diff --git a/.clang-format b/.clang-format index f3d4b9afd..d984ee12f 100644 --- a/.clang-format +++ b/.clang-format @@ -23,4 +23,4 @@ AllowShortEnumsOnASingleLine: false AlignEscapedNewlines: Left AlignTrailingComments: true SortIncludes: false -TypenameMacros: ['BAD_RETURN'] +TypenameMacros: ['BAD_RETURN', 'ALIGNED'] diff --git a/.gdbinit b/.gdbinit new file mode 100644 index 000000000..7b30b6cb4 --- /dev/null +++ b/.gdbinit @@ -0,0 +1,4 @@ +set remote noack-packet on +define target hookpost-remote + source tools/gdb_load_ovl.py +end diff --git a/.gitignore b/.gitignore index 8585eeebb..ce38c5189 100644 --- a/.gitignore +++ b/.gitignore @@ -19,15 +19,23 @@ notes/ baserom/ baseroms/*/segments/ docs/doxygen/ +build/*/cache/ *.elf +*.ram +*.sav *.sra +*.srm *.z64 *.n64 *.v64 *.map *.dump +*.wad out.txt *.ram +*.bin +F3DEX3/*.code +F3DEX3/*.data # Tool artifacts tools/mipspro7.2_compiler/ @@ -51,6 +59,7 @@ graphs/ *.fbx !*_custom* .extracted-assets.json +extracted/ # Docs !docs/tutorial/ diff --git a/F3DEX3/F3DEX3.code.bps b/F3DEX3/F3DEX3.code.bps new file mode 100644 index 000000000..32809196a Binary files /dev/null and b/F3DEX3/F3DEX3.code.bps differ diff --git a/F3DEX3/F3DEX3.data.bps b/F3DEX3/F3DEX3.data.bps new file mode 100644 index 000000000..7f237e3ae Binary files /dev/null and b/F3DEX3/F3DEX3.data.bps differ diff --git a/INSTALLATION.md b/INSTALLATION.md new file mode 100644 index 000000000..241645f10 --- /dev/null +++ b/INSTALLATION.md @@ -0,0 +1,109 @@ +# Installation + +We recommend using WSL on Windows, or native Linux, which the rest of this readme describes. We currently have instructions for + +* [Windows](#Windows), with and without WSL +* [macOS](docs/BUILDING_MACOS.md) +* [Linux](#Linux-Native-or-under-WSL--VM), natively or using WSL / VM +* [Docker](docs/BUILDING_DOCKER.md) + +(These will also depend on the Linux instructions.) +Some of these may also be out of date or unmaintained; usually our contributors use WSL, Linux, and macOS, so these instructions should be up to date. + +### Windows + +For Windows 10 or 11, install WSL and a distribution by following this +[WSL Installation Guide](https://docs.microsoft.com/en-us/windows/wsl/install). +We recommend using Ubuntu 20.04 as the Linux distribution. + +For older versions of Windows, install a Linux VM or refer to either [Cygwin](docs/BUILDING_CYGWIN.md) or [Docker](docs/BUILDING_DOCKER.md) instructions. + + +### Linux (Native or under WSL / VM) + +#### 1. Install build dependencies + +The build process has the following package requirements: + +* git +* build-essential +* binutils-mips-linux-gnu +* python3 +* python3-pip +* python3-venv +* libpng-dev +* gcc-mips-linux-gnu + +Under Debian / Ubuntu (which we recommend using), you can install them with the following commands: + +```bash +sudo apt-get update +sudo apt-get install git build-essential binutils-mips-linux-gnu python3 python3-pip python3-venv libpng-dev gcc-mips-linux-gnu +``` + +#### 2. Clone the repository + +**N.B.** If using WSL, we strongly encourage you to clone into WSL's Linux filesystem using Linux's `git`. +Cloning into the Windows filesystem will result in much slower read/write speeds, and often causes issues when Windows copies the files with the wrong line endings, which the compiler IDO cannot handle correctly. + +Clone `https://github.com/zeldaret/oot.git` where you wish to have the project, with a command such as: + +```bash +git clone https://github.com/zeldaret/oot.git +``` + +This will copy the GitHub repository contents into a new folder in the current directory called `oot`. Change into this directory before doing anything else: + +```bash +cd oot +``` + +#### 3. Prepare a base ROM + +Place a copy of the Master Quest (Debug) ROM inside the `baseroms/hackeroot-mq/` folder. + +Rename the file to `baserom.z64`, `baserom.n64` or `baserom.v64`, depending on the original extension. + +**NOTE:** to make a Wii VC build you will need to place a copy of the Ocarina of Time.wad file in this folder too, with the ``common-key.bin`` file. This project won't provide both. + +#### 4. Setup the ROM and build process + +Setup and extract everything from your ROM with the following command: + +```bash +make setup +``` + +This downloads some dependencies (from pip), and compiles tools for the build process. +Then it generates a new ROM "baseroms/hackeroot-mq/baserom-decompressed.z64" that will have the overdump removed and the header patched. +It will also extract the individual assets from the ROM. This command will also setup F3DEX3 binaries. + +**NOTE:** the decompressed baserom will be copied to ``baseroms/gc-eu-mq-dbg/``, this is a temporary solution. + +#### 5. Build the ROM + +Run make to build the ROM. +Make sure your path to the project is not too long, otherwise this process may error. + +```bash +make +``` + +If all goes well, a new ROM should be built at `build/hackeroot-mq/hackeroot-mq.z64`. + +**NOTE:** to speed up the build, you can either: + +* pass `-jN` to `make setup` and `make`, where N is the number of threads to use in the build. The generally-accepted wisdom is to use the number of virtual cores your computer has. +* pass `-j` to `make setup` and `make`, to use as many threads as possible, but beware that this can use too much memory on lower-end systems. + +Both of these have the disadvantage that the ordering of the terminal output is scrambled, so for debugging it is best to stick to one thread (i.e. not pass `-j` or `-jN`). + +#### 6. Creating a BPS patch + +To generate a .bps patch you can run the following command: + +```bash +make patch +``` + +The patch will be in the ``build/hackeroot-mq/`` folder. diff --git a/Makefile b/Makefile index b28d555d9..9ce878153 100644 --- a/Makefile +++ b/Makefile @@ -6,19 +6,33 @@ SHELL = /bin/bash # Build options can either be changed by modifying the makefile, or by building with 'make SETTING=value' -# If COMPARE is 1, check the output md5sum after building -COMPARE := 1 -# If NON_MATCHING is 1, define the NON_MATCHING C flag when building -NON_MATCHING := 0 -# If ORIG_COMPILER is 1, compile with QEMU_IRIX and the original compiler -ORIG_COMPILER := 0 -# If COMPILER is "gcc", compile with GCC instead of IDO. -COMPILER := ido +# currently, GCC is the only supported compiler +COMPILER := gcc + # Target game version. Currently only the following version is supported: -# gc-eu-mq-dbg GameCube Europe/PAL Master Quest Debug (default) +# gc-eu-mq-dbg GameCube Europe/PAL Master Quest Debug +# hackeroot-mq HackerOoT, based on gc-eu-mq-dbg (default) +# # The following versions are work-in-progress and not yet matching: # gc-eu-mq GameCube Europe/PAL Master Quest -VERSION := gc-eu-mq-dbg +# +# Note: choosing hackeroot-mq will enable HackerOoT features, +# if another version is chosen, this repo will be like +# zeldaret/main decomp but without the disassembly, decompilation +# and matching tools, including the IDO compiler +VERSION := hackeroot-mq + +# Enable optimization flags to use GDB on Ares +ARES_GDB := 1 + +# Toggle release or debug mode. 1=Release, 0=Debug +# Note: currently only used for HackerOoT +RELEASE := 0 + +# Valid compression algorithms are 'yaz', 'lzo' and 'aplib' +COMPRESSION ?= yaz +COMPRESSION_TYPE ?= $(shell echo $(COMPRESSION) | tr '[:lower:]' '[:upper:]') + # Number of threads to extract and compress with N_THREADS := $(shell nproc) # Check code syntax with host compiler @@ -27,37 +41,26 @@ RUN_CC_CHECK := 1 CFLAGS ?= CPPFLAGS ?= -# ORIG_COMPILER cannot be combined with a non-IDO compiler. Check for this case and error out if found. -ifneq ($(COMPILER),ido) - ifeq ($(ORIG_COMPILER),1) - $(error ORIG_COMPILER can only be used with the IDO compiler. Please check your Makefile variables and try again) - endif -endif - ifeq ($(COMPILER),gcc) - CFLAGS += -DCOMPILER_GCC - CPPFLAGS += -DCOMPILER_GCC - NON_MATCHING := 1 + CFLAGS += -DCOMPILER_GCC -DNON_MATCHING -DAVOID_UB + CPPFLAGS += -DCOMPILER_GCC -DNON_MATCHING -DAVOID_UB +else + $(error Unsupported compiler. Please use gcc as the COMPILER variable.) endif # Set prefix to mips binutils binaries (mips-linux-gnu-ld => 'mips-linux-gnu-') - Change at your own risk! # In nearly all cases, not having 'mips-linux-gnu-*' binaries on the PATH is indicative of missing dependencies MIPS_BINUTILS_PREFIX := mips-linux-gnu- -ifeq ($(NON_MATCHING),1) - CFLAGS += -DNON_MATCHING -DAVOID_UB - CPPFLAGS += -DNON_MATCHING -DAVOID_UB - COMPARE := 0 -endif - # Version-specific settings ifeq ($(VERSION),gc-eu-mq) DEBUG := 0 - CFLAGS += -DNON_MATCHING - CPPFLAGS += -DNON_MATCHING - COMPARE := 0 + HACKEROOT := 0 else ifeq ($(VERSION),gc-eu-mq-dbg) DEBUG := 1 + HACKEROOT := 0 +else ifeq ($(VERSION),hackeroot-mq) + HACKEROOT := 1 else $(error Unsupported version $(VERSION)) endif @@ -65,21 +68,70 @@ endif PROJECT_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) BUILD_DIR := build/$(VERSION) EXPECTED_DIR := expected/$(BUILD_DIR) +BASEROM_DIR := baseroms/$(VERSION) +EXTRACTED_DIR := extracted/$(VERSION) VENV := .venv MAKE = make -CPPFLAGS += -fno-dollars-in-identifiers -P +CPPFLAGS += -P -xc -fno-dollars-in-identifiers -ifeq ($(DEBUG),1) - CFLAGS += -DOOT_DEBUG=1 - CPPFLAGS += -DOOT_DEBUG=1 - OPTFLAGS := -O2 -else - CFLAGS += -DNDEBUG -DOOT_DEBUG=0 - CPPFLAGS += -DNDEBUG -DOOT_DEBUG=0 - OPTFLAGS := -O2 -g3 +# Set PACKAGE_VERSION define for printing commit hash +ifeq ($(origin PACKAGE_VERSION), undefined) + PACKAGE_VERSION := $(shell git log -1 --pretty=%h | tr -d '\n') + ifeq ('$(PACKAGE_VERSION)', '') + PACKAGE_VERSION = Unknown version + endif endif +# Set PACKAGE_AUTHOR define for printing author's git name +ifeq ($(origin PACKAGE_AUTHOR), undefined) + PACKAGE_AUTHOR := $(shell git config --get user.name) + ifeq ('$(PACKAGE_AUTHOR)', '') + PACKAGE_AUTHOR = Unknown author + endif +endif + +# Make sure the build reports the correct version +$(shell touch src/boot/build.c) + +ifeq ($(VERSION),hackeroot-mq) + CFLAGS += -DENABLE_HACKEROOT=1 + CPPFLAGS += -DENABLE_HACKEROOT=1 + OPTFLAGS := -Os + + ifeq ($(RELEASE),1) + CFLAGS += -DRELEASE_ROM=1 -DOOT_DEBUG=0 + CPPFLAGS += -DRELEASE_ROM=1 -DOOT_DEBUG=0 + else + CFLAGS += -DRELEASE_ROM=0 -DOOT_DEBUG=1 + CPPFLAGS += -DRELEASE_ROM=0 -DOOT_DEBUG=1 + endif +else + ifeq ($(DEBUG),1) + CFLAGS += -DOOT_DEBUG=1 + CPPFLAGS += -DOOT_DEBUG=1 + OPTFLAGS := -O2 + else + CFLAGS += -DNDEBUG -DOOT_DEBUG=0 + CPPFLAGS += -DNDEBUG -DOOT_DEBUG=0 + OPTFLAGS := -O2 -g3 + endif + + CFLAGS += -DENABLE_HACKEROOT=0 + CPPFLAGS += -DENABLE_HACKEROOT=0 +endif + +# Override optimization flags if using GDB +ifeq ($(ARES_GDB),1) + OPTFLAGS := -Og -ggdb3 +endif + +# Define author and package version for every OoT version +# Note: this won't be used if not using HackerOoT +CFLAGS += -DPACKAGE_AUTHOR='$(PACKAGE_AUTHOR)' -DPACKAGE_VERSION='$(PACKAGE_VERSION)' -DCOMPRESS_$(COMPRESSION_TYPE)=1 +CPPFLAGS += -DPACKAGE_AUTHOR='$(PACKAGE_AUTHOR)' -DPACKAGE_VERSION='$(PACKAGE_VERSION)' -DCOMPRESS_$(COMPRESSION_TYPE)=1 +OPTFLAGS += -ffast-math -fno-unsafe-math-optimizations + ifeq ($(OS),Windows_NT) DETECTED_OS=windows else @@ -90,7 +142,6 @@ else ifeq ($(UNAME_S),Darwin) DETECTED_OS=macos MAKE=gmake - CPPFLAGS += -xc++ endif endif @@ -102,23 +153,8 @@ endif # Detect compiler and set variables appropriately. ifeq ($(COMPILER),gcc) CC := $(MIPS_BINUTILS_PREFIX)gcc -else ifeq ($(COMPILER),ido) - CC := tools/ido_recomp/$(DETECTED_OS)/7.1/cc - CC_OLD := tools/ido_recomp/$(DETECTED_OS)/5.3/cc else -$(error Unsupported compiler. Please use either ido or gcc as the COMPILER variable.) -endif - -# if ORIG_COMPILER is 1, check that either QEMU_IRIX is set or qemu-irix package installed -ifeq ($(ORIG_COMPILER),1) - ifndef QEMU_IRIX - QEMU_IRIX := $(shell which qemu-irix) - ifeq (, $(QEMU_IRIX)) - $(error Please install qemu-irix package or set QEMU_IRIX env var to the full qemu-irix binary path) - endif - endif - CC = $(QEMU_IRIX) -L tools/ido7.1_compiler tools/ido7.1_compiler/usr/bin/cc - CC_OLD = $(QEMU_IRIX) -L tools/ido5.3_compiler tools/ido5.3_compiler/usr/bin/cc +$(error Unsupported compiler. Please use gcc as the COMPILER variable.) endif AS := $(MIPS_BINUTILS_PREFIX)as @@ -129,75 +165,57 @@ NM := $(MIPS_BINUTILS_PREFIX)nm N64_EMULATOR ?= -INC := -Iinclude -Iinclude/libc -Isrc -I$(BUILD_DIR) -I. +INC := -Iinclude -Iinclude/libc -Isrc -I$(BUILD_DIR) -I. -I$(EXTRACTED_DIR) # Check code syntax with host compiler CHECK_WARNINGS := -Wall -Wextra -Wno-format-security -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces -CPP := cpp +# The `cpp` command behaves differently on macOS (it behaves as if +# `-traditional-cpp` was passed) so we use `gcc -E` instead. +CPP := gcc -E MKLDSCRIPT := tools/mkldscript MKDMADATA := tools/mkdmadata ELF2ROM := tools/elf2rom ZAPD := tools/ZAPD/ZAPD.out FADO := tools/fado/fado.elf PYTHON ?= $(VENV)/bin/python3 +FLIPS := tools/Flips/flips # Command to replace path variables in the spec file. We can't use the C # preprocessor for this because it won't substitute inside string literals. SPEC_REPLACE_VARS := sed -e 's|$$(BUILD_DIR)|$(BUILD_DIR)|g' -ifeq ($(COMPILER),gcc) - OPTFLAGS := -Os -ffast-math -fno-unsafe-math-optimizations -endif - ASFLAGS := -march=vr4300 -32 -no-pad-sections -Iinclude ifeq ($(COMPILER),gcc) - CFLAGS += -G 0 -nostdinc $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-zero-initialized-in-bss -fno-toplevel-reorder -ffreestanding -fno-common -fno-merge-constants -mno-explicit-relocs -mno-split-addresses $(CHECK_WARNINGS) -funsigned-char + CFLAGS += -G 0 -nostdinc $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-PIC -fno-common -ffreestanding -fbuiltin -fno-builtin-sinf -fno-builtin-cosf $(CHECK_WARNINGS) -funsigned-char MIPS_VERSION := -mips3 -else - # Suppress warnings for wrong number of macro arguments (to fake variadic - # macros) and Microsoft extensions such as anonymous structs (which the - # compiler does support but warns for their usage). - CFLAGS += -G 0 -non_shared -fullwarn -verbose -Xcpluscomm $(INC) -Wab,-r4300_mul -woff 516,609,649,838,712 - MIPS_VERSION := -mips2 -endif - -ifeq ($(COMPILER),ido) - # Have CC_CHECK pretend to be a MIPS compiler - MIPS_BUILTIN_DEFS := -D_MIPS_ISA_MIPS2=2 -D_MIPS_ISA=_MIPS_ISA_MIPS2 -D_ABIO32=1 -D_MIPS_SIM=_ABIO32 -D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32 - CC_CHECK = gcc -fno-builtin -fsyntax-only -funsigned-char -std=gnu90 -D_LANGUAGE_C -DNON_MATCHING -DOOT_DEBUG=1 $(MIPS_BUILTIN_DEFS) $(INC) $(CHECK_WARNINGS) - ifeq ($(shell getconf LONG_BIT), 32) - # Work around memory allocation bug in QEMU - export QEMU_GUEST_BASE := 1 - else - # Ensure that gcc (warning check) treats the code as 32-bit - CC_CHECK += -m32 - endif -else RUN_CC_CHECK := 0 endif OBJDUMP_FLAGS := -d -r -z -Mreg-names=32 -DISASM_DATA_DIR := tools/disasm/$(VERSION) -DISASM_FLAGS += --custom-suffix _unknown --sequential-label-names --no-use-fpccsr --no-cop0-named-registers -DISASM_FLAGS += --config-dir $(DISASM_DATA_DIR) --symbol-addrs $(DISASM_DATA_DIR)/functions.txt --symbol-addrs $(DISASM_DATA_DIR)/variables.txt - #### Files #### # ROM image -ROM := $(BUILD_DIR)/oot-$(VERSION).z64 -ROMC := $(ROM:.z64=-compressed.z64) +ifeq ($(VERSION),hackeroot-mq) + ROM := $(BUILD_DIR)/$(VERSION).z64 +else + ROM := $(BUILD_DIR)/oot-$(VERSION).z64 +endif +ROMC := $(ROM:.z64=-compressed-$(COMPRESSION).z64) +WAD := $(ROM:.z64=.wad) +BPS := $(ROM:.z64=.bps) ELF := $(ROM:.z64=.elf) MAP := $(ROM:.z64=.map) LDSCRIPT := $(ROM:.z64=.ld) # description of ROM segments SPEC := spec -ifeq ($(COMPILER),ido) -SRC_DIRS := $(shell find src -type d -not -path src/gcc_fix) -else +# Baserom to use when creating BPS patches +BASEROM_PATCH ?= baseroms/$(VERSION)/baserom.z64 + +ifeq ($(COMPILER),gcc) SRC_DIRS := $(shell find src -type d) endif @@ -210,9 +228,7 @@ ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_XML:.xml=.c),$f) \ UNDECOMPILED_DATA_DIRS := $(shell find data -type d) -# TODO: for now, ROM segments are still taken from the Debug ROM even when building other versions -BASEROM_SEGMENTS_DIR := baseroms/gc-eu-mq-dbg/segments -BASEROM_BIN_FILES := $(wildcard $(BASEROM_SEGMENTS_DIR)/*) +BASEROM_BIN_FILES := $(wildcard $(EXTRACTED_DIR)/baserom/*) # source files C_FILES := $(filter-out %.inc.c,$(foreach dir,$(SRC_DIRS) $(ASSET_BIN_DIRS),$(wildcard $(dir)/*.c))) @@ -223,11 +239,6 @@ O_FILES := $(foreach f,$(S_FILES:.s=.o),$(BUILD_DIR)/$f) \ OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(SPEC_REPLACE_VARS) | grep -o '[^"]*_reloc.o' ) -DISASM_BASEROM := baseroms/$(VERSION)/baserom-decompressed.z64 -DISASM_DATA_FILES := $(wildcard $(DISASM_DATA_DIR)/*.csv) $(wildcard $(DISASM_DATA_DIR)/*.txt) -DISASM_S_FILES := $(shell test -e $(PYTHON) && $(PYTHON) tools/disasm/list_generated_files.py -o $(EXPECTED_DIR) --config-dir $(DISASM_DATA_DIR)) -DISASM_O_FILES := $(DISASM_S_FILES:.s=.o) - # Automatic dependency files # (Only asm_processor dependencies and reloc dependencies are handled for now) DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d) @@ -239,92 +250,19 @@ TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG:.png=.inc.c),$(BUILD_DIR)/$ $(foreach f,$(TEXTURE_FILES_JPG:.jpg=.jpg.inc.c),$(BUILD_DIR)/$f) \ # create build directories -$(shell mkdir -p $(BUILD_DIR)/baserom $(BUILD_DIR)/assets/text $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS) $(ASSET_BIN_DIRS),$(BUILD_DIR)/$(dir))) +$(shell mkdir -p $(BUILD_DIR)/baserom $(EXTRACTED_DIR)/text $(BUILD_DIR)/assets/text $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS) $(ASSET_BIN_DIRS),$(BUILD_DIR)/$(dir))) -ifeq ($(COMPILER),ido) -$(BUILD_DIR)/src/boot/stackcheck.o: OPTFLAGS := -O2 +ifeq ($(COMPILER),gcc) +# Note that if adding additional assets directories for modding reasons these flags must also be used there + $(BUILD_DIR)/assets/%.o: CFLAGS += -fno-zero-initialized-in-bss -fno-toplevel-reorder + $(BUILD_DIR)/src/%.o: CFLAGS += -fexec-charset=utf-8 + $(BUILD_DIR)/src/libultra/libc/ll.o: OPTFLAGS := -Ofast + $(BUILD_DIR)/src/overlays/%.o: CFLAGS += -fno-merge-constants -mno-explicit-relocs -mno-split-addresses -$(BUILD_DIR)/src/code/__osMalloc.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/code_800FC620.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/code_800FCE80.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/code_800FD970.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/gfxprint.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/jpegutils.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/jpegdecoder.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/load.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/loadfragment2.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/logutils.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/mtxuty-cvt.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/padsetup.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/padutils.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/printutils.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/relocation.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/sleep.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/system_malloc.o: OPTFLAGS := -O2 - -$(BUILD_DIR)/src/code/fault.o: CFLAGS += -trapuv -$(BUILD_DIR)/src/code/fault.o: OPTFLAGS := -O2 -g3 -$(BUILD_DIR)/src/code/fault_drawer.o: CFLAGS += -trapuv -$(BUILD_DIR)/src/code/fault_drawer.o: OPTFLAGS := -O2 -g3 -$(BUILD_DIR)/src/code/ucode_disas.o: OPTFLAGS := -O2 -g3 - -ifeq ($(DEBUG),1) -$(BUILD_DIR)/src/code/fmodf.o: OPTFLAGS := -g -$(BUILD_DIR)/src/code/__osMemset.o: OPTFLAGS := -g -$(BUILD_DIR)/src/code/__osMemmove.o: OPTFLAGS := -g -else -$(BUILD_DIR)/src/code/fmodf.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/__osMemset.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/__osMemmove.o: OPTFLAGS := -O2 -endif - -$(BUILD_DIR)/src/audio/%.o: OPTFLAGS := -O2 - -# Use signed chars instead of unsigned for this audio file (needed to match AudioDebug_ScrPrt) -$(BUILD_DIR)/src/audio/general.o: CFLAGS += -signed - -# Put string literals in .data for some audio files (needed to match these files with literals) -$(BUILD_DIR)/src/audio/sfx.o: CFLAGS += -use_readwrite_const -$(BUILD_DIR)/src/audio/sequence.o: CFLAGS += -use_readwrite_const - -ifeq ($(DEBUG),1) -$(BUILD_DIR)/src/libultra/libc/absf.o: OPTFLAGS := -O2 -g3 -$(BUILD_DIR)/src/libultra/libc/sqrt.o: OPTFLAGS := -O2 -g3 -else -$(BUILD_DIR)/src/libultra/libc/absf.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/libultra/libc/sqrt.o: OPTFLAGS := -O2 -endif - -$(BUILD_DIR)/src/libultra/libc/ll.o: OPTFLAGS := -O1 -$(BUILD_DIR)/src/libultra/libc/ll.o: MIPS_VERSION := -mips3 -32 -$(BUILD_DIR)/src/libultra/libc/llcvt.o: OPTFLAGS := -O1 -$(BUILD_DIR)/src/libultra/libc/llcvt.o: MIPS_VERSION := -mips3 -32 - -$(BUILD_DIR)/src/libultra/os/%.o: OPTFLAGS := -O1 -$(BUILD_DIR)/src/libultra/io/%.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/libultra/libc/%.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/libultra/rmon/%.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/libultra/gu/%.o: OPTFLAGS := -O2 - -$(BUILD_DIR)/assets/misc/z_select_static/%.o: CFLAGS += -DF3DEX_GBI - -$(BUILD_DIR)/src/libultra/gu/%.o: CC := $(CC_OLD) -$(BUILD_DIR)/src/libultra/io/%.o: CC := $(CC_OLD) -$(BUILD_DIR)/src/libultra/libc/%.o: CC := $(CC_OLD) -$(BUILD_DIR)/src/libultra/os/%.o: CC := $(CC_OLD) -$(BUILD_DIR)/src/libultra/rmon/%.o: CC := $(CC_OLD) - -$(BUILD_DIR)/src/code/jpegutils.o: CC := $(CC_OLD) -$(BUILD_DIR)/src/code/jpegdecoder.o: CC := $(CC_OLD) - -$(BUILD_DIR)/src/boot/%.o: CC := $(PYTHON) tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) -- -$(BUILD_DIR)/src/code/%.o: CC := $(PYTHON) tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) -- -$(BUILD_DIR)/src/overlays/%.o: CC := $(PYTHON) tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) -- - -$(BUILD_DIR)/assets/%.o: CC := $(PYTHON) tools/asm_processor/build.py $(CC) -- $(AS) $(ASFLAGS) -- -else -$(BUILD_DIR)/src/libultra/libc/ll.o: OPTFLAGS := -Ofast -$(BUILD_DIR)/src/%.o: CC := $(CC) -fexec-charset=euc-jp + $(BUILD_DIR)/src/overlays/actors/ovl_Item_Shield/%.o: OPTFLAGS := -O2 + $(BUILD_DIR)/src/overlays/actors/ovl_En_Part/%.o: OPTFLAGS := -O2 + $(BUILD_DIR)/src/overlays/actors/ovl_Item_B_Heart/%.o: OPTFLAGS := -O0 + $(BUILD_DIR)/src/overlays/actors/ovl_Bg_Mori_Hineri/%.o: OPTFLAGS := -O0 endif #### Main Targets ### @@ -332,29 +270,35 @@ endif all: rom compress rom: $(ROM) -ifneq ($(COMPARE),0) - @md5sum $(ROM) - @md5sum -c baseroms/$(VERSION)/checksum.md5 -endif -compress: $(ROMC) -ifneq ($(COMPARE),0) - @md5sum $(ROMC) - @md5sum -c baseroms/$(VERSION)/checksum-compressed.md5 +compress: +# make sure z_std_dma.c and spec are up-to-date + $(shell touch spec) + $(shell touch src/boot/z_std_dma.c) + $(MAKE) $(ROMC) + +wad: +ifeq ("$(wildcard baseroms/$(VERSION)/common-key.bin)", "") + $(error Please provide the common-key.bin file.) endif + $(MAKE) compress CFLAGS="-DCONSOLE_WIIVC $(CFLAGS) -fno-reorder-blocks -fno-optimize-sibling-calls" CPPFLAGS="-DCONSOLE_WIIVC $(CPPFLAGS)" + tools/gzinject/gzinject -a inject -r 1 -k baseroms/$(VERSION)/common-key.bin -w baseroms/$(VERSION)/basewad.wad -m $(ROMC) -o $(WAD) -t "HackerOoT" -i NHOE -p tools/gzinject/patches/NACE.gzi -p tools/gzinject/patches/gz_default_remap.gzi + $(RM) -r wadextract/ clean: $(RM) -r $(BUILD_DIR) assetclean: $(RM) -r $(ASSET_BIN_DIRS) - $(RM) -r assets/text/*.h + $(RM) -r $(EXTRACTED_DIR) $(RM) -r $(BUILD_DIR)/assets $(RM) -r .extracted-assets.json -distclean: clean assetclean - $(RM) -r $(BASEROM_SEGMENTS_DIR) +distclean: assetclean + $(RM) -r extracted/ + $(RM) -r build/ $(MAKE) -C tools distclean + $(RM) -r F3DEX3/F3DEX3.code F3DEX3/F3DEX3.data venv: # Create the virtual environment if it doesn't exist. @@ -366,13 +310,13 @@ venv: setup: venv $(MAKE) -C tools $(PYTHON) tools/decompress_baserom.py $(VERSION) -# TODO: for now, we only extract ROM segments and assets from the Debug ROM -ifeq ($(VERSION),gc-eu-mq-dbg) - $(PYTHON) extract_baserom.py - $(PYTHON) extract_assets.py -j$(N_THREADS) + $(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 -o $(EXTRACTED_DIR)/baserom --dmadata-start `cat $(BASEROM_DIR)/dmadata_start.txt` --dmadata-names $(BASEROM_DIR)/dmadata_names.txt + $(PYTHON) tools/msgdis.py --oot-version $(VERSION) --text-out $(EXTRACTED_DIR)/text/message_data.h --staff-text-out $(EXTRACTED_DIR)/text/message_data_staff.h +# TODO: for now, we only extract assets from the Debug ROM +ifneq ($(VERSION),gc-eu-mq) + $(PYTHON) extract_assets.py -j$(N_THREADS) -v $(VERSION) endif - -disasm: $(DISASM_O_FILES) + $(MAKE) f3dex3 run: $(ROM) ifeq ($(N64_EMULATOR),) @@ -380,8 +324,17 @@ ifeq ($(N64_EMULATOR),) endif $(N64_EMULATOR) $< +patch: + $(FLIPS) --create --bps $(BASEROM_PATCH) $(ROM) $(BPS) -.PHONY: all rom compress clean assetclean distclean venv setup disasm run +f3dex3: + $(PYTHON) tools/data_extractor.py --start 0xBCD0F0 --size 0x1630 --input $(BASEROM_DIR)/baserom-decompressed.z64 --output F3DEX3/f3dzex2.code + $(PYTHON) tools/data_extractor.py --start 0xBCE720 --size 0x420 --input $(BASEROM_DIR)/baserom-decompressed.z64 --output F3DEX3/f3dzex2.data + $(FLIPS) --apply F3DEX3/F3DEX3.code.bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3.code + $(FLIPS) --apply F3DEX3/F3DEX3.data.bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3.data + $(RM) -r F3DEX3/f3dzex2.code F3DEX3/f3dzex2.data + +.PHONY: all rom compress clean assetclean distclean venv setup run wad patch f3dex3 .DEFAULT_GOAL := rom #### Various Recipes #### @@ -390,8 +343,11 @@ $(ROM): $(ELF) $(ELF2ROM) -cic 6105 $< $@ $(ROMC): $(ROM) $(ELF) $(BUILD_DIR)/compress_ranges.txt -# note: $(BUILD_DIR)/compress_ranges.txt should only be used for nonmatching builds. it works by chance for matching builds too though - $(PYTHON) tools/compress.py --in $(ROM) --out $@ --dma-range `./tools/dmadata_range.sh $(NM) $(ELF)` --compress `cat $(BUILD_DIR)/compress_ranges.txt` --threads $(N_THREADS) +ifeq ($(COMPRESSION),yaz) + $(PYTHON) tools/compress.py --in $(ROM) --out $@ --dmadata-start `./tools/dmadata_range.sh $(NM) $(ELF)` --compress `cat $(BUILD_DIR)/compress_ranges.txt` --threads $(N_THREADS) +else + $(PYTHON) tools/z64compress_wrapper.py --codec $(COMPRESSION) --cache $(BUILD_DIR)/cache --threads $(N_THREADS) $< $@ $(ELF) $(BUILD_DIR)/$(SPEC) +endif $(PYTHON) -m ipl3checksum sum --cic 6105 --update $@ $(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(LDSCRIPT) $(BUILD_DIR)/undefined_syms.txt @@ -418,14 +374,16 @@ $(LDSCRIPT): $(BUILD_DIR)/$(SPEC) $(BUILD_DIR)/undefined_syms.txt: undefined_syms.txt $(CPP) $(CPPFLAGS) $< > $@ -$(BUILD_DIR)/baserom/%.o: $(BASEROM_SEGMENTS_DIR)/% +$(BUILD_DIR)/baserom/%.o: $(EXTRACTED_DIR)/baserom/% $(OBJCOPY) -I binary -O elf32-big $< $@ $(BUILD_DIR)/data/%.o: data/%.s $(AS) $(ASFLAGS) $< -o $@ -$(BUILD_DIR)/assets/text/%.enc.h: assets/text/%.h assets/text/charmap.txt - $(PYTHON) tools/msgenc.py assets/text/charmap.txt $< $@ +$(BUILD_DIR)/data/rsp.rodata.f3dex3.o: F3DEX3/F3DEX3.code F3DEX3/F3DEX3.data + +$(BUILD_DIR)/assets/text/%.enc.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h assets/text/charmap.txt + $(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py - --output $@ --charmap assets/text/charmap.txt # Dependencies for files including message data headers # TODO remove when full header dependencies are used. @@ -495,13 +453,6 @@ $(BUILD_DIR)/assets/%.bin.inc.c: assets/%.bin $(BUILD_DIR)/assets/%.jpg.inc.c: assets/%.jpg $(ZAPD) bren -eh -i $< -o $@ -$(EXPECTED_DIR)/.disasm: $(DISASM_DATA_FILES) - $(PYTHON) tools/disasm/disasm.py $(DISASM_FLAGS) $(DISASM_BASEROM) -o $(EXPECTED_DIR) --split-functions $(EXPECTED_DIR)/functions - touch $@ - -$(EXPECTED_DIR)/%.o: $(EXPECTED_DIR)/.disasm - $(AS) $(ASFLAGS) $(@:.o=.s) -o $@ - -include $(DEP_FILES) # Print target for debugging diff --git a/README.md b/README.md index 8e9b44817..08694cefd 100644 --- a/README.md +++ b/README.md @@ -1,157 +1,58 @@ -# The Legend of Zelda: Ocarina of Time +# Hacker Zelda: Ocarina of Time (HackerOoT) -[![Build Status][jenkins-badge]][jenkins] [![Decompilation Progress][progress-badge]][progress] [![Contributors][contributors-badge]][contributors] [![Discord Channel][discord-badge]][discord] +[![Contributors][contributors-badge]][contributors] -[jenkins]: https://jenkins.deco.mp/job/OOT/job/main -[jenkins-badge]: https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fjenkins.deco.mp%2Fjob%2FOOT%2Fjob%2Fmain +[contributors]: https://github.com/HackerN64/HackerOoT/graphs/contributors +[contributors-badge]: https://img.shields.io/github/contributors/HackerN64/HackerOoT -[progress]: https://zelda64.dev/games/oot -[progress-badge]: https://img.shields.io/endpoint?url=https://zelda64.dev/assets/csv/progress-oot-shield.json - -[contributors]: https://github.com/zeldaret/oot/graphs/contributors -[contributors-badge]: https://img.shields.io/github/contributors/zeldaret/oot - -[discord]: https://discord.zelda64.dev -[discord-badge]: https://img.shields.io/discord/688807550715560050?color=%237289DA&logo=discord&logoColor=%23FFFFFF - -```diff -- WARNING! - - -This repository is a work in progress, and while it can be used to make certain changes, it's still -constantly evolving. If you use it for modding purposes in its current state, please be aware that -the codebase can drastically change at any time. Also note that some parts of the ROM may not be -'shiftable' yet, so modifying them could be difficult at this point. -``` - -This is a WIP **decompilation** of ***The Legend of Zelda: Ocarina of Time***. The purpose of the project is to recreate a source code base for the game from scratch, using information found inside the game along with static and/or dynamic analysis. **It is not producing a PC port.** For more information you can get in touch with the team on our [Discord server](https://discord.zelda64.dev). +This project, based on the [Zelda: Ocarina of Time decompilation project](https://github.com/zeldaret/oot/), aims to be an easy-to-use base to make Zelda: Ocarina of Time mods. **It is not producing a PC port.** The only build currently supported is Master Quest (Debug), but other versions are planned to be supported. It builds the following ROM: -* oot-gc-eu-mq-dbg.z64 `md5: f0b7f35375f9cc8ca1b2d59d78e35405` +* hackeroot-mq.z64 + +This project is using the following tools: +- [F3DEX3](https://github.com/HackerN64/F3DEX3), *will make you want to finally ditch HLE*, by Sauraen +- [gzinject](https://github.com/krimtonz/gzinject), *injector for gz*, by krimtonz +- [z64compress](https://github.com/z64tools/z64compress), *the fastest Zelda 64 rom compressor*, by z64tools +- [Flips](https://github.com/Alcaro/Flips), *patcher for IPS and BPS files*, by Alcaro **Note: This repository does not include any of the assets necessary to build the ROM. A prior copy of the game is required to extract the needed assets.** +## HackerN64 + +**Discord:** + +## Zelda: Ocarina of Time Decompilation + **Website:** **Discord:** ## Installation -We recommend using WSL on Windows, or native Linux, which the rest of this readme describes. We currently have instructions for - -* [Windows](#Windows), with and without WSL -* [macOS](docs/BUILDING_MACOS.md) -* [Linux](#Linux-Native-or-under-WSL--VM), natively or using WSL / VM -* [Docker](docs/BUILDING_DOCKER.md) - -(These will also depend on the Linux instructions.) -Some of these may also be out of date or unmaintained; usually our contributors use WSL, Linux, and macOS, so these instructions should be up to date. - -### Windows - -For Windows 10 or 11, install WSL and a distribution by following this -[WSL Installation Guide](https://docs.microsoft.com/en-us/windows/wsl/install). -We recommend using Ubuntu 20.04 as the Linux distribution. - -For older versions of Windows, install a Linux VM or refer to either [Cygwin](docs/BUILDING_CYGWIN.md) or [Docker](docs/BUILDING_DOCKER.md) instructions. - - -### Linux (Native or under WSL / VM) - -#### 1. Install build dependencies - -The build process has the following package requirements: - -* git -* build-essential -* binutils-mips-linux-gnu -* python3 -* python3-pip -* python3-venv -* libpng-dev - -Under Debian / Ubuntu (which we recommend using), you can install them with the following commands: - -```bash -sudo apt-get update -sudo apt-get install git build-essential binutils-mips-linux-gnu python3 python3-pip python3-venv libpng-dev -``` - -If you are using GCC as the compiler for Ocarina of Time, you will also need: - -* gcc-mips-linux-gnu - -#### 2. Clone the repository - -**N.B.** If using WSL, we strongly encourage you to clone into WSL's Linux filesystem using Linux's `git`. -Cloning into the Windows filesystem will result in much slower read/write speeds, and often causes issues when Windows copies the files with the wrong line endings, which the compiler IDO cannot handle correctly. - -Clone `https://github.com/zeldaret/oot.git` where you wish to have the project, with a command such as: - -```bash -git clone https://github.com/zeldaret/oot.git -``` - -This will copy the GitHub repository contents into a new folder in the current directory called `oot`. Change into this directory before doing anything else: - -```bash -cd oot -``` - -#### 3. Prepare a base ROM - -Place a copy of the Master Quest (Debug) ROM inside the `baseroms/gc-eu-mq-dbg/` folder. - -Rename the file to `baserom.z64`, `baserom.n64` or `baserom.v64`, depending on the original extension. - -#### 4. Setup the ROM and build process - -Setup and extract everything from your ROM with the following command: - -```bash -make setup -``` - -This downloads some dependencies (from pip), and compiles tools for the build process. -Then it generates a new ROM "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64" that will have the overdump removed and the header patched. -It will also extract the individual assets from the ROM. - -#### 5. Build the ROM - -Run make to build the ROM. -Make sure your path to the project is not too long, otherwise this process may error. - -```bash -make -``` - -If all goes well, a new ROM should be built at `build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64`, and the following text printed: - -```bash -build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64: OK -``` - -If you instead see the following: - -```bash -build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64: FAILED -md5sum: WARNING: 1 computed checksum did NOT match -``` - -This means that the built ROM isn't the same as the base one, so something went wrong or some part of the code doesn't match. - -**NOTE:** to speed up the build, you can either: - -* pass `-jN` to `make setup` and `make`, where N is the number of threads to use in the build. The generally-accepted wisdom is to use the number of virtual cores your computer has. -* pass `-j` to `make setup` and `make`, to use as many threads as possible, but beware that this can use too much memory on lower-end systems. - -Both of these have the disadvantage that the ordering of the terminal output is scrambled, so for debugging it is best to stick to one thread (i.e. not pass `-j` or `-jN`). +Instructions to build this project are available [here](INSTALLATION.md). ## Contributing All contributions are welcome. This is a group effort, and even small contributions can make a difference. Some tasks also don't require much knowledge to get started. -Most discussions happen on our [Discord Server](https://discord.zelda64.dev), where you are welcome to ask if you need help getting started, or if you have any questions regarding this project and other decompilation projects. +Most discussions happen on our [Discord Server](https://discord.gg/brETAakcXr), where you are welcome to ask if you need help getting started, or if you have any questions regarding this project. **Feel free to ask any kind of questions.** + +## Contributors + +List of every HackerOoT contributors, from most recent to oldest contribution: + +- recardo-7 +- HailToDodongo +- CrashOverride95 +- Trueffell +- Yanis42 +- kurethedead +- zelllll +- ariahiro64 +- ghost +- krm01 diff --git a/assets/.gitignore b/assets/.gitignore index e5633a649..0bece9e89 100644 --- a/assets/.gitignore +++ b/assets/.gitignore @@ -1,7 +1,7 @@ *.bin *.c -!text/*.c *.h +!text/*.[ch] *.cfg *.vtx.inc *.dlist.inc diff --git a/assets/text/fra_message_data_static.c b/assets/text/fra_message_data_static.c index abad26c54..944d9f03f 100644 --- a/assets/text/fra_message_data_static.c +++ b/assets/text/fra_message_data_static.c @@ -5,4 +5,6 @@ #define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \ const char _message_##textId##_fra[sizeof(fraMessage)] = { fraMessage END }; +#define DEFINE_MESSAGE_NES(textId, type, yPos, nesMessage) + #include "assets/text/message_data.enc.h" diff --git a/assets/text/ger_message_data_static.c b/assets/text/ger_message_data_static.c index c4b8229a0..9d3e190bc 100644 --- a/assets/text/ger_message_data_static.c +++ b/assets/text/ger_message_data_static.c @@ -5,4 +5,6 @@ #define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \ const char _message_##textId##_ger[sizeof(gerMessage)] = { gerMessage END }; +#define DEFINE_MESSAGE_NES(textId, type, yPos, nesMessage) + #include "assets/text/message_data.enc.h" diff --git a/assets/text/message_data.h b/assets/text/message_data.h new file mode 100644 index 000000000..57a0859b5 --- /dev/null +++ b/assets/text/message_data.h @@ -0,0 +1,16 @@ +#include "text/message_data.h" + +/* + * The following two messages should be kept last and in this order. + * Message 0xFFFD must be last to not break the message debugger (see R_MESSAGE_DEBUGGER_TEXTID). + * Message 0xFFFC must be immediately before message 0xFFFD to not break Font_LoadOrderedFont. + */ +DEFINE_MESSAGE_NES(0xFFFC, TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE, +"0123456789\n" +"ABCDEFGHIJKLMN\n" +"OPQRSTUVWXYZ\n" +"abcdefghijklmn\n" +"opqrstuvwxyz\n" +" -.\n" +) +DEFINE_MESSAGE(0xFFFD, TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE, "", "", "") diff --git a/assets/text/message_data_staff.h b/assets/text/message_data_staff.h new file mode 100644 index 000000000..c282d7f7d --- /dev/null +++ b/assets/text/message_data_staff.h @@ -0,0 +1 @@ +#include "text/message_data_staff.h" diff --git a/assets/text/nes_message_data_static.c b/assets/text/nes_message_data_static.c index 2c37692d2..ff14d66b8 100644 --- a/assets/text/nes_message_data_static.c +++ b/assets/text/nes_message_data_static.c @@ -5,8 +5,6 @@ #define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \ const char _message_##textId##_nes[sizeof(nesMessage)] = { nesMessage END }; -#define DEFINE_MESSAGE_FFFC +#define DEFINE_MESSAGE_NES(textId, type, yPos, nesMessage) DEFINE_MESSAGE(textId, type, yPos, nesMessage, , ) #include "assets/text/message_data.enc.h" - -#undef DEFINE_MESSAGE_FFFC diff --git a/assets/xml/objects/object_link_boy.xml b/assets/xml/objects/object_link_boy.xml index cbdeaab2d..7e7d50c08 100644 --- a/assets/xml/objects/object_link_boy.xml +++ b/assets/xml/objects/object_link_boy.xml @@ -225,17 +225,17 @@ - - - - - + + + + + - - - - + + + + diff --git a/assets/xml/objects/object_link_child.xml b/assets/xml/objects/object_link_child.xml index 23a07b385..046be98ff 100644 --- a/assets/xml/objects/object_link_child.xml +++ b/assets/xml/objects/object_link_child.xml @@ -186,17 +186,17 @@ - - - - - + + + + + - - - - + + + + diff --git a/assets/xml/scenes/dungeons/ganon_tou.xml b/assets/xml/scenes/dungeons/ganon_tou.xml index 6642a8902..11b67b47e 100644 --- a/assets/xml/scenes/dungeons/ganon_tou.xml +++ b/assets/xml/scenes/dungeons/ganon_tou.xml @@ -3,6 +3,7 @@ + diff --git a/assets/xml/scenes/dungeons/jyasinzou.xml b/assets/xml/scenes/dungeons/jyasinzou.xml index 556f99900..5614bc893 100644 --- a/assets/xml/scenes/dungeons/jyasinzou.xml +++ b/assets/xml/scenes/dungeons/jyasinzou.xml @@ -4,6 +4,8 @@ + + diff --git a/assets/xml/scenes/indoors/daiyousei_izumi.xml b/assets/xml/scenes/indoors/daiyousei_izumi.xml index e9c8d7ef5..0c5ce3143 100644 --- a/assets/xml/scenes/indoors/daiyousei_izumi.xml +++ b/assets/xml/scenes/indoors/daiyousei_izumi.xml @@ -4,6 +4,7 @@ + diff --git a/assets/xml/scenes/indoors/hairal_niwa.xml b/assets/xml/scenes/indoors/hairal_niwa.xml index ff8fab363..2ae5add65 100644 --- a/assets/xml/scenes/indoors/hairal_niwa.xml +++ b/assets/xml/scenes/indoors/hairal_niwa.xml @@ -2,6 +2,7 @@ + diff --git a/assets/xml/scenes/misc/hiral_demo.xml b/assets/xml/scenes/misc/hiral_demo.xml index 1331fdd4c..32c55fac4 100644 --- a/assets/xml/scenes/misc/hiral_demo.xml +++ b/assets/xml/scenes/misc/hiral_demo.xml @@ -1,6 +1,9 @@ + + + diff --git a/assets/xml/scenes/overworld/spot00.xml b/assets/xml/scenes/overworld/spot00.xml index 7e94ff3a6..0ffdc1887 100644 --- a/assets/xml/scenes/overworld/spot00.xml +++ b/assets/xml/scenes/overworld/spot00.xml @@ -9,6 +9,7 @@ + diff --git a/assets/xml/scenes/overworld/spot15.xml b/assets/xml/scenes/overworld/spot15.xml index f17e76d55..3998cdc42 100644 --- a/assets/xml/scenes/overworld/spot15.xml +++ b/assets/xml/scenes/overworld/spot15.xml @@ -2,6 +2,7 @@ + diff --git a/assets/xml/scenes/overworld/spot16.xml b/assets/xml/scenes/overworld/spot16.xml index b6a105c65..57a64323b 100644 --- a/assets/xml/scenes/overworld/spot16.xml +++ b/assets/xml/scenes/overworld/spot16.xml @@ -5,6 +5,7 @@ + diff --git a/baseroms/gc-eu-mq-dbg/checksum-compressed.md5 b/baseroms/gc-eu-mq-dbg/checksum-compressed.md5 deleted file mode 100644 index 181bb4041..000000000 --- a/baseroms/gc-eu-mq-dbg/checksum-compressed.md5 +++ /dev/null @@ -1 +0,0 @@ -5831385a7f216370cdbea55616b12fed build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg-compressed.z64 diff --git a/baseroms/gc-eu-mq-dbg/checksum.md5 b/baseroms/gc-eu-mq-dbg/checksum.md5 index 55af8fae8..69e361d6a 100644 --- a/baseroms/gc-eu-mq-dbg/checksum.md5 +++ b/baseroms/gc-eu-mq-dbg/checksum.md5 @@ -1 +1 @@ -f0b7f35375f9cc8ca1b2d59d78e35405 build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64 +75e344f41c26ec2ec5ad92caa9e25629 build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64 diff --git a/baseroms/gc-eu-mq-dbg/dmadata_names.txt b/baseroms/gc-eu-mq-dbg/dmadata_names.txt new file mode 100644 index 000000000..60e3b0aa8 --- /dev/null +++ b/baseroms/gc-eu-mq-dbg/dmadata_names.txt @@ -0,0 +1,1532 @@ +makerom +boot +dmadata +Audiobank +Audioseq +Audiotable +link_animetion +icon_item_static +icon_item_24_static +icon_item_field_static +icon_item_dungeon_static +icon_item_gameover_static +icon_item_nes_static +icon_item_ger_static +icon_item_fra_static +item_name_static +map_name_static +do_action_static +message_static +message_texture_static +nes_font_static +nes_message_data_static +ger_message_data_static +fra_message_data_static +staff_message_data_static +map_grand_static +map_i_static +map_48x85_static +code +ovl_title +ovl_select +ovl_opening +ovl_file_choose +ovl_kaleido_scope +ovl_player_actor +ovl_map_mark_data +ovl_En_Test +ovl_Arms_Hook +ovl_Arrow_Fire +ovl_Arrow_Ice +ovl_Arrow_Light +ovl_Bg_Bdan_Objects +ovl_Bg_Bdan_Switch +ovl_Bg_Bom_Guard +ovl_Bg_Bombwall +ovl_Bg_Bowl_Wall +ovl_Bg_Breakwall +ovl_Bg_Ddan_Jd +ovl_Bg_Ddan_Kd +ovl_Bg_Dodoago +ovl_Bg_Dy_Yoseizo +ovl_Bg_Ganon_Otyuka +ovl_Bg_Gate_Shutter +ovl_Bg_Gjyo_Bridge +ovl_Bg_Gnd_Darkmeiro +ovl_Bg_Gnd_Firemeiro +ovl_Bg_Gnd_Iceblock +ovl_Bg_Gnd_Nisekabe +ovl_Bg_Gnd_Soulmeiro +ovl_Bg_Haka +ovl_Bg_Haka_Gate +ovl_Bg_Haka_Huta +ovl_Bg_Haka_Megane +ovl_Bg_Haka_MeganeBG +ovl_Bg_Haka_Sgami +ovl_Bg_Haka_Ship +ovl_Bg_Haka_Trap +ovl_Bg_Haka_Tubo +ovl_Bg_Haka_Water +ovl_Bg_Haka_Zou +ovl_Bg_Heavy_Block +ovl_Bg_Hidan_Curtain +ovl_Bg_Hidan_Dalm +ovl_Bg_Hidan_Firewall +ovl_Bg_Hidan_Fslift +ovl_Bg_Hidan_Fwbig +ovl_Bg_Hidan_Hamstep +ovl_Bg_Hidan_Hrock +ovl_Bg_Hidan_Kousi +ovl_Bg_Hidan_Kowarerukabe +ovl_Bg_Hidan_Rock +ovl_Bg_Hidan_Rsekizou +ovl_Bg_Hidan_Sekizou +ovl_Bg_Hidan_Sima +ovl_Bg_Hidan_Syoku +ovl_Bg_Ice_Objects +ovl_Bg_Ice_Shelter +ovl_Bg_Ice_Shutter +ovl_Bg_Ice_Turara +ovl_Bg_Ingate +ovl_Bg_Jya_1flift +ovl_Bg_Jya_Amishutter +ovl_Bg_Jya_Bigmirror +ovl_Bg_Jya_Block +ovl_Bg_Jya_Bombchuiwa +ovl_Bg_Jya_Bombiwa +ovl_Bg_Jya_Cobra +ovl_Bg_Jya_Goroiwa +ovl_Bg_Jya_Haheniron +ovl_Bg_Jya_Ironobj +ovl_Bg_Jya_Kanaami +ovl_Bg_Jya_Lift +ovl_Bg_Jya_Megami +ovl_Bg_Jya_Zurerukabe +ovl_Bg_Menkuri_Eye +ovl_Bg_Menkuri_Kaiten +ovl_Bg_Menkuri_Nisekabe +ovl_Bg_Mizu_Bwall +ovl_Bg_Mizu_Movebg +ovl_Bg_Mizu_Shutter +ovl_Bg_Mizu_Uzu +ovl_Bg_Mizu_Water +ovl_Bg_Mjin +ovl_Bg_Mori_Bigst +ovl_Bg_Mori_Elevator +ovl_Bg_Mori_Hashigo +ovl_Bg_Mori_Hashira4 +ovl_Bg_Mori_Hineri +ovl_Bg_Mori_Idomizu +ovl_Bg_Mori_Kaitenkabe +ovl_Bg_Mori_Rakkatenjo +ovl_Bg_Po_Event +ovl_Bg_Po_Syokudai +ovl_Bg_Pushbox +ovl_Bg_Relay_Objects +ovl_Bg_Spot00_Break +ovl_Bg_Spot00_Hanebasi +ovl_Bg_Spot01_Fusya +ovl_Bg_Spot01_Idohashira +ovl_Bg_Spot01_Idomizu +ovl_Bg_Spot01_Idosoko +ovl_Bg_Spot01_Objects2 +ovl_Bg_Spot02_Objects +ovl_Bg_Spot03_Taki +ovl_Bg_Spot05_Soko +ovl_Bg_Spot06_Objects +ovl_Bg_Spot07_Taki +ovl_Bg_Spot08_Bakudankabe +ovl_Bg_Spot08_Iceblock +ovl_Bg_Spot09_Obj +ovl_Bg_Spot11_Bakudankabe +ovl_Bg_Spot11_Oasis +ovl_Bg_Spot12_Gate +ovl_Bg_Spot12_Saku +ovl_Bg_Spot15_Rrbox +ovl_Bg_Spot15_Saku +ovl_Bg_Spot16_Bombstone +ovl_Bg_Spot16_Doughnut +ovl_Bg_Spot17_Bakudankabe +ovl_Bg_Spot17_Funen +ovl_Bg_Spot18_Basket +ovl_Bg_Spot18_Futa +ovl_Bg_Spot18_Obj +ovl_Bg_Spot18_Shutter +ovl_Bg_Sst_Floor +ovl_Bg_Toki_Hikari +ovl_Bg_Toki_Swd +ovl_Bg_Treemouth +ovl_Bg_Umajump +ovl_Bg_Vb_Sima +ovl_Bg_Ydan_Hasi +ovl_Bg_Ydan_Maruta +ovl_Bg_Ydan_Sp +ovl_Bg_Zg +ovl_Boss_Dodongo +ovl_Boss_Fd +ovl_Boss_Fd2 +ovl_Boss_Ganon +ovl_Boss_Ganon2 +ovl_Boss_Ganondrof +ovl_Boss_Goma +ovl_Boss_Mo +ovl_Boss_Sst +ovl_Boss_Tw +ovl_Boss_Va +ovl_Demo_6K +ovl_Demo_Du +ovl_Demo_Ec +ovl_Demo_Effect +ovl_Demo_Ext +ovl_Demo_Geff +ovl_Demo_Gj +ovl_Demo_Go +ovl_Demo_Gt +ovl_Demo_Ik +ovl_Demo_Im +ovl_Demo_Kankyo +ovl_Demo_Kekkai +ovl_Demo_Sa +ovl_Demo_Shd +ovl_Demo_Tre_Lgt +ovl_Door_Ana +ovl_Door_Gerudo +ovl_Door_Killer +ovl_Door_Shutter +ovl_Door_Toki +ovl_Door_Warp1 +ovl_Efc_Erupc +ovl_Eff_Dust +ovl_Effect_Ss_Blast +ovl_Effect_Ss_Bomb +ovl_Effect_Ss_Bomb2 +ovl_Effect_Ss_Bubble +ovl_Effect_Ss_D_Fire +ovl_Effect_Ss_Dead_Db +ovl_Effect_Ss_Dead_Dd +ovl_Effect_Ss_Dead_Ds +ovl_Effect_Ss_Dead_Sound +ovl_Effect_Ss_Dt_Bubble +ovl_Effect_Ss_Dust +ovl_Effect_Ss_En_Fire +ovl_Effect_Ss_En_Ice +ovl_Effect_Ss_Extra +ovl_Effect_Ss_Fcircle +ovl_Effect_Ss_Fhg_Flash +ovl_Effect_Ss_Fire_Tail +ovl_Effect_Ss_G_Fire +ovl_Effect_Ss_G_Magma +ovl_Effect_Ss_G_Magma2 +ovl_Effect_Ss_G_Ripple +ovl_Effect_Ss_G_Spk +ovl_Effect_Ss_G_Splash +ovl_Effect_Ss_Hahen +ovl_Effect_Ss_HitMark +ovl_Effect_Ss_Ice_Piece +ovl_Effect_Ss_Ice_Smoke +ovl_Effect_Ss_K_Fire +ovl_Effect_Ss_Kakera +ovl_Effect_Ss_KiraKira +ovl_Effect_Ss_Lightning +ovl_Effect_Ss_Sibuki +ovl_Effect_Ss_Sibuki2 +ovl_Effect_Ss_Solder_Srch_Ball +ovl_Effect_Ss_Stick +ovl_Effect_Ss_Stone1 +ovl_Elf_Msg +ovl_Elf_Msg2 +ovl_En_Am +ovl_En_Ani +ovl_En_Anubice +ovl_En_Anubice_Fire +ovl_En_Anubice_Tag +ovl_En_Arow_Trap +ovl_En_Arrow +ovl_En_Attack_Niw +ovl_En_Ba +ovl_En_Bb +ovl_En_Bdfire +ovl_En_Bigokuta +ovl_En_Bili +ovl_En_Bird +ovl_En_Blkobj +ovl_En_Bom +ovl_En_Bom_Bowl_Man +ovl_En_Bom_Bowl_Pit +ovl_En_Bom_Chu +ovl_En_Bombf +ovl_En_Boom +ovl_En_Box +ovl_En_Brob +ovl_En_Bubble +ovl_En_Butte +ovl_En_Bw +ovl_En_Bx +ovl_En_Changer +ovl_En_Clear_Tag +ovl_En_Cow +ovl_En_Crow +ovl_En_Cs +ovl_En_Daiku +ovl_En_Daiku_Kakariko +ovl_En_Dekubaba +ovl_En_Dekunuts +ovl_En_Dh +ovl_En_Dha +ovl_En_Diving_Game +ovl_En_Dns +ovl_En_Dnt_Demo +ovl_En_Dnt_Jiji +ovl_En_Dnt_Nomal +ovl_En_Dodojr +ovl_En_Dodongo +ovl_En_Dog +ovl_En_Door +ovl_En_Ds +ovl_En_Du +ovl_En_Dy_Extra +ovl_En_Eg +ovl_En_Eiyer +ovl_En_Elf +ovl_En_Encount1 +ovl_En_Encount2 +ovl_En_Ex_Item +ovl_En_Ex_Ruppy +ovl_En_Fd +ovl_En_Fd_Fire +ovl_En_Fhg_Fire +ovl_En_Fire_Rock +ovl_En_Firefly +ovl_En_Fish +ovl_En_Floormas +ovl_En_Fr +ovl_En_Fu +ovl_En_Fw +ovl_En_Fz +ovl_En_G_Switch +ovl_En_Ganon_Mant +ovl_En_Ganon_Organ +ovl_En_Gb +ovl_En_Ge1 +ovl_En_Ge2 +ovl_En_Ge3 +ovl_En_GeldB +ovl_En_GirlA +ovl_En_Gm +ovl_En_Go +ovl_En_Go2 +ovl_En_Goma +ovl_En_Goroiwa +ovl_En_Gs +ovl_En_Guest +ovl_En_Hata +ovl_En_Heishi1 +ovl_En_Heishi2 +ovl_En_Heishi3 +ovl_En_Heishi4 +ovl_En_Hintnuts +ovl_En_Holl +ovl_En_Honotrap +ovl_En_Horse +ovl_En_Horse_Game_Check +ovl_En_Horse_Ganon +ovl_En_Horse_Link_Child +ovl_En_Horse_Normal +ovl_En_Horse_Zelda +ovl_En_Hs +ovl_En_Hs2 +ovl_En_Hy +ovl_En_Ice_Hono +ovl_En_Ik +ovl_En_In +ovl_En_Insect +ovl_En_Ishi +ovl_En_It +ovl_En_Jj +ovl_En_Js +ovl_En_Jsjutan +ovl_En_Kakasi +ovl_En_Kakasi2 +ovl_En_Kakasi3 +ovl_En_Kanban +ovl_En_Karebaba +ovl_En_Ko +ovl_En_Kusa +ovl_En_Kz +ovl_En_Light +ovl_En_Lightbox +ovl_En_M_Fire1 +ovl_En_M_Thunder +ovl_En_Ma1 +ovl_En_Ma2 +ovl_En_Ma3 +ovl_En_Mag +ovl_En_Mb +ovl_En_Md +ovl_En_Mk +ovl_En_Mm +ovl_En_Mm2 +ovl_En_Ms +ovl_En_Mu +ovl_En_Nb +ovl_En_Niw +ovl_En_Niw_Girl +ovl_En_Niw_Lady +ovl_En_Nutsball +ovl_En_Nwc +ovl_En_Ny +ovl_En_OE2 +ovl_En_Okarina_Effect +ovl_En_Okarina_Tag +ovl_En_Okuta +ovl_En_Ossan +ovl_En_Owl +ovl_En_Part +ovl_En_Peehat +ovl_En_Po_Desert +ovl_En_Po_Field +ovl_En_Po_Relay +ovl_En_Po_Sisters +ovl_En_Poh +ovl_En_Pu_box +ovl_En_Rd +ovl_En_Reeba +ovl_En_River_Sound +ovl_En_Rl +ovl_En_Rr +ovl_En_Ru1 +ovl_En_Ru2 +ovl_En_Sa +ovl_En_Sb +ovl_En_Scene_Change +ovl_En_Sda +ovl_En_Shopnuts +ovl_En_Si +ovl_En_Siofuki +ovl_En_Skb +ovl_En_Skj +ovl_En_Skjneedle +ovl_En_Ssh +ovl_En_St +ovl_En_Sth +ovl_En_Stream +ovl_En_Sw +ovl_En_Syateki_Itm +ovl_En_Syateki_Man +ovl_En_Syateki_Niw +ovl_En_Ta +ovl_En_Takara_Man +ovl_En_Tana +ovl_En_Tg +ovl_En_Tite +ovl_En_Tk +ovl_En_Torch +ovl_En_Torch2 +ovl_En_Toryo +ovl_En_Tp +ovl_En_Tr +ovl_En_Trap +ovl_En_Tubo_Trap +ovl_En_Vali +ovl_En_Vase +ovl_En_Vb_Ball +ovl_En_Viewer +ovl_En_Vm +ovl_En_Wall_Tubo +ovl_En_Wallmas +ovl_En_Weather_Tag +ovl_En_Weiyer +ovl_En_Wf +ovl_En_Wonder_Item +ovl_En_Wonder_Talk +ovl_En_Wonder_Talk2 +ovl_En_Wood02 +ovl_En_Xc +ovl_En_Yabusame_Mark +ovl_En_Yukabyun +ovl_En_Zf +ovl_En_Zl1 +ovl_En_Zl2 +ovl_En_Zl3 +ovl_En_Zl4 +ovl_En_Zo +ovl_En_fHG +ovl_End_Title +ovl_Fishing +ovl_Item_B_Heart +ovl_Item_Etcetera +ovl_Item_Inbox +ovl_Item_Ocarina +ovl_Item_Shield +ovl_Magic_Dark +ovl_Magic_Fire +ovl_Magic_Wind +ovl_Mir_Ray +ovl_Obj_Bean +ovl_Obj_Blockstop +ovl_Obj_Bombiwa +ovl_Obj_Comb +ovl_Obj_Dekujr +ovl_Obj_Elevator +ovl_Obj_Hamishi +ovl_Obj_Hana +ovl_Obj_Hsblock +ovl_Obj_Ice_Poly +ovl_Obj_Kibako +ovl_Obj_Kibako2 +ovl_Obj_Lift +ovl_Obj_Lightswitch +ovl_Obj_Makekinsuta +ovl_Obj_Makeoshihiki +ovl_Obj_Mure +ovl_Obj_Mure2 +ovl_Obj_Mure3 +ovl_Obj_Oshihiki +ovl_Obj_Roomtimer +ovl_Obj_Switch +ovl_Obj_Syokudai +ovl_Obj_Timeblock +ovl_Obj_Tsubo +ovl_Obj_Warp2block +ovl_Object_Kankyo +ovl_Oceff_Spot +ovl_Oceff_Storm +ovl_Oceff_Wipe +ovl_Oceff_Wipe2 +ovl_Oceff_Wipe3 +ovl_Oceff_Wipe4 +ovl_Shot_Sun +gameplay_keep +gameplay_field_keep +gameplay_dangeon_keep +gameplay_object_exchange_static +object_link_boy +object_link_child +object_box +object_human +object_okuta +object_poh +object_wallmaster +object_dy_obj +object_firefly +object_dodongo +object_fire +object_niw +object_tite +object_reeba +object_peehat +object_kingdodongo +object_horse +object_zf +object_goma +object_zl1 +object_gol +object_bubble +object_dodojr +object_torch2 +object_bl +object_tp +object_oA1 +object_st +object_bw +object_ei +object_horse_normal +object_oB1 +object_o_anime +object_spot04_objects +object_ddan_objects +object_hidan_objects +object_horse_ganon +object_oA2 +object_spot00_objects +object_mb +object_bombf +object_sk2 +object_oE1 +object_oE_anime +object_oE2 +object_ydan_objects +object_gnd +object_am +object_dekubaba +object_oA3 +object_oA4 +object_oA5 +object_oA6 +object_oA7 +object_jj +object_oA8 +object_oA9 +object_oB2 +object_oB3 +object_oB4 +object_horse_zelda +object_opening_demo1 +object_warp1 +object_b_heart +object_dekunuts +object_oE3 +object_oE4 +object_menkuri_objects +object_oE5 +object_oE6 +object_oE7 +object_oE8 +object_oE9 +object_oE10 +object_oE11 +object_oE12 +object_vali +object_oA10 +object_oA11 +object_mizu_objects +object_fhg +object_ossan +object_mori_hineri1 +object_Bb +object_toki_objects +object_yukabyun +object_zl2 +object_mjin +object_mjin_flash +object_mjin_dark +object_mjin_flame +object_mjin_ice +object_mjin_soul +object_mjin_wind +object_mjin_oka +object_haka_objects +object_spot06_objects +object_ice_objects +object_relay_objects +object_mori_hineri1a +object_mori_hineri2 +object_mori_hineri2a +object_mori_objects +object_mori_tex +object_spot08_obj +object_warp2 +object_hata +object_bird +object_wood02 +object_lightbox +object_pu_box +object_trap +object_vase +object_im +object_ta +object_tk +object_xc +object_vm +object_bv +object_hakach_objects +object_efc_crystal_light +object_efc_fire_ball +object_efc_flash +object_efc_lgt_shower +object_efc_star_field +object_god_lgt +object_light_ring +object_triforce_spot +object_medal +object_bdan_objects +object_sd +object_rd +object_po_sisters +object_heavy_object +object_gndd +object_fd +object_du +object_fw +object_horse_link_child +object_spot02_objects +object_haka +object_ru1 +object_syokudai +object_fd2 +object_dh +object_rl +object_efc_tw +object_demo_tre_lgt +object_gi_key +object_mir_ray +object_brob +object_gi_jewel +object_spot09_obj +object_spot18_obj +object_bdoor +object_spot17_obj +object_shop_dungen +object_nb +object_mo +object_sb +object_gi_melody +object_gi_heart +object_gi_compass +object_gi_bosskey +object_gi_medal +object_gi_nuts +object_sa +object_gi_hearts +object_gi_arrowcase +object_gi_bombpouch +object_in +object_tr +object_spot16_obj +object_oE1s +object_oE4s +object_os_anime +object_gi_bottle +object_gi_stick +object_gi_map +object_oF1d_map +object_ru2 +object_gi_shield_1 +object_dekujr +object_gi_magicpot +object_gi_bomb_1 +object_oF1s +object_ma2 +object_gi_purse +object_hni +object_tw +object_rr +object_bxa +object_anubice +object_gi_gerudo +object_gi_arrow +object_gi_bomb_2 +object_gi_egg +object_gi_scale +object_gi_shield_2 +object_gi_hookshot +object_gi_ocarina +object_gi_milk +object_ma1 +object_ganon +object_sst +object_ny +object_fr +object_gi_pachinko +object_gi_boomerang +object_gi_bow +object_gi_glasses +object_gi_liquid +object_ani +object_demo_6k +object_gi_shield_3 +object_gi_letter +object_spot15_obj +object_jya_obj +object_gi_clothes +object_gi_bean +object_gi_fish +object_gi_saw +object_gi_hammer +object_gi_grass +object_gi_longsword +object_spot01_objects +object_md +object_km1 +object_kw1 +object_zo +object_kz +object_umajump +object_masterkokiri +object_masterkokirihead +object_mastergolon +object_masterzoora +object_aob +object_ik +object_ahg +object_cne +object_gi_niwatori +object_skj +object_gi_bottle_letter +object_bji +object_bba +object_gi_ocarina_0 +object_ds +object_ane +object_boj +object_spot03_object +object_spot07_object +object_fz +object_bob +object_ge1 +object_yabusame_point +object_gi_boots_2 +object_gi_seed +object_gnd_magic +object_d_elevator +object_d_hsblock +object_d_lift +object_mamenoki +object_goroiwa +object_toryo +object_daiku +object_nwc +object_blkobj +object_gm +object_ms +object_hs +object_ingate +object_lightswitch +object_kusa +object_tsubo +object_gi_gloves +object_gi_coin +object_kanban +object_gjyo_objects +object_owl +object_mk +object_fu +object_gi_ki_tan_mask +object_gi_redead_mask +object_gi_skj_mask +object_gi_rabit_mask +object_gi_truth_mask +object_ganon_objects +object_siofuki +object_stream +object_mm +object_fa +object_os +object_gi_eye_lotion +object_gi_powder +object_gi_mushroom +object_gi_ticketstone +object_gi_brokensword +object_js +object_cs +object_gi_prescription +object_gi_bracelet +object_gi_soldout +object_gi_frog +object_mag +object_door_gerudo +object_gt +object_efc_erupc +object_zl2_anime1 +object_zl2_anime2 +object_gi_golonmask +object_gi_zoramask +object_gi_gerudomask +object_ganon2 +object_ka +object_ts +object_zg +object_gi_hoverboots +object_gi_m_arrow +object_ds2 +object_ec +object_fish +object_gi_sutaru +object_gi_goddess +object_ssh +object_bigokuta +object_bg +object_spot05_objects +object_spot12_obj +object_bombiwa +object_hintnuts +object_rs +object_spot00_break +object_gla +object_shopnuts +object_geldb +object_gr +object_dog +object_jya_iron +object_jya_door +object_spot01_objects2 +object_spot11_obj +object_kibako2 +object_dns +object_dnk +object_gi_fire +object_gi_insect +object_gi_butterfly +object_gi_ghost +object_gi_soul +object_bowl +object_po_field +object_demo_kekkai +object_efc_doughnut +object_gi_dekupouch +object_ganon_anime1 +object_ganon_anime2 +object_ganon_anime3 +object_gi_rupy +object_spot01_matoya +object_spot01_matoyab +object_po_composer +object_mu +object_wf +object_skb +object_gj +object_geff +object_haka_door +object_gs +object_ps +object_bwall +object_crow +object_cow +object_cob +object_gi_sword_1 +object_door_killer +object_ouke_haka +object_timeblock +object_zl4 +g_pn_01 +g_pn_02 +g_pn_03 +g_pn_04 +g_pn_05 +g_pn_06 +g_pn_07 +g_pn_08 +g_pn_09 +g_pn_10 +g_pn_11 +g_pn_12 +g_pn_13 +g_pn_14 +g_pn_15 +g_pn_16 +g_pn_17 +g_pn_18 +g_pn_19 +g_pn_20 +g_pn_21 +g_pn_22 +g_pn_23 +g_pn_24 +g_pn_25 +g_pn_26 +g_pn_27 +g_pn_28 +g_pn_29 +g_pn_30 +g_pn_31 +g_pn_32 +g_pn_33 +g_pn_34 +g_pn_35 +g_pn_36 +g_pn_37 +g_pn_38 +g_pn_39 +g_pn_40 +g_pn_41 +g_pn_42 +g_pn_43 +g_pn_44 +g_pn_45 +g_pn_46 +g_pn_47 +g_pn_48 +g_pn_49 +g_pn_50 +g_pn_51 +g_pn_52 +g_pn_53 +g_pn_54 +g_pn_55 +g_pn_56 +g_pn_57 +z_select_static +nintendo_rogo_static +title_static +parameter_static +vr_fine0_static +vr_fine0_pal_static +vr_fine1_static +vr_fine1_pal_static +vr_fine2_static +vr_fine2_pal_static +vr_fine3_static +vr_fine3_pal_static +vr_cloud0_static +vr_cloud0_pal_static +vr_cloud1_static +vr_cloud1_pal_static +vr_cloud2_static +vr_cloud2_pal_static +vr_cloud3_static +vr_cloud3_pal_static +vr_holy0_static +vr_holy0_pal_static +vr_holy1_static +vr_holy1_pal_static +vr_MDVR_static +vr_MDVR_pal_static +vr_MNVR_static +vr_MNVR_pal_static +vr_RUVR_static +vr_RUVR_pal_static +vr_LHVR_static +vr_LHVR_pal_static +vr_KHVR_static +vr_KHVR_pal_static +vr_K3VR_static +vr_K3VR_pal_static +vr_K4VR_static +vr_K4VR_pal_static +vr_K5VR_static +vr_K5VR_pal_static +vr_SP1a_static +vr_SP1a_pal_static +vr_MLVR_static +vr_MLVR_pal_static +vr_KKRVR_static +vr_KKRVR_pal_static +vr_KR3VR_static +vr_KR3VR_pal_static +vr_IPVR_static +vr_IPVR_pal_static +vr_KSVR_static +vr_KSVR_pal_static +vr_GLVR_static +vr_GLVR_pal_static +vr_ZRVR_static +vr_ZRVR_pal_static +vr_DGVR_static +vr_DGVR_pal_static +vr_ALVR_static +vr_ALVR_pal_static +vr_NSVR_static +vr_NSVR_pal_static +vr_LBVR_static +vr_LBVR_pal_static +vr_TTVR_static +vr_TTVR_pal_static +vr_FCVR_static +vr_FCVR_pal_static +elf_message_field +elf_message_ydan +syotes_scene +syotes_room_0 +syotes2_scene +syotes2_room_0 +depth_test_scene +depth_test_room_0 +spot00_scene +spot00_room_0 +spot01_scene +spot01_room_0 +spot02_scene +spot02_room_0 +spot02_room_1 +spot03_scene +spot03_room_0 +spot03_room_1 +spot04_scene +spot04_room_0 +spot04_room_1 +spot04_room_2 +spot05_scene +spot05_room_0 +spot06_scene +spot06_room_0 +spot07_scene +spot07_room_0 +spot07_room_1 +spot08_scene +spot08_room_0 +spot09_scene +spot09_room_0 +spot10_scene +spot10_room_0 +spot10_room_1 +spot10_room_2 +spot10_room_3 +spot10_room_4 +spot10_room_5 +spot10_room_6 +spot10_room_7 +spot10_room_8 +spot10_room_9 +spot11_scene +spot11_room_0 +spot12_scene +spot12_room_0 +spot12_room_1 +spot13_scene +spot13_room_0 +spot13_room_1 +spot15_scene +spot15_room_0 +spot16_scene +spot16_room_0 +spot17_scene +spot17_room_0 +spot17_room_1 +spot18_scene +spot18_room_0 +spot18_room_1 +spot18_room_2 +spot18_room_3 +ydan_scene +ydan_room_0 +ydan_room_1 +ydan_room_2 +ydan_room_3 +ydan_room_4 +ydan_room_5 +ydan_room_6 +ydan_room_7 +ydan_room_8 +ydan_room_9 +ydan_room_10 +ydan_room_11 +ddan_scene +ddan_room_0 +ddan_room_1 +ddan_room_2 +ddan_room_3 +ddan_room_4 +ddan_room_5 +ddan_room_6 +ddan_room_7 +ddan_room_8 +ddan_room_9 +ddan_room_10 +ddan_room_11 +ddan_room_12 +ddan_room_13 +ddan_room_14 +ddan_room_15 +ddan_room_16 +bdan_scene +bdan_room_0 +bdan_room_1 +bdan_room_2 +bdan_room_3 +bdan_room_4 +bdan_room_5 +bdan_room_6 +bdan_room_7 +bdan_room_8 +bdan_room_9 +bdan_room_10 +bdan_room_11 +bdan_room_12 +bdan_room_13 +bdan_room_14 +bdan_room_15 +Bmori1_scene +Bmori1_room_0 +Bmori1_room_1 +Bmori1_room_2 +Bmori1_room_3 +Bmori1_room_4 +Bmori1_room_5 +Bmori1_room_6 +Bmori1_room_7 +Bmori1_room_8 +Bmori1_room_9 +Bmori1_room_10 +Bmori1_room_11 +Bmori1_room_12 +Bmori1_room_13 +Bmori1_room_14 +Bmori1_room_15 +Bmori1_room_16 +Bmori1_room_17 +Bmori1_room_18 +Bmori1_room_19 +Bmori1_room_20 +Bmori1_room_21 +Bmori1_room_22 +HIDAN_scene +HIDAN_room_0 +HIDAN_room_1 +HIDAN_room_2 +HIDAN_room_3 +HIDAN_room_4 +HIDAN_room_5 +HIDAN_room_6 +HIDAN_room_7 +HIDAN_room_8 +HIDAN_room_9 +HIDAN_room_10 +HIDAN_room_11 +HIDAN_room_12 +HIDAN_room_13 +HIDAN_room_14 +HIDAN_room_15 +HIDAN_room_16 +HIDAN_room_17 +HIDAN_room_18 +HIDAN_room_19 +HIDAN_room_20 +HIDAN_room_21 +HIDAN_room_22 +HIDAN_room_23 +HIDAN_room_24 +HIDAN_room_25 +HIDAN_room_26 +MIZUsin_scene +MIZUsin_room_0 +MIZUsin_room_1 +MIZUsin_room_2 +MIZUsin_room_3 +MIZUsin_room_4 +MIZUsin_room_5 +MIZUsin_room_6 +MIZUsin_room_7 +MIZUsin_room_8 +MIZUsin_room_9 +MIZUsin_room_10 +MIZUsin_room_11 +MIZUsin_room_12 +MIZUsin_room_13 +MIZUsin_room_14 +MIZUsin_room_15 +MIZUsin_room_16 +MIZUsin_room_17 +MIZUsin_room_18 +MIZUsin_room_19 +MIZUsin_room_20 +MIZUsin_room_21 +MIZUsin_room_22 +jyasinzou_scene +jyasinzou_room_0 +jyasinzou_room_1 +jyasinzou_room_2 +jyasinzou_room_3 +jyasinzou_room_4 +jyasinzou_room_5 +jyasinzou_room_6 +jyasinzou_room_7 +jyasinzou_room_8 +jyasinzou_room_9 +jyasinzou_room_10 +jyasinzou_room_11 +jyasinzou_room_12 +jyasinzou_room_13 +jyasinzou_room_14 +jyasinzou_room_15 +jyasinzou_room_16 +jyasinzou_room_17 +jyasinzou_room_18 +jyasinzou_room_19 +jyasinzou_room_20 +jyasinzou_room_21 +jyasinzou_room_22 +jyasinzou_room_23 +jyasinzou_room_24 +jyasinzou_room_25 +jyasinzou_room_26 +jyasinzou_room_27 +jyasinzou_room_28 +HAKAdan_scene +HAKAdan_room_0 +HAKAdan_room_1 +HAKAdan_room_2 +HAKAdan_room_3 +HAKAdan_room_4 +HAKAdan_room_5 +HAKAdan_room_6 +HAKAdan_room_7 +HAKAdan_room_8 +HAKAdan_room_9 +HAKAdan_room_10 +HAKAdan_room_11 +HAKAdan_room_12 +HAKAdan_room_13 +HAKAdan_room_14 +HAKAdan_room_15 +HAKAdan_room_16 +HAKAdan_room_17 +HAKAdan_room_18 +HAKAdan_room_19 +HAKAdan_room_20 +HAKAdan_room_21 +HAKAdan_room_22 +HAKAdanCH_scene +HAKAdanCH_room_0 +HAKAdanCH_room_1 +HAKAdanCH_room_2 +HAKAdanCH_room_3 +HAKAdanCH_room_4 +HAKAdanCH_room_5 +HAKAdanCH_room_6 +ice_doukutu_scene +ice_doukutu_room_0 +ice_doukutu_room_1 +ice_doukutu_room_2 +ice_doukutu_room_3 +ice_doukutu_room_4 +ice_doukutu_room_5 +ice_doukutu_room_6 +ice_doukutu_room_7 +ice_doukutu_room_8 +ice_doukutu_room_9 +ice_doukutu_room_10 +ice_doukutu_room_11 +men_scene +men_room_0 +men_room_1 +men_room_2 +men_room_3 +men_room_4 +men_room_5 +men_room_6 +men_room_7 +men_room_8 +men_room_9 +men_room_10 +ganontika_scene +ganontika_room_0 +ganontika_room_1 +ganontika_room_2 +ganontika_room_3 +ganontika_room_4 +ganontika_room_5 +ganontika_room_6 +ganontika_room_7 +ganontika_room_8 +ganontika_room_9 +ganontika_room_10 +ganontika_room_11 +ganontika_room_12 +ganontika_room_13 +ganontika_room_14 +ganontika_room_15 +ganontika_room_16 +ganontika_room_17 +ganontika_room_18 +ganontika_room_19 +market_day_scene +market_day_room_0 +market_night_scene +market_night_room_0 +testroom_scene +testroom_room_0 +testroom_room_1 +testroom_room_2 +testroom_room_3 +testroom_room_4 +kenjyanoma_scene +kenjyanoma_room_0 +tokinoma_scene +tokinoma_room_0 +tokinoma_room_1 +sutaru_scene +sutaru_room_0 +link_home_scene +link_home_room_0 +kokiri_shop_scene +kokiri_shop_room_0 +kokiri_home_scene +kokiri_home_room_0 +kakusiana_scene +kakusiana_room_0 +kakusiana_room_1 +kakusiana_room_2 +kakusiana_room_3 +kakusiana_room_4 +kakusiana_room_5 +kakusiana_room_6 +kakusiana_room_7 +kakusiana_room_8 +kakusiana_room_9 +kakusiana_room_10 +kakusiana_room_11 +kakusiana_room_12 +kakusiana_room_13 +entra_scene +entra_room_0 +moribossroom_scene +moribossroom_room_0 +moribossroom_room_1 +syatekijyou_scene +syatekijyou_room_0 +shop1_scene +shop1_room_0 +hairal_niwa_scene +hairal_niwa_room_0 +ganon_tou_scene +ganon_tou_room_0 +sasatest_scene +sasatest_room_0 +market_alley_scene +market_alley_room_0 +spot20_scene +spot20_room_0 +market_ruins_scene +market_ruins_room_0 +entra_n_scene +entra_n_room_0 +enrui_scene +enrui_room_0 +market_alley_n_scene +market_alley_n_room_0 +hiral_demo_scene +hiral_demo_room_0 +kokiri_home3_scene +kokiri_home3_room_0 +malon_stable_scene +malon_stable_room_0 +kakariko_scene +kakariko_room_0 +bdan_boss_scene +bdan_boss_room_0 +bdan_boss_room_1 +FIRE_bs_scene +FIRE_bs_room_0 +FIRE_bs_room_1 +hut_scene +hut_room_0 +daiyousei_izumi_scene +daiyousei_izumi_room_0 +hakaana_scene +hakaana_room_0 +yousei_izumi_tate_scene +yousei_izumi_tate_room_0 +yousei_izumi_yoko_scene +yousei_izumi_yoko_room_0 +golon_scene +golon_room_0 +zoora_scene +zoora_room_0 +drag_scene +drag_room_0 +alley_shop_scene +alley_shop_room_0 +night_shop_scene +night_shop_room_0 +impa_scene +impa_room_0 +labo_scene +labo_room_0 +tent_scene +tent_room_0 +nakaniwa_scene +nakaniwa_room_0 +ddan_boss_scene +ddan_boss_room_0 +ddan_boss_room_1 +ydan_boss_scene +ydan_boss_room_0 +ydan_boss_room_1 +HAKAdan_bs_scene +HAKAdan_bs_room_0 +HAKAdan_bs_room_1 +MIZUsin_bs_scene +MIZUsin_bs_room_0 +MIZUsin_bs_room_1 +ganon_scene +ganon_room_0 +ganon_room_1 +ganon_room_2 +ganon_room_3 +ganon_room_4 +ganon_room_5 +ganon_room_6 +ganon_room_7 +ganon_room_8 +ganon_room_9 +ganon_boss_scene +ganon_boss_room_0 +jyasinboss_scene +jyasinboss_room_0 +jyasinboss_room_1 +jyasinboss_room_2 +jyasinboss_room_3 +kokiri_home4_scene +kokiri_home4_room_0 +kokiri_home5_scene +kokiri_home5_room_0 +ganon_final_scene +ganon_final_room_0 +kakariko3_scene +kakariko3_room_0 +hairal_niwa2_scene +hairal_niwa2_room_0 +hakasitarelay_scene +hakasitarelay_room_0 +hakasitarelay_room_1 +hakasitarelay_room_2 +hakasitarelay_room_3 +hakasitarelay_room_4 +hakasitarelay_room_5 +hakasitarelay_room_6 +shrine_scene +shrine_room_0 +turibori_scene +turibori_room_0 +shrine_n_scene +shrine_n_room_0 +shrine_r_scene +shrine_r_room_0 +hakaana2_scene +hakaana2_room_0 +gerudoway_scene +gerudoway_room_0 +gerudoway_room_1 +gerudoway_room_2 +gerudoway_room_3 +gerudoway_room_4 +gerudoway_room_5 +hairal_niwa_n_scene +hairal_niwa_n_room_0 +bowling_scene +bowling_room_0 +hakaana_ouke_scene +hakaana_ouke_room_0 +hakaana_ouke_room_1 +hakaana_ouke_room_2 +hylia_labo_scene +hylia_labo_room_0 +souko_scene +souko_room_0 +souko_room_1 +souko_room_2 +miharigoya_scene +miharigoya_room_0 +mahouya_scene +mahouya_room_0 +takaraya_scene +takaraya_room_0 +takaraya_room_1 +takaraya_room_2 +takaraya_room_3 +takaraya_room_4 +takaraya_room_5 +takaraya_room_6 +ganon_sonogo_scene +ganon_sonogo_room_0 +ganon_sonogo_room_1 +ganon_sonogo_room_2 +ganon_sonogo_room_3 +ganon_sonogo_room_4 +ganon_demo_scene +ganon_demo_room_0 +besitu_scene +besitu_room_0 +face_shop_scene +face_shop_room_0 +kinsuta_scene +kinsuta_room_0 +ganontikasonogo_scene +ganontikasonogo_room_0 +ganontikasonogo_room_1 +test01_scene +test01_room_0 +bump_texture_static +anime_model_1_static +anime_model_2_static +anime_model_3_static +anime_model_4_static +anime_model_5_static +anime_model_6_static +anime_texture_1_static +anime_texture_2_static +anime_texture_3_static +anime_texture_4_static +anime_texture_5_static +anime_texture_6_static +softsprite_matrix_static diff --git a/baseroms/gc-eu-mq-dbg/dmadata_start.txt b/baseroms/gc-eu-mq-dbg/dmadata_start.txt new file mode 100644 index 000000000..290d1938d --- /dev/null +++ b/baseroms/gc-eu-mq-dbg/dmadata_start.txt @@ -0,0 +1 @@ +0x12f70 diff --git a/baseroms/gc-eu-mq/checksum-compressed.md5 b/baseroms/gc-eu-mq/checksum-compressed.md5 deleted file mode 100644 index baf83abd5..000000000 --- a/baseroms/gc-eu-mq/checksum-compressed.md5 +++ /dev/null @@ -1 +0,0 @@ -1618403427e4344a57833043db5ce3c3 build/gc-eu-mq/oot-gc-eu-mq-compressed.z64 diff --git a/baseroms/gc-eu-mq/checksum.md5 b/baseroms/gc-eu-mq/checksum.md5 index 6c33e9d3e..7d78aaf06 100644 --- a/baseroms/gc-eu-mq/checksum.md5 +++ b/baseroms/gc-eu-mq/checksum.md5 @@ -1 +1 @@ -1a438f4235f8038856971c14a798122a build/gc-eu-mq/oot-gc-eu-mq.z64 +4920520254b9aab86de57b42ab477dbb build/gc-eu-mq/oot-gc-eu-mq.z64 diff --git a/baseroms/gc-eu-mq/dmadata_names.txt b/baseroms/gc-eu-mq/dmadata_names.txt new file mode 100644 index 000000000..cfe5c4689 --- /dev/null +++ b/baseroms/gc-eu-mq/dmadata_names.txt @@ -0,0 +1,1510 @@ +makerom +boot +dmadata +Audiobank +Audioseq +Audiotable +link_animetion +icon_item_static +icon_item_24_static +icon_item_field_static +icon_item_dungeon_static +icon_item_gameover_static +icon_item_nes_static +icon_item_ger_static +icon_item_fra_static +item_name_static +map_name_static +do_action_static +message_static +message_texture_static +nes_font_static +nes_message_data_static +ger_message_data_static +fra_message_data_static +staff_message_data_static +map_grand_static +map_48x85_static +map_i_static +code +ovl_title +ovl_select +ovl_opening +ovl_file_choose +ovl_kaleido_scope +ovl_player_actor +ovl_map_mark_data +ovl_En_Test +ovl_Arms_Hook +ovl_Arrow_Fire +ovl_Arrow_Ice +ovl_Arrow_Light +ovl_Bg_Bdan_Objects +ovl_Bg_Bdan_Switch +ovl_Bg_Bom_Guard +ovl_Bg_Bombwall +ovl_Bg_Bowl_Wall +ovl_Bg_Breakwall +ovl_Bg_Ddan_Jd +ovl_Bg_Ddan_Kd +ovl_Bg_Dodoago +ovl_Bg_Dy_Yoseizo +ovl_Bg_Ganon_Otyuka +ovl_Bg_Gate_Shutter +ovl_Bg_Gjyo_Bridge +ovl_Bg_Gnd_Darkmeiro +ovl_Bg_Gnd_Firemeiro +ovl_Bg_Gnd_Iceblock +ovl_Bg_Gnd_Nisekabe +ovl_Bg_Gnd_Soulmeiro +ovl_Bg_Haka +ovl_Bg_Haka_Gate +ovl_Bg_Haka_Huta +ovl_Bg_Haka_Megane +ovl_Bg_Haka_MeganeBG +ovl_Bg_Haka_Sgami +ovl_Bg_Haka_Ship +ovl_Bg_Haka_Trap +ovl_Bg_Haka_Tubo +ovl_Bg_Haka_Water +ovl_Bg_Haka_Zou +ovl_Bg_Heavy_Block +ovl_Bg_Hidan_Curtain +ovl_Bg_Hidan_Dalm +ovl_Bg_Hidan_Firewall +ovl_Bg_Hidan_Fslift +ovl_Bg_Hidan_Fwbig +ovl_Bg_Hidan_Hamstep +ovl_Bg_Hidan_Hrock +ovl_Bg_Hidan_Kousi +ovl_Bg_Hidan_Kowarerukabe +ovl_Bg_Hidan_Rock +ovl_Bg_Hidan_Rsekizou +ovl_Bg_Hidan_Sekizou +ovl_Bg_Hidan_Sima +ovl_Bg_Hidan_Syoku +ovl_Bg_Ice_Objects +ovl_Bg_Ice_Shelter +ovl_Bg_Ice_Shutter +ovl_Bg_Ice_Turara +ovl_Bg_Ingate +ovl_Bg_Jya_1flift +ovl_Bg_Jya_Amishutter +ovl_Bg_Jya_Bigmirror +ovl_Bg_Jya_Block +ovl_Bg_Jya_Bombchuiwa +ovl_Bg_Jya_Bombiwa +ovl_Bg_Jya_Cobra +ovl_Bg_Jya_Goroiwa +ovl_Bg_Jya_Haheniron +ovl_Bg_Jya_Ironobj +ovl_Bg_Jya_Kanaami +ovl_Bg_Jya_Lift +ovl_Bg_Jya_Megami +ovl_Bg_Jya_Zurerukabe +ovl_Bg_Menkuri_Eye +ovl_Bg_Menkuri_Kaiten +ovl_Bg_Menkuri_Nisekabe +ovl_Bg_Mizu_Bwall +ovl_Bg_Mizu_Movebg +ovl_Bg_Mizu_Shutter +ovl_Bg_Mizu_Uzu +ovl_Bg_Mizu_Water +ovl_Bg_Mjin +ovl_Bg_Mori_Bigst +ovl_Bg_Mori_Elevator +ovl_Bg_Mori_Hashigo +ovl_Bg_Mori_Hashira4 +ovl_Bg_Mori_Hineri +ovl_Bg_Mori_Idomizu +ovl_Bg_Mori_Kaitenkabe +ovl_Bg_Mori_Rakkatenjo +ovl_Bg_Po_Event +ovl_Bg_Po_Syokudai +ovl_Bg_Pushbox +ovl_Bg_Relay_Objects +ovl_Bg_Spot00_Break +ovl_Bg_Spot00_Hanebasi +ovl_Bg_Spot01_Fusya +ovl_Bg_Spot01_Idohashira +ovl_Bg_Spot01_Idomizu +ovl_Bg_Spot01_Idosoko +ovl_Bg_Spot01_Objects2 +ovl_Bg_Spot02_Objects +ovl_Bg_Spot03_Taki +ovl_Bg_Spot05_Soko +ovl_Bg_Spot06_Objects +ovl_Bg_Spot07_Taki +ovl_Bg_Spot08_Bakudankabe +ovl_Bg_Spot08_Iceblock +ovl_Bg_Spot09_Obj +ovl_Bg_Spot11_Bakudankabe +ovl_Bg_Spot11_Oasis +ovl_Bg_Spot12_Gate +ovl_Bg_Spot12_Saku +ovl_Bg_Spot15_Rrbox +ovl_Bg_Spot15_Saku +ovl_Bg_Spot16_Bombstone +ovl_Bg_Spot16_Doughnut +ovl_Bg_Spot17_Bakudankabe +ovl_Bg_Spot17_Funen +ovl_Bg_Spot18_Basket +ovl_Bg_Spot18_Futa +ovl_Bg_Spot18_Obj +ovl_Bg_Spot18_Shutter +ovl_Bg_Sst_Floor +ovl_Bg_Toki_Hikari +ovl_Bg_Toki_Swd +ovl_Bg_Treemouth +ovl_Bg_Umajump +ovl_Bg_Vb_Sima +ovl_Bg_Ydan_Hasi +ovl_Bg_Ydan_Maruta +ovl_Bg_Ydan_Sp +ovl_Bg_Zg +ovl_Boss_Dodongo +ovl_Boss_Fd +ovl_Boss_Fd2 +ovl_Boss_Ganon +ovl_Boss_Ganon2 +ovl_Boss_Ganondrof +ovl_Boss_Goma +ovl_Boss_Mo +ovl_Boss_Sst +ovl_Boss_Tw +ovl_Boss_Va +ovl_Demo_6K +ovl_Demo_Du +ovl_Demo_Ec +ovl_Demo_Effect +ovl_Demo_Ext +ovl_Demo_Geff +ovl_Demo_Gj +ovl_Demo_Go +ovl_Demo_Gt +ovl_Demo_Ik +ovl_Demo_Im +ovl_Demo_Kankyo +ovl_Demo_Kekkai +ovl_Demo_Sa +ovl_Demo_Shd +ovl_Demo_Tre_Lgt +ovl_Door_Ana +ovl_Door_Gerudo +ovl_Door_Killer +ovl_Door_Shutter +ovl_Door_Toki +ovl_Door_Warp1 +ovl_Efc_Erupc +ovl_Eff_Dust +ovl_Effect_Ss_Blast +ovl_Effect_Ss_Bomb +ovl_Effect_Ss_Bomb2 +ovl_Effect_Ss_Bubble +ovl_Effect_Ss_D_Fire +ovl_Effect_Ss_Dead_Db +ovl_Effect_Ss_Dead_Dd +ovl_Effect_Ss_Dead_Ds +ovl_Effect_Ss_Dead_Sound +ovl_Effect_Ss_Dt_Bubble +ovl_Effect_Ss_Dust +ovl_Effect_Ss_En_Fire +ovl_Effect_Ss_En_Ice +ovl_Effect_Ss_Extra +ovl_Effect_Ss_Fcircle +ovl_Effect_Ss_Fhg_Flash +ovl_Effect_Ss_Fire_Tail +ovl_Effect_Ss_G_Fire +ovl_Effect_Ss_G_Magma +ovl_Effect_Ss_G_Magma2 +ovl_Effect_Ss_G_Ripple +ovl_Effect_Ss_G_Spk +ovl_Effect_Ss_G_Splash +ovl_Effect_Ss_Hahen +ovl_Effect_Ss_HitMark +ovl_Effect_Ss_Ice_Piece +ovl_Effect_Ss_Ice_Smoke +ovl_Effect_Ss_K_Fire +ovl_Effect_Ss_Kakera +ovl_Effect_Ss_KiraKira +ovl_Effect_Ss_Lightning +ovl_Effect_Ss_Sibuki +ovl_Effect_Ss_Sibuki2 +ovl_Effect_Ss_Solder_Srch_Ball +ovl_Effect_Ss_Stick +ovl_Effect_Ss_Stone1 +ovl_Elf_Msg +ovl_Elf_Msg2 +ovl_En_Am +ovl_En_Ani +ovl_En_Anubice +ovl_En_Anubice_Fire +ovl_En_Anubice_Tag +ovl_En_Arow_Trap +ovl_En_Arrow +ovl_En_Attack_Niw +ovl_En_Ba +ovl_En_Bb +ovl_En_Bdfire +ovl_En_Bigokuta +ovl_En_Bili +ovl_En_Bird +ovl_En_Blkobj +ovl_En_Bom +ovl_En_Bom_Bowl_Man +ovl_En_Bom_Bowl_Pit +ovl_En_Bom_Chu +ovl_En_Bombf +ovl_En_Boom +ovl_En_Box +ovl_En_Brob +ovl_En_Bubble +ovl_En_Butte +ovl_En_Bw +ovl_En_Bx +ovl_En_Changer +ovl_En_Clear_Tag +ovl_En_Cow +ovl_En_Crow +ovl_En_Cs +ovl_En_Daiku +ovl_En_Daiku_Kakariko +ovl_En_Dekubaba +ovl_En_Dekunuts +ovl_En_Dh +ovl_En_Dha +ovl_En_Diving_Game +ovl_En_Dns +ovl_En_Dnt_Demo +ovl_En_Dnt_Jiji +ovl_En_Dnt_Nomal +ovl_En_Dodojr +ovl_En_Dodongo +ovl_En_Dog +ovl_En_Door +ovl_En_Ds +ovl_En_Du +ovl_En_Dy_Extra +ovl_En_Eg +ovl_En_Eiyer +ovl_En_Elf +ovl_En_Encount1 +ovl_En_Encount2 +ovl_En_Ex_Item +ovl_En_Ex_Ruppy +ovl_En_Fd +ovl_En_Fd_Fire +ovl_En_Fhg_Fire +ovl_En_Fire_Rock +ovl_En_Firefly +ovl_En_Fish +ovl_En_Floormas +ovl_En_Fr +ovl_En_Fu +ovl_En_Fw +ovl_En_Fz +ovl_En_G_Switch +ovl_En_Ganon_Mant +ovl_En_Ganon_Organ +ovl_En_Gb +ovl_En_Ge1 +ovl_En_Ge2 +ovl_En_Ge3 +ovl_En_GeldB +ovl_En_GirlA +ovl_En_Gm +ovl_En_Go +ovl_En_Go2 +ovl_En_Goma +ovl_En_Goroiwa +ovl_En_Gs +ovl_En_Guest +ovl_En_Hata +ovl_En_Heishi1 +ovl_En_Heishi2 +ovl_En_Heishi3 +ovl_En_Heishi4 +ovl_En_Hintnuts +ovl_En_Holl +ovl_En_Honotrap +ovl_En_Horse +ovl_En_Horse_Game_Check +ovl_En_Horse_Ganon +ovl_En_Horse_Link_Child +ovl_En_Horse_Normal +ovl_En_Horse_Zelda +ovl_En_Hs +ovl_En_Hs2 +ovl_En_Hy +ovl_En_Ice_Hono +ovl_En_Ik +ovl_En_In +ovl_En_Insect +ovl_En_Ishi +ovl_En_It +ovl_En_Jj +ovl_En_Js +ovl_En_Jsjutan +ovl_En_Kakasi +ovl_En_Kakasi2 +ovl_En_Kakasi3 +ovl_En_Kanban +ovl_En_Karebaba +ovl_En_Ko +ovl_En_Kusa +ovl_En_Kz +ovl_En_Light +ovl_En_Lightbox +ovl_En_M_Fire1 +ovl_En_M_Thunder +ovl_En_Ma1 +ovl_En_Ma2 +ovl_En_Ma3 +ovl_En_Mag +ovl_En_Mb +ovl_En_Md +ovl_En_Mk +ovl_En_Mm +ovl_En_Mm2 +ovl_En_Ms +ovl_En_Mu +ovl_En_Nb +ovl_En_Niw +ovl_En_Niw_Girl +ovl_En_Niw_Lady +ovl_En_Nutsball +ovl_En_Nwc +ovl_En_Ny +ovl_En_OE2 +ovl_En_Okarina_Effect +ovl_En_Okarina_Tag +ovl_En_Okuta +ovl_En_Ossan +ovl_En_Owl +ovl_En_Part +ovl_En_Peehat +ovl_En_Po_Desert +ovl_En_Po_Field +ovl_En_Po_Relay +ovl_En_Po_Sisters +ovl_En_Poh +ovl_En_Pu_box +ovl_En_Rd +ovl_En_Reeba +ovl_En_River_Sound +ovl_En_Rl +ovl_En_Rr +ovl_En_Ru1 +ovl_En_Ru2 +ovl_En_Sa +ovl_En_Sb +ovl_En_Scene_Change +ovl_En_Sda +ovl_En_Shopnuts +ovl_En_Si +ovl_En_Siofuki +ovl_En_Skb +ovl_En_Skj +ovl_En_Skjneedle +ovl_En_Ssh +ovl_En_St +ovl_En_Sth +ovl_En_Stream +ovl_En_Sw +ovl_En_Syateki_Itm +ovl_En_Syateki_Man +ovl_En_Syateki_Niw +ovl_En_Ta +ovl_En_Takara_Man +ovl_En_Tana +ovl_En_Tg +ovl_En_Tite +ovl_En_Tk +ovl_En_Torch +ovl_En_Torch2 +ovl_En_Toryo +ovl_En_Tp +ovl_En_Tr +ovl_En_Trap +ovl_En_Tubo_Trap +ovl_En_Vali +ovl_En_Vase +ovl_En_Vb_Ball +ovl_En_Viewer +ovl_En_Vm +ovl_En_Wall_Tubo +ovl_En_Wallmas +ovl_En_Weather_Tag +ovl_En_Weiyer +ovl_En_Wf +ovl_En_Wonder_Item +ovl_En_Wonder_Talk +ovl_En_Wonder_Talk2 +ovl_En_Wood02 +ovl_En_Xc +ovl_En_Yabusame_Mark +ovl_En_Yukabyun +ovl_En_Zf +ovl_En_Zl1 +ovl_En_Zl2 +ovl_En_Zl3 +ovl_En_Zl4 +ovl_En_Zo +ovl_En_fHG +ovl_End_Title +ovl_Fishing +ovl_Item_B_Heart +ovl_Item_Etcetera +ovl_Item_Inbox +ovl_Item_Ocarina +ovl_Item_Shield +ovl_Magic_Dark +ovl_Magic_Fire +ovl_Magic_Wind +ovl_Mir_Ray +ovl_Obj_Bean +ovl_Obj_Blockstop +ovl_Obj_Bombiwa +ovl_Obj_Comb +ovl_Obj_Dekujr +ovl_Obj_Elevator +ovl_Obj_Hamishi +ovl_Obj_Hana +ovl_Obj_Hsblock +ovl_Obj_Ice_Poly +ovl_Obj_Kibako +ovl_Obj_Kibako2 +ovl_Obj_Lift +ovl_Obj_Lightswitch +ovl_Obj_Makekinsuta +ovl_Obj_Makeoshihiki +ovl_Obj_Mure +ovl_Obj_Mure2 +ovl_Obj_Mure3 +ovl_Obj_Oshihiki +ovl_Obj_Roomtimer +ovl_Obj_Switch +ovl_Obj_Syokudai +ovl_Obj_Timeblock +ovl_Obj_Tsubo +ovl_Obj_Warp2block +ovl_Object_Kankyo +ovl_Oceff_Spot +ovl_Oceff_Storm +ovl_Oceff_Wipe +ovl_Oceff_Wipe2 +ovl_Oceff_Wipe3 +ovl_Oceff_Wipe4 +ovl_Shot_Sun +gameplay_keep +gameplay_field_keep +gameplay_dangeon_keep +gameplay_object_exchange_static +object_link_boy +object_link_child +object_box +object_human +object_okuta +object_poh +object_wallmaster +object_dy_obj +object_firefly +object_dodongo +object_fire +object_niw +object_tite +object_reeba +object_peehat +object_kingdodongo +object_horse +object_zf +object_goma +object_zl1 +object_gol +object_bubble +object_dodojr +object_torch2 +object_bl +object_tp +object_oA1 +object_st +object_bw +object_ei +object_horse_normal +object_oB1 +object_o_anime +object_spot04_objects +object_ddan_objects +object_hidan_objects +object_horse_ganon +object_oA2 +object_spot00_objects +object_mb +object_bombf +object_sk2 +object_oE1 +object_oE_anime +object_oE2 +object_ydan_objects +object_gnd +object_am +object_dekubaba +object_oA3 +object_oA4 +object_oA5 +object_oA6 +object_oA7 +object_jj +object_oA8 +object_oA9 +object_oB2 +object_oB3 +object_oB4 +object_horse_zelda +object_opening_demo1 +object_warp1 +object_b_heart +object_dekunuts +object_oE3 +object_oE4 +object_menkuri_objects +object_oE5 +object_oE6 +object_oE7 +object_oE8 +object_oE9 +object_oE10 +object_oE11 +object_oE12 +object_vali +object_oA10 +object_oA11 +object_mizu_objects +object_fhg +object_ossan +object_mori_hineri1 +object_Bb +object_toki_objects +object_yukabyun +object_zl2 +object_mjin +object_mjin_flash +object_mjin_dark +object_mjin_flame +object_mjin_ice +object_mjin_soul +object_mjin_wind +object_mjin_oka +object_haka_objects +object_spot06_objects +object_ice_objects +object_relay_objects +object_mori_hineri1a +object_mori_hineri2 +object_mori_hineri2a +object_mori_objects +object_mori_tex +object_spot08_obj +object_warp2 +object_hata +object_bird +object_wood02 +object_lightbox +object_pu_box +object_trap +object_vase +object_im +object_ta +object_tk +object_xc +object_vm +object_bv +object_hakach_objects +object_efc_crystal_light +object_efc_fire_ball +object_efc_flash +object_efc_lgt_shower +object_efc_star_field +object_god_lgt +object_light_ring +object_triforce_spot +object_medal +object_bdan_objects +object_sd +object_rd +object_po_sisters +object_heavy_object +object_gndd +object_fd +object_du +object_fw +object_horse_link_child +object_spot02_objects +object_haka +object_ru1 +object_syokudai +object_fd2 +object_dh +object_rl +object_efc_tw +object_demo_tre_lgt +object_gi_key +object_mir_ray +object_brob +object_gi_jewel +object_spot09_obj +object_spot18_obj +object_bdoor +object_spot17_obj +object_shop_dungen +object_nb +object_mo +object_sb +object_gi_melody +object_gi_heart +object_gi_compass +object_gi_bosskey +object_gi_medal +object_gi_nuts +object_sa +object_gi_hearts +object_gi_arrowcase +object_gi_bombpouch +object_in +object_tr +object_spot16_obj +object_oE1s +object_oE4s +object_os_anime +object_gi_bottle +object_gi_stick +object_gi_map +object_oF1d_map +object_ru2 +object_gi_shield_1 +object_dekujr +object_gi_magicpot +object_gi_bomb_1 +object_oF1s +object_ma2 +object_gi_purse +object_hni +object_tw +object_rr +object_bxa +object_anubice +object_gi_gerudo +object_gi_arrow +object_gi_bomb_2 +object_gi_egg +object_gi_scale +object_gi_shield_2 +object_gi_hookshot +object_gi_ocarina +object_gi_milk +object_ma1 +object_ganon +object_sst +object_ny +object_fr +object_gi_pachinko +object_gi_boomerang +object_gi_bow +object_gi_glasses +object_gi_liquid +object_ani +object_demo_6k +object_gi_shield_3 +object_gi_letter +object_spot15_obj +object_jya_obj +object_gi_clothes +object_gi_bean +object_gi_fish +object_gi_saw +object_gi_hammer +object_gi_grass +object_gi_longsword +object_spot01_objects +object_md +object_km1 +object_kw1 +object_zo +object_kz +object_umajump +object_masterkokiri +object_masterkokirihead +object_mastergolon +object_masterzoora +object_aob +object_ik +object_ahg +object_cne +object_gi_niwatori +object_skj +object_gi_bottle_letter +object_bji +object_bba +object_gi_ocarina_0 +object_ds +object_ane +object_boj +object_spot03_object +object_spot07_object +object_fz +object_bob +object_ge1 +object_yabusame_point +object_gi_boots_2 +object_gi_seed +object_gnd_magic +object_d_elevator +object_d_hsblock +object_d_lift +object_mamenoki +object_goroiwa +object_toryo +object_daiku +object_nwc +object_blkobj +object_gm +object_ms +object_hs +object_ingate +object_lightswitch +object_kusa +object_tsubo +object_gi_gloves +object_gi_coin +object_kanban +object_gjyo_objects +object_owl +object_mk +object_fu +object_gi_ki_tan_mask +object_gi_redead_mask +object_gi_skj_mask +object_gi_rabit_mask +object_gi_truth_mask +object_ganon_objects +object_siofuki +object_stream +object_mm +object_fa +object_os +object_gi_eye_lotion +object_gi_powder +object_gi_mushroom +object_gi_ticketstone +object_gi_brokensword +object_js +object_cs +object_gi_prescription +object_gi_bracelet +object_gi_soldout +object_gi_frog +object_mag +object_door_gerudo +object_gt +object_efc_erupc +object_zl2_anime1 +object_zl2_anime2 +object_gi_golonmask +object_gi_zoramask +object_gi_gerudomask +object_ganon2 +object_ka +object_ts +object_zg +object_gi_hoverboots +object_gi_m_arrow +object_ds2 +object_ec +object_fish +object_gi_sutaru +object_gi_goddess +object_ssh +object_bigokuta +object_bg +object_spot05_objects +object_spot12_obj +object_bombiwa +object_hintnuts +object_rs +object_spot00_break +object_gla +object_shopnuts +object_geldb +object_gr +object_dog +object_jya_iron +object_jya_door +object_spot01_objects2 +object_spot11_obj +object_kibako2 +object_dns +object_dnk +object_gi_fire +object_gi_insect +object_gi_butterfly +object_gi_ghost +object_gi_soul +object_bowl +object_po_field +object_demo_kekkai +object_efc_doughnut +object_gi_dekupouch +object_ganon_anime1 +object_ganon_anime2 +object_ganon_anime3 +object_gi_rupy +object_spot01_matoya +object_spot01_matoyab +object_po_composer +object_mu +object_wf +object_skb +object_gj +object_geff +object_haka_door +object_gs +object_ps +object_bwall +object_crow +object_cow +object_cob +object_gi_sword_1 +object_door_killer +object_ouke_haka +object_timeblock +object_zl4 +g_pn_01 +g_pn_02 +g_pn_03 +g_pn_04 +g_pn_05 +g_pn_06 +g_pn_07 +g_pn_08 +g_pn_09 +g_pn_10 +g_pn_11 +g_pn_12 +g_pn_13 +g_pn_14 +g_pn_15 +g_pn_16 +g_pn_17 +g_pn_18 +g_pn_19 +g_pn_20 +g_pn_21 +g_pn_22 +g_pn_23 +g_pn_24 +g_pn_25 +g_pn_26 +g_pn_27 +g_pn_28 +g_pn_29 +g_pn_30 +g_pn_31 +g_pn_32 +g_pn_33 +g_pn_34 +g_pn_35 +g_pn_36 +g_pn_37 +g_pn_38 +g_pn_39 +g_pn_40 +g_pn_41 +g_pn_42 +g_pn_43 +g_pn_44 +g_pn_45 +g_pn_46 +g_pn_47 +g_pn_48 +g_pn_49 +g_pn_50 +g_pn_51 +g_pn_52 +g_pn_53 +g_pn_54 +g_pn_55 +g_pn_56 +g_pn_57 +z_select_static +nintendo_rogo_static +title_static +parameter_static +vr_fine0_static +vr_fine0_pal_static +vr_fine1_static +vr_fine1_pal_static +vr_fine2_static +vr_fine2_pal_static +vr_fine3_static +vr_fine3_pal_static +vr_cloud0_static +vr_cloud0_pal_static +vr_cloud1_static +vr_cloud1_pal_static +vr_cloud2_static +vr_cloud2_pal_static +vr_cloud3_static +vr_cloud3_pal_static +vr_holy0_static +vr_holy0_pal_static +vr_holy1_static +vr_holy1_pal_static +vr_MDVR_static +vr_MDVR_pal_static +vr_MNVR_static +vr_MNVR_pal_static +vr_RUVR_static +vr_RUVR_pal_static +vr_LHVR_static +vr_LHVR_pal_static +vr_KHVR_static +vr_KHVR_pal_static +vr_K3VR_static +vr_K3VR_pal_static +vr_K4VR_static +vr_K4VR_pal_static +vr_K5VR_static +vr_K5VR_pal_static +vr_SP1a_static +vr_SP1a_pal_static +vr_MLVR_static +vr_MLVR_pal_static +vr_KKRVR_static +vr_KKRVR_pal_static +vr_KR3VR_static +vr_KR3VR_pal_static +vr_IPVR_static +vr_IPVR_pal_static +vr_KSVR_static +vr_KSVR_pal_static +vr_GLVR_static +vr_GLVR_pal_static +vr_ZRVR_static +vr_ZRVR_pal_static +vr_DGVR_static +vr_DGVR_pal_static +vr_ALVR_static +vr_ALVR_pal_static +vr_NSVR_static +vr_NSVR_pal_static +vr_LBVR_static +vr_LBVR_pal_static +vr_TTVR_static +vr_TTVR_pal_static +vr_FCVR_static +vr_FCVR_pal_static +elf_message_field +elf_message_ydan +ydan_scene +ydan_room_0 +ydan_room_1 +ydan_room_2 +ydan_room_3 +ydan_room_4 +ydan_room_5 +ydan_room_6 +ydan_room_7 +ydan_room_8 +ydan_room_9 +ydan_room_10 +ydan_room_11 +ddan_scene +ddan_room_0 +ddan_room_1 +ddan_room_2 +ddan_room_3 +ddan_room_4 +ddan_room_5 +ddan_room_6 +ddan_room_7 +ddan_room_8 +ddan_room_9 +ddan_room_10 +ddan_room_11 +ddan_room_12 +ddan_room_13 +ddan_room_14 +ddan_room_15 +ddan_room_16 +bdan_scene +bdan_room_0 +bdan_room_1 +bdan_room_2 +bdan_room_3 +bdan_room_4 +bdan_room_5 +bdan_room_6 +bdan_room_7 +bdan_room_8 +bdan_room_9 +bdan_room_10 +bdan_room_11 +bdan_room_12 +bdan_room_13 +bdan_room_14 +bdan_room_15 +Bmori1_scene +Bmori1_room_0 +Bmori1_room_1 +Bmori1_room_2 +Bmori1_room_3 +Bmori1_room_4 +Bmori1_room_5 +Bmori1_room_6 +Bmori1_room_7 +Bmori1_room_8 +Bmori1_room_9 +Bmori1_room_10 +Bmori1_room_11 +Bmori1_room_12 +Bmori1_room_13 +Bmori1_room_14 +Bmori1_room_15 +Bmori1_room_16 +Bmori1_room_17 +Bmori1_room_18 +Bmori1_room_19 +Bmori1_room_20 +Bmori1_room_21 +Bmori1_room_22 +HIDAN_scene +HIDAN_room_0 +HIDAN_room_1 +HIDAN_room_2 +HIDAN_room_3 +HIDAN_room_4 +HIDAN_room_5 +HIDAN_room_6 +HIDAN_room_7 +HIDAN_room_8 +HIDAN_room_9 +HIDAN_room_10 +HIDAN_room_11 +HIDAN_room_12 +HIDAN_room_13 +HIDAN_room_14 +HIDAN_room_15 +HIDAN_room_16 +HIDAN_room_17 +HIDAN_room_18 +HIDAN_room_19 +HIDAN_room_20 +HIDAN_room_21 +HIDAN_room_22 +HIDAN_room_23 +HIDAN_room_24 +HIDAN_room_25 +HIDAN_room_26 +MIZUsin_scene +MIZUsin_room_0 +MIZUsin_room_1 +MIZUsin_room_2 +MIZUsin_room_3 +MIZUsin_room_4 +MIZUsin_room_5 +MIZUsin_room_6 +MIZUsin_room_7 +MIZUsin_room_8 +MIZUsin_room_9 +MIZUsin_room_10 +MIZUsin_room_11 +MIZUsin_room_12 +MIZUsin_room_13 +MIZUsin_room_14 +MIZUsin_room_15 +MIZUsin_room_16 +MIZUsin_room_17 +MIZUsin_room_18 +MIZUsin_room_19 +MIZUsin_room_20 +MIZUsin_room_21 +MIZUsin_room_22 +jyasinzou_scene +jyasinzou_room_0 +jyasinzou_room_1 +jyasinzou_room_2 +jyasinzou_room_3 +jyasinzou_room_4 +jyasinzou_room_5 +jyasinzou_room_6 +jyasinzou_room_7 +jyasinzou_room_8 +jyasinzou_room_9 +jyasinzou_room_10 +jyasinzou_room_11 +jyasinzou_room_12 +jyasinzou_room_13 +jyasinzou_room_14 +jyasinzou_room_15 +jyasinzou_room_16 +jyasinzou_room_17 +jyasinzou_room_18 +jyasinzou_room_19 +jyasinzou_room_20 +jyasinzou_room_21 +jyasinzou_room_22 +jyasinzou_room_23 +jyasinzou_room_24 +jyasinzou_room_25 +jyasinzou_room_26 +jyasinzou_room_27 +jyasinzou_room_28 +HAKAdan_scene +HAKAdan_room_0 +HAKAdan_room_1 +HAKAdan_room_2 +HAKAdan_room_3 +HAKAdan_room_4 +HAKAdan_room_5 +HAKAdan_room_6 +HAKAdan_room_7 +HAKAdan_room_8 +HAKAdan_room_9 +HAKAdan_room_10 +HAKAdan_room_11 +HAKAdan_room_12 +HAKAdan_room_13 +HAKAdan_room_14 +HAKAdan_room_15 +HAKAdan_room_16 +HAKAdan_room_17 +HAKAdan_room_18 +HAKAdan_room_19 +HAKAdan_room_20 +HAKAdan_room_21 +HAKAdan_room_22 +HAKAdanCH_scene +HAKAdanCH_room_0 +HAKAdanCH_room_1 +HAKAdanCH_room_2 +HAKAdanCH_room_3 +HAKAdanCH_room_4 +HAKAdanCH_room_5 +HAKAdanCH_room_6 +ice_doukutu_scene +ice_doukutu_room_0 +ice_doukutu_room_1 +ice_doukutu_room_2 +ice_doukutu_room_3 +ice_doukutu_room_4 +ice_doukutu_room_5 +ice_doukutu_room_6 +ice_doukutu_room_7 +ice_doukutu_room_8 +ice_doukutu_room_9 +ice_doukutu_room_10 +ice_doukutu_room_11 +men_scene +men_room_0 +men_room_1 +men_room_2 +men_room_3 +men_room_4 +men_room_5 +men_room_6 +men_room_7 +men_room_8 +men_room_9 +men_room_10 +ganontika_scene +ganontika_room_0 +ganontika_room_1 +ganontika_room_2 +ganontika_room_3 +ganontika_room_4 +ganontika_room_5 +ganontika_room_6 +ganontika_room_7 +ganontika_room_8 +ganontika_room_9 +ganontika_room_10 +ganontika_room_11 +ganontika_room_12 +ganontika_room_13 +ganontika_room_14 +ganontika_room_15 +ganontika_room_16 +ganontika_room_17 +ganontika_room_18 +ganontika_room_19 +spot00_scene +spot00_room_0 +spot01_scene +spot01_room_0 +spot02_scene +spot02_room_0 +spot02_room_1 +spot03_scene +spot03_room_0 +spot03_room_1 +spot04_scene +spot04_room_0 +spot04_room_1 +spot04_room_2 +spot05_scene +spot05_room_0 +spot06_scene +spot06_room_0 +spot07_scene +spot07_room_0 +spot07_room_1 +spot08_scene +spot08_room_0 +spot09_scene +spot09_room_0 +spot10_scene +spot10_room_0 +spot10_room_1 +spot10_room_2 +spot10_room_3 +spot10_room_4 +spot10_room_5 +spot10_room_6 +spot10_room_7 +spot10_room_8 +spot10_room_9 +spot11_scene +spot11_room_0 +spot12_scene +spot12_room_0 +spot12_room_1 +spot13_scene +spot13_room_0 +spot13_room_1 +spot15_scene +spot15_room_0 +spot16_scene +spot16_room_0 +spot17_scene +spot17_room_0 +spot17_room_1 +spot18_scene +spot18_room_0 +spot18_room_1 +spot18_room_2 +spot18_room_3 +market_day_scene +market_day_room_0 +market_night_scene +market_night_room_0 +kenjyanoma_scene +kenjyanoma_room_0 +tokinoma_scene +tokinoma_room_0 +tokinoma_room_1 +link_home_scene +link_home_room_0 +kokiri_shop_scene +kokiri_shop_room_0 +kokiri_home_scene +kokiri_home_room_0 +kakusiana_scene +kakusiana_room_0 +kakusiana_room_1 +kakusiana_room_2 +kakusiana_room_3 +kakusiana_room_4 +kakusiana_room_5 +kakusiana_room_6 +kakusiana_room_7 +kakusiana_room_8 +kakusiana_room_9 +kakusiana_room_10 +kakusiana_room_11 +kakusiana_room_12 +kakusiana_room_13 +entra_scene +entra_room_0 +moribossroom_scene +moribossroom_room_0 +moribossroom_room_1 +syatekijyou_scene +syatekijyou_room_0 +shop1_scene +shop1_room_0 +hairal_niwa_scene +hairal_niwa_room_0 +ganon_tou_scene +ganon_tou_room_0 +market_alley_scene +market_alley_room_0 +spot20_scene +spot20_room_0 +market_ruins_scene +market_ruins_room_0 +entra_n_scene +entra_n_room_0 +enrui_scene +enrui_room_0 +market_alley_n_scene +market_alley_n_room_0 +hiral_demo_scene +hiral_demo_room_0 +kokiri_home3_scene +kokiri_home3_room_0 +malon_stable_scene +malon_stable_room_0 +kakariko_scene +kakariko_room_0 +bdan_boss_scene +bdan_boss_room_0 +bdan_boss_room_1 +FIRE_bs_scene +FIRE_bs_room_0 +FIRE_bs_room_1 +hut_scene +hut_room_0 +daiyousei_izumi_scene +daiyousei_izumi_room_0 +hakaana_scene +hakaana_room_0 +yousei_izumi_tate_scene +yousei_izumi_tate_room_0 +yousei_izumi_yoko_scene +yousei_izumi_yoko_room_0 +golon_scene +golon_room_0 +zoora_scene +zoora_room_0 +drag_scene +drag_room_0 +alley_shop_scene +alley_shop_room_0 +night_shop_scene +night_shop_room_0 +impa_scene +impa_room_0 +labo_scene +labo_room_0 +tent_scene +tent_room_0 +nakaniwa_scene +nakaniwa_room_0 +ddan_boss_scene +ddan_boss_room_0 +ddan_boss_room_1 +ydan_boss_scene +ydan_boss_room_0 +ydan_boss_room_1 +HAKAdan_bs_scene +HAKAdan_bs_room_0 +HAKAdan_bs_room_1 +MIZUsin_bs_scene +MIZUsin_bs_room_0 +MIZUsin_bs_room_1 +ganon_scene +ganon_room_0 +ganon_room_1 +ganon_room_2 +ganon_room_3 +ganon_room_4 +ganon_room_5 +ganon_room_6 +ganon_room_7 +ganon_room_8 +ganon_room_9 +ganon_boss_scene +ganon_boss_room_0 +jyasinboss_scene +jyasinboss_room_0 +jyasinboss_room_1 +jyasinboss_room_2 +jyasinboss_room_3 +kokiri_home4_scene +kokiri_home4_room_0 +kokiri_home5_scene +kokiri_home5_room_0 +ganon_final_scene +ganon_final_room_0 +kakariko3_scene +kakariko3_room_0 +hakasitarelay_scene +hakasitarelay_room_0 +hakasitarelay_room_1 +hakasitarelay_room_2 +hakasitarelay_room_3 +hakasitarelay_room_4 +hakasitarelay_room_5 +hakasitarelay_room_6 +shrine_scene +shrine_room_0 +turibori_scene +turibori_room_0 +shrine_n_scene +shrine_n_room_0 +shrine_r_scene +shrine_r_room_0 +hakaana2_scene +hakaana2_room_0 +gerudoway_scene +gerudoway_room_0 +gerudoway_room_1 +gerudoway_room_2 +gerudoway_room_3 +gerudoway_room_4 +gerudoway_room_5 +hairal_niwa_n_scene +hairal_niwa_n_room_0 +bowling_scene +bowling_room_0 +hakaana_ouke_scene +hakaana_ouke_room_0 +hakaana_ouke_room_1 +hakaana_ouke_room_2 +hylia_labo_scene +hylia_labo_room_0 +souko_scene +souko_room_0 +souko_room_1 +souko_room_2 +miharigoya_scene +miharigoya_room_0 +mahouya_scene +mahouya_room_0 +takaraya_scene +takaraya_room_0 +takaraya_room_1 +takaraya_room_2 +takaraya_room_3 +takaraya_room_4 +takaraya_room_5 +takaraya_room_6 +ganon_sonogo_scene +ganon_sonogo_room_0 +ganon_sonogo_room_1 +ganon_sonogo_room_2 +ganon_sonogo_room_3 +ganon_sonogo_room_4 +ganon_demo_scene +ganon_demo_room_0 +face_shop_scene +face_shop_room_0 +kinsuta_scene +kinsuta_room_0 +ganontikasonogo_scene +ganontikasonogo_room_0 +ganontikasonogo_room_1 +bump_texture_static +anime_model_1_static +anime_model_2_static +anime_model_3_static +anime_model_4_static +anime_model_5_static +anime_model_6_static +anime_texture_1_static +anime_texture_2_static +anime_texture_3_static +anime_texture_4_static +anime_texture_5_static +anime_texture_6_static +softsprite_matrix_static diff --git a/baseroms/gc-eu-mq/dmadata_start.txt b/baseroms/gc-eu-mq/dmadata_start.txt new file mode 100644 index 000000000..08515b6d6 --- /dev/null +++ b/baseroms/gc-eu-mq/dmadata_start.txt @@ -0,0 +1 @@ +0x07170 diff --git a/baseroms/hackeroot-mq/checksum.md5 b/baseroms/hackeroot-mq/checksum.md5 new file mode 100644 index 000000000..55af8fae8 --- /dev/null +++ b/baseroms/hackeroot-mq/checksum.md5 @@ -0,0 +1 @@ +f0b7f35375f9cc8ca1b2d59d78e35405 build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.z64 diff --git a/baseroms/hackeroot-mq/dmadata_names.txt b/baseroms/hackeroot-mq/dmadata_names.txt new file mode 100644 index 000000000..60e3b0aa8 --- /dev/null +++ b/baseroms/hackeroot-mq/dmadata_names.txt @@ -0,0 +1,1532 @@ +makerom +boot +dmadata +Audiobank +Audioseq +Audiotable +link_animetion +icon_item_static +icon_item_24_static +icon_item_field_static +icon_item_dungeon_static +icon_item_gameover_static +icon_item_nes_static +icon_item_ger_static +icon_item_fra_static +item_name_static +map_name_static +do_action_static +message_static +message_texture_static +nes_font_static +nes_message_data_static +ger_message_data_static +fra_message_data_static +staff_message_data_static +map_grand_static +map_i_static +map_48x85_static +code +ovl_title +ovl_select +ovl_opening +ovl_file_choose +ovl_kaleido_scope +ovl_player_actor +ovl_map_mark_data +ovl_En_Test +ovl_Arms_Hook +ovl_Arrow_Fire +ovl_Arrow_Ice +ovl_Arrow_Light +ovl_Bg_Bdan_Objects +ovl_Bg_Bdan_Switch +ovl_Bg_Bom_Guard +ovl_Bg_Bombwall +ovl_Bg_Bowl_Wall +ovl_Bg_Breakwall +ovl_Bg_Ddan_Jd +ovl_Bg_Ddan_Kd +ovl_Bg_Dodoago +ovl_Bg_Dy_Yoseizo +ovl_Bg_Ganon_Otyuka +ovl_Bg_Gate_Shutter +ovl_Bg_Gjyo_Bridge +ovl_Bg_Gnd_Darkmeiro +ovl_Bg_Gnd_Firemeiro +ovl_Bg_Gnd_Iceblock +ovl_Bg_Gnd_Nisekabe +ovl_Bg_Gnd_Soulmeiro +ovl_Bg_Haka +ovl_Bg_Haka_Gate +ovl_Bg_Haka_Huta +ovl_Bg_Haka_Megane +ovl_Bg_Haka_MeganeBG +ovl_Bg_Haka_Sgami +ovl_Bg_Haka_Ship +ovl_Bg_Haka_Trap +ovl_Bg_Haka_Tubo +ovl_Bg_Haka_Water +ovl_Bg_Haka_Zou +ovl_Bg_Heavy_Block +ovl_Bg_Hidan_Curtain +ovl_Bg_Hidan_Dalm +ovl_Bg_Hidan_Firewall +ovl_Bg_Hidan_Fslift +ovl_Bg_Hidan_Fwbig +ovl_Bg_Hidan_Hamstep +ovl_Bg_Hidan_Hrock +ovl_Bg_Hidan_Kousi +ovl_Bg_Hidan_Kowarerukabe +ovl_Bg_Hidan_Rock +ovl_Bg_Hidan_Rsekizou +ovl_Bg_Hidan_Sekizou +ovl_Bg_Hidan_Sima +ovl_Bg_Hidan_Syoku +ovl_Bg_Ice_Objects +ovl_Bg_Ice_Shelter +ovl_Bg_Ice_Shutter +ovl_Bg_Ice_Turara +ovl_Bg_Ingate +ovl_Bg_Jya_1flift +ovl_Bg_Jya_Amishutter +ovl_Bg_Jya_Bigmirror +ovl_Bg_Jya_Block +ovl_Bg_Jya_Bombchuiwa +ovl_Bg_Jya_Bombiwa +ovl_Bg_Jya_Cobra +ovl_Bg_Jya_Goroiwa +ovl_Bg_Jya_Haheniron +ovl_Bg_Jya_Ironobj +ovl_Bg_Jya_Kanaami +ovl_Bg_Jya_Lift +ovl_Bg_Jya_Megami +ovl_Bg_Jya_Zurerukabe +ovl_Bg_Menkuri_Eye +ovl_Bg_Menkuri_Kaiten +ovl_Bg_Menkuri_Nisekabe +ovl_Bg_Mizu_Bwall +ovl_Bg_Mizu_Movebg +ovl_Bg_Mizu_Shutter +ovl_Bg_Mizu_Uzu +ovl_Bg_Mizu_Water +ovl_Bg_Mjin +ovl_Bg_Mori_Bigst +ovl_Bg_Mori_Elevator +ovl_Bg_Mori_Hashigo +ovl_Bg_Mori_Hashira4 +ovl_Bg_Mori_Hineri +ovl_Bg_Mori_Idomizu +ovl_Bg_Mori_Kaitenkabe +ovl_Bg_Mori_Rakkatenjo +ovl_Bg_Po_Event +ovl_Bg_Po_Syokudai +ovl_Bg_Pushbox +ovl_Bg_Relay_Objects +ovl_Bg_Spot00_Break +ovl_Bg_Spot00_Hanebasi +ovl_Bg_Spot01_Fusya +ovl_Bg_Spot01_Idohashira +ovl_Bg_Spot01_Idomizu +ovl_Bg_Spot01_Idosoko +ovl_Bg_Spot01_Objects2 +ovl_Bg_Spot02_Objects +ovl_Bg_Spot03_Taki +ovl_Bg_Spot05_Soko +ovl_Bg_Spot06_Objects +ovl_Bg_Spot07_Taki +ovl_Bg_Spot08_Bakudankabe +ovl_Bg_Spot08_Iceblock +ovl_Bg_Spot09_Obj +ovl_Bg_Spot11_Bakudankabe +ovl_Bg_Spot11_Oasis +ovl_Bg_Spot12_Gate +ovl_Bg_Spot12_Saku +ovl_Bg_Spot15_Rrbox +ovl_Bg_Spot15_Saku +ovl_Bg_Spot16_Bombstone +ovl_Bg_Spot16_Doughnut +ovl_Bg_Spot17_Bakudankabe +ovl_Bg_Spot17_Funen +ovl_Bg_Spot18_Basket +ovl_Bg_Spot18_Futa +ovl_Bg_Spot18_Obj +ovl_Bg_Spot18_Shutter +ovl_Bg_Sst_Floor +ovl_Bg_Toki_Hikari +ovl_Bg_Toki_Swd +ovl_Bg_Treemouth +ovl_Bg_Umajump +ovl_Bg_Vb_Sima +ovl_Bg_Ydan_Hasi +ovl_Bg_Ydan_Maruta +ovl_Bg_Ydan_Sp +ovl_Bg_Zg +ovl_Boss_Dodongo +ovl_Boss_Fd +ovl_Boss_Fd2 +ovl_Boss_Ganon +ovl_Boss_Ganon2 +ovl_Boss_Ganondrof +ovl_Boss_Goma +ovl_Boss_Mo +ovl_Boss_Sst +ovl_Boss_Tw +ovl_Boss_Va +ovl_Demo_6K +ovl_Demo_Du +ovl_Demo_Ec +ovl_Demo_Effect +ovl_Demo_Ext +ovl_Demo_Geff +ovl_Demo_Gj +ovl_Demo_Go +ovl_Demo_Gt +ovl_Demo_Ik +ovl_Demo_Im +ovl_Demo_Kankyo +ovl_Demo_Kekkai +ovl_Demo_Sa +ovl_Demo_Shd +ovl_Demo_Tre_Lgt +ovl_Door_Ana +ovl_Door_Gerudo +ovl_Door_Killer +ovl_Door_Shutter +ovl_Door_Toki +ovl_Door_Warp1 +ovl_Efc_Erupc +ovl_Eff_Dust +ovl_Effect_Ss_Blast +ovl_Effect_Ss_Bomb +ovl_Effect_Ss_Bomb2 +ovl_Effect_Ss_Bubble +ovl_Effect_Ss_D_Fire +ovl_Effect_Ss_Dead_Db +ovl_Effect_Ss_Dead_Dd +ovl_Effect_Ss_Dead_Ds +ovl_Effect_Ss_Dead_Sound +ovl_Effect_Ss_Dt_Bubble +ovl_Effect_Ss_Dust +ovl_Effect_Ss_En_Fire +ovl_Effect_Ss_En_Ice +ovl_Effect_Ss_Extra +ovl_Effect_Ss_Fcircle +ovl_Effect_Ss_Fhg_Flash +ovl_Effect_Ss_Fire_Tail +ovl_Effect_Ss_G_Fire +ovl_Effect_Ss_G_Magma +ovl_Effect_Ss_G_Magma2 +ovl_Effect_Ss_G_Ripple +ovl_Effect_Ss_G_Spk +ovl_Effect_Ss_G_Splash +ovl_Effect_Ss_Hahen +ovl_Effect_Ss_HitMark +ovl_Effect_Ss_Ice_Piece +ovl_Effect_Ss_Ice_Smoke +ovl_Effect_Ss_K_Fire +ovl_Effect_Ss_Kakera +ovl_Effect_Ss_KiraKira +ovl_Effect_Ss_Lightning +ovl_Effect_Ss_Sibuki +ovl_Effect_Ss_Sibuki2 +ovl_Effect_Ss_Solder_Srch_Ball +ovl_Effect_Ss_Stick +ovl_Effect_Ss_Stone1 +ovl_Elf_Msg +ovl_Elf_Msg2 +ovl_En_Am +ovl_En_Ani +ovl_En_Anubice +ovl_En_Anubice_Fire +ovl_En_Anubice_Tag +ovl_En_Arow_Trap +ovl_En_Arrow +ovl_En_Attack_Niw +ovl_En_Ba +ovl_En_Bb +ovl_En_Bdfire +ovl_En_Bigokuta +ovl_En_Bili +ovl_En_Bird +ovl_En_Blkobj +ovl_En_Bom +ovl_En_Bom_Bowl_Man +ovl_En_Bom_Bowl_Pit +ovl_En_Bom_Chu +ovl_En_Bombf +ovl_En_Boom +ovl_En_Box +ovl_En_Brob +ovl_En_Bubble +ovl_En_Butte +ovl_En_Bw +ovl_En_Bx +ovl_En_Changer +ovl_En_Clear_Tag +ovl_En_Cow +ovl_En_Crow +ovl_En_Cs +ovl_En_Daiku +ovl_En_Daiku_Kakariko +ovl_En_Dekubaba +ovl_En_Dekunuts +ovl_En_Dh +ovl_En_Dha +ovl_En_Diving_Game +ovl_En_Dns +ovl_En_Dnt_Demo +ovl_En_Dnt_Jiji +ovl_En_Dnt_Nomal +ovl_En_Dodojr +ovl_En_Dodongo +ovl_En_Dog +ovl_En_Door +ovl_En_Ds +ovl_En_Du +ovl_En_Dy_Extra +ovl_En_Eg +ovl_En_Eiyer +ovl_En_Elf +ovl_En_Encount1 +ovl_En_Encount2 +ovl_En_Ex_Item +ovl_En_Ex_Ruppy +ovl_En_Fd +ovl_En_Fd_Fire +ovl_En_Fhg_Fire +ovl_En_Fire_Rock +ovl_En_Firefly +ovl_En_Fish +ovl_En_Floormas +ovl_En_Fr +ovl_En_Fu +ovl_En_Fw +ovl_En_Fz +ovl_En_G_Switch +ovl_En_Ganon_Mant +ovl_En_Ganon_Organ +ovl_En_Gb +ovl_En_Ge1 +ovl_En_Ge2 +ovl_En_Ge3 +ovl_En_GeldB +ovl_En_GirlA +ovl_En_Gm +ovl_En_Go +ovl_En_Go2 +ovl_En_Goma +ovl_En_Goroiwa +ovl_En_Gs +ovl_En_Guest +ovl_En_Hata +ovl_En_Heishi1 +ovl_En_Heishi2 +ovl_En_Heishi3 +ovl_En_Heishi4 +ovl_En_Hintnuts +ovl_En_Holl +ovl_En_Honotrap +ovl_En_Horse +ovl_En_Horse_Game_Check +ovl_En_Horse_Ganon +ovl_En_Horse_Link_Child +ovl_En_Horse_Normal +ovl_En_Horse_Zelda +ovl_En_Hs +ovl_En_Hs2 +ovl_En_Hy +ovl_En_Ice_Hono +ovl_En_Ik +ovl_En_In +ovl_En_Insect +ovl_En_Ishi +ovl_En_It +ovl_En_Jj +ovl_En_Js +ovl_En_Jsjutan +ovl_En_Kakasi +ovl_En_Kakasi2 +ovl_En_Kakasi3 +ovl_En_Kanban +ovl_En_Karebaba +ovl_En_Ko +ovl_En_Kusa +ovl_En_Kz +ovl_En_Light +ovl_En_Lightbox +ovl_En_M_Fire1 +ovl_En_M_Thunder +ovl_En_Ma1 +ovl_En_Ma2 +ovl_En_Ma3 +ovl_En_Mag +ovl_En_Mb +ovl_En_Md +ovl_En_Mk +ovl_En_Mm +ovl_En_Mm2 +ovl_En_Ms +ovl_En_Mu +ovl_En_Nb +ovl_En_Niw +ovl_En_Niw_Girl +ovl_En_Niw_Lady +ovl_En_Nutsball +ovl_En_Nwc +ovl_En_Ny +ovl_En_OE2 +ovl_En_Okarina_Effect +ovl_En_Okarina_Tag +ovl_En_Okuta +ovl_En_Ossan +ovl_En_Owl +ovl_En_Part +ovl_En_Peehat +ovl_En_Po_Desert +ovl_En_Po_Field +ovl_En_Po_Relay +ovl_En_Po_Sisters +ovl_En_Poh +ovl_En_Pu_box +ovl_En_Rd +ovl_En_Reeba +ovl_En_River_Sound +ovl_En_Rl +ovl_En_Rr +ovl_En_Ru1 +ovl_En_Ru2 +ovl_En_Sa +ovl_En_Sb +ovl_En_Scene_Change +ovl_En_Sda +ovl_En_Shopnuts +ovl_En_Si +ovl_En_Siofuki +ovl_En_Skb +ovl_En_Skj +ovl_En_Skjneedle +ovl_En_Ssh +ovl_En_St +ovl_En_Sth +ovl_En_Stream +ovl_En_Sw +ovl_En_Syateki_Itm +ovl_En_Syateki_Man +ovl_En_Syateki_Niw +ovl_En_Ta +ovl_En_Takara_Man +ovl_En_Tana +ovl_En_Tg +ovl_En_Tite +ovl_En_Tk +ovl_En_Torch +ovl_En_Torch2 +ovl_En_Toryo +ovl_En_Tp +ovl_En_Tr +ovl_En_Trap +ovl_En_Tubo_Trap +ovl_En_Vali +ovl_En_Vase +ovl_En_Vb_Ball +ovl_En_Viewer +ovl_En_Vm +ovl_En_Wall_Tubo +ovl_En_Wallmas +ovl_En_Weather_Tag +ovl_En_Weiyer +ovl_En_Wf +ovl_En_Wonder_Item +ovl_En_Wonder_Talk +ovl_En_Wonder_Talk2 +ovl_En_Wood02 +ovl_En_Xc +ovl_En_Yabusame_Mark +ovl_En_Yukabyun +ovl_En_Zf +ovl_En_Zl1 +ovl_En_Zl2 +ovl_En_Zl3 +ovl_En_Zl4 +ovl_En_Zo +ovl_En_fHG +ovl_End_Title +ovl_Fishing +ovl_Item_B_Heart +ovl_Item_Etcetera +ovl_Item_Inbox +ovl_Item_Ocarina +ovl_Item_Shield +ovl_Magic_Dark +ovl_Magic_Fire +ovl_Magic_Wind +ovl_Mir_Ray +ovl_Obj_Bean +ovl_Obj_Blockstop +ovl_Obj_Bombiwa +ovl_Obj_Comb +ovl_Obj_Dekujr +ovl_Obj_Elevator +ovl_Obj_Hamishi +ovl_Obj_Hana +ovl_Obj_Hsblock +ovl_Obj_Ice_Poly +ovl_Obj_Kibako +ovl_Obj_Kibako2 +ovl_Obj_Lift +ovl_Obj_Lightswitch +ovl_Obj_Makekinsuta +ovl_Obj_Makeoshihiki +ovl_Obj_Mure +ovl_Obj_Mure2 +ovl_Obj_Mure3 +ovl_Obj_Oshihiki +ovl_Obj_Roomtimer +ovl_Obj_Switch +ovl_Obj_Syokudai +ovl_Obj_Timeblock +ovl_Obj_Tsubo +ovl_Obj_Warp2block +ovl_Object_Kankyo +ovl_Oceff_Spot +ovl_Oceff_Storm +ovl_Oceff_Wipe +ovl_Oceff_Wipe2 +ovl_Oceff_Wipe3 +ovl_Oceff_Wipe4 +ovl_Shot_Sun +gameplay_keep +gameplay_field_keep +gameplay_dangeon_keep +gameplay_object_exchange_static +object_link_boy +object_link_child +object_box +object_human +object_okuta +object_poh +object_wallmaster +object_dy_obj +object_firefly +object_dodongo +object_fire +object_niw +object_tite +object_reeba +object_peehat +object_kingdodongo +object_horse +object_zf +object_goma +object_zl1 +object_gol +object_bubble +object_dodojr +object_torch2 +object_bl +object_tp +object_oA1 +object_st +object_bw +object_ei +object_horse_normal +object_oB1 +object_o_anime +object_spot04_objects +object_ddan_objects +object_hidan_objects +object_horse_ganon +object_oA2 +object_spot00_objects +object_mb +object_bombf +object_sk2 +object_oE1 +object_oE_anime +object_oE2 +object_ydan_objects +object_gnd +object_am +object_dekubaba +object_oA3 +object_oA4 +object_oA5 +object_oA6 +object_oA7 +object_jj +object_oA8 +object_oA9 +object_oB2 +object_oB3 +object_oB4 +object_horse_zelda +object_opening_demo1 +object_warp1 +object_b_heart +object_dekunuts +object_oE3 +object_oE4 +object_menkuri_objects +object_oE5 +object_oE6 +object_oE7 +object_oE8 +object_oE9 +object_oE10 +object_oE11 +object_oE12 +object_vali +object_oA10 +object_oA11 +object_mizu_objects +object_fhg +object_ossan +object_mori_hineri1 +object_Bb +object_toki_objects +object_yukabyun +object_zl2 +object_mjin +object_mjin_flash +object_mjin_dark +object_mjin_flame +object_mjin_ice +object_mjin_soul +object_mjin_wind +object_mjin_oka +object_haka_objects +object_spot06_objects +object_ice_objects +object_relay_objects +object_mori_hineri1a +object_mori_hineri2 +object_mori_hineri2a +object_mori_objects +object_mori_tex +object_spot08_obj +object_warp2 +object_hata +object_bird +object_wood02 +object_lightbox +object_pu_box +object_trap +object_vase +object_im +object_ta +object_tk +object_xc +object_vm +object_bv +object_hakach_objects +object_efc_crystal_light +object_efc_fire_ball +object_efc_flash +object_efc_lgt_shower +object_efc_star_field +object_god_lgt +object_light_ring +object_triforce_spot +object_medal +object_bdan_objects +object_sd +object_rd +object_po_sisters +object_heavy_object +object_gndd +object_fd +object_du +object_fw +object_horse_link_child +object_spot02_objects +object_haka +object_ru1 +object_syokudai +object_fd2 +object_dh +object_rl +object_efc_tw +object_demo_tre_lgt +object_gi_key +object_mir_ray +object_brob +object_gi_jewel +object_spot09_obj +object_spot18_obj +object_bdoor +object_spot17_obj +object_shop_dungen +object_nb +object_mo +object_sb +object_gi_melody +object_gi_heart +object_gi_compass +object_gi_bosskey +object_gi_medal +object_gi_nuts +object_sa +object_gi_hearts +object_gi_arrowcase +object_gi_bombpouch +object_in +object_tr +object_spot16_obj +object_oE1s +object_oE4s +object_os_anime +object_gi_bottle +object_gi_stick +object_gi_map +object_oF1d_map +object_ru2 +object_gi_shield_1 +object_dekujr +object_gi_magicpot +object_gi_bomb_1 +object_oF1s +object_ma2 +object_gi_purse +object_hni +object_tw +object_rr +object_bxa +object_anubice +object_gi_gerudo +object_gi_arrow +object_gi_bomb_2 +object_gi_egg +object_gi_scale +object_gi_shield_2 +object_gi_hookshot +object_gi_ocarina +object_gi_milk +object_ma1 +object_ganon +object_sst +object_ny +object_fr +object_gi_pachinko +object_gi_boomerang +object_gi_bow +object_gi_glasses +object_gi_liquid +object_ani +object_demo_6k +object_gi_shield_3 +object_gi_letter +object_spot15_obj +object_jya_obj +object_gi_clothes +object_gi_bean +object_gi_fish +object_gi_saw +object_gi_hammer +object_gi_grass +object_gi_longsword +object_spot01_objects +object_md +object_km1 +object_kw1 +object_zo +object_kz +object_umajump +object_masterkokiri +object_masterkokirihead +object_mastergolon +object_masterzoora +object_aob +object_ik +object_ahg +object_cne +object_gi_niwatori +object_skj +object_gi_bottle_letter +object_bji +object_bba +object_gi_ocarina_0 +object_ds +object_ane +object_boj +object_spot03_object +object_spot07_object +object_fz +object_bob +object_ge1 +object_yabusame_point +object_gi_boots_2 +object_gi_seed +object_gnd_magic +object_d_elevator +object_d_hsblock +object_d_lift +object_mamenoki +object_goroiwa +object_toryo +object_daiku +object_nwc +object_blkobj +object_gm +object_ms +object_hs +object_ingate +object_lightswitch +object_kusa +object_tsubo +object_gi_gloves +object_gi_coin +object_kanban +object_gjyo_objects +object_owl +object_mk +object_fu +object_gi_ki_tan_mask +object_gi_redead_mask +object_gi_skj_mask +object_gi_rabit_mask +object_gi_truth_mask +object_ganon_objects +object_siofuki +object_stream +object_mm +object_fa +object_os +object_gi_eye_lotion +object_gi_powder +object_gi_mushroom +object_gi_ticketstone +object_gi_brokensword +object_js +object_cs +object_gi_prescription +object_gi_bracelet +object_gi_soldout +object_gi_frog +object_mag +object_door_gerudo +object_gt +object_efc_erupc +object_zl2_anime1 +object_zl2_anime2 +object_gi_golonmask +object_gi_zoramask +object_gi_gerudomask +object_ganon2 +object_ka +object_ts +object_zg +object_gi_hoverboots +object_gi_m_arrow +object_ds2 +object_ec +object_fish +object_gi_sutaru +object_gi_goddess +object_ssh +object_bigokuta +object_bg +object_spot05_objects +object_spot12_obj +object_bombiwa +object_hintnuts +object_rs +object_spot00_break +object_gla +object_shopnuts +object_geldb +object_gr +object_dog +object_jya_iron +object_jya_door +object_spot01_objects2 +object_spot11_obj +object_kibako2 +object_dns +object_dnk +object_gi_fire +object_gi_insect +object_gi_butterfly +object_gi_ghost +object_gi_soul +object_bowl +object_po_field +object_demo_kekkai +object_efc_doughnut +object_gi_dekupouch +object_ganon_anime1 +object_ganon_anime2 +object_ganon_anime3 +object_gi_rupy +object_spot01_matoya +object_spot01_matoyab +object_po_composer +object_mu +object_wf +object_skb +object_gj +object_geff +object_haka_door +object_gs +object_ps +object_bwall +object_crow +object_cow +object_cob +object_gi_sword_1 +object_door_killer +object_ouke_haka +object_timeblock +object_zl4 +g_pn_01 +g_pn_02 +g_pn_03 +g_pn_04 +g_pn_05 +g_pn_06 +g_pn_07 +g_pn_08 +g_pn_09 +g_pn_10 +g_pn_11 +g_pn_12 +g_pn_13 +g_pn_14 +g_pn_15 +g_pn_16 +g_pn_17 +g_pn_18 +g_pn_19 +g_pn_20 +g_pn_21 +g_pn_22 +g_pn_23 +g_pn_24 +g_pn_25 +g_pn_26 +g_pn_27 +g_pn_28 +g_pn_29 +g_pn_30 +g_pn_31 +g_pn_32 +g_pn_33 +g_pn_34 +g_pn_35 +g_pn_36 +g_pn_37 +g_pn_38 +g_pn_39 +g_pn_40 +g_pn_41 +g_pn_42 +g_pn_43 +g_pn_44 +g_pn_45 +g_pn_46 +g_pn_47 +g_pn_48 +g_pn_49 +g_pn_50 +g_pn_51 +g_pn_52 +g_pn_53 +g_pn_54 +g_pn_55 +g_pn_56 +g_pn_57 +z_select_static +nintendo_rogo_static +title_static +parameter_static +vr_fine0_static +vr_fine0_pal_static +vr_fine1_static +vr_fine1_pal_static +vr_fine2_static +vr_fine2_pal_static +vr_fine3_static +vr_fine3_pal_static +vr_cloud0_static +vr_cloud0_pal_static +vr_cloud1_static +vr_cloud1_pal_static +vr_cloud2_static +vr_cloud2_pal_static +vr_cloud3_static +vr_cloud3_pal_static +vr_holy0_static +vr_holy0_pal_static +vr_holy1_static +vr_holy1_pal_static +vr_MDVR_static +vr_MDVR_pal_static +vr_MNVR_static +vr_MNVR_pal_static +vr_RUVR_static +vr_RUVR_pal_static +vr_LHVR_static +vr_LHVR_pal_static +vr_KHVR_static +vr_KHVR_pal_static +vr_K3VR_static +vr_K3VR_pal_static +vr_K4VR_static +vr_K4VR_pal_static +vr_K5VR_static +vr_K5VR_pal_static +vr_SP1a_static +vr_SP1a_pal_static +vr_MLVR_static +vr_MLVR_pal_static +vr_KKRVR_static +vr_KKRVR_pal_static +vr_KR3VR_static +vr_KR3VR_pal_static +vr_IPVR_static +vr_IPVR_pal_static +vr_KSVR_static +vr_KSVR_pal_static +vr_GLVR_static +vr_GLVR_pal_static +vr_ZRVR_static +vr_ZRVR_pal_static +vr_DGVR_static +vr_DGVR_pal_static +vr_ALVR_static +vr_ALVR_pal_static +vr_NSVR_static +vr_NSVR_pal_static +vr_LBVR_static +vr_LBVR_pal_static +vr_TTVR_static +vr_TTVR_pal_static +vr_FCVR_static +vr_FCVR_pal_static +elf_message_field +elf_message_ydan +syotes_scene +syotes_room_0 +syotes2_scene +syotes2_room_0 +depth_test_scene +depth_test_room_0 +spot00_scene +spot00_room_0 +spot01_scene +spot01_room_0 +spot02_scene +spot02_room_0 +spot02_room_1 +spot03_scene +spot03_room_0 +spot03_room_1 +spot04_scene +spot04_room_0 +spot04_room_1 +spot04_room_2 +spot05_scene +spot05_room_0 +spot06_scene +spot06_room_0 +spot07_scene +spot07_room_0 +spot07_room_1 +spot08_scene +spot08_room_0 +spot09_scene +spot09_room_0 +spot10_scene +spot10_room_0 +spot10_room_1 +spot10_room_2 +spot10_room_3 +spot10_room_4 +spot10_room_5 +spot10_room_6 +spot10_room_7 +spot10_room_8 +spot10_room_9 +spot11_scene +spot11_room_0 +spot12_scene +spot12_room_0 +spot12_room_1 +spot13_scene +spot13_room_0 +spot13_room_1 +spot15_scene +spot15_room_0 +spot16_scene +spot16_room_0 +spot17_scene +spot17_room_0 +spot17_room_1 +spot18_scene +spot18_room_0 +spot18_room_1 +spot18_room_2 +spot18_room_3 +ydan_scene +ydan_room_0 +ydan_room_1 +ydan_room_2 +ydan_room_3 +ydan_room_4 +ydan_room_5 +ydan_room_6 +ydan_room_7 +ydan_room_8 +ydan_room_9 +ydan_room_10 +ydan_room_11 +ddan_scene +ddan_room_0 +ddan_room_1 +ddan_room_2 +ddan_room_3 +ddan_room_4 +ddan_room_5 +ddan_room_6 +ddan_room_7 +ddan_room_8 +ddan_room_9 +ddan_room_10 +ddan_room_11 +ddan_room_12 +ddan_room_13 +ddan_room_14 +ddan_room_15 +ddan_room_16 +bdan_scene +bdan_room_0 +bdan_room_1 +bdan_room_2 +bdan_room_3 +bdan_room_4 +bdan_room_5 +bdan_room_6 +bdan_room_7 +bdan_room_8 +bdan_room_9 +bdan_room_10 +bdan_room_11 +bdan_room_12 +bdan_room_13 +bdan_room_14 +bdan_room_15 +Bmori1_scene +Bmori1_room_0 +Bmori1_room_1 +Bmori1_room_2 +Bmori1_room_3 +Bmori1_room_4 +Bmori1_room_5 +Bmori1_room_6 +Bmori1_room_7 +Bmori1_room_8 +Bmori1_room_9 +Bmori1_room_10 +Bmori1_room_11 +Bmori1_room_12 +Bmori1_room_13 +Bmori1_room_14 +Bmori1_room_15 +Bmori1_room_16 +Bmori1_room_17 +Bmori1_room_18 +Bmori1_room_19 +Bmori1_room_20 +Bmori1_room_21 +Bmori1_room_22 +HIDAN_scene +HIDAN_room_0 +HIDAN_room_1 +HIDAN_room_2 +HIDAN_room_3 +HIDAN_room_4 +HIDAN_room_5 +HIDAN_room_6 +HIDAN_room_7 +HIDAN_room_8 +HIDAN_room_9 +HIDAN_room_10 +HIDAN_room_11 +HIDAN_room_12 +HIDAN_room_13 +HIDAN_room_14 +HIDAN_room_15 +HIDAN_room_16 +HIDAN_room_17 +HIDAN_room_18 +HIDAN_room_19 +HIDAN_room_20 +HIDAN_room_21 +HIDAN_room_22 +HIDAN_room_23 +HIDAN_room_24 +HIDAN_room_25 +HIDAN_room_26 +MIZUsin_scene +MIZUsin_room_0 +MIZUsin_room_1 +MIZUsin_room_2 +MIZUsin_room_3 +MIZUsin_room_4 +MIZUsin_room_5 +MIZUsin_room_6 +MIZUsin_room_7 +MIZUsin_room_8 +MIZUsin_room_9 +MIZUsin_room_10 +MIZUsin_room_11 +MIZUsin_room_12 +MIZUsin_room_13 +MIZUsin_room_14 +MIZUsin_room_15 +MIZUsin_room_16 +MIZUsin_room_17 +MIZUsin_room_18 +MIZUsin_room_19 +MIZUsin_room_20 +MIZUsin_room_21 +MIZUsin_room_22 +jyasinzou_scene +jyasinzou_room_0 +jyasinzou_room_1 +jyasinzou_room_2 +jyasinzou_room_3 +jyasinzou_room_4 +jyasinzou_room_5 +jyasinzou_room_6 +jyasinzou_room_7 +jyasinzou_room_8 +jyasinzou_room_9 +jyasinzou_room_10 +jyasinzou_room_11 +jyasinzou_room_12 +jyasinzou_room_13 +jyasinzou_room_14 +jyasinzou_room_15 +jyasinzou_room_16 +jyasinzou_room_17 +jyasinzou_room_18 +jyasinzou_room_19 +jyasinzou_room_20 +jyasinzou_room_21 +jyasinzou_room_22 +jyasinzou_room_23 +jyasinzou_room_24 +jyasinzou_room_25 +jyasinzou_room_26 +jyasinzou_room_27 +jyasinzou_room_28 +HAKAdan_scene +HAKAdan_room_0 +HAKAdan_room_1 +HAKAdan_room_2 +HAKAdan_room_3 +HAKAdan_room_4 +HAKAdan_room_5 +HAKAdan_room_6 +HAKAdan_room_7 +HAKAdan_room_8 +HAKAdan_room_9 +HAKAdan_room_10 +HAKAdan_room_11 +HAKAdan_room_12 +HAKAdan_room_13 +HAKAdan_room_14 +HAKAdan_room_15 +HAKAdan_room_16 +HAKAdan_room_17 +HAKAdan_room_18 +HAKAdan_room_19 +HAKAdan_room_20 +HAKAdan_room_21 +HAKAdan_room_22 +HAKAdanCH_scene +HAKAdanCH_room_0 +HAKAdanCH_room_1 +HAKAdanCH_room_2 +HAKAdanCH_room_3 +HAKAdanCH_room_4 +HAKAdanCH_room_5 +HAKAdanCH_room_6 +ice_doukutu_scene +ice_doukutu_room_0 +ice_doukutu_room_1 +ice_doukutu_room_2 +ice_doukutu_room_3 +ice_doukutu_room_4 +ice_doukutu_room_5 +ice_doukutu_room_6 +ice_doukutu_room_7 +ice_doukutu_room_8 +ice_doukutu_room_9 +ice_doukutu_room_10 +ice_doukutu_room_11 +men_scene +men_room_0 +men_room_1 +men_room_2 +men_room_3 +men_room_4 +men_room_5 +men_room_6 +men_room_7 +men_room_8 +men_room_9 +men_room_10 +ganontika_scene +ganontika_room_0 +ganontika_room_1 +ganontika_room_2 +ganontika_room_3 +ganontika_room_4 +ganontika_room_5 +ganontika_room_6 +ganontika_room_7 +ganontika_room_8 +ganontika_room_9 +ganontika_room_10 +ganontika_room_11 +ganontika_room_12 +ganontika_room_13 +ganontika_room_14 +ganontika_room_15 +ganontika_room_16 +ganontika_room_17 +ganontika_room_18 +ganontika_room_19 +market_day_scene +market_day_room_0 +market_night_scene +market_night_room_0 +testroom_scene +testroom_room_0 +testroom_room_1 +testroom_room_2 +testroom_room_3 +testroom_room_4 +kenjyanoma_scene +kenjyanoma_room_0 +tokinoma_scene +tokinoma_room_0 +tokinoma_room_1 +sutaru_scene +sutaru_room_0 +link_home_scene +link_home_room_0 +kokiri_shop_scene +kokiri_shop_room_0 +kokiri_home_scene +kokiri_home_room_0 +kakusiana_scene +kakusiana_room_0 +kakusiana_room_1 +kakusiana_room_2 +kakusiana_room_3 +kakusiana_room_4 +kakusiana_room_5 +kakusiana_room_6 +kakusiana_room_7 +kakusiana_room_8 +kakusiana_room_9 +kakusiana_room_10 +kakusiana_room_11 +kakusiana_room_12 +kakusiana_room_13 +entra_scene +entra_room_0 +moribossroom_scene +moribossroom_room_0 +moribossroom_room_1 +syatekijyou_scene +syatekijyou_room_0 +shop1_scene +shop1_room_0 +hairal_niwa_scene +hairal_niwa_room_0 +ganon_tou_scene +ganon_tou_room_0 +sasatest_scene +sasatest_room_0 +market_alley_scene +market_alley_room_0 +spot20_scene +spot20_room_0 +market_ruins_scene +market_ruins_room_0 +entra_n_scene +entra_n_room_0 +enrui_scene +enrui_room_0 +market_alley_n_scene +market_alley_n_room_0 +hiral_demo_scene +hiral_demo_room_0 +kokiri_home3_scene +kokiri_home3_room_0 +malon_stable_scene +malon_stable_room_0 +kakariko_scene +kakariko_room_0 +bdan_boss_scene +bdan_boss_room_0 +bdan_boss_room_1 +FIRE_bs_scene +FIRE_bs_room_0 +FIRE_bs_room_1 +hut_scene +hut_room_0 +daiyousei_izumi_scene +daiyousei_izumi_room_0 +hakaana_scene +hakaana_room_0 +yousei_izumi_tate_scene +yousei_izumi_tate_room_0 +yousei_izumi_yoko_scene +yousei_izumi_yoko_room_0 +golon_scene +golon_room_0 +zoora_scene +zoora_room_0 +drag_scene +drag_room_0 +alley_shop_scene +alley_shop_room_0 +night_shop_scene +night_shop_room_0 +impa_scene +impa_room_0 +labo_scene +labo_room_0 +tent_scene +tent_room_0 +nakaniwa_scene +nakaniwa_room_0 +ddan_boss_scene +ddan_boss_room_0 +ddan_boss_room_1 +ydan_boss_scene +ydan_boss_room_0 +ydan_boss_room_1 +HAKAdan_bs_scene +HAKAdan_bs_room_0 +HAKAdan_bs_room_1 +MIZUsin_bs_scene +MIZUsin_bs_room_0 +MIZUsin_bs_room_1 +ganon_scene +ganon_room_0 +ganon_room_1 +ganon_room_2 +ganon_room_3 +ganon_room_4 +ganon_room_5 +ganon_room_6 +ganon_room_7 +ganon_room_8 +ganon_room_9 +ganon_boss_scene +ganon_boss_room_0 +jyasinboss_scene +jyasinboss_room_0 +jyasinboss_room_1 +jyasinboss_room_2 +jyasinboss_room_3 +kokiri_home4_scene +kokiri_home4_room_0 +kokiri_home5_scene +kokiri_home5_room_0 +ganon_final_scene +ganon_final_room_0 +kakariko3_scene +kakariko3_room_0 +hairal_niwa2_scene +hairal_niwa2_room_0 +hakasitarelay_scene +hakasitarelay_room_0 +hakasitarelay_room_1 +hakasitarelay_room_2 +hakasitarelay_room_3 +hakasitarelay_room_4 +hakasitarelay_room_5 +hakasitarelay_room_6 +shrine_scene +shrine_room_0 +turibori_scene +turibori_room_0 +shrine_n_scene +shrine_n_room_0 +shrine_r_scene +shrine_r_room_0 +hakaana2_scene +hakaana2_room_0 +gerudoway_scene +gerudoway_room_0 +gerudoway_room_1 +gerudoway_room_2 +gerudoway_room_3 +gerudoway_room_4 +gerudoway_room_5 +hairal_niwa_n_scene +hairal_niwa_n_room_0 +bowling_scene +bowling_room_0 +hakaana_ouke_scene +hakaana_ouke_room_0 +hakaana_ouke_room_1 +hakaana_ouke_room_2 +hylia_labo_scene +hylia_labo_room_0 +souko_scene +souko_room_0 +souko_room_1 +souko_room_2 +miharigoya_scene +miharigoya_room_0 +mahouya_scene +mahouya_room_0 +takaraya_scene +takaraya_room_0 +takaraya_room_1 +takaraya_room_2 +takaraya_room_3 +takaraya_room_4 +takaraya_room_5 +takaraya_room_6 +ganon_sonogo_scene +ganon_sonogo_room_0 +ganon_sonogo_room_1 +ganon_sonogo_room_2 +ganon_sonogo_room_3 +ganon_sonogo_room_4 +ganon_demo_scene +ganon_demo_room_0 +besitu_scene +besitu_room_0 +face_shop_scene +face_shop_room_0 +kinsuta_scene +kinsuta_room_0 +ganontikasonogo_scene +ganontikasonogo_room_0 +ganontikasonogo_room_1 +test01_scene +test01_room_0 +bump_texture_static +anime_model_1_static +anime_model_2_static +anime_model_3_static +anime_model_4_static +anime_model_5_static +anime_model_6_static +anime_texture_1_static +anime_texture_2_static +anime_texture_3_static +anime_texture_4_static +anime_texture_5_static +anime_texture_6_static +softsprite_matrix_static diff --git a/baseroms/hackeroot-mq/dmadata_start.txt b/baseroms/hackeroot-mq/dmadata_start.txt new file mode 100644 index 000000000..290d1938d --- /dev/null +++ b/baseroms/hackeroot-mq/dmadata_start.txt @@ -0,0 +1 @@ +0x12f70 diff --git a/data/fault_drawer.bss.s b/data/fault_drawer.bss.s index 0c64984b3..89a29d8bb 100644 --- a/data/fault_drawer.bss.s +++ b/data/fault_drawer.bss.s @@ -13,6 +13,7 @@ glabel sFaultDrawer .space 0x3C + .space 0x04 # padding -glabel D_8016B6BC - .space 0x24 +glabel D_8016B6C0 + .space 0x20 diff --git a/data/rsp.rodata.f3dex3.s b/data/rsp.rodata.f3dex3.s new file mode 100644 index 000000000..8ed1daf35 --- /dev/null +++ b/data/rsp.rodata.f3dex3.s @@ -0,0 +1,32 @@ +.include "macro.inc" + +# assembler directives +.set noat # allow manual use of $at +.set noreorder # don't insert nops after branches +.set gp=64 # allow use of 64-bit general purpose registers + +.section .rodata + +.balign 16 + +glabel aspMainDataStart + .incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCCE10, 0x2E0 +glabel aspMainDataEnd + +glabel gspF3DZEX2_NoN_PosLight_fifoTextStart + .incbin "F3DEX3/F3DEX3.code" +glabel gspF3DZEX2_NoN_PosLight_fifoTextEnd +.balign 16 + +glabel gspF3DZEX2_NoN_PosLight_fifoDataStart + .incbin "F3DEX3/F3DEX3.data" +glabel gspF3DZEX2_NoN_PosLight_fifoDataEnd +.balign 16 + +glabel gspS2DEX2d_fifoDataStart + .incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCEB40, 0x390 +glabel gspS2DEX2d_fifoDataEnd + +glabel njpgdspMainDataStart + .incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCEED0, 0x60 +glabel njpgdspMainDataEnd diff --git a/diff.py b/diff.py deleted file mode 120000 index da050d17b..000000000 --- a/diff.py +++ /dev/null @@ -1 +0,0 @@ -./tools/asm-differ/diff.py \ No newline at end of file diff --git a/diff_settings.py b/diff_settings.py deleted file mode 100644 index 66eb4e733..000000000 --- a/diff_settings.py +++ /dev/null @@ -1,10 +0,0 @@ -def add_custom_arguments(parser): - parser.add_argument("-v", "--oot-version", help="OOT version", default="gc-eu-mq-dbg") - -def apply(config, args): - version = args.oot_version - config['mapfile'] = f'build/{version}/oot-{version}.map' - config['myimg'] = f'build/{version}/oot-{version}.z64' - config['baseimg'] = f'baseroms/{version}/baserom-decompressed.z64' - config['makeflags'] = [f'VERSION={version}'] - config['source_directories'] = ['src', 'include', 'spec'] diff --git a/docs/tutorial/beginning_decomp.md b/docs/tutorial/beginning_decomp.md index 54fde940b..149753d43 100644 --- a/docs/tutorial/beginning_decomp.md +++ b/docs/tutorial/beginning_decomp.md @@ -666,8 +666,8 @@ extern ColliderCylinderInit D_80A88CB4; // ELEMTYPE_UNK0, // { 0x00000000, 0x00, 0x00 }, // { 0x00000004, 0x00, 0x00 }, -// TOUCH_NONE, -// BUMP_ON, +// ATELEM_NONE, +// ACELEM_ON, // OCELEM_ON, // }, // { 170, 150, 0, { 0, 0, 0 } }, diff --git a/docs/tutorial/introduction.md b/docs/tutorial/introduction.md index 80798cd35..b9a658d53 100644 --- a/docs/tutorial/introduction.md +++ b/docs/tutorial/introduction.md @@ -33,7 +33,7 @@ void func_80A13098(EnFirefly* this) { } else { this->actor.params -= 2; } - this->collider.list->body.toucher.effect = 1; + this->collider.list->body.atDmgInfo.effect = 1; this->auraType = 1; this->onFire = 1; this->actor.naviEnemyId = 0x11; diff --git a/docs/vscode.md b/docs/vscode.md index 2bab5a578..11f5cac47 100644 --- a/docs/vscode.md +++ b/docs/vscode.md @@ -41,22 +41,26 @@ You can create a `.vscode/c_cpp_properties.json` file with `C/C++: Edit Configur { "configurations": [ { - "name": "N64 oot-gc-eu-mq-dbg", - "compilerPath": "${default}", // Needs to not be "" for -m32 to work + "name": "N64 hackeroot-mq", + "compilerPath": "/usr/bin/gcc", // Needs to not be "" for -m32 to work "compilerArgs": [ "-m32" // Removes integer truncation warnings with gbi macros ], - "intelliSenseMode": "${default}", // Shouldn't matter + "intelliSenseMode": "gcc-x86", // Shouldn't matter "includePath": [ // Matches makefile's includes - "${workspaceFolder}/**", - "src", - "build/gc-eu-mq-dbg", "include", - "include/libc" + "include/libc", + "src", + "build/hackeroot-mq", + ".", + "extracted/hackeroot-mq" ], "defines": [ "_LANGUAGE_C", // For gbi.h - "OOT_DEBUG=1" // If targeting a debug version + "OOT_DEBUG=1", // If targeting a debug version + "ENABLE_HACKEROOT=1", + "RELEASE_ROM=0", + "COMPRESS_YAZ=1" ], "cStandard": "gnu89", // C89 + some GNU extensions from C99 like C++ comments "cppStandard": "${default}" // Only ZAPD uses C++, so doesn't really matter @@ -81,3 +85,39 @@ Add the following to (or create) the `.vscode/settings.json` file for VSCode to }, } ``` + +## GDB Launch File +```jsonc +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Ares GDB (Linux)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/hackeroot-mq/hackeroot-mq.elf", + "cwd": "${workspaceFolder}", + "stopAtEntry": false, + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/gdb-multiarch", + "miDebuggerServerAddress": "tcp:172.0.0.1:9123", // change this to your Linux/WSL IP address + }, + { + "name": "Ares GDB (Windows)", + "type": "cppdbg", + "request": "launch", + "program": "windows_path_to_HackerOoT.elf", + "cwd": "windows_path_to_folder_containing_HackerOoT.elf", + "stopAtEntry": true, + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "/mnt/c/msys64/mingw64/bin/gdb-multiarch.exe", + "miDebuggerServerAddress": "[::1]:9123", + } + ] +} +``` diff --git a/extract_assets.py b/extract_assets.py index defac57dc..4d80ef48b 100755 --- a/extract_assets.py +++ b/extract_assets.py @@ -10,6 +10,7 @@ from pathlib import Path EXTRACTED_ASSETS_NAMEFILE = ".extracted-assets.json" +VERSION = "" def SignalHandler(sig, frame): @@ -28,7 +29,7 @@ def ExtractFile(xmlPath, outputPath, outputSourcePath): Path(outputPath).mkdir(parents=True, exist_ok=True) Path(outputSourcePath).mkdir(parents=True, exist_ok=True) - execStr = f"{zapdPath} e -eh -i {xmlPath} -b baseroms/gc-eu-mq-dbg/segments -o {outputPath} -osf {outputSourcePath} -gsf 1 -rconf {configPath} {ZAPDArgs}" + execStr = f"{zapdPath} e -eh -i {xmlPath} -b baseroms/{VERSION}/segments -o {outputPath} -osf {outputSourcePath} -gsf 1 -rconf {configPath} --cs-float both {ZAPDArgs}" if "overlays" in xmlPath: execStr += " --static" @@ -96,12 +97,16 @@ def processZAPDArgs(argsZ): def main(): parser = argparse.ArgumentParser(description="baserom asset extractor") parser.add_argument("-s", "--single", help="asset path relative to assets/, e.g. objects/gameplay_keep") - parser.add_argument("-f", "--force", help="Force the extraction of every xml instead of checking the touched ones, and text (overwriting current files).", action="store_true") + parser.add_argument("-f", "--force", help="Force the extraction of every xml instead of checking the touched ones (overwriting current files).", action="store_true") parser.add_argument("-j", "--jobs", help="Number of cpu cores to extract with.") parser.add_argument("-u", "--unaccounted", help="Enables ZAPD unaccounted detector warning system.", action="store_true") parser.add_argument("-Z", help="Pass the argument on to ZAPD, e.g. `-ZWunaccounted` to warn about unaccounted blocks in XMLs. Each argument should be passed separately, *without* the leading dash.", metavar="ZAPD_ARG", action="append") + parser.add_argument("-v", "--version", help="OoT Version", choices=["gc-eu-mq-dbg", "hackeroot-mq"]) args = parser.parse_args() + global VERSION + VERSION = args.version + global ZAPDArgs ZAPDArgs = processZAPDArgs(args.Z) if args.Z else "" @@ -128,21 +133,6 @@ def main(): del extractedAssetsTracker[fullPath] ExtractFunc(fullPath) else: - extract_text_path = "assets/text/message_data.h" - extract_staff_text_path = "assets/text/message_data_staff.h" - - # Only extract text if the header does not already exist, or if --force was passed - if not args.force: - if os.path.isfile(extract_text_path): - extract_text_path = None - if os.path.isfile(extract_staff_text_path): - extract_staff_text_path = None - - if extract_text_path is not None or extract_staff_text_path is not None: - print("Extracting text") - from tools import msgdis - msgdis.extract_all_text(extract_text_path, extract_staff_text_path) - xmlFiles = [] for currentPath, _, files in os.walk(os.path.join("assets", "xml")): for file in files: diff --git a/extract_baserom.py b/extract_baserom.py deleted file mode 100755 index 43686e403..000000000 --- a/extract_baserom.py +++ /dev/null @@ -1,1600 +0,0 @@ -#!/usr/bin/python3 - -import struct -from multiprocessing import Pool, cpu_count -from pathlib import Path - - -ROM_FILE_PATH = Path('baseroms/gc-eu-mq-dbg/baserom-decompressed.z64') -SEGMENTS_PATH = Path('baseroms/gc-eu-mq-dbg/segments/') -FILE_TABLE_OFFSET = 0x12F70 - -FILE_NAMES = [ - 'makerom', - 'boot', - 'dmadata', - 'Audiobank', - 'Audioseq', - 'Audiotable', - 'link_animetion', - 'icon_item_static', - 'icon_item_24_static', - 'icon_item_field_static', - 'icon_item_dungeon_static', - 'icon_item_gameover_static', - 'icon_item_nes_static', - 'icon_item_ger_static', - 'icon_item_fra_static', - 'item_name_static', - 'map_name_static', - 'do_action_static', - 'message_static', - 'message_texture_static', - 'nes_font_static', - 'nes_message_data_static', - 'ger_message_data_static', - 'fra_message_data_static', - 'staff_message_data_static', - 'map_grand_static', - 'map_i_static', - 'map_48x85_static', - 'code', - 'ovl_title', - 'ovl_select', - 'ovl_opening', - 'ovl_file_choose', - 'ovl_kaleido_scope', - 'ovl_player_actor', - 'ovl_map_mark_data', - 'ovl_En_Test', - 'ovl_Arms_Hook', - 'ovl_Arrow_Fire', - 'ovl_Arrow_Ice', - 'ovl_Arrow_Light', - 'ovl_Bg_Bdan_Objects', - 'ovl_Bg_Bdan_Switch', - 'ovl_Bg_Bom_Guard', - 'ovl_Bg_Bombwall', - 'ovl_Bg_Bowl_Wall', - 'ovl_Bg_Breakwall', - 'ovl_Bg_Ddan_Jd', - 'ovl_Bg_Ddan_Kd', - 'ovl_Bg_Dodoago', - 'ovl_Bg_Dy_Yoseizo', - 'ovl_Bg_Ganon_Otyuka', - 'ovl_Bg_Gate_Shutter', - 'ovl_Bg_Gjyo_Bridge', - 'ovl_Bg_Gnd_Darkmeiro', - 'ovl_Bg_Gnd_Firemeiro', - 'ovl_Bg_Gnd_Iceblock', - 'ovl_Bg_Gnd_Nisekabe', - 'ovl_Bg_Gnd_Soulmeiro', - 'ovl_Bg_Haka', - 'ovl_Bg_Haka_Gate', - 'ovl_Bg_Haka_Huta', - 'ovl_Bg_Haka_Megane', - 'ovl_Bg_Haka_MeganeBG', - 'ovl_Bg_Haka_Sgami', - 'ovl_Bg_Haka_Ship', - 'ovl_Bg_Haka_Trap', - 'ovl_Bg_Haka_Tubo', - 'ovl_Bg_Haka_Water', - 'ovl_Bg_Haka_Zou', - 'ovl_Bg_Heavy_Block', - 'ovl_Bg_Hidan_Curtain', - 'ovl_Bg_Hidan_Dalm', - 'ovl_Bg_Hidan_Firewall', - 'ovl_Bg_Hidan_Fslift', - 'ovl_Bg_Hidan_Fwbig', - 'ovl_Bg_Hidan_Hamstep', - 'ovl_Bg_Hidan_Hrock', - 'ovl_Bg_Hidan_Kousi', - 'ovl_Bg_Hidan_Kowarerukabe', - 'ovl_Bg_Hidan_Rock', - 'ovl_Bg_Hidan_Rsekizou', - 'ovl_Bg_Hidan_Sekizou', - 'ovl_Bg_Hidan_Sima', - 'ovl_Bg_Hidan_Syoku', - 'ovl_Bg_Ice_Objects', - 'ovl_Bg_Ice_Shelter', - 'ovl_Bg_Ice_Shutter', - 'ovl_Bg_Ice_Turara', - 'ovl_Bg_Ingate', - 'ovl_Bg_Jya_1flift', - 'ovl_Bg_Jya_Amishutter', - 'ovl_Bg_Jya_Bigmirror', - 'ovl_Bg_Jya_Block', - 'ovl_Bg_Jya_Bombchuiwa', - 'ovl_Bg_Jya_Bombiwa', - 'ovl_Bg_Jya_Cobra', - 'ovl_Bg_Jya_Goroiwa', - 'ovl_Bg_Jya_Haheniron', - 'ovl_Bg_Jya_Ironobj', - 'ovl_Bg_Jya_Kanaami', - 'ovl_Bg_Jya_Lift', - 'ovl_Bg_Jya_Megami', - 'ovl_Bg_Jya_Zurerukabe', - 'ovl_Bg_Menkuri_Eye', - 'ovl_Bg_Menkuri_Kaiten', - 'ovl_Bg_Menkuri_Nisekabe', - 'ovl_Bg_Mizu_Bwall', - 'ovl_Bg_Mizu_Movebg', - 'ovl_Bg_Mizu_Shutter', - 'ovl_Bg_Mizu_Uzu', - 'ovl_Bg_Mizu_Water', - 'ovl_Bg_Mjin', - 'ovl_Bg_Mori_Bigst', - 'ovl_Bg_Mori_Elevator', - 'ovl_Bg_Mori_Hashigo', - 'ovl_Bg_Mori_Hashira4', - 'ovl_Bg_Mori_Hineri', - 'ovl_Bg_Mori_Idomizu', - 'ovl_Bg_Mori_Kaitenkabe', - 'ovl_Bg_Mori_Rakkatenjo', - 'ovl_Bg_Po_Event', - 'ovl_Bg_Po_Syokudai', - 'ovl_Bg_Pushbox', - 'ovl_Bg_Relay_Objects', - 'ovl_Bg_Spot00_Break', - 'ovl_Bg_Spot00_Hanebasi', - 'ovl_Bg_Spot01_Fusya', - 'ovl_Bg_Spot01_Idohashira', - 'ovl_Bg_Spot01_Idomizu', - 'ovl_Bg_Spot01_Idosoko', - 'ovl_Bg_Spot01_Objects2', - 'ovl_Bg_Spot02_Objects', - 'ovl_Bg_Spot03_Taki', - 'ovl_Bg_Spot05_Soko', - 'ovl_Bg_Spot06_Objects', - 'ovl_Bg_Spot07_Taki', - 'ovl_Bg_Spot08_Bakudankabe', - 'ovl_Bg_Spot08_Iceblock', - 'ovl_Bg_Spot09_Obj', - 'ovl_Bg_Spot11_Bakudankabe', - 'ovl_Bg_Spot11_Oasis', - 'ovl_Bg_Spot12_Gate', - 'ovl_Bg_Spot12_Saku', - 'ovl_Bg_Spot15_Rrbox', - 'ovl_Bg_Spot15_Saku', - 'ovl_Bg_Spot16_Bombstone', - 'ovl_Bg_Spot16_Doughnut', - 'ovl_Bg_Spot17_Bakudankabe', - 'ovl_Bg_Spot17_Funen', - 'ovl_Bg_Spot18_Basket', - 'ovl_Bg_Spot18_Futa', - 'ovl_Bg_Spot18_Obj', - 'ovl_Bg_Spot18_Shutter', - 'ovl_Bg_Sst_Floor', - 'ovl_Bg_Toki_Hikari', - 'ovl_Bg_Toki_Swd', - 'ovl_Bg_Treemouth', - 'ovl_Bg_Umajump', - 'ovl_Bg_Vb_Sima', - 'ovl_Bg_Ydan_Hasi', - 'ovl_Bg_Ydan_Maruta', - 'ovl_Bg_Ydan_Sp', - 'ovl_Bg_Zg', - 'ovl_Boss_Dodongo', - 'ovl_Boss_Fd', - 'ovl_Boss_Fd2', - 'ovl_Boss_Ganon', - 'ovl_Boss_Ganon2', - 'ovl_Boss_Ganondrof', - 'ovl_Boss_Goma', - 'ovl_Boss_Mo', - 'ovl_Boss_Sst', - 'ovl_Boss_Tw', - 'ovl_Boss_Va', - 'ovl_Demo_6K', - 'ovl_Demo_Du', - 'ovl_Demo_Ec', - 'ovl_Demo_Effect', - 'ovl_Demo_Ext', - 'ovl_Demo_Geff', - 'ovl_Demo_Gj', - 'ovl_Demo_Go', - 'ovl_Demo_Gt', - 'ovl_Demo_Ik', - 'ovl_Demo_Im', - 'ovl_Demo_Kankyo', - 'ovl_Demo_Kekkai', - 'ovl_Demo_Sa', - 'ovl_Demo_Shd', - 'ovl_Demo_Tre_Lgt', - 'ovl_Door_Ana', - 'ovl_Door_Gerudo', - 'ovl_Door_Killer', - 'ovl_Door_Shutter', - 'ovl_Door_Toki', - 'ovl_Door_Warp1', - 'ovl_Efc_Erupc', - 'ovl_Eff_Dust', - 'ovl_Effect_Ss_Blast', - 'ovl_Effect_Ss_Bomb', - 'ovl_Effect_Ss_Bomb2', - 'ovl_Effect_Ss_Bubble', - 'ovl_Effect_Ss_D_Fire', - 'ovl_Effect_Ss_Dead_Db', - 'ovl_Effect_Ss_Dead_Dd', - 'ovl_Effect_Ss_Dead_Ds', - 'ovl_Effect_Ss_Dead_Sound', - 'ovl_Effect_Ss_Dt_Bubble', - 'ovl_Effect_Ss_Dust', - 'ovl_Effect_Ss_En_Fire', - 'ovl_Effect_Ss_En_Ice', - 'ovl_Effect_Ss_Extra', - 'ovl_Effect_Ss_Fcircle', - 'ovl_Effect_Ss_Fhg_Flash', - 'ovl_Effect_Ss_Fire_Tail', - 'ovl_Effect_Ss_G_Fire', - 'ovl_Effect_Ss_G_Magma', - 'ovl_Effect_Ss_G_Magma2', - 'ovl_Effect_Ss_G_Ripple', - 'ovl_Effect_Ss_G_Spk', - 'ovl_Effect_Ss_G_Splash', - 'ovl_Effect_Ss_Hahen', - 'ovl_Effect_Ss_HitMark', - 'ovl_Effect_Ss_Ice_Piece', - 'ovl_Effect_Ss_Ice_Smoke', - 'ovl_Effect_Ss_K_Fire', - 'ovl_Effect_Ss_Kakera', - 'ovl_Effect_Ss_KiraKira', - 'ovl_Effect_Ss_Lightning', - 'ovl_Effect_Ss_Sibuki', - 'ovl_Effect_Ss_Sibuki2', - 'ovl_Effect_Ss_Solder_Srch_Ball', - 'ovl_Effect_Ss_Stick', - 'ovl_Effect_Ss_Stone1', - 'ovl_Elf_Msg', - 'ovl_Elf_Msg2', - 'ovl_En_Am', - 'ovl_En_Ani', - 'ovl_En_Anubice', - 'ovl_En_Anubice_Fire', - 'ovl_En_Anubice_Tag', - 'ovl_En_Arow_Trap', - 'ovl_En_Arrow', - 'ovl_En_Attack_Niw', - 'ovl_En_Ba', - 'ovl_En_Bb', - 'ovl_En_Bdfire', - 'ovl_En_Bigokuta', - 'ovl_En_Bili', - 'ovl_En_Bird', - 'ovl_En_Blkobj', - 'ovl_En_Bom', - 'ovl_En_Bom_Bowl_Man', - 'ovl_En_Bom_Bowl_Pit', - 'ovl_En_Bom_Chu', - 'ovl_En_Bombf', - 'ovl_En_Boom', - 'ovl_En_Box', - 'ovl_En_Brob', - 'ovl_En_Bubble', - 'ovl_En_Butte', - 'ovl_En_Bw', - 'ovl_En_Bx', - 'ovl_En_Changer', - 'ovl_En_Clear_Tag', - 'ovl_En_Cow', - 'ovl_En_Crow', - 'ovl_En_Cs', - 'ovl_En_Daiku', - 'ovl_En_Daiku_Kakariko', - 'ovl_En_Dekubaba', - 'ovl_En_Dekunuts', - 'ovl_En_Dh', - 'ovl_En_Dha', - 'ovl_En_Diving_Game', - 'ovl_En_Dns', - 'ovl_En_Dnt_Demo', - 'ovl_En_Dnt_Jiji', - 'ovl_En_Dnt_Nomal', - 'ovl_En_Dodojr', - 'ovl_En_Dodongo', - 'ovl_En_Dog', - 'ovl_En_Door', - 'ovl_En_Ds', - 'ovl_En_Du', - 'ovl_En_Dy_Extra', - 'ovl_En_Eg', - 'ovl_En_Eiyer', - 'ovl_En_Elf', - 'ovl_En_Encount1', - 'ovl_En_Encount2', - 'ovl_En_Ex_Item', - 'ovl_En_Ex_Ruppy', - 'ovl_En_Fd', - 'ovl_En_Fd_Fire', - 'ovl_En_Fhg_Fire', - 'ovl_En_Fire_Rock', - 'ovl_En_Firefly', - 'ovl_En_Fish', - 'ovl_En_Floormas', - 'ovl_En_Fr', - 'ovl_En_Fu', - 'ovl_En_Fw', - 'ovl_En_Fz', - 'ovl_En_G_Switch', - 'ovl_En_Ganon_Mant', - 'ovl_En_Ganon_Organ', - 'ovl_En_Gb', - 'ovl_En_Ge1', - 'ovl_En_Ge2', - 'ovl_En_Ge3', - 'ovl_En_GeldB', - 'ovl_En_GirlA', - 'ovl_En_Gm', - 'ovl_En_Go', - 'ovl_En_Go2', - 'ovl_En_Goma', - 'ovl_En_Goroiwa', - 'ovl_En_Gs', - 'ovl_En_Guest', - 'ovl_En_Hata', - 'ovl_En_Heishi1', - 'ovl_En_Heishi2', - 'ovl_En_Heishi3', - 'ovl_En_Heishi4', - 'ovl_En_Hintnuts', - 'ovl_En_Holl', - 'ovl_En_Honotrap', - 'ovl_En_Horse', - 'ovl_En_Horse_Game_Check', - 'ovl_En_Horse_Ganon', - 'ovl_En_Horse_Link_Child', - 'ovl_En_Horse_Normal', - 'ovl_En_Horse_Zelda', - 'ovl_En_Hs', - 'ovl_En_Hs2', - 'ovl_En_Hy', - 'ovl_En_Ice_Hono', - 'ovl_En_Ik', - 'ovl_En_In', - 'ovl_En_Insect', - 'ovl_En_Ishi', - 'ovl_En_It', - 'ovl_En_Jj', - 'ovl_En_Js', - 'ovl_En_Jsjutan', - 'ovl_En_Kakasi', - 'ovl_En_Kakasi2', - 'ovl_En_Kakasi3', - 'ovl_En_Kanban', - 'ovl_En_Karebaba', - 'ovl_En_Ko', - 'ovl_En_Kusa', - 'ovl_En_Kz', - 'ovl_En_Light', - 'ovl_En_Lightbox', - 'ovl_En_M_Fire1', - 'ovl_En_M_Thunder', - 'ovl_En_Ma1', - 'ovl_En_Ma2', - 'ovl_En_Ma3', - 'ovl_En_Mag', - 'ovl_En_Mb', - 'ovl_En_Md', - 'ovl_En_Mk', - 'ovl_En_Mm', - 'ovl_En_Mm2', - 'ovl_En_Ms', - 'ovl_En_Mu', - 'ovl_En_Nb', - 'ovl_En_Niw', - 'ovl_En_Niw_Girl', - 'ovl_En_Niw_Lady', - 'ovl_En_Nutsball', - 'ovl_En_Nwc', - 'ovl_En_Ny', - 'ovl_En_OE2', - 'ovl_En_Okarina_Effect', - 'ovl_En_Okarina_Tag', - 'ovl_En_Okuta', - 'ovl_En_Ossan', - 'ovl_En_Owl', - 'ovl_En_Part', - 'ovl_En_Peehat', - 'ovl_En_Po_Desert', - 'ovl_En_Po_Field', - 'ovl_En_Po_Relay', - 'ovl_En_Po_Sisters', - 'ovl_En_Poh', - 'ovl_En_Pu_box', - 'ovl_En_Rd', - 'ovl_En_Reeba', - 'ovl_En_River_Sound', - 'ovl_En_Rl', - 'ovl_En_Rr', - 'ovl_En_Ru1', - 'ovl_En_Ru2', - 'ovl_En_Sa', - 'ovl_En_Sb', - 'ovl_En_Scene_Change', - 'ovl_En_Sda', - 'ovl_En_Shopnuts', - 'ovl_En_Si', - 'ovl_En_Siofuki', - 'ovl_En_Skb', - 'ovl_En_Skj', - 'ovl_En_Skjneedle', - 'ovl_En_Ssh', - 'ovl_En_St', - 'ovl_En_Sth', - 'ovl_En_Stream', - 'ovl_En_Sw', - 'ovl_En_Syateki_Itm', - 'ovl_En_Syateki_Man', - 'ovl_En_Syateki_Niw', - 'ovl_En_Ta', - 'ovl_En_Takara_Man', - 'ovl_En_Tana', - 'ovl_En_Tg', - 'ovl_En_Tite', - 'ovl_En_Tk', - 'ovl_En_Torch', - 'ovl_En_Torch2', - 'ovl_En_Toryo', - 'ovl_En_Tp', - 'ovl_En_Tr', - 'ovl_En_Trap', - 'ovl_En_Tubo_Trap', - 'ovl_En_Vali', - 'ovl_En_Vase', - 'ovl_En_Vb_Ball', - 'ovl_En_Viewer', - 'ovl_En_Vm', - 'ovl_En_Wall_Tubo', - 'ovl_En_Wallmas', - 'ovl_En_Weather_Tag', - 'ovl_En_Weiyer', - 'ovl_En_Wf', - 'ovl_En_Wonder_Item', - 'ovl_En_Wonder_Talk', - 'ovl_En_Wonder_Talk2', - 'ovl_En_Wood02', - 'ovl_En_Xc', - 'ovl_En_Yabusame_Mark', - 'ovl_En_Yukabyun', - 'ovl_En_Zf', - 'ovl_En_Zl1', - 'ovl_En_Zl2', - 'ovl_En_Zl3', - 'ovl_En_Zl4', - 'ovl_En_Zo', - 'ovl_En_fHG', - 'ovl_End_Title', - 'ovl_Fishing', - 'ovl_Item_B_Heart', - 'ovl_Item_Etcetera', - 'ovl_Item_Inbox', - 'ovl_Item_Ocarina', - 'ovl_Item_Shield', - 'ovl_Magic_Dark', - 'ovl_Magic_Fire', - 'ovl_Magic_Wind', - 'ovl_Mir_Ray', - 'ovl_Obj_Bean', - 'ovl_Obj_Blockstop', - 'ovl_Obj_Bombiwa', - 'ovl_Obj_Comb', - 'ovl_Obj_Dekujr', - 'ovl_Obj_Elevator', - 'ovl_Obj_Hamishi', - 'ovl_Obj_Hana', - 'ovl_Obj_Hsblock', - 'ovl_Obj_Ice_Poly', - 'ovl_Obj_Kibako', - 'ovl_Obj_Kibako2', - 'ovl_Obj_Lift', - 'ovl_Obj_Lightswitch', - 'ovl_Obj_Makekinsuta', - 'ovl_Obj_Makeoshihiki', - 'ovl_Obj_Mure', - 'ovl_Obj_Mure2', - 'ovl_Obj_Mure3', - 'ovl_Obj_Oshihiki', - 'ovl_Obj_Roomtimer', - 'ovl_Obj_Switch', - 'ovl_Obj_Syokudai', - 'ovl_Obj_Timeblock', - 'ovl_Obj_Tsubo', - 'ovl_Obj_Warp2block', - 'ovl_Object_Kankyo', - 'ovl_Oceff_Spot', - 'ovl_Oceff_Storm', - 'ovl_Oceff_Wipe', - 'ovl_Oceff_Wipe2', - 'ovl_Oceff_Wipe3', - 'ovl_Oceff_Wipe4', - 'ovl_Shot_Sun', - 'gameplay_keep', - 'gameplay_field_keep', - 'gameplay_dangeon_keep', - 'gameplay_object_exchange_static', - 'object_link_boy', - 'object_link_child', - 'object_box', - 'object_human', - 'object_okuta', - 'object_poh', - 'object_wallmaster', - 'object_dy_obj', - 'object_firefly', - 'object_dodongo', - 'object_fire', - 'object_niw', - 'object_tite', - 'object_reeba', - 'object_peehat', - 'object_kingdodongo', - 'object_horse', - 'object_zf', - 'object_goma', - 'object_zl1', - 'object_gol', - 'object_bubble', - 'object_dodojr', - 'object_torch2', - 'object_bl', - 'object_tp', - 'object_oA1', - 'object_st', - 'object_bw', - 'object_ei', - 'object_horse_normal', - 'object_oB1', - 'object_o_anime', - 'object_spot04_objects', - 'object_ddan_objects', - 'object_hidan_objects', - 'object_horse_ganon', - 'object_oA2', - 'object_spot00_objects', - 'object_mb', - 'object_bombf', - 'object_sk2', - 'object_oE1', - 'object_oE_anime', - 'object_oE2', - 'object_ydan_objects', - 'object_gnd', - 'object_am', - 'object_dekubaba', - 'object_oA3', - 'object_oA4', - 'object_oA5', - 'object_oA6', - 'object_oA7', - 'object_jj', - 'object_oA8', - 'object_oA9', - 'object_oB2', - 'object_oB3', - 'object_oB4', - 'object_horse_zelda', - 'object_opening_demo1', - 'object_warp1', - 'object_b_heart', - 'object_dekunuts', - 'object_oE3', - 'object_oE4', - 'object_menkuri_objects', - 'object_oE5', - 'object_oE6', - 'object_oE7', - 'object_oE8', - 'object_oE9', - 'object_oE10', - 'object_oE11', - 'object_oE12', - 'object_vali', - 'object_oA10', - 'object_oA11', - 'object_mizu_objects', - 'object_fhg', - 'object_ossan', - 'object_mori_hineri1', - 'object_Bb', - 'object_toki_objects', - 'object_yukabyun', - 'object_zl2', - 'object_mjin', - 'object_mjin_flash', - 'object_mjin_dark', - 'object_mjin_flame', - 'object_mjin_ice', - 'object_mjin_soul', - 'object_mjin_wind', - 'object_mjin_oka', - 'object_haka_objects', - 'object_spot06_objects', - 'object_ice_objects', - 'object_relay_objects', - 'object_mori_hineri1a', - 'object_mori_hineri2', - 'object_mori_hineri2a', - 'object_mori_objects', - 'object_mori_tex', - 'object_spot08_obj', - 'object_warp2', - 'object_hata', - 'object_bird', - 'object_wood02', - 'object_lightbox', - 'object_pu_box', - 'object_trap', - 'object_vase', - 'object_im', - 'object_ta', - 'object_tk', - 'object_xc', - 'object_vm', - 'object_bv', - 'object_hakach_objects', - 'object_efc_crystal_light', - 'object_efc_fire_ball', - 'object_efc_flash', - 'object_efc_lgt_shower', - 'object_efc_star_field', - 'object_god_lgt', - 'object_light_ring', - 'object_triforce_spot', - 'object_medal', - 'object_bdan_objects', - 'object_sd', - 'object_rd', - 'object_po_sisters', - 'object_heavy_object', - 'object_gndd', - 'object_fd', - 'object_du', - 'object_fw', - 'object_horse_link_child', - 'object_spot02_objects', - 'object_haka', - 'object_ru1', - 'object_syokudai', - 'object_fd2', - 'object_dh', - 'object_rl', - 'object_efc_tw', - 'object_demo_tre_lgt', - 'object_gi_key', - 'object_mir_ray', - 'object_brob', - 'object_gi_jewel', - 'object_spot09_obj', - 'object_spot18_obj', - 'object_bdoor', - 'object_spot17_obj', - 'object_shop_dungen', - 'object_nb', - 'object_mo', - 'object_sb', - 'object_gi_melody', - 'object_gi_heart', - 'object_gi_compass', - 'object_gi_bosskey', - 'object_gi_medal', - 'object_gi_nuts', - 'object_sa', - 'object_gi_hearts', - 'object_gi_arrowcase', - 'object_gi_bombpouch', - 'object_in', - 'object_tr', - 'object_spot16_obj', - 'object_oE1s', - 'object_oE4s', - 'object_os_anime', - 'object_gi_bottle', - 'object_gi_stick', - 'object_gi_map', - 'object_oF1d_map', - 'object_ru2', - 'object_gi_shield_1', - 'object_dekujr', - 'object_gi_magicpot', - 'object_gi_bomb_1', - 'object_oF1s', - 'object_ma2', - 'object_gi_purse', - 'object_hni', - 'object_tw', - 'object_rr', - 'object_bxa', - 'object_anubice', - 'object_gi_gerudo', - 'object_gi_arrow', - 'object_gi_bomb_2', - 'object_gi_egg', - 'object_gi_scale', - 'object_gi_shield_2', - 'object_gi_hookshot', - 'object_gi_ocarina', - 'object_gi_milk', - 'object_ma1', - 'object_ganon', - 'object_sst', - 'object_ny', - 'object_fr', - 'object_gi_pachinko', - 'object_gi_boomerang', - 'object_gi_bow', - 'object_gi_glasses', - 'object_gi_liquid', - 'object_ani', - 'object_demo_6k', - 'object_gi_shield_3', - 'object_gi_letter', - 'object_spot15_obj', - 'object_jya_obj', - 'object_gi_clothes', - 'object_gi_bean', - 'object_gi_fish', - 'object_gi_saw', - 'object_gi_hammer', - 'object_gi_grass', - 'object_gi_longsword', - 'object_spot01_objects', - 'object_md', - 'object_km1', - 'object_kw1', - 'object_zo', - 'object_kz', - 'object_umajump', - 'object_masterkokiri', - 'object_masterkokirihead', - 'object_mastergolon', - 'object_masterzoora', - 'object_aob', - 'object_ik', - 'object_ahg', - 'object_cne', - 'object_gi_niwatori', - 'object_skj', - 'object_gi_bottle_letter', - 'object_bji', - 'object_bba', - 'object_gi_ocarina_0', - 'object_ds', - 'object_ane', - 'object_boj', - 'object_spot03_object', - 'object_spot07_object', - 'object_fz', - 'object_bob', - 'object_ge1', - 'object_yabusame_point', - 'object_gi_boots_2', - 'object_gi_seed', - 'object_gnd_magic', - 'object_d_elevator', - 'object_d_hsblock', - 'object_d_lift', - 'object_mamenoki', - 'object_goroiwa', - 'object_toryo', - 'object_daiku', - 'object_nwc', - 'object_blkobj', - 'object_gm', - 'object_ms', - 'object_hs', - 'object_ingate', - 'object_lightswitch', - 'object_kusa', - 'object_tsubo', - 'object_gi_gloves', - 'object_gi_coin', - 'object_kanban', - 'object_gjyo_objects', - 'object_owl', - 'object_mk', - 'object_fu', - 'object_gi_ki_tan_mask', - 'object_gi_redead_mask', - 'object_gi_skj_mask', - 'object_gi_rabit_mask', - 'object_gi_truth_mask', - 'object_ganon_objects', - 'object_siofuki', - 'object_stream', - 'object_mm', - 'object_fa', - 'object_os', - 'object_gi_eye_lotion', - 'object_gi_powder', - 'object_gi_mushroom', - 'object_gi_ticketstone', - 'object_gi_brokensword', - 'object_js', - 'object_cs', - 'object_gi_prescription', - 'object_gi_bracelet', - 'object_gi_soldout', - 'object_gi_frog', - 'object_mag', - 'object_door_gerudo', - 'object_gt', - 'object_efc_erupc', - 'object_zl2_anime1', - 'object_zl2_anime2', - 'object_gi_golonmask', - 'object_gi_zoramask', - 'object_gi_gerudomask', - 'object_ganon2', - 'object_ka', - 'object_ts', - 'object_zg', - 'object_gi_hoverboots', - 'object_gi_m_arrow', - 'object_ds2', - 'object_ec', - 'object_fish', - 'object_gi_sutaru', - 'object_gi_goddess', - 'object_ssh', - 'object_bigokuta', - 'object_bg', - 'object_spot05_objects', - 'object_spot12_obj', - 'object_bombiwa', - 'object_hintnuts', - 'object_rs', - 'object_spot00_break', - 'object_gla', - 'object_shopnuts', - 'object_geldb', - 'object_gr', - 'object_dog', - 'object_jya_iron', - 'object_jya_door', - 'object_spot01_objects2', - 'object_spot11_obj', - 'object_kibako2', - 'object_dns', - 'object_dnk', - 'object_gi_fire', - 'object_gi_insect', - 'object_gi_butterfly', - 'object_gi_ghost', - 'object_gi_soul', - 'object_bowl', - 'object_po_field', - 'object_demo_kekkai', - 'object_efc_doughnut', - 'object_gi_dekupouch', - 'object_ganon_anime1', - 'object_ganon_anime2', - 'object_ganon_anime3', - 'object_gi_rupy', - 'object_spot01_matoya', - 'object_spot01_matoyab', - 'object_po_composer', - 'object_mu', - 'object_wf', - 'object_skb', - 'object_gj', - 'object_geff', - 'object_haka_door', - 'object_gs', - 'object_ps', - 'object_bwall', - 'object_crow', - 'object_cow', - 'object_cob', - 'object_gi_sword_1', - 'object_door_killer', - 'object_ouke_haka', - 'object_timeblock', - 'object_zl4', - 'g_pn_01', - 'g_pn_02', - 'g_pn_03', - 'g_pn_04', - 'g_pn_05', - 'g_pn_06', - 'g_pn_07', - 'g_pn_08', - 'g_pn_09', - 'g_pn_10', - 'g_pn_11', - 'g_pn_12', - 'g_pn_13', - 'g_pn_14', - 'g_pn_15', - 'g_pn_16', - 'g_pn_17', - 'g_pn_18', - 'g_pn_19', - 'g_pn_20', - 'g_pn_21', - 'g_pn_22', - 'g_pn_23', - 'g_pn_24', - 'g_pn_25', - 'g_pn_26', - 'g_pn_27', - 'g_pn_28', - 'g_pn_29', - 'g_pn_30', - 'g_pn_31', - 'g_pn_32', - 'g_pn_33', - 'g_pn_34', - 'g_pn_35', - 'g_pn_36', - 'g_pn_37', - 'g_pn_38', - 'g_pn_39', - 'g_pn_40', - 'g_pn_41', - 'g_pn_42', - 'g_pn_43', - 'g_pn_44', - 'g_pn_45', - 'g_pn_46', - 'g_pn_47', - 'g_pn_48', - 'g_pn_49', - 'g_pn_50', - 'g_pn_51', - 'g_pn_52', - 'g_pn_53', - 'g_pn_54', - 'g_pn_55', - 'g_pn_56', - 'g_pn_57', - 'z_select_static', - 'nintendo_rogo_static', - 'title_static', - 'parameter_static', - 'vr_fine0_static', - 'vr_fine0_pal_static', - 'vr_fine1_static', - 'vr_fine1_pal_static', - 'vr_fine2_static', - 'vr_fine2_pal_static', - 'vr_fine3_static', - 'vr_fine3_pal_static', - 'vr_cloud0_static', - 'vr_cloud0_pal_static', - 'vr_cloud1_static', - 'vr_cloud1_pal_static', - 'vr_cloud2_static', - 'vr_cloud2_pal_static', - 'vr_cloud3_static', - 'vr_cloud3_pal_static', - 'vr_holy0_static', - 'vr_holy0_pal_static', - 'vr_holy1_static', - 'vr_holy1_pal_static', - 'vr_MDVR_static', - 'vr_MDVR_pal_static', - 'vr_MNVR_static', - 'vr_MNVR_pal_static', - 'vr_RUVR_static', - 'vr_RUVR_pal_static', - 'vr_LHVR_static', - 'vr_LHVR_pal_static', - 'vr_KHVR_static', - 'vr_KHVR_pal_static', - 'vr_K3VR_static', - 'vr_K3VR_pal_static', - 'vr_K4VR_static', - 'vr_K4VR_pal_static', - 'vr_K5VR_static', - 'vr_K5VR_pal_static', - 'vr_SP1a_static', - 'vr_SP1a_pal_static', - 'vr_MLVR_static', - 'vr_MLVR_pal_static', - 'vr_KKRVR_static', - 'vr_KKRVR_pal_static', - 'vr_KR3VR_static', - 'vr_KR3VR_pal_static', - 'vr_IPVR_static', - 'vr_IPVR_pal_static', - 'vr_KSVR_static', - 'vr_KSVR_pal_static', - 'vr_GLVR_static', - 'vr_GLVR_pal_static', - 'vr_ZRVR_static', - 'vr_ZRVR_pal_static', - 'vr_DGVR_static', - 'vr_DGVR_pal_static', - 'vr_ALVR_static', - 'vr_ALVR_pal_static', - 'vr_NSVR_static', - 'vr_NSVR_pal_static', - 'vr_LBVR_static', - 'vr_LBVR_pal_static', - 'vr_TTVR_static', - 'vr_TTVR_pal_static', - 'vr_FCVR_static', - 'vr_FCVR_pal_static', - 'elf_message_field', - 'elf_message_ydan', - 'syotes_scene', - 'syotes_room_0', - 'syotes2_scene', - 'syotes2_room_0', - 'depth_test_scene', - 'depth_test_room_0', - 'spot00_scene', - 'spot00_room_0', - 'spot01_scene', - 'spot01_room_0', - 'spot02_scene', - 'spot02_room_0', - 'spot02_room_1', - 'spot03_scene', - 'spot03_room_0', - 'spot03_room_1', - 'spot04_scene', - 'spot04_room_0', - 'spot04_room_1', - 'spot04_room_2', - 'spot05_scene', - 'spot05_room_0', - 'spot06_scene', - 'spot06_room_0', - 'spot07_scene', - 'spot07_room_0', - 'spot07_room_1', - 'spot08_scene', - 'spot08_room_0', - 'spot09_scene', - 'spot09_room_0', - 'spot10_scene', - 'spot10_room_0', - 'spot10_room_1', - 'spot10_room_2', - 'spot10_room_3', - 'spot10_room_4', - 'spot10_room_5', - 'spot10_room_6', - 'spot10_room_7', - 'spot10_room_8', - 'spot10_room_9', - 'spot11_scene', - 'spot11_room_0', - 'spot12_scene', - 'spot12_room_0', - 'spot12_room_1', - 'spot13_scene', - 'spot13_room_0', - 'spot13_room_1', - 'spot15_scene', - 'spot15_room_0', - 'spot16_scene', - 'spot16_room_0', - 'spot17_scene', - 'spot17_room_0', - 'spot17_room_1', - 'spot18_scene', - 'spot18_room_0', - 'spot18_room_1', - 'spot18_room_2', - 'spot18_room_3', - 'ydan_scene', - 'ydan_room_0', - 'ydan_room_1', - 'ydan_room_2', - 'ydan_room_3', - 'ydan_room_4', - 'ydan_room_5', - 'ydan_room_6', - 'ydan_room_7', - 'ydan_room_8', - 'ydan_room_9', - 'ydan_room_10', - 'ydan_room_11', - 'ddan_scene', - 'ddan_room_0', - 'ddan_room_1', - 'ddan_room_2', - 'ddan_room_3', - 'ddan_room_4', - 'ddan_room_5', - 'ddan_room_6', - 'ddan_room_7', - 'ddan_room_8', - 'ddan_room_9', - 'ddan_room_10', - 'ddan_room_11', - 'ddan_room_12', - 'ddan_room_13', - 'ddan_room_14', - 'ddan_room_15', - 'ddan_room_16', - 'bdan_scene', - 'bdan_room_0', - 'bdan_room_1', - 'bdan_room_2', - 'bdan_room_3', - 'bdan_room_4', - 'bdan_room_5', - 'bdan_room_6', - 'bdan_room_7', - 'bdan_room_8', - 'bdan_room_9', - 'bdan_room_10', - 'bdan_room_11', - 'bdan_room_12', - 'bdan_room_13', - 'bdan_room_14', - 'bdan_room_15', - 'Bmori1_scene', - 'Bmori1_room_0', - 'Bmori1_room_1', - 'Bmori1_room_2', - 'Bmori1_room_3', - 'Bmori1_room_4', - 'Bmori1_room_5', - 'Bmori1_room_6', - 'Bmori1_room_7', - 'Bmori1_room_8', - 'Bmori1_room_9', - 'Bmori1_room_10', - 'Bmori1_room_11', - 'Bmori1_room_12', - 'Bmori1_room_13', - 'Bmori1_room_14', - 'Bmori1_room_15', - 'Bmori1_room_16', - 'Bmori1_room_17', - 'Bmori1_room_18', - 'Bmori1_room_19', - 'Bmori1_room_20', - 'Bmori1_room_21', - 'Bmori1_room_22', - 'HIDAN_scene', - 'HIDAN_room_0', - 'HIDAN_room_1', - 'HIDAN_room_2', - 'HIDAN_room_3', - 'HIDAN_room_4', - 'HIDAN_room_5', - 'HIDAN_room_6', - 'HIDAN_room_7', - 'HIDAN_room_8', - 'HIDAN_room_9', - 'HIDAN_room_10', - 'HIDAN_room_11', - 'HIDAN_room_12', - 'HIDAN_room_13', - 'HIDAN_room_14', - 'HIDAN_room_15', - 'HIDAN_room_16', - 'HIDAN_room_17', - 'HIDAN_room_18', - 'HIDAN_room_19', - 'HIDAN_room_20', - 'HIDAN_room_21', - 'HIDAN_room_22', - 'HIDAN_room_23', - 'HIDAN_room_24', - 'HIDAN_room_25', - 'HIDAN_room_26', - 'MIZUsin_scene', - 'MIZUsin_room_0', - 'MIZUsin_room_1', - 'MIZUsin_room_2', - 'MIZUsin_room_3', - 'MIZUsin_room_4', - 'MIZUsin_room_5', - 'MIZUsin_room_6', - 'MIZUsin_room_7', - 'MIZUsin_room_8', - 'MIZUsin_room_9', - 'MIZUsin_room_10', - 'MIZUsin_room_11', - 'MIZUsin_room_12', - 'MIZUsin_room_13', - 'MIZUsin_room_14', - 'MIZUsin_room_15', - 'MIZUsin_room_16', - 'MIZUsin_room_17', - 'MIZUsin_room_18', - 'MIZUsin_room_19', - 'MIZUsin_room_20', - 'MIZUsin_room_21', - 'MIZUsin_room_22', - 'jyasinzou_scene', - 'jyasinzou_room_0', - 'jyasinzou_room_1', - 'jyasinzou_room_2', - 'jyasinzou_room_3', - 'jyasinzou_room_4', - 'jyasinzou_room_5', - 'jyasinzou_room_6', - 'jyasinzou_room_7', - 'jyasinzou_room_8', - 'jyasinzou_room_9', - 'jyasinzou_room_10', - 'jyasinzou_room_11', - 'jyasinzou_room_12', - 'jyasinzou_room_13', - 'jyasinzou_room_14', - 'jyasinzou_room_15', - 'jyasinzou_room_16', - 'jyasinzou_room_17', - 'jyasinzou_room_18', - 'jyasinzou_room_19', - 'jyasinzou_room_20', - 'jyasinzou_room_21', - 'jyasinzou_room_22', - 'jyasinzou_room_23', - 'jyasinzou_room_24', - 'jyasinzou_room_25', - 'jyasinzou_room_26', - 'jyasinzou_room_27', - 'jyasinzou_room_28', - 'HAKAdan_scene', - 'HAKAdan_room_0', - 'HAKAdan_room_1', - 'HAKAdan_room_2', - 'HAKAdan_room_3', - 'HAKAdan_room_4', - 'HAKAdan_room_5', - 'HAKAdan_room_6', - 'HAKAdan_room_7', - 'HAKAdan_room_8', - 'HAKAdan_room_9', - 'HAKAdan_room_10', - 'HAKAdan_room_11', - 'HAKAdan_room_12', - 'HAKAdan_room_13', - 'HAKAdan_room_14', - 'HAKAdan_room_15', - 'HAKAdan_room_16', - 'HAKAdan_room_17', - 'HAKAdan_room_18', - 'HAKAdan_room_19', - 'HAKAdan_room_20', - 'HAKAdan_room_21', - 'HAKAdan_room_22', - 'HAKAdanCH_scene', - 'HAKAdanCH_room_0', - 'HAKAdanCH_room_1', - 'HAKAdanCH_room_2', - 'HAKAdanCH_room_3', - 'HAKAdanCH_room_4', - 'HAKAdanCH_room_5', - 'HAKAdanCH_room_6', - 'ice_doukutu_scene', - 'ice_doukutu_room_0', - 'ice_doukutu_room_1', - 'ice_doukutu_room_2', - 'ice_doukutu_room_3', - 'ice_doukutu_room_4', - 'ice_doukutu_room_5', - 'ice_doukutu_room_6', - 'ice_doukutu_room_7', - 'ice_doukutu_room_8', - 'ice_doukutu_room_9', - 'ice_doukutu_room_10', - 'ice_doukutu_room_11', - 'men_scene', - 'men_room_0', - 'men_room_1', - 'men_room_2', - 'men_room_3', - 'men_room_4', - 'men_room_5', - 'men_room_6', - 'men_room_7', - 'men_room_8', - 'men_room_9', - 'men_room_10', - 'ganontika_scene', - 'ganontika_room_0', - 'ganontika_room_1', - 'ganontika_room_2', - 'ganontika_room_3', - 'ganontika_room_4', - 'ganontika_room_5', - 'ganontika_room_6', - 'ganontika_room_7', - 'ganontika_room_8', - 'ganontika_room_9', - 'ganontika_room_10', - 'ganontika_room_11', - 'ganontika_room_12', - 'ganontika_room_13', - 'ganontika_room_14', - 'ganontika_room_15', - 'ganontika_room_16', - 'ganontika_room_17', - 'ganontika_room_18', - 'ganontika_room_19', - 'market_day_scene', - 'market_day_room_0', - 'market_night_scene', - 'market_night_room_0', - 'testroom_scene', - 'testroom_room_0', - 'testroom_room_1', - 'testroom_room_2', - 'testroom_room_3', - 'testroom_room_4', - 'kenjyanoma_scene', - 'kenjyanoma_room_0', - 'tokinoma_scene', - 'tokinoma_room_0', - 'tokinoma_room_1', - 'sutaru_scene', - 'sutaru_room_0', - 'link_home_scene', - 'link_home_room_0', - 'kokiri_shop_scene', - 'kokiri_shop_room_0', - 'kokiri_home_scene', - 'kokiri_home_room_0', - 'kakusiana_scene', - 'kakusiana_room_0', - 'kakusiana_room_1', - 'kakusiana_room_2', - 'kakusiana_room_3', - 'kakusiana_room_4', - 'kakusiana_room_5', - 'kakusiana_room_6', - 'kakusiana_room_7', - 'kakusiana_room_8', - 'kakusiana_room_9', - 'kakusiana_room_10', - 'kakusiana_room_11', - 'kakusiana_room_12', - 'kakusiana_room_13', - 'entra_scene', - 'entra_room_0', - 'moribossroom_scene', - 'moribossroom_room_0', - 'moribossroom_room_1', - 'syatekijyou_scene', - 'syatekijyou_room_0', - 'shop1_scene', - 'shop1_room_0', - 'hairal_niwa_scene', - 'hairal_niwa_room_0', - 'ganon_tou_scene', - 'ganon_tou_room_0', - 'sasatest_scene', - 'sasatest_room_0', - 'market_alley_scene', - 'market_alley_room_0', - 'spot20_scene', - 'spot20_room_0', - 'market_ruins_scene', - 'market_ruins_room_0', - 'entra_n_scene', - 'entra_n_room_0', - 'enrui_scene', - 'enrui_room_0', - 'market_alley_n_scene', - 'market_alley_n_room_0', - 'hiral_demo_scene', - 'hiral_demo_room_0', - 'kokiri_home3_scene', - 'kokiri_home3_room_0', - 'malon_stable_scene', - 'malon_stable_room_0', - 'kakariko_scene', - 'kakariko_room_0', - 'bdan_boss_scene', - 'bdan_boss_room_0', - 'bdan_boss_room_1', - 'FIRE_bs_scene', - 'FIRE_bs_room_0', - 'FIRE_bs_room_1', - 'hut_scene', - 'hut_room_0', - 'daiyousei_izumi_scene', - 'daiyousei_izumi_room_0', - 'hakaana_scene', - 'hakaana_room_0', - 'yousei_izumi_tate_scene', - 'yousei_izumi_tate_room_0', - 'yousei_izumi_yoko_scene', - 'yousei_izumi_yoko_room_0', - 'golon_scene', - 'golon_room_0', - 'zoora_scene', - 'zoora_room_0', - 'drag_scene', - 'drag_room_0', - 'alley_shop_scene', - 'alley_shop_room_0', - 'night_shop_scene', - 'night_shop_room_0', - 'impa_scene', - 'impa_room_0', - 'labo_scene', - 'labo_room_0', - 'tent_scene', - 'tent_room_0', - 'nakaniwa_scene', - 'nakaniwa_room_0', - 'ddan_boss_scene', - 'ddan_boss_room_0', - 'ddan_boss_room_1', - 'ydan_boss_scene', - 'ydan_boss_room_0', - 'ydan_boss_room_1', - 'HAKAdan_bs_scene', - 'HAKAdan_bs_room_0', - 'HAKAdan_bs_room_1', - 'MIZUsin_bs_scene', - 'MIZUsin_bs_room_0', - 'MIZUsin_bs_room_1', - 'ganon_scene', - 'ganon_room_0', - 'ganon_room_1', - 'ganon_room_2', - 'ganon_room_3', - 'ganon_room_4', - 'ganon_room_5', - 'ganon_room_6', - 'ganon_room_7', - 'ganon_room_8', - 'ganon_room_9', - 'ganon_boss_scene', - 'ganon_boss_room_0', - 'jyasinboss_scene', - 'jyasinboss_room_0', - 'jyasinboss_room_1', - 'jyasinboss_room_2', - 'jyasinboss_room_3', - 'kokiri_home4_scene', - 'kokiri_home4_room_0', - 'kokiri_home5_scene', - 'kokiri_home5_room_0', - 'ganon_final_scene', - 'ganon_final_room_0', - 'kakariko3_scene', - 'kakariko3_room_0', - 'hairal_niwa2_scene', - 'hairal_niwa2_room_0', - 'hakasitarelay_scene', - 'hakasitarelay_room_0', - 'hakasitarelay_room_1', - 'hakasitarelay_room_2', - 'hakasitarelay_room_3', - 'hakasitarelay_room_4', - 'hakasitarelay_room_5', - 'hakasitarelay_room_6', - 'shrine_scene', - 'shrine_room_0', - 'turibori_scene', - 'turibori_room_0', - 'shrine_n_scene', - 'shrine_n_room_0', - 'shrine_r_scene', - 'shrine_r_room_0', - 'hakaana2_scene', - 'hakaana2_room_0', - 'gerudoway_scene', - 'gerudoway_room_0', - 'gerudoway_room_1', - 'gerudoway_room_2', - 'gerudoway_room_3', - 'gerudoway_room_4', - 'gerudoway_room_5', - 'hairal_niwa_n_scene', - 'hairal_niwa_n_room_0', - 'bowling_scene', - 'bowling_room_0', - 'hakaana_ouke_scene', - 'hakaana_ouke_room_0', - 'hakaana_ouke_room_1', - 'hakaana_ouke_room_2', - 'hylia_labo_scene', - 'hylia_labo_room_0', - 'souko_scene', - 'souko_room_0', - 'souko_room_1', - 'souko_room_2', - 'miharigoya_scene', - 'miharigoya_room_0', - 'mahouya_scene', - 'mahouya_room_0', - 'takaraya_scene', - 'takaraya_room_0', - 'takaraya_room_1', - 'takaraya_room_2', - 'takaraya_room_3', - 'takaraya_room_4', - 'takaraya_room_5', - 'takaraya_room_6', - 'ganon_sonogo_scene', - 'ganon_sonogo_room_0', - 'ganon_sonogo_room_1', - 'ganon_sonogo_room_2', - 'ganon_sonogo_room_3', - 'ganon_sonogo_room_4', - 'ganon_demo_scene', - 'ganon_demo_room_0', - 'besitu_scene', - 'besitu_room_0', - 'face_shop_scene', - 'face_shop_room_0', - 'kinsuta_scene', - 'kinsuta_room_0', - 'ganontikasonogo_scene', - 'ganontikasonogo_room_0', - 'ganontikasonogo_room_1', - 'test01_scene', - 'test01_room_0', - 'bump_texture_static', - 'anime_model_1_static', - 'anime_model_2_static', - 'anime_model_3_static', - 'anime_model_4_static', - 'anime_model_5_static', - 'anime_model_6_static', - 'anime_texture_1_static', - 'anime_texture_2_static', - 'anime_texture_3_static', - 'anime_texture_4_static', - 'anime_texture_5_static', - 'anime_texture_6_static', - 'softsprite_matrix_static', -] - -romData = None - - -def initialize_worker(rom_data): - global romData - romData = rom_data - -def read_uint32_be(offset): - return struct.unpack('>I', romData[offset:offset+4])[0] - -def write_output_file(name, offset, size): - try: - with open(name, 'wb') as f: - f.write(romData[offset:offset+size]) - except IOError: - print('failed to write file ' + name) - -def ExtractFunc(i): - filename = SEGMENTS_PATH / FILE_NAMES[i] - entryOffset = FILE_TABLE_OFFSET + 16 * i - - virtStart = read_uint32_be(entryOffset + 0) - virtEnd = read_uint32_be(entryOffset + 4) - physStart = read_uint32_be(entryOffset + 8) - physEnd = read_uint32_be(entryOffset + 12) - - if physEnd == 0: # uncompressed - size = virtEnd - virtStart - else: # compressed - size = physEnd - physStart - - print(f'extracting {filename} (0x{virtStart:08X}, 0x{virtEnd:08X})') - write_output_file(filename, physStart, size) - -##################################################################### - -def main(): - SEGMENTS_PATH.mkdir(parents=True, exist_ok=True) - - # read baserom data - try: - rom_data = ROM_FILE_PATH.read_bytes() - except IOError: - print(f'failed to read file {ROM_FILE_PATH}') - exit(1) - - # extract files - num_cores = cpu_count() - print("Extracting baserom with " + str(num_cores) + " CPU cores.") - with Pool(num_cores, initialize_worker, (rom_data,)) as p: - p.map(ExtractFunc, range(len(FILE_NAMES))) - -if __name__ == "__main__": - main() diff --git a/first_diff.py b/first_diff.py deleted file mode 100755 index 5c16b7620..000000000 --- a/first_diff.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -from pathlib import Path - -import rabbitizer -import mapfile_parser - - -def decodeInstruction(bytesDiff: bytes, mapFile: mapfile_parser.MapFile) -> str: - word = (bytesDiff[0] << 24) | (bytesDiff[1] << 16) | (bytesDiff[2] << 8) | (bytesDiff[3] << 0) - instr = rabbitizer.Instruction(word) - immOverride = None - - if instr.isJumpWithAddress(): - # Instruction is a function call (jal) - - # Get the embedded address of the function call - symAddress = instr.getInstrIndexAsVram() - - # Search for the address in the mapfile - symInfo = mapFile.findSymbolByVramOrVrom(symAddress) - if symInfo is not None: - # Use the symbol from the mapfile instead of a raw value - immOverride = symInfo.symbol.name - - return instr.disassemble(immOverride=immOverride, extraLJust=-20) - -def firstDiffMain(): - parser = argparse.ArgumentParser(description="Find the first difference(s) between the built ROM and the base ROM.") - - parser.add_argument("-c", "--count", type=int, default=5, help="find up to this many instruction difference(s)") - parser.add_argument("-v", "--oot-version", help="Which version should be processed", default="gc-eu-mq-dbg") - parser.add_argument("-a", "--add-colons", action='store_true', help="Add colon between bytes" ) - - args = parser.parse_args() - - buildFolder = Path("build") / args.oot_version - - BUILTROM = buildFolder / f"oot-{args.oot_version}.z64" - BUILTMAP = buildFolder / f"oot-{args.oot_version}.map" - - EXPECTEDROM = Path(f"baseroms/{args.oot_version}/baserom-decompressed.z64") - EXPECTEDMAP = "expected" / BUILTMAP - - mapfile_parser.frontends.first_diff.doFirstDiff(BUILTMAP, EXPECTEDMAP, BUILTROM, EXPECTEDROM, args.count, mismatchSize=True, addColons=args.add_colons, bytesConverterCallback=decodeInstruction) - -if __name__ == "__main__": - firstDiffMain() diff --git a/format.py b/format.py index 520a2d807..67f46bd6d 100755 --- a/format.py +++ b/format.py @@ -29,7 +29,7 @@ APPLY_OPTS = "--format --style=file" # Compiler options used with Clang-Tidy # Normal warnings are disabled with -Wno-everything to focus only on tidying -INCLUDES = "-Iinclude -Isrc -Ibuild/gc-eu-mq-dbg -I." +INCLUDES = "-Iinclude -Isrc -Ibuild/gc-eu-mq-dbg -Ibuild/hackeroot-mq -I." DEFINES = "-D_LANGUAGE_C -DNON_MATCHING" COMPILER_OPTS = f"-fno-builtin -std=gnu90 -m32 -Wno-everything {INCLUDES} {DEFINES}" diff --git a/include/alignment.h b/include/alignment.h index e26a1d3f3..2169f90d3 100644 --- a/include/alignment.h +++ b/include/alignment.h @@ -8,9 +8,9 @@ #define ALIGN256(val) (((val) + 0xFF) & ~0xFF) #ifdef __GNUC__ -#define ALIGNED8 __attribute__ ((aligned (8))) +#define ALIGNED(n) __attribute__ ((aligned (n))) #else -#define ALIGNED8 +#define ALIGNED(n) #endif #ifdef __sgi /* IDO compiler */ diff --git a/include/compression.h b/include/compression.h new file mode 100644 index 000000000..3a068285b --- /dev/null +++ b/include/compression.h @@ -0,0 +1,14 @@ +#ifndef COMPRESSION_H +#define COMPRESSION_H + +#include "ultra64.h" + +void* Yaz0_FirstDMA(void); +void* Yaz0_NextDMA(u8* curSrcPos); +void Yaz0_DecompressImpl(u8* src, u8* dst); + +void Yaz0_Decompress(uintptr_t romStart, u8* dst, size_t size); +void LZO_Decompress(unsigned int pstart, unsigned char* op, unsigned int sz); +void Aplib_Decompress(unsigned rom, unsigned char* dst, unsigned compSz); + +#endif diff --git a/include/config.h b/include/config.h new file mode 100644 index 000000000..595be835b --- /dev/null +++ b/include/config.h @@ -0,0 +1,18 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include "libc/stdbool.h" + +/** + * All HackerOoT config headers included into one. + */ + +#include "config/config_debug_features.h" +#include "config/config_debug_controls.h" +#include "config/config_debug.h" +#include "config/config_game.h" + +/* WARNING: Compatibility safeguards - don't remove this file unless you know what you're doing */ +#include "config/config_safeguards.h" + +#endif diff --git a/include/config/config_debug.h b/include/config/config_debug.h new file mode 100644 index 000000000..3931fe1f4 --- /dev/null +++ b/include/config/config_debug.h @@ -0,0 +1,68 @@ +#ifndef CONFIG_BOOTUP_H +#define CONFIG_BOOTUP_H + +/****************** + * DEBUG SETTINGS * + ******************/ + +/** + * All settings here will only be applied if DEBUG_ROM is defined. + * See the Makefile to toggle this on or off. + */ + +/** + * Avoids code that may be compiled differently between builds, such as using `__DATE__`, `__TIME__`, `__FILE__`, or `__LINE__`. + */ +#define DETERMINISTIC_BUILD false + +/** + * Options for booting directly into a scene, the map select or the file select, instead of the title screen. + */ +#define BOOT_TO_SCENE false +#define BOOT_TO_SCENE_NEW_GAME_ONLY false +#define BOOT_TO_FILE_SELECT false +#define BOOT_TO_MAP_SELECT false + +/** + * Use file 1 to load the map select from the file select + * Note: using this will automatically enable the map select +*/ +#define MAP_SELECT_ON_FILE_1 false + +// Change these if using `BOOT_TO_SCENE`, `BOOT_TO_SCENE_NEW_GAME_ONLY` or `BOOT_TO_MAP_SELECT` +#define BOOT_ENTRANCE ENTR_DEKU_TREE_0 +#define BOOT_AGE LINK_AGE_CHILD +#define BOOT_CUTSCENE 0x0000 + +// Change these if using `BOOT_TO_SCENE` or `BOOT_TO_SCENE_NEW_GAME_ONLY` +#define BOOT_TIME NEXT_TIME_NONE +// #define BOOT_PLAYER_NAME 0x15, 0x12, 0x17, 0x14, 0x3E, 0x3E, 0x3E, 0x3E // "LINK" + +/** + * Enable/Disable BGM on Map Select + * Comment this to disable BGM + */ +#define MAP_SELECT_BGM NA_BGM_OWL + +/** + * Fix a crash if you spawn in a grotto without using the grotto actor + */ +// #define FIX_GROTTO_CRASH false + +/** + * Disable every debug feature + * This will enable Jumper pak compatibility + */ +#define DISABLE_DEBUG_FEATURES false + +/** + * Disable autoscroll on crash debugger +*/ +#define DISABLE_CRASH_DBG_AUTOSCROLL true + +/** + * Enable DMA print at boot +*/ +#define ENABLE_DMA_PRINTF false + +#endif diff --git a/include/config/config_debug_controls.h b/include/config/config_debug_controls.h new file mode 100644 index 000000000..2bc4866e6 --- /dev/null +++ b/include/config/config_debug_controls.h @@ -0,0 +1,72 @@ +#ifndef CONFIG_DEBUG_CONTROLS_H +#define CONFIG_DEBUG_CONTROLS_H + +/********************** + * CONTROLLER MAPPING * + **********************/ + +/** + * Change the debug features' controls + */ + +// ------------------------------------------- + +/**** [NO CLIP CONTROLS] ****/ +// Controller port to use +#define NOCLIP_CONTROLLER_PORT CONTROLLER_PORT_1 + +// Set to true to use a button combo +#define NOCLIP_USE_BTN_COMBO true +#define NOCLIP_BTN_HOLD_FOR_COMBO BTN_L + +// Control to enable no clip +#define NOCLIP_TOGGLE_BTN BTN_DRIGHT + +// Control to hold to go faster +#define NOCLIP_FAST_BTN BTN_R + +// Controls to move Link up and down +#define NOCLIP_GO_UP BTN_B +#define NOCLIP_GO_DOWN BTN_A + +// ------------------------------------------- + +/**** [CUTSCENE FEATURES] ****/ +// Controller port to use +#define CS_CTRL_CONTROLLER_PORT CONTROLLER_PORT_1 + +// Set to true to use a button combo +#define CS_CTRL_USE_BTN_COMBO true +#define CS_CTRL_BTN_HOLD_FOR_COMBO BTN_Z + +// Control to stop the current cutscene +#define CS_CTRL_STOP_CONTROL BTN_DRIGHT + +// Control to restart the cutscene +#define CS_CTRL_RESTART_CONTROL BTN_DUP + +// Control to restart the cutscene +// without the camera commands (the camera will follow the player) +#define CS_CTRL_RESTART_NO_CAMERA_CONTROL BTN_DLEFT + +// Control to execute the cutscene destination command +// (currently called "terminator") +#define CS_CTRL_RUN_DEST_CONTROL BTN_START + +// ------------------------------------------- + +/**** [FRAME ADVANCE CONTROLS] ****/ +// Controller port to use +#define FA_CONTROLLER_PORT CONTROLLER_PORT_1 + +// Set to true to use a button combo +#define FA_USE_BTN_COMBO true +#define FA_BTN_HOLD_FOR_COMBO BTN_R + +// Pausing +#define FA_PAUSE_CONTROL BTN_DDOWN + +// Frame advancing +#define FA_CONTROL BTN_DUP + +#endif diff --git a/include/config/config_debug_features.h b/include/config/config_debug_features.h new file mode 100644 index 000000000..574e3b04c --- /dev/null +++ b/include/config/config_debug_features.h @@ -0,0 +1,113 @@ +#ifndef CONFIG_DEBUG_FEATURES_H +#define CONFIG_DEBUG_FEATURES_H + +/****************** + * DEBUG FEATURES * + ******************/ + +/** + * Enable or disable debug rom's features + * See `config_debug_controls.h` for controls + */ + +// ------------------------------------------- + +/** + * General features + */ + +/**** [DEBUG HEAP] ****/ +// ``IS_DEBUG_HEAP_ENABLED`` +#define ENABLE_DEBUG_HEAP false + +// The memory space to allocate for the debug heap (used by the Camera Debugger) +// Note: it can't be higher than 0x800000 with the Expansion Pak +// Note: if the Expansion Pak is missing the heap's size will be 0x400 +#define DEBUG_HEAP_SIZE 0x600000 + +/**** [NO CLIP] ****/ +// ``IS_NO_CLIP_ENABLED`` +#define ENABLE_NO_CLIP true + +/**** [INPUT DISPLAY] ****/ +// ``CAN_SHOW_INPUT_DISPLAY`` +#define SHOW_INPUT_DISPLAY false + +/**** [CUTSCENE FEATURES] ****/ +// ``CAN_SHOW_CS_INFOS`` +#define SHOW_CS_INFOS false +// ``IS_CS_CONTROL_ENABLED`` +#define ENABLE_CS_CONTROL false + +// Allow skip on the title screen (if using ``ENABLE_CS_CONTROL``) +// ``CS_CAN_SKIP_TITLE_SCREEN`` +#define CS_CTRL_SKIP_TITLE_SCREEN false + +/**** [TIME INFORMATIONS] ****/ +// ``CAN_SHOW_TIME_INFOS`` +#define SHOW_TIME_INFOS false + +/**** [FRAMERATE OPTIONS] ****/ +// TODO: check for frame advance for drawing, improve how it works +// ``ARE_FRAMERATE_OPTIONS_ENABLED`` +#define ENABLE_FRAMERATE_OPTIONS false + +/**** [MAP SELECT] ****/ +// ``IS_MAP_SELECT_ENABLED`` +#define ENABLE_MAP_SELECT false + +/**** [DEBUG FILE 1] ****/ +// ``IS_DEBUG_SAVE_ENABLED`` +#define ENABLE_DEBUG_SAVE true + +/**** [TEST SCENES] ****/ +// ``CAN_INCLUDE_TEST_SCENES`` +#define INCLUDE_TEST_SCENES false + +// ------------------------------------------- + +/** + * In-game editors + */ + +/**** [INVENTORY EDITOR] ****/ +// ``IS_INV_EDITOR_ENABLED`` +#define ENABLE_INV_EDITOR false + +/**** [EVENT EDITOR] ****/ +// ``IS_EVENT_EDITOR_ENABLED`` +#define ENABLE_EVENT_EDITOR false + +/**** [REGISTERS EDITOR] ****/ +// ``IS_REG_EDITOR_ENABLED`` +#define ENABLE_REG_EDITOR false + +// ------------------------------------------- + +/** + * In-game debuggers + */ + +/**** [CAMERA DEBUGGER] ****/ +// ``IS_CAMERA_DEBUG_ENABLED`` +// Includes a cutscene debugger/exporter +#define ENABLE_CAMERA_DEBUGGER false + +/**** [AUDIO DEBUGGER] ****/ +// ``IS_AUDIO_DEBUG_ENABLED`` +#define ENABLE_AUDIO_DEBUGGER false + +/**** [ACTOR DEBUGGER] ****/ +// ``IS_ACTOR_DEBUG_ENABLED`` +#define ENABLE_ACTOR_DEBUGGER false + +/**** [MESSAGES DEBUGGER] ****/ +// ``IS_MSG_DEBUG_ENABLED`` +#define ENABLE_MSG_DEBUGGER false + +/**** [SPEEDMETER] ****/ +// ``IS_SPEEDMETER_ENABLED`` +// This looks like a profiler +#define ENABLE_SPEEDMETER false + +#endif diff --git a/include/config/config_game.h b/include/config/config_game.h new file mode 100644 index 000000000..b8b2385bd --- /dev/null +++ b/include/config/config_game.h @@ -0,0 +1,106 @@ +#ifndef CONFIG_GAME_H +#define CONFIG_GAME_H + + +/***************** + * GAME SETTINGS * + *****************/ + +// Disables AA (Improves console performance but causes visible seams between unconnected geometry). +// #define DISABLE_AA false + +/** + * F3DEX3 options + * ``ENABLE_F3DEX3_RECOMMENDATIONS`` will enable the recommended changes listed in F3DEX3's readme + * ``ENABLE_F3DEX3_NEW_FEATURES`` will enable the required changes to use the new features from F3DEX3 +*/ +#define ENABLE_F3DEX3 true +#define ENABLE_F3DEX3_RECOMMENDATIONS true // missing matrix stuff + fast64 re-export process +#define ENABLE_F3DEX3_LIGHT_RECO false // unfinished, faster but experimental (reco -> recommendations) +// #define ENABLE_F3DEX3_NEW_FEATURES true // not implemented yet + +// Fix annoying glitches (crashes and softlocks) +#define FIX_ANNOYING_GLITCH true + +// Add a fix for the Stale Reference Manipulation glitch (OoT's Pandora's Box) +#define FIX_SRM true + +/** + * Enable mempak-related code + */ +#define ENABLE_MEMPAK false + +// Configure dialogue print speed (1 is vanilla) +// #define DIALOGUE_PRINT_SPEED 2 + +// Rupee counter icon changes color with wallet upgrades like in MM +#define MM_WALLET_ICON_COLORS true + +// Configure block push speed multiplier +#define BLOCK_PUSH_SPEED 1.0f + +// Enables the beep sound at low health (vanilla behavior) +#define ENABLE_LOW_HEALTH_BEEP true + +// Make the Bunny Hood Mask behave like in Majora's Mask where it increases Link's speed when equipped. +#define MM_BUNNY_HOOD false +#define MM_BUNNY_HOOD_SPEED 1.5f + +/** + * Enable fast text + */ +#define ENABLE_FAST_TEXT false + +/** + * Splits Farore's Wind warp point across ages. One point for child Link, one point for adult Link. + */ +#define FW_SPLIT_AGE false + +/** + * Disable Player being unable to move + * Examples: when getting a Gold Skulltula Token, when pushing the walls in Forest Temple +*/ +#define DISABLE_PLAYER_FREEZE true + +/** + * Add Gold Skulltula count to the textbox +*/ +#define GS_COUNT_IN_TEXT true + +/** + * Applies the anti-aliasing filter for the background of the pause menu. + * Note: this adds a significant delay when pausing. +*/ +#define ENABLE_PAUSE_BG_AA false + +/** + * Widescreen mode + * Note: pre-rendered scenes with the fixed camera mode won't re-scale properly +*/ +#define ENABLE_WIDESCREEN false + +// Force widescreen mode regardless of SaveContext +#define FORCE_WIDESCREEN false + +// Increase the size of small elements (improves readability on N64) +#define WIDESCREEN_N64_MODE true + +/** + * Automatic GI Object Allocation +*/ +#define ENABLE_AUTO_GI_ALLOC false + +// Use the button colors of the N64 version instead of GameCube +#define N64_BTN_COLORS true + +/** + * Skips the N64 logo and boots directly into the game if defined (may already be skipped by the options below) + */ +#define SKIP_N64_BOOT_LOGO true + +/** + * Use Majora's Masks' N64 Logo logic +*/ +#define MM_N64_BOOT_LOGO false + +#endif diff --git a/include/config/config_safeguards.h b/include/config/config_safeguards.h new file mode 100644 index 000000000..33cf4844b --- /dev/null +++ b/include/config/config_safeguards.h @@ -0,0 +1,229 @@ +#ifndef CONFIG_SAFEGUARDS_H +#define CONFIG_SAFEGUARDS_H + +/***************************** + * COMPATIBILITY SAFE GUARDS * + *****************************/ + +/** + * NOTE: Only mess with these if you know what you're doing! + * These are put in place to insure that connected functionality works as intended. + */ + +/***************** + * config_debug.h + */ +#if RELEASE_ROM + #undef DETERMINISTIC_BUILD + #undef SKIP_N64_BOOT_LOGO + #undef BOOT_TO_SCENE + #undef BOOT_TO_SCENE_NEW_GAME_ONLY + #undef BOOT_TO_FILE_SELECT + #undef DISABLE_DEBUG_FEATURES + + #define DETERMINISTIC_BUILD false + #define SKIP_N64_BOOT_LOGO false + #define BOOT_TO_SCENE false + #define BOOT_TO_SCENE_NEW_GAME_ONLY false + #define BOOT_TO_FILE_SELECT false + #define DISABLE_DEBUG_FEATURES true +#endif + +#if DISABLE_DEBUG_FEATURES + #undef SHOW_CS_INFOS + #undef SHOW_INPUT_DISPLAY + #undef SHOW_TIME_INFOS + #undef INCLUDE_TEST_SCENES + #undef ENABLE_NO_CLIP + #undef ENABLE_CS_CONTROL + #undef ENABLE_FRAMERATE_OPTIONS + #undef ENABLE_MAP_SELECT + #undef ENABLE_INV_EDITOR + #undef ENABLE_EVENT_EDITOR + #undef ENABLE_REG_EDITOR + #undef ENABLE_CAMERA_DEBUGGER + #undef ENABLE_AUDIO_DEBUGGER + #undef ENABLE_ACTOR_DEBUGGER + #undef ENABLE_MSG_DEBUGGER + #undef ENABLE_DEBUG_SAVE + #undef MAP_SELECT_ON_FILE_1 + #undef ENABLE_DEBUG_HEAP + + #define SHOW_CS_INFOS false + #define SHOW_INPUT_DISPLAY false + #define SHOW_TIME_INFOS false + #define INCLUDE_TEST_SCENES false + #define ENABLE_NO_CLIP false + #define ENABLE_CS_CONTROL false + #define ENABLE_FRAMERATE_OPTIONS false + #define ENABLE_MAP_SELECT false + #define ENABLE_INV_EDITOR false + #define ENABLE_EVENT_EDITOR false + #define ENABLE_REG_EDITOR false + #define ENABLE_CAMERA_DEBUGGER false + #define ENABLE_AUDIO_DEBUGGER false + #define ENABLE_ACTOR_DEBUGGER false + #define ENABLE_MSG_DEBUGGER false + #define ENABLE_DEBUG_SAVE false + #define MAP_SELECT_ON_FILE_1 false + #define ENABLE_DEBUG_HEAP false +#endif + + +// Remove actor and camera debug draw-related code if both are disabled +#ifndef NO_DEBUG_DISPLAY + #if !ENABLE_ACTOR_DEBUGGER && !ENABLE_CAMERA_DEBUGGER + #define NO_DEBUG_DISPLAY true + #else + #define NO_DEBUG_DISPLAY false + #endif +#endif + +// The camera debugger needs mempak functions for the cutscene exporter +#if ENABLE_CAMERA_DEBUGGER && !ENABLE_MEMPAK + #undef ENABLE_MEMPAK + #define ENABLE_MEMPAK true +#endif + +// Enable the map select feature if booting to map select or using map select for file 1 +#if (BOOT_TO_MAP_SELECT || MAP_SELECT_ON_FILE_1) && !ENABLE_MAP_SELECT + #undef ENABLE_MAP_SELECT + #define ENABLE_MAP_SELECT true +#endif + +// Remove map select from file 1 +#if !ENABLE_MAP_SELECT + #undef MAP_SELECT_ON_FILE_1 + #define MAP_SELECT_ON_FILE_1 false +#endif + +// The camera debugger uses the debug heap, which is located in the expanded RAM +#if ENABLE_CAMERA_DEBUGGER && !ENABLE_DEBUG_HEAP + #undef ENABLE_DEBUG_HEAP + #define ENABLE_DEBUG_HEAP true +#endif + + +/***************** + * config_game.h + */ +#if !ENABLE_F3DEX3 && ENABLE_F3DEX3_RECOMMENDATIONS + #undef ENABLE_F3DEX3_RECOMMENDATIONS + #define ENABLE_F3DEX3_RECOMMENDATIONS false +#endif + +#if !ENABLE_F3DEX3 && ENABLE_F3DEX3_NEW_FEATURES + #undef ENABLE_F3DEX3_NEW_FEATURES + #define ENABLE_F3DEX3_NEW_FEATURES false +#endif + +#if FORCE_WIDESCREEN + #define USE_WIDESCREEN true +#else + #define USE_WIDESCREEN (ENABLE_WIDESCREEN && gSaveContext.save.useWidescreen == true) +#endif + + +/** + * Default settings if not using HackerOoT mode +*/ +#if !ENABLE_HACKEROOT + #undef DETERMINISTIC_BUILD + #undef SKIP_N64_BOOT_LOGO + #undef BOOT_TO_SCENE + #undef BOOT_TO_SCENE_NEW_GAME_ONLY + #undef BOOT_TO_FILE_SELECT + #undef DISABLE_DEBUG_FEATURES + #undef SHOW_CS_INFOS + #undef SHOW_INPUT_DISPLAY + #undef SHOW_TIME_INFOS + #undef INCLUDE_TEST_SCENES + #undef ENABLE_NO_CLIP + #undef ENABLE_CS_CONTROL + #undef ENABLE_FRAMERATE_OPTIONS + #undef ENABLE_MAP_SELECT + #undef ENABLE_INV_EDITOR + #undef ENABLE_EVENT_EDITOR + #undef ENABLE_REG_EDITOR + #undef ENABLE_CAMERA_DEBUGGER + #undef ENABLE_AUDIO_DEBUGGER + #undef ENABLE_ACTOR_DEBUGGER + #undef ENABLE_MSG_DEBUGGER + #undef ENABLE_DEBUG_SAVE + #undef MAP_SELECT_ON_FILE_1 + + #define DETERMINISTIC_BUILD false + #define SKIP_N64_BOOT_LOGO true + #define BOOT_TO_SCENE false + #define BOOT_TO_SCENE_NEW_GAME_ONLY false + #define BOOT_TO_FILE_SELECT false + #define DISABLE_DEBUG_FEATURES false + #define SHOW_CS_INFOS false + #define SHOW_INPUT_DISPLAY false + #define SHOW_TIME_INFOS false + #define INCLUDE_TEST_SCENES true + #define ENABLE_NO_CLIP false + #define ENABLE_CS_CONTROL false + #define ENABLE_FRAMERATE_OPTIONS false + #define ENABLE_MAP_SELECT true + #define ENABLE_INV_EDITOR false + #define ENABLE_EVENT_EDITOR false + #define ENABLE_REG_EDITOR false + #define ENABLE_CAMERA_DEBUGGER true + #define ENABLE_AUDIO_DEBUGGER false + #define ENABLE_ACTOR_DEBUGGER false + #define ENABLE_MSG_DEBUGGER false + #define ENABLE_DEBUG_SAVE false + #define MAP_SELECT_ON_FILE_1 true +#endif + +/** + * Used in if statements +*/ +#if ENABLE_HACKEROOT +#define IS_DEBUG (OOT_DEBUG && !DISABLE_DEBUG_FEATURES) +#else +#define IS_DEBUG OOT_DEBUG +#endif + +// General features +#define IS_DEBUG_HEAP_ENABLED (IS_DEBUG && ENABLE_DEBUG_HEAP) +#define IS_NO_CLIP_ENABLED (IS_DEBUG && ENABLE_NO_CLIP) +#define CAN_SHOW_INPUT_DISPLAY (IS_DEBUG && SHOW_INPUT_DISPLAY) +#define CAN_SHOW_CS_INFOS (IS_DEBUG && SHOW_CS_INFOS) +#define IS_CS_CONTROL_ENABLED (IS_DEBUG && ENABLE_CS_CONTROL) +#define CS_CAN_SKIP_TITLE_SCREEN (IS_CS_CONTROL_ENABLED && CS_CTRL_SKIP_TITLE_SCREEN) +#define CAN_SHOW_TIME_INFOS (IS_DEBUG && SHOW_TIME_INFOS) +#define ARE_FRAMERATE_OPTIONS_ENABLED (IS_DEBUG && ENABLE_FRAMERATE_OPTIONS) +#define IS_MAP_SELECT_ENABLED (IS_DEBUG && ENABLE_MAP_SELECT) +#define IS_DEBUG_SAVE_ENABLED (IS_DEBUG && ENABLE_DEBUG_SAVE) +#define CAN_INCLUDE_TEST_SCENES (!ENABLE_HACKEROOT || (IS_DEBUG && INCLUDE_TEST_SCENES)) + +// In-game editors +#define IS_INV_EDITOR_ENABLED (IS_DEBUG && ENABLE_INV_EDITOR) +#define IS_EVENT_EDITOR_ENABLED (IS_DEBUG && ENABLE_EVENT_EDITOR) +#define IS_REG_EDITOR_ENABLED (IS_DEBUG && ENABLE_REG_EDITOR) + +// In-game debuggers +#define IS_CAMERA_DEBUG_ENABLED (IS_DEBUG && ENABLE_CAMERA_DEBUGGER) +#define IS_AUDIO_DEBUG_ENABLED (IS_DEBUG && ENABLE_AUDIO_DEBUGGER) +#define IS_ACTOR_DEBUG_ENABLED (IS_DEBUG && ENABLE_ACTOR_DEBUGGER) +#define IS_MSG_DEBUG_ENABLED (IS_DEBUG && ENABLE_MSG_DEBUGGER) +#define IS_SPEEDMETER_ENABLED (IS_DEBUG && ENABLE_SPEEDMETER) + +/** + * Compression +*/ +#ifndef COMPRESS_YAZ +#define COMPRESS_YAZ false +#endif + +#ifndef COMPRESS_LZO +#define COMPRESS_LZO false +#endif + +#ifndef COMPRESS_APLIB +#define COMPRESS_APLIB false +#endif + +#endif diff --git a/include/face_change.h b/include/face_change.h new file mode 100644 index 000000000..6a5573765 --- /dev/null +++ b/include/face_change.h @@ -0,0 +1,12 @@ +#ifndef FACE_CHANGE_H +#define FACE_CHANGE_H + +typedef struct { + /* 0x00 */ s16 face; + /* 0x02 */ s16 timer; +} FaceChange; // size = 0x4 + +s16 FaceChange_UpdateBlinking(FaceChange* faceChange, s16 blinkIntervalBase, s16 blinkIntervalRandRange, s16 blinkDuration); +s16 FaceChange_UpdateRandomSet(FaceChange* faceChange, s16 changeTimerBase, s16 changeTimerRandRange, s16 faceSetRange); + +#endif diff --git a/include/fault.h b/include/fault.h index 778f708e9..df125487e 100644 --- a/include/fault.h +++ b/include/fault.h @@ -44,7 +44,7 @@ void Fault_Init(void); // Fatal Errors NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2); -NORETURN void Fault_AddHungupAndCrash(const char* file, s32 line); +NORETURN void Fault_AddHungupAndCrash(const char* file, int line); // Client Registration diff --git a/include/functions.h b/include/functions.h index d8d09222c..57c04635c 100644 --- a/include/functions.h +++ b/include/functions.h @@ -27,19 +27,15 @@ void Main_ThreadEntry(void* arg); void Idle_ThreadEntry(void* arg); void ViConfig_UpdateVi(u32 black); void ViConfig_UpdateBlack(void); -void* Yaz0_FirstDMA(void); -void* Yaz0_NextDMA(u8* curSrcPos); -void Yaz0_DecompressImpl(u8* src, u8* dst); -void Yaz0_Decompress(uintptr_t romStart, u8* dst, size_t size); void Locale_Init(void); void Locale_ResetRegion(void); -#if OOT_DEBUG +#if IS_DEBUG void isPrintfInit(void); #endif void rmonPrintf(const char* fmt, ...); -#if OOT_DEBUG +#if IS_DEBUG void* is_proutSyncPrintf(void* arg, const char* str, size_t count); -NORETURN void func_80002384(const char* exp, const char* file, u32 line); +NORETURN void func_80002384(const char* exp, const char* file, int line); #endif OSPiHandle* osDriveRomInit(void); void Mio0_Decompress(u8* src, u8* dst); @@ -49,13 +45,13 @@ void StackCheck_Cleanup(StackEntry* entry); u32 StackCheck_GetState(StackEntry* entry); u32 StackCheck_CheckAll(void); u32 StackCheck_Check(StackEntry* entry); -#if OOT_DEBUG +#if IS_DEBUG void LogUtils_LogHexDump(void* ptr, s32 size0); -void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, s32 line); -void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, s32 line); -void LogUtils_LogThreadId(const char* name, s32 line); +void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, int line); +void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, int line); +void LogUtils_LogThreadId(const char* name, int line); #endif -void LogUtils_HungupThread(const char* name, s32 line); +void LogUtils_HungupThread(const char* name, int line); void LogUtils_ResetHungup(void); void __osPiCreateAccessQueue(void); void __osPiGetAccess(void); @@ -308,7 +304,8 @@ void EffectSsDeadSound_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f void EffectSsDeadSound_SpawnStationary(PlayState* play, Vec3f* pos, u16 sfxId, s16 lowerPriority, s16 repeatMode, s32 life); void EffectSsIceSmoke_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale); -void FlagSet_Update(PlayState* play); + +void FlagSet_Update(PlayState* play); // ENABLE_EVENT_EDITOR void Overlay_LoadGameState(GameStateOverlay* overlayEntry); void Overlay_FreeGameState(GameStateOverlay* overlayEntry); void ActorShape_Init(ActorShape* shape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale); @@ -443,7 +440,6 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play); Actor* func_80032AF0(PlayState* play, ActorContext* actorCtx, Actor** actorPtr, Player* player); Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorCategory); void Enemy_StartFinishingBlow(PlayState* play, Actor* actor); -s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3); void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play); void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList, s16 objectSlot); @@ -612,7 +608,7 @@ u16 WaterBox_GetBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox); u32 WaterBox_GetLightIndex(CollisionContext* colCtx, WaterBox* waterBox); s32 func_80042708(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* point, Vec3f* closestPoint); s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec3f* pointB, Vec3f* closestPoint); -#if OOT_DEBUG +#if IS_DEBUG void BgCheck_DrawDynaCollision(PlayState*, CollisionContext*); void BgCheck_DrawStaticCollision(PlayState*, CollisionContext*); #endif @@ -660,7 +656,7 @@ s32 func_8005B198(void); s16 Camera_SetFinishedFlag(Camera* camera); DamageTable* DamageTable_Get(s32 index); void DamageTable_Clear(DamageTable* table); -#if OOT_DEBUG +#if IS_DEBUG void Collider_DrawRedPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC); void Collider_DrawPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC, u8 r, u8 g, u8 b); #endif @@ -711,7 +707,7 @@ void CollisionCheck_DestroyContext(PlayState* play, CollisionCheckContext* colCh void CollisionCheck_ClearContext(PlayState* play, CollisionCheckContext* colChkCtx); void CollisionCheck_EnableSAC(PlayState* play, CollisionCheckContext* colChkCtx); void CollisionCheck_DisableSAC(PlayState* play, CollisionCheckContext* colChkCtx); -#if OOT_DEBUG +#if IS_DEBUG void Collider_Draw(PlayState* play, Collider* col); void CollisionCheck_DrawCollision(PlayState* play, CollisionCheckContext* colChkCtx); #endif @@ -754,12 +750,10 @@ u8 CollisionCheck_GetSwordDamage(s32 dmgFlags); void SaveContext_Init(void); s32 func_800635D0(s32); void Regs_Init(void); -void DebugCamera_ScreenText(u8 x, u8 y, const char* text); -void DebugCamera_ScreenTextColored(u8 x, u8 y, u8 colorIndex, const char* text); -#if OOT_DEBUG -void Regs_UpdateEditor(Input* input); -#endif -void Debug_DrawText(GraphicsContext* gfxCtx); +void DebugCamera_ScreenText(u8 x, u8 y, const char* text); // ENABLE_NO_CLIP +void DebugCamera_ScreenTextColored(u8 x, u8 y, u8 colorIndex, const char* text); // ENABLE_CAMERA_DEBUGGER +void Regs_UpdateEditor(Input* input); // ENABLE_REG_EDITOR +void Debug_DrawText(GraphicsContext* gfxCtx); // ENABLE_CAMERA_DEBUGGER || ENABLE_REG_EDITOR void DebugDisplay_Init(void); DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX, f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, s16 type, @@ -911,12 +905,12 @@ void ZeldaArena_Check(void); void ZeldaArena_Init(void* start, u32 size); void ZeldaArena_Cleanup(void); u8 ZeldaArena_IsInitialized(void); -#if OOT_DEBUG +#if IS_DEBUG void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); -void* ZeldaArena_MallocDebug(u32 size, const char* file, s32 line); -void* ZeldaArena_MallocRDebug(u32 size, const char* file, s32 line); -void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line); -void ZeldaArena_FreeDebug(void* ptr, const char* file, s32 line); +void* ZeldaArena_MallocDebug(u32 size, const char* file, int line); +void* ZeldaArena_MallocRDebug(u32 size, const char* file, int line); +void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); +void ZeldaArena_FreeDebug(void* ptr, const char* file, int line); void ZeldaArena_Display(void); #endif void MapMark_Init(PlayState* play); @@ -985,8 +979,12 @@ void Interface_Update(PlayState* play); Path* Path_GetByIndex(PlayState* play, s16 index, s16 max); f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw); void Path_CopyLastPoint(Path* path, Vec3f* dest); + +#if ARE_FRAMERATE_OPTIONS_ENABLED void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx); s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input); +#endif + void Player_SetBootData(PlayState* play, Player* this); int Player_InBlockingCsMode(PlayState* play, Player* this); int Player_InCsMode(PlayState* play); @@ -1155,10 +1153,10 @@ void Sram_WriteSramHeader(SramContext* sramCtx); void Sram_InitSram(GameState* gameState, SramContext* sramCtx); void Sram_Alloc(GameState* gameState, SramContext* sramCtx); void Sram_Init(PlayState* play, SramContext* sramCtx); -void SsSram_Init(u32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration, +void SsSram_Init(s32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration, u8 handlePulse, u32 handleSpeed); void SsSram_Dma(void* dramAddr, size_t size, s32 direction); -void SsSram_ReadWrite(u32 addr, void* dramAddr, size_t size, s32 direction); +void SsSram_ReadWrite(s32 addr, void* dramAddr, size_t size, s32 direction); View* View_New(GraphicsContext* gfxCtx); void View_Free(View* view); void View_Init(View*, GraphicsContext*); @@ -1184,7 +1182,7 @@ s32 View_ApplyOrthoToOverlay(View* view); s32 View_ApplyPerspectiveToOverlay(View* view); s32 View_UpdateViewingMatrix(View* view); s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP); -#if OOT_DEBUG +#if IS_DEBUG s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ); #endif void ViMode_LogPrint(OSViMode* osViMode); @@ -1241,10 +1239,13 @@ u32 Letterbox_GetSize(void); void Letterbox_Init(void); void Letterbox_Destroy(void); void Letterbox_Update(s32 updateRate); + +// ENABLE_CAMERA_DEBUGGER void DebugCamera_Init(DebugCam* debugCam, Camera* cameraPtr); void DebugCamera_Enable(DebugCam* debugCam, Camera* cam); void DebugCamera_Update(DebugCam* debugCam, Camera* cam); void DebugCamera_Reset(Camera* cam, DebugCam* debugCam); + void func_800BB0A0(f32 u, Vec3f* pos, f32* roll, f32* viewAngle, f32* point0, f32* point1, f32* point2, f32* point3); s32 func_800BB2B4(Vec3f* pos, f32* roll, f32* fov, CutsceneCameraPoint* point, s16* keyFrame, f32* curFrame); void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl); @@ -1294,6 +1295,8 @@ void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void PreRender_Init(PreRender* this); void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf); void PreRender_Destroy(PreRender* this); + +// ENABLE_PAUSE_BG_AA void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a); void func_800C1AE8(PreRender* this, Gfx** gfxP, void* fbuf, void* fbufSave); void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxP); @@ -1305,6 +1308,7 @@ void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP); void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP); void PreRender_ApplyFilters(PreRender* this); void GameState_SetFBFilter(Gfx** gfxP); + void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx); void GameState_SetFrameBuffer(GraphicsContext* gfxCtx); void GameState_ReqPadData(GameState* gameState); @@ -1315,9 +1319,9 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g void GameState_Destroy(GameState* gameState); GameStateFunc GameState_GetInit(GameState* gameState); u32 GameState_IsRunning(GameState* gameState); -#if OOT_DEBUG -void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line); -void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line); +#if IS_DEBUG +void* GameState_Alloc(GameState* gameState, size_t size, const char* file, int line); +void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line); #endif void* GameAlloc_Malloc(GameAlloc* this, u32 size); void GameAlloc_Free(GameAlloc* this, void* data); @@ -1332,9 +1336,9 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState); void Graph_ThreadEntry(void*); void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size); void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size); -#if OOT_DEBUG -void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line); -void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line); +#if IS_DEBUG +void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line); +void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line); #endif Gfx* Gfx_Open(Gfx* gfx); Gfx* Gfx_Close(Gfx* gfx, Gfx* dst); @@ -1436,9 +1440,9 @@ void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode); void Matrix_TranslateRotateZYX(Vec3f* translation, Vec3s* rotation); void Matrix_SetTranslateRotateYXZ(f32 translateX, f32 translateY, f32 translateZ, Vec3s* rot); Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest); -#if OOT_DEBUG -Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line); -Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, char* file, s32 line); +#if IS_DEBUG +Mtx* Matrix_ToMtx(Mtx* dest, const char* file, int line); +Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, const char* file, int line); #else Mtx* Matrix_ToMtx(Mtx* dest); Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx); @@ -1452,8 +1456,8 @@ void Matrix_ReplaceRotation(MtxF* mf); void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag); void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag); void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode); -#if OOT_DEBUG -MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line); +#if IS_DEBUG +MtxF* Matrix_CheckFloats(MtxF* mf, const char* file, int line); #endif void Matrix_SetTranslateScaleMtx2(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY, f32 translateZ); @@ -1474,14 +1478,16 @@ void DebugArena_Check(void); void DebugArena_Init(void* start, u32 size); void DebugArena_Cleanup(void); u8 DebugArena_IsInitialized(void); -#if OOT_DEBUG +#if IS_DEBUG void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); -void* DebugArena_MallocDebug(u32 size, const char* file, s32 line); -void* DebugArena_MallocRDebug(u32 size, const char* file, s32 line); -void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line); -void DebugArena_FreeDebug(void* ptr, const char* file, s32 line); +void* DebugArena_MallocDebug(u32 size, const char* file, int line); +void* DebugArena_MallocRDebug(u32 size, const char* file, int line); +void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); +void DebugArena_FreeDebug(void* ptr, const char* file, int line); void DebugArena_Display(void); #endif +void DebugArena_Display(void); + void UCodeDisas_Init(UCodeDisas*); void UCodeDisas_Destroy(UCodeDisas*); void UCodeDisas_Disassemble(UCodeDisas*, Gfx*); @@ -1617,8 +1623,11 @@ OcarinaStaff* AudioOcarina_GetPlaybackStaff(void); void AudioOcarina_MemoryGameInit(u8 minigameRound); s32 AudioOcarina_MemoryGameNextNote(void); void AudioOcarina_PlayLongScarecrowSong(void); + +// ENABLE_AUDIO_DEBUGGER void AudioDebug_Draw(GfxPrint* printer); void AudioDebug_ScrPrt(const char* str, u16 num); + void Audio_Update(void); void Audio_SetSfxProperties(u8 bankId, u8 entryIdx, u8 channelIndex); void Audio_PlayCutsceneEffectsSequence(u8 csEffectType); @@ -1773,13 +1782,15 @@ void SystemArena_Check(void); void SystemArena_Init(void* start, u32 size); void SystemArena_Cleanup(void); u8 SystemArena_IsInitialized(void); -#if OOT_DEBUG -void* SystemArena_MallocDebug(u32 size, const char* file, s32 line); -void* SystemArena_MallocRDebug(u32 size, const char* file, s32 line); -void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line); -void SystemArena_FreeDebug(void* ptr, const char* file, s32 line); +#if IS_DEBUG +void* SystemArena_MallocDebug(u32 size, const char* file, int line); +void* SystemArena_MallocRDebug(u32 size, const char* file, int line); +void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); +void SystemArena_FreeDebug(void* ptr, const char* file, int line); void SystemArena_Display(void); #endif +void SystemArena_Display(void); // IS_SPEEDMETER_ENABLED + u32 Rand_Next(void); void Rand_Seed(u32 seed); f32 Rand_ZeroOne(void); @@ -1798,11 +1809,11 @@ void __osFree(Arena* arena, void* ptr); void* __osRealloc(Arena* arena, void* ptr, u32 newSize); void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc); u32 __osCheckArena(Arena* arena); -#if OOT_DEBUG -void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line); -void* __osMallocRDebug(Arena* arena, u32 size, const char* file, s32 line); -void __osFreeDebug(Arena* arena, void* ptr, const char* file, s32 line); -void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, s32 line); +#if IS_DEBUG +void* __osMallocDebug(Arena* arena, u32 size, const char* file, int line); +void* __osMallocRDebug(Arena* arena, u32 size, const char* file, int line); +void __osFreeDebug(Arena* arena, void* ptr, const char* file, int line); +void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, int line); void __osDisplayArena(Arena* arena); #endif s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args); @@ -1954,8 +1965,11 @@ void Setup_Init(GameState* thisx); void Setup_Destroy(GameState* thisx); void ConsoleLogo_Init(GameState* thisx); void ConsoleLogo_Destroy(GameState* thisx); + +// ENABLE_MAP_SELECT void MapSelect_Init(GameState* thisx); void MapSelect_Destroy(GameState* thisx); + void TitleSetup_Init(GameState* thisx); void TitleSetup_Destroy(GameState* thisx); void FileSelect_Init(GameState* thisx); diff --git a/include/macro.inc b/include/macro.inc index b153bc544..882093744 100644 --- a/include/macro.inc +++ b/include/macro.inc @@ -1,3 +1,8 @@ +# Evaluate this file only once in case it's included more than once +.ifndef _MACRO_INC_GUARD +.internal _MACRO_INC_GUARD +.set _MACRO_INC_GUARD, 1 + .macro glabel label .global \label \label: @@ -47,3 +52,5 @@ .set $fs4f, $f29 .set $fs5, $f30 .set $fs5f, $f31 + +.endif diff --git a/include/macros.h b/include/macros.h index b0a35844f..a57f7ab08 100644 --- a/include/macros.h +++ b/include/macros.h @@ -114,9 +114,9 @@ // argument errors instead. // Note some tools define __sgi but preprocess with a modern cpp implementation, // ensure that these do not use the IDO workaround to avoid errors. -#define IDO_PRINTF_WORKAROUND (__sgi && !__GNUC__ && !PERMUTER && !M2CTX) +#define IDO_PRINTF_WORKAROUND (__sgi && !__GNUC__ && !M2CTX) -#if OOT_DEBUG +#if IS_DEBUG #define PRINTF osSyncPrintf #elif IDO_PRINTF_WORKAROUND #define PRINTF(args) (void)0 @@ -124,7 +124,7 @@ #define PRINTF(format, ...) (void)0 #endif -#if OOT_DEBUG +#if IS_DEBUG #define LOG(exp, value, format, file, line) \ do { \ LogUtils_LogThreadId(file, line); \ @@ -170,7 +170,7 @@ extern struct GraphicsContext* __gfxCtx; #define POLY_XLU_DISP __gfxCtx->polyXlu.p #define OVERLAY_DISP __gfxCtx->overlay.p -#if OOT_DEBUG +#if IS_DEBUG // __gfxCtx shouldn't be used directly. // Use the DISP macros defined above when writing to display buffers. @@ -241,7 +241,7 @@ extern struct GraphicsContext* __gfxCtx; #define HUNGUP_AND_CRASH(file, line) LogUtils_HungupThread(file, line) #define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_Malloc(alloc, size) -#endif /* OOT_DEBUG */ +#endif /* IS_DEBUG */ /** * `x` vertex x @@ -272,3 +272,14 @@ extern struct GraphicsContext* __gfxCtx; } while (0) #endif + +// HackerOoT + +#if IS_DEBUG +// if using button combo check for the input, else simply return true +#define DEBUG_BTN_COMBO(useCombo, btnToHold, btnToPress, input) ((useCombo ? CHECK_BTN_ALL(input->cur.button, btnToHold) : true) && CHECK_BTN_ALL(input->press.button, btnToPress)) +#else +#define DEBUG_BTN_COMBO(useCombo, btnToHold, btnToPress, input) true +#endif + +#define IS_DEBUG_CAM_ENABLED (IS_CAMERA_DEBUG_ENABLED ? gDebugCamEnabled : false) diff --git a/include/message_data_fmt.h b/include/message_data_fmt.h index 447117d81..93f242e0a 100644 --- a/include/message_data_fmt.h +++ b/include/message_data_fmt.h @@ -1,6 +1,8 @@ #ifndef MESSAGE_DATA_FMT_H #define MESSAGE_DATA_FMT_H +#include "config.h" + /* * Macros to create both a constant and a string literal from a magic value * The constants are used in code files when parsing text for various purposes diff --git a/include/message_data_static.h b/include/message_data_static.h index b80320382..b888192d5 100644 --- a/include/message_data_static.h +++ b/include/message_data_static.h @@ -47,9 +47,12 @@ typedef struct { extern const char _message_##textId##_ger[]; \ extern const char _message_##textId##_fra[]; +#define DEFINE_MESSAGE_NES(textId, type, yPos, nesMessage) \ + extern const char _message_##textId##_nes[]; + #include "assets/text/message_data.h" -extern const char _message_0xFFFC_nes[]; #undef DEFINE_MESSAGE +#undef DEFINE_MESSAGE_NES #endif diff --git a/include/padmgr.h b/include/padmgr.h index 65705949e..f9756f66f 100644 --- a/include/padmgr.h +++ b/include/padmgr.h @@ -17,6 +17,13 @@ typedef struct { /* 0x12 */ OSContPad rel; // X/Y store adjusted } Input; // size = 0x18 +typedef enum { + /* 0x0 */ CONTROLLER_PORT_1, + /* 0x1 */ CONTROLLER_PORT_2, + /* 0x2 */ CONTROLLER_PORT_3, + /* 0x3 */ CONTROLLER_PORT_4 +} ControllerPort; + typedef struct PadMgr { /* 0x0000 */ OSContStatus padStatus[MAXCONTROLLERS]; /* 0x0010 */ OSMesg serialMsg; diff --git a/include/regs.h b/include/regs.h index e1eb9d8b9..49af09a87 100644 --- a/include/regs.h +++ b/include/regs.h @@ -1,6 +1,8 @@ #ifndef REGS_H #define REGS_H +#include "config.h" + #define REG_GROUPS 29 // number of REG groups, i.e. REG, SREG, OREG, etc. #define REG_PAGES 6 #define REGS_PER_PAGE 16 @@ -47,7 +49,10 @@ #define R_ENV_FOG_NEAR REG(14) #define R_ENV_TIME_SPEED_OLD REG(15) // Most likely used during development. Unused in the final game. #define R_RUN_SPEED_LIMIT REG(45) + +// ENABLE_SPEEDMETER || SHOW_TIME_INFOS #define R_ENABLE_ARENA_DBG SREG(0) + #define R_AUDIOMGR_DEBUG_LEVEL SREG(20) #define R_ROOM_IMAGE_NODRAW_FLAGS SREG(25) #define R_ROOM_BG2D_FORCE_SCALEBG SREG(26) diff --git a/include/romfile.h b/include/romfile.h new file mode 100644 index 000000000..a7022f45f --- /dev/null +++ b/include/romfile.h @@ -0,0 +1,18 @@ +#ifndef ROMFILE_H +#define ROMFILE_H + +#include "ultra64.h" + +typedef struct { + /* 0x00 */ uintptr_t vromStart; + /* 0x04 */ uintptr_t vromEnd; +} RomFile; // size = 0x8 + +#define ROM_FILE(name) \ + { (uintptr_t)_##name##SegmentRomStart, (uintptr_t)_##name##SegmentRomEnd } +#define ROM_FILE_EMPTY(name) \ + { (uintptr_t)_##name##SegmentRomStart, (uintptr_t)_##name##SegmentRomStart } +#define ROM_FILE_UNSET \ + { 0, 0 } + +#endif diff --git a/include/sfx.h b/include/sfx.h index d5545af8d..928b1e36a 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -119,7 +119,7 @@ typedef struct { u16 params; } SfxParams; -#if OOT_DEBUG +#if IS_DEBUG #define SFX_DIST_SCALING 1.0f #else #define SFX_DIST_SCALING 10.0f diff --git a/include/tables/dmadata_table.h b/include/tables/dmadata_table.h index e633e7f56..02f55a9cf 100644 --- a/include/tables/dmadata_table.h +++ b/include/tables/dmadata_table.h @@ -1,9 +1,4 @@ /** * Select dmadata table for version */ -#ifdef NON_MATCHING -// For non-matching builds, dmadata is generated from the specfile segments #include "dmadata_table_spec.h" -#else -#include "dmadata_table_mqdbg.h" -#endif diff --git a/include/tables/entrance_table.h b/include/tables/entrance_table.h index 7af44f154..3d288a90a 100644 --- a/include/tables/entrance_table.h +++ b/include/tables/entrance_table.h @@ -49,6 +49,7 @@ /* 0x016 */ DEFINE_ENTRANCE(ENTR_UNUSED_6E_2, SCENE_UNUSED_6E, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x017 */ DEFINE_ENTRANCE(ENTR_UNUSED_6E_3, SCENE_UNUSED_6E, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) +#if CAN_INCLUDE_TEST_SCENES /* 0x018 */ DEFINE_ENTRANCE(ENTR_SASATEST_0, SCENE_SASATEST, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x019 */ DEFINE_ENTRANCE(ENTR_SASATEST_0_1, SCENE_SASATEST, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x01A */ DEFINE_ENTRANCE(ENTR_SASATEST_0_2, SCENE_SASATEST, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) @@ -68,6 +69,7 @@ /* 0x025 */ DEFINE_ENTRANCE(ENTR_TESTROOM_0_1, SCENE_TESTROOM, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x026 */ DEFINE_ENTRANCE(ENTR_TESTROOM_0_2, SCENE_TESTROOM, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x027 */ DEFINE_ENTRANCE(ENTR_TESTROOM_0_3, SCENE_TESTROOM, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) +#endif /* 0x028 */ DEFINE_ENTRANCE(ENTR_JABU_JABU_0, SCENE_JABU_JABU, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x029 */ DEFINE_ENTRANCE(ENTR_JABU_JABU_0_1, SCENE_JABU_JABU, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) @@ -107,10 +109,12 @@ /* 0x045 */ DEFINE_ENTRANCE(ENTR_LAKESIDE_LABORATORY_0_2, SCENE_LAKESIDE_LABORATORY, 0, false, true, TRANS_TYPE_FADE_BLACK_FAST, TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST)) /* 0x046 */ DEFINE_ENTRANCE(ENTR_LAKESIDE_LABORATORY_0_3, SCENE_LAKESIDE_LABORATORY, 0, false, true, TRANS_TYPE_FADE_BLACK_FAST, TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST)) +#if CAN_INCLUDE_TEST_SCENES /* 0x047 */ DEFINE_ENTRANCE(ENTR_SUTARU_0, SCENE_SUTARU, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x048 */ DEFINE_ENTRANCE(ENTR_SUTARU_0_1, SCENE_SUTARU, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x049 */ DEFINE_ENTRANCE(ENTR_SUTARU_0_2, SCENE_SUTARU, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x04A */ DEFINE_ENTRANCE(ENTR_SUTARU_0_3, SCENE_SUTARU, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) +#endif /* 0x04B */ DEFINE_ENTRANCE(ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN_0, SCENE_GRAVE_WITH_FAIRYS_FOUNTAIN, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_CIRCLE(TCA_STARBURST,TCC_BLACK, TCS_FAST)) /* 0x04C */ DEFINE_ENTRANCE(ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN_0_1, SCENE_GRAVE_WITH_FAIRYS_FOUNTAIN, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_CIRCLE(TCA_STARBURST,TCC_BLACK, TCS_FAST)) @@ -162,10 +166,12 @@ /* 0x074 */ DEFINE_ENTRANCE(ENTR_POTION_SHOP_GRANNY_0_2, SCENE_POTION_SHOP_GRANNY, 0, false, true, TRANS_TYPE_FADE_BLACK_FAST, TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST)) /* 0x075 */ DEFINE_ENTRANCE(ENTR_POTION_SHOP_GRANNY_0_3, SCENE_POTION_SHOP_GRANNY, 0, false, true, TRANS_TYPE_FADE_BLACK_FAST, TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST)) +#if CAN_INCLUDE_TEST_SCENES /* 0x076 */ DEFINE_ENTRANCE(ENTR_HAIRAL_NIWA2_0, SCENE_HAIRAL_NIWA2, 0, false, true, TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_BLACK, TCS_FAST), TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_BLACK, TCS_FAST)) /* 0x077 */ DEFINE_ENTRANCE(ENTR_HAIRAL_NIWA2_0_1, SCENE_HAIRAL_NIWA2, 0, false, true, TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_BLACK, TCS_FAST), TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_BLACK, TCS_FAST)) /* 0x078 */ DEFINE_ENTRANCE(ENTR_HAIRAL_NIWA2_0_2, SCENE_HAIRAL_NIWA2, 0, false, true, TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_BLACK, TCS_FAST), TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_BLACK, TCS_FAST)) /* 0x079 */ DEFINE_ENTRANCE(ENTR_HAIRAL_NIWA2_0_3, SCENE_HAIRAL_NIWA2, 0, false, true, TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_BLACK, TCS_FAST), TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_BLACK, TCS_FAST)) +#endif /* 0x07A */ DEFINE_ENTRANCE(ENTR_CASTLE_COURTYARD_GUARDS_DAY_0, SCENE_CASTLE_COURTYARD_GUARDS_DAY, 0, false, true, TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_BLACK, TCS_FAST), TRANS_TYPE_FADE_BLACK_FAST) /* 0x07B */ DEFINE_ENTRANCE(ENTR_CASTLE_COURTYARD_GUARDS_NIGHT_0_1, SCENE_CASTLE_COURTYARD_GUARDS_NIGHT, 0, false, true, TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_BLACK, TCS_FAST), TRANS_TYPE_FADE_BLACK_FAST) @@ -198,10 +204,12 @@ /* 0x092 */ DEFINE_ENTRANCE(ENTR_SPIRIT_TEMPLE_BOSS_0_5, SCENE_SPIRIT_TEMPLE_BOSS, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x093 */ DEFINE_ENTRANCE(ENTR_SPIRIT_TEMPLE_BOSS_0_6, SCENE_SPIRIT_TEMPLE_BOSS, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) +#if CAN_INCLUDE_TEST_SCENES /* 0x094 */ DEFINE_ENTRANCE(ENTR_TEST01_0, SCENE_TEST01, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x095 */ DEFINE_ENTRANCE(ENTR_TEST01_0_1, SCENE_TEST01, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x096 */ DEFINE_ENTRANCE(ENTR_TEST01_0_2, SCENE_TEST01, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x097 */ DEFINE_ENTRANCE(ENTR_TEST01_0_3, SCENE_TEST01, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) +#endif /* 0x098 */ DEFINE_ENTRANCE(ENTR_BOTTOM_OF_THE_WELL_0, SCENE_BOTTOM_OF_THE_WELL, 0, false, true, TRANS_TYPE_FADE_BLACK_FAST, TRANS_TYPE_FADE_BLACK_FAST) /* 0x099 */ DEFINE_ENTRANCE(ENTR_BOTTOM_OF_THE_WELL_0_1, SCENE_BOTTOM_OF_THE_WELL, 0, false, true, TRANS_TYPE_FADE_BLACK_FAST, TRANS_TYPE_FADE_BLACK_FAST) @@ -238,7 +246,9 @@ /* 0x0B4 */ DEFINE_ENTRANCE(ENTR_MARKET_RUINS_0_3, SCENE_MARKET_RUINS, 0, true, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x0B5 */ DEFINE_ENTRANCE(ENTR_MARKET_DAY_0_4, SCENE_MARKET_DAY, 0, false, true, TRANS_TYPE_WIPE_FAST, TRANS_TYPE_WIPE_FAST) +#if CAN_INCLUDE_TEST_SCENES /* 0x0B6 */ DEFINE_ENTRANCE(ENTR_DEPTH_TEST_0, SCENE_DEPTH_TEST, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) +#endif /* 0x0B7 */ DEFINE_ENTRANCE(ENTR_BAZAAR_0, SCENE_BAZAAR, 0, false, true, TRANS_TYPE_FADE_BLACK_FAST, TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST)) /* 0x0B8 */ DEFINE_ENTRANCE(ENTR_BAZAAR_0_1, SCENE_BAZAAR, 0, false, true, TRANS_TYPE_FADE_BLACK_FAST, TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST)) @@ -1628,10 +1638,12 @@ /* 0x51E */ DEFINE_ENTRANCE(ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_6_2, SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR, 6, true, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x51F */ DEFINE_ENTRANCE(ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_6_3, SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR, 6, true, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) +#if CAN_INCLUDE_TEST_SCENES /* 0x520 */ DEFINE_ENTRANCE(ENTR_BESITU_0, SCENE_BESITU, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x521 */ DEFINE_ENTRANCE(ENTR_BESITU_0_1, SCENE_BESITU, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x522 */ DEFINE_ENTRANCE(ENTR_BESITU_0_2, SCENE_BESITU, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x523 */ DEFINE_ENTRANCE(ENTR_BESITU_0_3, SCENE_BESITU, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) +#endif /* 0x524 */ DEFINE_ENTRANCE(ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_7, SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR, 7, true, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x525 */ DEFINE_ENTRANCE(ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_7_1, SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR, 7, true, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) diff --git a/include/tables/gamestate_table.h b/include/tables/gamestate_table.h index 280740fe2..add0d9393 100644 --- a/include/tables/gamestate_table.h +++ b/include/tables/gamestate_table.h @@ -9,7 +9,9 @@ * DEFINE_GAMESTATE_INTERNAL should be used for gamestates that aren't an overlay, the first two arguments are the same as for DEFINE_GAMESTATE */ /* 0x00 */ DEFINE_GAMESTATE_INTERNAL(Setup, GAMESTATE_SETUP) +#if IS_MAP_SELECT_ENABLED /* 0x01 */ DEFINE_GAMESTATE(MapSelect, GAMESTATE_MAP_SELECT, select) +#endif /* 0x02 */ DEFINE_GAMESTATE(ConsoleLogo, GAMESTATE_CONSOLE_LOGO, title) /* 0x03 */ DEFINE_GAMESTATE_INTERNAL(Play, GAMESTATE_PLAY) /* 0x04 */ DEFINE_GAMESTATE(TitleSetup, GAMESTATE_TITLE_SETUP, opening) diff --git a/include/tables/object_table.h b/include/tables/object_table.h index 97e6aa255..326227fee 100644 --- a/include/tables/object_table.h +++ b/include/tables/object_table.h @@ -5,7 +5,7 @@ * - Argument 1: Name of the object segment in spec * - Argument 2: Enum value for this object * - * DEFINE_OBJECT_UNSET and DEFINE_OBJECT_NULL are needed to define empty entries from the original game + * DEFINE_OBJECT_UNSET and DEFINE_OBJECT_EMPTY are needed to define empty entries from the original game */ /* 0x0000 */ DEFINE_OBJECT_UNSET(OBJECT_INVALID) // Object ID 0 isn't usable and should remain unset /* 0x0001 */ DEFINE_OBJECT(gameplay_keep, OBJECT_GAMEPLAY_KEEP) @@ -234,7 +234,7 @@ /* 0x00E0 */ DEFINE_OBJECT(object_ma1, OBJECT_MA1) /* 0x00E1 */ DEFINE_OBJECT(object_ganon, OBJECT_GANON) /* 0x00E2 */ DEFINE_OBJECT(object_sst, OBJECT_SST) -/* 0x00E3 */ DEFINE_OBJECT_NULL(object_ny, OBJECT_NY_UNUSED) // unused duplicate with size 0 +/* 0x00E3 */ DEFINE_OBJECT_EMPTY(object_ny, OBJECT_NY_UNUSED) // unused duplicate with size 0 /* 0x00E4 */ DEFINE_OBJECT_UNSET(OBJECT_UNSET_E4) /* 0x00E5 */ DEFINE_OBJECT(object_ny, OBJECT_NY) /* 0x00E6 */ DEFINE_OBJECT(object_fr, OBJECT_FR) @@ -257,7 +257,7 @@ /* 0x00F7 */ DEFINE_OBJECT(object_gi_grass, OBJECT_GI_GRASS) /* 0x00F8 */ DEFINE_OBJECT(object_gi_longsword, OBJECT_GI_LONGSWORD) /* 0x00F9 */ DEFINE_OBJECT(object_spot01_objects, OBJECT_SPOT01_OBJECTS) -/* 0x00FA */ DEFINE_OBJECT_NULL(object_md, OBJECT_MD_UNUSED) // unused duplicate with size 0 +/* 0x00FA */ DEFINE_OBJECT_EMPTY(object_md, OBJECT_MD_UNUSED) // unused duplicate with size 0 /* 0x00FB */ DEFINE_OBJECT(object_md, OBJECT_MD) /* 0x00FC */ DEFINE_OBJECT(object_km1, OBJECT_KM1) /* 0x00FD */ DEFINE_OBJECT(object_kw1, OBJECT_KW1) diff --git a/include/tables/scene_table.h b/include/tables/scene_table.h index 0337e1252..506e8d654 100644 --- a/include/tables/scene_table.h +++ b/include/tables/scene_table.h @@ -110,7 +110,8 @@ /* 0x62 */ DEFINE_SCENE(spot18_scene, g_pn_41, SCENE_GORON_CITY, SDC_GORON_CITY, 0, 0) /* 0x63 */ DEFINE_SCENE(spot20_scene, g_pn_42, SCENE_LON_LON_RANCH, SDC_LON_LON_RANCH, 0, 0) /* 0x64 */ DEFINE_SCENE(ganon_tou_scene, g_pn_43, SCENE_OUTSIDE_GANONS_CASTLE, SDC_OUTSIDE_GANONS_CASTLE, 0, 0) -// Debug-only scenes + +#if CAN_INCLUDE_TEST_SCENES /* 0x65 */ DEFINE_SCENE(test01_scene, none, SCENE_TEST01, SDC_CALM_WATER, 0, 0) /* 0x66 */ DEFINE_SCENE(besitu_scene, none, SCENE_BESITU, SDC_BESITU, 0, 0) /* 0x67 */ DEFINE_SCENE(depth_test_scene, none, SCENE_DEPTH_TEST, SDC_DEFAULT, 0, 0) @@ -120,3 +121,4 @@ /* 0x6B */ DEFINE_SCENE(hairal_niwa2_scene, g_pn_12, SCENE_HAIRAL_NIWA2, SDC_CASTLE_COURTYARD_GUARDS, 0, 0) /* 0x6C */ DEFINE_SCENE(sasatest_scene, none, SCENE_SASATEST, SDC_DEFAULT, 0, 0) /* 0x6D */ DEFINE_SCENE(testroom_scene, none, SCENE_TESTROOM, SDC_DEFAULT, 0, 0) +#endif diff --git a/include/ultra64/controller.h b/include/ultra64/controller.h index 8b759db77..9178991d9 100644 --- a/include/ultra64/controller.h +++ b/include/ultra64/controller.h @@ -119,6 +119,12 @@ #define BTN_B 0x4000 #define BTN_A 0x8000 +#ifdef __GNUC__ +// Ensure data cache coherency for OSPifRam structures by aligning to the data cache line size. +// On older compilers such as IDO this was done by placing each OSPifRam at the top of the file it is declared in, +// however file alignment should not be relied on in general. +__attribute__((aligned(0x10))) +#endif typedef union { struct { /* 0x00 */ u32 ram[15]; diff --git a/include/ultra64/gbi.f3dex3.h b/include/ultra64/gbi.f3dex3.h new file mode 100644 index 000000000..3dbc36441 --- /dev/null +++ b/include/ultra64/gbi.f3dex3.h @@ -0,0 +1,5166 @@ +/* Modded GBI for use with F3DEX3 custom microcode. */ + +#include "mbi.h" + +#ifndef F3DEX3_H +#define F3DEX3_H + +#define F3DEX_GBI_2 1 +#define F3DEX_GBI_3 1 + +#ifdef REQUIRE_SEMICOLONS_AFTER_GBI_COMMANDS +/* OoT style, semicolons required after using macros, cleaner code. If modding +SM64, will have to fix a few places the codebase omits the semicolons. */ +#define _DW(macro) do {macro} while (0) +#else +/* SM64 style, semicolons optional, uglier code, will produce tens of thousands +of warnings if you use -Wpedantic. */ +#define _DW(macro) macro +#endif + +/* + * The following commands are the "generated" RDP commands; the user + * never sees them, the RSP microcode generates them. + * edge, shade, texture, zbuff bits: estz + */ +#define G_TRI_FILL 0xC8 /* fill triangle: 11001000 */ +#define G_TRI_SHADE 0xCC /* shade triangle: 11001100 */ +#define G_TRI_TXTR 0xCA /* texture triangle: 11001010 */ +#define G_TRI_SHADE_TXTR 0xCE /* shade, texture triangle: 11001110 */ +#define G_TRI_FILL_ZBUFF 0xC9 /* fill, zbuff triangle: 11001001 */ +#define G_TRI_SHADE_ZBUFF 0xCD /* shade, zbuff triangle: 11001101 */ +#define G_TRI_TXTR_ZBUFF 0xCB /* texture, zbuff triangle: 11001011 */ +#define G_TRI_SHADE_TXTR_ZBUFF 0xCF /* shade, txtr, zbuff trngl: 11001111 */ + +/* masks to create the above: */ +#define G_RDP_TRI_FILL_MASK 0x08 +#define G_RDP_TRI_SHADE_MASK 0x04 +#define G_RDP_TRI_TXTR_MASK 0x02 +#define G_RDP_TRI_ZBUFF_MASK 0x01 + +/* + * GBI commands in order + */ +/*#define G_SPECIAL_3 0xD3 no-op in F3DEX2 */ +/*#define G_SPECIAL_2 0xD4 no-op in F3DEX2 */ +/*#define G_SPECIAL_1 0xD5 triggered MVP recalculation, not supported in F3DEX3 */ +#define G_DMA_IO 0xD6 +#define G_TEXTURE 0xD7 +#define G_POPMTX 0xD8 +#define G_GEOMETRYMODE 0xD9 +#define G_MTX 0xDA +#define G_MOVEWORD 0xDB +#define G_MOVEMEM 0xDC +#define G_LOAD_UCODE 0xDD +#define G_DL 0xDE +#define G_ENDDL 0xDF +#define G_SPNOOP 0xE0 +#define G_RDPHALF_1 0xE1 +#define G_SETOTHERMODE_L 0xE2 +#define G_SETOTHERMODE_H 0xE3 +#define G_TEXRECT 0xE4 +#define G_TEXRECTFLIP 0xE5 +#define G_RDPLOADSYNC 0xE6 +#define G_RDPPIPESYNC 0xE7 +#define G_RDPTILESYNC 0xE8 +#define G_RDPFULLSYNC 0xE9 +#define G_SETKEYGB 0xEA +#define G_SETKEYR 0xEB +#define G_SETCONVERT 0xEC +#define G_SETSCISSOR 0xED +#define G_SETPRIMDEPTH 0xEE +#define G_RDPSETOTHERMODE 0xEF +#define G_LOADTLUT 0xF0 +#define G_RDPHALF_2 0xF1 +#define G_SETTILESIZE 0xF2 +#define G_LOADBLOCK 0xF3 +#define G_LOADTILE 0xF4 +#define G_SETTILE 0xF5 +#define G_FILLRECT 0xF6 +#define G_SETFILLCOLOR 0xF7 +#define G_SETFOGCOLOR 0xF8 +#define G_SETBLENDCOLOR 0xF9 +#define G_SETPRIMCOLOR 0xFA +#define G_SETENVCOLOR 0xFB +#define G_SETCOMBINE 0xFC +#define G_SETTIMG 0xFD +#define G_SETZIMG 0xFE +#define G_SETCIMG 0xFF +#define G_NOOP 0x00 +#define G_VTX 0x01 +#define G_MODIFYVTX 0x02 +#define G_CULLDL 0x03 +#define G_BRANCH_WZ 0x04 +#define G_TRI1 0x05 +#define G_TRI2 0x06 +#define G_QUAD 0x07 +#define G_TRISTRIP 0x08 /* = G_LINE3D was a no-op in F3DEX2, has been removed */ +#define G_TRIFAN 0x09 +#define G_LIGHTTORDP 0x0A +#define G_RELSEGMENT 0x0B + +/* names differ between F3DEX2 and F3DZEX */ +#define G_BRANCH_Z G_BRANCH_WZ +#define G_BRANCH_W G_BRANCH_WZ + +/* + * RSP command argument and misc defines + */ + +/* Maximum number of transformed vertices kept in buffer in RSP DMEM */ +#define G_MAX_VERTS 56 + +/* Maximum number of directional / point lights, not counting ambient */ +#define G_MAX_LIGHTS 9 + +/* Maximum number of display list commands loaded at once into RSP DMEM */ +#define G_INPUT_BUFFER_CMDS 21 + +/* + * flags for G_SETGEOMETRYMODE + * + * Note that flat shading, i.e. not G_SHADING_SMOOTH, sets shade RGB for all + * three verts to the value of the first vertex in the triangle. Shade alpha is + * still separate for each vertex, which is desired behavior for fog but not for + * any other F3DEX3 effects which use shade alpha. + */ +#define G_ZBUFFER 0x00000001 +#define G_TEXTURE_ENABLE 0x00000000 /* actually 2, but controlled by SPTexture */ +#define G_SHADE 0x00000004 +#define G_AMBOCCLUSION 0x00000040 +#define G_ATTROFFSET_Z_ENABLE 0x00000080 +#define G_ATTROFFSET_ST_ENABLE 0x00000100 +#define G_CULL_NEITHER 0x00000000 +#define G_CULL_FRONT 0x00000200 +#define G_CULL_BACK 0x00000400 +#define G_CULL_BOTH 0x00000600 /* useless but supported */ +#define G_PACKED_NORMALS 0x00000800 +#define G_LIGHTTOALPHA 0x00001000 +#define G_LIGHTING_SPECULAR 0x00002000 +#define G_FRESNEL_COLOR 0x00004000 +#define G_FRESNEL_ALPHA 0x00008000 +#define G_FOG 0x00010000 +#define G_LIGHTING 0x00020000 +#define G_TEXTURE_GEN 0x00040000 +#define G_TEXTURE_GEN_LINEAR 0x00080000 +#define G_LOD 0x00100000 /* Ignored by all F3DEX* variants */ +#define G_SHADING_SMOOTH 0x00200000 +#define G_LIGHTING_POSITIONAL 0x00400000 /* Ignored by F3DEX3, assumed always on */ +#define G_CLIPPING 0x00800000 /* Ignored by all F3DEX* variants */ + +/* See SPDisplayList / SPBranchList */ +#define G_DL_PUSH 0 +#define G_DL_NOPUSH 1 + +/* See SPMatrix */ +#define G_MTX_MODELVIEW 0x00 /* matrix types */ +#define G_MTX_PROJECTION 0x04 +#define G_MTX_MUL 0x00 /* concat or load */ +#define G_MTX_LOAD 0x02 +#define G_MTX_NOPUSH 0x00 /* push or not */ +#define G_MTX_PUSH 0x01 + +/* See SPNormalsMode */ +#define G_NORMALS_MODE_FAST 0x00 +#define G_NORMALS_MODE_AUTO 0x01 +#define G_NORMALS_MODE_MANUAL 0x02 + +/* See SPAlphaCompareCull */ +#define G_ALPHA_COMPARE_CULL_DISABLE 0 +#define G_ALPHA_COMPARE_CULL_BELOW 1 +#define G_ALPHA_COMPARE_CULL_ABOVE -1 + +/* + * MOVEMEM indices + * Each of these indexes an entry in a dmem table which points to an arbitrarily + * sized block of dmem in which to store the result of a DMA. + */ +#define G_MV_TEMPMTX0 0 /* for internal use by G_MTX multiply mode */ +#define G_MV_MMTX 2 +#define G_MV_TEMPMTX1 4 /* for internal use by G_MTX multiply mode */ +#define G_MV_VPMTX 6 +#define G_MV_VIEWPORT 8 +#define G_MV_LIGHT 10 +/* G_MV_POINT is no longer supported because the internal vertex format is no +longer a multiple of 8 (DMA word). This was not used in any command anyway. */ +/* G_MV_MATRIX is no longer supported because there is no MVP matrix in F3DEX3. */ +#define G_MV_PMTX G_MV_VPMTX /* backwards compatibility */ + +/* + * MOVEWORD indices + * Each of these indexes an entry in a dmem table which points to a word in dmem + * where an immediate word will be stored. + */ +#define G_MW_FX 0x00 /* replaces G_MW_MATRIX which is no longer supported */ +#define G_MW_NUMLIGHT 0x02 +/* nothing for 0x04; G_MW_CLIP is no longer supported */ +#define G_MW_SEGMENT 0x06 +#define G_MW_FOG 0x08 +#define G_MW_LIGHTCOL 0x0A +/* G_MW_FORCEMTX is no longer supported because there is no MVP matrix in F3DEX3. */ +/* G_MW_PERSPNORM is removed; perspective norm is now set via G_MW_FX. */ + +#define G_MW_HALFWORD_FLAG 0x8000 /* indicates store 2 bytes instead of 4 */ + +/* + * These are offsets from the address in the dmem table + */ +#define G_MWO_NUMLIGHT 0x00 +#define G_MWO_FOG 0x00 + +#define G_MWO_SEGMENT_0 0x00 +#define G_MWO_SEGMENT_1 0x01 +#define G_MWO_SEGMENT_2 0x02 +#define G_MWO_SEGMENT_3 0x03 +#define G_MWO_SEGMENT_4 0x04 +#define G_MWO_SEGMENT_5 0x05 +#define G_MWO_SEGMENT_6 0x06 +#define G_MWO_SEGMENT_7 0x07 +#define G_MWO_SEGMENT_8 0x08 +#define G_MWO_SEGMENT_9 0x09 +#define G_MWO_SEGMENT_A 0x0A +#define G_MWO_SEGMENT_B 0x0B +#define G_MWO_SEGMENT_C 0x0C +#define G_MWO_SEGMENT_D 0x0D +#define G_MWO_SEGMENT_E 0x0E +#define G_MWO_SEGMENT_F 0x0F + +/* These are deprecated and no longer needed. */ +#define G_MWO_aLIGHT_1 0x00 +#define G_MWO_bLIGHT_1 0x04 +#define G_MWO_aLIGHT_2 0x10 +#define G_MWO_bLIGHT_2 0x14 +#define G_MWO_aLIGHT_3 0x20 +#define G_MWO_bLIGHT_3 0x24 +#define G_MWO_aLIGHT_4 0x30 +#define G_MWO_bLIGHT_4 0x34 +#define G_MWO_aLIGHT_5 0x40 +#define G_MWO_bLIGHT_5 0x44 +#define G_MWO_aLIGHT_6 0x50 +#define G_MWO_bLIGHT_6 0x54 +#define G_MWO_aLIGHT_7 0x60 +#define G_MWO_bLIGHT_7 0x64 +#define G_MWO_aLIGHT_8 0x70 +#define G_MWO_bLIGHT_8 0x74 +#define G_MWO_aLIGHT_9 0x80 +#define G_MWO_bLIGHT_9 0x84 +#define G_MWO_aLIGHT_10 0x90 +#define G_MWO_bLIGHT_10 0x94 + +#define G_MWO_POINT_RGBA 0x10 +#define G_MWO_POINT_ST 0x14 +#define G_MWO_POINT_XYSCREEN 0x18 /* not recommended to use, won't work if */ +#define G_MWO_POINT_ZSCREEN 0x1C /* the tri gets clipped */ + +#define G_MWO_AO_AMBIENT 0x00 +#define G_MWO_AO_DIRECTIONAL 0x02 +#define G_MWO_AO_POINT 0x04 +#define G_MWO_PERSPNORM 0x06 +#define G_MWO_FRESNEL_SCALE 0x0C +#define G_MWO_FRESNEL_OFFSET 0x0E +#define G_MWO_ATTR_OFFSET_S 0x10 +#define G_MWO_ATTR_OFFSET_T 0x12 +#define G_MWO_ATTR_OFFSET_Z 0x14 +#define G_MWO_ALPHA_COMPARE_CULL 0x16 +#define G_MWO_NORMALS_MODE 0x18 + +/* + * RDP command argument defines + */ + +/* + * Coordinate shift values, number of bits of fraction + */ +#define G_TEXTURE_IMAGE_FRAC 2 +#define G_TEXTURE_SCALE_FRAC 16 +#define G_SCALE_FRAC 8 +#define G_ROTATE_FRAC 16 + +/* + * Maximum z-buffer value, used to initialize the z-buffer. + * Note : this number is NOT the viewport z-scale constant. + * See the comment next to G_MAXZ for more info. + */ +#define G_MAXFBZ 0x3FFF /* 3b exp, 11b mantissa */ + +#define GPACK_RGBA5551(r, g, b, a) \ + ((((r) << 8) & 0xF800) | \ + (((g) << 3) & 0x07C0) | \ + (((b) >> 2) & 0x003E) | \ + ((a) & 1)) + +#define GPACK_IA16(i, a) (((i) << 8) | (a)) + +#define GPACK_ZDZ(z, dz) (((z) << 2) | (dz)) + +/* + * G_SETIMG fmt: set image formats + */ +#define G_IM_FMT_RGBA 0 +#define G_IM_FMT_YUV 1 +#define G_IM_FMT_CI 2 +#define G_IM_FMT_IA 3 +#define G_IM_FMT_I 4 + +/* + * G_SETIMG siz: set image pixel size + */ +#define G_IM_SIZ_4b 0 +#define G_IM_SIZ_8b 1 +#define G_IM_SIZ_16b 2 +#define G_IM_SIZ_32b 3 +#define G_IM_SIZ_DD 5 + +#define G_IM_SIZ_4b_BYTES 0 +#define G_IM_SIZ_4b_TILE_BYTES G_IM_SIZ_4b_BYTES +#define G_IM_SIZ_4b_LINE_BYTES G_IM_SIZ_4b_BYTES + +#define G_IM_SIZ_8b_BYTES 1 +#define G_IM_SIZ_8b_TILE_BYTES G_IM_SIZ_8b_BYTES +#define G_IM_SIZ_8b_LINE_BYTES G_IM_SIZ_8b_BYTES + +#define G_IM_SIZ_16b_BYTES 2 +#define G_IM_SIZ_16b_TILE_BYTES G_IM_SIZ_16b_BYTES +#define G_IM_SIZ_16b_LINE_BYTES G_IM_SIZ_16b_BYTES + +#define G_IM_SIZ_32b_BYTES 4 +#define G_IM_SIZ_32b_TILE_BYTES 2 +#define G_IM_SIZ_32b_LINE_BYTES 2 + +#define G_IM_SIZ_4b_LOAD_BLOCK G_IM_SIZ_16b +#define G_IM_SIZ_8b_LOAD_BLOCK G_IM_SIZ_16b +#define G_IM_SIZ_16b_LOAD_BLOCK G_IM_SIZ_16b +#define G_IM_SIZ_32b_LOAD_BLOCK G_IM_SIZ_32b + +#define G_IM_SIZ_4b_SHIFT 2 +#define G_IM_SIZ_8b_SHIFT 1 +#define G_IM_SIZ_16b_SHIFT 0 +#define G_IM_SIZ_32b_SHIFT 0 + +#define G_IM_SIZ_4b_INCR 3 +#define G_IM_SIZ_8b_INCR 1 +#define G_IM_SIZ_16b_INCR 0 +#define G_IM_SIZ_32b_INCR 0 + +/* + * G_SETCOMBINE: color combine modes + */ +/* Color combiner constants: */ +#define G_CCMUX_COMBINED 0 +#define G_CCMUX_TEXEL0 1 +#define G_CCMUX_TEXEL1 2 +#define G_CCMUX_PRIMITIVE 3 +#define G_CCMUX_SHADE 4 +#define G_CCMUX_ENVIRONMENT 5 +#define G_CCMUX_CENTER 6 +#define G_CCMUX_SCALE 6 +#define G_CCMUX_COMBINED_ALPHA 7 +#define G_CCMUX_TEXEL0_ALPHA 8 +#define G_CCMUX_TEXEL1_ALPHA 9 +#define G_CCMUX_PRIMITIVE_ALPHA 10 +#define G_CCMUX_SHADE_ALPHA 11 +#define G_CCMUX_ENV_ALPHA 12 +#define G_CCMUX_LOD_FRACTION 13 +#define G_CCMUX_PRIM_LOD_FRAC 14 +#define G_CCMUX_NOISE 7 +#define G_CCMUX_K4 7 +#define G_CCMUX_K5 15 +#define G_CCMUX_1 6 +#define G_CCMUX_0 31 + +/* Alpha combiner constants: */ +#define G_ACMUX_COMBINED 0 +#define G_ACMUX_TEXEL0 1 +#define G_ACMUX_TEXEL1 2 +#define G_ACMUX_PRIMITIVE 3 +#define G_ACMUX_SHADE 4 +#define G_ACMUX_ENVIRONMENT 5 +#define G_ACMUX_LOD_FRACTION 0 +#define G_ACMUX_PRIM_LOD_FRAC 6 +#define G_ACMUX_1 6 +#define G_ACMUX_0 7 + +/* typical CC cycle 1 modes */ + +/* typical CC cycle 1 modes */ +#define G_CC_PRIMITIVE 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE +#define G_CC_SHADE 0, 0, 0, SHADE, 0, 0, 0, SHADE + +#define G_CC_MODULATEI TEXEL0, 0, SHADE, 0, 0, 0, 0, SHADE +#define G_CC_MODULATEIDECALA TEXEL0, 0, SHADE, 0, 0, 0, 0, TEXEL0 +#define G_CC_MODULATEIFADE TEXEL0, 0, SHADE, 0, 0, 0, 0, ENVIRONMENT + +#define G_CC_MODULATERGB G_CC_MODULATEI +#define G_CC_MODULATERGBDECALA G_CC_MODULATEIDECALA +#define G_CC_MODULATERGBFADE G_CC_MODULATEIFADE + +#define G_CC_MODULATEIA TEXEL0, 0, SHADE, 0, TEXEL0, 0, SHADE, 0 +#define G_CC_MODULATEIFADEA TEXEL0, 0, SHADE, 0, TEXEL0, 0, ENVIRONMENT, 0 + +#define G_CC_MODULATEFADE TEXEL0, 0, SHADE, 0, ENVIRONMENT, 0, TEXEL0, 0 + +#define G_CC_MODULATERGBA G_CC_MODULATEIA +#define G_CC_MODULATERGBFADEA G_CC_MODULATEIFADEA + +#define G_CC_MODULATEI_PRIM TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE +#define G_CC_MODULATEIA_PRIM TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0 +#define G_CC_MODULATEIDECALA_PRIM TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, TEXEL0 + +#define G_CC_MODULATERGB_PRIM G_CC_MODULATEI_PRIM +#define G_CC_MODULATERGBA_PRIM G_CC_MODULATEIA_PRIM +#define G_CC_MODULATERGBDECALA_PRIM G_CC_MODULATEIDECALA_PRIM + +#define G_CC_FADE SHADE, 0, ENVIRONMENT, 0, SHADE, 0, ENVIRONMENT, 0 +#define G_CC_FADEA TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0 + +#define G_CC_DECALRGB 0, 0, 0, TEXEL0, 0, 0, 0, SHADE +#define G_CC_DECALRGBA 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0 +#define G_CC_DECALFADE 0, 0, 0, TEXEL0, 0, 0, 0, ENVIRONMENT + +#define G_CC_DECALFADEA 0, 0, 0, TEXEL0, TEXEL0, 0, ENVIRONMENT, 0 + +#define G_CC_BLENDI ENVIRONMENT, SHADE, TEXEL0, SHADE, 0, 0, 0, SHADE +#define G_CC_BLENDIA ENVIRONMENT, SHADE, TEXEL0, SHADE, TEXEL0, 0, SHADE, 0 +#define G_CC_BLENDIDECALA ENVIRONMENT, SHADE, TEXEL0, SHADE, 0, 0, 0, TEXEL0 + +#define G_CC_BLENDRGBA TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, 0, 0, 0, SHADE +#define G_CC_BLENDRGBDECALA TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, 0, 0, 0, TEXEL0 +#define G_CC_BLENDRGBFADEA TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, 0, 0, 0, ENVIRONMENT + +#define G_CC_ADDRGB TEXEL0, 0, TEXEL0, SHADE, 0, 0, 0, SHADE +#define G_CC_ADDRGBDECALA TEXEL0, 0, TEXEL0, SHADE, 0, 0, 0, TEXEL0 +#define G_CC_ADDRGBFADE TEXEL0, 0, TEXEL0, SHADE, 0, 0, 0, ENVIRONMENT + +#define G_CC_REFLECTRGB ENVIRONMENT, 0, TEXEL0, SHADE, 0, 0, 0, SHADE +#define G_CC_REFLECTRGBDECALA ENVIRONMENT, 0, TEXEL0, SHADE, 0, 0, 0, TEXEL0 + +#define G_CC_HILITERGB PRIMITIVE, SHADE, TEXEL0, SHADE, 0, 0, 0, SHADE +#define G_CC_HILITERGBA PRIMITIVE, SHADE, TEXEL0, SHADE, PRIMITIVE, SHADE, TEXEL0, SHADE +#define G_CC_HILITERGBDECALA PRIMITIVE, SHADE, TEXEL0, SHADE, 0, 0, 0, TEXEL0 + +#define G_CC_SHADEDECALA 0, 0, 0, SHADE, 0, 0, 0, TEXEL0 +#define G_CC_SHADEFADEA 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT + +#define G_CC_BLENDPE PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, SHADE, 0 +#define G_CC_BLENDPEDECALA PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, TEXEL0 + +/* oddball modes */ +#define _G_CC_BLENDPE ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, SHADE, 0 +#define _G_CC_BLENDPEDECALA ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, 0, 0, 0, TEXEL0 +#define _G_CC_TWOCOLORTEX PRIMITIVE, SHADE, TEXEL0, SHADE, 0, 0, 0, SHADE +/* used for 1-cycle sparse mip-maps, primitive color has color of lowest LOD */ +#define _G_CC_SPARSEST PRIMITIVE, TEXEL0, LOD_FRACTION, TEXEL0, PRIMITIVE, TEXEL0, LOD_FRACTION, TEXEL0 +#define G_CC_TEMPLERP TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0 + +/* typical CC cycle 1 modes, usually followed by other cycle 2 modes */ +#define G_CC_TRILERP TEXEL1, TEXEL0, LOD_FRACTION, TEXEL0, TEXEL1, TEXEL0, LOD_FRACTION, TEXEL0 +#define G_CC_INTERFERENCE TEXEL0, 0, TEXEL1, 0, TEXEL0, 0, TEXEL1, 0 + +/* + * One-cycle color convert operation + */ +#define G_CC_1CYUV2RGB TEXEL0, K4, K5, TEXEL0, 0, 0, 0, SHADE + +/* + * NOTE: YUV2RGB expects TF step1 color conversion to occur in 2nd clock. + * Therefore, CC looks for step1 results in TEXEL1 + */ +#define G_CC_YUV2RGB TEXEL1, K4, K5, TEXEL1, 0, 0, 0, 0 + +/* typical CC cycle 2 modes */ +#define G_CC_PASS2 0, 0, 0, COMBINED, 0, 0, 0, COMBINED +#define G_CC_MODULATEI2 COMBINED, 0, SHADE, 0, 0, 0, 0, SHADE +#define G_CC_MODULATEIA2 COMBINED, 0, SHADE, 0, COMBINED, 0, SHADE, 0 +#define G_CC_MODULATERGB2 G_CC_MODULATEI2 +#define G_CC_MODULATERGBA2 G_CC_MODULATEIA2 +#define G_CC_MODULATEI_PRIM2 COMBINED, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE +#define G_CC_MODULATEIA_PRIM2 COMBINED, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0 +#define G_CC_MODULATERGB_PRIM2 G_CC_MODULATEI_PRIM2 +#define G_CC_MODULATERGBA_PRIM2 G_CC_MODULATEIA_PRIM2 +#define G_CC_DECALRGB2 0, 0, 0, COMBINED, 0, 0, 0, SHADE +/* + * ? +#define G_CC_DECALRGBA2 COMBINED, SHADE, COMBINED_ALPHA, SHADE, 0, 0, 0, SHADE +*/ +#define G_CC_BLENDI2 ENVIRONMENT, SHADE, COMBINED, SHADE, 0, 0, 0, SHADE +#define G_CC_BLENDIA2 ENVIRONMENT, SHADE, COMBINED, SHADE, COMBINED, 0, SHADE, 0 +#define G_CC_CHROMA_KEY2 TEXEL0, CENTER, SCALE, 0, 0, 0, 0, 0 +#define G_CC_HILITERGB2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, SHADE +#define G_CC_HILITERGBA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, ENVIRONMENT, COMBINED, TEXEL0, COMBINED +#define G_CC_HILITERGBDECALA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, TEXEL0 +#define G_CC_HILITERGBPASSA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, COMBINED + + +/* + * One-cycle color convert operation + */ +#define G_CC_1CYUV2RGB TEXEL0, K4, K5, TEXEL0, 0, 0, 0, SHADE + +/* + * NOTE: YUV2RGB expects TF step1 color conversion to occur in 2nd clock. + * Therefore, CC looks for step1 results in TEXEL1 + */ +#define G_CC_YUV2RGB TEXEL1, K4, K5, TEXEL1, 0, 0, 0, 0 + +/* typical CC cycle 2 modes */ +#define G_CC_PASS2 0, 0, 0, COMBINED, 0, 0, 0, COMBINED +#define G_CC_MODULATEI2 COMBINED, 0, SHADE, 0, 0, 0, 0, SHADE +#define G_CC_MODULATEIA2 COMBINED, 0, SHADE, 0, COMBINED, 0, SHADE, 0 +#define G_CC_MODULATERGB2 G_CC_MODULATEI2 +#define G_CC_MODULATERGBA2 G_CC_MODULATEIA2 +#define G_CC_MODULATEI_PRIM2 COMBINED, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE +#define G_CC_MODULATEIA_PRIM2 COMBINED, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0 +#define G_CC_MODULATERGB_PRIM2 G_CC_MODULATEI_PRIM2 +#define G_CC_MODULATERGBA_PRIM2 G_CC_MODULATEIA_PRIM2 +#define G_CC_DECALRGB2 0, 0, 0, COMBINED, 0, 0, 0, SHADE +/* + * ? +#define G_CC_DECALRGBA2 COMBINED, SHADE, COMBINED_ALPHA, SHADE, 0, 0, 0, SHADE +*/ +#define G_CC_BLENDI2 ENVIRONMENT, SHADE, COMBINED, SHADE, 0, 0, 0, SHADE +#define G_CC_BLENDIA2 ENVIRONMENT, SHADE, COMBINED, SHADE, COMBINED, 0, SHADE, 0 +#define G_CC_CHROMA_KEY2 TEXEL0, CENTER, SCALE, 0, 0, 0, 0, 0 +#define G_CC_HILITERGB2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, SHADE +#define G_CC_HILITERGBA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, ENVIRONMENT, COMBINED, TEXEL0, COMBINED +#define G_CC_HILITERGBDECALA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, TEXEL0 +#define G_CC_HILITERGBPASSA2 ENVIRONMENT, COMBINED, TEXEL0, COMBINED, 0, 0, 0, COMBINED + +/* + * G_SETOTHERMODE_L sft: shift count + */ +#define G_MDSFT_ALPHACOMPARE 0 +#define G_MDSFT_ZSRCSEL 2 +#define G_MDSFT_RENDERMODE 3 +#define G_MDSFT_BLENDER 16 + +/* + * G_SETOTHERMODE_H sft: shift count + */ +#define G_MDSFT_ALPHADITHER 4 +#define G_MDSFT_RGBDITHER 6 +#define G_MDSFT_COMBKEY 8 +#define G_MDSFT_TEXTCONV 9 +#define G_MDSFT_TEXTFILT 12 +#define G_MDSFT_TEXTLUT 14 +#define G_MDSFT_TEXTLOD 16 +#define G_MDSFT_TEXTDETAIL 17 +#define G_MDSFT_TEXTPERSP 19 +#define G_MDSFT_CYCLETYPE 20 +#define G_MDSFT_COLORDITHER 22 /* Needed for OoT ucode_disas even though HW 1.0 only */ +#define G_MDSFT_PIPELINE 23 + +/* G_SETOTHERMODE_H gPipelineMode */ +#define G_PM_1PRIMITIVE (1 << G_MDSFT_PIPELINE) +#define G_PM_NPRIMITIVE (0 << G_MDSFT_PIPELINE) + +/* G_SETOTHERMODE_H gSetCycleType */ +#define G_CYC_1CYCLE (0 << G_MDSFT_CYCLETYPE) +#define G_CYC_2CYCLE (1 << G_MDSFT_CYCLETYPE) +#define G_CYC_COPY (2 << G_MDSFT_CYCLETYPE) +#define G_CYC_FILL (3 << G_MDSFT_CYCLETYPE) + +/* G_SETOTHERMODE_H gSetTexturePersp */ +#define G_TP_NONE (0 << G_MDSFT_TEXTPERSP) +#define G_TP_PERSP (1 << G_MDSFT_TEXTPERSP) + +/* G_SETOTHERMODE_H gSetTextureDetail */ +#define G_TD_CLAMP (0 << G_MDSFT_TEXTDETAIL) +#define G_TD_SHARPEN (1 << G_MDSFT_TEXTDETAIL) +#define G_TD_DETAIL (2 << G_MDSFT_TEXTDETAIL) + +/* G_SETOTHERMODE_H gSetTextureLOD */ +#define G_TL_TILE (0 << G_MDSFT_TEXTLOD) +#define G_TL_LOD (1 << G_MDSFT_TEXTLOD) + +/* G_SETOTHERMODE_H gSetTextureLUT */ +#define G_TT_NONE (0 << G_MDSFT_TEXTLUT) +#define G_TT_RGBA16 (2 << G_MDSFT_TEXTLUT) +#define G_TT_IA16 (3 << G_MDSFT_TEXTLUT) + +/* G_SETOTHERMODE_H gSetTextureFilter */ +#define G_TF_POINT (0 << G_MDSFT_TEXTFILT) +#define G_TF_AVERAGE (3 << G_MDSFT_TEXTFILT) +#define G_TF_BILERP (2 << G_MDSFT_TEXTFILT) + +/* G_SETOTHERMODE_H gSetTextureConvert */ +#define G_TC_CONV (0 << G_MDSFT_TEXTCONV) +#define G_TC_FILTCONV (5 << G_MDSFT_TEXTCONV) +#define G_TC_FILT (6 << G_MDSFT_TEXTCONV) + +/* G_SETOTHERMODE_H gSetCombineKey */ +#define G_CK_NONE (0 << G_MDSFT_COMBKEY) +#define G_CK_KEY (1 << G_MDSFT_COMBKEY) + +/* G_SETOTHERMODE_H gSetColorDither */ +#define G_CD_MAGICSQ (0 << G_MDSFT_RGBDITHER) +#define G_CD_BAYER (1 << G_MDSFT_RGBDITHER) +#define G_CD_NOISE (2 << G_MDSFT_RGBDITHER) +#define G_CD_DISABLE (3 << G_MDSFT_RGBDITHER) + +/* G_SETOTHERMODE_H gSetAlphaDither */ +#define G_AD_PATTERN (0 << G_MDSFT_ALPHADITHER) +#define G_AD_NOTPATTERN (1 << G_MDSFT_ALPHADITHER) +#define G_AD_NOISE (2 << G_MDSFT_ALPHADITHER) +#define G_AD_DISABLE (3 << G_MDSFT_ALPHADITHER) + +/* G_SETOTHERMODE_L gSetAlphaCompare */ +#define G_AC_NONE (0 << G_MDSFT_ALPHACOMPARE) +#define G_AC_THRESHOLD (1 << G_MDSFT_ALPHACOMPARE) +#define G_AC_DITHER (3 << G_MDSFT_ALPHACOMPARE) + +/* G_SETOTHERMODE_L gSetDepthSource */ +#define G_ZS_PIXEL (0 << G_MDSFT_ZSRCSEL) +#define G_ZS_PRIM (1 << G_MDSFT_ZSRCSEL) + +/* G_SETOTHERMODE_L gSetRenderMode */ +#define AA_EN 0x0008 +#define Z_CMP 0x0010 +#define Z_UPD 0x0020 +#define IM_RD 0x0040 +#define CLR_ON_CVG 0x0080 +#define CVG_DST_CLAMP 0x0000 +#define CVG_DST_WRAP 0x0100 +#define CVG_DST_FULL 0x0200 +#define CVG_DST_SAVE 0x0300 +#define ZMODE_OPA 0x0000 +#define ZMODE_INTER 0x0400 +#define ZMODE_XLU 0x0800 +#define ZMODE_DEC 0x0C00 +#define CVG_X_ALPHA 0x1000 +#define ALPHA_CVG_SEL 0x2000 +#define FORCE_BL 0x4000 +#define TEX_EDGE 0x0000 /* used to be 0x8000 */ + +#define G_BL_CLR_IN 0 +#define G_BL_CLR_MEM 1 +#define G_BL_CLR_BL 2 +#define G_BL_CLR_FOG 3 +#define G_BL_1MA 0 +#define G_BL_A_MEM 1 +#define G_BL_A_IN 0 +#define G_BL_A_FOG 1 +#define G_BL_A_SHADE 2 +#define G_BL_1 2 +#define G_BL_0 3 + +#define GBL_c1(m1a, m1b, m2a, m2b) \ + (m1a) << 30 | (m1b) << 26 | (m2a) << 22 | (m2b) << 18 +#define GBL_c2(m1a, m1b, m2a, m2b) \ + (m1a) << 28 | (m1b) << 24 | (m2a) << 20 | (m2b) << 16 + +#define RM_AA_ZB_OPA_SURF(clk) \ + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ + ZMODE_OPA | ALPHA_CVG_SEL | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_RA_ZB_OPA_SURF(clk) \ + AA_EN | Z_CMP | Z_UPD | CVG_DST_CLAMP | \ + ZMODE_OPA | ALPHA_CVG_SEL | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_AA_ZB_XLU_SURF(clk) \ + AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | \ + FORCE_BL | ZMODE_XLU | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_ZB_OPA_DECAL(clk) \ + AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | ALPHA_CVG_SEL | \ + ZMODE_DEC | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_RA_ZB_OPA_DECAL(clk) \ + AA_EN | Z_CMP | CVG_DST_WRAP | ALPHA_CVG_SEL | \ + ZMODE_DEC | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_AA_ZB_XLU_DECAL(clk) \ + AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | \ + FORCE_BL | ZMODE_DEC | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_ZB_OPA_INTER(clk) \ + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ + ALPHA_CVG_SEL | ZMODE_INTER | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_RA_ZB_OPA_INTER(clk) \ + AA_EN | Z_CMP | Z_UPD | CVG_DST_CLAMP | \ + ALPHA_CVG_SEL | ZMODE_INTER | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_AA_ZB_XLU_INTER(clk) \ + AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | \ + FORCE_BL | ZMODE_INTER | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_ZB_XLU_LINE(clk) \ + AA_EN | Z_CMP | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | \ + ALPHA_CVG_SEL | FORCE_BL | ZMODE_XLU | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_ZB_DEC_LINE(clk) \ + AA_EN | Z_CMP | IM_RD | CVG_DST_SAVE | CVG_X_ALPHA | \ + ALPHA_CVG_SEL | FORCE_BL | ZMODE_DEC | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_ZB_TEX_EDGE(clk) \ + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ + CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_AA_ZB_TEX_INTER(clk) \ + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ + CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_INTER | TEX_EDGE | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_AA_ZB_SUB_SURF(clk) \ + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | \ + ZMODE_OPA | ALPHA_CVG_SEL | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_AA_ZB_PCL_SURF(clk) \ + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ + ZMODE_OPA | G_AC_DITHER | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_ZB_OPA_TERR(clk) \ + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ + ZMODE_OPA | ALPHA_CVG_SEL | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_ZB_TEX_TERR(clk) \ + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | \ + CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_ZB_SUB_TERR(clk) \ + AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | \ + ZMODE_OPA | ALPHA_CVG_SEL | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + + +#define RM_AA_OPA_SURF(clk) \ + AA_EN | IM_RD | CVG_DST_CLAMP | \ + ZMODE_OPA | ALPHA_CVG_SEL | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_RA_OPA_SURF(clk) \ + AA_EN | CVG_DST_CLAMP | \ + ZMODE_OPA | ALPHA_CVG_SEL | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_AA_XLU_SURF(clk) \ + AA_EN | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | FORCE_BL | \ + ZMODE_OPA | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_XLU_LINE(clk) \ + AA_EN | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | \ + ALPHA_CVG_SEL | FORCE_BL | ZMODE_OPA | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_DEC_LINE(clk) \ + AA_EN | IM_RD | CVG_DST_FULL | CVG_X_ALPHA | \ + ALPHA_CVG_SEL | FORCE_BL | ZMODE_OPA | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_TEX_EDGE(clk) \ + AA_EN | IM_RD | CVG_DST_CLAMP | \ + CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_AA_SUB_SURF(clk) \ + AA_EN | IM_RD | CVG_DST_FULL | \ + ZMODE_OPA | ALPHA_CVG_SEL | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_AA_PCL_SURF(clk) \ + AA_EN | IM_RD | CVG_DST_CLAMP | \ + ZMODE_OPA | G_AC_DITHER | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_OPA_TERR(clk) \ + AA_EN | IM_RD | CVG_DST_CLAMP | \ + ZMODE_OPA | ALPHA_CVG_SEL | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_TEX_TERR(clk) \ + AA_EN | IM_RD | CVG_DST_CLAMP | \ + CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_AA_SUB_TERR(clk) \ + AA_EN | IM_RD | CVG_DST_FULL | \ + ZMODE_OPA | ALPHA_CVG_SEL | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + + +#define RM_ZB_OPA_SURF(clk) \ + Z_CMP | Z_UPD | CVG_DST_FULL | ALPHA_CVG_SEL | \ + ZMODE_OPA | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_ZB_XLU_SURF(clk) \ + Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_XLU | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_ZB_OPA_DECAL(clk) \ + Z_CMP | CVG_DST_FULL | ALPHA_CVG_SEL | ZMODE_DEC | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM) + +#define RM_ZB_XLU_DECAL(clk) \ + Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_DEC | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_ZB_CLD_SURF(clk) \ + Z_CMP | IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_XLU | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_ZB_OVL_SURF(clk) \ + Z_CMP | IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_DEC | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_ZB_PCL_SURF(clk) \ + Z_CMP | Z_UPD | CVG_DST_FULL | ZMODE_OPA | \ + G_AC_DITHER | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) + + +#define RM_OPA_SURF(clk) \ + CVG_DST_CLAMP | FORCE_BL | ZMODE_OPA | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) + +#define RM_XLU_SURF(clk) \ + IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_OPA | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_TEX_EDGE(clk) \ + CVG_DST_CLAMP | CVG_X_ALPHA | ALPHA_CVG_SEL | FORCE_BL | \ + ZMODE_OPA | TEX_EDGE | AA_EN | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) + +#define RM_CLD_SURF(clk) \ + IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_OPA | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) + +#define RM_PCL_SURF(clk) \ + CVG_DST_FULL | FORCE_BL | ZMODE_OPA | \ + G_AC_DITHER | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) + +#define RM_ADD(clk) \ + IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_OPA | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_1) + +#define RM_NOOP(clk) \ + GBL_c##clk(0, 0, 0, 0) + +#define RM_VISCVG(clk) \ + IM_RD | FORCE_BL | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_BL, G_BL_A_MEM) + +/* for rendering to an 8-bit framebuffer */ +#define RM_OPA_CI(clk) \ + CVG_DST_CLAMP | ZMODE_OPA | \ + GBL_c##clk(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) + +/* Custom version of RM_AA_ZB_XLU_SURF with Z_UPD */ +#define RM_CUSTOM_AA_ZB_XLU_SURF(clk) \ + RM_AA_ZB_XLU_SURF(clk) | Z_UPD + +#define G_RM_CUSTOM_AA_ZB_XLU_SURF RM_CUSTOM_AA_ZB_XLU_SURF(1) +#define G_RM_CUSTOM_AA_ZB_XLU_SURF2 RM_CUSTOM_AA_ZB_XLU_SURF(2) + +#define G_RM_AA_ZB_OPA_SURF RM_AA_ZB_OPA_SURF(1) +#define G_RM_AA_ZB_OPA_SURF2 RM_AA_ZB_OPA_SURF(2) +#define G_RM_AA_ZB_XLU_SURF RM_AA_ZB_XLU_SURF(1) +#define G_RM_AA_ZB_XLU_SURF2 RM_AA_ZB_XLU_SURF(2) +#define G_RM_AA_ZB_OPA_DECAL RM_AA_ZB_OPA_DECAL(1) +#define G_RM_AA_ZB_OPA_DECAL2 RM_AA_ZB_OPA_DECAL(2) +#define G_RM_AA_ZB_XLU_DECAL RM_AA_ZB_XLU_DECAL(1) +#define G_RM_AA_ZB_XLU_DECAL2 RM_AA_ZB_XLU_DECAL(2) +#define G_RM_AA_ZB_OPA_INTER RM_AA_ZB_OPA_INTER(1) +#define G_RM_AA_ZB_OPA_INTER2 RM_AA_ZB_OPA_INTER(2) +#define G_RM_AA_ZB_XLU_INTER RM_AA_ZB_XLU_INTER(1) +#define G_RM_AA_ZB_XLU_INTER2 RM_AA_ZB_XLU_INTER(2) +#define G_RM_AA_ZB_XLU_LINE RM_AA_ZB_XLU_LINE(1) +#define G_RM_AA_ZB_XLU_LINE2 RM_AA_ZB_XLU_LINE(2) +#define G_RM_AA_ZB_DEC_LINE RM_AA_ZB_DEC_LINE(1) +#define G_RM_AA_ZB_DEC_LINE2 RM_AA_ZB_DEC_LINE(2) +#define G_RM_AA_ZB_TEX_EDGE RM_AA_ZB_TEX_EDGE(1) +#define G_RM_AA_ZB_TEX_EDGE2 RM_AA_ZB_TEX_EDGE(2) +#define G_RM_AA_ZB_TEX_INTER RM_AA_ZB_TEX_INTER(1) +#define G_RM_AA_ZB_TEX_INTER2 RM_AA_ZB_TEX_INTER(2) +#define G_RM_AA_ZB_SUB_SURF RM_AA_ZB_SUB_SURF(1) +#define G_RM_AA_ZB_SUB_SURF2 RM_AA_ZB_SUB_SURF(2) +#define G_RM_AA_ZB_PCL_SURF RM_AA_ZB_PCL_SURF(1) +#define G_RM_AA_ZB_PCL_SURF2 RM_AA_ZB_PCL_SURF(2) +#define G_RM_AA_ZB_OPA_TERR RM_AA_ZB_OPA_TERR(1) +#define G_RM_AA_ZB_OPA_TERR2 RM_AA_ZB_OPA_TERR(2) +#define G_RM_AA_ZB_TEX_TERR RM_AA_ZB_TEX_TERR(1) +#define G_RM_AA_ZB_TEX_TERR2 RM_AA_ZB_TEX_TERR(2) +#define G_RM_AA_ZB_SUB_TERR RM_AA_ZB_SUB_TERR(1) +#define G_RM_AA_ZB_SUB_TERR2 RM_AA_ZB_SUB_TERR(2) + +#define G_RM_RA_ZB_OPA_SURF RM_RA_ZB_OPA_SURF(1) +#define G_RM_RA_ZB_OPA_SURF2 RM_RA_ZB_OPA_SURF(2) +#define G_RM_RA_ZB_OPA_DECAL RM_RA_ZB_OPA_DECAL(1) +#define G_RM_RA_ZB_OPA_DECAL2 RM_RA_ZB_OPA_DECAL(2) +#define G_RM_RA_ZB_OPA_INTER RM_RA_ZB_OPA_INTER(1) +#define G_RM_RA_ZB_OPA_INTER2 RM_RA_ZB_OPA_INTER(2) + +#define G_RM_AA_OPA_SURF RM_AA_OPA_SURF(1) +#define G_RM_AA_OPA_SURF2 RM_AA_OPA_SURF(2) +#define G_RM_AA_XLU_SURF RM_AA_XLU_SURF(1) +#define G_RM_AA_XLU_SURF2 RM_AA_XLU_SURF(2) +#define G_RM_AA_XLU_LINE RM_AA_XLU_LINE(1) +#define G_RM_AA_XLU_LINE2 RM_AA_XLU_LINE(2) +#define G_RM_AA_DEC_LINE RM_AA_DEC_LINE(1) +#define G_RM_AA_DEC_LINE2 RM_AA_DEC_LINE(2) +#define G_RM_AA_TEX_EDGE RM_AA_TEX_EDGE(1) +#define G_RM_AA_TEX_EDGE2 RM_AA_TEX_EDGE(2) +#define G_RM_AA_SUB_SURF RM_AA_SUB_SURF(1) +#define G_RM_AA_SUB_SURF2 RM_AA_SUB_SURF(2) +#define G_RM_AA_PCL_SURF RM_AA_PCL_SURF(1) +#define G_RM_AA_PCL_SURF2 RM_AA_PCL_SURF(2) +#define G_RM_AA_OPA_TERR RM_AA_OPA_TERR(1) +#define G_RM_AA_OPA_TERR2 RM_AA_OPA_TERR(2) +#define G_RM_AA_TEX_TERR RM_AA_TEX_TERR(1) +#define G_RM_AA_TEX_TERR2 RM_AA_TEX_TERR(2) +#define G_RM_AA_SUB_TERR RM_AA_SUB_TERR(1) +#define G_RM_AA_SUB_TERR2 RM_AA_SUB_TERR(2) + +#define G_RM_RA_OPA_SURF RM_RA_OPA_SURF(1) +#define G_RM_RA_OPA_SURF2 RM_RA_OPA_SURF(2) + +#define G_RM_ZB_OPA_SURF RM_ZB_OPA_SURF(1) +#define G_RM_ZB_OPA_SURF2 RM_ZB_OPA_SURF(2) +#define G_RM_ZB_XLU_SURF RM_ZB_XLU_SURF(1) +#define G_RM_ZB_XLU_SURF2 RM_ZB_XLU_SURF(2) +#define G_RM_ZB_OPA_DECAL RM_ZB_OPA_DECAL(1) +#define G_RM_ZB_OPA_DECAL2 RM_ZB_OPA_DECAL(2) +#define G_RM_ZB_XLU_DECAL RM_ZB_XLU_DECAL(1) +#define G_RM_ZB_XLU_DECAL2 RM_ZB_XLU_DECAL(2) +#define G_RM_ZB_CLD_SURF RM_ZB_CLD_SURF(1) +#define G_RM_ZB_CLD_SURF2 RM_ZB_CLD_SURF(2) +#define G_RM_ZB_OVL_SURF RM_ZB_OVL_SURF(1) +#define G_RM_ZB_OVL_SURF2 RM_ZB_OVL_SURF(2) +#define G_RM_ZB_PCL_SURF RM_ZB_PCL_SURF(1) +#define G_RM_ZB_PCL_SURF2 RM_ZB_PCL_SURF(2) + +#define G_RM_OPA_SURF RM_OPA_SURF(1) +#define G_RM_OPA_SURF2 RM_OPA_SURF(2) +#define G_RM_XLU_SURF RM_XLU_SURF(1) +#define G_RM_XLU_SURF2 RM_XLU_SURF(2) +#define G_RM_CLD_SURF RM_CLD_SURF(1) +#define G_RM_CLD_SURF2 RM_CLD_SURF(2) +#define G_RM_TEX_EDGE RM_TEX_EDGE(1) +#define G_RM_TEX_EDGE2 RM_TEX_EDGE(2) +#define G_RM_PCL_SURF RM_PCL_SURF(1) +#define G_RM_PCL_SURF2 RM_PCL_SURF(2) +#define G_RM_ADD RM_ADD(1) +#define G_RM_ADD2 RM_ADD(2) +#define G_RM_NOOP RM_NOOP(1) +#define G_RM_NOOP2 RM_NOOP(2) +#define G_RM_VISCVG RM_VISCVG(1) +#define G_RM_VISCVG2 RM_VISCVG(2) +#define G_RM_OPA_CI RM_OPA_CI(1) +#define G_RM_OPA_CI2 RM_OPA_CI(2) + + +#define G_RM_FOG_SHADE_A GBL_c1(G_BL_CLR_FOG, G_BL_A_SHADE, G_BL_CLR_IN, G_BL_1MA) +#define G_RM_FOG_PRIM_A GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_IN, G_BL_1MA) +#define G_RM_PASS GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1) + +/* + * G_SETCONVERT: K0-5 + */ +#define G_CV_K0 175 +#define G_CV_K1 -43 +#define G_CV_K2 -89 +#define G_CV_K3 222 +#define G_CV_K4 114 +#define G_CV_K5 42 + +/* + * G_SETSCISSOR: interlace mode + */ +#define G_SC_NON_INTERLACE 0 +#define G_SC_ODD_INTERLACE 3 +#define G_SC_EVEN_INTERLACE 2 + +/* + * Data Structures + */ + +/* + * Vertex (set up for use with colors) + */ +typedef struct { + short ob[3]; /* x, y, z */ + unsigned short flag; /* Holds packed normals, or unused */ + short tc[2]; /* texture coord */ + unsigned char cn[4]; /* color & alpha */ +} Vtx_t; + +/* + * Vertex (set up for use with normals) + */ +typedef struct { + short ob[3]; /* x, y, z */ + unsigned short flag; /* Packed normals are not used when normals are in colors */ + short tc[2]; /* texture coord */ + signed char n[3]; /* normal */ + unsigned char a; /* alpha */ +} Vtx_tn; + +typedef union { + Vtx_t v; /* Use this one for colors */ + Vtx_tn n; /* Use this one for normals */ + long long int force_structure_alignment; +} Vtx; + +typedef struct { + short pos[3]; + short pad; /* value ignored, need not be 0 */ +} PlainVtx_t; + +typedef union { + PlainVtx_t c; + long long int force_structure_alignment; +} PlainVtx; + +/* + * Triangle face + */ +typedef struct { + unsigned char flag; + unsigned char v[3]; +} Tri; + +/* + * 4x4 matrix, fixed point s15.16 format. + * First 8 words are integer portion of the 4x4 matrix + * Last 8 words are the fraction portion of the 4x4 matrix + */ +typedef long int Mtx_t[4][4]; +typedef union { + Mtx_t m; + struct { + u16 intPart[4][4]; + u16 fracPart[4][4]; + }; + long long int force_structure_alignment; +} Mtx; + +#define IPART(x) (((s32)((x) * 0x10000) >> 16) & 0xFFFF) +#define FPART(x) ((s32)((x) * 0x10000) & 0xFFFF) + +#define gdSPDefMtx( \ + xx, xy, xz, xw, \ + yx, yy, yz, yw, \ + zx, zy, zz, zw, \ + wx, wy, wz, ww) \ + { { \ + (IPART(xx) << 16) | IPART(yx), \ + (IPART(zx) << 16) | IPART(wx), \ + (IPART(xy) << 16) | IPART(yy), \ + (IPART(zy) << 16) | IPART(wy), \ + (IPART(xz) << 16) | IPART(yz), \ + (IPART(zz) << 16) | IPART(wz), \ + (IPART(xw) << 16) | IPART(yw), \ + (IPART(zw) << 16) | IPART(ww), \ + (FPART(xx) << 16) | FPART(yx), \ + (FPART(zx) << 16) | FPART(wx), \ + (FPART(xy) << 16) | FPART(yy), \ + (FPART(zy) << 16) | FPART(wy), \ + (FPART(xz) << 16) | FPART(yz), \ + (FPART(zz) << 16) | FPART(wz), \ + (FPART(xw) << 16) | FPART(yw), \ + (FPART(zw) << 16) | FPART(ww), \ + } } + +/* + * Viewport + */ + +/* + * This magic value is the maximum INTEGER z-range of the hardware + * (there are also 16-bits of fraction, which are introduced during + * any transformations). This is not just a good idea, it's the law. + * Feeding the hardware eventual z-coordinates (after any transforms + * or scaling) bigger than this, will not work. + * + * This number is DIFFERENT than G_MAXFBZ, which is the maximum value + * you want to use to initialize the z-buffer. + * + * The reason these are different is mildly interesting, but too long + * to explain here. It is basically the result of optimizations in the + * hardware. A more generic API might hide this detail from the users, + * but we don't have the ucode to do that... + * + */ +#define G_MAXZ 0x03FF /* 10 bits of integer screen-Z precision */ + +/* + * The viewport structure elements have 2 bits of fraction, necessary + * to accomodate the sub-pixel positioning scaling for the hardware. + * This can also be exploited to handle odd-sized viewports. + * + * Accounting for these fractional bits, using the default projection + * and viewing matrices, the viewport structure is initialized thusly: + * + * (SCREEN_WD/2)*4, (SCREEN_HT/2)*4, G_MAXZ, 0, + * (SCREEN_WD/2)*4, (SCREEN_HT/2)*4, 0, 0, + */ +typedef struct { + short vscale[4]; /* scale, 2 bits fraction */ + short vtrans[4]; /* translate, 2 bits fraction */ + /* both the above arrays are padded to 64-bit boundary */ +} Vp_t; + +typedef union { + Vp_t vp; + long long int force_structure_alignment[2]; +} Vp; + +/* + * Light structure. + * + * Note: the weird order is for the DMEM alignment benefit of + * the microcode. + */ + +typedef struct { + unsigned char col[3]; /* diffuse light color (rgb) */ + unsigned char type; /* formerly pad1; MUST SET TO 0 to indicate directional light */ + unsigned char colc[3]; /* copy of diffuse light color (rgb) */ + char pad2; + signed char dir[3]; /* direction of light (normalized) */ + char pad3; + char pad4[3]; + unsigned char size; /* For specular only; reasonable values are 1-4 */ +} Light_t; + +typedef struct { + unsigned char col[3]; /* point light color (rgb) */ + unsigned char kc; /* point light enable flag (> 0) & constant attenuation Kc */ + unsigned char colc[3]; /* copy of point light color (rgb) */ + unsigned char kl; /* linear attenuation Kl */ + short pos[3]; /* light position x, y, z in world space */ + unsigned char kq; /* quadratic attenuation Kq */ + unsigned char size; /* For specular only; reasonable values are 1-4 */ +} PosLight_t; + +typedef struct { + unsigned char col[3]; /* ambient light color (rgb) */ + char pad1; + unsigned char colc[3]; /* copy of ambient light color (rgb) */ + char pad2; +} Ambient_t; + +typedef struct { + signed char dir[3]; /* direction of lookat (normalized) */ + char pad1; +} LookAt_t; + +typedef struct { + LookAt_t l; /* for backwards compatibility */ +} LookAtWrapper; + +typedef struct { + /* texture offsets for highlight 1/2 */ + int x1; + int y1; + int x2; + int y2; +} Hilite_t; + +typedef struct { + short c0; + short c1; + short c2; + short c3; + short c4; + short c5; + short c6; + short c7; + short kx; + short ky; + short kz; + short kc; +} OcclusionPlane_t; + +typedef union { + Light_t l; + long long int force_structure_alignment[2]; +} Light; + +typedef union { + Ambient_t l; + long long int force_structure_alignment[1]; +} Ambient; + +typedef union { + PosLight_t p; + Light_t l; + long long int force_structure_alignment[2]; +} PosLight; + +typedef union { + LookAtWrapper l[2]; + long long int force_structure_alignment[1]; +} LookAt; + +typedef union { + Hilite_t h; + long int force_structure_alignment; +} Hilite; + +typedef union { + OcclusionPlane_t o; + short c[12]; + long long int force_structure_alignment[3]; +} OcclusionPlane; + +typedef struct { + Light l[9]; + Ambient a; +} Lightsn; + +typedef struct { + /* F3DEX3 properly supports zero lights, unlike F3DEX2 where you need + to include one black directional light. */ + Ambient a; +} Lights0; + +typedef struct { + Light l[1]; + Ambient a; +} Lights1; + +typedef struct { + Light l[2]; + Ambient a; +} Lights2; + +typedef struct { + Light l[3]; + Ambient a; +} Lights3; + +typedef struct { + Light l[4]; + Ambient a; +} Lights4; + +typedef struct { + Light l[5]; + Ambient a; +} Lights5; + +typedef struct { + Light l[6]; + Ambient a; +} Lights6; + +typedef struct { + Light l[7]; + Ambient a; +} Lights7; + +typedef struct { + Light l[8]; + Ambient a; +} Lights8; + +typedef struct { + Light l[9]; + Ambient a; +} Lights9; + +typedef struct { + PosLight l[9]; + Ambient a; +} PosLightsn; + +typedef struct { + /* F3DEX3 properly supports zero lights, unlike F3DEX2 where you need + to include one black directional light. */ + Ambient a; +} PosLights0; + +typedef struct { + PosLight l[1]; + Ambient a; +} PosLights1; + +typedef struct { + PosLight l[2]; + Ambient a; +} PosLights2; + +typedef struct { + PosLight l[3]; + Ambient a; +} PosLights3; + +typedef struct { + PosLight l[4]; + Ambient a; +} PosLights4; + +typedef struct { + PosLight l[5]; + Ambient a; +} PosLights5; + +typedef struct { + PosLight l[6]; + Ambient a; +} PosLights6; + +typedef struct { + PosLight l[7]; + Ambient a; +} PosLights7; + +typedef struct { + PosLight l[8]; + Ambient a; +} PosLights8; + +typedef struct { + PosLight l[9]; + Ambient a; +} PosLights9; + +#define gdSPDefLights0(ar, ag, ab) \ + { \ + {{ \ + { ar, ag, ab }, 0, \ + { ar, ag, ab }, 0, \ + }} \ + } + +#define gdSPDefLights1(ar, ag, ab, \ + r1, g1, b1, x1, y1, z1) \ + { \ + { \ + {{ \ + { r1, g1, b1 }, 0, \ + { r1, g1, b1 }, 0, \ + { x1, y1, z1 }, 0, \ + { 0, 0, 0 }, 0 \ + }} \ + }, \ + {{ \ + { ar, ag, ab }, 0, \ + { ar, ag, ab }, 0, \ + }} \ + } + +#define gdSPDefLights2(ar, ag, ab, \ + r1, g1, b1, x1, y1, z1, \ + r2, g2, b2, x2, y2, z2) \ + { \ + { \ + {{ \ + { r1, g1, b1 }, 0, \ + { r1, g1, b1 }, 0, \ + { x1, y1, z1 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r2, g2, b2 }, 0, \ + { r2, g2, b2 }, 0, \ + { x2, y2, z2 }, 0, \ + { 0, 0, 0 }, 0 \ + }} \ + }, \ + {{ \ + { ar, ag, ab }, 0, \ + { ar, ag, ab }, 0, \ + }} \ + } + +#define gdSPDefLights3(ar, ag, ab, \ + r1, g1, b1, x1, y1, z1, \ + r2, g2, b2, x2, y2, z2, \ + r3, g3, b3, x3, y3, z3) \ + { \ + { \ + {{ \ + { r1, g1, b1 }, 0, \ + { r1, g1, b1 }, 0, \ + { x1, y1, z1 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r2, g2, b2 }, 0, \ + { r2, g2, b2 }, 0, \ + { x2, y2, z2 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r3, g3, b3 }, 0, \ + { r3, g3, b3 }, 0, \ + { x3, y3, z3 }, 0, \ + { 0, 0, 0 }, 0 \ + }} \ + }, \ + {{ \ + { ar, ag, ab }, 0, \ + { ar, ag, ab }, 0, \ + }} \ + } + +#define gdSPDefLights4(ar, ag, ab, \ + r1, g1, b1, x1, y1, z1, \ + r2, g2, b2, x2, y2, z2, \ + r3, g3, b3, x3, y3, z3, \ + r4, g4, b4, x4, y4, z4) \ + { \ + { \ + {{ \ + { r1, g1, b1 }, 0, \ + { r1, g1, b1 }, 0, \ + { x1, y1, z1 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r2, g2, b2 }, 0, \ + { r2, g2, b2 }, 0, \ + { x2, y2, z2 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r3, g3, b3 }, 0, \ + { r3, g3, b3 }, 0, \ + { x3, y3, z3 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r4, g4, b4 }, 0, \ + { r4, g4, b4 }, 0, \ + { x4, y4, z4 }, 0, \ + { 0, 0, 0 }, 0 \ + }} \ + }, \ + {{ \ + { ar, ag, ab }, 0, \ + { ar, ag, ab }, 0, \ + }} \ + } + +#define gdSPDefLights5(ar, ag, ab, \ + r1, g1, b1, x1, y1, z1, \ + r2, g2, b2, x2, y2, z2, \ + r3, g3, b3, x3, y3, z3, \ + r4, g4, b4, x4, y4, z4, \ + r5, g5, b5, x5, y5, z5) \ + { \ + { \ + {{ \ + { r1, g1, b1 }, 0, \ + { r1, g1, b1 }, 0, \ + { x1, y1, z1 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r2, g2, b2 }, 0, \ + { r2, g2, b2 }, 0, \ + { x2, y2, z2 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r3, g3, b3 }, 0, \ + { r3, g3, b3 }, 0, \ + { x3, y3, z3 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r4, g4, b4 }, 0, \ + { r4, g4, b4 }, 0, \ + { x4, y4, z4 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r5, g5, b5 }, 0, \ + { r5, g5, b5 }, 0, \ + { x5, y5, z5 }, 0, \ + { 0, 0, 0 }, 0 \ + }} \ + }, \ + {{ \ + { ar, ag, ab }, 0, \ + { ar, ag, ab }, 0, \ + }} \ + } + +#define gdSPDefLights6(ar, ag, ab, \ + r1, g1, b1, x1, y1, z1, \ + r2, g2, b2, x2, y2, z2, \ + r3, g3, b3, x3, y3, z3, \ + r4, g4, b4, x4, y4, z4, \ + r5, g5, b5, x5, y5, z5, \ + r6, g6, b6, x6, y6, z6) \ + { \ + { \ + {{ \ + { r1, g1, b1 }, 0, \ + { x1, y1, z1 }, 0, \ + { r1, g1, b1 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r2, g2, b2 }, 0, \ + { r2, g2, b2 }, 0, \ + { x2, y2, z2 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r3, g3, b3 }, 0, \ + { r3, g3, b3 }, 0, \ + { x3, y3, z3 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r4, g4, b4 }, 0, \ + { r4, g4, b4 }, 0, \ + { x4, y4, z4 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r5, g5, b5 }, 0, \ + { r5, g5, b5 }, 0, \ + { x5, y5, z5 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r6, g6, b6 }, 0, \ + { r6, g6, b6 }, 0, \ + { x6, y6, z6 }, 0, \ + { 0, 0, 0 }, 0 \ + }} \ + }, \ + {{ \ + { ar, ag, ab }, 0, \ + { ar, ag, ab }, 0, \ + }} \ + } + +#define gdSPDefLights7(ar, ag, ab, \ + r1, g1, b1, x1, y1, z1, \ + r2, g2, b2, x2, y2, z2, \ + r3, g3, b3, x3, y3, z3, \ + r4, g4, b4, x4, y4, z4, \ + r5, g5, b5, x5, y5, z5, \ + r6, g6, b6, x6, y6, z6, \ + r7, g7, b7, x7, y7, z7) \ + { \ + { \ + {{ \ + { r1, g1, b1 }, 0, \ + { r1, g1, b1 }, 0, \ + { x1, y1, z1 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r2, g2, b2 }, 0, \ + { r2, g2, b2 }, 0, \ + { x2, y2, z2 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r3, g3, b3 }, 0, \ + { r3, g3, b3 }, 0, \ + { x3, y3, z3 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r4, g4, b4 }, 0, \ + { r4, g4, b4 }, 0, \ + { x4, y4, z4 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r5, g5, b5 }, 0, \ + { r5, g5, b5 }, 0, \ + { x5, y5, z5 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r6, g6, b6 }, 0, \ + { r6, g6, b6 }, 0, \ + { x6, y6, z6 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r7, g7, b7 }, 0, \ + { r7, g7, b7 }, 0, \ + { x7, y7, z7 }, 0, \ + { 0, 0, 0 }, 0 \ + }} \ + }, \ + {{ \ + { ar, ag, ab }, 0, \ + { ar, ag, ab }, 0, \ + }} \ + } + +#define gdSPDefLights8(ar, ag, ab, \ + r1, g1, b1, x1, y1, z1, \ + r2, g2, b2, x2, y2, z2, \ + r3, g3, b3, x3, y3, z3, \ + r4, g4, b4, x4, y4, z4, \ + r5, g5, b5, x5, y5, z5, \ + r6, g6, b6, x6, y6, z6, \ + r7, g7, b7, x7, y7, z7, \ + r8, g8, b8, x8, y8, z8) \ + { \ + { \ + {{ \ + { r1, g1, b1 }, 0, \ + { r1, g1, b1 }, 0, \ + { x1, y1, z1 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r2, g2, b2 }, 0, \ + { r2, g2, b2 }, 0, \ + { x2, y2, z2 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r3, g3, b3 }, 0, \ + { r3, g3, b3 }, 0, \ + { x3, y3, z3 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r4, g4, b4 }, 0, \ + { r4, g4, b4 }, 0, \ + { x4, y4, z4 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r5, g5, b5 }, 0, \ + { r5, g5, b5 }, 0, \ + { x5, y5, z5 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r6, g6, b6 }, 0, \ + { r6, g6, b6 }, 0, \ + { x6, y6, z6 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r7, g7, b7 }, 0, \ + { r7, g7, b7 }, 0, \ + { x7, y7, z7 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r8, g8, b8 }, 0, \ + { r8, g8, b8 }, 0, \ + { x8, y8, z8 }, 0, \ + { 0, 0, 0 }, 0 \ + }} \ + }, \ + {{ \ + { ar, ag, ab }, 0, \ + { ar, ag, ab }, 0, \ + }} \ + } + +#define gdSPDefLights9(ar, ag, ab, \ + r1, g1, b1, x1, y1, z1, \ + r2, g2, b2, x2, y2, z2, \ + r3, g3, b3, x3, y3, z3, \ + r4, g4, b4, x4, y4, z4, \ + r5, g5, b5, x5, y5, z5, \ + r6, g6, b6, x6, y6, z6, \ + r7, g7, b7, x7, y7, z7, \ + r8, g8, b8, x8, y8, z8, \ + r9, g9, b9, x9, y9, z9) \ + { \ + { \ + {{ \ + { r1, g1, b1 }, 0, \ + { r1, g1, b1 }, 0, \ + { x1, y1, z1 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r2, g2, b2 }, 0, \ + { r2, g2, b2 }, 0, \ + { x2, y2, z2 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r3, g3, b3 }, 0, \ + { r3, g3, b3 }, 0, \ + { x3, y3, z3 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r4, g4, b4 }, 0, \ + { r4, g4, b4 }, 0, \ + { x4, y4, z4 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r5, g5, b5 }, 0, \ + { r5, g5, b5 }, 0, \ + { x5, y5, z5 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r6, g6, b6 }, 0, \ + { r6, g6, b6 }, 0, \ + { x6, y6, z6 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r7, g7, b7 }, 0, \ + { r7, g7, b7 }, 0, \ + { x7, y7, z7 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r8, g8, b8 }, 0, \ + { r8, g8, b8 }, 0, \ + { x8, y8, z8 }, 0, \ + { 0, 0, 0 }, 0 \ + }}, \ + {{ \ + { r9, g9, b9 }, 0, \ + { r9, g9, b9 }, 0, \ + { x9, y9, z9 }, 0, \ + { 0, 0, 0 }, 0 \ + }} \ + }, \ + {{ \ + { ar, ag, ab }, 0, \ + { ar, ag, ab }, 0, \ + }} \ + } + +#define gdSPDefLookAt(rightx, righty, rightz, upx, upy, upz) \ + { \ + {{{ rightx, righty, rightz }, 0 }}, \ + {{{ upx, upy, upz }, 0 }}, \ + } + + +#define _gdSPDefAmbient(ar,ag,ab) \ + {{ {ar,ag,ab},0,{ar,ag,ab},0}} +#define _gdSPDefPosLight(r,g,b,x,y,z,c,l,q) \ + {{ {r,g,b},c,{r,g,b},l,{x,y,z},q,0 }} +#define _gdSPDefInfLight(r,g,b,x,y,z) \ + {{ {r,g,b},0,{r,g,b},0,{((x)<<8)|((y)&0xff),(z)<<8,0},0,0}} +#define gdSPDefPosLights0(ar,ag,ab) \ + { _gdSPDefAmbient(ar,ag,ab) } +#define gdSPDefPosLights1(ar,ag,ab,r1,g1,b1,x1,y1,z1,c1,l1,q1) \ + {{ _gdSPDefPosLight(r1,g1,b1,x1,y1,z1,c1,l1,q1) }, \ + _gdSPDefAmbient(ar,ag,ab) } +#define gdSPDefPosLights2(ar,ag,ab,r1,g1,b1,x1,y1,z1,c1,l1,q1,r2,g2,b2,x2,y2,z2,c2,l2,q2) \ + {{ _gdSPDefPosLight(r1,g1,b1,x1,y1,z1,c1,l1,q1), \ + _gdSPDefPosLight(r2,g2,b2,x2,y2,z2,c2,l2,q2) }, \ + _gdSPDefAmbient(ar,ag,ab) } +#define gdSPDefPosLights3(ar,ag,ab,r1,g1,b1,x1,y1,z1,c1,l1,q1,r2,g2,b2,x2,y2,z2,c2,l2,q2,r3,g3,b3,x3,y3,z3,c3,l3,q3) \ + {{ _gdSPDefPosLight(r1,g1,b1,x1,y1,z1,c1,l1,q1), \ + _gdSPDefPosLight(r2,g2,b2,x2,y2,z2,c2,l2,q2), \ + _gdSPDefPosLight(r3,g3,b3,x3,y3,z3,c3,l3,q3) }, \ + _gdSPDefAmbient(ar,ag,ab) } +#define gdSPDefPosLights4(ar,ag,ab,r1,g1,b1,x1,y1,z1,c1,l1,q1,r2,g2,b2,x2,y2,z2,c2,l2,q2,r3,g3,b3,x3,y3,z3,c3,l3,q3,r4,g4,b4,x4,y4,z4,c4,l4,q4) \ + {{ _gdSPDefPosLight(r1,g1,b1,x1,y1,z1,c1,l1,q1), \ + _gdSPDefPosLight(r2,g2,b2,x2,y2,z2,c2,l2,q2), \ + _gdSPDefPosLight(r3,g3,b3,x3,y3,z3,c3,l3,q3), \ + _gdSPDefPosLight(r4,g4,b4,x4,y4,z4,c4,l4,q4) }, \ + _gdSPDefAmbient(ar,ag,ab) } +#define gdSPDefPosLights5(ar,ag,ab,r1,g1,b1,x1,y1,z1,c1,l1,q1,r2,g2,b2,x2,y2,z2,c2,l2,q2,r3,g3,b3,x3,y3,z3,c3,l3,q3,r4,g4,b4,x4,y4,z4,c4,l4,q4,r5,g5,b5,x5,y5,z5,c5,l5,q5) \ + {{ _gdSPDefPosLight(r1,g1,b1,x1,y1,z1,c1,l1,q1), \ + _gdSPDefPosLight(r2,g2,b2,x2,y2,z2,c2,l2,q2), \ + _gdSPDefPosLight(r3,g3,b3,x3,y3,z3,c3,l3,q3), \ + _gdSPDefPosLight(r4,g4,b4,x4,y4,z4,c4,l4,q4), \ + _gdSPDefPosLight(r5,g5,b5,x5,y5,z5,c5,l5,q5) }, \ + _gdSPDefAmbient(ar,ag,ab) } +#define gdSPDefPosLights6(ar,ag,ab,r1,g1,b1,x1,y1,z1,c1,l1,q1,r2,g2,b2,x2,y2,z2,c2,l2,q2,r3,g3,b3,x3,y3,z3,c3,l3,q3,r4,g4,b4,x4,y4,z4,c4,l4,q4,r5,g5,b5,x5,y5,z5,c5,l5,q5,r6,g6,b6,x6,y6,z6,c6,l6,q6) \ + {{ _gdSPDefPosLight(r1,g1,b1,x1,y1,z1,c1,l1,q1), \ + _gdSPDefPosLight(r2,g2,b2,x2,y2,z2,c2,l2,q2), \ + _gdSPDefPosLight(r3,g3,b3,x3,y3,z3,c3,l3,q3), \ + _gdSPDefPosLight(r4,g4,b4,x4,y4,z4,c4,l4,q4), \ + _gdSPDefPosLight(r5,g5,b5,x5,y5,z5,c5,l5,q5), \ + _gdSPDefPosLight(r6,g6,b6,x6,y6,z6,c6,l6,q6) }, \ + _gdSPDefAmbient(ar,ag,ab) } +#define gdSPDefPosLights7(ar,ag,ab,r1,g1,b1,x1,y1,z1,c1,l1,q1,r2,g2,b2,x2,y2,z2,c2,l2,q2,r3,g3,b3,x3,y3,z3,c3,l3,q3,r4,g4,b4,x4,y4,z4,c4,l4,q4,r5,g5,b5,x5,y5,z5,c5,l5,q5,r6,g6,b6,x6,y6,z6,c6,l6,q6,r7,g7,b7,x7,y7,z7,c7,l7,q7) \ + {{ _gdSPDefPosLight(r1,g1,b1,x1,y1,z1,c1,l1,q1), \ + _gdSPDefPosLight(r2,g2,b2,x2,y2,z2,c2,l2,q2), \ + _gdSPDefPosLight(r3,g3,b3,x3,y3,z3,c3,l3,q3), \ + _gdSPDefPosLight(r4,g4,b4,x4,y4,z4,c4,l4,q4), \ + _gdSPDefPosLight(r5,g5,b5,x5,y5,z5,c5,l5,q5), \ + _gdSPDefPosLight(r6,g6,b6,x6,y6,z6,c6,l6,q6), \ + _gdSPDefPosLight(r7,g7,b7,x7,y7,z7,c7,l7,q7) }, \ + _gdSPDefAmbient(ar,ag,ab) } +#define gdSPDefPosLights8(ar,ag,ab,r1,g1,b1,x1,y1,z1,c1,l1,q1,r2,g2,b2,x2,y2,z2,c2,l2,q2,r3,g3,b3,x3,y3,z3,c3,l3,q3,r4,g4,b4,x4,y4,z4,c4,l4,q4,r5,g5,b5,x5,y5,z5,c5,l5,q5,r6,g6,b6,x6,y6,z6,c6,l6,q6,r7,g7,b7,x7,y7,z7,c7,l7,q7,r8,g8,b8,x8,y8,z8,c8,l8,q8) \ + {{ _gdSPDefPosLight(r1,g1,b1,x1,y1,z1,c1,l1,q1), \ + _gdSPDefPosLight(r2,g2,b2,x2,y2,z2,c2,l2,q2), \ + _gdSPDefPosLight(r3,g3,b3,x3,y3,z3,c3,l3,q3), \ + _gdSPDefPosLight(r4,g4,b4,x4,y4,z4,c4,l4,q4), \ + _gdSPDefPosLight(r5,g5,b5,x5,y5,z5,c5,l5,q5), \ + _gdSPDefPosLight(r6,g6,b6,x6,y6,z6,c6,l6,q6), \ + _gdSPDefPosLight(r7,g7,b7,x7,y7,z7,c7,l7,q7), \ + _gdSPDefPosLight(r8,g8,b8,x8,y8,z8,c8,l8,q8) }, \ + _gdSPDefAmbient(ar,ag,ab) } +#define gdSPDefPosLights9(ar,ag,ab,r1,g1,b1,x1,y1,z1,c1,l1,q1,r2,g2,b2,x2,y2,z2,c2,l2,q2,r3,g3,b3,x3,y3,z3,c3,l3,q3,r4,g4,b4,x4,y4,z4,c4,l4,q4,r5,g5,b5,x5,y5,z5,c5,l5,q5,r6,g6,b6,x6,y6,z6,c6,l6,q6,r7,g7,b7,x7,y7,z7,c7,l7,q7,r8,g8,b8,x8,y8,z8,c8,l8,q8,r9,g9,b9,x9,y9,z9,c9,l9,q9) \ + {{ _gdSPDefPosLight(r1,g1,b1,x1,y1,z1,c1,l1,q1), \ + _gdSPDefPosLight(r2,g2,b2,x2,y2,z2,c2,l2,q2), \ + _gdSPDefPosLight(r3,g3,b3,x3,y3,z3,c3,l3,q3), \ + _gdSPDefPosLight(r4,g4,b4,x4,y4,z4,c4,l4,q4), \ + _gdSPDefPosLight(r5,g5,b5,x5,y5,z5,c5,l5,q5), \ + _gdSPDefPosLight(r6,g6,b6,x6,y6,z6,c6,l6,q6), \ + _gdSPDefPosLight(r7,g7,b7,x7,y7,z7,c7,l7,q7), \ + _gdSPDefPosLight(r8,g8,b8,x8,y8,z8,c8,l8,q8), \ + _gdSPDefPosLight(r9,g9,b9,x9,y9,z9,c9,l9,q9) }, \ + _gdSPDefAmbient(ar,ag,ab) } + + +typedef struct { + int cmd : 8; + unsigned int type : 8; + unsigned int len : 16; + union { + /* The exact form of this callback is intentionally left unspecified, a display list + parser may choose the return value and parameters so long as it is consistent. */ + void (*callback)(); + const char* str; + unsigned int u32; + float f32; + void* addr; + } value; +} Gnoop; + +/* + * Graphics DMA Packet + */ +typedef struct { + int cmd : 8; + unsigned int par : 8; + unsigned int len : 16; + unsigned int addr; +} Gdma; + +typedef struct { + int cmd : 8; + unsigned int len : 8; + unsigned int ofs : 8; + unsigned int par : 8; + unsigned int addr; +} Gdma2; + +/* + * Graphics Moveword Packet + */ +typedef struct { + int cmd : 8; + unsigned int index : 8; + unsigned int offset : 16; + unsigned int data; +} Gmovewd; + +/* + * Graphics Movemem Packet + */ +typedef struct { + int cmd : 8; + unsigned int size : 8; + unsigned int offset : 8; + unsigned int index : 8; + unsigned int data; +} Gmovemem; + +/* + * Graphics Immediate Mode Packet types + */ +typedef struct { + int cmd : 8; + int pad : 24; + Tri tri; +} Gtri; + +typedef struct { + Tri tri1; /* flag is the command byte */ + Tri tri2; +} Gtri2; + +typedef struct { + Tri tri1; /* flag is the command byte */ + Tri tri2; +} Gquad; + +typedef struct { + int cmd : 8; + unsigned int pad : 8; + unsigned short vstart_x2; + unsigned short pad2; + unsigned short vend_x2; +} Gcull; + +typedef struct { + int cmd : 8; + unsigned int pad : 24; + unsigned short z; + unsigned short dz; +} Gsetprimdepth; + +typedef struct { + int cmd : 8; + int pad1 : 24; + unsigned int param; +} Gpopmtx; + +typedef struct { + int cmd : 8; + int mw_index : 8; + int pad0 : 8; + int number : 8; + int pad1 : 8; + int base : 24; +} Gsegment; + +typedef struct { + int cmd : 8; + int pad0 : 8; + unsigned int sft : 8; + unsigned int len : 8; + unsigned int data : 32; +} GsetothermodeL; + +typedef struct { + int cmd : 8; + int pad0 : 8; + unsigned int sft : 8; + unsigned int len : 8; + unsigned int data : 32; +} GsetothermodeH; + +typedef struct { + unsigned char cmd; + unsigned char lodscale; + unsigned char pad : 2; + unsigned char level : 3; + unsigned char tile : 3; + unsigned char on; + unsigned short s; + unsigned short t; +} Gtexture; + +typedef struct { + int cmd : 8; + int pad1 : 24; + short int pad2; + short int scale; +} Gperspnorm; + + +/* + * RDP Packet types + */ +typedef struct { + int cmd : 8; + unsigned int fmt : 3; + unsigned int siz : 2; + unsigned int pad : 7; + unsigned int wd : 12; /* really only 10 bits, extra */ + unsigned int dram; /* to account for 1024 */ +} Gsetimg; + +typedef struct { + int cmd : 8; + /* muxs0 */ + unsigned int a0 : 4; + unsigned int c0 : 5; + unsigned int Aa0 : 3; + unsigned int Ac0 : 3; + unsigned int a1 : 4; + unsigned int c1 : 5; + /* muxs1 */ + unsigned int b0 : 4; + unsigned int b1 : 4; + unsigned int Aa1 : 3; + unsigned int Ac1 : 3; + unsigned int d0 : 3; + unsigned int Ab0 : 3; + unsigned int Ad0 : 3; + unsigned int d1 : 3; + unsigned int Ab1 : 3; + unsigned int Ad1 : 3; +} Gsetcombine; + +typedef struct { + int cmd : 8; + unsigned char pad; + unsigned char prim_min_level; + unsigned char prim_level; + union { + unsigned long color; + struct { + unsigned char r; + unsigned char g; + unsigned char b; + unsigned char a; + }; + }; +} Gsetcolor; + +typedef struct { + int cmd : 8; + int x0 : 10; + int x0frac : 2; + int y0 : 10; + int y0frac : 2; + unsigned int pad : 8; + int x1 : 10; + int x1frac : 2; + int y1 : 10; + int y1frac : 2; +} Gfillrect; + +typedef struct { + int cmd : 8; + unsigned int fmt : 3; + unsigned int siz : 2; + unsigned int pad0 : 1; + unsigned int line : 9; + unsigned int tmem : 9; + unsigned int pad1 : 5; + unsigned int tile : 3; + unsigned int palette : 4; + unsigned int ct : 1; + unsigned int mt : 1; + unsigned int maskt : 4; + unsigned int shiftt : 4; + unsigned int cs : 1; + unsigned int ms : 1; + unsigned int masks : 4; + unsigned int shifts : 4; +} Gsettile; + +typedef struct { + int cmd : 8; + unsigned int sl : 12; + unsigned int tl : 12; + int pad : 5; + unsigned int tile : 3; + unsigned int sh : 12; + unsigned int th : 12; +} Gloadtile; + +typedef Gloadtile Gloadblock; + +typedef Gloadtile Gsettilesize; + +typedef Gloadtile Gloadtlut; + +typedef struct { + unsigned int cmd : 8; /* command */ + unsigned int xl : 12; /* X coordinate of upper left */ + unsigned int yl : 12; /* Y coordinate of upper left */ + unsigned int pad1 : 5; /* Padding */ + unsigned int tile : 3; /* Tile descriptor index */ + unsigned int xh : 12; /* X coordinate of lower right */ + unsigned int yh : 12; /* Y coordinate of lower right */ + unsigned int s : 16; /* S texture coord at top left */ + unsigned int t : 16; /* T texture coord at top left */ + unsigned int dsdx : 16; /* Change in S per change in X */ + unsigned int dtdy : 16; /* Change in T per change in Y */ +} Gtexrect; + +#define MakeTexRect(xh,yh,flip,tile,xl,yl,s,t,dsdx,dtdy) \ + G_TEXRECT, xh, yh, 0, flip, 0, tile, xl, yl, s, t, dsdx, dtdy + +/* + * Textured rectangles are 128 bits not 64 bits + */ +typedef struct { + unsigned long w0; + unsigned long w1; + unsigned long w2; + unsigned long w3; +} TexRect; + +typedef struct { + int cmd : 8; + unsigned int pad : 4; + unsigned int len : 8; /* n */ + unsigned int pad2 : 4; + unsigned char par; /* v0 */ + unsigned int addr; +} Gvtx; + +/* + * Generic Gfx Packet + */ +typedef struct { + unsigned int w0; + unsigned int w1; +} Gwords; + +/* + * This union is the fundamental type of the display list. + * It is, by law, exactly 64 bits in size. + */ +typedef union { + Gwords words; + Gnoop noop; + Gdma dma; + Gdma2 dma2; + Gvtx vtx; + Gtri tri; + Gtri2 tri2; + Gquad quad; + Gcull cull; + Gmovewd movewd; + Gmovemem movemem; + Gpopmtx popmtx; + Gsegment segment; + GsetothermodeH setothermodeH; + GsetothermodeL setothermodeL; + Gtexture texture; + Gperspnorm perspnorm; + Gsetimg setimg; + Gsetcombine setcombine; + Gsetcolor setcolor; + Gfillrect fillrect; /* use for setscissor also */ + Gsettile settile; + Gloadtile loadtile; /* use for loadblock also, th is dxt */ + Gsettilesize settilesize; + Gloadtlut loadtlut; + Gsetprimdepth setprimdepth; + long long int force_structure_alignment; +} Gfx; + +/* + * Macros to assemble the graphics display list + */ + +/* + * DMA macros + */ +#define gDma0p(pkt, c, s, l) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL((c), 24, 8) | \ + _SHIFTL((l), 0, 24)); \ + _g->words.w1 = (unsigned int)(s); \ +}) + +#define gsDma0p(c, s, l) \ +{ \ + (_SHIFTL((c), 24, 8) | \ + _SHIFTL((l), 0, 24)), \ + (unsigned int)(s) \ +} + +#define gDma1p(pkt, c, s, l, p) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL((c), 24, 8) | \ + _SHIFTL((p), 16, 8) | \ + _SHIFTL((l), 0, 16)); \ + _g->words.w1 = (unsigned int)(s); \ +}) + +#define gsDma1p(c, s, l, p) \ +{ \ + (_SHIFTL((c), 24, 8) | \ + _SHIFTL((p), 16, 8) | \ + _SHIFTL((l), 0, 16)), \ + (unsigned int)(s) \ +} + +#define gDma2p(pkt, c, adrs, len, idx, ofs) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL((c), 24, 8) | \ + _SHIFTL(((len) - 1) / 8, 19, 5) | \ + _SHIFTL((ofs) / 8, 8, 8) | \ + _SHIFTL((idx), 0, 8)); \ + _g->words.w1 = (unsigned int)(adrs); \ +}) + +#define gsDma2p(c, adrs, len, idx, ofs) \ +{ \ + (_SHIFTL((c), 24, 8) | \ + _SHIFTL(((len) - 1) / 8, 19, 5) | \ + _SHIFTL((ofs) / 8, 8, 8) | \ + _SHIFTL((idx), 0, 8)), \ + (unsigned int)(adrs) \ +} + +#define gSPNoOp(pkt) gDma0p(pkt, G_SPNOOP, 0, 0) +#define gsSPNoOp() gsDma0p( G_SPNOOP, 0, 0) + +#define gSPMatrix(pkt, m, p) \ + gDma2p((pkt),G_MTX, (m), sizeof(Mtx), (p) ^ G_MTX_PUSH, 0) +#define gsSPMatrix(m, p) \ + gsDma2p( G_MTX, (m), sizeof(Mtx), (p) ^ G_MTX_PUSH, 0) + +#define gSPPopMatrixN(pkt, n, num) gDma2p((pkt), G_POPMTX, (num) * 64, 64, 2, 0) +#define gsSPPopMatrixN(n, num) gsDma2p( G_POPMTX, (num) * 64, 64, 2, 0) +#define gSPPopMatrix(pkt, n) gSPPopMatrixN((pkt), (n), 1) +#define gsSPPopMatrix(n) gsSPPopMatrixN( (n), 1) + +/* + * +--------+----+---+---+----+------+-+ + * G_VTX | cmd:8 |0000| n:8 |0000|v0+n:7|0| + * +-+---+--+----+---+---+----+------+-+ + * | |seg| address | + * +-+---+-----------------------------+ + */ +#define gSPVertex(pkt, v, n, v0) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_VTX, 24, 8) | \ + _SHIFTL((n), 12, 8) | \ + _SHIFTL((v0) + (n), 1, 7)); \ + _g->words.w1 = (unsigned int)(v); \ +}) + +#define gsSPVertex(v, n, v0) \ +{ \ + (_SHIFTL(G_VTX, 24, 8) | \ + _SHIFTL((n), 12, 8) | \ + _SHIFTL((v0) + (n), 1, 7)), \ + (unsigned int)(v) \ +} + +#define gSPViewport(pkt, v) \ + gDma2p((pkt), G_MOVEMEM, (v), sizeof(Vp), G_MV_VIEWPORT, 0) +#define gsSPViewport(v) \ + gsDma2p( G_MOVEMEM, (v), sizeof(Vp), G_MV_VIEWPORT, 0) + +/* + * Display list control flow + */ + +#define _gSPDisplayListRaw(pkt,dl,hint) gDma1p(pkt, G_DL, dl, hint, G_DL_PUSH) +#define _gsSPDisplayListRaw( dl,hint) gsDma1p( G_DL, dl, hint, G_DL_PUSH) + +#define _gSPBranchListRaw(pkt,dl,hint) gDma1p(pkt, G_DL, dl, hint, G_DL_NOPUSH) +#define _gsSPBranchListRaw( dl,hint) gsDma1p( G_DL, dl, hint, G_DL_NOPUSH) + +#define _gSPEndDisplayListRaw(pkt,hint) gDma0p(pkt, G_ENDDL, 0, hint) +#define _gsSPEndDisplayListRaw(hint) gsDma0p( G_ENDDL, 0, hint) + +/* + * Converts a total expected count of DL commands to a number of bytes to + * initially NOT load into the DL command buffer. + */ +#define _DLHINTVALUE(count) \ + (((count) > 0 && ((count) % G_INPUT_BUFFER_CMDS) > 0) ? \ + ((G_INPUT_BUFFER_CMDS - ((count) % G_INPUT_BUFFER_CMDS)) << 3) : 0) + +/* + * Optimization for reduced memory traffic. In count, put the estimated number + * of DL commands in the target DL (the DL being called / jumped to, or the DL + * being returned to, starting from the next command to be executed) up to and + * including the next call / jump / return. Normally, for SPDisplayList, this is + * just the total number of commands in the target DL. The actual on-screen + * result will not change regardless of the value of count, but the performance + * will be best if count is correct, and potentially worse than not specifying + * count if it is wrong. + * Feature suggested by Kaze Emanuar +*/ + +#define gSPDisplayListHint(pkt, dl, count) _gSPDisplayListRaw(pkt, dl, _DLHINTVALUE(count)) +#define gsSPDisplayListHint( dl, count) _gsSPDisplayListRaw( dl, _DLHINTVALUE(count)) + +#define gSPBranchListHint(pkt, dl, count) _gSPBranchListRaw( pkt, dl, _DLHINTVALUE(count)) +#define gsSPBranchListHint( dl, count) _gsSPBranchListRaw( dl, _DLHINTVALUE(count)) + +#define gSPEndDisplayListHint(pkt, count) _gSPEndDisplayListRaw( pkt, _DLHINTVALUE(count)) +#define gsSPEndDisplayListHint( count) _gsSPEndDisplayListRaw( _DLHINTVALUE(count)) + +/* + * Normal control flow commands; same as above but with hint of 0 + */ + +#define gSPDisplayList(pkt, dl) _gSPDisplayListRaw(pkt, dl, 0) +#define gsSPDisplayList( dl) _gsSPDisplayListRaw( dl, 0) + +#define gSPBranchList(pkt, dl) _gSPBranchListRaw( pkt, dl, 0) +#define gsSPBranchList( dl) _gsSPBranchListRaw( dl, 0) + +#define gSPEndDisplayList(pkt) _gSPEndDisplayListRaw( pkt, 0) +#define gsSPEndDisplayList( ) _gsSPEndDisplayListRaw( 0) + + +/* + * gSPLoadUcode RSP loads specified ucode. + * + * uc_start = ucode text section start + * uc_dstart = ucode data section start + */ +#define gSPLoadUcodeEx(pkt, uc_start, uc_dstart, uc_dsize) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = _SHIFTL(G_RDPHALF_1, 24, 8); \ + _g->words.w1 = (unsigned int)(uc_dstart); \ + \ + _g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_LOAD_UCODE, 24, 8) | \ + _SHIFTL((int)(uc_dsize) - 1, 0, 16)); \ + _g->words.w1 = (unsigned int)(uc_start); \ +}) + +#define gsSPLoadUcodeEx(uc_start, uc_dstart, uc_dsize) \ +{ \ + _SHIFTL(G_RDPHALF_1, 24, 8), \ + (unsigned int)(uc_dstart), \ +}, \ +{ \ + (_SHIFTL(G_LOAD_UCODE, 24, 8) | \ + _SHIFTL((int)(uc_dsize) - 1, 0, 16)), \ + (unsigned int)(uc_start), \ +} + +#define gSPLoadUcode(pkt, uc_start, uc_dstart) \ + gSPLoadUcodeEx((pkt), (uc_start), (uc_dstart), SP_UCODE_DATA_SIZE) +#define gsSPLoadUcode(uc_start, uc_dstart) \ + gsSPLoadUcodeEx((uc_start), (uc_dstart), SP_UCODE_DATA_SIZE) + +#define gSPLoadUcodeL(pkt, ucode) \ + gSPLoadUcode((pkt), OS_K0_TO_PHYSICAL(& ucode##TextStart), \ + OS_K0_TO_PHYSICAL(& ucode##DataStart)) +#define gsSPLoadUcodeL(ucode) \ + gsSPLoadUcode( OS_K0_TO_PHYSICAL(& ucode##TextStart), \ + OS_K0_TO_PHYSICAL(& ucode##DataStart)) + +/* + * gSPDma_io DMA to/from DMEM/IMEM for DEBUG. + */ +#define gSPDma_io(pkt, flag, dmem, dram, size) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_DMA_IO, 24, 8) | \ + _SHIFTL((flag), 23, 1) | \ + _SHIFTL((dmem) / 8, 13, 10) | \ + _SHIFTL((size) - 1, 0, 12)); \ + _g->words.w1 = (unsigned int)(dram); \ +}) + +#define gsSPDma_io(flag, dmem, dram, size) \ +{ \ + (_SHIFTL(G_DMA_IO, 24, 8) | \ + _SHIFTL((flag), 23, 1) | \ + _SHIFTL((dmem) / 8, 13, 10) | \ + _SHIFTL((size) - 1, 0, 12)), \ + (unsigned int)(dram) \ +} + +#define gSPDmaRead(pkt,dmem,dram,size) gSPDma_io((pkt),0,(dmem),(dram),(size)) +#define gsSPDmaRead(dmem,dram,size) gsSPDma_io( 0,(dmem),(dram),(size)) +#define gSPDmaWrite(pkt,dmem,dram,size) gSPDma_io((pkt),1,(dmem),(dram),(size)) +#define gsSPDmaWrite(dmem,dram,size) gsSPDma_io( 1,(dmem),(dram),(size)) + + +/* + * RSP short command (no DMA required) macros + */ +#define gImmp0(pkt, c) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = _SHIFTL((c), 24, 8); \ +}) + +#define gsImmp0(c) \ +{ \ + _SHIFTL((c), 24, 8) \ +} + +#define gImmp1(pkt, c, p0) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = _SHIFTL((c), 24, 8); \ + _g->words.w1 = (unsigned int)(p0); \ +}) + +#define gsImmp1(c, p0) \ +{ \ + _SHIFTL((c), 24, 8), \ + (unsigned int)(p0) \ +} + +#define gImmp2(pkt, c, p0, p1) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = _SHIFTL((c), 24, 8); \ + _g->words.w1 = (_SHIFTL((p0), 16, 16) | \ + _SHIFTL((p1), 8, 8)); \ +}) + +#define gsImmp2(c, p0, p1) \ +{ \ + _SHIFTL((c), 24, 8), \ + (_SHIFTL((p0), 16, 16) | \ + _SHIFTL((p1), 8, 8)) \ +} + +#define gImmp3(pkt, c, p0, p1, p2) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = _SHIFTL((c), 24, 8); \ + _g->words.w1 = (_SHIFTL((p0), 16, 16) | \ + _SHIFTL((p1), 8, 8) | \ + _SHIFTL((p2), 0, 8)); \ +}) + +#define gsImmp3(c, p0, p1, p2) \ +{ \ + _SHIFTL((c), 24, 8), \ + (_SHIFTL((p0), 16, 16) | \ + _SHIFTL((p1), 8, 8) | \ + _SHIFTL((p2), 0, 8)) \ +} + +#define gImmp21(pkt, c, p0, p1, dat) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL((c), 24, 8) | \ + _SHIFTL((p0), 8, 16) | \ + _SHIFTL((p1), 0, 8)); \ + _g->words.w1 = (unsigned int) (dat); \ +}) + +#define gsImmp21(c, p0, p1, dat) \ +{ \ + (_SHIFTL((c), 24, 8) | \ + _SHIFTL((p0), 8, 16) | \ + _SHIFTL((p1), 0, 8)), \ + (unsigned int) (dat) \ +} + +#define gMoveWd(pkt, index, offset, data) \ + gDma1p((pkt), G_MOVEWORD, data, (offset & 0xFFF), index) +#define gsMoveWd( index, offset, data) \ + gsDma1p( G_MOVEWORD, data, (offset & 0xFFF), index) + +#define gMoveHalfwd(pkt, index, offset, data) \ + gDma1p((pkt), G_MOVEWORD, data, (offset & 0xFFF) | G_MW_HALFWORD_FLAG, index) +#define gsMoveHalfwd( index, offset, data) \ + gsDma1p( G_MOVEWORD, data, (offset & 0xFFF) | G_MW_HALFWORD_FLAG, index) + + +/* + * Triangle commands + */ + +#define __gsSP1Triangle_w1(v0, v1, v2) \ + (_SHIFTL((v0) * 2, 16, 8) | \ + _SHIFTL((v1) * 2, 8, 8) | \ + _SHIFTL((v2) * 2, 0, 8)) + +#define __gsSP1Triangle_w1f(v0, v1, v2, flag) \ + (((flag) == 0) ? __gsSP1Triangle_w1(v0, v1, v2) : \ + ((flag) == 1) ? __gsSP1Triangle_w1(v1, v2, v0) : \ + __gsSP1Triangle_w1(v2, v0, v1)) + +#define __gsSP1Quadrangle_w1f(v0, v1, v2, v3, flag) \ + (((flag) == 0) ? __gsSP1Triangle_w1(v0, v1, v2) : \ + ((flag) == 1) ? __gsSP1Triangle_w1(v1, v2, v3) : \ + ((flag) == 2) ? __gsSP1Triangle_w1(v2, v3, v0) : \ + __gsSP1Triangle_w1(v3, v0, v1)) + +#define __gsSP1Quadrangle_w2f(v0, v1, v2, v3, flag) \ + (((flag) == 0) ? __gsSP1Triangle_w1(v0, v2, v3) : \ + ((flag) == 1) ? __gsSP1Triangle_w1(v1, v3, v0) : \ + ((flag) == 2) ? __gsSP1Triangle_w1(v2, v0, v1) : \ + __gsSP1Triangle_w1(v3, v1, v2)) + + +/*** + *** 1 Triangle + ***/ +#define gSP1Triangle(pkt, v0, v1, v2, flag) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + _g->words.w0 = (_SHIFTL(G_TRI1, 24, 8) | \ + __gsSP1Triangle_w1f(v0, v1, v2, flag)); \ + _g->words.w1 = 0; \ +}) +#define gsSP1Triangle(v0, v1, v2, flag) \ +{ \ + (_SHIFTL(G_TRI1, 24, 8) | \ + __gsSP1Triangle_w1f(v0, v1, v2, flag)), \ + 0 \ +} + +/*** + *** 1 Quadrangle + ***/ +#define gSP1Quadrangle(pkt, v0, v1, v2, v3, flag) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + _g->words.w0 = (_SHIFTL(G_QUAD, 24, 8) | \ + __gsSP1Quadrangle_w1f(v0, v1, v2, v3, flag)); \ + _g->words.w1 = (__gsSP1Quadrangle_w2f(v0, v1, v2, v3, flag)); \ +}) + +#define gsSP1Quadrangle(v0, v1, v2, v3, flag) \ +{ \ + (_SHIFTL(G_QUAD, 24, 8) | \ + __gsSP1Quadrangle_w1f(v0, v1, v2, v3, flag)), \ + __gsSP1Quadrangle_w2f(v0, v1, v2, v3, flag) \ +} + +/*** + *** 2 Triangles + ***/ +#define gSP2Triangles(pkt, v00, v01, v02, flag0, v10, v11, v12, flag1) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + _g->words.w0 = (_SHIFTL(G_TRI2, 24, 8) | \ + __gsSP1Triangle_w1f(v00, v01, v02, flag0)); \ + _g->words.w1 = __gsSP1Triangle_w1f(v10, v11, v12, flag1); \ +}) + +#define gsSP2Triangles(v00, v01, v02, flag0, v10, v11, v12, flag1) \ +{ \ + (_SHIFTL(G_TRI2, 24, 8) | \ + __gsSP1Triangle_w1f(v00, v01, v02, flag0)), \ + __gsSP1Triangle_w1f(v10, v11, v12, flag1) \ +} + +/* + * 5 Triangles base commands + */ +#define _gSP5Triangles(pkt, cmd, v1, v2, v3, v4, v5, v6, v7) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + _g->words.w0 = (_SHIFTL(cmd, 24, 8) | \ + _SHIFTL((v1)*2, 16, 8) | \ + _SHIFTL((v2)*2, 8, 8) | \ + _SHIFTL((v3)*2, 0, 8)); \ + _g->words.w1 = (_SHIFTL((v4)*2, 24, 8) | \ + _SHIFTL((v5)*2, 16, 8) | \ + _SHIFTL((v6)*2, 8, 8) | \ + _SHIFTL((v7)*2, 0, 8)); \ +}) +#define _gsSP5Triangles(cmd, v1, v2, v3, v4, v5, v6, v7) \ +{ \ + (_SHIFTL(cmd, 24, 8) | \ + _SHIFTL((v1)*2, 16, 8) | \ + _SHIFTL((v2)*2, 8, 8) | \ + _SHIFTL((v3)*2, 0, 8)), \ + (_SHIFTL((v4)*2, 24, 8) | \ + _SHIFTL((v5)*2, 16, 8) | \ + _SHIFTL((v6)*2, 8, 8) | \ + _SHIFTL((v7)*2, 0, 8)) \ +}) +/* + * 5 Triangles in strip arrangement. Draws the following tris: + * v1-v2-v3, v3-v2-v4, v3-v4-v5, v5-v4-v6, v5-v6-v7 + * If you want to draw fewer tris, set indices to -1 from the right. + * e.g. to draw 4 tris, set v7 to -1; to draw 3 tris, set v6 to -1 + * Note that any set of 3 adjacent tris can be drawn with either SPTriStrip + * or SPTriFan. For arbitrary sets of 4 adjacent tris, four out of five of them + * can be drawn with one of SPTriStrip or SPTriFan. The 4-triangle formation + * which can't be drawn with either command looks like the Triforce. + */ +#define gSPTriStrip(pkt, v1, v2, v3, v4, v5, v6, v7) \ + _gSP5Triangles(pkt, G_TRISTRIP, v1, v2, v3, v4, v5, v6, v7) +#define gsSPTriStrip(v1, v2, v3, v4, v5, v6, v7) \ + _gsSP5Triangles(G_TRISTRIP, v1, v2, v3, v4, v5, v6, v7) +/* + * 5 Triangles in fan arrangement. Draws the following tris: + * v1-v2-v3, v1-v3-v4, v1-v4-v5, v1-v5-v6, v1-v6-v7 + * Otherwise works the same as SPTriStrip, see above. + */ +#define gSPTriFan(pkt, v1, v2, v3, v4, v5, v6, v7) \ + _gSP5Triangles(pkt, G_TRIFAN, v1, v2, v3, v4, v5, v6, v7) +#define gsSPTriFan(v1, v2, v3, v4, v5, v6, v7) \ + _gsSP5Triangles(G_TRIFAN, v1, v2, v3, v4, v5, v6, v7) + + +/* + * Moveword commands + */ +/* not strictly a moveword command anymore */ +#define gSPSegment(pkt, segment, base) \ + gDma1p((pkt), G_RELSEGMENT, (base), ((segment) * 4) & 0xFFF, G_MW_SEGMENT) +#define gsSPSegment(segment, base) \ + gsDma1p( G_RELSEGMENT, (base), ((segment) * 4) & 0xFFF, G_MW_SEGMENT) + +#define gSPPerspNormalize(pkt, s) gMoveHalfwd(pkt, G_MW_FX, G_MWO_PERSPNORM, (s)) +#define gsSPPerspNormalize(s) gsMoveHalfwd( G_MW_FX, G_MWO_PERSPNORM, (s)) + +/* + * Clipping Macros - Deprecated, encodes SP no-ops + * It is not possible to change the clip ratio from 2 in F3DEX3. + */ +#define gSPClipRatio(pkt, r) gSPNoOp(pkt) +#define gsSPClipRatio(r) gsSPNoOp() + +/* + * Load new MVP matrix directly. + * This is no longer supported as there is no MVP matrix in F3DEX3. + */ +#define gSPForceMatrix(pkt, mptr) gSPNoOp(pkt) +#define gsSPForceMatrix(mptr) gsSPNoOp() + +/* + * Ambient occlusion + * Enabled with the G_AMBOCCLUSION bit in geometry mode. + * Each of these factors sets how much ambient occlusion affects lights of + * the given type (ambient, directional, point). They are u16s. + * You can set each independently or two adjacent values with one moveword. + * A two-command macro is also provided to set all three values. + * + * When building the model, you must encode the amount of ambient occlusion at + * each vertex--effectively the shadow map for the model--in vertex alpha, where + * 00 means darkest and FF means lightest. Then, the factors set with the + * SPAmbOcclusion command determine how much the vertex alpha values affect the + * light intensity. For example, if the ambient factor is set to 0x8000, this + * means that in the darkest parts of the model, the ambient light intensity + * will be reduced by 50%, and in the lightest parts of the model, the ambient + * light intensity won't be reduced at all. + * + * The default is: + * amb = 0xFFFF (ambient light fully affected by vertex alpha) + * dir = 0xA000 (directional lights 62% affected by vertex alpha) + * point = 0 (point lights not at all affected by vertex alpha) + * + * Two reasons to use ambient occlusion rather than darkening the vertex colors: + * - With ambient occlusion, the geometry can be fully lit up with point and/or + * directional lights, depending on your settings here. + * - Ambient occlusion can be used with cel shading to create areas which are + * "darker" for the cel shading thresholds, but still have bright / white + * vertex colors. + * + * Two reasons to use these factors to modify ambient occlusion rather than + * just manually scaling and offsetting all the vertex alpha values: + * - To allow the behavior to differ between ambient, directional, and point + * lights + * - To allow the lighting to be adjusted at the scene level on-the-fly + */ + +#define gSPAmbOcclusionAmb(pkt, amb) gMoveHalfwd(pkt, G_MW_FX, G_MWO_AO_AMBIENT, amb) +#define gsSPAmbOcclusionAmb(amb) gsMoveHalfwd( G_MW_FX, G_MWO_AO_AMBIENT, amb) +#define gSPAmbOcclusionDir(pkt, dir) gMoveHalfwd(pkt, G_MW_FX, G_MWO_AO_DIRECTIONAL, dir) +#define gsSPAmbOcclusionDir(dir) gsMoveHalfwd( G_MW_FX, G_MWO_AO_DIRECTIONAL, dir) +#define gSPAmbOcclusionPoint(pkt, point) gMoveHalfwd(pkt, G_MW_FX, G_MWO_AO_POINT, point) +#define gsSPAmbOcclusionPoint(point) gsMoveHalfwd( G_MW_FX, G_MWO_AO_POINT, point) + +#define gSPAmbOcclusionAmbDir(pkt, amb, dir) \ + gMoveWd(pkt, G_MW_FX, G_MWO_AO_AMBIENT, \ + (_SHIFTL((amb), 16, 16) | _SHIFTL((dir), 0, 16))) +#define gsSPAmbOcclusionAmbDir(amb, dir) \ + gsMoveWd(G_MW_FX, G_MWO_AO_AMBIENT, \ + (_SHIFTL((amb), 16, 16) | _SHIFTL((dir), 0, 16))) +#define gSPAmbOcclusionDirPoint(pkt, dir, point) \ + gMoveWd(pkt, G_MW_FX, G_MWO_AO_DIRECTIONAL, \ + (_SHIFTL((dir), 16, 16) | _SHIFTL((point), 0, 16))) +#define gsSPAmbOcclusionDirPoint(dir, point) \ + gsMoveWd(G_MW_FX, G_MWO_AO_DIRECTIONAL, \ + (_SHIFTL((dir), 16, 16) | _SHIFTL((point), 0, 16))) + +#define gSPAmbOcclusion(pkt, amb, dir, point) \ +_DW({ \ + gSPAmbOcclusionAmbDir(pkt, amb, dir); \ + gSPAmbOcclusionPoint(pkt, point); \ +}) +#define gsSPAmbOcclusion(amb, dir, point) \ + gsSPAmbOcclusionAmbDir(amb, dir), \ + gsSPAmbOcclusionPoint(point) + +/* + * Fresnel - Feature suggested by thecozies + * Enabled with the G_FRESNEL bit in geometry mode. + * The dot product between a vertex normal and the vector from the vertex to the + * camera is computed. The offset and scale here convert this to a shade alpha + * value. This is useful for making surfaces fade between transparent when + * viewed straight-on and opaque when viewed at a large angle, or for applying a + * fake "outline" around the border of meshes. + * + * If using Fresnel, you need to set the camera world position whenever you set + * the VP matrix, viewport, etc. See SPCameraWorld. + * + * The RSP does: + * s16 dotProduct = dot(vertex normal, camera pos - vertex pos); + * dotProduct = abs(dotProduct); // 0 = points to side, 7FFF = points at or away + * s32 factor = ((scale * dotProduct) >> 15) + offset; + * s16 result = clamp(factor << 8, 0, 7FFF); + * color_or_alpha = result >> 7; + * + * At dotMax, color_or_alpha = FF, result = 7F80, factor = 7F + * At dotMin, color_or_alpha = 00, result = 0, factor = 0 + * 7F = ((scale * dotMax) >> 15) + offset + * 00 = ((scale * dotMin) >> 15) + offset + * Subtract: 7F = (scale * (dotMax - dotMin)) >> 15 + * 3F8000 = scale * (dotMax - dotMin) + * scale = 3F8000 / (dotMax - dotMin) <-- + * offset = -(((3F8000 / (dotMax - dotMin)) * dotMin) >> 15) + * offset = -((7F * dotMin) / (dotMax - dotMin)) <-- + * + * To convert in the opposite direction: + * ((7F - offset) << 15) / scale = dotMax + * ((00 - offset) << 15) / scale = dotMin + */ +#define gSPFresnelScale(pkt, scale) \ + gMoveHalfwd(pkt, G_MW_FX, G_MWO_FRESNEL_SCALE, scale) +#define gsSPFresnelScale(scale) \ + gsMoveHalfwd(G_MW_FX, G_MWO_FRESNEL_SCALE, scale) +#define gSPFresnelOffset(pkt, offset) \ + gMoveHalfwd(pkt, G_MW_FX, G_MWO_FRESNEL_OFFSET, offset) +#define gsSPFresnelOffset(offset) \ + gsMoveHalfwd(G_MW_FX, G_MWO_FRESNEL_OFFSET, offset) +#define gSPFresnel(pkt, scale, offset) \ + gMoveWd(pkt, G_MW_FX, G_MWO_FRESNEL_SCALE, \ + (_SHIFTL((scale), 16, 16) | _SHIFTL((offset), 0, 16))) +#define gsSPFresnel(scale, offset) \ + gsMoveWd(G_MW_FX, G_MWO_FRESNEL_SCALE, \ + (_SHIFTL((scale), 16, 16) | _SHIFTL((offset), 0, 16))) + +/* + * Attribute offsets + * These are added to ST or Z values after vertices are loaded and transformed. + * They are all s16s. + * For ST, the addition is after the multiplication for ST scale in SPTexture. + * For Z, this simply adds to the Z offset from the viewport. + * Whether each feature is enabled or disabled at a given time is determined + * by the G_ATTROFFSET_ST_ENABLE and G_ATTROFFSET_Z_ENABLE bits respectively in + * the geometry mode. + * Normally you would use ST offsets for UV scrolling, and you would use a Z + * offset of -2 (which it is set to by default) to fix decal mode. For the + * latter, enable the Z offset and set the Z mode to opaque. + */ +#define gSPAttrOffsetST(pkt, s, t) \ + gMoveWd(pkt, G_MW_FX, G_MWO_ATTR_OFFSET_S, \ + (_SHIFTL((s), 16, 16) | _SHIFTL((t), 0, 16))) +#define gsSPAttrOffsetST(s, t) \ + gsMoveWd(G_MW_FX, G_MWO_ATTR_OFFSET_S, \ + (_SHIFTL((s), 16, 16) | _SHIFTL((t), 0, 16))) +#define gSPAttrOffsetZ(pkt, z) \ + gMoveHalfwd(pkt, G_MW_FX, G_MWO_ATTR_OFFSET_Z, z) +#define gsSPAttrOffsetZ(z) \ + gsMoveHalfwd(G_MW_FX, G_MWO_ATTR_OFFSET_Z, z) + +/* + * Alpha compare culling. Optimization for cel shading, could also be used for + * other scenarios where lots of tris are being drawn with alpha compare. + * + * If mode == G_ALPHA_COMPARE_CULL_DISABLE, tris are drawn normally. + * + * Otherwise: + * - "vertex alpha" means the post-transform alpha value at each vertex being + * sent to the RDP. This may be the original model vertex alpha, fog, light + * level (for cel shading), or Fresnel. + * - Assuming a cel shading context: you have a threshold value thresh, you draw + * tris once and want to write all pixels where shade alpha >= thresh. Then + * you change color settings and draw tris again, and want to write all other + * pixels, i.e. where shade alpha < thresh. + * + * For the light pass: + * - Set blend color alpha to thresh + * - Set CC alpha cycle 1 (or only cycle) to (shade alpha - 0) * tex alpha + 0 + * - The RDP will draw pixels whenever shade alpha >= thresh (with binary alpha + * from the texture) + * - Set mode = G_ALPHA_COMPARE_CULL_BELOW in SPAlphaCompareCull, and thresh + * - The RSP will cull any tris where all three vertex alpha values (i.e. light + * level) are < thresh + * + * For the dark pass: + * - Set blend color alpha to 0x100 - thresh (yes, not 0xFF - thresh). + * - Set CC alpha cycle 1 (or only cycle) to (1 - shade alpha) * tex alpha + 0 + * - The RDP will draw pixels whenever shade alpha < thresh (with binary alpha + * from the texture) + * - Set mode = G_ALPHA_COMPARE_CULL_ABOVE in SPAlphaCompareCull, and thresh + * - The RSP will cull any tris where all three vertex alpha values (i.e. light + * level) are >= thresh + * + * The idea is to cull tris early on the RSP which won't have any of their + * fragments drawn on the RDP, to save RDP time and memory bandwidth. + */ +#define gSPAlphaCompareCull(pkt, mode, thresh) \ + gMoveHalfwd(pkt, G_MW_FX, G_MWO_ALPHA_COMPARE_CULL, \ + (_SHIFTL((mode), 8, 8) | _SHIFTL((thresh), 0, 8))) +#define gsSPAlphaCompareCull(mode, thresh) \ + gsMoveHalfwd(G_MW_FX, G_MWO_ALPHA_COMPARE_CULL, \ + (_SHIFTL((mode), 8, 8) | _SHIFTL((thresh), 0, 8))) + +/* + * Normals mode: How to handle transformation of vertex normals from model to + * world space for lighting. + * + * If mode = G_NORMALS_MODE_FAST, transforms normals from model space to world + * space with the M matrix. This is correct if the object's transformation + * matrix stack only included translations, rotations, and uniform scale (i.e. + * same scale in X, Y, and Z); otherwise, if the transformation matrix has + * nonuniform scale or shear, the lighting on the object will be somewhat + * distorted. + * + * If mode = G_NORMALS_MODE_AUTO, transforms normals from model space to world + * space with M inverse transpose, which renders lighting correctly for the + * object regardless of its transformation matrix (nonuniform scale or shear is + * okay). Whenever vertices are drawn with lighting enabled after M has been + * changed, computes M inverse transpose from M. This requires swapping to + * overlay 4 for M inverse transpose and then back to overlay 2 for lighting, + * which produces roughly 3.5 us of extra DRAM traffic. This performance penalty + * happens effectively once per matrix, which is once per normal object or + * separated limb or about twice per flex skeleton limb. So in a scene with lots + * of complex skeletons, this may have a noticeable performance impact. + * + * If mode = G_NORMALS_MODE_MANUAL, uses M inverse transpose for correct results + * like G_NORMALS_MODE_AUTO, but it never internally computes M inverse + * transpose. You have to upload M inverse transpose to the RSP using + * SPMITMatrix every time you change the M matrix. The DRAM traffic for the + * extra matrix uploads is much smaller than the overlay swaps, so if you can + * efficiently compute M inverse transpose on the CPU, this may be faster than + * G_NORMALS_MODE_AUTO. + * + * Recommended to leave this set to G_NORMALS_MODE_FAST generally, and only set + * it to G_NORMALS_MODE_AUTO for specific objects at times when they actually + * have a nonuniform scale. For example, G_NORMALS_MODE_FAST for Mario + * generally, but G_NORMALS_MODE_AUTO temporarily while he is squashed. + */ +#define gSPNormalsMode(pkt, mode) \ + gMoveHalfwd(pkt, G_MW_FX, G_MWO_NORMALS_MODE, (mode) & 0xFF) +#define gsSPNormalsMode(mode) \ + gsMoveHalfwd(G_MW_FX, G_MWO_NORMALS_MODE, (mode) & 0xFF) + +typedef union { + struct { + s16 intPart[3][4]; /* Fourth row containing translations is omitted. */ + u16 fracPart[3][4]; /* Also the fourth column data is ignored, need not be 0. */ + }; + long long int force_structure_alignment; +} MITMtx; + +/* + * See SPNormalsMode. mtx is the address of a MITMtx (M inverse transpose). + * + * The matrix values must be scaled down so that the matrix norm is <= 1, + * i.e. multiplying this matrix by any vector length <= 1 must produce a vector + * with length <= 1. Normally, M scales things down substantially, so M inverse + * transpose natively would scale them up substantially; you need to apply a + * constant scale to counteract this. One easy way to do this is compute M + * inverse transpose normally, then scale it so until the maximum absolute + * value of any element is 0.5. Because of this scaling, you can also skip the + * part of the inverse computation where you compute the determinant and divide + * by it, cause you're going to rescale it arbitrarily anyway. + */ +#define gSPMITMatrix(pkt, mit) \ + gDma2p((pkt), G_MOVEMEM, (mit), sizeof(MITMtx), G_MV_MMTX, 0x80) +#define gsSPMITMatrix(mtx) \ + gsDma2p( G_MOVEMEM, (mit), sizeof(MITMtx), G_MV_MMTX, 0x80) + + +/* + * Insert values into Vertices + * + * vtx = vertex number 0-55 + * where = which element of point to modify (byte offset into vertex) + * num = new value (32 bit) + */ +# define gSPModifyVertex(pkt, vtx, where, val) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_MODIFYVTX, 24, 8) | \ + _SHIFTL((where), 16, 8) | \ + _SHIFTL((vtx) * 2, 0, 16)); \ + _g->words.w1 = (unsigned int)(val); \ +}) +# define gsSPModifyVertex(vtx, where, val) \ +{ \ + (_SHIFTL(G_MODIFYVTX, 24, 8) | \ + _SHIFTL((where), 16, 8) | \ + _SHIFTL((vtx) * 2, 0, 16)), \ + (unsigned int)(val) \ +} + +/* + * Display list optimization / object culling + */ + +/* + * Cull the display list based on screen clip flags of range of loaded verts. + * Executes SPEndDisplayList if the convex hull formed by the specified range of + * already-loaded vertices is offscreen. + */ +#define gSPCullDisplayList(pkt,vstart,vend) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_CULLDL, 24, 8) | \ + _SHIFTL((vstart) * 2, 0, 16)); \ + _g->words.w1 = _SHIFTL((vend) * 2, 0, 16); \ +}) + +#define gsSPCullDisplayList(vstart,vend) \ +{ \ + (_SHIFTL(G_CULLDL, 24, 8) | \ + _SHIFTL((vstart) * 2, 0, 16)), \ + _SHIFTL((vend) * 2, 0, 16) \ +} + +/* + * gSPBranchLessZ Branch DL if (vtx.z) less than or equal (zval). + * Note that this uses W in F3DZEX / CFG_G_BRANCH_W, in which case all the + * Z calculations below are wrong and raw values must be used. + * + * dl = DL branch to + * vtx = Vertex + * zval = Screen depth + * near = Near plane + * far = Far plane + * flag = G_BZ_PERSP or G_BZ_ORTHO + */ + +/* From gu.h */ +#ifndef FTOFIX32 +# define FTOFIX32(x) (long)((x) * (float)0x00010000) +#endif + +#define G_BZ_PERSP 0 +#define G_BZ_ORTHO 1 + +#define G_DEPTOZSrg(zval, near, far, flag, zmin, zmax) \ + (((unsigned int)FTOFIX32(((flag) == G_BZ_PERSP ? \ + (1.0f - (float)(near) / (float)(zval)) / \ + (1.0f - (float)(near) / (float)(far )) : \ + ((float)(zval) - (float)(near)) / \ + ((float)(far ) - (float)(near))))) * \ + (((int)((zmax) - (zmin))) & ~1) + (int)FTOFIX32(zmin)) + +#define G_DEPTOZS(zval, near, far, flag) \ + G_DEPTOZSrg(zval, near, far, flag, 0, G_MAXZ) + +#define gSPBranchLessZrg(pkt, dl, vtx, zval, near, far, flag, zmin, zmax) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = _SHIFTL(G_RDPHALF_1, 24, 8); \ + _g->words.w1 = (unsigned int)(dl); \ + \ + _g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_BRANCH_Z, 24, 8) | \ + _SHIFTL((vtx) * 5, 12, 12) | \ + _SHIFTL((vtx) * 2, 0, 12)); \ + _g->words.w1 = G_DEPTOZSrg(zval, near, far, flag, zmin, zmax); \ +}) + +#define gsSPBranchLessZrg(dl, vtx, zval, near, far, flag, zmin, zmax) \ +{ \ + _SHIFTL(G_RDPHALF_1, 24, 8), \ + (unsigned int)(dl), \ +}, \ +{ \ + (_SHIFTL(G_BRANCH_Z, 24, 8) | \ + _SHIFTL((vtx) * 5, 12, 12) | \ + _SHIFTL((vtx) * 2, 0, 12)), \ + G_DEPTOZSrg(zval, near, far, flag, zmin, zmax), \ +} + +#define gSPBranchLessZ(pkt, dl, vtx, zval, near, far, flag) \ + gSPBranchLessZrg(pkt, dl, vtx, zval, near, far, flag, 0, G_MAXZ) +#define gsSPBranchLessZ(dl, vtx, zval, near, far, flag) \ + gsSPBranchLessZrg(dl, vtx, zval, near, far, flag, 0, G_MAXZ) + +/* + * gSPBranchLessZraw Branch DL if (vtx.z) less than or equal (raw zval). + * + * dl = DL branch to + * vtx = Vertex + * zval = Raw value of screen depth + */ +#define gSPBranchLessZraw(pkt, dl, vtx, zval) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = _SHIFTL(G_RDPHALF_1, 24, 8); \ + _g->words.w1 = (unsigned int)(dl); \ + \ + _g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_BRANCH_Z, 24, 8) | \ + _SHIFTL((vtx) * 5, 12, 12) | \ + _SHIFTL((vtx) * 2, 0, 12)); \ + _g->words.w1 = (unsigned int)(zval); \ +}) + +#define gsSPBranchLessZraw(dl, vtx, zval) \ +{ \ + _SHIFTL(G_RDPHALF_1, 24, 8), \ + (unsigned int)(dl), \ +}, \ +{ \ + (_SHIFTL(G_BRANCH_Z, 24, 8) | \ + _SHIFTL((vtx) * 5, 12, 12) | \ + _SHIFTL((vtx) * 2, 0, 12)), \ + (unsigned int)(zval), \ +} + + +/* + * Lighting Commands + */ + +#define NUML(n) ((n) * 0x10) +/* + * F3DEX3 properly supports zero lights, so there is no need to use these macros + * anymore. + */ +#define NUMLIGHTS_0 0 +#define NUMLIGHTS_1 1 +#define NUMLIGHTS_2 2 +#define NUMLIGHTS_3 3 +#define NUMLIGHTS_4 4 +#define NUMLIGHTS_5 5 +#define NUMLIGHTS_6 6 +#define NUMLIGHTS_7 7 +#define NUMLIGHTS_8 8 +#define NUMLIGHTS_9 9 + +/* + * Number of directional / point lights, in the range 0-9. There is also always + * one ambient light not counted in this number. + */ +#define gSPNumLights(pkt, n) \ + gMoveWd(pkt, G_MW_NUMLIGHT, G_MWO_NUMLIGHT, NUML(n)) +#define gsSPNumLights(n) \ + gsMoveWd( G_MW_NUMLIGHT, G_MWO_NUMLIGHT, NUML(n)) + +/* There is also no need to use these macros. */ +#define LIGHT_1 1 +#define LIGHT_2 2 +#define LIGHT_3 3 +#define LIGHT_4 4 +#define LIGHT_5 5 +#define LIGHT_6 6 +#define LIGHT_7 7 +#define LIGHT_8 8 +#define LIGHT_9 9 +#define LIGHT_10 10 + +/* + * l should point to a Light or PosLight struct. + * n should be an integer 1-9 to load lights 0-8. + * Can also load Ambient lights to lights 0-8 with this. However, if you have + * 9 directional / point lights, you must use SPAmbient to load light 9 + * (LIGHT_10) with an ambient light. (That is, the memory for light 9 (LIGHT_10) + * is only sizeof(Ambient), so if you load this with SPLight, it will overwrite + * other DMEM and corrupt unrelated things.) + * New code should not generally use SPLight, and instead use SPSetLights to set + * all lights in one memory transaction. + */ +#define _LIGHT_TO_OFFSET(n) (((n) - 1) * 0x10 + 0x10) /* The + 0x10 skips cam pos and lookat */ +#define gSPLight(pkt, l, n) \ + gDma2p((pkt), G_MOVEMEM, (l), sizeof(Light), G_MV_LIGHT, _LIGHT_TO_OFFSET(n)) +#define gsSPLight(l, n) \ + gsDma2p( G_MOVEMEM, (l), sizeof(Light), G_MV_LIGHT, _LIGHT_TO_OFFSET(n)) + +/* + * l should point to an Ambient struct. + * n should be an integer 1-10 to load lights 0-9. + */ +#define gSPAmbient(pkt, l, n) \ + gDma2p((pkt), G_MOVEMEM, (l), sizeof(Ambient), G_MV_LIGHT, _LIGHT_TO_OFFSET(n)) +#define gsSPAmbient(l, n) \ + gsDma2p( G_MOVEMEM, (l), sizeof(Ambient), G_MV_LIGHT, _LIGHT_TO_OFFSET(n)) + +/* + * gSPLightColor changes the color of a directional light without an additional + * DMA transfer. + * col is a 32 bit word where (col >> 24) & 0xFF is red, (col >> 16) & 0xFF is + * green, and (col >> 8) & 0xFF is blue. (col & 0xFF) is ignored and masked to + * zero. + * n should be an integer 1-10 to apply to light 0-9. + */ +#define gSPLightColor(pkt, n, col) \ +_DW({ \ + gMoveWd(pkt, G_MW_LIGHTCOL, (((n) - 1) * 0x10) + 0, ((col) & 0xFFFFFF00)); \ + gMoveWd(pkt, G_MW_LIGHTCOL, (((n) - 1) * 0x10) + 4, ((col) & 0xFFFFFF00)); \ +}) +#define gsSPLightColor(n, col) \ + gsMoveWd(G_MW_LIGHTCOL, (((n) - 1) * 0x10) + 0, ((col) & 0xFFFFFF00)), \ + gsMoveWd(G_MW_LIGHTCOL, (((n) - 1) * 0x10) + 4, ((col) & 0xFFFFFF00)) +/* + * Version for point lights. (col1 & 0xFF) must be set to the point light constant + * factor (must be nonzero), and (col2 & 0xFF) must be set to the point light + * linear factor. + * n should be an integer 1-10 to apply to light 0-9. + */ +#define _gSPLightColor2(pkt, n, col1, col2) \ +_DW({\ + gMoveWd(pkt, G_MW_LIGHTCOL, (((n) - 1) * 0x10) + 0, col1); \ + gMoveWd(pkt, G_MW_LIGHTCOL, (((n) - 1) * 0x10) + 4, col2); \ +}) +#define _gsSPLightColor2(n, col1, col2) \ + gsMoveWd(G_MW_LIGHTCOL, (((n) - 1) * 0x10) + 0, col1), \ + gsMoveWd(G_MW_LIGHTCOL, (((n) - 1) * 0x10) + 4, col2) + + +/* + * Set all your scene's lights (directional/point + ambient) with one memory + * transaction. + * n is the number of directional / point lights, from 0 to 9. There is also + * always an ambient light. + * name should be the NAME of a Lights or PosLights struct (NOT A POINTER) + * filled in with all the lighting data. You can use the gdSPDef* macros to fill + * in the struct or just do it manually. Example: + * PosLights2 myLights; // 2 pos + 1 ambient + * + * gSPSetLights(POLY_OPA_DISP++, 2, myLights); + * + * If you need to use a pointer, e.g. if the number of lights is variable at + * runtime: + * PosLight *lights = memory_allocate((numLights + 1) * sizeof(PosLight)); + * lights[0].p.pos = ...; + * lights[1].l.dir = ...; + * ... + * lights[numLights].l.col = ambient_color(); + * gSPSetLights(POLY_OPA_DISP++, numLights, *lights); // <- NOTE DEREFERENCE + * + * If you're wondering why this macro takes a name / dereference instead of a + * pointer, it's for backwards compatibility. + */ +#define gSPSetLights(pkt, n, name) \ +_DW({ \ + gSPNumLights(pkt, n); \ + gDma2p((pkt), G_MOVEMEM, &(name), (n) * 0x10 + 8, G_MV_LIGHT, 0x10); \ +}) +#define gsSPSetLights(n, name) \ + gsSPNumLights(n), \ + gsDma2p(G_MOVEMEM, &(name), (n) * 0x10 + 8, G_MV_LIGHT, 0x10) + +#define gSPSetLights0(pkt, name) gSPSetLights(pkt, 0, name) +#define gsSPSetLights0(name) gsSPSetLights( 0, name) +#define gSPSetLights1(pkt, name) gSPSetLights(pkt, 1, name) +#define gsSPSetLights1(name) gsSPSetLights( 1, name) +#define gSPSetLights2(pkt, name) gSPSetLights(pkt, 2, name) +#define gsSPSetLights2(name) gsSPSetLights( 2, name) +#define gSPSetLights3(pkt, name) gSPSetLights(pkt, 3, name) +#define gsSPSetLights3(name) gsSPSetLights( 3, name) +#define gSPSetLights4(pkt, name) gSPSetLights(pkt, 4, name) +#define gsSPSetLights4(name) gsSPSetLights( 4, name) +#define gSPSetLights5(pkt, name) gSPSetLights(pkt, 5, name) +#define gsSPSetLights5(name) gsSPSetLights( 5, name) +#define gSPSetLights6(pkt, name) gSPSetLights(pkt, 6, name) +#define gsSPSetLights6(name) gsSPSetLights( 6, name) +#define gSPSetLights7(pkt, name) gSPSetLights(pkt, 7, name) +#define gsSPSetLights7(name) gsSPSetLights( 7, name) +#define gSPSetLights8(pkt, name) gSPSetLights(pkt, 8, name) +#define gsSPSetLights8(name) gsSPSetLights( 8, name) +#define gSPSetLights9(pkt, name) gSPSetLights(pkt, 9, name) +#define gsSPSetLights9(name) gsSPSetLights( 9, name) + + +/* + * Camera world position for Fresnel and specular lighting. Set this whenever + * you set the VP matrix, viewport, etc. cam is the address of a PlainVtx struct. + */ +#define gSPCameraWorld(pkt, cam) \ + gDma2p((pkt), G_MOVEMEM, (cam), sizeof(PlainVtx), G_MV_LIGHT, 0) +#define gsSPCameraWorld(cam) \ + gsDma2p( G_MOVEMEM, (cam), sizeof(PlainVtx), G_MV_LIGHT, 0) + + +/* + * Reflection/Hiliting Macros. + * la is the address of a LookAt struct. + */ +#define gSPLookAt(pkt, la) \ + gDma2p((pkt), G_MOVEMEM, (la), sizeof(LookAt), G_MV_LIGHT, 8) +#define gsSPLookAt(la) \ + gsDma2p( G_MOVEMEM, (la), sizeof(LookAt), G_MV_LIGHT, 8) + +/* + * These versions are deprecated, please use g*SPLookAt. The two directions + * cannot be set independently anymore as they both fit within one memory word. + * (They could be set with moveword, but then the values would have to be within + * the command itself, not at a memory address.) + * This deprecated version has the X command set both (assuming l is the name / + * address of a LookAt struct) and has the Y command as a SP no-op. + */ +#define gSPLookAtX(pkt, l) gSPLookAt(pkt, l) +#define gsSPLookAtX(l) gsSPLookAt(l) +#define gSPLookAtY(pkt, l) gSPNoOp(pkt) +#define gsSPLookAtY(l) gsSPNoOp() + + +#define gDPSetHilite1Tile(pkt, tile, hilite, width, height) \ + gDPSetTileSize(pkt, tile, \ + (hilite)->h.x1 & 0xFFF, \ + (hilite)->h.y1 & 0xFFF, \ + ((((width) - 1) * 4) + (hilite)->h.x1) & 0xFFF, \ + ((((height) - 1) * 4) + (hilite)->h.y1) & 0xFFF) +#define gsDPSetHilite1Tile(tile, hilite, width, height) \ + gsDPSetTileSize(tile, \ + (hilite)->h.x1 & 0xFFF, \ + (hilite)->h.y1 & 0xFFF, \ + ((((width) - 1) * 4) + (hilite)->h.x1) & 0xFFF, \ + ((((height) - 1) * 4) + (hilite)->h.y1) & 0xFFF) + +#define gDPSetHilite2Tile(pkt, tile, hilite, width, height) \ + gDPSetTileSize(pkt, tile, \ + (hilite)->h.x2 & 0xFFF, \ + (hilite)->h.y2 & 0xFFF, \ + ((((width) - 1) * 4) + (hilite)->h.x2) & 0xFFF, \ + ((((height) - 1) * 4) + (hilite)->h.y2) & 0xFFF) +#define gsDPSetHilite2Tile(tile, hilite, width, height) \ + gsDPSetTileSize(tile, \ + (hilite)->h.x2 & 0xFFF, \ + (hilite)->h.y2 & 0xFFF, \ + ((((width) - 1) * 4) + (hilite)->h.x2) & 0xFFF, \ + ((((height) - 1) * 4) + (hilite)->h.y2) & 0xFFF) + + +/* + * Set the occlusion plane. This is a quadrilateral in 3D space where all + * geometry behind it is culled. You should create occlusion plane candidates + * just behind walls and other large objects, and have your game engine pick + * the most optimal one every frame to send to the RSP. + * + * Computing the coefficients for the occlusion plane is far too complicated to + * explain here. The reference implementation `guOcclusionPlane` is provided + * separately. + * + * o is the address of an OcclusionPlane struct + */ +#define gSPOcclusionPlane(pkt, o) \ + gDma2p((pkt), G_MOVEMEM, (o), sizeof(OcclusionPlane), G_MV_LIGHT, \ + (G_MAX_LIGHTS * 0x10) + 0x18) +#define gsSPOcclusionPlane(o) \ + gsDma2p( G_MOVEMEM, (o), sizeof(OcclusionPlane), G_MV_LIGHT, \ + (G_MAX_LIGHTS * 0x10) + 0x18) + + +/* + * FOG macros + * fm = z multiplier + * fo = z offset + * FOG FORMULA: alpha(fog) = (eyespace z) * fm + fo CLAMPED 0 to 255 + * note: (eyespace z) ranges -1 to 1 + * + * Alternate method of setting fog: + * min, max: range 0 to 1000: 0=nearplane, 1000=farplane + * min is where fog begins (usually less than max and often 0) + * max is where fog is thickest (usually 1000) + * + */ +#define gSPFogFactor(pkt, fm, fo) \ + gMoveWd(pkt, G_MW_FOG, G_MWO_FOG, \ + (_SHIFTL(fm, 16, 16) | _SHIFTL(fo, 0, 16))) + +#define gsSPFogFactor(fm, fo) \ + gsMoveWd(G_MW_FOG, G_MWO_FOG, \ + (_SHIFTL(fm, 16, 16) | _SHIFTL(fo, 0, 16))) + +#define gSPFogPosition(pkt, min, max) \ + gMoveWd(pkt, G_MW_FOG, G_MWO_FOG, \ + (_SHIFTL((128000 / ((max) - (min))), 16, 16) | \ + _SHIFTL(((500 - (min)) * 256 / ((max) - (min))), 0, 16))) + +#define gsSPFogPosition(min, max) \ + gsMoveWd(G_MW_FOG, G_MWO_FOG, \ + (_SHIFTL((128000 / ((max) - (min))), 16, 16) | \ + _SHIFTL(((500 - (min)) * 256 / ((max) - (min))), 0, 16))) + + +/* + * Macros to turn texture on/off + */ +#define gSPTexture(pkt, s, t, level, tile, on) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_TEXTURE, 24, 8) | \ + _SHIFTL((level), 11, 3) | \ + _SHIFTL((tile), 8, 3) | \ + _SHIFTL((on), 1, 7)); \ + _g->words.w1 = (_SHIFTL((s), 16, 16) | \ + _SHIFTL((t), 0, 16)); \ +}) +#define gsSPTexture(s, t, level, tile, on) \ +{ \ + (_SHIFTL(G_TEXTURE, 24, 8) | \ + _SHIFTL((level), 11, 3) | \ + _SHIFTL((tile), 8, 3) | \ + _SHIFTL((on), 1, 7)), \ + (_SHIFTL((s), 16, 16) | \ + _SHIFTL((t), 0, 16)) \ +} + +/* + * The bowtie value is a workaround for a bug in HW V1, and is not supported + * by F3DEX2, let alone F3DEX3. + */ +#define gSPTextureL(pkt, s, t, level, bowtie, tile, on) \ + gSPTexture(pkt, s, t, level, tile, on) +#define gsSPTextureL(s, t, level, bowtie, tile, on) \ + gsSPTexture(s, t, level, tile, on) + +/* + * One gSPGeometryMode(pkt,c,s) GBI is equal to these two GBIs. + * + * gSPClearGeometryMode(pkt,c) + * gSPSetGeometryMode(pkt,s) + * + * gSPLoadGeometryMode(pkt, word) sets GeometryMode directly. + */ +#define gSPGeometryMode(pkt, c, s) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_GEOMETRYMODE, 24, 8) | \ + _SHIFTL(~(u32)(c), 0, 24)); \ + _g->words.w1 = (u32)(s); \ +}) + +#define gsSPGeometryMode(c, s) \ +{ \ + (_SHIFTL(G_GEOMETRYMODE, 24, 8) | \ + _SHIFTL(~(u32)(c), 0, 24)), \ + (u32)(s) \ +} + +#define gSPSetGeometryMode(pkt, word) gSPGeometryMode((pkt), 0, (word)) +#define gsSPSetGeometryMode(word) gsSPGeometryMode( 0, (word)) +#define gSPClearGeometryMode(pkt, word) gSPGeometryMode((pkt), (word), 0) +#define gsSPClearGeometryMode(word) gsSPGeometryMode( (word), 0) +#define gSPLoadGeometryMode(pkt, word) gSPGeometryMode((pkt), -1, (word)) +#define gsSPLoadGeometryMode(word) gsSPGeometryMode( -1, (word)) + +#define gsSPGeometryModeSetFirst(c, s) gsSPGeometryMode(c, s) + +#define gSPSetOtherMode(pkt, cmd, sft, len, data) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(cmd, 24, 8) | \ + _SHIFTL(32 - (sft) - (len), 8, 8) | \ + _SHIFTL((len) - 1, 0, 8)); \ + _g->words.w1 = (unsigned int)(data); \ +}) + +#define gsSPSetOtherMode(cmd, sft, len, data) \ +{ \ + (_SHIFTL(cmd, 24, 8) | \ + _SHIFTL(32 - (sft) - (len), 8, 8) | \ + _SHIFTL((len) - 1, 0, 8)), \ + (unsigned int)(data) \ +} + +/* + * RDP setothermode register commands - register shadowed in RSP + */ +#define gDPPipelineMode(pkt, mode) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_PIPELINE, 1, mode) +#define gsDPPipelineMode(mode) \ + gsSPSetOtherMode( G_SETOTHERMODE_H, G_MDSFT_PIPELINE, 1, mode) + +#define gDPSetCycleType(pkt, type) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_CYCLETYPE, 2, type) +#define gsDPSetCycleType(type) \ + gsSPSetOtherMode( G_SETOTHERMODE_H, G_MDSFT_CYCLETYPE, 2, type) + +#define gDPSetTexturePersp(pkt, type) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_TEXTPERSP, 1, type) +#define gsDPSetTexturePersp(type) \ + gsSPSetOtherMode( G_SETOTHERMODE_H, G_MDSFT_TEXTPERSP, 1, type) + +#define gDPSetTextureDetail(pkt, type) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_TEXTDETAIL, 2, type) +#define gsDPSetTextureDetail(type) \ + gsSPSetOtherMode( G_SETOTHERMODE_H, G_MDSFT_TEXTDETAIL, 2, type) + +#define gDPSetTextureLOD(pkt, type) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_TEXTLOD, 1, type) +#define gsDPSetTextureLOD(type) \ + gsSPSetOtherMode( G_SETOTHERMODE_H, G_MDSFT_TEXTLOD, 1, type) + +#define gDPSetTextureLUT(pkt, type) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_TEXTLUT, 2, type) +#define gsDPSetTextureLUT(type) \ + gsSPSetOtherMode( G_SETOTHERMODE_H, G_MDSFT_TEXTLUT, 2, type) + +#define gDPSetTextureFilter(pkt, type) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_TEXTFILT, 2, type) +#define gsDPSetTextureFilter(type) \ + gsSPSetOtherMode( G_SETOTHERMODE_H, G_MDSFT_TEXTFILT, 2, type) + +#define gDPSetTextureConvert(pkt, type) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_TEXTCONV, 3, type) +#define gsDPSetTextureConvert(type) \ + gsSPSetOtherMode( G_SETOTHERMODE_H, G_MDSFT_TEXTCONV, 3, type) + +#define gDPSetCombineKey(pkt, type) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_COMBKEY, 1, type) +#define gsDPSetCombineKey(type) \ + gsSPSetOtherMode( G_SETOTHERMODE_H, G_MDSFT_COMBKEY, 1, type) + +#define gDPSetColorDither(pkt, mode) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_RGBDITHER, 2, mode) +#define gsDPSetColorDither(mode) \ + gsSPSetOtherMode( G_SETOTHERMODE_H, G_MDSFT_RGBDITHER, 2, mode) + +#define gDPSetAlphaDither(pkt, mode) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_H, G_MDSFT_ALPHADITHER, 2, mode) +#define gsDPSetAlphaDither(mode) \ + gsSPSetOtherMode( G_SETOTHERMODE_H, G_MDSFT_ALPHADITHER, 2, mode) + +/* 'blendmask' is not supported anymore. + * The bits are reserved for future use. + * Fri May 26 13:45:55 PDT 1995 + */ +#define gDPSetBlendMask(pkt, mask) gDPNoOp(pkt) +#define gsDPSetBlendMask(mask) gsDPNoOp() + +#define gDPSetAlphaCompare(pkt, type) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_L, G_MDSFT_ALPHACOMPARE, 2, type) +#define gsDPSetAlphaCompare(type) \ + gsSPSetOtherMode( G_SETOTHERMODE_L, G_MDSFT_ALPHACOMPARE, 2, type) + +#define gDPSetDepthSource(pkt, src) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_L, G_MDSFT_ZSRCSEL, 1, src) +#define gsDPSetDepthSource(src) \ + gsSPSetOtherMode( G_SETOTHERMODE_L, G_MDSFT_ZSRCSEL, 1, src) + +#define gDPSetRenderMode(pkt, c0, c1) \ + gSPSetOtherMode(pkt, G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, 29, (c0) | (c1)) +#define gsDPSetRenderMode(c0, c1) \ + gsSPSetOtherMode( G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, 29, (c0) | (c1)) + +#define gSetImage(pkt, cmd, fmt, siz, width, i) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(cmd, 24, 8) | \ + _SHIFTL(fmt, 21, 3) | \ + _SHIFTL(siz, 19, 2) | \ + _SHIFTL((width) - 1, 0, 12)); \ + _g->words.w1 = (unsigned int)(i); \ +}) + +#define gsSetImage(cmd, fmt, siz, width, i) \ +{ \ + (_SHIFTL(cmd, 24, 8) | \ + _SHIFTL(fmt, 21, 3) | \ + _SHIFTL(siz, 19, 2) | \ + _SHIFTL((width) - 1, 0, 12)), \ + (unsigned int)(i) \ +} + +#define gDPSetColorImage(pkt, f, s, w, i) gSetImage(pkt, G_SETCIMG, f, s, w, i) +#define gsDPSetColorImage(f, s, w, i) gsSetImage( G_SETCIMG, f, s, w, i) + + +/* use these for new code */ +#define gDPSetDepthImage(pkt, i) gSetImage(pkt, G_SETZIMG, 0, 0, 1, i) +#define gsDPSetDepthImage(i) gsSetImage( G_SETZIMG, 0, 0, 1, i) +/* kept for compatibility */ +#define gDPSetMaskImage(pkt, i) gDPSetDepthImage(pkt, i) +#define gsDPSetMaskImage(i) gsDPSetDepthImage( i) + +#define gDPSetTextureImage(pkt, f, s, w, i) gSetImage(pkt, G_SETTIMG, f, s, w, i) +#define gsDPSetTextureImage(f, s, w, i) gsSetImage( G_SETTIMG, f, s, w, i) + +/* + * RDP macros + */ + +#define gDPSetCombine(pkt, muxs0, muxs1) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_SETCOMBINE, 24, 8) | \ + _SHIFTL(muxs0, 0, 24)); \ + _g->words.w1 = (unsigned int)(muxs1); \ +}) + +#define gsDPSetCombine(muxs0, muxs1) \ +{ \ + (_SHIFTL(G_SETCOMBINE, 24, 8) | \ + _SHIFTL(muxs0, 0, 24)), \ + (unsigned int)(muxs1) \ +} + +#define GCCc0w0(saRGB0, mRGB0, saA0, mA0) \ + (_SHIFTL((saRGB0), 20, 4) | \ + _SHIFTL((mRGB0), 15, 5) | \ + _SHIFTL((saA0), 12, 3) | \ + _SHIFTL((mA0), 9, 3)) + +#define GCCc1w0(saRGB1, mRGB1) \ + (_SHIFTL((saRGB1), 5, 4) | \ + _SHIFTL((mRGB1), 0, 5)) + +#define GCCc0w1(sbRGB0, aRGB0, sbA0, aA0) \ + (_SHIFTL((sbRGB0), 28, 4) | \ + _SHIFTL((aRGB0), 15, 3) | \ + _SHIFTL((sbA0), 12, 3) | \ + _SHIFTL((aA0), 9, 3)) + +#define GCCc1w1(sbRGB1, saA1, mA1, aRGB1, sbA1, aA1) \ + (_SHIFTL((sbRGB1), 24, 4) | \ + _SHIFTL((saA1), 21, 3) | \ + _SHIFTL((mA1), 18, 3) | \ + _SHIFTL((aRGB1), 6, 3) | \ + _SHIFTL((sbA1), 3, 3) | \ + _SHIFTL((aA1), 0, 3)) + +#define gDPSetCombineLERP(pkt, a0, b0, c0, d0, Aa0, Ab0, Ac0, Ad0, \ + a1, b1, c1, d1, Aa1, Ab1, Ac1, Ad1) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_SETCOMBINE, 24, 8) | \ + _SHIFTL(GCCc0w0(G_CCMUX_##a0, G_CCMUX_##c0, \ + G_ACMUX_##Aa0, G_ACMUX_##Ac0) | \ + GCCc1w0(G_CCMUX_##a1, G_CCMUX_##c1), \ + 0, 24)); \ + _g->words.w1 = (unsigned int)(GCCc0w1(G_CCMUX_##b0, G_CCMUX_##d0, \ + G_ACMUX_##Ab0, G_ACMUX_##Ad0) | \ + GCCc1w1(G_CCMUX_##b1, G_ACMUX_##Aa1, \ + G_ACMUX_##Ac1, G_CCMUX_##d1, \ + G_ACMUX_##Ab1, G_ACMUX_##Ad1)); \ +}) + +#define gsDPSetCombineLERP(a0, b0, c0, d0, Aa0, Ab0, Ac0, Ad0, \ + a1, b1, c1, d1, Aa1, Ab1, Ac1, Ad1) \ +{ \ + (_SHIFTL(G_SETCOMBINE, 24, 8) | \ + _SHIFTL(GCCc0w0(G_CCMUX_##a0, G_CCMUX_##c0, \ + G_ACMUX_##Aa0, G_ACMUX_##Ac0) | \ + GCCc1w0(G_CCMUX_##a1, G_CCMUX_##c1), \ + 0, 24)), \ + (unsigned int)(GCCc0w1(G_CCMUX_##b0, G_CCMUX_##d0, \ + G_ACMUX_##Ab0, G_ACMUX_##Ad0) | \ + GCCc1w1(G_CCMUX_##b1, G_ACMUX_##Aa1, \ + G_ACMUX_##Ac1, G_CCMUX_##d1, \ + G_ACMUX_##Ab1, G_ACMUX_##Ad1)) \ +} + +/* + * SetCombineMode macros are NOT redunant. It allow the C preprocessor + * to substitute single parameter which includes commas in the token and + * rescan for higher parameter count macro substitution. + * + * eg. gsDPSetCombineMode(G_CC_MODULATE, G_CC_MODULATE) turns into + * gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, TEXEL0, 0, SHADE, 0, + * TEXEL0, 0, SHADE, 0, TEXEL0, 0, SHADE, 0) + */ + +#define gDPSetCombineMode(pkt, a, b) gDPSetCombineLERP(pkt, a, b) +#define gsDPSetCombineMode(a, b) gsDPSetCombineLERP( a, b) + +#define gDPSetColor(pkt, c, d) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = _SHIFTL(c, 24, 8); \ + _g->words.w1 = (unsigned int)(d); \ +}) + +#define gsDPSetColor(c, d) \ +{ \ + _SHIFTL(c, 24, 8), \ + (unsigned int)(d) \ +} + +#define DPRGBColor(pkt, cmd, r, g, b, a) \ + gDPSetColor(pkt, cmd, \ + (_SHIFTL(r, 24, 8) | \ + _SHIFTL(g, 16, 8) | \ + _SHIFTL(b, 8, 8) | \ + _SHIFTL(a, 0, 8))) + +#define sDPRGBColor(cmd, r, g, b, a) \ + gsDPSetColor(cmd, \ + (_SHIFTL(r, 24, 8) | \ + _SHIFTL(g, 16, 8) | \ + _SHIFTL(b, 8, 8) | \ + _SHIFTL(a, 0, 8))) + +#define gDPSetEnvColor(pkt, r, g, b, a) \ + DPRGBColor(pkt, G_SETENVCOLOR, r, g, b, a) + +#define gsDPSetEnvColor(r, g, b, a) \ + sDPRGBColor( G_SETENVCOLOR, r, g, b, a) + +#define gDPSetBlendColor(pkt, r, g, b, a) \ + DPRGBColor(pkt, G_SETBLENDCOLOR, r, g, b, a) + +#define gsDPSetBlendColor(r, g, b, a) \ + sDPRGBColor( G_SETBLENDCOLOR, r, g, b, a) + +#define gDPSetFogColor(pkt, r, g, b, a) \ + DPRGBColor(pkt, G_SETFOGCOLOR, r, g, b, a) + +#define gsDPSetFogColor(r, g, b, a) \ + sDPRGBColor( G_SETFOGCOLOR, r, g, b, a) + +#define gDPSetFillColor(pkt, d) \ + gDPSetColor(pkt, G_SETFILLCOLOR, (d)) + +#define gsDPSetFillColor(d) \ + gsDPSetColor( G_SETFILLCOLOR, (d)) + +#define gDPSetPrimDepth(pkt, z, dz) \ + gDPSetColor(pkt, G_SETPRIMDEPTH, \ + _SHIFTL(z, 16, 16) | _SHIFTL(dz, 0, 16)) + +#define gsDPSetPrimDepth(z, dz) \ + gsDPSetColor(G_SETPRIMDEPTH, \ + _SHIFTL(z, 16, 16) | _SHIFTL(dz, 0, 16)) + +#define gDPSetPrimColor(pkt, m, l, r, g, b, a) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | \ + _SHIFTL(m, 8, 8) | \ + _SHIFTL(l, 0, 8)); \ + _g->words.w1 = (_SHIFTL(r, 24, 8) | \ + _SHIFTL(g, 16, 8) | \ + _SHIFTL(b, 8, 8) | \ + _SHIFTL(a, 0, 8)); \ +}) + +#define gsDPSetPrimColor(m, l, r, g, b, a) \ +{ \ + (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | \ + _SHIFTL(m, 8, 8) | \ + _SHIFTL(l, 0, 8)), \ + (_SHIFTL(r, 24, 8) | \ + _SHIFTL(g, 16, 8) | \ + _SHIFTL(b, 8, 8) | \ + _SHIFTL(a, 0, 8)) \ +} + +/* + * Send the color of the specified light to one of the RDP's color registers. + * light is the index of a light in the RSP counting from the end, i.e. 0 is + * the ambient light, 1 is the last directional / point light, etc. The RGB + * color of the selected light is combined with the alpha specified in this + * command as word 1 of a RDP command, and word 0 is specified in this command. + * Specialized versions are provided below for prim color and fog color, + * because these are the two versions needed for cel shading, but any RDP color + * command could be specified this way. + */ +#define gSPLightToRDP(pkt, light, alpha, word0) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + _g->words.w0 = (_SHIFTL(G_LIGHTTORDP, 24, 8) | \ + _SHIFTL(light * 0x10, 8, 8) | \ + _SHIFTL(alpha, 0, 8)); \ + _g->words.w1 = (word0); \ +}) +#define gsSPLightToRDP(light, alpha, word0) \ +{ \ + (_SHIFTL(G_LIGHTTORDP, 24, 8) | \ + _SHIFTL(light * 0x10, 8, 8) | \ + _SHIFTL(alpha, 0, 8)), \ + (word0) \ +} +#define gSPLightToPrimColor(pkt, light, alpha, m, l) \ + gSPLightToRDP(pkt, light, alpha, \ + (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | _SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8))) +#define gsSPLightToPrimColor(light, alpha, m, l) \ + gsSPLightToRDP(light, alpha, \ + (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | _SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8))) +#define gSPLightToFogColor(pkt, light, alpha) \ + gSPLightToRDP(pkt, light, alpha, _SHIFTL(G_SETFOGCOLOR, 24, 8)) +#define gsSPLightToFogColor(light, alpha) \ + gsSPLightToRDP(light, alpha, _SHIFTL(G_SETFOGCOLOR, 24, 8)) + +/* + * gDPSetOtherMode (This is for expert user.) + * + * This command makes all othermode parameters set. + * Do not use this command in the same DL with another g*SPSetOtherMode DLs. + * + * [Usage] + * gDPSetOtherMode(pkt, modeA, modeB) + * + * 'modeA' is described all parameters of GroupA GBI command. + * 'modeB' is also described all parameters of GroupB GBI command. + * + * GroupA: + * gDPPipelineMode, gDPSetCycleType, gSPSetTexturePersp, + * gDPSetTextureDetail, gDPSetTextureLOD, gDPSetTextureLUT, + * gDPSetTextureFilter, gDPSetTextureConvert, gDPSetCombineKey, + * gDPSetColorDither, gDPSetAlphaDither + * + * GroupB: + * gDPSetAlphaCompare, gDPSetDepthSource, gDPSetRenderMode + * + * Use 'OR' operation to get modeA and modeB. + * + * modeA = G_PM_* | G_CYC_* | G_TP_* | G_TD_* | G_TL_* | G_TT_* | G_TF_* + * G_TC_* | G_CK_* | G_CD_* | G_AD_*; + * + * modeB = G_AC_* | G_ZS_* | G_RM_* | G_RM_*2; + */ +#define gDPSetOtherMode(pkt, mode0, mode1) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_RDPSETOTHERMODE, 24, 8) | \ + _SHIFTL(mode0, 0, 24)); \ + _g->words.w1 = (unsigned int)(mode1); \ +}) + +#define gsDPSetOtherMode(mode0, mode1) \ +{ \ + (_SHIFTL(G_RDPSETOTHERMODE, 24, 8) | \ + _SHIFTL(mode0, 0, 24)), \ + (unsigned int)(mode1) \ +} + +/* + * Texturing macros + */ + +#define G_TX_LOADTILE 7 +#define G_TX_RENDERTILE 0 + +/* + * Define this to remove syncs from texture loading multi-command macros. + * + * You should convert your romhack codebase to F3DEX3 without this defined + * first, then once everything is stable, define it and fix any crashes or + * graphical issues that arise. + * + * How the syncs work: load, tile, and pipe sync all delay the RDP by fixed + * numbers of cycles. It is the smallest number for load, a medium number for + * tile, and the largest number for pipe. These syncs do NOT wait until + * something is finished being used; they just stall for a fixed time. + * (DPFullSync is different and DOES wait for writebacks to memory to be done; + * that is not considered in this explanation.) + * + * Syncs always happen after rendering something and before changing some + * settings. In other words: + * - gsSP2Triangles(), gsSPTextureRectangle(), etc. + * - gsDPSomeSync(), + * - gsDPSetSomething() + * You never need the opposite, i.e. you never need a sync after changing + * settings but before rendering. + * + * Which sync you use depends on which settings you are changing. If you are + * doing a texture load (DPLoadBlock or DPLoadTile), you need a load sync (or + * either of the other syncs which wait for even longer). If you are changing + * tile settings, you need a tile sync (or pipe sync which is longer). If you + * are changing CC, othermode, env color, or other things like that, you need + * a pipe sync. + * + * Display lists overall should be structured like: + * + * - ... + * - previous draw tris + * - pipe sync + * - texture load, CC settings, othermode, etc. (no syncs within these) + * - (no sync here) + * - draw tris + * - pipe sync + * - next material setup + * - ... + * + * In SM64, the pipe sync is at the end of each object or sub-object; in OoT + * it is at the start of each display list. This ends up being the same thing + * when the display lists are effectively concatenated: you have a pipe sync + * after each set of rendering things, and before each new set of changing + * settings. + * + * If you are doing multitexture and/or CI texture loads, use a different tile + * for each load, and then you don't need any syncs in the loads. As an extreme + * example with two CI textures: + * - previous pipe sync, either at the start of this DL or the end of the last + * - set tile 7 to load texture 0 CIs (no syncs) + * - load block on tile 7 (no syncs) + * - set tile 5 to load texture 0 palette (no syncs) + * - load block on tile 5 (no syncs) + * - set tile 6 to load texture 1 CIs (no syncs) + * - load block on tile 6 (no syncs) + * - set tile 4 to load texture 1 palette (no syncs) + * - load block on tile 4 (no syncs) + * - set tile 0 for render texture 0 (no syncs) + * - set tile 1 for render texture 0 (no syncs) + * - set othermode, CC, etc. (no syncs) + * - draw tris (no syncs) + * - next pipe sync, either at the end of this DL or the start of the next + * Both fast64 and the multi-command macros in this GBI if + * NO_SYNCS_IN_TEXTURE_LOADS is enabled do this, but if you wrote the DLs by + * hand or they were vanilla DLs not using the multi-command macros, they may + * need to be updated. (Then again, in that case the syncs are also written by + * hand, so these syncs changes do not affect them.) + * + * If you are writing GUI display lists with texture rectangle which look like + * - load tex + * - tex rect + * - load tex + * - tex rect + * you need a load sync before each load tex, and you don't need any other + * syncs. + */ +#ifdef NO_SYNCS_IN_TEXTURE_LOADS +#define gDPLoadSyncInTexLoad(pkt) (void)0 +#define gDPTileSyncInTexLoad(pkt) (void)0 +#define gDPPipeSyncInTexLoad(pkt) (void)0 +#define gsDPLoadSyncInTexLoad +#define gsDPTileSyncInTexLoad +#define gsDPPipeSyncInTexLoad +#define gsDPPipeSyncEndOfTexLoad +#define _G_TEXLOADTILE(rtile) (G_TX_LOADTILE - (rtile)) +#define _G_PALLOADTILE(rtile) (G_TX_LOADTILE - 2 - (rtile)) +#else +#define gDPLoadSyncInTexLoad(pkt) gDPLoadSync(pkt) +#define gDPTileSyncInTexLoad(pkt) gDPTileSync(pkt) +#define gDPPipeSyncInTexLoad(pkt) gDPPipeSync(pkt) +#define gsDPLoadSyncInTexLoad gsDPLoadSync(), +#define gsDPTileSyncInTexLoad gsDPTileSync(), +#define gsDPPipeSyncInTexLoad gsDPPipeSync(), +#define gsDPPipeSyncEndOfTexLoad , gsDPPipeSync() +#define _G_TEXLOADTILE(rtile) G_TX_LOADTILE +#define _G_PALLOADTILE(rtile) G_TX_LOADTILE +#endif + + +#define G_TX_NOMIRROR (0 << 0) +#define G_TX_WRAP (0 << 1) +#define G_TX_MIRROR (1 << 0) +#define G_TX_CLAMP (1 << 1) +#define G_TX_NOMASK 0 +#define G_TX_NOLOD 0 + +#ifndef MAX +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#endif + +#ifndef MIN +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif + +/* + * Dxt is the inverse of the number of 64-bit words in a line of + * the texture being loaded using the load_block command. If + * there are any 1's to the right of the 11th fractional bit, + * dxt should be rounded up. The following macros accomplish + * this. The 4b macros are a special case since 4-bit textures + * are loaded as 8-bit textures. Dxt is fixed point 1.11. RJM + */ +#define G_TX_DXT_FRAC 11 + +/* + * For RCP 2.0, the maximum number of texels that can be loaded + * using a load_block command is 2048. In order to load the total + * 4kB of Tmem, change the texel size when loading to be G_IM_SIZ_16b, + * then change the tile to the proper texel size after the load. + * The g*DPLoadTextureBlock macros already do this, so this change + * will be transparent if you use these macros. If you use + * the g*DPLoadBlock macros directly, you will need to handle this + * tile manipulation yourself. RJM. + */ +#define G_TX_LDBLK_MAX_TXL 2047 + +#define TXL2WORDS(txls, b_txl) \ + MAX(1, ((txls) * (b_txl) / 8)) + +#define CALC_DXT(width, b_txl) \ + (((1 << G_TX_DXT_FRAC) + TXL2WORDS(width, b_txl) - 1) / TXL2WORDS(width, b_txl)) + +#define TXL2WORDS_4b(txls) \ + MAX(1, ((txls) / 16)) + +#define CALC_DXT_4b(width) \ + (((1 << G_TX_DXT_FRAC) + TXL2WORDS_4b(width) - 1) / TXL2WORDS_4b(width)) + +#define gDPLoadTileGeneric(pkt, c, tile, uls, ult, lrs, lrt) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(c, 24, 8) | \ + _SHIFTL(uls, 12, 12) | \ + _SHIFTL(ult, 0, 12)); \ + _g->words.w1 = (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(lrs, 12, 12) | \ + _SHIFTL(lrt, 0, 12)); \ +}) + +#define gsDPLoadTileGeneric(c, tile, uls, ult, lrs, lrt) \ +{ \ + (_SHIFTL(c, 24, 8) | \ + _SHIFTL(uls, 12, 12) | \ + _SHIFTL(ult, 0, 12)), \ + (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(lrs, 12, 12) | \ + _SHIFTL(lrt, 0, 12)) \ +} + +#define gDPSetTileSize(pkt, t, uls, ult, lrs, lrt) \ + gDPLoadTileGeneric(pkt, G_SETTILESIZE, t, uls, ult, lrs, lrt) +#define gsDPSetTileSize(t, uls, ult, lrs, lrt) \ + gsDPLoadTileGeneric( G_SETTILESIZE, t, uls, ult, lrs, lrt) +#define gDPLoadTile(pkt, t, uls, ult, lrs, lrt) \ + gDPLoadTileGeneric(pkt, G_LOADTILE, t, uls, ult, lrs, lrt) +#define gsDPLoadTile(t, uls, ult, lrs, lrt) \ + gsDPLoadTileGeneric( G_LOADTILE, t, uls, ult, lrs, lrt) + +#define gDPSetTile(pkt, fmt, siz, line, tmem, tile, palette, cmt, \ + maskt, shiftt, cms, masks, shifts) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_SETTILE, 24, 8) | \ + _SHIFTL(fmt, 21, 3) | \ + _SHIFTL(siz, 19, 2) | \ + _SHIFTL(line, 9, 9) | \ + _SHIFTL(tmem, 0, 9)); \ + _g->words.w1 = (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(palette, 20, 4) | \ + _SHIFTL(cmt, 18, 2) | \ + _SHIFTL(maskt, 14, 4) | \ + _SHIFTL(shiftt, 10, 4) | \ + _SHIFTL(cms, 8, 2) | \ + _SHIFTL(masks, 4, 4) | \ + _SHIFTL(shifts, 0, 4)); \ +}) + +#define gsDPSetTile(fmt, siz, line, tmem, tile, palette, cmt, \ + maskt, shiftt, cms, masks, shifts) \ +{ \ + (_SHIFTL(G_SETTILE, 24, 8) | \ + _SHIFTL(fmt, 21, 3) | \ + _SHIFTL(siz, 19, 2) | \ + _SHIFTL(line, 9, 9) | \ + _SHIFTL(tmem, 0, 9)), \ + (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(palette, 20, 4) | \ + _SHIFTL(cmt, 18, 2) | \ + _SHIFTL(maskt, 14, 4) | \ + _SHIFTL(shiftt, 10, 4) | \ + _SHIFTL(cms, 8, 2) | \ + _SHIFTL(masks, 4, 4) | \ + _SHIFTL(shifts, 0, 4)) \ +} + +#define gDPLoadBlock(pkt, tile, uls, ult, lrs, dxt) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + _g->words.w0 = (_SHIFTL(G_LOADBLOCK, 24, 8) | \ + _SHIFTL(uls, 12, 12) | \ + _SHIFTL(ult, 0, 12)); \ + _g->words.w1 = (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(MIN(lrs, G_TX_LDBLK_MAX_TXL), 12, 12) | \ + _SHIFTL(dxt, 0, 12)); \ +}) + +#define gsDPLoadBlock(tile, uls, ult, lrs, dxt) \ +{ \ + (_SHIFTL(G_LOADBLOCK, 24, 8) | \ + _SHIFTL(uls, 12, 12) | \ + _SHIFTL(ult, 0, 12)), \ + (_SHIFTL(tile, 24, 3) | \ + _SHIFTL((MIN(lrs, G_TX_LDBLK_MAX_TXL)), 12, 12) | \ + _SHIFTL(dxt, 0, 12)) \ +} + +#define gDPLoadTLUTCmd(pkt, tile, count) \ +_DW({ \ + Gfx *_g = (Gfx *)pkt; \ + \ + _g->words.w0 = _SHIFTL(G_LOADTLUT, 24, 8); \ + _g->words.w1 = (_SHIFTL((tile), 24, 3) | \ + _SHIFTL((count), 14, 10)); \ +}) + +#define gsDPLoadTLUTCmd(tile, count) \ +{ \ + _SHIFTL(G_LOADTLUT, 24, 8), \ + (_SHIFTL((tile), 24, 3) | \ + _SHIFTL((count), 14, 10)) \ +} + +#define gDPLoadTextureBlock(pkt, timg, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ + gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) -1, \ + CALC_DXT(width, siz##_BYTES)); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((width) * siz##_LINE_BYTES) + 7) >> 3, 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + +#define gDPLoadTextureBlockYuv(pkt, timg, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ + gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) -1, \ + CALC_DXT(width, siz##_BYTES)); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((width) * 1) + 7) >> 3, 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + +/* Load fix rww 27jun95 */ +/* The S at the end means odd lines are already word Swapped */ + +#define gDPLoadTextureBlockS(pkt, timg, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ + gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, 0); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((width) * siz##_LINE_BYTES) + 7) >> 3, 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + +/* + * Allow tmem address and render tile to be specified. + * The S at the end means odd lines are already word Swapped + */ +#define gDPLoadMultiBlockS(pkt, timg, tmem, rtile, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ + gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, tmem, _G_TEXLOADTILE(rtile), \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, _G_TEXLOADTILE(rtile), 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1,0); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((width) * siz##_LINE_BYTES) + 7) >> 3, tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, \ + shifts); \ + gDPSetTileSize(pkt, rtile, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + + +#define gDPLoadTextureBlockYuvS(pkt, timg, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ + gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1,0); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((width) * 1) + 7) >> 3, 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + +/* + * allows tmem address to be specified + */ +#define _gDPLoadTextureBlock(pkt, timg, tmem, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ + gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, tmem, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, \ + CALC_DXT(width, siz##_BYTES)); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((width) * siz##_LINE_BYTES) + 7) >> 3, tmem, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + +/* + * allows tmem address and render tile to be specified + */ +#define _gDPLoadTextureBlockTile(pkt, timg, tmem, rtile, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ + gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, tmem, _G_TEXLOADTILE(rtile), \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, _G_TEXLOADTILE(rtile), 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, \ + CALC_DXT(width, siz##_BYTES)); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((width) * siz##_LINE_BYTES) + 7) >> 3, tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, rtile, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + +/* + * allows tmem address and render tile to be specified + */ +#define gDPLoadMultiBlock(pkt, timg, tmem, rtile, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \ + gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, tmem, _G_TEXLOADTILE(rtile), \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, _G_TEXLOADTILE(rtile), 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, \ + CALC_DXT(width, siz##_BYTES)); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((width) * siz##_LINE_BYTES) + 7) >> 3, tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, rtile, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + +#define gsDPLoadTextureBlock(timg, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ + gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \ + (((width)*(height) + siz##_INCR) >> siz##_SHIFT) - 1, \ + CALC_DXT(width, siz##_BYTES)), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, siz, \ + ((((width) * siz##_LINE_BYTES) + 7) >> 3), 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC) + +/* Here is the static form of the pre-swapped texture block loading */ +/* See gDPLoadTextureBlockS() for reference. Basically, just don't + calculate DxT, use 0 */ + +#define gsDPLoadTextureBlockS(timg, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ + gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, \ + 0, cmt, maskt,shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, 0), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, siz, \ + ((((width) * siz##_LINE_BYTES) + 7) >> 3), 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ + shifts), \ + gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC) + +/* + * Allow tmem address to be specified + */ +#define _gsDPLoadTextureBlock(timg, tmem, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ + gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, tmem, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, \ + CALC_DXT(width, siz##_BYTES)), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, siz, \ + ((((width) * siz##_LINE_BYTES) + 7) >> 3), tmem, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, \ + shifts), \ + gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC) + + +/* + * Allow tmem address and render_tile to be specified + */ +#define _gsDPLoadTextureBlockTile(timg, tmem, rtile, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ + gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, tmem, _G_TEXLOADTILE(rtile), \ + 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadBlock(_G_TEXLOADTILE(rtile), 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, \ + CALC_DXT(width, siz##_BYTES)), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, siz, \ + ((((width) * siz##_LINE_BYTES) + 7) >> 3), tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, \ + shifts), \ + gsDPSetTileSize(rtile, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC) + + +/* + * Allow tmem address and render_tile to be specified, useful when loading + * mutilple tiles at a time. + */ +#define gsDPLoadMultiBlock(timg, tmem, rtile, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ + gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, tmem, _G_TEXLOADTILE(rtile), \ + 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadBlock(_G_TEXLOADTILE(rtile), 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, \ + CALC_DXT(width, siz##_BYTES)), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, siz, \ + ((((width) * siz##_LINE_BYTES) + 7) >> 3), tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPSetTileSize(rtile, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC) + +/* + * Allows tmem and render tile to be specified. Useful when loading + * several tiles at a time. + * + * Here is the static form of the pre-swapped texture block loading + * See gDPLoadTextureBlockS() for reference. Basically, just don't + * calculate DxT, use 0 + */ + +#define gsDPLoadMultiBlockS(timg, tmem, rtile, fmt, siz, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \ + gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, tmem, _G_TEXLOADTILE(rtile), \ + 0, cmt, maskt,shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadBlock(_G_TEXLOADTILE(rtile), 0, 0, \ + (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, 0), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, siz, \ + ((((width) * siz##_LINE_BYTES) + 7) >> 3), tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPSetTileSize(rtile, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC) + + +#define gDPLoadTextureBlock_4b(pkt, timg, fmt, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + 3) >> 2) - 1, \ + CALC_DXT_4b(width)); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \ + ((((width) >> 1) + 7) >> 3), 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + +/* Load fix rww 27jun95 */ +/* The S at the end means odd lines are already word Swapped */ + +#define gDPLoadTextureBlock_4bS(pkt, timg, fmt, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + 3) >> 2) - 1, \ + 0); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \ + ((((width) >> 1) + 7) >> 3), 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + +/* + * 4-bit load block. Useful when loading multiple tiles + */ +#define gDPLoadMultiBlock_4b(pkt, timg, tmem, rtile, fmt, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, tmem, _G_TEXLOADTILE(rtile), \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, _G_TEXLOADTILE(rtile), 0, 0, \ + (((width) * (height) + 3) >> 2) - 1, \ + CALC_DXT_4b(width)); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \ + ((((width) >> 1) + 7) >> 3), tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, rtile, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + +/* + * 4-bit load block. Allows tmem and render tile to be specified. Useful when + * loading multiple tiles. The S means odd lines are already word swapped. + */ +#define gDPLoadMultiBlock_4bS(pkt, timg, tmem, rtile, fmt, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, tmem, _G_TEXLOADTILE(rtile), \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, _G_TEXLOADTILE(rtile), 0, 0, \ + (((width) * (height) + 3) >> 2) - 1, \ + 0); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \ + ((((width) >> 1) + 7) >> 3), tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, rtile, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + + +#define _gDPLoadTextureBlock_4b(pkt, timg, tmem, fmt, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, G_IM_SIZ_16b, 1, timg); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_16b, 0, tmem, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + 3) >> 2) - 1, \ + CALC_DXT_4b(width)); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \ + ((((width) >> 1) + 7) >> 3), tmem, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC); \ +}) + +#define gsDPLoadTextureBlock_4b(timg, fmt, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, G_IM_SIZ_16b, 1, timg), \ + gsDPSetTile(fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + 3) >> 2) - 1, \ + CALC_DXT_4b(width)), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, G_IM_SIZ_4b, \ + ((((width) >> 1) + 7) >> 3), 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC) + +#define gsDPLoadTextureBlock_4bS(timg, fmt, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, G_IM_SIZ_16b, 1, timg), \ + gsDPSetTile(fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + 3) >> 2) - 1, \ + 0), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, G_IM_SIZ_4b, \ + ((((width) >> 1) + 7) >> 3), 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC) + +/* + * 4-bit load block. Allows tmem address and render tile to be specified. + * Useful when loading multiple tiles. + */ +#define gsDPLoadMultiBlock_4b(timg, tmem, rtile, fmt, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, G_IM_SIZ_16b, 1, timg), \ + gsDPSetTile(fmt, G_IM_SIZ_16b, 0, tmem, _G_TEXLOADTILE(rtile), \ + 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadBlock(_G_TEXLOADTILE(rtile), 0, 0, \ + (((width) * (height) + 3) >> 2) - 1, \ + CALC_DXT_4b(width)), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, G_IM_SIZ_4b, \ + ((((width) >> 1) + 7) >> 3), tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPSetTileSize(rtile, 0, 0, \ + ((width)-1) << G_TEXTURE_IMAGE_FRAC, \ + ((height)-1) << G_TEXTURE_IMAGE_FRAC) + + +/* + * 4-bit load block. Allows tmem address and render tile to be specified. + * Useful when loading multiple tiles. S means odd lines are already swapped. + */ +#define gsDPLoadMultiBlock_4bS(timg, tmem, rtile, fmt, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, G_IM_SIZ_16b, 1, timg), \ + gsDPSetTile(fmt, G_IM_SIZ_16b, 0, tmem, _G_TEXLOADTILE(rtile), \ + 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadBlock(_G_TEXLOADTILE(rtile), 0, 0, \ + (((width) * (height) + 3) >> 2) - 1, \ + 0), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, G_IM_SIZ_4b, \ + ((((width) >> 1) + 7) >> 3), tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPSetTileSize(rtile, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC) + + +/* + * Allows tmem address to be specified + */ +#define _gsDPLoadTextureBlock_4b(timg, tmem, fmt, width, height, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, G_IM_SIZ_16b, 1, timg), \ + gsDPSetTile(fmt, G_IM_SIZ_16b, 0, tmem, G_TX_LOADTILE, \ + 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadBlock(G_TX_LOADTILE, 0, 0, \ + (((width) * (height) + 3) >> 2) - 1, \ + CALC_DXT_4b(width)), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, G_IM_SIZ_4b, \ + ((((width) >> 1) + 7) >> 3), tmem, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, \ + ((width) - 1) << G_TEXTURE_IMAGE_FRAC, \ + ((height) - 1) << G_TEXTURE_IMAGE_FRAC) + +#define gDPLoadTextureTile(pkt, timg, fmt, siz, width, height, \ + uls, ult, lrs, lrt, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, siz, width, timg); \ + gDPSetTile(pkt, fmt, siz, \ + (((((lrs) - (uls) + 1) * siz##_TILE_BYTES) + 7) >> 3), 0, \ + G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, \ + shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadTile(pkt, G_TX_LOADTILE, \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((((lrs) - (uls) + 1) * siz##_LINE_BYTES) + 7) >> 3), 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC); \ +}) + +/* + * Load texture tile. Allows tmem address and render tile to be specified. + * Useful for loading multiple tiles. + */ +#define gDPLoadMultiTile(pkt, timg, tmem, rtile, fmt, siz, width, height, \ + uls, ult, lrs, lrt, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, siz, width, timg); \ + gDPSetTile(pkt, fmt, siz, \ + (((((lrs) - (uls) + 1) * siz##_TILE_BYTES) + 7) >> 3), tmem, \ + _G_TEXLOADTILE(rtile), 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadTile(pkt, _G_TEXLOADTILE(rtile), \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, siz, \ + (((((lrs) - (uls) + 1) * siz##_LINE_BYTES) + 7) >> 3), tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, rtile, \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC); \ +}) + + +#define gsDPLoadTextureTile(timg, fmt, siz, width, height, \ + uls, ult, lrs, lrt, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, siz, width, timg), \ + gsDPSetTile(fmt, siz, \ + (((((lrs) - (uls) + 1) * siz##_TILE_BYTES) + 7) >> 3), 0, \ + G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadTile(G_TX_LOADTILE, \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, siz, \ + (((((lrs) - (uls) + 1) * siz##_LINE_BYTES) + 7) >> 3), 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPSetTileSize(G_TX_RENDERTILE, \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC) + +/* + * Load texture tile. Allows tmem address and render tile to be specified. + * Useful for loading multiple tiles. + */ +#define gsDPLoadMultiTile(timg, tmem, rtile, fmt, siz, width, height, \ + uls, ult, lrs, lrt, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, siz, width, timg), \ + gsDPSetTile(fmt, siz, \ + (((((lrs) - (uls) + 1) * siz##_TILE_BYTES) + 7) >> 3), tmem, \ + _G_TEXLOADTILE(rtile), 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadTile(_G_TEXLOADTILE(rtile), \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, siz, \ + (((((lrs) - (uls) + 1) * siz##_LINE_BYTES) + 7) >> 3), \ + tmem, rtile, pal, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPSetTileSize(rtile, \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC) + +#define gDPLoadTextureTile_4b(pkt, timg, fmt, width, height, \ + uls, ult, lrs, lrt, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, G_IM_SIZ_8b, ((width) >> 1), timg); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_8b, \ + (((((lrs) - (uls) + 1) >> 1) + 7) >> 3), 0, \ + G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadTile(pkt, G_TX_LOADTILE, \ + (uls) << (G_TEXTURE_IMAGE_FRAC - 1), \ + (ult) << (G_TEXTURE_IMAGE_FRAC), \ + (lrs) << (G_TEXTURE_IMAGE_FRAC - 1), \ + (lrt) << (G_TEXTURE_IMAGE_FRAC)); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \ + (((((lrs) - (uls) + 1) >> 1) + 7) >> 3), 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, G_TX_RENDERTILE, \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC); \ +}) + +/* + * Load texture tile. Allows tmem address and render tile to be specified. + * Useful for loading multiple tiles. + */ +#define gDPLoadMultiTile_4b(pkt, timg, tmem, rtile, fmt, width, height, \ + uls, ult, lrs, lrt, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ +_DW({ \ + gDPSetTextureImage(pkt, fmt, G_IM_SIZ_8b, ((width) >> 1), timg); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_8b, \ + (((((lrs) - (uls) + 1) >> 1) + 7) >> 3), tmem, \ + _G_TEXLOADTILE(rtile), 0, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadTile(pkt, _G_TEXLOADTILE(rtile), \ + (uls) << (G_TEXTURE_IMAGE_FRAC - 1), \ + (ult) << (G_TEXTURE_IMAGE_FRAC), \ + (lrs) << (G_TEXTURE_IMAGE_FRAC - 1), \ + (lrt) << (G_TEXTURE_IMAGE_FRAC)); \ + gDPPipeSyncInTexLoad(pkt); \ + gDPSetTile(pkt, fmt, G_IM_SIZ_4b, \ + (((((lrs) - (uls) + 1) >> 1) + 7) >> 3), tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, shifts); \ + gDPSetTileSize(pkt, rtile, \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC); \ +}) + +#define gsDPLoadTextureTile_4b(timg, fmt, width, height, \ + uls, ult, lrs, lrt, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + gsDPSetTextureImage(fmt, G_IM_SIZ_8b, ((width) >> 1), timg), \ + gsDPSetTile(fmt, G_IM_SIZ_8b, \ + (((((lrs) - (uls) + 1) >> 1) + 7) >> 3), 0, \ + G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadTile(G_TX_LOADTILE, \ + (uls) << (G_TEXTURE_IMAGE_FRAC - 1), \ + (ult) << (G_TEXTURE_IMAGE_FRAC), \ + (lrs) << (G_TEXTURE_IMAGE_FRAC - 1), \ + (lrt) << (G_TEXTURE_IMAGE_FRAC)), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, G_IM_SIZ_4b, \ + (((((lrs) - (uls) + 1) >> 1) + 7) >> 3), 0, \ + G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPSetTileSize(G_TX_RENDERTILE, \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC) + +/* + * Load texture tile. Allows tmem address and render tile to be specified. + * Useful for loading multiple tiles. + */ +#define gsDPLoadMultiTile_4b(timg, tmem, rtile, fmt, width, height, \ + uls, ult, lrs, lrt, pal, \ + cms, cmt, masks, maskt, shifts, shiftt) \ + \ + gsDPSetTextureImage(fmt, G_IM_SIZ_8b, ((width) >> 1), timg), \ + gsDPSetTile(fmt, G_IM_SIZ_8b, \ + (((((lrs) - (uls) + 1) >> 1) + 7) >> 3), tmem, \ + _G_TEXLOADTILE(rtile), 0, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadTile(_G_TEXLOADTILE(rtile), \ + (uls) << (G_TEXTURE_IMAGE_FRAC - 1), \ + (ult) << (G_TEXTURE_IMAGE_FRAC), \ + (lrs) << (G_TEXTURE_IMAGE_FRAC - 1), \ + (lrt) << (G_TEXTURE_IMAGE_FRAC)), \ + gsDPPipeSyncInTexLoad \ + gsDPSetTile(fmt, G_IM_SIZ_4b, \ + (((((lrs) - (uls) + 1) >> 1) + 7) >> 3), tmem, \ + rtile, pal, cmt, maskt, shiftt, cms, masks, shifts), \ + gsDPSetTileSize(rtile, \ + (uls) << G_TEXTURE_IMAGE_FRAC, \ + (ult) << G_TEXTURE_IMAGE_FRAC, \ + (lrs) << G_TEXTURE_IMAGE_FRAC, \ + (lrt) << G_TEXTURE_IMAGE_FRAC) + +/* + * Load a 16-entry palette (for 4-bit CI textures) + * Assumes a 16 entry tlut is being loaded, palette # is 0-15 + * With NO_SYNCS_IN_TEXTURE_LOADS: assumes that palette 0 is for multitexture + * texture 0 and palette 1 is for texture 1 (uses load tiles 5 and 4) + */ + +#define gDPLoadTLUT_pal16(pkt, pal, dram) \ +_DW({ \ + gDPSetTextureImage(pkt, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram); \ + gDPTileSyncInTexLoad(pkt); \ + gDPSetTile(pkt, 0, 0, 0, (256 + (((pal) & 0xF) * 16)), \ + _G_PALLOADTILE((pal) & 1), 0, 0, 0, 0, 0, 0, 0); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadTLUTCmd(pkt, _G_PALLOADTILE((pal) & 1), 15); \ + gDPPipeSyncInTexLoad(pkt); \ +}) + +#define gsDPLoadTLUT_pal16(pal, dram) \ + gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram), \ + gsDPTileSyncInTexLoad \ + gsDPSetTile(0, 0, 0, (256 + (((pal) & 0xF) * 16)), \ + _G_PALLOADTILE((pal) & 1), 0, 0, 0, 0, 0, 0, 0), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadTLUTCmd(_G_PALLOADTILE((pal) & 1), 15) \ + gsDPPipeSyncEndOfTexLoad + +/* + * Load a 256-entry palette (for 8-bit CI textures) + * Assumes a 256 entry tlut is being loaded, palette # is not used + */ + +#define gDPLoadTLUT_pal256(pkt, dram) \ +_DW({ \ + gDPSetTextureImage(pkt, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram); \ + gDPTileSyncInTexLoad(pkt); \ + gDPSetTile(pkt, 0, 0, 0, 256, \ + _G_PALLOADTILE(0), 0, 0, 0, 0, 0, 0, 0); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadTLUTCmd(pkt, _G_PALLOADTILE(0), 255); \ + gDPPipeSyncInTexLoad(pkt); \ +}) + +#define gsDPLoadTLUT_pal256(dram) \ + gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram), \ + gsDPTileSyncInTexLoad \ + gsDPSetTile(0, 0, 0, 256, \ + _G_PALLOADTILE(0), 0, 0, 0, 0, 0, 0, 0), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadTLUTCmd(_G_PALLOADTILE(0), 255) \ + gsDPPipeSyncEndOfTexLoad + +/* + * Assumes that the starting TMEM address is calculated like in DPLoadTLUT_pal16 + * (which is the only sane way to do it if you are loading two palettes for + * multitexture) + */ +#define _G_PALTMEMTOTILE(tmemaddr) _G_PALLOADTILE(((tmemaddr) >> 4) & 1) + +#define gDPLoadTLUT(pkt, count, tmemaddr, dram) \ +_DW({ \ + gDPSetTextureImage(pkt, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram); \ + gDPTileSyncInTexLoad(pkt); \ + gDPSetTile(pkt, 0, 0, 0, tmemaddr, \ + _G_PALTMEMTOTILE(tmemaddr), 0, 0, 0, 0, 0, 0, 0); \ + gDPLoadSyncInTexLoad(pkt); \ + gDPLoadTLUTCmd(pkt, _G_PALTMEMTOTILE(tmemaddr), ((count) - 1)); \ + gDPPipeSyncInTexLoad(pkt); \ +}) + +#define gsDPLoadTLUT(count, tmemaddr, dram) \ + gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, dram), \ + gsDPTileSyncInTexLoad \ + gsDPSetTile(0, 0, 0, tmemaddr, \ + _G_PALTMEMTOTILE(tmemaddr), 0, 0, 0, 0, 0, 0, 0), \ + gsDPLoadSyncInTexLoad \ + gsDPLoadTLUTCmd(_G_PALTMEMTOTILE(tmemaddr), ((count) - 1)) \ + gsDPPipeSyncEndOfTexLoad + + + +#define gDPSetScissor(pkt, mode, ulx, uly, lrx, lry) \ +_DW({ \ + Gfx *_g = (Gfx *)pkt; \ + \ + _g->words.w0 = (_SHIFTL(G_SETSCISSOR, 24, 8) | \ + _SHIFTL((int)((float)(ulx) * 4.0f), 12, 12) | \ + _SHIFTL((int)((float)(uly) * 4.0f), 0, 12)); \ + _g->words.w1 = (_SHIFTL(mode, 24, 2) | \ + _SHIFTL((int)((float)(lrx) * 4.0f), 12, 12) | \ + _SHIFTL((int)((float)(lry) * 4.0f), 0, 12)); \ +}) + + +#define gDPSetScissorFrac(pkt, mode, ulx, uly, lrx, lry) \ +_DW({ \ + Gfx *_g = (Gfx *)pkt; \ + \ + _g->words.w0 = (_SHIFTL(G_SETSCISSOR, 24, 8) | \ + _SHIFTL((int)((ulx)), 12, 12) | \ + _SHIFTL((int)((uly)), 0, 12)); \ + _g->words.w1 = (_SHIFTL(mode, 24, 2) | \ + _SHIFTL((int)((lrx)), 12, 12) | \ + _SHIFTL((int)((lry)), 0, 12)); \ +}) + +#define gsDPSetScissor(mode, ulx, uly, lrx, lry) \ +{ \ + (_SHIFTL(G_SETSCISSOR, 24, 8) | \ + _SHIFTL((int)((float)(ulx) * 4.0f), 12, 12) | \ + _SHIFTL((int)((float)(uly) * 4.0f), 0, 12)), \ + (_SHIFTL(mode, 24, 2) | \ + _SHIFTL((int)((float)(lrx) * 4.0f), 12, 12) | \ + _SHIFTL((int)((float)(lry) * 4.0f), 0, 12)) \ +} + +#define gsDPSetScissorFrac(mode, ulx, uly, lrx, lry) \ +{ \ + (_SHIFTL(G_SETSCISSOR, 24, 8) | \ + _SHIFTL((int)((ulx)), 12, 12) | \ + _SHIFTL((int)((uly)), 0, 12)), \ + (_SHIFTL(mode, 24, 2) | \ + _SHIFTL((int)(lrx), 12, 12) | \ + _SHIFTL((int)(lry), 0, 12)) \ +} + +/* Fraction never used in fill */ +#define gDPFillRectangle(pkt, ulx, uly, lrx, lry) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_FILLRECT, 24, 8) | \ + _SHIFTL((lrx), 14, 10) | \ + _SHIFTL((lry), 2, 10)); \ + _g->words.w1 = (_SHIFTL((ulx), 14, 10) | \ + _SHIFTL((uly), 2, 10)); \ +}) + +#define gsDPFillRectangle(ulx, uly, lrx, lry) \ +{ \ + (_SHIFTL(G_FILLRECT, 24, 8) | \ + _SHIFTL((lrx), 14, 10) | \ + _SHIFTL((lry), 2, 10)), \ + (_SHIFTL((ulx), 14, 10) | \ + _SHIFTL((uly), 2, 10)) \ +} + +/* like gDPFillRectangle but accepts negative arguments */ +#define gDPScisFillRectangle(pkt, ulx, uly, lrx, lry) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_FILLRECT, 24, 8) | \ + _SHIFTL(MAX((lrx), 0), 14, 10) | \ + _SHIFTL(MAX((lry), 0), 2, 10)); \ + _g->words.w1 = (_SHIFTL(MAX((ulx), 0), 14, 10) | \ + _SHIFTL(MAX((uly), 0), 2, 10)); \ +}) + +#define gDPSetConvert(pkt, k0, k1, k2, k3, k4, k5) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_SETCONVERT, 24, 8) | \ + _SHIFTL(k0, 13, 9) | \ + _SHIFTL(k1, 4, 9) | \ + _SHIFTR(k2, 5, 4)); \ + _g->words.w1 = (_SHIFTL(k2, 27, 5) | \ + _SHIFTL(k3, 18, 9) | \ + _SHIFTL(k4, 9, 9) | \ + _SHIFTL(k5, 0, 9)); \ +}) + +#define gsDPSetConvert(k0, k1, k2, k3, k4, k5) \ +{ \ + (_SHIFTL(G_SETCONVERT, 24, 8) | \ + _SHIFTL(k0, 13, 9) | \ + _SHIFTL(k1, 4, 9) | \ + _SHIFTL(k2, 5, 4)), \ + (_SHIFTL(k2, 27, 5) | \ + _SHIFTL(k3, 18, 9) | \ + _SHIFTL(k4, 9, 9) | \ + _SHIFTL(k5, 0, 9)) \ +} + +#define gDPSetKeyR(pkt, cR, sR, wR) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = _SHIFTL(G_SETKEYR, 24, 8); \ + _g->words.w1 = (_SHIFTL(wR, 16, 12) | \ + _SHIFTL(cR, 8, 8) | \ + _SHIFTL(sR, 0, 8)); \ +}) + +#define gsDPSetKeyR(cR, sR, wR) \ +{ \ + _SHIFTL(G_SETKEYR, 24, 8), \ + (_SHIFTL(wR, 16, 12) | \ + _SHIFTL(cR, 8, 8) | \ + _SHIFTL(sR, 0, 8)) \ +} + +#define gDPSetKeyGB(pkt, cG, sG, wG, cB, sB, wB) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_SETKEYGB, 24, 8) | \ + _SHIFTL(wG, 12, 12) | \ + _SHIFTL(wB, 0, 12)); \ + _g->words.w1 = (_SHIFTL(cG, 24, 8) | \ + _SHIFTL(sG, 16, 8) | \ + _SHIFTL(cB, 8, 8) | \ + _SHIFTL(sB, 0, 8)); \ +}) + +#define gsDPSetKeyGB(cG, sG, wG, cB, sB, wB) \ +{ \ + (_SHIFTL(G_SETKEYGB, 24, 8) | \ + _SHIFTL(wG, 12, 12) | \ + _SHIFTL(wB, 0, 12)), \ + (_SHIFTL(cG, 24, 8) | \ + _SHIFTL(sG, 16, 8) | \ + _SHIFTL(cB, 8, 8) | \ + _SHIFTL(sB, 0, 8)) \ +} + +#define gDPNoParam(pkt, cmd) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = _SHIFTL(cmd, 24, 8); \ + _g->words.w1 = 0; \ +}) + +#define gsDPNoParam(cmd) \ +{ \ + _SHIFTL(cmd, 24, 8), \ + 0 \ +} + +#define gDPParam(pkt, cmd, param) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = _SHIFTL(cmd, 24, 8); \ + _g->words.w1 = (param); \ +}) + +#define gsDPParam(cmd, param) \ +{ \ + _SHIFTL(cmd, 24, 8), \ + (param) \ +} + +/* Notice that textured rectangles are 128-bit commands, therefore + * gsDPTextureRectangle() should not be used in display lists + * under normal circumstances (use gsSPTextureRectangle()). + * That is also why there is no gDPTextureRectangle() macros. + */ +#define gsDPTextureRectangle(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ +{ \ + (_SHIFTL(G_TEXRECT, 24, 8) | \ + _SHIFTL(xh, 12, 12) | \ + _SHIFTL(yh, 0, 12)), \ + (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(xl, 12, 12) | \ + _SHIFTL(yl, 0, 12)), \ +}, \ +{ \ + (_SHIFTL(s, 16, 16) | \ + _SHIFTL(t, 0, 16)), \ + (_SHIFTL(dsdx, 16, 16) | \ + _SHIFTL(dtdy, 0, 16)) \ +} + +#define gDPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + if (pkt); \ + _g->words.w0 = (_SHIFTL(G_TEXRECT, 24, 8) | \ + _SHIFTL(xh, 12, 12) | \ + _SHIFTL(yh, 0, 12)); \ + _g->words.w1 = (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(xl, 12, 12) | \ + _SHIFTL(yl, 0, 12)); \ + _g ++; \ + _g->words.w0 = (_SHIFTL(s, 16, 16) | \ + _SHIFTL(t, 0, 16)); \ + _g->words.w1 = (_SHIFTL(dsdx, 16, 16) | \ + _SHIFTL(dtdy, 0, 16)); \ +}) + +#define gsDPTextureRectangleFlip(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ +{ \ + (_SHIFTL(G_TEXRECTFLIP, 24, 8) | \ + _SHIFTL(xh, 12, 12) | \ + _SHIFTL(yh, 0, 12)), \ + (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(xl, 12, 12) | \ + _SHIFTL(yl, 0, 12)), \ +}, \ +{ \ + (_SHIFTL(s, 16, 16) | \ + _SHIFTL(t, 0, 16)), \ + (_SHIFTL(dsdx, 16, 16) | \ + _SHIFTL(dtdy, 0, 16)) \ +} + +#define gDPTextureRectangleFlip(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + if (pkt); \ + _g->words.w0 = (_SHIFTL(G_TEXRECTFLIP, 24, 8) | \ + _SHIFTL(xh, 12, 12) | \ + _SHIFTL(yh, 0, 12)); \ + _g->words.w1 = (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(xl, 12, 12) | \ + _SHIFTL(yl, 0, 12)); \ + _g ++; \ + _g->words.w0 = (_SHIFTL(s, 16, 16) | \ + _SHIFTL(t, 0, 16)); \ + _g->words.w1 = (_SHIFTL(dsdx, 16, 16) | \ + _SHIFTL(dtdy, 0, 16)); \ +}) + +#define gsSPTextureRectangle(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ + (_SHIFTL(G_TEXRECT, 24, 8) | \ + _SHIFTL(xh, 12, 12) | \ + _SHIFTL(yh, 0, 12)), \ + (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(xl, 12, 12) | \ + _SHIFTL(yl, 0, 12)), \ + gsImmp1(G_RDPHALF_1, \ + (_SHIFTL(s, 16, 16) | \ + _SHIFTL(t, 0, 16))), \ + gsImmp1(G_RDPHALF_2, \ + (_SHIFTL(dsdx, 16, 16) | \ + _SHIFTL(dtdy, 0, 16))) + +#define gSPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_TEXRECT, 24, 8) | \ + _SHIFTL(xh, 12, 12) | \ + _SHIFTL(yh, 0, 12)); \ + _g->words.w1 = (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(xl, 12, 12) | \ + _SHIFTL(yl, 0, 12)); \ + gImmp1(pkt, G_RDPHALF_1, \ + (_SHIFTL(s, 16, 16) | \ + _SHIFTL(t, 0, 16))); \ + gImmp1(pkt, G_RDPHALF_2, \ + (_SHIFTL(dsdx, 16, 16) | \ + _SHIFTL(dtdy, 0, 16))); \ +}) + +/* like gSPTextureRectangle but accepts negative position arguments */ +#define gSPScisTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_TEXRECT, 24, 8) | \ + _SHIFTL(MAX((s16)(xh),0), 12, 12) | \ + _SHIFTL(MAX((s16)(yh),0), 0, 12)); \ + _g->words.w1 = (_SHIFTL((tile), 24, 3) | \ + _SHIFTL(MAX((s16)(xl),0), 12, 12) | \ + _SHIFTL(MAX((s16)(yl),0), 0, 12)); \ + gImmp1(pkt, G_RDPHALF_1, \ + (_SHIFTL(((s) - \ + (((s16)(xl) < 0) ? \ + (((s16)(dsdx) < 0) ? \ + (MAX((((s16)(xl) * (s16)(dsdx)) >> 7), 0)) : \ + (MIN((((s16)(xl) * (s16)(dsdx)) >> 7), 0))) : 0)), 16, 16) | \ + _SHIFTL(((t) - \ + (( (yl) < 0) ? \ + (((s16)(dtdy) < 0) ? \ + (MAX((((s16)(yl) * (s16)(dtdy)) >> 7), 0)) : \ + (MIN((((s16)(yl) * (s16)(dtdy)) >> 7), 0))) : 0)), 0, 16))); \ + gImmp1(pkt, G_RDPHALF_2, \ + (_SHIFTL((dsdx), 16, 16) | \ + _SHIFTL((dtdy), 0, 16))); \ +}) + +#define gsSPTextureRectangleFlip(xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ + (_SHIFTL(G_TEXRECTFLIP, 24, 8) | \ + _SHIFTL(xh, 12, 12) | \ + _SHIFTL(yh, 0, 12)), \ + (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(xl, 12, 12) | \ + _SHIFTL(yl, 0, 12)), \ + gsImmp1(G_RDPHALF_1, \ + (_SHIFTL(s, 16, 16) | \ + _SHIFTL(t, 0, 16))), \ + gsImmp1(G_RDPHALF_2, \ + (_SHIFTL(dsdx, 16, 16) | \ + _SHIFTL(dtdy, 0, 16))) + +#define gSPTextureRectangleFlip(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_TEXRECTFLIP, 24, 8) | \ + _SHIFTL(xh, 12, 12) | \ + _SHIFTL(yh, 0, 12)); \ + _g->words.w1 = (_SHIFTL(tile, 24, 3) | \ + _SHIFTL(xl, 12, 12) | \ + _SHIFTL(yl, 0, 12)); \ + gImmp1(pkt, G_RDPHALF_1, \ + (_SHIFTL(s, 16, 16) | \ + _SHIFTL(t, 0, 16))); \ + gImmp1(pkt, G_RDPHALF_2, \ + (_SHIFTL(dsdx, 16, 16) | \ + _SHIFTL(dtdy, 0, 16))); \ +}) + +#define gsDPWord(wordhi, wordlo) \ + gsImmp1(G_RDPHALF_1, (unsigned int)(wordhi)), \ + gsImmp1(G_RDPHALF_2, (unsigned int)(wordlo)) + +#define gDPWord(pkt, wordhi, wordlo) \ +_DW({ \ + Gfx *_g = (Gfx *)(pkt); \ + \ + gImmp1(pkt, G_RDPHALF_1, (unsigned int)(wordhi)); \ + gImmp1(pkt, G_RDPHALF_2, (unsigned int)(wordlo)); \ +}) + +#define gDPFullSync(pkt) gDPNoParam(pkt, G_RDPFULLSYNC) +#define gsDPFullSync() gsDPNoParam( G_RDPFULLSYNC) +#define gDPTileSync(pkt) gDPNoParam(pkt, G_RDPTILESYNC) +#define gsDPTileSync() gsDPNoParam( G_RDPTILESYNC) +#define gDPPipeSync(pkt) gDPNoParam(pkt, G_RDPPIPESYNC) +#define gsDPPipeSync() gsDPNoParam( G_RDPPIPESYNC) +#define gDPLoadSync(pkt) gDPNoParam(pkt, G_RDPLOADSYNC) +#define gsDPLoadSync() gsDPNoParam( G_RDPLOADSYNC) +#define gDPNoOp(pkt) gDPNoParam(pkt, G_NOOP) +#define gsDPNoOp() gsDPNoParam( G_NOOP) +#define gDPNoOpTag(pkt, tag) gDPParam(pkt, G_NOOP, tag) +#define gsDPNoOpTag(tag) gsDPParam( G_NOOP, tag) + +#define gDPNoOpHere(pkt, file, line) gDma1p(pkt, G_NOOP, file, line, 1) +#define gDPNoOpString(pkt, data, n) gDma1p(pkt, G_NOOP, data, n, 2) +#define gDPNoOpWord(pkt, data, n) gDma1p(pkt, G_NOOP, data, n, 3) +#define gDPNoOpFloat(pkt, data, n) gDma1p(pkt, G_NOOP, data, n, 4) +#define gDPNoOpQuiet(pkt) gDma1p(pkt, G_NOOP, 0, 0, 5) +#define gDPNoOpVerbose(pkt, n) gDma1p(pkt, G_NOOP, 0, n, 5) +#define gDPNoOpCallBack(pkt, callback, arg) gDma1p(pkt, G_NOOP, callback, arg, 6) +#define gDPNoOpOpenDisp(pkt, file, line) gDma1p(pkt, G_NOOP, file, line, 7) +#define gDPNoOpCloseDisp(pkt, file, line) gDma1p(pkt, G_NOOP, file, line, 8) +#define gDPNoOpTag3(pkt, type, data, n) gDma1p(pkt, G_NOOP, data, n, type) + +#endif /* F3DEX3_H */ diff --git a/include/ultra64/gbi.h b/include/ultra64/gbi.h index a38d85f03..816cc3dab 100644 --- a/include/ultra64/gbi.h +++ b/include/ultra64/gbi.h @@ -3,6 +3,15 @@ #ifndef ULTRA64_GBI_H #define ULTRA64_GBI_H +#include "config.h" + +#if ENABLE_F3DEX3 + #define REQUIRE_SEMICOLONS_AFTER_GBI_COMMANDS + #if ENABLE_F3DEX3_RECOMMENDATIONS + #define NO_SYNCS_IN_TEXTURE_LOADS + #endif + #include "gbi.f3dex3.h" +#else /* To enable Fast3DEX grucode support, define F3DEX_GBI. */ /* Types */ @@ -2896,6 +2905,9 @@ _DW({ \ gsDma1p( G_MOVEMEM, (l), sizeof(Light), ((n) - 1) * 2 + G_MV_L0) #endif /* F3DEX_GBI_2 */ +// F3DEX3 compatibility +#define gSPAmbient gSPLight + /* * gSPLightColor changes color of light without recalculating light direction * col is a 32 bit word with r,g,b,a (alpha is ignored) @@ -5123,7 +5135,7 @@ _DW({ \ #define gDPNoOpTag(pkt, tag) gDPParam(pkt, G_NOOP, tag) #define gsDPNoOpTag(tag) gsDPParam( G_NOOP, tag) -#if OOT_DEBUG +#if IS_DEBUG #define gDPNoOpHere(pkt, file, line) gDma1p(pkt, G_NOOP, file, line, 1) #define gDPNoOpString(pkt, data, n) gDma1p(pkt, G_NOOP, data, n, 2) @@ -5149,8 +5161,10 @@ _DW({ \ #define gDPNoOpCloseDisp(pkt, file, line) #define gDPNoOpTag3(pkt, type, data, n) -#endif /* OOT_DEBUG */ +#endif /* IS_DEBUG */ #endif +#endif // ENABLE_F3DEX3 + #endif diff --git a/include/ultra64/libc.h b/include/ultra64/libc.h index f297bfd0d..e71cb879d 100644 --- a/include/ultra64/libc.h +++ b/include/ultra64/libc.h @@ -5,8 +5,14 @@ void osSyncPrintf(const char* fmt, ...); +#ifdef __GNUC__ +void bzero(void* __s, unsigned int __n); +int bcmp(const void* __sl, const void* __s2, unsigned int __n); +void bcopy(const void* __src, void* __dest, unsigned int __n); +#else void bzero(void* __s, int __n); int bcmp(const void* __sl, const void* __s2, int __n); void bcopy(const void* __src, void* __dest, int __n); +#endif #endif diff --git a/include/variables.h b/include/variables.h index f0fa2b9fe..6aa74e4c7 100644 --- a/include/variables.h +++ b/include/variables.h @@ -38,9 +38,11 @@ extern OSViContext* __osViCurr; extern OSViContext* __osViNext; extern OSViMode osViModeFpalLan1; extern u32 __additional_scanline; -extern u8 gBuildTeam[]; -extern u8 gBuildDate[]; -extern u8 gBuildMakeOption[]; +extern const char gBuildAuthor[]; +extern const char gBuildDate[]; +extern const char gBuildMakeOption[]; +extern const char gBuildGitVersion[]; +extern const char gBuildTeam[]; extern OSMesgQueue gPiMgrCmdQueue; extern OSViMode gViConfigMode; extern u8 gViConfigModeType; @@ -55,7 +57,7 @@ extern EffectSsOverlay gEffectSsOverlayTable[EFFECT_SS_TYPE_MAX]; extern Gfx D_80116280[]; extern ActorOverlay gActorOverlayTable[ACTOR_ID_MAX]; // original name: "actor_dlftbls" 801162A0 extern s32 gMaxActorId; // original name: "MaxProfile" -extern s32 gDebugCamEnabled; +extern s32 gDebugCamEnabled; // ENABLE_CAMERA_DEBUGGER extern GameStateOverlay gGameStateOverlayTable[GAMESTATE_ID_MAX]; extern u8 gWeatherMode; extern u8 gLightConfigAfterUnderwater; @@ -103,7 +105,7 @@ extern s32 gScreenWidth; extern s32 gScreenHeight; extern Mtx gMtxClear; extern MtxF gMtxFClear; -#if OOT_DEBUG +#if IS_DEBUG extern u32 gIsCtrlr2Valid; #endif extern s16* gWaveSamples[9]; @@ -143,13 +145,19 @@ extern u16 D_801333D0; extern Vec3f gSfxDefaultPos; extern f32 gSfxDefaultFreqAndVolScale; extern s8 gSfxDefaultReverb; + +// ENABLE_AUDIO_DEBUGGER extern u8 D_801333F0; extern u8 gAudioSfxSwapOff; extern u8 D_801333F8; + extern u8 gSeqCmdWritePos; extern u8 gSeqCmdReadPos; extern u8 gStartSeqDisabled; + +// ENABLE_AUDIO_DEBUGGER extern u8 gAudioDebugPrintSeqCmd; + extern u8 gSoundModeList[]; extern u8 gAudioSpecId; extern u8 D_80133418; @@ -189,6 +197,8 @@ extern Color_RGBA8_u32 gVisMonoColor; extern PreNmiBuff* gAppNmiBufferPtr; extern Scheduler gScheduler; extern uintptr_t gSegments[NUM_SEGMENTS]; + +// ENABLE_SPEEDMETER extern volatile OSTime gAudioThreadUpdateTimeTotalPerGfxTask; extern volatile OSTime gGfxTaskSentToNextReadyMinusAudioThreadUpdateTime; extern volatile OSTime gRSPAudioTimeTotal; @@ -211,9 +221,12 @@ extern SfxBankEntry D_8016C820[3]; extern SfxBankEntry D_8016C8B0[5]; extern ActiveSfx gActiveSfx[7][MAX_CHANNELS_PER_BANK]; // total size = 0xA8 extern u8 gSfxBankMuted[]; + +// ENABLE_AUDIO_DEBUGGER extern u16 gAudioSfxSwapSource[10]; extern u16 gAudioSfxSwapTarget[10]; extern u8 gAudioSfxSwapMode[10]; + extern ActiveSequence gActiveSeqs[4]; extern AudioContext gAudioCtx; extern AudioCustomUpdateFunction gAudioCustomUpdateFunction; @@ -231,6 +244,5 @@ extern u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)]; // 0xC00 byt extern u64 gGfxSPTaskStack[SP_DRAM_STACK_SIZE64]; // 0x400 bytes extern GfxPool gGfxPools[2]; // 0x24820 bytes extern u8 gAudioHeap[0x38000]; // 0x38000 bytes -extern u8 gSystemHeap[]; #endif diff --git a/include/widescreen.h b/include/widescreen.h new file mode 100644 index 000000000..6bfa9bf2c --- /dev/null +++ b/include/widescreen.h @@ -0,0 +1,38 @@ +#ifndef WIDESCREEN_H +#define WIDESCREEN_H + +// This file provides macros to handle switching between 4:3 and 16:9 and fixing issues. +// It is not meant to be something the users can edit. + +// Base un-wide values +#define WIDE_GET_4_3 (4.0f / 3.0f) +#define WIDE_GET_16_9 (16.0f / 9.0f) +#define WIDE_GET_RATIO (WIDE_GET_4_3 / WIDE_GET_16_9) + +// Maths +#define WIDE_DIV(originalVal, changeBy) (USE_WIDESCREEN ? (u16)(originalVal / changeBy) : originalVal) +#define WIDE_MULT(originalVal, changeBy) (USE_WIDESCREEN ? (u16)(originalVal * changeBy) : originalVal) +#define WIDE_INCR(originalVal, changeBy) (USE_WIDESCREEN ? originalVal + changeBy : originalVal) + +// Buttons base shift values +#define WIDE_BTNA_SHIFT 26 +#define WIDE_BTNB_SHIFT 37 +#define WIDE_BTNC_SHIFT 60 +#define WIDE_BTNSTART_SHIFT ((s32)(WIDE_GET_16_9 * 100.f)) + +// Individual C-Buttons shift values +#define WIDE_CRIGHT_SHIFT WIDE_BTNC_SHIFT +#define WIDE_CDOWN_SHIFT (WIDE_BTNC_SHIFT + 16) +#define WIDE_CLEFT_SHIFT (WIDE_BTNC_SHIFT + 32) +#define WIDE_CUP_SHIFT WIDE_CDOWN_SHIFT // c-up is synced with c-down +#define WIDE_C_SHIFT(button) (button == 0 ? WIDE_CLEFT_SHIFT : button == 1 ? WIDE_CDOWN_SHIFT : WIDE_CRIGHT_SHIFT) +#define WIDE_C_VAL(originalVal, button) WIDE_INCR(WIDE_DIV(originalVal, WIDE_GET_RATIO), (WIDE_C_SHIFT(button) * 4)) + +// Other shift values +#define WIDE_MINIMAP_SHIFT 110 +#define WIDE_MINIMAP_ARROW_SHIFT 1.55f +#define WIDE_MINIMAP_ARROW_SHIFT_DGN (1585.0f / 900.0f) +#define WIDE_ITEMICON_RIGHT_X(button) (button != 0 ? -25 : -32) +#define WIDE_N64_MODE(originalVal, changeBy) (WIDESCREEN_N64_MODE ? WIDE_INCR(originalVal, changeBy) : originalVal) + +#endif diff --git a/include/z64.h b/include/z64.h index 92ce7fb68..8da813d87 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1,6 +1,7 @@ #ifndef Z64_H #define Z64_H +#include "config.h" #include "ultra64.h" #include "ultra64/gs2dex.h" #include "attributes.h" @@ -58,6 +59,7 @@ #include "gfx.h" #include "jpeg.h" #include "prerender.h" +#include "widescreen.h" #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 240 @@ -100,11 +102,13 @@ #define REGION_NATIVE REGION_EU typedef struct { + // ENABLE_REG_EDITOR /* 0x00 */ s32 regPage; // 0: no page selected (reg editor is not active); 1: first page; `REG_PAGES`: last page /* 0x04 */ s32 regGroup; // Indexed from 0 to `REG_GROUPS`-1. Each group has its own character to identify it. /* 0x08 */ s32 regCur; // Selected reg, indexed from 0 as the page start /* 0x0C */ s32 dPadInputPrev; /* 0x10 */ s32 inputRepeatTimer; + /* 0x14 */ s16 data[REG_GROUPS * REGS_PER_GROUP]; // Accessed through *REG macros, see regs.h } RegEditor; // size = 0x15D4 @@ -113,6 +117,7 @@ typedef struct { /* 0x01 */ u8 natureAmbienceId; } SequenceContext; // size = 0x2 +// ENABLE_FRAMERATE_OPTIONS typedef struct { /* 0x00 */ s32 enabled; /* 0x04 */ s32 timer; @@ -194,8 +199,7 @@ typedef struct { typedef struct { /* 0x00 */ void* loadedRamAddr; - /* 0x04 */ uintptr_t vromStart; - /* 0x08 */ uintptr_t vromEnd; + /* 0x04 */ RomFile file; /* 0x0C */ void* vramStart; /* 0x10 */ void* vramEnd; /* 0x14 */ u32 offset; // loadedRamAddr - vramStart @@ -297,10 +301,10 @@ typedef struct { /* 0x00A4 */ u8* staticSegment; /* 0x00A8 */ View view; /* 0x01D0 */ SramContext sramCtx; - /* 0x01D4 */ u16 unk_1D4; // not used in mq dbg (some sort of timer that doesn't seem to affect anything) + /* 0x01D4 */ u16 timer; // not used in mq dbg (some sort of timer that doesn't seem to affect anything) /* 0x01D6 */ s16 coverAlpha; - /* 0x01D8 */ s16 addAlpha; // not used in mq dbg - /* 0x01DA */ u16 visibleDuration; // not used in mq dbg + /* 0x01D8 */ s16 addAlpha; + /* 0x01DA */ u16 visibleDuration; /* 0x01DC */ s16 ult; /* 0x01DE */ s16 uls; /* 0x01E0 */ char unk_1E0[0x01]; @@ -308,6 +312,7 @@ typedef struct { /* 0x01E2 */ char unk_1E2[0x06]; } ConsoleLogoState; // size = 0x1E8 +// vvv IS_MAP_SELECT_ENABLED vvv struct MapSelectState; typedef struct { @@ -319,25 +324,27 @@ typedef struct { typedef struct MapSelectState { /* 0x0000 */ GameState state; /* 0x00A8 */ View view; - /* 0x01D0 */ s32 count; + /* 0x01D0 */ s32 sceneTotal; /* 0x01D4 */ SceneSelectEntry* scenes; /* 0x01D8 */ s32 currentScene; /* 0x01DC */ s32 pageDownIndex; // Index of pageDownStops /* 0x01E0 */ s32 pageDownStops[7]; - /* 0x01FC */ char unk_1FC[0x0C]; - /* 0x0208 */ s32 opt; - /* 0x020C */ s32 topDisplayedScene; // The scene which is currently at the top of the screen - /* 0x0210 */ char unk_210[0x0C]; - /* 0x021C */ s32 verticalInputAccumulator; - /* 0x0220 */ s32 verticalInput; - /* 0x0224 */ s32 timerUp; - /* 0x0228 */ s32 timerDown; - /* 0x022C */ s32 lockUp; - /* 0x0230 */ s32 lockDown; - /* 0x0234 */ s32 unk_234; // unused - /* 0x0238 */ u8* staticSegment; + /* 0x01FC */ s32 topDisplayedScene; // The scene which is currently at the top of the screen + /* 0x0200 */ s32 verticalInputAccumulator; + /* 0x0204 */ s32 verticalInput; + /* 0x0208 */ s32 timerUp; + /* 0x020A */ s32 timerDown; + /* 0x020C */ s32 lockUp; + /* 0x0210 */ s32 lockDown; + /* 0x0214 */ u8 showControls; + /* 0x0218 */ u8 toggleBGM; + /* 0x021A */ u8 isBGMPlaying; + /* 0x021C */ u8 sceneLayer; + /* 0x0220 */ u8 selectedSceneColor; } MapSelectState; // size = 0x240 +// ^^^ IS_MAP_SELECT_ENABLED ^^^ + typedef struct { /* 0x0000 */ GameState state; /* 0x00A4 */ u8* staticSegment; @@ -385,7 +392,7 @@ typedef struct PlayState { /* 0x007A2 */ s16 nextCamId; /* 0x007A4 */ SequenceContext sequenceCtx; /* 0x007A8 */ LightContext lightCtx; - /* 0x007B8 */ FrameAdvanceContext frameAdvCtx; + /* 0x007B8 */ FrameAdvanceContext frameAdvCtx; // ENABLE_FRAMERATE_OPTIONS /* 0x007C0 */ CollisionContext colCtx; /* 0x01C24 */ ActorContext actorCtx; /* 0x01D64 */ CutsceneContext csCtx; // "demo_play" @@ -551,15 +558,14 @@ typedef struct { & (ENTRANCE_INFO_START_TRANS_TYPE_MASK >> ENTRANCE_INFO_START_TRANS_TYPE_SHIFT)) typedef struct { - /* 0x00 */ s8 sceneId; - /* 0x01 */ s8 spawn; + /* 0x00 */ u8 sceneId; + /* 0x01 */ u8 spawn; /* 0x02 */ u16 field; } EntranceInfo; // size = 0x4 typedef struct { /* 0x00 */ void* loadedRamAddr; - /* 0x04 */ uintptr_t vromStart; // if applicable - /* 0x08 */ uintptr_t vromEnd; // if applicable + /* 0x04 */ RomFile file; // if applicable /* 0x0C */ void* vramStart; // if applicable /* 0x10 */ void* vramEnd; // if applicable /* 0x14 */ void* unk_14; @@ -715,9 +721,9 @@ typedef struct ArenaNode { /* 0x04 */ u32 size; /* 0x08 */ struct ArenaNode* next; /* 0x0C */ struct ArenaNode* prev; -#if OOT_DEBUG // TODO: This debug info is also present in N64 retail builds +#if IS_DEBUG // TODO: This debug info is also present in N64 retail builds /* 0x10 */ const char* filename; - /* 0x14 */ s32 line; + /* 0x14 */ int line; /* 0x18 */ OSId threadId; /* 0x1C */ Arena* arena; /* 0x20 */ OSTime time; @@ -755,7 +761,12 @@ typedef struct OverlayRelocationSection { /* 0x14 */ u32 relocations[1]; // size is nRelocations } OverlayRelocationSection; // size >= 0x18 -typedef struct { +// This struct is used at osAppNMIBuffer which is not at an 8-byte aligned address. This causes an unaligned access +// crash if the OSTime variables use 64-bit load/store instructions, which is the case in any MIPS ABI other than O32 +// where 64-bit load/store instructions are emulated with 2x 32-bit load/store instructions. The alignment attribute +// conveys that this structure will not always be 8-bytes aligned, allowing a modern compiler to generate non-crashing +// code for accessing these. This is not an issue in the original compiler as it only output O32 ABI code. +ALIGNED(4) typedef struct { /* 0x00 */ u32 resetting; /* 0x04 */ u32 resetCount; /* 0x08 */ OSTime duration; diff --git a/include/z64actor.h b/include/z64actor.h index f14fa1a49..96cd6f4cf 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -42,7 +42,7 @@ typedef struct { /** * @see ACTOROVL_ALLOC_ABSOLUTE */ -#if OOT_DEBUG +#if IS_DEBUG #define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x27A0 #else #define ACTOROVL_ABSOLUTE_SPACE_SIZE 0x24E0 @@ -89,8 +89,7 @@ typedef struct { #define ACTOROVL_ALLOC_PERSISTENT (1 << 1) typedef struct { - /* 0x00 */ uintptr_t vromStart; - /* 0x04 */ uintptr_t vromEnd; + /* 0x00 */ RomFile file; /* 0x08 */ void* vramStart; /* 0x0C */ void* vramEnd; /* 0x10 */ void* loadedRamAddr; // original name: "allocp" @@ -135,7 +134,7 @@ typedef struct { typedef struct { /* 0x00 */ Vec3s rot; // Current actor shape rotation - /* 0x06 */ s16 face; // Used to index eyebrow/eye/mouth textures. Only used by player + /* 0x06 */ s16 face; // Used to index eyes and mouth textures. Only used by player /* 0x08 */ f32 yOffset; // Model y axis offset. Represents model space units /* 0x0C */ ActorShadowFunc shadowDraw; // Shadow draw function /* 0x10 */ f32 shadowScale; // Changes the size of the shadow @@ -309,7 +308,7 @@ typedef struct Actor { /* 0x130 */ ActorFunc update; // Update Routine. Called by `Actor_UpdateAll` /* 0x134 */ ActorFunc draw; // Draw Routine. Called by `Actor_Draw` /* 0x138 */ ActorOverlay* overlayEntry; // Pointer to the overlay table entry for this actor -#if OOT_DEBUG +#if IS_DEBUG /* 0x13C */ char dbgPad[0x10]; #endif } Actor; // size = 0x14C diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index 9ff85c55e..0568d7bd3 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -267,8 +267,6 @@ typedef struct { /* 0x00 */ u16 max; // original name: short_slist_node_size /* 0x02 */ u16 count; // original name: short_slist_node_last_index /* 0x04 */ SSNode* tbl; // original name: short_slist_node_tbl - /* 0x08 */ u8* polyCheckTbl; // points to an array of bytes, one per static poly. Zero initialized when starting a - // bg check, and set to 1 if that poly has already been tested. } SSNodeList; typedef struct { diff --git a/include/z64camera.h b/include/z64camera.h index 81584c1b6..8b4e3684d 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -6,6 +6,8 @@ #include "z64math.h" #include "z64save.h" +#include "config.h" + // these two angle conversion macros are slightly inaccurate #define CAM_DEG_TO_BINANG(degrees) (s16)TRUNCF_BINANG((degrees) * 182.04167f + .5f) #define CAM_BINANG_TO_DEG(binang) ((f32)(binang) * (360.0001525f / 65535.0f)) @@ -1620,6 +1622,8 @@ typedef struct Camera { /* 0x16A */ s16 unk_16A; } Camera; // size = 0x16C +// ENABLE_CAMERA_DEBUGGER + /** * Debug Camera */ diff --git a/include/z64collision_check.h b/include/z64collision_check.h index bf411201d..aa69dedb0 100644 --- a/include/z64collision_check.h +++ b/include/z64collision_check.h @@ -76,23 +76,23 @@ typedef struct { } ColliderInitToActor; // size = 0x08 typedef struct { - /* 0x00 */ u32 dmgFlags; // Toucher damage type flags. + /* 0x00 */ u32 dmgFlags; // Damage types dealt by this collider element as AT. /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) - /* 0x05 */ u8 damage; // Damage or Stun Timer -} ColliderElementTouch; // size = 0x08 + /* 0x05 */ u8 damage; // Damage +} ColliderElementDamageInfoAT; // size = 0x08 typedef struct { - /* 0x00 */ u32 dmgFlags; // Bumper damage type flags. + /* 0x00 */ u32 dmgFlags; // Damage types that may affect this collider element as AC. /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) /* 0x05 */ u8 defense; // Damage Resistance /* 0x06 */ Vec3s hitPos; // Point of contact -} ColliderElementBump; // size = 0x0C +} ColliderElementDamageInfoAC; // size = 0x0C typedef struct { - /* 0x00 */ u32 dmgFlags; // Bumper exclusion mask + /* 0x00 */ u32 dmgFlags; // Damage types that may affect this collider element as AC. /* 0x04 */ u8 effect; // Damage Effect (Knockback, Fire, etc.) /* 0x05 */ u8 defense; // Damage Resistance -} ColliderElementBumpInit; // size = 0x08 +} ColliderElementDamageInfoACInit; // size = 0x08 /** * Affects the sound Link's sword makes when hitting it, hookability, @@ -112,11 +112,11 @@ typedef enum { } ElementType; typedef struct ColliderElement { - /* 0x00 */ ColliderElementTouch toucher; // Damage properties when acting as an AT collider - /* 0x08 */ ColliderElementBump bumper; // Damage properties when acting as an AC collider + /* 0x00 */ ColliderElementDamageInfoAT atDmgInfo; // Damage properties when acting as an AT collider + /* 0x08 */ ColliderElementDamageInfoAC acDmgInfo; // Damage properties when acting as an AC collider /* 0x14 */ u8 elemType; // Affects sfx reaction when attacked by Link and hookability. Full purpose unknown. - /* 0x15 */ u8 toucherFlags; // Information flags for AT collisions - /* 0x16 */ u8 bumperFlags; // Information flags for AC collisions + /* 0x15 */ u8 atElemFlags; // Information flags for AT collisions + /* 0x16 */ u8 acElemFlags; // Information flags for AC collisions /* 0x17 */ u8 ocElemFlags; // Information flags for OC collisions /* 0x18 */ Collider* atHit; // object touching this element's AT collider /* 0x1C */ Collider* acHit; // object touching this element's AC collider @@ -126,10 +126,10 @@ typedef struct ColliderElement { typedef struct { /* 0x00 */ u8 elemType; // Affects sfx reaction when attacked by Link and hookability. Full purpose unknown. - /* 0x04 */ ColliderElementTouch toucher; // Damage properties when acting as an AT collider - /* 0x0C */ ColliderElementBumpInit bumper; // Damage properties when acting as an AC collider - /* 0x14 */ u8 toucherFlags; // Information flags for AT collisions - /* 0x15 */ u8 bumperFlags; // Information flags for AC collisions + /* 0x04 */ ColliderElementDamageInfoAT atDmgInfo; // Damage properties when acting as an AT collider + /* 0x0C */ ColliderElementDamageInfoACInit acDmgInfo; // Damage properties when acting as an AC collider + /* 0x14 */ u8 atElemFlags; // Information flags for AT collisions + /* 0x15 */ u8 acElemFlags; // Information flags for AC collisions /* 0x16 */ u8 ocElemFlags; // Information flags for OC collisions } ColliderElementInit; // size = 0x18 @@ -349,28 +349,28 @@ typedef struct { #define OC2_TYPE_2 OC1_TYPE_2 // Has OC type 2 #define OC2_FIRST_ONLY (1 << 6) // Skips AC checks on elements after the first collision. Only used by Ganon -#define TOUCH_NONE 0 // No flags set. Cannot have AT collisions -#define TOUCH_ON (1 << 0) // Can have AT collisions -#define TOUCH_HIT (1 << 1) // Had an AT collision -#define TOUCH_NEAREST (1 << 2) // If a Quad, only collides with the closest bumper -#define TOUCH_SFX_MASK (3 << 3) -#define TOUCH_SFX_NORMAL (0 << 3) // Hit sound effect based on AC collider's type -#define TOUCH_SFX_HARD (1 << 3) // Always uses hard deflection sound -#define TOUCH_SFX_WOOD (2 << 3) // Always uses wood deflection sound -#define TOUCH_SFX_NONE (3 << 3) // No hit sound effect -#define TOUCH_AT_HITMARK (1 << 5) // Draw hitmarks for every AT collision -#define TOUCH_DREW_HITMARK (1 << 6) // Already drew hitmark for this frame -#define TOUCH_UNK7 (1 << 7) // Unknown purpose. Used by some enemy quads +#define ATELEM_NONE 0 // No flags set. Cannot have AT collisions +#define ATELEM_ON (1 << 0) // Can have AT collisions +#define ATELEM_HIT (1 << 1) // Had an AT collision +#define ATELEM_NEAREST (1 << 2) // For COLSHAPE_QUAD colliders, only collide with the closest AC element +#define ATELEM_SFX_MASK (3 << 3) +#define ATELEM_SFX_NORMAL (0 << 3) // Hit sound effect based on AC collider's type +#define ATELEM_SFX_HARD (1 << 3) // Always uses hard deflection sound +#define ATELEM_SFX_WOOD (2 << 3) // Always uses wood deflection sound +#define ATELEM_SFX_NONE (3 << 3) // No hit sound effect +#define ATELEM_AT_HITMARK (1 << 5) // Draw hitmarks for every AT collision +#define ATELEM_DREW_HITMARK (1 << 6) // Already drew hitmark for this frame +#define ATELEM_UNK7 (1 << 7) // Unknown purpose. Used by some enemy quads -#define BUMP_NONE 0 // No flags set. Cannot have AC collisions -#define BUMP_ON (1 << 0) // Can have AC collisions -#define BUMP_HIT (1 << 1) // Had an AC collision -#define BUMP_HOOKABLE (1 << 2) // Can be hooked if actor has hookability flags set. -#define BUMP_NO_AT_INFO (1 << 3) // Does not give its info to the AT collider that hit it. -#define BUMP_NO_DAMAGE (1 << 4) // Does not take damage. -#define BUMP_NO_SWORD_SFX (1 << 5) // Does not have a sound effect when hit by player-attached AT colliders. -#define BUMP_NO_HITMARK (1 << 6) // Skips hit effects. -#define BUMP_DRAW_HITMARK (1 << 7) // Draw hitmark for AC collision this frame. +#define ACELEM_NONE 0 // No flags set. Cannot have AC collisions +#define ACELEM_ON (1 << 0) // Can have AC collisions +#define ACELEM_HIT (1 << 1) // Had an AC collision +#define ACELEM_HOOKABLE (1 << 2) // Can be hooked if actor has hookability flags set. +#define ACELEM_NO_AT_INFO (1 << 3) // Does not give its info to the AT collider that hit it. +#define ACELEM_NO_DAMAGE (1 << 4) // Does not take damage. +#define ACELEM_NO_SWORD_SFX (1 << 5) // Does not have a sound effect when hit by player-attached AT colliders. +#define ACELEM_NO_HITMARK (1 << 6) // Skips hit effects. +#define ACELEM_DRAW_HITMARK (1 << 7) // Draw hitmark for AC collision this frame. #define OCELEM_NONE 0 // No flags set. Cannot have OC collisions #define OCELEM_ON (1 << 0) // Can have OC collisions diff --git a/include/z64cutscene.h b/include/z64cutscene.h index ebd261220..99cca6263 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -3,20 +3,6 @@ #include "ultra64.h" -/** - * Special type for blocks of cutscene data, asm-processor checks - * arrays for CutsceneData type and converts floats within the array - * to their IEEE-754 representation. The array must close with }; - * on its own line. - * - * Files that contain this type that are included in other C files - * must be preceded by a '#pragma asmproc recurse' qualifier to - * inform asm-processor that it must recursively process that include. - * - * Example: - * #pragma asmproc recurse - * #include "file.c" - */ typedef union CutsceneData { s32 i; f32 f; diff --git a/include/z64cutscene_commands.h b/include/z64cutscene_commands.h index beaecb798..5de3d3c83 100644 --- a/include/z64cutscene_commands.h +++ b/include/z64cutscene_commands.h @@ -21,9 +21,18 @@ * when sometimes only the `startFrame` matters (as documented). */ +/** + * CMD_F expects an (IEEE 754) encoded float (colloquially "in hex", such as `0x42280000`), + * rather than a C float literal (such as `42.0f`). + * Float literals cannot be used because cutscenes are arrays of union type CutsceneData, which may contain integers and floats. + * Regardless of CutsceneData having a float member, initializing with a float will cast the float to s32. + * Designated initializers (added in C99) would solve this problem but are not supported by IDO (C89 and some extensions). + */ #ifdef __GNUC__ +#define CS_FLOAT(ieee754bin, f) (f) #define CMD_F(a) {.f = (a)} #else +#define CS_FLOAT(ieee754bin, f) (ieee754bin) #define CMD_F(a) {(a)} #endif @@ -112,10 +121,10 @@ * The lighting change will take place immediately with no blending. * @note `endFrame` is not used in the implementation of the command, so its value does not matter */ -#define CS_LIGHT_SETTING(lightSetting, startFrame, endFrame, unused0, unused1, unused2, unused3, unused4, unused5, unused6, unused7) \ +#define CS_LIGHT_SETTING(lightSetting, startFrame, endFrame, unused0, unused1, unused2, unused3, unused4, unused5, unused6, unused7, unused8, unused9, unused10) \ CMD_BBH(0, (lightSetting + 1), startFrame), CMD_HH(endFrame, unused0), \ CMD_W(unused1), CMD_W(unused2), CMD_W(unused3), CMD_W(unused4), CMD_W(unused5), \ - CMD_W(unused6), CMD_W(unused7), 0x00000000, 0x00000000, 0x00000000 + CMD_W(unused6), CMD_W(unused7), CMD_W(unused8), CMD_W(unused9), CMD_W(unused10) /** * Declares a list of `CS_RUMBLE_CONTROLLER` entries. diff --git a/include/z64dma.h b/include/z64dma.h index fb9d03c72..7fdb530ae 100755 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -3,37 +3,25 @@ #include "ultra64.h" #include "alignment.h" +#include "romfile.h" typedef struct { /* 0x00 */ uintptr_t vromAddr; // VROM address (source) /* 0x04 */ void* dramAddr; // DRAM address (destination) /* 0x08 */ size_t size; // File Transfer size /* 0x0C */ const char* filename; // Filename for debugging - /* 0x10 */ s32 line; // Line for debugging + /* 0x10 */ int line; // Line number for debugging /* 0x14 */ s32 unk_14; /* 0x18 */ OSMesgQueue* notifyQueue; // Message queue for the notification message /* 0x1C */ OSMesg notifyMsg; // Completion notification message } DmaRequest; // size = 0x20 typedef struct { - /* 0x00 */ uintptr_t vromStart; - /* 0x04 */ uintptr_t vromEnd; + /* 0x00 */ RomFile file; /* 0x08 */ uintptr_t romStart; /* 0x0C */ uintptr_t romEnd; } DmaEntry; -typedef struct { - /* 0x00 */ uintptr_t vromStart; - /* 0x04 */ uintptr_t vromEnd; -} RomFile; // size = 0x8 - -#define ROM_FILE(name) \ - { (uintptr_t)_##name##SegmentRomStart, (uintptr_t)_##name##SegmentRomEnd } -#define ROM_FILE_EMPTY(name) \ - { (uintptr_t)_##name##SegmentRomStart, (uintptr_t)_##name##SegmentRomStart } -#define ROM_FILE_UNSET \ - { 0 } - extern DmaEntry gDmaDataTable[]; extern u32 gDmaMgrVerbose; @@ -46,10 +34,10 @@ extern size_t gDmaMgrDmaBuffSize; s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk5, OSMesgQueue* queue, OSMesg msg); s32 DmaMgr_RequestSync(void* ram, uintptr_t vrom, size_t size); -#if OOT_DEBUG +#if IS_DEBUG s32 DmaMgr_RequestAsyncDebug(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk5, OSMesgQueue* queue, - OSMesg msg, const char* file, s32 line); -s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, s32 line); + OSMesg msg, const char* file, int line); +s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, int line); #endif // Special-purpose DMA Requests diff --git a/include/z64effect.h b/include/z64effect.h index 4189edc5b..e90ff85af 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -202,8 +202,7 @@ typedef struct { } EffectSsInit; // size = 0x08 typedef struct { - /* 0x00 */ uintptr_t vromStart; - /* 0x04 */ uintptr_t vromEnd; + /* 0x00 */ RomFile file; /* 0x08 */ void* vramStart; /* 0x0C */ void* vramEnd; /* 0x10 */ void* loadedRamAddr; diff --git a/include/z64object.h b/include/z64object.h index aa7c2a85e..057b445b6 100644 --- a/include/z64object.h +++ b/include/z64object.h @@ -23,7 +23,7 @@ typedef struct { } ObjectContext; // size = 0x518 #define DEFINE_OBJECT(_0, enum) enum, -#define DEFINE_OBJECT_NULL(_0, enum) enum, +#define DEFINE_OBJECT_EMPTY(_0, enum) enum, #define DEFINE_OBJECT_UNSET(enum) enum, typedef enum { @@ -32,7 +32,7 @@ typedef enum { } ObjectId; #undef DEFINE_OBJECT -#undef DEFINE_OBJECT_NULL +#undef DEFINE_OBJECT_EMPTY #undef DEFINE_OBJECT_UNSET #endif diff --git a/include/z64pause.h b/include/z64pause.h index 1cc810c31..75e9ced37 100644 --- a/include/z64pause.h +++ b/include/z64pause.h @@ -5,6 +5,8 @@ #include "z64message.h" #include "z64view.h" +#include "config.h" + struct OcarinaStaff; #define PAUSE_ITEM_NONE 999 @@ -52,8 +54,13 @@ typedef enum { #define IS_PAUSE_STATE_GAMEOVER(pauseCtx) \ (((pauseCtx)->state >= PAUSE_STATE_8) && ((pauseCtx)->state <= PAUSE_STATE_17)) -#define IS_PAUSED(pauseCtx) \ - (((pauseCtx)->state != PAUSE_STATE_OFF) || ((pauseCtx)->debugState != 0)) +#if ENABLE_INV_EDITOR || ENABLE_EVENT_EDITOR + #define IS_PAUSED(pauseCtx) \ + (((pauseCtx)->state != PAUSE_STATE_OFF) || ((pauseCtx)->debugState != 0)) +#else + #define IS_PAUSED(pauseCtx) \ + ((pauseCtx)->state != PAUSE_STATE_OFF) +#endif // Sub-states of PAUSE_STATE_MAIN typedef enum { @@ -95,7 +102,7 @@ typedef struct { /* 0x01B8 */ OSMesgQueue loadQueue; /* 0x01D0 */ OSMesg loadMsg; /* 0x01D4 */ u16 state; - /* 0x01D6 */ u16 debugState; + /* 0x01D6 */ u16 debugState; // ENABLE_INV_EDITOR || ENABLE_EVENT_EDITOR /* 0x01D8 */ Vec3f eye; /* 0x01E4 */ u16 mainState; /* 0x01E6 */ u16 mode; diff --git a/include/z64player.h b/include/z64player.h index f47160bdb..89bb2cbf7 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -3,6 +3,7 @@ #include "z64actor.h" #include "alignment.h" +#include "face_change.h" struct Player; @@ -228,6 +229,52 @@ typedef enum { /* 3 */ PLAYER_DOORTYPE_FAKE } PlayerDoorType; +typedef enum { + /* 0 */ PLAYER_FACEPART_EYES, + /* 1 */ PLAYER_FACEPART_MOUTH, + /* 2 */ PLAYER_FACEPART_MAX +} PlayerFacePart; + +typedef enum { + /* 0 */ PLAYER_EYES_OPEN, + /* 1 */ PLAYER_EYES_HALF, + /* 2 */ PLAYER_EYES_CLOSED, + /* 3 */ PLAYER_EYES_LEFT, + /* 4 */ PLAYER_EYES_RIGHT, + /* 5 */ PLAYER_EYES_WIDE, + /* 6 */ PLAYER_EYES_DOWN, + /* 7 */ PLAYER_EYES_WINCING, + /* 8 */ PLAYER_EYES_MAX +} PlayerEyes; + +typedef enum { + /* 0 */ PLAYER_MOUTH_CLOSED, + /* 1 */ PLAYER_MOUTH_HALF, + /* 2 */ PLAYER_MOUTH_OPEN, + /* 3 */ PLAYER_MOUTH_SMILE, + /* 4 */ PLAYER_MOUTH_MAX +} PlayerMouth; + +typedef enum { + /* 0 */ PLAYER_FACE_NEUTRAL, // eyes open and mouth closed + /* 1 */ PLAYER_FACE_NEUTRAL_BLINKING_HALF, // eyes half open and mouth closed + /* 2 */ PLAYER_FACE_NEUTRAL_BLINKING_CLOSED, // eyes and mouth closed + /* 3 */ PLAYER_FACE_NEUTRAL_2, // same as `PLAYER_FACE_NEUTRAL` + /* 4 */ PLAYER_FACE_NEUTRAL_BLINKING_HALF_2, // same as `PLAYER_FACE_NEUTRAL_BLINKING_HALF` + /* 5 */ PLAYER_FACE_NEUTRAL_BLINKING_CLOSED_2, // same as `PLAYER_FACE_NEUTRAL_BLINKING_CLOSED` + /* 6 */ PLAYER_FACE_LOOK_RIGHT, // eyes looking right and mouth closed + /* 7 */ PLAYER_FACE_SURPRISED, // wide eyes and grimacing mouth + /* 8 */ PLAYER_FACE_HURT, // eyes wincing in pain and mouth open + /* 9 */ PLAYER_FACE_GASP, // eyes and mouth open + /* 10 */ PLAYER_FACE_LOOK_LEFT, // eyes looking left and mouth closed + /* 11 */ PLAYER_FACE_LOOK_RIGHT_2, // duplicate of `PLAYER_FACE_LOOK_RIGHT` + /* 12 */ PLAYER_FACE_EYES_CLOSED_MOUTH_OPEN, // eyes closed and mouth open + /* 13 */ PLAYER_FACE_OPENING, // eyes and mouth both halfway open + /* 14 */ PLAYER_FACE_EYES_AND_MOUTH_OPEN, // eyes and mouth open + /* 15 */ PLAYER_FACE_NEUTRAL_3, // same as `PLAYER_FACE_NEUTRAL` and `PLAYER_FACE_NEUTRAL_2` + /* 16 */ PLAYER_FACE_MAX +} PlayerFace; + typedef enum { /* 0x00 */ PLAYER_MODELGROUP_0, // unused (except for a bug in `Player_OverrideLimbDrawPause`) /* 0x01 */ PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD, //hold sword only. used for holding sword only as child link with hylian shield equipped @@ -668,6 +715,8 @@ typedef struct { #define PLAYER_STATE3_RESTORE_NAYRUS_LOVE (1 << 6) // Set by ocarina effects actors when destroyed to signal Nayru's Love may be restored (see `ACTOROVL_ALLOC_ABSOLUTE`) #define PLAYER_STATE3_7 (1 << 7) +#define PLAYER_ALLOC_GI_MIN 0x2880 // title card maximum file size + typedef void (*PlayerActionFunc)(struct Player*, struct PlayState*); typedef s32 (*UpperActionFunc)(struct Player*, struct PlayState*); typedef void (*PlayerFuncA74)(struct PlayState*, struct Player*); @@ -705,7 +754,7 @@ typedef struct Player { /* 0x01F8 */ Vec3s jointTable[PLAYER_LIMB_BUF_COUNT]; /* 0x0288 */ Vec3s morphTable[PLAYER_LIMB_BUF_COUNT]; /* 0x0318 */ Vec3s blendTable[PLAYER_LIMB_BUF_COUNT]; - /* 0x03A8 */ s16 unk_3A8[2]; + /* 0x03A8 */ FaceChange faceChange; /* 0x03AC */ Actor* heldActor; /* 0x03B0 */ Vec3f leftHandPos; /* 0x03BC */ Vec3s unk_3BC; @@ -754,8 +803,8 @@ typedef struct Player { /* 0x0690 */ s16 naviTextId; /* 0x0692 */ u8 stateFlags3; /* 0x0693 */ s8 exchangeItemId; - /* 0x0694 */ Actor* targetActor; - /* 0x0698 */ f32 targetActorDistance; + /* 0x0694 */ Actor* talkActor; // Actor offering to talk, or currently talking to, depending on context + /* 0x0698 */ f32 talkActorDistance; // xz distance away from `talkActor` /* 0x069C */ char unk_69C[0x004]; /* 0x06A0 */ f32 unk_6A0; /* 0x06A4 */ f32 closestSecretDistSq; diff --git a/include/z64save.h b/include/z64save.h index 03ae2d147..769b77ee6 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -203,7 +203,8 @@ typedef struct { /* 0x004C 0x0068 */ ItemEquips equips; /* 0x0058 0x0074 */ Inventory inventory; /* 0x00B8 0x00D4 */ SavedSceneFlags sceneFlags[124]; - /* 0x0E48 0x0E64 */ FaroresWindData fw; + /* 0x0E48 0x0E64 */ FaroresWindData fwMain; + /* 0x0E48 0x0E64 */ FaroresWindData fwSecondary; // HackerOoT: FW_SPLIT_AGE /* 0x0E70 0x0E8C */ char unk_E8C[0x10]; /* 0x0E80 0x0E9C */ s32 gsFlags[6]; /* 0x0E98 0x0EB4 */ char unk_EB4[0x4]; @@ -233,6 +234,7 @@ typedef struct { /* 0x14 */ s32 totalDays; /* 0x18 */ s32 bgsDayCount; // increments with totalDays, can be cleared with `Environment_ClearBgsDayCount` /* 0x1C */ SaveInfo info; // "information" + u8 useWidescreen; } Save; typedef struct { diff --git a/include/z64scene.h b/include/z64scene.h index 7cb48e0bb..106f613ab 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -355,9 +355,21 @@ typedef enum { #undef DEFINE_SCENE -// this define exists to preserve shiftability for an unused scene that is -// listed in the entrance table -#define SCENE_UNUSED_6E SCENE_ID_MAX +// Fake enum values for scenes that are still referenced in the entrance table +#if !IS_DEBUG +// Debug-only scenes +#define SCENE_TEST01 0x65 +#define SCENE_BESITU 0x66 +#define SCENE_DEPTH_TEST 0x67 +#define SCENE_SYOTES 0x68 +#define SCENE_SYOTES2 0x69 +#define SCENE_SUTARU 0x6A +#define SCENE_HAIRAL_NIWA2 0x6B +#define SCENE_SASATEST 0x6C +#define SCENE_TESTROOM 0x6D +#endif +// Deleted scene +#define SCENE_UNUSED_6E 0x6E // Entrance Index Enum #define DEFINE_ENTRANCE(enum, _1, _2, _3, _4, _5, _6) enum, diff --git a/include/z64view.h b/include/z64view.h index 5bce71f48..d506d5a36 100644 --- a/include/z64view.h +++ b/include/z64view.h @@ -49,7 +49,7 @@ typedef struct { #define VIEW_FORCE_PROJECTION_PERSPECTIVE (VIEW_PROJECTION_PERSPECTIVE << 4) #define VIEW_FORCE_PROJECTION_ORTHO (VIEW_PROJECTION_ORTHO << 4) -#if OOT_DEBUG +#if IS_DEBUG #define VIEW_ERROR_CHECK_EYE_POS(x, y, z) View_ErrorCheckEyePosition((x), (y), (z)) #else #define VIEW_ERROR_CHECK_EYE_POS(x, y, z) (void)0 diff --git a/progress.py b/progress.py deleted file mode 100755 index 0556ae6f7..000000000 --- a/progress.py +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import json -import git -import os -import re - -parser = argparse.ArgumentParser(description="Computes current progress throughout the whole project.") -parser.add_argument("format", nargs="?", default="text", choices=["text", "csv", "shield-json"]) -parser.add_argument("-m", "--matching", dest='matching', action='store_true', - help="Output matching progress instead of decompilation progress") -args = parser.parse_args() - -NON_MATCHING_PATTERN = r"#ifdef\s+NON_MATCHING.*?#pragma\s+GLOBAL_ASM\s*\(\s*\"(.*?)\"\s*\).*?#endif" - -def GetNonMatchingFunctions(files): - functions = [] - - for file in files: - with open(file) as f: - functions += re.findall(NON_MATCHING_PATTERN, f.read(), re.DOTALL) - - return functions - -def ReadAllLines(fileName): - lineList = list() - with open(fileName) as f: - lineList = f.readlines() - - return lineList - -def GetFiles(path, ext): - files = [] - - for r, d, f in os.walk(path): - for file in f: - if file.endswith(ext): - files.append(os.path.join(r, file)) - - return files - -nonMatchingFunctions = GetNonMatchingFunctions(GetFiles("src", ".c")) if not args.matching else [] - -def GetNonMatchingSize(path): - size = 0 - - asmFiles = GetFiles(path, ".s") - - for asmFilePath in asmFiles: - if asmFilePath not in nonMatchingFunctions: - asmLines = ReadAllLines(asmFilePath) - - for asmLine in asmLines: - if (asmLine.startswith("/*")): - size += 4 - - return size - -def IsCFile(objfile): - srcfile = objfile.strip().replace("build/gc-eu-mq-dbg/", "").replace(".o", ".c") - return os.path.isfile(srcfile) - -mapFile = ReadAllLines("build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.map") -curSegment = None -src = 0 -code = 0 -boot = 0 -ovl = 0 - -for line in mapFile: - - if "_codeSegmentStart" in line: - curSegment = "code" - elif "_bootSegmentStart" in line: - curSegment = "boot" - elif "_codeSegmentEnd" in line or "_bootSegmentEnd" in line: - curSegment = None - - lineSplit = list(filter(None, line.split(" "))) - - if (len(lineSplit) == 4 and lineSplit[0].startswith(".")): - section = lineSplit[0] - size = int(lineSplit[2], 16) - objFile = lineSplit[3] - - if (section == ".text" and IsCFile(objFile)): - if objFile.startswith("build/gc-eu-mq-dbg/src"): - src += size - - if curSegment == "code": - code += size - elif curSegment == "boot": - boot += size - else: - ovl += size - -nonMatchingASM = GetNonMatchingSize("asm/non_matchings") -nonMatchingASMBoot = GetNonMatchingSize("asm/non_matchings/boot") -nonMatchingASMCode = GetNonMatchingSize("asm/non_matchings/code") -nonMatchingASMOvl = GetNonMatchingSize("asm/non_matchings/overlays") - -src -= nonMatchingASM -code -= nonMatchingASMCode -boot -= nonMatchingASMBoot -ovl -= nonMatchingASMOvl - -bootSize = 31408 # decompilable code only -codeSize = 999984 # decompilable code only -ovlSize = 2812000 # .text sections - -total = src + nonMatchingASM -srcPct = 100 * src / total -codePct = 100 * code / codeSize -bootPct = 100 * boot / bootSize -ovlPct = 100 * ovl / ovlSize - -bytesPerHeartPiece = total // 80 - -if args.format == 'csv': - csv_version = 2 - git_object = git.Repo().head.object - timestamp = str(git_object.committed_date) - git_hash = git_object.hexsha - csv_list = [str(csv_version), timestamp, git_hash, str(src), str(total), str(code), str(codeSize), str(boot), str(bootSize), str(ovl), str(ovlSize), str(nonMatchingASM), str(len(nonMatchingFunctions))] - print(",".join(csv_list)) -elif args.format == 'shield-json': - # https://shields.io/endpoint - print(json.dumps({ - "schemaVersion": 1, - "label": "progress", - "message": f"{srcPct:.3g}%", - "color": 'yellow' if srcPct < 100 else 'brightgreen', - })) -elif args.format == 'text': - adjective = "decompiled" if not args.matching else "matched" - - print(str(total) + " total bytes of decompilable code\n") - print(str(src) + " bytes " + adjective + " in src " + str(srcPct) + "%\n") - print(str(boot) + "/" + str(bootSize) + " bytes " + adjective + " in boot " + str(bootPct) + "%\n") - print(str(code) + "/" + str(codeSize) + " bytes " + adjective + " in code " + str(codePct) + "%\n") - print(str(ovl) + "/" + str(ovlSize) + " bytes " + adjective + " in overlays " + str(ovlPct) + "%\n") - print("------------------------------------\n") - - heartPieces = int(src / bytesPerHeartPiece) - rupees = int(((src % bytesPerHeartPiece) * 100) / bytesPerHeartPiece) - - if (rupees > 0): - print("You have " + str(heartPieces) + "/80 heart pieces and " + str(rupees) + " rupee(s).\n") - else: - print("You have " + str(heartPieces) + "/80 heart pieces.\n") -else: - print("Unknown format argument: " + args.format) diff --git a/requirements.txt b/requirements.txt index 677bf2d3e..af99ad0f2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,6 +14,15 @@ pycparser toml # tools -mapfile-parser>=1.2.1,<2.0.0 +mapfile-parser>=2.3.5,<3.0.0 +pyelftools==0.30 rabbitizer>=1.0.0,<2.0.0 -spimdisasm>=1.20.0,<2.0.0 +spimdisasm>=1.21.0,<2.0.0 + +### --- HackerOoT --- ### + +# z64compress_wrapper.py +pyelftools + +# Ares GDB +gdb-tools diff --git a/retail_progress.py b/retail_progress.py deleted file mode 100755 index 53a137a2d..000000000 --- a/retail_progress.py +++ /dev/null @@ -1,245 +0,0 @@ -#!/usr/bin/env python3 - -# SPDX-FileCopyrightText: © 2024 ZeldaRET -# SPDX-License-Identifier: CC0-1.0 - -import argparse -import collections -from dataclasses import dataclass -import difflib -from enum import Enum -import itertools -import math -from pathlib import Path -import re -import subprocess -import sys -from typing import Iterator, List, Optional, Tuple - - -@dataclass -class Inst: - func_name: str - mnemonic: str - regs: List[str] - imm: Optional[int] - reloc_type: Optional[str] - reloc_symbol: Optional[str] - - -FUNC_RE = re.compile(r"([0-9a-f]+) <(.*)>:") - - -def parse_func_name(line: str) -> str: - match = FUNC_RE.match(line) - if not match: - raise Exception(f"could not parse function name from '{line}'") - return match.group(2) - - -def is_branch(mnemonic: str) -> bool: - return mnemonic.startswith("b") and mnemonic != "break" - - -def parse_inst(func_name: str, line: str) -> Inst: - parts = line.split() - addr = int(parts[0][:-1], 16) - mnemonic = parts[2] - regs = [] - imm = None - if len(parts) > 3: - for part in parts[3].split(","): - if "(" in part: # load/store - offset_str, rest = part.split("(") - regs.append(rest[:-1]) - imm = int(offset_str, 10) - elif is_branch(mnemonic): - try: - # convert branch targets to relative offsets - offset = int(part, 16) - imm = offset - addr - 4 - except ValueError: - regs.append(part) - else: - try: - imm = int(part, 0) - except ValueError: - regs.append(part) - return Inst(func_name, mnemonic, regs, imm, None, None) - - -def run_objdump(path: Path) -> List[Inst]: - if not path.exists(): - raise Exception(f"file {path} does not exist") - - command = [ - "mips-linux-gnu-objdump", - "-drz", - "-m", - "mips:4300", - "-j", - ".text", - str(path), - ] - try: - lines = subprocess.run( - command, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - check=True, - encoding="utf-8", - ).stdout.splitlines() - except subprocess.CalledProcessError as e: - return [] - - result = [] - - func_name = None - i = 6 # skip preamble - while i < len(lines): - row = lines[i] - i += 1 - - if not row: - continue - - if not row.startswith(" "): - func_name = parse_func_name(row) - continue - - if not func_name: - raise Exception(f"no function name for line '{row}'") - - inst = parse_inst(func_name, row) - - if i < len(lines) and lines[i].startswith("\t"): - reloc = lines[i] - i += 1 - _, inst.reloc_type, inst.reloc_symbol = reloc.split() - - result.append(inst) - - # trim trailing nops - while result and result[-1].mnemonic == "nop": - result.pop() - return result - - -def pair_instructions( - insts1: List[Inst], insts2: List[Inst] -) -> Iterator[Tuple[Optional[Inst], Optional[Inst]]]: - differ = difflib.SequenceMatcher( - a=[(inst.func_name, inst.mnemonic) for inst in insts1], - b=[(inst.func_name, inst.mnemonic) for inst in insts2], - autojunk=False, - ) - for tag, i1, i2, j1, j2 in differ.get_opcodes(): - for inst1, inst2 in itertools.zip_longest(insts1[i1:i2], insts2[j1:j2]): - yield (inst1, inst2) - - -def has_diff(inst1: Inst, inst2: Inst) -> bool: - if ( - inst1.func_name != inst2.func_name - or inst1.mnemonic != inst2.mnemonic - or inst1.regs != inst2.regs - ): - return True - - if inst1.reloc_type == inst2.reloc_type and inst1.reloc_type in ( - "R_MIPS_HI16", - "R_MIPS_LO16", - ): - # ignore symbol differences - return False - - return inst1 != inst2 - - -def find_functions_with_diffs(version: str, c_path: str): - object_path = Path(c_path).with_suffix(".o") - - expected_dir = Path("expected/build") / version - build_dir = Path("build") / version - - insts1 = run_objdump(expected_dir / object_path) - insts2 = run_objdump(build_dir / object_path) - - functions_with_diffs = collections.OrderedDict() - for inst1, inst2 in pair_instructions(insts1, insts2): - if inst1 is None and inst2 is not None: - functions_with_diffs[inst2.func_name] = True - elif inst1 is not None and inst2 is None: - functions_with_diffs[inst1.func_name] = True - elif inst1 is not None and inst2 is not None and has_diff(inst1, inst2): - functions_with_diffs[inst1.func_name] = True - functions_with_diffs[inst2.func_name] = True - - if not functions_with_diffs: - print(f"{c_path} OK") - return - - print(f"{c_path} functions with diffs:") - for func_name in functions_with_diffs: - print(f" {func_name}") - - -def print_summary(version: str, csv: bool): - expected_dir = Path("expected/build") / version - build_dir = Path("build") / version - - if csv: - print("path,expected,actual,added,removed,changed,progress") - for object_file in sorted(expected_dir.glob("src/**/*.o")): - object_path = object_file.relative_to(expected_dir) - c_path = object_path.with_suffix(".c") - - insts1 = run_objdump(expected_dir / object_path) - insts2 = run_objdump(build_dir / object_path) - - added = 0 - removed = 0 - changed = 0 - for inst1, inst2 in pair_instructions(insts1, insts2): - if inst1 is None and inst2 is not None: - added += 1 - elif inst1 is not None and inst2 is None: - removed += 1 - elif inst1 is not None and inst2 is not None and has_diff(inst1, inst2): - changed += 1 - - if insts1: - progress = max(1.0 - (added + removed + changed) / len(insts1), 0) - else: - progress = 1.0 - - if csv: - print( - f"{c_path},{len(insts1)},{len(insts2)},{added},{removed},{changed},{progress:.3f}" - ) - elif progress == 1.0: - print(f" OK {c_path}") - else: - print(f" {math.floor(progress * 100):>2}% {c_path}") - - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description="Calculate progress matching .text sections" - ) - parser.add_argument( - "file", - metavar="FILE", - nargs="?", - help="find functions with diffs in the given source file (if omitted, print summary of diffs for all files)", - ) - parser.add_argument( - "-v", "--version", help="version to compare", default="gc-eu-mq" - ) - parser.add_argument("--csv", help="print summary CSV", action="store_true") - args = parser.parse_args() - - if args.file is not None: - find_functions_with_diffs(args.version, args.file) - else: - print_summary(args.version, args.csv) diff --git a/spec b/spec index 8e08b4f89..9db4a1adf 100644 --- a/spec +++ b/spec @@ -2,6 +2,8 @@ * ROM spec file */ +#include "include/config.h" + beginseg name "makerom" include "$(BUILD_DIR)/src/makerom/rom_header.o" @@ -18,15 +20,25 @@ beginseg include "$(BUILD_DIR)/src/boot/idle.o" include "$(BUILD_DIR)/src/boot/viconfig.o" include "$(BUILD_DIR)/src/boot/z_std_dma.o" - include "$(BUILD_DIR)/src/boot/yaz0.o" +#if COMPRESS_YAZ + include "$(BUILD_DIR)/src/compression/yaz0.o" +#elif COMPRESS_LZO + include "$(BUILD_DIR)/src/compression/lzo.o" +#elif COMPRESS_APLIB + include "$(BUILD_DIR)/src/compression/aplib.o" +#endif include "$(BUILD_DIR)/src/boot/z_locale.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/boot/assert.o" +#endif include "$(BUILD_DIR)/src/boot/is_debug.o" include "$(BUILD_DIR)/src/libultra/io/driverominit.o" include "$(BUILD_DIR)/src/boot/mio0.o" include "$(BUILD_DIR)/src/boot/stackcheck.o" include "$(BUILD_DIR)/src/boot/logutils.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/libc/sprintf.o" +#endif include "$(BUILD_DIR)/src/libultra/io/piacs.o" include "$(BUILD_DIR)/src/libultra/os/sendmesg.o" include "$(BUILD_DIR)/src/libultra/os/stopthread.o" @@ -57,10 +69,14 @@ beginseg include "$(BUILD_DIR)/src/libultra/os/probetlb.o" include "$(BUILD_DIR)/src/libultra/os/getmemsize.o" include "$(BUILD_DIR)/src/libultra/os/seteventmesg.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/libc/xprintf.o" +#endif include "$(BUILD_DIR)/src/libultra/os/unmaptlball.o" include "$(BUILD_DIR)/src/libultra/io/epidma.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/libc/string.o" +#endif include "$(BUILD_DIR)/src/libultra/os/invalicache.o" include "$(BUILD_DIR)/src/libultra/os/createmesgqueue.o" include "$(BUILD_DIR)/src/libultra/os/invaldcache.o" @@ -88,17 +104,23 @@ beginseg include "$(BUILD_DIR)/src/libultra/io/epiread.o" include "$(BUILD_DIR)/src/libultra/io/visetspecial.o" include "$(BUILD_DIR)/src/libultra/io/cartrominit.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o" +#endif include "$(BUILD_DIR)/src/libultra/os/setfpccsr.o" include "$(BUILD_DIR)/src/libultra/os/getfpccsr.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/io/epiwrite.o" +#endif include "$(BUILD_DIR)/src/libultra/os/maptlbrdb.o" include "$(BUILD_DIR)/src/libultra/os/yieldthread.o" include "$(BUILD_DIR)/src/libultra/os/getcause.o" include "$(BUILD_DIR)/src/libultra/io/epirawwrite.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/libc/xlitob.o" include "$(BUILD_DIR)/src/libultra/libc/ldiv.o" include "$(BUILD_DIR)/src/libultra/libc/xldtob.o" +#endif include "$(BUILD_DIR)/src/boot/build.o" include "$(BUILD_DIR)/src/libultra/io/sirawwrite.o" include "$(BUILD_DIR)/src/libultra/io/vimgr.o" @@ -242,7 +264,12 @@ endseg beginseg name "nes_font_static" romalign 0x1000 +#if IS_DEBUG include "$(BUILD_DIR)/assets/textures/nes_font_static/nes_font_static.o" +#else + // TODO: Remove this hack once assets are extracted from gc-eu-mq + include "$(BUILD_DIR)/baserom/nes_font_static.o" +#endif number 10 endseg @@ -299,6 +326,7 @@ beginseg name "code" compress after "dmadata" + align 0x20 include "$(BUILD_DIR)/src/code/z_en_a_keep.o" include "$(BUILD_DIR)/src/code/z_en_item00.o" include "$(BUILD_DIR)/src/code/z_eff_blure.o" @@ -309,7 +337,9 @@ beginseg include "$(BUILD_DIR)/src/code/z_effect_soft_sprite.o" include "$(BUILD_DIR)/src/code/z_effect_soft_sprite_old_init.o" include "$(BUILD_DIR)/src/code/z_effect_soft_sprite_dlftbls.o" +#if IS_EVENT_EDITOR_ENABLED include "$(BUILD_DIR)/src/code/flg_set.o" +#endif include "$(BUILD_DIR)/src/code/z_DLF.o" include "$(BUILD_DIR)/src/code/z_actor.o" include "$(BUILD_DIR)/src/code/z_actor_dlftbls.o" @@ -342,7 +372,9 @@ beginseg include "$(BUILD_DIR)/src/code/z_lights.o" include "$(BUILD_DIR)/src/code/z_malloc.o" include "$(BUILD_DIR)/src/code/z_map_mark.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/code/z_moji.o" +#endif include "$(BUILD_DIR)/src/code/z_prenmi_buff.o" include "$(BUILD_DIR)/src/code/z_nulltask.o" include "$(BUILD_DIR)/src/code/z_olib.o" @@ -351,7 +383,9 @@ beginseg include "$(BUILD_DIR)/src/code/z_map_data.o" include "$(BUILD_DIR)/src/code/z_parameter.o" include "$(BUILD_DIR)/src/code/z_path.o" +#if ARE_FRAMERATE_OPTIONS_ENABLED include "$(BUILD_DIR)/src/code/z_frame_advance.o" +#endif include "$(BUILD_DIR)/src/code/z_player_lib.o" include "$(BUILD_DIR)/src/code/z_prenmi.o" include "$(BUILD_DIR)/src/code/z_quake.o" @@ -369,7 +403,9 @@ beginseg include "$(BUILD_DIR)/src/code/z_sram.o" include "$(BUILD_DIR)/src/code/z_ss_sram.o" include "$(BUILD_DIR)/src/code/z_rumble.o" +#if IS_DEBUG include "$(BUILD_DIR)/data/z_text.data.o" +#endif include "$(BUILD_DIR)/data/unk_8012ABC0.data.o" include "$(BUILD_DIR)/src/code/z_view.o" include "$(BUILD_DIR)/src/code/z_vimode.o" @@ -385,9 +421,13 @@ beginseg include "$(BUILD_DIR)/src/code/z_fbdemo_circle.o" include "$(BUILD_DIR)/src/code/z_fbdemo_fade.o" include "$(BUILD_DIR)/src/code/shrink_window.o" +#if IS_CAMERA_DEBUG_ENABLED include "$(BUILD_DIR)/src/code/db_camera.o" +#endif include "$(BUILD_DIR)/src/code/code_800BB0A0.o" +#if ENABLE_MEMPAK include "$(BUILD_DIR)/src/code/mempak.o" +#endif include "$(BUILD_DIR)/src/code/z_kaleido_manager.o" include "$(BUILD_DIR)/src/code/z_kaleido_scope_call.o" include "$(BUILD_DIR)/src/code/z_play.o" @@ -405,7 +445,9 @@ beginseg include "$(BUILD_DIR)/src/code/main.o" include "$(BUILD_DIR)/src/code/padmgr.o" include "$(BUILD_DIR)/src/code/sched.o" +#if IS_SPEEDMETER_ENABLED include "$(BUILD_DIR)/src/code/speed_meter.o" +#endif include "$(BUILD_DIR)/src/code/sys_cfb.o" include "$(BUILD_DIR)/src/code/sys_math.o" include "$(BUILD_DIR)/src/code/sys_math3d.o" @@ -415,7 +457,9 @@ beginseg include "$(BUILD_DIR)/src/code/sys_rumble.o" include "$(BUILD_DIR)/src/code/code_800D31A0.o" include "$(BUILD_DIR)/src/code/irqmgr.o" +#if IS_DEBUG_HEAP_ENABLED include "$(BUILD_DIR)/src/code/debug_malloc.o" +#endif include "$(BUILD_DIR)/src/code/fault.o" include "$(BUILD_DIR)/src/code/fault_drawer.o" #ifndef NON_MATCHING @@ -423,8 +467,10 @@ beginseg include "$(BUILD_DIR)/data/fault_drawer.bss.o" #endif include "$(BUILD_DIR)/src/code/kanread.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/code/ucode_disas.o" - pad_text // audio library aligned to 32 bytes? +#endif + pad_text // on GameCube, NTSC 1.0 and "0.9" prerelease include "$(BUILD_DIR)/src/audio/lib/data.o" include "$(BUILD_DIR)/src/audio/lib/synthesis.o" include "$(BUILD_DIR)/src/audio/lib/heap.o" @@ -436,6 +482,9 @@ beginseg include "$(BUILD_DIR)/src/audio/lib/effects.o" include "$(BUILD_DIR)/src/audio/lib/seqplayer.o" include "$(BUILD_DIR)/src/audio/general.o" +#if !IS_DEBUG + pad_text // on retail GameCube +#endif include "$(BUILD_DIR)/src/audio/sfx_params.o" include "$(BUILD_DIR)/src/audio/sfx.o" include "$(BUILD_DIR)/src/audio/sequence.o" @@ -445,7 +494,9 @@ beginseg include "$(BUILD_DIR)/src/code/gfxprint.o" include "$(BUILD_DIR)/src/code/rcp_utils.o" include "$(BUILD_DIR)/src/code/loadfragment2.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/code/mtxuty-cvt.o" +#endif include "$(BUILD_DIR)/src/code/relocation.o" include "$(BUILD_DIR)/src/code/load.o" include "$(BUILD_DIR)/src/code/code_800FC620.o" @@ -454,13 +505,18 @@ beginseg include "$(BUILD_DIR)/src/code/code_800FCE80.o" include "$(BUILD_DIR)/src/code/fp.o" include "$(BUILD_DIR)/src/code/system_malloc.o" - include "$(BUILD_DIR)/src/code/code_800FD970.o" + include "$(BUILD_DIR)/src/code/rand.o" include "$(BUILD_DIR)/src/code/__osMalloc.o" +#if !IS_DEBUG + include "$(BUILD_DIR)/src/libultra/libc/sprintf.o" +#endif include "$(BUILD_DIR)/src/code/printutils.o" include "$(BUILD_DIR)/src/code/sleep.o" include "$(BUILD_DIR)/src/code/jpegutils.o" include "$(BUILD_DIR)/src/code/jpegdecoder.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/io/pfsfreeblocks.o" +#endif include "$(BUILD_DIR)/src/libultra/mgu/scale.o" include "$(BUILD_DIR)/src/libultra/gu/sinf.o" include "$(BUILD_DIR)/src/libultra/gu/sins.o" @@ -473,19 +529,29 @@ beginseg include "$(BUILD_DIR)/src/libultra/io/sprawdma.o" include "$(BUILD_DIR)/src/libultra/io/sirawdma.o" include "$(BUILD_DIR)/src/libultra/io/sptaskyield.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/io/pfsreadwritefile.o" include "$(BUILD_DIR)/src/libultra/io/pfsgetstatus.o" +#endif include "$(BUILD_DIR)/src/libultra/mgu/mtxidentf.o" include "$(BUILD_DIR)/src/libultra/gu/lookat.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/io/pfsallocatefile.o" +#endif include "$(BUILD_DIR)/src/libultra/os/stoptimer.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/io/contpfs.o" include "$(BUILD_DIR)/src/libultra/mgu/mtxl2f.o" include "$(BUILD_DIR)/src/libultra/io/pfsfindfile.o" +#endif include "$(BUILD_DIR)/src/libultra/gu/sqrtf.o" include "$(BUILD_DIR)/src/libultra/os/afterprenmi.o" include "$(BUILD_DIR)/src/libultra/io/contquery.o" include "$(BUILD_DIR)/src/libultra/gu/lookathil.o" +#if !IS_DEBUG + include "$(BUILD_DIR)/src/libultra/libc/xprintf.o" + include "$(BUILD_DIR)/src/libultra/libc/string.o" +#endif include "$(BUILD_DIR)/src/libultra/io/sp.o" include "$(BUILD_DIR)/src/libultra/mgu/mtxident.o" include "$(BUILD_DIR)/src/libultra/gu/position.o" @@ -496,25 +562,44 @@ beginseg include "$(BUILD_DIR)/src/libultra/mgu/normalize.o" include "$(BUILD_DIR)/src/libultra/io/dpgetstat.o" include "$(BUILD_DIR)/src/libultra/io/dpsetstat.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/io/pfsdeletefile.o" +#endif include "$(BUILD_DIR)/src/libultra/gu/ortho.o" include "$(BUILD_DIR)/src/libultra/gu/cosf.o" include "$(BUILD_DIR)/src/libultra/gu/libm_vals.o" include "$(BUILD_DIR)/src/libultra/gu/coss.o" include "$(BUILD_DIR)/src/libultra/io/visetevent.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/io/pfsisplug.o" +#endif include "$(BUILD_DIR)/src/libultra/gu/us2dex.o" include "$(BUILD_DIR)/src/libultra/io/pfsselectbank.o" include "$(BUILD_DIR)/src/libultra/io/contsetch.o" +#if IS_DEBUG include "$(BUILD_DIR)/src/libultra/io/pfsfilestate.o" include "$(BUILD_DIR)/src/libultra/io/pfsinitpak.o" include "$(BUILD_DIR)/src/libultra/io/pfschecker.o" +#endif include "$(BUILD_DIR)/src/libultra/io/aigetlen.o" include "$(BUILD_DIR)/src/libultra/mgu/translate.o" include "$(BUILD_DIR)/src/libultra/io/contramwrite.o" +#if !IS_DEBUG + include "$(BUILD_DIR)/src/libultra/io/vimodefpallan1.o" + include "$(BUILD_DIR)/src/libultra/io/pfsgetstatus.o" + include "$(BUILD_DIR)/src/libultra/io/contpfs.o" +#endif include "$(BUILD_DIR)/src/libultra/io/contramread.o" include "$(BUILD_DIR)/src/libultra/io/crc.o" +#if !IS_DEBUG + include "$(BUILD_DIR)/src/libultra/io/pfsisplug.o" +#endif include "$(BUILD_DIR)/src/libultra/os/settimer.o" +#if !IS_DEBUG + include "$(BUILD_DIR)/src/libultra/libc/xldtob.o" + include "$(BUILD_DIR)/src/libultra/libc/ldiv.o" + include "$(BUILD_DIR)/src/libultra/libc/xlitob.o" +#endif include "$(BUILD_DIR)/src/libultra/io/spgetstat.o" include "$(BUILD_DIR)/src/libultra/io/spsetstat.o" include "$(BUILD_DIR)/src/libultra/os/writebackdcacheall.o" @@ -533,15 +618,20 @@ beginseg include "$(BUILD_DIR)/src/code/z_construct.o" include "$(BUILD_DIR)/data/audio_tables.rodata.o" include "$(BUILD_DIR)/data/rsp.text.o" +#if ENABLE_F3DEX3 + include "$(BUILD_DIR)/data/rsp.rodata.f3dex3.o" +#else include "$(BUILD_DIR)/data/rsp.rodata.o" +#endif endseg beginseg name "buffers" + flags NOLOAD align 0x40 include "$(BUILD_DIR)/src/buffers/zbuffer.o" include "$(BUILD_DIR)/src/buffers/gfxbuffers.o" - include "$(BUILD_DIR)/src/buffers/heaps.o" + include "$(BUILD_DIR)/src/buffers/audio_heap.o" endseg beginseg @@ -552,12 +642,14 @@ beginseg include "$(BUILD_DIR)/src/overlays/gamestates/ovl_title/ovl_title_reloc.o" endseg +#if IS_MAP_SELECT_ENABLED beginseg name "ovl_select" compress include "$(BUILD_DIR)/src/overlays/gamestates/ovl_select/z_select.o" include "$(BUILD_DIR)/src/overlays/gamestates/ovl_select/ovl_select_reloc.o" endseg +#endif beginseg name "ovl_opening" @@ -580,7 +672,9 @@ beginseg name "ovl_kaleido_scope" compress include "$(BUILD_DIR)/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.o" +#if IS_INV_EDITOR_ENABLED include "$(BUILD_DIR)/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.o" +#endif include "$(BUILD_DIR)/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.o" include "$(BUILD_DIR)/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.o" include "$(BUILD_DIR)/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.o" @@ -2910,7 +3004,7 @@ beginseg name "ovl_En_Mb" compress include "$(BUILD_DIR)/src/overlays/actors/ovl_En_Mb/z_en_mb.o" - include "$(BUILD_DIR)/src/overlays/actors/ovl_En_Mb/ovl_En_Mb_reloc.o" + include "$(BUILD_DIR)/src/overlays/actors/ovl_En_Mb/ovl_En_Mb_reloc.o" endseg beginseg @@ -7348,6 +7442,7 @@ endseg beginseg name "vr_fine0_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/skyboxes/vr_fine0_pal_static.o" endseg @@ -7361,6 +7456,7 @@ endseg beginseg name "vr_fine1_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/skyboxes/vr_fine1_pal_static.o" endseg @@ -7374,6 +7470,7 @@ endseg beginseg name "vr_fine2_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/skyboxes/vr_fine2_pal_static.o" endseg @@ -7387,6 +7484,7 @@ endseg beginseg name "vr_fine3_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/skyboxes/vr_fine3_pal_static.o" endseg @@ -7400,6 +7498,7 @@ endseg beginseg name "vr_cloud0_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/skyboxes/vr_cloud0_pal_static.o" endseg @@ -7413,6 +7512,7 @@ endseg beginseg name "vr_cloud1_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/skyboxes/vr_cloud1_pal_static.o" endseg @@ -7426,6 +7526,7 @@ endseg beginseg name "vr_cloud2_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/skyboxes/vr_cloud2_pal_static.o" endseg @@ -7439,6 +7540,7 @@ endseg beginseg name "vr_cloud3_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/skyboxes/vr_cloud3_pal_static.o" endseg @@ -7452,6 +7554,7 @@ endseg beginseg name "vr_holy0_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/skyboxes/vr_holy0_pal_static.o" endseg @@ -7465,6 +7568,7 @@ endseg beginseg name "vr_holy1_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/skyboxes/vr_holy1_pal_static.o" endseg @@ -7478,6 +7582,7 @@ endseg beginseg name "vr_MDVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_MDVR_pal_static.o" endseg @@ -7491,6 +7596,7 @@ endseg beginseg name "vr_MNVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_MNVR_pal_static.o" endseg @@ -7504,6 +7610,7 @@ endseg beginseg name "vr_RUVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_RUVR_pal_static.o" endseg @@ -7517,6 +7624,7 @@ endseg beginseg name "vr_LHVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_LHVR_pal_static.o" endseg @@ -7530,6 +7638,7 @@ endseg beginseg name "vr_KHVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_KHVR_pal_static.o" endseg @@ -7543,6 +7652,7 @@ endseg beginseg name "vr_K3VR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_K3VR_pal_static.o" endseg @@ -7556,6 +7666,7 @@ endseg beginseg name "vr_K4VR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_K4VR_pal_static.o" endseg @@ -7569,6 +7680,7 @@ endseg beginseg name "vr_K5VR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_K5VR_pal_static.o" endseg @@ -7582,6 +7694,7 @@ endseg beginseg name "vr_SP1a_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_SP1a_pal_static.o" endseg @@ -7595,6 +7708,7 @@ endseg beginseg name "vr_MLVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_MLVR_pal_static.o" endseg @@ -7608,6 +7722,7 @@ endseg beginseg name "vr_KKRVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_KKRVR_pal_static.o" endseg @@ -7621,6 +7736,7 @@ endseg beginseg name "vr_KR3VR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_KR3VR_pal_static.o" endseg @@ -7634,6 +7750,7 @@ endseg beginseg name "vr_IPVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_IPVR_pal_static.o" endseg @@ -7647,6 +7764,7 @@ endseg beginseg name "vr_KSVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_KSVR_pal_static.o" endseg @@ -7660,6 +7778,7 @@ endseg beginseg name "vr_GLVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_GLVR_pal_static.o" endseg @@ -7673,6 +7792,7 @@ endseg beginseg name "vr_ZRVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_ZRVR_pal_static.o" endseg @@ -7686,6 +7806,7 @@ endseg beginseg name "vr_DGVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_DGVR_pal_static.o" endseg @@ -7699,6 +7820,7 @@ endseg beginseg name "vr_ALVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_ALVR_pal_static.o" endseg @@ -7712,6 +7834,7 @@ endseg beginseg name "vr_NSVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_NSVR_pal_static.o" endseg @@ -7725,6 +7848,7 @@ endseg beginseg name "vr_LBVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_LBVR_pal_static.o" endseg @@ -7738,6 +7862,7 @@ endseg beginseg name "vr_TTVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_TTVR_pal_static.o" endseg @@ -7751,6 +7876,7 @@ endseg beginseg name "vr_FCVR_pal_static" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/textures/backgrounds/vr_FCVR_pal_static.o" endseg @@ -9627,6 +9753,7 @@ beginseg number 3 endseg +#if CAN_INCLUDE_TEST_SCENES beginseg name "syotes_scene" romalign 0x1000 @@ -9668,6 +9795,7 @@ beginseg include "$(BUILD_DIR)/assets/scenes/test_levels/depth_test/depth_test_room_0.o" number 3 endseg +#endif beginseg name "spot00_scene" @@ -10149,6 +10277,7 @@ beginseg number 3 endseg +#if CAN_INCLUDE_TEST_SCENES beginseg name "testroom_scene" romalign 0x1000 @@ -10190,6 +10319,7 @@ beginseg include "$(BUILD_DIR)/assets/scenes/test_levels/testroom/testroom_room_4.o" number 3 endseg +#endif beginseg name "kenjyanoma_scene" @@ -10231,6 +10361,7 @@ beginseg number 3 endseg +#if CAN_INCLUDE_TEST_SCENES beginseg name "sutaru_scene" romalign 0x1000 @@ -10244,6 +10375,7 @@ beginseg include "$(BUILD_DIR)/assets/scenes/test_levels/sutaru/sutaru_room_0.o" number 3 endseg +#endif beginseg name "link_home_scene" @@ -10517,6 +10649,7 @@ beginseg number 3 endseg +#if CAN_INCLUDE_TEST_SCENES beginseg name "sasatest_scene" romalign 0x1000 @@ -10530,6 +10663,7 @@ beginseg include "$(BUILD_DIR)/assets/scenes/test_levels/sasatest/sasatest_room_0.o" number 3 endseg +#endif beginseg name "market_alley_scene" @@ -11267,6 +11401,7 @@ beginseg number 3 endseg +#if CAN_INCLUDE_TEST_SCENES beginseg name "hairal_niwa2_scene" romalign 0x1000 @@ -11280,6 +11415,7 @@ beginseg include "$(BUILD_DIR)/assets/scenes/indoors/hairal_niwa2/hairal_niwa2_room_0.o" number 3 endseg +#endif beginseg name "hakasitarelay_scene" @@ -11753,6 +11889,7 @@ beginseg number 3 endseg +#if CAN_INCLUDE_TEST_SCENES beginseg name "besitu_scene" romalign 0x1000 @@ -11766,6 +11903,7 @@ beginseg include "$(BUILD_DIR)/assets/scenes/test_levels/besitu/besitu_room_0.o" number 3 endseg +#endif beginseg name "face_shop_scene" @@ -11823,8 +11961,10 @@ beginseg number 3 endseg +#if CAN_INCLUDE_TEST_SCENES beginseg name "test01_scene" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/scenes/test_levels/test01/test01_scene.o" number 2 @@ -11832,11 +11972,14 @@ endseg beginseg name "test01_room_0" + compress romalign 0x1000 include "$(BUILD_DIR)/assets/scenes/test_levels/test01/test01_room_0.o" number 3 endseg +#endif +#if !ENABLE_HACKEROOT beginseg name "bump_texture_static" compress @@ -11934,3 +12077,4 @@ beginseg romalign 0x1000 include "$(BUILD_DIR)/baserom/softsprite_matrix_static.o" endseg +#endif diff --git a/src/audio/data.c b/src/audio/data.c index 6a4c29eda..422ad83f5 100644 --- a/src/audio/data.c +++ b/src/audio/data.c @@ -44,17 +44,17 @@ s8 gSfxDefaultReverb = 0; s32 D_801333EC = 0; // unused +// ENABLE_AUDIO_DEBUGGER u8 D_801333F0 = 0; - u8 gAudioSfxSwapOff = 0; - u8 D_801333F8 = 0; - s32 D_801333FC = 0; // unused u8 gSeqCmdWritePos = 0; u8 gSeqCmdReadPos = 0; u8 gStartSeqDisabled = false; + +// ENABLE_AUDIO_DEBUGGER u8 gAudioDebugPrintSeqCmd = true; u8 gSoundModeList[] = { diff --git a/src/audio/general.c b/src/audio/general.c index a70a35823..176bb7e53 100644 --- a/src/audio/general.c +++ b/src/audio/general.c @@ -100,7 +100,11 @@ f32 D_801305E4[4] = { 1.0f, 1.12246f, 1.33484f, 1.33484f }; // 2**({0, 2, 5, 5}/ f32 D_801305F4 = 1.0f; u8 sGanonsTowerLevelsVol[8] = { 127, 80, 75, 73, 70, 68, 65, 60 }; u8 sEnterGanonsTowerTimer = 0; +#if IS_DEBUG s8 sSoundMode = SOUNDMODE_SURROUND; +#else +s8 sSoundMode = SOUNDMODE_STEREO; +#endif s8 D_80130608 = 0; s8 sAudioCutsceneFlag = 0; s8 sSpecReverb = 0; @@ -123,7 +127,10 @@ u8 sAudioBaseFilter2 = 0; u8 sAudioExtraFilter2 = 0; Vec3f* sSariaBgmPtr = NULL; f32 D_80130650 = 2000.0f; + +#if IS_DEBUG u8 sSeqModeInput = 0; +#endif #define SEQ_FLAG_ENEMY (1 << 0) // Allows enemy bgm #define SEQ_FLAG_FANFARE (1 << 1) @@ -1212,8 +1219,10 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { { 0, { 0 } }, }; +// ENABLE_AUDIO_DEBUGGER u32 sAudioUpdateStartTime; u32 sAudioUpdateEndTime; + f32 D_8016B7A8; f32 D_8016B7AC; f32 D_8016B7B0; @@ -1223,20 +1232,29 @@ FreqLerp sWaterfallFreqScaleLerp; f32 D_8016B7D8; s8 D_8016B7DC; f32 D_8016B7E0; +#if IS_DEBUG u16 D_8016B7E4; + +// ENABLE_AUDIO_DEBUGGER struct { char str[5]; u16 num; } sAudioScrPrtBuf[SCROLL_PRINT_BUF_SIZE]; +#endif + u8 sRiverSoundMainBgmVol; u8 sRiverSoundMainBgmCurrentVol; u8 sRiverSoundMainBgmLower; u8 sRiverSoundMainBgmRestore; u8 sGanonsTowerVol; SfxPlayerState sSfxChannelState[0x10]; +#if IS_DEBUG char sBinToStrBuf[0x20]; +#endif u8 sMalonSingingTimer; +#if IS_DEBUG u8 sAudioSpecPeakNumNotes[0x12]; +#endif u8 sMalonSingingDisabled; u8 D_8016B9F3; u8 sFanfareStartTimer; @@ -1251,7 +1269,6 @@ u32 sOcarinaInputButtonCur; u32 sOcarinaInputButtonStart; u32 sOcarinaInputButtonPrev; s32 sOcarinaInputButtonPress; -s32 sOcarinaUnused; u8 sCurOcarinaSongWithoutMusicStaff[8]; u8 sOcarinaWithoutMusicStaffPos; u8 sOcarinaHasStartedSong; @@ -1264,8 +1281,10 @@ u16 sMusicStaffCurHeldLength[OCARINA_SONG_MAX]; u16 sMusicStaffExpectedLength[OCARINA_SONG_MAX]; u8 sMusicStaffExpectedPitch[OCARINA_SONG_MAX]; OcarinaNote sScarecrowsLongSongSecondNote; +#if IS_DEBUG u8 sIsMalonSinging; f32 sMalonSingingDist; +#endif void PadMgr_RequestPadData(PadMgr* padMgr, Input* inputs, s32 gameRequest); @@ -2302,7 +2321,7 @@ void AudioOcarina_ResetStaffs(void) { sOcarinaDropInputTimer = 0; } -#if OOT_DEBUG +#if IS_AUDIO_DEBUG_ENABLED #include "debug.inc.c" #else void AudioDebug_Draw(GfxPrint* printer) { @@ -2320,7 +2339,7 @@ void Audio_UpdateFanfare(void); */ void Audio_Update(void) { if (func_800FAD34() == 0) { -#if OOT_DEBUG +#if IS_AUDIO_DEBUG_ENABLED sAudioUpdateTaskStart = gAudioCtx.totalTaskCount; sAudioUpdateStartTime = osGetTime(); #endif @@ -2339,14 +2358,14 @@ void Audio_Update(void) { func_800F8F88(); Audio_UpdateActiveSequences(); -#if OOT_DEBUG +#if IS_AUDIO_DEBUG_ENABLED AudioDebug_SetInput(); AudioDebug_ProcessInput(); #endif AudioThread_ScheduleProcessCmds(); -#if OOT_DEBUG +#if IS_AUDIO_DEBUG_ENABLED sAudioUpdateTaskEnd = gAudioCtx.totalTaskCount; sAudioUpdateEndTime = osGetTime(); #endif @@ -2753,7 +2772,7 @@ void func_800F4010(Vec3f* pos, u16 sfxId, f32 arg2) { u8 phi_v0; u16 sfxId2; -#if OOT_DEBUG +#if IS_AUDIO_DEBUG_ENABLED D_80131C8C = arg2; #endif @@ -3337,7 +3356,7 @@ s32 Audio_IsSequencePlaying(u16 seqId) { void func_800F5ACC(u16 seqId) { u16 curSeqId = Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); -#if !OOT_DEBUG +#if !IS_DEBUG if (1) {} #endif @@ -3461,7 +3480,7 @@ void Audio_SetSequenceMode(u8 seqMode) { u16 seqId; u8 volumeFadeOutTimer; -#if OOT_DEBUG +#if IS_DEBUG sSeqModeInput = seqMode; #endif @@ -3567,7 +3586,7 @@ void Audio_UpdateMalonSinging(f32 dist, u16 seqId) { s8 melodyVolume; s16 curSeqId; -#if OOT_DEBUG +#if IS_DEBUG sIsMalonSinging = true; sMalonSingingDist = dist; #endif @@ -3878,7 +3897,7 @@ void Audio_SetNatureAmbienceChannelIO(u8 channelIdxRange, u8 ioPort, u8 ioData) if ((gActiveSeqs[SEQ_PLAYER_BGM_MAIN].seqId != NA_BGM_NATURE_AMBIENCE) && Audio_IsSeqCmdNotQueued(SEQCMD_OP_PLAY_SEQUENCE << 28 | NA_BGM_NATURE_AMBIENCE, SEQCMD_OP_MASK | 0xFF)) { -#if OOT_DEBUG +#if IS_AUDIO_DEBUG_ENABLED sAudioNatureFailed = true; #endif @@ -3919,7 +3938,7 @@ void Audio_StartNatureAmbienceSequence(u16 playerIO, u16 channelMask) { channelIdx = false; -#if OOT_DEBUG +#if IS_DEBUG if (gStartSeqDisabled) { channelIdx = true; SEQCMD_DISABLE_PLAY_SEQUENCES(false); diff --git a/src/audio/lib/data.c b/src/audio/lib/data.c index d1bd4acc1..8dc4729ff 100644 --- a/src/audio/lib/data.c +++ b/src/audio/lib/data.c @@ -1,7 +1,7 @@ #include "global.h" // clang-format off -s16 gSawtoothWaveSample[] = { +ALIGNED(16) s16 gSawtoothWaveSample[] = { // Frequency of 1 0, 1023, 2047, 3071, 4095, 5119, 6143, 7167, 8191, 9215, 10239, 11263, 12287, 13311, 14335, 15359, @@ -43,7 +43,7 @@ s16 gSawtoothWaveSample[] = { 0, 8191, 16383, 24575, -32767, -24575, -16383, -8191, }; -s16 gTriangleWaveSample[] = { +ALIGNED(16) s16 gTriangleWaveSample[] = { // Frequency of 1 0, 2047, 4095, 6143, 8191, 10239, 12287, 14335, 16383, 18431, 20479, 22527, 24575, 26623, 28671, 30719, @@ -85,7 +85,7 @@ s16 gTriangleWaveSample[] = { 0, 16383, 32767, 16383, 0, -16383, -32767, -16383, }; -s16 gSineWaveSample[] = { +ALIGNED(16) s16 gSineWaveSample[] = { // Frequency of 1 0, 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, 25329, 27244, 28897, 30272, 31356, 32137, 32609, @@ -127,7 +127,7 @@ s16 gSineWaveSample[] = { 0, 23169, 32767, 23169, 0, -23169, -32767, -23169, }; -s16 gSquareWaveSample[] = { +ALIGNED(16) s16 gSquareWaveSample[] = { // Frequency of 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -169,7 +169,7 @@ s16 gSquareWaveSample[] = { 0, 0, 32767, 32767, 0, 0, -32767, -32767, }; -s16 gWhiteNoiseSample[] = { +ALIGNED(16) s16 gWhiteNoiseSample[] = { // Frequency of 1 0, -25689, -25791, 27803, -27568, -21030, 22174, 6298, 27071, -18531, 28649, 2284, 3380, 6890, -12682, -21114, @@ -212,7 +212,7 @@ s16 gWhiteNoiseSample[] = { }; // Sine White Noise? -s16 D_8012EA90[] = { +ALIGNED(16) s16 D_8012EA90[] = { // Frequency of 1 0, 16316, 20148, 20257, 27209, -32657, 29264, 27259, -29394, -21494, -26410, 30770, 30033, 29130, 20206, 14129, @@ -255,7 +255,7 @@ s16 D_8012EA90[] = { }; // Pulse Wave (duty cycle = 12.5%) -s16 gEighthPulseWaveSample[] = { +ALIGNED(16) s16 gEighthPulseWaveSample[] = { // Frequency of 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -298,7 +298,7 @@ s16 gEighthPulseWaveSample[] = { }; // Pulse Wave (duty cycle = 25%) -s16 gQuarterPulseWaveSample[] = { +ALIGNED(16) s16 gQuarterPulseWaveSample[] = { // Frequency of 1 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -686,7 +686,7 @@ f32 gDefaultPanVolume[] = { 0.086471f, 0.074143f, 0.061803f, 0.049454f, 0.037097f, 0.024734f, 0.012368f, 0.0f, }; -s16 gLowPassFilterData[16 * 8] = { +ALIGNED(16) s16 gLowPassFilterData[16 * 8] = { /* 0x0 */ 0, 0, 0, 32767, 0, 0, 0, 0, // Identity filter (delta function) /* 0x1 */ 3854, 4188, 4398, 4469, 4398, 4188, 3854, 3416, /* 0x2 */ 3415, 4314, 4915, 5126, 4915, 4314, 3415, 2351, @@ -705,7 +705,7 @@ s16 gLowPassFilterData[16 * 8] = { /* 0xF */ 841, -853, 863, 26829, 863, -853, 841, -820, }; -s16 gHighPassFilterData[15 * 8] = { +ALIGNED(16) s16 gHighPassFilterData[15 * 8] = { /* 0x0 */ -289, -291, -289, 30736, -289, -291, -289, -290, /* 0x1 */ -464, -467, -467, 29506, -467, -467, -464, -463, /* 0x2 */ -662, -670, -672, 28101, -672, -670, -662, -656, @@ -723,7 +723,7 @@ s16 gHighPassFilterData[15 * 8] = { /* 0xE */ -772, -3, -6985, 17240, -6985, -3, -772, -3, }; -s16 D_80130418[8 * 8] = { +ALIGNED(16) s16 D_80130418[8 * 8] = { /* 0x0 */ 0, 6392, 12539, 18204, 23169, 27244, 30272, 32137, /* 0x1 */ 32767, 32137, 30272, 27244, 23169, 18204, 12539, 6392, /* 0x2 */ 0, -3211, -6392, -9511, -12539, -15446, -18204, -20787, diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index c542c8062..0d2fe051d 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -1133,9 +1133,19 @@ void AudioLoad_Init(void* heap, u32 heapSize) { s32 i; u8* audioContextPtr = (u8*)&gAudioCtx; +#ifndef AVOID_UB + //! @bug This clearing loop sets one extra byte to 0 following gAudioCtx. + //! In practice this is harmless as it would set the most significant byte in gAudioCustomUpdateFunction to 0, + //! which was just reset to NULL above. for (i = sizeof(gAudioCtx); i >= 0; i--) { *audioContextPtr++ = 0; } +#else + // Avoid out-of-bounds variable access + for (i = sizeof(gAudioCtx); i > 0; i--) { + *audioContextPtr++ = 0; + } +#endif } // 1000 is a conversion from seconds to milliseconds diff --git a/src/audio/sequence.c b/src/audio/sequence.c index e04a5668a..9a338bf16 100644 --- a/src/audio/sequence.c +++ b/src/audio/sequence.c @@ -43,7 +43,7 @@ void Audio_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDura if (!gStartSeqDisabled || (seqPlayerIndex == SEQ_PLAYER_SFX)) { seqArgs &= 0x7F; - if (OOT_DEBUG && (seqArgs == 0x7F)) { + if (IS_DEBUG && (seqArgs == 0x7F)) { // `fadeInDuration` interpreted as seconds, 60 is refresh rate and does not account for PAL skipTicks = (fadeInDuration >> 3) * 60 * gAudioCtx.audioBufferParameters.ticksPerUpdate; AUDIOCMD_GLOBAL_INIT_SEQPLAYER_SKIP_TICKS((u32)seqPlayerIndex, (u32)seqId, skipTicks); @@ -103,12 +103,11 @@ void Audio_ProcessSeqCmd(u32 cmd) { f32 freqScaleTarget; s32 pad; -#if OOT_DEBUG - if (gAudioDebugPrintSeqCmd && (cmd & SEQCMD_OP_MASK) != (SEQCMD_OP_SET_SEQPLAYER_IO << 28)) { + if (IS_AUDIO_DEBUG_ENABLED && gAudioDebugPrintSeqCmd && + (cmd & SEQCMD_OP_MASK) != (SEQCMD_OP_SET_SEQPLAYER_IO << 28)) { AudioDebug_ScrPrt("SEQ H", (cmd >> 16) & 0xFFFF); AudioDebug_ScrPrt(" L", cmd & 0xFFFF); } -#endif op = cmd >> 28; seqPlayerIndex = (cmd & 0xF000000) >> 24; diff --git a/src/audio/sfx.c b/src/audio/sfx.c index 9f8787467..5ed86fe7e 100644 --- a/src/audio/sfx.c +++ b/src/audio/sfx.c @@ -33,6 +33,8 @@ ActiveSfx gActiveSfx[7][3]; u8 sCurSfxPlayerChannelIndex; u8 gSfxBankMuted[7]; UnusedBankLerp sUnusedBankLerp[7]; + +//! TODO: audio debug feature? u16 gAudioSfxSwapSource[10]; u16 gAudioSfxSwapTarget[10]; u8 gAudioSfxSwapMode[10]; @@ -71,8 +73,7 @@ void Audio_PlaySfxGeneral(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32* if (!gSfxBankMuted[SFX_BANK_SHIFT(sfxId)]) { req = &sSfxRequests[gSfxRequestWriteIndex]; -#if OOT_DEBUG - if (!gAudioSfxSwapOff) { + if (IS_AUDIO_DEBUG_ENABLED && !gAudioSfxSwapOff) { for (i = 0; i < 10; i++) { if (sfxId == gAudioSfxSwapSource[i]) { if (gAudioSfxSwapMode[i] == 0) { // "SWAP" @@ -91,7 +92,6 @@ void Audio_PlaySfxGeneral(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32* } } } -#endif req->sfxId = sfxId; req->pos = pos; @@ -169,12 +169,10 @@ void Audio_ProcessSfxRequest(void) { bankId = SFX_BANK(req->sfxId); -#if OOT_DEBUG - if ((1 << bankId) & D_801333F0) { + if (IS_AUDIO_DEBUG_ENABLED && ((1 << bankId) & D_801333F0)) { AudioDebug_ScrPrt("SE", req->sfxId); bankId = SFX_BANK(req->sfxId); } -#endif count = 0; index = gSfxBanks[bankId][0].next; @@ -733,8 +731,7 @@ void Audio_ResetSfx(void) { gSfxBanks[bankId][i].next = 0xFF; } -#if OOT_DEBUG - if (D_801333F8 == 0) { + if (IS_AUDIO_DEBUG_ENABLED && D_801333F8 == 0) { for (bankId = 0; bankId < 10; bankId++) { gAudioSfxSwapSource[bankId] = 0; gAudioSfxSwapTarget[bankId] = 0; @@ -742,5 +739,4 @@ void Audio_ResetSfx(void) { } D_801333F8++; } -#endif } diff --git a/src/boot/boot_main.c b/src/boot/boot_main.c index b8c08fe8a..9b9cedb67 100644 --- a/src/boot/boot_main.c +++ b/src/boot/boot_main.c @@ -21,7 +21,7 @@ void bootproc(void) { gCartHandle = osCartRomInit(); osDriveRomInit(); -#if OOT_DEBUG +#if IS_DEBUG isPrintfInit(); #endif Locale_Init(); diff --git a/src/boot/build.c b/src/boot/build.c index ee6de4e7a..66c06130a 100644 --- a/src/boot/build.c +++ b/src/boot/build.c @@ -1,3 +1,28 @@ -const char gBuildTeam[] = "zelda@srd022j"; -const char gBuildDate[] = "03-02-21 00:16:31"; -const char gBuildMakeOption[] = ""; +#define STRINGIFY(s) #s +#define EXPAND_AND_STRINGIFY(s) STRINGIFY(s) + +#if !DETERMINISTIC_BUILD && (defined PACKAGE_AUTHOR) +char const gBuildAuthor[] = EXPAND_AND_STRINGIFY(PACKAGE_AUTHOR); +#else +char const gBuildAuthor[] = "???"; +#endif + +#if !DETERMINISTIC_BUILD +char const gBuildDate[] = __DATE__ " " __TIME__; +#else +char const gBuildDate[] = "???"; +#endif + +#if RELEASE_ROM +char const gBuildMakeOption[] = "RELEASE"; +#else +char const gBuildMakeOption[] = "DEBUG"; +#endif + +#if !DETERMINISTIC_BUILD && (defined PACKAGE_VERSION) +char const gBuildGitVersion[] = EXPAND_AND_STRINGIFY(PACKAGE_VERSION); +#else +char const gBuildGitVersion[] = "???"; +#endif + +char const gBuildTeam[] = ""; diff --git a/src/boot/idle.c b/src/boot/idle.c index f7074bd2f..72716b33e 100644 --- a/src/boot/idle.c +++ b/src/boot/idle.c @@ -46,7 +46,8 @@ void Idle_ThreadEntry(void* arg) { PRINTF("ダイナミックãƒãƒƒãƒ•ã‚¡ã®ã‚µã‚¤ã‚ºã¯ %d キロãƒã‚¤ãƒˆã§ã™\n", 0x92); PRINTF("FIFOãƒãƒƒãƒ•ã‚¡ã®ã‚µã‚¤ã‚ºã¯ %d キロãƒã‚¤ãƒˆã§ã™\n", 0x60); PRINTF("YIELDãƒãƒƒãƒ•ã‚¡ã®ã‚µã‚¤ã‚ºã¯ %d キロãƒã‚¤ãƒˆã§ã™\n", 3); - PRINTF("オーディオヒープã®ã‚µã‚¤ã‚ºã¯ %d キロãƒã‚¤ãƒˆã§ã™\n", ((intptr_t)gSystemHeap - (intptr_t)gAudioHeap) / 1024); + PRINTF("オーディオヒープã®ã‚µã‚¤ã‚ºã¯ %d キロãƒã‚¤ãƒˆã§ã™\n", + ((intptr_t)&gAudioHeap[ARRAY_COUNT(gAudioHeap)] - (intptr_t)gAudioHeap) / 1024); PRINTF(VT_RST); osCreateViManager(OS_PRIORITY_VIMGR); @@ -56,7 +57,7 @@ void Idle_ThreadEntry(void* arg) { gViConfigYScale = 1.0f; switch (osTvType) { -#if !OOT_DEBUG +#if !IS_DEBUG case OS_TV_PAL: #endif case OS_TV_NTSC: @@ -69,7 +70,7 @@ void Idle_ThreadEntry(void* arg) { gViConfigMode = osViModeMpalLan1; break; -#if OOT_DEBUG +#if IS_DEBUG case OS_TV_PAL: gViConfigModeType = OS_VI_FPAL_LAN1; gViConfigMode = osViModeFpalLan1; diff --git a/src/boot/is_debug.c b/src/boot/is_debug.c index b5d077212..365e4d8a5 100644 --- a/src/boot/is_debug.c +++ b/src/boot/is_debug.c @@ -1,11 +1,11 @@ #include "global.h" -OSPiHandle* sISVHandle; // official name : is_Handle - #define gISVDbgPrnAdrs ((ISVDbg*)0xB3FF0000) #define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0))) -#if OOT_DEBUG +#if IS_DEBUG +OSPiHandle* sISVHandle; // official name : is_Handle + void isPrintfInit(void) { sISVHandle = osCartRomInit(); osEPiWriteIo(sISVHandle, (u32)&gISVDbgPrnAdrs->put, 0); @@ -18,7 +18,7 @@ void osSyncPrintfUnused(const char* fmt, ...) { va_list args; va_start(args, fmt); -#if OOT_DEBUG +#if IS_DEBUG _Printf(is_proutSyncPrintf, NULL, fmt, args); #endif @@ -29,7 +29,7 @@ void osSyncPrintf(const char* fmt, ...) { va_list args; va_start(args, fmt); -#if OOT_DEBUG +#if IS_DEBUG _Printf(is_proutSyncPrintf, NULL, fmt, args); #endif @@ -41,14 +41,14 @@ void rmonPrintf(const char* fmt, ...) { va_list args; va_start(args, fmt); -#if OOT_DEBUG +#if IS_DEBUG _Printf(is_proutSyncPrintf, NULL, fmt, args); #endif va_end(args); } -#if OOT_DEBUG +#if IS_DEBUG void* is_proutSyncPrintf(void* arg, const char* str, size_t count) { u32 data; s32 pos; @@ -95,7 +95,7 @@ void* is_proutSyncPrintf(void* arg, const char* str, size_t count) { return (void*)1; } -NORETURN void func_80002384(const char* exp, const char* file, u32 line) { +NORETURN void func_80002384(const char* exp, const char* file, int line) { osSyncPrintf("File:%s Line:%d %s \n", file, line, exp); while (true) { ; diff --git a/src/boot/logutils.c b/src/boot/logutils.c index 101598482..1a6331606 100644 --- a/src/boot/logutils.c +++ b/src/boot/logutils.c @@ -1,8 +1,8 @@ #include "global.h" #include "terminal.h" -#if OOT_DEBUG -f32 LogUtils_CheckFloatRange(const char* exp, s32 line, const char* valueName, f32 value, const char* minName, f32 min, +#if IS_DEBUG +f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f32 value, const char* minName, f32 min, const char* maxName, f32 max) { if (value < min || max < value) { PRINTF("%s %d: range error %s(%f) < %s(%f) < %s(%f)\n", exp, line, minName, min, valueName, value, maxName, @@ -11,7 +11,7 @@ f32 LogUtils_CheckFloatRange(const char* exp, s32 line, const char* valueName, f return value; } -s32 LogUtils_CheckIntRange(const char* exp, s32 line, const char* valueName, s32 value, const char* minName, s32 min, +s32 LogUtils_CheckIntRange(const char* exp, int line, const char* valueName, s32 value, const char* minName, s32 min, const char* maxName, s32 max) { if (value < min || max < value) { PRINTF("%s %d: range error %s(%d) < %s(%d) < %s(%d)\n", exp, line, minName, min, valueName, value, maxName, @@ -73,11 +73,11 @@ void LogUtils_LogHexDump(void* ptr, s32 size0) { } } -void LogUtils_LogPointer(s32 value, u32 max, void* ptr, const char* name, const char* file, s32 line) { +void LogUtils_LogPointer(s32 value, u32 max, void* ptr, const char* name, const char* file, int line) { PRINTF(VT_COL(RED, WHITE) "%s %d %s[%d] max=%u ptr=%08x\n" VT_RST, file, line, name, value, max, ptr); } -void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* file, s32 line) { +void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* file, int line) { u32 mask = (unk - 1); if (value & mask) { @@ -85,24 +85,24 @@ void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* fi } } -void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, s32 line) { +void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, int line) { if (ptr == NULL) { PRINTF(VT_COL(RED, WHITE) "%s %d:%s 㯠ã¯ãƒŒãƒ«ãƒã‚¤ãƒ³ã‚¿ã§ã™\n" VT_RST, file, line, exp); } } -void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, s32 line) { +void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, int line) { if (ptr == NULL || (u32)ptr < 0x80000000 || (0x80000000 + osMemSize) <= (u32)ptr) { PRINTF(VT_COL(RED, WHITE) "%s %d:ãƒã‚¤ãƒ³ã‚¿ %s(%08x) ãŒç•°å¸¸ã§ã™\n" VT_RST, file, line, exp, ptr); } } -void LogUtils_LogThreadId(const char* name, s32 line) { +void LogUtils_LogThreadId(const char* name, int line) { PRINTF("<%d %s %d>", osGetThreadId(NULL), name, line); } #endif -void LogUtils_HungupThread(const char* name, s32 line) { +void LogUtils_HungupThread(const char* name, int line) { OSId threadId = osGetThreadId(NULL); PRINTF("*** HungUp in thread %d, [%s:%d] ***\n", threadId, name, line); diff --git a/src/boot/stackcheck.c b/src/boot/stackcheck.c index f7eefad71..5c8cee3d8 100644 --- a/src/boot/stackcheck.c +++ b/src/boot/stackcheck.c @@ -98,11 +98,16 @@ u32 StackCheck_GetState(StackEntry* entry) { ret = STACK_STATUS_OK; } +#if !IS_DEBUG + // This string is still in .rodata for retail builds + (void)"(null)"; +#endif + PRINTF("head=%08x tail=%08x last=%08x used=%08x free=%08x [%s]\n", entry->head, entry->tail, last, used, free, entry->name != NULL ? entry->name : "(null)"); PRINTF(VT_RST); -#if OOT_DEBUG +#if IS_DEBUG if (ret != STACK_STATUS_OK) { LogUtils_LogHexDump(entry->head, (uintptr_t)entry->tail - (uintptr_t)entry->head); } diff --git a/src/boot/z_locale.c b/src/boot/z_locale.c index abff2ba77..df803ccbf 100644 --- a/src/boot/z_locale.c +++ b/src/boot/z_locale.c @@ -33,7 +33,7 @@ void Locale_ResetRegion(void) { gCurrentRegion = REGION_NULL; } -#if OOT_DEBUG +#if IS_DEBUG u32 func_80001F48(void) { if (gCurrentRegion == REGION_NATIVE) { return 0; diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index a949197bf..5cb0f5187 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -20,6 +20,7 @@ */ #include "global.h" #include "terminal.h" +#include "compression.h" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; @@ -36,7 +37,7 @@ u32 sDmaMgrIsRomCompressed = false; // dmadata filenames #define DEFINE_DMA_ENTRY(_0, nameString) nameString, -#if OOT_DEBUG +#if IS_DEBUG const char* sDmaMgrFileNames[] = { #include "tables/dmadata_table.h" }; @@ -44,7 +45,7 @@ const char* sDmaMgrFileNames[] = { #undef DEFINE_DMA_ENTRY -#if OOT_DEBUG +#if IS_DEBUG /** * Compares `str1` and `str2`. * @@ -224,7 +225,7 @@ void DmaMgr_DmaFromDriveRom(void* ram, uintptr_t rom, size_t size) { osRecvMesg(&queue, NULL, OS_MESG_BLOCK); } -#if OOT_DEBUG +#if IS_DEBUG /** * DMA error encountered, print error messages and bring up the crash screen. * @@ -282,12 +283,12 @@ NORETURN void DmaMgr_Error(DmaRequest* req, const char* filename, const char* er * @return Pointer to associated filename */ const char* DmaMgr_FindFileName(uintptr_t vrom) { -#if OOT_DEBUG +#if IS_DEBUG DmaEntry* iter = gDmaDataTable; const char** name = sDmaMgrFileNames; - while (iter->vromEnd != 0) { - if (vrom >= iter->vromStart && vrom < iter->vromEnd) { + while (iter->file.vromEnd != 0) { + if (vrom >= iter->file.vromStart && vrom < iter->file.vromEnd) { return *name; } @@ -305,7 +306,7 @@ const char* DmaMgr_FindFileName(uintptr_t vrom) { } const char* DmaMgr_GetFileName(uintptr_t vrom) { -#if OOT_DEBUG +#if IS_DEBUG const char* ret = DmaMgr_FindFileName(vrom); if (ret == NULL) { @@ -333,7 +334,7 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { DmaEntry* iter; const char* filename; -#if OOT_DEBUG +#if IS_DEBUG // Get the filename (for debugging) filename = DmaMgr_GetFileName(vrom); #else @@ -343,8 +344,8 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { // Iterate through the DMA data table until the region containing the vrom address for this request is found iter = gDmaDataTable; - while (iter->vromEnd != 0) { - if (vrom >= iter->vromStart && vrom < iter->vromEnd) { + while (iter->file.vromEnd != 0) { + if (vrom >= iter->file.vromStart && vrom < iter->file.vromEnd) { // Found the region this request falls into if (0) { @@ -357,7 +358,7 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { // romEnd of 0 indicates that the file is uncompressed. Files that are stored uncompressed can have // only part of their content loaded into RAM, so DMA only the requested region. - if (iter->vromEnd < vrom + size) { + if (iter->file.vromEnd < vrom + size) { // Error, vrom + size ends up in a different file than it started in // "DMA transfers cannot cross segment boundaries" @@ -365,7 +366,7 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { "セグメント境界をã¾ãŸãŒã£ã¦ï¼¤ï¼­ï¼¡è»¢é€ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“", "../z_std_dma.c", 726); } - DmaMgr_DmaRomToRam(iter->romStart + (vrom - iter->vromStart), ram, size); + DmaMgr_DmaRomToRam(iter->romStart + (vrom - iter->file.vromStart), ram, size); found = true; if (0) { @@ -377,7 +378,7 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { romStart = iter->romStart; romSize = iter->romEnd - iter->romStart; - if (vrom != iter->vromStart) { + if (vrom != iter->file.vromStart) { // Error, requested vrom is not the start of a file // "DMA transfer cannot be performed from the middle of a compressed segment" @@ -385,7 +386,7 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { "圧縮ã•れãŸã‚»ã‚°ãƒ¡ãƒ³ãƒˆã®é€”中ã‹ã‚‰ã¯ï¼¤ï¼­ï¼¡è»¢é€ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“", "../z_std_dma.c", 746); } - if (size != iter->vromEnd - iter->vromStart) { + if (size != iter->file.vromEnd - iter->file.vromStart) { // Error, only part of the file was requested // "It is not possible to DMA only part of a compressed segment" @@ -396,7 +397,13 @@ void DmaMgr_ProcessRequest(DmaRequest* req) { // Reduce the thread priority and decompress the file, the decompression routine handles the DMA // in chunks. Restores the thread priority when done. osSetThreadPri(NULL, THREAD_PRI_DMAMGR_LOW); - Yaz0_Decompress(romStart, ram, romSize); + if (COMPRESS_YAZ) { + Yaz0_Decompress(romStart, ram, romSize); + } else if (COMPRESS_LZO) { + LZO_Decompress(romStart, ram, romSize); + } else if (COMPRESS_APLIB) { + Aplib_Decompress(romStart, ram, romSize); + } osSetThreadPri(NULL, THREAD_PRI_DMAMGR); found = true; @@ -481,7 +488,7 @@ s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, OSMesg msg) { static s32 sDmaMgrQueueFullLogged = 0; -#if OOT_DEBUG +#if IS_DEBUG if ((ram == NULL) || (osMemSize < OS_K0_TO_PHYSICAL(ram) + size) || (vrom & 1) || (vrom > 0x4000000) || (size == 0) || (size & 1)) { // The line numbers for `DMA_ERROR` are only used in retail builds, but this usage was removed so @@ -498,7 +505,7 @@ s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, req->notifyQueue = queue; req->notifyMsg = msg; -#if OOT_DEBUG +#if IS_DEBUG if (1 && (sDmaMgrQueueFullLogged == 0) && MQ_IS_FULL(&sDmaMgrMsgQueue)) { sDmaMgrQueueFullLogged++; PRINTF("%c", BEL); @@ -550,21 +557,25 @@ void DmaMgr_Init(void) { (u32)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart)); PRINTF("dma_rom_ad[]\n"); -#if OOT_DEBUG +#if IS_DEBUG name = sDmaMgrFileNames; iter = gDmaDataTable; idx = 0; // Check if the ROM is compressed (romEnd not 0) sDmaMgrIsRomCompressed = false; - while (iter->vromEnd != 0) { + while (iter->file.vromEnd != 0) { if (iter->romEnd != 0) { sDmaMgrIsRomCompressed = true; } - PRINTF("%3d %08x %08x %08x %08x %08x %c %s\n", idx, iter->vromStart, iter->vromEnd, iter->romStart, - iter->romEnd, (iter->romEnd != 0) ? iter->romEnd - iter->romStart : iter->vromEnd - iter->vromStart, - (((iter->romEnd != 0) ? iter->romEnd - iter->romStart : 0) > 0x10000) ? '*' : ' ', name ? *name : ""); + if (ENABLE_DMA_PRINTF) { + PRINTF("%3d %08x %08x %08x %08x %08x %c %s\n", idx, iter->file.vromStart, iter->file.vromEnd, + iter->romStart, iter->romEnd, + (iter->romEnd != 0) ? iter->romEnd - iter->romStart : iter->file.vromEnd - iter->file.vromStart, + (((iter->romEnd != 0) ? iter->romEnd - iter->romStart : 0) > 0x10000) ? '*' : ' ', + name ? *name : ""); + } idx++; iter++; @@ -576,9 +587,9 @@ void DmaMgr_Init(void) { #endif // Ensure that the boot segment always follows after the makerom segment. - if ((uintptr_t)_bootSegmentRomStart != gDmaDataTable[0].vromEnd) { + if ((uintptr_t)_bootSegmentRomStart != gDmaDataTable[0].file.vromEnd) { PRINTF("_bootSegmentRomStart(%08x) != dma_rom_ad[0].rom_b(%08x)\n", _bootSegmentRomStart, - gDmaDataTable[0].vromEnd); + gDmaDataTable[0].file.vromEnd); //! @bug The main code file where fault.c resides is not yet loaded Fault_AddHungupAndCrash("../z_std_dma.c", 1055); } @@ -591,14 +602,14 @@ void DmaMgr_Init(void) { osStartThread(&sDmaMgrThread); } -#if OOT_DEBUG +#if IS_DEBUG /** * Asynchronous DMA Request with source file and line info for debugging. * * @see DmaMgr_RequestAsync */ s32 DmaMgr_RequestAsyncDebug(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk5, OSMesgQueue* queue, - OSMesg msg, const char* file, s32 line) { + OSMesg msg, const char* file, int line) { req->filename = file; req->line = line; return DmaMgr_RequestAsync(req, ram, vrom, size, unk5, queue, msg); @@ -609,7 +620,7 @@ s32 DmaMgr_RequestAsyncDebug(DmaRequest* req, void* ram, uintptr_t vrom, size_t * * @see DmaMgr_RequestSync */ -s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, s32 line) { +s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, int line) { DmaRequest req; s32 ret; OSMesgQueue queue; diff --git a/src/buffers/audio_heap.c b/src/buffers/audio_heap.c new file mode 100644 index 000000000..b6474ccc6 --- /dev/null +++ b/src/buffers/audio_heap.c @@ -0,0 +1,3 @@ +#include "z64.h" + +ALIGNED(16) u8 gAudioHeap[0x38000]; diff --git a/src/buffers/gfxbuffers.c b/src/buffers/gfxbuffers.c index 978dede54..fa466bc82 100644 --- a/src/buffers/gfxbuffers.c +++ b/src/buffers/gfxbuffers.c @@ -1,13 +1,9 @@ #include "z64.h" -// 0x18000 bytes -u64 gGfxSPTaskOutputBuffer[0x3000]; +ALIGNED(16) u64 gGfxSPTaskOutputBuffer[0x3000]; -// 0xC00 bytes -u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)]; +ALIGNED(16) u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)]; -// 0x400 bytes -u64 gGfxSPTaskStack[SP_DRAM_STACK_SIZE64]; +ALIGNED(16) u64 gGfxSPTaskStack[SP_DRAM_STACK_SIZE64]; -// 0x12410 bytes each; 0x24820 bytes total -GfxPool gGfxPools[2]; +ALIGNED(16) GfxPool gGfxPools[2]; diff --git a/src/buffers/heaps.c b/src/buffers/heaps.c deleted file mode 100644 index e39afc33f..000000000 --- a/src/buffers/heaps.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "z64.h" - -// 0x38000 bytes -u8 gAudioHeap[0x38000]; - -u8 gSystemHeap[UNK_SIZE]; diff --git a/src/buffers/zbuffer.c b/src/buffers/zbuffer.c index 555d9fdd7..d9e5d2784 100644 --- a/src/buffers/zbuffer.c +++ b/src/buffers/zbuffer.c @@ -1,4 +1,3 @@ #include "z64.h" -// 0x25800 bytes -u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH]; +ALIGNED(64) u16 gZBuffer[SCREEN_HEIGHT][SCREEN_WIDTH]; diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 962d148d7..2ef603fa7 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -95,8 +95,8 @@ void PreRender_CopyImage(PreRender* this, Gfx** gfxP, void* img, void* imgDst) { gSPTextureRectangle(gfx++, uls << 2, ult << 2, lrs << 2, lrt << 2, G_TX_RENDERTILE, uls << 5, ult << 5, 4 << 10, 1 << 10); - rowsRemaining -= nRows; curRow += nRows; + rowsRemaining -= nRows; } gDPPipeSync(gfx++); @@ -140,7 +140,9 @@ void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxP) { s32 uly; // Make sure that we don't load past the end of the source image - nRows = MIN(rowsRemaining, nRows); + if (nRows > rowsRemaining) { + nRows = rowsRemaining; + } // Determine the upper and lower bounds of the rect to draw ult = this->ulySave + curRow; @@ -156,8 +158,8 @@ void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxP) { gSPTextureRectangle(gfx++, this->ulx << 2, uly << 2, this->lrx << 2, (uly + nRows - 1) << 2, G_TX_RENDERTILE, this->ulxSave << 5, ult << 5, 4 << 10, 1 << 10); - rowsRemaining -= nRows; curRow += nRows; + rowsRemaining -= nRows; } // Reset the color image and scissor @@ -226,8 +228,8 @@ void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, gSPTextureRectangle(gfx++, uls << 2, ult << 2, (lrs + 1) << 2, (lrt + 1) << 2, G_TX_RENDERTILE, uls << 5, ult << 5, 1 << 10, 1 << 10); - rowsRemaining -= nRows; curRow += nRows; + rowsRemaining -= nRows; } gDPPipeSync(gfx++); @@ -287,7 +289,9 @@ void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxP, void* img, void* s32 lrt; // Make sure that we don't load past the end of the source image - nRows = MIN(rowsRemaining, nRows); + if (nRows > rowsRemaining) { + nRows = rowsRemaining; + } // Determine the upper and lower bounds of the rect to draw ult = curRow; @@ -319,8 +323,8 @@ void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxP, void* img, void* ult << 5, 1 << 10, 1 << 10); // Update the number of rows remaining and index of the row being drawn - rowsRemaining -= nRows; curRow += nRows; + rowsRemaining -= nRows; } // Reset the color image to the current framebuffer @@ -477,8 +481,8 @@ void func_800C213C(PreRender* this, Gfx** gfxP) { gSPTextureRectangle(gfx++, uls << 2, ult << 2, (lrs + 1) << 2, (lrt + 1) << 2, G_TX_RENDERTILE, uls << 5, ult << 5, 1 << 10, 1 << 10); - rowsRemaining -= nRows; curRow += nRows; + rowsRemaining -= nRows; } gDPPipeSync(gfx++); @@ -545,7 +549,7 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) { s32 buffB[5 * 3]; s32 xi; s32 yi; - s32 pad; + s32 invCvg; s32 pmaxR; s32 pmaxG; s32 pmaxB; @@ -583,10 +587,12 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) { buffCvg[i] = this->cvgSave[xi + yi * this->width] >> 5; } +#if IS_DEBUG if (buffCvg[7] == 7) { PRINTF("Error, should not be in here \n"); return; } +#endif pmaxR = pminR = buffR[7]; pmaxG = pminG = buffG[7]; @@ -658,9 +664,10 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) { // BackGround = (pMax + pMin) - (ForeGround) * 2 // OutputColor = cvg * ForeGround + (1.0 - cvg) * BackGround - outR = buffR[7] + ((s32)((7 - buffCvg[7]) * (pmaxR + pminR - (buffR[7] * 2)) + 4) >> 3); - outG = buffG[7] + ((s32)((7 - buffCvg[7]) * (pmaxG + pminG - (buffG[7] * 2)) + 4) >> 3); - outB = buffB[7] + ((s32)((7 - buffCvg[7]) * (pmaxB + pminB - (buffB[7] * 2)) + 4) >> 3); + invCvg = 7 - buffCvg[7]; + outR = buffR[7] + ((s32)(invCvg * (pmaxR + pminR - (buffR[7] * 2)) + 4) >> 3); + outG = buffG[7] + ((s32)(invCvg * (pmaxG + pminG - (buffG[7] * 2)) + 4) >> 3); + outB = buffB[7] + ((s32)(invCvg * (pmaxB + pminB - (buffB[7] * 2)) + 4) >> 3); pxOut.r = outR >> 3; pxOut.g = outG >> 3; @@ -674,6 +681,14 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) { (((a2) >= (a1)) ? (((a3) >= (a2)) ? (a2) : (((a1) >= (a3)) ? (a1) : (a3))) \ : (((a2) >= (a3)) ? (a2) : (((a3) >= (a1)) ? (a1) : (a3)))) +#if IS_DEBUG +#define R_HREG_MODE_DEBUG R_HREG_MODE +#else +#define R_HREG_MODE_DEBUG ((void)0, 0) +#endif + +#define PRERENDER_DIVOT_CONTROL (R_HREG_MODE_DEBUG == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) + /** * Applies the Video Interface divot filter to an image. * @@ -689,7 +704,7 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) { void PreRender_DivotFilter(PreRender* this) { s32 x; s32 y; - s32 pad1; + s32 cvg; u8* buffR = alloca(this->width); u8* buffG = alloca(this->width); u8* buffB = alloca(this->width); @@ -697,14 +712,14 @@ void PreRender_DivotFilter(PreRender* this) { s32 pxR; s32 pxG; s32 pxB; + Color_RGBA16 pxIn; + Color_RGBA16 pxOut; for (y = 0; y < this->height; y++) { // The divot filter is applied row-by-row as it only needs to use pixels that are horizontally adjacent // Decompose each pixel into color channels for (x = 0; x < this->width; x++) { - Color_RGBA16 pxIn; - pxIn.rgba = this->fbufSave[x + y * this->width]; buffR[x] = pxIn.r; buffG[x] = pxIn.g; @@ -714,8 +729,7 @@ void PreRender_DivotFilter(PreRender* this) { // Apply the divot filter itself. For pixels with partial coverage, the filter selects the median value from a // window of 3 pixels in a horizontal row and uses that as the value for the center pixel. for (x = 1; x < this->width - 1; x++) { - Color_RGBA16 pxOut; - s32 cvg = this->cvgSave[x + y * this->width]; + cvg = this->cvgSave[x + y * this->width]; // Reject pixels with full coverage. The hardware video filter divot circuit checks if all 3 pixels in the // window have partial coverage, here only the center pixel is checked. @@ -725,11 +739,10 @@ void PreRender_DivotFilter(PreRender* this) { } // This condition is checked before entering this function, it will always pass if it runs. - if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) != 0) { - if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) != 0) {} + if (PRERENDER_DIVOT_CONTROL != 0) { + if (PRERENDER_DIVOT_CONTROL != 0) {} - if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) == - PRERENDER_DIVOT_PARTIAL_CVG_RED) { + if (PRERENDER_DIVOT_CONTROL == PRERENDER_DIVOT_PARTIAL_CVG_RED) { // Fill the pixel with full red, likely for debugging pxR = 31; pxG = 0; @@ -740,8 +753,7 @@ void PreRender_DivotFilter(PreRender* this) { u8* windowG = &buffG[x - 1]; u8* windowB = &buffB[x - 1]; - if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) == - PRERENDER_DIVOT_PRINT_COLOR) { + if (PRERENDER_DIVOT_CONTROL == PRERENDER_DIVOT_PRINT_COLOR) { PRINTF("red=%3d %3d %3d %3d grn=%3d %3d %3d %3d blu=%3d %3d %3d %3d \n", windowR[0], windowR[1], windowR[2], MEDIAN3(windowR[0], windowR[1], windowR[2]), windowG[0], windowG[1], windowG[2], MEDIAN3(windowG[0], windowG[1], windowG[2]), windowB[0], windowB[1], @@ -751,8 +763,7 @@ void PreRender_DivotFilter(PreRender* this) { // Sample the median value from the 3 pixel wide window // (Both blocks contain the same code) - if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) == - PRERENDER_DIVOT_ALTERNATE_COLOR) { + if (PRERENDER_DIVOT_CONTROL == PRERENDER_DIVOT_ALTERNATE_COLOR) { pxR = MEDIAN3(windowR[0], windowR[1], windowR[2]); pxG = MEDIAN3(windowG[0], windowG[1], windowG[2]); pxB = MEDIAN3(windowB[0], windowB[1], windowB[2]); @@ -778,27 +789,29 @@ void PreRender_DivotFilter(PreRender* this) { * `this->cvgSave` */ void PreRender_ApplyFilters(PreRender* this) { - s32 x; - s32 y; + if (ENABLE_PAUSE_BG_AA) { + s32 x; + s32 y; - if ((this->cvgSave != NULL) && (this->fbufSave != NULL)) { - // Apply AA filter - for (y = 0; y < this->height; y++) { - for (x = 0; x < this->width; x++) { - s32 cvg = this->cvgSave[x + y * this->width]; + if ((this->cvgSave != NULL) && (this->fbufSave != NULL)) { + // Apply AA filter + for (y = 0; y < this->height; y++) { + for (x = 0; x < this->width; x++) { + s32 cvg = this->cvgSave[x + y * this->width]; - cvg >>= 5; - cvg++; - if (cvg != 8) { - // If this pixel has only partial coverage, perform the Video Filter interpolation on it - PreRender_AntiAliasFilter(this, x, y); + cvg >>= 5; + cvg++; + if (cvg != 8) { + // If this pixel has only partial coverage, perform the Video Filter interpolation on it + PreRender_AntiAliasFilter(this, x, y); + } } } - } - if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) != 0) { - // Apply divot filter - PreRender_DivotFilter(this); + if (IS_DEBUG && PRERENDER_DIVOT_CONTROL != 0) { + // Apply divot filter + PreRender_DivotFilter(this); + } } } } diff --git a/src/code/__osMalloc.c b/src/code/__osMalloc.c index 6119f8af0..db5522ff0 100644 --- a/src/code/__osMalloc.c +++ b/src/code/__osMalloc.c @@ -16,7 +16,7 @@ #define NODE_IS_VALID(node) (((node) != NULL) && ((node)->magic == NODE_MAGIC)) -#if OOT_DEBUG +#if IS_DEBUG #define NODE_GET_NEXT(node) ArenaImpl_GetNextBlock(node) #define NODE_GET_PREV(node) ArenaImpl_GetPrevBlock(node) @@ -67,7 +67,7 @@ u32 sTotalAllocFailures = 0; OSMesg sArenaLockMsg; -#if OOT_DEBUG +#if IS_DEBUG u32 __osMalloc_FreeBlockTest_Enable; u32 ArenaImpl_GetFillAllocBlock(Arena* arena) { @@ -100,7 +100,7 @@ void ArenaImpl_UnsetCheckFreeBlock(Arena* arena) { arena->flag &= ~CHECK_FREE_BLOCK_FLAG; } -void ArenaImpl_SetDebugInfo(ArenaNode* node, const char* file, s32 line, Arena* arena) { +void ArenaImpl_SetDebugInfo(ArenaNode* node, const char* file, int line, Arena* arena) { node->filename = file; node->line = line; node->threadId = osGetThreadId(NULL); @@ -121,7 +121,7 @@ void ArenaImpl_Unlock(Arena* arena) { osRecvMesg(&arena->lockQueue, NULL, OS_MESG_BLOCK); } -#if OOT_DEBUG +#if IS_DEBUG ArenaNode* ArenaImpl_GetNextBlock(ArenaNode* node) { ArenaNode* next = node->next; @@ -178,7 +178,7 @@ void __osMallocAddBlock(Arena* arena, void* start, s32 size) { size2 = (size - diff) & ~0xF; if (size2 > (s32)sizeof(ArenaNode)) { -#if OOT_DEBUG +#if IS_DEBUG __osMemset(firstNode, BLOCK_UNINIT_MAGIC, size2); #endif firstNode->next = NULL; @@ -200,7 +200,7 @@ void __osMallocAddBlock(Arena* arena, void* start, s32 size) { } } -#if OOT_DEBUG +#if IS_DEBUG void ArenaImpl_RemoveAllBlocks(Arena* arena) { ArenaNode* iter; ArenaNode* next; @@ -219,7 +219,7 @@ void ArenaImpl_RemoveAllBlocks(Arena* arena) { #endif void __osMallocCleanup(Arena* arena) { -#if OOT_DEBUG +#if IS_DEBUG ArenaImpl_RemoveAllBlocks(arena); #endif bzero(arena, sizeof(*arena)); @@ -229,7 +229,7 @@ u8 __osMallocIsInitialized(Arena* arena) { return arena->isInit; } -#if OOT_DEBUG +#if IS_DEBUG void __osMalloc_FreeBlockTest(Arena* arena, ArenaNode* node) { ArenaNode* node2 = node; u32* start; @@ -254,7 +254,7 @@ void __osMalloc_FreeBlockTest(Arena* arena, ArenaNode* node) { } } -void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, s32 line) { +void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, int line) { ArenaNode* iter; u32 blockSize; ArenaNode* newNode; @@ -299,7 +299,7 @@ void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, s32 line) return alloc; } -void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line) { +void* __osMallocDebug(Arena* arena, u32 size, const char* file, int line) { void* alloc; ArenaImpl_Lock(arena); @@ -309,7 +309,7 @@ void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line) { return alloc; } -void* __osMallocRDebug(Arena* arena, u32 size, const char* file, s32 line) { +void* __osMallocRDebug(Arena* arena, u32 size, const char* file, int line) { ArenaNode* iter; ArenaNode* newNode; u32 blockSize; @@ -483,7 +483,7 @@ void __osFree_NoLock(Arena* arena, void* ptr) { PRINTF(VT_COL(RED, WHITE) "__osFree:二é‡è§£æ”¾(%08x)\n" VT_RST, ptr); // "__osFree: Double release (%08x)" return; } -#if OOT_DEBUG +#if IS_DEBUG if (arena != node->arena && arena != NULL) { // "__osFree:Tried to release in a different way than when it was secured (%08x:%08x)" PRINTF(VT_COL(RED, WHITE) "__osFree:ç¢ºä¿æ™‚ã¨é•ã†æ–¹æ³•ã§è§£æ”¾ã—よã†ã¨ã—㟠(%08x:%08x)\n" VT_RST, arena, @@ -527,8 +527,8 @@ void __osFree(Arena* arena, void* ptr) { ArenaImpl_Unlock(arena); } -#if OOT_DEBUG -void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line) { +#if IS_DEBUG +void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, int line) { ArenaNode* node; ArenaNode* next; ArenaNode* prev; @@ -586,7 +586,7 @@ void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line) { } } -void __osFreeDebug(Arena* arena, void* ptr, const char* file, s32 line) { +void __osFreeDebug(Arena* arena, void* ptr, const char* file, int line) { ArenaImpl_Lock(arena); __osFree_NoLockDebug(arena, ptr, file, line); ArenaImpl_Unlock(arena); @@ -694,8 +694,8 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) { return ptr; } -#if OOT_DEBUG -void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, s32 line) { +#if IS_DEBUG +void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, int line) { return __osRealloc(arena, ptr, newSize); } #endif @@ -726,7 +726,7 @@ void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAll ArenaImpl_Unlock(arena); } -#if OOT_DEBUG +#if IS_DEBUG void __osDisplayArena(Arena* arena) { u32 freeSize; u32 allocatedSize; @@ -852,7 +852,11 @@ u32 __osCheckArena(Arena* arena) { while (iter != NULL) { if (iter && iter->magic == NODE_MAGIC) { // "Oops!! (%08x %08x)" +#if IS_DEBUG osSyncPrintf(VT_COL(RED, WHITE) "ãŠãŠã£ã¨ï¼ï¼ (%08x %08x)\n" VT_RST, iter, iter->magic); +#else + osSyncPrintf("ãŠãŠã£ã¨ï¼ï¼ (%08x %08x)\n", iter, iter->magic); +#endif error = 1; break; } @@ -866,7 +870,7 @@ u32 __osCheckArena(Arena* arena) { return error; } -#if OOT_DEBUG +#if IS_DEBUG u8 ArenaImpl_GetAllocFailures(Arena* arena) { return arena->allocFailures; } diff --git a/src/code/audio_thread_manager.c b/src/code/audio_thread_manager.c index bbec08dea..718281484 100644 --- a/src/code/audio_thread_manager.c +++ b/src/code/audio_thread_manager.c @@ -45,7 +45,9 @@ void AudioMgr_HandleRetrace(AudioMgr* audioMgr) { // Update the audio driver - gAudioThreadUpdateTimeStart = osGetTime(); + if (IS_SPEEDMETER_ENABLED) { + gAudioThreadUpdateTimeStart = osGetTime(); + } if (R_AUDIOMGR_DEBUG_LEVEL >= AUDIOMGR_DEBUG_LEVEL_NO_UPDATE) { // Skip update, no rsp task produced @@ -54,8 +56,10 @@ void AudioMgr_HandleRetrace(AudioMgr* audioMgr) { rspTask = AudioThread_Update(); } - gAudioThreadUpdateTimeAcc += osGetTime() - gAudioThreadUpdateTimeStart; - gAudioThreadUpdateTimeStart = 0; + if (IS_SPEEDMETER_ENABLED) { + gAudioThreadUpdateTimeAcc += osGetTime() - gAudioThreadUpdateTimeStart; + gAudioThreadUpdateTimeStart = 0; + } if (audioMgr->rspTask != NULL) { // Wait for the audio rsp task scheduled on the previous retrace to complete. This looks like it should wait @@ -105,7 +109,7 @@ void AudioMgr_ThreadEntry(void* arg) { IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->interruptQueue); // Spin waiting for events - while (true) { + for (;;) { osRecvMesg(&audioMgr->interruptQueue, (OSMesg*)&msg, OS_MESG_BLOCK); switch (*msg) { diff --git a/src/code/code_800430A0.c b/src/code/code_800430A0.c index a13ecce7e..4060cc51c 100644 --- a/src/code/code_800430A0.c +++ b/src/code/code_800430A0.c @@ -36,7 +36,7 @@ void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Act SkinMatrix_Vec3fMtxFMultXYZ(&curTransform, &tempPos, &pos); carriedActor->world.pos = pos; -#if OOT_DEBUG +#if IS_DEBUG if (BGCHECK_XYZ_ABSMAX <= pos.x || pos.x <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.y || pos.y <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.z || pos.z <= -BGCHECK_XYZ_ABSMAX) { diff --git a/src/code/code_800D31A0.c b/src/code/code_800D31A0.c index b4e0495e1..59e60968b 100644 --- a/src/code/code_800D31A0.c +++ b/src/code/code_800D31A0.c @@ -1,7 +1,7 @@ #include "global.h" #include "terminal.h" -#if OOT_DEBUG +#if IS_DEBUG u32 gIsCtrlr2Valid = false; #endif @@ -12,7 +12,7 @@ NORETURN void func_800D31A0(void) { } } -#if OOT_DEBUG +#if IS_DEBUG void func_800D31F0(void) { gIsCtrlr2Valid = (gPadMgr.validCtrlrsMask & 2) != 0; } diff --git a/src/code/code_800FC620.c b/src/code/code_800FC620.c index 462179b38..6db810300 100644 --- a/src/code/code_800FC620.c +++ b/src/code/code_800FC620.c @@ -13,7 +13,11 @@ typedef struct InitFunc { // .data void* sInitFuncs = NULL; +#if IS_DEBUG char sNew[] = "new"; +#else +char sNew[] = ""; +#endif char D_80134488[0x18] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x00, @@ -26,7 +30,7 @@ void* func_800FC800(u32 size) { size = 1; } -#if OOT_DEBUG +#if IS_DEBUG return __osMallocDebug(&gSystemArena, size, sNew, 0); #else return __osMalloc(&gSystemArena, size); diff --git a/src/code/code_800FD970.c b/src/code/code_800FD970.c deleted file mode 100644 index cc9dc5e63..000000000 --- a/src/code/code_800FD970.c +++ /dev/null @@ -1,79 +0,0 @@ -#include "global.h" - -// The latest generated random number, used to generate the next number in the sequence. -static u32 sRandInt = 1; - -// Space to store a value to be re-interpreted as a float. -static u32 sRandFloat; - -/** - * Gets the next integer in the sequence of pseudo-random numbers. - */ -u32 Rand_Next(void) { - return sRandInt = (sRandInt * 1664525) + 1013904223; -} - -/** - * Seeds the pseudo-random number generator by providing a starting value. - */ -void Rand_Seed(u32 seed) { - sRandInt = seed; -} - -/** - * Returns a pseudo-random floating-point number between 0.0f and 1.0f, by generating - * the next integer and masking it to an IEEE-754 compliant floating-point number - * between 1.0f and 2.0f, returning the result subtract 1.0f. - */ -f32 Rand_ZeroOne(void) { - sRandInt = (sRandInt * 1664525) + 1013904223; - sRandFloat = ((sRandInt >> 9) | 0x3F800000); - return *((f32*)&sRandFloat) - 1.0f; -} - -/** - * Returns a pseudo-random floating-point number between -0.5f and 0.5f by the same - * manner in which Rand_ZeroOne generates its result. - */ -f32 Rand_Centered(void) { - sRandInt = (sRandInt * 1664525) + 1013904223; - sRandFloat = ((sRandInt >> 9) | 0x3F800000); - return *((f32*)&sRandFloat) - 1.5f; -} - -/** - * Seeds a pseudo-random number at rndNum with a provided seed. - */ -void Rand_Seed_Variable(u32* rndNum, u32 seed) { - *rndNum = seed; -} - -/** - * Generates the next pseudo-random integer from the provided rndNum. - */ -u32 Rand_Next_Variable(u32* rndNum) { - return *rndNum = (*rndNum * 1664525) + 1013904223; -} - -/** - * Generates the next pseudo-random floating-point number between 0.0f and - * 1.0f from the provided rndNum. - */ -f32 Rand_ZeroOne_Variable(u32* rndNum) { - u32 next = (*rndNum * 1664525) + 1013904223; - - sRandFloat = ((*rndNum = next) >> 9) | 0x3F800000; - return *((f32*)&sRandFloat) - 1.0f; -} - -/** - * Generates the next pseudo-random floating-point number between -0.5f and - * 0.5f from the provided rndNum. - */ -f32 Rand_Centered_Variable(u32* rndNum) { - u32 next = (*rndNum * 1664525) + 1013904223; - - *rndNum = next; - sRandFloat = (next >> 9) | 0x3F800000; - return *((f32*)&sRandFloat) - 1.5f; -} diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c index 1f00167bd..706578527 100644 --- a/src/code/debug_malloc.c +++ b/src/code/debug_malloc.c @@ -6,7 +6,7 @@ Arena sDebugArena; -#if OOT_DEBUG +#if IS_DEBUG s32 gDebugArenaLogSeverity = LOG_SEVERITY_ERROR; void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) { @@ -35,8 +35,8 @@ void* DebugArena_Malloc(u32 size) { return ptr; } -#if OOT_DEBUG -void* DebugArena_MallocDebug(u32 size, const char* file, s32 line) { +#if IS_DEBUG +void* DebugArena_MallocDebug(u32 size, const char* file, int line) { void* ptr = __osMallocDebug(&sDebugArena, size, file, line); DEBUG_ARENA_CHECK_POINTER(ptr, size, "debug_malloc_DEBUG", "確ä¿"); // "Secure" @@ -51,8 +51,8 @@ void* DebugArena_MallocR(u32 size) { return ptr; } -#if OOT_DEBUG -void* DebugArena_MallocRDebug(u32 size, const char* file, s32 line) { +#if IS_DEBUG +void* DebugArena_MallocRDebug(u32 size, const char* file, int line) { void* ptr = __osMallocRDebug(&sDebugArena, size, file, line); DEBUG_ARENA_CHECK_POINTER(ptr, size, "debug_malloc_r_DEBUG", "確ä¿"); // "Secure" @@ -66,8 +66,8 @@ void* DebugArena_Realloc(void* ptr, u32 newSize) { return ptr; } -#if OOT_DEBUG -void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) { +#if IS_DEBUG +void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) { ptr = __osReallocDebug(&sDebugArena, ptr, newSize, file, line); DEBUG_ARENA_CHECK_POINTER(ptr, newSize, "debug_realloc_DEBUG", "å†ç¢ºä¿"); // "Re-securing" return ptr; @@ -78,8 +78,8 @@ void DebugArena_Free(void* ptr) { __osFree(&sDebugArena, ptr); } -#if OOT_DEBUG -void DebugArena_FreeDebug(void* ptr, const char* file, s32 line) { +#if IS_DEBUG +void DebugArena_FreeDebug(void* ptr, const char* file, int line) { __osFreeDebug(&sDebugArena, ptr, file, line); } #endif @@ -97,13 +97,13 @@ void* DebugArena_Calloc(u32 num, u32 size) { return ret; } -#if OOT_DEBUG void DebugArena_Display(void) { - // "Zelda heap display" ("Zelda" should probably have been changed to "Debug") - PRINTF("ゼルダヒープ表示\n"); - __osDisplayArena(&sDebugArena); + if (IS_DEBUG_HEAP_ENABLED) { + // "Zelda heap display" ("Zelda" should probably have been changed to "Debug") + PRINTF("ゼルダヒープ表示\n"); + __osDisplayArena(&sDebugArena); + } } -#endif void DebugArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) { ArenaImpl_GetSizes(&sDebugArena, outMaxFree, outFree, outAlloc); @@ -114,14 +114,14 @@ void DebugArena_Check(void) { } void DebugArena_Init(void* start, u32 size) { -#if OOT_DEBUG +#if IS_DEBUG gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocInit(&sDebugArena, start, size); } void DebugArena_Cleanup(void) { -#if OOT_DEBUG +#if IS_DEBUG gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocCleanup(&sDebugArena); diff --git a/src/code/fault.c b/src/code/fault.c index 593613f50..fbc89e1b1 100644 --- a/src/code/fault.c +++ b/src/code/fault.c @@ -361,21 +361,10 @@ void Fault_Sleep(u32 msec) { Fault_SleepImpl(msec); } -#ifndef AVOID_UB -void PadMgr_RequestPadData(Input* inputs, s32 gameRequest); -#endif +void PadMgr_RequestPadData(PadMgr* padmgr, Input* inputs, s32 gameRequest); void Fault_PadCallback(Input* inputs) { - //! @bug This function is not called correctly, it is missing a leading PadMgr* argument. This - //! renders the crash screen unusable. - //! In Majora's Mask, PadMgr functions were changed to not require this argument, and this was - //! likely just not addressed when backporting. -#ifndef AVOID_UB - PadMgr_RequestPadData(inputs, false); -#else - // Guarantee crashing behavior: false -> NULL, previous value in a2 is more often non-zero than zero - PadMgr_RequestPadData((PadMgr*)inputs, NULL, true); -#endif + PadMgr_RequestPadData(&gPadMgr, inputs, false); } void Fault_UpdatePadImpl(void) { @@ -402,11 +391,11 @@ u32 Fault_WaitForInputImpl(void) { pressedBtn = input->press.button; - if (pressedBtn == BTN_L) { + if (!DISABLE_CRASH_DBG_AUTOSCROLL && pressedBtn == BTN_L) { sFaultInstance->autoScroll = !sFaultInstance->autoScroll; } - if (sFaultInstance->autoScroll) { + if (!DISABLE_CRASH_DBG_AUTOSCROLL && sFaultInstance->autoScroll) { if (count-- < 1) { return false; } @@ -658,157 +647,7 @@ void Fault_Wait5Seconds(void) { Fault_Sleep(1000 / 60); } while ((osGetTime() - start) < OS_SEC_TO_CYCLES(5) + 1); - sFaultInstance->autoScroll = true; -} - -/** - * Waits for the following button combination to be entered before returning: - * - * (L & R & Z) + DPad-Up + C-Down + C-Up + DPad-Down + DPad-Left + C-Left + C-Right + DPad-Right + (B & A & START) - */ -void Fault_WaitForButtonCombo(void) { - Input* input = &sFaultInstance->inputs[0]; - s32 state; - u32 s1; - u32 s2; - u32 pressedBtn; - u32 curBtn; - - if (1) {} - if (1) {} - - osSyncPrintf( - VT_FGCOL(WHITE) "KeyWaitB (LRZ " VT_FGCOL(WHITE) "上" VT_FGCOL(YELLOW) "下 " VT_FGCOL(YELLOW) "上" VT_FGCOL(WHITE) "下 " VT_FGCOL(WHITE) "å·¦" VT_FGCOL( - YELLOW) "å·¦ " VT_FGCOL(YELLOW) "å³" VT_FGCOL(WHITE) "å³ " VT_FGCOL(GREEN) "ï¼¢" VT_FGCOL(BLUE) "A" VT_FGCOL(RED) "START" VT_FGCOL(WHITE) ")" VT_RST - "\n"); - osSyncPrintf(VT_FGCOL(WHITE) "KeyWaitB'(LR左" VT_FGCOL(YELLOW) "å³ +" VT_FGCOL(RED) "START" VT_FGCOL( - WHITE) ")" VT_RST "\n"); - - FaultDrawer_SetForeColor(GPACK_RGBA5551(255, 255, 255, 1)); - FaultDrawer_SetBackColor(GPACK_RGBA5551(0, 0, 0, 1)); - - state = 0; - s1 = 0; - s2 = 1; - - while (state != 11) { - Fault_Sleep(1000 / 60); - Fault_UpdatePadImpl(); - - pressedBtn = input->press.button; - curBtn = input->cur.button; - - if (curBtn == 0 && s1 == s2) { - s1 = 0; - } else if (pressedBtn != 0) { - if (s1 == s2) { - state = 0; - } - - switch (state) { - case 0: - if (curBtn == (BTN_Z | BTN_L | BTN_R) && pressedBtn == BTN_Z) { - state = s2; - s1 = s2; - } - break; - case 1: - if (pressedBtn == BTN_DUP) { - state = 2; - } else { - state = 0; - } - break; - case 2: - if (pressedBtn == BTN_CDOWN) { - state = 3; - s1 = s2; - } else { - state = 0; - } - break; - case 3: - if (pressedBtn == BTN_CUP) { - state = 4; - } else { - state = 0; - } - break; - case 4: - if (pressedBtn == BTN_DDOWN) { - state = 5; - s1 = s2; - } else { - state = 0; - } - break; - case 5: - if (pressedBtn == BTN_DLEFT) { - state = 6; - } else { - state = 0; - } - break; - case 6: - if (pressedBtn == BTN_CLEFT) { - state = 7; - s1 = s2; - } else { - state = 0; - } - break; - case 7: - if (pressedBtn == BTN_CRIGHT) { - state = 8; - } else { - state = 0; - } - break; - case 8: - if (pressedBtn == BTN_DRIGHT) { - state = 9; - s1 = s2; - } else { - state = 0; - } - break; - case 9: - if (pressedBtn == (BTN_A | BTN_B)) { - state = 10; - } else if (pressedBtn == BTN_A) { - state = 0x5B; - } else if (pressedBtn == BTN_B) { - state = 0x5C; - } else { - state = 0; - } - break; - case 0x5B: - if (pressedBtn == BTN_B) { - state = 10; - } else { - state = 0; - } - break; - case 0x5C: - if (pressedBtn == BTN_A) { - state = 10; - } else { - state = 0; - } - break; - case 10: - if (pressedBtn == BTN_START) { - state = 11; - } else { - state = 0; - } - break; - } - } - - osWritebackDCacheAll(); - } + sFaultInstance->autoScroll = !DISABLE_CRASH_DBG_AUTOSCROLL; } void Fault_DrawMemDumpContents(const char* title, uintptr_t addr, u32 arg2) { @@ -948,7 +787,7 @@ void Fault_DrawMemDump(uintptr_t pc, uintptr_t sp, uintptr_t cLeftJump, uintptr_ } while (!CHECK_BTN_ALL(input->press.button, BTN_L)); // Resume auto-scroll and move to next page - sFaultInstance->autoScroll = true; + sFaultInstance->autoScroll = !DISABLE_CRASH_DBG_AUTOSCROLL; } /** @@ -1217,16 +1056,15 @@ void Fault_ThreadEntry(void* arg) { // Show fault framebuffer Fault_DisplayFrameBuffer(); - if (sFaultInstance->autoScroll) { + if (!DISABLE_CRASH_DBG_AUTOSCROLL && sFaultInstance->autoScroll) { Fault_Wait5Seconds(); } else { // Draw error bar signifying the crash screen is available Fault_DrawCornerRec(GPACK_RGBA5551(255, 0, 0, 1)); - Fault_WaitForButtonCombo(); } // Set auto-scrolling and default colors - sFaultInstance->autoScroll = true; + sFaultInstance->autoScroll = !DISABLE_CRASH_DBG_AUTOSCROLL; FaultDrawer_SetForeColor(GPACK_RGBA5551(255, 255, 255, 1)); FaultDrawer_SetBackColor(GPACK_RGBA5551(0, 0, 0, 0)); @@ -1277,7 +1115,7 @@ void Fault_Init(void) { sFaultInstance->faultedThread = NULL; sFaultInstance->padCallback = Fault_PadCallback; sFaultInstance->clients = NULL; - sFaultInstance->autoScroll = false; + sFaultInstance->autoScroll = !DISABLE_CRASH_DBG_AUTOSCROLL; gFaultMgr.faultHandlerEnabled = true; osCreateMesgQueue(&sFaultInstance->queue, &sFaultInstance->msg, 1); StackCheck_Init(&sFaultThreadInfo, sFaultStack, STACK_TOP(sFaultStack), 0, 0x100, "fault"); @@ -1322,7 +1160,7 @@ NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) { * Like `Fault_AddHungupAndCrashImpl`, however provides a fixed message containing * filename and line number */ -NORETURN void Fault_AddHungupAndCrash(const char* file, s32 line) { +NORETURN void Fault_AddHungupAndCrash(const char* file, int line) { char msg[256]; sprintf(msg, "HungUp %s:%d", file, line); diff --git a/src/code/fault_drawer.c b/src/code/fault_drawer.c index 181e68269..8f5fbcbe4 100644 --- a/src/code/fault_drawer.c +++ b/src/code/fault_drawer.c @@ -102,11 +102,11 @@ FaultDrawer sFaultDrawerDefault = { #ifndef NON_MATCHING // TODO: match .bss (has reordering issues) extern FaultDrawer sFaultDrawer; -extern char D_8016B6BC[0x24]; +extern char D_8016B6C0[0x20]; #else // Non-matching version for struct shiftability FaultDrawer sFaultDrawer; -char D_8016B6BC[0x24]; +char D_8016B6C0[0x20]; #endif void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) { diff --git a/src/code/flg_set.c b/src/code/flg_set.c index 190439486..ecdf13d56 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -6,178 +6,180 @@ typedef struct { } FlagSetEntry; // size = 0x08 void FlagSet_Update(PlayState* play) { - static s32 entryIdx = 0; - static u32 curBit = 0; - static s32 timer = 0; - static s32 bitIdx; // ? this doesn't need to be static + if (IS_EVENT_EDITOR_ENABLED) { + static s32 entryIdx = 0; + static u32 curBit = 0; + static s32 timer = 0; + static s32 bitIdx; // ? this doesn't need to be static - FlagSetEntry entries[53] = { - { &gSaveContext.save.info.eventChkInf[0], "event_chk_inf[0]" }, - { &gSaveContext.save.info.eventChkInf[1], "event_chk_inf[1]" }, - { &gSaveContext.save.info.eventChkInf[2], "event_chk_inf[2]" }, - { &gSaveContext.save.info.eventChkInf[3], "event_chk_inf[3]" }, - { &gSaveContext.save.info.eventChkInf[4], "event_chk_inf[4]" }, - { &gSaveContext.save.info.eventChkInf[5], "event_chk_inf[5]" }, - { &gSaveContext.save.info.eventChkInf[6], "event_chk_inf[6]" }, - { &gSaveContext.save.info.eventChkInf[7], "event_chk_inf[7]" }, - { &gSaveContext.save.info.eventChkInf[8], "event_chk_inf[8]" }, - { &gSaveContext.save.info.eventChkInf[9], "event_chk_inf[9]" }, - { &gSaveContext.save.info.eventChkInf[10], "event_chk_inf[10]" }, - { &gSaveContext.save.info.eventChkInf[11], "event_chk_inf[11]" }, - { &gSaveContext.save.info.eventChkInf[12], "event_chk_inf[12]" }, - { &gSaveContext.save.info.eventChkInf[13], "event_chk_inf[13]" }, - { &gSaveContext.save.info.itemGetInf[0], "item_get_inf[0]" }, - { &gSaveContext.save.info.itemGetInf[1], "item_get_inf[1]" }, - { &gSaveContext.save.info.itemGetInf[2], "item_get_inf[2]" }, - { &gSaveContext.save.info.itemGetInf[3], "item_get_inf[3]" }, - { &gSaveContext.save.info.infTable[0], "inf_table[0]" }, - { &gSaveContext.save.info.infTable[1], "inf_table[1]" }, - { &gSaveContext.save.info.infTable[2], "inf_table[2]" }, - { &gSaveContext.save.info.infTable[3], "inf_table[3]" }, - { &gSaveContext.save.info.infTable[4], "inf_table[4]" }, - { &gSaveContext.save.info.infTable[5], "inf_table[5]" }, - { &gSaveContext.save.info.infTable[6], "inf_table[6]" }, - { &gSaveContext.save.info.infTable[7], "inf_table[7]" }, - { &gSaveContext.save.info.infTable[8], "inf_table[8]" }, - { &gSaveContext.save.info.infTable[9], "inf_table[9]" }, - { &gSaveContext.save.info.infTable[10], "inf_table[10]" }, - { &gSaveContext.save.info.infTable[11], "inf_table[11]" }, - { &gSaveContext.save.info.infTable[12], "inf_table[12]" }, - { &gSaveContext.save.info.infTable[13], "inf_table[13]" }, - { &gSaveContext.save.info.infTable[14], "inf_table[14]" }, - { &gSaveContext.save.info.infTable[15], "inf_table[15]" }, - { &gSaveContext.save.info.infTable[16], "inf_table[16]" }, - { &gSaveContext.save.info.infTable[17], "inf_table[17]" }, - { &gSaveContext.save.info.infTable[18], "inf_table[18]" }, - { &gSaveContext.save.info.infTable[19], "inf_table[19]" }, - { &gSaveContext.save.info.infTable[20], "inf_table[20]" }, - { &gSaveContext.save.info.infTable[21], "inf_table[21]" }, - { &gSaveContext.save.info.infTable[22], "inf_table[22]" }, - { &gSaveContext.save.info.infTable[23], "inf_table[23]" }, - { &gSaveContext.save.info.infTable[24], "inf_table[24]" }, - { &gSaveContext.save.info.infTable[25], "inf_table[25]" }, - { &gSaveContext.save.info.infTable[26], "inf_table[26]" }, - { &gSaveContext.save.info.infTable[27], "inf_table[27]" }, - { &gSaveContext.save.info.infTable[28], "inf_table[28]" }, - { &gSaveContext.save.info.infTable[29], "inf_table[29]" }, - { &gSaveContext.eventInf[0], "event_inf[0]" }, - { &gSaveContext.eventInf[1], "event_inf[1]" }, - { &gSaveContext.eventInf[2], "event_inf[2]" }, - { &gSaveContext.eventInf[3], "event_inf[3]" }, - }; + FlagSetEntry entries[53] = { + { &gSaveContext.save.info.eventChkInf[0], "event_chk_inf[0]" }, + { &gSaveContext.save.info.eventChkInf[1], "event_chk_inf[1]" }, + { &gSaveContext.save.info.eventChkInf[2], "event_chk_inf[2]" }, + { &gSaveContext.save.info.eventChkInf[3], "event_chk_inf[3]" }, + { &gSaveContext.save.info.eventChkInf[4], "event_chk_inf[4]" }, + { &gSaveContext.save.info.eventChkInf[5], "event_chk_inf[5]" }, + { &gSaveContext.save.info.eventChkInf[6], "event_chk_inf[6]" }, + { &gSaveContext.save.info.eventChkInf[7], "event_chk_inf[7]" }, + { &gSaveContext.save.info.eventChkInf[8], "event_chk_inf[8]" }, + { &gSaveContext.save.info.eventChkInf[9], "event_chk_inf[9]" }, + { &gSaveContext.save.info.eventChkInf[10], "event_chk_inf[10]" }, + { &gSaveContext.save.info.eventChkInf[11], "event_chk_inf[11]" }, + { &gSaveContext.save.info.eventChkInf[12], "event_chk_inf[12]" }, + { &gSaveContext.save.info.eventChkInf[13], "event_chk_inf[13]" }, + { &gSaveContext.save.info.itemGetInf[0], "item_get_inf[0]" }, + { &gSaveContext.save.info.itemGetInf[1], "item_get_inf[1]" }, + { &gSaveContext.save.info.itemGetInf[2], "item_get_inf[2]" }, + { &gSaveContext.save.info.itemGetInf[3], "item_get_inf[3]" }, + { &gSaveContext.save.info.infTable[0], "inf_table[0]" }, + { &gSaveContext.save.info.infTable[1], "inf_table[1]" }, + { &gSaveContext.save.info.infTable[2], "inf_table[2]" }, + { &gSaveContext.save.info.infTable[3], "inf_table[3]" }, + { &gSaveContext.save.info.infTable[4], "inf_table[4]" }, + { &gSaveContext.save.info.infTable[5], "inf_table[5]" }, + { &gSaveContext.save.info.infTable[6], "inf_table[6]" }, + { &gSaveContext.save.info.infTable[7], "inf_table[7]" }, + { &gSaveContext.save.info.infTable[8], "inf_table[8]" }, + { &gSaveContext.save.info.infTable[9], "inf_table[9]" }, + { &gSaveContext.save.info.infTable[10], "inf_table[10]" }, + { &gSaveContext.save.info.infTable[11], "inf_table[11]" }, + { &gSaveContext.save.info.infTable[12], "inf_table[12]" }, + { &gSaveContext.save.info.infTable[13], "inf_table[13]" }, + { &gSaveContext.save.info.infTable[14], "inf_table[14]" }, + { &gSaveContext.save.info.infTable[15], "inf_table[15]" }, + { &gSaveContext.save.info.infTable[16], "inf_table[16]" }, + { &gSaveContext.save.info.infTable[17], "inf_table[17]" }, + { &gSaveContext.save.info.infTable[18], "inf_table[18]" }, + { &gSaveContext.save.info.infTable[19], "inf_table[19]" }, + { &gSaveContext.save.info.infTable[20], "inf_table[20]" }, + { &gSaveContext.save.info.infTable[21], "inf_table[21]" }, + { &gSaveContext.save.info.infTable[22], "inf_table[22]" }, + { &gSaveContext.save.info.infTable[23], "inf_table[23]" }, + { &gSaveContext.save.info.infTable[24], "inf_table[24]" }, + { &gSaveContext.save.info.infTable[25], "inf_table[25]" }, + { &gSaveContext.save.info.infTable[26], "inf_table[26]" }, + { &gSaveContext.save.info.infTable[27], "inf_table[27]" }, + { &gSaveContext.save.info.infTable[28], "inf_table[28]" }, + { &gSaveContext.save.info.infTable[29], "inf_table[29]" }, + { &gSaveContext.eventInf[0], "event_inf[0]" }, + { &gSaveContext.eventInf[1], "event_inf[1]" }, + { &gSaveContext.eventInf[2], "event_inf[2]" }, + { &gSaveContext.eventInf[3], "event_inf[3]" }, + }; - GraphicsContext* gfxCtx = play->state.gfxCtx; - Input* input = &play->state.input[0]; - Gfx* gfx; - Gfx* polyOpa; + GraphicsContext* gfxCtx = play->state.gfxCtx; + Input* input = &play->state.input[0]; + Gfx* gfx; + Gfx* polyOpa; - OPEN_DISPS(gfxCtx, "../flg_set.c", 131); + OPEN_DISPS(gfxCtx, "../flg_set.c", 131); - { - GfxPrint printer; - s32 pad; + { + GfxPrint printer; + s32 pad; - polyOpa = POLY_OPA_DISP; - gfx = Gfx_Open(polyOpa); - gSPDisplayList(OVERLAY_DISP++, gfx); + polyOpa = POLY_OPA_DISP; + gfx = Gfx_Open(polyOpa); + gSPDisplayList(OVERLAY_DISP++, gfx); - GfxPrint_Init(&printer); - GfxPrint_Open(&printer, gfx); - GfxPrint_SetColor(&printer, 250, 50, 50, 255); - GfxPrint_SetPos(&printer, 4, 13); - GfxPrint_Printf(&printer, entries[entryIdx].name); - GfxPrint_SetPos(&printer, 4, 15); + GfxPrint_Init(&printer); + GfxPrint_Open(&printer, gfx); + GfxPrint_SetColor(&printer, 250, 50, 50, 255); + GfxPrint_SetPos(&printer, 4, 13); + GfxPrint_Printf(&printer, entries[entryIdx].name); + GfxPrint_SetPos(&printer, 4, 15); - for (bitIdx = 15; bitIdx >= 0; bitIdx--) { - if ((u32)bitIdx == curBit) { - GfxPrint_SetColor(&printer, 200, 200, 200, 255); - } else { - GfxPrint_SetColor(&printer, 100, 100, 100, 255); + for (bitIdx = 15; bitIdx >= 0; bitIdx--) { + if ((u32)bitIdx == curBit) { + GfxPrint_SetColor(&printer, 200, 200, 200, 255); + } else { + GfxPrint_SetColor(&printer, 100, 100, 100, 255); + } + + if (*entries[entryIdx].value & (1 << bitIdx)) { + GfxPrint_Printf(&printer, "1"); + } else { + GfxPrint_Printf(&printer, "0"); + } + + if ((bitIdx % 4) == 0) { + GfxPrint_Printf(&printer, " "); + } } - if (*entries[entryIdx].value & (1 << bitIdx)) { - GfxPrint_Printf(&printer, "1"); - } else { - GfxPrint_Printf(&printer, "0"); - } - - if ((bitIdx % 4) == 0) { - GfxPrint_Printf(&printer, " "); - } - } - - if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) { - timer = 10; - curBit++; - } - if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) { - curBit--; - timer = 10; - } - - if (timer == 0) { - if (CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) { + timer = 10; curBit++; - timer = 2; } - if (CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) { curBit--; - timer = 2; + timer = 10; } - } - curBit %= 16; - if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) { - entryIdx--; - if (entryIdx < 0) { - entryIdx = 0; + if (timer == 0) { + if (CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) { + curBit++; + timer = 2; + } + if (CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) { + curBit--; + timer = 2; + } } - timer = 10; - } - if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) { - timer = 10; - entryIdx++; - if (!entries[entryIdx].value) { - entryIdx--; - } - } - if (timer == 0) { - if (CHECK_BTN_ALL(input->cur.button, BTN_DUP)) { + curBit %= 16; + if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) { entryIdx--; - timer = 2; if (entryIdx < 0) { entryIdx = 0; } + timer = 10; } - if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN)) { - timer = 2; + if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) { + timer = 10; entryIdx++; if (!entries[entryIdx].value) { entryIdx--; } } + + if (timer == 0) { + if (CHECK_BTN_ALL(input->cur.button, BTN_DUP)) { + entryIdx--; + timer = 2; + if (entryIdx < 0) { + entryIdx = 0; + } + } + if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN)) { + timer = 2; + entryIdx++; + if (!entries[entryIdx].value) { + entryIdx--; + } + } + } + + if (CHECK_BTN_ALL(input->press.button, BTN_A)) { + *entries[entryIdx].value ^= (1 << curBit); + } + + if (timer != 0) { + timer--; + } + + gfx = GfxPrint_Close(&printer); + GfxPrint_Destroy(&printer); + + gSPEndDisplayList(gfx++); + Gfx_Close(polyOpa, gfx); + POLY_OPA_DISP = gfx; } - if (CHECK_BTN_ALL(input->press.button, BTN_A)) { - *entries[entryIdx].value ^= (1 << curBit); + if (CHECK_BTN_ALL(input->press.button, BTN_L)) { + play->pauseCtx.debugState = 0; } - if (timer != 0) { - timer--; - } - - gfx = GfxPrint_Close(&printer); - GfxPrint_Destroy(&printer); - - gSPEndDisplayList(gfx++); - Gfx_Close(polyOpa, gfx); - POLY_OPA_DISP = gfx; + CLOSE_DISPS(gfxCtx, "../flg_set.c", 241); } - - if (CHECK_BTN_ALL(input->press.button, BTN_L)) { - play->pauseCtx.debugState = 0; - } - - CLOSE_DISPS(gfxCtx, "../flg_set.c", 241); } diff --git a/src/code/game.c b/src/code/game.c index ea6e399f5..e2862f897 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -1,15 +1,19 @@ #include "global.h" #include "terminal.h" +// ENABLE_SPEEDMETER SpeedMeter D_801664D0; + VisCvg sVisCvg; VisZBuf sVisZBuf; VisMono sVisMono; ViMode sViMode; + +// IS_DEBUG FaultClient sGameFaultClient; u16 sLastButtonPressed; -#if OOT_DEBUG +#if IS_DEBUG void GameState_FaultPrint(void) { static char sBtnChars[] = "ABZSuldr*+LRudlr"; s32 i; @@ -64,7 +68,7 @@ void GameState_SetFBFilter(Gfx** gfxP) { } void func_800C4344(GameState* gameState) { -#if OOT_DEBUG +#if IS_DEBUG Input* selectedInput; s32 hexDumpSize; u16 inputCompareValue; @@ -91,14 +95,17 @@ void func_800C4344(GameState* gameState) { R_INPUT_TEST_COMPARE_COMBO_PRESS = CHECK_BTN_ALL(selectedInput->press.button, inputCompareValue); } - if (gIsCtrlr2Valid) { + if (IS_REG_EDITOR_ENABLED) { Regs_UpdateEditor(&gameState->input[1]); } gDmaMgrVerbose = HREG(60); gDmaMgrDmaBuffSize = SREG(21) != 0 ? ALIGN16(SREG(21)) : DMAMGR_DEFAULT_BUFSIZE; gSystemArenaLogSeverity = HREG(61); + +#if IS_DEBUG gZeldaArenaLogSeverity = HREG(62); +#endif if (R_HREG_MODE == HREG_MODE_PRINT_MEMORY) { if (R_PRINT_MEMORY_INIT != HREG_MODE_PRINT_MEMORY) { @@ -111,44 +118,47 @@ void func_800C4344(GameState* gameState) { if (R_PRINT_MEMORY_TRIGGER < 0) { R_PRINT_MEMORY_TRIGGER = 0; hexDumpSize = (u32)(R_PRINT_MEMORY_SIZE == 0 ? 0x100 : R_PRINT_MEMORY_SIZE * 0x10); +#if IS_DEBUG LogUtils_LogHexDump((void*)(0x80000000 + (R_PRINT_MEMORY_ADDR << 8)), hexDumpSize); +#endif } } #endif } -#if OOT_DEBUG +// SHOW_INPUT_DISPLAY void GameState_DrawInputDisplay(u16 input, Gfx** gfxP) { - static const u16 sInpDispBtnColors[] = { - GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), - GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), - GPACK_RGBA5551(0, 255, 255, 1), GPACK_RGBA5551(255, 0, 255, 1), GPACK_RGBA5551(120, 120, 120, 1), - GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), - GPACK_RGBA5551(255, 0, 0, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(0, 255, 0, 1), - GPACK_RGBA5551(0, 0, 255, 1), - }; - s32 i, j, k; - Gfx* gfx = *gfxP; + if (CAN_SHOW_INPUT_DISPLAY) { + static const u16 sInpDispBtnColors[] = { + GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), + GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), + GPACK_RGBA5551(0, 255, 255, 1), GPACK_RGBA5551(255, 0, 255, 1), GPACK_RGBA5551(120, 120, 120, 1), + GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), + GPACK_RGBA5551(255, 0, 0, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(0, 255, 0, 1), + GPACK_RGBA5551(0, 0, 255, 1), + }; + s32 i, j, k; + Gfx* gfx = *gfxP; - gDPPipeSync(gfx++); - 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); + gDPPipeSync(gfx++); + 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); - for (i = 0; i < 16; i++) { - j = i; - if (input & (1 << i)) { - gDPSetFillColor(gfx++, (sInpDispBtnColors[i] << 0x10) | sInpDispBtnColors[i]); - k = i + 1; - gDPFillRectangle(gfx++, (j * 4) + 226, 220, (k * 4) + 225, 223); - gDPPipeSync(gfx++); + for (i = 0; i < 16; i++) { + j = i; + if (input & (1 << i)) { + gDPSetFillColor(gfx++, (sInpDispBtnColors[i] << 0x10) | sInpDispBtnColors[i]); + k = i + 1; + gDPFillRectangle(gfx++, (j * 4) + 226, 220, (k * 4) + 225, 223); + gDPPipeSync(gfx++); + } } - } - *gfxP = gfx; + *gfxP = gfx; + } } -#endif void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { Gfx* newDList; @@ -163,13 +173,14 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { GameState_SetFBFilter(&newDList); } -#if OOT_DEBUG +#if IS_DEBUG sLastButtonPressed = gameState->input[0].press.button | gameState->input[0].cur.button; - if (R_DISABLE_INPUT_DISPLAY == 0) { + + if (CAN_SHOW_INPUT_DISPLAY && R_DISABLE_INPUT_DISPLAY == 0) { GameState_DrawInputDisplay(sLastButtonPressed, &newDList); } - if (R_ENABLE_AUDIO_DBG & 1) { + if (IS_AUDIO_DEBUG_ENABLED && (R_ENABLE_AUDIO_DBG & 1)) { s32 pad; GfxPrint printer; @@ -179,16 +190,19 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { newDList = GfxPrint_Close(&printer); GfxPrint_Destroy(&printer); } + #endif - if (R_ENABLE_ARENA_DBG < 0) { -#if OOT_DEBUG + if (IS_SPEEDMETER_ENABLED && (R_ENABLE_ARENA_DBG < 0)) { s32 pad; - DebugArena_Display(); + + if (IS_DEBUG_HEAP_ENABLED) { + DebugArena_Display(); + } + SystemArena_Display(); // "%08x bytes left until the death of Hyrule (game_alloc)" PRINTF("ãƒã‚¤ãƒ©ãƒ«æ»…亡ã¾ã§ã‚㨠%08x ãƒã‚¤ãƒˆ(game_alloc)\n", THA_GetRemaining(&gameState->tha)); -#endif R_ENABLE_ARENA_DBG = 0; } @@ -200,9 +214,11 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx, "../game.c", 800); - Debug_DrawText(gfxCtx); + if (IS_DEBUG && (ENABLE_CAMERA_DEBUGGER || ENABLE_REG_EDITOR)) { + Debug_DrawText(gfxCtx); + } - if (R_ENABLE_ARENA_DBG != 0) { + if (IS_SPEEDMETER_ENABLED && (R_ENABLE_ARENA_DBG != 0)) { SpeedMeter_DrawTimeEntries(&D_801664D0, gfxCtx); SpeedMeter_DrawAllocEntries(&D_801664D0, gfxCtx, gameState); } @@ -257,7 +273,7 @@ void GameState_Update(GameState* gameState) { func_800C4344(gameState); -#if OOT_DEBUG +#if IS_DEBUG if (SREG(63) == 1u) { if (R_VI_MODE_EDIT_STATE < VI_MODE_EDIT_STATE_INACTIVE) { R_VI_MODE_EDIT_STATE = VI_MODE_EDIT_STATE_INACTIVE; @@ -390,9 +406,9 @@ void GameState_Realloc(GameState* gameState, size_t size) { THA_Init(&gameState->tha, NULL, 0); PRINTF("ãƒã‚¤ãƒ©ãƒ«å†ç¢ºä¿å¤±æ•—\n"); // "Failure to secure Hyral" -#if OOT_DEBUG - SystemArena_Display(); -#endif + if (IS_SPEEDMETER_ENABLED) { + SystemArena_Display(); + } HUNGUP_AND_CRASH("../game.c", 1044); } } @@ -408,7 +424,10 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g gameState->destroy = NULL; gameState->running = 1; startTime = osGetTime(); - gameState->size = gameState->init = 0; + + // Thse assignments must be written this way for matching and to avoid a warning due to casting a pointer to an + // integer without a cast. This assigns init = NULL and size = 0. + gameState->size = (u32)(gameState->init = NULL); { s32 requiredScopeTemp; @@ -436,17 +455,21 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g VisCvg_Init(&sVisCvg); VisZBuf_Init(&sVisZBuf); VisMono_Init(&sVisMono); - if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !OOT_DEBUG) { + if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !IS_DEBUG) { ViMode_Init(&sViMode); } - SpeedMeter_Init(&D_801664D0); + + if (IS_SPEEDMETER_ENABLED) { + SpeedMeter_Init(&D_801664D0); + } + Rumble_Init(); osSendMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK); endTime = osGetTime(); // "Other initialization processing time %d us" PRINTF("ãã®ä»–åˆæœŸåŒ– å‡¦ç†æ™‚é–“ %d us\n", OS_CYCLES_TO_USEC(endTime - startTime)); -#if OOT_DEBUG +#if IS_DEBUG Fault_AddClient(&sGameFaultClient, GameState_FaultPrint, NULL, NULL); #endif @@ -463,20 +486,24 @@ void GameState_Destroy(GameState* gameState) { gameState->destroy(gameState); } Rumble_Destroy(); - SpeedMeter_Destroy(&D_801664D0); + + if (IS_SPEEDMETER_ENABLED) { + SpeedMeter_Destroy(&D_801664D0); + } + VisCvg_Destroy(&sVisCvg); VisZBuf_Destroy(&sVisZBuf); VisMono_Destroy(&sVisMono); - if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !OOT_DEBUG) { + if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !IS_DEBUG) { ViMode_Destroy(&sViMode); } THA_Destroy(&gameState->tha); GameAlloc_Cleanup(&gameState->alloc); -#if OOT_DEBUG - SystemArena_Display(); - Fault_RemoveClient(&sGameFaultClient); -#endif + if (IS_SPEEDMETER_ENABLED) { + SystemArena_Display(); + Fault_RemoveClient(&sGameFaultClient); + } PRINTF("game デストラクタ終了\n"); // "game destructor end" } @@ -493,8 +520,8 @@ u32 GameState_IsRunning(GameState* gameState) { return gameState->running; } -#if OOT_DEBUG -void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line) { +#if IS_DEBUG +void* GameState_Alloc(GameState* gameState, size_t size, const char* file, int line) { void* ret; if (THA_IsCrash(&gameState->tha)) { diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c index c5e8e5243..06fa9b92d 100644 --- a/src/code/gamealloc.c +++ b/src/code/gamealloc.c @@ -12,8 +12,8 @@ void GameAlloc_Log(GameAlloc* this) { } } -#if OOT_DEBUG -void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line) { +#if IS_DEBUG +void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line) { GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), file, line); if (ptr != NULL) { diff --git a/src/code/gfxprint.c b/src/code/gfxprint.c index d6171aacc..a5821a036 100644 --- a/src/code/gfxprint.c +++ b/src/code/gfxprint.c @@ -207,27 +207,31 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) { } } + this->posX = WIDE_INCR(this->posX, -9); + if (this->flags & GFXP_FLAG_SHADOW) { gDPSetColor(this->dList++, G_SETPRIMCOLOR, 0); if (this->flags & GFXP_FLAG_ENLARGE) { - gSPTextureRectangle(this->dList++, (this->posX + 4) << 1, (this->posY + 4) << 1, (this->posX + 4 + 32) << 1, - (this->posY + 4 + 32) << 1, tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1 << 9, - 1 << 9); + gSPTextureRectangle(this->dList++, (this->posX + 4) << 1, (this->posY + 4) << 1, + WIDE_INCR(this->posX + 4 + 32, -9) << 1, (this->posY + 4 + 32 - 1) << 1, tile, + (u16)(c & 4) * 64, (u16)(c >> 3) * 256, WIDE_DIV((1 << 9), WIDE_GET_RATIO), 1 << 9); } else { - gSPTextureRectangle(this->dList++, this->posX + 4, this->posY + 4, this->posX + 4 + 32, this->posY + 4 + 32, - tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1 << 10, 1 << 10); + gSPTextureRectangle(this->dList++, this->posX + 4, this->posY + 4, WIDE_INCR(this->posX + 4 + 32, -9), + this->posY + 4 + 32 - 1, tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, + WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); } gDPSetColor(this->dList++, G_SETPRIMCOLOR, this->color.rgba); } if (this->flags & GFXP_FLAG_ENLARGE) { - gSPTextureRectangle(this->dList++, this->posX << 1, this->posY << 1, (this->posX + 32) << 1, - (this->posY + 32) << 1, tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1 << 9, 1 << 9); + gSPTextureRectangle(this->dList++, this->posX << 1, this->posY << 1, WIDE_INCR(this->posX + 32, -9) << 1, + (this->posY + 32 - 1) << 1, tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, + WIDE_DIV((1 << 9), WIDE_GET_RATIO), 1 << 9); } else { - gSPTextureRectangle(this->dList++, this->posX, this->posY, this->posX + 32, this->posY + 32, tile, - (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1 << 10, 1 << 10); + gSPTextureRectangle(this->dList++, this->posX, this->posY, WIDE_INCR(this->posX + 32, -9), this->posY + 32 - 1, + tile, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); } this->posX += GFX_CHAR_X_SPACING << 2; @@ -237,7 +241,7 @@ void GfxPrint_PrintChar(GfxPrint* this, u8 c) { u8 charParam = c; if (c == ' ') { - this->posX += GFX_CHAR_X_SPACING << 2; + this->posX += WIDE_DIV((GFX_CHAR_X_SPACING << 2), WIDE_GET_16_9); } else if (c > ' ' && c < 0x7F) { GfxPrint_PrintCharImpl(this, charParam); } else if (c >= 0xA0 && c < 0xE0) { diff --git a/src/code/graph.c b/src/code/graph.c index 36cfa633d..61e0b89c5 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -14,8 +14,13 @@ OSTime sGraphPrevUpdateEndTime; */ OSTime sGraphPrevTaskTimeStart; +#if IS_DEBUG FaultClient sGraphFaultClient; +#endif + CfbInfo sGraphCfbInfos[3]; + +#if IS_DEBUG FaultClient sGraphUcodeFaultClient; UCodeInfo D_8012D230[3] = { @@ -30,7 +35,6 @@ UCodeInfo D_8012D248[3] = { { UCODE_S2DEX, gspS2DEX2d_fifoTextStart }, }; -#if OOT_DEBUG void Graph_FaultClient(void) { void* nextFb = osViGetNextFramebuffer(); void* newFb = (SysCfb_GetFbPtr(0) != nextFb) ? SysCfb_GetFbPtr(0) : SysCfb_GetFbPtr(1); @@ -141,21 +145,23 @@ void Graph_Init(GraphicsContext* gfxCtx) { gfxCtx->xScale = gViConfigXScale; gfxCtx->yScale = gViConfigYScale; osCreateMesgQueue(&gfxCtx->queue, gfxCtx->msgBuff, ARRAY_COUNT(gfxCtx->msgBuff)); -#if OOT_DEBUG +#if IS_DEBUG func_800D31F0(); Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, NULL, NULL); #endif } void Graph_Destroy(GraphicsContext* gfxCtx) { -#if OOT_DEBUG +#if IS_DEBUG func_800D3210(); Fault_RemoveClient(&sGraphFaultClient); #endif } void Graph_TaskSet00(GraphicsContext* gfxCtx) { +#if IS_DEBUG static Gfx* sPrevTaskWorkBuffer = NULL; +#endif static s32 sGraphCfbInfoIdx = 0; OSTime timeNow; @@ -164,8 +170,10 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { OSTask_t* task = &gfxCtx->task.list.t; OSScTask* scTask = &gfxCtx->task; - gGfxTaskSentToNextReadyMinusAudioThreadUpdateTime = - osGetTime() - sGraphPrevTaskTimeStart - gAudioThreadUpdateTimeAcc; + if (IS_SPEEDMETER_ENABLED) { + gGfxTaskSentToNextReadyMinusAudioThreadUpdateTime = + osGetTime() - sGraphPrevTaskTimeStart - gAudioThreadUpdateTimeAcc; + } { CfbInfo* cfb; @@ -176,7 +184,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { osStopTimer(&timer); if (msg == (OSMesg)666) { -#if OOT_DEBUG +#if IS_DEBUG PRINTF(VT_FGCOL(RED)); PRINTF("RCPãŒå¸°ã£ã¦ãã¾ã›ã‚“ã§ã—ãŸã€‚"); // "RCP did not return." PRINTF(VT_RST); @@ -199,7 +207,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_NOBLOCK); -#if OOT_DEBUG +#if IS_DEBUG sPrevTaskWorkBuffer = gfxCtx->workBuffer; #endif @@ -207,16 +215,18 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { gfxCtx->callback(gfxCtx, gfxCtx->callbackParam); } - timeNow = osGetTime(); - if (gAudioThreadUpdateTimeStart != 0) { - // The audio thread update is running - // Add the time already spent to the accumulator and leave the rest for the next cycle + if (IS_SPEEDMETER_ENABLED) { + timeNow = osGetTime(); + if (gAudioThreadUpdateTimeStart != 0) { + // The audio thread update is running + // Add the time already spent to the accumulator and leave the rest for the next cycle - gAudioThreadUpdateTimeAcc += timeNow - gAudioThreadUpdateTimeStart; - gAudioThreadUpdateTimeStart = timeNow; + gAudioThreadUpdateTimeAcc += timeNow - gAudioThreadUpdateTimeStart; + gAudioThreadUpdateTimeStart = timeNow; + } + gAudioThreadUpdateTimeTotalPerGfxTask = gAudioThreadUpdateTimeAcc; + gAudioThreadUpdateTimeAcc = 0; } - gAudioThreadUpdateTimeTotalPerGfxTask = gAudioThreadUpdateTimeAcc; - gAudioThreadUpdateTimeAcc = 0; sGraphPrevTaskTimeStart = osGetTime(); @@ -287,7 +297,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gameState->inPreNMIState = false; Graph_InitTHGA(gfxCtx); -#if OOT_DEBUG +#if IS_DEBUG OPEN_DISPS(gfxCtx, "../graph.c", 966); gDPNoOpString(WORK_DISP++, "WORK_DISP é–‹å§‹", 0); @@ -301,7 +311,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { GameState_ReqPadData(gameState); GameState_Update(gameState); -#if OOT_DEBUG +#if IS_DEBUG OPEN_DISPS(gfxCtx, "../graph.c", 987); gDPNoOpString(WORK_DISP++, "WORK_DISP 終了", 0); @@ -323,7 +333,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { CLOSE_DISPS(gfxCtx, "../graph.c", 1028); -#if OOT_DEBUG +#if IS_DEBUG if (R_HREG_MODE == HREG_MODE_PLAY && R_PLAY_ENABLE_UCODE_DISAS == 2) { R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_TOGGLE = -1; @@ -404,21 +414,24 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { OSTime timeNow = osGetTime(); s32 pad; - gRSPGfxTimeTotal = gRSPGfxTimeAcc; - gRSPAudioTimeTotal = gRSPAudioTimeAcc; - gRDPTimeTotal = gRDPTimeAcc; - gRSPGfxTimeAcc = 0; - gRSPAudioTimeAcc = 0; - gRDPTimeAcc = 0; + if (IS_SPEEDMETER_ENABLED) { + gRSPGfxTimeTotal = gRSPGfxTimeAcc; + gRSPAudioTimeTotal = gRSPAudioTimeAcc; + gRDPTimeTotal = gRDPTimeAcc; + gRSPGfxTimeAcc = 0; + gRSPAudioTimeAcc = 0; + gRDPTimeAcc = 0; - if (sGraphPrevUpdateEndTime != 0) { - gGraphUpdatePeriod = timeNow - sGraphPrevUpdateEndTime; + if (sGraphPrevUpdateEndTime != 0) { + gGraphUpdatePeriod = timeNow - sGraphPrevUpdateEndTime; + } } + sGraphPrevUpdateEndTime = timeNow; } -#if OOT_DEBUG - if (gIsCtrlr2Valid && CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) && +#if IS_DEBUG + if (IS_MAP_SELECT_ENABLED && CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) && CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_L | BTN_R)) { gSaveContext.gameMode = GAMEMODE_NORMAL; SET_NEXT_GAMESTATE(gameState, MapSelect_Init, MapSelectState); @@ -432,6 +445,11 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gameState->running = false; } #endif + + if (ENABLE_WIDESCREEN && CHECK_BTN_ALL(gameState->input[0].press.button, BTN_DUP) && + CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_Z | BTN_R)) { + gSaveContext.save.useWidescreen ^= 1; + } } void Graph_ThreadEntry(void* arg0) { @@ -454,7 +472,7 @@ void Graph_ThreadEntry(void* arg0) { gameState = SYSTEM_ARENA_MALLOC(size, "../graph.c", 1196); if (gameState == NULL) { -#if OOT_DEBUG +#if IS_DEBUG char faultMsg[0x50]; PRINTF("確ä¿å¤±æ•—\n"); // "Failure to secure" @@ -500,8 +518,8 @@ void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size) { return THGA_AllocTail(&gfxCtx->polyOpa, ALIGN16(size)); } -#if OOT_DEBUG -void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line) { +#if IS_DEBUG +void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line) { if (R_HREG_MODE == HREG_MODE_UCODE_DISAS && R_UCODE_DISAS_LOG_MODE != 4) { dispRefs[0] = gfxCtx->polyOpa.p; dispRefs[1] = gfxCtx->polyXlu.p; @@ -513,7 +531,7 @@ void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, } } -void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line) { +void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line) { if (R_HREG_MODE == HREG_MODE_UCODE_DISAS && R_UCODE_DISAS_LOG_MODE != 4) { if (dispRefs[0] + 1 == gfxCtx->polyOpa.p) { gfxCtx->polyOpa.p = dispRefs[0]; diff --git a/src/code/main.c b/src/code/main.c index 15eeed80c..761e1e6a0 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -1,6 +1,8 @@ #include "global.h" #include "terminal.h" +extern u8 _buffersSegmentEnd[]; + s32 gScreenWidth = SCREEN_WIDTH; s32 gScreenHeight = SCREEN_HEIGHT; u32 gSystemHeapSize = 0; @@ -25,11 +27,12 @@ AudioMgr gAudioMgr; OSMesgQueue sSerialEventQueue; OSMesg sSerialMsgBuf[1]; -#if OOT_DEBUG +#if IS_DEBUG void Main_LogSystemHeap(void) { PRINTF(VT_FGCOL(GREEN)); // "System heap size% 08x (% dKB) Start address% 08x" - PRINTF("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024, gSystemHeap); + PRINTF("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024, + _buffersSegmentEnd); PRINTF(VT_RST); } #endif @@ -48,21 +51,20 @@ void Main(void* arg) { PreNmiBuff_Init(gAppNmiBufferPtr); Fault_Init(); SysCfb_Init(0); - systemHeapStart = (uintptr_t)gSystemHeap; + systemHeapStart = (uintptr_t)_buffersSegmentEnd; fb = (uintptr_t)SysCfb_GetFbPtr(0); gSystemHeapSize = fb - systemHeapStart; // "System heap initalization" PRINTF("ã‚·ã‚¹ãƒ†ãƒ ãƒ’ãƒ¼ãƒ—åˆæœŸåŒ– %08x-%08x %08x\n", systemHeapStart, fb, gSystemHeapSize); SystemHeap_Init((void*)systemHeapStart, gSystemHeapSize); // initializes the system heap -#if OOT_DEBUG - { + if (IS_DEBUG_HEAP_ENABLED) { void* debugHeapStart; u32 debugHeapSize; if (osMemSize >= 0x800000) { debugHeapStart = SysCfb_GetFbEnd(); - debugHeapSize = PHYS_TO_K0(0x600000) - (uintptr_t)debugHeapStart; + debugHeapSize = PHYS_TO_K0(DEBUG_HEAP_SIZE) - (uintptr_t)debugHeapStart; } else { debugHeapSize = 0x400; debugHeapStart = SYSTEM_ARENA_MALLOC(debugHeapSize, "../main.c", 565); @@ -71,16 +73,15 @@ void Main(void* arg) { PRINTF("debug_InitArena(%08x, %08x)\n", debugHeapStart, debugHeapSize); DebugArena_Init(debugHeapStart, debugHeapSize); } -#endif Regs_Init(); - R_ENABLE_ARENA_DBG = 0; + R_ENABLE_ARENA_DBG = 0; // ENABLE_SPEEDMETER osCreateMesgQueue(&sSerialEventQueue, sSerialMsgBuf, ARRAY_COUNT(sSerialMsgBuf)); osSetEventMesg(OS_EVENT_SI, &sSerialEventQueue, NULL); -#if OOT_DEBUG +#if IS_DEBUG Main_LogSystemHeap(); #endif diff --git a/src/code/object_table.c b/src/code/object_table.c index dc32b4435..d0f9e936d 100644 --- a/src/code/object_table.c +++ b/src/code/object_table.c @@ -6,24 +6,24 @@ u32 gObjectTableSize = ARRAY_COUNT(gObjectTable); // Object linker symbol declarations (used in the table below) #define DEFINE_OBJECT(name, _1) DECLARE_ROM_SEGMENT(name) -#define DEFINE_OBJECT_NULL(_0, _1) +#define DEFINE_OBJECT_EMPTY(_0, _1) #define DEFINE_OBJECT_UNSET(_0) #include "tables/object_table.h" #undef DEFINE_OBJECT -#undef DEFINE_OBJECT_NULL +#undef DEFINE_OBJECT_EMPTY #undef DEFINE_OBJECT_UNSET // Object Table definition #define DEFINE_OBJECT(name, _1) ROM_FILE(name), -#define DEFINE_OBJECT_NULL(name, _1) ROM_FILE_EMPTY(name), -#define DEFINE_OBJECT_UNSET(_0) { 0 }, +#define DEFINE_OBJECT_EMPTY(name, _1) ROM_FILE_EMPTY(name), +#define DEFINE_OBJECT_UNSET(_0) ROM_FILE_UNSET, RomFile gObjectTable[] = { #include "tables/object_table.h" }; #undef DEFINE_OBJECT -#undef DEFINE_OBJECT_NULL +#undef DEFINE_OBJECT_EMPTY #undef DEFINE_OBJECT_UNSET diff --git a/src/code/padmgr.c b/src/code/padmgr.c index 74ca9bd4f..94b51b3d1 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -32,7 +32,7 @@ #include "terminal.h" #define PADMGR_LOG(controllerNum, msg) \ - if (OOT_DEBUG) { \ + if (IS_DEBUG) { \ PRINTF(VT_FGCOL(YELLOW)); \ /* padmgr: Controller %d: %s */ \ PRINTF("padmgr: %dコン: %s\n", (controllerNum) + 1, (msg)); \ @@ -68,7 +68,7 @@ s32 gPadMgrLogSeverity = LOG_SEVERITY_CRITICAL; OSMesgQueue* PadMgr_AcquireSerialEventQueue(PadMgr* padMgr) { OSMesgQueue* serialEventQueue; -#if OOT_DEBUG +#if IS_DEBUG serialEventQueue = NULL; #endif @@ -185,7 +185,7 @@ void PadMgr_UpdateRumble(PadMgr* padMgr) { } } else { if (padMgr->pakType[i] != CONT_PAK_NONE) { - if (padMgr->pakType[i] == CONT_PAK_RUMBLE || !OOT_DEBUG) { + if (padMgr->pakType[i] == CONT_PAK_RUMBLE || !IS_DEBUG) { // "It seems that a vibration pack was pulled out" PADMGR_LOG(i, "æŒ¯å‹•ãƒ‘ãƒƒã‚¯ãŒæŠœã‹ã‚ŒãŸã‚ˆã†ã§ã™"); padMgr->pakType[i] = CONT_PAK_NONE; @@ -367,7 +367,7 @@ void PadMgr_HandleRetrace(PadMgr* padMgr) { osRecvMesg(serialEventQueue, NULL, OS_MESG_BLOCK); osContGetReadData(padMgr->pads); -#if !OOT_DEBUG +#if !IS_DEBUG // Clear controllers 2 and 4 bzero(&padMgr->pads[1], sizeof(OSContPad)); bzero(&padMgr->pads[3], sizeof(OSContPad)); diff --git a/src/code/rand.c b/src/code/rand.c new file mode 100644 index 000000000..4a0c5dc4a --- /dev/null +++ b/src/code/rand.c @@ -0,0 +1,162 @@ +/** + * @file rand.c + * + * This file implements the primary random number generator the game relies on. The generator is pseudo-random and + * implemented as a Linear Congruential Generator (LCG). + * + * A LCG computes random numbers sequentially via the relation + * X(n+1) = (a * X(n) + c) mod m + * where m is the modulus, a is the multiplier and c is the increment. + * + * These three parameters (a,c,m) completely specify the LCG and should be chosen such that + * - m > 0 + * - 0 < a < m + * - 0 <= c < m + * + * The period of the LCG (a, c, m) is the smallest period p such that X(n + p) = X(n), past n=p the sequence will repeat + * itself in its outputs. + * A good LCG should have the maximum possible period, which will be equal to m as there are at most m possible values + * for X. This occurs when (Hull, T.E., & Dobell, A.R. (1962). Random Number Generators. Siam Review, 4, 230-254.): + * - m,c are relatively prime, that is the only integer that divides both m and c with no remainder is 1. + * - a - 1 is divisible by all prime factors of m. + * - a - 1 is divisible by 4 if m is divisible by 4. + * + * Ideally m is chosen to be a large power of 2 so that the modulo operation is inexpensive to compute. In this case the + * prime factors of m = 2^k are just k copies of 2. For k > 1 m is divisible by 4, so a - 1 must be divisible by 4. 2^k + * and c can easily be made relatively prime by making c an odd number. + * If we let k=32 to match the size of an integer, the modulo operation is made implicit by the width of the data type + * and becomes free to compute. + * + * The parameter a should be selected such that a-1 is divisible by 4 (and hence divisible by 2) and c should be any odd + * number. The precise values should fare well against the spectral test, a measure of "how random" a particular LCG is. + * A pair (a,c) that satisfies these requirements is (1664525, 1013904223), recommended by "Numerical Recipes in C: The + * Art of Scientific Computing" (p. 284). + * + * Therefore, the LCG with parameters (1664525, 1013904223, 2^32) that is implemented in this file has a maximal period + * of 2^32 and produces high-quality pseudo-random numbers. + * + * @note If sampling the LCG for a n-bit number it is important to use the upper n bits instead of the lower n bits of + * the LCG output. The lower n bits only have a period of 2^n which may significantly worsen the quality of the + * resulting random numbers compared to the quality of the full 32-bit result. + * + * @note Original name: qrand.c + */ +#include "ultra64.h" + +#define RAND_MULTIPLIER 1664525 +#define RAND_INCREMENT 1013904223 + +/** + * The latest generated random number, used to generate the next number in the sequence. + * + * @note Original name: __qrand_idum + */ +static u32 sRandInt = 1; + +/** + * Space to store a value to be re-interpreted as a float. + * + * @note Orignal name: __qrand_itemp + */ +static fu sRandFloat; + +/** + * Gets the next integer in the sequence of pseudo-random numbers. + * + * @note Original name: qrand + */ +u32 Rand_Next(void) { + return sRandInt = sRandInt * RAND_MULTIPLIER + RAND_INCREMENT; +} + +/** + * Seeds the pseudo-random number generator by providing a starting value. + * + * @note Original name: sqrand + */ +void Rand_Seed(u32 seed) { + sRandInt = seed; +} + +/** + * Returns a pseudo-random floating-point number between 0.0f and 1.0f, by generating the next integer and masking it + * to an IEEE-754 compliant floating-point number between 1.0f and 2.0f, returning the result subtract 1.0f. + * + * @note This technique for generating pseudo-random floats is recommended as a particularly fast but potentially + * non-portable generator in "Numerical Recipes in C: The Art of Scientic Computing", pp. 284-5. + * + * @note Original name: fqrand + */ +f32 Rand_ZeroOne(void) { + sRandInt = sRandInt * RAND_MULTIPLIER + RAND_INCREMENT; + // Samples the upper 23 bits to avoid effectively reducing the LCG period. + sRandFloat.i = (sRandInt >> 9) | 0x3F800000; + return sRandFloat.f - 1.0f; +} + +/** + * Returns a pseudo-random floating-point number between -0.5f and 0.5f by the same manner in which Rand_ZeroOne + * generates its result. + * + * @see Rand_ZeroOne + * + * @note Original name: fqrand2 + */ +f32 Rand_Centered(void) { + sRandInt = sRandInt * RAND_MULTIPLIER + RAND_INCREMENT; + sRandFloat.i = (sRandInt >> 9) | 0x3F800000; + return sRandFloat.f - 1.5f; +} + +//! All functions below are unused variants of the above four, that use a provided random number variable instead of the +//! internal `sRandInt` + +/** + * Seeds a pseudo-random number at rndNum with a provided starting value. + * + * @see Rand_Seed + * + * @note Original name: sqrand_r + */ +void Rand_Seed_Variable(u32* rndNum, u32 seed) { + *rndNum = seed; +} + +/** + * Generates the next pseudo-random integer from the provided rndNum. + * + * @see Rand_Next + * + * @note Original name: qrand_r + */ +u32 Rand_Next_Variable(u32* rndNum) { + return *rndNum = (*rndNum) * RAND_MULTIPLIER + RAND_INCREMENT; +} + +/** + * Generates the next pseudo-random floating-point number between 0.0f and 1.0f from the provided rndNum. + * + * @see Rand_ZeroOne + * + * @note Original name: fqrand_r + */ +f32 Rand_ZeroOne_Variable(u32* rndNum) { + u32 next = (*rndNum) * RAND_MULTIPLIER + RAND_INCREMENT; + + sRandFloat.i = ((*rndNum = next) >> 9) | 0x3F800000; + return sRandFloat.f - 1.0f; +} + +/** + * Generates the next pseudo-random floating-point number between -0.5f and 0.5f from the provided rndNum. + * + * @see Rand_ZeroOne, Rand_Centered + * + * @note Original name: fqrand2_r + */ +f32 Rand_Centered_Variable(u32* rndNum) { + u32 next = (*rndNum) * RAND_MULTIPLIER + RAND_INCREMENT; + + sRandFloat.i = ((*rndNum = next) >> 9) | 0x3F800000; + return sRandFloat.f - 1.5f; +} diff --git a/src/code/sched.c b/src/code/sched.c index b398f3e45..d2ec1a445 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -45,14 +45,14 @@ #define RDP_DONE_MSG 668 #define NOTIFY_MSG 670 // original name: ENTRY_MSG -vs32 sSchedDebugPrintfEnabled = false; - OSTime sRSPGfxTimeStart; OSTime sRSPAudioTimeStart; OSTime sRSPOtherTimeStart; OSTime sRDPTimeStart; -#if OOT_DEBUG +#if IS_DEBUG +vs32 sSchedDebugPrintfEnabled = false; + #define SCHED_DEBUG_PRINTF \ if (sSchedDebugPrintfEnabled) \ PRINTF @@ -81,7 +81,7 @@ void Sched_SwapFrameBufferImpl(CfbInfo* cfbInfo) { Fault_SetFrameBuffer(cfbInfo->swapBuffer, width, 16); } -#if OOT_DEBUG +#if IS_DEBUG if (R_HREG_MODE == HREG_MODE_SCHED && R_SCHED_INIT != HREG_MODE_SCHED) { R_SCHED_TOGGLE_SPECIAL_FEATURES = 0; R_SCHED_GAMMA_ON = 0; @@ -127,7 +127,7 @@ void Sched_SwapFrameBuffer(Scheduler* sc, CfbInfo* cfbInfo) { } void Sched_HandlePreNMI(Scheduler* sc) { -#if OOT_DEBUG +#if IS_DEBUG OSTime now; if (sc->curRSPTask != NULL) { @@ -512,13 +512,15 @@ void Sched_HandleRSPDone(Scheduler* sc) { ASSERT(sc->curRSPTask != NULL, "sc->curRSPTask", "../sched.c", 819); - // Task profiling - if (sc->curRSPTask->list.t.type == M_AUDTASK) { - gRSPAudioTimeAcc += osGetTime() - sRSPAudioTimeStart; - } else if (sc->curRSPTask->list.t.type == M_GFXTASK) { - gRSPGfxTimeAcc += osGetTime() - sRSPGfxTimeStart; - } else { - gRSPOtherTimeAcc += osGetTime() - sRSPOtherTimeStart; + if (IS_SPEEDMETER_ENABLED) { + // Task profiling + if (sc->curRSPTask->list.t.type == M_AUDTASK) { + gRSPAudioTimeAcc += osGetTime() - sRSPAudioTimeStart; + } else if (sc->curRSPTask->list.t.type == M_GFXTASK) { + gRSPGfxTimeAcc += osGetTime() - sRSPGfxTimeStart; + } else { + gRSPOtherTimeAcc += osGetTime() - sRSPOtherTimeStart; + } } // Clear current RSP task @@ -562,8 +564,10 @@ void Sched_HandleRDPDone(Scheduler* sc) { OSScTask* nextRDP = NULL; s32 state; - // Task profiling - gRDPTimeAcc = osGetTime() - sRDPTimeStart; + if (IS_SPEEDMETER_ENABLED) { + // Task profiling + gRDPTimeAcc = osGetTime() - sRDPTimeStart; + } // Sanity check ASSERT(sc->curRDPTask != NULL, "sc->curRDPTask", "../sched.c", 878); diff --git a/src/code/shrink_window.c b/src/code/shrink_window.c index d2cbf78f3..66eb73d66 100644 --- a/src/code/shrink_window.c +++ b/src/code/shrink_window.c @@ -86,7 +86,7 @@ void Letterbox_Update(s32 updateRate) { sLetterboxState = LETTERBOX_STATE_IDLE; } - if (OOT_DEBUG && (R_HREG_MODE == HREG_MODE_LETTERBOX)) { + if (IS_DEBUG && (R_HREG_MODE == HREG_MODE_LETTERBOX)) { if (R_LETTERBOX_INIT != HREG_MODE_LETTERBOX) { R_LETTERBOX_INIT = HREG_MODE_LETTERBOX; R_LETTERBOX_ENABLE_LOGS = 0; diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index 041c72659..13f5e22a9 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -13,7 +13,7 @@ void SysCfb_Init(s32 n64dd) { tmpFbEnd = 0x8044BE80; if (n64dd == 1) { PRINTF("RAM 8M mode (N64DD対応)\n"); // "RAM 8M mode (N64DD compatible)" -#if OOT_DEBUG +#if IS_DEBUG sSysCfbEnd = 0x805FB000; #else sSysCfbEnd = 0x80600000; @@ -21,7 +21,7 @@ void SysCfb_Init(s32 n64dd) { } else { // "The margin for this version is %dK bytes" PRINTF("ã“ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒžãƒ¼ã‚¸ãƒ³ã¯ %dK ãƒã‚¤ãƒˆã§ã™\n", (0x4BC00 / 1024)); -#if OOT_DEBUG +#if IS_DEBUG sSysCfbEnd = tmpFbEnd; #else sSysCfbEnd = 0x80400000; diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 3e50249b1..c79e77f9a 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -922,7 +922,7 @@ f32 Math3D_Plane(Plane* plane, Vec3f* pointOnPlane) { * `nx`, `ny`, `nz`, and `originDist` */ f32 Math3D_UDistPlaneToPos(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* p) { - if (OOT_DEBUG && IS_ZERO(sqrtf(SQ(nx) + SQ(ny) + SQ(nz)))) { + if (IS_DEBUG && IS_ZERO(sqrtf(SQ(nx) + SQ(ny) + SQ(nz)))) { PRINTF(VT_COL(YELLOW, BLACK)); // "Math3DLengthPlaneAndPos(): Normal size is near zero %f %f %f" PRINTF("Math3DLengthPlaneAndPos():法線size ãŒã‚¼ãƒ­è¿‘ã„ã§ã™%f %f %f\n", nx, ny, nz); @@ -2144,7 +2144,7 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z) { return false; } -#if OOT_DEBUG +#if IS_DEBUG void Math3D_DrawSphere(PlayState* play, Sphere16* sph) { } diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index b90ddaad5..d83d642c2 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -603,13 +603,13 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) { return dest; } -#if OOT_DEBUG +#if IS_DEBUG -Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line) { +Mtx* Matrix_ToMtx(Mtx* dest, const char* file, int line) { return Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(sCurrentMatrix, file, line), dest); } -Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, char* file, s32 line) { +Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, const char* file, int line) { return Matrix_ToMtx(GRAPH_ALLOC(gfxCtx, sizeof(Mtx)), file, line); } @@ -623,7 +623,7 @@ Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx) { return Matrix_ToMtx(GRAPH_ALLOC(gfxCtx, sizeof(Mtx))); } -#endif /* OOT_DEBUG */ +#endif /* IS_DEBUG */ Mtx* Matrix_MtxFToNewMtx(MtxF* src, GraphicsContext* gfxCtx) { return Matrix_MtxFToMtx(src, GRAPH_ALLOC(gfxCtx, sizeof(Mtx))); @@ -969,8 +969,8 @@ void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode) { } } -#if OOT_DEBUG -MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) { +#if IS_DEBUG +MtxF* Matrix_CheckFloats(MtxF* mf, const char* file, int line) { s32 i, j; for (i = 0; i < 4; i++) { diff --git a/src/code/sys_rumble.c b/src/code/sys_rumble.c index fdb204af5..da8b9d875 100644 --- a/src/code/sys_rumble.c +++ b/src/code/sys_rumble.c @@ -147,7 +147,7 @@ void RumbleMgr_Init(RumbleMgr* rumbleMgr) { } void RumbleMgr_Destroy(RumbleMgr* rumbleMgr) { -#if OOT_DEBUG +#if IS_DEBUG bzero(rumbleMgr, sizeof(RumbleMgr)); #endif } diff --git a/src/code/system_malloc.c b/src/code/system_malloc.c index 74e69ed46..0219fc2a5 100644 --- a/src/code/system_malloc.c +++ b/src/code/system_malloc.c @@ -6,7 +6,7 @@ Arena gSystemArena; -#if OOT_DEBUG +#if IS_DEBUG s32 gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG; void SystemArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) { @@ -35,8 +35,8 @@ void* SystemArena_Malloc(u32 size) { return ptr; } -#if OOT_DEBUG -void* SystemArena_MallocDebug(u32 size, const char* file, s32 line) { +#if IS_DEBUG +void* SystemArena_MallocDebug(u32 size, const char* file, int line) { void* ptr = __osMallocDebug(&gSystemArena, size, file, line); SYSTEM_ARENA_CHECK_POINTER(ptr, size, "malloc_DEBUG", "確ä¿"); // "Secure" @@ -51,8 +51,8 @@ void* SystemArena_MallocR(u32 size) { return ptr; } -#if OOT_DEBUG -void* SystemArena_MallocRDebug(u32 size, const char* file, s32 line) { +#if IS_DEBUG +void* SystemArena_MallocRDebug(u32 size, const char* file, int line) { void* ptr = __osMallocRDebug(&gSystemArena, size, file, line); SYSTEM_ARENA_CHECK_POINTER(ptr, size, "malloc_r_DEBUG", "確ä¿"); // "Secure" @@ -66,8 +66,8 @@ void* SystemArena_Realloc(void* ptr, u32 newSize) { return ptr; } -#if OOT_DEBUG -void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) { +#if IS_DEBUG +void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) { ptr = __osReallocDebug(&gSystemArena, ptr, newSize, file, line); SYSTEM_ARENA_CHECK_POINTER(ptr, newSize, "realloc_DEBUG", "å†ç¢ºä¿"); // "Re-securing" return ptr; @@ -78,8 +78,8 @@ void SystemArena_Free(void* ptr) { __osFree(&gSystemArena, ptr); } -#if OOT_DEBUG -void SystemArena_FreeDebug(void* ptr, const char* file, s32 line) { +#if IS_DEBUG +void SystemArena_FreeDebug(void* ptr, const char* file, int line) { __osFreeDebug(&gSystemArena, ptr, file, line); } #endif @@ -97,12 +97,12 @@ void* SystemArena_Calloc(u32 num, u32 size) { return ret; } -#if OOT_DEBUG void SystemArena_Display(void) { - PRINTF("システムヒープ表示\n"); // "System heap display" - __osDisplayArena(&gSystemArena); + if (IS_SPEEDMETER_ENABLED) { + PRINTF("システムヒープ表示\n"); // "System heap display" + __osDisplayArena(&gSystemArena); + } } -#endif void SystemArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) { ArenaImpl_GetSizes(&gSystemArena, outMaxFree, outFree, outAlloc); @@ -113,14 +113,14 @@ void SystemArena_Check(void) { } void SystemArena_Init(void* start, u32 size) { -#if OOT_DEBUG +#if IS_DEBUG gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocInit(&gSystemArena, start, size); } void SystemArena_Cleanup(void) { -#if OOT_DEBUG +#if IS_DEBUG gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocCleanup(&gSystemArena); diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c index de6f7eed4..0587da6b7 100644 --- a/src/code/ucode_disas.c +++ b/src/code/ucode_disas.c @@ -894,7 +894,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, Gfx* ptr) { this->tri1Cnt++; this->pipeSyncRequired = true; } break; - +#if !ENABLE_F3DEX3 case G_LINE3D: { if (curGfx->line.wd == 0) { DISAS_LOG("gsSPLine3D(%d, %d),", curGfx->line.v0, curGfx->line.v1); @@ -906,7 +906,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, Gfx* ptr) { this->lineCnt++; this->pipeSyncRequired = true; } break; - +#endif case G_TRI2: { Gtri2 tri2 = ptr->tri2; u32 v0, v1, v2; @@ -1019,13 +1019,13 @@ void UCodeDisas_Disassemble(UCodeDisas* this, Gfx* ptr) { DISAS_LOG("gsSPSegment(%d, 0x%08x),", movewd.offset / 4, movewd.data); this->segments[movewd.offset / 4] = movewd.data & 0xFFFFFF; } break; - +#if !ENABLE_F3DEX3 case G_MW_CLIP: { DISAS_LOG("gsSPClipRatio(FRUSTRATIO_%d), ", (movewd.data != 0) ? movewd.data : -movewd.data); ptr += 4 - 1; } break; - +#endif case G_MW_NUMLIGHT: { DISAS_LOG("gsSPNumLights(%d), ", movewd.data / 24); } break; @@ -1039,11 +1039,11 @@ void UCodeDisas_Disassemble(UCodeDisas* this, Gfx* ptr) { case G_MW_FOG: { DISAS_LOG("gsSPFogFactor(%d, %d),", movewd.data >> 16, movewd.data & 0xFFFF); } break; - +#if !ENABLE_F3DEX3 case G_MW_PERSPNORM: { DISAS_LOG("gsSPPerspNormalize(%d),", movewd.data); } break; - +#endif default: { DISAS_LOG("gsMoveWd(%d, %d, %d), ", movewd.index, movewd.offset, movewd.data); } break; @@ -1062,14 +1062,15 @@ void UCodeDisas_Disassemble(UCodeDisas* this, Gfx* ptr) { DISAS_LOG("vtrans=[%d %d %d %d] ", vp->vtrans[0], vp->vtrans[1], vp->vtrans[2], vp->vtrans[3]); } break; - +#if !ENABLE_F3DEX3 case G_MV_MATRIX: { DISAS_LOG("gsSPForceMatrix(0x%08x),", movemem.data); ptr += 2 - 1; } break; - +#endif case G_MV_LIGHT: { switch (movemem.offset * 8) { +#if !ENABLE_F3DEX3 case G_MVO_LOOKATX: { DISAS_LOG("gsSPLookAtX(0x%08x),", movemem.data); } break; @@ -1077,7 +1078,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, Gfx* ptr) { case G_MVO_LOOKATY: { DISAS_LOG("gsSPLookAtY(0x%08x),", movemem.data); } break; - +#endif default: { DISAS_LOG("gsSPLight(0x%08x,%d),", movemem.data, (movemem.offset * 8 - 0x18) / 0x18); diff --git a/src/code/z_DLF.c b/src/code/z_DLF.c index 8c144a1cd..42fbc4b47 100644 --- a/src/code/z_DLF.c +++ b/src/code/z_DLF.c @@ -10,7 +10,7 @@ void Overlay_LoadGameState(GameStateOverlay* overlayEntry) { if (overlayEntry->vramStart == NULL) { overlayEntry->unk_28 = 0; } else { - overlayEntry->loadedRamAddr = Overlay_AllocateAndLoad(overlayEntry->vromStart, overlayEntry->vromEnd, + overlayEntry->loadedRamAddr = Overlay_AllocateAndLoad(overlayEntry->file.vromStart, overlayEntry->file.vromEnd, overlayEntry->vramStart, overlayEntry->vramEnd); if (overlayEntry->loadedRamAddr == NULL) { diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 86afb147c..6b475799d 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1,7 +1,6 @@ #include "global.h" #include "quake.h" #include "terminal.h" - #include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h" #include "overlays/actors/ovl_En_Part/z_en_part.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" @@ -11,7 +10,7 @@ static CollisionPoly* sCurCeilingPoly; static s32 sCurCeilingBgId; -#if OOT_DEBUG +#if IS_DEBUG #define ACTOR_DEBUG_PRINTF \ if (R_ENABLE_ACTOR_DEBUG_PRINTF) \ PRINTF @@ -724,7 +723,7 @@ void TitleCard_Draw(PlayState* play, TitleCardContext* titleCtx) { width = titleCtx->width; height = titleCtx->height; doubleWidth = width * 2; - titleX = (titleCtx->x * 4) - (width * 2); + titleX = WIDE_INCR((titleCtx->x * 4) - (width * 2), (WIDE_GET_RATIO * 100.0f)); titleY = (titleCtx->y * 4) - (height * 2); OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 2824); @@ -743,7 +742,7 @@ void TitleCard_Draw(PlayState* play, TitleCardContext* titleCtx) { G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPTextureRectangle(OVERLAY_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4) - 1, - G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + G_TX_RENDERTILE, 0, 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); height = titleCtx->height - height; @@ -753,8 +752,9 @@ void TitleCard_Draw(PlayState* play, TitleCardContext* titleCtx) { G_IM_SIZ_8b, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4, - titleSecondY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + gSPTextureRectangle(OVERLAY_DISP++, titleX, WIDE_INCR(titleSecondY, -1), ((doubleWidth * 2) + titleX) - 4, + titleSecondY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, + WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); } CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 2880); @@ -840,7 +840,7 @@ void Actor_Destroy(Actor* actor, PlayState* play) { actor->destroy(actor, play); actor->destroy = NULL; } else { -#if OOT_DEBUG +#if IS_DEBUG overlayEntry = actor->overlayEntry; name = overlayEntry->name != NULL ? overlayEntry->name : ""; @@ -1392,7 +1392,7 @@ Gfx* func_8002E830(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* *hilite = GRAPH_ALLOC(gfxCtx, sizeof(Hilite)); -#if OOT_DEBUG +#if IS_DEBUG if (R_HREG_MODE == HREG_MODE_PRINT_HILITE_INFO) { PRINTF("z_actor.c 3529 eye=[%f(%f) %f %f] object=[%f %f %f] light_direction=[%f %f %f]\n", correctedEyeX, eye->x, eye->y, eye->z, object->x, object->y, object->z, lightDir->x, lightDir->y, lightDir->z); @@ -1601,13 +1601,13 @@ s32 Actor_OfferTalkExchange(Actor* actor, PlayState* play, f32 xzRange, f32 yRan if ((player->actor.flags & ACTOR_FLAG_TALK) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(play)) || (!actor->isTargeted && - ((yRange < fabsf(actor->yDistToPlayer)) || (player->targetActorDistance < actor->xzDistToPlayer) || + ((yRange < fabsf(actor->yDistToPlayer)) || (player->talkActorDistance < actor->xzDistToPlayer) || (xzRange < actor->xzDistToPlayer)))) { return false; } - player->targetActor = actor; - player->targetActorDistance = actor->xzDistToPlayer; + player->talkActor = actor; + player->talkActorDistance = actor->xzDistToPlayer; player->exchangeItemId = exchangeItemId; return true; @@ -1697,7 +1697,7 @@ s32 Actor_OfferGetItem(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange if (!(player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_12 | PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_18 | PLAYER_STATE1_19 | PLAYER_STATE1_20 | PLAYER_STATE1_21)) && Player_GetExplosiveHeld(player) < 0) { - if ((((player->heldActor != NULL) || (actor == player->targetActor)) && (getItemId > GI_NONE) && + if ((((player->heldActor != NULL) || (actor == player->talkActor)) && (getItemId > GI_NONE) && (getItemId < GI_MAX)) || (!(player->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_29)))) { if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) { @@ -1903,17 +1903,17 @@ f32 D_8015BC18; void func_8002FA60(PlayState* play) { Vec3f lightPos; - if (gSaveContext.save.info.fw.set) { + if (gSaveContext.save.info.fwMain.set) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0x28; - gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x = gSaveContext.save.info.fw.pos.x; - gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y = gSaveContext.save.info.fw.pos.y; - gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z = gSaveContext.save.info.fw.pos.z; - gSaveContext.respawn[RESPAWN_MODE_TOP].yaw = gSaveContext.save.info.fw.yaw; - gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams = gSaveContext.save.info.fw.playerParams; - gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex = gSaveContext.save.info.fw.entranceIndex; - gSaveContext.respawn[RESPAWN_MODE_TOP].roomIndex = gSaveContext.save.info.fw.roomIndex; - gSaveContext.respawn[RESPAWN_MODE_TOP].tempSwchFlags = gSaveContext.save.info.fw.tempSwchFlags; - gSaveContext.respawn[RESPAWN_MODE_TOP].tempCollectFlags = gSaveContext.save.info.fw.tempCollectFlags; + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x = gSaveContext.save.info.fwMain.pos.x; + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y = gSaveContext.save.info.fwMain.pos.y; + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z = gSaveContext.save.info.fwMain.pos.z; + gSaveContext.respawn[RESPAWN_MODE_TOP].yaw = gSaveContext.save.info.fwMain.yaw; + gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams = gSaveContext.save.info.fwMain.playerParams; + gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex = gSaveContext.save.info.fwMain.entranceIndex; + gSaveContext.respawn[RESPAWN_MODE_TOP].roomIndex = gSaveContext.save.info.fwMain.roomIndex; + gSaveContext.respawn[RESPAWN_MODE_TOP].tempSwchFlags = gSaveContext.save.info.fwMain.tempSwchFlags; + gSaveContext.respawn[RESPAWN_MODE_TOP].tempCollectFlags = gSaveContext.save.info.fwMain.tempCollectFlags; } else { gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0; gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x = 0.0f; @@ -2025,7 +2025,7 @@ void Actor_DrawFaroresWindPointer(PlayState* play) { alpha = 255 - (temp * 30); if (alpha < 0) { - gSaveContext.save.info.fw.set = 0; + gSaveContext.save.info.fwMain.set = 0; gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0; alpha = 0; } else { @@ -2187,7 +2187,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { actorCtx->unk_02--; } -#if OOT_DEBUG +#if IS_DEBUG if (KREG(0) == -100) { Actor* player = &GET_PLAYER(play)->actor; @@ -2204,7 +2204,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { } if ((player->stateFlags1 & PLAYER_STATE1_6) && ((player->actor.textId & 0xFF00) != 0x600)) { - sp74 = player->targetActor; + sp74 = player->talkActor; } for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++, categoryFreezeMaskP++) { @@ -2309,7 +2309,7 @@ void Actor_FaultPrint(Actor* actor, char* command) { FaultDrawer_Printf("ACTOR NAME is NULL"); } -#if OOT_DEBUG +#if IS_DEBUG overlayEntry = actor->overlayEntry; name = overlayEntry->name != NULL ? overlayEntry->name : ""; @@ -2421,12 +2421,14 @@ void Actor_DrawLensOverlay(GraphicsContext* gfxCtx) { LENS_MASK_HEIGHT, 0, G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD); - gDPSetTileSize(POLY_XLU_DISP++, G_TX_RENDERTILE, (SCREEN_WIDTH / 2 - LENS_MASK_WIDTH) << 2, - (SCREEN_HEIGHT / 2 - LENS_MASK_HEIGHT) << 2, (SCREEN_WIDTH / 2 + LENS_MASK_WIDTH - 1) << 2, + gDPSetTileSize(POLY_XLU_DISP++, G_TX_RENDERTILE, + WIDE_DIV(((SCREEN_WIDTH / 2 - LENS_MASK_WIDTH) << 2), WIDE_GET_RATIO), + (SCREEN_HEIGHT / 2 - LENS_MASK_HEIGHT) << 2, + (WIDE_DIV(SCREEN_WIDTH / 2 + LENS_MASK_WIDTH - 1, WIDE_GET_RATIO) + 37) << 2, (SCREEN_HEIGHT / 2 + LENS_MASK_HEIGHT - 1) << 2); gSPTextureRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH << 2, SCREEN_HEIGHT << 2, G_TX_RENDERTILE, LENS_MASK_OFFSET_S << 5, LENS_MASK_OFFSET_T << 5, - (1 << 10) * (SCREEN_WIDTH - 2 * LENS_MASK_OFFSET_S) / SCREEN_WIDTH, + WIDE_DIV(((1 << 10) * (SCREEN_WIDTH - 2 * LENS_MASK_OFFSET_S) / SCREEN_WIDTH), WIDE_GET_RATIO), (1 << 10) * (SCREEN_HEIGHT - 2 * LENS_MASK_OFFSET_T) / SCREEN_HEIGHT); gDPPipeSync(POLY_XLU_DISP++); @@ -2562,22 +2564,22 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { gDPNoOpString(POLY_OPA_DISP++, actorName, i); gDPNoOpString(POLY_XLU_DISP++, actorName, i); - if (OOT_DEBUG) { + if (IS_DEBUG) { HREG(66) = i; } - if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) { + if (!IS_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) { SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos, &actor->projectedW); } - if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(69) == 0)) { + if (!IS_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(69) == 0)) { if (actor->sfx != 0) { func_80030ED8(actor); } } - if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) { + if (!IS_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) { if (func_800314B0(play, actor)) { actor->flags |= ACTOR_FLAG_6; } else { @@ -2587,7 +2589,7 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { actor->isDrawn = false; - if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { + if (!IS_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) { if ((actor->flags & ACTOR_FLAG_REACT_TO_LENS) && ((play->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) || play->actorCtx.lensActive || @@ -2597,7 +2599,7 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { invisibleActors[invisibleActorCounter] = actor; invisibleActorCounter++; } else { - if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || + if (!IS_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(72) == 0)) { Actor_Draw(play, actor); actor->isDrawn = true; @@ -2610,15 +2612,15 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { } } - if (!OOT_DEBUG || (HREG(64) != 1) || (HREG(73) != 0)) { + if (!IS_DEBUG || (HREG(64) != 1) || (HREG(73) != 0)) { Effect_DrawAll(play->state.gfxCtx); } - if (!OOT_DEBUG || (HREG(64) != 1) || (HREG(74) != 0)) { + if (!IS_DEBUG || (HREG(64) != 1) || (HREG(74) != 0)) { EffectSs_DrawAll(play); } - if (!OOT_DEBUG || (HREG(64) != 1) || (HREG(72) != 0)) { + if (!IS_DEBUG || (HREG(64) != 1) || (HREG(72) != 0)) { if (play->actorCtx.lensActive) { Actor_DrawLensActors(play, invisibleActorCounter, invisibleActors); if ((play->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(play)) { @@ -2633,11 +2635,11 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { Lights_DrawGlow(play); } - if (!OOT_DEBUG || (HREG(64) != 1) || (HREG(75) != 0)) { + if (!IS_DEBUG || (HREG(64) != 1) || (HREG(75) != 0)) { TitleCard_Draw(play, &actorCtx->titleCtx); } -#if OOT_DEBUG +#if IS_DEBUG if ((HREG(64) != 1) || (HREG(76) != 0)) { CollisionCheck_DrawCollision(play, &play->colChkCtx); } @@ -2830,7 +2832,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos overlayEntry = &gActorOverlayTable[actorId]; ASSERT(actorId < ACTOR_ID_MAX, "profile < ACTOR_DLF_MAX", "../z_actor.c", 6883); -#if OOT_DEBUG +#if IS_DEBUG name = overlayEntry->name != NULL ? overlayEntry->name : ""; #endif @@ -2877,8 +2879,8 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos return NULL; } - Overlay_Load(overlayEntry->vromStart, overlayEntry->vromEnd, overlayEntry->vramStart, overlayEntry->vramEnd, - overlayEntry->loadedRamAddr); + Overlay_Load(overlayEntry->file.vromStart, overlayEntry->file.vromEnd, overlayEntry->vramStart, + overlayEntry->vramEnd, overlayEntry->loadedRamAddr); PRINTF(VT_FGCOL(GREEN)); PRINTF("OVL(a):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", overlayEntry->vramStart, overlayEntry->vramEnd, @@ -3059,6 +3061,12 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { Actor_FreeOverlay(overlayEntry); } + if (FIX_SRM) { + // this is required to avoid having actor data still loaded in RAM after it's supposed to be deleted + // see func_80031B14 + Actor_Kill(actor); + } + return newHead; } @@ -3189,33 +3197,64 @@ void Enemy_StartFinishingBlow(PlayState* play, Actor* actor) { SfxSource_PlaySfxAtFixedWorldPos(play, &actor->world.pos, 20, NA_SE_EN_LAST_DAMAGE); } -s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3) { - if (DECR(arg0[1]) == 0) { - arg0[1] = Rand_S16Offset(arg1, arg2); +/** + * Updates `FaceChange` data for a blinking pattern. + * This system expects that the actor using the system has defined 3 faces in this exact order: + * "eyes open", "eyes half open", "eyes closed". + * + * @param faceChange pointer to an actor's faceChange data + * @param blinkIntervalBase The base number of frames between blinks + * @param blinkIntervalRandRange The range for a random number of frames that can be added to `blinkIntervalBase` + * @param blinkDuration The number of frames it takes for a single blink to occur + */ +s16 FaceChange_UpdateBlinking(FaceChange* faceChange, s16 blinkIntervalBase, s16 blinkIntervalRandRange, + s16 blinkDuration) { + if (DECR(faceChange->timer) == 0) { + faceChange->timer = Rand_S16Offset(blinkIntervalBase, blinkIntervalRandRange); } - if ((arg0[1] - arg3) > 0) { - arg0[0] = 0; - } else if (((arg0[1] - arg3) > -2) || (arg0[1] < 2)) { - arg0[0] = 1; + if ((faceChange->timer - blinkDuration) > 0) { + // `timer - duration` is positive so this is the default state: "eyes open" face + faceChange->face = 0; + } else if (((faceChange->timer - blinkDuration) > -2) || (faceChange->timer < 2)) { + // This condition aims to catch both cases where the "eyes half open" face is needed. + // Note that the comparison assumes the duration of the "eyes half open" phase is 2 frames, irrespective of the + // value of `blinkDuration`. The duration for the "eyes closed" phase is `blinkDuration - 4`. + // For Player's use case `blinkDuration` is 6, so the "eyes closed" phase happens to have + // the same duration as each "eyes half open" phase. + faceChange->face = 1; } else { - arg0[0] = 2; + // If both conditions above fail, the only possibility left is the "eyes closed" face + faceChange->face = 2; } - return arg0[0]; + return faceChange->face; } -s16 func_80032D60(s16* arg0, s16 arg1, s16 arg2, s16 arg3) { - if (DECR(arg0[1]) == 0) { - arg0[1] = Rand_S16Offset(arg1, arg2); - arg0[0]++; +/** + * Updates `FaceChange` data for randomly selected face sets. + * Each set contains 3 faces. After the timer runs out, the next face in the set is used. + * After the third face in a set is used, a new face set is randomly chosen. + * + * @param faceChange pointer to an actor's faceChange data + * @param changeTimerBase The base number of frames between each face change + * @param changeTimerRandRange The range for a random number of frames that can be added to `changeTimerBase` + * @param faceSetRange The max number of face sets that will be chosen from + */ +s16 FaceChange_UpdateRandomSet(FaceChange* faceChange, s16 changeTimerBase, s16 changeTimerRandRange, + s16 faceSetRange) { + if (DECR(faceChange->timer) == 0) { + faceChange->timer = Rand_S16Offset(changeTimerBase, changeTimerRandRange); + faceChange->face++; - if ((arg0[0] % 3) == 0) { - arg0[0] = (s32)(Rand_ZeroOne() * arg3) * 3; + if ((faceChange->face % 3) == 0) { + // Randomly chose a "set number", then multiply by 3 because each set has 3 faces. + // This will use the first face in the newly chosen set. + faceChange->face = (s32)(Rand_ZeroOne() * faceSetRange) * 3; } } - return arg0[0]; + return faceChange->face; } void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) { @@ -4147,7 +4186,7 @@ s16 func_80034DD4(Actor* actor, PlayState* play, s16 arg2, f32 arg3) { Player* player = GET_PLAYER(play); f32 var; - if ((play->csCtx.state != CS_STATE_IDLE) || gDebugCamEnabled) { + if ((play->csCtx.state != CS_STATE_IDLE) || IS_DEBUG_CAM_ENABLED) { var = Math_Vec3f_DistXYZ(&actor->world.pos, &play->view.eye) * 0.25f; } else { var = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos); @@ -4324,24 +4363,24 @@ u8 Actor_ApplyDamage(Actor* actor) { void Actor_SetDropFlag(Actor* actor, ColliderElement* elem, s32 freezeFlag) { if (elem->acHitElem == NULL) { actor->dropFlag = 0x00; - } else if (freezeFlag && (elem->acHitElem->toucher.dmgFlags & (DMG_UNKNOWN_1 | DMG_MAGIC_ICE | DMG_MAGIC_FIRE))) { - actor->freezeTimer = elem->acHitElem->toucher.damage; + } else if (freezeFlag && (elem->acHitElem->atDmgInfo.dmgFlags & (DMG_UNKNOWN_1 | DMG_MAGIC_ICE | DMG_MAGIC_FIRE))) { + actor->freezeTimer = elem->acHitElem->atDmgInfo.damage; actor->dropFlag = 0x00; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_ARROW_FIRE) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_FIRE) { actor->dropFlag = 0x01; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_ARROW_ICE) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_ICE) { actor->dropFlag = 0x02; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_ARROW_UNK1) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_UNK1) { actor->dropFlag = 0x04; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_ARROW_UNK2) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_UNK2) { actor->dropFlag = 0x08; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_ARROW_UNK3) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_UNK3) { actor->dropFlag = 0x10; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_ARROW_LIGHT) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_LIGHT) { actor->dropFlag = 0x20; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_MAGIC_LIGHT) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_MAGIC_LIGHT) { if (freezeFlag) { - actor->freezeTimer = elem->acHitElem->toucher.damage; + actor->freezeTimer = elem->acHitElem->atDmgInfo.damage; } actor->dropFlag = 0x40; } else { @@ -4361,24 +4400,24 @@ void Actor_SetDropFlagJntSph(Actor* actor, ColliderJntSph* jntSph, s32 freezeFla if (elem->acHitElem == NULL) { flag = 0x00; } else if (freezeFlag && - (elem->acHitElem->toucher.dmgFlags & (DMG_UNKNOWN_1 | DMG_MAGIC_ICE | DMG_MAGIC_FIRE))) { - actor->freezeTimer = elem->acHitElem->toucher.damage; + (elem->acHitElem->atDmgInfo.dmgFlags & (DMG_UNKNOWN_1 | DMG_MAGIC_ICE | DMG_MAGIC_FIRE))) { + actor->freezeTimer = elem->acHitElem->atDmgInfo.damage; flag = 0x00; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_ARROW_FIRE) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_FIRE) { flag = 0x01; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_ARROW_ICE) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_ICE) { flag = 0x02; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_ARROW_UNK1) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_UNK1) { flag = 0x04; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_ARROW_UNK2) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_UNK2) { flag = 0x08; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_ARROW_UNK3) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_UNK3) { flag = 0x10; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_ARROW_LIGHT) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_LIGHT) { flag = 0x20; - } else if (elem->acHitElem->toucher.dmgFlags & DMG_MAGIC_LIGHT) { + } else if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_MAGIC_LIGHT) { if (freezeFlag) { - actor->freezeTimer = elem->acHitElem->toucher.damage; + actor->freezeTimer = elem->acHitElem->atDmgInfo.damage; } flag = 0x40; } else { @@ -5821,7 +5860,7 @@ s32 Actor_TrackPlayerSetFocusHeight(PlayState* play, Actor* actor, Vec3s* headRo actor->focus.pos = actor->world.pos; actor->focus.pos.y += focusHeight; - if (!(((play->csCtx.state != CS_STATE_IDLE) || gDebugCamEnabled) && + if (!(((play->csCtx.state != CS_STATE_IDLE) || IS_DEBUG_CAM_ENABLED) && (gSaveContext.save.entranceIndex == ENTR_KOKIRI_FOREST_0))) { yaw = ABS((s16)(actor->yawTowardsPlayer - actor->shape.rot.y)); if (yaw >= 0x4300) { @@ -5830,7 +5869,7 @@ s32 Actor_TrackPlayerSetFocusHeight(PlayState* play, Actor* actor, Vec3s* headRo } } - if (((play->csCtx.state != CS_STATE_IDLE) || gDebugCamEnabled) && + if (((play->csCtx.state != CS_STATE_IDLE) || IS_DEBUG_CAM_ENABLED) && (gSaveContext.save.entranceIndex == ENTR_KOKIRI_FOREST_0)) { target = play->view.eye; } else { @@ -5865,7 +5904,7 @@ s32 Actor_TrackPlayer(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* tors actor->focus.pos = focusPos; - if (!(((play->csCtx.state != CS_STATE_IDLE) || gDebugCamEnabled) && + if (!(((play->csCtx.state != CS_STATE_IDLE) || IS_DEBUG_CAM_ENABLED) && (gSaveContext.save.entranceIndex == ENTR_KOKIRI_FOREST_0))) { yaw = ABS((s16)(actor->yawTowardsPlayer - actor->shape.rot.y)); if (yaw >= 0x4300) { @@ -5874,7 +5913,7 @@ s32 Actor_TrackPlayer(PlayState* play, Actor* actor, Vec3s* headRot, Vec3s* tors } } - if (((play->csCtx.state != CS_STATE_IDLE) || gDebugCamEnabled) && + if (((play->csCtx.state != CS_STATE_IDLE) || IS_DEBUG_CAM_ENABLED) && (gSaveContext.save.entranceIndex == ENTR_KOKIRI_FOREST_0)) { target = play->view.eye; } else { diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index 23159e7ed..c697ddb4c 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -23,19 +23,46 @@ #undef DEFINE_ACTOR_UNSET // Actor Overlay Table definition -#define DEFINE_ACTOR(name, _1, allocType, nameString) \ - { (uintptr_t)_ovl_##name##SegmentRomStart, \ - (uintptr_t)_ovl_##name##SegmentRomEnd, \ - _ovl_##name##SegmentStart, \ - _ovl_##name##SegmentEnd, \ - NULL, \ - &name##_InitVars, \ - nameString, \ - allocType, \ - 0 }, +#if IS_DEBUG -#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, nameString) \ - { 0, 0, NULL, NULL, NULL, &name##_InitVars, nameString, allocType, 0 }, +#define DEFINE_ACTOR(name, _1, allocType, nameString) \ + { \ + ROM_FILE(ovl_##name), \ + _ovl_##name##SegmentStart, \ + _ovl_##name##SegmentEnd, \ + NULL, \ + &name##_InitVars, \ + nameString, \ + allocType, \ + 0, \ + }, + +#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, nameString) \ + { \ + ROM_FILE_UNSET, NULL, NULL, NULL, &name##_InitVars, nameString, allocType, 0, \ + }, + +#else + +// Actor name is set to NULL in retail builds +#define DEFINE_ACTOR(name, _1, allocType, _3) \ + { \ + ROM_FILE(ovl_##name), \ + _ovl_##name##SegmentStart, \ + _ovl_##name##SegmentEnd, \ + NULL, \ + &name##_InitVars, \ + NULL, \ + allocType, \ + 0, \ + }, + +#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, _3) \ + { \ + ROM_FILE_UNSET, NULL, NULL, NULL, &name##_InitVars, NULL, allocType, 0, \ + }, + +#endif #define DEFINE_ACTOR_UNSET(_0) { 0 }, @@ -52,7 +79,7 @@ s32 gMaxActorId = 0; static FaultClient sFaultClient; void ActorOverlayTable_LogPrint(void) { -#if OOT_DEBUG +#if IS_DEBUG ActorOverlay* overlayEntry; u32 i; @@ -60,7 +87,7 @@ void ActorOverlayTable_LogPrint(void) { PRINTF("RomStart RomEnd SegStart SegEnd allocp profile segname\n"); for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < (u32)gMaxActorId; i++, overlayEntry++) { - PRINTF("%08x %08x %08x %08x %08x %08x %s\n", overlayEntry->vromStart, overlayEntry->vromEnd, + PRINTF("%08x %08x %08x %08x %08x %08x %s\n", overlayEntry->file.vromStart, overlayEntry->file.vromEnd, overlayEntry->vramStart, overlayEntry->vramEnd, overlayEntry->loadedRamAddr, &overlayEntry->initInfo->id, overlayEntry->name != NULL ? overlayEntry->name : "?"); } @@ -82,7 +109,7 @@ void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) { if (overlayEntry->loadedRamAddr != NULL) { FaultDrawer_Printf("%3d %08x-%08x %3d %s\n", i, overlayEntry->loadedRamAddr, (uintptr_t)overlayEntry->loadedRamAddr + overlaySize, overlayEntry->numLoaded, - (OOT_DEBUG && overlayEntry->name != NULL) ? overlayEntry->name : ""); + (IS_DEBUG && overlayEntry->name != NULL) ? overlayEntry->name : ""); } } } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 488d9464f..884fde7ce 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -22,7 +22,6 @@ s32 BgCheck_CheckLineAgainstDyna(CollisionContext* colCtx, u16 xpFlags, Vec3f* p s32 bccFlags); s32 BgCheck_SphVsFirstDynaPoly(CollisionContext* colCtx, u16 xpFlags, CollisionPoly** outPoly, s32* outBgId, Vec3f* center, f32 radius, Actor* actor, u16 bciFlags); -void BgCheck_ResetPolyCheckTbl(SSNodeList* nodeList, s32 numPolys); #define SS_NULL 0xFFFF @@ -79,10 +78,11 @@ u16 sSurfaceMaterialToSfxOffset[SURFACE_MATERIAL_MAX] = { SURFACE_SFX_OFFSET_CARPET, // SURFACE_MATERIAL_CARPET }; +#if IS_DEBUG /** * original name: T_BGCheck_PosErrorCheck */ -s32 BgCheck_PosErrorCheck(Vec3f* pos, char* file, s32 line) { +s32 BgCheck_PosErrorCheck(Vec3f* pos, const char* file, int line) { if (pos->x >= BGCHECK_XYZ_ABSMAX || pos->x <= -BGCHECK_XYZ_ABSMAX || pos->y >= BGCHECK_XYZ_ABSMAX || pos->y <= -BGCHECK_XYZ_ABSMAX || pos->z >= BGCHECK_XYZ_ABSMAX || pos->z <= -BGCHECK_XYZ_ABSMAX) { PRINTF(VT_FGCOL(RED)); @@ -94,6 +94,7 @@ s32 BgCheck_PosErrorCheck(Vec3f* pos, char* file, s32 line) { } return false; } +#endif /** * Set SSNode @@ -194,30 +195,24 @@ void BgCheck_Vec3fToVec3s(Vec3s* dst, Vec3f* src) { * Get CollisionPoly's lowest y point */ s16 CollisionPoly_GetMinY(CollisionPoly* poly, Vec3s* vtxList) { - s32 a; - s32 b; - s32 c; - s16 min; - //! @bug Due to rounding errors, some polys with a slight slope have a y normal of 1.0f/-1.0f. As such, this //! optimization returns the wrong minimum y for a subset of these polys. if (poly->normal.y == COLPOLY_SNORMAL(1.0f) || poly->normal.y == COLPOLY_SNORMAL(-1.0f)) { return vtxList[COLPOLY_VTX_INDEX(poly->flags_vIA)].y; - } + } else { + s32 a = COLPOLY_VTX_INDEX(poly->flags_vIA); + s32 b = COLPOLY_VTX_INDEX(poly->flags_vIB); + s32 c = poly->vIC; + s16 min = vtxList[a].y; - a = COLPOLY_VTX_INDEX(poly->flags_vIA); - b = COLPOLY_VTX_INDEX(poly->flags_vIB); - c = poly->vIC; - - min = vtxList[a].y; - - if (min > vtxList[b].y) { - min = vtxList[b].y; + if (min > vtxList[b].y) { + min = vtxList[b].y; + } + if (min < vtxList[c].y) { + return min; + } + return vtxList[c].y; } - if (min < vtxList[c].y) { - return min; - } - return vtxList[c].y; } /** @@ -491,8 +486,8 @@ void StaticLookup_AddPolyToSSList(CollisionContext* colCtx, SSList* ssList, Coll SSNode* curNode; SSNode* nextNode; s32 polyYMin; - u16 newNodeId; s16 curPolyId; + u16 newNodeId; // if list is null if (ssList->head == SS_NULL) { @@ -514,6 +509,8 @@ void StaticLookup_AddPolyToSSList(CollisionContext* colCtx, SSList* ssList, Coll while (true) { // if at the end of the list if (curNode->next == SS_NULL) { + s32 pad; + newNodeId = SSNodeList_GetNextNodeIdx(&colCtx->polyNodes); SSNode_SetValue(&colCtx->polyNodes.tbl[newNodeId], &polyId, SS_NULL); curNode->next = newNodeId; @@ -681,8 +678,8 @@ s32 BgCheck_ComputeWallDisplacement(CollisionContext* colCtx, CollisionPoly* pol s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16 xpFlags, f32* outX, f32* outZ, Vec3f* pos, f32 radius, CollisionPoly** outPoly) { Vec3f resultPos; - f32 temp_f2; - f32 temp_f2_2; + f32 zTemp; + f32 xTemp; f32 planeDist; f32 intersect; s32 result; @@ -690,17 +687,14 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16 CollisionPoly* polyList; SSNode* curNode; f32 invNormalXZ; - f32 zTemp; - f32 xTemp; s32 polyId; f32 normalXZ; f32 nx; f32 ny; f32 nz; - f32 temp_f16; + s32 pad; Vec3s* vtxList; - u16 pad; - + f32 temp_f16; f32 zMin; f32 zMax; f32 xMin; @@ -780,8 +774,10 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16 } } if (CollisionPoly_CheckZIntersectApprox(curPoly, vtxList, resultPos.x, pos->y, &intersect)) { - if (fabsf(intersect - resultPos.z) <= radius / temp_f16) { - if ((intersect - resultPos.z) * nz <= 4.0f) { + f32 zIntersectDist = intersect - resultPos.z; + + if (fabsf(zIntersectDist) <= radius / temp_f16) { + if (zIntersectDist * nz <= 4.0f) { BgCheck_ComputeWallDisplacement(colCtx, curPoly, &resultPos.x, &resultPos.z, nx, ny, nz, invNormalXZ, planeDist, radius, outPoly); result = true; @@ -790,9 +786,8 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16 } if (curNode->next == SS_NULL) { break; - } else { - curNode = &colCtx->polyNodes.tbl[curNode->next]; } + curNode = &colCtx->polyNodes.tbl[curNode->next]; } curNode = &colCtx->polyNodes.tbl[lookup->wall.head]; @@ -861,8 +856,10 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16 } } if (CollisionPoly_CheckXIntersectApprox(curPoly, vtxList, pos->y, resultPos.z, &intersect)) { - if (fabsf(intersect - resultPos.x) <= radius / temp_f16) { - if ((intersect - resultPos.x) * nx <= 4.0f) { + f32 xIntersectDist = intersect - resultPos.x; + + if (fabsf(xIntersectDist) <= radius / temp_f16) { + if (xIntersectDist * nx <= 4.0f) { BgCheck_ComputeWallDisplacement(colCtx, curPoly, &resultPos.x, &resultPos.z, nx, ny, nz, invNormalXZ, planeDist, radius, outPoly); result = true; @@ -871,10 +868,8 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16 } if (curNode->next == SS_NULL) { break; - } else { - curNode = &colCtx->polyNodes.tbl[curNode->next]; - continue; } + curNode = &colCtx->polyNodes.tbl[curNode->next]; } *outX = resultPos.x; @@ -909,6 +904,9 @@ s32 BgCheck_CheckStaticCeiling(StaticLookup* lookup, u16 xpFlags, CollisionConte *outY = pos->y; while (true) { + f32 intersectDist; + f32 ny; + curPolyId = curNode->polyId; if (COLPOLY_VTX_CHECK_FLAGS_ANY(colCtx->colHeader->polyList[curPolyId].flags_vIA, xpFlags)) { if (curNode->next == SS_NULL) { @@ -921,8 +919,8 @@ s32 BgCheck_CheckStaticCeiling(StaticLookup* lookup, u16 xpFlags, CollisionConte curPoly = &polyList[curPolyId]; if (CollisionPoly_CheckYIntersectApprox2(curPoly, vtxList, pos->x, pos->z, &ceilingY)) { - f32 intersectDist = ceilingY - *outY; - f32 ny = COLPOLY_GET_NORMAL(curPoly->normal.y); + intersectDist = ceilingY - *outY; + ny = COLPOLY_GET_NORMAL(curPoly->normal.y); if (intersectDist > 0.0f && intersectDist < checkHeight && intersectDist * ny <= 0) { *outY = ceilingY - checkHeight; @@ -941,7 +939,7 @@ s32 BgCheck_CheckStaticCeiling(StaticLookup* lookup, u16 xpFlags, CollisionConte } /** - * Tests if line `posA` to `posB` intersects with a static poly in list `ssList`. Uses polyCheckTbl + * Tests if line `posA` to `posB` intersects with a static poly in list `ssList`. * returns true if such a poly exists, else false * `outPoly` returns the pointer of the poly intersected * `posB` and `outPos` returns the point of intersection with `outPoly` @@ -951,14 +949,12 @@ s32 BgCheck_CheckLineAgainstSSList(SSList* ssList, CollisionContext* colCtx, u16 Vec3f* posB, Vec3f* outPos, CollisionPoly** outPoly, f32* outDistSq, f32 chkDist, s32 bccFlags) { SSNode* curNode; - u8* checkedPoly; Vec3f polyIntersect; CollisionPoly* polyList; CollisionPoly* curPoly; s32 result; f32 minY; f32 distSq; - s16 polyId; result = false; polyList = colCtx->colHeader->polyList; @@ -968,10 +964,9 @@ s32 BgCheck_CheckLineAgainstSSList(SSList* ssList, CollisionContext* colCtx, u16 curNode = &colCtx->polyNodes.tbl[ssList->head]; while (true) { - polyId = curNode->polyId; - checkedPoly = &colCtx->polyNodes.polyCheckTbl[polyId]; + s16 polyId = curNode->polyId; - if (*checkedPoly == true || COLPOLY_VTX_CHECK_FLAGS_ANY(polyList[polyId].flags_vIA, xpFlags1) || + if (COLPOLY_VTX_CHECK_FLAGS_ANY(polyList[polyId].flags_vIA, xpFlags1) || !(xpFlags2 == 0 || COLPOLY_VTX_CHECK_FLAGS_ANY(polyList[polyId].flags_vIA, xpFlags2))) { if (curNode->next == SS_NULL) { @@ -981,7 +976,6 @@ s32 BgCheck_CheckLineAgainstSSList(SSList* ssList, CollisionContext* colCtx, u16 continue; } } - *checkedPoly = true; curPoly = &polyList[polyId]; minY = CollisionPoly_GetMinY(curPoly, colCtx->colHeader->vtxList); if (posA->y < minY && posB->y < minY) { @@ -1008,7 +1002,7 @@ s32 BgCheck_CheckLineAgainstSSList(SSList* ssList, CollisionContext* colCtx, u16 } /** - * Tests if line `posA` to `posB` intersects with a static poly in `lookup`. Uses polyCheckTbl + * Tests if line `posA` to `posB` intersects with a static poly in `lookup`. * returns true if such a poly exists, else false * `outPoly` returns the pointer of the poly intersected * `posB` and `outPos` returns the point of intersection with `outPoly` @@ -1051,13 +1045,12 @@ s32 BgCheck_SphVsFirstStaticPolyList(SSNode* node, u16 xpFlags, CollisionContext CollisionPoly** outPoly) { CollisionPoly* polyList = colCtx->colHeader->polyList; Vec3s* vtxList = colCtx->colHeader->vtxList; - CollisionPoly* curPoly; - u16 nextId; - s16 curPolyId; while (true) { - curPolyId = node->polyId; - curPoly = &polyList[curPolyId]; + u16 nextId; + s16 curPolyId = node->polyId; + CollisionPoly* curPoly = &polyList[curPolyId]; + if (COLPOLY_VTX_CHECK_FLAGS_ANY(colCtx->colHeader->polyList[curPolyId].flags_vIA, xpFlags)) { if (node->next == SS_NULL) { break; @@ -1542,10 +1535,10 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader u32 tblMax; u32 memSize; u32 lookupTblMemSize; - SSNodeList* nodeList; - s32 useCustomSubdivisions; - u32 customMemSize; s32 customNodeListMax; + SSNodeList* nodeList; + u32 customMemSize; + s32 useCustomSubdivisions; s32 i; colCtx->colHeader = colHeader; @@ -1717,11 +1710,15 @@ f32 BgCheck_RaycastDownImpl(PlayState* play, CollisionContext* colCtx, u16 xpFla if (checkPos.y < colCtx->minBounds.y) { break; } + +#if IS_DEBUG if (BgCheck_PosErrorCheck(&checkPos, "../z_bgcheck.c", 4410)) { if (actor != NULL) { PRINTF("ã“ã„ã¤,pself_actor->name %d\n", actor->id); } } +#endif + lookup = BgCheck_GetStaticLookup(colCtx, lookupTbl, &checkPos); if (lookup == NULL) { checkPos.y -= colCtx->subdivLength.y; @@ -1735,16 +1732,16 @@ f32 BgCheck_RaycastDownImpl(PlayState* play, CollisionContext* colCtx, u16 xpFla checkPos.y -= colCtx->subdivLength.y; } + dynaRaycastDown.play = play; dynaRaycastDown.colCtx = colCtx; dynaRaycastDown.xpFlags = xpFlags; + dynaRaycastDown.resultPoly = outPoly; dynaRaycastDown.yIntersect = yIntersect; dynaRaycastDown.pos = pos; + dynaRaycastDown.bgId = outBgId; dynaRaycastDown.actor = actor; dynaRaycastDown.downChkFlags = downChkFlags; dynaRaycastDown.chkDist = chkDist; - dynaRaycastDown.play = play; - dynaRaycastDown.resultPoly = outPoly; - dynaRaycastDown.bgId = outBgId; yIntersectDyna = BgCheck_RaycastDownDyna(&dynaRaycastDown); @@ -1951,11 +1948,11 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul Vec3f checkLinePrev; f32 n2XZDist; f32 n3XZDist; - f32 nx3, nz3; s32 bccFlags; + f32 nx; + f32 nz; Vec3f posIntersect2; s32 bgId2; - f32 nx, ny, nz; // unit normal of polygon result = false; *outBgId = BGCHECK_SCENE; @@ -1966,12 +1963,14 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul dy = posNext->y - posPrev->y; dz = posNext->z - posPrev->z; +#if IS_DEBUG if (BgCheck_PosErrorCheck(posNext, "../z_bgcheck.c", 4831) == true || BgCheck_PosErrorCheck(posPrev, "../z_bgcheck.c", 4832) == true) { if (actor != NULL) { PRINTF("ã“ã„ã¤,pself_actor->name %d\n", actor->id); } } +#endif // if there's movement on the xz plane, and argA flag is 0, if ((dx != 0.0f || dz != 0.0f) && (argA & 1) == 0) { @@ -1980,7 +1979,8 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul result = BgCheck_CheckLineImpl(colCtx, xpFlags, COLPOLY_IGNORE_NONE, posPrev, posNext, &posIntersect, &poly, &bgId, actor, 1.0f, BGCHECK_CHECK_ALL & ~BGCHECK_CHECK_CEILING); if (result) { - ny = COLPOLY_GET_NORMAL(poly->normal.y); + f32 ny = COLPOLY_GET_NORMAL(poly->normal.y); + // if poly is floor, push result underneath the floor if (ny > 0.5f) { posResult->x = posIntersect.x; @@ -2061,8 +2061,9 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul if (dynaPolyCollision == true || *outBgId != BGCHECK_SCENE) { if (BgCheck_CheckLineImpl(colCtx, xpFlags, COLPOLY_IGNORE_NONE, posPrev, posResult, &posIntersect2, &poly, &bgId2, actor, 1.0f, BGCHECK_CHECK_ONE_FACE | BGCHECK_CHECK_WALL)) { - nx3 = COLPOLY_GET_NORMAL(poly->normal.x); - nz3 = COLPOLY_GET_NORMAL(poly->normal.z); + f32 nx3 = COLPOLY_GET_NORMAL(poly->normal.x); + f32 nz3 = COLPOLY_GET_NORMAL(poly->normal.z); + n3XZDist = sqrtf(SQ(nx3) + SQ(nz3)); // if poly is not a "flat" floor or "flat" ceiling @@ -2155,11 +2156,15 @@ s32 BgCheck_CheckCeilingImpl(CollisionContext* colCtx, u16 xpFlags, f32* outY, V *outBgId = BGCHECK_SCENE; *outY = pos->y; + +#if IS_DEBUG if (BgCheck_PosErrorCheck(pos, "../z_bgcheck.c", 5206) == true) { if (actor != NULL) { PRINTF("ã“ã„ã¤,pself_actor->name %d\n", actor->id); } } +#endif + lookupTbl = colCtx->lookupTbl; if (!BgCheck_PosInStaticBoundingBox(colCtx, pos)) { return false; @@ -2222,13 +2227,10 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2, Vec3f posBTemp = *posB; Vec3f sectorMin; Vec3f sectorMax; - s32 k; - StaticLookup* lookup; - s32 j; - StaticLookup* jLookup; - s32 temp_lo; *outBgId = BGCHECK_SCENE; + +#if IS_DEBUG if (BgCheck_PosErrorCheck(posA, "../z_bgcheck.c", 5334) == true || BgCheck_PosErrorCheck(posB, "../z_bgcheck.c", 5335) == true) { if (actor != NULL) { @@ -2237,8 +2239,8 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2, PRINTF("pself_actor == NULLã§çŠ¯äººä¸æ˜Ž\n"); } } +#endif - BgCheck_ResetPolyCheckTbl(&colCtx->polyNodes, colCtx->colHeader->numPolygons); BgCheck_GetStaticLookupIndicesFromPos(colCtx, posA, (Vec3i*)&subdivMin); BgCheck_GetStaticLookupIndicesFromPos(colCtx, &posBTemp, (Vec3i*)&subdivMax); *posResult = *posB; @@ -2247,6 +2249,10 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2, *outPoly = NULL; if (subdivMin[0] != subdivMax[0] || subdivMin[1] != subdivMax[1] || subdivMin[2] != subdivMax[2]) { + s32 k; + s32 temp_lo; + s32 j; + for (i = 0; i < 3; i++) { if (subdivMax[i] < subdivMin[i]) { j = subdivMax[i]; @@ -2260,12 +2266,14 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2, sectorMax.z = colCtx->subdivLength.z + sectorMin.z; for (i = subdivMin[2]; i < subdivMax[2] + 1; i++) { - jLookup = iLookup + subdivMin[1] * colCtx->subdivAmount.x; + StaticLookup* jLookup = iLookup + subdivMin[1] * colCtx->subdivAmount.x; + sectorMin.y = subdivMin[1] * colCtx->subdivLength.y + colCtx->minBounds.y; sectorMax.y = colCtx->subdivLength.y + sectorMin.y; for (j = subdivMin[1]; j < subdivMax[1] + 1; j++) { - lookup = jLookup + subdivMin[0]; + StaticLookup* lookup = jLookup + subdivMin[0]; + sectorMin.x = subdivMin[0] * colCtx->subdivLength.x + colCtx->minBounds.x; sectorMax.x = colCtx->subdivLength.x + sectorMin.x; @@ -2443,11 +2451,14 @@ s32 BgCheck_SphVsFirstPolyImpl(CollisionContext* colCtx, u16 xpFlags, CollisionP StaticLookup* lookup; *outBgId = BGCHECK_SCENE; + +#if IS_DEBUG if (BgCheck_PosErrorCheck(center, "../z_bgcheck.c", 5852) == true) { if (actor != NULL) { PRINTF("ã“ã„ã¤,pself_actor->name %d\n", actor->id); } } +#endif lookup = BgCheck_GetStaticLookup(colCtx, colCtx->lookupTbl, center); if (lookup == NULL) { @@ -2488,7 +2499,6 @@ void SSNodeList_Initialize(SSNodeList* this) { this->max = 0; this->count = 0; this->tbl = NULL; - this->polyCheckTbl = NULL; } /** @@ -2502,10 +2512,6 @@ void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPoly this->tbl = THA_AllocTailAlign(&play->state.tha, tblMax * sizeof(SSNode), ALIGNOF_MASK(SSNode)); ASSERT(this->tbl != NULL, "this->short_slist_node_tbl != NULL", "../z_bgcheck.c", 5975); - - this->polyCheckTbl = GAME_STATE_ALLOC(&play->state, numPolys, "../z_bgcheck.c", 5979); - - ASSERT(this->polyCheckTbl != NULL, "this->polygon_check != NULL", "../z_bgcheck.c", 5981); } /** @@ -2784,12 +2790,12 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI PRINTF(VT_RST); if (!DynaPoly_IsBgIdBgActor(bgId)) { +#if IS_DEBUG if (bgId == -1) { PRINTF(VT_FGCOL(GREEN)); // "The index that should have been deleted(? ) was(== -1), processing aborted." PRINTF("DynaPolyInfo_delReserve():削除ã•れã¦ã„ã‚‹ã¯ãšã®(?)\nインデックス(== -1)ã®ãŸã‚,処ç†ã‚’中止ã—ã¾ã™ã€‚\n"); PRINTF(VT_RST); - return; } else { PRINTF(VT_FGCOL(RED)); // "Unable to deallocate index / index unallocated, processing aborted." @@ -2797,15 +2803,17 @@ void DynaPoly_DeleteBgActor(PlayState* play, DynaCollisionContext* dyna, s32 bgI "確ä¿ã—ã¦ã„ãªã„ï¼å‡ºæ¥ãªã‹ã£ãŸã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã®è§£æ”¾ã®ãŸã‚ã€å‡¦ç†ã‚’中止ã—ã¾ã™ã€‚index == %d\n", bgId); PRINTF(VT_RST); - return; } - } - actor = DynaPoly_GetActor(&play->colCtx, bgId); - if (actor != NULL) { +#endif - actor->bgId = BGACTOR_NEG_ONE; - dyna->bgActors[bgId].actor = NULL; - dyna->bgActorFlags[bgId] |= BGACTOR_1; + } else { + actor = DynaPoly_GetActor(&play->colCtx, bgId); + if (actor != NULL) { + + actor->bgId = BGACTOR_NEG_ONE; + dyna->bgActors[bgId].actor = NULL; + dyna->bgActorFlags[bgId] |= BGACTOR_1; + } } } @@ -2821,7 +2829,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3 MtxF mtx; Actor* actor; s32 pad; - s32 pad2; + f32 radiusSq; f32 numVtxInverse; s32 i; Vec3f pos; @@ -2851,6 +2859,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3 return; } +#if IS_DEBUG if (!(dyna->polyListMax >= *polyStartIndex + pbgdata->numPolygons)) { PRINTF(VT_FGCOL(RED)); // "do not use if %d exceeds %d" @@ -2869,6 +2878,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3 "pdyna_poly_info->poly_num >= *pstart_poly_index + pbgdata->poly_num", "../z_bgcheck.c", 6687); ASSERT(dyna->vtxListMax >= *vtxStartIndex + pbgdata->numVertices, "pdyna_poly_info->vert_num >= *pstart_vert_index + pbgdata->vtx_num", "../z_bgcheck.c", 6688); +#endif if (!(dyna->bitFlag & DYNAPOLY_INVALIDATE_LOOKUP) && (BgActor_IsTransformUnchanged(&dyna->bgActors[bgId]) == true)) { @@ -2898,111 +2908,111 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3 *polyStartIndex += pbgdata->numPolygons; *vtxStartIndex += pbgdata->numVertices; - } else { - SkinMatrix_SetTranslateRotateYXZScale( - &mtx, dyna->bgActors[bgId].curTransform.scale.x, dyna->bgActors[bgId].curTransform.scale.y, - dyna->bgActors[bgId].curTransform.scale.z, dyna->bgActors[bgId].curTransform.rot.x, - dyna->bgActors[bgId].curTransform.rot.y, dyna->bgActors[bgId].curTransform.rot.z, - dyna->bgActors[bgId].curTransform.pos.x, dyna->bgActors[bgId].curTransform.pos.y, - dyna->bgActors[bgId].curTransform.pos.z); - - numVtxInverse = 1.0f / pbgdata->numVertices; - newCenterPoint.x = newCenterPoint.y = newCenterPoint.z = 0.0f; - for (i = 0; i < pbgdata->numVertices; i++) { - Vec3f vtx; - Vec3f vtxT; // Vtx after mtx transform - - Math_Vec3s_ToVec3f(&vtx, &pbgdata->vtxList[i]); - SkinMatrix_Vec3fMtxFMultXYZ(&mtx, &vtx, &vtxT); - BgCheck_Vec3fToVec3s(&dyna->vtxList[*vtxStartIndex + i], &vtxT); - - if (i == 0) { - dyna->bgActors[bgId].minY = dyna->bgActors[bgId].maxY = vtxT.y; - } else if (vtxT.y < dyna->bgActors[bgId].minY) { - dyna->bgActors[bgId].minY = vtxT.y; - } else if (dyna->bgActors[bgId].maxY < vtxT.y) { - dyna->bgActors[bgId].maxY = vtxT.y; - } - newCenterPoint.x += vtxT.x; - newCenterPoint.y += vtxT.y; - newCenterPoint.z += vtxT.z; - } - - newCenterPoint.x *= numVtxInverse; - newCenterPoint.y *= numVtxInverse; - newCenterPoint.z *= numVtxInverse; - sphere->center.x = newCenterPoint.x; - sphere->center.y = newCenterPoint.y; - sphere->center.z = newCenterPoint.z; - newRadiusSq = -SQ(10.0f); - - for (i = 0; i < pbgdata->numVertices; i++) { - f32 radiusSq; - - newVtx.x = dyna->vtxList[*vtxStartIndex + i].x; - newVtx.y = dyna->vtxList[*vtxStartIndex + i].y; - newVtx.z = dyna->vtxList[*vtxStartIndex + i].z; - radiusSq = Math3D_Vec3fDistSq(&newVtx, &newCenterPoint); - if (newRadiusSq < radiusSq) { - newRadiusSq = radiusSq; - } - } - - sphere->radius = sqrtf(newRadiusSq) * 1.1f; - - for (i = 0; i < pbgdata->numPolygons; i++) { - CollisionPoly* newPoly = &dyna->polyList[*polyStartIndex + i]; - f32 newNormMagnitude; - - *newPoly = pbgdata->polyList[i]; - - // Yeah, this is all kinds of fake, but my God, it matches. - newPoly->flags_vIA = (COLPOLY_VTX_INDEX(newPoly->flags_vIA) + *vtxStartIndex) | - COLPOLY_VTX_FLAGS_MASKED((*newPoly).flags_vIA); - newPoly->flags_vIB = (COLPOLY_VTX_INDEX(newPoly->flags_vIB) + *vtxStartIndex) | - COLPOLY_VTX_FLAGS_MASKED((*newPoly).flags_vIB); - newPoly->vIC = *vtxStartIndex + newPoly->vIC; - dVtxList = dyna->vtxList; - vtxA.x = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIA)].x; - vtxA.y = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIA)].y; - vtxA.z = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIA)].z; - vtxB.x = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIB)].x; - vtxB.y = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIB)].y; - vtxB.z = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIB)].z; - vtxC.x = dVtxList[newPoly->vIC].x; - vtxC.y = dVtxList[newPoly->vIC].y; - vtxC.z = dVtxList[newPoly->vIC].z; - Math3D_SurfaceNorm(&vtxA, &vtxB, &vtxC, &newNormal); - newNormMagnitude = Math3D_Vec3fMagnitude(&newNormal); - - if (!IS_ZERO(newNormMagnitude)) { - newNormal.x *= (1.0f / newNormMagnitude); - newNormal.y *= (1.0f / newNormMagnitude); - newNormal.z *= (1.0f / newNormMagnitude); - newPoly->normal.x = COLPOLY_SNORMAL(newNormal.x); - newPoly->normal.y = COLPOLY_SNORMAL(newNormal.y); - newPoly->normal.z = COLPOLY_SNORMAL(newNormal.z); - } - - newPoly->dist = -DOTXYZ(newNormal, dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIA)]); - if (newNormal.y > 0.5f) { - s16 polyId = *polyStartIndex + i; - - DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.floor, &polyId); - } else if (newNormal.y < -0.8f) { - s16 polyId = *polyStartIndex + i; - - DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.ceiling, &polyId); - } else { - s16 polyId = *polyStartIndex + i; - - DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.wall, &polyId); - } - } - - *polyStartIndex += pbgdata->numPolygons; - *vtxStartIndex += pbgdata->numVertices; + return; } + + SkinMatrix_SetTranslateRotateYXZScale( + &mtx, dyna->bgActors[bgId].curTransform.scale.x, dyna->bgActors[bgId].curTransform.scale.y, + dyna->bgActors[bgId].curTransform.scale.z, dyna->bgActors[bgId].curTransform.rot.x, + dyna->bgActors[bgId].curTransform.rot.y, dyna->bgActors[bgId].curTransform.rot.z, + dyna->bgActors[bgId].curTransform.pos.x, dyna->bgActors[bgId].curTransform.pos.y, + dyna->bgActors[bgId].curTransform.pos.z); + + numVtxInverse = 1.0f / pbgdata->numVertices; + newCenterPoint.x = newCenterPoint.y = newCenterPoint.z = 0.0f; + for (i = 0; i < pbgdata->numVertices; i++) { + Vec3f vtx; + Vec3f vtxT; // Vtx after mtx transform + s32 pad2; + + Math_Vec3s_ToVec3f(&vtx, &pbgdata->vtxList[i]); + SkinMatrix_Vec3fMtxFMultXYZ(&mtx, &vtx, &vtxT); + BgCheck_Vec3fToVec3s(&dyna->vtxList[*vtxStartIndex + i], &vtxT); + + if (i == 0) { + dyna->bgActors[bgId].minY = dyna->bgActors[bgId].maxY = vtxT.y; + } else if (vtxT.y < dyna->bgActors[bgId].minY) { + dyna->bgActors[bgId].minY = vtxT.y; + } else if (dyna->bgActors[bgId].maxY < vtxT.y) { + dyna->bgActors[bgId].maxY = vtxT.y; + } + newCenterPoint.x += vtxT.x; + newCenterPoint.y += vtxT.y; + newCenterPoint.z += vtxT.z; + } + + newCenterPoint.x *= numVtxInverse; + newCenterPoint.y *= numVtxInverse; + newCenterPoint.z *= numVtxInverse; + sphere->center.x = newCenterPoint.x; + sphere->center.y = newCenterPoint.y; + sphere->center.z = newCenterPoint.z; + newRadiusSq = -SQ(10.0f); + + for (i = 0; i < pbgdata->numVertices; i++) { + newVtx.x = dyna->vtxList[*vtxStartIndex + i].x; + newVtx.y = dyna->vtxList[*vtxStartIndex + i].y; + newVtx.z = dyna->vtxList[*vtxStartIndex + i].z; + radiusSq = Math3D_Vec3fDistSq(&newVtx, &newCenterPoint); + if (newRadiusSq < radiusSq) { + newRadiusSq = radiusSq; + } + } + + sphere->radius = sqrtf(newRadiusSq) * 1.1f; + + for (i = 0; i < pbgdata->numPolygons; i++) { + CollisionPoly* newPoly = &dyna->polyList[*polyStartIndex + i]; + f32 newNormMagnitude; + + *newPoly = pbgdata->polyList[i]; + + // Yeah, this is all kinds of fake, but my God, it matches. + newPoly->flags_vIA = + (COLPOLY_VTX_INDEX(newPoly->flags_vIA) + *vtxStartIndex) | COLPOLY_VTX_FLAGS_MASKED((*newPoly).flags_vIA); + newPoly->flags_vIB = + (COLPOLY_VTX_INDEX(newPoly->flags_vIB) + *vtxStartIndex) | COLPOLY_VTX_FLAGS_MASKED((*newPoly).flags_vIB); + newPoly->vIC = *vtxStartIndex + newPoly->vIC; + dVtxList = dyna->vtxList; + vtxA.x = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIA)].x; + vtxA.y = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIA)].y; + vtxA.z = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIA)].z; + vtxB.x = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIB)].x; + vtxB.y = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIB)].y; + vtxB.z = dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIB)].z; + vtxC.x = dVtxList[newPoly->vIC].x; + vtxC.y = dVtxList[newPoly->vIC].y; + vtxC.z = dVtxList[newPoly->vIC].z; + Math3D_SurfaceNorm(&vtxA, &vtxB, &vtxC, &newNormal); + newNormMagnitude = Math3D_Vec3fMagnitude(&newNormal); + + if (!IS_ZERO(newNormMagnitude)) { + newNormal.x *= (1.0f / newNormMagnitude); + newNormal.y *= (1.0f / newNormMagnitude); + newNormal.z *= (1.0f / newNormMagnitude); + newPoly->normal.x = COLPOLY_SNORMAL(newNormal.x); + newPoly->normal.y = COLPOLY_SNORMAL(newNormal.y); + newPoly->normal.z = COLPOLY_SNORMAL(newNormal.z); + } + + newPoly->dist = -DOTXYZ(newNormal, dVtxList[(u32)COLPOLY_VTX_INDEX(newPoly->flags_vIA)]); + if (newNormal.y > 0.5f) { + s16 polyId = *polyStartIndex + i; + + DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.floor, &polyId); + } else if (newNormal.y < -0.8f) { + s16 polyId = *polyStartIndex + i; + + DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.ceiling, &polyId); + } else { + s16 polyId = *polyStartIndex + i; + + DynaSSNodeList_SetSSListHead(&dyna->polyNodes, &dyna->bgActors[bgId].dynaLookup.wall, &polyId); + } + } + + *polyStartIndex += pbgdata->numPolygons; + *vtxStartIndex += pbgdata->numVertices; } void DynaPoly_UnsetAllInteractFlags(PlayState* play, DynaCollisionContext* dyna, Actor* actor) { @@ -3155,7 +3165,7 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) { s32 i2; s32 isPaused; DynaPolyActor* dynaActor; - s32 pad; + CollisionPoly* poly; Vec3f polyVtx[3]; Vec3f polyNorm; u32 polyIndex; @@ -3167,7 +3177,6 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) { Vec3f vtx; f32 intersect; ScaleRotPos* curTransform; - CollisionPoly* poly; result = BGCHECK_Y_MIN; *dynaRaycastDown->bgId = BGCHECK_SCENE; @@ -3239,9 +3248,12 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) { vtxList = dynaRaycastDown->dyna->bgActors[*dynaRaycastDown->bgId].colHeader->vtxList; for (i2 = 0; i2 < 3; i2++) { + s32 pad; + Math_Vec3s_ToVec3f(&vtx, &vtxList[COLPOLY_VTX_INDEX(poly->vtxData[i2])]); SkinMatrix_Vec3fMtxFMultXYZ(&srpMtx, &vtx, &polyVtx[i2]); } + Math3D_SurfaceNorm(&polyVtx[0], &polyVtx[1], &polyVtx[2], &polyNorm); magnitude = Math3D_Vec3fMagnitude(&polyNorm); @@ -3290,8 +3302,6 @@ s32 BgCheck_SphVsDynaWallInBgActor(CollisionContext* colCtx, u16 xpFlags, DynaCo f32 invNormalXZ; f32 planeDist; f32 temp_f18; - f32 zIntersectDist; - f32 xIntersectDist; f32 zMin; f32 zMax; f32 xMin; @@ -3360,8 +3370,10 @@ s32 BgCheck_SphVsDynaWallInBgActor(CollisionContext* colCtx, u16 xpFlags, DynaCo } } if (CollisionPoly_CheckZIntersectApprox(poly, dyna->vtxList, resultPos.x, pos->y, &intersect)) { - if (fabsf(intersect - resultPos.z) <= radius / temp_f18) { - if ((intersect - resultPos.z) * nz <= 4.0f) { + f32 zIntersectDist = intersect - resultPos.z; + + if (fabsf(zIntersectDist) <= radius / temp_f18) { + if (zIntersectDist * nz <= 4.0f) { if (BgCheck_ComputeWallDisplacement(colCtx, poly, &resultPos.x, &resultPos.z, nx, ny, nz, invNormalXZ, planeDist, radius, outPoly)) { *outBgId = bgId; @@ -3434,7 +3446,8 @@ s32 BgCheck_SphVsDynaWallInBgActor(CollisionContext* colCtx, u16 xpFlags, DynaCo } if (CollisionPoly_CheckXIntersectApprox(poly, dyna->vtxList, pos->y, resultPos.z, &intersect)) { - xIntersectDist = intersect - resultPos.x; + f32 xIntersectDist = intersect - resultPos.x; + if (fabsf(xIntersectDist) <= radius / temp_f18) { if (xIntersectDist * nx <= 4.0f) { if (BgCheck_ComputeWallDisplacement(colCtx, poly, &resultPos.x, &resultPos.z, nx, ny, nz, @@ -3891,17 +3904,6 @@ void func_800418D0(CollisionContext* colCtx, PlayState* play) { } } -/** - * Reset SSNodeList polyCheckTbl - */ -void BgCheck_ResetPolyCheckTbl(SSNodeList* nodeList, s32 numPolys) { - u8* t; - - for (t = nodeList->polyCheckTbl; t < nodeList->polyCheckTbl + numPolys; t++) { - *t = 0; - } -} - /** * Get SurfaceType property set */ @@ -4223,6 +4225,8 @@ f32 sZorasDomainWaterBoxMaxZ = -967.0f; s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) { if (play->sceneId == SCENE_ZORAS_DOMAIN) { + s32 pad; + if (sZorasDomainWaterBoxMinX < x && x < sZorasDomainWaterBoxMaxX && sZorasDomainWaterBoxMinY < *ySurface && *ySurface < sZorasDomainWaterBoxMaxY && sZorasDomainWaterBoxMinZ < z && z < sZorasDomainWaterBoxMaxZ) { *outWaterBox = &sZorasDomainWaterBox; @@ -4409,7 +4413,7 @@ s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec return result; } -#if OOT_DEBUG +#if IS_DEBUG /** * Draw a list of dyna polys, specified by `ssList` */ diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 7db82ed35..956f630bd 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -6,13 +6,32 @@ s16 Camera_RequestSettingImpl(Camera* camera, s16 requestedSetting, s16 flags); s32 Camera_RequestModeImpl(Camera* camera, s16 requestedMode, u8 forceModeChange); -s32 Camera_QRegInit(void); s32 Camera_UpdateWater(Camera* camera); +#if IS_CAMERA_DEBUG_ENABLED +s32 Camera_QRegInit(void); +#endif + +#if IS_CAMERA_DEBUG_ENABLED +#define CAM_DEBUG_RELOAD_PREG(camera) \ + if (R_RELOAD_CAM_PARAMS) { \ + Camera_CopyPREGToModeValues(camera); \ + } \ + (void)0 +#else +#define CAM_DEBUG_RELOAD_PREG(camera) (void)0 +#endif + // Camera will reload its paramData. Usually that means setting the read-only data from what is stored in // CameraModeValue arrays. Although sometimes some read-write data is reset as well #define RELOAD_PARAMS(camera) (camera->animState == 0 || camera->animState == 10 || camera->animState == 20) +#if IS_CAMERA_DEBUG_ENABLED +#define CAM_DEBUG_RELOAD_PARAMS R_RELOAD_CAM_PARAMS +#else +#define CAM_DEBUG_RELOAD_PARAMS true +#endif + /** * Camera data is stored in both read-only data and OREG as s16, and then converted to the appropriate type during * runtime. If a small f32 is being stored as an s16, it is common to store that value 100 times larger than the @@ -25,6 +44,120 @@ s32 Camera_UpdateWater(Camera* camera); // Load the next value and scale down from camera read-only data stored in CameraModeValue #define GET_NEXT_SCALED_RO_DATA(values) CAM_DATA_SCALED(GET_NEXT_RO_DATA(values)) +#if IS_CAMERA_DEBUG_ENABLED + +#define CAM_GLOBAL_0 OREG(0) +#define CAM_GLOBAL_1 OREG(1) +#define CAM_XZ_OFFSET_UPDATE_RATE CAM_DATA_SCALED(R_CAM_XZ_OFFSET_UPDATE_RATE) +#define CAM_Y_OFFSET_UPDATE_RATE CAM_DATA_SCALED(R_CAM_Y_OFFSET_UPDATE_RATE) +#define CAM_FOV_UPDATE_RATE CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE) +#define CAM_MAX_PITCH R_CAM_MAX_PITCH +#define CAM_R_UPDATE_RATE_INV R_CAM_R_UPDATE_RATE_INV +#define CAM_PITCH_UPDATE_RATE_INV R_CAM_PITCH_UPDATE_RATE_INV +#define CAM_GLOBAL_8 CAM_DATA_SCALED(OREG(8)) +#define CAM_SLOPE_Y_ADJ_AMOUNT R_CAM_SLOPE_Y_ADJ_AMOUNT +#define CAM_GLOBAL_10 CAM_DATA_SCALED(OREG(10)) +#define CAM_GLOBAL_11 CAM_DATA_SCALED(OREG(11)) +#define CAM_GLOBAL_12 CAM_DATA_SCALED(OREG(12)) +#define CAM_GLOBAL_13 OREG(13) +#define CAM_GLOBAL_14 OREG(14) +#define CAM_GLOBAL_15 OREG(15) +#define CAM_GLOBAL_16 OREG(16) +#define CAM_PITCH_FLOOR_CHECK_NEAR_DIST_FAC CAM_DATA_SCALED(R_CAM_PITCH_FLOOR_CHECK_NEAR_DIST_FAC) +#define CAM_PITCH_FLOOR_CHECK_FAR_DIST_FAC CAM_DATA_SCALED(R_CAM_PITCH_FLOOR_CHECK_FAR_DIST_FAC) +#define CAM_PITCH_FLOOR_CHECK_OFFSET_Y_FAC CAM_DATA_SCALED(R_CAM_PITCH_FLOOR_CHECK_OFFSET_Y_FAC) +#define CAM_PITCH_FLOOR_CHECK_NEAR_WEIGHT CAM_DATA_SCALED(R_CAM_PITCH_FLOOR_CHECK_NEAR_WEIGHT) +#define CAM_GLOBAL_21 OREG(21) +#define CAM_GLOBAL_22 CAM_DATA_SCALED(OREG(22)) +#define CAM_DEFAULT_ANIM_TIME R_CAM_DEFAULT_ANIM_TIME +#define CAM_GLOBAL_24 OREG(24) +#define CAM_UPDATE_RATE_STEP_SCALE_XZ CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ) +#define CAM_UPDATE_RATE_STEP_SCALE_Y CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y) +#define CAM_GLOBAL_27 OREG(27) +#define CAM_GLOBAL_28 CAM_DATA_SCALED(OREG(28)) +#define CAM_GLOBAL_29 CAM_DATA_SCALED(OREG(29)) +#define CAM_GLOBAL_30 CAM_DATA_SCALED(OREG(30)) +#define CAM_JUMP1_EYE_Y_STEP_SCALE CAM_DATA_SCALED(R_CAM_JUMP1_EYE_Y_STEP_SCALE) +#define CAM_GLOBAL_32 OREG(32) +#define CAM_GLOBAL_33 OREG(33) +#define CAM_MIN_PITCH_1 R_CAM_MIN_PITCH_1 +#define CAM_MIN_PITCH_2 R_CAM_MIN_PITCH_2 +#define CAM_BATTLE1_ROLL_TARGET_BASE R_CAM_BATTLE1_ROLL_TARGET_BASE +#define CAM_BATTLE1_ROLL_STEP_SCALE CAM_DATA_SCALED(R_CAM_BATTLE1_ROLL_STEP_SCALE) +#define CAM_GLOBAL_38 CAM_DATA_SCALED(OREG(38)) +#define CAM_GLOBAL_39 CAM_DATA_SCALED(OREG(39)) +#define CAM_BATTLE1_XYZ_OFFSET_UPDATE_RATE_TARGET CAM_DATA_SCALED(R_CAM_BATTLE1_XYZ_OFFSET_UPDATE_RATE_TARGET) +#define CAM_AT_LERP_STEP_SCALE_MIN CAM_DATA_SCALED(R_CAM_AT_LERP_STEP_SCALE_MIN) +#define CAM_AT_LERP_STEP_SCALE_FAC CAM_DATA_SCALED(R_CAM_AT_LERP_STEP_SCALE_FAC) +#define CAM_GLOBAL_43 CAM_DATA_SCALED(OREG(43)) +#define CAM_GLOBAL_44 OREG(44) +#define CAM_GLOBAL_45 OREG(45) +#define CAM_YOFFSET_NORM CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) +#define CAM_GLOBAL_47 OREG(47) +#define CAM_GLOBAL_48 CAM_DATA_SCALED(OREG(48)) +#define CAM_GLOBAL_49 CAM_DATA_SCALED(OREG(49)) +#define CAM_GLOBAL_50 OREG(50) +#define CAM_GLOBAL_51 OREG(51) +#define CAM_GLOBAL_52 OREG(52) + +#else + +#define CAM_GLOBAL_0 0 +#define CAM_GLOBAL_1 1 +#define CAM_XZ_OFFSET_UPDATE_RATE .05f +#define CAM_Y_OFFSET_UPDATE_RATE .05f +#define CAM_FOV_UPDATE_RATE .05f +#define CAM_MAX_PITCH 14500 +#define CAM_R_UPDATE_RATE_INV 20 +#define CAM_PITCH_UPDATE_RATE_INV 16 +#define CAM_GLOBAL_8 1.5f +#define CAM_SLOPE_Y_ADJ_AMOUNT 25 +#define CAM_GLOBAL_10 1.5f +#define CAM_GLOBAL_11 0.06f +#define CAM_GLOBAL_12 .10f +#define CAM_GLOBAL_13 10 +#define CAM_GLOBAL_14 0 +#define CAM_GLOBAL_15 0 +#define CAM_GLOBAL_16 1 +#define CAM_PITCH_FLOOR_CHECK_NEAR_DIST_FAC 1.0f +#define CAM_PITCH_FLOOR_CHECK_FAR_DIST_FAC 2.5f +#define CAM_PITCH_FLOOR_CHECK_OFFSET_Y_FAC 1.2f +#define CAM_PITCH_FLOOR_CHECK_NEAR_WEIGHT 0.8f +#define CAM_GLOBAL_21 30 +#define CAM_GLOBAL_22 1.2f +#define CAM_DEFAULT_ANIM_TIME 4 +#define CAM_GLOBAL_24 1 +#define CAM_UPDATE_RATE_STEP_SCALE_XZ .50f +#define CAM_UPDATE_RATE_STEP_SCALE_Y .20f +#define CAM_GLOBAL_27 1800 +#define CAM_GLOBAL_28 0.5f +#define CAM_GLOBAL_29 0.5f +#define CAM_GLOBAL_30 0.5f +#define CAM_JUMP1_EYE_Y_STEP_SCALE 0.2f +#define CAM_GLOBAL_32 20 +#define CAM_GLOBAL_33 -10 +#define CAM_MIN_PITCH_1 -5460 +#define CAM_MIN_PITCH_2 -9100 +#define CAM_BATTLE1_ROLL_TARGET_BASE -6 +#define CAM_BATTLE1_ROLL_STEP_SCALE 0.08f +#define CAM_GLOBAL_38 0.15f +#define CAM_GLOBAL_39 0.75f +#define CAM_BATTLE1_XYZ_OFFSET_UPDATE_RATE_TARGET 0.6f +#define CAM_AT_LERP_STEP_SCALE_MIN 0.12f +#define CAM_AT_LERP_STEP_SCALE_FAC 1.1f +#define CAM_GLOBAL_43 0.4f +#define CAM_GLOBAL_44 50 +#define CAM_GLOBAL_45 250 +#define CAM_YOFFSET_NORM -0.1f +#define CAM_GLOBAL_47 30 +#define CAM_GLOBAL_48 0.3f +#define CAM_GLOBAL_49 0.7f +#define CAM_GLOBAL_50 20 +#define CAM_GLOBAL_51 20 +#define CAM_GLOBAL_52 20 + +#endif + #define DISTORTION_HOT_ROOM (1 << 0) #define DISTORTION_UNDERWATER_WEAK (1 << 1) #define DISTORTION_UNDERWATER_MEDIUM (1 << 2) @@ -160,17 +293,17 @@ void Camera_LERPCeilVec3f(Vec3f* target, Vec3f* cur, f32 yStepScale, f32 xzStepS void func_80043ABC(Camera* camera) { camera->yawUpdateRateInv = 100.0f; - camera->pitchUpdateRateInv = R_CAM_PITCH_UPDATE_RATE_INV; - camera->rUpdateRateInv = R_CAM_R_UPDATE_RATE_INV; - camera->xzOffsetUpdateRate = CAM_DATA_SCALED(R_CAM_XZ_OFFSET_UPDATE_RATE); - camera->yOffsetUpdateRate = CAM_DATA_SCALED(R_CAM_Y_OFFSET_UPDATE_RATE); - camera->fovUpdateRate = CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE); + camera->pitchUpdateRateInv = CAM_PITCH_UPDATE_RATE_INV; + camera->rUpdateRateInv = CAM_R_UPDATE_RATE_INV; + camera->xzOffsetUpdateRate = CAM_XZ_OFFSET_UPDATE_RATE; + camera->yOffsetUpdateRate = CAM_Y_OFFSET_UPDATE_RATE; + camera->fovUpdateRate = CAM_FOV_UPDATE_RATE; } void func_80043B60(Camera* camera) { - camera->rUpdateRateInv = OREG(27); - camera->yawUpdateRateInv = OREG(27); - camera->pitchUpdateRateInv = OREG(27); + camera->rUpdateRateInv = CAM_GLOBAL_27; + camera->yawUpdateRateInv = CAM_GLOBAL_27; + camera->pitchUpdateRateInv = CAM_GLOBAL_27; camera->xzOffsetUpdateRate = 0.001f; camera->yOffsetUpdateRate = 0.001f; camera->fovUpdateRate = 0.001f; @@ -439,9 +572,13 @@ f32 Camera_GetFloorYLayer(Camera* camera, Vec3f* norm, Vec3f* pos, s32* bgId) { break; } } + +#if IS_CAMERA_DEBUG_ENABLED if (i == 0) { PRINTF(VT_COL(YELLOW, BLACK) "camera: foward check: too many layer!\n" VT_RST); } +#endif + return floorY; } @@ -598,9 +735,9 @@ s16 Camera_GetPitchAdjFromFloorHeightDiffs(Camera* camera, s16 viewYaw, s16 init viewForwardsUnitZ = Math_CosS(viewYaw); playerHeight = Player_GetHeight(camera->player); - checkOffsetY = CAM_DATA_SCALED(R_CAM_PITCH_FLOOR_CHECK_OFFSET_Y_FAC) * playerHeight; - nearDist = CAM_DATA_SCALED(R_CAM_PITCH_FLOOR_CHECK_NEAR_DIST_FAC) * playerHeight; - farDist = CAM_DATA_SCALED(R_CAM_PITCH_FLOOR_CHECK_FAR_DIST_FAC) * playerHeight; + checkOffsetY = playerHeight * CAM_PITCH_FLOOR_CHECK_OFFSET_Y_FAC; + nearDist = playerHeight * CAM_PITCH_FLOOR_CHECK_NEAR_DIST_FAC; + farDist = playerHeight * CAM_PITCH_FLOOR_CHECK_FAR_DIST_FAC; playerPos.x = camera->playerPosRot.pos.x; playerPos.y = camera->playerGroundY + checkOffsetY; @@ -644,9 +781,8 @@ s16 Camera_GetPitchAdjFromFloorHeightDiffs(Camera* camera, s16 viewYaw, s16 init } } - floorYDiffNear = CAM_DATA_SCALED(R_CAM_PITCH_FLOOR_CHECK_NEAR_WEIGHT) * (sFloorYNear - camera->playerGroundY); - floorYDiffFar = - (1.0f - CAM_DATA_SCALED(R_CAM_PITCH_FLOOR_CHECK_NEAR_WEIGHT)) * (sFloorYFar - camera->playerGroundY); + floorYDiffNear = CAM_PITCH_FLOOR_CHECK_NEAR_WEIGHT * (sFloorYNear - camera->playerGroundY); + floorYDiffFar = (1.0f - CAM_PITCH_FLOOR_CHECK_NEAR_WEIGHT) * (sFloorYFar - camera->playerGroundY); pitchNear = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(floorYDiffNear, nearDist))); pitchFar = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(floorYDiffFar, farDist))); @@ -706,12 +842,12 @@ Vec3f Camera_CalcUpFromPitchYawRoll(s16 pitch, s16 yaw, s16 roll) { f32 Camera_ClampLERPScale(Camera* camera, f32 maxLERPScale) { f32 ret; - if (camera->atLERPStepScale < CAM_DATA_SCALED(R_CAM_AT_LERP_STEP_SCALE_MIN)) { - ret = CAM_DATA_SCALED(R_CAM_AT_LERP_STEP_SCALE_MIN); + if (camera->atLERPStepScale < CAM_AT_LERP_STEP_SCALE_MIN) { + ret = CAM_AT_LERP_STEP_SCALE_MIN; } else if (camera->atLERPStepScale >= maxLERPScale) { ret = maxLERPScale; } else { - ret = CAM_DATA_SCALED(R_CAM_AT_LERP_STEP_SCALE_FAC) * camera->atLERPStepScale; + ret = CAM_AT_LERP_STEP_SCALE_FAC * camera->atLERPStepScale; } return ret; @@ -722,6 +858,7 @@ void Camera_CopyDataToRegs(Camera* camera, s16 mode) { CameraModeValue* valueP; s32 i; +#if IS_CAMERA_DEBUG_ENABLED if (PREG(82)) { PRINTF("camera: res: stat (%d/%d/%d)\n", camera->camId, camera->setting, mode); } @@ -735,9 +872,12 @@ void Camera_CopyDataToRegs(Camera* camera, s16 mode) { PRINTF("camera: res: PREG(%02d) = %d\n", valueP->dataType, valueP->val); } } +#endif + camera->animState = 0; } +#if IS_CAMERA_DEBUG_ENABLED s32 Camera_CopyPREGToModeValues(Camera* camera) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; CameraModeValue* valueP; @@ -752,6 +892,7 @@ s32 Camera_CopyPREGToModeValues(Camera* camera) { } return true; } +#endif void Camera_UpdateInterface(s16 interfaceField) { s16 hudVisibilityMode; @@ -796,11 +937,15 @@ void Camera_UpdateInterface(s16 interfaceField) { Vec3f Camera_BGCheckCorner(Vec3f* linePointA, Vec3f* linePointB, CamColChk* pointAColChk, CamColChk* pointBColChk) { Vec3f closestPoint; + bool result; - if (!func_800427B4(pointAColChk->poly, pointBColChk->poly, linePointA, linePointB, &closestPoint)) { + result = func_800427B4(pointAColChk->poly, pointBColChk->poly, linePointA, linePointB, &closestPoint); +#if IS_CAMERA_DEBUG_ENABLED + if (!result) { PRINTF(VT_COL(YELLOW, BLACK) "camera: corner check no cross point %x %x\n" VT_RST, pointAColChk, pointBColChk); return pointAColChk->pos; } +#endif return closestPoint; } @@ -916,7 +1061,7 @@ s32 Camera_CalcAtDefault(Camera* camera, VecGeo* eyeAtDir, f32 yOffset, s16 calc if (calcSlopeYAdj) { playerToAtOffsetTarget.y -= OLib_ClampMaxDist( - Camera_CalcSlopeYAdj(&camera->floorNorm, playerPosRot->rot.y, eyeAtDir->yaw, R_CAM_SLOPE_Y_ADJ_AMOUNT), + Camera_CalcSlopeYAdj(&camera->floorNorm, playerPosRot->rot.y, eyeAtDir->yaw, CAM_SLOPE_Y_ADJ_AMOUNT), playerHeight); } @@ -939,7 +1084,9 @@ s32 func_800458D4(Camera* camera, VecGeo* eyeAtDir, f32 yOffset, f32* arg3, s16 f32 eyeAtAngle; PosRot* playerPosRot = &camera->playerPosRot; f32 deltaY; - s32 pad[2]; + Vec3f* at = &camera->at; + f32 temp; + s32 pad; playerToAtOffsetTarget.y = Player_GetHeight(camera->player) + yOffset; playerToAtOffsetTarget.x = 0.0f; @@ -947,30 +1094,30 @@ s32 func_800458D4(Camera* camera, VecGeo* eyeAtDir, f32 yOffset, f32* arg3, s16 if (calcSlopeYAdj) { playerToAtOffsetTarget.y -= - Camera_CalcSlopeYAdj(&camera->floorNorm, playerPosRot->rot.y, eyeAtDir->yaw, R_CAM_SLOPE_Y_ADJ_AMOUNT); + Camera_CalcSlopeYAdj(&camera->floorNorm, playerPosRot->rot.y, eyeAtDir->yaw, CAM_SLOPE_Y_ADJ_AMOUNT); } deltaY = playerPosRot->pos.y - *arg3; - eyeAtAngle = Math_FAtan2F(deltaY, OLib_Vec3fDistXZ(&camera->at, &camera->eye)); + eyeAtAngle = Math_FAtan2F(deltaY, OLib_Vec3fDistXZ(at, &camera->eye)); - if (eyeAtAngle > DEG_TO_RAD(OREG(32))) { + if (eyeAtAngle > DEG_TO_RAD(CAM_GLOBAL_32)) { if (1) {} - phi_f2 = 1.0f - sinf(eyeAtAngle - DEG_TO_RAD(OREG(32))); - } else if (eyeAtAngle < DEG_TO_RAD(OREG(33))) { - phi_f2 = 1.0f - sinf(DEG_TO_RAD(OREG(33)) - eyeAtAngle); + phi_f2 = 1.0f - sinf(eyeAtAngle - DEG_TO_RAD(CAM_GLOBAL_32)); + } else if (eyeAtAngle < DEG_TO_RAD(CAM_GLOBAL_33)) { + phi_f2 = 1.0f - sinf(DEG_TO_RAD(CAM_GLOBAL_33) - eyeAtAngle); } else { phi_f2 = 1.0f; } playerToAtOffsetTarget.y -= deltaY * phi_f2; - Camera_LERPCeilVec3f(&playerToAtOffsetTarget, &camera->playerToAtOffset, CAM_DATA_SCALED(OREG(29)), - CAM_DATA_SCALED(OREG(30)), 0.1f); + Camera_LERPCeilVec3f(&playerToAtOffsetTarget, &camera->playerToAtOffset, CAM_GLOBAL_29, CAM_GLOBAL_30, 0.1f); atTarget.x = playerPosRot->pos.x + camera->playerToAtOffset.x; atTarget.y = playerPosRot->pos.y + camera->playerToAtOffset.y; atTarget.z = playerPosRot->pos.z + camera->playerToAtOffset.z; - Camera_LERPCeilVec3f(&atTarget, &camera->at, camera->atLERPStepScale, camera->atLERPStepScale, 0.2f); + temp = camera->atLERPStepScale; + Camera_LERPCeilVec3f(&atTarget, at, temp, camera->atLERPStepScale, 0.2f); return 1; } @@ -995,7 +1142,7 @@ s32 func_80045B08(Camera* camera, VecGeo* eyeAtDir, f32 yOffset, s16 arg3) { phi_f2 = -Math_CosS(playerPosRot->rot.y - eyeAtDir->yaw); } - playerToAtOffsetTarget.y -= temp_ret * phi_f2 * R_CAM_SLOPE_Y_ADJ_AMOUNT; + playerToAtOffsetTarget.y -= temp_ret * phi_f2 * CAM_SLOPE_Y_ADJ_AMOUNT; Camera_LERPCeilVec3f(&playerToAtOffsetTarget, &camera->playerToAtOffset, camera->yOffsetUpdateRate, camera->xzOffsetUpdateRate, 0.1f); @@ -1028,12 +1175,12 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecGeo* arg1, f32 yOffset, f32* arg if (R_CAM_PARALLEL_LOCKON_CALC_SLOPE_Y_ADJ && calcSlopeYAdj) { playerToAtOffsetTarget.y -= - Camera_CalcSlopeYAdj(&camera->floorNorm, playerPosRot->rot.y, arg1->yaw, R_CAM_SLOPE_Y_ADJ_AMOUNT); + Camera_CalcSlopeYAdj(&camera->floorNorm, playerPosRot->rot.y, arg1->yaw, CAM_SLOPE_Y_ADJ_AMOUNT); } if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f || camera->player->stateFlags1 & PLAYER_STATE1_21) { - *arg3 = Camera_LERPCeilF(playerPosRot->pos.y, *arg3, CAM_DATA_SCALED(OREG(43)), 0.1f); + *arg3 = Camera_LERPCeilF(playerPosRot->pos.y, *arg3, CAM_GLOBAL_43, 0.1f); phi_f20 = playerPosRot->pos.y - *arg3; playerToAtOffsetTarget.y -= phi_f20; Camera_LERPCeilVec3f(&playerToAtOffsetTarget, &camera->playerToAtOffset, camera->yOffsetUpdateRate, @@ -1056,19 +1203,18 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecGeo* arg1, f32 yOffset, f32* arg } else { phi_f20 = playerPosRot->pos.y - *arg3; temp_f2 = Math_FAtan2F(phi_f20, OLib_Vec3fDistXZ(at, eye)); - if (DEG_TO_RAD(OREG(32)) < temp_f2) { - phi_f16 = 1 - sinf(temp_f2 - DEG_TO_RAD(OREG(32))); - } else if (temp_f2 < DEG_TO_RAD(OREG(33))) { - phi_f16 = 1 - sinf(DEG_TO_RAD(OREG(33)) - temp_f2); + if (DEG_TO_RAD(CAM_GLOBAL_32) < temp_f2) { + phi_f16 = 1 - sinf(temp_f2 - DEG_TO_RAD(CAM_GLOBAL_32)); + } else if (temp_f2 < DEG_TO_RAD(CAM_GLOBAL_33)) { + phi_f16 = 1 - sinf(DEG_TO_RAD(CAM_GLOBAL_33) - temp_f2); } else { phi_f16 = 1; } playerToAtOffsetTarget.y -= phi_f20 * phi_f16; } - Camera_LERPCeilVec3f(&playerToAtOffsetTarget, &camera->playerToAtOffset, CAM_DATA_SCALED(OREG(29)), - CAM_DATA_SCALED(OREG(30)), 0.1f); - camera->yOffsetUpdateRate = CAM_DATA_SCALED(OREG(29)); - camera->xzOffsetUpdateRate = CAM_DATA_SCALED(OREG(30)); + Camera_LERPCeilVec3f(&playerToAtOffsetTarget, &camera->playerToAtOffset, CAM_GLOBAL_29, CAM_GLOBAL_30, 0.1f); + camera->yOffsetUpdateRate = CAM_GLOBAL_29; + camera->xzOffsetUpdateRate = CAM_GLOBAL_30; } atTarget.x = playerPosRot->pos.x + camera->playerToAtOffset.x; atTarget.y = playerPosRot->pos.y + camera->playerToAtOffset.y; @@ -1103,7 +1249,7 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targetPos, f playerToAtOffsetTarget.z = 0.0f; if (R_CAM_PARALLEL_LOCKON_CALC_SLOPE_Y_ADJ && (flags & CAM_LOCKON_AT_FLAG_CALC_SLOPE_Y_ADJ)) { playerToAtOffsetTarget.y -= - Camera_CalcSlopeYAdj(floorNorm, playerPosRot->rot.y, eyeAtDir->yaw, R_CAM_SLOPE_Y_ADJ_AMOUNT); + Camera_CalcSlopeYAdj(floorNorm, playerPosRot->rot.y, eyeAtDir->yaw, CAM_SLOPE_Y_ADJ_AMOUNT); } // tmpPos1 is player's head @@ -1112,13 +1258,13 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targetPos, f *outPlayerToTargetDir = OLib_Vec3fDiffToVecGeo(&tmpPos1, targetPos); playerToTargetDir = *outPlayerToTargetDir; if (distance < playerToTargetDir.r) { - playerToTargetDir.r = playerToTargetDir.r * CAM_DATA_SCALED(OREG(38)); + playerToTargetDir.r = playerToTargetDir.r * CAM_GLOBAL_38; } else { // ratio of player's height off ground to player's height. temp_f0_2 = OLib_ClampMaxDist((playerPosRot->pos.y - camera->playerGroundY) / playerHeight, 1.0f); - playerToTargetDir.r = (playerToTargetDir.r * CAM_DATA_SCALED(OREG(39))) - - (((CAM_DATA_SCALED(OREG(39)) - CAM_DATA_SCALED(OREG(38))) * playerToTargetDir.r) * - (playerToTargetDir.r / distance)); + playerToTargetDir.r = + (playerToTargetDir.r * CAM_GLOBAL_39) - + ((playerToTargetDir.r * (CAM_GLOBAL_39 - CAM_GLOBAL_38)) * (playerToTargetDir.r / distance)); playerToTargetDir.r -= (playerToTargetDir.r * temp_f0_2) * temp_f0_2; } @@ -1140,7 +1286,7 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targetPos, f if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f || camera->player->stateFlags1 & PLAYER_STATE1_21) { - *yPosOffset = Camera_LERPCeilF(playerPosRot->pos.y, *yPosOffset, CAM_DATA_SCALED(OREG(43)), 0.1f); + *yPosOffset = Camera_LERPCeilF(playerPosRot->pos.y, *yPosOffset, CAM_GLOBAL_43, 0.1f); yPosDelta = playerPosRot->pos.y - *yPosOffset; playerToAtOffsetTarget.y -= yPosDelta; Camera_LERPCeilVec3f(&playerToAtOffsetTarget, &camera->playerToAtOffset, camera->yOffsetUpdateRate, @@ -1164,20 +1310,19 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targetPos, f yPosDelta = playerPosRot->pos.y - *yPosOffset; temp_f0_2 = Math_FAtan2F(yPosDelta, OLib_Vec3fDistXZ(at, &camera->eye)); - if (temp_f0_2 > DEG_TO_RAD(OREG(32))) { - phi_f16 = 1.0f - sinf(temp_f0_2 - DEG_TO_RAD(OREG(32))); - } else if (temp_f0_2 < DEG_TO_RAD(OREG(33))) { - phi_f16 = 1.0f - sinf(DEG_TO_RAD(OREG(33)) - temp_f0_2); + if (temp_f0_2 > DEG_TO_RAD(CAM_GLOBAL_32)) { + phi_f16 = 1.0f - sinf(temp_f0_2 - DEG_TO_RAD(CAM_GLOBAL_32)); + } else if (temp_f0_2 < DEG_TO_RAD(CAM_GLOBAL_33)) { + phi_f16 = 1.0f - sinf(DEG_TO_RAD(CAM_GLOBAL_33) - temp_f0_2); } else { phi_f16 = 1.0f; } playerToAtOffsetTarget.y -= (yPosDelta * phi_f16); } - Camera_LERPCeilVec3f(&playerToAtOffsetTarget, &camera->playerToAtOffset, CAM_DATA_SCALED(OREG(29)), - CAM_DATA_SCALED(OREG(30)), 0.1f); - camera->yOffsetUpdateRate = CAM_DATA_SCALED(OREG(29)); - camera->xzOffsetUpdateRate = CAM_DATA_SCALED(OREG(30)); + Camera_LERPCeilVec3f(&playerToAtOffsetTarget, &camera->playerToAtOffset, CAM_GLOBAL_29, CAM_GLOBAL_30, 0.1f); + camera->yOffsetUpdateRate = CAM_GLOBAL_29; + camera->xzOffsetUpdateRate = CAM_GLOBAL_30; } tmpPos1.x = playerPosRot->pos.x + camera->playerToAtOffset.x; @@ -1212,8 +1357,8 @@ s32 Camera_CalcAtForHorse(Camera* camera, VecGeo* eyeAtDir, f32 yOffset, f32* yP playerToAtOffsetTarget.z = 0.0f; if (calcSlopeYAdj) { - playerToAtOffsetTarget.y -= Camera_CalcSlopeYAdj(&camera->floorNorm, camera->playerPosRot.rot.y, eyeAtDir->yaw, - R_CAM_SLOPE_Y_ADJ_AMOUNT); + playerToAtOffsetTarget.y -= + Camera_CalcSlopeYAdj(&camera->floorNorm, camera->playerPosRot.rot.y, eyeAtDir->yaw, CAM_SLOPE_Y_ADJ_AMOUNT); } Camera_LERPCeilVec3f(&playerToAtOffsetTarget, &camera->playerToAtOffset, camera->yOffsetUpdateRate, @@ -1233,17 +1378,17 @@ f32 Camera_LERPClampDist(Camera* camera, f32 dist, f32 min, f32 max) { if (dist < min) { distTarget = min; - rUpdateRateInvTarget = R_CAM_R_UPDATE_RATE_INV; + rUpdateRateInvTarget = CAM_R_UPDATE_RATE_INV; } else if (dist > max) { distTarget = max; - rUpdateRateInvTarget = R_CAM_R_UPDATE_RATE_INV; + rUpdateRateInvTarget = CAM_R_UPDATE_RATE_INV; } else { distTarget = dist; rUpdateRateInvTarget = 1.0f; } - camera->rUpdateRateInv = Camera_LERPCeilF(rUpdateRateInvTarget, camera->rUpdateRateInv, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ), 0.1f); + camera->rUpdateRateInv = + Camera_LERPCeilF(rUpdateRateInvTarget, camera->rUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); return Camera_LERPCeilF(distTarget, camera->dist, 1.0f / camera->rUpdateRateInv, 0.2f); } @@ -1254,19 +1399,19 @@ f32 Camera_ClampDist(Camera* camera, f32 dist, f32 minDist, f32 maxDist, s16 tim if (dist < minDist) { distTarget = minDist; - rUpdateRateInvTarget = timer != 0 ? R_CAM_R_UPDATE_RATE_INV * 0.5f : R_CAM_R_UPDATE_RATE_INV; + rUpdateRateInvTarget = timer != 0 ? CAM_R_UPDATE_RATE_INV * 0.5f : CAM_R_UPDATE_RATE_INV; } else if (maxDist < dist) { distTarget = maxDist; - rUpdateRateInvTarget = timer != 0 ? R_CAM_R_UPDATE_RATE_INV * 0.5f : R_CAM_R_UPDATE_RATE_INV; + rUpdateRateInvTarget = timer != 0 ? CAM_R_UPDATE_RATE_INV * 0.5f : CAM_R_UPDATE_RATE_INV; } else { distTarget = dist; - rUpdateRateInvTarget = timer != 0 ? R_CAM_R_UPDATE_RATE_INV : 1.0f; + rUpdateRateInvTarget = timer != 0 ? CAM_R_UPDATE_RATE_INV : 1.0f; } - camera->rUpdateRateInv = Camera_LERPCeilF(rUpdateRateInvTarget, camera->rUpdateRateInv, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ), 0.1f); + camera->rUpdateRateInv = + Camera_LERPCeilF(rUpdateRateInvTarget, camera->rUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); return Camera_LERPCeilF(distTarget, camera->dist, 1.0f / camera->rUpdateRateInv, 0.2f); } @@ -1285,7 +1430,7 @@ s16 Camera_CalcDefaultPitch(Camera* camera, s16 arg1, s16 arg2, s16 arg3) { if (ABS(target) < absCur) { stepScale = (1.0f / camera->pitchUpdateRateInv) * 3.0f; } else { - t = absCur * (1.0f / R_CAM_MAX_PITCH); + t = absCur * (1.0f / CAM_MAX_PITCH); pad = Camera_InterpolateCurve(0.8f, 1.0f - t); stepScale = (1.0f / camera->pitchUpdateRateInv) * pad; } @@ -1305,7 +1450,7 @@ s16 Camera_CalcDefaultYaw(Camera* camera, s16 cur, s16 target, f32 arg3, f32 acc speedT = COLPOLY_GET_NORMAL((s16)(angDelta - 0x7FFF)); } else { angDelta = target - (s16)(cur - 0x7FFF); - speedT = CAM_DATA_SCALED(OREG(48)); + speedT = CAM_GLOBAL_48; } updSpeed = Camera_InterpolateCurve(arg3, speedT); @@ -1348,7 +1493,7 @@ void func_80046E20(Camera* camera, VecGeo* eyeAdjustment, f32 minDist, f32 arg3, temp_f0 = OLib_Vec3fDist(at, &atEyeColChk.pos); *arg4 = temp_f0 > minDist ? 1.0f : temp_f0 / minDist; - anim->swingUpdateRate = CAM_DATA_SCALED(OREG(10)); + anim->swingUpdateRate = CAM_GLOBAL_10; anim->unk_18 = 1; anim->atEyePoly = eyeAtColChk.poly; newEyeAdjustment = OLib_Vec3fDiffToVecGeo(at, &peekAroundPoint); @@ -1384,7 +1529,7 @@ void func_80046E20(Camera* camera, VecGeo* eyeAdjustment, f32 minDist, f32 arg3, case 3: case 6: if (anim->unk_18 != 0) { - anim->swingUpdateRateTimer = OREG(52); + anim->swingUpdateRateTimer = CAM_GLOBAL_52; anim->unk_18 = 0; *eyeNext = *eye; } @@ -1396,16 +1541,16 @@ void func_80046E20(Camera* camera, VecGeo* eyeAdjustment, f32 minDist, f32 arg3, *eye = Camera_Vec3fTranslateByUnitVector(&atEyeColChk.pos, &atEyeColChk.norm, 1.0f); anim->atEyePoly = NULL; - if (temp_f0 < OREG(21)) { + if (temp_f0 < CAM_GLOBAL_21) { sp40.yaw = eyeAdjustment->yaw; sp40.pitch = Math_SinS(atEyeColChk.geoNorm.pitch + 0x3FFF) * 16380.0f; - sp40.r = (OREG(21) - temp_f0) * CAM_DATA_SCALED(OREG(22)); + sp40.r = (CAM_GLOBAL_21 - temp_f0) * CAM_GLOBAL_22; *eye = Camera_AddVecGeoToVec3f(eye, &sp40); } break; default: if (anim->unk_18 != 0) { - anim->swingUpdateRateTimer = OREG(52); + anim->swingUpdateRateTimer = CAM_GLOBAL_52; *eyeNext = *eye; anim->unk_18 = 0; } @@ -1443,10 +1588,9 @@ s32 Camera_Normal1(Camera* camera) { f32 rate = 0.1f; playerHeight = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = - (1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + f32 yNormal = (1.0f + CAM_YOFFSET_NORM - CAM_YOFFSET_NORM * (68.0f / playerHeight)); sp94 = yNormal * CAM_DATA_SCALED(playerHeight); @@ -1462,9 +1606,7 @@ s32 Camera_Normal1(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sCameraInterfaceField = roData->interfaceField; @@ -1473,8 +1615,8 @@ s32 Camera_Normal1(Camera* camera) { switch (camera->animState) { case 20: - camera->yawUpdateRateInv = OREG(27); - camera->pitchUpdateRateInv = OREG(27); + camera->yawUpdateRateInv = CAM_GLOBAL_27; + camera->pitchUpdateRateInv = CAM_GLOBAL_27; FALLTHROUGH; case 0: case 10: @@ -1489,7 +1631,7 @@ s32 Camera_Normal1(Camera* camera) { rwData->swing.swingUpdateRateTimer = 0; rwData->swingYawTarget = atEyeGeo.yaw; sUpdateCameraDirection = 0; - rwData->startSwingTimer = OREG(50) + OREG(51); + rwData->startSwingTimer = CAM_GLOBAL_50 + CAM_GLOBAL_51; break; default: break; @@ -1503,18 +1645,18 @@ s32 Camera_Normal1(Camera* camera) { } if (camera->xzSpeed > 0.001f) { - rwData->startSwingTimer = OREG(50) + OREG(51); + rwData->startSwingTimer = CAM_GLOBAL_50 + CAM_GLOBAL_51; } else if (rwData->startSwingTimer > 0) { - if (rwData->startSwingTimer > OREG(50)) { + if (rwData->startSwingTimer > CAM_GLOBAL_50) { rwData->swingYawTarget = atEyeGeo.yaw + ((s16)((s16)(camera->playerPosRot.rot.y - 0x7FFF) - atEyeGeo.yaw) / rwData->startSwingTimer); } rwData->startSwingTimer--; } - spA0 = camera->speedRatio * CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ); - sp9C = camera->speedRatio * CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y); - sp98 = rwData->swing.unk_18 != 0 ? CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ) : spA0; + spA0 = camera->speedRatio * CAM_UPDATE_RATE_STEP_SCALE_XZ; + sp9C = camera->speedRatio * CAM_UPDATE_RATE_STEP_SCALE_Y; + sp98 = rwData->swing.unk_18 != 0 ? CAM_UPDATE_RATE_STEP_SCALE_XZ : spA0; sp94 = (camera->xzSpeed - rwData->unk_20) * (0.333333f); if (sp94 > 1.0f) { @@ -1531,24 +1673,22 @@ s32 Camera_Normal1(Camera* camera) { Camera_LERPCeilF(rwData->swing.swingUpdateRate + (f32)(rwData->swing.swingUpdateRateTimer * 2), camera->yawUpdateRateInv, sp98, rate); camera->pitchUpdateRateInv = - Camera_LERPCeilF((f32)R_CAM_PITCH_UPDATE_RATE_INV + (f32)(rwData->swing.swingUpdateRateTimer * 2), + Camera_LERPCeilF((f32)CAM_PITCH_UPDATE_RATE_INV + (f32)(rwData->swing.swingUpdateRateTimer * 2), camera->pitchUpdateRateInv, sp9C, rate); rwData->swing.swingUpdateRateTimer--; } else { - camera->yawUpdateRateInv = Camera_LERPCeilF(rwData->swing.swingUpdateRate - - ((OREG(49) * 0.01f) * rwData->swing.swingUpdateRate * sp94), - camera->yawUpdateRateInv, sp98, rate); + camera->yawUpdateRateInv = + Camera_LERPCeilF(rwData->swing.swingUpdateRate - (rwData->swing.swingUpdateRate * CAM_GLOBAL_49 * sp94), + camera->yawUpdateRateInv, sp98, rate); camera->pitchUpdateRateInv = - Camera_LERPCeilF(R_CAM_PITCH_UPDATE_RATE_INV, camera->pitchUpdateRateInv, sp9C, rate); + Camera_LERPCeilF(CAM_PITCH_UPDATE_RATE_INV, camera->pitchUpdateRateInv, sp9C, rate); } - camera->pitchUpdateRateInv = Camera_LERPCeilF(R_CAM_PITCH_UPDATE_RATE_INV, camera->pitchUpdateRateInv, sp9C, rate); - camera->xzOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_XZ_OFFSET_UPDATE_RATE), camera->xzOffsetUpdateRate, spA0, rate); - camera->yOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_Y_OFFSET_UPDATE_RATE), camera->yOffsetUpdateRate, sp9C, rate); - camera->fovUpdateRate = Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE), camera->yOffsetUpdateRate, - camera->speedRatio * 0.05f, rate); + camera->pitchUpdateRateInv = Camera_LERPCeilF(CAM_PITCH_UPDATE_RATE_INV, camera->pitchUpdateRateInv, sp9C, rate); + camera->xzOffsetUpdateRate = Camera_LERPCeilF(CAM_XZ_OFFSET_UPDATE_RATE, camera->xzOffsetUpdateRate, spA0, rate); + camera->yOffsetUpdateRate = Camera_LERPCeilF(CAM_Y_OFFSET_UPDATE_RATE, camera->yOffsetUpdateRate, sp9C, rate); + camera->fovUpdateRate = + Camera_LERPCeilF(CAM_FOV_UPDATE_RATE, camera->yOffsetUpdateRate, camera->speedRatio * 0.05f, rate); if (roData->interfaceField & NORMAL1_FLAG_0) { t = Camera_GetPitchAdjFromFloorHeightDiffs(camera, atEyeGeo.yaw - 0x7FFF, false); @@ -1680,14 +1820,11 @@ s32 Camera_Normal2(Camera* camera) { f32 yNormal; playerHeight = Player_GetHeight(camera->player); - yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; roData->unk_00 = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; @@ -1701,9 +1838,7 @@ s32 Camera_Normal2(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sCameraInterfaceField = roData->interfaceField; @@ -1746,18 +1881,16 @@ s32 Camera_Normal2(Camera* camera) { atToEyeNextDir = OLib_Vec3fDiffToVecGeo(at, eyeNext); camera->speedRatio *= 0.5f; - spA4 = CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ) * camera->speedRatio; - spA0 = CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y) * camera->speedRatio; + spA4 = CAM_UPDATE_RATE_STEP_SCALE_XZ * camera->speedRatio; + spA0 = CAM_UPDATE_RATE_STEP_SCALE_Y * camera->speedRatio; camera->yawUpdateRateInv = Camera_LERPCeilF(roData->unk_0C, camera->yawUpdateRateInv * camera->speedRatio, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ), 0.1f); - camera->pitchUpdateRateInv = Camera_LERPCeilF(R_CAM_PITCH_UPDATE_RATE_INV, camera->pitchUpdateRateInv, spA0, 0.1f); - camera->xzOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_XZ_OFFSET_UPDATE_RATE), camera->xzOffsetUpdateRate, spA4, 0.1f); - camera->yOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_Y_OFFSET_UPDATE_RATE), camera->yOffsetUpdateRate, spA0, 0.1f); - camera->fovUpdateRate = Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE), camera->yOffsetUpdateRate, - camera->speedRatio * 0.05f, 0.1f); + CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); + camera->pitchUpdateRateInv = Camera_LERPCeilF(CAM_PITCH_UPDATE_RATE_INV, camera->pitchUpdateRateInv, spA0, 0.1f); + camera->xzOffsetUpdateRate = Camera_LERPCeilF(CAM_XZ_OFFSET_UPDATE_RATE, camera->xzOffsetUpdateRate, spA4, 0.1f); + camera->yOffsetUpdateRate = Camera_LERPCeilF(CAM_Y_OFFSET_UPDATE_RATE, camera->yOffsetUpdateRate, spA0, 0.1f); + camera->fovUpdateRate = + Camera_LERPCeilF(CAM_FOV_UPDATE_RATE, camera->yOffsetUpdateRate, camera->speedRatio * 0.05f, 0.1f); if (!(roData->interfaceField & NORMAL2_FLAG_7)) { Camera_CalcAtDefault(camera, &atToEyeNextDir, roData->unk_00, roData->interfaceField & NORMAL2_FLAG_0); @@ -1823,7 +1956,7 @@ s32 Camera_Normal2(Camera* camera) { } camera->fov = Camera_LERPCeilF(rwData->unk_1C, camera->fov, camera->fovUpdateRate, 1.0f); - camera->roll = Camera_LERPCeilS(0, camera->roll, 0.5f, 0xA); + camera->roll = Camera_LERPCeilS(0, camera->roll, .5f, 0xA); camera->atLERPStepScale = Camera_ClampLERPScale(camera, roData->unk_18); return 1; } @@ -1850,7 +1983,7 @@ s32 Camera_Normal3(Camera* camera) { f32 playerHeight; playerHeight = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; roData->yOffset = GET_NEXT_RO_DATA(values) * CAM_DATA_SCALED(playerHeight); @@ -1864,9 +1997,7 @@ s32 Camera_Normal3(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sp7C = OLib_Vec3fDiffToVecGeo(at, eye); sp74 = OLib_Vec3fDiffToVecGeo(at, eyeNext); @@ -1884,10 +2015,9 @@ s32 Camera_Normal3(Camera* camera) { rwData->unk_20 = camera->playerGroundY; rwData->swing.unk_16 = rwData->swing.unk_14 = rwData->swing.unk_18 = 0; rwData->swing.swingUpdateRate = roData->yawUpdateSpeed; - rwData->yawUpdAmt = - (s16)((s16)(playerPosRot->rot.y - 0x7FFF) - sp7C.yaw) * (1.0f / R_CAM_DEFAULT_ANIM_TIME); + rwData->yawUpdAmt = (s16)((s16)(playerPosRot->rot.y - 0x7FFF) - sp7C.yaw) * (1.0f / CAM_DEFAULT_ANIM_TIME); rwData->distTimer = 10; - rwData->yawTimer = R_CAM_DEFAULT_ANIM_TIME; + rwData->yawTimer = CAM_DEFAULT_ANIM_TIME; camera->animState = 1; rwData->swing.swingUpdateRateTimer = 0; } @@ -1896,28 +2026,25 @@ s32 Camera_Normal3(Camera* camera) { rwData->distTimer--; } - sp98 = CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ) * camera->speedRatio; - sp94 = CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y) * camera->speedRatio; + sp98 = CAM_UPDATE_RATE_STEP_SCALE_XZ * camera->speedRatio; + sp94 = CAM_UPDATE_RATE_STEP_SCALE_Y * camera->speedRatio; if (rwData->swing.swingUpdateRateTimer != 0) { camera->yawUpdateRateInv = Camera_LERPCeilF(roData->yawUpdateSpeed + (rwData->swing.swingUpdateRateTimer * 2), camera->yawUpdateRateInv, sp98, 0.1f); camera->pitchUpdateRateInv = - Camera_LERPCeilF((f32)R_CAM_PITCH_UPDATE_RATE_INV + (rwData->swing.swingUpdateRateTimer * 2), + Camera_LERPCeilF((f32)CAM_PITCH_UPDATE_RATE_INV + (rwData->swing.swingUpdateRateTimer * 2), camera->pitchUpdateRateInv, sp94, 0.1f); - if (1) {} rwData->swing.swingUpdateRateTimer--; } else { camera->yawUpdateRateInv = Camera_LERPCeilF(roData->yawUpdateSpeed, camera->yawUpdateRateInv, sp98, 0.1f); camera->pitchUpdateRateInv = - Camera_LERPCeilF(R_CAM_PITCH_UPDATE_RATE_INV, camera->pitchUpdateRateInv, sp94, 0.1f); + Camera_LERPCeilF(CAM_PITCH_UPDATE_RATE_INV, camera->pitchUpdateRateInv, sp94, 0.1f); } - camera->xzOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_XZ_OFFSET_UPDATE_RATE), camera->xzOffsetUpdateRate, sp98, 0.1f); - camera->yOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_Y_OFFSET_UPDATE_RATE), camera->yOffsetUpdateRate, sp94, 0.1f); - camera->fovUpdateRate = Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE), camera->fovUpdateRate, sp94, 0.1f); + camera->xzOffsetUpdateRate = Camera_LERPCeilF(CAM_XZ_OFFSET_UPDATE_RATE, camera->xzOffsetUpdateRate, sp98, 0.1f); + camera->yOffsetUpdateRate = Camera_LERPCeilF(CAM_Y_OFFSET_UPDATE_RATE, camera->yOffsetUpdateRate, sp94, 0.1f); + camera->fovUpdateRate = Camera_LERPCeilF(CAM_FOV_UPDATE_RATE, camera->fovUpdateRate, sp94, 0.1f); t2 = Camera_GetPitchAdjFromFloorHeightDiffs(camera, sp7C.yaw - 0x7FFF, true); sp94 = ((1.0f / roData->unk_10) * 0.5f); @@ -1934,11 +2061,11 @@ s32 Camera_Normal3(Camera* camera) { phi_a0 = roData->pitchTarget - rwData->curPitch; sp84.pitch = Camera_LERPCeilS(phi_a0, sp74.pitch, 1.0f / camera->pitchUpdateRateInv, 0xA); - if (sp84.pitch > R_CAM_MAX_PITCH) { - sp84.pitch = R_CAM_MAX_PITCH; + if (sp84.pitch > CAM_MAX_PITCH) { + sp84.pitch = CAM_MAX_PITCH; } - if (sp84.pitch < R_CAM_MIN_PITCH_1) { - sp84.pitch = R_CAM_MIN_PITCH_1; + if (sp84.pitch < CAM_MIN_PITCH_1) { + sp84.pitch = CAM_MIN_PITCH_1; } phi_a0 = playerPosRot->rot.y - (s16)(sp74.yaw - 0x7FFF); @@ -1957,6 +2084,7 @@ s32 Camera_Normal3(Camera* camera) { sp98 = sp98 + (sp94 * sp90); sp98 = (sp98 * phi_a0) / camera->yawUpdateRateInv; + if (1) {} sp84.yaw = fabsf(sp98) > (150.0f * (1.0f - camera->speedRatio)) ? (s16)(sp74.yaw + sp98) : sp74.yaw; if (rwData->yawTimer > 0) { @@ -2007,10 +2135,9 @@ s32 Camera_Parallel1(Camera* camera) { s32 pad3; playerHeight = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); roData->yOffset = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->distTarget = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; @@ -2025,9 +2152,7 @@ s32 Camera_Parallel1(Camera* camera) { roData->unk_1C = GET_NEXT_SCALED_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); atToEyeDir = OLib_Vec3fDiffToVecGeo(at, eye); atToEyeNextDir = OLib_Vec3fDiffToVecGeo(at, eyeNext); @@ -2042,7 +2167,7 @@ s32 Camera_Parallel1(Camera* camera) { if (roData->interfaceField & PARALLEL1_FLAG_2) { rwData->animTimer = 20; } else { - rwData->animTimer = R_CAM_DEFAULT_ANIM_TIME; + rwData->animTimer = CAM_DEFAULT_ANIM_TIME; } rwData->unk_00.x = 0.0f; rwData->yTarget = playerPosRot->pos.y - camera->playerPosDelta.y; @@ -2077,18 +2202,16 @@ s32 Camera_Parallel1(Camera* camera) { camera->animState = 1; } - spB8 = CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ) * camera->speedRatio; - spB4 = CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y) * camera->speedRatio; + spB8 = CAM_UPDATE_RATE_STEP_SCALE_XZ * camera->speedRatio; + spB4 = CAM_UPDATE_RATE_STEP_SCALE_Y * camera->speedRatio; - camera->rUpdateRateInv = Camera_LERPCeilF(R_CAM_R_UPDATE_RATE_INV, camera->rUpdateRateInv, spB8, 0.1f); + camera->rUpdateRateInv = Camera_LERPCeilF(CAM_R_UPDATE_RATE_INV, camera->rUpdateRateInv, spB8, 0.1f); camera->yawUpdateRateInv = Camera_LERPCeilF(roData->unk_08, camera->yawUpdateRateInv, spB8, 0.1f); camera->pitchUpdateRateInv = Camera_LERPCeilF(2.0f, camera->pitchUpdateRateInv, spB4, 0.1f); - camera->xzOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_XZ_OFFSET_UPDATE_RATE), camera->xzOffsetUpdateRate, spB8, 0.1f); - camera->yOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_Y_OFFSET_UPDATE_RATE), camera->yOffsetUpdateRate, spB4, 0.1f); - camera->fovUpdateRate = Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE), camera->fovUpdateRate, - camera->speedRatio * 0.05f, 0.1f); + camera->xzOffsetUpdateRate = Camera_LERPCeilF(CAM_XZ_OFFSET_UPDATE_RATE, camera->xzOffsetUpdateRate, spB8, 0.1f); + camera->yOffsetUpdateRate = Camera_LERPCeilF(CAM_Y_OFFSET_UPDATE_RATE, camera->yOffsetUpdateRate, spB4, 0.1f); + camera->fovUpdateRate = + Camera_LERPCeilF(CAM_FOV_UPDATE_RATE, camera->fovUpdateRate, camera->speedRatio * 0.05f, 0.1f); if (roData->interfaceField & PARALLEL1_FLAG_0) { tangle = Camera_GetPitchAdjFromFloorHeightDiffs(camera, atToEyeDir.yaw - 0x7FFF, true); @@ -2143,12 +2266,12 @@ s32 Camera_Parallel1(Camera* camera) { spA8.pitch = Camera_LERPCeilS(phi_a0, atToEyeNextDir.pitch, 1.0f / camera->pitchUpdateRateInv, 4); - if (spA8.pitch > R_CAM_MAX_PITCH) { - spA8.pitch = R_CAM_MAX_PITCH; + if (spA8.pitch > CAM_MAX_PITCH) { + spA8.pitch = CAM_MAX_PITCH; } - if (spA8.pitch < R_CAM_MIN_PITCH_1) { - spA8.pitch = R_CAM_MIN_PITCH_1; + if (spA8.pitch < CAM_MIN_PITCH_1) { + spA8.pitch = CAM_MIN_PITCH_1; } } *eyeNext = Camera_AddVecGeoToVec3f(at, &spA8); @@ -2222,10 +2345,9 @@ s32 Camera_Jump1(Camera* camera) { f32 playerHeight; playerHeight = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); roData->atYOffset = CAM_DATA_SCALED(GET_NEXT_RO_DATA(values)) * playerHeight * yNormal; roData->distMin = CAM_DATA_SCALED(GET_NEXT_RO_DATA(values)) * playerHeight * yNormal; @@ -2237,9 +2359,7 @@ s32 Camera_Jump1(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); // playerhead never gets used. playerhead = Actor_GetFocus(&camera->player->actor); @@ -2264,27 +2384,24 @@ s32 Camera_Jump1(Camera* camera) { } if (rwData->swing.swingUpdateRateTimer != 0) { - camera->yawUpdateRateInv = - Camera_LERPCeilF(roData->yawUpateRateTarget + rwData->swing.swingUpdateRateTimer, camera->yawUpdateRateInv, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y), 0.1f); + camera->yawUpdateRateInv = Camera_LERPCeilF(roData->yawUpateRateTarget + rwData->swing.swingUpdateRateTimer, + camera->yawUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_Y, 0.1f); camera->pitchUpdateRateInv = - Camera_LERPCeilF((f32)R_CAM_PITCH_UPDATE_RATE_INV + rwData->swing.swingUpdateRateTimer, - camera->pitchUpdateRateInv, CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y), 0.1f); + Camera_LERPCeilF((f32)CAM_PITCH_UPDATE_RATE_INV + rwData->swing.swingUpdateRateTimer, + camera->pitchUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_Y, 0.1f); rwData->swing.swingUpdateRateTimer--; } else { - camera->yawUpdateRateInv = Camera_LERPCeilF(roData->yawUpateRateTarget, camera->yawUpdateRateInv, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y), 0.1f); - camera->pitchUpdateRateInv = Camera_LERPCeilF((f32)R_CAM_PITCH_UPDATE_RATE_INV, camera->pitchUpdateRateInv, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y), 0.1f); + camera->yawUpdateRateInv = + Camera_LERPCeilF(roData->yawUpateRateTarget, camera->yawUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_Y, 0.1f); + camera->pitchUpdateRateInv = Camera_LERPCeilF((f32)CAM_PITCH_UPDATE_RATE_INV, camera->pitchUpdateRateInv, + CAM_UPDATE_RATE_STEP_SCALE_Y, 0.1f); } camera->xzOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_XZ_OFFSET_UPDATE_RATE), camera->xzOffsetUpdateRate, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ), 0.1f); - camera->yOffsetUpdateRate = Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_Y_OFFSET_UPDATE_RATE), camera->yOffsetUpdateRate, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y), 0.1f); - camera->fovUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE), camera->yOffsetUpdateRate, 0.05f, 0.1f); + Camera_LERPCeilF(CAM_XZ_OFFSET_UPDATE_RATE, camera->xzOffsetUpdateRate, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); + camera->yOffsetUpdateRate = + Camera_LERPCeilF(CAM_Y_OFFSET_UPDATE_RATE, camera->yOffsetUpdateRate, CAM_UPDATE_RATE_STEP_SCALE_Y, 0.1f); + camera->fovUpdateRate = Camera_LERPCeilF(CAM_FOV_UPDATE_RATE, camera->yOffsetUpdateRate, 0.05f, 0.1f); func_800458D4(camera, &eyeNextAtOffset, roData->atYOffset, &rwData->unk_1C, false); @@ -2292,8 +2409,8 @@ s32 Camera_Jump1(Camera* camera) { eyeDiffTarget = OLib_Vec3fDiffToVecGeo(at, eye); - eyeDiffGeo.r = Camera_LERPCeilF(eyeDiffTarget.r, eyeAtOffset.r, CAM_DATA_SCALED(OREG(29)), 1.0f); - eyeDiffGeo.pitch = Camera_LERPCeilS(eyeDiffTarget.pitch, eyeAtOffset.pitch, CAM_DATA_SCALED(OREG(29)), 0xA); + eyeDiffGeo.r = Camera_LERPCeilF(eyeDiffTarget.r, eyeAtOffset.r, CAM_GLOBAL_29, 1.0f); + eyeDiffGeo.pitch = Camera_LERPCeilS(eyeDiffTarget.pitch, eyeAtOffset.pitch, CAM_GLOBAL_29, 0xA); if (rwData->swing.unk_18) { eyeDiffGeo.yaw = @@ -2312,17 +2429,17 @@ s32 Camera_Jump1(Camera* camera) { eyeDiffGeo.r = roData->distMax; } - // Clamp the phi rotation at R_CAM_MAX_PITCH AND R_CAM_MIN_PITCH_2 - if (eyeDiffGeo.pitch > R_CAM_MAX_PITCH) { - eyeDiffGeo.pitch = R_CAM_MAX_PITCH; - } else if (eyeDiffGeo.pitch < R_CAM_MIN_PITCH_2) { - eyeDiffGeo.pitch = R_CAM_MIN_PITCH_2; + // Clamp the phi rotation at CAM_MAX_PITCH AND CAM_MIN_PITCH_2 + if (eyeDiffGeo.pitch > CAM_MAX_PITCH) { + eyeDiffGeo.pitch = CAM_MAX_PITCH; + } else if (eyeDiffGeo.pitch < CAM_MIN_PITCH_2) { + eyeDiffGeo.pitch = CAM_MIN_PITCH_2; } newEye = Camera_AddVecGeoToVec3f(at, &eyeDiffGeo); eyeNext->x = newEye.x; eyeNext->z = newEye.z; - eyeNext->y += (newEye.y - eyeNext->y) * CAM_DATA_SCALED(R_CAM_JUMP1_EYE_Y_STEP_SCALE); + eyeNext->y += (newEye.y - eyeNext->y) * CAM_JUMP1_EYE_Y_STEP_SCALE; if ((camera->status == CAM_STAT_ACTIVE) && !(roData->interfaceField & JUMP1_FLAG_4)) { func_80046E20(camera, &eyeDiffGeo, roData->distMin, roData->yawUpateRateTarget, &spA4, &rwData->swing); if (roData->interfaceField & JUMP1_FLAG_2) { @@ -2375,19 +2492,17 @@ s32 Camera_Jump2(Camera* camera) { s16 playerYawRot180; Jump2ReadOnlyData* roData = &camera->paramData.jump2.roData; Jump2ReadWriteData* rwData = &camera->paramData.jump2.rwData; - CameraModeValue* values; + s32 pad; f32 playerHeight; - f32 yNormal; playerHeight = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { - values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); - roData->atYOffset = - CAM_DATA_SCALED((camera->playerPosDelta.y > 0.0f ? -10.0f : 10.0f) + GET_NEXT_RO_DATA(values)) * - playerHeight * yNormal; + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { + CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); + + sp90 = (camera->playerPosDelta.y > 0.0f) ? -10.0f : 10.0f; + roData->atYOffset = CAM_DATA_SCALED(sp90 + GET_NEXT_RO_DATA(values)) * playerHeight * yNormal; roData->minDist = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->maxDist = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->minMaxDistFactor = GET_NEXT_SCALED_RO_DATA(values); @@ -2398,9 +2513,7 @@ s32 Camera_Jump2(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); atToEyeDir = OLib_Vec3fDiffToVecGeo(at, eye); atToEyeNextDir = OLib_Vec3fDiffToVecGeo(at, eyeNext); @@ -2424,7 +2537,7 @@ s32 Camera_Jump2(Camera* camera) { } yawDiff = (s16)(playerPosRot->rot.y - 0x7FFF) - atToEyeNextDir.yaw; - rwData->initYawDiff = ((yawDiff / R_CAM_DEFAULT_ANIM_TIME) / 4) * 3; + rwData->initYawDiff = ((yawDiff / CAM_DEFAULT_ANIM_TIME) / 4) * 3; if (roData->interfaceField & JUMP2_FLAG_1) { rwData->yawAdj = 0xA; } else { @@ -2434,21 +2547,20 @@ s32 Camera_Jump2(Camera* camera) { playerPosRot->pos.x -= camera->playerPosDelta.x; playerPosRot->pos.y -= camera->playerPosDelta.y; playerPosRot->pos.z -= camera->playerPosDelta.z; - rwData->animTimer = R_CAM_DEFAULT_ANIM_TIME; + rwData->animTimer = CAM_DEFAULT_ANIM_TIME; camera->animState++; camera->atLERPStepScale = roData->atLERPStepScale; } - sp90 = CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ) * camera->speedRatio; - sp8C = CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y) * camera->speedRatio; + sp90 = CAM_UPDATE_RATE_STEP_SCALE_XZ * camera->speedRatio; + sp8C = CAM_UPDATE_RATE_STEP_SCALE_Y * camera->speedRatio; camera->yawUpdateRateInv = Camera_LERPCeilF(roData->yawUpdRateTarget, camera->yawUpdateRateInv, sp90, 0.1f); camera->xzOffsetUpdateRate = Camera_LERPCeilF(roData->xzUpdRateTarget, camera->xzOffsetUpdateRate, sp90, 0.1f); - camera->yOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_Y_OFFSET_UPDATE_RATE), camera->yOffsetUpdateRate, sp8C, 0.1f); + camera->yOffsetUpdateRate = Camera_LERPCeilF(CAM_Y_OFFSET_UPDATE_RATE, camera->yOffsetUpdateRate, sp8C, 0.1f); - camera->fovUpdateRate = Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE), camera->yOffsetUpdateRate, - camera->speedRatio * 0.05f, 0.1f); - camera->rUpdateRateInv = OREG(27); + camera->fovUpdateRate = + Camera_LERPCeilF(CAM_FOV_UPDATE_RATE, camera->yOffsetUpdateRate, camera->speedRatio * 0.05f, 0.1f); + camera->rUpdateRateInv = CAM_GLOBAL_27; Camera_CalcAtDefault(camera, &atToEyeNextDir, roData->atYOffset, false); adjAtToEyeDir = OLib_Vec3fDiffToVecGeo(at, eye); @@ -2486,16 +2598,14 @@ s32 Camera_Jump2(Camera* camera) { if ((sp90 != BGCHECK_Y_MIN) && (playerPosRot->pos.y < sp90)) { // top of the climb is within 2.2x of the player's height. camera->pitchUpdateRateInv = - Camera_LERPCeilF(20.0f, camera->pitchUpdateRateInv, CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y), 0.1f); - camera->rUpdateRateInv = - Camera_LERPCeilF(20.0f, camera->rUpdateRateInv, CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y), 0.1f); + Camera_LERPCeilF(20.0f, camera->pitchUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_Y, 0.1f); + camera->rUpdateRateInv = Camera_LERPCeilF(20.0f, camera->rUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_Y, 0.1f); adjAtToEyeDir.pitch = Camera_LERPCeilS(0x1F4, atToEyeNextDir.pitch, 1.0f / camera->pitchUpdateRateInv, 0xA); } else if ((playerPosRot->pos.y - rwData->floorY) < playerHeight) { // player is within his height of the ground. camera->pitchUpdateRateInv = - Camera_LERPCeilF(20.0f, camera->pitchUpdateRateInv, CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y), 0.1f); - camera->rUpdateRateInv = - Camera_LERPCeilF(20.0f, camera->rUpdateRateInv, CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y), 0.1f); + Camera_LERPCeilF(20.0f, camera->pitchUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_Y, 0.1f); + camera->rUpdateRateInv = Camera_LERPCeilF(20.0f, camera->rUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_Y, 0.1f); adjAtToEyeDir.pitch = Camera_LERPCeilS(0x1F4, atToEyeNextDir.pitch, 1.0f / camera->pitchUpdateRateInv, 0xA); } else { camera->pitchUpdateRateInv = 100.0f; @@ -2576,12 +2686,12 @@ s32 Camera_Jump3(Camera* camera) { playerhead = Actor_GetFocus(&camera->player->actor); modeSwitch = false; - if (((camera->waterYPos - eye->y) < OREG(44) || (camera->animState == 0))) { + if (((camera->waterYPos - eye->y) < CAM_GLOBAL_44 || (camera->animState == 0))) { if (rwData->mode != CAM_MODE_NORMAL) { rwData->mode = CAM_MODE_NORMAL; modeSwitch = true; } - } else if (((camera->waterYPos - eye->y) > OREG(45)) && (rwData->mode != CAM_MODE_AIM_BOOMERANG)) { + } else if (((camera->waterYPos - eye->y) > CAM_GLOBAL_45) && (rwData->mode != CAM_MODE_AIM_BOOMERANG)) { rwData->mode = CAM_MODE_AIM_BOOMERANG; modeSwitch = true; } @@ -2589,10 +2699,9 @@ s32 Camera_Jump3(Camera* camera) { eyeAtOffset = OLib_Vec3fDiffToVecGeo(at, eye); eyeNextAtOffset = OLib_Vec3fDiffToVecGeo(at, eyeNext); - if (RELOAD_PARAMS(camera) || modeSwitch || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || modeSwitch || CAM_DEBUG_RELOAD_PARAMS) { values = sCameraSettings[camera->setting].cameraModes[rwData->mode].values; - yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); t2 = CAM_DATA_SCALED(playerHeight) * yNormal; roData->yOffset = GET_NEXT_RO_DATA(values) * t2; roData->distMin = GET_NEXT_RO_DATA(values) * t2; @@ -2606,12 +2715,14 @@ s32 Camera_Jump3(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } +#if IS_CAMERA_DEBUG_ENABLED if (R_RELOAD_CAM_PARAMS) { prevMode = camera->mode; camera->mode = rwData->mode; Camera_CopyPREGToModeValues(camera); camera->mode = prevMode; } +#endif sCameraInterfaceField = roData->interfaceField; @@ -2637,9 +2748,9 @@ s32 Camera_Jump3(Camera* camera) { spB0 = *eye; - spC4 = CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ) * camera->speedRatio; - spC0 = camera->speedRatio * CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y); - spBC = rwData->swing.unk_18 != 0 ? CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ) : spC4; + spC4 = CAM_UPDATE_RATE_STEP_SCALE_XZ * camera->speedRatio; + spC0 = camera->speedRatio * CAM_UPDATE_RATE_STEP_SCALE_Y; + spBC = rwData->swing.unk_18 != 0 ? CAM_UPDATE_RATE_STEP_SCALE_XZ : spC4; if (rwData->swing.swingUpdateRateTimer != 0) { camera->yawUpdateRateInv = @@ -2654,12 +2765,10 @@ s32 Camera_Jump3(Camera* camera) { camera->pitchUpdateRateInv = Camera_LERPCeilF(40.0f, camera->pitchUpdateRateInv, spC0, 0.1f); } - camera->xzOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_XZ_OFFSET_UPDATE_RATE), camera->xzOffsetUpdateRate, spC4, 0.1f); - camera->yOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_Y_OFFSET_UPDATE_RATE), camera->yOffsetUpdateRate, spC0, 0.1f); - camera->fovUpdateRate = Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE), camera->yOffsetUpdateRate, - camera->speedRatio * 0.05f, 0.1f); + camera->xzOffsetUpdateRate = Camera_LERPCeilF(CAM_XZ_OFFSET_UPDATE_RATE, camera->xzOffsetUpdateRate, spC4, 0.1f); + camera->yOffsetUpdateRate = Camera_LERPCeilF(CAM_Y_OFFSET_UPDATE_RATE, camera->yOffsetUpdateRate, spC0, 0.1f); + camera->fovUpdateRate = + Camera_LERPCeilF(CAM_FOV_UPDATE_RATE, camera->yOffsetUpdateRate, camera->speedRatio * 0.05f, 0.1f); Camera_CalcAtDefault(camera, &eyeNextAtOffset, roData->yOffset, roData->interfaceField); eyeDiffGeo = OLib_Vec3fDiffToVecGeo(at, eyeNext); @@ -2693,12 +2802,12 @@ s32 Camera_Jump3(Camera* camera) { eyeDiffGeo.pitch = Camera_CalcDefaultPitch(camera, eyeNextAtOffset.pitch, roData->pitchTarget, 0); } - if (eyeDiffGeo.pitch > R_CAM_MAX_PITCH) { - eyeDiffGeo.pitch = R_CAM_MAX_PITCH; + if (eyeDiffGeo.pitch > CAM_MAX_PITCH) { + eyeDiffGeo.pitch = CAM_MAX_PITCH; } - if (eyeDiffGeo.pitch < R_CAM_MIN_PITCH_1) { - eyeDiffGeo.pitch = R_CAM_MIN_PITCH_1; + if (eyeDiffGeo.pitch < CAM_MIN_PITCH_1) { + eyeDiffGeo.pitch = CAM_MIN_PITCH_1; } *eyeNext = Camera_AddVecGeoToVec3f(at, &eyeDiffGeo); @@ -2782,10 +2891,9 @@ s32 Camera_Battle1(Camera* camera) { skipEyeAtCalc = false; player = camera->player; playerHeight = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); roData->yOffset = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->distance = GET_NEXT_RO_DATA(values); @@ -2800,12 +2908,10 @@ s32 Camera_Battle1(Camera* camera) { roData->yOffsetOffGround = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->atLERPScaleOffGround = GET_NEXT_SCALED_RO_DATA(values); rwData->chargeTimer = 40; - rwData->unk_10 = CAM_DATA_SCALED(OREG(12)); + rwData->unk_10 = CAM_GLOBAL_12; } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); distance = roData->distance; sp7C = roData->swingPitchInitial; @@ -2814,12 +2920,12 @@ s32 Camera_Battle1(Camera* camera) { if (camera->player->stateFlags1 & PLAYER_STATE1_12) { // charging sword. - rwData->unk_10 = Camera_LERPCeilF(CAM_DATA_SCALED(OREG(12)) * 0.5f, rwData->unk_10, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ), 0.1f); + rwData->unk_10 = + Camera_LERPCeilF(CAM_GLOBAL_12 * (1.0f - 0.5f), rwData->unk_10, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); camera->xzOffsetUpdateRate = - Camera_LERPCeilF(0.2f, camera->xzOffsetUpdateRate, CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ), 0.1f); + Camera_LERPCeilF(0.2f, camera->xzOffsetUpdateRate, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); camera->yOffsetUpdateRate = - Camera_LERPCeilF(0.2f, camera->yOffsetUpdateRate, CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ), 0.1f); + Camera_LERPCeilF(0.2f, camera->yOffsetUpdateRate, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); if (rwData->chargeTimer > -20) { rwData->chargeTimer--; } else { @@ -2836,17 +2942,16 @@ s32 Camera_Battle1(Camera* camera) { rwData->chargeTimer++; } else { rwData->chargeTimer = 40; - rwData->unk_10 = Camera_LERPCeilF(CAM_DATA_SCALED(OREG(12)), rwData->unk_10, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ), 0.1f); + rwData->unk_10 = Camera_LERPCeilF(CAM_GLOBAL_12, rwData->unk_10, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); camera->xzOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_BATTLE1_XYZ_OFFSET_UPDATE_RATE_TARGET), camera->xzOffsetUpdateRate, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ) * camera->speedRatio, 0.1f); + Camera_LERPCeilF(CAM_BATTLE1_XYZ_OFFSET_UPDATE_RATE_TARGET, camera->xzOffsetUpdateRate, + CAM_UPDATE_RATE_STEP_SCALE_XZ * camera->speedRatio, 0.1f); camera->yOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_BATTLE1_XYZ_OFFSET_UPDATE_RATE_TARGET), camera->yOffsetUpdateRate, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y) * camera->speedRatio, 0.1f); + Camera_LERPCeilF(CAM_BATTLE1_XYZ_OFFSET_UPDATE_RATE_TARGET, camera->yOffsetUpdateRate, + CAM_UPDATE_RATE_STEP_SCALE_Y * camera->speedRatio, 0.1f); } - camera->fovUpdateRate = Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE), camera->fovUpdateRate, - camera->speedRatio * 0.05f, 0.1f); + camera->fovUpdateRate = + Camera_LERPCeilF(CAM_FOV_UPDATE_RATE, camera->fovUpdateRate, camera->speedRatio * 0.05f, 0.1f); playerHeight += roData->yOffset; atToEyeDir = OLib_Vec3fDiffToVecGeo(at, eye); atToEyeNextDir = OLib_Vec3fDiffToVecGeo(at, eyeNext); @@ -2866,6 +2971,8 @@ s32 Camera_Battle1(Camera* camera) { rwData->roll = 0.0f; rwData->target = camera->target; camera->animState++; + +#if IS_CAMERA_DEBUG_ENABLED if (rwData->target->id > 0) { PRINTF("camera: battle: target actor name " VT_FGCOL(BLUE) "%d" VT_RST "\n", rwData->target->id); } else { @@ -2874,7 +2981,9 @@ s32 Camera_Battle1(Camera* camera) { Camera_RequestMode(camera, CAM_MODE_Z_PARALLEL); return true; } - rwData->animTimer = R_CAM_DEFAULT_ANIM_TIME + OREG(24); +#endif + + rwData->animTimer = CAM_DEFAULT_ANIM_TIME + CAM_GLOBAL_24; rwData->initialEyeToAtYaw = atToEyeDir.yaw; rwData->initialEyeToAtPitch = atToEyeDir.pitch; rwData->initialEyeToAtDist = atToEyeDir.r; @@ -2918,33 +3027,31 @@ s32 Camera_Battle1(Camera* camera) { playerHead = playerPosRot->pos; playerHead.y += playerHeight; playerToTargetDir = OLib_Vec3fDiffToVecGeo(&playerHead, &camera->targetPosRot.pos); - distRatio = playerToTargetDir.r > distance ? 1 : playerToTargetDir.r / distance; + distRatio = playerToTargetDir.r > distance ? 1.0f : playerToTargetDir.r / distance; targetPos = camera->targetPosRot.pos; atToTargetDir = OLib_Vec3fDiffToVecGeo(at, &targetPos); atToTargetDir.r = distance - ((atToTargetDir.r <= distance ? atToTargetDir.r : distance) * 0.5f); swingAngle = roData->swingYawInitial + ((roData->swingYawFinal - roData->swingYawInitial) * (1.1f - distRatio)); - spF8 = OREG(13) + swingAngle; + spF8 = swingAngle + CAM_GLOBAL_13; - spB4.r = camera->dist = Camera_LERPCeilF(distance, camera->dist, CAM_DATA_SCALED(OREG(11)), 2.0f); + spB4.r = camera->dist = Camera_LERPCeilF(distance, camera->dist, CAM_GLOBAL_11, 2.0f); spB4.yaw = atToEyeNextDir.yaw; tmpAng1 = (s16)(atToTargetDir.yaw - (s16)(atToEyeNextDir.yaw - 0x7FFF)); if (rwData->animTimer != 0) { - if (rwData->animTimer >= OREG(24)) { - sp86 = rwData->animTimer - OREG(24); + if (rwData->animTimer >= CAM_GLOBAL_24) { + sp86 = rwData->animTimer - CAM_GLOBAL_24; playerToTargetDir = OLib_Vec3fDiffToVecGeo(at, eye); playerToTargetDir.yaw = tmpAng2 - 0x7FFF; - var2 = 1.0f / R_CAM_DEFAULT_ANIM_TIME; + var2 = 1.0f / CAM_DEFAULT_ANIM_TIME; var3 = (rwData->initialEyeToAtDist - playerToTargetDir.r) * var2; tmpAng1 = (s16)(rwData->initialEyeToAtYaw - playerToTargetDir.yaw) * var2; tmpAng2 = (s16)(rwData->initialEyeToAtPitch - playerToTargetDir.pitch) * var2; - spB4.r = - Camera_LERPCeilF(playerToTargetDir.r + (var3 * sp86), atToEyeDir.r, CAM_DATA_SCALED(OREG(28)), 1.0f); - spB4.yaw = Camera_LERPCeilS(playerToTargetDir.yaw + (tmpAng1 * sp86), atToEyeDir.yaw, - CAM_DATA_SCALED(OREG(28)), 0xA); - spB4.pitch = Camera_LERPCeilS(playerToTargetDir.pitch + (tmpAng2 * sp86), atToEyeDir.pitch, - CAM_DATA_SCALED(OREG(28)), 0xA); + spB4.r = Camera_LERPCeilF(playerToTargetDir.r + (var3 * sp86), atToEyeDir.r, CAM_GLOBAL_28, 1.0f); + spB4.yaw = Camera_LERPCeilS(playerToTargetDir.yaw + (tmpAng1 * sp86), atToEyeDir.yaw, CAM_GLOBAL_28, 0xA); + spB4.pitch = + Camera_LERPCeilS(playerToTargetDir.pitch + (tmpAng2 * sp86), atToEyeDir.pitch, CAM_GLOBAL_28, 0xA); } else { skipEyeAtCalc = true; } @@ -2959,7 +3066,7 @@ s32 Camera_Battle1(Camera* camera) { spB4.yaw = (s16)((s16)(atToEyeNextDir.yaw - 0x7FFF) + tmpAng2) - 0x7FFF; } else { spFC = 0.05f; - spFC = (1 - camera->speedRatio) * spFC; + spFC = (1.0f - camera->speedRatio) * spFC; tmpAng2 = tmpAng1 >= 0 ? CAM_DEG_TO_BINANG(swingAngle) : -CAM_DEG_TO_BINANG(swingAngle); spB4.yaw = atToEyeNextDir.yaw - (s16)((tmpAng2 - tmpAng1) * spFC); } @@ -2967,7 +3074,8 @@ s32 Camera_Battle1(Camera* camera) { if (!skipEyeAtCalc) { var3 = atToTargetDir.pitch * roData->swingPitchAdj; var2 = F32_LERPIMP(sp7C, sp78, distRatio); - tmpAng1 = CAM_DEG_TO_BINANG(var2) - (s16)(playerToTargetDir.pitch * (0.5f + distRatio * (1.0f - 0.5f))); + tmpAng1 = + CAM_DEG_TO_BINANG(var2) - (s16)(playerToTargetDir.pitch * ((1.0f - 0.5f) + distRatio * (1.0f - 0.5f))); tmpAng1 += (s16)(var3); if (tmpAng1 < -0x2AA8) { @@ -2995,8 +3103,8 @@ s32 Camera_Battle1(Camera* camera) { *eye = *eyeNext; } } - rwData->roll += ((R_CAM_BATTLE1_ROLL_TARGET_BASE * camera->speedRatio * (1.0f - distRatio)) - rwData->roll) * - CAM_DATA_SCALED(R_CAM_BATTLE1_ROLL_STEP_SCALE); + rwData->roll += ((CAM_BATTLE1_ROLL_TARGET_BASE * camera->speedRatio * (1.0f - distRatio)) - rwData->roll) * + CAM_BATTLE1_ROLL_STEP_SCALE; camera->roll = CAM_DEG_TO_BINANG(rwData->roll); camera->fov = Camera_LERPCeilF((player->meleeWeaponState != 0 ? 0.8f : gSaveContext.save.info.playerData.health <= 0x10 ? 0.8f @@ -3031,10 +3139,9 @@ s32 Camera_Battle4(Camera* camera) { f32 playerHeight; playerHeight = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); roData->yOffset = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->rTarget = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; @@ -3045,9 +3152,7 @@ s32 Camera_Battle4(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); eyeAtOffset = OLib_Vec3fDiffToVecGeo(at, eye); eyeNextAtOffset = OLib_Vec3fDiffToVecGeo(at, eyeNext); @@ -3063,16 +3168,14 @@ s32 Camera_Battle4(Camera* camera) { break; } - camera->yawUpdateRateInv = - Camera_LERPCeilF(roData->lerpUpdateRate, camera->yawUpdateRateInv, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ) * camera->speedRatio, 0.1f); + camera->yawUpdateRateInv = Camera_LERPCeilF(roData->lerpUpdateRate, camera->yawUpdateRateInv, + CAM_UPDATE_RATE_STEP_SCALE_XZ * camera->speedRatio, 0.1f); camera->rUpdateRateInv = 1000.0f; camera->pitchUpdateRateInv = 1000.0f; camera->xzOffsetUpdateRate = - Camera_LERPCeilF(0.025f, camera->xzOffsetUpdateRate, CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ), 0.1f); - camera->yOffsetUpdateRate = - Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_Y_OFFSET_UPDATE_RATE), camera->yOffsetUpdateRate, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y) * camera->speedRatio, 0.1f); + Camera_LERPCeilF(0.025f, camera->xzOffsetUpdateRate, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); + camera->yOffsetUpdateRate = Camera_LERPCeilF(CAM_Y_OFFSET_UPDATE_RATE, camera->yOffsetUpdateRate, + CAM_UPDATE_RATE_STEP_SCALE_Y * camera->speedRatio, 0.1f); camera->fovUpdateRate = 0.0001f; Camera_CalcAtDefault(camera, &eyeNextAtOffset, roData->yOffset, true); if (rwData->animTimer != 0) { @@ -3144,10 +3247,9 @@ s32 Camera_KeepOn1(Camera* camera) { return 1; } - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); roData->unk_00 = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->unk_04 = GET_NEXT_RO_DATA(values); @@ -3163,9 +3265,7 @@ s32 Camera_KeepOn1(Camera* camera) { roData->unk_28 = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->unk_2C = GET_NEXT_SCALED_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); playerHeight += roData->unk_00; spC0 = OLib_Vec3fDiffToVecGeo(at, eye); @@ -3176,7 +3276,7 @@ s32 Camera_KeepOn1(Camera* camera) { rwData->unk_10 = 0; rwData->unk_04 = 0.0f; rwData->unk_0C = camera->target; - rwData->unk_16 = R_CAM_DEFAULT_ANIM_TIME + OREG(24); + rwData->unk_16 = CAM_DEFAULT_ANIM_TIME + CAM_GLOBAL_24; rwData->unk_12 = spC0.yaw; rwData->unk_14 = spC0.pitch; rwData->unk_00 = spC0.r; @@ -3210,14 +3310,12 @@ s32 Camera_KeepOn1(Camera* camera) { rwData->unk_0C = camera->target; camera->atLERPStepScale = 0.0f; } - camera->xzOffsetUpdateRate = - Camera_LERPCeilF(1.0f, camera->xzOffsetUpdateRate, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ) * camera->speedRatio, 0.1f); - camera->yOffsetUpdateRate = - Camera_LERPCeilF(1.0f, camera->yOffsetUpdateRate, - CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_Y) * camera->speedRatio, 0.1f); - camera->fovUpdateRate = Camera_LERPCeilF(CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE), camera->fovUpdateRate, - camera->speedRatio * 0.05f, 0.1f); + camera->xzOffsetUpdateRate = Camera_LERPCeilF(1.0f, camera->xzOffsetUpdateRate, + CAM_UPDATE_RATE_STEP_SCALE_XZ * camera->speedRatio, 0.1f); + camera->yOffsetUpdateRate = Camera_LERPCeilF(1.0f, camera->yOffsetUpdateRate, + CAM_UPDATE_RATE_STEP_SCALE_Y * camera->speedRatio, 0.1f); + camera->fovUpdateRate = + Camera_LERPCeilF(CAM_FOV_UPDATE_RATE, camera->fovUpdateRate, camera->speedRatio * 0.05f, 0.1f); goto cont; case CAM_VIEW_TARGET_POS: rwData->unk_0C = NULL; @@ -3247,41 +3345,40 @@ s32 Camera_KeepOn1(Camera* camera) { spD8 = OLib_Vec3fDiffToVecGeo(at, eyeNext); if (spD8.r < roData->unk_04) { sp104 = roData->unk_04; - spE8 = R_CAM_R_UPDATE_RATE_INV; + spE8 = CAM_R_UPDATE_RATE_INV; } else if (roData->unk_08 < spD8.r) { sp104 = roData->unk_08; - spE8 = R_CAM_R_UPDATE_RATE_INV; + spE8 = CAM_R_UPDATE_RATE_INV; } else { sp104 = spD8.r; spE8 = 1.0f; } - camera->rUpdateRateInv = - Camera_LERPCeilF(spE8, camera->rUpdateRateInv, CAM_DATA_SCALED(R_CAM_UPDATE_RATE_STEP_SCALE_XZ), 0.1f); + camera->rUpdateRateInv = Camera_LERPCeilF(spE8, camera->rUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); spD8.r = spE8 = camera->dist = Camera_LERPCeilF(sp104, camera->dist, 1.0f / camera->rUpdateRateInv, 0.2f); sp108 = camera->targetPosRot.pos; spD0 = OLib_Vec3fDiffToVecGeo(at, &sp108); spD0.r = spE8 - ((spD0.r <= spE8 ? spD0.r : spE8) * 0.5f); spEC = roData->unk_0C + ((roData->unk_10 - roData->unk_0C) * (1.1f - sp84)); - spF0 = OREG(13) + spEC; - spD8.r = camera->dist = Camera_LERPCeilF(spE8, camera->dist, CAM_DATA_SCALED(OREG(11)), 2.0f); + spF0 = spEC + CAM_GLOBAL_13; + spD8.r = camera->dist = Camera_LERPCeilF(spE8, camera->dist, CAM_GLOBAL_11, 2.0f); spD8.yaw = spB8.yaw; spE2 = spD0.yaw - (s16)(spB8.yaw - 0x7FFF); if (rwData->unk_16 != 0) { - if (rwData->unk_16 >= OREG(24)) { - sp82 = rwData->unk_16 - OREG(24); + if (rwData->unk_16 >= CAM_GLOBAL_24) { + sp82 = rwData->unk_16 - CAM_GLOBAL_24; spE2 = spC8.yaw; spC8 = OLib_Vec3fDiffToVecGeo(at, eye); spC8.yaw = spE2 - 0x7FFF; - t2 = 1.0f / R_CAM_DEFAULT_ANIM_TIME; + t2 = 1.0f / CAM_DEFAULT_ANIM_TIME; spE8 = (rwData->unk_00 - spC8.r) * t2; spE2 = (s16)(rwData->unk_12 - spC8.yaw) * t2; spE0 = (s16)(rwData->unk_14 - spC8.pitch) * t2; - spD8.r = Camera_LERPCeilF(spC8.r + (spE8 * sp82), spC0.r, CAM_DATA_SCALED(OREG(28)), 1.0f); - spD8.yaw = Camera_LERPCeilS(spC8.yaw + (spE2 * sp82), spC0.yaw, CAM_DATA_SCALED(OREG(28)), 0xA); - spD8.pitch = Camera_LERPCeilS(spC8.pitch + (spE0 * sp82), spC0.pitch, CAM_DATA_SCALED(OREG(28)), 0xA); + spD8.r = Camera_LERPCeilF(spC8.r + (spE8 * sp82), spC0.r, CAM_GLOBAL_28, 1.0f); + spD8.yaw = Camera_LERPCeilS(spC8.yaw + (spE2 * sp82), spC0.yaw, CAM_GLOBAL_28, 0xA); + spD8.pitch = Camera_LERPCeilS(spC8.pitch + (spE0 * sp82), spC0.pitch, CAM_GLOBAL_28, 0xA); } else { sp88 = 1; } @@ -3313,7 +3410,7 @@ s32 Camera_KeepOn1(Camera* camera) { spE2 = 0x3200; } - spD8.pitch = Camera_LERPCeilS(spE2, spB8.pitch, CAM_DATA_SCALED(OREG(12)), 0xA); + spD8.pitch = Camera_LERPCeilS(spE2, spB8.pitch, CAM_GLOBAL_12, 0xA); *eyeNext = Camera_AddVecGeoToVec3f(at, &spD8); sp8C.pos = *eyeNext; if (camera->status == CAM_STAT_ACTIVE) { @@ -3332,7 +3429,7 @@ s32 Camera_KeepOn1(Camera* camera) { *eye = *eyeNext; } sp120 = OLib_Vec3fDistNormalize(eye, at); - *eye = Camera_Vec3fTranslateByUnitVector(eye, &sp120, OREG(1)); + *eye = Camera_Vec3fTranslateByUnitVector(eye, &sp120, CAM_GLOBAL_1); } camera->fov = Camera_LERPCeilF(roData->unk_20, camera->fov, camera->fovUpdateRate, 1.0f); camera->roll = Camera_LERPCeilS(0, camera->roll, 0.5f, 0xA); @@ -3391,10 +3488,9 @@ s32 Camera_KeepOn3(Camera* camera) { camera->stateFlags &= ~CAM_STATE_LOCK_MODE; } camera->stateFlags &= ~CAM_STATE_CAM_FUNC_FINISH; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); roData->yOffset = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->minDist = GET_NEXT_RO_DATA(values); @@ -3410,9 +3506,7 @@ s32 Camera_KeepOn3(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); playerHeight += roData->yOffset; atToEyeDir = OLib_Vec3fDiffToVecGeo(at, eye); @@ -3584,7 +3678,7 @@ s32 Camera_KeepOn4(Camera* camera) { playerHeight = Player_GetHeight(camera->player); camera->stateFlags &= ~CAM_STATE_CAM_FUNC_FINISH; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; f32 yNormal = 1.0f + t - (68.0f / playerHeight * t); @@ -3684,12 +3778,12 @@ s32 Camera_KeepOn4(Camera* camera) { roData->unk_00 = playerHeight * -0.3f * yNormal; roData->unk_04 = playerHeight * 1.5f * yNormal; roData->unk_08 = 2.0f; + roData->unk_18 = 45.0f; roData->unk_0C = 20.0f; roData->unk_10 = 20.0f; roData->interfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_MEDIUM, CAM_HUD_VISIBILITY_NOTHING_ALT, KEEPON4_FLAG_7); roData->unk_1E = 0x1E; - roData->unk_18 = 45.0f; break; case 11: @@ -3706,9 +3800,7 @@ s32 Camera_KeepOn4(Camera* camera) { } } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sUpdateCameraDirection = 1; sCameraInterfaceField = roData->interfaceField; @@ -3785,7 +3877,9 @@ s32 Camera_KeepOn4(Camera* camera) { spB8.pitch = D_8011D3CC[i] + spA2; D_8015BD70 = Camera_AddVecGeoToVec3f(&D_8015BD50, &spB8); } +#if IS_CAMERA_DEBUG_ENABLED PRINTF("camera: item: BG&collision check %d time(s)\n", i); +#endif } rwData->unk_04 = (s16)(spB8.pitch - spA8.pitch) / (f32)rwData->unk_10; rwData->unk_00 = (s16)(spB8.yaw - spA8.yaw) / (f32)rwData->unk_10; @@ -3865,7 +3959,7 @@ s32 Camera_KeepOn0(Camera* camera) { camera->stateFlags &= ~CAM_STATE_CAM_FUNC_FINISH; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; roData->fovScale = GET_NEXT_SCALED_RO_DATA(values); @@ -3874,9 +3968,7 @@ s32 Camera_KeepOn0(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); bgCamFuncData = (BgCamFuncData*)Camera_GetBgCamFuncData(camera); *eyeNext = Camera_Vec3sToVec3f(&bgCamFuncData->pos); @@ -3940,7 +4032,7 @@ s32 Camera_Fixed1(Camera* camera) { f32 playerHeight; playerHeight = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; bgCamFuncData = (BgCamFuncData*)Camera_GetBgCamFuncData(camera); @@ -3954,9 +4046,7 @@ s32 Camera_Fixed1(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); if (rwData->fov == -1) { rwData->fov = roData->fov * 100.0f; } else if (rwData->fov <= 360) { @@ -4014,10 +4104,9 @@ s32 Camera_Fixed2(Camera* camera) { playerHeight = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); roData->yOffset = (GET_NEXT_SCALED_RO_DATA(values) * playerHeight) * yNormal; roData->eyeStepScale = GET_NEXT_SCALED_RO_DATA(values); @@ -4040,9 +4129,7 @@ s32 Camera_Fixed2(Camera* camera) { } } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sCameraInterfaceField = roData->interfaceField; @@ -4097,7 +4184,7 @@ s32 Camera_Fixed3(Camera* camera) { eyeAtOffset = OLib_Vec3fDiffToVecGeo(eye, at); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; roData->interfaceField = GET_NEXT_RO_DATA(values); @@ -4114,9 +4201,7 @@ s32 Camera_Fixed3(Camera* camera) { } } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); if (camera->animState == 0) { rwData->updDirTimer = 5; @@ -4172,10 +4257,9 @@ s32 Camera_Fixed4(Camera* camera) { playerYOffset = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerYOffset)); + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerYOffset)); roData->yOffset = GET_NEXT_SCALED_RO_DATA(values) * playerYOffset * yNormal; roData->speedToEyePos = GET_NEXT_SCALED_RO_DATA(values); @@ -4190,9 +4274,7 @@ s32 Camera_Fixed4(Camera* camera) { rwData->eyeTarget = *eye; } } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sCameraInterfaceField = roData->interfaceField; if (camera->animState == 0) { camera->animState++; @@ -4276,7 +4358,11 @@ s32 Camera_Subj3(Camera* camera) { } func_80043ABC(camera); + +#if IS_CAMERA_DEBUG_ENABLED Camera_CopyPREGToModeValues(camera); +#endif + values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; roData->eyeNextYOffset = GET_NEXT_SCALED_RO_DATA(values) * playerHeight; roData->eyeDist = GET_NEXT_RO_DATA(values); @@ -4301,7 +4387,7 @@ s32 Camera_Subj3(Camera* camera) { rwData->r = sp7C.r; rwData->yaw = sp7C.yaw; rwData->pitch = sp7C.pitch; - rwData->animTimer = R_CAM_DEFAULT_ANIM_TIME; + rwData->animTimer = CAM_DEFAULT_ANIM_TIME; camera->dist = roData->eyeNextDist; camera->animState++; camera->rUpdateRateInv = 1.0f; @@ -4317,15 +4403,14 @@ s32 Camera_Subj3(Camera* camera) { at->y = F32_LERPIMP(at->y, sp98.y, temp_f0_3); at->z = F32_LERPIMP(at->z, sp98.z, temp_f0_3); - temp_f0_3 = (1.0f / R_CAM_DEFAULT_ANIM_TIME); + temp_f0_3 = (1.0f / CAM_DEFAULT_ANIM_TIME); sp58 = (tGeo.r - sp84.r) * temp_f0_3; sp52 = (s16)(tGeo.yaw - sp84.yaw) * temp_f0_3; sp50 = (s16)(tGeo.pitch - sp84.pitch) * temp_f0_3; - sp7C.r = Camera_LERPCeilF(sp84.r + (sp58 * rwData->animTimer), sp7C.r, CAM_DATA_SCALED(OREG(28)), 1.0f); - sp7C.yaw = Camera_LERPCeilS(sp84.yaw + (sp52 * rwData->animTimer), sp7C.yaw, CAM_DATA_SCALED(OREG(28)), 0xA); - sp7C.pitch = - Camera_LERPCeilS(sp84.pitch + (sp50 * rwData->animTimer), sp7C.pitch, CAM_DATA_SCALED(OREG(28)), 0xA); + sp7C.r = Camera_LERPCeilF(sp84.r + (sp58 * rwData->animTimer), sp7C.r, CAM_GLOBAL_28, 1.0f); + sp7C.yaw = Camera_LERPCeilS(sp84.yaw + (sp52 * rwData->animTimer), sp7C.yaw, CAM_GLOBAL_28, 0xA); + sp7C.pitch = Camera_LERPCeilS(sp84.pitch + (sp50 * rwData->animTimer), sp7C.pitch, CAM_GLOBAL_28, 0xA); *eyeNext = Camera_AddVecGeoToVec3f(at, &sp7C); *eye = *eyeNext; @@ -4389,13 +4474,13 @@ s32 Camera_Subj4(Camera* camera) { Vec3f temp1; Vec3f zoomAtTarget; f32 temp2; - Player* player; + s32 pad1; f32 eyeLerp; PosRot playerPosRot; VecGeo targetOffset; VecGeo atEyeOffset; s16 eyeToAtYaw; - s32 pad[2]; + s32 pad2; f32 temp; Subj4ReadOnlyData* roData = &camera->paramData.subj4.roData; Subj4ReadWriteData* rwData = &camera->paramData.subj4.rwData; @@ -4405,15 +4490,13 @@ s32 Camera_Subj4(Camera* camera) { #define vPlayerDistToFront temp2 #define vZoomTimer temp2 - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); if (camera->play->view.unk_124 == 0) { camera->play->view.unk_124 = camera->camId | 0x50; @@ -4513,7 +4596,8 @@ s32 Camera_Subj4(Camera* camera) { // When camera reaches the peak of offset and starts to move down // && alternating cycles (sfx plays only every 2nd cycle) if ((eyeLerp > rwData->eyeLerp) && !rwData->isSfxOff) { - player = camera->player; + Player* player = camera->player; + rwData->isSfxOff = true; func_800F4010(&player->actor.projectedPos, NA_SE_PL_CRAWL + player->floorSfxOffset, 4.0f); } else if (eyeLerp < rwData->eyeLerp) { @@ -4570,19 +4654,18 @@ s32 Camera_Data4(Camera* camera) { Vec3f* eyeNext = &camera->eyeNext; BgCamFuncData* bgCamFuncData; Vec3f lookAt; - CameraModeValue* values; + s32 pad; Data4ReadWriteData* rwData = &camera->paramData.data4.rwData; Vec3f* eye = &camera->eye; f32 playerHeight; Vec3f* at = &camera->at; - s32 pad; playerHeight = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { - values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { + CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + + yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); roData->yOffset = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->fov = GET_NEXT_RO_DATA(values); roData->interfaceField = GET_NEXT_RO_DATA(values); @@ -4600,9 +4683,7 @@ s32 Camera_Data4(Camera* camera) { *eye = rwData->eyePosRot.pos; } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sCameraInterfaceField = roData->interfaceField; @@ -4655,10 +4736,9 @@ s32 Camera_Unique1(Camera* camera) { s32 pad2; playerHeight = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); roData->yOffset = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->distMin = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; @@ -4669,9 +4749,7 @@ s32 Camera_Unique1(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS != 0) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sUpdateCameraDirection = 1; @@ -4686,7 +4764,7 @@ s32 Camera_Unique1(Camera* camera) { rwData->unk_00 = 0.0f; playerWaistPos = camera->player->bodyPartsPos[PLAYER_BODYPART_WAIST]; unk908PlayerPosOffset = OLib_Vec3fDiffToVecGeo(&playerPosRot->pos, &playerWaistPos); - rwData->timer = R_CAM_DEFAULT_ANIM_TIME; + rwData->timer = CAM_DEFAULT_ANIM_TIME; rwData->yawTargetAdj = ABS((s16)(unk908PlayerPosOffset.yaw - eyeAtOffset.yaw)) < 0x3A98 ? 0 : (((s16)(unk908PlayerPosOffset.yaw - eyeAtOffset.yaw) / rwData->timer) / 4) * 3; @@ -4695,15 +4773,13 @@ s32 Camera_Unique1(Camera* camera) { playerhead = Actor_GetFocus(&camera->player->actor); // unused - camera->yawUpdateRateInv = - Camera_LERPCeilF(100.0f, camera->yawUpdateRateInv, R_CAM_UPDATE_RATE_STEP_SCALE_XZ * 0.01f, 0.1f); + camera->yawUpdateRateInv = Camera_LERPCeilF(100.0f, camera->yawUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); camera->pitchUpdateRateInv = - Camera_LERPCeilF(100.0f, camera->pitchUpdateRateInv, R_CAM_UPDATE_RATE_STEP_SCALE_XZ * 0.01f, 0.1f); + Camera_LERPCeilF(100.0f, camera->pitchUpdateRateInv, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.1f); camera->xzOffsetUpdateRate = - Camera_LERPCeilF(0.005f, camera->xzOffsetUpdateRate, R_CAM_UPDATE_RATE_STEP_SCALE_XZ * 0.01f, 0.01f); - camera->yOffsetUpdateRate = - Camera_LERPCeilF(0.01f, camera->yOffsetUpdateRate, R_CAM_UPDATE_RATE_STEP_SCALE_Y * 0.01f, 0.01f); - camera->fovUpdateRate = Camera_LERPCeilF(R_CAM_FOV_UPDATE_RATE * 0.01f, camera->fovUpdateRate, 0.05f, 0.1f); + Camera_LERPCeilF(0.005f, camera->xzOffsetUpdateRate, CAM_UPDATE_RATE_STEP_SCALE_XZ, 0.01f); + camera->yOffsetUpdateRate = Camera_LERPCeilF(0.01f, camera->yOffsetUpdateRate, CAM_UPDATE_RATE_STEP_SCALE_Y, 0.01f); + camera->fovUpdateRate = Camera_LERPCeilF(CAM_FOV_UPDATE_RATE, camera->fovUpdateRate, 0.05f, 0.1f); Camera_CalcAtDefault(camera, &eyeNextAtOffset, roData->yOffset, true); sp8C = OLib_Vec3fDiffToVecGeo(at, eyeNext); @@ -4713,11 +4789,11 @@ s32 Camera_Unique1(Camera* camera) { phiTarget = roData->pitchTarget; sp8C.pitch = Camera_LERPCeilS(phiTarget, eyeNextAtOffset.pitch, 1.0f / camera->pitchUpdateRateInv, 0xA); - if (sp8C.pitch > R_CAM_MAX_PITCH) { - sp8C.pitch = R_CAM_MAX_PITCH; + if (sp8C.pitch > CAM_MAX_PITCH) { + sp8C.pitch = CAM_MAX_PITCH; } - if (sp8C.pitch < -R_CAM_MAX_PITCH) { - sp8C.pitch = -R_CAM_MAX_PITCH; + if (sp8C.pitch < -CAM_MAX_PITCH) { + sp8C.pitch = -CAM_MAX_PITCH; } if (rwData->timer != 0) { @@ -4753,10 +4829,9 @@ s32 Camera_Unique2(Camera* camera) { eyeAtOffset = OLib_Vec3fDiffToVecGeo(at, eye); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); roData->yOffset = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->distTarget = GET_NEXT_RO_DATA(values); @@ -4764,9 +4839,7 @@ s32 Camera_Unique2(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sCameraInterfaceField = roData->interfaceField; @@ -4830,19 +4903,16 @@ s32 Camera_Unique3(Camera* camera) { playerHeight = Player_GetHeight(camera->player); camera->stateFlags &= ~CAM_STATE_CAM_FUNC_FINISH; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerHeight)); + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerHeight)); roData->yOffset = GET_NEXT_SCALED_RO_DATA(values) * playerHeight * yNormal; roData->fov = GET_NEXT_RO_DATA(values); roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS != 0) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sCameraInterfaceField = roData->interfaceField; @@ -4942,7 +5012,7 @@ s32 Camera_Unique3(Camera* camera) { */ s32 Camera_Unique0(Camera* camera) { f32 yOffset; - CameraModeValue* values; + s16 fov; Player* player; Vec3f playerPosWithOffset; VecGeo atPlayerOffset; @@ -4953,19 +5023,17 @@ s32 Camera_Unique0(Camera* camera) { Unique0ReadOnlyData* roData = &camera->paramData.uniq0.roData; Unique0ReadWriteData* rwData = &camera->paramData.uniq0.rwData; Vec3f* eye = &camera->eye; - s16 fov; yOffset = Player_GetHeight(camera->player); player = camera->player; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { - values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { + CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); playerPosWithOffset = playerPosRot->pos; playerPosWithOffset.y += yOffset; @@ -5072,19 +5140,17 @@ s32 Camera_Unique5(Camera* camera) { */ s32 Camera_Unique6(Camera* camera) { Unique6ReadOnlyData* roData = &camera->paramData.uniq6.roData; - CameraModeValue* values; + f32 offset; Vec3f sp2C; PosRot* playerPosRot = &camera->playerPosRot; - f32 offset; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { - values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { + CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sCameraInterfaceField = roData->interfaceField; @@ -5119,25 +5185,23 @@ s32 Camera_Unique6(Camera* camera) { s32 Camera_Unique7(Camera* camera) { s32 pad; Unique7ReadOnlyData* roData = &camera->paramData.uniq7.roData; - CameraModeValue* values; + PosRot* playerPosRot = &camera->playerPosRot; VecGeo playerPosEyeOffset; s16 fov; BgCamFuncData* bgCamFuncData; UNUSED Vec3s bgCamRot; Vec3f* at = &camera->at; - PosRot* playerPosRot = &camera->playerPosRot; Vec3f* eye = &camera->eye; Vec3f* eyeNext = &camera->eyeNext; Unique7ReadWriteData* rwData = &camera->paramData.uniq7.rwData; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { - values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { + CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + roData->fov = GET_NEXT_RO_DATA(values); roData->interfaceField = (s16)GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); bgCamFuncData = (BgCamFuncData*)Camera_GetBgCamFuncData(camera); @@ -5208,17 +5272,14 @@ s32 Camera_Unique9(Camera* camera) { f32 spB4; PosRot atFocusPosRot; Vec3f eyeLookAtPos; - CameraModeValue* values; - PosRot eyeFocusPosRot; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { - values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { + CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sCameraInterfaceField = roData->interfaceField; @@ -5260,7 +5321,7 @@ s32 Camera_Unique9(Camera* camera) { PRINTF("camera: demo: player demo set WAIT\n"); } else { PRINTF("camera: demo: player demo set %d\n", rwData->curKeyFrame->initField); - Player_SetCsAction(camera->play, camera->target, rwData->curKeyFrame->initField); + Player_SetCsAction(camera->play, camera->target, rwData->curKeyFrame->initField & 0xFF); } } } @@ -5415,6 +5476,8 @@ s32 Camera_Unique9(Camera* camera) { } if (focusActor != NULL) { + PosRot eyeFocusPosRot; + if ((eyeFlags & 0xF00) == 0x100) { // head eyeFocusPosRot = Actor_GetFocus(focusActor); @@ -5668,6 +5731,7 @@ s32 Camera_Unique9(Camera* camera) { return true; } +#if IS_CAMERA_DEBUG_ENABLED void Camera_DebugPrintSplineArray(char* name, s16 length, CutsceneCameraPoint cameraPoints[]) { s32 i; @@ -5684,6 +5748,7 @@ void Camera_DebugPrintSplineArray(char* name, s16 length, CutsceneCameraPoint ca } PRINTF("};\n\n"); } +#endif /** * Copies `src` to `dst`, used in Camera_Demo1 @@ -5717,7 +5782,7 @@ void Camera_RotateAroundPoint(PosRot* at, Vec3f* pos, Vec3f* dst) { s32 Camera_Demo1(Camera* camera) { s32 pad; Demo1ReadOnlyData* roData = &camera->paramData.demo1.roData; - CameraModeValue* values; + f32* cameraFOV = &camera->fov; Vec3f* at = &camera->at; CutsceneCameraPoint* csAtPoints = (CutsceneCameraPoint*)camera->data0; CutsceneCameraPoint* csEyePoints = (CutsceneCameraPoint*)camera->data1; @@ -5727,12 +5792,12 @@ s32 Camera_Demo1(Camera* camera) { Vec3f csAtUpdate; f32 newRoll; Vec3f* eyeNext = &camera->eyeNext; - f32* cameraFOV = &camera->fov; s16* relativeToPlayer = &camera->data2; Demo1ReadWriteData* rwData = &camera->paramData.demo1.rwData; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { - values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { + CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + roData->interfaceField = GET_NEXT_RO_DATA(values); } @@ -5748,10 +5813,12 @@ s32 Camera_Demo1(Camera* camera) { PRINTF(VT_SGR("1") "%06u:" VT_RST " camera: spline demo: start %s \n", camera->play->state.frames, *relativeToPlayer == 0 ? "絶対" : "相対"); +#if IS_CAMERA_DEBUG_ENABLED if (PREG(93)) { Camera_DebugPrintSplineArray("CENTER", 5, csAtPoints); Camera_DebugPrintSplineArray(" EYE", 5, csEyePoints); } +#endif FALLTHROUGH; case 1: // follow CutsceneCameraPoints. function returns 1 if at the end. @@ -5766,9 +5833,12 @@ s32 Camera_Demo1(Camera* camera) { curPlayerPosRot = Actor_GetWorld(&camera->player->actor); Camera_RotateAroundPoint(&curPlayerPosRot, &csEyeUpdate, eyeNext); Camera_RotateAroundPoint(&curPlayerPosRot, &csAtUpdate, at); - } else { + } +#if IS_CAMERA_DEBUG_ENABLED + else { PRINTF(VT_COL(RED, WHITE) "camera: spline demo: owner dead\n" VT_RST); } +#endif } else { // simply copy the interpolated values to the eye and at Camera_Vec3fCopy(&csEyeUpdate, eyeNext); @@ -5813,7 +5883,7 @@ s32 Camera_Demo3(Camera* camera) { camera->stateFlags &= ~CAM_STATE_CAM_FUNC_FINISH; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; roData->fov = GET_NEXT_RO_DATA(values); @@ -5821,9 +5891,7 @@ s32 Camera_Demo3(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); eyeAtOffset = OLib_Vec3fDiffToVecGeo(at, eye); @@ -5990,6 +6058,8 @@ s32 Camera_Demo3(Camera* camera) { camera->animState = 4; } + if (1) {} + if (!skipUpdateEye) { eyeOffset.r = Camera_LERPCeilF(eyeOffset.r, eyeAtOffset.r, rwData->unk_0C, 2.0f); eyeOffset.pitch = Camera_LERPCeilS(eyeOffset.pitch, eyeAtOffset.pitch, rwData->unk_0C, 0xA); @@ -6014,6 +6084,7 @@ s32 Camera_Demo4(Camera* camera) { * Sets up a OnePoint attention cutscene */ s32 Camera_Demo5(Camera* camera) { + static s32 sDemo5PrevSfxFrame = -200; f32 eyeTargetDist; f32 sp90; VecGeo playerTargetGeo; @@ -6053,6 +6124,54 @@ s32 Camera_Demo5(Camera* camera) { if (camera->target->category == ACTORCAT_PLAYER) { // camera is targeting a(the) player actor if (eyePlayerGeo.r > 30.0f) { + // target is player, far from eye + static OnePointCsFull D_8011D6AC[] = { + { + // viewFlags & 0x00FF (at): 2, atTarget is view lookAt + atInit + // viewFlags & 0xFF00 (eye): none + // action: 15, copy at, eye, roll, fov to camera + // result: eye remains in the same location, at is View's lookAt + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0002, + 1, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + // viewFlags & 0x00FF (at): 3, atTarget is camera's current at + atInit + // viewFlags & 0xFF00 (eye): 3, eyeTarget is the camera's current eye + eyeInit + // action: interpolate eye and at. + // result: eye and at's y interpolate to become +20 from their current location. + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0303, + 19, + 0, + 45.0f, + 1.0f, + { 0.0f, 20.0f, 0.0f }, + { 0.0f, 20.0f, 0.0f }, + }, + { + // viewFlags & 0x00FF (at): 0 none + // viewFlags & 0xFF00 (eye): 0 none + // action: 18, copy this camera to default camera. + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + D_8011D6AC[1].timerInit = camera->timer - 1; D_8011D6AC[1].atTargetInit.z = Rand_ZeroOne() * 10.0f; D_8011D6AC[1].eyeTargetInit.x = Rand_ZeroOne() * 10.0f; @@ -6064,6 +6183,43 @@ s32 Camera_Demo5(Camera* camera) { camera->timer += D_8011D6AC[2].timerInit; } } else { + // target is player close to current eye + static OnePointCsFull D_8011D724[] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2424, + 1, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 10.0f, -20.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 19, + 0, + 50.0f, + 1.0f, + { 0.0f, -10.0f, 0.0f }, + { 0.0f, 0.0f, 60.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + D_8011D724[1].eyeTargetInit.x = Rand_ZeroOne() * 10.0f; D_8011D724[1].timerInit = camera->timer - 1; ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D724; @@ -6076,6 +6232,53 @@ s32 Camera_Demo5(Camera* camera) { } } else if (playerTargetGeo.r < 30.0f) { // distance between player and target is less than 30 units. + static OnePointCsFull D_8011D79C[] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0002, + 1, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0303, + 19, + 0, + 45.0f, + 1.0f, + { 0.0f, -20.0f, 0.0f }, + { 0.0f, -10.0f, 5.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0303, + 9, + 0, + 60.0f, + 1.0f, + { 0.0f, 10.0f, 0.0f }, + { 0.0f, 10.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D79C; ONEPOINT_CS_INFO(camera)->keyFrameCount = ARRAY_COUNT(D_8011D79C); if ((targetScreenPosX <= 20) || (targetScreenPosX >= SCREEN_WIDTH - 20) || (targetScreenPosY <= 40) || @@ -6099,6 +6302,31 @@ s32 Camera_Demo5(Camera* camera) { } else if (eyeTargetDist < 300.0f && eyePlayerGeo.r < 30.0f) { // distance from the camera's current positon and the target is less than 300 units // and the distance fromthe camera's current position to the player is less than 30 units + static OnePointCsFull D_8011D83C[] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2141, + 20, + 0, + 45.0f, + 0.2f, + { 0.0f, 0.0f, 10.0f }, + { 0.0f, 0.0f, 10.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + D_8011D83C[0].timerInit = camera->timer; ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D83C; ONEPOINT_CS_INFO(camera)->keyFrameCount = ARRAY_COUNT(D_8011D83C); @@ -6113,6 +6341,33 @@ s32 Camera_Demo5(Camera* camera) { // is less than ~76.9 degrees if ((targetScreenPosX > 20) && (targetScreenPosX < SCREEN_WIDTH - 20) && (targetScreenPosY > 40) && (targetScreenPosY < SCREEN_HEIGHT - 40) && (eyePlayerGeo.r > 30.0f)) { + // The x/y coordinates of the target on screen is between (21, 41) and (300, 200), + // and the player is farther than 30 units of the eye + static OnePointCsFull D_8011D88C[] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0303, + 20, + 0, + 45.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + D_8011D88C[0].timerInit = camera->timer; ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D88C; ONEPOINT_CS_INFO(camera)->keyFrameCount = ARRAY_COUNT(D_8011D88C); @@ -6122,6 +6377,43 @@ s32 Camera_Demo5(Camera* camera) { camera->timer += D_8011D88C[1].timerInit; } } else { + // same as above, but the target is NOT within the screen area. + static OnePointCsFull D_8011D8DC[] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0404, + 20, + 1, + 50.0f, + 1.0f, + { 0.0f, 5.0f, 10.0f }, + { 0.0f, 10.0f, -80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 5, + 0, + 60.0f, + 1.0f, + { 0.0f, 5.0f, 0.0f }, + { 5.0f, 5.0f, -200.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + D_8011D8DC[0].atTargetInit.z = eyeTargetDist * 0.6f; D_8011D8DC[0].eyeTargetInit.z = eyeTargetDist + 50.0f; D_8011D8DC[0].eyeTargetInit.x = Rand_ZeroOne() * 10.0f; @@ -6142,6 +6434,53 @@ s32 Camera_Demo5(Camera* camera) { } } else if (camera->target->category == ACTORCAT_DOOR) { // the target is a door. + static OnePointCsFull D_8011D954[] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0xC1C1, + 20, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 50.0f }, + { 0.0f, 0.0f, 250.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x05B1, + 5, + 0, + 60.0f, + 0.1f, + { 0.0f, 10.0f, 50.0f }, + { 0.0f, 10.0f, 100.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 5, + 2, + 60.0f, + 1.0f, + { 0.0f, 10.0f, 0.0f }, + { 0.0f, 20.0f, -150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + D_8011D954[0].timerInit = camera->timer - 5; sp4A = 0; if (!func_800C0D34(camera->play, camera->target, &sp4A)) { @@ -6177,6 +6516,43 @@ s32 Camera_Demo5(Camera* camera) { camera->timer += D_8011D954[2].timerInit + D_8011D954[3].timerInit; } } else { + // otherwise + static OnePointCsFull D_8011D9F4[] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0504, + 20, + 2, + 60.0f, + 1.0f, + { 0.0f, 5.0f, 50.0f }, + { 0.0f, 20.0f, 300.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 5, + 2, + 60.0f, + 1.0f, + { 0.0f, 10.0f, 0.0f }, + { 0.0f, 20.0f, -150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + if (playerTargetGeo.r < 200.0f) { D_8011D9F4[0].eyeTargetInit.z = playerTargetGeo.r; D_8011D9F4[0].atTargetInit.z = playerTargetGeo.r * 0.25f; @@ -6254,12 +6630,11 @@ s32 Camera_Demo6(Camera* camera) { Camera* mainCam; Demo6ReadOnlyData* roData = &camera->paramData.demo6.roData; Vec3f* eyeNext = &camera->eyeNext; - CameraModeValue* values; + Demo6ReadWriteData* rwData = &camera->paramData.demo6.rwData; VecGeo eyeOffset; Actor* camFocus; PosRot focusPosRot; s16 stateTimers[4]; - Demo6ReadWriteData* rwData = &camera->paramData.demo6.rwData; mainCam = Play_GetCamera(camera->play, CAM_ID_MAIN); camFocus = camera->target; @@ -6267,14 +6642,13 @@ s32 Camera_Demo6(Camera* camera) { stateTimers[2] = 70; stateTimers[3] = 90; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { - values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { + CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); switch (camera->animState) { case 0: @@ -6357,12 +6731,11 @@ s32 Camera_Demo9(Camera* camera) { Vec3f newEye; Vec3f newAt; f32 newRoll; - CameraModeValue* values; + s32 pad3; Camera* mainCam; Vec3f* eye = &camera->eye; PosRot* mainCamPlayerPosRot; PosRot focusPosRot; - s32 pad3; Vec3f* eyeNext = &camera->eyeNext; Demo9ReadOnlyData* roData = &camera->paramData.demo9.roData; Vec3f* at = &camera->at; @@ -6371,14 +6744,13 @@ s32 Camera_Demo9(Camera* camera) { mainCam = Play_GetCamera(camera->play, CAM_ID_MAIN); mainCamPlayerPosRot = &mainCam->playerPosRot; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { - values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { + CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; + roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sCameraInterfaceField = roData->interfaceField; @@ -6494,16 +6866,14 @@ s32 Camera_Special0(Camera* camera) { PosRot* playerPosRot = &camera->playerPosRot; Special0ReadOnlyData* roData = &camera->paramData.spec0.roData; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; roData->lerpAtScale = GET_NEXT_SCALED_RO_DATA(values); roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sCameraInterfaceField = roData->interfaceField; @@ -6604,10 +6974,9 @@ s32 Camera_Special5(Camera* camera) { f32 yOffset; yOffset = Player_GetHeight(camera->player); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - f32 yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / yOffset)); + f32 yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / yOffset)); roData->yOffset = (GET_NEXT_SCALED_RO_DATA(values) * yOffset) * yNormal; roData->eyeDist = GET_NEXT_RO_DATA(values); @@ -6619,9 +6988,7 @@ s32 Camera_Special5(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); sp64 = OLib_Vec3fDiffToVecGeo(at, eye); sp5C = OLib_Vec3fDiffToVecGeo(at, eyeNext); @@ -6664,13 +7031,59 @@ s32 Camera_Special5(Camera* camera) { } Camera_CalcAtDefault(camera, &sp5C, roData->yOffset, false); - camera->fov = Camera_LERPCeilF(roData->fovTarget, camera->fov, - camera->atLERPStepScale * CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE), 1.0f); + camera->fov = Camera_LERPCeilF(roData->fovTarget, camera->fov, camera->atLERPStepScale * CAM_FOV_UPDATE_RATE, 1.0f); camera->roll = Camera_LERPCeilS(0, camera->roll, 0.5f, 0xA); camera->atLERPStepScale = Camera_ClampLERPScale(camera, roData->atMaxLERPScale); return true; } +typedef enum { + /* 0 */ CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR, // ACTOR_BG_HIDAN_ROCK + /* 1 */ CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER, // ACTOR_BG_HIDAN_FSLIFT + /* 2 */ CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER, // ACTOR_BG_HIDAN_SYOKU + /* 3 */ CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE // ACTOR_BG_JYA_1FLIFT +} CamElevatorPlatform; + +Vec3f sCamElevatorPlatformLowerEyePoints[] = { + { 3050.0f, 700.0f, 0.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR + { 1755.0f, 3415.0f, -380.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER + { -3120.0f, 3160.0f, 245.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER + { 0.0f, -10.0f, 240.0f }, // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE +}; + +Vec3f sCamElevatorPlatformUpperEyePoints[] = { + { 3160.0f, 2150.0f, 0.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR + { 1515.0f, 4130.0f, -835.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER + { -3040.0f, 4135.0f, 230.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER + { -50.0f, 600.0f, -75.0f }, // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE +}; + +// Trigger player y position to swap eye points +f32 sCamElevatorPlatformTogglePosY[] = { + 1570.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR + 3680.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER + 3700.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER + 395.0f, // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE +}; + +f32 sCamElevatorPlatformFovRollParam[] = { + 320.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR + 320.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER + 320.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER + 0.0f, // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE +}; + +s16 sCamElevatorPlatformRolls[] = { + -2000, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR + -1000, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER + 0, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER + 0 // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE +}; + +// unused +s32 D_8011DAF4 = 0; +s32 D_8011DAF8 = 0; + /** * Camera's eye is fixed at points specified at lower or upper points depending on the player's position. * Designed around 4 specific elevator platforms, 1 in spirit temple and 3 in fire temple. @@ -6766,15 +7179,13 @@ s32 Camera_Special6(Camera* camera) { Special6ReadWriteData* rwData = &camera->paramData.spec6.rwData; s32 pad; - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); eyeAtOffset = OLib_Vec3fDiffToVecGeo(eye, at); @@ -6877,10 +7288,9 @@ s32 Camera_Special9(Camera* camera) { playerYOffset = Player_GetHeight(camera->player); camera->stateFlags &= ~CAM_STATE_CAM_FUNC_FINISH; - yNormal = - 1.0f + CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) - (CAM_DATA_SCALED(R_CAM_YOFFSET_NORM) * (68.0f / playerYOffset)); + yNormal = 1.0f + CAM_YOFFSET_NORM - (CAM_YOFFSET_NORM * (68.0f / playerYOffset)); - if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { + if (RELOAD_PARAMS(camera) || CAM_DEBUG_RELOAD_PARAMS) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; roData->yOffset = GET_NEXT_SCALED_RO_DATA(values) * playerYOffset * yNormal; @@ -6888,9 +7298,7 @@ s32 Camera_Special9(Camera* camera) { roData->interfaceField = GET_NEXT_RO_DATA(values); } - if (R_RELOAD_CAM_PARAMS) { - Camera_CopyPREGToModeValues(camera); - } + CAM_DEBUG_RELOAD_PREG(camera); if (doorParams->doorActor != NULL) { referencePosRot = Actor_GetWorldPosShapeRot(doorParams->doorActor); @@ -7034,12 +7442,14 @@ void Camera_Destroy(Camera* camera) { void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState* play) { Camera* camP; - s32 i; s16 curUID; s16 j; __osMemset(camera, 0, sizeof(Camera)); if (sInitRegs) { + s32 i; + +#if IS_CAMERA_DEBUG_ENABLED for (i = 0; i < sOREGInitCnt; i++) { OREG(i) = sOREGInit[i]; } @@ -7049,11 +7459,16 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState } DebugCamera_Reset(camera, &D_8015BD80); +#endif sInitRegs = false; PREG(88) = -1; } camera->play = D_8015BD7C = play; + +#if IS_CAMERA_DEBUG_ENABLED DebugCamera_Init(&D_8015BD80, camera); +#endif + curUID = sNextUID; sNextUID++; while (curUID != 0) { @@ -7081,14 +7496,13 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState camera->camDir = camera->inputDir; camera->rUpdateRateInv = 10.0f; camera->yawUpdateRateInv = 10.0f; - camera->up.x = 0.0f; camera->up.y = 1.0f; - camera->up.z = 0.0f; + camera->up.z = camera->up.x = 0.0f; camera->fov = 60.0f; - camera->pitchUpdateRateInv = R_CAM_PITCH_UPDATE_RATE_INV; - camera->xzOffsetUpdateRate = CAM_DATA_SCALED(R_CAM_XZ_OFFSET_UPDATE_RATE); - camera->yOffsetUpdateRate = CAM_DATA_SCALED(R_CAM_Y_OFFSET_UPDATE_RATE); - camera->fovUpdateRate = CAM_DATA_SCALED(R_CAM_FOV_UPDATE_RATE); + camera->pitchUpdateRateInv = CAM_PITCH_UPDATE_RATE_INV; + camera->xzOffsetUpdateRate = CAM_XZ_OFFSET_UPDATE_RATE; + camera->yOffsetUpdateRate = CAM_Y_OFFSET_UPDATE_RATE; + camera->fovUpdateRate = CAM_FOV_UPDATE_RATE; sCameraLetterboxSize = 32; sCameraHudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; camera->stateFlags = 0; @@ -7102,10 +7516,16 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState camera->up.y = 1.0f; camera->up.z = camera->up.x = 0.0f; - camera->quakeOffset.x = camera->quakeOffset.y = camera->quakeOffset.z = 0; + camera->quakeOffset.x = 0; + camera->quakeOffset.y = 0; + camera->quakeOffset.z = 0; camera->atLERPStepScale = 1; sCameraInterfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_IGNORE, CAM_HUD_VISIBILITY_IGNORE, 0); + +#if IS_CAMERA_DEBUG_ENABLED sDbgModeIdx = -1; +#endif + D_8011D3F0 = 3; PRINTF(VT_FGCOL(BLUE) "camera: initialize --- " VT_RST " UID %d\n", camera->uid); } @@ -7149,9 +7569,7 @@ void Camera_InitDataUsingPlayer(Camera* camera, Player* player) { Vec3f floorNorm; s32 upXZ; f32 playerToAtOffsetY; - Vec3f* eye = &camera->eye; Vec3f* at = &camera->at; - Vec3f* eyeNext = &camera->eyeNext; playerPosRot = Actor_GetWorldPosShapeRot(&player->actor); playerToAtOffsetY = Player_GetHeight(player); @@ -7172,8 +7590,8 @@ void Camera_InitDataUsingPlayer(Camera* camera, Player* player) { camera->playerToAtOffset.y = playerToAtOffsetY; camera->playerToAtOffset.z = 0; - *eyeNext = Camera_AddVecGeoToVec3f(at, &eyeNextAtOffset); - *eye = *eyeNext; + camera->eyeNext = Camera_AddVecGeoToVec3f(at, &eyeNextAtOffset); + camera->eye = camera->eyeNext; camera->roll = 0; upXZ = 0; @@ -7185,8 +7603,13 @@ void Camera_InitDataUsingPlayer(Camera* camera, Player* player) { camera->bgId = bgId; } - camera->bgCamIndexBeforeUnderwater = -1; - camera->waterCamSetting = -1; + { + s32 pad[2]; + + camera->bgCamIndexBeforeUnderwater = -1; + camera->waterCamSetting = -1; + } + camera->stateFlags |= CAM_STATE_CHECK_BG; if (camera == &camera->play->mainCamera) { @@ -7202,7 +7625,9 @@ void Camera_InitDataUsingPlayer(Camera* camera, Player* player) { camera->nextBgCamIndex = -1; camera->atLERPStepScale = 1.0f; Camera_CopyDataToRegs(camera, camera->mode); +#if IS_CAMERA_DEBUG_ENABLED Camera_QRegInit(); +#endif PRINTF(VT_FGCOL(BLUE) "camera: personalize ---" VT_RST "\n"); if (camera->camId == CAM_ID_MAIN) { @@ -7215,6 +7640,7 @@ s16 Camera_ChangeStatus(Camera* camera, s16 status) { CameraModeValue* valueP; s32 i; +#if IS_CAMERA_DEBUG_ENABLED if (PREG(82)) { PRINTF("camera: change camera status: cond %c%c\n", status == CAM_STAT_ACTIVE ? 'o' : 'x', camera->status != CAM_STAT_ACTIVE ? 'o' : 'x'); @@ -7234,86 +7660,92 @@ s16 Camera_ChangeStatus(Camera* camera, s16 status) { } } } +#endif + camera->status = status; return camera->status; } +#if IS_CAMERA_DEBUG_ENABLED void Camera_PrintSettings(Camera* camera) { - char sp58[8]; - char sp50[8]; - char sp48[8]; - s32 i; + if (IS_CAMERA_DEBUG_ENABLED) { + char sp58[8]; + char sp50[8]; + char sp48[8]; + s32 i; - if ((OREG(0) & 1) && (camera->play->activeCamId == camera->camId) && !gDebugCamEnabled) { - for (i = 0; i < NUM_CAMS; i++) { - if (camera->play->cameraPtrs[i] == NULL) { - sp58[i] = '-'; - sp48[i] = ' '; - } else { - switch (camera->play->cameraPtrs[i]->status) { - case 0: - sp58[i] = 'c'; - break; - case 1: - sp58[i] = 'w'; - break; - case 3: - sp58[i] = 's'; - break; - case 7: - sp58[i] = 'a'; - break; - case 0x100: - sp58[i] = 'd'; - break; - default: - sp58[i] = '*'; - break; + if ((OREG(0) & 1) && (camera->play->activeCamId == camera->camId) && !gDebugCamEnabled) { + for (i = 0; i < NUM_CAMS; i++) { + if (camera->play->cameraPtrs[i] == NULL) { + sp58[i] = '-'; + sp48[i] = ' '; + } else { + switch (camera->play->cameraPtrs[i]->status) { + case 0: + sp58[i] = 'c'; + break; + case 1: + sp58[i] = 'w'; + break; + case 3: + sp58[i] = 's'; + break; + case 7: + sp58[i] = 'a'; + break; + case 0x100: + sp58[i] = 'd'; + break; + default: + sp58[i] = '*'; + break; + } } + sp48[i] = ' '; } - sp48[i] = ' '; + sp58[i] = '\0'; + sp48[i] = '\0'; + + sp48[camera->play->activeCamId] = 'a'; + DebugCamera_ScreenTextColored(3, 22, DEBUG_CAM_TEXT_WHITE, sp58); + DebugCamera_ScreenTextColored(3, 22, DEBUG_CAM_TEXT_PEACH, sp48); + DebugCamera_ScreenTextColored(3, 23, DEBUG_CAM_TEXT_WHITE, "S:"); + DebugCamera_ScreenTextColored(5, 23, DEBUG_CAM_TEXT_GOLD, sCameraSettingNames[camera->setting]); + DebugCamera_ScreenTextColored(3, 24, DEBUG_CAM_TEXT_WHITE, "M:"); + DebugCamera_ScreenTextColored(5, 24, DEBUG_CAM_TEXT_GOLD, sCameraModeNames[camera->mode]); + DebugCamera_ScreenTextColored(3, 25, DEBUG_CAM_TEXT_WHITE, "F:"); + DebugCamera_ScreenTextColored( + 5, 25, DEBUG_CAM_TEXT_GOLD, + sCameraFunctionNames[sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx]); + + i = 0; + if (camera->bgCamIndex < 0) { + sp50[i++] = '-'; + } + + //! @bug: this code was clearly meaning to print `abs(camera->bgCamIndex)` as a + //! one-or-two-digit number, instead of `i`. + // "sp50[i++] = ..." matches here, but is undefined behavior due to conflicting + // reads/writes between sequence points, triggering warnings. Work around by + // putting i++ afterwards while on the same line. + // clang-format off + if (camera->bgCamIndex / 10 != 0) { + sp50[i] = i / 10 + '0'; i++; + } + sp50[i] = i % 10 + '0'; i++; + // clang-format on + + sp50[i++] = ' '; + sp50[i++] = ' '; + sp50[i++] = ' '; + sp50[i++] = ' '; + sp50[i] = '\0'; + DebugCamera_ScreenTextColored(3, 26, DEBUG_CAM_TEXT_WHITE, "I:"); + DebugCamera_ScreenTextColored(5, 26, DEBUG_CAM_TEXT_GOLD, sp50); } - sp58[i] = '\0'; - sp48[i] = '\0'; - - sp48[camera->play->activeCamId] = 'a'; - DebugCamera_ScreenTextColored(3, 22, DEBUG_CAM_TEXT_WHITE, sp58); - DebugCamera_ScreenTextColored(3, 22, DEBUG_CAM_TEXT_PEACH, sp48); - DebugCamera_ScreenTextColored(3, 23, DEBUG_CAM_TEXT_WHITE, "S:"); - DebugCamera_ScreenTextColored(5, 23, DEBUG_CAM_TEXT_GOLD, sCameraSettingNames[camera->setting]); - DebugCamera_ScreenTextColored(3, 24, DEBUG_CAM_TEXT_WHITE, "M:"); - DebugCamera_ScreenTextColored(5, 24, DEBUG_CAM_TEXT_GOLD, sCameraModeNames[camera->mode]); - DebugCamera_ScreenTextColored(3, 25, DEBUG_CAM_TEXT_WHITE, "F:"); - DebugCamera_ScreenTextColored( - 5, 25, DEBUG_CAM_TEXT_GOLD, - sCameraFunctionNames[sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx]); - - i = 0; - if (camera->bgCamIndex < 0) { - sp50[i++] = '-'; - } - - //! @bug: this code was clearly meaning to print `abs(camera->bgCamIndex)` as a - //! one-or-two-digit number, instead of `i`. - // "sp50[i++] = ..." matches here, but is undefined behavior due to conflicting - // reads/writes between sequence points, triggering warnings. Work around by - // putting i++ afterwards while on the same line. - // clang-format off - if (camera->bgCamIndex / 10 != 0) { - sp50[i] = i / 10 + '0'; i++; - } - sp50[i] = i % 10 + '0'; i++; - // clang-format on - - sp50[i++] = ' '; - sp50[i++] = ' '; - sp50[i++] = ' '; - sp50[i++] = ' '; - sp50[i] = '\0'; - DebugCamera_ScreenTextColored(3, 26, DEBUG_CAM_TEXT_WHITE, "I:"); - DebugCamera_ScreenTextColored(5, 26, DEBUG_CAM_TEXT_GOLD, sp50); } } +#endif s32 Camera_UpdateWater(Camera* camera) { f32 waterY; @@ -7453,7 +7885,12 @@ s32 Camera_UpdateHotRoom(Camera* camera) { return 1; } +#if IS_CAMERA_DEBUG_ENABLED +// doesn't seem to work properly s32 Camera_DbgChangeMode(Camera* camera) { + static s16 D_8011DAFC[] = { + CAM_SET_NORMAL0, CAM_SET_NORMAL1, CAM_SET_NORMAL2, CAM_SET_DUNGEON0, CAM_SET_DUNGEON1, CAM_SET_DUNGEON2, + }; s32 changeDir = 0; if (!gDebugCamEnabled && camera->play->activeCamId == CAM_ID_MAIN) { @@ -7479,8 +7916,10 @@ s32 Camera_DbgChangeMode(Camera* camera) { } } } + return true; } +#endif void Camera_UpdateDistortion(Camera* camera) { static s16 depthPhase = 0x3F0; @@ -7567,6 +8006,12 @@ void Camera_UpdateDistortion(Camera* camera) { } } +#if IS_CAMERA_DEBUG_ENABLED +#define ENABLE_DEBUG_CAM_UPDATE R_DEBUG_CAM_UPDATE +#else +#define ENABLE_DEBUG_CAM_UPDATE false +#endif + Vec3s Camera_Update(Camera* camera) { static s32 sOOBTimer = 0; Vec3f viewAt; @@ -7586,12 +8031,12 @@ Vec3s Camera_Update(Camera* camera) { player = camera->play->cameraPtrs[CAM_ID_MAIN]->player; - if (R_DEBUG_CAM_UPDATE) { + if (ENABLE_DEBUG_CAM_UPDATE) { PRINTF("camera: in %x\n", camera); } if (camera->status == CAM_STAT_CUT) { - if (R_DEBUG_CAM_UPDATE) { + if (ENABLE_DEBUG_CAM_UPDATE) { PRINTF("camera: cut out %x\n", camera); } return camera->inputDir; @@ -7603,8 +8048,7 @@ Vec3s Camera_Update(Camera* camera) { curPlayerPosRot = Actor_GetWorldPosShapeRot(&camera->player->actor); camera->xzSpeed = playerXZSpeed = OLib_Vec3fDistXZ(&curPlayerPosRot.pos, &camera->playerPosRot.pos); - camera->speedRatio = - OLib_ClampMaxDist(playerXZSpeed / (func_8002DCE4(camera->player) * CAM_DATA_SCALED(OREG(8))), 1.0f); + camera->speedRatio = OLib_ClampMaxDist(playerXZSpeed / (func_8002DCE4(camera->player) * CAM_GLOBAL_8), 1.0f); camera->playerPosDelta.x = curPlayerPosRot.pos.x - camera->playerPosRot.pos.x; camera->playerPosDelta.y = curPlayerPosRot.pos.y - camera->playerPosRot.pos.y; camera->playerPosDelta.z = curPlayerPosRot.pos.z - camera->playerPosRot.pos.z; @@ -7615,18 +8059,18 @@ Vec3s Camera_Update(Camera* camera) { &camera->player->actor, &pos); if (playerGroundY != BGCHECK_Y_MIN) { // player is above ground. - sOOBTimer = 0; camera->floorNorm.x = COLPOLY_GET_NORMAL(playerFloorPoly->normal.x); camera->floorNorm.y = COLPOLY_GET_NORMAL(playerFloorPoly->normal.y); camera->floorNorm.z = COLPOLY_GET_NORMAL(playerFloorPoly->normal.z); camera->bgId = bgId; camera->playerGroundY = playerGroundY; + sOOBTimer = 0; } else { // player is not above ground. - sOOBTimer++; camera->floorNorm.x = 0.0; camera->floorNorm.y = 1.0f; camera->floorNorm.z = 0.0; + sOOBTimer++; } camera->playerPosRot = curPlayerPosRot; @@ -7662,11 +8106,14 @@ Vec3s Camera_Update(Camera* camera) { } } } + +#if IS_CAMERA_DEBUG_ENABLED Camera_PrintSettings(camera); Camera_DbgChangeMode(camera); +#endif if (camera->status == CAM_STAT_WAIT) { - if (R_DEBUG_CAM_UPDATE) { + if (ENABLE_DEBUG_CAM_UPDATE) { PRINTF("camera: wait out %x\n", camera); } return camera->inputDir; @@ -7676,7 +8123,7 @@ Vec3s Camera_Update(Camera* camera) { camera->stateFlags &= ~(CAM_STATE_BLOCK_BG | CAM_STATE_LOCK_MODE); camera->stateFlags |= CAM_STATE_CAM_FUNC_FINISH; - if (R_DEBUG_CAM_UPDATE) { + if (ENABLE_DEBUG_CAM_UPDATE) { PRINTF("camera: engine (%d %d %d) %04x \n", camera->setting, camera->mode, sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx, camera->stateFlags); } @@ -7700,18 +8147,21 @@ Vec3s Camera_Update(Camera* camera) { sCameraInterfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_IGNORE, CAM_HUD_VISIBILITY_NOTHING_ALT, 0); Camera_UpdateInterface(sCameraInterfaceField); } else if (camera->play->csCtx.state != CS_STATE_IDLE) { - sCameraInterfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_LARGE, CAM_HUD_VISIBILITY_NOTHING_ALT, 0); + // clang-format off + sCameraInterfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_LARGE, CAM_HUD_VISIBILITY_NOTHING_ALT, 0); \ Camera_UpdateInterface(sCameraInterfaceField); + // clang-format on } else { Camera_UpdateInterface(sCameraInterfaceField); } } - if (R_DEBUG_CAM_UPDATE) { +#if IS_CAMERA_DEBUG_ENABLED + if (ENABLE_DEBUG_CAM_UPDATE) { PRINTF("camera: shrink_and_bitem %x(%d)\n", sCameraInterfaceField, camera->play->transitionMode); } - if (R_DEBUG_CAM_UPDATE) { + if (ENABLE_DEBUG_CAM_UPDATE) { PRINTF("camera: engine (%s(%d) %s(%d) %s(%d)) ok!\n", &sCameraSettingNames[camera->setting], camera->setting, &sCameraModeNames[camera->mode], camera->mode, &sCameraFunctionNames[sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx], @@ -7726,151 +8176,153 @@ Vec3s Camera_Update(Camera* camera) { } else if (camera->play->csCtx.state != CS_STATE_IDLE) { Cutscene_StopManual(camera->play, &camera->play->csCtx); } - } - // Debug cam update - if (gDebugCamEnabled) { - camera->play->view.fovy = D_8015BD80.fov; - DebugCamera_Update(&D_8015BD80, camera); - View_LookAt(&camera->play->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C); - if (R_DEBUG_CAM_UPDATE) { - PRINTF("camera: debug out\n"); - } - return D_8015BD80.sub.unk_104A; - } - - OREG(0) &= ~8; - - if (camera->status == CAM_STAT_UNK3) { - return camera->inputDir; - } - - numQuakesApplied = Quake_Update(camera, &camShake); - - bgId = numQuakesApplied; // required to match - - if ((numQuakesApplied != 0) && (camera->setting != CAM_SET_TURN_AROUND)) { - viewAt.x = camera->at.x + camShake.atOffset.x; - viewAt.y = camera->at.y + camShake.atOffset.y; - viewAt.z = camera->at.z + camShake.atOffset.z; - - viewEye.x = camera->eye.x + camShake.eyeOffset.x; - viewEye.y = camera->eye.y + camShake.eyeOffset.y; - viewEye.z = camera->eye.z + camShake.eyeOffset.z; - - eyeAtAngle = OLib_Vec3fDiffToVecGeo(&viewEye, &viewAt); - viewUp = Camera_CalcUpFromPitchYawRoll(eyeAtAngle.pitch + camShake.upPitchOffset, - eyeAtAngle.yaw + camShake.upYawOffset, camera->roll); - viewFov = camera->fov + CAM_BINANG_TO_DEG(camShake.fovOffset); - } else { - viewAt = camera->at; - viewEye = camera->eye; - eyeAtAngle = OLib_Vec3fDiffToVecGeo(&viewEye, &viewAt); - viewUp = Camera_CalcUpFromPitchYawRoll(eyeAtAngle.pitch, eyeAtAngle.yaw, camera->roll); - viewFov = camera->fov; - } - - if (camera->viewFlags & CAM_VIEW_UP) { - camera->viewFlags &= ~CAM_VIEW_UP; - viewUp = camera->up; - } else { - camera->up = viewUp; - } - - camera->quakeOffset = camShake.eyeOffset; - - Camera_UpdateDistortion(camera); - - if ((camera->play->sceneId == SCENE_HYRULE_FIELD) && (camera->fov < 59.0f)) { - View_SetScale(&camera->play->view, 0.79f); - } else { - View_SetScale(&camera->play->view, 1.0f); - } - camera->play->view.fovy = viewFov; - View_LookAt(&camera->play->view, &viewEye, &viewAt, &viewUp); - camera->camDir.x = eyeAtAngle.pitch; - camera->camDir.y = eyeAtAngle.yaw; - camera->camDir.z = 0; - - if (sUpdateCameraDirection == 0) { - camera->inputDir.x = eyeAtAngle.pitch; - camera->inputDir.y = eyeAtAngle.yaw; - camera->inputDir.z = 0; - } - - if (PREG(81)) { - PRINTF("dir (%d) %d(%f) %d(%f) 0(0) \n", sUpdateCameraDirection, camera->inputDir.x, - CAM_BINANG_TO_DEG(camera->inputDir.x), camera->inputDir.y, CAM_BINANG_TO_DEG(camera->inputDir.y)); - PRINTF("real (%d) %d(%f) %d(%f) 0(0) \n", sUpdateCameraDirection, camera->camDir.x, - CAM_BINANG_TO_DEG(camera->camDir.x), camera->camDir.y, CAM_BINANG_TO_DEG(camera->camDir.y)); - } - - if (camera->timer != -1 && CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_DRIGHT)) { - camera->timer = 0; - } - - if (R_DEBUG_CAM_UPDATE) { - PRINTF("camera: out (%f %f %f) (%f %f %f)\n", camera->at.x, camera->at.y, camera->at.z, camera->eye.x, - camera->eye.y, camera->eye.z); - PRINTF("camera: dir (%f %d(%f) %d(%f)) (%f)\n", eyeAtAngle.r, eyeAtAngle.pitch, - CAM_BINANG_TO_DEG(eyeAtAngle.pitch), eyeAtAngle.yaw, CAM_BINANG_TO_DEG(eyeAtAngle.yaw), camera->fov); - if (camera->player != NULL) { - PRINTF("camera: foot(%f %f %f) dist (%f)\n", curPlayerPosRot.pos.x, curPlayerPosRot.pos.y, - curPlayerPosRot.pos.z, camera->dist); - } - } - - return camera->inputDir; -} - -/** - * When the camera's timer is 0, change the camera to its parent - */ -void Camera_Finish(Camera* camera) { - Camera* mainCam = camera->play->cameraPtrs[CAM_ID_MAIN]; - Player* player = GET_PLAYER(camera->play); - - if (camera->timer == 0) { - Play_ChangeCameraStatus(camera->play, camera->parentCamId, CAM_STAT_ACTIVE); - - if ((camera->parentCamId == CAM_ID_MAIN) && (camera->csId != 0)) { - player->actor.freezeTimer = 0; - player->stateFlags1 &= ~PLAYER_STATE1_29; - - if (player->csAction != PLAYER_CSACTION_NONE) { - Player_SetCsActionWithHaltedActors(camera->play, &player->actor, PLAYER_CSACTION_7); - PRINTF("camera: player demo end!!\n"); + // Debug cam update + if (gDebugCamEnabled) { + camera->play->view.fovy = D_8015BD80.fov; + DebugCamera_Update(&D_8015BD80, camera); + View_LookAt(&camera->play->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C); + if (ENABLE_DEBUG_CAM_UPDATE) { + PRINTF("camera: debug out\n"); } - mainCam->stateFlags |= CAM_STATE_EXTERNAL_FINISHED; + OREG(0) &= ~8; +#endif + + if (camera->status == CAM_STAT_UNK3) { + return camera->inputDir; + } + + numQuakesApplied = Quake_Update(camera, &camShake); + + bgId = numQuakesApplied; // required to match + + if ((numQuakesApplied != 0) && (camera->setting != CAM_SET_TURN_AROUND)) { + viewAt.x = camera->at.x + camShake.atOffset.x; + viewAt.y = camera->at.y + camShake.atOffset.y; + viewAt.z = camera->at.z + camShake.atOffset.z; + + viewEye.x = camera->eye.x + camShake.eyeOffset.x; + viewEye.y = camera->eye.y + camShake.eyeOffset.y; + viewEye.z = camera->eye.z + camShake.eyeOffset.z; + + eyeAtAngle = OLib_Vec3fDiffToVecGeo(&viewEye, &viewAt); + viewUp = Camera_CalcUpFromPitchYawRoll(eyeAtAngle.pitch + camShake.upPitchOffset, + eyeAtAngle.yaw + camShake.upYawOffset, camera->roll); + viewFov = camera->fov + CAM_BINANG_TO_DEG(camShake.fovOffset); + } else { + viewAt = camera->at; + viewEye = camera->eye; + eyeAtAngle = OLib_Vec3fDiffToVecGeo(&viewEye, &viewAt); + viewUp = Camera_CalcUpFromPitchYawRoll(eyeAtAngle.pitch, eyeAtAngle.yaw, camera->roll); + viewFov = camera->fov; + } + + if (camera->viewFlags & CAM_VIEW_UP) { + camera->viewFlags &= ~CAM_VIEW_UP; + viewUp = camera->up; + } else { + camera->up = viewUp; + } + + camera->quakeOffset = camShake.eyeOffset; + + Camera_UpdateDistortion(camera); + + if ((camera->play->sceneId == SCENE_HYRULE_FIELD) && (camera->fov < 59.0f)) { + View_SetScale(&camera->play->view, 0.79f); + } else { + View_SetScale(&camera->play->view, 1.0f); + } + camera->play->view.fovy = viewFov; + View_LookAt(&camera->play->view, &viewEye, &viewAt, &viewUp); + camera->camDir.x = eyeAtAngle.pitch; + camera->camDir.y = eyeAtAngle.yaw; + camera->camDir.z = 0; + + if (sUpdateCameraDirection == 0) { + camera->inputDir.x = eyeAtAngle.pitch; + camera->inputDir.y = eyeAtAngle.yaw; + camera->inputDir.z = 0; + } + + if (PREG(81)) { + PRINTF("dir (%d) %d(%f) %d(%f) 0(0) \n", sUpdateCameraDirection, camera->inputDir.x, + CAM_BINANG_TO_DEG(camera->inputDir.x), camera->inputDir.y, + CAM_BINANG_TO_DEG(camera->inputDir.y)); + PRINTF("real (%d) %d(%f) %d(%f) 0(0) \n", sUpdateCameraDirection, camera->camDir.x, + CAM_BINANG_TO_DEG(camera->camDir.x), camera->camDir.y, CAM_BINANG_TO_DEG(camera->camDir.y)); + } + +#if IS_CAMERA_DEBUG_ENABLED + if (camera->timer != -1 && CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_DRIGHT)) { + camera->timer = 0; + } +#endif + + if (ENABLE_DEBUG_CAM_UPDATE) { + PRINTF("camera: out (%f %f %f) (%f %f %f)\n", camera->at.x, camera->at.y, camera->at.z, camera->eye.x, + camera->eye.y, camera->eye.z); + PRINTF("camera: dir (%f %d(%f) %d(%f)) (%f)\n", eyeAtAngle.r, eyeAtAngle.pitch, + CAM_BINANG_TO_DEG(eyeAtAngle.pitch), eyeAtAngle.yaw, CAM_BINANG_TO_DEG(eyeAtAngle.yaw), + camera->fov); + if (camera->player != NULL) { + PRINTF("camera: foot(%f %f %f) dist (%f)\n", curPlayerPosRot.pos.x, curPlayerPosRot.pos.y, + curPlayerPosRot.pos.z, camera->dist); + } + } + + return camera->inputDir; } - if (CHILD_CAM(camera)->parentCamId == camera->camId) { - CHILD_CAM(camera)->parentCamId = camera->parentCamId; + /** + * When the camera's timer is 0, change the camera to its parent + */ + void Camera_Finish(Camera * camera) { + Camera* mainCam = camera->play->cameraPtrs[CAM_ID_MAIN]; + Player* player = GET_PLAYER(camera->play); + + if (camera->timer == 0) { + Play_ChangeCameraStatus(camera->play, camera->parentCamId, CAM_STAT_ACTIVE); + + if ((camera->parentCamId == CAM_ID_MAIN) && (camera->csId != 0)) { + player->actor.freezeTimer = 0; + player->stateFlags1 &= ~PLAYER_STATE1_29; + + if (player->csAction != PLAYER_CSACTION_NONE) { + Player_SetCsActionWithHaltedActors(camera->play, &player->actor, PLAYER_CSACTION_7); + PRINTF("camera: player demo end!!\n"); + } + + mainCam->stateFlags |= CAM_STATE_EXTERNAL_FINISHED; + } + + if (CHILD_CAM(camera)->parentCamId == camera->camId) { + CHILD_CAM(camera)->parentCamId = camera->parentCamId; + } + + if (PARENT_CAM(camera)->childCamId == camera->camId) { + PARENT_CAM(camera)->childCamId = camera->childCamId; + } + + if (PARENT_CAM(camera)->camId == CAM_ID_MAIN) { + PARENT_CAM(camera)->animState = 0; + } + + camera->childCamId = camera->parentCamId = CAM_ID_MAIN; + camera->timer = -1; + camera->play->envCtx.fillScreen = false; + + Play_ClearCamera(camera->play, camera->camId); + } } - if (PARENT_CAM(camera)->childCamId == camera->camId) { - PARENT_CAM(camera)->childCamId = camera->childCamId; + s32 Camera_SetNewModeStateFlags(Camera * camera) { + camera->stateFlags |= (CAM_STATE_CHECK_BG | CAM_STATE_EXTERNAL_FINISHED); + camera->stateFlags &= ~(CAM_STATE_EXTERNAL_FINISHED | CAM_STATE_DEMO7); + return true; } - if (PARENT_CAM(camera)->camId == CAM_ID_MAIN) { - PARENT_CAM(camera)->animState = 0; - } - - camera->childCamId = camera->parentCamId = CAM_ID_MAIN; - camera->timer = -1; - camera->play->envCtx.fillScreen = false; - - Play_ClearCamera(camera->play, camera->camId); - } -} - -s32 Camera_SetNewModeStateFlags(Camera* camera) { - camera->stateFlags |= (CAM_STATE_CHECK_BG | CAM_STATE_EXTERNAL_FINISHED); - camera->stateFlags &= ~(CAM_STATE_EXTERNAL_FINISHED | CAM_STATE_DEMO7); - return true; -} - #define CAM_REQUEST_MODE_FORCE_NO_SFX (1 << 0) #define CAM_REQUEST_MODE_SFX_ATTENTION (1 << 1) #define CAM_REQUEST_MODE_Z_TARGET_UNFRIENDLY (1 << 2) @@ -7878,585 +8330,615 @@ s32 Camera_SetNewModeStateFlags(Camera* camera) { #define CAM_REQUEST_MODE_SKIP_ANIM_NORMAL_PARALLEL (1 << 4) // never set to #define CAM_REQUEST_MODE_SKIP_ANIM_FIRST_PERSON (1 << 5) -s32 Camera_RequestModeImpl(Camera* camera, s16 requestedMode, u8 forceModeChange) { - static s32 sModeRequestFlags = 0; + s32 Camera_RequestModeImpl(Camera * camera, s16 requestedMode, u8 forceModeChange) { + static s32 sModeRequestFlags = 0; - if (QREG(89)) { - PRINTF("+=+(%d)+=+ recive request -> %s\n", camera->play->state.frames, sCameraModeNames[requestedMode]); - } - - if ((camera->stateFlags & CAM_STATE_LOCK_MODE) && !forceModeChange) { - camera->behaviorFlags |= CAM_BEHAVIOR_MODE_VALID; - return -1; - } - - if (!((sCameraSettings[camera->setting].unk_00 & 0x3FFFFFFF) & (1 << requestedMode))) { - if (requestedMode == CAM_MODE_FIRST_PERSON) { - PRINTF("camera: error sound\n"); - Sfx_PlaySfxCentered(NA_SE_SY_ERROR); - } - - if (camera->mode != CAM_MODE_NORMAL) { - PRINTF(VT_COL(YELLOW, BLACK) "camera: change camera mode: force NORMAL: %s %s refused\n" VT_RST, - sCameraSettingNames[camera->setting], sCameraModeNames[requestedMode]); - camera->mode = CAM_MODE_NORMAL; - Camera_CopyDataToRegs(camera, camera->mode); - Camera_SetNewModeStateFlags(camera); - return 0xC0000000 | requestedMode; - } - - camera->behaviorFlags |= CAM_BEHAVIOR_MODE_VALID; - camera->behaviorFlags |= CAM_BEHAVIOR_MODE_SUCCESS; - return CAM_MODE_NORMAL; - } - - if ((requestedMode == camera->mode) && !forceModeChange) { - camera->behaviorFlags |= CAM_BEHAVIOR_MODE_VALID; - camera->behaviorFlags |= CAM_BEHAVIOR_MODE_SUCCESS; - return -1; - } - - camera->behaviorFlags |= CAM_BEHAVIOR_MODE_VALID; - camera->behaviorFlags |= CAM_BEHAVIOR_MODE_SUCCESS; - - Camera_CopyDataToRegs(camera, requestedMode); - - sModeRequestFlags = 0; - - // requested camMode - switch (requestedMode) { - case CAM_MODE_FIRST_PERSON: - sModeRequestFlags = CAM_REQUEST_MODE_SKIP_ANIM_FIRST_PERSON; - break; - - case CAM_MODE_Z_TARGET_UNFRIENDLY: - sModeRequestFlags = CAM_REQUEST_MODE_Z_TARGET_UNFRIENDLY; - break; - - case CAM_MODE_Z_TARGET_FRIENDLY: - if ((camera->target != NULL) && (camera->target->id != ACTOR_EN_BOOM)) { - sModeRequestFlags = CAM_REQUEST_MODE_Z_TARGET_FRIENDLY; +#if IS_CAMERA_DEBUG_ENABLED + if (QREG(89)) { + PRINTF("+=+(%d)+=+ recive request -> %s\n", camera->play->state.frames, + sCameraModeNames[requestedMode]); } - break; +#endif - case CAM_MODE_Z_PARALLEL: - case CAM_MODE_TALK: - case CAM_MODE_Z_AIM: - case CAM_MODE_Z_LEDGE_HANG: - case CAM_MODE_PUSH_PULL: - sModeRequestFlags = CAM_REQUEST_MODE_SFX_ATTENTION; - break; - - default: - break; - } - - // If the requested mode is already the same as the current mode, - // then many modes will reset their animState to 10. - switch (camera->mode) { - case CAM_MODE_FIRST_PERSON: - if (sModeRequestFlags & CAM_REQUEST_MODE_SKIP_ANIM_FIRST_PERSON) { - camera->animState = 10; + if ((camera->stateFlags & CAM_STATE_LOCK_MODE) && !forceModeChange) { + camera->behaviorFlags |= CAM_BEHAVIOR_MODE_VALID; + return -1; } - break; - case CAM_MODE_Z_PARALLEL: - if (sModeRequestFlags & CAM_REQUEST_MODE_SKIP_ANIM_NORMAL_PARALLEL) { - camera->animState = 10; - } - sModeRequestFlags |= CAM_REQUEST_MODE_FORCE_NO_SFX; - break; - - case CAM_MODE_CHARGE: - sModeRequestFlags |= CAM_REQUEST_MODE_FORCE_NO_SFX; - break; - - case CAM_MODE_Z_TARGET_FRIENDLY: - if (sModeRequestFlags & CAM_REQUEST_MODE_Z_TARGET_FRIENDLY) { - camera->animState = 10; - } - sModeRequestFlags |= CAM_REQUEST_MODE_FORCE_NO_SFX; - break; - - case CAM_MODE_Z_TARGET_UNFRIENDLY: - if (sModeRequestFlags & CAM_REQUEST_MODE_Z_TARGET_UNFRIENDLY) { - camera->animState = 10; - } - sModeRequestFlags |= CAM_REQUEST_MODE_FORCE_NO_SFX; - break; - - case CAM_MODE_Z_AIM: - case CAM_MODE_Z_LEDGE_HANG: - case CAM_MODE_PUSH_PULL: - sModeRequestFlags |= CAM_REQUEST_MODE_FORCE_NO_SFX; - break; - - case CAM_MODE_NORMAL: - if (sModeRequestFlags & CAM_REQUEST_MODE_SKIP_ANIM_NORMAL_PARALLEL) { - camera->animState = 10; - } - break; - - default: - break; - } - - sModeRequestFlags &= ~CAM_REQUEST_MODE_SKIP_ANIM_NORMAL_PARALLEL; - - // Choose a sound effect to play. - // Having `CAM_REQUEST_MODE_FORCE_NO_SFX` set often means `default` is taken from two bits being set - if (camera->status == CAM_STAT_ACTIVE) { - switch (sModeRequestFlags) { - case CAM_REQUEST_MODE_FORCE_NO_SFX: - Sfx_PlaySfxCentered(NA_SE_NONE); - break; - - case CAM_REQUEST_MODE_SFX_ATTENTION: - if (camera->play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) { - Sfx_PlaySfxCentered(NA_SE_SY_ATTENTION_URGENCY); - } else { - Sfx_PlaySfxCentered(NA_SE_SY_ATTENTION_ON); + if (!((sCameraSettings[camera->setting].unk_00 & 0x3FFFFFFF) & (1 << requestedMode))) { + if (requestedMode == CAM_MODE_FIRST_PERSON) { + PRINTF("camera: error sound\n"); + Sfx_PlaySfxCentered(NA_SE_SY_ERROR); } - break; - case CAM_REQUEST_MODE_Z_TARGET_UNFRIENDLY: - Sfx_PlaySfxCentered(NA_SE_SY_ATTENTION_URGENCY); - break; + if (camera->mode != CAM_MODE_NORMAL) { +#if IS_CAMERA_DEBUG_ENABLED + PRINTF(VT_COL(YELLOW, BLACK) "camera: change camera mode: force NORMAL: %s %s refused\n" VT_RST, + sCameraSettingNames[camera->setting], sCameraModeNames[requestedMode]); +#endif + camera->mode = CAM_MODE_NORMAL; + Camera_CopyDataToRegs(camera, camera->mode); + Camera_SetNewModeStateFlags(camera); + return 0xC0000000 | requestedMode; + } - case CAM_REQUEST_MODE_Z_TARGET_FRIENDLY: - Sfx_PlaySfxCentered(NA_SE_SY_ATTENTION_ON); - break; + camera->behaviorFlags |= CAM_BEHAVIOR_MODE_VALID; + camera->behaviorFlags |= CAM_BEHAVIOR_MODE_SUCCESS; + return CAM_MODE_NORMAL; + } - default: - break; + if ((requestedMode == camera->mode) && !forceModeChange) { + camera->behaviorFlags |= CAM_BEHAVIOR_MODE_VALID; + camera->behaviorFlags |= CAM_BEHAVIOR_MODE_SUCCESS; + return -1; + } + + camera->behaviorFlags |= CAM_BEHAVIOR_MODE_VALID; + camera->behaviorFlags |= CAM_BEHAVIOR_MODE_SUCCESS; + + Camera_CopyDataToRegs(camera, requestedMode); + + sModeRequestFlags = 0; + + // requested camMode + switch (requestedMode) { + case CAM_MODE_FIRST_PERSON: + sModeRequestFlags = CAM_REQUEST_MODE_SKIP_ANIM_FIRST_PERSON; + break; + + case CAM_MODE_Z_TARGET_UNFRIENDLY: + sModeRequestFlags = CAM_REQUEST_MODE_Z_TARGET_UNFRIENDLY; + break; + + case CAM_MODE_Z_TARGET_FRIENDLY: + if ((camera->target != NULL) && (camera->target->id != ACTOR_EN_BOOM)) { + sModeRequestFlags = CAM_REQUEST_MODE_Z_TARGET_FRIENDLY; + } + break; + + case CAM_MODE_Z_PARALLEL: + case CAM_MODE_TALK: + case CAM_MODE_Z_AIM: + case CAM_MODE_Z_LEDGE_HANG: + case CAM_MODE_PUSH_PULL: + sModeRequestFlags = CAM_REQUEST_MODE_SFX_ATTENTION; + break; + + default: + break; + } + + // If the requested mode is already the same as the current mode, + // then many modes will reset their animState to 10. + switch (camera->mode) { + case CAM_MODE_FIRST_PERSON: + if (sModeRequestFlags & CAM_REQUEST_MODE_SKIP_ANIM_FIRST_PERSON) { + camera->animState = 10; + } + break; + + case CAM_MODE_Z_PARALLEL: + if (sModeRequestFlags & CAM_REQUEST_MODE_SKIP_ANIM_NORMAL_PARALLEL) { + camera->animState = 10; + } + sModeRequestFlags |= CAM_REQUEST_MODE_FORCE_NO_SFX; + break; + + case CAM_MODE_CHARGE: + sModeRequestFlags |= CAM_REQUEST_MODE_FORCE_NO_SFX; + break; + + case CAM_MODE_Z_TARGET_FRIENDLY: + if (sModeRequestFlags & CAM_REQUEST_MODE_Z_TARGET_FRIENDLY) { + camera->animState = 10; + } + sModeRequestFlags |= CAM_REQUEST_MODE_FORCE_NO_SFX; + break; + + case CAM_MODE_Z_TARGET_UNFRIENDLY: + if (sModeRequestFlags & CAM_REQUEST_MODE_Z_TARGET_UNFRIENDLY) { + camera->animState = 10; + } + sModeRequestFlags |= CAM_REQUEST_MODE_FORCE_NO_SFX; + break; + + case CAM_MODE_Z_AIM: + case CAM_MODE_Z_LEDGE_HANG: + case CAM_MODE_PUSH_PULL: + sModeRequestFlags |= CAM_REQUEST_MODE_FORCE_NO_SFX; + break; + + case CAM_MODE_NORMAL: + if (sModeRequestFlags & CAM_REQUEST_MODE_SKIP_ANIM_NORMAL_PARALLEL) { + camera->animState = 10; + } + break; + + default: + break; + } + + sModeRequestFlags &= ~CAM_REQUEST_MODE_SKIP_ANIM_NORMAL_PARALLEL; + + // Choose a sound effect to play. + // Having `CAM_REQUEST_MODE_FORCE_NO_SFX` set often means `default` is taken from two bits being set + if (camera->status == CAM_STAT_ACTIVE) { + switch (sModeRequestFlags) { + case CAM_REQUEST_MODE_FORCE_NO_SFX: + Sfx_PlaySfxCentered(NA_SE_NONE); + break; + + case CAM_REQUEST_MODE_SFX_ATTENTION: + if (camera->play->roomCtx.curRoom.behaviorType1 == ROOM_BEHAVIOR_TYPE1_1) { + Sfx_PlaySfxCentered(NA_SE_SY_ATTENTION_URGENCY); + } else { + Sfx_PlaySfxCentered(NA_SE_SY_ATTENTION_ON); + } + break; + + case CAM_REQUEST_MODE_Z_TARGET_UNFRIENDLY: + Sfx_PlaySfxCentered(NA_SE_SY_ATTENTION_URGENCY); + break; + + case CAM_REQUEST_MODE_Z_TARGET_FRIENDLY: + Sfx_PlaySfxCentered(NA_SE_SY_ATTENTION_ON); + break; + + default: + break; + } + } + + Camera_SetNewModeStateFlags(camera); + camera->mode = requestedMode; + + return requestedMode | 0x80000000; } - } - Camera_SetNewModeStateFlags(camera); - camera->mode = requestedMode; + s32 Camera_RequestMode(Camera * camera, s16 mode) { + return Camera_RequestModeImpl(camera, mode, false); + } - return requestedMode | 0x80000000; -} + s32 Camera_CheckValidMode(Camera * camera, s16 mode) { +#if IS_CAMERA_DEBUG_ENABLED + if (QREG(89) != 0) { + PRINTF("+=+=+=+ recive asking -> %s (%s)\n", sCameraModeNames[mode], + sCameraSettingNames[camera->setting]); + } +#endif -s32 Camera_RequestMode(Camera* camera, s16 mode) { - return Camera_RequestModeImpl(camera, mode, false); -} + if (!(sCameraSettings[camera->setting].validModes & (1 << mode))) { + return 0; + } else if (mode == camera->mode) { + return -1; + } else { + return mode | 0x80000000; + } + } -s32 Camera_CheckValidMode(Camera* camera, s16 mode) { - if (QREG(89) != 0) { - PRINTF("+=+=+=+ recive asking -> %s (%s)\n", sCameraModeNames[mode], sCameraSettingNames[camera->setting]); - } - if (!(sCameraSettings[camera->setting].validModes & (1 << mode))) { - return 0; - } else if (mode == camera->mode) { - return -1; - } else { - return mode | 0x80000000; - } -} + s16 Camera_RequestSettingImpl(Camera * camera, s16 requestedSetting, s16 flags) { + if (camera->behaviorFlags & CAM_BEHAVIOR_SETTING_CHECK_PRIORITY) { + // If a second setting is requested this frame, determine if the setting overwrites the + // current setting through priority + if (((sCameraSettings[camera->setting].unk_00 & 0xF000000) >> 0x18) >= + ((sCameraSettings[requestedSetting].unk_00 & 0xF000000) >> 0x18)) { + camera->behaviorFlags |= CAM_BEHAVIOR_SETTING_VALID; + return -2; + } + } + + if (((requestedSetting == CAM_SET_MEADOW_BIRDS_EYE) || (requestedSetting == CAM_SET_MEADOW_UNUSED)) && + LINK_IS_ADULT && (camera->play->sceneId == SCENE_SACRED_FOREST_MEADOW)) { + camera->behaviorFlags |= CAM_BEHAVIOR_SETTING_VALID; + return -5; + } + + if ((requestedSetting == CAM_SET_NONE) || (requestedSetting >= CAM_SET_MAX)) { + PRINTF(VT_COL(RED, WHITE) "camera: error: illegal camera set (%d) !!!!\n" VT_RST, requestedSetting); + return -99; + } + + if ((requestedSetting == camera->setting) && !(flags & CAM_REQUEST_SETTING_FORCE_CHANGE)) { + camera->behaviorFlags |= CAM_BEHAVIOR_SETTING_VALID; + if (!(flags & CAM_REQUEST_SETTING_IGNORE_PRIORITY)) { + camera->behaviorFlags |= CAM_BEHAVIOR_SETTING_CHECK_PRIORITY; + } + return -1; + } -s16 Camera_RequestSettingImpl(Camera* camera, s16 requestedSetting, s16 flags) { - if (camera->behaviorFlags & CAM_BEHAVIOR_SETTING_CHECK_PRIORITY) { - // If a second setting is requested this frame, determine if the setting overwrites the - // current setting through priority - if (((sCameraSettings[camera->setting].unk_00 & 0xF000000) >> 0x18) >= - ((sCameraSettings[requestedSetting].unk_00 & 0xF000000) >> 0x18)) { camera->behaviorFlags |= CAM_BEHAVIOR_SETTING_VALID; - return -2; + + if (!(flags & CAM_REQUEST_SETTING_IGNORE_PRIORITY)) { + camera->behaviorFlags |= CAM_BEHAVIOR_SETTING_CHECK_PRIORITY; + } + + camera->stateFlags |= (CAM_STATE_CHECK_BG | CAM_STATE_EXTERNAL_FINISHED); + camera->stateFlags &= ~(CAM_STATE_EXTERNAL_FINISHED | CAM_STATE_DEMO7); + + if (!(sCameraSettings[camera->setting].unk_00 & 0x40000000)) { + camera->prevSetting = camera->setting; + } + + if (flags & CAM_REQUEST_SETTING_RESTORE_PREV_BG_CAM_INDEX) { + if (1) {} + camera->bgCamIndex = camera->prevBgCamIndex; + camera->prevBgCamIndex = -1; + } else if (!(flags & CAM_REQUEST_SETTING_PRESERVE_BG_CAM_INDEX)) { + if (!(sCameraSettings[camera->setting].unk_00 & 0x40000000)) { + camera->prevBgCamIndex = camera->bgCamIndex; + } + camera->bgCamIndex = -1; + } + + camera->setting = requestedSetting; + + if (Camera_RequestModeImpl(camera, camera->mode, true) >= 0) { + Camera_CopyDataToRegs(camera, camera->mode); + } + +#if IS_CAMERA_DEBUG_ENABLED + PRINTF(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->play->state.frames, + camera->camId, sCameraSettingNames[camera->setting]); +#endif + + return requestedSetting; } - } - if (((requestedSetting == CAM_SET_MEADOW_BIRDS_EYE) || (requestedSetting == CAM_SET_MEADOW_UNUSED)) && - LINK_IS_ADULT && (camera->play->sceneId == SCENE_SACRED_FOREST_MEADOW)) { - camera->behaviorFlags |= CAM_BEHAVIOR_SETTING_VALID; - return -5; - } - - if ((requestedSetting == CAM_SET_NONE) || (requestedSetting >= CAM_SET_MAX)) { - PRINTF(VT_COL(RED, WHITE) "camera: error: illegal camera set (%d) !!!!\n" VT_RST, requestedSetting); - return -99; - } - - if ((requestedSetting == camera->setting) && !(flags & CAM_REQUEST_SETTING_FORCE_CHANGE)) { - camera->behaviorFlags |= CAM_BEHAVIOR_SETTING_VALID; - if (!(flags & CAM_REQUEST_SETTING_IGNORE_PRIORITY)) { - camera->behaviorFlags |= CAM_BEHAVIOR_SETTING_CHECK_PRIORITY; + s32 Camera_RequestSetting(Camera * camera, s16 setting) { + return Camera_RequestSettingImpl(camera, setting, 0); } - return -1; - } - camera->behaviorFlags |= CAM_BEHAVIOR_SETTING_VALID; + s32 Camera_RequestBgCam(Camera * camera, s32 requestedBgCamIndex) { + s16 requestedCamSetting; + s16 settingChangeSuccessful; - if (!(flags & CAM_REQUEST_SETTING_IGNORE_PRIORITY)) { - camera->behaviorFlags |= CAM_BEHAVIOR_SETTING_CHECK_PRIORITY; - } + if ((requestedBgCamIndex == -1) || (requestedBgCamIndex == camera->bgCamIndex)) { + camera->behaviorFlags |= CAM_BEHAVIOR_BG_PROCESSED; + return -1; + } - camera->stateFlags |= (CAM_STATE_CHECK_BG | CAM_STATE_EXTERNAL_FINISHED); - camera->stateFlags &= ~(CAM_STATE_EXTERNAL_FINISHED | CAM_STATE_DEMO7); - - if (!(sCameraSettings[camera->setting].unk_00 & 0x40000000)) { - camera->prevSetting = camera->setting; - } - - if (flags & CAM_REQUEST_SETTING_RESTORE_PREV_BG_CAM_INDEX) { - if (1) {} - camera->bgCamIndex = camera->prevBgCamIndex; - camera->prevBgCamIndex = -1; - } else if (!(flags & CAM_REQUEST_SETTING_PRESERVE_BG_CAM_INDEX)) { - if (!(sCameraSettings[camera->setting].unk_00 & 0x40000000)) { - camera->prevBgCamIndex = camera->bgCamIndex; - } - camera->bgCamIndex = -1; - } - - camera->setting = requestedSetting; - - if (Camera_RequestModeImpl(camera, camera->mode, true) >= 0) { - Camera_CopyDataToRegs(camera, camera->mode); - } - - PRINTF(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->play->state.frames, camera->camId, - sCameraSettingNames[camera->setting]); - - return requestedSetting; -} - -s32 Camera_RequestSetting(Camera* camera, s16 setting) { - return Camera_RequestSettingImpl(camera, setting, 0); -} - -s32 Camera_RequestBgCam(Camera* camera, s32 requestedBgCamIndex) { - s16 requestedCamSetting; - s16 settingChangeSuccessful; - - if ((requestedBgCamIndex == -1) || (requestedBgCamIndex == camera->bgCamIndex)) { - camera->behaviorFlags |= CAM_BEHAVIOR_BG_PROCESSED; - return -1; - } - - if (!(camera->behaviorFlags & CAM_BEHAVIOR_BG_PROCESSED)) { - requestedCamSetting = Camera_GetBgCamSetting(camera, requestedBgCamIndex); - camera->behaviorFlags |= CAM_BEHAVIOR_BG_PROCESSED; - settingChangeSuccessful = Camera_RequestSettingImpl(camera, requestedCamSetting, - CAM_REQUEST_SETTING_PRESERVE_BG_CAM_INDEX | - CAM_REQUEST_SETTING_FORCE_CHANGE) >= 0; - if ((settingChangeSuccessful != CAM_SET_NONE) || (sCameraSettings[camera->setting].unk_00 & 0x80000000)) { + if (!(camera->behaviorFlags & CAM_BEHAVIOR_BG_PROCESSED)) { + requestedCamSetting = Camera_GetBgCamSetting(camera, requestedBgCamIndex); + camera->behaviorFlags |= CAM_BEHAVIOR_BG_PROCESSED; +#if IS_CAMERA_DEBUG_ENABLED + settingChangeSuccessful = Camera_RequestSettingImpl(camera, requestedCamSetting, + CAM_REQUEST_SETTING_PRESERVE_BG_CAM_INDEX | + CAM_REQUEST_SETTING_FORCE_CHANGE) >= 0; + if ((settingChangeSuccessful != CAM_SET_NONE) || + (sCameraSettings[camera->setting].unk_00 & 0x80000000)) { + camera->bgCamIndex = requestedBgCamIndex; + camera->behaviorFlags |= CAM_BEHAVIOR_BG_SUCCESS; + Camera_CopyDataToRegs(camera, camera->mode); + } else if (settingChangeSuccessful < -1) { + //! @bug: `settingChangeSuccessful` is a bool and is likely checking the wrong value. This can never + //! pass. + // The actual return of Camera_RequestSettingImpl or bgCamIndex would make more sense. + PRINTF(VT_COL(RED, WHITE) "camera: error: illegal camera ID (%d) !! (%d|%d|%d)\n" VT_RST, + requestedBgCamIndex, camera->camId, BGCHECK_SCENE, requestedCamSetting); + } +#else + if ((Camera_RequestSettingImpl(camera, requestedCamSetting, + CAM_REQUEST_SETTING_PRESERVE_BG_CAM_INDEX | CAM_REQUEST_SETTING_FORCE_CHANGE) >= + 0) || + (sCameraSettings[camera->setting].unk_00 & 0x80000000)) { camera->bgCamIndex = requestedBgCamIndex; camera->behaviorFlags |= CAM_BEHAVIOR_BG_SUCCESS; Camera_CopyDataToRegs(camera, camera->mode); - } else if (settingChangeSuccessful < -1) { - //! @bug: `settingChangeSuccessful` is a bool and is likely checking the wrong value. This can never pass. - // The actual return of Camera_RequestSettingImpl or bgCamIndex would make more sense. - PRINTF(VT_COL(RED, WHITE) "camera: error: illegal camera ID (%d) !! (%d|%d|%d)\n" VT_RST, - requestedBgCamIndex, camera->camId, BGCHECK_SCENE, requestedCamSetting); } - return 0x80000000 | requestedBgCamIndex; - } +#endif + return 0x80000000 | requestedBgCamIndex; + } - //! @note: no return here, but return is unused -} + //! @note: no return here, but return is unused + } -Vec3s Camera_GetInputDir(Camera* camera) { - if (gDebugCamEnabled) { - return D_8015BD80.sub.unk_104A; - } else { - return camera->inputDir; - } -} + Vec3s Camera_GetInputDir(Camera * camera) { +#if IS_CAMERA_DEBUG_ENABLED + if (gDebugCamEnabled) { + return D_8015BD80.sub.unk_104A; + } +#endif -s16 Camera_GetInputDirPitch(Camera* camera) { - Vec3s dir = Camera_GetInputDir(camera); + return camera->inputDir; + } - return dir.x; -} + s16 Camera_GetInputDirPitch(Camera * camera) { + Vec3s dir = Camera_GetInputDir(camera); -s16 Camera_GetInputDirYaw(Camera* camera) { - Vec3s dir = Camera_GetInputDir(camera); + return dir.x; + } - return dir.y; -} + s16 Camera_GetInputDirYaw(Camera * camera) { + Vec3s dir = Camera_GetInputDir(camera); -Vec3s Camera_GetCamDir(Camera* camera) { - if (gDebugCamEnabled) { - return D_8015BD80.sub.unk_104A; - } else { - return camera->camDir; - } -} + return dir.y; + } -s16 Camera_GetCamDirPitch(Camera* camera) { - Vec3s camDir = Camera_GetCamDir(camera); + Vec3s Camera_GetCamDir(Camera * camera) { +#if IS_CAMERA_DEBUG_ENABLED + if (gDebugCamEnabled) { + return D_8015BD80.sub.unk_104A; + } +#endif - return camDir.x; -} + return camera->camDir; + } -s16 Camera_GetCamDirYaw(Camera* camera) { - Vec3s camDir = Camera_GetCamDir(camera); + s16 Camera_GetCamDirPitch(Camera * camera) { + Vec3s camDir = Camera_GetCamDir(camera); - return camDir.y; -} + return camDir.x; + } -s32 Camera_RequestQuake(Camera* camera, s32 unused, s16 y, s32 duration) { - s16 quakeIndex; + s16 Camera_GetCamDirYaw(Camera * camera) { + Vec3s camDir = Camera_GetCamDir(camera); - quakeIndex = Quake_Request(camera, QUAKE_TYPE_3); - if (quakeIndex == 0) { - return false; - } - Quake_SetSpeed(quakeIndex, 0x61A8); - Quake_SetPerturbations(quakeIndex, y, 0, 0, 0); - Quake_SetDuration(quakeIndex, duration); - return true; -} + return camDir.y; + } -s32 Camera_SetViewParam(Camera* camera, s32 viewFlag, void* param) { - s32 pad[3]; + s32 Camera_RequestQuake(Camera * camera, s32 unused, s16 y, s32 duration) { + s16 quakeIndex; - if (param != NULL) { - switch (viewFlag) { - case CAM_VIEW_AT: - camera->viewFlags &= ~(CAM_VIEW_AT | CAM_VIEW_TARGET | CAM_VIEW_TARGET_POS); - camera->at = *(Vec3f*)param; - break; - - case CAM_VIEW_TARGET_POS: - camera->viewFlags &= ~(CAM_VIEW_AT | CAM_VIEW_TARGET | CAM_VIEW_TARGET_POS); - camera->targetPosRot.pos = *(Vec3f*)param; - break; - - case CAM_VIEW_TARGET: - if (camera->setting != CAM_SET_CS_C && camera->setting != CAM_SET_CS_ATTENTION) { - camera->target = (Actor*)param; - camera->viewFlags &= ~(CAM_VIEW_AT | CAM_VIEW_TARGET | CAM_VIEW_TARGET_POS); - } - break; - - case CAM_VIEW_EYE: - camera->eye = camera->eyeNext = *(Vec3f*)param; - break; - - case CAM_VIEW_UP: - camera->up = *(Vec3f*)param; - break; - - case CAM_VIEW_ROLL: - camera->roll = CAM_DEG_TO_BINANG(*(f32*)param); - break; - - case CAM_VIEW_FOV: - camera->fov = *(f32*)param; - break; - - default: + quakeIndex = Quake_Request(camera, QUAKE_TYPE_3); + if (quakeIndex == 0) { return false; - } - camera->viewFlags |= viewFlag; - } else { - return false; - } - return true; -} - -s32 Camera_UnsetViewFlag(Camera* camera, s16 viewFlag) { - camera->viewFlags &= ~viewFlag; - return true; -} - -s32 Camera_OverwriteStateFlags(Camera* camera, s16 stateFlags) { - camera->stateFlags = stateFlags; - return true; -} - -s32 Camera_ResetAnim(Camera* camera) { - camera->animState = 0; - return 1; -} - -s32 Camera_SetCSParams(Camera* camera, CutsceneCameraPoint* atPoints, CutsceneCameraPoint* eyePoints, Player* player, - s16 relativeToPlayer) { - PosRot playerPosRot; - - camera->data0 = atPoints; - camera->data1 = eyePoints; - camera->data2 = relativeToPlayer; - - if (camera->data2 != 0) { - camera->player = player; - playerPosRot = Actor_GetWorldPosShapeRot(&player->actor); - camera->playerPosRot = playerPosRot; - - camera->nextBgCamIndex = -1; - camera->xzSpeed = 0.0f; - camera->speedRatio = 0.0f; - } - - return 1; -} - -s16 Camera_SetStateFlag(Camera* camera, s16 stateFlag) { - camera->stateFlags |= stateFlag; - return camera->stateFlags; -} - -s16 Camera_UnsetStateFlag(Camera* camera, s16 stateFlag) { - camera->stateFlags &= ~stateFlag; - return camera->stateFlags; -} - -/** - * A bgCamIndex of -99 will save the door params without changing the camera setting - * A bgCamIndex of -1 uses the default door camera setting (CAM_SET_DOORC) - * Otherwise, change the door camera setting by reading the bgCam indexed at bgCamIndex - */ -s32 Camera_ChangeDoorCam(Camera* camera, Actor* doorActor, s16 bgCamIndex, f32 arg3, s16 timer1, s16 timer2, - s16 timer3) { - DoorParams* doorParams = &camera->paramData.doorParams; - - if ((camera->setting == CAM_SET_CS_ATTENTION) || (camera->setting == CAM_SET_DOORC)) { - return 0; - } - - doorParams->doorActor = doorActor; - doorParams->timer1 = timer1; - doorParams->timer2 = timer2; - doorParams->timer3 = timer3; - doorParams->bgCamIndex = bgCamIndex; - - if (bgCamIndex == -99) { - Camera_CopyDataToRegs(camera, camera->mode); - return -99; - } - - if (bgCamIndex == -1) { - Camera_RequestSetting(camera, CAM_SET_DOORC); - PRINTF(".... change default door camera (set %d)\n", CAM_SET_DOORC); - } else { - s32 setting = Camera_GetBgCamSetting(camera, bgCamIndex); - - camera->behaviorFlags |= CAM_BEHAVIOR_BG_PROCESSED; - - if (Camera_RequestSetting(camera, setting) >= 0) { - camera->bgCamIndex = bgCamIndex; - camera->behaviorFlags |= CAM_BEHAVIOR_BG_SUCCESS; + } + Quake_SetSpeed(quakeIndex, 0x61A8); + Quake_SetPerturbations(quakeIndex, y, 0, 0, 0); + Quake_SetDuration(quakeIndex, duration); + return true; } - PRINTF("....change door camera ID %d (set %d)\n", camera->bgCamIndex, camera->setting); - } + s32 Camera_SetViewParam(Camera * camera, s32 viewFlag, void* param) { + s32 pad[3]; - Camera_CopyDataToRegs(camera, camera->mode); - return -1; -} + if (param != NULL) { + switch (viewFlag) { + case CAM_VIEW_AT: + camera->viewFlags &= ~(CAM_VIEW_AT | CAM_VIEW_TARGET | CAM_VIEW_TARGET_POS); + camera->at = *(Vec3f*)param; + break; -s32 Camera_Copy(Camera* dstCamera, Camera* srcCamera) { - s32 pad; + case CAM_VIEW_TARGET_POS: + camera->viewFlags &= ~(CAM_VIEW_AT | CAM_VIEW_TARGET | CAM_VIEW_TARGET_POS); + camera->targetPosRot.pos = *(Vec3f*)param; + break; - dstCamera->playerToAtOffset.x = 0.0f; - dstCamera->playerToAtOffset.y = 0.0f; - dstCamera->playerToAtOffset.z = 0.0f; - dstCamera->atLERPStepScale = 0.1f; - dstCamera->at = srcCamera->at; + case CAM_VIEW_TARGET: + if (camera->setting != CAM_SET_CS_C && camera->setting != CAM_SET_CS_ATTENTION) { + camera->target = (Actor*)param; + camera->viewFlags &= ~(CAM_VIEW_AT | CAM_VIEW_TARGET | CAM_VIEW_TARGET_POS); + } + break; - dstCamera->eye = dstCamera->eyeNext = srcCamera->eye; + case CAM_VIEW_EYE: + camera->eye = camera->eyeNext = *(Vec3f*)param; + break; - dstCamera->dist = OLib_Vec3fDist(&dstCamera->at, &dstCamera->eye); - dstCamera->fov = srcCamera->fov; - dstCamera->roll = srcCamera->roll; - func_80043B60(dstCamera); + case CAM_VIEW_UP: + camera->up = *(Vec3f*)param; + break; - if (dstCamera->player != NULL) { - dstCamera->playerPosRot = Actor_GetWorld(&dstCamera->player->actor); - dstCamera->playerToAtOffset.x = dstCamera->at.x - dstCamera->playerPosRot.pos.x; - dstCamera->playerToAtOffset.y = dstCamera->at.y - dstCamera->playerPosRot.pos.y; - dstCamera->playerToAtOffset.z = dstCamera->at.z - dstCamera->playerPosRot.pos.z; - dstCamera->dist = OLib_Vec3fDist(&dstCamera->playerPosRot.pos, &dstCamera->eye); - dstCamera->xzOffsetUpdateRate = 1.0f; - dstCamera->yOffsetUpdateRate = 1.0f; - } - return true; -} + case CAM_VIEW_ROLL: + camera->roll = CAM_DEG_TO_BINANG(*(f32*)param); + break; -s32 Camera_IsDebugCamEnabled(void) { - return gDebugCamEnabled; -} + case CAM_VIEW_FOV: + camera->fov = *(f32*)param; + break; -Vec3f Camera_GetQuakeOffset(Camera* camera) { - return camera->quakeOffset; -} + default: + return false; + } + camera->viewFlags |= viewFlag; + } else { + return false; + } + return true; + } -void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3, - UNK_TYPE arg6) { - if (setDataFlags & 0x1) { - camera->data0 = data0; - } + s32 Camera_UnsetViewFlag(Camera * camera, s16 viewFlag) { + camera->viewFlags &= ~viewFlag; + return true; + } - if (setDataFlags & 0x2) { - camera->data1 = data1; - } + s32 Camera_OverwriteStateFlags(Camera * camera, s16 stateFlags) { + camera->stateFlags = stateFlags; + return true; + } - if (setDataFlags & 0x4) { - camera->data2 = data2; - } + s32 Camera_ResetAnim(Camera * camera) { + camera->animState = 0; + return 1; + } - if (setDataFlags & 0x8) { - camera->data3 = data3; - } + s32 Camera_SetCSParams(Camera * camera, CutsceneCameraPoint * atPoints, CutsceneCameraPoint * eyePoints, + Player * player, s16 relativeToPlayer) { + PosRot playerPosRot; - if (setDataFlags & 0x10) { - PRINTF(VT_COL(RED, WHITE) "camera: setCameraData: last argument not alive!\n" VT_RST); - } -} + camera->data0 = atPoints; + camera->data1 = eyePoints; + camera->data2 = relativeToPlayer; -s32 Camera_QRegInit(void) { - if (!R_RELOAD_CAM_PARAMS) { - QREG(2) = 1; - QREG(10) = -1; - QREG(11) = 100; - QREG(12) = 80; - QREG(20) = 90; - QREG(21) = 10; - QREG(22) = 10; - QREG(23) = 50; - QREG(24) = 6000; - QREG(25) = 240; - QREG(26) = 40; - QREG(27) = 85; - QREG(28) = 55; - QREG(29) = 87; - QREG(30) = 23; - QREG(31) = 20; - QREG(32) = 4; - QREG(33) = 5; - QREG(50) = 1; - QREG(51) = 20; - QREG(52) = 200; - QREG(53) = 1; - QREG(54) = 15; - QREG(55) = 60; - QREG(56) = 15; - QREG(57) = 30; - QREG(58) = 0; - } + if (camera->data2 != 0) { + camera->player = player; + playerPosRot = Actor_GetWorldPosShapeRot(&player->actor); + camera->playerPosRot = playerPosRot; - QREG(65) = 50; - return true; -} + camera->nextBgCamIndex = -1; + camera->xzSpeed = 0.0f; + camera->speedRatio = 0.0f; + } -s32 func_8005B198(void) { - return D_8011D3AC; -} + return 1; + } -/** - * Signal to the camera update function through stateFlags that something external has - * finished and is ready for the next camera setting/function - * Different camera update functions will respond differently to this flag being set. - */ -s16 Camera_SetFinishedFlag(Camera* camera) { - camera->stateFlags |= CAM_STATE_EXTERNAL_FINISHED; + s16 Camera_SetStateFlag(Camera * camera, s16 stateFlag) { + camera->stateFlags |= stateFlag; + return camera->stateFlags; + } - if ((camera->camId == CAM_ID_MAIN) && (camera->play->activeCamId != CAM_ID_MAIN)) { - GET_ACTIVE_CAM(camera->play)->stateFlags |= CAM_STATE_EXTERNAL_FINISHED; - return camera->play->activeCamId; - } + s16 Camera_UnsetStateFlag(Camera * camera, s16 stateFlag) { + camera->stateFlags &= ~stateFlag; + return camera->stateFlags; + } - return camera->camId; -} + /** + * A bgCamIndex of -99 will save the door params without changing the camera setting + * A bgCamIndex of -1 uses the default door camera setting (CAM_SET_DOORC) + * Otherwise, change the door camera setting by reading the bgCam indexed at bgCamIndex + */ + s32 Camera_ChangeDoorCam(Camera * camera, Actor * doorActor, s16 bgCamIndex, f32 arg3, s16 timer1, s16 timer2, + s16 timer3) { + DoorParams* doorParams = &camera->paramData.doorParams; + + if ((camera->setting == CAM_SET_CS_ATTENTION) || (camera->setting == CAM_SET_DOORC)) { + return 0; + } + + doorParams->doorActor = doorActor; + doorParams->timer1 = timer1; + doorParams->timer2 = timer2; + doorParams->timer3 = timer3; + doorParams->bgCamIndex = bgCamIndex; + + if (bgCamIndex == -99) { + Camera_CopyDataToRegs(camera, camera->mode); + return -99; + } + + if (bgCamIndex == -1) { + Camera_RequestSetting(camera, CAM_SET_DOORC); + PRINTF(".... change default door camera (set %d)\n", CAM_SET_DOORC); + } else { + s32 setting = Camera_GetBgCamSetting(camera, bgCamIndex); + + camera->behaviorFlags |= CAM_BEHAVIOR_BG_PROCESSED; + + if (Camera_RequestSetting(camera, setting) >= 0) { + camera->bgCamIndex = bgCamIndex; + camera->behaviorFlags |= CAM_BEHAVIOR_BG_SUCCESS; + } + + PRINTF("....change door camera ID %d (set %d)\n", camera->bgCamIndex, camera->setting); + } + + Camera_CopyDataToRegs(camera, camera->mode); + return -1; + } + + s32 Camera_Copy(Camera * dstCamera, Camera * srcCamera) { + dstCamera->playerToAtOffset.x = dstCamera->playerToAtOffset.y = dstCamera->playerToAtOffset.z = 0.0f; + dstCamera->atLERPStepScale = 0.1f; + dstCamera->at = srcCamera->at; + + dstCamera->eye = dstCamera->eyeNext = srcCamera->eye; + + dstCamera->dist = OLib_Vec3fDist(&dstCamera->at, &dstCamera->eye); + dstCamera->fov = srcCamera->fov; + dstCamera->roll = srcCamera->roll; + func_80043B60(dstCamera); + + if (dstCamera->player != NULL) { + dstCamera->playerPosRot = Actor_GetWorld(&dstCamera->player->actor); + dstCamera->playerToAtOffset.x = dstCamera->at.x - dstCamera->playerPosRot.pos.x; + dstCamera->playerToAtOffset.y = dstCamera->at.y - dstCamera->playerPosRot.pos.y; + dstCamera->playerToAtOffset.z = dstCamera->at.z - dstCamera->playerPosRot.pos.z; + dstCamera->dist = OLib_Vec3fDist(&dstCamera->playerPosRot.pos, &dstCamera->eye); + dstCamera->xzOffsetUpdateRate = 1.0f; + dstCamera->yOffsetUpdateRate = 1.0f; + } + return true; + } + + s32 Camera_IsDebugCamEnabled(void) { +#if IS_CAMERA_DEBUG_ENABLED + return gDebugCamEnabled; +#else + return false; +#endif + } + + Vec3f Camera_GetQuakeOffset(Camera * camera) { + return camera->quakeOffset; + } + + void Camera_SetCameraData(Camera * camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3, + UNK_TYPE arg6) { + if (setDataFlags & 0x1) { + camera->data0 = data0; + } + + if (setDataFlags & 0x2) { + camera->data1 = data1; + } + + if (setDataFlags & 0x4) { + camera->data2 = data2; + } + + if (setDataFlags & 0x8) { + camera->data3 = data3; + } + + if (setDataFlags & 0x10) { + PRINTF(VT_COL(RED, WHITE) "camera: setCameraData: last argument not alive!\n" VT_RST); + } + } + +#if IS_CAMERA_DEBUG_ENABLED + s32 Camera_QRegInit(void) { + if (!R_RELOAD_CAM_PARAMS) { + QREG(2) = 1; + QREG(10) = -1; + QREG(11) = 100; + QREG(12) = 80; + QREG(20) = 90; + QREG(21) = 10; + QREG(22) = 10; + QREG(23) = 50; + QREG(24) = 6000; + QREG(25) = 240; + QREG(26) = 40; + QREG(27) = 85; + QREG(28) = 55; + QREG(29) = 87; + QREG(30) = 23; + QREG(31) = 20; + QREG(32) = 4; + QREG(33) = 5; + QREG(50) = 1; + QREG(51) = 20; + QREG(52) = 200; + QREG(53) = 1; + QREG(54) = 15; + QREG(55) = 60; + QREG(56) = 15; + QREG(57) = 30; + QREG(58) = 0; + } + + QREG(65) = 50; + return true; + } +#endif + + s32 func_8005B198(void) { + return D_8011D3AC; + } + + /** + * Signal to the camera update function through stateFlags that something external has + * finished and is ready for the next camera setting/function + * Different camera update functions will respond differently to this flag being set. + */ + s16 Camera_SetFinishedFlag(Camera * camera) { + camera->stateFlags |= CAM_STATE_EXTERNAL_FINISHED; + + if ((camera->camId == CAM_ID_MAIN) && (camera->play->activeCamId != CAM_ID_MAIN)) { + GET_ACTIVE_CAM(camera->play)->stateFlags |= CAM_STATE_EXTERNAL_FINISHED; + return camera->play->activeCamId; + } + + return camera->camId; + } diff --git a/src/code/z_camera_data.inc.c b/src/code/z_camera_data.inc.c index 4a4c828e2..8c64d260a 100644 --- a/src/code/z_camera_data.inc.c +++ b/src/code/z_camera_data.inc.c @@ -26,6 +26,8 @@ typedef struct { /*==================================================================*/ // Data + +#if IS_CAMERA_DEBUG_ENABLED s16 sOREGInit[] = { 0, // OREG(0) 1, // OREG(1) @@ -83,6 +85,7 @@ s16 sOREGInit[] = { }; s16 sOREGInitCnt = ARRAY_COUNT(sOREGInit); +#endif s16 sCamDataRegsInit[CAM_DATA_MAX] = { -20, // CAM_DATA_Y_OFFSET @@ -116,6 +119,7 @@ s16 sCamDataRegsInit[CAM_DATA_MAX] = { s16 sCamDataRegsInitCount = ARRAY_COUNT(sCamDataRegsInit); +#if IS_CAMERA_DEBUG_ENABLED char sCameraSettingNames[][12] = { "NONE ", // CAM_SET_NONE "NORMAL0 ", // CAM_SET_NORMAL0 @@ -208,6 +212,7 @@ char sCameraModeNames[][12] = { "PUSHPULL ", // CAM_MODE_PUSH_PULL "BOOKEEPON ", // CAM_MODE_FOLLOW_BOOMERANG }; +#endif /** *===================================================================== @@ -2555,8 +2560,13 @@ s32 (*sCameraFunctions[])(Camera*) = { s32 sInitRegs = 1; +// ENABLE_CAMERA_DEBUGGER s32 gDebugCamEnabled = false; + +#if IS_CAMERA_DEBUG_ENABLED s32 sDbgModeIdx = -1; +#endif + s16 sNextUID = 0; s32 sCameraInterfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_NONE, CAM_HUD_VISIBILITY_ALL, 1); @@ -2579,6 +2589,7 @@ s32 D_8011D3F0 = 0; s32 sDemo5PrevAction12Frame = -16; +#if IS_CAMERA_DEBUG_ENABLED char sCameraFunctionNames[][8] = { "NONE ", // CAM_FUNC_NONE "NORM0()", // CAM_FUNC_NORM0 @@ -2653,6 +2664,7 @@ char sCameraFunctionNames[][8] = { "SPEC9()", // CAM_FUNC_SPEC9 "", "", "", "", "", }; +#endif VecSph D_8011D658[] = { { 50.0f, 0xEE3A, 0xD558 }, @@ -2668,371 +2680,10 @@ Vec3f D_8011D678[] = { { 0.0f, 3.0f, -3.0 }, }; -/******************************************************* - * OnePoint initalization values for Attention Cutscenes (Demo5) - ********************************************************/ -s32 sDemo5PrevSfxFrame = -200; - -// target is player, far from eye -OnePointCsFull D_8011D6AC[] = { - { - // viewFlags & 0x00FF (at): 2, atTarget is view lookAt + atInit - // viewFlags & 0xFF00 (eye): none - // action: 15, copy at, eye, roll, fov to camera - // result: eye remains in the same location, at is View's lookAt - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0002, - 1, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - // viewFlags & 0x00FF (at): 3, atTarget is camera's current at + atInit - // viewFlags & 0xFF00 (eye): 3, eyeTarget is the camera's current eye + eyeInit - // action: interpolate eye and at. - // result: eye and at's y interpolate to become +20 from their current location. - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0303, - 19, - 0, - 45.0f, - 1.0f, - { 0.0f, 20.0f, 0.0f }, - { 0.0f, 20.0f, 0.0f }, - }, - { - // viewFlags & 0x00FF (at): 0 none - // viewFlags & 0xFF00 (eye): 0 none - // action: 18, copy this camera to default camera. - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -// target is player close to current eye -OnePointCsFull D_8011D724[] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2424, - 1, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 10.0f, -20.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 19, - 0, - 50.0f, - 1.0f, - { 0.0f, -10.0f, 0.0f }, - { 0.0f, 0.0f, 60.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -// target is close to player -OnePointCsFull D_8011D79C[] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0002, - 1, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0303, - 19, - 0, - 45.0f, - 1.0f, - { 0.0f, -20.0f, 0.0f }, - { 0.0f, -10.0f, 5.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0303, - 9, - 0, - 60.0f, - 1.0f, - { 0.0f, 10.0f, 0.0f }, - { 0.0f, 10.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -// target is within 300 units of eye, and player is within 30 units of eye -OnePointCsFull D_8011D83C[] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2141, - 20, - 0, - 45.0f, - 0.2f, - { 0.0f, 0.0f, 10.0f }, - { 0.0f, 0.0f, 10.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -// target is within 700 units of eye, angle between player/eye and target/eye is less than -// 76.9 degrees. The x/y coordinates of the target on screen is between (21, 41) and (300, 200), -// and the player is farther than 30 units of the eye -OnePointCsFull D_8011D88C[] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0303, - 20, - 0, - 45.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -// same as above, but the target is NOT within the screen area. -OnePointCsFull D_8011D8DC[] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0404, - 20, - 1, - 50.0f, - 1.0f, - { 0.0f, 5.0f, 10.0f }, - { 0.0f, 10.0f, -80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 5, - 0, - 60.0f, - 1.0f, - { 0.0f, 5.0f, 0.0f }, - { 5.0f, 5.0f, -200.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -// target is a door. -OnePointCsFull D_8011D954[] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0xC1C1, - 20, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 50.0f }, - { 0.0f, 0.0f, 250.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x05B1, - 5, - 0, - 60.0f, - 0.1f, - { 0.0f, 10.0f, 50.0f }, - { 0.0f, 10.0f, 100.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 5, - 2, - 60.0f, - 1.0f, - { 0.0f, 10.0f, 0.0f }, - { 0.0f, 20.0f, -150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -// otherwise -OnePointCsFull D_8011D9F4[] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0504, - 20, - 2, - 60.0f, - 1.0f, - { 0.0f, 5.0f, 50.0f }, - { 0.0f, 20.0f, 300.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 5, - 2, - 60.0f, - 1.0f, - { 0.0f, 10.0f, 0.0f }, - { 0.0f, 20.0f, -150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -typedef enum { - /* 0 */ CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR, // ACTOR_BG_HIDAN_ROCK - /* 1 */ CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER, // ACTOR_BG_HIDAN_FSLIFT - /* 2 */ CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER, // ACTOR_BG_HIDAN_SYOKU - /* 3 */ CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE // ACTOR_BG_JYA_1FLIFT -} CamElevatorPlatform; - -Vec3f sCamElevatorPlatformLowerEyePoints[] = { - { 3050.0f, 700.0f, 0.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR - { 1755.0f, 3415.0f, -380.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER - { -3120.0f, 3160.0f, 245.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER - { 0.0f, -10.0f, 240.0f }, // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE -}; - -Vec3f sCamElevatorPlatformUpperEyePoints[] = { - { 3160.0f, 2150.0f, 0.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR - { 1515.0f, 4130.0f, -835.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER - { -3040.0f, 4135.0f, 230.0f }, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER - { -50.0f, 600.0f, -75.0f }, // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE -}; - -// Trigger player y position to swap eye points -f32 sCamElevatorPlatformTogglePosY[] = { - 1570.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR - 3680.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER - 3700.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER - 395.0f, // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE -}; - -f32 sCamElevatorPlatformFovRollParam[] = { - 320.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR - 320.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER - 320.0f, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER - 0.0f, // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE -}; - -s16 sCamElevatorPlatformRolls[] = { - -2000, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_LOWER_FLOOR - -1000, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_EAST_TOWER - 0, // CAM_ELEVATOR_PLATFORM_FIRE_TEMPLE_WEST_TOWER - 0 // CAM_ELEVATOR_PLATFORM_SPIRIT_TEMPLE_ENTRANCE -}; - -// unused -s32 D_8011DAF4 = 0; -s32 D_8011DAF8 = 0; - -s16 D_8011DAFC[] = { - CAM_SET_NORMAL0, CAM_SET_NORMAL1, CAM_SET_NORMAL2, CAM_SET_DUNGEON0, CAM_SET_DUNGEON1, CAM_SET_DUNGEON2, -}; - PlayState* D_8015BD7C; + +#if IS_CAMERA_DEBUG_ENABLED DebugCam D_8015BD80; +#endif + CollisionPoly* playerFloorPoly; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 57510f3c4..1791d4cf4 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -7,7 +7,7 @@ typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); typedef void (*ColChkVsFunc)(PlayState*, CollisionCheckContext*, Collider*, Collider*); typedef s32 (*ColChkLineFunc)(PlayState*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*); -#if OOT_DEBUG +#if IS_DEBUG /** * Draws a red triangle with vertices vA, vB, and vC. */ @@ -139,18 +139,19 @@ void Collider_ResetOCBase(PlayState* play, Collider* col) { col->ocFlags2 &= ~OC2_HIT_PLAYER; } -s32 Collider_InitElementTouch(PlayState* play, ColliderElementTouch* touch) { - static ColliderElementTouch init = { 0x00000000, 0, 0 }; +s32 Collider_InitElementDamageInfoAT(PlayState* play, ColliderElementDamageInfoAT* atDmgInfo) { + static ColliderElementDamageInfoAT init = { 0x00000000, 0, 0 }; - *touch = init; + *atDmgInfo = init; return true; } -s32 Collider_DestroyElementTouch(PlayState* play, ColliderElementTouch* touch) { +s32 Collider_DestroyElementDamageInfoAT(PlayState* play, ColliderElementDamageInfoAT* atDmgInfo) { return true; } -s32 Collider_SetElementTouch(PlayState* play, ColliderElementTouch* dest, ColliderElementTouch* src) { +s32 Collider_SetElementDamageInfoAT(PlayState* play, ColliderElementDamageInfoAT* dest, + ColliderElementDamageInfoAT* src) { dest->dmgFlags = src->dmgFlags; dest->effect = src->effect; dest->damage = src->damage; @@ -160,51 +161,52 @@ s32 Collider_SetElementTouch(PlayState* play, ColliderElementTouch* dest, Collid void Collider_ResetATElement_Unk(PlayState* play, ColliderElement* elem) { } -s32 Collider_InitElementBump(PlayState* play, ColliderElementBump* bump) { - static ColliderElementBump init = { 0xFFCFFFFF, 0, 0, { 0, 0, 0 } }; +s32 Collider_InitElementDamageInfoAC(PlayState* play, ColliderElementDamageInfoAC* acDmgInfo) { + static ColliderElementDamageInfoAC init = { 0xFFCFFFFF, 0, 0, { 0, 0, 0 } }; - *bump = init; + *acDmgInfo = init; return true; } -s32 Collider_DestroyElementBump(PlayState* play, ColliderElementBump* bump) { +s32 Collider_DestroyElementDamageInfoAC(PlayState* play, ColliderElementDamageInfoAC* acDmgInfo) { return true; } -s32 Collider_SetElementBump(PlayState* play, ColliderElementBump* bump, ColliderElementBumpInit* init) { - bump->dmgFlags = init->dmgFlags; - bump->effect = init->effect; - bump->defense = init->defense; +s32 Collider_SetElementDamageInfoAC(PlayState* play, ColliderElementDamageInfoAC* acDmgInfo, + ColliderElementDamageInfoACInit* init) { + acDmgInfo->dmgFlags = init->dmgFlags; + acDmgInfo->effect = init->effect; + acDmgInfo->defense = init->defense; return true; } s32 Collider_InitElement(PlayState* play, ColliderElement* elem) { static ColliderElement init = { { 0, 0, 0 }, { 0xFFCFFFFF, 0, 0, { 0, 0, 0 } }, - ELEMTYPE_UNK0, TOUCH_NONE, - BUMP_NONE, OCELEM_NONE, + ELEMTYPE_UNK0, ATELEM_NONE, + ACELEM_NONE, OCELEM_NONE, NULL, NULL, NULL, NULL, }; *elem = init; - Collider_InitElementTouch(play, &elem->toucher); - Collider_InitElementBump(play, &elem->bumper); + Collider_InitElementDamageInfoAT(play, &elem->atDmgInfo); + Collider_InitElementDamageInfoAC(play, &elem->acDmgInfo); return true; } s32 Collider_DestroyElement(PlayState* play, ColliderElement* elem) { - Collider_DestroyElementTouch(play, &elem->toucher); - Collider_DestroyElementBump(play, &elem->bumper); + Collider_DestroyElementDamageInfoAT(play, &elem->atDmgInfo); + Collider_DestroyElementDamageInfoAC(play, &elem->acDmgInfo); return true; } s32 Collider_SetElement(PlayState* play, ColliderElement* elem, ColliderElementInit* elemInit) { elem->elemType = elemInit->elemType; - Collider_SetElementTouch(play, &elem->toucher, &elemInit->toucher); - Collider_SetElementBump(play, &elem->bumper, &elemInit->bumper); - elem->toucherFlags = elemInit->toucherFlags; - elem->bumperFlags = elemInit->bumperFlags; + Collider_SetElementDamageInfoAT(play, &elem->atDmgInfo, &elemInit->atDmgInfo); + Collider_SetElementDamageInfoAC(play, &elem->acDmgInfo, &elemInit->acDmgInfo); + elem->atElemFlags = elemInit->atElemFlags; + elem->acElemFlags = elemInit->acElemFlags; elem->ocElemFlags = elemInit->ocElemFlags; return true; } @@ -212,15 +214,15 @@ s32 Collider_SetElement(PlayState* play, ColliderElement* elem, ColliderElementI void Collider_ResetATElement(PlayState* play, ColliderElement* elem) { elem->atHit = NULL; elem->atHitElem = NULL; - elem->toucherFlags &= ~TOUCH_HIT; - elem->toucherFlags &= ~TOUCH_DREW_HITMARK; + elem->atElemFlags &= ~ATELEM_HIT; + elem->atElemFlags &= ~ATELEM_DREW_HITMARK; Collider_ResetATElement_Unk(play, elem); } void Collider_ResetACElement(PlayState* play, ColliderElement* elem) { - elem->bumper.hitPos.x = elem->bumper.hitPos.y = elem->bumper.hitPos.z = 0; - elem->bumperFlags &= ~BUMP_HIT; - elem->bumperFlags &= ~BUMP_DRAW_HITMARK; + elem->acDmgInfo.hitPos.x = elem->acDmgInfo.hitPos.y = elem->acDmgInfo.hitPos.z = 0; + elem->acElemFlags &= ~ACELEM_HIT; + elem->acElemFlags &= ~ACELEM_DRAW_HITMARK; elem->acHit = NULL; elem->acHitElem = NULL; } @@ -929,7 +931,7 @@ s32 Collider_QuadSetNearestAC(PlayState* play, ColliderQuad* quad, Vec3f* hitPos f32 acDistSq; Vec3f dcMid; - if (!(quad->elem.toucherFlags & TOUCH_NEAREST)) { + if (!(quad->elem.atElemFlags & ATELEM_NEAREST)) { return true; } Math_Vec3s_ToVec3f(&dcMid, &quad->dim.dcMid); @@ -1003,7 +1005,7 @@ void CollisionCheck_InitContext(PlayState* play, CollisionCheckContext* colChkCt colChkCtx->sacFlags = 0; CollisionCheck_ClearContext(play, colChkCtx); -#if OOT_DEBUG +#if IS_DEBUG AREG(21) = true; AREG(22) = true; AREG(23) = true; @@ -1057,7 +1059,7 @@ void CollisionCheck_DisableSAC(PlayState* play, CollisionCheckContext* colChkCtx colChkCtx->sacFlags &= ~SAC_ENABLE; } -#if OOT_DEBUG +#if IS_DEBUG /** * Draws a collider of any shape. * Math3D_DrawSphere and Math3D_DrawCylinder are noops, so JntSph and Cylinder are not drawn. @@ -1155,6 +1157,7 @@ s32 CollisionCheck_SetAT(PlayState* play, CollisionCheckContext* colChkCtx, Coll if (FrameAdvance_IsEnabled(play) == true) { return -1; } + ASSERT(collider->shape < COLSHAPE_MAX, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 2997); sATResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { @@ -1180,9 +1183,11 @@ s32 CollisionCheck_SetAT(PlayState* play, CollisionCheckContext* colChkCtx, Coll */ s32 CollisionCheck_SetAT_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index) { ASSERT(collider->shape < COLSHAPE_MAX, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3037); + if (FrameAdvance_IsEnabled(play) == true) { return -1; } + sATResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1223,6 +1228,7 @@ s32 CollisionCheck_SetAC(PlayState* play, CollisionCheckContext* colChkCtx, Coll if (FrameAdvance_IsEnabled(play) == true) { return -1; } + ASSERT(collider->shape < COLSHAPE_MAX, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3114); sACResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { @@ -1248,9 +1254,11 @@ s32 CollisionCheck_SetAC(PlayState* play, CollisionCheckContext* colChkCtx, Coll */ s32 CollisionCheck_SetAC_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index) { ASSERT(collider->shape < COLSHAPE_MAX, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3153); + if (FrameAdvance_IsEnabled(play) == true) { return -1; } + sACResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1320,6 +1328,7 @@ s32 CollisionCheck_SetOC_SAC(PlayState* play, CollisionCheckContext* colChkCtx, if (FrameAdvance_IsEnabled(play) == true) { return -1; } + ASSERT(collider->shape < COLSHAPE_MAX, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3274); sOCResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { @@ -1355,6 +1364,7 @@ s32 CollisionCheck_SetOCLine(PlayState* play, CollisionCheckContext* colChkCtx, if (FrameAdvance_IsEnabled(play) == true) { return -1; } + Collider_ResetLineOC(play, collider); if (!(colChkCtx->colLineCount < COLLISION_CHECK_OC_LINE_MAX)) { // "Index exceeded and cannot add more" @@ -1366,21 +1376,15 @@ s32 CollisionCheck_SetOCLine(PlayState* play, CollisionCheckContext* colChkCtx, return index; } -/** - * Skips AT elements that are off. - */ -s32 CollisionCheck_SkipElementTouch(ColliderElement* elem) { - if (!(elem->toucherFlags & TOUCH_ON)) { +s32 CollisionCheck_IsElementNotAT(ColliderElement* elem) { + if (!(elem->atElemFlags & ATELEM_ON)) { return true; } return false; } -/** - * Skips AC elements that are off. - */ -s32 CollisionCheck_SkipElementBump(ColliderElement* elem) { - if (!(elem->bumperFlags & BUMP_ON)) { +s32 CollisionCheck_IsElementNotAC(ColliderElement* elem) { + if (!(elem->acElemFlags & ACELEM_ON)) { return true; } return false; @@ -1390,7 +1394,7 @@ s32 CollisionCheck_SkipElementBump(ColliderElement* elem) { * If the AT element has no dmgFlags in common with the AC element, no collision happens. */ s32 CollisionCheck_NoSharedFlags(ColliderElement* atElem, ColliderElement* acElem) { - if (!(atElem->toucher.dmgFlags & acElem->bumper.dmgFlags)) { + if (!(atElem->atDmgInfo.dmgFlags & acElem->acDmgInfo.dmgFlags)) { return true; } return false; @@ -1538,9 +1542,9 @@ void CollisionCheck_RedBloodUnused(PlayState* play, Collider* collider, Vec3f* v * Plays sound effects and displays hitmarks for solid-type AC colliders (METAL, WOOD, HARD, and TREE) */ void CollisionCheck_HitSolid(PlayState* play, ColliderElement* elem, Collider* collider, Vec3f* hitPos) { - s32 flags = elem->toucherFlags & TOUCH_SFX_MASK; + s32 flags = elem->atElemFlags & ATELEM_SFX_MASK; - if (flags == TOUCH_SFX_NORMAL && collider->colType != COLTYPE_METAL) { + if (flags == ATELEM_SFX_NORMAL && collider->colType != COLTYPE_METAL) { EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_WHITE, hitPos); if (collider->actor == NULL) { Audio_PlaySfxGeneral(NA_SE_IT_SHIELD_BOUND, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -1549,14 +1553,14 @@ void CollisionCheck_HitSolid(PlayState* play, ColliderElement* elem, Collider* c Audio_PlaySfxGeneral(NA_SE_IT_SHIELD_BOUND, &collider->actor->projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - } else if (flags == TOUCH_SFX_NORMAL) { // collider->colType == COLTYPE_METAL + } else if (flags == ATELEM_SFX_NORMAL) { // collider->colType == COLTYPE_METAL EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_METAL, hitPos); if (collider->actor == NULL) { CollisionCheck_SpawnShieldParticlesMetal(play, hitPos); } else { CollisionCheck_SpawnShieldParticlesMetalSfx(play, hitPos, &collider->actor->projectedPos); } - } else if (flags == TOUCH_SFX_HARD) { + } else if (flags == ATELEM_SFX_HARD) { EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_WHITE, hitPos); if (collider->actor == NULL) { Audio_PlaySfxGeneral(NA_SE_IT_SHIELD_BOUND, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -1565,7 +1569,7 @@ void CollisionCheck_HitSolid(PlayState* play, ColliderElement* elem, Collider* c Audio_PlaySfxGeneral(NA_SE_IT_SHIELD_BOUND, &collider->actor->projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - } else if (flags == TOUCH_SFX_WOOD) { + } else if (flags == ATELEM_SFX_WOOD) { EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_DUST, hitPos); if (collider->actor == NULL) { Audio_PlaySfxGeneral(NA_SE_IT_REFLECTION_WOOD, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -1655,10 +1659,10 @@ static HitInfo sHitInfo[] = { */ void CollisionCheck_HitEffects(PlayState* play, Collider* atCol, ColliderElement* atElem, Collider* acCol, ColliderElement* acElem, Vec3f* hitPos) { - if (acElem->bumperFlags & BUMP_NO_HITMARK) { + if (acElem->acElemFlags & ACELEM_NO_HITMARK) { return; } - if (!(atElem->toucherFlags & TOUCH_AT_HITMARK) && atElem->toucherFlags & TOUCH_DREW_HITMARK) { + if (!(atElem->atElemFlags & ATELEM_AT_HITMARK) && atElem->atElemFlags & ATELEM_DREW_HITMARK) { return; } if (acCol->actor != NULL) { @@ -1677,7 +1681,7 @@ void CollisionCheck_HitEffects(PlayState* play, Collider* atCol, ColliderElement } } else if (sHitInfo[acCol->colType].effect != HIT_NONE) { EffectSsHitMark_SpawnFixedScale(play, sHitInfo[acCol->colType].effect, hitPos); - if (!(acElem->bumperFlags & BUMP_NO_SWORD_SFX)) { + if (!(acElem->acElemFlags & ACELEM_NO_SWORD_SFX)) { CollisionCheck_SwordHitAudio(atCol, acElem); } } @@ -1709,33 +1713,33 @@ s32 CollisionCheck_SetATvsAC(PlayState* play, Collider* atCol, ColliderElement* if (acCol->acFlags & AC_HARD && atCol->actor != NULL && acCol->actor != NULL) { CollisionCheck_SetBounce(atCol, acCol); } - if (!(acElem->bumperFlags & BUMP_NO_AT_INFO)) { + if (!(acElem->acElemFlags & ACELEM_NO_AT_INFO)) { atCol->atFlags |= AT_HIT; atCol->at = acCol->actor; atElem->atHit = acCol; atElem->atHitElem = acElem; - atElem->toucherFlags |= TOUCH_HIT; + atElem->atElemFlags |= ATELEM_HIT; if (atCol->actor != NULL) { - atCol->actor->colChkInfo.atHitEffect = acElem->bumper.effect; + atCol->actor->colChkInfo.atHitEffect = acElem->acDmgInfo.effect; } } acCol->acFlags |= AC_HIT; acCol->ac = atCol->actor; acElem->acHit = atCol; acElem->acHitElem = atElem; - acElem->bumperFlags |= BUMP_HIT; + acElem->acElemFlags |= ACELEM_HIT; if (acCol->actor != NULL) { - acCol->actor->colChkInfo.acHitEffect = atElem->toucher.effect; + acCol->actor->colChkInfo.acHitEffect = atElem->atDmgInfo.effect; } - acElem->bumper.hitPos.x = hitPos->x; - acElem->bumper.hitPos.y = hitPos->y; - acElem->bumper.hitPos.z = hitPos->z; - if (!(atElem->toucherFlags & TOUCH_AT_HITMARK) && acCol->colType != COLTYPE_METAL && + acElem->acDmgInfo.hitPos.x = hitPos->x; + acElem->acDmgInfo.hitPos.y = hitPos->y; + acElem->acDmgInfo.hitPos.z = hitPos->z; + if (!(atElem->atElemFlags & ATELEM_AT_HITMARK) && acCol->colType != COLTYPE_METAL && acCol->colType != COLTYPE_WOOD && acCol->colType != COLTYPE_HARD) { - acElem->bumperFlags |= BUMP_DRAW_HITMARK; + acElem->acElemFlags |= ACELEM_DRAW_HITMARK; } else { CollisionCheck_HitEffects(play, atCol, atElem, acCol, acElem, hitPos); - atElem->toucherFlags |= TOUCH_DREW_HITMARK; + atElem->atElemFlags |= ATELEM_DREW_HITMARK; } return true; } @@ -1751,12 +1755,12 @@ void CollisionCheck_ATJntSphVsACJntSph(PlayState* play, CollisionCheckContext* c if (atJntSph->count > 0 && atJntSph->elements != NULL && acJntSph->count > 0 && acJntSph->elements != NULL) { for (atJntSphElem = atJntSph->elements; atJntSphElem < atJntSph->elements + atJntSph->count; atJntSphElem++) { - if (CollisionCheck_SkipElementTouch(&atJntSphElem->base) == true) { + if (CollisionCheck_IsElementNotAT(&atJntSphElem->base) == true) { continue; } for (acJntSphElem = acJntSph->elements; acJntSphElem < acJntSph->elements + acJntSph->count; acJntSphElem++) { - if (CollisionCheck_SkipElementBump(&acJntSphElem->base) == true) { + if (CollisionCheck_IsElementNotAC(&acJntSphElem->base) == true) { continue; } if (CollisionCheck_NoSharedFlags(&atJntSphElem->base, &acJntSphElem->base) == true) { @@ -1803,11 +1807,11 @@ void CollisionCheck_ATJntSphVsACCyl(PlayState* play, CollisionCheckContext* colC f32 centerDist; if (atJntSph->count > 0 && atJntSph->elements != NULL && acCyl->dim.radius > 0 && acCyl->dim.height > 0) { - if (CollisionCheck_SkipElementBump(&acCyl->elem) == true) { + if (CollisionCheck_IsElementNotAC(&acCyl->elem) == true) { return; } for (atJntSphElem = atJntSph->elements; atJntSphElem < atJntSph->elements + atJntSph->count; atJntSphElem++) { - if (CollisionCheck_SkipElementTouch(&atJntSphElem->base) == true) { + if (CollisionCheck_IsElementNotAT(&atJntSphElem->base) == true) { continue; } if (CollisionCheck_NoSharedFlags(&atJntSphElem->base, &acCyl->elem) == true) { @@ -1855,11 +1859,11 @@ void CollisionCheck_ATCylVsACJntSph(PlayState* play, CollisionCheckContext* colC ColliderJntSphElement* acJntSphElem; if (acJntSph->count > 0 && acJntSph->elements != NULL && atCyl->dim.radius > 0 && atCyl->dim.height > 0) { - if (CollisionCheck_SkipElementTouch(&atCyl->elem) == true) { + if (CollisionCheck_IsElementNotAT(&atCyl->elem) == true) { return; } for (acJntSphElem = acJntSph->elements; acJntSphElem < acJntSph->elements + acJntSph->count; acJntSphElem++) { - if (CollisionCheck_SkipElementBump(&acJntSphElem->base) == true) { + if (CollisionCheck_IsElementNotAC(&acJntSphElem->base) == true) { continue; } if (CollisionCheck_NoSharedFlags(&atCyl->elem, &acJntSphElem->base) == true) { @@ -1910,11 +1914,11 @@ void CollisionCheck_ATJntSphVsACTris(PlayState* play, CollisionCheckContext* col if (atJntSph->count > 0 && atJntSph->elements != NULL && acTris->count > 0 && acTris->elements != NULL) { for (atJntSphElem = atJntSph->elements; atJntSphElem < atJntSph->elements + atJntSph->count; atJntSphElem++) { - if (CollisionCheck_SkipElementTouch(&atJntSphElem->base) == true) { + if (CollisionCheck_IsElementNotAT(&atJntSphElem->base) == true) { continue; } for (acTrisElem = acTris->elements; acTrisElem < acTris->elements + acTris->count; acTrisElem++) { - if (CollisionCheck_SkipElementBump(&acTrisElem->base) == true) { + if (CollisionCheck_IsElementNotAC(&acTrisElem->base) == true) { continue; } if (CollisionCheck_NoSharedFlags(&atJntSphElem->base, &acTrisElem->base) == true) { @@ -1952,11 +1956,11 @@ void CollisionCheck_ATTrisVsACJntSph(PlayState* play, CollisionCheckContext* col if (acJntSph->count > 0 && acJntSph->elements != NULL && atTris->count > 0 && atTris->elements != NULL) { for (acJntSphElem = acJntSph->elements; acJntSphElem < acJntSph->elements + acJntSph->count; acJntSphElem++) { - if (CollisionCheck_SkipElementBump(&acJntSphElem->base) == true) { + if (CollisionCheck_IsElementNotAC(&acJntSphElem->base) == true) { continue; } for (atTrisElem = atTris->elements; atTrisElem < atTris->elements + atTris->count; atTrisElem++) { - if (CollisionCheck_SkipElementTouch(&atTrisElem->base) == true) { + if (CollisionCheck_IsElementNotAT(&atTrisElem->base) == true) { continue; } if (CollisionCheck_NoSharedFlags(&atTrisElem->base, &acJntSphElem->base) == true) { @@ -1994,13 +1998,13 @@ void CollisionCheck_ATJntSphVsACQuad(PlayState* play, CollisionCheckContext* col ColliderJntSphElement* atJntSphElem; if (atJntSph->count > 0 && atJntSph->elements != NULL) { - if (CollisionCheck_SkipElementBump(&acQuad->elem) == true) { + if (CollisionCheck_IsElementNotAC(&acQuad->elem) == true) { return; } Math3D_TriNorm(&tri1, &acQuad->dim.quad[2], &acQuad->dim.quad[3], &acQuad->dim.quad[1]); Math3D_TriNorm(&tri2, &acQuad->dim.quad[1], &acQuad->dim.quad[0], &acQuad->dim.quad[2]); for (atJntSphElem = atJntSph->elements; atJntSphElem < atJntSph->elements + atJntSph->count; atJntSphElem++) { - if (CollisionCheck_SkipElementTouch(&atJntSphElem->base) == true) { + if (CollisionCheck_IsElementNotAT(&atJntSphElem->base) == true) { continue; } if (CollisionCheck_NoSharedFlags(&atJntSphElem->base, &acQuad->elem) == true) { @@ -2041,13 +2045,13 @@ void CollisionCheck_ATQuadVsACJntSph(PlayState* play, CollisionCheckContext* col ColliderJntSphElement* acJntSphElem; if (acJntSph->count > 0 && acJntSph->elements != NULL) { - if (CollisionCheck_SkipElementTouch(&atQuad->elem) == true) { + if (CollisionCheck_IsElementNotAT(&atQuad->elem) == true) { return; } Math3D_TriNorm(&tri1, &atQuad->dim.quad[2], &atQuad->dim.quad[3], &atQuad->dim.quad[1]); Math3D_TriNorm(&tri2, &atQuad->dim.quad[2], &atQuad->dim.quad[1], &atQuad->dim.quad[0]); for (acJntSphElem = acJntSph->elements; acJntSphElem < acJntSph->elements + acJntSph->count; acJntSphElem++) { - if (CollisionCheck_SkipElementBump(&acJntSphElem->base) == true) { + if (CollisionCheck_IsElementNotAC(&acJntSphElem->base) == true) { continue; } if (CollisionCheck_NoSharedFlags(&atQuad->elem, &acJntSphElem->base) == true) { @@ -2091,10 +2095,10 @@ void CollisionCheck_ATCylVsACCyl(PlayState* play, CollisionCheckContext* colChkC Vec3f hitPos; if (atCyl->dim.radius > 0 && atCyl->dim.height > 0 && acCyl->dim.radius > 0 && acCyl->dim.height > 0) { - if (CollisionCheck_SkipElementBump(&acCyl->elem) == true) { + if (CollisionCheck_IsElementNotAC(&acCyl->elem) == true) { return; } - if (CollisionCheck_SkipElementTouch(&atCyl->elem) == true) { + if (CollisionCheck_IsElementNotAT(&atCyl->elem) == true) { return; } if (CollisionCheck_NoSharedFlags(&atCyl->elem, &acCyl->elem) == true) { @@ -2128,11 +2132,11 @@ void CollisionCheck_ATCylVsACTris(PlayState* play, CollisionCheckContext* colChk Vec3f hitPos; if (atCyl->dim.radius > 0 && atCyl->dim.height > 0 && acTris->count > 0 && acTris->elements != NULL) { - if (CollisionCheck_SkipElementTouch(&atCyl->elem) == true) { + if (CollisionCheck_IsElementNotAT(&atCyl->elem) == true) { return; } for (acTrisElem = acTris->elements; acTrisElem < acTris->elements + acTris->count; acTrisElem++) { - if (CollisionCheck_SkipElementBump(&acTrisElem->base) == true) { + if (CollisionCheck_IsElementNotAC(&acTrisElem->base) == true) { continue; } if (CollisionCheck_NoSharedFlags(&atCyl->elem, &acTrisElem->base) == true) { @@ -2162,11 +2166,11 @@ void CollisionCheck_ATTrisVsACCyl(PlayState* play, CollisionCheckContext* colChk ColliderCylinder* acCyl = (ColliderCylinder*)acCol; if (acCyl->dim.radius > 0 && acCyl->dim.height > 0 && atTris->count > 0 && atTris->elements != NULL) { - if (CollisionCheck_SkipElementBump(&acCyl->elem) == true) { + if (CollisionCheck_IsElementNotAC(&acCyl->elem) == true) { return; } for (atTrisElem = atTris->elements; atTrisElem < atTris->elements + atTris->count; atTrisElem++) { - if (CollisionCheck_SkipElementTouch(&atTrisElem->base) == true) { + if (CollisionCheck_IsElementNotAT(&atTrisElem->base) == true) { continue; } if (CollisionCheck_NoSharedFlags(&atTrisElem->base, &acCyl->elem) == true) { @@ -2197,8 +2201,8 @@ void CollisionCheck_ATCylVsACQuad(PlayState* play, CollisionCheckContext* colChk ColliderQuad* acQuad = (ColliderQuad*)acCol; if (atCyl->dim.height > 0 && atCyl->dim.radius > 0) { - if (CollisionCheck_SkipElementTouch(&atCyl->elem) == true || - CollisionCheck_SkipElementBump(&acQuad->elem) == true) { + if (CollisionCheck_IsElementNotAT(&atCyl->elem) == true || + CollisionCheck_IsElementNotAC(&acQuad->elem) == true) { return; } if (CollisionCheck_NoSharedFlags(&atCyl->elem, &acQuad->elem) == true) { @@ -2253,8 +2257,8 @@ void CollisionCheck_ATQuadVsACCyl(PlayState* play, CollisionCheckContext* colChk ColliderCylinder* acCyl = (ColliderCylinder*)acCol; if (acCyl->dim.height > 0 && acCyl->dim.radius > 0) { - if (CollisionCheck_SkipElementBump(&acCyl->elem) == true || - CollisionCheck_SkipElementTouch(&atQuad->elem) == true) { + if (CollisionCheck_IsElementNotAC(&acCyl->elem) == true || + CollisionCheck_IsElementNotAT(&atQuad->elem) == true) { return; } if (CollisionCheck_NoSharedFlags(&atQuad->elem, &acCyl->elem) == true) { @@ -2319,11 +2323,11 @@ void CollisionCheck_ATTrisVsACTris(PlayState* play, CollisionCheckContext* colCh if (acTris->count > 0 && acTris->elements != NULL && atTris->count > 0 && atTris->elements != NULL) { for (acTrisElem = acTris->elements; acTrisElem < acTris->elements + acTris->count; acTrisElem++) { - if (CollisionCheck_SkipElementBump(&acTrisElem->base) == true) { + if (CollisionCheck_IsElementNotAC(&acTrisElem->base) == true) { continue; } for (atTrisElem = atTris->elements; atTrisElem < atTris->elements + atTris->count; atTrisElem++) { - if (CollisionCheck_SkipElementTouch(&atTrisElem->base) == true) { + if (CollisionCheck_IsElementNotAT(&atTrisElem->base) == true) { continue; } if (CollisionCheck_NoSharedFlags(&atTrisElem->base, &acTrisElem->base) == true) { @@ -2369,13 +2373,13 @@ void CollisionCheck_ATTrisVsACQuad(PlayState* play, CollisionCheckContext* colCh ColliderQuad* acQuad = (ColliderQuad*)acCol; if (atTris->count > 0 && atTris->elements != NULL) { - if (CollisionCheck_SkipElementBump(&acQuad->elem) == true) { + if (CollisionCheck_IsElementNotAC(&acQuad->elem) == true) { return; } Math3D_TriNorm(&tri1, &acQuad->dim.quad[2], &acQuad->dim.quad[3], &acQuad->dim.quad[1]); Math3D_TriNorm(&tri2, &acQuad->dim.quad[1], &acQuad->dim.quad[0], &acQuad->dim.quad[2]); for (atTrisElem = atTris->elements; atTrisElem < atTris->elements + atTris->count; atTrisElem++) { - if (CollisionCheck_SkipElementTouch(&atTrisElem->base) == true) { + if (CollisionCheck_IsElementNotAT(&atTrisElem->base) == true) { continue; } if (CollisionCheck_NoSharedFlags(&atTrisElem->base, &acQuad->elem) == true) { @@ -2416,13 +2420,13 @@ void CollisionCheck_ATQuadVsACTris(PlayState* play, CollisionCheckContext* colCh ColliderTrisElement* acTrisElem; if (acTris->count > 0 && acTris->elements != NULL) { - if (CollisionCheck_SkipElementTouch(&atQuad->elem) == true) { + if (CollisionCheck_IsElementNotAT(&atQuad->elem) == true) { return; } Math3D_TriNorm(&tri1, &atQuad->dim.quad[2], &atQuad->dim.quad[3], &atQuad->dim.quad[1]); Math3D_TriNorm(&tri2, &atQuad->dim.quad[1], &atQuad->dim.quad[0], &atQuad->dim.quad[2]); for (acTrisElem = acTris->elements; acTrisElem < acTris->elements + acTris->count; acTrisElem++) { - if (CollisionCheck_SkipElementBump(&acTrisElem->base) == true) { + if (CollisionCheck_IsElementNotAC(&acTrisElem->base) == true) { continue; } if (CollisionCheck_NoSharedFlags(&atQuad->elem, &acTrisElem->base) == true) { @@ -2468,10 +2472,10 @@ void CollisionCheck_ATQuadVsACQuad(PlayState* play, CollisionCheckContext* colCh s32 i; s32 j; - if (CollisionCheck_SkipElementTouch(&atQuad->elem) == true) { + if (CollisionCheck_IsElementNotAT(&atQuad->elem) == true) { return; } - if (CollisionCheck_SkipElementBump(&acQuad->elem) == true) { + if (CollisionCheck_IsElementNotAC(&acQuad->elem) == true) { return; } if (CollisionCheck_NoSharedFlags(&atQuad->elem, &acQuad->elem) == true) { @@ -2522,14 +2526,14 @@ void CollisionCheck_SetJntSphHitFX(PlayState* play, CollisionCheckContext* colCh ColliderJntSphElement* jntSphElem; for (jntSphElem = jntSph->elements; jntSphElem < jntSph->elements + jntSph->count; jntSphElem++) { - if ((jntSphElem->base.bumperFlags & BUMP_DRAW_HITMARK) && (jntSphElem->base.acHitElem != NULL) && - !(jntSphElem->base.acHitElem->toucherFlags & TOUCH_DREW_HITMARK)) { + if ((jntSphElem->base.acElemFlags & ACELEM_DRAW_HITMARK) && (jntSphElem->base.acHitElem != NULL) && + !(jntSphElem->base.acHitElem->atElemFlags & ATELEM_DREW_HITMARK)) { Vec3f hitPos; - Math_Vec3s_ToVec3f(&hitPos, &jntSphElem->base.bumper.hitPos); + Math_Vec3s_ToVec3f(&hitPos, &jntSphElem->base.acDmgInfo.hitPos); CollisionCheck_HitEffects(play, jntSphElem->base.acHit, jntSphElem->base.acHitElem, &jntSph->base, &jntSphElem->base, &hitPos); - jntSphElem->base.acHitElem->toucherFlags |= TOUCH_DREW_HITMARK; + jntSphElem->base.acHitElem->atElemFlags |= ATELEM_DREW_HITMARK; return; } } @@ -2538,13 +2542,13 @@ void CollisionCheck_SetJntSphHitFX(PlayState* play, CollisionCheckContext* colCh void CollisionCheck_SetCylHitFX(PlayState* play, CollisionCheckContext* colChkCtx, Collider* col) { ColliderCylinder* cyl = (ColliderCylinder*)col; - if ((cyl->elem.bumperFlags & BUMP_DRAW_HITMARK) && (cyl->elem.acHitElem != NULL) && - !(cyl->elem.acHitElem->toucherFlags & TOUCH_DREW_HITMARK)) { + if ((cyl->elem.acElemFlags & ACELEM_DRAW_HITMARK) && (cyl->elem.acHitElem != NULL) && + !(cyl->elem.acHitElem->atElemFlags & ATELEM_DREW_HITMARK)) { Vec3f hitPos; - Math_Vec3s_ToVec3f(&hitPos, &cyl->elem.bumper.hitPos); + Math_Vec3s_ToVec3f(&hitPos, &cyl->elem.acDmgInfo.hitPos); CollisionCheck_HitEffects(play, cyl->elem.acHit, cyl->elem.acHitElem, &cyl->base, &cyl->elem, &hitPos); - cyl->elem.acHitElem->toucherFlags |= TOUCH_DREW_HITMARK; + cyl->elem.acHitElem->atElemFlags |= ATELEM_DREW_HITMARK; } } @@ -2553,14 +2557,14 @@ void CollisionCheck_SetTrisHitFX(PlayState* play, CollisionCheckContext* colChkC ColliderTrisElement* trisElem; for (trisElem = tris->elements; trisElem < tris->elements + tris->count; trisElem++) { - if ((trisElem->base.bumperFlags & BUMP_DRAW_HITMARK) && (trisElem->base.acHitElem != NULL) && - !(trisElem->base.acHitElem->toucherFlags & TOUCH_DREW_HITMARK)) { + if ((trisElem->base.acElemFlags & ACELEM_DRAW_HITMARK) && (trisElem->base.acHitElem != NULL) && + !(trisElem->base.acHitElem->atElemFlags & ATELEM_DREW_HITMARK)) { Vec3f hitPos; - Math_Vec3s_ToVec3f(&hitPos, &trisElem->base.bumper.hitPos); + Math_Vec3s_ToVec3f(&hitPos, &trisElem->base.acDmgInfo.hitPos); CollisionCheck_HitEffects(play, trisElem->base.acHit, trisElem->base.acHitElem, &tris->base, &trisElem->base, &hitPos); - trisElem->base.acHitElem->toucherFlags |= TOUCH_DREW_HITMARK; + trisElem->base.acHitElem->atElemFlags |= ATELEM_DREW_HITMARK; return; } } @@ -2570,11 +2574,11 @@ void CollisionCheck_SetQuadHitFX(PlayState* play, CollisionCheckContext* colChkC ColliderQuad* quad = (ColliderQuad*)col; Vec3f hitPos; - if ((quad->elem.bumperFlags & BUMP_DRAW_HITMARK) && (quad->elem.acHitElem != NULL) && - !(quad->elem.acHitElem->toucherFlags & TOUCH_DREW_HITMARK)) { - Math_Vec3s_ToVec3f(&hitPos, &quad->elem.bumper.hitPos); + if ((quad->elem.acElemFlags & ACELEM_DRAW_HITMARK) && (quad->elem.acHitElem != NULL) && + !(quad->elem.acHitElem->atElemFlags & ATELEM_DREW_HITMARK)) { + Math_Vec3s_ToVec3f(&hitPos, &quad->elem.acDmgInfo.hitPos); CollisionCheck_HitEffects(play, quad->elem.acHit, quad->elem.acHitElem, &quad->base, &quad->elem, &hitPos); - quad->elem.acHitElem->toucherFlags |= TOUCH_DREW_HITMARK; + quad->elem.acHitElem->atElemFlags |= ATELEM_DREW_HITMARK; } } @@ -2661,7 +2665,7 @@ void CollisionCheck_AC(PlayState* play, CollisionCheckContext* colChkCtx, Collid * Iterates through all AT colliders, testing them for AC collisions with each AC collider, setting the info regarding * the collision for each AC and AT collider that collided. Then spawns hitmarks and plays sound effects for each * successful collision. To collide, an AT collider must share a type (AC_TYPE_PLAYER, AC_TYPE_ENEMY, or AC_TYPE_OTHER) - * with the AC collider and the toucher and bumper elements that overlapped must share a dmgFlag. + * with the AC collider and the AT and AC elements that overlapped must share a dmgFlag. */ void CollisionCheck_AT(PlayState* play, CollisionCheckContext* colChkCtx) { Collider** atColP; @@ -3052,20 +3056,20 @@ void CollisionCheck_ApplyDamage(PlayState* play, CollisionCheckContext* colChkCt if (col->actor == NULL || !(col->acFlags & AC_HIT)) { return; } - if (!(elem->bumperFlags & BUMP_HIT) || elem->bumperFlags & BUMP_NO_DAMAGE) { + if (!(elem->acElemFlags & ACELEM_HIT) || elem->acElemFlags & ACELEM_NO_DAMAGE) { return; } ASSERT(elem->acHitElem != NULL, "pclobj_elem->ac_hit_elem != NULL", "../z_collision_check.c", 6493); tbl = col->actor->colChkInfo.damageTable; if (tbl == NULL) { - damage = (f32)elem->acHitElem->toucher.damage - elem->bumper.defense; + damage = (f32)elem->acHitElem->atDmgInfo.damage - elem->acDmgInfo.defense; if (damage < 0) { damage = 0; } } else { s32 i; - u32 flags = elem->acHitElem->toucher.dmgFlags; + u32 flags = elem->acHitElem->atDmgInfo.dmgFlags; for (i = 0; i < 32; i++, flags >>= 1) { if (flags == 1) { @@ -3699,7 +3703,7 @@ u8 CollisionCheck_GetSwordDamage(s32 dmgFlags) { damage = 8; } -#if OOT_DEBUG +#if IS_DEBUG KREG(7) = damage; #endif diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 94d8b7a3f..5dae1573e 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -1,7 +1,6 @@ #include "global.h" -// The use of ALIGNED8 here is just a temporary solution until the SaveContext is re-structured -ALIGNED8 SaveContext gSaveContext; +ALIGNED(16) SaveContext gSaveContext; u32 D_8015FA88; u32 D_8015FA8C; @@ -20,4 +19,5 @@ void SaveContext_Init(void) { gSaveContext.dogIsLost = true; gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT; gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL; + gSaveContext.save.useWidescreen = false; } diff --git a/src/code/z_construct.c b/src/code/z_construct.c index e2810934a..3ea13a06f 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -11,14 +11,17 @@ void Interface_Init(PlayState* play) { u32 parameterSize; u16 doActionOffset; u8 timerId; + Color_RGB8 aBtnColor = { 255, 30, 30 }; + Color_RGB8 bBtnColor = { 0, 200, 50 }; gSaveContext.sunsSongState = SUNSSONG_INACTIVE; gSaveContext.nextHudVisibilityMode = gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; View_Init(&interfaceCtx->view, play->state.gfxCtx); - interfaceCtx->unk_1FA = interfaceCtx->unk_261 = interfaceCtx->unk_1FC = 0; interfaceCtx->unk_1EC = interfaceCtx->unk_1EE = interfaceCtx->unk_1F0 = 0; + interfaceCtx->unk_1FA = interfaceCtx->unk_261 = interfaceCtx->unk_1FC = 0; + interfaceCtx->unk_22E = 0; interfaceCtx->lensMagicConsumptionTimer = 16; interfaceCtx->unk_1F4 = 0.0f; @@ -159,17 +162,28 @@ void Interface_Init(PlayState* play) { interfaceCtx->unk_23C = interfaceCtx->unk_242 = 0; + if (N64_BTN_COLORS) { + aBtnColor.r = aBtnColor.b = 0; + aBtnColor.g = 150; + + bBtnColor.r = bBtnColor.g = 90; + bBtnColor.b = 255; + } + R_ITEM_BTN_X(0) = B_BUTTON_X; - R_B_BTN_COLOR(0) = 255; - R_B_BTN_COLOR(1) = 30; - R_B_BTN_COLOR(2) = 30; + + R_B_BTN_COLOR(0) = aBtnColor.r; + R_B_BTN_COLOR(1) = aBtnColor.g; + R_B_BTN_COLOR(2) = aBtnColor.b; + R_ITEM_ICON_X(0) = B_BUTTON_X; R_ITEM_AMMO_X(0) = B_BUTTON_X + 2; R_A_BTN_X = A_BUTTON_X; R_A_ICON_X = A_BUTTON_X; - R_A_BTN_COLOR(0) = 0; - R_A_BTN_COLOR(1) = 200; - R_A_BTN_COLOR(2) = 50; + + R_A_BTN_COLOR(0) = bBtnColor.r; + R_A_BTN_COLOR(1) = bBtnColor.g; + R_A_BTN_COLOR(2) = bBtnColor.b; } #define TEXTBOX_SEGMENT_SIZE \ diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 8fd35af19..6656c4ebd 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -1,5 +1,7 @@ #include "global.h" +#include "config.h" +// ENABLE_CAMERA_DEBUGGER typedef struct { /* 0x0 */ u8 x; /* 0x1 */ u8 y; @@ -7,18 +9,21 @@ typedef struct { /* 0x3 */ char text[21]; } DebugCamTextBufferEntry; // size = 0x18 +// ENABLE_REG_EDITOR typedef struct { /* 0x0 */ u16 hold; /* 0x2 */ u16 press; } InputCombo; // size = 0x4 -RegEditor* gRegEditor; +RegEditor* gRegEditor; // ``gRegEditor->data`` is used by non-debug features in normal gameplay +// ENABLE_CAMERA_DEBUGGER DebugCamTextBufferEntry sDebugCamTextBuffer[22]; s16 sDebugCamTextEntryCount = 0; Color_RGBA8 sDebugCamTextColors[] = { +#if IS_CAMERA_DEBUG_ENABLED { 255, 255, 32, 192 }, // DEBUG_CAM_TEXT_YELLOW { 255, 150, 128, 192 }, // DEBUG_CAM_TEXT_PEACH { 128, 96, 0, 64 }, // DEBUG_CAM_TEXT_BROWN @@ -27,9 +32,12 @@ Color_RGBA8 sDebugCamTextColors[] = { { 230, 230, 220, 64 }, // DEBUG_CAM_TEXT_WHITE { 128, 150, 255, 128 }, // DEBUG_CAM_TEXT_BLUE { 128, 255, 32, 128 }, // DEBUG_CAM_TEXT_GREEN +#endif }; +#if IS_DEBUG InputCombo sRegGroupInputCombos[REG_GROUPS] = { +#if IS_REG_EDITOR_ENABLED { BTN_L, BTN_CUP }, // REG { BTN_L, BTN_CLEFT }, // SREG { BTN_L, BTN_CDOWN }, // OREG @@ -59,10 +67,11 @@ InputCombo sRegGroupInputCombos[REG_GROUPS] = { { BTN_START, BTN_A }, // dREG { BTN_START, BTN_B }, // kREG { BTN_START, BTN_CRIGHT }, // bREG - +#endif }; char sRegGroupChars[REG_GROUPS] = { +#if IS_REG_EDITOR_ENABLED ' ', // REG 'S', // SREG 'O', // OREG @@ -92,17 +101,23 @@ char sRegGroupChars[REG_GROUPS] = { 'd', // dREG 'k', // kREG 'b', // bREG +#endif }; +#endif void Regs_Init(void) { s32 i; gRegEditor = SYSTEM_ARENA_MALLOC(sizeof(RegEditor), "../z_debug.c", 260); - gRegEditor->regPage = 0; - gRegEditor->regGroup = 0; - gRegEditor->regCur = 0; - gRegEditor->dPadInputPrev = 0; - gRegEditor->inputRepeatTimer = 0; + + if (IS_REG_EDITOR_ENABLED) { + gRegEditor->regPage = 0; + gRegEditor->regGroup = 0; + gRegEditor->regCur = 0; + gRegEditor->dPadInputPrev = 0; + gRegEditor->inputRepeatTimer = 0; + } + for (i = 0; i < ARRAY_COUNT(gRegEditor->data); i++) { gRegEditor->data[i] = 0; } @@ -113,160 +128,169 @@ void DebugCamera_ScreenText(u8 x, u8 y, const char* text) { } void DebugCamera_ScreenTextColored(u8 x, u8 y, u8 colorIndex, const char* text) { - DebugCamTextBufferEntry* entry = &sDebugCamTextBuffer[sDebugCamTextEntryCount]; - char* textDest; - s16 charCount; + if (IS_CAMERA_DEBUG_ENABLED) { + DebugCamTextBufferEntry* entry = &sDebugCamTextBuffer[sDebugCamTextEntryCount]; + char* textDest; + s16 charCount; - if (sDebugCamTextEntryCount < ARRAY_COUNT(sDebugCamTextBuffer)) { - entry->x = x; - entry->y = y; - entry->colorIndex = colorIndex; + if (sDebugCamTextEntryCount < ARRAY_COUNT(sDebugCamTextBuffer)) { + entry->x = x; + entry->y = y; + entry->colorIndex = colorIndex; - // Copy text into the entry, truncating if needed - charCount = 0; - textDest = entry->text; + // Copy text into the entry, truncating if needed + charCount = 0; + textDest = entry->text; - while ((*textDest++ = *text++) != '\0') { - if (charCount++ > (ARRAY_COUNT(entry->text) - 1)) { - break; + while ((*textDest++ = *text++) != '\0') { + if (charCount++ > (ARRAY_COUNT(entry->text) - 1)) { + break; + } } + + *textDest = '\0'; + + sDebugCamTextEntryCount++; } - - *textDest = '\0'; - - sDebugCamTextEntryCount++; } } void DebugCamera_DrawScreenText(GfxPrint* printer) { - s32 i; - Color_RGBA8* color; - DebugCamTextBufferEntry* entry; + if (IS_CAMERA_DEBUG_ENABLED) { + s32 i; + Color_RGBA8* color; + DebugCamTextBufferEntry* entry; - for (i = 0; i < sDebugCamTextEntryCount; i++) { - entry = &sDebugCamTextBuffer[i]; - color = &sDebugCamTextColors[entry->colorIndex]; + for (i = 0; i < sDebugCamTextEntryCount; i++) { + entry = &sDebugCamTextBuffer[i]; + color = &sDebugCamTextColors[entry->colorIndex]; - GfxPrint_SetColor(printer, color->r, color->g, color->b, color->a); - GfxPrint_SetPos(printer, entry->x, entry->y); - GfxPrint_Printf(printer, "%s", entry->text); + GfxPrint_SetColor(printer, color->r, color->g, color->b, color->a); + GfxPrint_SetPos(printer, entry->x, entry->y); + GfxPrint_Printf(printer, "%s", entry->text); + } } } -#if OOT_DEBUG +#if IS_DEBUG /** * Updates the state of the Reg Editor according to user input. * Also contains a controller rumble test that can be interfaced with via related REGs. */ void Regs_UpdateEditor(Input* input) { - s32 dPadInputCur; - s32 pageDataStart = ((gRegEditor->regGroup * REG_PAGES) + gRegEditor->regPage - 1) * REGS_PER_PAGE; - s32 increment; - s32 i; + if (IS_REG_EDITOR_ENABLED) { + s32 dPadInputCur; + s32 pageDataStart = ((gRegEditor->regGroup * REG_PAGES) + gRegEditor->regPage - 1) * REGS_PER_PAGE; + s32 increment; + s32 i; - dPadInputCur = input->cur.button & (BTN_DUP | BTN_DLEFT | BTN_DRIGHT | BTN_DDOWN); + dPadInputCur = input->cur.button & (BTN_DUP | BTN_DLEFT | BTN_DRIGHT | BTN_DDOWN); - if (CHECK_BTN_ALL(input->cur.button, BTN_L) || CHECK_BTN_ALL(input->cur.button, BTN_R) || - CHECK_BTN_ALL(input->cur.button, BTN_START)) { + if (CHECK_BTN_ALL(input->cur.button, BTN_L) || CHECK_BTN_ALL(input->cur.button, BTN_R) || + CHECK_BTN_ALL(input->cur.button, BTN_START)) { - for (i = 0; i < REG_GROUPS; i++) { - if (CHECK_BTN_ALL(input->cur.button, sRegGroupInputCombos[i].hold) && - CHECK_BTN_ALL(input->press.button, sRegGroupInputCombos[i].press)) { - break; + for (i = 0; i < REG_GROUPS; i++) { + if (CHECK_BTN_ALL(input->cur.button, sRegGroupInputCombos[i].hold) && + CHECK_BTN_ALL(input->press.button, sRegGroupInputCombos[i].press)) { + break; + } } - } - // If a combo corresponding to a reg group was found - if (i < REG_GROUPS) { - if (i == gRegEditor->regGroup) { - // Same reg group as current, advance page index - gRegEditor->regPage = (gRegEditor->regPage + 1) % (REG_PAGES + 1); - } else { - gRegEditor->regGroup = i; // Switch current reg group - gRegEditor->regPage = 0; // Disable reg editor - } - } - } else { - switch (gRegEditor->regPage) { - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - if (dPadInputCur == gRegEditor->dPadInputPrev) { - gRegEditor->inputRepeatTimer--; - if (gRegEditor->inputRepeatTimer < 0) { - gRegEditor->inputRepeatTimer = 1; - } else { - dPadInputCur ^= gRegEditor->dPadInputPrev; - } + // If a combo corresponding to a reg group was found + if (i < REG_GROUPS) { + if (i == gRegEditor->regGroup) { + // Same reg group as current, advance page index + gRegEditor->regPage = (gRegEditor->regPage + 1) % (REG_PAGES + 1); } else { - gRegEditor->inputRepeatTimer = 16; - gRegEditor->dPadInputPrev = dPadInputCur; + gRegEditor->regGroup = i; // Switch current reg group + gRegEditor->regPage = 0; // Disable reg editor } - - increment = - CHECK_BTN_ANY(dPadInputCur, BTN_DRIGHT) ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B) ? 1000 - : CHECK_BTN_ALL(input->cur.button, BTN_A) ? 100 - : CHECK_BTN_ALL(input->cur.button, BTN_B) ? 10 - : 1) - : CHECK_BTN_ANY(dPadInputCur, BTN_DLEFT) ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B) ? -1000 - : CHECK_BTN_ALL(input->cur.button, BTN_A) ? -100 - : CHECK_BTN_ALL(input->cur.button, BTN_B) ? -10 - : -1) - : 0; - - gRegEditor->data[gRegEditor->regCur + pageDataStart] += increment; - - if (CHECK_BTN_ANY(dPadInputCur, BTN_DUP)) { - gRegEditor->regCur--; - if (gRegEditor->regCur < 0) { - gRegEditor->regCur = REGS_PER_PAGE - 1; + } + } else { + switch (gRegEditor->regPage) { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + if (dPadInputCur == gRegEditor->dPadInputPrev) { + gRegEditor->inputRepeatTimer--; + if (gRegEditor->inputRepeatTimer < 0) { + gRegEditor->inputRepeatTimer = 1; + } else { + dPadInputCur ^= gRegEditor->dPadInputPrev; + } + } else { + gRegEditor->inputRepeatTimer = 16; + gRegEditor->dPadInputPrev = dPadInputCur; } - } else if (CHECK_BTN_ANY(dPadInputCur, BTN_DDOWN)) { - gRegEditor->regCur++; - if (gRegEditor->regCur >= REGS_PER_PAGE) { - gRegEditor->regCur = 0; + + increment = CHECK_BTN_ANY(dPadInputCur, BTN_DRIGHT) + ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B) ? 1000 + : CHECK_BTN_ALL(input->cur.button, BTN_A) ? 100 + : CHECK_BTN_ALL(input->cur.button, BTN_B) ? 10 + : 1) + : CHECK_BTN_ANY(dPadInputCur, BTN_DLEFT) + ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B) ? -1000 + : CHECK_BTN_ALL(input->cur.button, BTN_A) ? -100 + : CHECK_BTN_ALL(input->cur.button, BTN_B) ? -10 + : -1) + : 0; + + gRegEditor->data[gRegEditor->regCur + pageDataStart] += increment; + + if (CHECK_BTN_ANY(dPadInputCur, BTN_DUP)) { + gRegEditor->regCur--; + if (gRegEditor->regCur < 0) { + gRegEditor->regCur = REGS_PER_PAGE - 1; + } + } else if (CHECK_BTN_ANY(dPadInputCur, BTN_DDOWN)) { + gRegEditor->regCur++; + if (gRegEditor->regCur >= REGS_PER_PAGE) { + gRegEditor->regCur = 0; + } } - } - if (iREG(0)) { - iREG(0) = 0; - Rumble_Request(0.0f, iREG(1), iREG(2), iREG(3)); - } + if (iREG(0)) { + iREG(0) = 0; + Rumble_Request(0.0f, iREG(1), iREG(2), iREG(3)); + } - break; + break; - default: - break; + default: + break; + } } } } void Regs_DrawEditor(GfxPrint* printer) { - s32 i; - s32 pageStart = (gRegEditor->regPage - 1) * REGS_PER_PAGE; - s32 pageDataStart = ((gRegEditor->regGroup * REG_PAGES) + gRegEditor->regPage - 1) * REGS_PER_PAGE; - s32 pad; - char regGroupName[3]; + if (IS_REG_EDITOR_ENABLED) { + s32 i; + s32 pageStart = (gRegEditor->regPage - 1) * REGS_PER_PAGE; + s32 pageDataStart = ((gRegEditor->regGroup * REG_PAGES) + gRegEditor->regPage - 1) * REGS_PER_PAGE; + s32 pad; + char regGroupName[3]; - regGroupName[0] = 'R'; - regGroupName[1] = sRegGroupChars[gRegEditor->regGroup]; - regGroupName[2] = '\0'; + regGroupName[0] = 'R'; + regGroupName[1] = sRegGroupChars[gRegEditor->regGroup]; + regGroupName[2] = '\0'; - GfxPrint_SetColor(printer, 0, 128, 128, 128); + GfxPrint_SetColor(printer, 0, 128, 128, 128); - for (i = 0; i < REGS_PER_PAGE; i++) { - if (i == gRegEditor->regCur) { - GfxPrint_SetColor(printer, 0, 255, 255, 255); - } + for (i = 0; i < REGS_PER_PAGE; i++) { + if (i == gRegEditor->regCur) { + GfxPrint_SetColor(printer, 0, 255, 255, 255); + } - GfxPrint_SetPos(printer, 3, i + 5); - GfxPrint_Printf(printer, "%s%02d%6d", regGroupName, pageStart + i, gRegEditor->data[i + pageDataStart]); + GfxPrint_SetPos(printer, 3, i + 5); + GfxPrint_Printf(printer, "%s%02d%6d", regGroupName, pageStart + i, gRegEditor->data[i + pageDataStart]); - if (i == gRegEditor->regCur) { - GfxPrint_SetColor(printer, 0, 128, 128, 128); + if (i == gRegEditor->regCur) { + GfxPrint_SetColor(printer, 0, 128, 128, 128); + } } } } @@ -276,39 +300,41 @@ void Regs_DrawEditor(GfxPrint* printer) { * Draws the Reg Editor and Debug Camera text on screen */ void Debug_DrawText(GraphicsContext* gfxCtx) { - Gfx* gfx; - Gfx* opaStart; - GfxPrint printer; - s32 pad; + if (IS_DEBUG && (ENABLE_CAMERA_DEBUGGER || ENABLE_REG_EDITOR)) { + Gfx* gfx; + Gfx* opaStart; + GfxPrint printer; + s32 pad; - OPEN_DISPS(gfxCtx, "../z_debug.c", 628); + OPEN_DISPS(gfxCtx, "../z_debug.c", 628); - GfxPrint_Init(&printer); - opaStart = POLY_OPA_DISP; - gfx = Gfx_Open(POLY_OPA_DISP); - gSPDisplayList(OVERLAY_DISP++, gfx); - GfxPrint_Open(&printer, gfx); + GfxPrint_Init(&printer); + opaStart = POLY_OPA_DISP; + gfx = Gfx_Open(POLY_OPA_DISP); + gSPDisplayList(OVERLAY_DISP++, gfx); + GfxPrint_Open(&printer, gfx); - if ((OREG(0) == 1) || (OREG(0) == 8)) { - DebugCamera_DrawScreenText(&printer); + if (IS_CAMERA_DEBUG_ENABLED && ((OREG(0) == 1) || (OREG(0) == 8))) { + DebugCamera_DrawScreenText(&printer); + } + + if (IS_REG_EDITOR_ENABLED && gRegEditor->regPage != 0) { + Regs_DrawEditor(&printer); + } + + if (IS_CAMERA_DEBUG_ENABLED) { + sDebugCamTextEntryCount = 0; + } + + gfx = GfxPrint_Close(&printer); + gSPEndDisplayList(gfx++); + Gfx_Close(opaStart, gfx); + POLY_OPA_DISP = gfx; + + if (1) {} + + CLOSE_DISPS(gfxCtx, "../z_debug.c", 664); + + GfxPrint_Destroy(&printer); } - -#if OOT_DEBUG - if (gRegEditor->regPage != 0) { - Regs_DrawEditor(&printer); - } -#endif - - sDebugCamTextEntryCount = 0; - - gfx = GfxPrint_Close(&printer); - gSPEndDisplayList(gfx++); - Gfx_Close(opaStart, gfx); - POLY_OPA_DISP = gfx; - - if (1) {} - - CLOSE_DISPS(gfxCtx, "../z_debug.c", 664); - - GfxPrint_Destroy(&printer); } diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c index d1d5dd34c..bd1fa2b65 100644 --- a/src/code/z_debug_display.c +++ b/src/code/z_debug_display.c @@ -1,3 +1,7 @@ +#include "config.h" + +#if !NO_DEBUG_DISPLAY + #include "global.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" @@ -106,3 +110,5 @@ void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, PlayState* CLOSE_DISPS(play->state.gfxCtx, "../z_debug_display.c", 231); } + +#endif diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 68b67de0f..c8875edef 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -130,27 +130,27 @@ s16 sQuakeIndex; void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx); -#if OOT_DEBUG void Cutscene_DrawDebugInfo(PlayState* play, Gfx** dlist, CutsceneContext* csCtx) { - GfxPrint printer; - s32 pad[2]; + if (CAN_SHOW_CS_INFOS) { + GfxPrint printer; + s32 pad[2]; - GfxPrint_Init(&printer); - GfxPrint_Open(&printer, *dlist); + GfxPrint_Init(&printer); + GfxPrint_Open(&printer, *dlist); - GfxPrint_SetPos(&printer, 22, 25); - GfxPrint_SetColor(&printer, 255, 255, 55, 32); - GfxPrint_Printf(&printer, "%s", "FLAME "); - GfxPrint_SetColor(&printer, 255, 255, 255, 32); - GfxPrint_Printf(&printer, "%06d", csCtx->curFrame); - GfxPrint_SetColor(&printer, 50, 255, 255, 60); - GfxPrint_SetPos(&printer, 4, 26); - GfxPrint_Printf(&printer, "%s", "SKIP=(START) or (Cursole Right)"); + GfxPrint_SetPos(&printer, 22, 25); + GfxPrint_SetColor(&printer, 255, 255, 55, 32); + GfxPrint_Printf(&printer, "%s", "FLAME "); + GfxPrint_SetColor(&printer, 255, 255, 255, 32); + GfxPrint_Printf(&printer, "%06d", csCtx->curFrame); + GfxPrint_SetColor(&printer, 50, 255, 255, 60); + GfxPrint_SetPos(&printer, 4, 26); + GfxPrint_Printf(&printer, "%s", "SKIP=(START) or (Cursole Right)"); - *dlist = GfxPrint_Close(&printer); - GfxPrint_Destroy(&printer); + *dlist = GfxPrint_Close(&printer); + GfxPrint_Destroy(&printer); + } } -#endif void Cutscene_InitContext(PlayState* play, CutsceneContext* csCtx) { csCtx->state = CS_STATE_IDLE; @@ -175,9 +175,8 @@ void Cutscene_UpdateManual(PlayState* play, CutsceneContext* csCtx) { } void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { -#if OOT_DEBUG - { - Input* input = &play->state.input[0]; + if (IS_CS_CONTROL_ENABLED) { + Input* input = &play->state.input[CS_CTRL_CONTROLLER_PORT]; if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) { gUseCutsceneCam = false; @@ -185,14 +184,13 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { gSaveContext.cutsceneTrigger = 1; } - if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER && - !gDebugCamEnabled) { + if (CHECK_BTN_ALL(input->press.button, CS_CTRL_RESTART_CONTROL) && (csCtx->state == CS_STATE_IDLE) && + IS_CUTSCENE_LAYER && !IS_DEBUG_CAM_ENABLED) { gUseCutsceneCam = true; gSaveContext.save.cutsceneIndex = 0xFFFD; gSaveContext.cutsceneTrigger = 1; } } -#endif if ((gSaveContext.cutsceneTrigger != 0) && (play->transitionTrigger == TRANS_TRIGGER_START)) { gSaveContext.cutsceneTrigger = 0; @@ -568,7 +566,8 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti } if ((csCtx->curFrame == cmd->startFrame) || titleDemoSkipped || - (OOT_DEBUG && (csCtx->curFrame > 20) && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) && + (CS_CAN_SKIP_TITLE_SCREEN && (csCtx->curFrame > 20) && + CHECK_BTN_ALL(play->state.input[CS_CTRL_CONTROLLER_PORT].press.button, CS_CTRL_RUN_DEST_CONTROL) && (gSaveContext.fileNum != 0xFEDC))) { csCtx->state = CS_STATE_RUN_UNSTOPPABLE; Audio_SetCutsceneFlag(0); @@ -636,7 +635,13 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti break; case CS_DEST_TEMPLE_OF_TIME_FROM_MASTER_SWORD: - gSaveContext.save.info.fw.set = 0; + if (FW_SPLIT_AGE) { + FaroresWindData fwTemp = gSaveContext.save.info.fwMain; + gSaveContext.save.info.fwMain = gSaveContext.save.info.fwSecondary; + gSaveContext.save.info.fwSecondary = fwTemp; + } else { + gSaveContext.save.info.fwMain.set = 0; + } gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0; if (!GET_EVENTCHKINF(EVENTCHKINF_45)) { @@ -723,7 +728,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti break; case CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION: -#if OOT_DEBUG +#if IS_DEBUG SET_EVENTCHKINF(EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS); #endif play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_4; @@ -894,7 +899,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti break; case CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION_ALT: -#if OOT_DEBUG +#if IS_DEBUG SET_EVENTCHKINF(EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS); #endif play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_4; @@ -951,7 +956,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti break; case CS_DEST_GERUDO_VALLEY_CREDITS: -#if OOT_DEBUG +#if IS_DEBUG gSaveContext.gameMode = GAMEMODE_END_CREDITS; Audio_SetSfxBanksMute(0x6F); #endif @@ -1791,12 +1796,13 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) return; } -#if OOT_DEBUG - if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_DRIGHT)) { - csCtx->state = CS_STATE_STOP; - return; + if (IS_CS_CONTROL_ENABLED) { + Input* input = &play->state.input[CS_CTRL_CONTROLLER_PORT]; + if (DEBUG_BTN_COMBO(CS_CTRL_USE_BTN_COMBO, CS_CTRL_BTN_HOLD_FOR_COMBO, CS_CTRL_STOP_CONTROL, input)) { + csCtx->state = CS_STATE_STOP; + return; + } } -#endif for (i = 0; i < totalEntries; i++) { MemCpy(&cmdType, script, sizeof(cmdType)); @@ -2204,7 +2210,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) { if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { - if (OOT_DEBUG && BREG(0) != 0) { + if (CAN_SHOW_CS_INFOS && BREG(0) != 0) { Gfx* displayList; Gfx* prevDisplayList; @@ -2218,11 +2224,13 @@ void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) { Gfx_Close(prevDisplayList, displayList); POLY_OPA_DISP = displayList; + if (1) {} CLOSE_DISPS(play->state.gfxCtx, "../z_demo.c", 4108); } + csCtx->curFrame++; - if (OOT_DEBUG && R_USE_DEBUG_CUTSCENE) { + if (IS_DEBUG && R_USE_DEBUG_CUTSCENE) { Cutscene_ProcessScript(play, csCtx, gDebugCutsceneScript); } else { Cutscene_ProcessScript(play, csCtx, play->csCtx.script); diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index c1ef1bb7a..4df2b6e4c 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -8,11 +8,12 @@ void EffectSs_InitInfo(PlayState* play, s32 tableSize) { EffectSs* effectSs; EffectSsOverlay* overlay; -#if OOT_DEBUG +#if IS_DEBUG for (i = 0; i < ARRAY_COUNT(gEffectSsOverlayTable); i++) { overlay = &gEffectSsOverlayTable[i]; PRINTF("effect index %3d:size=%6dbyte romsize=%6dbyte\n", i, - (uintptr_t)overlay->vramEnd - (uintptr_t)overlay->vramStart, overlay->vromEnd - overlay->vromStart); + (uintptr_t)overlay->vramEnd - (uintptr_t)overlay->vramStart, + overlay->file.vromEnd - overlay->file.vromStart); } #endif @@ -205,13 +206,13 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) { return; } - Overlay_Load(overlayEntry->vromStart, overlayEntry->vromEnd, overlayEntry->vramStart, overlayEntry->vramEnd, - overlayEntry->loadedRamAddr); + Overlay_Load(overlayEntry->file.vromStart, overlayEntry->file.vromEnd, overlayEntry->vramStart, + overlayEntry->vramEnd, overlayEntry->loadedRamAddr); PRINTF(VT_FGCOL(GREEN)); - PRINTF("EFFECT SS OVL:SegRom %08x %08x, Seg %08x %08x, RamStart %08x, type: %d\n", overlayEntry->vromStart, - overlayEntry->vromEnd, overlayEntry->vramStart, overlayEntry->vramEnd, overlayEntry->loadedRamAddr, - type); + PRINTF("EFFECT SS OVL:SegRom %08x %08x, Seg %08x %08x, RamStart %08x, type: %d\n", + overlayEntry->file.vromStart, overlayEntry->file.vromEnd, overlayEntry->vramStart, + overlayEntry->vramEnd, overlayEntry->loadedRamAddr, type); PRINTF(VT_RST); } diff --git a/src/code/z_effect_soft_sprite_dlftbls.c b/src/code/z_effect_soft_sprite_dlftbls.c index e8e2f9280..3fb498b33 100644 --- a/src/code/z_effect_soft_sprite_dlftbls.c +++ b/src/code/z_effect_soft_sprite_dlftbls.c @@ -19,18 +19,15 @@ #undef DEFINE_EFFECT_SS_UNSET // Effect SS Overlay Table definition -#define DEFINE_EFFECT_SS(name, _1) \ - { \ - (uintptr_t)_ovl_##name##SegmentRomStart, \ - (uintptr_t)_ovl_##name##SegmentRomEnd, \ - _ovl_##name##SegmentStart, \ - _ovl_##name##SegmentEnd, \ - NULL, \ - &name##_InitVars, \ - 1, \ +#define DEFINE_EFFECT_SS(name, _1) \ + { \ + ROM_FILE(ovl_##name), _ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, NULL, &name##_InitVars, 1, \ }, -#define DEFINE_EFFECT_SS_UNSET(_0) { 0 }, +#define DEFINE_EFFECT_SS_UNSET(_0) \ + { \ + ROM_FILE_UNSET, NULL, NULL, NULL, NULL, 0, \ + }, EffectSsOverlay gEffectSsOverlayTable[] = { #include "tables/effect_ss_table.h" diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 33adc258c..21c5ebd75 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -45,8 +45,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 25, 60, 0, { 0, 0, 0 } }, diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 23bc99f82..9e2e76249 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -45,8 +45,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000010, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_NONE | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { 10, 30, 0, { 0, 0, 0 } }, diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c index b1ad5a208..1a3916ffa 100644 --- a/src/code/z_fbdemo.c +++ b/src/code/z_fbdemo.c @@ -40,6 +40,22 @@ Gfx sTransTileSetupDL[] = { gsSPEndDisplayList(), }; +#define SET_VERTEX(vtx, x, y, z, s, t, nx, ny, nz, alpha) \ + { \ + Vtx_tn* vtxn = &(vtx)->n; \ + vtxn->ob[0] = (x); \ + vtxn->ob[1] = (y); \ + vtxn->ob[2] = (z); \ + vtxn->flag = 0; \ + vtxn->tc[0] = (s); \ + vtxn->tc[1] = (t); \ + vtxn->n[0] = (nx); \ + vtxn->n[1] = (ny); \ + vtxn->n[2] = (nz); \ + vtxn->a = (alpha); \ + } \ + (void)0 + void TransitionTile_InitGraphics(TransitionTile* this) { s32 frame; s32 col; @@ -61,20 +77,7 @@ void TransitionTile_InitGraphics(TransitionTile* this) { for (row = 0; row < this->rows + 1; row++) { colTex = 0; for (col = 0; col < this->cols + 1; col++) { - Vtx_tn* vtxn = &vtx->n; - - vtx++; - vtxn->tc[0] = colTex << 6; - vtxn->ob[0] = col * 0x20; - vtxn->ob[1] = row * 0x20; - vtxn->ob[2] = -5; - vtxn->flag = 0; - vtxn->tc[1] = rowTex << 6; - vtxn->n[0] = 0; - vtxn->n[1] = 0; - vtxn->n[2] = 120; - vtxn->a = 255; - + SET_VERTEX(vtx++, col * 0x20, row * 0x20, -5, colTex << 6, rowTex << 6, 0, 0, 120, 255); colTex += 0x20; } diff --git a/src/code/z_fbdemo_circle.c b/src/code/z_fbdemo_circle.c index 72ee6e128..8eaeb5ef0 100644 --- a/src/code/z_fbdemo_circle.c +++ b/src/code/z_fbdemo_circle.c @@ -95,7 +95,8 @@ void TransitionCircle_Start(void* thisx) { } } - guPerspective(&this->projection, &this->normal, 60.0f, (4.0f / 3.0f), 10.0f, 12800.0f, 1.0f); + guPerspective(&this->projection, &this->normal, 60.0f, (USE_WIDESCREEN ? WIDE_GET_16_9 : WIDE_GET_4_3), 10.0f, + 12800.0f, 1.0f); guLookAt(&this->lookAt, 0.0f, 0.0f, 400.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); } @@ -150,6 +151,10 @@ void TransitionCircle_Draw(void* thisx, Gfx** gfxP) { f32 rot = 0.0f; f32 scale = 14.8f; + if (USE_WIDESCREEN) { + scale += 4.0f; + } + modelView = this->modelView[this->frame]; this->frame ^= 1; diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index 1d76e8ec7..1f0843176 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -62,7 +62,7 @@ void TransitionFade_Update(void* thisx, s32 updateRate) { break; case TRANS_FADE_TYPE_ONE_WAY: - this->timer += updateRate; + ((TransitionFade*)thisx)->timer += updateRate; if (this->timer >= gSaveContext.transFadeDuration) { this->timer = gSaveContext.transFadeDuration; this->isDone = true; diff --git a/src/code/z_fbdemo_wipe1.c b/src/code/z_fbdemo_wipe1.c index aea2235e3..1170d0bd6 100644 --- a/src/code/z_fbdemo_wipe1.c +++ b/src/code/z_fbdemo_wipe1.c @@ -52,7 +52,8 @@ void TransitionWipe_Start(void* thisx) { this->texY = (s32)(153.0f * (1 << 2)); } - guPerspective(&this->projection, &this->normal, 60.0f, (4.0f / 3.0f), 10.0f, 12800.0f, 1.0f); + guPerspective(&this->projection, &this->normal, 60.0f, (USE_WIDESCREEN ? WIDE_GET_16_9 : WIDE_GET_4_3), 10.0f, + 12800.0f, 1.0f); guLookAt(&this->lookAt, 0.0f, 0.0f, 400.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); } diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index 2348fa13a..e4d4b8a77 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -162,6 +162,8 @@ void SkelCurve_DrawLimb(PlayState* play, s32 limbIndex, SkelCurve* skelCurve, Ov OPEN_DISPS(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 279); + if (1) {} + Matrix_Push(); if ((overrideLimbDraw == NULL) || diff --git a/src/code/z_frame_advance.c b/src/code/z_frame_advance.c index 930db59b3..0121f7ca7 100644 --- a/src/code/z_frame_advance.c +++ b/src/code/z_frame_advance.c @@ -14,13 +14,15 @@ void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) { * This function returns true when frame advance is not active (game will run normally) */ s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input) { - if (CHECK_BTN_ALL(input->cur.button, BTN_R) && CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) { + // if the macro is set to true check R input, else simply return true + u8 checkR = FA_USE_BTN_COMBO ? CHECK_BTN_ALL(input->cur.button, FA_BTN_HOLD_FOR_COMBO) : true; + + if (checkR && CHECK_BTN_ALL(input->press.button, FA_PAUSE_CONTROL)) { frameAdvCtx->enabled = !frameAdvCtx->enabled; } - if (!frameAdvCtx->enabled || (CHECK_BTN_ALL(input->cur.button, BTN_Z) && - (CHECK_BTN_ALL(input->press.button, BTN_R) || - (CHECK_BTN_ALL(input->cur.button, BTN_R) && (++frameAdvCtx->timer >= 9))))) { + if (!frameAdvCtx->enabled || + ((checkR && CHECK_BTN_ALL(input->press.button, FA_CONTROL)) || (checkR && (++frameAdvCtx->timer >= 9)))) { frameAdvCtx->timer = 0; return true; } diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 8e9f00fec..2cad84089 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -10,22 +10,26 @@ #undef DEFINE_GAMESTATE_INTERNAL // Gamestate Overlay Table definition -#define DEFINE_GAMESTATE_INTERNAL(typeName, enumName) \ - { NULL, 0, 0, NULL, NULL, NULL, typeName##_Init, typeName##_Destroy, NULL, NULL, 0, sizeof(typeName##State) }, +#define DEFINE_GAMESTATE_INTERNAL(typeName, enumName) \ + { \ + NULL, ROM_FILE_UNSET, NULL, NULL, NULL, typeName##_Init, typeName##_Destroy, NULL, NULL, \ + 0, sizeof(typeName##State), \ + }, #define DEFINE_GAMESTATE(typeName, enumName, name) \ - { NULL, \ - (uintptr_t)_ovl_##name##SegmentRomStart, \ - (uintptr_t)_ovl_##name##SegmentRomEnd, \ - _ovl_##name##SegmentStart, \ - _ovl_##name##SegmentEnd, \ - NULL, \ - typeName##_Init, \ - typeName##_Destroy, \ - NULL, \ - NULL, \ - 0, \ - sizeof(typeName##State) }, + { \ + NULL, \ + ROM_FILE(ovl_##name), \ + _ovl_##name##SegmentStart, \ + _ovl_##name##SegmentEnd, \ + NULL, \ + typeName##_Init, \ + typeName##_Destroy, \ + NULL, \ + NULL, \ + 0, \ + sizeof(typeName##State), \ + }, GameStateOverlay gGameStateOverlayTable[] = { #include "tables/gamestate_table.h" diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index 35a6bc4a7..954cbcf3f 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -1,11 +1,8 @@ #include "global.h" #include "terminal.h" -#define KALEIDO_OVERLAY(name, nameString) \ - { \ - NULL, (uintptr_t)_ovl_##name##SegmentRomStart, (uintptr_t)_ovl_##name##SegmentRomEnd, \ - _ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, 0, nameString, \ - } +#define KALEIDO_OVERLAY(name, nameString) \ + { NULL, ROM_FILE(ovl_##name), _ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, 0, nameString, } KaleidoMgrOverlay gKaleidoMgrOverlayTable[] = { KALEIDO_OVERLAY(kaleido_scope, "kaleido_scope"), @@ -20,7 +17,7 @@ void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl) { LOG_UTILS_CHECK_NULL_POINTER("KaleidoArea_allocp", sKaleidoAreaPtr, "../z_kaleido_manager.c", 99); ovl->loadedRamAddr = sKaleidoAreaPtr; - Overlay_Load(ovl->vromStart, ovl->vromEnd, ovl->vramStart, ovl->vramEnd, ovl->loadedRamAddr); + Overlay_Load(ovl->file.vromStart, ovl->file.vromEnd, ovl->vramStart, ovl->vramEnd, ovl->loadedRamAddr); PRINTF(VT_FGCOL(GREEN)); PRINTF("OVL(k):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", ovl->vramStart, ovl->vramEnd, ovl->loadedRamAddr, @@ -80,9 +77,10 @@ void KaleidoManager_Destroy(void) { void* KaleidoManager_GetRamAddr(void* vram) { KaleidoMgrOverlay* iter = gKaleidoMgrCurOvl; KaleidoMgrOverlay* ovl = iter; - u32 i; if (ovl == NULL) { + u32 i; + iter = &gKaleidoMgrOverlayTable[0]; for (i = 0; i < ARRAY_COUNT(gKaleidoMgrOverlayTable); i++) { if (((uintptr_t)vram >= (uintptr_t)iter->vramStart) && ((uintptr_t)iter->vramEnd >= (uintptr_t)vram)) { diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 79d9242f4..49b5ebcc0 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -56,19 +56,25 @@ void KaleidoScopeCall_Update(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; PauseContext* pauseCtx = &play->pauseCtx; - if (IS_PAUSED(pauseCtx)) { + if (IS_PAUSED(&play->pauseCtx)) { if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) { if (Letterbox_GetSize() == 0) { +#if IS_DEBUG R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_LOG_MODE = 3; +#endif + R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->unk_1EC = 0; pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; // PAUSE_STATE_WAIT_BG_PRERENDER } } else if (pauseCtx->state == PAUSE_STATE_8) { +#if IS_DEBUG R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_LOG_MODE = 3; +#endif + R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->unk_1EC = 0; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 6585ea54f..34353f513 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -19,7 +19,8 @@ void KaleidoSetup_Update(PlayState* play) { gSaveContext.magicState != MAGIC_STATE_FILL && (play->sceneId != SCENE_BOMBCHU_BOWLING_ALLEY || !Flags_GetSwitch(play, 0x38))) { - if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) { + if (IS_EVENT_EDITOR_ENABLED && CHECK_BTN_ALL(input->cur.button, BTN_L) && + CHECK_BTN_ALL(input->press.button, BTN_CUP)) { if (BREG(0)) { pauseCtx->debugState = 3; } @@ -65,23 +66,26 @@ void KaleidoSetup_Update(PlayState* play) { void KaleidoSetup_Init(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; - u64 temp = 0; // Necessary to match pauseCtx->state = PAUSE_STATE_OFF; - pauseCtx->debugState = 0; + pauseCtx->alpha = 0; pauseCtx->unk_1EA = 0; pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->mode = 0; pauseCtx->pageIndex = PAUSE_ITEM; + pauseCtx->debugState = 0; - pauseCtx->unk_1F4 = 160.0f; - pauseCtx->unk_1F8 = 160.0f; - pauseCtx->unk_1FC = 160.0f; - pauseCtx->unk_200 = 160.0f; + pauseCtx->eye.x = pauseCtx->eye.y = 0.0f; pauseCtx->eye.z = 64.0f; pauseCtx->unk_1F0 = 936.0f; - pauseCtx->eye.x = pauseCtx->eye.y = 0.0f; + pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = 160.0f; + + pauseCtx->alpha = 0; + + // mainState = PAUSE_MAIN_STATE_IDLE , pageIndex = PAUSE_ITEM + pauseCtx->unk_1EA = pauseCtx->mainState = pauseCtx->mode = pauseCtx->pageIndex = 0; + pauseCtx->unk_204 = -314.0f; pauseCtx->cursorPoint[PAUSE_ITEM] = 0; @@ -94,8 +98,8 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->cursorY[PAUSE_ITEM] = 0; pauseCtx->cursorX[PAUSE_MAP] = 0; pauseCtx->cursorY[PAUSE_MAP] = 0; - pauseCtx->cursorX[PAUSE_QUEST] = temp; - pauseCtx->cursorY[PAUSE_QUEST] = temp; + pauseCtx->cursorX[PAUSE_QUEST] = 0; + pauseCtx->cursorY[PAUSE_QUEST] = 0; pauseCtx->cursorX[PAUSE_EQUIP] = 1; pauseCtx->cursorY[PAUSE_EQUIP] = 0; diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index e1ab29cef..5b3bb2e67 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -9,8 +9,10 @@ void func_8006EE50(Font* font, u16 arg1, u16 arg2) { * at `codePointIndex`. The value of `character` is the ASCII codepoint subtract ' '/0x20. */ void Font_LoadChar(Font* font, u8 character, u16 codePointIndex) { + u8 charTmp = character; + DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex], - (uintptr_t)_nes_font_staticSegmentRomStart + character * FONT_CHAR_TEX_SIZE, FONT_CHAR_TEX_SIZE, + (uintptr_t)_nes_font_staticSegmentRomStart + charTmp * FONT_CHAR_TEX_SIZE, FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 93); } @@ -31,10 +33,7 @@ void Font_LoadMessageBoxIcon(Font* font, u16 icon) { * the font buffer. */ void Font_LoadOrderedFont(Font* font) { - u8* fontBuf; - uintptr_t fontStatic; s32 len; - s32 jj; s32 codePointIndex; s32 fontBufIndex; u32 offset; @@ -44,23 +43,22 @@ void Font_LoadOrderedFont(Font* font) { DMA_REQUEST_SYNC(font->msgBuf, (uintptr_t)_nes_message_data_staticSegmentRomStart + font->msgOffset, len, "../z_kanfont.c", 122); - PRINTF("msg_data=%x, msg_data0=%x jj=%x\n", font->msgOffset, font->msgLength, jj = len); - len = jj; - for (fontBufIndex = 0, codePointIndex = 0; font->msgBuf[codePointIndex] != MESSAGE_END; codePointIndex++) { - if (codePointIndex > len) { + PRINTF("msg_data=%x, msg_data0=%x jj=%x\n", font->msgOffset, font->msgLength, len * 1); + + fontBufIndex = 0; + for (codePointIndex = 0; font->msgBuf[codePointIndex] != MESSAGE_END; codePointIndex++) { + if (codePointIndex > (len * 1)) { PRINTF("ERRORï¼ï¼ エラーï¼ï¼ï¼ error───ï¼ï¼ï¼ï¼\n"); return; } if (font->msgBuf[codePointIndex] != MESSAGE_NEWLINE) { - fontBuf = font->fontBuf + fontBufIndex * 8; - fontStatic = (uintptr_t)_nes_font_staticSegmentRomStart; - PRINTF("nes_mes_buf[%d]=%d\n", codePointIndex, font->msgBuf[codePointIndex]); offset = (font->msgBuf[codePointIndex] - ' ') * FONT_CHAR_TEX_SIZE; - DMA_REQUEST_SYNC(fontBuf, fontStatic + offset, FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 134); + DMA_REQUEST_SYNC(font->fontBuf + fontBufIndex * 8, (uintptr_t)_nes_font_staticSegmentRomStart + offset, + FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 134); fontBufIndex += FONT_CHAR_TEX_SIZE / 8; } } diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 771cc1d37..2d8a341ce 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -252,7 +252,8 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) gSaveContext.sunsSongState = SUNSSONG_INACTIVE; - if (((void)0, gSaveContext.save.dayTime) > CLOCK_TIME(18, 0) || + //! FAKE: (void)0 on CLOCK_TIME(18, 0) + if (((void)0, gSaveContext.save.dayTime) > ((void)0, CLOCK_TIME(18, 0)) || ((void)0, gSaveContext.save.dayTime) < CLOCK_TIME(6, 30)) { ((void)0, gSaveContext.save.nightFlag = 1); } else { @@ -335,12 +336,17 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) envCtx->lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; envCtx->lightBlendRateOverride = LIGHT_BLENDRATE_OVERRIDE_NONE; - R_ENV_TIME_SPEED_OLD = gTimeSpeed = envCtx->sceneTimeSpeed = 0; + envCtx->sceneTimeSpeed = 0; + gTimeSpeed = envCtx->sceneTimeSpeed; + +#if IS_DEBUG + R_ENV_TIME_SPEED_OLD = gTimeSpeed; R_ENV_DISABLE_DBG = true; if (CREG(3) != 0) { gSaveContext.chamberCutsceneNum = CREG(3) - 1; } +#endif play->envCtx.precipitation[PRECIP_RAIN_MAX] = 0; play->envCtx.precipitation[PRECIP_RAIN_CUR] = 0; @@ -405,6 +411,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) gSkyboxIsChanging = false; gSaveContext.retainWeatherMode = false; +#if IS_DEBUG R_ENV_LIGHT1_DIR(0) = 80; R_ENV_LIGHT1_DIR(1) = 80; R_ENV_LIGHT1_DIR(2) = 80; @@ -419,6 +426,8 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) cREG(12) = 0; cREG(13) = 0; cREG(14) = 0; +#endif + gUseCutsceneCam = true; for (i = 0; i < ARRAY_COUNT(sLightningBolts); i++) { @@ -512,10 +521,9 @@ u8 Environment_SmoothStepToS8(s8* pvalue, s8 target, u8 scale, u8 step, u8 minSt f32 Environment_LerpWeight(u16 max, u16 min, u16 val) { f32 diff = max - min; - f32 ret; if (diff != 0.0f) { - ret = 1.0f - (max - val) / diff; + f32 ret = 1.0f - (max - val) / diff; if (!(ret >= 1.0f)) { return ret; @@ -700,10 +708,12 @@ void Environment_UpdateSkybox(u8 skyboxId, EnvironmentContext* envCtx, SkyboxCon } } +#if IS_DEBUG if (newSkybox1Index == 0xFF) { // "Environment VR data acquisition failed! Report to Sasaki!" PRINTF(VT_COL(RED, WHITE) "\n環境VRデータå–å¾—å¤±æ•—ï¼ ã•ã•ãã¾ã§ã”報告をï¼" VT_RST); } +#endif if ((envCtx->skybox1Index != newSkybox1Index) && (envCtx->skyboxDmaState == SKYBOX_DMA_INACTIVE)) { envCtx->skyboxDmaState = SKYBOX_DMA_TEXTURE1_START; @@ -815,60 +825,64 @@ void Environment_DisableUnderwaterLights(PlayState* play) { } } +#if IS_DEBUG void Environment_PrintDebugInfo(PlayState* play, Gfx** gfx) { - GfxPrint printer; - s32 pad[2]; + if (CAN_SHOW_TIME_INFOS) { + GfxPrint printer; + s32 pad[2]; - GfxPrint_Init(&printer); - GfxPrint_Open(&printer, *gfx); + GfxPrint_Init(&printer); + GfxPrint_Open(&printer, *gfx); - GfxPrint_SetPos(&printer, 22, 7); - GfxPrint_SetColor(&printer, 155, 155, 255, 64); - GfxPrint_Printf(&printer, "T%03d ", ((void)0, gSaveContext.save.totalDays)); - GfxPrint_Printf(&printer, "E%03d", ((void)0, gSaveContext.save.bgsDayCount)); + GfxPrint_SetPos(&printer, 22, 7); + GfxPrint_SetColor(&printer, 155, 155, 255, 64); + GfxPrint_Printf(&printer, "T%03d ", ((void)0, gSaveContext.save.totalDays)); + GfxPrint_Printf(&printer, "E%03d", ((void)0, gSaveContext.save.bgsDayCount)); - GfxPrint_SetColor(&printer, 255, 255, 55, 64); - GfxPrint_SetPos(&printer, 22, 8); - GfxPrint_Printf(&printer, "%s", "ZELDATIME "); + GfxPrint_SetColor(&printer, 255, 255, 55, 64); + GfxPrint_SetPos(&printer, 22, 8); + GfxPrint_Printf(&printer, "%s", "ZELDATIME "); - GfxPrint_SetColor(&printer, 255, 255, 255, 64); - GfxPrint_Printf(&printer, "%02d", (u8)(24 * 60 / (f32)0x10000 * ((void)0, gSaveContext.save.dayTime) / 60.0f)); + GfxPrint_SetColor(&printer, 255, 255, 255, 64); + GfxPrint_Printf(&printer, "%02d", (u8)(24 * 60 / (f32)0x10000 * ((void)0, gSaveContext.save.dayTime) / 60.0f)); - if ((gSaveContext.save.dayTime & 0x1F) >= 0x10 || gTimeSpeed >= 6) { - GfxPrint_Printf(&printer, "%s", ":"); - } else { - GfxPrint_Printf(&printer, "%s", " "); + if ((gSaveContext.save.dayTime & 0x1F) >= 0x10 || gTimeSpeed >= 6) { + GfxPrint_Printf(&printer, "%s", ":"); + } else { + GfxPrint_Printf(&printer, "%s", " "); + } + + GfxPrint_Printf(&printer, "%02d", (s16)(24 * 60 / (f32)0x10000 * ((void)0, gSaveContext.save.dayTime)) % 60); + + GfxPrint_SetColor(&printer, 255, 255, 55, 64); + GfxPrint_SetPos(&printer, 22, 9); + GfxPrint_Printf(&printer, "%s", "VRBOXTIME "); + + GfxPrint_SetColor(&printer, 255, 255, 255, 64); + GfxPrint_Printf(&printer, "%02d", (u8)(24 * 60 / (f32)0x10000 * ((void)0, gSaveContext.skyboxTime) / 60.0f)); + + if ((((void)0, gSaveContext.skyboxTime) & 0x1F) >= 0x10 || gTimeSpeed >= 6) { + GfxPrint_Printf(&printer, "%s", ":"); + } else { + GfxPrint_Printf(&printer, "%s", " "); + } + + GfxPrint_Printf(&printer, "%02d", (s16)(24 * 60 / (f32)0x10000 * ((void)0, gSaveContext.skyboxTime)) % 60); + + GfxPrint_SetColor(&printer, 55, 255, 255, 64); + GfxPrint_SetPos(&printer, 22, 6); + + if (!IS_DAY) { + GfxPrint_Printf(&printer, "%s", "YORU"); // "night" + } else { + GfxPrint_Printf(&printer, "%s", "HIRU"); // "day" + } + + *gfx = GfxPrint_Close(&printer); + GfxPrint_Destroy(&printer); } - - GfxPrint_Printf(&printer, "%02d", (s16)(24 * 60 / (f32)0x10000 * ((void)0, gSaveContext.save.dayTime)) % 60); - - GfxPrint_SetColor(&printer, 255, 255, 55, 64); - GfxPrint_SetPos(&printer, 22, 9); - GfxPrint_Printf(&printer, "%s", "VRBOXTIME "); - - GfxPrint_SetColor(&printer, 255, 255, 255, 64); - GfxPrint_Printf(&printer, "%02d", (u8)(24 * 60 / (f32)0x10000 * ((void)0, gSaveContext.skyboxTime) / 60.0f)); - - if ((((void)0, gSaveContext.skyboxTime) & 0x1F) >= 0x10 || gTimeSpeed >= 6) { - GfxPrint_Printf(&printer, "%s", ":"); - } else { - GfxPrint_Printf(&printer, "%s", " "); - } - - GfxPrint_Printf(&printer, "%02d", (s16)(24 * 60 / (f32)0x10000 * ((void)0, gSaveContext.skyboxTime)) % 60); - - GfxPrint_SetColor(&printer, 55, 255, 255, 64); - GfxPrint_SetPos(&printer, 22, 6); - - if (!IS_DAY) { - GfxPrint_Printf(&printer, "%s", "YORU"); // "night" - } else { - GfxPrint_Printf(&printer, "%s", "HIRU"); // "day" - } - - *gfx = GfxPrint_Close(&printer); - GfxPrint_Destroy(&printer); } +#endif void Environment_PlayTimeBasedSequence(PlayState* play); void Environment_UpdateRain(PlayState* play); @@ -881,7 +895,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex u16 j; u16 time; EnvLightSettings* lightSettingsList = play->envCtx.lightSettingsList; - s32 adjustment; + u8 blendRate; if ((((void)0, gSaveContext.gameMode) != GAMEMODE_NORMAL) && (((void)0, gSaveContext.gameMode) != GAMEMODE_END_CREDITS)) { @@ -923,7 +937,9 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex if ((pauseCtx->state == PAUSE_STATE_OFF) && (gameOverCtx->state == GAMEOVER_INACTIVE)) { if (((msgCtx->msgLength == 0) && (msgCtx->msgMode == MSGMODE_NONE)) || (((void)0, gSaveContext.gameMode) == GAMEMODE_END_CREDITS)) { + if ((envCtx->changeSkyboxTimer == 0) && !FrameAdvance_IsEnabled(play) && + (play->transitionMode == TRANS_MODE_OFF || ((void)0, gSaveContext.gameMode) != GAMEMODE_NORMAL)) { if (IS_DAY || gTimeSpeed >= 400) { @@ -951,7 +967,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex gSaveContext.save.nightFlag = 0; } - if (R_ENABLE_ARENA_DBG != 0 || CREG(2) != 0) { + if (CAN_SHOW_TIME_INFOS && (R_ENABLE_ARENA_DBG != 0) || (CREG(2) != 0)) { Gfx* displayList; Gfx* prevDisplayList; @@ -973,243 +989,240 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex (envCtx->lightSetting != envCtx->lightSettingOverride) && (envCtx->lightBlend >= 1.0f) && (envCtx->lightSettingOverride <= LIGHT_SETTING_MAX)) { + envCtx->lightBlend = 0.0f; envCtx->prevLightSetting = envCtx->lightSetting; envCtx->lightSetting = envCtx->lightSettingOverride; - envCtx->lightBlend = 0.0f; } - if (envCtx->lightSettingOverride != LIGHT_SETTING_OVERRIDE_FULL_CONTROL) { - if ((envCtx->lightMode == LIGHT_MODE_TIME) && - (envCtx->lightSettingOverride == LIGHT_SETTING_OVERRIDE_NONE)) { - for (i = 0; i < ARRAY_COUNT(sTimeBasedLightConfigs[envCtx->lightConfig]); i++) { - if ((gSaveContext.skyboxTime >= sTimeBasedLightConfigs[envCtx->lightConfig][i].startTime) && - ((gSaveContext.skyboxTime < sTimeBasedLightConfigs[envCtx->lightConfig][i].endTime) || - sTimeBasedLightConfigs[envCtx->lightConfig][i].endTime == 0xFFFF)) { - u8 blend8[2]; - s16 blend16[2]; + if (envCtx->lightSettingOverride == LIGHT_SETTING_OVERRIDE_FULL_CONTROL) { + // Do nothing; Skip updating lights based on time or light settings + } else if ((envCtx->lightMode == LIGHT_MODE_TIME) && + (envCtx->lightSettingOverride == LIGHT_SETTING_OVERRIDE_NONE)) { + for (i = 0; i < ARRAY_COUNT(sTimeBasedLightConfigs[envCtx->lightConfig]); i++) { + if ((gSaveContext.skyboxTime >= sTimeBasedLightConfigs[envCtx->lightConfig][i].startTime) && + ((gSaveContext.skyboxTime < sTimeBasedLightConfigs[envCtx->lightConfig][i].endTime) || + sTimeBasedLightConfigs[envCtx->lightConfig][i].endTime == 0xFFFF)) { + u8 blend8[2]; + s16 blend16[2]; - timeChangeBlend = - Environment_LerpWeight(sTimeBasedLightConfigs[envCtx->lightConfig][i].endTime, - sTimeBasedLightConfigs[envCtx->lightConfig][i].startTime, - ((void)0, gSaveContext.skyboxTime)); + timeChangeBlend = Environment_LerpWeight(sTimeBasedLightConfigs[envCtx->lightConfig][i].endTime, + sTimeBasedLightConfigs[envCtx->lightConfig][i].startTime, + ((void)0, gSaveContext.skyboxTime)); - sSandstormColorIndex = sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting & 3; - sNextSandstormColorIndex = sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting & 3; - sSandstormLerpScale = timeChangeBlend; + sSandstormColorIndex = sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting & 3; + sNextSandstormColorIndex = sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting & 3; + sSandstormLerpScale = timeChangeBlend; - if (envCtx->changeLightEnabled) { - configChangeBlend = - ((f32)envCtx->changeDuration - envCtx->changeLightTimer) / envCtx->changeDuration; - envCtx->changeLightTimer--; + if (envCtx->changeLightEnabled) { + configChangeBlend = + ((f32)envCtx->changeDuration - envCtx->changeLightTimer) / envCtx->changeDuration; + envCtx->changeLightTimer--; - if (envCtx->changeLightTimer <= 0) { - envCtx->changeLightEnabled = false; - envCtx->lightConfig = envCtx->changeLightNextConfig; - } + if (envCtx->changeLightTimer <= 0) { + envCtx->changeLightEnabled = false; + envCtx->lightConfig = envCtx->changeLightNextConfig; } + } - for (j = 0; j < 3; j++) { - // blend ambient color - blend8[0] = - LERP(lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting] - .ambientColor[j], - lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting] - .ambientColor[j], - timeChangeBlend); - blend8[1] = LERP( - lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] - .ambientColor[j], - lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i] - .nextLightSetting] - .ambientColor[j], - timeChangeBlend); - *(envCtx->lightSettings.ambientColor + j) = LERP(blend8[0], blend8[1], configChangeBlend); - } - - // set light1 direction for the sun - envCtx->lightSettings.light1Dir[0] = - -(Math_SinS(((void)0, gSaveContext.save.dayTime) - CLOCK_TIME(12, 0)) * 120.0f); - envCtx->lightSettings.light1Dir[1] = - Math_CosS(((void)0, gSaveContext.save.dayTime) - CLOCK_TIME(12, 0)) * 120.0f; - envCtx->lightSettings.light1Dir[2] = - Math_CosS(((void)0, gSaveContext.save.dayTime) - CLOCK_TIME(12, 0)) * 20.0f; - - // set light2 direction for the moon - envCtx->lightSettings.light2Dir[0] = -envCtx->lightSettings.light1Dir[0]; - envCtx->lightSettings.light2Dir[1] = -envCtx->lightSettings.light1Dir[1]; - envCtx->lightSettings.light2Dir[2] = -envCtx->lightSettings.light1Dir[2]; - - for (j = 0; j < 3; j++) { - // blend light1Color - blend8[0] = - LERP(lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting] - .light1Color[j], - lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting] - .light1Color[j], - timeChangeBlend); - blend8[1] = LERP( - lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] - .light1Color[j], - lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i] - .nextLightSetting] - .light1Color[j], - timeChangeBlend); - *(envCtx->lightSettings.light1Color + j) = LERP(blend8[0], blend8[1], configChangeBlend); - - // blend light2Color - blend8[0] = - LERP(lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting] - .light2Color[j], - lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting] - .light2Color[j], - timeChangeBlend); - blend8[1] = LERP( - lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] - .light2Color[j], - lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i] - .nextLightSetting] - .light2Color[j], - timeChangeBlend); - *(envCtx->lightSettings.light2Color + j) = LERP(blend8[0], blend8[1], configChangeBlend); - } - - // blend fogColor - for (j = 0; j < 3; j++) { - blend8[0] = - LERP(lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting] - .fogColor[j], - lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting] - .fogColor[j], - timeChangeBlend); - blend8[1] = LERP( - lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] - .fogColor[j], - lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i] - .nextLightSetting] - .fogColor[j], - timeChangeBlend); - *(envCtx->lightSettings.fogColor + j) = LERP(blend8[0], blend8[1], configChangeBlend); - } - - blend16[0] = LERP16( - ENV_LIGHT_SETTINGS_FOG_NEAR( - lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting] - .blendRateAndFogNear), - ENV_LIGHT_SETTINGS_FOG_NEAR( - lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting] - .blendRateAndFogNear), - timeChangeBlend); - blend16[1] = LERP16( - ENV_LIGHT_SETTINGS_FOG_NEAR( - lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] - .blendRateAndFogNear), - ENV_LIGHT_SETTINGS_FOG_NEAR( - lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i] - .nextLightSetting] - .blendRateAndFogNear), - timeChangeBlend); - - envCtx->lightSettings.fogNear = LERP16(blend16[0], blend16[1], configChangeBlend); - - blend16[0] = LERP16( - lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting].zFar, - lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting].zFar, - timeChangeBlend); - blend16[1] = LERP16( + for (j = 0; j < 3; j++) { + // blend ambient color + blend8[0] = + LERP(lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting] + .ambientColor[j], + lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting] + .ambientColor[j], + timeChangeBlend); + blend8[1] = LERP( lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] - .zFar, + .ambientColor[j], lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting] - .zFar, + .ambientColor[j], timeChangeBlend); - - envCtx->lightSettings.zFar = LERP16(blend16[0], blend16[1], configChangeBlend); - - if (sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting >= - envCtx->numLightSettings) { - // "The color palette setting seems to be wrong!" - PRINTF(VT_COL(RED, WHITE) "\nカラーパレットã®è¨­å®šãŒãŠã‹ã—ã„よã†ã§ã™ï¼" VT_RST); - - // "Palette setting = [] Last palette number = []" - PRINTF(VT_COL(RED, WHITE) "\n設定パレットï¼[%d] 最後パレット番å·ï¼[%d]\n" VT_RST, - sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting, - envCtx->numLightSettings - 1); - } - break; - } - } - } else { - if (!envCtx->lightBlendEnabled) { - for (i = 0; i < 3; i++) { - envCtx->lightSettings.ambientColor[i] = lightSettingsList[envCtx->lightSetting].ambientColor[i]; - envCtx->lightSettings.light1Dir[i] = lightSettingsList[envCtx->lightSetting].light1Dir[i]; - envCtx->lightSettings.light1Color[i] = lightSettingsList[envCtx->lightSetting].light1Color[i]; - envCtx->lightSettings.light2Dir[i] = lightSettingsList[envCtx->lightSetting].light2Dir[i]; - envCtx->lightSettings.light2Color[i] = lightSettingsList[envCtx->lightSetting].light2Color[i]; - envCtx->lightSettings.fogColor[i] = lightSettingsList[envCtx->lightSetting].fogColor[i]; + envCtx->lightSettings.ambientColor[j] = LERP(blend8[0], blend8[1], configChangeBlend); } - envCtx->lightSettings.fogNear = - ENV_LIGHT_SETTINGS_FOG_NEAR(lightSettingsList[envCtx->lightSetting].blendRateAndFogNear); - envCtx->lightSettings.zFar = lightSettingsList[envCtx->lightSetting].zFar; - envCtx->lightBlend = 1.0f; - } else { - u8 blendRate = - ENV_LIGHT_SETTINGS_BLEND_RATE_U8(lightSettingsList[envCtx->lightSetting].blendRateAndFogNear); + // set light1 direction for the sun + envCtx->lightSettings.light1Dir[0] = + -(Math_SinS(((void)0, gSaveContext.save.dayTime) - CLOCK_TIME(12, 0)) * 120.0f); + envCtx->lightSettings.light1Dir[1] = + Math_CosS(((void)0, gSaveContext.save.dayTime) - CLOCK_TIME(12, 0)) * 120.0f; + envCtx->lightSettings.light1Dir[2] = + Math_CosS(((void)0, gSaveContext.save.dayTime) - CLOCK_TIME(12, 0)) * 20.0f; - if (blendRate == 0) { - blendRate++; + // set light2 direction for the moon + envCtx->lightSettings.light2Dir[0] = -envCtx->lightSettings.light1Dir[0]; + envCtx->lightSettings.light2Dir[1] = -envCtx->lightSettings.light1Dir[1]; + envCtx->lightSettings.light2Dir[2] = -envCtx->lightSettings.light1Dir[2]; + + for (j = 0; j < 3; j++) { + // blend light1Color + blend8[0] = + LERP(lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting] + .light1Color[j], + lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting] + .light1Color[j], + timeChangeBlend); + blend8[1] = LERP( + lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] + .light1Color[j], + lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting] + .light1Color[j], + timeChangeBlend); + envCtx->lightSettings.light1Color[j] = LERP(blend8[0], blend8[1], configChangeBlend); + + // blend light2Color + blend8[0] = + LERP(lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting] + .light2Color[j], + lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting] + .light2Color[j], + timeChangeBlend); + blend8[1] = LERP( + lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] + .light2Color[j], + lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting] + .light2Color[j], + timeChangeBlend); + envCtx->lightSettings.light2Color[j] = LERP(blend8[0], blend8[1], configChangeBlend); } - if (envCtx->lightBlendRateOverride != LIGHT_BLENDRATE_OVERRIDE_NONE) { - blendRate = envCtx->lightBlendRateOverride; + // blend fogColor + for (j = 0; j < 3; j++) { + blend8[0] = LERP( + lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting].fogColor[j], + lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting] + .fogColor[j], + timeChangeBlend); + blend8[1] = LERP( + lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] + .fogColor[j], + lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting] + .fogColor[j], + timeChangeBlend); + envCtx->lightSettings.fogColor[j] = LERP(blend8[0], blend8[1], configChangeBlend); } - if (envCtx->lightBlendOverride == LIGHT_BLEND_OVERRIDE_NONE) { - envCtx->lightBlend += blendRate / 255.0f; + blend16[0] = + LERP16(ENV_LIGHT_SETTINGS_FOG_NEAR( + lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting] + .blendRateAndFogNear), + ENV_LIGHT_SETTINGS_FOG_NEAR( + lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting] + .blendRateAndFogNear), + timeChangeBlend); + blend16[1] = LERP16( + ENV_LIGHT_SETTINGS_FOG_NEAR( + lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting] + .blendRateAndFogNear), + ENV_LIGHT_SETTINGS_FOG_NEAR( + lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting] + .blendRateAndFogNear), + timeChangeBlend); + + envCtx->lightSettings.fogNear = LERP16(blend16[0], blend16[1], configChangeBlend); + + blend16[0] = + LERP16(lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].lightSetting].zFar, + lightSettingsList[sTimeBasedLightConfigs[envCtx->lightConfig][i].nextLightSetting].zFar, + timeChangeBlend); + blend16[1] = LERP16( + lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].lightSetting].zFar, + lightSettingsList[sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting] + .zFar, + timeChangeBlend); + + envCtx->lightSettings.zFar = LERP16(blend16[0], blend16[1], configChangeBlend); + +#if IS_DEBUG + if (sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting >= + envCtx->numLightSettings) { + // "The color palette setting seems to be wrong!" + PRINTF(VT_COL(RED, WHITE) "\nカラーパレットã®è¨­å®šãŒãŠã‹ã—ã„よã†ã§ã™ï¼" VT_RST); + + // "Palette setting = [] Last palette number = []" + PRINTF(VT_COL(RED, WHITE) "\n設定パレットï¼[%d] 最後パレット番å·ï¼[%d]\n" VT_RST, + sTimeBasedLightConfigs[envCtx->changeLightNextConfig][i].nextLightSetting, + envCtx->numLightSettings - 1); } +#endif - if (envCtx->lightBlend > 1.0f) { - envCtx->lightBlend = 1.0f; - } - - for (i = 0; i < 3; i++) { - envCtx->lightSettings.ambientColor[i] = - LERP(lightSettingsList[envCtx->prevLightSetting].ambientColor[i], - lightSettingsList[envCtx->lightSetting].ambientColor[i], envCtx->lightBlend); - envCtx->lightSettings.light1Dir[i] = - LERP16(lightSettingsList[envCtx->prevLightSetting].light1Dir[i], - lightSettingsList[envCtx->lightSetting].light1Dir[i], envCtx->lightBlend); - envCtx->lightSettings.light1Color[i] = - LERP(lightSettingsList[envCtx->prevLightSetting].light1Color[i], - lightSettingsList[envCtx->lightSetting].light1Color[i], envCtx->lightBlend); - envCtx->lightSettings.light2Dir[i] = - LERP16(lightSettingsList[envCtx->prevLightSetting].light2Dir[i], - lightSettingsList[envCtx->lightSetting].light2Dir[i], envCtx->lightBlend); - envCtx->lightSettings.light2Color[i] = - LERP(lightSettingsList[envCtx->prevLightSetting].light2Color[i], - lightSettingsList[envCtx->lightSetting].light2Color[i], envCtx->lightBlend); - envCtx->lightSettings.fogColor[i] = - LERP(lightSettingsList[envCtx->prevLightSetting].fogColor[i], - lightSettingsList[envCtx->lightSetting].fogColor[i], envCtx->lightBlend); - } - envCtx->lightSettings.fogNear = LERP16( - ENV_LIGHT_SETTINGS_FOG_NEAR(lightSettingsList[envCtx->prevLightSetting].blendRateAndFogNear), - ENV_LIGHT_SETTINGS_FOG_NEAR(lightSettingsList[envCtx->lightSetting].blendRateAndFogNear), - envCtx->lightBlend); - envCtx->lightSettings.zFar = - LERP16(lightSettingsList[envCtx->prevLightSetting].zFar, - lightSettingsList[envCtx->lightSetting].zFar, envCtx->lightBlend); - } - - if (envCtx->lightSetting >= envCtx->numLightSettings) { - // "The color palette seems to be wrong!" - PRINTF("\n" VT_FGCOL(RED) "カラーパレットãŒãŠã‹ã—ã„よã†ã§ã™ï¼"); - - // "Palette setting = [] Last palette number = []" - PRINTF("\n" VT_FGCOL(YELLOW) "設定パレットï¼[%d] パレット数ï¼[%d]\n" VT_RST, envCtx->lightSetting, - envCtx->numLightSettings); + break; } } + } else { + if (!envCtx->lightBlendEnabled) { + for (i = 0; i < 3; i++) { + envCtx->lightSettings.ambientColor[i] = lightSettingsList[envCtx->lightSetting].ambientColor[i]; + envCtx->lightSettings.light1Dir[i] = lightSettingsList[envCtx->lightSetting].light1Dir[i]; + envCtx->lightSettings.light1Color[i] = lightSettingsList[envCtx->lightSetting].light1Color[i]; + envCtx->lightSettings.light2Dir[i] = lightSettingsList[envCtx->lightSetting].light2Dir[i]; + envCtx->lightSettings.light2Color[i] = lightSettingsList[envCtx->lightSetting].light2Color[i]; + envCtx->lightSettings.fogColor[i] = lightSettingsList[envCtx->lightSetting].fogColor[i]; + } + + envCtx->lightSettings.fogNear = + ENV_LIGHT_SETTINGS_FOG_NEAR(lightSettingsList[envCtx->lightSetting].blendRateAndFogNear); + envCtx->lightSettings.zFar = lightSettingsList[envCtx->lightSetting].zFar; + envCtx->lightBlend = 1.0f; + } else { + blendRate = + ENV_LIGHT_SETTINGS_BLEND_RATE_U8(lightSettingsList[envCtx->lightSetting].blendRateAndFogNear); + + if (blendRate == 0) { + blendRate++; + } + + if (envCtx->lightBlendRateOverride != LIGHT_BLENDRATE_OVERRIDE_NONE) { + blendRate = envCtx->lightBlendRateOverride; + } + + if (envCtx->lightBlendOverride == LIGHT_BLEND_OVERRIDE_NONE) { + envCtx->lightBlend += blendRate / 255.0f; + } + + if (envCtx->lightBlend > 1.0f) { + envCtx->lightBlend = 1.0f; + } + + for (i = 0; i < 3; i++) { + envCtx->lightSettings.ambientColor[i] = + LERP(lightSettingsList[envCtx->prevLightSetting].ambientColor[i], + lightSettingsList[envCtx->lightSetting].ambientColor[i], envCtx->lightBlend); + envCtx->lightSettings.light1Dir[i] = + LERP16(lightSettingsList[envCtx->prevLightSetting].light1Dir[i], + lightSettingsList[envCtx->lightSetting].light1Dir[i], envCtx->lightBlend); + envCtx->lightSettings.light1Color[i] = + LERP(lightSettingsList[envCtx->prevLightSetting].light1Color[i], + lightSettingsList[envCtx->lightSetting].light1Color[i], envCtx->lightBlend); + envCtx->lightSettings.light2Dir[i] = + LERP16(lightSettingsList[envCtx->prevLightSetting].light2Dir[i], + lightSettingsList[envCtx->lightSetting].light2Dir[i], envCtx->lightBlend); + envCtx->lightSettings.light2Color[i] = + LERP(lightSettingsList[envCtx->prevLightSetting].light2Color[i], + lightSettingsList[envCtx->lightSetting].light2Color[i], envCtx->lightBlend); + envCtx->lightSettings.fogColor[i] = + LERP(lightSettingsList[envCtx->prevLightSetting].fogColor[i], + lightSettingsList[envCtx->lightSetting].fogColor[i], envCtx->lightBlend); + } + + envCtx->lightSettings.fogNear = + LERP16(ENV_LIGHT_SETTINGS_FOG_NEAR(lightSettingsList[envCtx->prevLightSetting].blendRateAndFogNear), + ENV_LIGHT_SETTINGS_FOG_NEAR(lightSettingsList[envCtx->lightSetting].blendRateAndFogNear), + envCtx->lightBlend); + envCtx->lightSettings.zFar = LERP16(lightSettingsList[envCtx->prevLightSetting].zFar, + lightSettingsList[envCtx->lightSetting].zFar, envCtx->lightBlend); + } + +#if IS_DEBUG + if (envCtx->lightSetting >= envCtx->numLightSettings) { + // "The color palette seems to be wrong!" + PRINTF("\n" VT_FGCOL(RED) "カラーパレットãŒãŠã‹ã—ã„よã†ã§ã™ï¼"); + + // "Palette setting = [] Last palette number = []" + PRINTF("\n" VT_FGCOL(YELLOW) "設定パレットï¼[%d] パレット数ï¼[%d]\n" VT_RST, envCtx->lightSetting, + envCtx->numLightSettings); + } +#endif } envCtx->lightBlendEnabled = true; @@ -1261,22 +1274,20 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex envCtx->dirLight2.params.dir.z = envCtx->lightSettings.light2Dir[2]; // Adjust fog near and far if necessary - adjustment = envCtx->lightSettings.fogNear + envCtx->adjFogNear; - if (adjustment <= ENV_FOGNEAR_MAX) { - lightCtx->fogNear = adjustment; + if ((envCtx->lightSettings.fogNear + envCtx->adjFogNear) <= ENV_FOGNEAR_MAX) { + lightCtx->fogNear = envCtx->lightSettings.fogNear + envCtx->adjFogNear; } else { lightCtx->fogNear = ENV_FOGNEAR_MAX; } - adjustment = envCtx->lightSettings.zFar + envCtx->adjZFar; - - if (adjustment <= ENV_ZFAR_MAX) { - lightCtx->zFar = adjustment; + if ((envCtx->lightSettings.zFar + envCtx->adjZFar) <= ENV_ZFAR_MAX) { + lightCtx->zFar = envCtx->lightSettings.zFar + envCtx->adjZFar; } else { lightCtx->zFar = ENV_ZFAR_MAX; } +#if IS_DEBUG // When environment debug is enabled, various environment related variables can be configured via the reg editor if (R_ENV_DISABLE_DBG) { R_ENV_AMBIENT_COLOR(0) = lightCtx->ambientColor[0]; @@ -1357,6 +1368,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex envCtx->windDirection.z = R_ENV_WIND_DIR(2); envCtx->windSpeed = R_ENV_WIND_SPEED; } +#endif if ((envCtx->dirLight1.params.dir.x == 0) && (envCtx->dirLight1.params.dir.y == 0) && (envCtx->dirLight1.params.dir.z == 0)) { @@ -2366,9 +2378,6 @@ void Environment_DrawSandstorm(PlayState* play, u8 sandstormState) { Color_RGBA8 envColor; s32 pad; f32 sp98; - u16 sp96; - u16 sp94; - u16 sp92; switch (sandstormState) { case SANDSTORM_ACTIVE: @@ -2475,25 +2484,27 @@ void Environment_DrawSandstorm(PlayState* play, u8 sandstormState) { envColor.g = ((envColor.g * sp98) + ((6.0f - sp98) * primColor.g)) * (1.0f / 6.0f); envColor.b = ((envColor.b * sp98) + ((6.0f - sp98) * primColor.b)) * (1.0f / 6.0f); - sp96 = (s32)(sSandstormScroll * (11.0f / 6.0f)); - sp94 = (s32)(sSandstormScroll * (9.0f / 6.0f)); - sp92 = (s32)(sSandstormScroll * (6.0f / 6.0f)); + { + u16 sp96 = (s32)(sSandstormScroll * (11.0f / 6.0f)); + u16 sp94 = (s32)(sSandstormScroll * (9.0f / 6.0f)); + u16 sp92 = (s32)(sSandstormScroll * (6.0f / 6.0f)); - OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 4044); + OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 4044); - POLY_XLU_DISP = Gfx_SetupDL_64(POLY_XLU_DISP); + POLY_XLU_DISP = Gfx_SetupDL_64(POLY_XLU_DISP); - gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE); - gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColor.r, primColor.g, primColor.b, play->envCtx.sandstormPrimA); - gDPSetEnvColor(POLY_XLU_DISP++, envColor.r, envColor.g, envColor.b, play->envCtx.sandstormEnvA); - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (u32)sp96 % 4096, 0, 512, 32, 1, (u32)sp94 % 4096, - 4095 - ((u32)sp92 % 4096), 256, 64)); - gDPSetTextureLUT(POLY_XLU_DISP++, G_TT_NONE); - gSPDisplayList(POLY_XLU_DISP++, gFieldSandstormDL); + gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_NOISE); + gDPSetColorDither(POLY_XLU_DISP++, G_CD_NOISE); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColor.r, primColor.g, primColor.b, play->envCtx.sandstormPrimA); + gDPSetEnvColor(POLY_XLU_DISP++, envColor.r, envColor.g, envColor.b, play->envCtx.sandstormEnvA); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (u32)sp96 % 4096, 0, 512, 32, 1, + (u32)sp94 % 4096, 4095 - ((u32)sp92 % 4096), 256, 64)); + gDPSetTextureLUT(POLY_XLU_DISP++, G_TT_NONE); + gSPDisplayList(POLY_XLU_DISP++, gFieldSandstormDL); - CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 4068); + CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 4068); + } sSandstormScroll += (s32)sp98; } diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 6f3617d24..4f8357ae2 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -452,11 +452,11 @@ void Health_DrawMeter(PlayState* play) { heartTexCoordPerPixel *= 1 << 10; halfHeartLength = 8.0f; halfHeartLength *= 0.68f; - gSPTextureRectangle(OVERLAY_DISP++, (s32)((heartCenterX - halfHeartLength) * 4), + gSPTextureRectangle(OVERLAY_DISP++, WIDE_DIV(((heartCenterX - halfHeartLength) * 4), WIDE_GET_4_3), (s32)((heartCenterY - halfHeartLength) * 4), - (s32)((heartCenterX + halfHeartLength) * 4), + WIDE_DIV(((heartCenterX + halfHeartLength) * 4), WIDE_GET_RATIO), (s32)((heartCenterY + halfHeartLength) * 4), G_TX_RENDERTILE, 0, 0, - (s32)heartTexCoordPerPixel, (s32)heartTexCoordPerPixel); + WIDE_DIV(heartTexCoordPerPixel, WIDE_GET_RATIO), (s32)heartTexCoordPerPixel); } else { if ((ddHeartCountMinusOne < 0) || (heartIndex > ddHeartCountMinusOne)) { if (curCombineModeSet != 2) { @@ -476,9 +476,10 @@ void Health_DrawMeter(PlayState* play) { { Mtx* matrix = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); + f32 wideOffsetX = USE_WIDESCREEN ? (offsetX - (30.f * WIDE_GET_16_9)) : offsetX; Matrix_SetTranslateScaleMtx2( matrix, 1.0f - (0.32f * beatingHeartPulsingSize), 1.0f - (0.32f * beatingHeartPulsingSize), - 1.0f - (0.32f * beatingHeartPulsingSize), -130.0f + offsetX, 94.5f - offsetY, 0.0f); + 1.0f - (0.32f * beatingHeartPulsingSize), -129.7f + wideOffsetX, 94.f - offsetY, 0.0f); gSPMatrix(OVERLAY_DISP++, matrix, G_MTX_MODELVIEW | G_MTX_LOAD); gSPVertex(OVERLAY_DISP++, beatingHeartVtx, 4, 0); gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); @@ -506,7 +507,8 @@ void Health_UpdateBeatingHeart(PlayState* play) { if (interfaceCtx->beatingHeartOscillator <= 0) { interfaceCtx->beatingHeartOscillator = 0; interfaceCtx->beatingHeartOscillatorDirection = 0; - if (!Player_InCsMode(play) && !IS_PAUSED(&play->pauseCtx) && Health_IsCritical() && !Play_InCsMode(play)) { + if (ENABLE_LOW_HEALTH_BEEP && !Player_InCsMode(play) && !IS_PAUSED(&play->pauseCtx) && + Health_IsCritical() && !Play_InCsMode(play)) { Sfx_PlaySfxCentered(NA_SE_SY_HITPOINT_ALARM); } } diff --git a/src/code/z_lights.c b/src/code/z_lights.c index ba197dee1..9e33032fc 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -64,6 +64,13 @@ void Lights_Draw(Lights* lights, GraphicsContext* gfxCtx) { gSPNumLights(POLY_OPA_DISP++, lights->numLights); gSPNumLights(POLY_XLU_DISP++, lights->numLights); +#if ENABLE_F3DEX3_LIGHT_RECO + gSPSetLights(POLY_OPA_DISP++, lights->numLights, *lights); + gSPSetLights(POLY_XLU_DISP++, lights->numLights, *lights); + + gSPAmbient(POLY_OPA_DISP++, &lights->l.a, lights->numLights); + gSPAmbient(POLY_XLU_DISP++, &lights->l.a, lights->numLights); +#else light = &lights->l.l[0]; i = 0; @@ -73,14 +80,16 @@ void Lights_Draw(Lights* lights, GraphicsContext* gfxCtx) { } // ambient light is total number of lights + 1 - gSPLight(POLY_OPA_DISP++, &lights->l.a, ++i); - gSPLight(POLY_XLU_DISP++, &lights->l.a, i); + gSPAmbient(POLY_OPA_DISP++, &lights->l.a, ++i); + gSPAmbient(POLY_XLU_DISP++, &lights->l.a, i); +#endif CLOSE_DISPS(gfxCtx, "../z_lights.c", 352); } Light* Lights_FindSlot(Lights* lights) { - if (lights->numLights >= 7) { + u8 numLights = ENABLE_F3DEX3_RECOMMENDATIONS ? 9 : 7; + if (lights->numLights >= numLights) { return NULL; } else { return &lights->l.l[lights->numLights++]; @@ -110,7 +119,9 @@ void Lights_BindPoint(Lights* lights, LightParams* params, Vec3f* vec) { scale = posDiff / scale; scale = 1 - SQ(scale); - +#if ENABLE_F3DEX3 + light->l.type = 0; +#endif light->l.col[0] = light->l.colc[0] = params->point.color[0] * scale; light->l.col[1] = light->l.colc[1] = params->point.color[1] * scale; light->l.col[2] = light->l.colc[2] = params->point.color[2] * scale; @@ -129,6 +140,9 @@ void Lights_BindDirectional(Lights* lights, LightParams* params, Vec3f* vec) { Light* light = Lights_FindSlot(lights); if (light != NULL) { +#if ENABLE_F3DEX3 + light->l.type = 0; +#endif light->l.col[0] = light->l.colc[0] = params->dir.color[0]; light->l.col[1] = light->l.colc[1] = params->dir.color[1]; light->l.col[2] = light->l.colc[2] = params->dir.color[2]; @@ -286,6 +300,9 @@ Lights* Lights_NewAndDraw(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 lights->numLights = numLights; for (i = 0; i < numLights; i++) { +#if ENABLE_F3DEX3 + lights->l.l[i].l.type = 0; +#endif lights->l.l[i].l.col[0] = lights->l.l[i].l.colc[0] = r; lights->l.l[i].l.col[1] = lights->l.l[i].l.colc[1] = g; lights->l.l[i].l.col[2] = lights->l.l[i].l.colc[2] = b; diff --git a/src/code/z_malloc.c b/src/code/z_malloc.c index 41685a60e..cc7310d8d 100644 --- a/src/code/z_malloc.c +++ b/src/code/z_malloc.c @@ -6,7 +6,7 @@ Arena sZeldaArena; -#if OOT_DEBUG +#if IS_DEBUG s32 gZeldaArenaLogSeverity = LOG_SEVERITY_ERROR; void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) { @@ -34,8 +34,8 @@ void* ZeldaArena_Malloc(u32 size) { return ptr; } -#if OOT_DEBUG -void* ZeldaArena_MallocDebug(u32 size, const char* file, s32 line) { +#if IS_DEBUG +void* ZeldaArena_MallocDebug(u32 size, const char* file, int line) { void* ptr = __osMallocDebug(&sZeldaArena, size, file, line); ZELDA_ARENA_CHECK_POINTER(ptr, size, "zelda_malloc_DEBUG", "確ä¿"); // "Secure" @@ -50,8 +50,8 @@ void* ZeldaArena_MallocR(u32 size) { return ptr; } -#if OOT_DEBUG -void* ZeldaArena_MallocRDebug(u32 size, const char* file, s32 line) { +#if IS_DEBUG +void* ZeldaArena_MallocRDebug(u32 size, const char* file, int line) { void* ptr = __osMallocRDebug(&sZeldaArena, size, file, line); ZELDA_ARENA_CHECK_POINTER(ptr, size, "zelda_malloc_r_DEBUG", "確ä¿"); // "Secure" @@ -65,8 +65,8 @@ void* ZeldaArena_Realloc(void* ptr, u32 newSize) { return ptr; } -#if OOT_DEBUG -void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) { +#if IS_DEBUG +void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) { ptr = __osReallocDebug(&sZeldaArena, ptr, newSize, file, line); ZELDA_ARENA_CHECK_POINTER(ptr, newSize, "zelda_realloc_DEBUG", "å†ç¢ºä¿"); // "Re-securing" return ptr; @@ -77,8 +77,8 @@ void ZeldaArena_Free(void* ptr) { __osFree(&sZeldaArena, ptr); } -#if OOT_DEBUG -void ZeldaArena_FreeDebug(void* ptr, const char* file, s32 line) { +#if IS_DEBUG +void ZeldaArena_FreeDebug(void* ptr, const char* file, int line) { __osFreeDebug(&sZeldaArena, ptr, file, line); } #endif @@ -96,7 +96,7 @@ void* ZeldaArena_Calloc(u32 num, u32 size) { return ret; } -#if OOT_DEBUG +#if IS_DEBUG void ZeldaArena_Display(void) { PRINTF("ゼルダヒープ表示\n"); // "Zelda heap display" __osDisplayArena(&sZeldaArena); @@ -112,14 +112,14 @@ void ZeldaArena_Check(void) { } void ZeldaArena_Init(void* start, u32 size) { -#if OOT_DEBUG +#if IS_DEBUG gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocInit(&sZeldaArena, start, size); } void ZeldaArena_Cleanup(void) { -#if OOT_DEBUG +#if IS_DEBUG gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocCleanup(&sZeldaArena); diff --git a/src/code/z_map_data.c b/src/code/z_map_data.c index 24721c623..0a9c9e637 100644 --- a/src/code/z_map_data.c +++ b/src/code/z_map_data.c @@ -231,11 +231,12 @@ static s16 sOwMinimapHeight[24] = { }; static s16 sOwEntranceIconPosX[24] = { - 1, 269, 1, 1, 273, 279, 259, 1, 260, 1, 1, 235, 1, 1, 1, 267, 261, 1, 1, 260, 294, 259, 1, 243, + -1, 269, -1, -1, 273, 279, 259, -1, 260, -1, -1, 235, -1, -1, -1, 267, 261, -1, -1, 260, 294, 259, -1, 243, }; static s16 sOwEntranceIconPosY[24] = { - 0, -833, 0, 0, -850, -889, -829, 0, -844, 0, 0, -836, 0, 0, 0, -852, -873, 0, 0, -848, -825, -829, 0, -833, + -10, -833, -10, -10, -850, -889, -829, -10, -844, -10, -10, -836, + -10, -10, -10, -852, -873, -10, -10, -848, -825, -829, -10, -833, }; static u16 sOwEntranceFlag[20] = { diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index a4eb9d520..c08dd6eb5 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -163,7 +163,8 @@ void Map_InitData(PlayState* play, s16 room) { (uintptr_t)_map_i_staticSegmentRomStart + ((gMapData->dgnMinimapTexIndexOffset[mapIndex] + room) * MAP_I_TEX_SIZE), MAP_I_TEX_SIZE, "../z_map_exp.c", 346); - R_COMPASS_OFFSET_X = gMapData->roomCompassOffsetX[mapIndex][room]; + R_COMPASS_OFFSET_X = + WIDE_MULT(WIDE_MULT(gMapData->roomCompassOffsetX[mapIndex][room], WIDE_GET_16_9), WIDE_GET_RATIO); R_COMPASS_OFFSET_Y = gMapData->roomCompassOffsetY[mapIndex][room]; Map_SetFloorPalettesData(play, VREG(30)); PRINTF("MAP å„階ONãƒã‚§ãƒƒã‚¯\n"); // "MAP Individual Floor ON Check" @@ -263,7 +264,7 @@ void Map_Init(PlayState* play) { R_MAP_INDEX = gSaveContext.mapIndex = mapIndex; R_COMPASS_SCALE_X = gMapData->owCompassInfo[mapIndex][0]; R_COMPASS_SCALE_Y = gMapData->owCompassInfo[mapIndex][1]; - R_COMPASS_OFFSET_X = gMapData->owCompassInfo[mapIndex][2]; + R_COMPASS_OFFSET_X = WIDE_MULT(gMapData->owCompassInfo[mapIndex][2], WIDE_MINIMAP_ARROW_SHIFT); R_COMPASS_OFFSET_Y = gMapData->owCompassInfo[mapIndex][3]; Map_InitData(play, mapIndex); R_OW_MINIMAP_X = gMapData->owMinimapPosX[mapIndex]; @@ -365,7 +366,7 @@ void Minimap_Draw(PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_map_exp.c", 626); - if (play->pauseCtx.state <= PAUSE_STATE_INIT) { + if (play->pauseCtx.state < PAUSE_STATE_INIT) { switch (play->sceneId) { case SCENE_DEKU_TREE: case SCENE_DODONGOS_CAVERN: @@ -390,10 +391,10 @@ void Minimap_Draw(PlayState* play) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, R_DGN_MINIMAP_X << 2, R_DGN_MINIMAP_Y << 2, - (R_DGN_MINIMAP_X + MAP_I_TEX_WIDTH) << 2, - (R_DGN_MINIMAP_Y + MAP_I_TEX_HEIGHT) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, - 1 << 10); + gSPTextureRectangle(OVERLAY_DISP++, WIDE_INCR((R_DGN_MINIMAP_X << 2), WIDE_MINIMAP_SHIFT), + R_DGN_MINIMAP_Y << 2, WIDE_INCR(R_DGN_MINIMAP_X + MAP_I_TEX_WIDTH, 4) << 2, + (R_DGN_MINIMAP_Y + MAP_I_TEX_HEIGHT) << 2, G_TX_RENDERTILE, 0, 0, + WIDE_INCR((1 << 10), (u16)((WIDE_GET_4_3 - 1.0f) * 1000.0f)), 1 << 10); } if (CHECK_DUNGEON_ITEM(DUNGEON_COMPASS, mapIndex)) { @@ -451,10 +452,11 @@ void Minimap_Draw(PlayState* play) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, R_OW_MINIMAP_X << 2, R_OW_MINIMAP_Y << 2, - (R_OW_MINIMAP_X + gMapData->owMinimapWidth[mapIndex]) << 2, + gSPTextureRectangle(OVERLAY_DISP++, WIDE_INCR((R_OW_MINIMAP_X << 2), WIDE_MINIMAP_SHIFT), + R_OW_MINIMAP_Y << 2, + WIDE_INCR(R_OW_MINIMAP_X + gMapData->owMinimapWidth[mapIndex], 10) << 2, (R_OW_MINIMAP_Y + gMapData->owMinimapHeight[mapIndex]) << 2, G_TX_RENDERTILE, 0, - 0, 1 << 10, 1 << 10); + 0, WIDE_INCR((1 << 10), (u16)((WIDE_GET_4_3 - 1.0f) * 1000.0f)), 1 << 10); if (((play->sceneId != SCENE_KAKARIKO_VILLAGE) && (play->sceneId != SCENE_KOKIRI_FOREST) && (play->sceneId != SCENE_ZORAS_FOUNTAIN)) || @@ -468,12 +470,15 @@ void Minimap_Draw(PlayState* play) { 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, - gMapData->owEntranceIconPosX[sEntranceIconMapIndex] << 2, - gMapData->owEntranceIconPosY[sEntranceIconMapIndex] << 2, - (gMapData->owEntranceIconPosX[sEntranceIconMapIndex] + 8) << 2, - (gMapData->owEntranceIconPosY[sEntranceIconMapIndex] + 8) << 2, - G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + gSPTextureRectangle( + OVERLAY_DISP++, + WIDE_INCR((gMapData->owEntranceIconPosX[sEntranceIconMapIndex] << 2), + (WIDE_MINIMAP_SHIFT / 2)), + gMapData->owEntranceIconPosY[sEntranceIconMapIndex] << 2, + WIDE_INCR(((gMapData->owEntranceIconPosX[sEntranceIconMapIndex] + 8) << 2), + (WIDE_MINIMAP_SHIFT / 2)), + (gMapData->owEntranceIconPosY[sEntranceIconMapIndex] + 8) << 2, G_TX_RENDERTILE, 0, 0, + WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); } } @@ -483,8 +488,9 @@ void Minimap_Draw(PlayState* play) { 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, 270 << 2, 154 << 2, 278 << 2, 162 << 2, G_TX_RENDERTILE, 0, - 0, 1 << 10, 1 << 10); + gSPTextureRectangle(OVERLAY_DISP++, WIDE_INCR((270 << 2), (WIDE_MINIMAP_SHIFT / 2)), 154 << 2, + WIDE_INCR((278 << 2), (WIDE_MINIMAP_SHIFT / 2)), 162 << 2, G_TX_RENDERTILE, + 0, 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); } Minimap_DrawCompassIcons(play); // Draw icons for the player spawn and current position diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index 47d3d2bda..116d14214 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -16,8 +16,7 @@ typedef struct { typedef struct { /* 0x00 */ void* loadedRamAddr; // original name: "allocp" - /* 0x04 */ uintptr_t vromStart; - /* 0x08 */ uintptr_t vromEnd; + /* 0x04 */ RomFile file; /* 0x0C */ void* vramStart; /* 0x10 */ void* vramEnd; /* 0x14 */ void* vramTable; @@ -43,12 +42,7 @@ static MapMarkInfo sMapMarkInfoTable[] = { }; static MapMarkDataOverlay sMapMarkDataOvl = { - NULL, - (uintptr_t)_ovl_map_mark_dataSegmentRomStart, - (uintptr_t)_ovl_map_mark_dataSegmentRomEnd, - _ovl_map_mark_dataSegmentStart, - _ovl_map_mark_dataSegmentEnd, - gMapMarkDataTable, + NULL, ROM_FILE(ovl_map_mark_data), _ovl_map_mark_dataSegmentStart, _ovl_map_mark_dataSegmentEnd, gMapMarkDataTable, }; static MapMarkData** sLoadedMarkDataTable; @@ -60,7 +54,8 @@ void MapMark_Init(PlayState* play) { overlay->loadedRamAddr = GAME_STATE_ALLOC(&play->state, overlaySize, "../z_map_mark.c", 235); LOG_UTILS_CHECK_NULL_POINTER("dlftbl->allocp", overlay->loadedRamAddr, "../z_map_mark.c", 236); - Overlay_Load(overlay->vromStart, overlay->vromEnd, overlay->vramStart, overlay->vramEnd, overlay->loadedRamAddr); + Overlay_Load(overlay->file.vromStart, overlay->file.vromEnd, overlay->vramStart, overlay->vramEnd, + overlay->loadedRamAddr); sLoadedMarkDataTable = gMapMarkDataTable; sLoadedMarkDataTable = @@ -118,11 +113,11 @@ void MapMark_DrawForDungeon(PlayState* play) { markInfo->textureWidth, markInfo->textureHeight, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - rectLeft = (GREG(94) + markPoint->x + 204) << 2; - rectTop = (GREG(95) + markPoint->y + 140) << 2; + rectLeft = WIDE_INCR((((IS_DEBUG ? GREG(94) : 0) + markPoint->x + 204) << 2), (WIDE_MINIMAP_SHIFT / 2)); + rectTop = ((IS_DEBUG ? GREG(95) : 0) + markPoint->y + 140) << 2; gSPTextureRectangle(OVERLAY_DISP++, rectLeft, rectTop, markInfo->rectWidth + rectLeft, - rectTop + markInfo->rectHeight, G_TX_RENDERTILE, 0, 0, markInfo->dsdx, - markInfo->dtdy); + rectTop + markInfo->rectHeight, G_TX_RENDERTILE, 0, 0, + WIDE_DIV(markInfo->dsdx, WIDE_GET_RATIO), markInfo->dtdy); } markPoint++; } diff --git a/src/code/z_message_PAL.c b/src/code/z_message_PAL.c index be7d20473..87090e080 100644 --- a/src/code/z_message_PAL.c +++ b/src/code/z_message_PAL.c @@ -30,24 +30,28 @@ u16 sOcarinaSongBitFlags = 0; // ocarina bit flags MessageTableEntry sNesMessageEntryTable[] = { #define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \ { textId, (_SHIFTL(type, 4, 8) | _SHIFTL(yPos, 0, 8)), _message_##textId##_nes }, -#define DEFINE_MESSAGE_FFFC +#define DEFINE_MESSAGE_NES(textId, type, yPos, nesMessage) DEFINE_MESSAGE(textId, type, yPos, nesMessage, , ) #include "assets/text/message_data.h" -#undef DEFINE_MESSAGE_FFFC #undef DEFINE_MESSAGE +#undef DEFINE_MESSAGE_NES { 0xFFFF, 0, NULL }, }; const char* sGerMessageEntryTable[] = { #define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) _message_##textId##_ger, +#define DEFINE_MESSAGE_NES(textId, type, yPos, nesMessage) #include "assets/text/message_data.h" #undef DEFINE_MESSAGE +#undef DEFINE_MESSAGE_NES NULL, }; const char* sFraMessageEntryTable[] = { #define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) _message_##textId##_fra, +#define DEFINE_MESSAGE_NES(textId, type, yPos, nesMessage) #include "assets/text/message_data.h" #undef DEFINE_MESSAGE +#undef DEFINE_MESSAGE_NES NULL, }; @@ -118,9 +122,17 @@ void Message_ResetOcarinaNoteState(void) { sOcarinaButtonAlphaValues[0] = sOcarinaButtonAlphaValues[1] = sOcarinaButtonAlphaValues[2] = sOcarinaButtonAlphaValues[3] = sOcarinaButtonAlphaValues[4] = sOcarinaButtonAlphaValues[5] = sOcarinaButtonAlphaValues[6] = sOcarinaButtonAlphaValues[7] = sOcarinaButtonAlphaValues[8] = 0; - sOcarinaButtonAPrimR = 80; - sOcarinaButtonAPrimG = 255; - sOcarinaButtonAPrimB = 150; + + if (N64_BTN_COLORS) { + sOcarinaButtonAPrimR = 80; + sOcarinaButtonAPrimG = 150; + sOcarinaButtonAPrimB = 255; + } else { + sOcarinaButtonAPrimR = 80; + sOcarinaButtonAPrimG = 255; + sOcarinaButtonAPrimB = 150; + } + sOcarinaButtonAEnvR = 10; sOcarinaButtonAEnvG = 10; sOcarinaButtonAEnvB = 10; @@ -238,15 +250,16 @@ void Message_DrawTextChar(PlayState* play, void* textureImage, Gfx** p) { if (msgCtx->textBoxType != TEXTBOX_TYPE_NONE_NO_SHADOW) { gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, msgCtx->textColorAlpha); gSPTextureRectangle(gfx++, (x + R_TEXT_DROP_SHADOW_OFFSET) << 2, (y + R_TEXT_DROP_SHADOW_OFFSET) << 2, - (x + R_TEXT_DROP_SHADOW_OFFSET + sCharTexSize) << 2, - (y + R_TEXT_DROP_SHADOW_OFFSET + sCharTexSize) << 2, G_TX_RENDERTILE, 0, 0, sCharTexScale, - sCharTexScale); + (x + R_TEXT_DROP_SHADOW_OFFSET + WIDE_MULT(sCharTexSize, WIDE_GET_RATIO)) << 2, + (y + R_TEXT_DROP_SHADOW_OFFSET + sCharTexSize) << 2, G_TX_RENDERTILE, 0, 0, + WIDE_DIV(sCharTexScale, WIDE_GET_RATIO), sCharTexScale); } gDPPipeSync(gfx++); gDPSetPrimColor(gfx++, 0, 0, msgCtx->textColorR, msgCtx->textColorG, msgCtx->textColorB, msgCtx->textColorAlpha); - gSPTextureRectangle(gfx++, x << 2, y << 2, (x + sCharTexSize) << 2, (y + sCharTexSize) << 2, G_TX_RENDERTILE, 0, 0, - sCharTexScale, sCharTexScale); + gSPTextureRectangle(gfx++, x << 2, y << 2, (x + WIDE_MULT(sCharTexSize, WIDE_GET_RATIO)) << 2, + (y + sCharTexSize) << 2, G_TX_RENDERTILE, 0, 0, WIDE_DIV(sCharTexScale, WIDE_GET_RATIO), + sCharTexScale); *p = gfx; } @@ -291,17 +304,15 @@ void Message_GrowTextbox(MessageContext* msgCtx) { void Message_FindMessage(PlayState* play, u16 textId) { const char* foundSeg; const char* nextSeg; + Font* font = &play->msgCtx.font; MessageTableEntry* messageTableEntry = sNesMessageEntryTablePtr; const char** languageSegmentTable; - Font* font; const char* seg; if (gSaveContext.language == LANGUAGE_ENG) { seg = messageTableEntry->segment; while (messageTableEntry->textId != 0xFFFF) { - font = &play->msgCtx.font; - if (messageTableEntry->textId == textId) { foundSeg = messageTableEntry->segment; font->charTexBuf[0] = messageTableEntry->typePos; @@ -323,8 +334,6 @@ void Message_FindMessage(PlayState* play, u16 textId) { seg = messageTableEntry->segment; while (messageTableEntry->textId != 0xFFFF) { - font = &play->msgCtx.font; - if (messageTableEntry->textId == textId) { foundSeg = *languageSegmentTable; font->charTexBuf[0] = messageTableEntry->typePos; @@ -344,7 +353,6 @@ void Message_FindMessage(PlayState* play, u16 textId) { } // "Message not found!!!" PRINTF(" メッセージãŒ,見ã¤ã‹ã‚‰ãªã‹ã£ãŸï¼ï¼ï¼ = %x\n", textId); - font = &play->msgCtx.font; messageTableEntry = sNesMessageEntryTablePtr; if (gSaveContext.language == LANGUAGE_ENG) { @@ -368,13 +376,11 @@ void Message_FindCreditsMessage(PlayState* play, u16 textId) { const char* foundSeg; const char* nextSeg; const char* seg; + Font* font = &play->msgCtx.font; MessageTableEntry* messageTableEntry = sStaffMessageEntryTablePtr; - Font* font; seg = messageTableEntry->segment; while (messageTableEntry->textId != 0xFFFF) { - font = &play->msgCtx.font; - if (messageTableEntry->textId == textId) { foundSeg = messageTableEntry->segment; font->charTexBuf[0] = messageTableEntry->typePos; @@ -478,6 +484,16 @@ void Message_SetTextColor(MessageContext* msgCtx, u16 colorParameter) { } void Message_DrawTextboxIcon(PlayState* play, Gfx** p, s16 x, s16 y) { +#if N64_BTN_COLORS + static s16 sIconPrimColors[][3] = { + { 0, 80, 200 }, + { 50, 130, 255 }, + }; + static s16 sIconEnvColors[][3] = { + { 0, 0, 0 }, + { 0, 130, 255 }, + }; +#else static s16 sIconPrimColors[][3] = { { 0, 200, 80 }, { 50, 255, 130 }, @@ -486,6 +502,7 @@ void Message_DrawTextboxIcon(PlayState* play, Gfx** p, s16 x, s16 y) { { 0, 0, 0 }, { 0, 255, 130 }, }; +#endif static s16 sIconPrimR = 0; static s16 sIconPrimG = 200; static s16 sIconPrimB = 80; @@ -581,8 +598,9 @@ void Message_DrawTextboxIcon(PlayState* play, Gfx** p, s16 x, s16 y) { sCharTexSize = 16.0f * ((f32)R_TEXT_CHAR_SCALE / 100.0f); sCharTexScale = 1024.0f / ((f32)R_TEXT_CHAR_SCALE / 100.0f); - gSPTextureRectangle(gfx++, x << 2, y << 2, (x + sCharTexSize) << 2, (y + sCharTexSize) << 2, G_TX_RENDERTILE, 0, 0, - sCharTexScale, sCharTexScale); + gSPTextureRectangle(gfx++, x << 2, y << 2, WIDE_INCR(((x + sCharTexSize) << 2), -(u16)(WIDE_GET_4_3 * 10.0f)), + (y + sCharTexSize) << 2, G_TX_RENDERTILE, 0, 0, WIDE_DIV(sCharTexScale, WIDE_GET_RATIO), + sCharTexScale); msgCtx->stateTimer++; @@ -762,9 +780,13 @@ u16 Message_DrawItemIcon(PlayState* play, u16 itemId, Gfx** p, u16 i) { ITEM_ICON_WIDTH, ITEM_ICON_HEIGHT, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); } - gSPTextureRectangle(gfx++, (msgCtx->textPosX + R_TEXTBOX_ICON_XPOS) << 2, R_TEXTBOX_ICON_YPOS << 2, - (msgCtx->textPosX + R_TEXTBOX_ICON_XPOS + R_TEXTBOX_ICON_DIMENSION) << 2, - (R_TEXTBOX_ICON_YPOS + R_TEXTBOX_ICON_DIMENSION) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + + gSPTextureRectangle(gfx++, (WIDE_INCR(msgCtx->textPosX, 3) + R_TEXTBOX_ICON_XPOS) << 2, R_TEXTBOX_ICON_YPOS << 2, + WIDE_INCR((msgCtx->textPosX + R_TEXTBOX_ICON_XPOS + R_TEXTBOX_ICON_DIMENSION), + (itemId < ITEM_MEDALLION_FOREST ? -5 : -3)) + << 2, + (R_TEXTBOX_ICON_YPOS + R_TEXTBOX_ICON_DIMENSION) << 2, G_TX_RENDERTILE, 0, 0, + WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); gDPPipeSync(gfx++); gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); @@ -857,7 +879,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { Font* font = &play->msgCtx.font; Gfx* gfx = *gfxP; - play->msgCtx.textPosX = R_TEXT_INIT_XPOS; + play->msgCtx.textPosX = WIDE_INCR(R_TEXT_INIT_XPOS, 23); if (!sTextIsCredits) { msgCtx->textPosY = R_TEXT_INIT_YPOS; @@ -879,7 +901,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { switch (character) { case MESSAGE_NEWLINE: - msgCtx->textPosX = R_TEXT_INIT_XPOS; + msgCtx->textPosX = WIDE_INCR(R_TEXT_INIT_XPOS, 23); if (msgCtx->choiceNum == 1 || msgCtx->choiceNum == 3) { msgCtx->textPosX += 32; } @@ -892,7 +914,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { Message_SetTextColor(msgCtx, msgCtx->msgBufDecoded[++i] & 0xF); break; case ' ': - msgCtx->textPosX += MESSAGE_SPACE_WIDTH; + msgCtx->textPosX += WIDE_MULT(MESSAGE_SPACE_WIDTH, WIDE_GET_RATIO); break; case MESSAGE_BOX_BREAK: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { @@ -910,7 +932,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { *gfxP = gfx; return; case MESSAGE_SHIFT: - msgCtx->textPosX += msgCtx->msgBufDecoded[++i]; + msgCtx->textPosX += WIDE_INCR(msgCtx->msgBufDecoded[++i], (msgCtx->textId == 0x009E ? -16 : -8)); break; case MESSAGE_TEXTID: msgCtx->textboxEndType = TEXTBOX_ENDTYPE_HAS_NEXT; @@ -981,7 +1003,8 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { sMessageHasSetSfx = true; // "Sound (SE)" PRINTF("サウンド(SE)\n"); - sfxHi = msgCtx->msgBufDecoded[i + 1] << 8; + sfxHi = msgCtx->msgBufDecoded[i + 1]; + sfxHi <<= 8; Audio_PlaySfxGeneral(sfxHi | msgCtx->msgBufDecoded[i + 2], &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } @@ -1133,8 +1156,15 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { } Message_DrawTextChar(play, &font->charTexBuf[charTexIdx], &gfx); charTexIdx += FONT_CHAR_TEX_SIZE; + { + f32 fontWidth = sFontWidths[character - ' ']; - msgCtx->textPosX += (s32)(sFontWidths[character - ' '] * (R_TEXT_CHAR_SCALE / 100.0f)); + if (character - ' ' == 7) { + fontWidth = WIDE_N64_MODE(sFontWidths[character - ' '], 3.0f); + } + + msgCtx->textPosX += (s32)WIDE_MULT((fontWidth * (R_TEXT_CHAR_SCALE / 100.0f)), WIDE_GET_RATIO); + } break; } } @@ -1369,8 +1399,8 @@ void Message_Decode(PlayState* play) { } if (loadChar) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); - msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0'; charTexIdx += FONT_CHAR_TEX_SIZE; + msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0'; PRINTF("%x(%x) ", digits[i] + '0' - ' ', digits[i]); decodedBufPos++; } @@ -1390,8 +1420,8 @@ void Message_Decode(PlayState* play) { for (i = 0; i < 2; i++) { if (i == 1 || digits[i] != 0) { Font_LoadChar(font, digits[i] + '0' - ' ', charTexIdx); - msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0'; charTexIdx += FONT_CHAR_TEX_SIZE; + msgCtx->msgBufDecoded[decodedBufPos] = digits[i] + '0'; PRINTF("%x(%x) ", digits[i] + '0' - ' ', digits[i]); decodedBufPos++; } @@ -1579,9 +1609,10 @@ void Message_OpenText(PlayState* play, u16 textId) { Font* font = &msgCtx->font; s16 textBoxType; - if (msgCtx->msgMode == MSGMODE_NONE) { - gSaveContext.prevHudVisibilityMode = gSaveContext.hudVisibilityMode; - } + // clang-format off + if (msgCtx->msgMode == MSGMODE_NONE) { gSaveContext.prevHudVisibilityMode = gSaveContext.hudVisibilityMode; } + // clang-format on + if (R_SCENE_CAM_TYPE == SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT) { Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE); } @@ -1707,6 +1738,7 @@ void Message_StartTextbox(PlayState* play, u16 textId, Actor* actor) { } void Message_ContinueTextbox(PlayState* play, u16 textId) { + s32 pad; MessageContext* msgCtx = &play->msgCtx; PRINTF(VT_FGCOL(GREEN)); @@ -1915,6 +1947,9 @@ u8 Message_GetState(MessageContext* msgCtx) { void Message_DrawTextBox(PlayState* play, Gfx** p) { MessageContext* msgCtx = &play->msgCtx; Gfx* gfx = *p; + u32 width = WIDE_MULT(R_TEXTBOX_WIDTH, WIDE_GET_RATIO); + u32 texWidth = WIDE_DIV(R_TEXTBOX_TEXWIDTH, WIDE_GET_RATIO); + u32 posX = WIDE_INCR(R_TEXTBOX_X, 30); gDPPipeSync(gfx++); gDPSetPrimColor(gfx++, 0, 0, msgCtx->textboxColorRed, msgCtx->textboxColorGreen, msgCtx->textboxColorBlue, @@ -1934,9 +1969,8 @@ void Message_DrawTextBox(PlayState* play, Gfx** p) { G_TX_NOLOD, G_TX_NOLOD); } - gSPTextureRectangle(gfx++, R_TEXTBOX_X << 2, R_TEXTBOX_Y << 2, (R_TEXTBOX_X + R_TEXTBOX_WIDTH) << 2, - (R_TEXTBOX_Y + R_TEXTBOX_HEIGHT) << 2, G_TX_RENDERTILE, 0, 0, R_TEXTBOX_TEXWIDTH << 1, - R_TEXTBOX_TEXHEIGHT << 1); + gSPTextureRectangle(gfx++, posX << 2, R_TEXTBOX_Y << 2, (posX + width) << 2, (R_TEXTBOX_Y + R_TEXTBOX_HEIGHT) << 2, + G_TX_RENDERTILE, 0, 0, texWidth << 1, R_TEXTBOX_TEXHEIGHT << 1); // Draw treble clef if (msgCtx->textBoxType == TEXTBOX_TYPE_OCARINA) { @@ -1946,8 +1980,9 @@ void Message_DrawTextBox(PlayState* play, Gfx** p) { gDPSetPrimColor(gfx++, 0, 0, 255, 100, 0, 255); gDPLoadTextureBlock_4b(gfx++, gOcarinaTrebleClefTex, G_IM_FMT_I, 16, 32, 0, G_TX_MIRROR, G_TX_MIRROR, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfx++, R_TEXTBOX_CLEF_XPOS << 2, R_TEXTBOX_CLEF_YPOS << 2, (R_TEXTBOX_CLEF_XPOS + 16) << 2, - (R_TEXTBOX_CLEF_YPOS + 32) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + gSPTextureRectangle(gfx++, WIDE_INCR(R_TEXTBOX_CLEF_XPOS, 20) << 2, R_TEXTBOX_CLEF_YPOS << 2, + WIDE_INCR((R_TEXTBOX_CLEF_XPOS + 16), 20) << 2, (R_TEXTBOX_CLEF_YPOS + 32) << 2, + G_TX_RENDERTILE, 0, 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); } *p = gfx; @@ -1974,6 +2009,16 @@ void Message_DrawMain(PlayState* play, Gfx** p) { gOcarinaBtnIconCLeftTex, // OCARINA_BTN_C_LEFT gOcarinaBtnIconCUpTex, // OCARINA_BTN_C_UP }; +#if N64_BTN_COLORS + static s16 sOcarinaButtonAPrimColors[][3] = { + { 80, 150, 255 }, + { 100, 200, 255 }, + }; + static s16 sOcarinaButtonAEnvColors[][3] = { + { 10, 10, 10 }, + { 50, 50, 255 }, + }; +#else static s16 sOcarinaButtonAPrimColors[][3] = { { 80, 255, 150 }, { 100, 255, 200 }, @@ -1982,6 +2027,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { { 10, 10, 10 }, { 50, 255, 50 }, }; +#endif static s16 sOcarinaButtonCPrimColors[][3] = { { 255, 255, 50 }, { 255, 255, 180 }, @@ -2852,11 +2898,11 @@ void Message_DrawMain(PlayState* play, Gfx** p) { switch (msgCtx->textboxEndType) { case TEXTBOX_ENDTYPE_2_CHOICE: Message_HandleChoiceSelection(play, 1); - Message_DrawTextboxIcon(play, &gfx, msgCtx->textPosX, msgCtx->textPosY); + Message_DrawTextboxIcon(play, &gfx, WIDE_INCR(msgCtx->textPosX, 24), msgCtx->textPosY); break; case TEXTBOX_ENDTYPE_3_CHOICE: Message_HandleChoiceSelection(play, 2); - Message_DrawTextboxIcon(play, &gfx, msgCtx->textPosX, msgCtx->textPosY); + Message_DrawTextboxIcon(play, &gfx, WIDE_INCR(msgCtx->textPosX, 24), msgCtx->textPosY); break; case TEXTBOX_ENDTYPE_PERSISTENT: if (msgCtx->textId >= 0x6D && msgCtx->textId < 0x73) { @@ -2893,7 +2939,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { if (msgCtx->msgMode == MSGMODE_SONG_PLAYBACK) { g = msgCtx->ocarinaAction - OCARINA_ACTION_PLAYBACK_MINUET; r = gOcarinaSongButtons[g].numButtons; - for (notePosX = R_OCARINA_BUTTONS_XPOS, i = 0; i < r; i++, notePosX += R_OCARINA_BUTTONS_XPOS_OFFSET) { + for (notePosX = WIDE_INCR(R_OCARINA_BUTTONS_XPOS, 16), i = 0; i < r; + i++, notePosX += WIDE_INCR(R_OCARINA_BUTTONS_XPOS_OFFSET, -4)) { gDPPipeSync(gfx++); gDPSetPrimColor(gfx++, 0, 0, 150, 150, 150, 150); gDPSetEnvColor(gfx++, 10, 10, 10, 0); @@ -2906,13 +2953,14 @@ void Message_DrawMain(PlayState* play, Gfx** p) { R_OCARINA_BUTTONS_YPOS(gOcarinaSongButtons[g].buttonsIndex[i]) << 2, (notePosX + 16) << 2, (R_OCARINA_BUTTONS_YPOS(gOcarinaSongButtons[g].buttonsIndex[i]) + 16) << 2, - G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + G_TX_RENDERTILE, 0, 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); } } if (msgCtx->msgMode != MSGMODE_SCARECROW_LONG_RECORDING_START && msgCtx->msgMode != MSGMODE_MEMORY_GAME_START) { - for (notePosX = R_OCARINA_BUTTONS_XPOS, i = 0; i < 8; i++, notePosX += R_OCARINA_BUTTONS_XPOS_OFFSET) { + for (notePosX = WIDE_INCR(R_OCARINA_BUTTONS_XPOS, 16), i = 0; i < 8; + i++, notePosX += WIDE_INCR(R_OCARINA_BUTTONS_XPOS_OFFSET, -4)) { if (sOcarinaButtonIndexBuf[i] == OCARINA_BTN_INVALID) { break; } @@ -2943,7 +2991,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { gSPTextureRectangle(gfx++, notePosX << 2, R_OCARINA_BUTTONS_YPOS(sOcarinaButtonIndexBuf[i]) << 2, (notePosX + 16) << 2, (R_OCARINA_BUTTONS_YPOS(sOcarinaButtonIndexBuf[i]) + 16) << 2, G_TX_RENDERTILE, - 0, 0, 1 << 10, 1 << 10); + 0, 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); } } } @@ -2951,76 +2999,90 @@ void Message_DrawMain(PlayState* play, Gfx** p) { *p = gfx; } +#if IS_DEBUG /** * If the s16 variable pointed to by `var` changes in value, a black bar and white box * are briefly drawn onto the screen. It can only watch one variable per build due to * the last value being saved in a static variable. */ void Message_DrawDebugVariableChanged(s16* var, GraphicsContext* gfxCtx) { - static s16 sVarLastValue = 0; - static s16 sFillTimer = 0; - s32 pad; + if (IS_MSG_DEBUG_ENABLED) { + static s16 sVarLastValue = 0; + static s16 sFillTimer = 0; + s32 pad; - OPEN_DISPS(gfxCtx, "../z_message_PAL.c", 3485); + OPEN_DISPS(gfxCtx, "../z_message_PAL.c", 3485); - if (sVarLastValue != *var) { - sVarLastValue = *var; - sFillTimer = 30; + if (sVarLastValue != *var) { + sVarLastValue = *var; + sFillTimer = 30; + } + if (sFillTimer != 0) { + sFillTimer--; + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL); + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2); + gDPSetFillColor(POLY_OPA_DISP++, GPACK_RGBA5551(0, 0, 0, 1) << 0x10 | GPACK_RGBA5551(0, 0, 0, 1)); + gDPFillRectangle(POLY_OPA_DISP++, 0, 110, SCREEN_WIDTH - 1, 150); // 40x319 black bar + gDPPipeSync(POLY_OPA_DISP++); + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL); + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2); + gDPSetFillColor(POLY_OPA_DISP++, + GPACK_RGBA5551(255, 255, 255, 1) << 0x10 | GPACK_RGBA5551(255, 255, 255, 1)); + gDPFillRectangle(POLY_OPA_DISP++, 40, 120, 60, 140); // 20x20 white box + gDPPipeSync(POLY_OPA_DISP++); + } + CLOSE_DISPS(gfxCtx, "../z_message_PAL.c", 3513); } - if (sFillTimer != 0) { - sFillTimer--; - gDPPipeSync(POLY_OPA_DISP++); - gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL); - gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2); - gDPSetFillColor(POLY_OPA_DISP++, GPACK_RGBA5551(0, 0, 0, 1) << 0x10 | GPACK_RGBA5551(0, 0, 0, 1)); - gDPFillRectangle(POLY_OPA_DISP++, 0, 110, SCREEN_WIDTH - 1, 150); // 40x319 black bar - gDPPipeSync(POLY_OPA_DISP++); - gDPPipeSync(POLY_OPA_DISP++); - gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL); - gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2); - gDPSetFillColor(POLY_OPA_DISP++, GPACK_RGBA5551(255, 255, 255, 1) << 0x10 | GPACK_RGBA5551(255, 255, 255, 1)); - gDPFillRectangle(POLY_OPA_DISP++, 40, 120, 60, 140); // 20x20 white box - gDPPipeSync(POLY_OPA_DISP++); - } - CLOSE_DISPS(gfxCtx, "../z_message_PAL.c", 3513); } void Message_DrawDebugText(PlayState* play, Gfx** p) { - s32 pad; - GfxPrint printer; - s32 pad1; + if (IS_MSG_DEBUG_ENABLED) { + s32 pad; + GfxPrint printer; + s32 pad1; - GfxPrint_Init(&printer); - GfxPrint_Open(&printer, *p); - GfxPrint_SetPos(&printer, 6, 26); - GfxPrint_SetColor(&printer, 255, 60, 0, 255); - GfxPrint_Printf(&printer, "%s", "MESSAGE"); - GfxPrint_SetPos(&printer, 14, 26); - GfxPrint_Printf(&printer, "%s", "="); - GfxPrint_SetPos(&printer, 16, 26); - GfxPrint_Printf(&printer, "%x", play->msgCtx.textId); - *p = GfxPrint_Close(&printer); - GfxPrint_Destroy(&printer); + GfxPrint_Init(&printer); + GfxPrint_Open(&printer, *p); + GfxPrint_SetPos(&printer, 6, 26); + GfxPrint_SetColor(&printer, 255, 60, 0, 255); + GfxPrint_Printf(&printer, "%s", "MESSAGE"); + GfxPrint_SetPos(&printer, 14, 26); + GfxPrint_Printf(&printer, "%s", "="); + GfxPrint_SetPos(&printer, 16, 26); + GfxPrint_Printf(&printer, "%x", play->msgCtx.textId); + *p = GfxPrint_Close(&printer); + GfxPrint_Destroy(&printer); + } } +#endif void Message_Draw(PlayState* play) { Gfx* plusOne; Gfx* polyOpaP; + +#if IS_DEBUG s16 watchVar; +#endif OPEN_DISPS(play->state.gfxCtx, "../z_message_PAL.c", 3554); - watchVar = gSaveContext.save.info.scarecrowLongSongSet; - Message_DrawDebugVariableChanged(&watchVar, play->state.gfxCtx); - if (BREG(0) != 0 && play->msgCtx.textId != 0) { - plusOne = Gfx_Open(polyOpaP = POLY_OPA_DISP); - gSPDisplayList(OVERLAY_DISP++, plusOne); - Message_DrawDebugText(play, &plusOne); - gSPEndDisplayList(plusOne++); - Gfx_Close(polyOpaP, plusOne); - POLY_OPA_DISP = plusOne; + if (IS_MSG_DEBUG_ENABLED) { + watchVar = gSaveContext.save.info.scarecrowLongSongSet; + Message_DrawDebugVariableChanged(&watchVar, play->state.gfxCtx); + if (BREG(0) != 0 && play->msgCtx.textId != 0) { + plusOne = Gfx_Open(polyOpaP = POLY_OPA_DISP); + gSPDisplayList(OVERLAY_DISP++, plusOne); + Message_DrawDebugText(play, &plusOne); + gSPEndDisplayList(plusOne++); + Gfx_Close(polyOpaP, plusOne); + POLY_OPA_DISP = plusOne; + } } + if (1) {} + plusOne = Gfx_Open(polyOpaP = POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, plusOne); Message_DrawMain(play, &plusOne); @@ -3052,7 +3114,6 @@ void Message_Update(PlayState* play) { 0x0015, 0x0016, 0x0017, 0x0003, 0x0000, 0x270B, 0x00C8, 0x012C, 0x012D, 0xFFDA, 0x0014, 0x0016, 0x0014, 0x0016, }; static u8 D_80153D74 = 0; - static u16 D_80153D78 = 0; MessageContext* msgCtx = &play->msgCtx; InterfaceContext* interfaceCtx = &play->interfaceCtx; Player* player = GET_PLAYER(play); @@ -3063,11 +3124,17 @@ void Message_Update(PlayState* play) { s16 playerFocusScreenPosY; s16 actorFocusScreenPosY; - if (BREG(0) != 0) { + if (ENABLE_FAST_TEXT) { + sTextboxSkipped = true; + } + + if (IS_MSG_DEBUG_ENABLED && BREG(0) != 0) { + static u16 sMessageDebuggerTextboxCount = 0; + if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN) && CHECK_BTN_ALL(input->cur.button, BTN_L)) { - PRINTF("msgno=%d\n", D_80153D78); + PRINTF("msgno=%d\n", sMessageDebuggerTextboxCount); Message_StartTextbox(play, R_MESSAGE_DEBUGGER_TEXTID, NULL); - D_80153D78 = (D_80153D78 + 1) % 10; + sMessageDebuggerTextboxCount = (sMessageDebuggerTextboxCount + 1) % 10; } if (R_MESSAGE_DEBUGGER_SELECT != 0) { while (R_MESSAGE_DEBUGGER_TEXTID != 0x8000) { @@ -3089,255 +3156,256 @@ void Message_Update(PlayState* play) { } } - if (msgCtx->msgLength == 0) { - return; - } + if (msgCtx->msgLength != 0) { - switch (msgCtx->msgMode) { - case MSGMODE_TEXT_START: - D_8014B2F4++; + switch (msgCtx->msgMode) { + case MSGMODE_TEXT_START: + D_8014B2F4++; - var = false; - if (R_SCENE_CAM_TYPE == SCENE_CAM_TYPE_FIXED_MARKET) { - if (D_8014B2F4 >= 4) { + var = false; + if (R_SCENE_CAM_TYPE == SCENE_CAM_TYPE_FIXED_MARKET) { + if (D_8014B2F4 >= 4) { + var = true; + } + } else if (R_SCENE_CAM_TYPE != SCENE_CAM_TYPE_DEFAULT || + play->sceneId == SCENE_CASTLE_COURTYARD_GUARDS_DAY) { + var = true; + } else if (D_8014B2F4 >= 4 || msgCtx->talkActor == NULL) { var = true; } - } else if (R_SCENE_CAM_TYPE != SCENE_CAM_TYPE_DEFAULT || - play->sceneId == SCENE_CASTLE_COURTYARD_GUARDS_DAY) { - var = true; - } else if (D_8014B2F4 >= 4 || msgCtx->talkActor == NULL) { - var = true; - } - if (var) { - if (msgCtx->talkActor != NULL) { - Actor_GetScreenPos(play, &GET_PLAYER(play)->actor, &focusScreenPosX, &playerFocusScreenPosY); - Actor_GetScreenPos(play, msgCtx->talkActor, &focusScreenPosX, &actorFocusScreenPosY); + if (var) { + if (msgCtx->talkActor != NULL) { + Actor_GetScreenPos(play, &GET_PLAYER(play)->actor, &focusScreenPosX, &playerFocusScreenPosY); + Actor_GetScreenPos(play, msgCtx->talkActor, &focusScreenPosX, &actorFocusScreenPosY); - if (playerFocusScreenPosY >= actorFocusScreenPosY) { - averageY = ((playerFocusScreenPosY - actorFocusScreenPosY) / 2) + actorFocusScreenPosY; + if (playerFocusScreenPosY >= actorFocusScreenPosY) { + averageY = ((playerFocusScreenPosY - actorFocusScreenPosY) / 2) + actorFocusScreenPosY; + } else { + averageY = ((actorFocusScreenPosY - playerFocusScreenPosY) / 2) + playerFocusScreenPosY; + } + PRINTF("dxpos=%d dypos=%d dypos1 dypos2=%d\n", focusScreenPosX, averageY, + playerFocusScreenPosY, actorFocusScreenPosY); } else { - averageY = ((actorFocusScreenPosY - playerFocusScreenPosY) / 2) + playerFocusScreenPosY; + R_TEXTBOX_X = R_TEXTBOX_X_TARGET; + R_TEXTBOX_Y = R_TEXTBOX_Y_TARGET; } - PRINTF("dxpos=%d dypos=%d dypos1 dypos2=%d\n", focusScreenPosX, averageY, playerFocusScreenPosY, - actorFocusScreenPosY); - } else { - R_TEXTBOX_X = R_TEXTBOX_X_TARGET; - R_TEXTBOX_Y = R_TEXTBOX_Y_TARGET; - } - var = msgCtx->textBoxType; + var = msgCtx->textBoxType; - if (!msgCtx->textBoxPos) { // variable position - if (R_SCENE_CAM_TYPE != SCENE_CAM_TYPE_DEFAULT || - play->sceneId == SCENE_CASTLE_COURTYARD_GUARDS_DAY) { - if (averageY < XREG(92)) { - R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var]; + if (!msgCtx->textBoxPos) { // variable position + if (R_SCENE_CAM_TYPE != SCENE_CAM_TYPE_DEFAULT || + play->sceneId == SCENE_CASTLE_COURTYARD_GUARDS_DAY) { + if (averageY < XREG(92)) { + R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var]; + } else { + R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var]; + } + } else if (play->sceneId == SCENE_MARKET_DAY || play->sceneId == SCENE_MARKET_NIGHT || + play->sceneId == SCENE_MARKET_RUINS) { + if (averageY < XREG(93)) { + R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var]; + } else { + R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var]; + } } else { - R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var]; - } - } else if (play->sceneId == SCENE_MARKET_DAY || play->sceneId == SCENE_MARKET_NIGHT || - play->sceneId == SCENE_MARKET_RUINS) { - if (averageY < XREG(93)) { - R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var]; - } else { - R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var]; + if (averageY < XREG(94)) { + R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var]; + } else { + R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var]; + } } + } else if (msgCtx->textBoxPos == TEXTBOX_POS_TOP) { + R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var]; + } else if (msgCtx->textBoxPos == TEXTBOX_POS_MIDDLE) { + R_TEXTBOX_Y_TARGET = sTextboxMidYPositions[var]; } else { - if (averageY < XREG(94)) { - R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var]; - } else { - R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var]; - } + R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var]; } - } else if (msgCtx->textBoxPos == TEXTBOX_POS_TOP) { - R_TEXTBOX_Y_TARGET = sTextboxUpperYPositions[var]; - } else if (msgCtx->textBoxPos == TEXTBOX_POS_MIDDLE) { - R_TEXTBOX_Y_TARGET = sTextboxMidYPositions[var]; - } else { - R_TEXTBOX_Y_TARGET = sTextboxLowerYPositions[var]; - } - R_TEXTBOX_X_TARGET = sTextboxXPositions[var]; - R_TEXTBOX_END_YPOS = sTextboxEndIconYOffset[var] + R_TEXTBOX_Y_TARGET; - R_TEXT_CHOICE_YPOS(0) = R_TEXTBOX_Y_TARGET + 20; - R_TEXT_CHOICE_YPOS(1) = R_TEXTBOX_Y_TARGET + 32; - R_TEXT_CHOICE_YPOS(2) = R_TEXTBOX_Y_TARGET + 44; - PRINTF("message->msg_disp_type=%x\n", msgCtx->textBoxProperties & 0xF0); - if (msgCtx->textBoxType == TEXTBOX_TYPE_NONE_BOTTOM || - msgCtx->textBoxType == TEXTBOX_TYPE_NONE_NO_SHADOW) { - msgCtx->msgMode = MSGMODE_TEXT_STARTING; - R_TEXTBOX_X = R_TEXTBOX_X_TARGET; - R_TEXTBOX_Y = R_TEXTBOX_Y_TARGET; - R_TEXTBOX_WIDTH = 256; - R_TEXTBOX_HEIGHT = 64; - R_TEXTBOX_TEXWIDTH = 512; - R_TEXTBOX_TEXHEIGHT = 512; - } else { - Message_GrowTextbox(msgCtx); - Audio_PlaySfxIfNotInCutscene(NA_SE_NONE); - msgCtx->stateTimer = 0; - msgCtx->msgMode = MSGMODE_TEXT_BOX_GROWING; + R_TEXTBOX_X_TARGET = sTextboxXPositions[var]; + R_TEXTBOX_END_YPOS = sTextboxEndIconYOffset[var] + R_TEXTBOX_Y_TARGET; + R_TEXT_CHOICE_YPOS(0) = R_TEXTBOX_Y_TARGET + 20; + R_TEXT_CHOICE_YPOS(1) = R_TEXTBOX_Y_TARGET + 32; + R_TEXT_CHOICE_YPOS(2) = R_TEXTBOX_Y_TARGET + 44; + PRINTF("message->msg_disp_type=%x\n", msgCtx->textBoxProperties & 0xF0); + if (msgCtx->textBoxType == TEXTBOX_TYPE_NONE_BOTTOM || + msgCtx->textBoxType == TEXTBOX_TYPE_NONE_NO_SHADOW) { + msgCtx->msgMode = MSGMODE_TEXT_STARTING; + R_TEXTBOX_X = R_TEXTBOX_X_TARGET; + R_TEXTBOX_Y = R_TEXTBOX_Y_TARGET; + R_TEXTBOX_WIDTH = 256; + R_TEXTBOX_HEIGHT = 64; + R_TEXTBOX_TEXWIDTH = 512; + R_TEXTBOX_TEXHEIGHT = 512; + } else { + Message_GrowTextbox(msgCtx); + Audio_PlaySfxIfNotInCutscene(NA_SE_NONE); + msgCtx->stateTimer = 0; + msgCtx->msgMode = MSGMODE_TEXT_BOX_GROWING; + } } - } - break; - case MSGMODE_TEXT_BOX_GROWING: - Message_GrowTextbox(msgCtx); - break; - case MSGMODE_TEXT_STARTING: - msgCtx->msgMode = MSGMODE_TEXT_NEXT_MSG; - if (YREG(31) == 0) { - Interface_SetDoAction(play, DO_ACTION_NEXT); - } - break; - case MSGMODE_TEXT_NEXT_MSG: - Message_Decode(play); - if (sTextFade) { - Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); - } - if (D_80153D74 != 0) { - msgCtx->textDrawPos = msgCtx->decodedTextLen; - D_80153D74 = 0; - } - break; - case MSGMODE_TEXT_CONTINUING: - msgCtx->stateTimer--; - if (msgCtx->stateTimer == 0) { + break; + case MSGMODE_TEXT_BOX_GROWING: + Message_GrowTextbox(msgCtx); + break; + case MSGMODE_TEXT_STARTING: + msgCtx->msgMode = MSGMODE_TEXT_NEXT_MSG; + if (YREG(31) == 0) { + Interface_SetDoAction(play, DO_ACTION_NEXT); + } + break; + case MSGMODE_TEXT_NEXT_MSG: Message_Decode(play); - } - break; - case MSGMODE_TEXT_DISPLAYING: - if (msgCtx->textBoxType != TEXTBOX_TYPE_NONE_BOTTOM && YREG(31) == 0 && - CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B) && !msgCtx->textUnskippable) { - sTextboxSkipped = true; - msgCtx->textDrawPos = msgCtx->decodedTextLen; - } - break; - case MSGMODE_TEXT_AWAIT_INPUT: - if (YREG(31) == 0 && Message_ShouldAdvance(play)) { - msgCtx->msgMode = MSGMODE_TEXT_DISPLAYING; - msgCtx->textDrawPos++; - } - break; - case MSGMODE_TEXT_DELAYED_BREAK: - msgCtx->stateTimer--; - if (msgCtx->stateTimer == 0) { - msgCtx->msgMode = MSGMODE_TEXT_NEXT_MSG; - } - break; - case MSGMODE_TEXT_AWAIT_NEXT: - if (Message_ShouldAdvance(play)) { - msgCtx->msgMode = MSGMODE_TEXT_NEXT_MSG; - msgCtx->textUnskippable = false; - msgCtx->msgBufPos++; - } - break; - case MSGMODE_TEXT_DONE: - if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADING) { + if (sTextFade || + (DISABLE_PLAYER_FREEZE && sTextFade && (msgCtx->textId != 0xB4) && (msgCtx->textId != 0xB5))) { + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); + } + if (D_80153D74 != 0) { + msgCtx->textDrawPos = msgCtx->decodedTextLen; + D_80153D74 = 0; + } + break; + case MSGMODE_TEXT_CONTINUING: msgCtx->stateTimer--; if (msgCtx->stateTimer == 0) { - Message_CloseTextbox(play); + Message_Decode(play); } - } else if (msgCtx->textboxEndType != TEXTBOX_ENDTYPE_PERSISTENT && - msgCtx->textboxEndType != TEXTBOX_ENDTYPE_EVENT && YREG(31) == 0) { - if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_2_CHOICE && play->msgCtx.ocarinaMode == OCARINA_MODE_01) { - if (Message_ShouldAdvance(play)) { - PRINTF("OCARINA_MODE=%d -> ", play->msgCtx.ocarinaMode); - play->msgCtx.ocarinaMode = (msgCtx->choiceIndex == 0) ? OCARINA_MODE_02 : OCARINA_MODE_04; - PRINTF("InRaceSeq=%d(%d) OCARINA_MODE=%d --> ", GET_EVENTINF_HORSES_STATE(), 1, - play->msgCtx.ocarinaMode); - Message_CloseTextbox(play); - PRINTF("OCARINA_MODE=%d\n", play->msgCtx.ocarinaMode); - } - } else if (Message_ShouldAdvanceSilent(play)) { - PRINTF("select=%d\n", msgCtx->textboxEndType); - if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_HAS_NEXT) { - Audio_PlaySfxGeneral(NA_SE_SY_MESSAGE_PASS, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - Message_ContinueTextbox(play, sNextTextId); - } else { - Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - Message_CloseTextbox(play); - } - } - } - break; - case MSGMODE_TEXT_CLOSING: - msgCtx->stateTimer--; - if (msgCtx->stateTimer != 0) { break; - } - if ((msgCtx->textId >= 0xC2 && msgCtx->textId < 0xC7) || - (msgCtx->textId >= 0xFA && msgCtx->textId < 0xFE)) { - gSaveContext.healthAccumulator = 0x140; // Refill 20 hearts - } - if (msgCtx->textId == 0x301F || msgCtx->textId == 0xA || msgCtx->textId == 0xC || msgCtx->textId == 0xCF || - msgCtx->textId == 0x21C || msgCtx->textId == 9 || msgCtx->textId == 0x4078 || - msgCtx->textId == 0x2015 || msgCtx->textId == 0x3040) { - gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL; - } - if (play->csCtx.state == 0) { - PRINTF(VT_FGCOL(GREEN)); - PRINTF("day_time=%x active_camera=%d ", gSaveContext.save.cutsceneIndex, play->activeCamId); - - if (msgCtx->textId != 0x2061 && msgCtx->textId != 0x2025 && msgCtx->textId != 0x208C && - ((msgCtx->textId < 0x88D || msgCtx->textId >= 0x893) || msgCtx->choiceIndex != 0) && - (msgCtx->textId != 0x3055 && gSaveContext.save.cutsceneIndex < 0xFFF0)) { - PRINTF("=== day_time=%x ", ((void)0, gSaveContext.save.cutsceneIndex)); - if (play->activeCamId == CAM_ID_MAIN) { - if (gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NO_CHANGE || - gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NOTHING || - gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NOTHING_ALT) { - gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL; + case MSGMODE_TEXT_DISPLAYING: + if (msgCtx->textBoxType != TEXTBOX_TYPE_NONE_BOTTOM && YREG(31) == 0 && + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B) && !msgCtx->textUnskippable) { + sTextboxSkipped = true; + msgCtx->textDrawPos = msgCtx->decodedTextLen; + } + break; + case MSGMODE_TEXT_AWAIT_INPUT: + if (YREG(31) == 0 && Message_ShouldAdvance(play)) { + msgCtx->msgMode = MSGMODE_TEXT_DISPLAYING; + msgCtx->textDrawPos++; + } + break; + case MSGMODE_TEXT_DELAYED_BREAK: + msgCtx->stateTimer--; + if (msgCtx->stateTimer == 0) { + msgCtx->msgMode = MSGMODE_TEXT_NEXT_MSG; + } + break; + case MSGMODE_TEXT_AWAIT_NEXT: + if (Message_ShouldAdvance(play)) { + msgCtx->msgMode = MSGMODE_TEXT_NEXT_MSG; + msgCtx->textUnskippable = false; + msgCtx->msgBufPos++; + } + break; + case MSGMODE_TEXT_DONE: + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_FADING) { + msgCtx->stateTimer--; + if (msgCtx->stateTimer == 0) { + Message_CloseTextbox(play); + } + } else if (msgCtx->textboxEndType != TEXTBOX_ENDTYPE_PERSISTENT && + msgCtx->textboxEndType != TEXTBOX_ENDTYPE_EVENT && YREG(31) == 0) { + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_2_CHOICE && + play->msgCtx.ocarinaMode == OCARINA_MODE_01) { + if (Message_ShouldAdvance(play)) { + PRINTF("OCARINA_MODE=%d -> ", play->msgCtx.ocarinaMode); + play->msgCtx.ocarinaMode = (msgCtx->choiceIndex == 0) ? OCARINA_MODE_02 : OCARINA_MODE_04; + PRINTF("InRaceSeq=%d(%d) OCARINA_MODE=%d --> ", GET_EVENTINF_HORSES_STATE(), 1, + play->msgCtx.ocarinaMode); + Message_CloseTextbox(play); + PRINTF("OCARINA_MODE=%d\n", play->msgCtx.ocarinaMode); + } + } else if (Message_ShouldAdvanceSilent(play)) { + PRINTF("select=%d\n", msgCtx->textboxEndType); + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_HAS_NEXT) { + Audio_PlaySfxGeneral(NA_SE_SY_MESSAGE_PASS, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + Message_ContinueTextbox(play, sNextTextId); + } else { + Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + Message_CloseTextbox(play); } - gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; - Interface_ChangeHudVisibilityMode(gSaveContext.prevHudVisibilityMode); } } - } - PRINTF(VT_RST); - msgCtx->msgLength = 0; - msgCtx->msgMode = MSGMODE_NONE; - interfaceCtx->unk_1FA = interfaceCtx->unk_1FC = 0; - msgCtx->textId = msgCtx->stateTimer = 0; + break; + case MSGMODE_TEXT_CLOSING: + msgCtx->stateTimer--; + if (msgCtx->stateTimer != 0) { + break; + } + if ((msgCtx->textId >= 0xC2 && msgCtx->textId < 0xC7) || + (msgCtx->textId >= 0xFA && msgCtx->textId < 0xFE)) { + gSaveContext.healthAccumulator = 0x140; // Refill 20 hearts + } + if (msgCtx->textId == 0x301F || msgCtx->textId == 0xA || msgCtx->textId == 0xC || + msgCtx->textId == 0xCF || msgCtx->textId == 0x21C || msgCtx->textId == 9 || + msgCtx->textId == 0x4078 || msgCtx->textId == 0x2015 || msgCtx->textId == 0x3040) { + gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL; + } + if (play->csCtx.state == 0) { + PRINTF(VT_FGCOL(GREEN)); + PRINTF("day_time=%x active_camera=%d ", gSaveContext.save.cutsceneIndex, play->activeCamId); - if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_PERSISTENT) { - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; - play->msgCtx.ocarinaMode = OCARINA_MODE_02; - } else { - msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; - } - if ((s32)(gSaveContext.save.info.inventory.questItems & 0xF0000000) == (4 << QUEST_HEART_PIECE_COUNT)) { - gSaveContext.save.info.inventory.questItems ^= (4 << QUEST_HEART_PIECE_COUNT); - gSaveContext.save.info.playerData.healthCapacity += 0x10; - gSaveContext.save.info.playerData.health += 0x10; - } - if (msgCtx->ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE) { - if (sLastPlayedSong == OCARINA_SONG_SARIAS) { - //! @bug The last played song is not unset often, and if something interrupts the message system - // before it reaches this point after playing Saria's song, the song will be "stored". - // Later, if the ocarina has not been played and another textbox is closed, this handling - // for Saria's song will be carried out. - player->naviTextId = -0xE0; - player->naviActor->flags |= ACTOR_FLAG_16; - } - if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY_DONE && - (play->msgCtx.ocarinaMode == OCARINA_MODE_01 || play->msgCtx.ocarinaMode == OCARINA_MODE_0B)) { - play->msgCtx.ocarinaMode = OCARINA_MODE_04; - if (msgCtx->unk_E3F2 == OCARINA_SONG_SUNS) { - play->msgCtx.ocarinaMode = OCARINA_MODE_01; + if (msgCtx->textId != 0x2061 && msgCtx->textId != 0x2025 && msgCtx->textId != 0x208C && + ((msgCtx->textId < 0x88D || msgCtx->textId >= 0x893) || msgCtx->choiceIndex != 0) && + (msgCtx->textId != 0x3055 && gSaveContext.save.cutsceneIndex < 0xFFF0)) { + PRINTF("=== day_time=%x ", ((void)0, gSaveContext.save.cutsceneIndex)); + if (play->activeCamId == CAM_ID_MAIN) { + if (gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NO_CHANGE || + gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NOTHING || + gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NOTHING_ALT) { + gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL; + } + gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; + Interface_ChangeHudVisibilityMode(gSaveContext.prevHudVisibilityMode); + } } } - } - sLastPlayedSong = 0xFF; - PRINTF("OCARINA_MODE=%d chk_ocarina_no=%d\n", play->msgCtx.ocarinaMode, msgCtx->unk_E3F2); - break; - case MSGMODE_PAUSED: - break; - default: - msgCtx->lastOcarinaButtonIndex = OCARINA_BTN_INVALID; - break; + PRINTF(VT_RST); + msgCtx->msgLength = 0; + msgCtx->msgMode = MSGMODE_NONE; + interfaceCtx->unk_1FA = interfaceCtx->unk_1FC = 0; + msgCtx->textId = msgCtx->stateTimer = 0; + + if (msgCtx->textboxEndType == TEXTBOX_ENDTYPE_PERSISTENT) { + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; + play->msgCtx.ocarinaMode = OCARINA_MODE_02; + } else { + msgCtx->textboxEndType = TEXTBOX_ENDTYPE_DEFAULT; + } + if ((s32)(gSaveContext.save.info.inventory.questItems & 0xF0000000) == (4 << QUEST_HEART_PIECE_COUNT)) { + gSaveContext.save.info.inventory.questItems ^= (4 << QUEST_HEART_PIECE_COUNT); + gSaveContext.save.info.playerData.healthCapacity += 0x10; + gSaveContext.save.info.playerData.health += 0x10; + } + if (msgCtx->ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE) { + if (sLastPlayedSong == OCARINA_SONG_SARIAS) { + //! @bug The last played song is not unset often, and if something interrupts the message system + // before it reaches this point after playing Saria's song, the song will be "stored". + // Later, if the ocarina has not been played and another textbox is closed, this handling + // for Saria's song will be carried out. + player->naviTextId = -0xE0; + player->naviActor->flags |= ACTOR_FLAG_16; + } + if (msgCtx->ocarinaAction == OCARINA_ACTION_FREE_PLAY_DONE && + (play->msgCtx.ocarinaMode == OCARINA_MODE_01 || play->msgCtx.ocarinaMode == OCARINA_MODE_0B)) { + play->msgCtx.ocarinaMode = OCARINA_MODE_04; + if (msgCtx->unk_E3F2 == OCARINA_SONG_SUNS) { + play->msgCtx.ocarinaMode = OCARINA_MODE_01; + } + } + } + sLastPlayedSong = 0xFF; + PRINTF("OCARINA_MODE=%d chk_ocarina_no=%d\n", play->msgCtx.ocarinaMode, msgCtx->unk_E3F2); + break; + case MSGMODE_PAUSED: + break; + default: + msgCtx->lastOcarinaButtonIndex = OCARINA_BTN_INVALID; + break; + } } } @@ -3348,8 +3416,10 @@ void Message_SetTables(void) { sStaffMessageEntryTablePtr = sStaffMessageEntryTable; } +#if IS_DEBUG // Appears to be file padding UNK_TYPE D_80153D7C = 0x00000000; +#endif // This should be part of z_game_over.c, but cannot be moved there as the entire // late_rodata section of this file is in the way diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 41834bace..f8c569007 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -7,7 +7,123 @@ static s16 sDisableAttention = false; static s16 sUnused = -1; static s32 sPrevFrameCs1100 = -4096; -#include "z_onepointdemo_data.inc.c" +static CutsceneCameraPoint D_8012013C[14] = { + { CS_CAM_CONTINUE, 25, 40, 70.79991f, { -1814, 533, -1297 } }, + { CS_CAM_CONTINUE, 20, 40, 70.99991f, { -1805, 434, -1293 } }, + { CS_CAM_CONTINUE, 10, 30, 60.0f, { -1794, 323, -1280 } }, + { CS_CAM_CONTINUE, 5, 25, 60.0f, { -1817, 218, -1270 } }, + { CS_CAM_CONTINUE, 3, 20, 60.0f, { -1836, 168, -1243 } }, + { CS_CAM_CONTINUE, 0, 20, 60.0f, { -1905, 115, -1193 } }, + { CS_CAM_CONTINUE, 0, 30, 55.0f, { -1969, 58, -1212 } }, + { CS_CAM_CONTINUE, 0, 30, 55.0f, { -1969, 31, -1164 } }, + { CS_CAM_CONTINUE, 0, 30, 60.0f, { -1969, 54, -1209 } }, + { CS_CAM_CONTINUE, 0, 30, 60.0f, { -1973, 35, -1206 } }, + { CS_CAM_CONTINUE, 0, 50, 60.0f, { -1974, 12, -1179 } }, + { CS_CAM_CONTINUE, 0, 50, 60.0f, { -1974, 12, -1179 } }, + { CS_CAM_STOP, 0, 50, 60.0f, { -1974, 12, -1179 } }, + { CS_CAM_STOP, 0, 30, 60.0f, { -1974, 12, -1179 } }, +}; +static CutsceneCameraPoint D_8012021C[14] = { + { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1751, 604, -1233 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1752, 516, -1233 } }, + { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1751, 417, -1233 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1767, 306, -1219 } }, + { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1776, 257, -1205 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1881, 147, -1149 } }, + { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1969, 72, -1077 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1969, 7, -1048 } }, + { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1969, 1, -1030 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1987, 17, -1076 } }, + { CS_CAM_CONTINUE, 0, 0, 60.0f, { -2007, 10, -1004 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { -2007, 10, -1004 } }, + { CS_CAM_STOP, 0, 0, 60.0f, { -2007, 10, -1004 } }, { CS_CAM_STOP, 0, 0, 60.0f, { -2007, 10, -1004 } }, +}; +static s16 D_801202FC = 13; +static s16 D_80120300 = 210; +static s16 D_80120304 = 0; + +static CutsceneCameraPoint sCrawlspaceAtPoints[9] = { + { CS_CAM_CONTINUE, 0, 10, 40.0f, { 0, 4, 0 } }, { CS_CAM_CONTINUE, 0, 10, 40.000004f, { 0, 4, 0 } }, + { CS_CAM_CONTINUE, 0, 10, 50.0f, { 0, 9, 0 } }, { CS_CAM_CONTINUE, 0, 12, 55.0f, { 0, 12, 0 } }, + { CS_CAM_CONTINUE, 0, 15, 61.0f, { 0, 18, 0 } }, { CS_CAM_CONTINUE, 0, 20, 65.0f, { 0, 29, 0 } }, + { CS_CAM_CONTINUE, 0, 40, 60.0f, { 0, 34, 0 } }, { CS_CAM_STOP, 0, 40, 60.0f, { 0, 34, 0 } }, + { CS_CAM_STOP, 0, 10, 60.0f, { 0, 34, 0 } }, +}; +static CutsceneCameraPoint sCrawlspaceForwardsEyePoints[9] = { + { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 9, 45 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 8, 50 } }, + { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 17, 58 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 21, 78 } }, + { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 46, 109 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 58, 118 } }, + { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 63, 119 } }, { CS_CAM_STOP, 0, 0, 60.0f, { 0, 62, 119 } }, + { CS_CAM_STOP, 0, 0, 60.0f, { 0, 62, 119 } }, +}; +static s16 sCrawlspaceUnused = 9; +static s16 sCrawlspaceTimer = 90; +static s16 sCrawlspaceActionParam = 1; +static CutsceneCameraPoint sCrawlspaceBackwardsEyePoints[10] = { + { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 9, -45 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 9, -45 } }, + { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 8, -50 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 17, -58 } }, + { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 21, -78 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 46, -109 } }, + { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 58, -118 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 63, -119 } }, + { CS_CAM_STOP, 0, 0, 60.0f, { 0, 62, -119 } }, { CS_CAM_STOP, 0, 0, 60.0f, { 0, 62, -119 } }, +}; + +static CutsceneCameraPoint D_801204D4[14] = { + { CS_CAM_CONTINUE, -15, 40, 80.600006f, { -60, 332, 183 } }, + { CS_CAM_CONTINUE, -22, 30, 80.600006f, { -60, 332, 183 } }, + { CS_CAM_CONTINUE, -20, 38, 80.600006f, { -118, 344, 41 } }, + { CS_CAM_CONTINUE, -18, 32, 80.600006f, { -80, 251, -8 } }, + { CS_CAM_CONTINUE, -12, 28, 80.600006f, { -64, 259, -28 } }, + { CS_CAM_CONTINUE, -8, 22, 80.600006f, { -79, 200, -342 } }, + { CS_CAM_CONTINUE, -5, 10, 65.80005f, { -110, 140, -549 } }, + { CS_CAM_CONTINUE, -2, 8, 65.2f, { -74, 109, -507 } }, + { CS_CAM_CONTINUE, 0, 10, 65.80002f, { -32, 78, -680 } }, + { CS_CAM_CONTINUE, 0, 20, 85.199936f, { 25, 127, -950 } }, + { CS_CAM_CONTINUE, 0, 30, 85.199936f, { 25, 127, -950 } }, + { CS_CAM_CONTINUE, 0, 40, 85.199936f, { 25, 127, -950 } }, + { CS_CAM_STOP, 6, 30, 85.199936f, { 25, 127, -950 } }, + { CS_CAM_STOP, 0, 30, 85.199936f, { 25, 127, -950 } }, +}; +static CutsceneCameraPoint D_801205B4[14] = { + { CS_CAM_CONTINUE, 0, 0, 60.0f, { -225, 785, -242 } }, + { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -245, 784, -242 } }, + { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -288, 485, -379 } }, + { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -250, 244, -442 } }, + { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -163, 21, -415 } }, + { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -98, 86, -520 } }, + { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -86, 31, -816 } }, + { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -74, 18, -931 } }, + { CS_CAM_CONTINUE, 1, 0, 80.600006f, { -91, 80, -1220 } }, + { CS_CAM_CONTINUE, 0, 0, 85.199936f, { 14, 153, -1340 } }, + { CS_CAM_CONTINUE, 0, 0, 85.199936f, { 28, 125, -1340 } }, + { CS_CAM_CONTINUE, 0, 0, 85.199936f, { 48, 124, -1340 } }, + { CS_CAM_STOP, 0, 0, 85.199936f, { 48, 124, -1502 } }, + { CS_CAM_STOP, 0, 0, 85.199936f, { 48, 124, -1262 } }, +}; +static s16 D_80120694 = 14; +static s16 D_80120698 = 190; +static s16 D_8012069C = 8; + +static CutsceneCameraPoint D_801206A0[12] = { + { CS_CAM_CONTINUE, 6, 20, 80.0f, { -96, 40, 170 } }, { CS_CAM_CONTINUE, 6, 20, 80.0f, { -96, 40, 170 } }, + { CS_CAM_CONTINUE, 6, 20, 70.0f, { -70, 35, 150 } }, { CS_CAM_CONTINUE, 5, 10, 60.0f, { -57, 34, 133 } }, + { CS_CAM_CONTINUE, 4, 25, 65.0f, { -22, 32, 110 } }, { CS_CAM_CONTINUE, 3, 12, 60.0f, { -9, 33, 98 } }, + { CS_CAM_CONTINUE, 3, 5, 65.0f, { -3, 29, 87 } }, { CS_CAM_CONTINUE, 2, 10, 65.0f, { -1, 15, 84 } }, + { CS_CAM_CONTINUE, 1, 200, 65.0f, { 0, 17, 82 } }, { CS_CAM_CONTINUE, 1, 500, 65.0f, { 0, 18, 82 } }, + { CS_CAM_STOP, 8, 50, 65.0f, { 0, 18, 82 } }, { CS_CAM_STOP, 11, 60, 65.0f, { 0, 18, 82 } }, +}; +static CutsceneCameraPoint D_80120760[12] = { + { CS_CAM_CONTINUE, 6, 0, 80.0f, { -50, 10, 180 } }, { CS_CAM_CONTINUE, 6, 0, 80.0f, { -50, 20, 180 } }, + { CS_CAM_CONTINUE, 6, 0, 70.0f, { -40, 30, 177 } }, { CS_CAM_CONTINUE, 5, 0, 65.0f, { 0, 35, 172 } }, + { CS_CAM_CONTINUE, 4, 0, 65.0f, { 34, 35, 162 } }, { CS_CAM_CONTINUE, 3, 0, 65.0f, { 61, 32, 147 } }, + { CS_CAM_CONTINUE, 3, 0, 65.0f, { 72, 30, 128 } }, { CS_CAM_CONTINUE, 2, 0, 65.0f, { 74, 20, 125 } }, + { CS_CAM_CONTINUE, 1, 0, 65.0f, { 75, 18, 123 } }, { CS_CAM_CONTINUE, 1, 0, 65.0f, { 75, 10, 123 } }, + { CS_CAM_STOP, 0, 0, 65.0f, { 75, 10, 122 } }, { CS_CAM_STOP, 0, 0, 65.0f, { 75, 10, 122 } }, +}; +static CutsceneCameraPoint D_80120820[12] = { + { CS_CAM_CONTINUE, 6, 0, 80.0f, { 85, 5, 170 } }, { CS_CAM_CONTINUE, 6, 0, 80.0f, { 85, 10, 170 } }, + { CS_CAM_CONTINUE, 6, 0, 70.0f, { 80, 20, 167 } }, { CS_CAM_CONTINUE, 5, 0, 65.0f, { 74, 25, 165 } }, + { CS_CAM_CONTINUE, 4, 0, 65.0f, { 63, 30, 162 } }, { CS_CAM_CONTINUE, 3, 0, 65.0f, { 66, 34, 147 } }, + { CS_CAM_CONTINUE, 3, 0, 65.0f, { 72, 34, 128 } }, { CS_CAM_CONTINUE, 2, 0, 65.0f, { 74, 20, 125 } }, + { CS_CAM_CONTINUE, 1, 0, 65.0f, { 75, 18, 123 } }, { CS_CAM_CONTINUE, 1, 0, 65.0f, { 75, 10, 123 } }, + { CS_CAM_STOP, 0, 0, 65.0f, { 75, 10, 122 } }, { CS_CAM_STOP, 0, 0, 65.0f, { 75, 10, 122 } }, +}; +static s16 D_801208E0 = 12; +static s16 D_801208E4 = 90; +static s16 D_801208E8 = 8; Vec3f OnePointCutscene_AddVecGeoToVec3f(Vec3f* a, VecGeo* geo) { Vec3f sum; @@ -73,7 +189,43 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act OnePointCsInfo* csInfo = &subCam->paramData.uniq9.csInfo; switch (csId) { - case 1020: // smoothly return to main camera from current view + case 1020: { // smoothly return to main camera from current view + static OnePointCsFull D_801208EC[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x0101, + 1, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 1, + 0, + 60.0f, + 1.0f, + { 0.0f, -10.0f, 0.0f }, + { 0.0f, 0.0f, 150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + if (timer < 20) { timer = 20; } @@ -92,8 +244,34 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 1030: { + static OnePointCsFull D_80120964[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 1, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0xA121, + 1, + 0, + 75.0f, + 0.6f, + { 0.0f, -10.0f, 0.0f }, + { 0.0f, 0.0f, 150.0f }, + }, + }; - case 1030: D_80120964[0].atTargetInit = play->view.at; D_80120964[0].eyeTargetInit = play->view.eye; D_80120964[0].fovTargetInit = play->view.fovy; @@ -106,8 +284,56 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 5000: { + static OnePointCsFull D_801209B4[4] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x0101, + 1, + 0, + 60.0f, + 0.9f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0100, + 29, + 0, + 45.0f, + 0.1f, + { 0.0f, -10.0f, 0.0f }, + { 0.0f, 0.0f, 150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 10, + 0, + 60.0f, + 0.2f, + { 0.0f, -10.0f, 0.0f }, + { 0.0f, 0.0f, 150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 5000: D_801209B4[0].atTargetInit = D_801209B4[1].atTargetInit = play->view.at; D_801209B4[0].eyeTargetInit = play->view.eye; D_801209B4[0].fovTargetInit = D_801209B4[2].fovTargetInit = play->view.fovy; @@ -121,6 +347,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } case 5010: // attention cutscene // Setup keyFrames in `Camera_Demo5` @@ -129,13 +356,108 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act subCam->roll = 0; break; - case 9500: + case 9500: { + static OnePointCsFull D_80120A54[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2525, + 1, + 0, + 75.0f, + 0.1f, + { 0.0f, 20.0f, -10.0f }, + { 0.0f, 10.0f, -40.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 9, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0022, + 5000, + 0, + 75.0f, + 0.005f, + { 0.0f, 0.0f, -10.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + csInfo->keyFrames = D_80120A54; csInfo->keyFrameCount = ARRAY_COUNT(D_80120A54); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 2260: { + static OnePointCsFull D_80120ACC[5] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0442, + 10, + 0, + 40.0f, + 1.0f, + { -10.0f, 45.0f, 20.0f }, + { 20.0f, 30.0f, 160.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 40.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0442, + 10, + 0, + 40.0f, + 1.0f, + { -10.0f, 45.0f, 20.0f }, + { 20.0f, 30.0f, 160.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 40.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 2260: D_80120ACC[0].atTargetInit.x = D_80120ACC[2].atTargetInit.x = ((mainCam->play->state.frames & 1) ? -10.0f : 10.0f) + (Rand_ZeroOne() * 8.0f); @@ -147,8 +469,133 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 2270: { + static OnePointCsFull D_80120B94[11] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x2142, + 1, + 0, + 40.0f, + 1.0f, + { 20.0f, 40.0f, 20.0f }, + { -20.0f, 0.0f, -30.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0404, + 19, + 5, + 70.0f, + 0.01f, + { 0.0f, 30.0f, 20.0f }, + { 120.0f, 60.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0404, + 20, + 0, + 60.0f, + 0.01f, + { 0.0f, 20.0f, 20.0f }, + { 120.0f, 60.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0404, + 40, + -10, + 50.0f, + 0.02f, + { 0.0f, 30.0f, 20.0f }, + { 120.0f, 60.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4141, + 1, + 0, + 40.0f, + 1.0f, + { 0.0f, -10.0f, 20.0f }, + { 0.0f, 20.0f, 50.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0404, + 19, + 0, + 70.0f, + 0.01f, + { 0.0f, 30.0f, 20.0f }, + { 120.0f, 60.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0404, + 40, + 10, + 50.0f, + 0.01f, + { 0.0f, 20.0f, 20.0f }, + { 120.0f, 60.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0404, + 70, + 0, + 60.0f, + 0.01f, + { 0.0f, 30.0f, 20.0f }, + { 120.0f, 60.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4141, + 1, + 0, + 50.0f, + 1.0f, + { 0.0f, -10.0f, 0.0f }, + { 80.0f, 20.0f, 60.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_13, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4141, + 150, + 0, + 50.0f, + 1.0f, + { 0.0f, 5.0f, 0.0f }, + { 0.0f, 4.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_24, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 50.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 2270: csInfo->keyFrames = D_80120B94; csInfo->keyFrameCount = ARRAY_COUNT(D_80120B94); @@ -170,8 +617,89 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 4, 5, 40, 0x3C); Quake_SetDuration(i, 1600); break; + } + + case 2280: { + static OnePointCsFull D_80120D4C[7] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x2142, + 1, + 0, + 40.0f, + 1.0f, + { 20.0f, 40.0f, 20.0f }, + { -20.0f, 0.0f, -30.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0404, + 19, + 5, + 70.0f, + 0.01f, + { 0.0f, 30.0f, 20.0f }, + { 120.0f, 60.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0404, + 20, + 0, + 60.0f, + 0.01f, + { 0.0f, 20.0f, 20.0f }, + { 120.0f, 60.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0404, + 40, + -10, + 50.0f, + 0.02f, + { 0.0f, 30.0f, 20.0f }, + { 120.0f, 60.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4141, + 1, + 0, + 50.0f, + 1.0f, + { 0.0f, -10.0f, 0.0f }, + { 80.0f, 20.0f, 60.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_13, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4141, + 150, + 0, + 50.0f, + 1.0f, + { 0.0f, 5.0f, 0.0f }, + { 0.0f, 4.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_24, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 50.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 2280: csInfo->keyFrames = D_80120D4C; csInfo->keyFrameCount = ARRAY_COUNT(D_80120D4C); @@ -192,8 +720,100 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 2, 3, 200, 0x32); Quake_SetDuration(i, 9999); break; + } + + case 2220: { + static OnePointCsFull D_80120E64[8] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x2142, + 20, + 0, + 50.0f, + 1.0f, + { -25.0f, 20.0f, 0.0f }, + { 0.0f, 0.0f, 5.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 80, + 0, + 50.0f, + 1.0f, + { -25.0f, 20.0f, 0.0f }, + { 0.0f, 0.0f, 5.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, true, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 8, + 0, + 60.0f, + 0.1f, + { -25.0f, 20.0f, 0.0f }, + { 0.0f, 0.0f, 5.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, true, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 15, + 4, + 55.0f, + 0.05f, + { -50.0f, 20.0f, 20.0f }, + { 0.0f, 0.0f, 5.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, true, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 15, + -4, + 50.0f, + 0.05f, + { 0.0f, 20.0f, 0.0f }, + { 0.0f, 0.0f, 5.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, true, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 15, + 0, + 50.0f, + 0.1f, + { -25.0f, 20.0f, 0.0f }, + { 0.0f, 0.0f, 5.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 40, + 0, + 50.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 2220: csInfo->keyFrames = D_80120E64; csInfo->keyFrameCount = ARRAY_COUNT(D_80120E64); @@ -204,8 +824,78 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 2, 2, 50, 0); Quake_SetDuration(i, 280); break; + } + + case 2230: { + static OnePointCsFull D_80120FA4[6] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x2143, + 30, + 0, + 70.0f, + 0.4f, + { 0.0f, 40.0f, 50.0f }, + { 30.0f, 10.0f, -50.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 50.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2222, + 10, + 0, + 42.0f, + 1.0f, + { 0.0f, 40.0f, 0.0f }, + { 0.0f, 85.0f, 45.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 50.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 10, + 0, + 60.0f, + 1.0f, + { 0.0f, 10.0f, 0.0f }, + { 30.0f, 10.0f, -80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 2230: if (player->actor.world.pos.z < 1000.0f) { D_80120FA4[0].eyeTargetInit.x = -D_80120FA4[0].eyeTargetInit.x; D_80120FA4[2].eyeTargetInit.x = -D_80120FA4[2].eyeTargetInit.x; @@ -216,8 +906,45 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 2340: { + static OnePointCsFull D_80121094[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x2101, + 20, + 0, + 50.0f, + 1.0f, + { 3840.0f, 10.0f, 950.0f }, + { 0.0f, 0.0f, 5.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x2101, + 50, + 0, + 55.0f, + 1.0f, + { 4000.0f, 50.0f, 1000.0f }, + { 0.0f, 0.0f, 5.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 2340: csInfo->keyFrames = D_80121094; csInfo->keyFrameCount = ARRAY_COUNT(D_80121094); @@ -228,15 +955,101 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 2, 2, 50, 0); Quake_SetDuration(i, 60); break; + } + + case 2350: { + static OnePointCsFull D_8012110C[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), + 0x2142, + 1, + 0, + 50.0f, + 1.0f, + { -25.0f, 20.0f, 0.0f }, + { 0.0f, 0.0f, 5.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 10, + 0, + 60.0f, + 1.0f, + { 0.0f, 10.0f, 0.0f }, + { 0.0f, 10.0f, -80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 2350: csInfo->keyFrames = D_8012110C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012110C); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } case 2200: { + static OnePointCsFull D_80121184[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0101, + 40, + 0, + -1.0f, + 0.1f, + { 0.0f, 10.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + static OnePointCsFull D_801211D4[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x0101, + 50, + 0, + 60.0f, + 1.0f, + { 0.0f, 10.0f, 0.0f }, + { -10.0f, 85.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; s16 sp82; s16 sp80; s16 sp7E; @@ -271,9 +1084,78 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act } Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_UNK3); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); - } break; + break; + } case 2290: { + static OnePointCsFull D_80121224[6] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x4141, + 2, + 0, + 60.0f, + 1.0f, + { 0.0f, 5.0f, 10.0f }, + { 0.0f, 0.0f, 45.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4141, + 18, + 0, + 45.0f, + 1.0f, + { 0.0f, 5.0f, 10.0f }, + { 0.0f, -10.0f, 50.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_52), + 0x4104, + 80, + 0, + 70.0f, + 0.05f, + { 0.0f, 0.0f, 60.0f }, + { 0.0f, 250.0f, -50.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0000, + 20, + 0, + 70.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0421, + 60, + 0, + 50.0f, + 1.0f, + { 0.0f, -30.0f, 20.0f }, + { 10.0f, 5.0f, -50.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; Actor* rideActor = player->rideActor; Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); @@ -285,9 +1167,24 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrameCount = ARRAY_COUNT(D_80121224); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); - } break; + break; + } + + case 5120: { + static OnePointCsFull D_80121314[1] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x4141, + 1000, + 0, + 75.0f, + 0.6f, + { 0.0f, 0.0f, 10.0f }, + { 0.0f, 0.0f, 100.0f }, + }, + }; - case 5120: Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); csInfo->keyFrames = D_80121314; @@ -295,8 +1192,45 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4510: { + static OnePointCsFull D_8012133C[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0141, + 40, + 0, + 75.0f, + 1.0f, + { 0.0f, 60.0f, 0.0f }, + { 0.0f, 0.0f, 100.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 20, + 0, + 60.0f, + 0.2f, + { 0.0f, -10.0f, -10.0f }, + { 0.0f, 10.0f, -100.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4510: D_8012133C[0].eyeTargetInit = actor->world.pos; D_8012133C[0].eyeTargetInit.y = player->actor.world.pos.y + 40.0f; Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); @@ -306,6 +1240,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } case 4500: spA0 = Actor_GetFocus(actor); @@ -326,7 +1261,65 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act } break; - case 2210: + case 2210: { + static OnePointCsFull D_801213B4[5] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0xC2C2, + 40, + 0, + 70.0f, + 1.0f, + { 80.0f, 0.0f, 20.0f }, + { 20.0f, 0.0f, 80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0xC2C2, + 120, + 0, + 70.0f, + 0.1f, + { 80.0f, 0.0f, 20.0f }, + { 20.0f, 0.0f, 80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_83), + 0xC2C2, + 30, + 0, + 50.0f, + 1.0f, + { 60.0f, 0.0f, 20.0f }, + { 60.0f, 0.0f, 60.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_69), + 0x4222, + 30, + 0, + 60.0f, + 0.1f, + { 0.0f, 50.0f, 0.0f }, + { 5.0f, 30.0f, 220.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 75.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + spD0 = OLib_Vec3fDiffToVecGeo(&player->actor.world.pos, &actor->world.pos); D_801213B4[0].eyeTargetInit.y = D_801213B4[1].eyeTargetInit.y = D_801213B4[2].eyeTargetInit.y = D_801213B4[2].atTargetInit.y = CAM_BINANG_TO_DEG(spD0.yaw); @@ -340,6 +1333,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } case 1010: Play_RequestCameraSetting(play, subCamId, CAM_SET_FREE2); @@ -362,12 +1356,60 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act sCrawlspaceAtPoints, sCrawlspaceBackwardsEyePoints); break; - case 4175: + case 4175: { + static OnePointCsFull D_8012147C[4] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0101, + 40, + 0, + 45.0f, + 1.0f, + { 820.0f, 1600.0f, -400.0f }, + { 777.0f, 1577.0f, -577.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0142, + 1, + 0, + 50.0f, + 1.0f, + { -50.0f, 80.0f, 0.0f }, + { 900.0f, 1575.0f, 850.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x0142, + 89, + -4, + 80.0f, + 0.07f, + { -50.0f, 70.0f, 0.0f }, + { 975.0f, 1575.0f, 770.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + csInfo->keyFrames = D_8012147C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012147C); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } case 4180: spC0.x = -1881.0f; @@ -383,7 +1425,32 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); break; - case 3040: + case 3040: { + static OnePointCsFull D_8012151C[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0101, + 29, + 0, + 60.0f, + 1.0f, + { -700.0f, 875.0f, -100.0f }, + { -550.0f, 920.0f, -150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); D_8012151C[0].timerInit = timer - 1; @@ -392,8 +1459,34 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 3020: { + static OnePointCsFull D_8012156C[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_77), + 0x4242, + 1, + 0, + 65.0f, + 1.0f, + { 60.0f, 30.0f, 0.0f }, + { 50.0f, 20.0f, 150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + -1, + 0, + 65.0f, + 1.0f, + { -50.0f, 60.0f, 0.0f }, + { -60.0f, 40.0f, 150.0f }, + }, + }; - case 3020: D_8012156C[1].timerInit = timer - 1; if (mainCam->play->state.frames & 1) { D_8012156C[0].atTargetInit.x = -D_8012156C[0].atTargetInit.x; @@ -411,8 +1504,23 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); break; + } + + case 3010: { + static OnePointCsFull D_801215BC[1] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 5, + 0, + 65.0f, + 1.0f, + { -1185.0f, 655.0f, 1185.0f }, + { -1255.0f, 735.0f, 1255.0f }, + }, + }; - case 3010: D_801215BC[0].timerInit = timer; csInfo->keyFrames = D_801215BC; @@ -420,8 +1528,122 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 3070: { + static OnePointCsFull D_801215E4[10] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x4141, + 20, + 0, + 30.0f, + 1.0f, + { 0.0f, 120.0f, 0.0f }, + { -10.0f, 140.0f, -90.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0101, + 1, + 4, + 75.0f, + 1.0f, + { -1360.0f, -940.0f, -3343.0f }, + { -1060.0f, -980.0f, -3325.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4141, + 129, + 0, + 75.0f, + 0.5f, + { 0.0f, 50.0f, 0.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0303, + 30, + 0, + 70.0f, + 0.05f, + { 0.0f, 80.0f, 0.0f }, + { -10.0f, 120.0f, 10.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_9), + 0x0101, + 40, + -5, + 70.0f, + 1.0f, + { -973.0f, -924.0f, -3263.0f }, + { -1190.0f, -1010.0f, -3365.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0101, + 1, + 0, + 75.0f, + 1.0f, + { -1355.0f, -700.0f, -3340.0f }, + { -1040.0f, -940.0f, -3345.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 60, + 0, + 45.0f, + 0.8f, + { -1370.0f, -875.0f, -3345.0f }, + { -1230.0f, -885.0f, -3345.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 10, + 0, + 70.0f, + 1.0f, + { -1370.0f, -875.0f, -3345.0f }, + { -1210.0f, -900.0f, -3420.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 20, + 0, + 70.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3070: csInfo->keyFrames = D_801215E4; csInfo->keyFrameCount = ARRAY_COUNT(D_801215E4); @@ -432,15 +1654,111 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 2, 0, 200, 0); Quake_SetDuration(i, 10); break; + } + + case 3080: { + static OnePointCsFull D_80121774[4] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x0101, + 1, + -2, + 75.0f, + 1.0f, + { -1340.0f, -860.0f, -3345.0f }, + { -1415.0f, -940.0f, -3520.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0142, + 39, + 2, + 70.0f, + 1.0f, + { 0.0f, -20.0f, 10.0f }, + { -1140.0f, -1010.0f, -3560.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), + 0x0121, + 20, + 0, + 60.0f, + 1.0f, + { 0.0f, -20.0f, 20.0f }, + { -1220.0f, -1005.0f, -3660.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3080: csInfo->keyFrames = D_80121774; csInfo->keyFrameCount = ARRAY_COUNT(D_80121774); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 3090: { + static OnePointCsFull D_80121814[4] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_76), + 0x0101, + 5, + 0, + 40.0f, + 1.0f, + { -1400.0f, -540.0f, -3327.0f }, + { -1254.0f, -20.0f, -3357.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 70, + 0, + 75.0f, + 0.75f, + { -1327.0f, 100.0f, -3342.0f }, + { -1320.0f, 350.0f, -3540.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 10, + 0, + 60.0f, + 0.75f, + { 0.0f, 10.0f, 0.0f }, + { 0.0f, 20.0f, -150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3090: Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); csInfo->keyFrames = D_80121814; @@ -448,6 +1766,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } case 3100: VEC_SET(spB4, 0.0f, -280.0f, -1400.0f); @@ -462,7 +1781,32 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act break; case 3380: - case 3065: + case 3065: { + static OnePointCsFull D_801218B4[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 60, + 0, + 65.0f, + 1.0f, + { 0.0f, 350.0f, -1520.0f }, + { 0.0f, 715.0f, -885.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 100, + 0, + 70.0f, + 0.02f, + { 0.0f, 75.0f, -1335.0f }, + { 0.0f, 20.0f, -1190.0f }, + }, + }; + csInfo->keyFrames = D_801218B4; csInfo->keyFrameCount = ARRAY_COUNT(D_801218B4); @@ -474,16 +1818,43 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 2, 0, 0, 0); Quake_SetDuration(i, 160); break; + } + + case 3060: { + static OnePointCsFull D_80121904[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 50, + 10, + 65.0f, + 1.0f, + { 165.0f, 85.0f, -920.0f }, + { 65.0f, -30.0f, -720.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3060: csInfo->keyFrames = D_80121904; csInfo->keyFrameCount = ARRAY_COUNT(D_80121904); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } - case 3050: + case 3050: { Play_RequestCameraSetting(play, subCamId, CAM_SET_CS_3); Player_SetCsActionWithHaltedActors(play, &player->actor, PLAYER_CSACTION_5); OnePointCutscene_SetCsCamPoints(subCam, D_80120304 | 0x2000, D_80120300, D_8012013C, D_8012021C); @@ -508,8 +1879,84 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 2, 1, 1, 0); Quake_SetDuration(i, 200); break; + } + + case 3120: { + static OnePointCsFull D_80121954[3][2] = { + { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 20, + 5, + 60.0f, + 1.0f, + { -700.0f, 940.0f, 300.0f }, + { -765.0f, 1000.0f, 335.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 80, + -10, + 70.0f, + 0.1f, + { -540.0f, 875.0f, 245.0f }, + { -585.0f, 900.0f, 335.0f }, + }, + }, + { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 40, + -30, + 70.0f, + 1.0f, + { -80.0f, 115.0f, -180.0f }, + { -5.0f, 240.0f, -190.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 60, + 20, + 70.0f, + 0.1f, + { -100.0f, 350.0f, -175.0f }, + { -5.0f, 240.0f, -190.0f }, + }, + }, + { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 80, + 5, + 70.0f, + 0.2f, + { 960.0f, 900.0f, 260.0f }, + { 970.0f, 950.0f, 250.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 20, + 5, + 70.0f, + 1.0f, + { 960.0f, 900.0f, 260.0f }, + { 970.0f, 950.0f, 250.0f }, + }, + }, + }; - case 3120: csInfo->keyFrames = D_80121954[-(timer + 101)]; subCam->timer = 100; subCam->stateFlags |= CAM_STATE_CHECK_WATER; @@ -518,8 +1965,144 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 3130: { + static OnePointCsFull D_80121A44[12] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), + 0x2121, + 10, + 0, + 60.0f, + 1.0f, + { 0.0f, -5.0f, 0.0f }, + { 0.0f, 0.0f, -80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, true, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x4242, + 30, + 0, + 50.0f, + 1.0f, + { 0.0f, 45.0f, 0.0f }, + { 0.0f, 45.0f, 50.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, true, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), + 0x2222, + 40, + 5, + 50.0f, + 1.0f, + { 0.0f, 50.0f, 0.0f }, + { 0.0f, 50.0f, 50.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x4242, + 40, + 5, + 60.0f, + 1.0f, + { 30.0f, 30.0f, 15.0f }, + { 70.0f, 30.0f, -40.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, true, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 30, + -5, + 50.0f, + 1.0f, + { 20.0f, 30.0f, -5.0f }, + { 0.0f, 70.0f, 70.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, true, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x2242, + 40, + 0, + 45.0f, + 1.0f, + { 0.0f, 30.0f, 30.0f }, + { 25.0f, 60.0f, -60.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, true, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x22C2, + 140, + 0, + 60.0f, + 0.04f, + { 0.0f, 0.0f, 30.0f }, + { 25.0f, 60.0f, -60.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_9, true, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2222, + 20, + 0, + 60.0f, + 0.8f, + { 0.0f, 50.0f, 0.0f }, + { 0.0f, 60.0f, -60.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3130: csInfo->keyFrames = D_80121A44; csInfo->keyFrameCount = ARRAY_COUNT(D_80121A44); @@ -527,8 +2110,89 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); subCam->stateFlags |= CAM_STATE_CHECK_WATER; break; + } + + case 3140: { + static OnePointCsFull D_80121C24[7] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), + 0x0101, + 1, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 89, + 0, + 50.0f, + 0.4f, + { 125.0f, 320.0f, -1500.0f }, + { 125.0f, 500.0f, -1150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x0101, + 40, + 4, + 55.0f, + 1.0f, + { 0.0f, 375.0f, -1440.0f }, + { 5.0f, 365.0f, -1315.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 40, + -4, + 55.0f, + 1.0f, + { 250.0f, 375.0f, -1440.0f }, + { 235.0f, 365.0f, -1315.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 100, + 0, + 95.0f, + 1.0f, + { 125.0f, 345.0f, -1500.0f }, + { 125.0f, 255.0f, -1350.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 100, + 0, + 60.0f, + 1.0f, + { 125.0f, 325.0f, -1500.0f }, + { 125.0f, 480.0f, -1000.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3140: D_80121C24[0].atTargetInit = play->view.at; D_80121C24[0].eyeTargetInit = play->view.eye; D_80121C24[0].fovTargetInit = play->view.fovy; @@ -538,6 +2202,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } case 3150: spC0.x = 1890.0f; @@ -666,7 +2331,43 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); break; - case 3240: + case 3240: { + static OnePointCsFull D_80121D3C[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 1, + 0, + 60.0f, + 1.0f, + { 1023.0f, 738.0f, -2628.0f }, + { 993.0f, 770.0f, -2740.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 4, + 0, + 50.0f, + 1.0f, + { 1255.0f, 350.0f, -1870.0f }, + { 1240.0f, 575.0f, -2100.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + -1, + 0, + 75.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + D_80121D3C[2].timerInit = timer - 5; csInfo->keyFrames = D_80121D3C; @@ -675,6 +2376,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } case 6001: Play_RequestCameraSetting(play, subCamId, CAM_SET_CS_3); @@ -705,7 +2407,109 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetDuration(i, D_80120698 - 20); break; - case 3390: + case 3390: { + static OnePointCsFull D_80121DB4[9] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 40, + 0, + 70.0f, + 1.0f, + { 4290.0f, -1332.0f, -1900.0f }, + { 4155.0f, -1360.0f, -1840.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 60, + 0, + 70.0f, + 1.0f, + { 4215.0f, -975.0f, -2095.0f }, + { 4070.0f, -1000.0f, -2025.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 5, + 0, + 70.0f, + 1.0f, + { 4215.0f, -975.0f, -2095.0f }, + { 4070.0f, -1000.0f, -2025.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 80, + 8, + 75.0f, + 1.0f, + { 4010.0f, -1152.0f, -1728.0f }, + { 3997.0f, -1194.0f, -1629.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_57), + 0x2121, + 1, + 8, + 75.0f, + 1.0f, + { 20.0f, 20.0f, 0.0f }, + { 50.0f, 30.0f, 200.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 99, + 2, + 70.0f, + 0.02f, + { -20.0f, 0.0f, 20.0f }, + { 300.0f, 50.0f, -500.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_9, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_56), + 0x2121, + 149, + -20, + 70.0f, + 0.1f, + { 100.0f, 50.0f, -100.0f }, + { 5000.0f, 1055.0f, -2250.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 1, + 0, + 60.0f, + 1.0f, + { 0.0f, -20.0f, 0.0f }, + { 0.0f, 20.0f, -150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + player->actor.shape.rot.y = player->actor.world.rot.y = player->yaw = -0x3FD9; csInfo->keyFrames = D_80121DB4; @@ -714,6 +2518,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } case 3310: Play_RequestCameraSetting(play, subCamId, CAM_SET_FIRE_STAIRCASE); @@ -726,7 +2531,54 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetDuration(i, timer); break; - case 3290: + case 3290: { + static OnePointCsFull D_80121F1C[4] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x0101, + 10, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 10, + 0, + 50.0f, + 0.5f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_2), + 0x2121, + 23, + 0, + 50.0f, + 0.5f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + D_80121F1C[0].atTargetInit = play->view.at; D_80121F1C[0].eyeTargetInit = play->view.eye; D_80121F1C[0].fovTargetInit = play->view.fovy; @@ -743,8 +2595,56 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 0, 0, 1000, 0); Quake_SetDuration(i, 5); break; + } + + case 3340: { + static OnePointCsFull D_80121FBC[4] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 5, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 10, + 0, + 30.0f, + 1.0f, + { -2130.0f, 2885.0f, -1055.0f }, + { -2085.0f, 2875.0f, -1145.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 30, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3340: D_80121FBC[0].atTargetInit = play->view.at; D_80121FBC[0].eyeTargetInit = play->view.eye; D_80121FBC[0].fovTargetInit = play->view.fovy; @@ -760,16 +2660,112 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 0, 0, 1000, 0); Quake_SetDuration(i, 5); break; + } + + case 3360: { + static OnePointCsFull D_8012205C[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x42C2, + 1, + 0, + 50.0f, + 1.0f, + { 0.0f, 220.0f, 0.0f }, + { 0.0f, 220.0f, 240.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0080, + 29, + 0, + 50.0f, + 1.0f, + { 0.0f, 220.0f, 0.0f }, + { 0.0f, 220.0f, 240.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x21A1, + 10, + 0, + 60.0f, + 1.0f, + { 0.0f, -10.0f, 0.0f }, + { 0.0f, 10.0f, -200.0f }, + }, + }; - case 3360: csInfo->keyFrames = D_8012205C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012205C); Player_SetCsAction(play, &player->actor, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 3350: { + static OnePointCsFull D_801220D4[5] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0101, + 5, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4141, + 10, + 5, + 55.0f, + 0.75f, + { 400.0f, -50.0f, 800.0f }, + { 600.0f, -60.0f, 800.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4141, + 15, + 10, + 40.0f, + 0.75f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 10.0f, 200.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 25, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3350: D_801220D4[0].atTargetInit = play->view.at; D_801220D4[0].eyeTargetInit = play->view.eye; D_801220D4[0].fovTargetInit = play->view.fovy; @@ -788,16 +2784,156 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 3330: { + static OnePointCsFull D_8012219C[7] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 5, + 0, + 60.0f, + 1.0f, + { 0.0f, -5.0f, 0.0f }, + { 0.0f, 0.0f, -80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 15, + 0, + 40.0f, + 0.4f, + { 0.0f, 60.0f, -20.0f }, + { 0.0f, 60.0f, 100.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 20, + 0, + 40.0f, + 1.0f, + { 0.0f, 60.0f, -20.0f }, + { 0.0f, 60.0f, 100.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 20, + 0, + 60.0f, + 1.0f, + { 20.0f, 60.0f, 20.0f }, + { 40.0f, 60.0f, -80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 90, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3330: csInfo->keyFrames = D_8012219C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012219C); Player_SetCsAction(play, &player->actor, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 3410: { + static OnePointCsFull D_801222B4[5] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 20, + 10, + 45.0f, + 1.0f, + { -1200.0f, 730.0f, -860.0f }, + { -1100.0f, 500.0f, -1025.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 20, + 10, + 45.0f, + 0.1f, + { -880.0f, 480.0f, -860.0f }, + { -1100.0f, 500.0f, -1025.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), + ONEPOINT_CS_INIT_FIELD_ACTORCAT(ACTORCAT_BG), + 0x0101, + 20, + 10, + 45.0f, + 0.1f, + { -880.0f, 500.0f, -860.0f }, + { -1100.0f, 500.0f, -1025.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), + ONEPOINT_CS_INIT_FIELD_ACTORCAT(ACTORCAT_DOOR), + 0x0101, + 5, + 10, + 45.0f, + 0.1f, + { -880.0f, 500.0f, -860.0f }, + { -1100.0f, 500.0f, -1025.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3410: csInfo->keyFrames = D_801222B4; csInfo->keyFrameCount = ARRAY_COUNT(D_801222B4); @@ -809,8 +2945,34 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 4, 0, 0, 0); Quake_SetDuration(i, 20); break; + } + + case 3450: { + static OnePointCsFull D_8012237C[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 20, + -2, + 65.0f, + 1.0f, + { -625.0f, 185.0f, -685.0f }, + { -692.0f, 226.0f, -515.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3450: csInfo->keyFrames = D_8012237C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012237C); @@ -822,8 +2984,78 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 2, 0, 0, 0); Quake_SetDuration(i, 10); break; + } + + case 3440: { + static OnePointCsFull D_801223CC[6] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 20, + 0, + 55.0f, + 1.0f, + { 60.0f, 1130.0f, -1430.0f }, + { 60.0f, 1130.0f, -1190.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 18, + -13, + 68.0f, + 1.0f, + { 60.0f, 1130.0f, -1445.0f }, + { 180.0f, 1170.0f, -1240.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 16, + 18, + 75.0f, + 1.0f, + { 42.0f, 1040.0f, -1400.0f }, + { -20.0f, 940.0f, -1280.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 4, + 0, + 60.0f, + 1.0f, + { 60.0f, 1100.0f, -1465.0f }, + { 60.0f, 1100.0f, -1180.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 32, + 0, + 70.0f, + 1.0f, + { 60.0f, 1100.0f, -1030.0f }, + { 60.0f, 1150.0f, -740.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3440: csInfo->keyFrames = D_801223CC; csInfo->keyFrameCount = ARRAY_COUNT(D_801223CC); @@ -837,8 +3069,89 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 2, 0, 0, 0); Quake_SetDuration(i, 10); break; + } + + case 3430: { + static OnePointCsFull D_801224BC[7] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 5, + 0, + 70.0f, + 1.0f, + { 60.0f, 1800.0f, -920.0f }, + { 60.0f, 1860.0f, -800.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 20, + 0, + 70.0f, + 0.1f, + { 60.0f, 1720.0f, -920.0f }, + { 60.0f, 1780.0f, -800.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0142, + 1, + 0, + 75.0f, + 1.0f, + { 0.0f, 70.0f, 0.0f }, + { 60.0f, 990.0f, -690.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0142, + 119, + 0, + 75.0f, + 0.05f, + { 0.0f, 70.0f, 0.0f }, + { 60.0f, 990.0f, -690.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 20, + 0, + 60.0f, + 0.1f, + { 0.0f, 70.0f, 0.0f }, + { 0.0f, 100.0f, 200.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 3430: csInfo->keyFrames = D_801224BC; csInfo->keyFrameCount = ARRAY_COUNT(D_801224BC); @@ -850,8 +3163,67 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 1, 0, 10, 0); Quake_SetDuration(i, 20); break; + } + + case 4100: { + static OnePointCsFull D_801225D4[5] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x0101, + 1, + 0, + 50.0f, + 1.0f, + { 4100.0f, 1200.0f, -1400.0f }, + { 3900.0f, 1100.0f, -1400.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_59), + 0x0101, + 60, + 4, + 50.0f, + 0.94f, + { 4100.0f, 965.0f, -1385.0f }, + { 3790.0f, 825.0f, -1325.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 90, + -5, + 130.0f, + 0.02f, + { 4100.0f, 975.0f, -1375.0f }, + { 3735.0f, 715.0f, -1325.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x2323, + 2, + 0, + 60.0f, + 1.0f, + { 0.0f, 60.0f, 0.0f }, + { -10.0f, 15.0f, -200.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4100: csInfo->keyFrames = D_801225D4; csInfo->keyFrameCount = ARRAY_COUNT(D_801225D4); @@ -859,16 +3231,101 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); break; + } + + case 4110: { + static OnePointCsFull D_8012269C[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 20, + 2, + 45.0f, + 1.0f, + { 975.0f, 225.0f, -1195.0f }, + { 918.0f, 228.0f, -1228.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4110: csInfo->keyFrames = D_8012269C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012269C); Player_SetCsAction(play, &player->actor, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4120: { + static OnePointCsFull D_80122714[4] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 20, + 0, + 45.0f, + 1.0f, + { -915.0f, -2185.0f, 6335.0f }, + { -915.0f, -2290.0f, 6165.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + -1, + 0, + 80.0f, + 0.8f, + { -920.0f, -2270.0f, 6140.0f }, + { -920.0f, -2280.0f, 6070.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 20, + 0, + 80.0f, + 0.9f, + { -920.0f, -2300.0f, 6140.0f }, + { -920.0f, -2300.0f, 6070.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4120: Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); D_80122714[1].timerInit = 80; csInfo->keyFrames = D_80122714; @@ -876,16 +3333,145 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4140: { + static OnePointCsFull D_801227B4[6] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 30, + 0, + 60.0f, + 1.0f, + { 1400.0f, 100.0f, -170.0f }, + { 1250.0f, 100.0f, -170.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 130, + 0, + 60.0f, + 0.2f, + { 0.0f, -5.0f, 0.0f }, + { -150.0f, -5.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0303, + 69, + 0, + 85.0f, + 1.0f, + { -40.0f, 0.0f, 0.0f }, + { -40.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0303, + 20, + 0, + 60.0f, + 1.0f, + { 10.0f, 0.0f, 0.0f }, + { 10.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4140: csInfo->keyFrames = D_801227B4; csInfo->keyFrameCount = ARRAY_COUNT(D_801227B4); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); Camera_RequestMode(mainCam, CAM_MODE_NORMAL); break; + } + + case 4150: { + static OnePointCsFull D_801228A4[5] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0101, + 20, + 5, + 30.0f, + 1.0f, + { 800.0f, -40.0f, 2170.0f }, + { 512.0f, 142.0f, 2020.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 20, + -2, + 70.0f, + 0.8f, + { 800.0f, -40.0f, 2170.0f }, + { 512.0f, 142.0f, 2020.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), + 0x0101, + 90, + 2, + 62.0f, + 1.0f, + { 1140.0f, 125.0f, 1920.0f }, + { 1255.0f, 150.0f, 1785.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 10, + 0, + 60.0f, + 1.0f, + { 0.0f, 10.0f, 0.0f }, + { 30.0f, 10.0f, -80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4150: csInfo->keyFrames = D_801228A4; csInfo->keyFrameCount = ARRAY_COUNT(D_801228A4); @@ -893,8 +3479,56 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Camera_RequestMode(mainCam, CAM_MODE_NORMAL); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4160: { + static OnePointCsFull D_8012296C[4] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 20, + -10, + 70.0f, + 1.0f, + { -930.0f, 765.0f, -3075.0f }, + { -700.0f, 700.0f, -3075.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 80, + -10, + 70.0f, + 0.05f, + { -930.0f, 205.0f, -3075.0f }, + { -700.0f, 140.0f, -3075.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 120, + 0, + 70.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4160: csInfo->keyFrames = D_8012296C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012296C); @@ -902,8 +3536,34 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Camera_RequestMode(mainCam, CAM_MODE_NORMAL); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4170: { + static OnePointCsFull D_80122A0C[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 60, + 4, + 50.0f, + 1.0f, + { 0.0f, 400.0f, -1000.0f }, + { -200.0f, 500.0f, -850.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 50.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4170: csInfo->keyFrames = D_80122A0C; csInfo->keyFrameCount = ARRAY_COUNT(D_80122A0C); @@ -911,8 +3571,100 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Camera_RequestMode(mainCam, CAM_MODE_NORMAL); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4190: { + static OnePointCsFull D_80122A5C[8] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 1, + -15, + 70.0f, + 1.0f, + { 230.0f, 3675.0f, -4230.0f }, + { -45.0f, 3650.0f, -4415.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 1, + 0, + 60.0f, + 1.0f, + { -120.0f, 2187.0f, -3286.0f }, + { -110.0f, 2162.0f, -3262.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 55, + 0, + 60.0f, + 1.0f, + { -38.0f, 1467.0f, -1102.0f }, + { 64.0f, 1423.0f, -1188.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 1, + -15, + 70.0f, + 1.0f, + { 230.0f, 3675.0f, -4230.0f }, + { -20.0f, 3650.0f, -4400.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4190: csInfo->keyFrames = D_80122A5C; csInfo->keyFrameCount = ARRAY_COUNT(D_80122A5C); @@ -920,8 +3672,45 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Camera_RequestMode(mainCam, CAM_MODE_NORMAL); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4200: { + static OnePointCsFull D_80122B9C[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 60, + 0, + 65.0f, + 1.0f, + { 1095.0f, 2890.0f, -2980.0f }, + { 1166.0f, 2695.0f, -2710.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 60, + 15, + 65.0f, + 1.0f, + { 566.0f, 4654.0f, -4550.0f }, + { 606.0f, 5160.0f, -4740.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4200: csInfo->keyFrames = D_80122B9C; csInfo->keyFrameCount = ARRAY_COUNT(D_80122B9C); @@ -929,8 +3718,23 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Camera_RequestMode(mainCam, CAM_MODE_NORMAL); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4210: { + static OnePointCsFull D_80122C14[1] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 999, + 0, + 85.0f, + 1.0f, + { -15.0f, 185.0f, 160.0f }, + { -15.0f, 210.0f, 250.0f }, + }, + }; - case 4210: player->actor.freezeTimer = timer; csInfo->keyFrames = D_80122C14; @@ -943,8 +3747,36 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 0, 1, 100, 0); Quake_SetDuration(i, timer - 80); break; + } + + case 4220: { + static OnePointCsFull D_80122C3C[1] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 999, + -2, + 70.0f, + 1.0f, + { -62.0f, 60.0f, -315.0f }, + { -115.0f, 30.0f, -445.0f }, + }, + }; + static OnePointCsFull D_80122C64[1] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 999, + 3, + 70.0f, + 1.0f, + { -40.0f, 80.0f, 375.0f }, + { -85.0f, 45.0f, 485.0f }, + }, + }; - case 4220: csInfo->keyFrames = (player->actor.world.pos.z < -15.0f) ? D_80122C3C : D_80122C64; csInfo->keyFrameCount = ARRAY_COUNT(D_80122C3C); @@ -956,16 +3788,57 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 0, 1, 10, 0); Quake_SetDuration(i, timer - 10); break; + } + + case 4221: { + static OnePointCsFull D_80122C8C[1] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 999, + 5, + 60.0f, + 1.0f, + { -70.0f, 140.0f, 25.0f }, + { 10.0f, 180.0f, 195.0f }, + }, + }; - case 4221: csInfo->keyFrames = D_80122C8C; csInfo->keyFrameCount = ARRAY_COUNT(D_80122C8C); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 3260: { + static OnePointCsFull D_80122CB4[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 5, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 1000.0f }, + { 0.0f, 0.0f, 1100.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + -1, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, -100.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + }; - case 3260: Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); D_80122CB4[1].timerInit = timer - 5; @@ -974,8 +3847,34 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 3261: { + static OnePointCsFull D_80122D04[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 10, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, -100.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + -1, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 1000.0f }, + { 0.0f, 0.0f, 1100.0f }, + }, + }; - case 3261: Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); D_80122D04[1].timerInit = timer - 10; @@ -984,22 +3883,258 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 8010: { + static OnePointCsFull D_80122D54[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 1, + -4, + 50.0f, + 1.0f, + { 230.0f, 65.0f, 300.0f }, + { 50.0f, 50.0f, 225.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 8010: csInfo->keyFrames = D_80122D54; csInfo->keyFrameCount = ARRAY_COUNT(D_80122D54); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 8002: { + static OnePointCsFull D_80122DCC[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 1, + 0, + 50.0f, + 1.0f, + { 0.0f, 5.0f, -145.0f }, + { 0.0f, 55.0f, 55.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 8002: csInfo->keyFrames = D_80122DCC; csInfo->keyFrameCount = ARRAY_COUNT(D_80122DCC); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 8700: { + static OnePointCsFull D_80122E44[2][7] = { + { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2222, + 10, + 5, + 90.0f, + 0.2f, + { 50.0f, 100.0f, 140.0f }, + { -30.0f, 10.0f, -20.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 20, + 0, + 90.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4343, + 30, + -5, + 50.0f, + 0.2f, + { -10.0f, 80.0f, 10.0f }, + { 20.0f, 20.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -5, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x4343, + 160, + 10, + 80.0f, + 0.005f, + { -50.0f, 60.0f, 0.0f }, + { -100.0f, 20.0f, 50.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0501, + 50, + 0, + 60.0f, + 1.0f, + { 0.0f, -10.0f, 0.0f }, + { 0.0f, 10.0f, 80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_19, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }, + { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2222, + 10, + -5, + 90.0f, + 0.2f, + { -50.0f, 100.0f, 140.0f }, + { 30.0f, 10.0f, -20.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 20, + 0, + 90.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4343, + 30, + 5, + 50.0f, + 0.2f, + { 10.0f, 80.0f, 10.0f }, + { -20.0f, 20.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 5, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x4343, + 160, + -10, + 80.0f, + 0.005f, + { 50.0f, 60.0f, 0.0f }, + { 100.0f, 20.0f, 50.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0501, + 50, + 0, + 60.0f, + 1.0f, + { 0.0f, -10.0f, 0.0f }, + { 0.0f, 10.0f, 80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_19, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + -1, + -1.0f, + -1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }, + }; - case 8700: spA0 = Actor_GetFocus(actor); sp8C = Actor_GetFocus(&player->actor); D_80122E44[timer & 1][0].atTargetInit.y = ((spA0.pos.y - sp8C.pos.y) / 10.0f) + 90.0f; @@ -1010,14 +4145,109 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } case 1100: { s32 tempDiff = play->state.frames - sPrevFrameCs1100; if ((tempDiff > 3600) || (tempDiff < -3600)) { + static OnePointCsFull D_80123074[5] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0xA2A2, + 2, + 8, + 70.0f, + 1.0f, + { -27.0f, -96.0f, 25.0f }, + { 37.0f, -5.0f, 100.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0xA2A2, + 38, + 4, + 60.0f, + 1.0f, + { 64.0f, -109.0f, 55.0f }, + { 37.0f, 150.0f, 155.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0xA2A2, + 2, + 8, + 70.0f, + 1.0f, + { 45.0f, 123.0f, 45.0f }, + { 70.0f, 5.0f, 125.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0xA2A2, + 58, + 4, + 60.0f, + 0.9f, + { 82.0f, 95.0f, 55.0f }, + { 25.0f, -175.0f, 180.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + csInfo->keyFrames = D_80123074; csInfo->keyFrameCount = ARRAY_COUNT(D_80123074); } else { + static OnePointCsFull D_8012313C[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0xA2A2, + 20, + 8, + 70.0f, + 1.0f, + { 65.0f, -150.0f, 50.0f }, + { 30.0f, 10.0f, 90.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0xA2A2, + 100, + 0, + 60.0f, + 1.0f, + { 70.0f, -160.0f, 50.0f }, + { 25.0f, 180.0f, 180.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + if (play->state.frames & 1) { D_8012313C[0].rollTargetInit = -D_8012313C[0].rollTargetInit; D_8012313C[0].atTargetInit.y = -D_8012313C[0].atTargetInit.y; @@ -1030,7 +4260,8 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); sPrevFrameCs1100 = play->state.frames; - } break; + break; + } case 9806: subCam->timer = -99; @@ -1045,6 +4276,53 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act case 9908: if (Play_CamIsNotFixed(play)) { + static OnePointCsFull D_801231B4[4] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_HUD_VISIBILITY(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE), + 0x4343, + 1, + 0, + 50.0f, + 1.0f, + { 0.0f, 20.0f, 0.0f }, + { 0.0f, 5.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_HUD_VISIBILITY(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE), + 0x4343, + 48, + 0, + 50.0f, + 0.75f, + { 0.0f, 80.0f, 0.0f }, + { 0.0f, 15.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_HUD_VISIBILITY(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE), + 0x4343, + 1, + 5, + 45.0f, + 1.0f, + { 0.0f, 0.0f, 30.0f }, + { 30.0f, 120.0f, 60.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), + ONEPOINT_CS_INIT_FIELD_HUD_VISIBILITY(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE), + 0x4343, + -1, + 0, + -1.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; + D_801231B4[0].eyeTargetInit.z = D_801231B4[1].eyeTargetInit.z = !LINK_IS_ADULT ? 100.0f : 120.0f; if (player->stateFlags1 & PLAYER_STATE1_27) { @@ -1065,6 +4343,31 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); } else { + static OnePointCsFull D_80123254[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 1, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_HUD_VISIBILITY(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE), + 0x0101, + 49, + 0, + 50.0f, + 0.05f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + }; + D_80123254[1].timerInit = timer - 1; D_80123254[0].fovTargetInit = mainCam->fov; D_80123254[0].atTargetInit = D_80123254[1].atTargetInit = mainCam->at; @@ -1077,7 +4380,21 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act } break; - case 1000: + case 1000: { + static OnePointCsFull D_801232A4[1] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_69), + 0x0101, + 9999, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + }; + D_801232A4[0].atTargetInit = play->view.at; D_801232A4[0].eyeTargetInit = play->view.eye; D_801232A4[0].fovTargetInit = play->view.fovy; @@ -1087,57 +4404,496 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 8603: { + static OnePointCsFull D_801232CC[5] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 45, + -3, + 65.0f, + 1.0f, + { -52.0f, 84.0f, -846.0f }, + { -159.0f, 33.0f, -729.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 10, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 15, + 0, + 60.0f, + 1.0f, + { 10.0f, -5.0f, 0.0f }, + { 0.0f, 0.0f, -150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 8603: csInfo->keyFrames = D_801232CC; csInfo->keyFrameCount = ARRAY_COUNT(D_801232CC); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 8604: { + static OnePointCsFull D_80123394[5] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 45, + 3, + 65.0f, + 1.0f, + { -16.0f, 87.0f, -829.0f }, + { 98.0f, 24.0f, -714.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 10, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 15, + 0, + 60.0f, + 1.0f, + { 10.0f, -5.0f, 0.0f }, + { 0.0f, 0.0f, -150.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 8604: csInfo->keyFrames = D_80123394; csInfo->keyFrameCount = ARRAY_COUNT(D_80123394); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4000: { + static OnePointCsFull D_8012345C[4] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x4242, + 40, + 0, + 40.0f, + 1.0f, + { 0.0f, 50.0f, -40.0f }, + { 0.0f, 60.0f, -160.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_77), + 0x4242, + 40, + 0, + 60.0f, + 0.3f, + { 0.0f, 90.0f, -40.0f }, + { 0.0f, 60.0f, -160.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x2121, + 10, + 0, + 60.0f, + 0.2f, + { 0.0f, -10.0f, 10.0f }, + { 0.0f, 10.0f, -80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4000: csInfo->keyFrames = D_8012345C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012345C); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4010: { + static OnePointCsFull D_801234FC[5] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), + 0x0441, + 10, + 0, + 70.0f, + 1.0f, + { 0.0f, -10.0f, 20.0f }, + { 0.0f, 0.0f, 120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4141, + 30, + 0, + 50.0f, + 0.1f, + { 0.0f, -10.0f, 20.0f }, + { 0.0f, 10.0f, 80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 10, + 0, + 60.0f, + 0.9f, + { 0.0f, -10.0f, 0.0f }, + { 0.0f, 10.0f, -80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4010: csInfo->keyFrames = D_801234FC; csInfo->keyFrameCount = ARRAY_COUNT(D_801234FC); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4011: { + static OnePointCsFull D_801235C4[5] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), + 0x4141, + 1, + 0, + 50.0f, + 1.0f, + { 0.0f, -10.0f, 20.0f }, + { 0.0f, 10.0f, 60.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0441, + 39, + 0, + 70.0f, + 0.1f, + { 0.0f, -10.0f, 20.0f }, + { 0.0f, 0.0f, 100.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x2121, + 15, + 0, + 60.0f, + 0.9f, + { 0.0f, -10.0f, 0.0f }, + { 0.0f, 10.0f, -80.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4011: csInfo->keyFrames = D_801235C4; csInfo->keyFrameCount = ARRAY_COUNT(D_801235C4); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4020: { + static OnePointCsFull D_8012368C[4] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 10, + 0, + 60.0f, + 1.0f, + { -1110.0f, -180.0f, -840.0f }, + { -985.0f, -220.0f, -840.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 70, + -45, + 75.0f, + 1.0f, + { -1060.0f, -160.0f, -840.0f }, + { -1005.0f, -230.0f, -840.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 10, + -45, + 75.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 180, + 9, + 80.0f, + 1.0f, + { -1205.0f, -175.0f, -840.0f }, + { -1305.0f, -230.0f, -828.0f }, + }, + }; - case 4020: csInfo->keyFrames = D_8012368C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012368C); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4021: { + static OnePointCsFull D_8012372C[4] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0142, + 10, + 0, + 70.0f, + 1.0f, + { 0.0f, 80.0f, 0.0f }, + { -1650.0f, 200.0f, -2920.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0142, + 110, + -2, + 50.0f, + 0.5f, + { 0.0f, 150.0f, 0.0f }, + { -1320.0f, 170.0f, -2900.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 100, + 2, + 70.0f, + 0.1f, + { 0.0f, 150.0f, 50.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 60, + 2, + 45.0f, + 0.01f, + { 0.0f, 150.0f, 50.0f }, + { 0.0f, 200.0f, -80.0f }, + }, + }; - case 4021: csInfo->keyFrames = D_8012372C; csInfo->keyFrameCount = ARRAY_COUNT(D_8012372C); Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 4022: { + static OnePointCsFull D_801237CC[5] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 20, + 0, + 50.0f, + 1.0f, + { 0.0f, 50.0f, -10.0f }, + { 0.0f, 0.0f, 100.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_10, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 80, + 0, + 75.0f, + 1.0f, + { 2900.0f, 1300.0f, 530.0f }, + { 2800.0f, 1190.0f, 540.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 10, + 0, + 75.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 55, + 0, + 75.0f, + 1.0f, + { 2900.0f, 1300.0f, 530.0f }, + { 1500.0f, 1415.0f, 650.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 100, + -45, + 75.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 4022: subCam->timer = D_801237CC[0].timerInit + D_801237CC[3].timerInit + D_801237CC[1].timerInit + D_801237CC[2].timerInit + D_801237CC[4].timerInit; @@ -1146,8 +4902,45 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 9703: { + static OnePointCsFull D_80123894[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 60, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 30, + 0, + 50.0f, + 1.0f, + { 0.0f, 28.0f, 0.0f }, + { 0.0f, 20.0f, 40.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_13, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 120, + 0, + 180.0f, + 0.4f, + { 0.0f, -5.0f, 0.0f }, + { 0.0f, 2.0f, 40.0f }, + }, + }; - case 9703: D_80123894[0].atTargetInit = play->view.at; D_80123894[0].eyeTargetInit = play->view.eye; D_80123894[0].fovTargetInit = play->view.fovy; @@ -1161,8 +4954,34 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 9704: { + static OnePointCsFull D_8012390C[2] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 30, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 180, + 0, + 60.0f, + 1.0f, + { 0.0f, 78.0f, 0.0f }, + { 0.0f, 78.0f, 200.0f }, + }, + }; - case 9704: D_8012390C[0].atTargetInit = play->view.at; D_8012390C[0].eyeTargetInit = play->view.eye; D_8012390C[0].fovTargetInit = play->view.fovy; @@ -1172,8 +4991,45 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 9705: { + static OnePointCsFull D_8012395C[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0101, + 60, + 0, + 60.0f, + 1.0f, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 30, + 0, + 50.0f, + 1.0f, + { 0.0f, 28.0f, 0.0f }, + { 0.0f, 20.0f, -45.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_13, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 120, + 0, + 180.0f, + 0.4f, + { 0.0f, -5.0f, 0.0f }, + { 0.0f, 2.0f, 45.0f }, + }, + }; - case 9705: D_8012395C[0].atTargetInit = play->view.at; D_8012395C[0].eyeTargetInit = play->view.eye; D_8012395C[0].fovTargetInit = play->view.fovy; @@ -1183,8 +5039,45 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + } + + case 5110: { + static OnePointCsFull D_801239D4[3] = { + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 5, + 0, + 60.0f, + 1.0f, + { 0.0f, 20.0f, 0.0f }, + { 0.0f, 40.0f, -120.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_9, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x4242, + 0, + 0, + 60.0f, + 1.0f, + { 0.0f, 20.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + }, + { + ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), + ONEPOINT_CS_INIT_FIELD_NONE, + 0x0000, + 1, + 0, + 60.0f, + 1.0f, + { -1.0f, -1.0f, -1.0f }, + { -1.0f, -1.0f, -1.0f }, + }, + }; - case 5110: D_801239D4[1].timerInit = 10; csInfo->keyFrames = D_801239D4; @@ -1192,6 +5085,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_InitCameraDataUsingPlayer(play, subCamId, (Player*)actor, CAM_SET_CS_C); break; + } default: PRINTF(VT_COL(RED, WHITE) "onepointdemo camera: demo number not found !! (%d)\n" VT_RST, csId); @@ -1234,7 +5128,8 @@ s32 OnePointCutscene_RemoveCamera(PlayState* play, s16 subCamId) { #define vChildCamId temp2 #define vSubCamStatus temp1 #define vCurCamId temp2 -#define vNextCamId temp1 +#define vNextCamId temp3 +#define vParentCamId temp1 /** * Creates a cutscene subcamera with the specified ID, duration, and targeted actor. The camera is placed into the @@ -1242,10 +5137,11 @@ s32 OnePointCutscene_RemoveCamera(PlayState* play, s16 subCamId) { * queue. */ s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 parentCamId) { + Camera* subCam; + s16 subCamId; s16 temp1; s16 temp2; - s16 subCamId; - Camera* subCam; + s16 temp3; if (parentCamId == CAM_ID_NONE) { parentCamId = play->activeCamId; @@ -1292,15 +5188,12 @@ s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s1 vNextCamId = play->cameraPtrs[subCamId]->childCamId; while (vNextCamId >= CAM_ID_SUB_FIRST) { - s16 nextCsId = play->cameraPtrs[vNextCamId]->csId; - s16 thisCsId = play->cameraPtrs[subCamId]->csId; - - if ((nextCsId / 100) < (thisCsId / 100)) { + if ((play->cameraPtrs[vNextCamId]->csId / 100) < (play->cameraPtrs[subCamId]->csId / 100)) { PRINTF(VT_COL(YELLOW, BLACK) "onepointdemo camera[%d]: killed 'coz low priority (%d < %d)\n" VT_RST, - vNextCamId, nextCsId, thisCsId); + vNextCamId, play->cameraPtrs[vNextCamId]->csId, play->cameraPtrs[subCamId]->csId); if (play->cameraPtrs[vNextCamId]->csId != 5010) { - if ((vNextCamId = OnePointCutscene_RemoveCamera(play, vNextCamId)) != CAM_ID_NONE) { - Play_ChangeCameraStatus(play, vNextCamId, CAM_STAT_ACTIVE); + if ((vParentCamId = OnePointCutscene_RemoveCamera(play, vNextCamId)) != CAM_ID_NONE) { + Play_ChangeCameraStatus(play, vParentCamId, CAM_STAT_ACTIVE); } } else { vCurCamId = vNextCamId; @@ -1347,10 +5240,13 @@ s32 OnePointCutscene_Attention(PlayState* play, Actor* actor) { s32 temp2; s32 timer; +#if IS_DEBUG if (sDisableAttention) { PRINTF(VT_COL(YELLOW, BLACK) "actor attention demo camera: canceled by other camera\n" VT_RST); return CAM_ID_NONE; } +#endif + sUnused = -1; parentCam = play->cameraPtrs[CAM_ID_MAIN]; diff --git a/src/code/z_onepointdemo_data.inc.c b/src/code/z_onepointdemo_data.inc.c deleted file mode 100644 index be16be1ce..000000000 --- a/src/code/z_onepointdemo_data.inc.c +++ /dev/null @@ -1,3830 +0,0 @@ -#include "global.h" - -static CutsceneCameraPoint D_8012013C[14] = { - { CS_CAM_CONTINUE, 25, 40, 70.79991f, { -1814, 533, -1297 } }, - { CS_CAM_CONTINUE, 20, 40, 70.99991f, { -1805, 434, -1293 } }, - { CS_CAM_CONTINUE, 10, 30, 60.0f, { -1794, 323, -1280 } }, - { CS_CAM_CONTINUE, 5, 25, 60.0f, { -1817, 218, -1270 } }, - { CS_CAM_CONTINUE, 3, 20, 60.0f, { -1836, 168, -1243 } }, - { CS_CAM_CONTINUE, 0, 20, 60.0f, { -1905, 115, -1193 } }, - { CS_CAM_CONTINUE, 0, 30, 55.0f, { -1969, 58, -1212 } }, - { CS_CAM_CONTINUE, 0, 30, 55.0f, { -1969, 31, -1164 } }, - { CS_CAM_CONTINUE, 0, 30, 60.0f, { -1969, 54, -1209 } }, - { CS_CAM_CONTINUE, 0, 30, 60.0f, { -1973, 35, -1206 } }, - { CS_CAM_CONTINUE, 0, 50, 60.0f, { -1974, 12, -1179 } }, - { CS_CAM_CONTINUE, 0, 50, 60.0f, { -1974, 12, -1179 } }, - { CS_CAM_STOP, 0, 50, 60.0f, { -1974, 12, -1179 } }, - { CS_CAM_STOP, 0, 30, 60.0f, { -1974, 12, -1179 } }, -}; -static CutsceneCameraPoint D_8012021C[14] = { - { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1751, 604, -1233 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1752, 516, -1233 } }, - { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1751, 417, -1233 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1767, 306, -1219 } }, - { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1776, 257, -1205 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1881, 147, -1149 } }, - { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1969, 72, -1077 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1969, 7, -1048 } }, - { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1969, 1, -1030 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { -1987, 17, -1076 } }, - { CS_CAM_CONTINUE, 0, 0, 60.0f, { -2007, 10, -1004 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { -2007, 10, -1004 } }, - { CS_CAM_STOP, 0, 0, 60.0f, { -2007, 10, -1004 } }, { CS_CAM_STOP, 0, 0, 60.0f, { -2007, 10, -1004 } }, -}; -static s16 D_801202FC = 13; -static s16 D_80120300 = 210; -static s16 D_80120304 = 0; - -static CutsceneCameraPoint sCrawlspaceAtPoints[9] = { - { CS_CAM_CONTINUE, 0, 10, 40.0f, { 0, 4, 0 } }, { CS_CAM_CONTINUE, 0, 10, 40.000004f, { 0, 4, 0 } }, - { CS_CAM_CONTINUE, 0, 10, 50.0f, { 0, 9, 0 } }, { CS_CAM_CONTINUE, 0, 12, 55.0f, { 0, 12, 0 } }, - { CS_CAM_CONTINUE, 0, 15, 61.0f, { 0, 18, 0 } }, { CS_CAM_CONTINUE, 0, 20, 65.0f, { 0, 29, 0 } }, - { CS_CAM_CONTINUE, 0, 40, 60.0f, { 0, 34, 0 } }, { CS_CAM_STOP, 0, 40, 60.0f, { 0, 34, 0 } }, - { CS_CAM_STOP, 0, 10, 60.0f, { 0, 34, 0 } }, -}; -static CutsceneCameraPoint sCrawlspaceForwardsEyePoints[9] = { - { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 9, 45 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 8, 50 } }, - { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 17, 58 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 21, 78 } }, - { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 46, 109 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 58, 118 } }, - { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 63, 119 } }, { CS_CAM_STOP, 0, 0, 60.0f, { 0, 62, 119 } }, - { CS_CAM_STOP, 0, 0, 60.0f, { 0, 62, 119 } }, -}; -static s16 sCrawlspaceUnused = 9; -static s16 sCrawlspaceTimer = 90; -static s16 sCrawlspaceActionParam = 1; -static CutsceneCameraPoint sCrawlspaceBackwardsEyePoints[10] = { - { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 9, -45 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 9, -45 } }, - { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 8, -50 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 17, -58 } }, - { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 21, -78 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 46, -109 } }, - { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 58, -118 } }, { CS_CAM_CONTINUE, 0, 0, 60.0f, { 0, 63, -119 } }, - { CS_CAM_STOP, 0, 0, 60.0f, { 0, 62, -119 } }, { CS_CAM_STOP, 0, 0, 60.0f, { 0, 62, -119 } }, -}; - -static CutsceneCameraPoint D_801204D4[14] = { - { CS_CAM_CONTINUE, -15, 40, 80.600006f, { -60, 332, 183 } }, - { CS_CAM_CONTINUE, -22, 30, 80.600006f, { -60, 332, 183 } }, - { CS_CAM_CONTINUE, -20, 38, 80.600006f, { -118, 344, 41 } }, - { CS_CAM_CONTINUE, -18, 32, 80.600006f, { -80, 251, -8 } }, - { CS_CAM_CONTINUE, -12, 28, 80.600006f, { -64, 259, -28 } }, - { CS_CAM_CONTINUE, -8, 22, 80.600006f, { -79, 200, -342 } }, - { CS_CAM_CONTINUE, -5, 10, 65.80005f, { -110, 140, -549 } }, - { CS_CAM_CONTINUE, -2, 8, 65.2f, { -74, 109, -507 } }, - { CS_CAM_CONTINUE, 0, 10, 65.80002f, { -32, 78, -680 } }, - { CS_CAM_CONTINUE, 0, 20, 85.199936f, { 25, 127, -950 } }, - { CS_CAM_CONTINUE, 0, 30, 85.199936f, { 25, 127, -950 } }, - { CS_CAM_CONTINUE, 0, 40, 85.199936f, { 25, 127, -950 } }, - { CS_CAM_STOP, 6, 30, 85.199936f, { 25, 127, -950 } }, - { CS_CAM_STOP, 0, 30, 85.199936f, { 25, 127, -950 } }, -}; -static CutsceneCameraPoint D_801205B4[14] = { - { CS_CAM_CONTINUE, 0, 0, 60.0f, { -225, 785, -242 } }, - { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -245, 784, -242 } }, - { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -288, 485, -379 } }, - { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -250, 244, -442 } }, - { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -163, 21, -415 } }, - { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -98, 86, -520 } }, - { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -86, 31, -816 } }, - { CS_CAM_CONTINUE, -21, 0, 80.600006f, { -74, 18, -931 } }, - { CS_CAM_CONTINUE, 1, 0, 80.600006f, { -91, 80, -1220 } }, - { CS_CAM_CONTINUE, 0, 0, 85.199936f, { 14, 153, -1340 } }, - { CS_CAM_CONTINUE, 0, 0, 85.199936f, { 28, 125, -1340 } }, - { CS_CAM_CONTINUE, 0, 0, 85.199936f, { 48, 124, -1340 } }, - { CS_CAM_STOP, 0, 0, 85.199936f, { 48, 124, -1502 } }, - { CS_CAM_STOP, 0, 0, 85.199936f, { 48, 124, -1262 } }, -}; -static s16 D_80120694 = 14; -static s16 D_80120698 = 190; -static s16 D_8012069C = 8; - -static CutsceneCameraPoint D_801206A0[12] = { - { CS_CAM_CONTINUE, 6, 20, 80.0f, { -96, 40, 170 } }, { CS_CAM_CONTINUE, 6, 20, 80.0f, { -96, 40, 170 } }, - { CS_CAM_CONTINUE, 6, 20, 70.0f, { -70, 35, 150 } }, { CS_CAM_CONTINUE, 5, 10, 60.0f, { -57, 34, 133 } }, - { CS_CAM_CONTINUE, 4, 25, 65.0f, { -22, 32, 110 } }, { CS_CAM_CONTINUE, 3, 12, 60.0f, { -9, 33, 98 } }, - { CS_CAM_CONTINUE, 3, 5, 65.0f, { -3, 29, 87 } }, { CS_CAM_CONTINUE, 2, 10, 65.0f, { -1, 15, 84 } }, - { CS_CAM_CONTINUE, 1, 200, 65.0f, { 0, 17, 82 } }, { CS_CAM_CONTINUE, 1, 500, 65.0f, { 0, 18, 82 } }, - { CS_CAM_STOP, 8, 50, 65.0f, { 0, 18, 82 } }, { CS_CAM_STOP, 11, 60, 65.0f, { 0, 18, 82 } }, -}; -static CutsceneCameraPoint D_80120760[12] = { - { CS_CAM_CONTINUE, 6, 0, 80.0f, { -50, 10, 180 } }, { CS_CAM_CONTINUE, 6, 0, 80.0f, { -50, 20, 180 } }, - { CS_CAM_CONTINUE, 6, 0, 70.0f, { -40, 30, 177 } }, { CS_CAM_CONTINUE, 5, 0, 65.0f, { 0, 35, 172 } }, - { CS_CAM_CONTINUE, 4, 0, 65.0f, { 34, 35, 162 } }, { CS_CAM_CONTINUE, 3, 0, 65.0f, { 61, 32, 147 } }, - { CS_CAM_CONTINUE, 3, 0, 65.0f, { 72, 30, 128 } }, { CS_CAM_CONTINUE, 2, 0, 65.0f, { 74, 20, 125 } }, - { CS_CAM_CONTINUE, 1, 0, 65.0f, { 75, 18, 123 } }, { CS_CAM_CONTINUE, 1, 0, 65.0f, { 75, 10, 123 } }, - { CS_CAM_STOP, 0, 0, 65.0f, { 75, 10, 122 } }, { CS_CAM_STOP, 0, 0, 65.0f, { 75, 10, 122 } }, -}; -static CutsceneCameraPoint D_80120820[12] = { - { CS_CAM_CONTINUE, 6, 0, 80.0f, { 85, 5, 170 } }, { CS_CAM_CONTINUE, 6, 0, 80.0f, { 85, 10, 170 } }, - { CS_CAM_CONTINUE, 6, 0, 70.0f, { 80, 20, 167 } }, { CS_CAM_CONTINUE, 5, 0, 65.0f, { 74, 25, 165 } }, - { CS_CAM_CONTINUE, 4, 0, 65.0f, { 63, 30, 162 } }, { CS_CAM_CONTINUE, 3, 0, 65.0f, { 66, 34, 147 } }, - { CS_CAM_CONTINUE, 3, 0, 65.0f, { 72, 34, 128 } }, { CS_CAM_CONTINUE, 2, 0, 65.0f, { 74, 20, 125 } }, - { CS_CAM_CONTINUE, 1, 0, 65.0f, { 75, 18, 123 } }, { CS_CAM_CONTINUE, 1, 0, 65.0f, { 75, 10, 123 } }, - { CS_CAM_STOP, 0, 0, 65.0f, { 75, 10, 122 } }, { CS_CAM_STOP, 0, 0, 65.0f, { 75, 10, 122 } }, -}; -static s16 D_801208E0 = 12; -static s16 D_801208E4 = 90; -static s16 D_801208E8 = 8; - -static OnePointCsFull D_801208EC[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x0101, - 1, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 1, - 0, - 60.0f, - 1.0f, - { 0.0f, -10.0f, 0.0f }, - { 0.0f, 0.0f, 150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80120964[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 1, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0xA121, - 1, - 0, - 75.0f, - 0.6f, - { 0.0f, -10.0f, 0.0f }, - { 0.0f, 0.0f, 150.0f }, - }, -}; - -static OnePointCsFull D_801209B4[4] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x0101, - 1, - 0, - 60.0f, - 0.9f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0100, - 29, - 0, - 45.0f, - 0.1f, - { 0.0f, -10.0f, 0.0f }, - { 0.0f, 0.0f, 150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 10, - 0, - 60.0f, - 0.2f, - { 0.0f, -10.0f, 0.0f }, - { 0.0f, 0.0f, 150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80120A54[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2525, - 1, - 0, - 75.0f, - 0.1f, - { 0.0f, 20.0f, -10.0f }, - { 0.0f, 10.0f, -40.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 9, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0022, - 5000, - 0, - 75.0f, - 0.005f, - { 0.0f, 0.0f, -10.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80120ACC[5] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0442, - 10, - 0, - 40.0f, - 1.0f, - { -10.0f, 45.0f, 20.0f }, - { 20.0f, 30.0f, 160.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 40.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0442, - 10, - 0, - 40.0f, - 1.0f, - { -10.0f, 45.0f, 20.0f }, - { 20.0f, 30.0f, 160.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 40.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80120B94[11] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x2142, - 1, - 0, - 40.0f, - 1.0f, - { 20.0f, 40.0f, 20.0f }, - { -20.0f, 0.0f, -30.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0404, - 19, - 5, - 70.0f, - 0.01f, - { 0.0f, 30.0f, 20.0f }, - { 120.0f, 60.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0404, - 20, - 0, - 60.0f, - 0.01f, - { 0.0f, 20.0f, 20.0f }, - { 120.0f, 60.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0404, - 40, - -10, - 50.0f, - 0.02f, - { 0.0f, 30.0f, 20.0f }, - { 120.0f, 60.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4141, - 1, - 0, - 40.0f, - 1.0f, - { 0.0f, -10.0f, 20.0f }, - { 0.0f, 20.0f, 50.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0404, - 19, - 0, - 70.0f, - 0.01f, - { 0.0f, 30.0f, 20.0f }, - { 120.0f, 60.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0404, - 40, - 10, - 50.0f, - 0.01f, - { 0.0f, 20.0f, 20.0f }, - { 120.0f, 60.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0404, - 70, - 0, - 60.0f, - 0.01f, - { 0.0f, 30.0f, 20.0f }, - { 120.0f, 60.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4141, - 1, - 0, - 50.0f, - 1.0f, - { 0.0f, -10.0f, 0.0f }, - { 80.0f, 20.0f, 60.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_13, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4141, - 150, - 0, - 50.0f, - 1.0f, - { 0.0f, 5.0f, 0.0f }, - { 0.0f, 4.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_24, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 50.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80120D4C[7] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x2142, - 1, - 0, - 40.0f, - 1.0f, - { 20.0f, 40.0f, 20.0f }, - { -20.0f, 0.0f, -30.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0404, - 19, - 5, - 70.0f, - 0.01f, - { 0.0f, 30.0f, 20.0f }, - { 120.0f, 60.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0404, - 20, - 0, - 60.0f, - 0.01f, - { 0.0f, 20.0f, 20.0f }, - { 120.0f, 60.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0404, - 40, - -10, - 50.0f, - 0.02f, - { 0.0f, 30.0f, 20.0f }, - { 120.0f, 60.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4141, - 1, - 0, - 50.0f, - 1.0f, - { 0.0f, -10.0f, 0.0f }, - { 80.0f, 20.0f, 60.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_13, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4141, - 150, - 0, - 50.0f, - 1.0f, - { 0.0f, 5.0f, 0.0f }, - { 0.0f, 4.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_24, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 50.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80120E64[8] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x2142, - 20, - 0, - 50.0f, - 1.0f, - { -25.0f, 20.0f, 0.0f }, - { 0.0f, 0.0f, 5.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 80, - 0, - 50.0f, - 1.0f, - { -25.0f, 20.0f, 0.0f }, - { 0.0f, 0.0f, 5.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, true, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 8, - 0, - 60.0f, - 0.1f, - { -25.0f, 20.0f, 0.0f }, - { 0.0f, 0.0f, 5.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, true, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 15, - 4, - 55.0f, - 0.05f, - { -50.0f, 20.0f, 20.0f }, - { 0.0f, 0.0f, 5.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, true, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 15, - -4, - 50.0f, - 0.05f, - { 0.0f, 20.0f, 0.0f }, - { 0.0f, 0.0f, 5.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, true, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 15, - 0, - 50.0f, - 0.1f, - { -25.0f, 20.0f, 0.0f }, - { 0.0f, 0.0f, 5.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 40, - 0, - 50.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80120FA4[6] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x2143, - 30, - 0, - 70.0f, - 0.4f, - { 0.0f, 40.0f, 50.0f }, - { 30.0f, 10.0f, -50.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 50.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2222, - 10, - 0, - 42.0f, - 1.0f, - { 0.0f, 40.0f, 0.0f }, - { 0.0f, 85.0f, 45.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 50.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 10, - 0, - 60.0f, - 1.0f, - { 0.0f, 10.0f, 0.0f }, - { 30.0f, 10.0f, -80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80121094[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x2101, - 20, - 0, - 50.0f, - 1.0f, - { 3840.0f, 10.0f, 950.0f }, - { 0.0f, 0.0f, 5.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x2101, - 50, - 0, - 55.0f, - 1.0f, - { 4000.0f, 50.0f, 1000.0f }, - { 0.0f, 0.0f, 5.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_8012110C[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), - 0x2142, - 1, - 0, - 50.0f, - 1.0f, - { -25.0f, 20.0f, 0.0f }, - { 0.0f, 0.0f, 5.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, true, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 10, - 0, - 60.0f, - 1.0f, - { 0.0f, 10.0f, 0.0f }, - { 0.0f, 10.0f, -80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80121184[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0101, - 40, - 0, - -1.0f, - 0.1f, - { 0.0f, 10.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_801211D4[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x0101, - 50, - 0, - 60.0f, - 1.0f, - { 0.0f, 10.0f, 0.0f }, - { -10.0f, 85.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80121224[6] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x4141, - 2, - 0, - 60.0f, - 1.0f, - { 0.0f, 5.0f, 10.0f }, - { 0.0f, 0.0f, 45.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4141, - 18, - 0, - 45.0f, - 1.0f, - { 0.0f, 5.0f, 10.0f }, - { 0.0f, -10.0f, 50.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_52), - 0x4104, - 80, - 0, - 70.0f, - 0.05f, - { 0.0f, 0.0f, 60.0f }, - { 0.0f, 250.0f, -50.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0000, - 20, - 0, - 70.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0421, - 60, - 0, - 50.0f, - 1.0f, - { 0.0f, -30.0f, 20.0f }, - { 10.0f, 5.0f, -50.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80121314[1] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x4141, - 1000, - 0, - 75.0f, - 0.6f, - { 0.0f, 0.0f, 10.0f }, - { 0.0f, 0.0f, 100.0f }, - }, -}; - -static OnePointCsFull D_8012133C[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0141, - 40, - 0, - 75.0f, - 1.0f, - { 0.0f, 60.0f, 0.0f }, - { 0.0f, 0.0f, 100.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 20, - 0, - 60.0f, - 0.2f, - { 0.0f, -10.0f, -10.0f }, - { 0.0f, 10.0f, -100.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_801213B4[5] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0xC2C2, - 40, - 0, - 70.0f, - 1.0f, - { 80.0f, 0.0f, 20.0f }, - { 20.0f, 0.0f, 80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0xC2C2, - 120, - 0, - 70.0f, - 0.1f, - { 80.0f, 0.0f, 20.0f }, - { 20.0f, 0.0f, 80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_83), - 0xC2C2, - 30, - 0, - 50.0f, - 1.0f, - { 60.0f, 0.0f, 20.0f }, - { 60.0f, 0.0f, 60.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_69), - 0x4222, - 30, - 0, - 60.0f, - 0.1f, - { 0.0f, 50.0f, 0.0f }, - { 5.0f, 30.0f, 220.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 75.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_8012147C[4] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0101, - 40, - 0, - 45.0f, - 1.0f, - { 820.0f, 1600.0f, -400.0f }, - { 777.0f, 1577.0f, -577.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0142, - 1, - 0, - 50.0f, - 1.0f, - { -50.0f, 80.0f, 0.0f }, - { 900.0f, 1575.0f, 850.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x0142, - 89, - -4, - 80.0f, - 0.07f, - { -50.0f, 70.0f, 0.0f }, - { 975.0f, 1575.0f, 770.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_8012151C[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0101, - 29, - 0, - 60.0f, - 1.0f, - { -700.0f, 875.0f, -100.0f }, - { -550.0f, 920.0f, -150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_8012156C[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_77), - 0x4242, - 1, - 0, - 65.0f, - 1.0f, - { 60.0f, 30.0f, 0.0f }, - { 50.0f, 20.0f, 150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - -1, - 0, - 65.0f, - 1.0f, - { -50.0f, 60.0f, 0.0f }, - { -60.0f, 40.0f, 150.0f }, - }, -}; - -static OnePointCsFull D_801215BC[1] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 5, - 0, - 65.0f, - 1.0f, - { -1185.0f, 655.0f, 1185.0f }, - { -1255.0f, 735.0f, 1255.0f }, - }, -}; - -static OnePointCsFull D_801215E4[10] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x4141, - 20, - 0, - 30.0f, - 1.0f, - { 0.0f, 120.0f, 0.0f }, - { -10.0f, 140.0f, -90.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0101, - 1, - 4, - 75.0f, - 1.0f, - { -1360.0f, -940.0f, -3343.0f }, - { -1060.0f, -980.0f, -3325.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4141, - 129, - 0, - 75.0f, - 0.5f, - { 0.0f, 50.0f, 0.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0303, - 30, - 0, - 70.0f, - 0.05f, - { 0.0f, 80.0f, 0.0f }, - { -10.0f, 120.0f, 10.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_9), - 0x0101, - 40, - -5, - 70.0f, - 1.0f, - { -973.0f, -924.0f, -3263.0f }, - { -1190.0f, -1010.0f, -3365.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0101, - 1, - 0, - 75.0f, - 1.0f, - { -1355.0f, -700.0f, -3340.0f }, - { -1040.0f, -940.0f, -3345.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 60, - 0, - 45.0f, - 0.8f, - { -1370.0f, -875.0f, -3345.0f }, - { -1230.0f, -885.0f, -3345.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 10, - 0, - 70.0f, - 1.0f, - { -1370.0f, -875.0f, -3345.0f }, - { -1210.0f, -900.0f, -3420.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 20, - 0, - 70.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80121774[4] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x0101, - 1, - -2, - 75.0f, - 1.0f, - { -1340.0f, -860.0f, -3345.0f }, - { -1415.0f, -940.0f, -3520.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0142, - 39, - 2, - 70.0f, - 1.0f, - { 0.0f, -20.0f, 10.0f }, - { -1140.0f, -1010.0f, -3560.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), - 0x0121, - 20, - 0, - 60.0f, - 1.0f, - { 0.0f, -20.0f, 20.0f }, - { -1220.0f, -1005.0f, -3660.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80121814[4] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_76), - 0x0101, - 5, - 0, - 40.0f, - 1.0f, - { -1400.0f, -540.0f, -3327.0f }, - { -1254.0f, -20.0f, -3357.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 70, - 0, - 75.0f, - 0.75f, - { -1327.0f, 100.0f, -3342.0f }, - { -1320.0f, 350.0f, -3540.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 10, - 0, - 60.0f, - 0.75f, - { 0.0f, 10.0f, 0.0f }, - { 0.0f, 20.0f, -150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_801218B4[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 60, - 0, - 65.0f, - 1.0f, - { 0.0f, 350.0f, -1520.0f }, - { 0.0f, 715.0f, -885.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 100, - 0, - 70.0f, - 0.02f, - { 0.0f, 75.0f, -1335.0f }, - { 0.0f, 20.0f, -1190.0f }, - }, -}; - -static OnePointCsFull D_80121904[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 50, - 10, - 65.0f, - 1.0f, - { 165.0f, 85.0f, -920.0f }, - { 65.0f, -30.0f, -720.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80121954[3][2] = { - { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 20, - 5, - 60.0f, - 1.0f, - { -700.0f, 940.0f, 300.0f }, - { -765.0f, 1000.0f, 335.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 80, - -10, - 70.0f, - 0.1f, - { -540.0f, 875.0f, 245.0f }, - { -585.0f, 900.0f, 335.0f }, - }, - }, - { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 40, - -30, - 70.0f, - 1.0f, - { -80.0f, 115.0f, -180.0f }, - { -5.0f, 240.0f, -190.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 60, - 20, - 70.0f, - 0.1f, - { -100.0f, 350.0f, -175.0f }, - { -5.0f, 240.0f, -190.0f }, - }, - }, - { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 80, - 5, - 70.0f, - 0.2f, - { 960.0f, 900.0f, 260.0f }, - { 970.0f, 950.0f, 250.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 20, - 5, - 70.0f, - 1.0f, - { 960.0f, 900.0f, 260.0f }, - { 970.0f, 950.0f, 250.0f }, - }, - }, -}; - -static OnePointCsFull D_80121A44[12] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), - 0x2121, - 10, - 0, - 60.0f, - 1.0f, - { 0.0f, -5.0f, 0.0f }, - { 0.0f, 0.0f, -80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x4242, - 30, - 0, - 50.0f, - 1.0f, - { 0.0f, 45.0f, 0.0f }, - { 0.0f, 45.0f, 50.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, true, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), - 0x2222, - 40, - 5, - 50.0f, - 1.0f, - { 0.0f, 50.0f, 0.0f }, - { 0.0f, 50.0f, 50.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x4242, - 40, - 5, - 60.0f, - 1.0f, - { 30.0f, 30.0f, 15.0f }, - { 70.0f, 30.0f, -40.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, true, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 30, - -5, - 50.0f, - 1.0f, - { 20.0f, 30.0f, -5.0f }, - { 0.0f, 70.0f, 70.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, true, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x2242, - 40, - 0, - 45.0f, - 1.0f, - { 0.0f, 30.0f, 30.0f }, - { 25.0f, 60.0f, -60.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, true, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x22C2, - 140, - 0, - 60.0f, - 0.04f, - { 0.0f, 0.0f, 30.0f }, - { 25.0f, 60.0f, -60.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_9, true, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2222, - 20, - 0, - 60.0f, - 0.8f, - { 0.0f, 50.0f, 0.0f }, - { 0.0f, 60.0f, -60.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80121C24[7] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), - 0x0101, - 1, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 89, - 0, - 50.0f, - 0.4f, - { 125.0f, 320.0f, -1500.0f }, - { 125.0f, 500.0f, -1150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x0101, - 40, - 4, - 55.0f, - 1.0f, - { 0.0f, 375.0f, -1440.0f }, - { 5.0f, 365.0f, -1315.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 40, - -4, - 55.0f, - 1.0f, - { 250.0f, 375.0f, -1440.0f }, - { 235.0f, 365.0f, -1315.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 100, - 0, - 95.0f, - 1.0f, - { 125.0f, 345.0f, -1500.0f }, - { 125.0f, 255.0f, -1350.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 100, - 0, - 60.0f, - 1.0f, - { 125.0f, 325.0f, -1500.0f }, - { 125.0f, 480.0f, -1000.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80121D3C[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 1, - 0, - 60.0f, - 1.0f, - { 1023.0f, 738.0f, -2628.0f }, - { 993.0f, 770.0f, -2740.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 4, - 0, - 50.0f, - 1.0f, - { 1255.0f, 350.0f, -1870.0f }, - { 1240.0f, 575.0f, -2100.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - -1, - 0, - 75.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80121DB4[9] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 40, - 0, - 70.0f, - 1.0f, - { 4290.0f, -1332.0f, -1900.0f }, - { 4155.0f, -1360.0f, -1840.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 60, - 0, - 70.0f, - 1.0f, - { 4215.0f, -975.0f, -2095.0f }, - { 4070.0f, -1000.0f, -2025.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 5, - 0, - 70.0f, - 1.0f, - { 4215.0f, -975.0f, -2095.0f }, - { 4070.0f, -1000.0f, -2025.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 80, - 8, - 75.0f, - 1.0f, - { 4010.0f, -1152.0f, -1728.0f }, - { 3997.0f, -1194.0f, -1629.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_57), - 0x2121, - 1, - 8, - 75.0f, - 1.0f, - { 20.0f, 20.0f, 0.0f }, - { 50.0f, 30.0f, 200.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 99, - 2, - 70.0f, - 0.02f, - { -20.0f, 0.0f, 20.0f }, - { 300.0f, 50.0f, -500.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_9, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_56), - 0x2121, - 149, - -20, - 70.0f, - 0.1f, - { 100.0f, 50.0f, -100.0f }, - { 5000.0f, 1055.0f, -2250.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 1, - 0, - 60.0f, - 1.0f, - { 0.0f, -20.0f, 0.0f }, - { 0.0f, 20.0f, -150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80121F1C[4] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x0101, - 10, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 10, - 0, - 50.0f, - 0.5f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_2), - 0x2121, - 23, - 0, - 50.0f, - 0.5f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80121FBC[4] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 5, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 10, - 0, - 30.0f, - 1.0f, - { -2130.0f, 2885.0f, -1055.0f }, - { -2085.0f, 2875.0f, -1145.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 30, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_8012205C[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x42C2, - 1, - 0, - 50.0f, - 1.0f, - { 0.0f, 220.0f, 0.0f }, - { 0.0f, 220.0f, 240.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0080, - 29, - 0, - 50.0f, - 1.0f, - { 0.0f, 220.0f, 0.0f }, - { 0.0f, 220.0f, 240.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x21A1, - 10, - 0, - 60.0f, - 1.0f, - { 0.0f, -10.0f, 0.0f }, - { 0.0f, 10.0f, -200.0f }, - }, -}; - -static OnePointCsFull D_801220D4[5] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0101, - 5, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4141, - 10, - 5, - 55.0f, - 0.75f, - { 400.0f, -50.0f, 800.0f }, - { 600.0f, -60.0f, 800.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4141, - 15, - 10, - 40.0f, - 0.75f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 10.0f, 200.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 25, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_8012219C[7] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 5, - 0, - 60.0f, - 1.0f, - { 0.0f, -5.0f, 0.0f }, - { 0.0f, 0.0f, -80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 15, - 0, - 40.0f, - 0.4f, - { 0.0f, 60.0f, -20.0f }, - { 0.0f, 60.0f, 100.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 20, - 0, - 40.0f, - 1.0f, - { 0.0f, 60.0f, -20.0f }, - { 0.0f, 60.0f, 100.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 20, - 0, - 60.0f, - 1.0f, - { 20.0f, 60.0f, 20.0f }, - { 40.0f, 60.0f, -80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 90, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_801222B4[5] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 20, - 10, - 45.0f, - 1.0f, - { -1200.0f, 730.0f, -860.0f }, - { -1100.0f, 500.0f, -1025.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 20, - 10, - 45.0f, - 0.1f, - { -880.0f, 480.0f, -860.0f }, - { -1100.0f, 500.0f, -1025.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), - ONEPOINT_CS_INIT_FIELD_ACTORCAT(ACTORCAT_BG), - 0x0101, - 20, - 10, - 45.0f, - 0.1f, - { -880.0f, 500.0f, -860.0f }, - { -1100.0f, 500.0f, -1025.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), - ONEPOINT_CS_INIT_FIELD_ACTORCAT(ACTORCAT_DOOR), - 0x0101, - 5, - 10, - 45.0f, - 0.1f, - { -880.0f, 500.0f, -860.0f }, - { -1100.0f, 500.0f, -1025.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_8012237C[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 20, - -2, - 65.0f, - 1.0f, - { -625.0f, 185.0f, -685.0f }, - { -692.0f, 226.0f, -515.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_801223CC[6] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 20, - 0, - 55.0f, - 1.0f, - { 60.0f, 1130.0f, -1430.0f }, - { 60.0f, 1130.0f, -1190.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 18, - -13, - 68.0f, - 1.0f, - { 60.0f, 1130.0f, -1445.0f }, - { 180.0f, 1170.0f, -1240.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 16, - 18, - 75.0f, - 1.0f, - { 42.0f, 1040.0f, -1400.0f }, - { -20.0f, 940.0f, -1280.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 4, - 0, - 60.0f, - 1.0f, - { 60.0f, 1100.0f, -1465.0f }, - { 60.0f, 1100.0f, -1180.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 32, - 0, - 70.0f, - 1.0f, - { 60.0f, 1100.0f, -1030.0f }, - { 60.0f, 1150.0f, -740.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_801224BC[7] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 5, - 0, - 70.0f, - 1.0f, - { 60.0f, 1800.0f, -920.0f }, - { 60.0f, 1860.0f, -800.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 20, - 0, - 70.0f, - 0.1f, - { 60.0f, 1720.0f, -920.0f }, - { 60.0f, 1780.0f, -800.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0142, - 1, - 0, - 75.0f, - 1.0f, - { 0.0f, 70.0f, 0.0f }, - { 60.0f, 990.0f, -690.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0142, - 119, - 0, - 75.0f, - 0.05f, - { 0.0f, 70.0f, 0.0f }, - { 60.0f, 990.0f, -690.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 20, - 0, - 60.0f, - 0.1f, - { 0.0f, 70.0f, 0.0f }, - { 0.0f, 100.0f, 200.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_801225D4[5] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x0101, - 1, - 0, - 50.0f, - 1.0f, - { 4100.0f, 1200.0f, -1400.0f }, - { 3900.0f, 1100.0f, -1400.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_59), - 0x0101, - 60, - 4, - 50.0f, - 0.94f, - { 4100.0f, 965.0f, -1385.0f }, - { 3790.0f, 825.0f, -1325.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 90, - -5, - 130.0f, - 0.02f, - { 4100.0f, 975.0f, -1375.0f }, - { 3735.0f, 715.0f, -1325.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x2323, - 2, - 0, - 60.0f, - 1.0f, - { 0.0f, 60.0f, 0.0f }, - { -10.0f, 15.0f, -200.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_8012269C[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 20, - 2, - 45.0f, - 1.0f, - { 975.0f, 225.0f, -1195.0f }, - { 918.0f, 228.0f, -1228.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80122714[4] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 20, - 0, - 45.0f, - 1.0f, - { -915.0f, -2185.0f, 6335.0f }, - { -915.0f, -2290.0f, 6165.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - -1, - 0, - 80.0f, - 0.8f, - { -920.0f, -2270.0f, 6140.0f }, - { -920.0f, -2280.0f, 6070.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 20, - 0, - 80.0f, - 0.9f, - { -920.0f, -2300.0f, 6140.0f }, - { -920.0f, -2300.0f, 6070.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_801227B4[6] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 30, - 0, - 60.0f, - 1.0f, - { 1400.0f, 100.0f, -170.0f }, - { 1250.0f, 100.0f, -170.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 130, - 0, - 60.0f, - 0.2f, - { 0.0f, -5.0f, 0.0f }, - { -150.0f, -5.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0303, - 69, - 0, - 85.0f, - 1.0f, - { -40.0f, 0.0f, 0.0f }, - { -40.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0303, - 20, - 0, - 60.0f, - 1.0f, - { 10.0f, 0.0f, 0.0f }, - { 10.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_801228A4[5] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0101, - 20, - 5, - 30.0f, - 1.0f, - { 800.0f, -40.0f, 2170.0f }, - { 512.0f, 142.0f, 2020.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 20, - -2, - 70.0f, - 0.8f, - { 800.0f, -40.0f, 2170.0f }, - { 512.0f, 142.0f, 2020.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_8), - 0x0101, - 90, - 2, - 62.0f, - 1.0f, - { 1140.0f, 125.0f, 1920.0f }, - { 1255.0f, 150.0f, 1785.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 10, - 0, - 60.0f, - 1.0f, - { 0.0f, 10.0f, 0.0f }, - { 30.0f, 10.0f, -80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_8012296C[4] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 20, - -10, - 70.0f, - 1.0f, - { -930.0f, 765.0f, -3075.0f }, - { -700.0f, 700.0f, -3075.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 80, - -10, - 70.0f, - 0.05f, - { -930.0f, 205.0f, -3075.0f }, - { -700.0f, 140.0f, -3075.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 120, - 0, - 70.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80122A0C[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 60, - 4, - 50.0f, - 1.0f, - { 0.0f, 400.0f, -1000.0f }, - { -200.0f, 500.0f, -850.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 50.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80122A5C[8] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 1, - -15, - 70.0f, - 1.0f, - { 230.0f, 3675.0f, -4230.0f }, - { -45.0f, 3650.0f, -4415.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 1, - 0, - 60.0f, - 1.0f, - { -120.0f, 2187.0f, -3286.0f }, - { -110.0f, 2162.0f, -3262.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_21, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 55, - 0, - 60.0f, - 1.0f, - { -38.0f, 1467.0f, -1102.0f }, - { 64.0f, 1423.0f, -1188.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 1, - -15, - 70.0f, - 1.0f, - { 230.0f, 3675.0f, -4230.0f }, - { -20.0f, 3650.0f, -4400.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80122B9C[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 60, - 0, - 65.0f, - 1.0f, - { 1095.0f, 2890.0f, -2980.0f }, - { 1166.0f, 2695.0f, -2710.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 60, - 15, - 65.0f, - 1.0f, - { 566.0f, 4654.0f, -4550.0f }, - { 606.0f, 5160.0f, -4740.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80122C14[1] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 999, - 0, - 85.0f, - 1.0f, - { -15.0f, 185.0f, 160.0f }, - { -15.0f, 210.0f, 250.0f }, - }, -}; - -static OnePointCsFull D_80122C3C[1] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 999, - -2, - 70.0f, - 1.0f, - { -62.0f, 60.0f, -315.0f }, - { -115.0f, 30.0f, -445.0f }, - }, -}; - -static OnePointCsFull D_80122C64[1] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 999, - 3, - 70.0f, - 1.0f, - { -40.0f, 80.0f, 375.0f }, - { -85.0f, 45.0f, 485.0f }, - }, -}; - -static OnePointCsFull D_80122C8C[1] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 999, - 5, - 60.0f, - 1.0f, - { -70.0f, 140.0f, 25.0f }, - { 10.0f, 180.0f, 195.0f }, - }, -}; - -static OnePointCsFull D_80122CB4[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 5, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 1000.0f }, - { 0.0f, 0.0f, 1100.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - -1, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, -100.0f }, - { 0.0f, 0.0f, 0.0f }, - }, -}; - -static OnePointCsFull D_80122D04[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 10, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, -100.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - -1, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 1000.0f }, - { 0.0f, 0.0f, 1100.0f }, - }, -}; - -static OnePointCsFull D_80122D54[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 1, - -4, - 50.0f, - 1.0f, - { 230.0f, 65.0f, 300.0f }, - { 50.0f, 50.0f, 225.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80122DCC[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 1, - 0, - 50.0f, - 1.0f, - { 0.0f, 5.0f, -145.0f }, - { 0.0f, 55.0f, 55.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_17, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80122E44[2][7] = { - { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2222, - 10, - 5, - 90.0f, - 0.2f, - { 50.0f, 100.0f, 140.0f }, - { -30.0f, 10.0f, -20.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 20, - 0, - 90.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4343, - 30, - -5, - 50.0f, - 0.2f, - { -10.0f, 80.0f, 10.0f }, - { 20.0f, 20.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -5, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x4343, - 160, - 10, - 80.0f, - 0.005f, - { -50.0f, 60.0f, 0.0f }, - { -100.0f, 20.0f, 50.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0501, - 50, - 0, - 60.0f, - 1.0f, - { 0.0f, -10.0f, 0.0f }, - { 0.0f, 10.0f, 80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_19, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - }, - { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2222, - 10, - -5, - 90.0f, - 0.2f, - { -50.0f, 100.0f, 140.0f }, - { 30.0f, 10.0f, -20.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 20, - 0, - 90.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4343, - 30, - 5, - 50.0f, - 0.2f, - { 10.0f, 80.0f, 10.0f }, - { -20.0f, 20.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 5, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x4343, - 160, - -10, - 80.0f, - 0.005f, - { 50.0f, 60.0f, 0.0f }, - { 100.0f, 20.0f, 50.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0501, - 50, - 0, - 60.0f, - 1.0f, - { 0.0f, -10.0f, 0.0f }, - { 0.0f, 10.0f, 80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_19, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - -1, - -1.0f, - -1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - }, -}; - -static OnePointCsFull D_80123074[5] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0xA2A2, - 2, - 8, - 70.0f, - 1.0f, - { -27.0f, -96.0f, 25.0f }, - { 37.0f, -5.0f, 100.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0xA2A2, - 38, - 4, - 60.0f, - 1.0f, - { 64.0f, -109.0f, 55.0f }, - { 37.0f, 150.0f, 155.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0xA2A2, - 2, - 8, - 70.0f, - 1.0f, - { 45.0f, 123.0f, 45.0f }, - { 70.0f, 5.0f, 125.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0xA2A2, - 58, - 4, - 60.0f, - 0.9f, - { 82.0f, 95.0f, 55.0f }, - { 25.0f, -175.0f, 180.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_8012313C[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0xA2A2, - 20, - 8, - 70.0f, - 1.0f, - { 65.0f, -150.0f, 50.0f }, - { 30.0f, 10.0f, 90.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0xA2A2, - 100, - 0, - 60.0f, - 1.0f, - { 70.0f, -160.0f, 50.0f }, - { 25.0f, 180.0f, 180.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_801231B4[4] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_HUD_VISIBILITY(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE), - 0x4343, - 1, - 0, - 50.0f, - 1.0f, - { 0.0f, 20.0f, 0.0f }, - { 0.0f, 5.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_HUD_VISIBILITY(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE), - 0x4343, - 48, - 0, - 50.0f, - 0.75f, - { 0.0f, 80.0f, 0.0f }, - { 0.0f, 15.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_HUD_VISIBILITY(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE), - 0x4343, - 1, - 5, - 45.0f, - 1.0f, - { 0.0f, 0.0f, 30.0f }, - { 30.0f, 120.0f, 60.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, true), - ONEPOINT_CS_INIT_FIELD_HUD_VISIBILITY(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE), - 0x4343, - -1, - 0, - -1.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80123254[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 1, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_HUD_VISIBILITY(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE), - 0x0101, - 49, - 0, - 50.0f, - 0.05f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, -}; - -static OnePointCsFull D_801232A4[1] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_69), - 0x0101, - 9999, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, -}; - -static OnePointCsFull D_801232CC[5] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 45, - -3, - 65.0f, - 1.0f, - { -52.0f, 84.0f, -846.0f }, - { -159.0f, 33.0f, -729.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 10, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 15, - 0, - 60.0f, - 1.0f, - { 10.0f, -5.0f, 0.0f }, - { 0.0f, 0.0f, -150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80123394[5] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 45, - 3, - 65.0f, - 1.0f, - { -16.0f, 87.0f, -829.0f }, - { 98.0f, 24.0f, -714.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 10, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 15, - 0, - 60.0f, - 1.0f, - { 10.0f, -5.0f, 0.0f }, - { 0.0f, 0.0f, -150.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_8012345C[4] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x4242, - 40, - 0, - 40.0f, - 1.0f, - { 0.0f, 50.0f, -40.0f }, - { 0.0f, 60.0f, -160.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_77), - 0x4242, - 40, - 0, - 60.0f, - 0.3f, - { 0.0f, 90.0f, -40.0f }, - { 0.0f, 60.0f, -160.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_4, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x2121, - 10, - 0, - 60.0f, - 0.2f, - { 0.0f, -10.0f, 10.0f }, - { 0.0f, 10.0f, -80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_801234FC[5] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_1, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_5), - 0x0441, - 10, - 0, - 70.0f, - 1.0f, - { 0.0f, -10.0f, 20.0f }, - { 0.0f, 0.0f, 120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4141, - 30, - 0, - 50.0f, - 0.1f, - { 0.0f, -10.0f, 20.0f }, - { 0.0f, 10.0f, 80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 10, - 0, - 60.0f, - 0.9f, - { 0.0f, -10.0f, 0.0f }, - { 0.0f, 10.0f, -80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_801235C4[5] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_PLAYER_CS(PLAYER_CSACTION_1), - 0x4141, - 1, - 0, - 50.0f, - 1.0f, - { 0.0f, -10.0f, 20.0f }, - { 0.0f, 10.0f, 60.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0441, - 39, - 0, - 70.0f, - 0.1f, - { 0.0f, -10.0f, 20.0f }, - { 0.0f, 0.0f, 100.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_16, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x2121, - 15, - 0, - 60.0f, - 0.9f, - { 0.0f, -10.0f, 0.0f }, - { 0.0f, 10.0f, -80.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_8012368C[4] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 10, - 0, - 60.0f, - 1.0f, - { -1110.0f, -180.0f, -840.0f }, - { -985.0f, -220.0f, -840.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 70, - -45, - 75.0f, - 1.0f, - { -1060.0f, -160.0f, -840.0f }, - { -1005.0f, -230.0f, -840.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 10, - -45, - 75.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 180, - 9, - 80.0f, - 1.0f, - { -1205.0f, -175.0f, -840.0f }, - { -1305.0f, -230.0f, -828.0f }, - }, -}; - -static OnePointCsFull D_8012372C[4] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0142, - 10, - 0, - 70.0f, - 1.0f, - { 0.0f, 80.0f, 0.0f }, - { -1650.0f, 200.0f, -2920.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0142, - 110, - -2, - 50.0f, - 0.5f, - { 0.0f, 150.0f, 0.0f }, - { -1320.0f, 170.0f, -2900.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_11, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 100, - 2, - 70.0f, - 0.1f, - { 0.0f, 150.0f, 50.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_3, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 60, - 2, - 45.0f, - 0.01f, - { 0.0f, 150.0f, 50.0f }, - { 0.0f, 200.0f, -80.0f }, - }, -}; - -static OnePointCsFull D_801237CC[5] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, true), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 20, - 0, - 50.0f, - 1.0f, - { 0.0f, 50.0f, -10.0f }, - { 0.0f, 0.0f, 100.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_10, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 80, - 0, - 75.0f, - 1.0f, - { 2900.0f, 1300.0f, 530.0f }, - { 2800.0f, 1190.0f, 540.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 10, - 0, - 75.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_2, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 55, - 0, - 75.0f, - 1.0f, - { 2900.0f, 1300.0f, 530.0f }, - { 1500.0f, 1415.0f, 650.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 100, - -45, - 75.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; - -static OnePointCsFull D_80123894[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 60, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 30, - 0, - 50.0f, - 1.0f, - { 0.0f, 28.0f, 0.0f }, - { 0.0f, 20.0f, 40.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_13, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 120, - 0, - 180.0f, - 0.4f, - { 0.0f, -5.0f, 0.0f }, - { 0.0f, 2.0f, 40.0f }, - }, -}; - -static OnePointCsFull D_8012390C[2] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 30, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 180, - 0, - 60.0f, - 1.0f, - { 0.0f, 78.0f, 0.0f }, - { 0.0f, 78.0f, 200.0f }, - }, -}; - -static OnePointCsFull D_8012395C[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0101, - 60, - 0, - 60.0f, - 1.0f, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 30, - 0, - 50.0f, - 1.0f, - { 0.0f, 28.0f, 0.0f }, - { 0.0f, 20.0f, -45.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_13, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 120, - 0, - 180.0f, - 0.4f, - { 0.0f, -5.0f, 0.0f }, - { 0.0f, 2.0f, 45.0f }, - }, -}; - -static OnePointCsFull D_801239D4[3] = { - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_15, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 5, - 0, - 60.0f, - 1.0f, - { 0.0f, 20.0f, 0.0f }, - { 0.0f, 40.0f, -120.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_9, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x4242, - 0, - 0, - 60.0f, - 1.0f, - { 0.0f, 20.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - }, - { - ONEPOINT_CS_ACTION(ONEPOINT_CS_ACTION_ID_18, false, false), - ONEPOINT_CS_INIT_FIELD_NONE, - 0x0000, - 1, - 0, - 60.0f, - 1.0f, - { -1.0f, -1.0f, -1.0f }, - { -1.0f, -1.0f, -1.0f }, - }, -}; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index dd3e89d78..2b29e67ba 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -115,6 +115,9 @@ static RestrictionFlags sRestrictionFlags[] = { { 0xFF, 0x00, 0x00, 0x00 }, }; +static s16 sBtnPosXShifts[] = { WIDE_BTNB_SHIFT, (WIDE_CLEFT_SHIFT / 4), (WIDE_CDOWN_SHIFT / 4), + (WIDE_CRIGHT_SHIFT / 4), 0 }; + static s16 sHBAScoreTier = 0; static u16 sHBAScoreDigits[] = { 0, 0, 0, 0 }; @@ -1157,8 +1160,8 @@ Gfx* Gfx_TextureIA8(Gfx* displayListHead, void* texture, s16 textureWidth, s16 t G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(displayListHead++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, - (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, dsdx, dtdy); + gSPTextureRectangle(displayListHead++, rectLeft << 2, rectTop << 2, (u32)(rectLeft + rectWidth) << 2, + (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, WIDE_DIV(dsdx, WIDE_GET_RATIO), dtdy); return displayListHead; } @@ -1169,8 +1172,10 @@ Gfx* Gfx_TextureI8(Gfx* displayListHead, void* texture, s16 textureWidth, s16 te G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(displayListHead++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, - (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, dsdx, dtdy); + rectLeft = WIDE_MULT(rectLeft, WIDE_GET_RATIO); + gSPTextureRectangle(displayListHead++, rectLeft << 2, rectTop << 2, + WIDE_INCR(rectLeft + rectWidth, -(s16)WIDE_GET_4_3) << 2, (rectTop + rectHeight) << 2, + G_TX_RENDERTILE, 0, 0, WIDE_DIV(dsdx, WIDE_GET_RATIO), dtdy); return displayListHead; } @@ -1820,7 +1825,7 @@ u8 Item_Give(PlayState* play, u8 item) { } } } else if ((item >= ITEM_WEIRD_EGG) && (item <= ITEM_CLAIM_CHECK)) { - if (item == ITEM_POACHERS_SAW) { + if (!FIX_ANNOYING_GLITCH && item == ITEM_POACHERS_SAW) { SET_ITEMGETINF(ITEMGETINF_1F); } @@ -2554,7 +2559,6 @@ void Magic_Update(PlayState* play) { (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) { if ((gSaveContext.save.info.playerData.magic == 0) || - ((Player_GetEnvironmentalHazard(play) >= PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) && (Player_GetEnvironmentalHazard(play) <= PLAYER_ENV_HAZARD_UNDERWATER_FREE)) || ((gSaveContext.save.info.equips.buttonItems[1] != ITEM_LENS_OF_TRUTH) && @@ -2649,18 +2653,27 @@ void Magic_DrawMeter(PlayState* play) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sMagicBorderR, sMagicBorderG, sMagicBorderB, interfaceCtx->magicAlpha); gDPSetEnvColor(OVERLAY_DISP++, 100, 50, 50, 255); - OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gMagicMeterEndTex, 8, 16, R_MAGIC_METER_X, magicMeterY, 8, 16, - 1 << 10, 1 << 10); + // TODO: find something better + { + OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gMagicMeterEndTex, 8, 16, WIDE_INCR(R_MAGIC_METER_X, -4), + magicMeterY, WIDE_INCR(8, -2), 16, 1 << 10, 1 << 10); + } - OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gMagicMeterMidTex, 24, 16, R_MAGIC_METER_X + 8, magicMeterY, - gSaveContext.magicCapacity, 16, 1 << 10, 1 << 10); + OVERLAY_DISP = + Gfx_TextureIA8(OVERLAY_DISP, gMagicMeterMidTex, 24, 16, WIDE_INCR((R_MAGIC_METER_X + 8), -6), magicMeterY, + WIDE_MULT(gSaveContext.magicCapacity, WIDE_GET_RATIO), 16, 1 << 10, 1 << 10); gDPLoadTextureBlock(OVERLAY_DISP++, gMagicMeterEndTex, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 16, 0, G_TX_MIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 3, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, (R_MAGIC_METER_X + gSaveContext.magicCapacity + 8) << 2, magicMeterY << 2, - (R_MAGIC_METER_X + gSaveContext.magicCapacity + 16) << 2, (magicMeterY + 16) << 2, - G_TX_RENDERTILE, 256, 0, 1 << 10, 1 << 10); + // TODO: find something better + { + s16 posX = WIDE_MULT(WIDE_INCR((R_MAGIC_METER_X + gSaveContext.magicCapacity + 8), 1), WIDE_GET_RATIO); + gSPTextureRectangle(OVERLAY_DISP++, posX << 2, magicMeterY << 2, + WIDE_MULT((R_MAGIC_METER_X + gSaveContext.magicCapacity + 16), WIDE_GET_RATIO) << 2, + (magicMeterY + 16) << 2, G_TX_RENDERTILE, 256, 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), + 1 << 10); + } gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, PRIMITIVE, PRIMITIVE, @@ -2675,18 +2688,29 @@ void Magic_DrawMeter(PlayState* play) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, R_MAGIC_FILL_X << 2, (magicMeterY + 3) << 2, - (R_MAGIC_FILL_X + gSaveContext.save.info.playerData.magic) << 2, - (magicMeterY + 10) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + // TODO: find something better + { + s16 posX = WIDE_MULT(WIDE_INCR(R_MAGIC_FILL_X, 1), WIDE_GET_RATIO); + s16 posRx = + WIDE_MULT(WIDE_INCR((R_MAGIC_FILL_X + gSaveContext.save.info.playerData.magic), 1), WIDE_GET_RATIO); + gSPTextureRectangle(OVERLAY_DISP++, posX << 2, (magicMeterY + 3) << 2, posRx << 2, + (magicMeterY + 10) << 2, G_TX_RENDERTILE, 0, 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), + 1 << 10); + } // Fill the rest of the meter with the normal magic color gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), R_MAGIC_FILL_COLOR(2), interfaceCtx->magicAlpha); - gSPTextureRectangle(OVERLAY_DISP++, R_MAGIC_FILL_X << 2, (magicMeterY + 3) << 2, - (R_MAGIC_FILL_X + gSaveContext.magicTarget) << 2, (magicMeterY + 10) << 2, - G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + // TODO: find something better + { + s16 posX = WIDE_MULT(WIDE_INCR(R_MAGIC_FILL_X, 1), WIDE_GET_RATIO); + s16 posRx = WIDE_MULT(WIDE_INCR((R_MAGIC_FILL_X + gSaveContext.magicTarget), 1), WIDE_GET_RATIO); + gSPTextureRectangle(OVERLAY_DISP++, posX << 2, (magicMeterY + 3) << 2, posRx << 2, + (magicMeterY + 10) << 2, G_TX_RENDERTILE, 0, 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), + 1 << 10); + } } else { // Fill the whole meter with the normal magic color gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), R_MAGIC_FILL_COLOR(2), @@ -2696,9 +2720,15 @@ void Magic_DrawMeter(PlayState* play) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, R_MAGIC_FILL_X << 2, (magicMeterY + 3) << 2, - (R_MAGIC_FILL_X + gSaveContext.save.info.playerData.magic) << 2, - (magicMeterY + 10) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + // TODO: find something better + { + s16 posX = WIDE_MULT(WIDE_INCR(R_MAGIC_FILL_X, 1), WIDE_GET_RATIO); + s16 posRx = + WIDE_MULT(WIDE_INCR((R_MAGIC_FILL_X + gSaveContext.save.info.playerData.magic), 1), WIDE_GET_RATIO); + gSPTextureRectangle(OVERLAY_DISP++, posX << 2, (magicMeterY + 3) << 2, posRx << 2, + (magicMeterY + 10) << 2, G_TX_RENDERTILE, 0, 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), + 1 << 10); + } } } @@ -2780,40 +2810,54 @@ void Interface_DrawItemButtons(PlayState* play) { gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_B_BTN_COLOR(0), R_B_BTN_COLOR(1), R_B_BTN_COLOR(2), interfaceCtx->bAlpha); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255); - OVERLAY_DISP = - Gfx_TextureIA8(OVERLAY_DISP, gButtonBackgroundTex, 32, 32, R_ITEM_BTN_X(0), R_ITEM_BTN_Y(0), - R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_DD(0) << 1, R_ITEM_BTN_DD(0) << 1); + OVERLAY_DISP = Gfx_TextureIA8( + OVERLAY_DISP, gButtonBackgroundTex, 32, 32, WIDE_INCR(R_ITEM_BTN_X(0), WIDE_BTNB_SHIFT), R_ITEM_BTN_Y(0), + WIDE_INCR(R_ITEM_BTN_WIDTH(0), -8), R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_DD(0) << 1, R_ITEM_BTN_DD(0) << 1); // C-Left Button Color & Texture gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cLeftAlpha); - gSPTextureRectangle(OVERLAY_DISP++, R_ITEM_BTN_X(1) << 2, R_ITEM_BTN_Y(1) << 2, - (R_ITEM_BTN_X(1) + R_ITEM_BTN_WIDTH(1)) << 2, (R_ITEM_BTN_Y(1) + R_ITEM_BTN_WIDTH(1)) << 2, - G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(1) << 1, R_ITEM_BTN_DD(1) << 1); + gSPTextureRectangle(OVERLAY_DISP++, WIDE_INCR((R_ITEM_BTN_X(1) << 2), WIDE_CLEFT_SHIFT), R_ITEM_BTN_Y(1) << 2, + WIDE_INCR(((R_ITEM_BTN_X(1) + R_ITEM_BTN_WIDTH(1)) << 2), WIDE_CLEFT_SHIFT - 29), + (R_ITEM_BTN_Y(1) + R_ITEM_BTN_WIDTH(1)) << 2, G_TX_RENDERTILE, 0, 0, + WIDE_DIV(R_ITEM_BTN_DD(1), WIDE_GET_RATIO) << 1, R_ITEM_BTN_DD(1) << 1); // C-Down Button Color & Texture gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cDownAlpha); - gSPTextureRectangle(OVERLAY_DISP++, R_ITEM_BTN_X(2) << 2, R_ITEM_BTN_Y(2) << 2, - (R_ITEM_BTN_X(2) + R_ITEM_BTN_WIDTH(2)) << 2, (R_ITEM_BTN_Y(2) + R_ITEM_BTN_WIDTH(2)) << 2, - G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(2) << 1, R_ITEM_BTN_DD(2) << 1); + gSPTextureRectangle(OVERLAY_DISP++, WIDE_INCR((R_ITEM_BTN_X(2) << 2), WIDE_CDOWN_SHIFT), R_ITEM_BTN_Y(2) << 2, + WIDE_INCR(((R_ITEM_BTN_X(2) + R_ITEM_BTN_WIDTH(2)) << 2), WIDE_CDOWN_SHIFT - 29), + (R_ITEM_BTN_Y(2) + R_ITEM_BTN_WIDTH(2)) << 2, G_TX_RENDERTILE, 0, 0, + WIDE_DIV(R_ITEM_BTN_DD(2), WIDE_GET_RATIO) << 1, R_ITEM_BTN_DD(2) << 1); // C-Right Button Color & Texture gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cRightAlpha); - gSPTextureRectangle(OVERLAY_DISP++, R_ITEM_BTN_X(3) << 2, R_ITEM_BTN_Y(3) << 2, - (R_ITEM_BTN_X(3) + R_ITEM_BTN_WIDTH(3)) << 2, (R_ITEM_BTN_Y(3) + R_ITEM_BTN_WIDTH(3)) << 2, - G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) << 1, R_ITEM_BTN_DD(3) << 1); + gSPTextureRectangle(OVERLAY_DISP++, WIDE_INCR((R_ITEM_BTN_X(3) << 2), WIDE_CRIGHT_SHIFT), R_ITEM_BTN_Y(3) << 2, + WIDE_INCR(((R_ITEM_BTN_X(3) + R_ITEM_BTN_WIDTH(3)) << 2), WIDE_CRIGHT_SHIFT - 29), + (R_ITEM_BTN_Y(3) + R_ITEM_BTN_WIDTH(3)) << 2, G_TX_RENDERTILE, 0, 0, + WIDE_DIV(R_ITEM_BTN_DD(3), WIDE_GET_RATIO) << 1, R_ITEM_BTN_DD(3) << 1); if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { if (IS_PAUSED(&play->pauseCtx)) { + Color_RGB8 startBtnRGB = { 120, 120, 120 }; + // Start Button Texture, Color & Label gDPPipeSync(OVERLAY_DISP++); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 120, 120, interfaceCtx->startAlpha); - gSPTextureRectangle(OVERLAY_DISP++, startButtonLeftPos[gSaveContext.language] << 2, 17 << 2, - (startButtonLeftPos[gSaveContext.language] + 22) << 2, 39 << 2, G_TX_RENDERTILE, 0, 0, - (s32)(1.4277344 * (1 << 10)), (s32)(1.4277344 * (1 << 10))); + if (N64_BTN_COLORS) { + startBtnRGB.r = 200; + startBtnRGB.g = startBtnRGB.b = 0; + } + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, startBtnRGB.r, startBtnRGB.g, startBtnRGB.b, + interfaceCtx->startAlpha); + gSPTextureRectangle( + OVERLAY_DISP++, + WIDE_N64_MODE(WIDE_INCR((startButtonLeftPos[gSaveContext.language] << 2), WIDE_BTNSTART_SHIFT), -3), + 17 << 2, WIDE_INCR((startButtonLeftPos[gSaveContext.language] + 22), 40 - (s16)WIDE_GET_4_3) << 2, + WIDE_N64_MODE(39, 3) << 2, G_TX_RENDERTILE, 0, 0, + WIDE_N64_MODE(WIDE_DIV((s32)(1.4277344 * (1 << 10)), WIDE_GET_RATIO), -128), + WIDE_N64_MODE((s32)(1.4277344 * (1 << 10)), -128)); gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->startAlpha); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); @@ -2825,13 +2869,16 @@ void Interface_DrawItemButtons(PlayState* play) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); texCoordScale = (1 << 10) / (R_START_LABEL_DD(gSaveContext.language) / 100.0f); - width = DO_ACTION_TEX_WIDTH / (R_START_LABEL_DD(gSaveContext.language) / 100.0f); + width = WIDE_INCR(DO_ACTION_TEX_WIDTH / (R_START_LABEL_DD(gSaveContext.language) / 100.0f), + 32 - (s16)WIDE_GET_4_3); height = DO_ACTION_TEX_HEIGHT / (R_START_LABEL_DD(gSaveContext.language) / 100.0f); - gSPTextureRectangle(OVERLAY_DISP++, R_START_LABEL_X(gSaveContext.language) << 2, - R_START_LABEL_Y(gSaveContext.language) << 2, - (R_START_LABEL_X(gSaveContext.language) + width) << 2, - (R_START_LABEL_Y(gSaveContext.language) + height) << 2, G_TX_RENDERTILE, 0, 0, - texCoordScale, texCoordScale); + + gSPTextureRectangle( + OVERLAY_DISP++, WIDE_N64_MODE((WIDE_INCR(R_START_LABEL_X(gSaveContext.language), 3 + 44) << 2), -3), + WIDE_N64_MODE(R_START_LABEL_Y(gSaveContext.language), 1) << 2, + (R_START_LABEL_X(gSaveContext.language) + width) << 2, + (R_START_LABEL_Y(gSaveContext.language) + height) << 2, G_TX_RENDERTILE, 0, 0, + WIDE_N64_MODE(WIDE_DIV(texCoordScale, WIDE_GET_RATIO), -32), WIDE_N64_MODE(texCoordScale, -32)); } } @@ -2854,8 +2901,9 @@ void Interface_DrawItemButtons(PlayState* play) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), temp); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - gSPTextureRectangle(OVERLAY_DISP++, R_C_UP_BTN_X << 2, R_C_UP_BTN_Y << 2, (R_C_UP_BTN_X + 16) << 2, - (R_C_UP_BTN_Y + 16) << 2, G_TX_RENDERTILE, 0, 0, 2 << 10, 2 << 10); + gSPTextureRectangle(OVERLAY_DISP++, WIDE_INCR((R_C_UP_BTN_X << 2), WIDE_CUP_SHIFT - 5), R_C_UP_BTN_Y << 2, + WIDE_INCR(((R_C_UP_BTN_X + 16) << 2), WIDE_CUP_SHIFT - 20), (R_C_UP_BTN_Y + 16) << 2, + G_TX_RENDERTILE, 0, 0, WIDE_DIV((2 << 10), WIDE_GET_RATIO), 2 << 10); gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, temp); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); @@ -2866,8 +2914,10 @@ void Interface_DrawItemButtons(PlayState* play) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, R_C_UP_ICON_X << 2, R_C_UP_ICON_Y << 2, (R_C_UP_ICON_X + 32) << 2, - (R_C_UP_ICON_Y + 8) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + gSPTextureRectangle(OVERLAY_DISP++, WIDE_INCR((R_C_UP_ICON_X << 2), WIDE_CUP_SHIFT), R_C_UP_ICON_Y << 2, + WIDE_INCR((R_C_UP_ICON_X + 32), WIDE_CUP_SHIFT - (s32)WIDE_GET_4_3) << 2, + (R_C_UP_ICON_Y + 8) << 2, G_TX_RENDERTILE, 0, 0, + WIDE_N64_MODE(WIDE_DIV((1 << 10), WIDE_GET_RATIO), -20), WIDE_N64_MODE((1 << 10), -20)); } sCUpTimer--; @@ -2894,7 +2944,8 @@ void Interface_DrawItemButtons(PlayState* play) { } OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, ((u8*)gButtonBackgroundTex + ((32 * 32) * (temp + 1))), 32, 32, - R_ITEM_BTN_X(temp), R_ITEM_BTN_Y(temp), R_ITEM_BTN_WIDTH(temp), + WIDE_INCR(R_ITEM_BTN_X(temp), sBtnPosXShifts[temp]), R_ITEM_BTN_Y(temp), + WIDE_INCR(R_ITEM_BTN_WIDTH(temp), sBtnPosXShifts[temp]), R_ITEM_BTN_WIDTH(temp), R_ITEM_BTN_DD(temp) << 1, R_ITEM_BTN_DD(temp) << 1); } } @@ -2903,15 +2954,17 @@ void Interface_DrawItemButtons(PlayState* play) { } void Interface_DrawItemIconTexture(PlayState* play, void* texture, s16 button) { + s16 posX = WIDE_INCR(R_ITEM_ICON_X(button), sBtnPosXShifts[button]); + OPEN_DISPS(play->state.gfxCtx, "../z_parameter.c", 3079); gDPLoadTextureBlock(OVERLAY_DISP++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, R_ITEM_ICON_X(button) << 2, R_ITEM_ICON_Y(button) << 2, - (R_ITEM_ICON_X(button) + R_ITEM_ICON_WIDTH(button)) << 2, + gSPTextureRectangle(OVERLAY_DISP++, posX << 2, R_ITEM_ICON_Y(button) << 2, + WIDE_INCR(((posX + R_ITEM_ICON_WIDTH(button)) << 2), WIDE_ITEMICON_RIGHT_X(button)), (R_ITEM_ICON_Y(button) + R_ITEM_ICON_WIDTH(button)) << 2, G_TX_RENDERTILE, 0, 0, - R_ITEM_ICON_DD(button) << 1, R_ITEM_ICON_DD(button) << 1); + WIDE_MULT((R_ITEM_ICON_DD(button) << 1), WIDE_GET_4_3), R_ITEM_ICON_DD(button) << 1); CLOSE_DISPS(play->state.gfxCtx, "../z_parameter.c", 3094); } @@ -2963,12 +3016,15 @@ void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { } if (i != 0) { - OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, ((u8*)gAmmoDigit0Tex + ((8 * 8) * i)), 8, 8, - R_ITEM_AMMO_X(button), R_ITEM_AMMO_Y(button), 8, 8, 1 << 10, 1 << 10); + OVERLAY_DISP = + Gfx_TextureIA8(OVERLAY_DISP, ((u8*)gAmmoDigit0Tex + ((8 * 8) * i)), 8, 8, + WIDE_INCR(R_ITEM_AMMO_X(button), sBtnPosXShifts[button]), R_ITEM_AMMO_Y(button), + WIDE_INCR(8, sBtnPosXShifts[button]), 8, 1 << 10, 1 << 10); } OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, ((u8*)gAmmoDigit0Tex + ((8 * 8) * ammo)), 8, 8, - R_ITEM_AMMO_X(button) + 6, R_ITEM_AMMO_Y(button), 8, 8, 1 << 10, 1 << 10); + WIDE_INCR((R_ITEM_AMMO_X(button) + 6), sBtnPosXShifts[button] - WIDE_GET_4_3), + R_ITEM_AMMO_Y(button), WIDE_INCR(8, sBtnPosXShifts[button]), 8, 1 << 10, 1 << 10); } CLOSE_DISPS(play->state.gfxCtx, "../z_parameter.c", 3158); @@ -3099,6 +3155,12 @@ void func_8008A994(InterfaceContext* interfaceCtx) { View_ApplyOrthoToOverlay(&interfaceCtx->view); } +#if IS_DEBUG && (ENABLE_INV_EDITOR || ENABLE_EVENT_EDITOR) +#define CAN_DRAW_INTERFACE (pauseCtx->debugState == 0) +#else +#define CAN_DRAW_INTERFACE true +#endif + void Interface_Draw(PlayState* play) { static s16 magicArrowEffectsR[] = { 255, 100, 255 }; static s16 magicArrowEffectsG[] = { 0, 100, 255 }; @@ -3137,7 +3199,7 @@ void Interface_Draw(PlayState* play) { gSPSegment(OVERLAY_DISP++, 0x08, interfaceCtx->iconItemSegment); gSPSegment(OVERLAY_DISP++, 0x0B, interfaceCtx->mapSegment); - if (pauseCtx->debugState == 0) { + if (CAN_DRAW_INTERFACE) { Interface_InitVertices(play); func_8008A994(interfaceCtx); Health_DrawMeter(play); @@ -3145,9 +3207,22 @@ void Interface_Draw(PlayState* play) { Gfx_SetupDL_39Overlay(play->state.gfxCtx); // Rupee Icon - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 255, 100, interfaceCtx->magicAlpha); + if (MM_WALLET_ICON_COLORS) { + u8 walletUpg = CUR_UPG_VALUE(UPG_WALLET); + static Color_RGB8 const walletColors[] = { + { 200, 255, 100 }, + { 130, 130, 255 }, + { 255, 100, 100 }, + }; + + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, walletColors[walletUpg].r, walletColors[walletUpg].g, + walletColors[walletUpg].b, interfaceCtx->magicAlpha); + } else { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 255, 100, interfaceCtx->magicAlpha); + } gDPSetEnvColor(OVERLAY_DISP++, 0, 80, 0, 255); - OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, 26, 206, 16, 16, 1 << 10, 1 << 10); + OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, WIDE_MULT(26, WIDE_GET_RATIO), 206, + 16, 16, WIDE_INCR(1, (u16)(WIDE_GET_RATIO)) << 10, 1 << 10); switch (play->sceneId) { case SCENE_FOREST_TEMPLE: @@ -3169,8 +3244,8 @@ void Interface_Draw(PlayState* play) { gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 230, 255, interfaceCtx->magicAlpha); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 20, 255); - OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gSmallKeyCounterIconTex, 16, 16, 26, 190, 16, 16, - 1 << 10, 1 << 10); + OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gSmallKeyCounterIconTex, 16, 16, WIDE_INCR(26, -7), 190, + WIDE_INCR(16, -4), 16, 1 << 10, 1 << 10); // Small Key Counter gDPPipeSync(OVERLAY_DISP++); @@ -3246,7 +3321,7 @@ void Interface_Draw(PlayState* play) { } Magic_DrawMeter(play); - Minimap_Draw(play); + Minimap_Draw(play); // TODO: fix the arrows if ((R_PAUSE_BG_PRERENDER_STATE != PAUSE_BG_PRERENDER_PROCESS) && (R_PAUSE_BG_PRERENDER_STATE != PAUSE_BG_PRERENDER_READY)) { @@ -3286,11 +3361,12 @@ void Interface_Draw(PlayState* play) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); R_B_LABEL_DD = (1 << 10) / (WREG(37 + gSaveContext.language) / 100.0f); - gSPTextureRectangle(OVERLAY_DISP++, R_B_LABEL_X(gSaveContext.language) << 2, - R_B_LABEL_Y(gSaveContext.language) << 2, - (R_B_LABEL_X(gSaveContext.language) + DO_ACTION_TEX_WIDTH) << 2, - (R_B_LABEL_Y(gSaveContext.language) + DO_ACTION_TEX_HEIGHT) << 2, G_TX_RENDERTILE, 0, 0, - R_B_LABEL_DD, R_B_LABEL_DD); + gSPTextureRectangle( + OVERLAY_DISP++, WIDE_INCR(R_B_LABEL_X(gSaveContext.language), 1 + sBtnPosXShifts[0]) << 2, + R_B_LABEL_Y(gSaveContext.language) << 2, + WIDE_INCR(R_B_LABEL_X(gSaveContext.language) + DO_ACTION_TEX_WIDTH, sBtnPosXShifts[0] - 20) << 2, + (R_B_LABEL_Y(gSaveContext.language) + DO_ACTION_TEX_HEIGHT) << 2, G_TX_RENDERTILE, 0, 0, + WIDE_DIV(R_B_LABEL_DD, WIDE_GET_RATIO), R_B_LABEL_DD); } gDPPipeSync(OVERLAY_DISP++); @@ -3334,21 +3410,23 @@ void Interface_Draw(PlayState* play) { // A Button Gfx_SetupDL_42Overlay(play->state.gfxCtx); - func_8008A8B8(play, R_A_BTN_Y, R_A_BTN_Y + 45, R_A_BTN_X, R_A_BTN_X + 45); + func_8008A8B8(play, R_A_BTN_Y, R_A_BTN_Y + 45, WIDE_INCR(R_A_BTN_X, WIDE_BTNA_SHIFT), + WIDE_INCR((R_A_BTN_X + 45), WIDE_BTNA_SHIFT)); gSPClearGeometryMode(OVERLAY_DISP++, G_CULL_BOTH); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2), interfaceCtx->aAlpha); Interface_DrawActionButton(play); gDPPipeSync(OVERLAY_DISP++); - func_8008A8B8(play, R_A_ICON_Y, R_A_ICON_Y + 45, R_A_ICON_X, R_A_ICON_X + 45); + func_8008A8B8(play, R_A_ICON_Y, R_A_ICON_Y + 45, WIDE_INCR(R_A_ICON_X, WIDE_BTNA_SHIFT), + WIDE_INCR((R_A_ICON_X + 45), WIDE_BTNA_SHIFT)); gSPSetGeometryMode(OVERLAY_DISP++, G_CULL_BACK); gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->aAlpha); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); Matrix_Translate(0.0f, 0.0f, WREG(46 + gSaveContext.language) / 10.0f, MTXMODE_NEW); - Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + Matrix_Scale(WIDE_N64_MODE(1.0f, 0.1), WIDE_N64_MODE(1.0f, 0.1), WIDE_N64_MODE(1.0f, 0.1), MTXMODE_APPLY); Matrix_RotateX(interfaceCtx->unk_1F4 / 10000.0f, MTXMODE_APPLY); gSPMatrix(OVERLAY_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_parameter.c", 3701), G_MTX_MODELVIEW | G_MTX_LOAD); @@ -3425,7 +3503,7 @@ void Interface_Draw(PlayState* play) { G_TX_NOLOD, G_TX_NOLOD); // Draw 6 carrots - for (svar1 = 1, svar5 = ZREG(14); svar1 < 7; svar1++, svar5 += 16) { + for (svar1 = 1, svar5 = ZREG(14); svar1 < 7; svar1++, svar5 += WIDE_INCR(16, -4)) { // Carrot Color (based on availability) if ((interfaceCtx->numHorseBoosts == 0) || (interfaceCtx->numHorseBoosts < svar1)) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 150, 255, interfaceCtx->aAlpha); @@ -3433,8 +3511,9 @@ void Interface_Draw(PlayState* play) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->aAlpha); } - gSPTextureRectangle(OVERLAY_DISP++, svar5 << 2, ZREG(15) << 2, (svar5 + 16) << 2, - (ZREG(15) + 16) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + gSPTextureRectangle(OVERLAY_DISP++, WIDE_INCR(svar5, 14) << 2, ZREG(15) << 2, + WIDE_INCR((svar5 + 16), 10) << 2, (ZREG(15) + 16) << 2, G_TX_RENDERTILE, 0, + 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); } } } else { @@ -3448,14 +3527,15 @@ void Interface_Draw(PlayState* play) { G_TX_NOLOD, G_TX_NOLOD); gSPTextureRectangle(OVERLAY_DISP++, (svar5 + 28) << 2, ZREG(15) << 2, (svar5 + 52) << 2, - (ZREG(15) + 16) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + (ZREG(15) + 16) << 2, G_TX_RENDERTILE, 0, 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), + 1 << 10); // Score Counter gDPPipeSync(OVERLAY_DISP++); gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); - svar5 = WREG(32) + 6 * 9; + svar5 = WIDE_INCR((WREG(32) + 6 * 9), 48); for (svar1 = svar2 = 0; svar1 < 4; svar1++) { if (sHBAScoreDigits[svar1] != 0 || (svar2 != 0) || (svar1 >= 3)) { @@ -3896,9 +3976,10 @@ void Interface_Draw(PlayState* play) { gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); - OVERLAY_DISP = - Gfx_TextureIA8(OVERLAY_DISP, gClockIconTex, 16, 16, ((void)0, gSaveContext.timerX[timerId]), - ((void)0, gSaveContext.timerY[timerId]) + 2, 16, 16, 1 << 10, 1 << 10); + OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gClockIconTex, 16, 16, + WIDE_MULT(((void)0, gSaveContext.timerX[timerId]), WIDE_GET_RATIO), + ((void)0, gSaveContext.timerY[timerId]) + 2, WIDE_INCR(16, -4), 16, + 1 << 10, 1 << 10); // Timer Counter gDPPipeSync(OVERLAY_DISP++); @@ -3932,11 +4013,9 @@ void Interface_Draw(PlayState* play) { } } -#if OOT_DEBUG - if (pauseCtx->debugState == 3) { + if (IS_EVENT_EDITOR_ENABLED && (pauseCtx->debugState == 3)) { FlagSet_Update(play); } -#endif if (interfaceCtx->unk_244 != 0) { gDPPipeSync(OVERLAY_DISP++); @@ -3958,7 +4037,7 @@ void Interface_Update(PlayState* play) { s16 risingAlpha; u16 action; -#if OOT_DEBUG +#if IS_DEBUG { Input* debugInput = &play->state.input[2]; diff --git a/src/code/z_play.c b/src/code/z_play.c index 62b6f9287..6d97002c1 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -2,23 +2,29 @@ #include "quake.h" #include "terminal.h" +#if IS_DEBUG void* gDebugCutsceneScript = NULL; UNK_TYPE D_8012D1F4 = 0; // unused +#endif + Input* D_8012D1F8 = NULL; TransitionTile sTransitionTile; s32 gTransitionTileState; VisMono sPlayVisMono; Color_RGBA8_u32 gVisMonoColor; + +#if IS_DEBUG FaultClient D_801614B8; +#endif + s16 sTransitionFillTimer; -u64 sDebugCutsceneScriptBuf[0xA00]; void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn); // This macro prints the number "1" with a file and line number if R_ENABLE_PLAY_LOGS is enabled. // For example, it can be used to trace the play state execution at a high level. -#if OOT_DEBUG +#if IS_DEBUG #define PLAY_LOG(line) \ do { \ if (R_ENABLE_PLAY_LOGS) { \ @@ -218,7 +224,7 @@ void Play_Destroy(GameState* thisx) { KaleidoManager_Destroy(); ZeldaArena_Cleanup(); -#if OOT_DEBUG +#if IS_DEBUG Fault_RemoveClient(&D_801614B8); #endif } @@ -242,9 +248,9 @@ void Play_Init(GameState* thisx) { return; } -#if OOT_DEBUG - SystemArena_Display(); -#endif + if (IS_SPEEDMETER_ENABLED) { + SystemArena_Display(); + } GameState_Realloc(&this->state, 0x1D4790); KaleidoManager_Init(this); @@ -376,7 +382,11 @@ void Play_Init(GameState* thisx) { PreRender_SetValues(&this->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, NULL, NULL); gTransitionTileState = TRANS_TILE_OFF; this->transitionMode = TRANS_MODE_OFF; + +#if ARE_FRAMERATE_OPTIONS_ENABLED FrameAdvance_Init(&this->frameAdvCtx); +#endif + Rand_Seed((u32)osGetTime()); Matrix_Init(&this->state); this->state.main = Play_Main; @@ -415,7 +425,7 @@ void Play_Init(GameState* thisx) { // "Zelda Heap" PRINTF("ゼルダヒープ %08x-%08x\n", zAllocAligned, (u8*)zAllocAligned + zAllocSize - (s32)(zAllocAligned - zAlloc)); -#if OOT_DEBUG +#if IS_DEBUG Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL); #endif @@ -451,7 +461,9 @@ void Play_Init(GameState* thisx) { AnimationContext_Update(this, &this->animationCtx); gSaveContext.respawnFlag = 0; - if (OOT_DEBUG && R_USE_DEBUG_CUTSCENE) { + if (IS_DEBUG && R_USE_DEBUG_CUTSCENE) { + static u64 sDebugCutsceneScriptBuf[0xA00]; + gDebugCutsceneScript = sDebugCutsceneScriptBuf; PRINTF("\nkawauso_data=[%x]", gDebugCutsceneScript); @@ -463,10 +475,10 @@ void Play_Init(GameState* thisx) { void Play_Update(PlayState* this) { Input* input = this->state.input; - s32 isPaused; + s32 isPaused = IS_PAUSED(&this->pauseCtx); s32 pad1; -#if OOT_DEBUG +#if IS_DEBUG if ((SREG(1) < 0) || (DREG(0) != 0)) { SREG(1) = 0; ZeldaArena_Display(); @@ -503,7 +515,13 @@ void Play_Update(PlayState* this) { gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment); gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment); - if (FrameAdvance_Update(&this->frameAdvCtx, &input[1])) { +#if ARE_FRAMERATE_OPTIONS_ENABLED +#define FRAMEADVANCE_CAN_UPDATE FrameAdvance_Update(&this->frameAdvCtx, &input[FA_CONTROLLER_PORT]) +#else +#define FRAMEADVANCE_CAN_UPDATE true +#endif + + if (FRAMEADVANCE_CAN_UPDATE) { if ((this->transitionMode == TRANS_MODE_OFF) && (this->transitionTrigger != TRANS_TRIGGER_OFF)) { this->transitionMode = TRANS_MODE_SETUP; } @@ -557,7 +575,7 @@ void Play_Update(PlayState* this) { } } -#if OOT_DEBUG +#if IS_DEBUG if (!R_TRANS_DBG_ENABLED) { Play_SetupTransition(this, this->transitionType); } else { @@ -875,7 +893,7 @@ void Play_Update(PlayState* this) { PLAY_LOG(3555); AnimationContext_Reset(&this->animationCtx); - if (!OOT_DEBUG) {} + if (!IS_DEBUG) {} PLAY_LOG(3561); Object_UpdateEntries(&this->objectCtx); @@ -1010,7 +1028,7 @@ void Play_Update(PlayState* this) { skip: PLAY_LOG(3801); - if (!isPaused || gDebugCamEnabled) { + if (!isPaused || IS_DEBUG_CAM_ENABLED) { s32 i; this->nextCamId = this->activeCamId; @@ -1079,7 +1097,7 @@ void Play_Draw(PlayState* this) { Gfx_SetupFrame(gfxCtx, 0, 0, 0); - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_DRAW) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_DRAW) { POLY_OPA_DISP = Play_SetFog(this, POLY_OPA_DISP); POLY_XLU_DISP = Play_SetFog(this, POLY_XLU_DISP); @@ -1102,7 +1120,7 @@ void Play_Draw(PlayState* this) { gSPSegment(POLY_OPA_DISP++, 0x01, this->billboardMtx); - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_COVER_ELEMENTS) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_COVER_ELEMENTS) { Gfx* gfxP; Gfx* sp1CC = POLY_OPA_DISP; @@ -1150,7 +1168,9 @@ void Play_Draw(PlayState* this) { // content and can be used by `PreRender_ApplyFilters` below. Sched_FlushTaskQueue(); - PreRender_ApplyFilters(&this->pauseBgPreRender); + if (ENABLE_PAUSE_BG_AA) { + PreRender_ApplyFilters(&this->pauseBgPreRender); + } R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_READY; } else if (R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_MAX) { @@ -1166,7 +1186,7 @@ void Play_Draw(PlayState* this) { goto Play_Draw_DrawOverlayElements; } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { if (this->skyboxId && (this->skyboxId != SKYBOX_UNSET_1D) && !this->envCtx.skyboxDisabled) { if ((this->skyboxId == SKYBOX_NORMAL_SKY) || (this->skyboxId == SKYBOX_CUTSCENE_MAP)) { Environment_UpdateSkybox(this->skyboxId, &this->envCtx, &this->skyboxCtx); @@ -1179,32 +1199,32 @@ void Play_Draw(PlayState* this) { } } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SUN_AND_MOON)) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SUN_AND_MOON)) { if (!this->envCtx.sunMoonDisabled) { Environment_DrawSunAndMoon(this); } } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SKYBOX_FILTERS)) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SKYBOX_FILTERS)) { Environment_DrawSkyboxFilters(this); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTNING)) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTNING)) { Environment_UpdateLightningStrike(this); Environment_DrawLightning(this, 0); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTS)) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTS)) { sp228 = LightContext_NewLights(&this->lightCtx, gfxCtx); Lights_BindAll(sp228, this->lightCtx.listHead, NULL); Lights_Draw(sp228, gfxCtx); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { if (VREG(94) == 0) { s32 roomDrawFlags; - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY)) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY)) { roomDrawFlags = ROOM_DRAW_OPA | ROOM_DRAW_XLU; } else { roomDrawFlags = R_PLAY_DRAW_ROOM_FLAGS; @@ -1215,7 +1235,7 @@ void Play_Draw(PlayState* this) { } } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { if ((this->skyboxCtx.drawType != SKYBOX_DRAW_128) && (GET_ACTIVE_CAM(this)->setting != CAM_SET_PREREND_FIXED)) { Vec3f quakeOffset; @@ -1230,15 +1250,15 @@ void Play_Draw(PlayState* this) { Environment_DrawRain(this, &this->view, gfxCtx); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { Environment_FillScreen(gfxCtx, 0, 0, 0, this->bgCoverAlpha, FILL_SCREEN_OPA); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_ACTORS) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_ACTORS) { func_800315AC(this, &this->actorCtx); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_LENS_FLARES) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_LENS_FLARES) { if (!this->envCtx.sunMoonDisabled) { sp21C.x = this->view.eye.x + this->envCtx.sunPos.x; sp21C.y = this->view.eye.y + this->envCtx.sunPos.y; @@ -1248,7 +1268,7 @@ void Play_Draw(PlayState* this) { Environment_DrawCustomLensFlare(this); } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SCREEN_FILLS) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SCREEN_FILLS) { if (MREG(64) != 0) { Environment_FillScreen(gfxCtx, MREG(65), MREG(66), MREG(67), MREG(68), FILL_SCREEN_OPA | FILL_SCREEN_XLU); @@ -1265,15 +1285,17 @@ void Play_Draw(PlayState* this) { } } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SANDSTORM) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SANDSTORM) { if (this->envCtx.sandstormState != SANDSTORM_OFF) { Environment_DrawSandstorm(this, this->envCtx.sandstormState); } } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_DEBUG_OBJECTS) { +#if IS_DEBUG && !NO_DEBUG_DISPLAY + if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_DEBUG_OBJECTS) { DebugDisplay_DrawObjects(this); } +#endif if ((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_SETUP) || (gTransitionTileState == TRANS_TILE_SETUP)) { Gfx* gfxP = OVERLAY_DISP; @@ -1298,7 +1320,7 @@ void Play_Draw(PlayState* this) { } Play_Draw_DrawOverlayElements: - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_OVERLAY_ELEMENTS) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_OVERLAY_ELEMENTS) { Play_DrawOverlayElements(this); } } @@ -1324,11 +1346,13 @@ void Play_Main(GameState* thisx) { D_8012D1F8 = &this->state.input[0]; +#ifndef NO_DEBUG_DISPLAY DebugDisplay_Init(); +#endif PLAY_LOG(4556); - if (OOT_DEBUG && (R_HREG_MODE == HREG_MODE_PLAY) && (R_PLAY_INIT != HREG_MODE_PLAY)) { + if (IS_DEBUG && (R_HREG_MODE == HREG_MODE_PLAY) && (R_PLAY_INIT != HREG_MODE_PLAY)) { R_PLAY_RUN_UPDATE = true; R_PLAY_RUN_DRAW = true; R_PLAY_DRAW_SKYBOX = true; @@ -1346,7 +1370,7 @@ void Play_Main(GameState* thisx) { R_PLAY_INIT = HREG_MODE_PLAY; } - if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_UPDATE) { + if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_UPDATE) { Play_Update(this); } @@ -1801,7 +1825,7 @@ int Play_CamIsNotFixed(PlayState* this) { } int FrameAdvance_IsEnabled(PlayState* this) { - return !!this->frameAdvCtx.enabled; + return ARE_FRAMERATE_OPTIONS_ENABLED ? !!this->frameAdvCtx.enabled : false; } s32 func_800C0D34(PlayState* this, Actor* actor, s16* yaw) { diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 5fc1c4863..2ca9e9302 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -813,41 +813,94 @@ s32 Player_GetEnvironmentalHazard(PlayState* play) { return envHazard + 1; } -u8 sEyeMouthIndices[][2] = { - { 0, 0 }, { 1, 0 }, { 2, 0 }, { 0, 0 }, { 1, 0 }, { 2, 0 }, { 4, 0 }, { 5, 1 }, - { 7, 2 }, { 0, 2 }, { 3, 0 }, { 4, 0 }, { 2, 2 }, { 1, 1 }, { 0, 2 }, { 0, 0 }, +u8 sPlayerFaces[PLAYER_FACE_MAX][PLAYER_FACEPART_MAX] = { + // The first 6 faces defined must be default blinking faces. See relevant code in `Player_UpdateCommon`. + { PLAYER_EYES_OPEN, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL + { PLAYER_EYES_HALF, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_BLINKING_HALF + { PLAYER_EYES_CLOSED, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_BLINKING_CLOSED + + // This duplicate set of blinking faces is defined because Player will choose between the first and second set + // based on gameplayFrames. See relevant code in `Player_UpdateCommon`. + // This, in theory, allows for psuedo-random variance in the faces used. But in practice, duplicate faces are used. + { PLAYER_EYES_OPEN, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_2 + { PLAYER_EYES_HALF, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_BLINKING_HALF_2 + { PLAYER_EYES_CLOSED, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_BLINKING_CLOSED_2 + + // The rest of these faces go unused. Face data encoded within animations handles all other faces. + { PLAYER_EYES_RIGHT, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_LOOK_RIGHT + { PLAYER_EYES_WIDE, PLAYER_MOUTH_HALF }, // PLAYER_FACE_SURPRISED + { PLAYER_EYES_WINCING, PLAYER_MOUTH_OPEN }, // PLAYER_FACE_HURT + { PLAYER_EYES_OPEN, PLAYER_MOUTH_OPEN }, // PLAYER_FACE_GASP + { PLAYER_EYES_LEFT, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_LOOK_LEFT + { PLAYER_EYES_RIGHT, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_LOOK_RIGHT_2 + { PLAYER_EYES_CLOSED, PLAYER_MOUTH_OPEN }, // PLAYER_FACE_EYES_CLOSED_MOUTH_OPEN + { PLAYER_EYES_HALF, PLAYER_MOUTH_HALF }, // PLAYER_FACE_OPENING + { PLAYER_EYES_OPEN, PLAYER_MOUTH_OPEN }, // PLAYER_FACE_EYES_AND_MOUTH_OPEN + { PLAYER_EYES_OPEN, PLAYER_MOUTH_CLOSED }, // PLAYER_FACE_NEUTRAL_3 }; /** - * Link's eye and mouth textures are placed at the exact same place in adult and child Link's respective object files. + * Link's eyes and mouth textures are placed at the exact same place in adult and child Link's respective object files. * This allows the array to only contain the symbols for one file and have it apply to both. This is a problem for * shiftability, and changes will need to be made in the code to account for this in a modding scenario. The symbols * from adult Link's object are used here. */ #ifndef AVOID_UB -void* sEyeTextures[] = { - gLinkAdultEyesOpenTex, gLinkAdultEyesHalfTex, gLinkAdultEyesClosedfTex, gLinkAdultEyesRollLeftTex, - gLinkAdultEyesRollRightTex, gLinkAdultEyesShockTex, gLinkAdultEyesUnk1Tex, gLinkAdultEyesUnk2Tex, +void* sEyeTextures[PLAYER_EYES_MAX] = { + gLinkAdultEyesOpenTex, // PLAYER_EYES_OPEN + gLinkAdultEyesHalfTex, // PLAYER_EYES_HALF + gLinkAdultEyesClosedfTex, // PLAYER_EYES_CLOSED + gLinkAdultEyesLeftTex, // PLAYER_EYES_LEFT + gLinkAdultEyesRightTex, // PLAYER_EYES_RIGHT + gLinkAdultEyesWideTex, // PLAYER_EYES_WIDE + gLinkAdultEyesDownTex, // PLAYER_EYES_DOWN + gLinkAdultEyesWincingTex, // PLAYER_EYES_WINCING }; -void* sMouthTextures[] = { - gLinkAdultMouth1Tex, - gLinkAdultMouth2Tex, - gLinkAdultMouth3Tex, - gLinkAdultMouth4Tex, +void* sMouthTextures[PLAYER_MOUTH_MAX] = { + gLinkAdultMouthClosedTex, // PLAYER_MOUTH_CLOSED + gLinkAdultMouthHalfTex, // PLAYER_MOUTH_HALF + gLinkAdultMouthOpenTex, // PLAYER_MOUTH_OPEN + gLinkAdultMouthSmileTex, // PLAYER_MOUTH_SMILE }; #else // Defining `AVOID_UB` will use a 2D array instead and properly use the child link pointers to allow for shifting. -void* sEyeTextures[][8] = { - { gLinkAdultEyesOpenTex, gLinkAdultEyesHalfTex, gLinkAdultEyesClosedfTex, gLinkAdultEyesRollLeftTex, - gLinkAdultEyesRollRightTex, gLinkAdultEyesShockTex, gLinkAdultEyesUnk1Tex, gLinkAdultEyesUnk2Tex }, - { gLinkChildEyesOpenTex, gLinkChildEyesHalfTex, gLinkChildEyesClosedfTex, gLinkChildEyesRollLeftTex, - gLinkChildEyesRollRightTex, gLinkChildEyesShockTex, gLinkChildEyesUnk1Tex, gLinkChildEyesUnk2Tex }, +void* sEyeTextures[][PLAYER_EYES_MAX] = { + { + gLinkAdultEyesOpenTex, // PLAYER_EYES_OPEN + gLinkAdultEyesHalfTex, // PLAYER_EYES_HALF + gLinkAdultEyesClosedfTex, // PLAYER_EYES_CLOSED + gLinkAdultEyesLeftTex, // PLAYER_EYES_LEFT + gLinkAdultEyesRightTex, // PLAYER_EYES_RIGHT + gLinkAdultEyesWideTex, // PLAYER_EYES_WIDE + gLinkAdultEyesDownTex, // PLAYER_EYES_DOWN + gLinkAdultEyesWincingTex, // PLAYER_EYES_WINCING + }, + { + gLinkChildEyesOpenTex, // PLAYER_EYES_OPEN + gLinkChildEyesHalfTex, // PLAYER_EYES_HALF + gLinkChildEyesClosedfTex, // PLAYER_EYES_CLOSED + gLinkChildEyesLeftTex, // PLAYER_EYES_LEFT + gLinkChildEyesRightTex, // PLAYER_EYES_RIGHT + gLinkChildEyesWideTex, // PLAYER_EYES_WIDE + gLinkChildEyesDownTex, // PLAYER_EYES_DOWN + gLinkChildEyesWincingTex, // PLAYER_EYES_WINCING + }, }; -void* sMouthTextures[][4] = { - { gLinkAdultMouth1Tex, gLinkAdultMouth2Tex, gLinkAdultMouth3Tex, gLinkAdultMouth4Tex }, - { gLinkChildMouth1Tex, gLinkChildMouth2Tex, gLinkChildMouth3Tex, gLinkChildMouth4Tex }, +void* sMouthTextures[][PLAYER_MOUTH_MAX] = { + { + gLinkAdultMouthClosedTex, // PLAYER_MOUTH_CLOSED + gLinkAdultMouthHalfTex, // PLAYER_MOUTH_HALF + gLinkAdultMouthOpenTex, // PLAYER_MOUTH_OPEN + gLinkAdultMouthSmileTex, // PLAYER_MOUTH_SMILE + }, + { + gLinkChildMouthClosedTex, // PLAYER_MOUTH_CLOSED + gLinkChildMouthHalfTex, // PLAYER_MOUTH_HALF + gLinkChildMouthOpenTex, // PLAYER_MOUTH_OPEN + gLinkChildMouthSmileTex, // PLAYER_MOUTH_SMILE + }, }; #endif @@ -870,23 +923,31 @@ Gfx* sBootDListGroups[][2] = { void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, void* data) { Color_RGB8* color; - s32 eyeIndex = (jointTable[22].x & 0xF) - 1; - s32 mouthIndex = (jointTable[22].x >> 4) - 1; + s32 eyesIndex; + s32 mouthIndex; + + // Player's animation data includes eyes and mouth indices for which texture to use on a given frame. + // Despite being accessed as "the x component of the 22nd limb", the eyes and mouth indices are stored in 2 + // additional bytes tacked onto the end of the limb rotation data for a given animation frame. + eyesIndex = (jointTable[22].x & 0xF) - 1; + mouthIndex = (jointTable[22].x >> 4) - 1; OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 1721); - if (eyeIndex < 0) { - eyeIndex = sEyeMouthIndices[face][0]; + // If the eyes index provided by the animation is negative, use the value provided by the `face` argument instead + if (eyesIndex < 0) { + eyesIndex = sPlayerFaces[face][PLAYER_FACEPART_EYES]; } #ifndef AVOID_UB - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[eyeIndex])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[eyesIndex])); #else - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[gSaveContext.save.linkAge][eyeIndex])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[gSaveContext.save.linkAge][eyesIndex])); #endif + // If the mouth index provided by the animation is negative, use the value provided by the `face` argument instead if (mouthIndex < 0) { - mouthIndex = sEyeMouthIndices[face][1]; + mouthIndex = sPlayerFaces[face][PLAYER_FACEPART_MOUTH]; } #ifndef AVOID_UB @@ -1758,7 +1819,10 @@ void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject, G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); gSPLoadGeometryMode(POLY_OPA_DISP++, G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH); gDPSetScissor(POLY_OPA_DISP++, G_SC_NON_INTERLACE, 0, 0, width, height); - gSPClipRatio(POLY_OPA_DISP++, FRUSTRATIO_1); + + if (!ENABLE_F3DEX3_RECOMMENDATIONS) { + gSPClipRatio(POLY_OPA_DISP++, FRUSTRATIO_1); + } gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, depthFrameBuffer); gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL); @@ -1810,8 +1874,8 @@ void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject, gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList); - Player_DrawImpl(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0, - Player_OverrideLimbDrawPause, NULL, &playerSwordAndShield); + Player_DrawImpl(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, + PLAYER_FACE_NEUTRAL, Player_OverrideLimbDrawPause, NULL, &playerSwordAndShield); gSPEndDisplayList(POLY_OPA_DISP++); gSPEndDisplayList(POLY_XLU_DISP++); diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 946a786b8..f50a22234 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -818,7 +818,9 @@ Gfx sFillSetupDL[] = { gsSPLoadGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH), gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), gsDPSetBlendColor(0, 0, 0, 8), +#if !ENABLE_F3DEX3_RECOMMENDATIONS gsSPClipRatio(FRUSTRATIO_2), +#endif gsSPEndDisplayList(), }; @@ -1246,23 +1248,33 @@ Gfx* Gfx_SetupDL_69NoCD(Gfx* gfx) { return gfx; } +#if IS_DEBUG +#define HREG_21 HREG(21) +#define HREG_22 HREG(22) +#else +#define HREG_21 0 +#define HREG_22 0 +#endif + Gfx* func_800947AC(Gfx* gfx) { gSPDisplayList(gfx++, sSetupDL[SETUPDL_65]); gDPSetColorDither(gfx++, G_CD_DISABLE); // clang-format off - switch (HREG(21)) { + switch (HREG_21) { case 1: gDPSetAlphaDither(gfx++, G_AD_DISABLE); break; case 2: gDPSetAlphaDither(gfx++, G_AD_PATTERN); break; case 3: gDPSetAlphaDither(gfx++, G_AD_NOTPATTERN); break; case 4: gDPSetAlphaDither(gfx++, G_AD_NOISE); break; + default: break; } - switch (HREG(22)) { + switch (HREG_22) { case 1: gDPSetColorDither(gfx++, G_CD_DISABLE); break; case 2: gDPSetColorDither(gfx++, G_CD_MAGICSQ); break; case 3: gDPSetColorDither(gfx++, G_CD_BAYER); break; case 4: gDPSetColorDither(gfx++, G_CD_NOISE); break; + default: break; } // clang-format on @@ -1472,6 +1484,7 @@ void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) { if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTransitionTileState <= TRANS_TILE_SETUP)) { s32 letterboxSize = Letterbox_GetSize(); +#if IS_DEBUG if (R_HREG_MODE == HREG_MODE_SETUP_FRAME) { if (R_SETUP_FRAME_INIT != HREG_MODE_SETUP_FRAME) { R_SETUP_FRAME_GET = (SETUP_FRAME_LETTERBOX_SIZE_FLAG | SETUP_FRAME_BASE_COLOR_FLAG); @@ -1514,6 +1527,7 @@ void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) { b = R_SETUP_FRAME_BASE_COLOR_B; } } +#endif // Set the whole z buffer to maximum depth // Don't bother with pixels that are being covered by the letterbox diff --git a/src/code/z_room.c b/src/code/z_room.c index 9c16a53b6..6a6dae900 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -14,7 +14,9 @@ Gfx D_801270B0[] = { G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2), gsSPLoadGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH), gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), +#if !ENABLE_F3DEX3_RECOMMENDATIONS gsSPClipRatio(FRUSTRATIO_1), +#endif gsSPEndDisplayList(), }; diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index d3dc09751..383098031 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -1490,7 +1490,6 @@ void Scene_DrawConfigJabuJabu(PlayState* play) { gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); if (FrameAdvance_IsEnabled(play) != true) { - D_8012A39C += 1820; D_8012A3A0 += 1820; @@ -1652,7 +1651,7 @@ void (*sSceneDrawConfigs[SDC_MAX])(PlayState*) = { }; void Scene_Draw(PlayState* play) { - if ((R_HREG_MODE == HREG_MODE_SCENE_CONFIG) && OOT_DEBUG) { + if ((R_HREG_MODE == HREG_MODE_SCENE_CONFIG) && IS_DEBUG) { if (R_SCENE_CONFIG_INIT != HREG_MODE_SCENE_CONFIG) { R_SCENE_CONFIG_INIT = HREG_MODE_SCENE_CONFIG; R_SCENE_CONFIG_DRAW_DEFAULT_DLIST = 1; diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 4be3f6735..42dfa4e9b 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -152,6 +152,7 @@ void SkelAnime_DrawFlexLimbLod(PlayState* play, s32 limbIndex, void** skeleton, } (*mtx)++; } else if (limbDList != NULL) { + if (1) {} MATRIX_TO_MTX(*mtx, "../z_skelanime.c", 954); (*mtx)++; } @@ -366,6 +367,7 @@ void SkelAnime_DrawFlexLimbOpa(PlayState* play, s32 limbIndex, void** skeleton, gSPDisplayList(POLY_OPA_DISP++, newDList); (*limbMatrices)++; } else if (limbDList != NULL) { + if (1) {} MATRIX_TO_MTX(*limbMatrices, "../z_skelanime.c", 1249); (*limbMatrices)++; } @@ -467,7 +469,7 @@ void SkelAnime_GetFrameData(AnimationHeader* animation, s32 frame, s32 limbCount u16 staticIndexMax = animHeader->staticIndexMax; s32 i; - for (i = 0; i < limbCount; i++, frameTable++, jointIndices++) { + for (i = 0; i < limbCount; i++) { if ((frameTable == NULL) || (jointIndices == NULL) || (dynamicData == NULL) || (staticData == NULL)) { LOG_ADDRESS("out", frameTable, "../z_skelanime.c", 1392); LOG_ADDRESS("ref_tbl", jointIndices, "../z_skelanime.c", 1393); @@ -481,6 +483,8 @@ void SkelAnime_GetFrameData(AnimationHeader* animation, s32 frame, s32 limbCount (jointIndices->y >= staticIndexMax) ? dynamicData[jointIndices->y] : staticData[jointIndices->y]; frameTable->z = (jointIndices->z >= staticIndexMax) ? dynamicData[jointIndices->z] : staticData[jointIndices->z]; + jointIndices++; + frameTable++; } } @@ -1024,10 +1028,11 @@ void AnimationContext_Update(PlayState* play, AnimationContext* animationCtx) { AnimationContext_LoadFrame, AnimationContext_CopyAll, AnimationContext_Interp, AnimationContext_CopyTrue, AnimationContext_CopyFalse, AnimationContext_MoveActor, }; - AnimationEntry* entry; + AnimationEntry* entry = animationCtx->entries; - for (entry = animationCtx->entries; animationCtx->animationCount != 0; entry++, animationCtx->animationCount--) { + for (; animationCtx->animationCount != 0; animationCtx->animationCount--) { animFuncs[entry->type](play, &entry->data); + entry++; } sAnimQueueFlags = 1; diff --git a/src/code/z_sram.c b/src/code/z_sram.c index d5d72a664..405fa786f 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -511,8 +511,7 @@ void Sram_WriteSave(SramContext* sramCtx) { gSaveContext.save.info.checksum = 0; ptr = (u16*)&gSaveContext; - checksum = 0; - j = 0; + checksum = j = 0; for (offset = 0; offset < CHECKSUM_SIZE; offset++) { if (++j == 0x20) { @@ -612,12 +611,15 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt bzero(&gSaveContext.save.entranceIndex, sizeof(s32)); bzero(&gSaveContext.save.linkAge, sizeof(s32)); bzero(&gSaveContext.save.cutsceneIndex, sizeof(s32)); - // note that gSaveContext.save.dayTime is not actually the sizeof(s32) + //! @bug gSaveContext.save.dayTime is a u16 but is cleared as a 32-bit value. This is harmless as-is + //! since it is followed by nightFlag which is also reset here, but can become an issue if the save + //! layout is changed. bzero(&gSaveContext.save.dayTime, sizeof(s32)); bzero(&gSaveContext.save.nightFlag, sizeof(s32)); bzero(&gSaveContext.save.totalDays, sizeof(s32)); bzero(&gSaveContext.save.bgsDayCount, sizeof(s32)); +#if IS_DEBUG if (!slotNum) { Sram_InitDebugSave(); gSaveContext.save.info.playerData.newf[0] = 'Z'; @@ -633,6 +635,9 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt } else { Sram_InitNewSave(); } +#else + Sram_InitNewSave(); +#endif ptr = (u16*)&gSaveContext; PRINTF("\n--------------------------------------------------------------\n"); @@ -718,20 +723,26 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) { u16* ptr; u16 checksum; +#if IS_DEBUG_SAVE_ENABLED if (fileSelect->buttonIndex != 0) { Sram_InitNewSave(); } else { Sram_InitDebugSave(); } +#else + Sram_InitNewSave(); +#endif gSaveContext.save.entranceIndex = ENTR_LINKS_HOUSE_0; gSaveContext.save.linkAge = LINK_AGE_CHILD; gSaveContext.save.dayTime = CLOCK_TIME(10, 0); gSaveContext.save.cutsceneIndex = 0xFFF1; +#if IS_DEBUG if (fileSelect->buttonIndex == 0) { gSaveContext.save.cutsceneIndex = 0; } +#endif for (offset = 0; offset < 8; offset++) { gSaveContext.save.info.playerData.playerName[offset] = fileSelect->fileNames[fileSelect->buttonIndex][offset]; @@ -753,10 +764,8 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) { PRINTF("\n$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n"); ptr = (u16*)&gSaveContext; - j = 0; - checksum = 0; - for (offset = 0; offset < CHECKSUM_SIZE; offset++) { + for (j = 0, checksum = 0, offset = 0; offset < CHECKSUM_SIZE; offset++) { PRINTF("%x ", *ptr); checksum += *ptr++; if (++j == 0x20) { @@ -893,6 +902,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { Sram_WriteSramHeader(sramCtx); } +#if IS_DEBUG if (CHECK_BTN_ANY(gameState->input[2].cur.button, BTN_DRIGHT)) { bzero(sramCtx->readBuff, SRAM_SIZE); for (i = 0; i < CHECKSUM_SIZE; i++) { @@ -901,6 +911,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_WRITE); PRINTF("SRAM破壊ï¼ï¼ï¼ï¼ï¼ï¼\n"); // "SRAM destruction! ! ! ! ! !" } +#endif // "GOOD! GOOD! Size = %d + %d = %d" PRINTF("GOODï¼ï¼§ï¼¯ï¼¯ï¼¤ï¼ サイズï¼%d + %d ï¼ %d\n", sizeof(SaveInfo), 4, sizeof(SaveInfo) + 4); diff --git a/src/code/z_ss_sram.c b/src/code/z_ss_sram.c index 8feef8ad1..75c61539a 100644 --- a/src/code/z_ss_sram.c +++ b/src/code/z_ss_sram.c @@ -9,7 +9,7 @@ typedef struct { SsSramContext sSsSramContext = { 0 }; -void SsSram_Init(u32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration, +void SsSram_Init(s32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration, u8 handlePulse, u32 handleSpeed) { u32 prevInt; OSPiHandle* handle = &sSsSramContext.piHandle; @@ -49,7 +49,7 @@ void SsSram_Dma(void* dramAddr, size_t size, s32 direction) { osInvalDCache(dramAddr, size); } -void SsSram_ReadWrite(u32 addr, void* dramAddr, size_t size, s32 direction) { +void SsSram_ReadWrite(s32 addr, void* dramAddr, size_t size, s32 direction) { PRINTF("ssSRAMReadWrite:%08x %08x %08x %d\n", addr, dramAddr, size, direction); SsSram_Init(addr, DEVICE_TYPE_SRAM, PI_DOMAIN2, 5, 0xD, 2, 0xC, 0); SsSram_Dma(dramAddr, size, direction); diff --git a/src/code/z_view.c b/src/code/z_view.c index 7ed124742..36a205497 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -312,11 +312,11 @@ s32 View_ApplyPerspective(View* view) { LOG_UTILS_CHECK_NULL_POINTER("projection", projection, "../z_view.c", 616); view->projectionPtr = projection; - width = view->viewport.rightX - view->viewport.leftX; + width = WIDE_MULT((view->viewport.rightX - view->viewport.leftX), WIDE_GET_4_3); height = view->viewport.bottomY - view->viewport.topY; aspect = (f32)width / (f32)height; - if (OOT_DEBUG && R_HREG_MODE == HREG_MODE_PERSPECTIVE) { + if (IS_DEBUG && R_HREG_MODE == HREG_MODE_PERSPECTIVE) { if (R_PERSPECTIVE_INIT != HREG_MODE_PERSPECTIVE) { R_PERSPECTIVE_INIT = HREG_MODE_PERSPECTIVE; R_PERSPECTIVE_FOVY = 60; @@ -331,7 +331,7 @@ s32 View_ApplyPerspective(View* view) { guPerspective(projection, &view->normal, view->fovy, aspect, view->zNear, view->zFar, view->scale); } -#if OOT_DEBUG +#if IS_DEBUG if (QREG(88) & 1) { s32 i; MtxF mf; @@ -375,7 +375,7 @@ s32 View_ApplyPerspective(View* view) { view->viewing = *viewing; -#if OOT_DEBUG +#if IS_DEBUG // Debug print view matrix if (QREG(88) & 2) { s32 i; @@ -440,6 +440,7 @@ s32 View_ApplyOrthoToOverlay(View* view) { GraphicsContext* gfxCtx = view->gfxCtx; Vp* vp; Mtx* projection; + s32 width; OPEN_DISPS(gfxCtx, "../z_view.c", 777); @@ -457,8 +458,10 @@ s32 View_ApplyOrthoToOverlay(View* view) { LOG_UTILS_CHECK_NULL_POINTER("projection", projection, "../z_view.c", 791); view->projectionPtr = projection; - guOrtho(projection, -(f32)gScreenWidth * 0.5f, (f32)gScreenWidth * 0.5f, -(f32)gScreenHeight * 0.5f, - (f32)gScreenHeight * 0.5f, view->zNear, view->zFar, view->scale); + // scales beating heart, inventory item change and minimap arrows properly + width = WIDE_MULT(gScreenWidth, WIDE_GET_4_3); + guOrtho(projection, -(f32)width * 0.5f, (f32)width * 0.5f, -(f32)gScreenHeight * 0.5f, (f32)gScreenHeight * 0.5f, + view->zNear, view->zFar, view->scale); view->projection = *projection; @@ -499,7 +502,8 @@ s32 View_ApplyPerspectiveToOverlay(View* view) { LOG_UTILS_CHECK_NULL_POINTER("projection", projection, "../z_view.c", 833); view->projectionPtr = projection; - width = view->viewport.rightX - view->viewport.leftX; + // rescale the A button/icon properly + width = WIDE_MULT((view->viewport.rightX - view->viewport.leftX), WIDE_GET_4_3); height = view->viewport.bottomY - view->viewport.topY; aspect = (f32)width / (f32)height; @@ -624,7 +628,7 @@ s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP) { return 1; } -#if OOT_DEBUG +#if IS_DEBUG /** * Logs an error and returns nonzero if camera is too far from the origin. */ diff --git a/src/code/z_viszbuf.c b/src/code/z_viszbuf.c index 90080b79c..3e9f15eb5 100644 --- a/src/code/z_viszbuf.c +++ b/src/code/z_viszbuf.c @@ -47,14 +47,18 @@ extern u16 D_0E000000[]; void VisZBuf_Init(VisZBuf* this) { this->vis.type = VIS_ZBUF_TYPE_IA; this->vis.scissorType = VIS_NO_SETSCISSOR; + this->vis.primColor.r = 255; this->vis.primColor.g = 255; this->vis.primColor.b = 255; this->vis.primColor.a = 255; + + // clang-format off + this->vis.envColor.r = 0; \ + this->vis.envColor.g = 0; \ + this->vis.envColor.b = 0; \ this->vis.envColor.a = 255; - this->vis.envColor.r = 0; - this->vis.envColor.g = 0; - this->vis.envColor.b = 0; + // clang-format on } void VisZBuf_Destroy(VisZBuf* this) { diff --git a/src/compression/aplib.c b/src/compression/aplib.c new file mode 100644 index 000000000..9c199ba70 --- /dev/null +++ b/src/compression/aplib.c @@ -0,0 +1,220 @@ +/* adapted from aPLib's depack.c */ + +/* + * aPLib compression library - the smaller the better :) + * + * C depacker + * + * Copyright (c) 1998-2014 Joergen Ibsen + * All Rights Reserved + * + * http://www.ibsensoftware.com/ + */ +#include "compression.h" + +static struct decoder dec; + +/* block copy, with desired overlapping behavior */ +static void* ocopy(void* _src, void* _dst, unsigned n) { + unsigned char* src = _src; + unsigned char* dst = _dst; + + do { + *dst++ = *src++; + } while (--n); + + return dst; +} + +struct decoder { + unsigned char buf[1024]; /* intermediate buffer for loading */ + unsigned char* buf_end; /* pointer that exists for the sole * + * purpose of getting size of `buf` */ + unsigned int pstart; /* offset of next read from rom */ + unsigned int remaining; /* remaining size of file */ + unsigned char* buf_limit; /* points to end of scannable area * + * of buf; this prevents yaz parser * + * from overflowing */ +#if MAJORA + unsigned char* dst_end; /* end of decompressed block */ +#endif +}; +static void* refill(unsigned char* ip) { + unsigned offset; + unsigned size; + + /* intermediate buffer is not yet due for a refill */ + if (ip < dec.buf_end - 8) { + return ip; + } + + /* the number 8 is used throughout to ensure * + * dma transfers are always 8 byte aligned */ + offset = dec.buf_end - ip; + size = sizeof(dec.buf) - 8; + + /* the last eight bytes wrap around */ + ocopy(dec.buf_end - 8, dec.buf, 8); + + /* transfer data from rom */ + DmaMgr_DmaRomToRam(dec.pstart, dec.buf + 8, size); + dec.pstart += size; + + return dec.buf + (8 - offset); +} + +/* internal data structure */ +struct APDSTATE { + unsigned char* source; + unsigned char* destination; + unsigned int tag; + unsigned int bitcount; +}; + +static unsigned int aP_getbit(struct APDSTATE* ud) { + unsigned int bit; + + /* check if tag is empty */ + if (!ud->bitcount--) { + /* load next tag */ + ud->tag = *ud->source++; + ud->bitcount = 7; + } + + /* shift bit out of tag */ + bit = (ud->tag >> 7) & 0x01; + ud->tag <<= 1; + + return bit; +} + +static unsigned int aP_getgamma(struct APDSTATE* ud) { + unsigned int result = 1; + + /* input gamma2-encoded bits */ + do { + result = (result << 1) + aP_getbit(ud); + } while (aP_getbit(ud)); + + return result; +} + +static inline void* aP_depack(void* source, unsigned char* destination) { + struct APDSTATE ud; + unsigned int offs, len, R0, LWM; + int done; + int i; + + ud.source = source; + ud.bitcount = 0; + + R0 = (unsigned int)-1; + LWM = 0; + done = 0; + + /* initial buffer fill */ + ud.source = refill(ud.source); + + /* skip header */ + ud.source += 8; + + /* first byte verbatim */ + *destination++ = *ud.source++; + + /* main decompression loop */ + while (!done) { + ud.source = refill(ud.source); + if (aP_getbit(&ud)) { + if (aP_getbit(&ud)) { + if (aP_getbit(&ud)) { + offs = 0; + + for (i = 4; i; i--) { + offs = (offs << 1) + aP_getbit(&ud); + } + + if (offs) { + *destination = *(destination - offs); + destination++; + } else { + *destination++ = 0x00; + } + + LWM = 0; + } else { + offs = *ud.source++; + + len = 2 + (offs & 0x0001); + + offs >>= 1; + + if (offs) { + for (; len; len--) { + *destination = *(destination - offs); + destination++; + } + } else { + done = 1; + } + + R0 = offs; + LWM = 1; + } + } else { + offs = aP_getgamma(&ud); + + if ((LWM == 0) && (offs == 2)) { + offs = R0; + + len = aP_getgamma(&ud); + + for (; len; len--) { + *destination = *(destination - offs); + destination++; + } + } else { + if (LWM == 0) { + offs -= 3; + } else { + offs -= 2; + } + + offs <<= 8; + offs += *ud.source++; + + len = aP_getgamma(&ud); + + if (offs >= 32000) { + len++; + } + if (offs >= 1280) { + len++; + } + if (offs < 128) { + len += 2; + } + + for (; len; len--) { + *destination = *(destination - offs); + destination++; + } + + R0 = offs; + } + + LWM = 1; + } + } else { + *destination++ = *ud.source++; + LWM = 0; + } + } + + return destination; +} + +void Aplib_Decompress(unsigned rom, unsigned char* dst, unsigned compSz) { + dec.pstart = rom; + dec.buf_end = dec.buf + sizeof(dec.buf); + dst = aP_depack(dec.buf_end, dst); +} diff --git a/src/compression/lzo.c b/src/compression/lzo.c new file mode 100644 index 000000000..5fe4d19c3 --- /dev/null +++ b/src/compression/lzo.c @@ -0,0 +1,220 @@ +#include "compression.h" + +/* adapted from lzo1x_d.ch */ + +/* negative indexing distance */ +#define NINDEX 2 + +/* lzo max negative offset */ +#define M2_MAX_OFFSET 0x0800 + +struct decoder { + unsigned char buf[1024]; /* intermediate buffer for loading */ + unsigned char* buf_end; /* pointer that exists for the sole * + * purpose of getting size of `buf` */ + unsigned int pstart; /* offset of next read from rom */ + unsigned int remaining; /* remaining size of file */ + unsigned char* buf_limit; /* points to end of scannable area * + * of buf; this prevents yaz parser * + * from overflowing */ +#if MAJORA + unsigned char* dst_end; /* end of decompressed block */ +#endif +}; + +static struct decoder dec; + +/* block copy, with desired overlapping behavior */ +static void* ocopy(void* _src, void* _dst, unsigned n) { + unsigned char* src = _src; + unsigned char* dst = _dst; + + do { + *dst++ = *src++; + } while (--n); + + return dst; +} + +/* refill intermediate buffer if necessary */ +static unsigned char* refill(unsigned char* ip) { + unsigned offset; + unsigned size; + int align; + + /* intermediate buffer is not yet due for a refill */ + if (ip < dec.buf_end - 32) { + return ip; + } + + ip -= NINDEX; + + /* the weird alignment stuff ensures dma * + * transfers are always 8 byte aligned */ + offset = dec.buf_end - ip; + align = 8 - (offset & 7); + offset += align; + size = sizeof(dec.buf) - offset; + + /* the last bytes wrap around */ + ocopy(dec.buf_end - offset, dec.buf, offset); + ip = dec.buf + align + NINDEX; + + /* transfer data from rom */ + DmaMgr_DmaRomToRam(dec.pstart, dec.buf + offset, size); + dec.pstart += size; + + return ip; +} + +void LZO_Decompress(unsigned int pstart /* physical rom offset of file */ + , + unsigned char* op /* destination of decompressed data */ + , + unsigned int sz /* size of compressed file */ +) { + unsigned char* m_pos; + unsigned char* ip; + int t; + + dec.pstart = pstart; + dec.buf_end = dec.buf + sizeof(dec.buf); + ip = dec.buf_end; + + /* initial buffer fill */ + ip = refill(ip); + + /* skip header */ + ip += 8; + + if (*ip > 17) { + t = *ip++ - 17; + if (t < 4) { + goto match_next; + } + op = ocopy(ip, op, t); + ip += t; + goto first_literal_run; + } + + for (;;) { + t = *ip++; + if (t >= 16) { + goto match; + } + /* a literal run */ + if (t == 0) { + while (*ip == 0) { + t += 255; + ip++; + } + t += 15 + *ip++; + } + /* copy literals */ + { + t += 3; + /* this loop can advance any number of bytes (4k+) */ + do { + /* ensure buffer contains data */ + ip = refill(ip); + + *op++ = *ip++; + } while (--t); + } + + first_literal_run: + t = *ip++; + if (t >= 16) { + goto match; + } + m_pos = op - (1 + M2_MAX_OFFSET); + m_pos -= t >> 2; + m_pos -= ip[0] << 2; + ip++; + + op = ocopy(m_pos, op, 3); + goto match_done; + + /* handle matches */ + for (;;) { + match: + m_pos = op - 1; + + if (t >= 64) /* M2 match */ + { + m_pos -= (t >> 2) & 7; + m_pos -= ip[0] << 3; + ip++; + t = (t >> 5) - 1; + } else if (t >= 32) /* M3 match */ + { + t &= 31; + + /* this never advances more than 8 bytes */ + if (t == 0) { + while (*ip == 0) { + t += 255; + ip++; + } + t += 31 + *ip++; + } + m_pos -= (ip[0] >> 2) + (ip[1] << 6); + ip += 2; + } else if (t >= 16) /* a M4 match */ + { + m_pos++; + m_pos -= (t & 8) << 11; + t &= 7; + + /* this never advances more than 8 bytes */ + if (t == 0) { + while (*ip == 0) { + t += 255; + ip++; + } + t += 7 + *ip++; + } + m_pos -= (ip[0] >> 2) + (ip[1] << 6); + /* end of compressed file */ + if (m_pos == op) { + goto L_done; + } + m_pos -= 0x4000; + ip += 2; + } else /* a M1 match */ + { + m_pos -= t >> 2; + m_pos -= ip[0] << 2; + ip += 1; + op = ocopy(m_pos, op, 2); + goto match_done; + } + + /* copy match */ + t += 2; + op = ocopy(m_pos, op, t); + + match_done: + /* ensure buffer contains data */ + ip = refill(ip); + t = ip[-NINDEX] & 3; + if (t == 0) { + break; + } + + /* copy literals */ + /* this never advances more than 4 bytes */ + match_next: + op = ocopy(ip, op, t); + ip += t; + t = *ip++; + } + } +L_done: + do { + } while (0); +#if MAJORA + dec.dst_end = op; + dec.buf_end = 0; +#endif +} diff --git a/src/boot/yaz0.c b/src/compression/yaz0.c similarity index 97% rename from src/boot/yaz0.c rename to src/compression/yaz0.c index 448ab3835..2f4701ccd 100644 --- a/src/boot/yaz0.c +++ b/src/compression/yaz0.c @@ -1,6 +1,7 @@ #include "global.h" +#include "compression.h" -u8 sYaz0DataBuffer[0x400]; +ALIGNED(16) u8 sYaz0DataBuffer[0x400]; u8* sYaz0DataBufferEnd; uintptr_t sYaz0CurRomStart; size_t sYaz0CurSize; diff --git a/src/dmadata/dmadata.c b/src/dmadata/dmadata.c index 20740d271..93ea2b4d3 100644 --- a/src/dmadata/dmadata.c +++ b/src/dmadata/dmadata.c @@ -10,8 +10,12 @@ #undef DEFINE_DMA_ENTRY // dmadata Table definition -#define DEFINE_DMA_ENTRY(name, _1) \ - { (uintptr_t)_##name##SegmentRomStart, (uintptr_t)_##name##SegmentRomEnd, (uintptr_t)_##name##SegmentRomStart, 0 }, +#define DEFINE_DMA_ENTRY(name, _1) \ + { \ + ROM_FILE(name), \ + (uintptr_t)_##name##SegmentRomStart, \ + 0, \ + }, DmaEntry gDmaDataTable[] = { #include "tables/dmadata_table.h" diff --git a/src/gcc_fix/missing_gcc_functions.c b/src/gcc_fix/missing_gcc_functions.c index b4d87a892..b95556937 100644 --- a/src/gcc_fix/missing_gcc_functions.c +++ b/src/gcc_fix/missing_gcc_functions.c @@ -10,10 +10,10 @@ // Self-hosted libc memory functions, gcc assumes these exist even in a freestanding // environment and there is no way to tell it otherwise. -int memcmp(void* s1, const void* s2, size_t n) { - u8* m1 = (u8*)s1; - u8* m2 = (u8*)s2; - u32 i; +int memcmp(const void* s1, const void* s2, size_t n) { + const u8* m1 = s1; + const u8* m2 = s2; + size_t i; for (i = 0; i < n; i++) { if (m1[i] < m2[i]) { @@ -26,17 +26,38 @@ int memcmp(void* s1, const void* s2, size_t n) { return 0; } -void* memset(void* str, s32 c, size_t n) { - u8* m1 = (u8*)str; - u32 i; +void* memset(void* str, int c, size_t n) { + u8* m = str; + size_t i; for (i = 0; i < n; i++) { - m1[i] = c; + m[i] = c; } return str; } +void* memmove(void* dest, const void* src, size_t len) { + u8* d = dest; + const u8* s = src; + + if (d == s) { + return dest; + } + if (d < s) { + while (len--) { + *d++ = *s++; + } + } else { + d += len - 1; + s += len - 1; + while (len--) { + *d-- = *s--; + } + } + return dest; +} + // Conversions involving 64-bit integer types required by the O32 MIPS ABI. // f32 -> u64, negative values become 0 diff --git a/src/libultra/gu/lookathil.c b/src/libultra/gu/lookathil.c index d1070b579..b0fbc57ea 100644 --- a/src/libultra/gu/lookathil.c +++ b/src/libultra/gu/lookathil.c @@ -106,6 +106,8 @@ void guLookAtHiliteF(f32 mf[4][4], LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 l->l[1].l.dir[0] = FTOFRAC8(xUp); l->l[1].l.dir[1] = FTOFRAC8(yUp); l->l[1].l.dir[2] = FTOFRAC8(zUp); + +#if !ENABLE_F3DEX3 l->l[0].l.col[0] = 0x00; l->l[0].l.col[1] = 0x00; l->l[0].l.col[2] = 0x00; @@ -122,6 +124,7 @@ void guLookAtHiliteF(f32 mf[4][4], LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 l->l[1].l.colc[1] = 0x80; l->l[1].l.colc[2] = 0x00; l->l[1].l.pad2 = 0x00; +#endif mf[0][0] = xRight; mf[1][0] = yRight; diff --git a/src/libultra/os/getmemsize.c b/src/libultra/os/getmemsize.c index 787346de6..2c3317c2b 100644 --- a/src/libultra/os/getmemsize.c +++ b/src/libultra/os/getmemsize.c @@ -9,7 +9,7 @@ u32 osGetMemSize(void) { u32 data1; while (size < 0x800000) { - ptr = (vu32*)(K1BASE + size); + ptr = OS_PHYSICAL_TO_K1(size); data0 = *ptr; data1 = ptr[STEP / 4 - 1]; diff --git a/src/makerom/rom_header.h b/src/makerom/rom_header.h new file mode 100644 index 000000000..1069ae86f --- /dev/null +++ b/src/makerom/rom_header.h @@ -0,0 +1,145 @@ +#ifndef ROM_HEADER_H +#define ROM_HEADER_H + +/* Storage medium IDs, used internally in MEDIUM below */ + +#define STORAGE_MEDIUM_CARTRIDGE "N" +#define STORAGE_MEDIUM_CARTRIDGE_EXPANDABLE "C" +#define STORAGE_MEDIUM_DISK "D" +#define STORAGE_MEDIUM_DISK_EXPANSION "E" + +/* Region IDs, used internally in REGION below */ + +#define REGION_CODE_ALL "A" +#define REGION_CODE_JP "J" +#define REGION_CODE_US "E" +#define REGION_CODE_PAL "P" +#define REGION_CODE_GATEWAY "G" +#define REGION_CODE_LODGENET "L" + +/** + * Magic value to determine if the ROM is byteswapped. + * + * This is not totally reliable since the PI Domain 1 Latency could also hold this value, however generally it can be + * assumed that this is not the case. + */ +#define ENDIAN_IDENTIFIER \ + .byte 0x80 + +/** + * Configures the timings for PI Domain 1. This determines how fast the PI hardware will read from the ROM. IPL2 reads + * this configuration using the slowest possible configuration before switching to the provided configuration. + */ +#define PI_DOMAIN_1_CFG(lat, pwd, pgs, rls) \ + .byte (((rls) & 3) << 4) | ((pgs) & 0xF); \ + .byte (pwd) & 0xFF; \ + .byte (lat) & 0xFF + +/** + * Some older libultra versions use this field to set osClockRate. It does not have any other meaningful effect, the + * clock rate of physical units does not actually change to match this value. + */ +#define SYSTEM_CLOCK_RATE_SETTING(num) \ + .word (num) + +/** + * Indicates the entrypoint address of the program that IPL3 will load the boot segment to and execute. + * This should be >= 0x80000400. + */ +#define ENTRYPOINT(sym) \ + .word (sym) + +/** + * Indicates the hardware revision the program is designed for (hw_major, hw_minor) + * and what libultra version (os_ver) it uses. + * + * The hardware revision for a retail N64 is (2,0). + * The libultra version may be a single letter, without quotes. + */ +#define LIBULTRA_VERSION(hw_major, hw_minor, os_ver) \ + .half 0; \ + .byte (hw_major) * 10 + (hw_minor); \ + _os_ver_start = .; \ + .ascii #os_ver ; \ + .if (. - _os_ver_start) != 1; \ + .error "OS version should be just one letter"; \ + .endif + +/** + * Leaves space to insert the ROM Checksum value. IPL3 computes a checksum over ROM data in the range 0x1000 to 0x101000 + * and compares it to this value, if the results differ it will refuse to boot the program. + * + * This macro just writes 8 bytes of 0. The correct checksum value is filled in after the full ROM image is available to + * compute the checksum with. + */ +#define CHECKSUM() \ + .word 0, 0 + +/** + * For unused header space. Fills num bytes with 0. + */ +#define PADDING(num) \ + .fill (num) + +/** + * Defines the ROM name. This should be a string that is at most 20 characters long, a null terminator is not required. + * If a name is less than 20 characters, the remaining space will be padded with spaces. + */ +#define ROM_NAME(name) \ + _name_start = .; \ + .ascii name; \ + .if (. - _name_start) > 20; \ + .error "ROM name too long, must be at most 20 characters"; \ + .endif; \ + .if (. - _name_start) < 20; \ + .fill 20 - (. - _name_start), 1, 0x20; \ + .endif + +/** + * Identifies the storage medium the program intends to use. + * + * Should be one of: + * - CARTRIDGE + * - CARTRIDGE_EXPANDABLE + * - DISK + * - DISK_EXPANSION + */ +#define MEDIUM(type) \ + .ascii STORAGE_MEDIUM_##type + +/** + * Two-letter game identifier. Should be wrapped in quotes. + */ +#define GAME_ID(id) \ + _game_id_start = .; \ + .ascii id ; \ + .if (. - _game_id_start) != 2; \ + .error "Game ID should be two letters"; \ + .endif + +/** + * Identifies the region the game is made for. + * + * Should be one of: + * - ALL + * - JP + * - US + * - PAL + * - GATEWAY + * - LODGENET + * + * Note: Often flashcarts and emulators will read this value to determine whether to act as an NTSC or PAL system and + * will adjust the VI timings appropriately, which may be used to determine target FPS. + * This can lead to glitchy video output on hardware if the program configures a video mode other than the native + * video mode for the hardware version. + */ +#define REGION(name) \ + .ascii REGION_CODE_##name + +/** + * Identifies the game revision number. Can be between 0 and 255. + */ +#define GAME_REVISION(num) \ + .byte (num) + +#endif diff --git a/src/makerom/rom_header.s b/src/makerom/rom_header.s index 883b8b0ab..ba0bea54b 100644 --- a/src/makerom/rom_header.s +++ b/src/makerom/rom_header.s @@ -1,18 +1,26 @@ -/* - * The Legend of Zelda: Ocarina of Time ROM header - */ +#include "rom_header.h" -.byte 0x80, 0x37, 0x12, 0x40 /* PI BSD Domain 1 register */ -.word 0x0000000F /* Clockrate setting */ -.word 0x80000400 /* Entrypoint function (`entrypoint`) */ -.word 0x0000144C /* Revision */ -.word 0x917D18F6 /* Checksum 1 */ -.word 0x69BC5453 /* Checksum 2 */ -.word 0x00000000 /* Unknown */ -.word 0x00000000 /* Unknown */ -.ascii "THE LEGEND OF ZELDA " /* Internal ROM name */ -.word 0x00000000 /* Unknown */ -.word 0x0000004E /* Cartridge */ -.ascii "ZL" /* Cartridge ID */ -.ascii "P" /* Region */ -.byte 0x0F /* Version */ +/* 0x00 */ ENDIAN_IDENTIFIER +/* 0x01 */ PI_DOMAIN_1_CFG(64, 18, 7, 3) +/* 0x04 */ SYSTEM_CLOCK_RATE_SETTING(0xF) +/* 0x08 */ ENTRYPOINT(0x80000400) +/* 0x0C */ LIBULTRA_VERSION(2, 0, L) +/* 0x10 */ CHECKSUM() +/* 0x18 */ PADDING(8) +/* 0x20 */ ROM_NAME("THE LEGEND OF ZELDA") +/* 0x34 */ PADDING(7) + +#ifdef CONSOLE_WIIVC +/* 0x3B */ MEDIUM(CARTRIDGE_EXPANDABLE) +#else +/* 0x3B */ MEDIUM(CARTRIDGE) +#endif + +/* 0x3C */ GAME_ID("ZL") +/* 0x3E */ REGION(US) + +#ifdef CONSOLE_WIIVC +/* 0x3F */ GAME_REVISION(0) +#else +/* 0x3F */ GAME_REVISION(15) +#endif diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 5b1e96306..9552c4546 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -36,8 +36,8 @@ static ColliderQuadInit sQuadInit = { ELEMTYPE_UNK2, { 0x00000080, 0x00, 0x01 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_NEAREST | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_NEAREST | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -139,25 +139,6 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) { void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { Player* player = GET_PLAYER(play); - Actor* touchedActor; - Actor* grabbed; - Vec3f bodyDistDiffVec; - Vec3f newPos; - f32 bodyDistDiff; - f32 phi_f16; - DynaPolyActor* dynaPolyActor; - f32 curGrabbedDist; - f32 grabbedDist; - s32 pad; - CollisionPoly* poly; - s32 bgId; - Vec3f intersectPos; - Vec3f prevFrameDiff; - Vec3f sp60; - f32 polyNormalX; - f32 polyNormalZ; - f32 velocity; - s32 pad1; if ((this->actor.parent == NULL) || (!Player_HoldsHookshot(player))) { ArmsHook_DetachHookFromActor(this); @@ -170,9 +151,10 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { if ((this->timer != 0) && (this->collider.base.atFlags & AT_HIT) && (this->collider.elem.atHitElem->elemType != ELEMTYPE_UNK4)) { - touchedActor = this->collider.base.at; + Actor* touchedActor = this->collider.base.at; + if ((touchedActor->update != NULL) && (touchedActor->flags & (ACTOR_FLAG_9 | ACTOR_FLAG_10))) { - if (this->collider.elem.atHitElem->bumperFlags & BUMP_HOOKABLE) { + if (this->collider.elem.atHitElem->acElemFlags & ACELEM_HOOKABLE) { ArmsHook_AttachHookToActor(this, touchedActor); if (CHECK_FLAG_ALL(touchedActor->flags, ACTOR_FLAG_10)) { func_80865044(this); @@ -182,7 +164,20 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { this->timer = 0; Audio_PlaySfxGeneral(NA_SE_IT_ARROW_STICK_CRE, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - } else if (DECR(this->timer) == 0) { + return; + } + + if (DECR(this->timer) == 0) { + Actor* grabbed; + Vec3f bodyDistDiffVec; + Vec3f newPos; + f32 bodyDistDiff; + f32 phi_f16; + s32 pad1; + f32 curGrabbedDist; + f32 grabbedDist; + f32 velocity; + grabbed = this->grabbed; if (grabbed != NULL) { if ((grabbed->update == NULL) || !CHECK_FLAG_ALL(grabbed->flags, ACTOR_FLAG_13)) { @@ -250,6 +245,12 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { } } } else { + CollisionPoly* poly; + s32 bgId; + Vec3f intersectPos; + Vec3f prevFrameDiff; + Vec3f sp60; + Actor_MoveXZGravity(&this->actor); Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.prevPos, &prevFrameDiff); Math_Vec3f_Sum(&this->unk_1E8, &prevFrameDiff, &this->unk_1E8); @@ -260,13 +261,17 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk_1E8, &intersectPos, &poly, true, true, true, true, &bgId) && !func_8002F9EC(play, &this->actor, poly, bgId, &intersectPos)) { - polyNormalX = COLPOLY_GET_NORMAL(poly->normal.x); - polyNormalZ = COLPOLY_GET_NORMAL(poly->normal.z); + f32 polyNormalX = COLPOLY_GET_NORMAL(poly->normal.x); + f32 polyNormalZ = COLPOLY_GET_NORMAL(poly->normal.z); + s32 pad; + Math_Vec3f_Copy(&this->actor.world.pos, &intersectPos); this->actor.world.pos.x += 10.0f * polyNormalX; this->actor.world.pos.z += 10.0f * polyNormalZ; this->timer = 0; if (SurfaceType_CanHookshot(&play->colCtx, poly, bgId)) { + DynaPolyActor* dynaPolyActor; + if (bgId != BGCHECK_SCENE) { dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); if (dynaPolyActor != NULL) { @@ -308,6 +313,8 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) { if ((player->actor.draw != NULL) && (player->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT)) { OPEN_DISPS(play->state.gfxCtx, "../z_arms_hook.c", 850); + if (1) {} + if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) { Matrix_MultVec3f(&D_80865B70, &this->unk_1E8); Matrix_MultVec3f(&D_80865B88, &hookNewTip); diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index d263d8bce..bd1270ab2 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -68,8 +68,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_NONE, OCELEM_NONE, }, { 0x00BB, 0x0050, 0x0000, { 0 } }, diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index 2220e8f54..d4a4a6fc0 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -60,8 +60,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xEFC1FFFE, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 0, { { 0, 120, 0 }, 370 }, 100 }, @@ -90,17 +90,21 @@ static InitChainEntry sInitChain[] = { static Vec3f D_8086E0E0 = { 0.0f, 140.0f, 0.0f }; void BgBdanSwitch_InitDynaPoly(BgBdanSwitch* this, PlayState* play, CollisionHeader* collision, s32 flag) { - s16 pad1; + s32 pad; CollisionHeader* colHeader = NULL; - s16 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_bdan_switch.c", 325, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgBdanSwitch_InitCollision(BgBdanSwitch* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c index 3d12a423b..ff7ebd99c 100644 --- a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c @@ -26,8 +26,8 @@ static ColliderTrisElementInit sTrisElementsInit[3] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x40000048, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { -70.0f, 176.0f, 0.0f }, { -70.0f, -4.0f, 0.0f }, { 0.0f, -4.0f, 30.0f } } }, @@ -37,8 +37,8 @@ static ColliderTrisElementInit sTrisElementsInit[3] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x40000048, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 70.0f, 176.0f, 0.0f }, { -70.0f, 176.0f, 0.0f }, { 0.0f, -4.0f, 30.0f } } }, @@ -48,8 +48,8 @@ static ColliderTrisElementInit sTrisElementsInit[3] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x40000048, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 70.0f, -4.0f, 0.0f }, { 70.0f, 176.0f, 0.0f }, { 0.0f, -4.0f, 30.0f } } }, diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index 522a139ee..ef92c82ee 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -51,8 +51,8 @@ static ColliderQuadInit sQuadInit = { ELEMTYPE_UNK0, { 0x00000048, 0x00, 0x00 }, { 0x00000048, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, diff --git a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c index f5cc8bd9c..f5396acc2 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c @@ -43,8 +43,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 245, 180, -400, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index dc28fe90e..d1ccf08fc 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -45,8 +45,8 @@ static ColliderCylinderInit sColCylinderInitMain = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 80, 30, 80, { 0, 0, 0 } }, @@ -65,8 +65,8 @@ static ColliderCylinderInit sColCylinderInitLeftRight = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 50, 60, 280, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index f2779f3c6..09e444365 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -252,7 +252,7 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) { } if (givingReward) { - if (!IS_CUTSCENE_LAYER) { + if (!IS_CUTSCENE_LAYER || !IS_DEBUG) { if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { switch (this->fountainType) { case FAIRY_SPELL_FARORES_WIND: diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c index 95f18f4b7..7cf14989c 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c @@ -97,12 +97,11 @@ void BgGanonOtyuka_Destroy(Actor* thisx, PlayState* play2) { void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) { Actor* thisx = &this->dyna.actor; Actor* prop; - BgGanonOtyuka* platform; + s16 i; f32 dx; f32 dy; f32 dz; Vec3f center; - s16 i; if (this->isFalling || ((play->actorCtx.unk_02 != 0) && (this->dyna.actor.xyzDistToPlayerSq < SQ(70.0f)))) { PRINTF("OTC O 1\n"); @@ -113,20 +112,19 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, PlayState* play) { if ((prop == thisx) || (prop->id != ACTOR_BG_GANON_OTYUKA)) { prop = prop->next; continue; - } - - platform = (BgGanonOtyuka*)prop; - - dx = platform->dyna.actor.world.pos.x - this->dyna.actor.world.pos.x + D_80876A68[i].x; - dy = platform->dyna.actor.world.pos.y - this->dyna.actor.world.pos.y; - dz = platform->dyna.actor.world.pos.z - this->dyna.actor.world.pos.z + D_80876A68[i].z; - - if ((fabsf(dx) < 10.0f) && (fabsf(dy) < 10.0f) && (fabsf(dz) < 10.0f)) { - platform->visibleSides |= sSides[i]; - break; } else { - prop = prop->next; + BgGanonOtyuka* platform = (BgGanonOtyuka*)prop; + + dx = platform->dyna.actor.world.pos.x - this->dyna.actor.world.pos.x + D_80876A68[i].x; + dy = platform->dyna.actor.world.pos.y - this->dyna.actor.world.pos.y; + dz = platform->dyna.actor.world.pos.z - this->dyna.actor.world.pos.z + D_80876A68[i].z; + + if ((fabsf(dx) < 10.0f) && (fabsf(dy) < 10.0f) && (fabsf(dz) < 10.0f)) { + platform->visibleSides |= sSides[i]; + break; + } } + prop = prop->next; } } diff --git a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c index e7ea4f365..05cf7cde5 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c @@ -44,8 +44,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0x00020800, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 50, 20, 20, { 0, 0, 0 } }, @@ -125,15 +125,18 @@ void func_8087AF38(BgGndSoulmeiro* this, PlayState* play) { } else if ((this->unk_198 % 6) == 0) { s32 i; s16 temp_2 = Rand_ZeroOne() * (10922.0f); // This should be: 0x10000 / 6.0f + s16 temp_1; + f32 temp_3; + f32 temp_4; + f32 distXZ; vecA.y = 0.0f; vecB.y = thisx->world.pos.y; for (i = 0; i < 6; i++) { - s16 temp_1 = Rand_CenteredFloat(0x2800) + temp_2; - f32 temp_3 = Math_SinS(temp_1); - f32 temp_4 = Math_CosS(temp_1); - f32 distXZ; + temp_1 = Rand_CenteredFloat(0x2800) + temp_2; + temp_3 = Math_SinS(temp_1); + temp_4 = Math_CosS(temp_1); vecB.x = thisx->world.pos.x + (120.0f * temp_3); vecB.z = thisx->world.pos.z + (120.0f * temp_4); diff --git a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index 8e129ae40..ed45e2cfc 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -315,8 +315,6 @@ void BgHakaGate_DrawFlame(BgHakaGate* this, PlayState* play) { if (this->vFlameScale > 0) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_gate.c", 716); - if (1) {} - Gfx_SetupDL_25Xlu(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x40, 1, 0, @@ -327,6 +325,9 @@ void BgHakaGate_DrawFlame(BgHakaGate* this, PlayState* play) { Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y + 15.0f, thisx->world.pos.z, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))), MTXMODE_APPLY); scale = this->vFlameScale * 0.00001f; + + if (1) {} + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_gate.c", 744), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index 8caf50d34..b7d324896 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -85,14 +85,14 @@ void BgHakaMegane_Destroy(Actor* thisx, PlayState* play) { } void func_8087DB24(BgHakaMegane* this, PlayState* play) { - CollisionHeader* colHeader; - CollisionHeader* collision; - if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { this->dyna.actor.objectSlot = this->requiredObjectSlot; this->dyna.actor.draw = BgHakaMegane_Draw; Actor_SetObjectDependency(play, &this->dyna.actor); if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) { + CollisionHeader* colHeader; + CollisionHeader* collision; + this->actionFunc = func_8087DBF0; collision = sCollisionHeaders[this->dyna.actor.params]; if (collision != NULL) { diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index 6a1963aea..c96055ac4 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -44,8 +44,8 @@ static ColliderTrisElementInit sTrisElementsInit[4] = { ELEMTYPE_UNK2, { 0x20000000, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { { { 365.0f, 45.0f, 27.0f }, { 130.0f, 45.0f, 150.0f }, { 290.0f, 45.0f, 145.0f } } }, @@ -55,8 +55,8 @@ static ColliderTrisElementInit sTrisElementsInit[4] = { ELEMTYPE_UNK2, { 0x20000000, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { { { 250.0f, 45.0f, 90.0f }, { 50.0f, 45.0f, 80.0f }, { 160.0f, 45.0f, 160.0f } } }, @@ -66,8 +66,8 @@ static ColliderTrisElementInit sTrisElementsInit[4] = { ELEMTYPE_UNK2, { 0x20000000, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { { { -305.0f, 33.0f, -7.0f }, { -220.0f, 33.0f, 40.0f }, { -130.0f, 33.0f, -5.0f } } }, @@ -77,8 +77,8 @@ static ColliderTrisElementInit sTrisElementsInit[4] = { ELEMTYPE_UNK2, { 0x20000000, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { { { -190.0f, 33.0f, 40.0f }, { -30.0f, 33.0f, 15.0f }, { -70.0f, 33.0f, -30.0f } } }, @@ -111,8 +111,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 80, 130, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c index 4bd23fcaa..19e7e18a7 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c +++ b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c @@ -199,7 +199,11 @@ void BgHakaShip_Draw(Actor* thisx, PlayState* play) { f32 angleTemp; OPEN_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 528); + Gfx_SetupDL_25Opa(play->state.gfxCtx); + + if (1) {} + if (this->dyna.actor.params == 0) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_haka_ship.c", 534), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -220,7 +224,9 @@ void BgHakaShip_Draw(Actor* thisx, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_haka_objects_DL_00E910); } + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_haka_ship.c", 568); + if (this->actionFunc == BgHakaShip_CutsceneStationary || this->actionFunc == BgHakaShip_Move) { s32 pad; Vec3f sp2C; diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index 1e205a090..c65a1a2f0 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -54,8 +54,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 30, 90, 0, { 0, 0, 0 } }, @@ -67,8 +67,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00020000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 1800.0f, 1200.0f, 0.0f }, { -1800.0f, 1200.0f, 0.0f }, { -1800.0f, 0.0f, 0.0f } } }, @@ -78,8 +78,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00020000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 1800.0f, 1200.0f, 0.0f }, { -1800.0f, 0.0f, 0.0f }, { 1800.0f, 0.0f, 0.0f } } }, @@ -166,8 +166,8 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) { this->colliderCylinder.dim.radius = 18; this->colliderCylinder.dim.height = 115; - this->colliderCylinder.elem.toucherFlags &= ~TOUCH_SFX_NORMAL; - this->colliderCylinder.elem.toucherFlags |= TOUCH_SFX_WOOD; + this->colliderCylinder.elem.atElemFlags &= ~ATELEM_SFX_NORMAL; + this->colliderCylinder.elem.atElemFlags |= ATELEM_SFX_WOOD; this->actionFunc = func_808801B8; } @@ -352,6 +352,7 @@ void func_808806BC(BgHakaTrap* this, PlayState* play) { f32 floorHeight; f32 yIntersect; s32 i; + s32 bgId; this->dyna.actor.velocity.y *= 1.6f; @@ -366,8 +367,6 @@ void func_808806BC(BgHakaTrap* this, PlayState* play) { floorHeight = this->dyna.actor.floorHeight; for (i = 0; i < 3; i++) { - s32 bgId; - yIntersect = BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &vector) - 25.0f; diff --git a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c index fbc49da85..c499e3191 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c +++ b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c @@ -43,8 +43,8 @@ static ColliderCylinderInit sPotColliderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 25, 60, 30, { 0, 0, 0 } }, @@ -63,8 +63,8 @@ static ColliderCylinderInit sFlamesColliderInit = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_ON, }, { 60, 45, 235, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c index cab46b446..781dd579b 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c +++ b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c @@ -45,8 +45,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 5, 60, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index c868ca72a..85549a63d 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -490,6 +490,8 @@ void BgHeavyBlock_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_heavy_block.c", 904); + if (1) {} + if (BgHeavyBlock_LiftedUp == this->actionFunc) { Matrix_SetTranslateRotateYXZ(player->leftHandPos.x, player->leftHandPos.y, player->leftHandPos.z, &thisx->shape.rot); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c index e7ec041a3..3ac82ceb5 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c @@ -42,8 +42,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_ON, }, { 81, 144, 0, { 0, 0, 0 } }, @@ -86,11 +86,12 @@ void BgHidanCurtain_Init(Actor* thisx, PlayState* play) { this->treasureFlag = (thisx->params >> 6) & 0x3F; thisx->params &= 0x3F; - if ((this->actor.params < 0) || (this->actor.params > 0x3F)) { + if (IS_DEBUG && ((this->actor.params < 0) || (this->actor.params > 0x3F))) { // "Save bit is not set" PRINTF("Warning : object ã®ã‚»ãƒ¼ãƒ–ビットãŒè¨­å®šã•れã¦ã„ãªã„(%s %d)(arg_data 0x%04x)\n", "../z_bg_hidan_curtain.c", 373, this->actor.params); } + Actor_SetScale(&this->actor, hcParams->scale); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c index 5d91381a9..16e1d8042 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c @@ -35,8 +35,8 @@ static ColliderTrisElementInit sTrisElementInit[4] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000040, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_NO_AT_INFO | BUMP_NO_DAMAGE | BUMP_NO_SWORD_SFX | BUMP_NO_HITMARK, + ATELEM_NONE, + ACELEM_ON | ACELEM_NO_AT_INFO | ACELEM_NO_DAMAGE | ACELEM_NO_SWORD_SFX | ACELEM_NO_HITMARK, OCELEM_NONE, }, { { { 305.0f, 0.0f, -300.0f }, { 305.0f, 600.0f, -300.0f }, { 305.0f, 600.0f, 300.0f } } }, @@ -46,8 +46,8 @@ static ColliderTrisElementInit sTrisElementInit[4] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000040, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_NO_AT_INFO | BUMP_NO_DAMAGE | BUMP_NO_SWORD_SFX | BUMP_NO_HITMARK, + ATELEM_NONE, + ACELEM_ON | ACELEM_NO_AT_INFO | ACELEM_NO_DAMAGE | ACELEM_NO_SWORD_SFX | ACELEM_NO_HITMARK, OCELEM_NONE, }, { { { 305.0f, 0.0f, -300.0f }, { 305.0f, 600.0f, 300.0f }, { 305.0f, 0.0f, 300.0f } } }, @@ -57,8 +57,8 @@ static ColliderTrisElementInit sTrisElementInit[4] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000040, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_NO_AT_INFO | BUMP_NO_DAMAGE | BUMP_NO_SWORD_SFX | BUMP_NO_HITMARK, + ATELEM_NONE, + ACELEM_ON | ACELEM_NO_AT_INFO | ACELEM_NO_DAMAGE | ACELEM_NO_SWORD_SFX | ACELEM_NO_HITMARK, OCELEM_NONE, }, { { { -305.0f, 0.0f, -300.0f }, { -305.0f, 600.0f, 300.0f }, { -305.0f, 600.0f, -300.0f } } }, @@ -68,8 +68,8 @@ static ColliderTrisElementInit sTrisElementInit[4] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000040, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_NO_AT_INFO | BUMP_NO_DAMAGE | BUMP_NO_SWORD_SFX | BUMP_NO_HITMARK, + ATELEM_NONE, + ACELEM_ON | ACELEM_NO_AT_INFO | ACELEM_NO_DAMAGE | ACELEM_NO_SWORD_SFX | ACELEM_NO_HITMARK, OCELEM_NONE, }, { { { -305.0f, 0.0f, -300.0f }, { -305.0f, 0.0f, 300.0f }, { -305.0f, 600.0f, 300.0f } } }, @@ -129,8 +129,8 @@ void BgHidanDalm_Wait(BgHidanDalm* this, PlayState* play) { (player->meleeWeaponAnimation == PLAYER_MWA_HAMMER_FORWARD || player->meleeWeaponAnimation == PLAYER_MWA_HAMMER_SIDE)) { this->collider.base.acFlags &= ~AC_HIT; - if ((this->collider.elements[0].base.bumperFlags & BUMP_HIT) || - (this->collider.elements[1].base.bumperFlags & BUMP_HIT)) { + if ((this->collider.elements[0].base.acElemFlags & ACELEM_HIT) || + (this->collider.elements[1].base.acElemFlags & ACELEM_HIT)) { this->dyna.actor.world.rot.y -= 0x4000; } else { this->dyna.actor.world.rot.y += 0x4000; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c index 441fe805f..130b38c12 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c @@ -46,8 +46,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_ON, }, { 30, 83, 0, { 0 } }, @@ -58,8 +58,7 @@ static CollisionCheckInfoInit sColChkInfoInit = { 1, 80, 100, MASS_IMMOVABLE }; void BgHidanFirewall_Init(Actor* thisx, PlayState* play) { BgHidanFirewall* this = (BgHidanFirewall*)thisx; - this->actor.scale.x = 0.12f; - this->actor.scale.z = 0.12f; + this->actor.scale.x = this->actor.scale.z = 0.12f; this->actor.scale.y = 0.01f; this->unk_150 = 0; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c index 8f55a5210..170f0677b 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c @@ -56,8 +56,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_ON, }, { 30, 130, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index b20e9f1c1..2e6bf978f 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c @@ -31,8 +31,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x40000040, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { -20.0f, 3.0f, -20.0f }, { -20.0f, 3.0f, 20.0f }, { 20.0f, 3.0f, 20.0f } } }, @@ -42,8 +42,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x40000040, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 20.0f, 3.0f, 20.0f }, { 20.0f, 3.0f, -20.0f }, { -20.0f, 3.0f, -20.0f } } }, @@ -347,11 +347,13 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) { Actor_MoveXZGravity(&this->dyna.actor); func_80888694(this, (BgHidanHamstep*)this->dyna.actor.parent); +#if IS_DEBUG if (((this->dyna.actor.params & 0xFF) <= 0) || ((this->dyna.actor.params & 0xFF) >= 6)) { // "[Hammer Step] arg_data strange (arg_data = %d)" PRINTF("ã€ãƒãƒ³ãƒžãƒ¼ã‚¹ãƒ†ãƒƒãƒ—】 arg_data ãŠã‹ã—ã„ (arg_data = %d)", this->dyna.actor.params); PRINTF("%s %d\n", "../z_bg_hidan_hamstep.c", 696); } +#endif if (((this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) <= sYPosOffsets[(this->dyna.actor.params & 0xFF) - 1]) && diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c index 0d476066d..d2f5a4f8c 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c @@ -36,8 +36,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x40000040, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_NO_AT_INFO | BUMP_NO_DAMAGE | BUMP_NO_SWORD_SFX | BUMP_NO_HITMARK, + ATELEM_NONE, + ACELEM_ON | ACELEM_NO_AT_INFO | ACELEM_NO_DAMAGE | ACELEM_NO_SWORD_SFX | ACELEM_NO_HITMARK, OCELEM_NONE, }, { { { -40.0f, 3.0f, -40.0f }, { -40.0f, 3.0f, 40.0f }, { 40.0f, 3.0f, 40.0f } } }, @@ -47,8 +47,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x40000040, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_NO_AT_INFO | BUMP_NO_DAMAGE | BUMP_NO_SWORD_SFX | BUMP_NO_HITMARK, + ATELEM_NONE, + ACELEM_ON | ACELEM_NO_AT_INFO | ACELEM_NO_DAMAGE | ACELEM_NO_SWORD_SFX | ACELEM_NO_HITMARK, OCELEM_NONE, }, { { { 40.0f, 3.0f, 40.0f }, { 40.0f, 3.0f, -40.0f }, { -40.0f, 3.0f, -40.0f } } }, @@ -82,6 +82,7 @@ void BgHidanHrock_Init(Actor* thisx, PlayState* play) { s32 i; s32 j; CollisionHeader* collisionHeader = NULL; + Vec3f* vtx; Actor_ProcessInitChain(thisx, sInitChain); this->unk_16A = thisx->params & 0x3F; @@ -103,7 +104,7 @@ void BgHidanHrock_Init(Actor* thisx, PlayState* play) { if (1) { for (j = 0; j < 3; j++) { - Vec3f* vtx = &colliderElementInit->dim.vtx[j]; + vtx = &colliderElementInit->dim.vtx[j]; vertices[j].x = vtx->z * sinRotY + (thisx->home.pos.x + vtx->x * cosRotY); vertices[j].y = vtx->y + thisx->home.pos.y; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c index 4bcee5a11..df811c7c4 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c @@ -73,9 +73,12 @@ void BgHidanKousi_Init(Actor* thisx, PlayState* play) { ((s32)thisx->params >> 8) & 0xFF); Actor_ProcessInitChain(thisx, sInitChain); + +#if IS_DEBUG if (((thisx->params & 0xFF) < 0) || ((thisx->params & 0xFF) >= 3)) { PRINTF("arg_data ãŠã‹ã—ã„ ã€æ ¼å­ã€‘\n"); } +#endif CollisionHeader_GetVirtual(sMetalFencesCollisions[thisx->params & 0xFF], &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c index 5c5730585..d9ce7e6ab 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c @@ -46,8 +46,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 100 }, 100 }, diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index 45863efc2..ef6bb4386 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -54,8 +54,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 45, 77, -40, { 3310, 120, 0 } }, diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index 1ebe33fcf..5f8ec0ce0 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c @@ -32,8 +32,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 1, { { 0, 30, 40 }, 25 }, 100 }, @@ -43,8 +43,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 1, { { -35, 32, 77 }, 32 }, 100 }, @@ -54,8 +54,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 1, { { -80, 35, 130 }, 42 }, 100 }, @@ -65,8 +65,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 1, { { 0, 30, -40 }, 25 }, 100 }, @@ -76,8 +76,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 1, { { 35, 32, -77 }, 32 }, 100 }, @@ -87,8 +87,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 1, { { 80, 35, -130 }, 42 }, 100 }, diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c index 0e0f1f606..d07db7eca 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c @@ -35,8 +35,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_ON, }, { 1, { { 0, 30, 40 }, 23 }, 100 }, @@ -46,8 +46,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_ON, }, { 1, { { 0, 32, 87 }, 30 }, 100 }, @@ -57,8 +57,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_ON, }, { 1, { { 0, 35, 150 }, 40 }, 100 }, @@ -68,8 +68,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_ON, }, { 1, { { 0, 30, 40 }, 23 }, 100 }, @@ -79,8 +79,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_ON, }, { 1, { { 0, 32, 87 }, 30 }, 100 }, @@ -90,8 +90,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_ON, }, { 1, { { 0, 35, 150 }, 40 }, 100 }, @@ -130,16 +130,17 @@ void func_8088CEC0(BgHidanSekizou* this, s32 arg1, s16 arg2) { s32 end = start + 3; f32 sp30 = Math_SinS(arg2); f32 sp2C = Math_CosS(arg2); + ColliderJntSphElement* element; for (i = start; i < end; i++) { - ColliderJntSphElement* element = &this->collider.elements[i]; + element = &this->collider.elements[i]; element->dim.worldSphere.center.x = this->dyna.actor.home.pos.x + (sp2C * element->dim.modelSphere.center.x) + (sp30 * element->dim.modelSphere.center.z); element->dim.worldSphere.center.y = (s16)this->dyna.actor.home.pos.y + element->dim.modelSphere.center.y; element->dim.worldSphere.center.z = this->dyna.actor.home.pos.z - (sp30 * element->dim.modelSphere.center.x) + (sp2C * element->dim.modelSphere.center.z); - element->base.toucherFlags |= TOUCH_ON; + element->base.atElemFlags |= ATELEM_ON; element->base.ocElemFlags |= OCELEM_ON; } } @@ -210,7 +211,7 @@ void func_8088D434(BgHidanSekizou* this, PlayState* play) { } } for (i = 3 * phi_s4; i < ARRAY_COUNT(this->elements); i++) { - this->collider.elements[i].base.toucherFlags &= ~TOUCH_ON; + this->collider.elements[i].base.atElemFlags &= ~ATELEM_ON; this->collider.elements[i].base.ocElemFlags &= ~OCELEM_ON; } } @@ -301,8 +302,8 @@ Gfx* func_8088D9F4(PlayState* play, BgHidanSekizou* this, s16 arg2, MtxF* arg3, f32 phi_f12; arg6 = (((arg6 + arg2) % 8) * 7) * (1 / 7.0f); - arg2++; gSPSegment(arg7++, 9, SEGMENTED_TO_VIRTUAL(sFireballsTexs[arg6])); + arg2++; if (arg2 != 4) { phi_f12 = arg2 + ((4 - this->unk_170) / 4.0f); } else { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c index 56363ffef..8273e2696 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c @@ -39,8 +39,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[2] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 1, { { 0, 40, 100 }, 22 }, 100 }, @@ -50,8 +50,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[2] = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 1, { { 0, 40, 145 }, 30 }, 100 }, diff --git a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c index 2a862c463..644efc385 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c +++ b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c @@ -53,8 +53,8 @@ static ColliderCylinderInit sCylinderInit1 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 0, 0, 0, { 0, 0, 0 } }, @@ -73,8 +73,8 @@ static ColliderCylinderInit sCylinderInit2 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x4FC1FFF6, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 0, 0, 0, { 0, 0, 0 } }, @@ -115,17 +115,20 @@ void BgIceShelter_InitColliders(BgIceShelter* this, PlayState* play) { void BgIceShelter_InitDynaPoly(BgIceShelter* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + // "Warning : move BG registration failed" PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_ice_shelter.c", 362, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgIceShelter_RotateY(Vec3f* dest, Vec3f* src, s16 angle) { @@ -144,7 +147,6 @@ static InitChainEntry sInitChain[] = { }; void BgIceShelter_Init(Actor* thisx, PlayState* play) { - static Vec3f kzIceScale = { 0.18f, 0.27f, 0.24f }; BgIceShelter* this = (BgIceShelter*)thisx; s16 type = BGICESHELTER_GET_TYPE(&this->dyna.actor); @@ -158,7 +160,9 @@ void BgIceShelter_Init(Actor* thisx, PlayState* play) { } if (type == RED_ICE_KING_ZORA) { - Math_Vec3f_Copy(&this->dyna.actor.scale, &kzIceScale); + static Vec3f sKingZoraRedIceScale = { 0.18f, 0.27f, 0.24f }; + + Math_Vec3f_Copy(&this->dyna.actor.scale, &sKingZoraRedIceScale); } else { Actor_SetScale(&this->dyna.actor, sRedIceScales[type]); } diff --git a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c index 343b1250c..0d8f5a34d 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c +++ b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c @@ -49,7 +49,6 @@ void BgIceShutter_Init(Actor* thisx, PlayState* play) { f32 sp24; CollisionHeader* colHeader; s32 sp28; - f32 temp_f6; colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -78,7 +77,8 @@ void BgIceShutter_Init(Actor* thisx, PlayState* play) { } if (sp28 == 2) { - temp_f6 = Math_SinS(this->dyna.actor.shape.rot.x) * 50.0f; + f32 temp_f6 = Math_SinS(this->dyna.actor.shape.rot.x) * 50.0f; + this->dyna.actor.focus.pos.x = (Math_SinS(this->dyna.actor.shape.rot.y) * temp_f6) + this->dyna.actor.home.pos.x; this->dyna.actor.focus.pos.y = this->dyna.actor.home.pos.y; diff --git a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c index a69d5ecee..30a2c281c 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c +++ b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c @@ -33,8 +33,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0x4FC007CA, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { 13, 120, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c index e9632360d..d6efc13ea 100644 --- a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c +++ b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c @@ -50,8 +50,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 70, 80, -82, { 0, 0, 0 } }, @@ -69,17 +69,20 @@ static InitChainEntry sInitChain[] = { void BgJya1flift_InitDynapoly(BgJya1flift* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + // "Warning : move BG login failed" PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_1flift.c", 179, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgJya1flift_InitCollision(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c index 4df5b39ed..e021ed63a 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c +++ b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c @@ -45,15 +45,19 @@ static InitChainEntry sInitChain[] = { void BgJyaAmishutter_InitDynaPoly(BgJyaAmishutter* this, PlayState* play, CollisionHeader* collision, s32 flag) { s32 pad1; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_amishutter.c", 129, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgJyaAmishutter_Init(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c index a66909bd6..bb7284b9a 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c @@ -74,10 +74,12 @@ void BgJyaBigmirror_HandleCobra(Actor* thisx, PlayState* play) { this->puzzleFlags &= ~cobraPuzzleFlags[i]; } +#if IS_DEBUG if (curCobraInfo->cobra->dyna.actor.update == NULL) { // "Cobra deleted" PRINTF("Error : コブラ削除ã•れ㟠(%s %d)\n", "../z_bg_jya_bigmirror.c", 203); } +#endif } else { curCobraInfo->cobra = (BgJyaCobra*)Actor_SpawnAsChild( &play->actorCtx, &this->actor, play, ACTOR_BG_JYA_COBRA, curSpawnData->pos.x, curSpawnData->pos.y, @@ -136,17 +138,10 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { this->lightBeams[1] = NULL; this->lightBeams[0] = NULL; } else { - puzzleSolved = !!(this->puzzleFlags & (BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM)); - - if (puzzleSolved) { - puzzleSolved = !!(this->puzzleFlags & BIGMIR_PUZZLE_COBRA2_SOLVED); - - if (puzzleSolved) { - puzzleSolved = !!(this->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED); - } - } - lightBeamToggles[0] = puzzleSolved; // Only spawn if puzzle solved - if (1) {} + // Only spawn if puzzle solved + lightBeamToggles[0] = (this->puzzleFlags & (BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM)) && + (this->puzzleFlags & BIGMIR_PUZZLE_COBRA2_SOLVED) && + (this->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED); lightBeamToggles[1] = lightBeamToggles[2] = this->puzzleFlags & (BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM); @@ -158,10 +153,12 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPositions[i].x, sMirRayPositions[i].y, sMirRayPositions[i].z, 0, 0, 0, sMirRayParamsVals[i]); +#if IS_DEBUG if (this->lightBeams[i] == NULL) { // "Mir Ray generation failed" PRINTF("Error : Mir Ray 発生失敗 (%s %d)\n", "../z_bg_jya_bigmirror.c", 310); } +#endif } } else { if (this->lightBeams[i] != NULL) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c index 54cb236fe..b4c2d6158 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c @@ -32,8 +32,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 0, { { -300, 0, 0 }, 40 }, 100 }, diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c index b03f841e3..9f64b58fe 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c @@ -34,8 +34,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 50 }, 100 }, @@ -63,19 +63,22 @@ static InitChainEntry sInitChain[] = { }; void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, PlayState* play, CollisionHeader* collision, s32 flag) { - s16 pad1; + s32 pad1; CollisionHeader* colHeader = NULL; - s16 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; // "Warning: move BG registration failed" PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_bombiwa.c", 174, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index 02b42c4ce..2de2264bd 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c +++ b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c @@ -118,27 +118,34 @@ void func_808958F0(Vec3f* dest, Vec3f* src, f32 arg2, f32 arg3) { void BgJyaCobra_InitDynapoly(BgJyaCobra* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + // "Warning : move BG Registration Failure" PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_cobra.c", 247, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgJyaCobra_SpawnRay(BgJyaCobra* this, PlayState* play) { Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_MIR_RAY, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 57.0f, this->dyna.actor.world.pos.z, 0, 0, 0, 6); + +#if IS_DEBUG if (this->dyna.actor.child == NULL) { PRINTF(VT_FGCOL(RED)); // "Errï½ï½’ : Mir Ray occurrence failure" PRINTF("Errï½ï½’ : Mir Ray 発生失敗 (%s %d)\n", "../z_bg_jya_cobra.c", 270); PRINTF(VT_RST); } +#endif } void func_80895A70(BgJyaCobra* this) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c index 6fe12df58..7ab065bd3 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c @@ -41,8 +41,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x20000000, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 58 }, 100 }, diff --git a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c index a46f78272..93e972e2e 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c +++ b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c @@ -40,8 +40,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 10 }, 100 }, diff --git a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c index af9ced88f..7526ae9a1 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c +++ b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c @@ -51,8 +51,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 30, 150, 0, { 0, 0, 0 } }, @@ -106,10 +106,13 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, PlayState* play, EnIk f32 sins; s32 pad[2]; +#if IS_DEBUG if (enIk->unk_2FF <= 0 || enIk->unk_2FF >= 4) { PRINTF("Error 攻撃方法ãŒåˆ†ã‹ã‚‰ãªã„(%s %d)\n", "../z_bg_jya_ironobj.c", 233, enIk->unk_2FF); return; } +#endif + PRINTF("¢ attack_type(%d)\n", enIk->unk_2FF); rotY = Actor_WorldYawTowardActor(&this->dyna.actor, &enIk->actor) + D_808994D8[enIk->unk_2FF - 1]; @@ -169,10 +172,13 @@ void BgJyaIronobj_SpawnThroneParticles(BgJyaIronobj* this, PlayState* play, EnIk f32 sins; s32 pad[2]; +#if IS_DEBUG if (enIk->unk_2FF <= 0 || enIk->unk_2FF >= 4) { PRINTF("Error 攻撃方法ãŒåˆ†ã‹ã‚‰ãªã„(%s %d)\n", "../z_bg_jya_ironobj.c", 362, enIk->unk_2FF); return; } +#endif + PRINTF("¢ attack_type(%d)\n", enIk->unk_2FF); rotY = Actor_WorldYawTowardActor(&this->dyna.actor, &enIk->actor) + D_808994D8[enIk->unk_2FF - 1]; for (i = 0; i < 8; i++) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c index f8ef9d42d..e46feba38 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c @@ -43,15 +43,19 @@ static InitChainEntry sInitChain[] = { void BgJyaKanaami_InitDynaPoly(BgJyaKanaami* this, PlayState* play, CollisionHeader* collision, s32 flag) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_kanaami.c", 145, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgJyaKanaami_Init(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c index 788f16adf..f4bd5ebcf 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c @@ -38,8 +38,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00200000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 0, { { 0, -600, -200 }, 60 }, 100 }, @@ -217,10 +217,11 @@ void BgJyaMegami_DetectLight(BgJyaMegami* this, PlayState* play) { void BgJyaMegami_SetupExplode(BgJyaMegami* this) { u32 i; + Vec3f* pos = &this->dyna.actor.world.pos; this->actionFunc = BgJyaMegami_Explode; for (i = 0; i < ARRAY_COUNT(this->pieces); i++) { - Math_Vec3f_Copy(&this->pieces[i].pos, &this->dyna.actor.world.pos); + Math_Vec3f_Copy(&this->pieces[i].pos, pos); this->pieces[i].vel.x = sPiecesInit[i].velX; } this->explosionTimer = 0; diff --git a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c index 2a4181eef..1da563d86 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c +++ b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c @@ -62,15 +62,19 @@ static InitChainEntry sInitChain[] = { void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, PlayState* play, CollisionHeader* collision, s32 flag) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_zurerukabe.c", 194, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void func_8089B4C8(BgJyaZurerukabe* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c index a52473aca..a39b2e8ae 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c @@ -34,8 +34,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK4, { 0x00000000, 0x00, 0x00 }, { 0x0001F820, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 1, { { 0, 0, 0 }, 14 }, 100 }, diff --git a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c index 0ab3facda..2eaf22b9e 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c @@ -37,8 +37,8 @@ static ColliderTrisElementInit sTrisElementInitFloor[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { -40.0f, 0.0f, -40.0f }, { -40.0f, 0.0f, 40.0f }, { 40.0f, 0.0f, 40.0f } } }, @@ -48,8 +48,8 @@ static ColliderTrisElementInit sTrisElementInitFloor[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { -40.0f, 0.0f, -40.0f }, { 40.0f, 0.0f, 40.0f }, { 40.0f, 0.0f, -40.0f } } }, @@ -75,8 +75,8 @@ static ColliderTrisElementInit sTrisElementInitRutoWall[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 116.0f, 0.0f }, { 0.0f, 0.0f, 70.0f }, { 0.0f, 0.0f, -70.0f } } }, @@ -102,8 +102,8 @@ static ColliderTrisElementInit sTrisElementInitWall[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 120.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 60.0f, 0.0f, 0.0f } } }, @@ -113,8 +113,8 @@ static ColliderTrisElementInit sTrisElementInitWall[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 120.0f, 0.0f }, { 60.0f, 0.0f, 0.0f }, { 60.0f, 120.0f, 0.0f } } }, @@ -182,7 +182,14 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); switch ((u16)this->dyna.actor.params & 0xF) { - case MIZUBWALL_FLOOR: + case MIZUBWALL_FLOOR: { + f32 sin; + f32 cos; + s32 i; + s32 j; + Vec3f offset; + Vec3f vtx[3]; + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; @@ -194,12 +201,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { - f32 sin = Math_SinS(this->dyna.actor.shape.rot.y); - f32 cos = Math_CosS(this->dyna.actor.shape.rot.y); - s32 i; - s32 j; - Vec3f offset; - Vec3f vtx[3]; + sin = Math_SinS(this->dyna.actor.shape.rot.y); + cos = Math_CosS(this->dyna.actor.shape.rot.y); for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) { for (j = 0; j < 3; j++) { @@ -217,7 +220,15 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { } } break; - case MIZUBWALL_RUTO_ROOM: + } + case MIZUBWALL_RUTO_ROOM: { + f32 sin; + f32 cos; + s32 i; + s32 j; + Vec3f offset; + Vec3f vtx[3]; + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; @@ -229,12 +240,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { - f32 sin = Math_SinS(this->dyna.actor.shape.rot.y); - f32 cos = Math_CosS(this->dyna.actor.shape.rot.y); - s32 i; - s32 j; - Vec3f offset; - Vec3f vtx[3]; + sin = Math_SinS(this->dyna.actor.shape.rot.y); + cos = Math_CosS(this->dyna.actor.shape.rot.y); for (i = 0; i < ARRAY_COUNT(sTrisElementInitRutoWall); i++) { for (j = 0; j < 3; j++) { @@ -252,7 +259,15 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { } } break; - case MIZUBWALL_UNUSED: + } + case MIZUBWALL_UNUSED: { + f32 sin; + f32 cos; + s32 i; + s32 j; + Vec3f offset; + Vec3f vtx[3]; + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; @@ -264,12 +279,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { - f32 sin = Math_SinS(this->dyna.actor.shape.rot.y); - f32 cos = Math_CosS(this->dyna.actor.shape.rot.y); - s32 i; - s32 j; - Vec3f offset; - Vec3f vtx[3]; + sin = Math_SinS(this->dyna.actor.shape.rot.y); + cos = Math_CosS(this->dyna.actor.shape.rot.y); for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) { for (j = 0; j < 3; j++) { @@ -289,7 +300,15 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { } } break; - case MIZUBWALL_STINGER_ROOM_1: + } + case MIZUBWALL_STINGER_ROOM_1: { + f32 sin; + f32 cos; + s32 i; + s32 j; + Vec3f offset; + Vec3f vtx[3]; + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; @@ -302,12 +321,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { - f32 sin = Math_SinS(this->dyna.actor.shape.rot.y); - f32 cos = Math_CosS(this->dyna.actor.shape.rot.y); - s32 i; - s32 j; - Vec3f offset; - Vec3f vtx[3]; + sin = Math_SinS(this->dyna.actor.shape.rot.y); + cos = Math_CosS(this->dyna.actor.shape.rot.y); for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) { for (j = 0; j < 3; j++) { @@ -327,7 +342,15 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { } } break; - case MIZUBWALL_STINGER_ROOM_2: + } + case MIZUBWALL_STINGER_ROOM_2: { + f32 sin; + f32 cos; + s32 i; + s32 j; + Vec3f offset; + Vec3f vtx[3]; + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; @@ -340,12 +363,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { - f32 sin = Math_SinS(this->dyna.actor.shape.rot.y); - f32 cos = Math_CosS(this->dyna.actor.shape.rot.y); - s32 i; - s32 j; - Vec3f offset; - Vec3f vtx[3]; + sin = Math_SinS(this->dyna.actor.shape.rot.y); + cos = Math_CosS(this->dyna.actor.shape.rot.y); for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) { for (j = 0; j < 3; j++) { @@ -365,6 +384,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { } } break; + } } } @@ -377,9 +397,8 @@ void BgMizuBwall_Destroy(Actor* thisx, PlayState* play) { } void BgMizuBwall_SetAlpha(BgMizuBwall* this, PlayState* play) { - f32 waterLevel = play->colCtx.colHeader->waterBoxes[2].ySurface; - - if (play->colCtx.colHeader->waterBoxes) {} + WaterBox* waterBoxes = play->colCtx.colHeader->waterBoxes; + f32 waterLevel = waterBoxes[2].ySurface; if (waterLevel < WATER_TEMPLE_WATER_F1_Y) { this->scrollAlpha1 = 255; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c index 050f850aa..b9495198a 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c @@ -53,6 +53,7 @@ static InitChainEntry sInitChain[] = { u32 BgMizuWater_GetWaterLevelActionIndex(s16 switchFlag, PlayState* play) { u32 ret; +#if IS_DEBUG if (bREG(0) != 0) { switch (bREG(1)) { case 0: @@ -67,6 +68,8 @@ u32 BgMizuWater_GetWaterLevelActionIndex(s16 switchFlag, PlayState* play) { } bREG(0) = 0; } +#endif + if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F1_FLAG)) { ret = 3; } else if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F2_FLAG)) { @@ -297,10 +300,13 @@ void BgMizuWater_Update(Actor* thisx, PlayState* play) { s32 unk1; s32 pad; +#if IS_DEBUG if (bREG(15) == 0) { PRINTF("%x %x %x\n", Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG), Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG), Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG)); } +#endif + if (this->type == 0) { posY = this->actor.world.pos.y; unk0 = 0; diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index 18e1eaaaf..dab97a76a 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c @@ -53,17 +53,20 @@ void BgMoriBigst_SetupAction(BgMoriBigst* this, BgMoriBigstActionFunc actionFunc void BgMoriBigst_InitDynapoly(BgMoriBigst* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + // "Warning : move BG login failed" PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_bigst.c", 190, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgMoriBigst_Init(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c index 12072ce5f..fb3ddac69 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c @@ -88,27 +88,31 @@ void BgMoriElevator_Init(Actor* thisx, PlayState* play) { this->unk_172 = sIsSpawned; this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); + +#if IS_DEBUG if (this->moriTexObjectSlot < 0) { Actor_Kill(thisx); // "Forest Temple obj elevator Bank Danger!" PRINTF("Error : 森ã®ç¥žæ®¿ obj elevator ãƒãƒ³ã‚¯å±é™ºï¼(%s %d)\n", "../z_bg_mori_elevator.c", 277); - } else { - switch (sIsSpawned) { - case false: - // "Forest Temple elevator CT" - PRINTF("森ã®ç¥žæ®¿ elevator CT\n"); - sIsSpawned = true; - this->dyna.actor.room = -1; - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - CollisionHeader_GetVirtual(&gMoriElevatorCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); - BgMoriElevator_SetupWaitAfterInit(this); - break; - case true: - Actor_Kill(thisx); - break; - } + return; + } +#endif + + switch (sIsSpawned) { + case false: + // "Forest Temple elevator CT" + PRINTF("森ã®ç¥žæ®¿ elevator CT\n"); + sIsSpawned = true; + this->dyna.actor.room = -1; + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); + CollisionHeader_GetVirtual(&gMoriElevatorCol, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); + BgMoriElevator_SetupWaitAfterInit(this); + break; + case true: + Actor_Kill(thisx); + break; } } diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c index e4be79015..69eed856f 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c @@ -42,8 +42,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK4, { 0x00000000, 0x00, 0x00 }, { 0x0001F820, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 25 }, 100 }, @@ -78,19 +78,21 @@ static InitChainEntry sInitChainLadder[] = { void BgMoriHashigo_InitDynapoly(BgMoriHashigo* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; - CollisionHeader* colHeader; - s32 pad2; + CollisionHeader* colHeader = NULL; - colHeader = NULL; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + // "Warning : move BG login failed" PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_hashigo.c", 164, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgMoriHashigo_InitCollider(BgMoriHashigo* this, PlayState* play) { @@ -260,9 +262,9 @@ void BgMoriHashigo_LadderFall(BgMoriHashigo* this, PlayState* play) { } void BgMoriHashigo_SetupLadderRest(BgMoriHashigo* this) { - this->actionFunc = NULL; this->dyna.actor.gravity = 0.0f; this->dyna.actor.velocity.y = 0.0f; + this->actionFunc = NULL; this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c index e4b2a1217..9d3dcbae8 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c @@ -50,19 +50,21 @@ void BgMoriHashira4_SetupAction(BgMoriHashira4* this, BgMoriHashira4ActionFunc a void BgMoriHashira4_InitDynaPoly(BgMoriHashira4* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; - CollisionHeader* colHeader; - s32 pad2; + CollisionHeader* colHeader = NULL; - colHeader = NULL; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + // "Warning : move BG login failed" PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_mori_hashira4.c", 155, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgMoriHashira4_Init(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index 836ab229a..41a12366b 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -92,11 +92,13 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->dyna.unk_150 > 0.001f) { - this->timer++; + this->timer += (s32)(1.0f * BLOCK_PUSH_SPEED); if ((this->timer > 28) && !Player_InCsMode(play)) { BgMoriKaitenkabe_SetupRotate(this); - Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, PLAYER_CSACTION_8); - Math_Vec3f_Copy(&this->lockedPlayerPos, &player->actor.world.pos); + if (!DISABLE_PLAYER_FREEZE) { + Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, PLAYER_CSACTION_8); + Math_Vec3f_Copy(&this->lockedPlayerPos, &player->actor.world.pos); + } push.x = Math_SinS(this->dyna.unk_158); push.y = 0.0f; push.z = Math_CosS(this->dyna.unk_158); @@ -126,10 +128,12 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { Actor* thisx = &this->dyna.actor; s16 rotY; - Math_StepToF(&this->rotSpeed, 0.6f, 0.02f); + Math_StepToF(&this->rotSpeed, 0.6f * BLOCK_PUSH_SPEED, 0.02f); if (Math_StepToF(&this->rotYdeg, this->rotDirection * 45.0f, this->rotSpeed)) { BgMoriKaitenkabe_SetupWait(this); - Player_SetCsActionWithHaltedActors(play, thisx, PLAYER_CSACTION_7); + if (!DISABLE_PLAYER_FREEZE) { + Player_SetCsActionWithHaltedActors(play, thisx, PLAYER_CSACTION_7); + } if (this->rotDirection > 0.0f) { thisx->home.rot.y += 0x2000; } else { @@ -146,7 +150,10 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~PLAYER_STATE2_4; } - Math_Vec3f_Copy(&player->actor.world.pos, &this->lockedPlayerPos); + + if (!DISABLE_PLAYER_FREEZE) { + Math_Vec3f_Copy(&player->actor.world.pos, &this->lockedPlayerPos); + } } void BgMoriKaitenkabe_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c index 74d462148..3c2474c41 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c @@ -12,7 +12,7 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play); void BgMoriRakkatenjo_Destroy(Actor* thisx, PlayState* play); -void BgMoriRakkatenjo_Update(Actor* thisx, PlayState* play); +void BgMoriRakkatenjo_Update(Actor* thisx, PlayState* play2); void BgMoriRakkatenjo_Draw(Actor* thisx, PlayState* play); void BgMoriRakkatenjo_SetupWaitForMoriTex(BgMoriRakkatenjo* this); @@ -52,6 +52,8 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); + +#if IS_DEBUG // "Forest Temple obj. Falling Ceiling" PRINTF("森ã®ç¥žæ®¿ obj. è½ä¸‹å¤©äº• (home posY %f)\n", this->dyna.actor.home.pos.y); if ((fabsf(1991.0f - this->dyna.actor.home.pos.x) > 0.001f) || @@ -64,6 +66,8 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) { // "The set Angle has changed. Let's fix the program." PRINTF("Warning : セット Angle ãŒå¤‰æ›´ã•れã¦ã„ã¾ã™ã€‚プログラムを修正ã—ã¾ã—ょã†ã€‚\n"); } +#endif + this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjectSlot < 0) { // "Forest Temple obj Falling Ceiling Bank Danger!" @@ -197,8 +201,8 @@ void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, PlayState* play) { } } -void BgMoriRakkatenjo_Update(Actor* thisx, PlayState* play) { - s32 pad; +void BgMoriRakkatenjo_Update(Actor* thisx, PlayState* play2) { + PlayState* play = (PlayState*)play2; BgMoriRakkatenjo* this = (BgMoriRakkatenjo*)thisx; if (this->timer > 0) { diff --git a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index 51a3faed8..f5fb613ba 100644 --- a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -46,8 +46,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK4, { 0x00000000, 0x00, 0x00 }, { 0x0001F820, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 25.0f, 33.0f, 0.0f }, { -25.0f, 33.0f, 0.0f }, { -25.0f, -33.0f, 0.0f } } }, @@ -57,8 +57,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK4, { 0x00000000, 0x00, 0x00 }, { 0x0001F820, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 25.0f, 33.0f, 0.0f }, { -25.0f, -33.0f, 0.0f }, { 25.0f, -33.0f, 0.0f } } }, diff --git a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c index 4008fe167..5c379a538 100644 --- a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c +++ b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c @@ -37,8 +37,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 12, 60, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index 3a8815ea2..1fafea47c 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -197,8 +197,9 @@ void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, PlayState* play) } void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { - BgSpot00Hanebasi* this = (BgSpot00Hanebasi*)thisx; s32 pad; + BgSpot00Hanebasi* this = (BgSpot00Hanebasi*)thisx; + Player* player; this->actionFunc(this, play); @@ -206,7 +207,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { if (play->sceneId == SCENE_HYRULE_FIELD) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) && CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) && !GET_EVENTCHKINF(EVENTCHKINF_80) && LINK_IS_CHILD) { - Player* player = GET_PLAYER(play); + player = GET_PLAYER(play); if ((player->actor.world.pos.x > -450.0f) && (player->actor.world.pos.x < 450.0f) && (player->actor.world.pos.z > 1080.0f) && (player->actor.world.pos.z < 1700.0f) && diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c index 513b8c20b..a8e6ce655 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c @@ -117,10 +117,11 @@ void func_808AAE6C(BgSpot01Idohashira* this, PlayState* play) { void func_808AAF34(BgSpot01Idohashira* this, PlayState* play) { s32 pad[2]; - Vec3f dest; - Vec3f src; if (this->unk_170 != 0) { + Vec3f dest; + Vec3f src; + src.x = kREG(20) + 1300.0f; src.y = kREG(21) + 200.0f; src.z = 0.0f; @@ -170,13 +171,11 @@ void func_808AB18C(BgSpot01Idohashira* this) { f32 func_808AB1DC(f32 arg0, f32 arg1, u16 arg2, u16 arg3, u16 arg4) { f32 temp_f12; f32 regFloat; - f32 diff23; - f32 diff43; + f32 diff23 = arg2 - arg3; + f32 diff43 = arg4 - arg3; - diff23 = arg2 - arg3; if (diff23 != 0.0f) { regFloat = kREG(9) + 30.0f; - diff43 = arg4 - arg3; temp_f12 = regFloat * diff43; return (((((arg1 - arg0) - temp_f12) / SQ(diff23)) * diff43) * diff43) + temp_f12; } diff --git a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c index a652df642..1f1f9da16 100644 --- a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c @@ -13,8 +13,8 @@ void BgSpot02Objects_Init(Actor* thisx, PlayState* play); void BgSpot02Objects_Destroy(Actor* thisx, PlayState* play); void BgSpot02Objects_Update(Actor* thisx, PlayState* play); void BgSpot02Objects_Draw(Actor* thisx, PlayState* play); -void func_808ACCB8(Actor* thisx, PlayState* play); -void func_808AD450(Actor* thisx, PlayState* play); +void func_808ACCB8(Actor* thisx, PlayState* play2); +void func_808AD450(Actor* thisx, PlayState* play2); void func_808AC8FC(BgSpot02Objects* this, PlayState* play); void func_808AC908(BgSpot02Objects* this, PlayState* play); @@ -212,10 +212,10 @@ void func_808ACC34(BgSpot02Objects* this, PlayState* play) { } } -void func_808ACCB8(Actor* thisx, PlayState* play) { +void func_808ACCB8(Actor* thisx, PlayState* play2) { BgSpot02Objects* this = (BgSpot02Objects*)thisx; + PlayState* play = (PlayState*)play2; f32 rate; - s32 pad; u8 redPrim; u8 greenPrim; u8 bluePrim; @@ -225,6 +225,8 @@ void func_808ACCB8(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot02_objects.c", 600); + if (1) {} + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.actorCues[0] != NULL && play->csCtx.actorCues[0]->id == 2) { if (this->unk_16A < 5) { rate = (this->unk_16A / 5.0f); @@ -278,9 +280,9 @@ void func_808AD3D4(BgSpot02Objects* this, PlayState* play) { } } -void func_808AD450(Actor* thisx, PlayState* play) { +void func_808AD450(Actor* thisx, PlayState* play2) { BgSpot02Objects* this = (BgSpot02Objects*)thisx; - s32 pad; + PlayState* play = (PlayState*)play2; f32 lerp; OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot02_objects.c", 736); diff --git a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c index ff24dcc5c..78d1e3d37 100644 --- a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c +++ b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c @@ -147,6 +147,8 @@ void BgSpot03Taki_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, object_spot03_object_DL_001580); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot03_taki.c", 358); this->bufferIndex = this->bufferIndex == 0; diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index 8784b28e2..5b183b972 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -62,8 +62,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000080, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 1, { { 0, 0, -160 }, 18 }, 100 }, @@ -111,11 +111,12 @@ void BgSpot06Objects_Init(Actor* thisx, PlayState* play) { if (LINK_IS_ADULT && Flags_GetSwitch(play, this->switchFlag)) { thisx->world.pos.y = thisx->home.pos.y + 120.0f; this->actionFunc = BgSpot06Objects_DoNothing; - } else { this->actionFunc = BgSpot06Objects_GateWaitForSwitch; } + if (1) {} + break; case LHO_WATER_TEMPLE_ENTRANCE_LOCK: Actor_ProcessInitChain(thisx, sInitChain); diff --git a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c index 17cdba2f1..3015e9015 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c @@ -37,8 +37,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 0, { { 0, 50, 50 }, 70 }, 100 }, @@ -48,8 +48,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 0, { { -100, 50, 50 }, 70 }, 100 }, @@ -59,8 +59,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 0, { { 100, 50, 50 }, 70 }, 100 }, diff --git a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c index f5ced0b3f..ab98d0d20 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c @@ -41,16 +41,20 @@ void BgSpot08Iceblock_SetupAction(BgSpot08Iceblock* this, BgSpot08IceblockAction void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + // "Warning: move BG registration failed" PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot08_iceblock.c", 0xD9, this->dyna.actor.id, this->dyna.actor.params); } +#endif } // Sets params to 0x10 (medium, nonrotating) if not in the cases listed. diff --git a/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c index 590ac9389..68f723fce 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c @@ -41,8 +41,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 40, 80, 0, { 2259, 108, -1580 } }, diff --git a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c index c65737af9..ff7c8e28b 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c +++ b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c @@ -125,7 +125,6 @@ void BgSpot11Oasis_Update(Actor* thisx, PlayState* play) { BgSpot11Oasis* this = (BgSpot11Oasis*)thisx; s32 pad; u32 gameplayFrames; - Vec3f sp30; this->actionFunc(this, play); if (this->actionFunc == func_808B2980) { @@ -136,6 +135,8 @@ void BgSpot11Oasis_Update(Actor* thisx, PlayState* play) { if (this->unk_150 && (this->actor.projectedPos.z < 400.0f) && (this->actor.projectedPos.z > -40.0f)) { gameplayFrames = play->gameplayFrames; if (gameplayFrames & 4) { + Vec3f sp30; + Math_Vec3f_Sum(&this->actor.world.pos, &D_808B2E34[this->unk_151], &sp30); EffectSsBubble_Spawn(play, &sp30, 0.0f, 15.0f, 50.0f, (Rand_ZeroOne() * 0.12f) + 0.02f); if (Rand_ZeroOne() < 0.3f) { diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c index e261a3523..cd5f89b84 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c @@ -46,15 +46,19 @@ static InitChainEntry sInitChain[] = { void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_gate.c", 145, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgSpot12Gate_Init(Actor* thisx, PlayState* play) { @@ -105,17 +109,19 @@ void func_808B317C(BgSpot12Gate* this) { void func_808B318C(BgSpot12Gate* this, PlayState* play) { s32 pad; - s32 quakeIndex; Math_StepToF(&this->dyna.actor.velocity.y, 1.6f, 0.03f); if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, this->dyna.actor.velocity.y)) { func_808B3274(this); - quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); - Quake_SetSpeed(quakeIndex, -0x3CB0); - Quake_SetPerturbations(quakeIndex, 3, 0, 0, 0); - Quake_SetDuration(quakeIndex, 12); + { + s32 quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + + Quake_SetSpeed(quakeIndex, -0x3CB0); + Quake_SetPerturbations(quakeIndex, 3, 0, 0, 0); + Quake_SetDuration(quakeIndex, 12); + } Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP); } else { diff --git a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c index 9700367f4..a242940b8 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c @@ -43,15 +43,19 @@ static InitChainEntry sInitChain[] = { void func_808B3420(BgSpot12Saku* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_saku.c", 140, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgSpot12Saku_Init(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index a2ce895d7..77a31675d 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -58,17 +58,19 @@ static Vec3f sBoxGroundCheckPoints[] = { void func_808B3960(BgSpot15Rrbox* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; - u32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot15_rrbox.c", 171, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void BgSpot15Rrbox_RotatePoint(Vec3f* outPos, Vec3f* pos, f32 arg2, f32 arg3) { @@ -224,11 +226,9 @@ s32 func_808B4010(BgSpot15Rrbox* this, PlayState* play) { } void func_808B4084(BgSpot15Rrbox* this, PlayState* play) { - this->actionFunc = func_808B40AC; this->dyna.actor.gravity = 0.0f; - this->dyna.actor.velocity.x = 0.0f; - this->dyna.actor.velocity.y = 0.0f; - this->dyna.actor.velocity.z = 0.0f; + this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; + this->actionFunc = func_808B40AC; } void func_808B40AC(BgSpot15Rrbox* this, PlayState* play) { @@ -260,11 +260,11 @@ void func_808B4194(BgSpot15Rrbox* this, PlayState* play) { s32 approxFResult; Actor* actor = &this->dyna.actor; - this->unk_174 += 0.5f; + this->unk_174 += 0.5f * BLOCK_PUSH_SPEED; - this->unk_174 = CLAMP_MAX(this->unk_174, 2.0f); + this->unk_174 = CLAMP_MAX(this->unk_174, 2.0f * BLOCK_PUSH_SPEED); - approxFResult = Math_StepToF(&this->unk_178, 20.0f, this->unk_174); + approxFResult = Math_StepToF(&this->unk_178, 20.0f * BLOCK_PUSH_SPEED, this->unk_174); sign = this->unk_17C >= 0.0f ? 1.0f : -1.0f; @@ -301,9 +301,7 @@ void func_808B4194(BgSpot15Rrbox* this, PlayState* play) { } void func_808B4380(BgSpot15Rrbox* this, PlayState* play) { - this->dyna.actor.velocity.x = 0.0f; - this->dyna.actor.velocity.y = 0.0f; - this->dyna.actor.velocity.z = 0.0f; + this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; this->dyna.actor.gravity = -1.0f; this->dyna.actor.floorHeight = BgSpot15Rrbox_GetFloorHeight(this, play); this->actionFunc = func_808B43D0; diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index 7a7a48561..46fbcc207 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -39,8 +39,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x4FC1FFF6, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 0, { { 0, 50, 0 }, 288 }, 100 }, @@ -73,8 +73,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 190, 80, 0, { 10, 0, 50 } }, @@ -230,8 +230,8 @@ s32 func_808B4E58(BgSpot16Bombstone* this, PlayState* play) { } void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play) { + s16 shouldLive = true; BgSpot16Bombstone* this = (BgSpot16Bombstone*)thisx; - s16 shouldLive; func_808B4C30(this); @@ -240,6 +240,7 @@ void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play) { // The boulder is intact shouldLive = func_808B4D9C(this, play); break; + case 0: case 1: case 2: @@ -249,11 +250,14 @@ void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play) { // The boulder is debris shouldLive = func_808B4E58(this, play); break; + +#if IS_DEBUG default: PRINTF("Error : arg_data ãŠã‹ã—ã„ãª(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot16_bombstone.c", 668, this->actor.params); shouldLive = false; break; +#endif } if (!shouldLive) { @@ -451,12 +455,14 @@ void func_808B5950(BgSpot16Bombstone* this, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } +#if IS_DEBUG if (mREG(64) == 1) { func_808B561C(this, play); mREG(64) = -10; } else if (mREG(64) < 0) { mREG(64)++; } +#endif } void func_808B5A78(BgSpot16Bombstone* this) { diff --git a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c index 84ca72ef5..92d1f9671 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c @@ -40,8 +40,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 2040, 0 }, 54 }, 100 }, @@ -51,8 +51,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 1, { { 0, 1400, 0 }, 13 }, 100 }, @@ -91,33 +91,33 @@ void func_808B7770(BgSpot18Basket* this, PlayState* play, f32 arg2) { s32 i; f32 randomValue; f32 sinValue; - s32 count; - for (i = 0, count = 2; i != count; i++) { - if (play) {} - if (!(arg2 < Rand_ZeroOne())) { - D_808B85D0 += 0x7530; - - sinValue = Math_SinS(D_808B85D0); - cosValue = Math_CosS(D_808B85D0); - - randomValue = (Rand_ZeroOne() * 35.0f) + 35.0f; - - position.x = (randomValue * sinValue) + this->dyna.actor.world.pos.x; - position.y = this->dyna.actor.world.pos.y + 10.0f; - position.z = (randomValue * cosValue) + this->dyna.actor.world.pos.z; - - velocity.x = sinValue; - velocity.y = 0.0f; - velocity.z = cosValue; - - acceleration.x = 0.0f; - acceleration.y = 0.5f; - acceleration.z = 0.0f; - - func_800286CC(play, &position, &velocity, &acceleration, ((Rand_ZeroOne() * 16) + 80), - ((Rand_ZeroOne() * 30) + 80)); + for (i = 0; i != 2; i++) { + if (arg2 < Rand_ZeroOne()) { + continue; } + + D_808B85D0 += 0x7530; + + sinValue = Math_SinS(D_808B85D0); + cosValue = Math_CosS(D_808B85D0); + + randomValue = (Rand_ZeroOne() * 35.0f) + 35.0f; + + position.x = (randomValue * sinValue) + this->dyna.actor.world.pos.x; + position.y = this->dyna.actor.world.pos.y + 10.0f; + position.z = (randomValue * cosValue) + this->dyna.actor.world.pos.z; + + velocity.x = sinValue; + velocity.y = 0.0f; + velocity.z = cosValue; + + acceleration.x = 0.0f; + acceleration.y = 0.5f; + acceleration.z = 0.0f; + + func_800286CC(play, &position, &velocity, &acceleration, ((Rand_ZeroOne() * 16) + 80), + ((Rand_ZeroOne() * 30) + 80)); } } @@ -240,9 +240,6 @@ void func_808B7D38(BgSpot18Basket* this) { } void func_808B7D50(BgSpot18Basket* this, PlayState* play) { - f32 tempValue2; - f32 tempValue; - if (this->unk_216 > 120) { Math_StepToS(&this->unk_210, 0x3E8, 0x32); } else { @@ -281,11 +278,12 @@ void func_808B7D50(BgSpot18Basket* this, PlayState* play) { func_808B7770(this, play, 0.8f); } - tempValue2 = (this->unk_210 - 500) * 0.0006f; + { + f32 tempValue2 = (this->unk_210 - 500) * 0.0006f; + f32 tempValue = CLAMP(tempValue2, 0.0f, 1.5f); - tempValue = CLAMP(tempValue2, 0.0f, 1.5f); - - func_800F436C(&this->dyna.actor.projectedPos, NA_SE_EV_WALL_MOVE_SP - SFX_FLAG, tempValue); + func_800F436C(&this->dyna.actor.projectedPos, NA_SE_EV_WALL_MOVE_SP - SFX_FLAG, tempValue); + } } void func_808B7F74(BgSpot18Basket* this) { @@ -308,9 +306,7 @@ void func_808B7F74(BgSpot18Basket* this) { void func_808B7FC0(BgSpot18Basket* this, PlayState* play) { s32 pad; s32 tempUnk214; - f32 tempUnk210; s16 arrayValue; - f32 clampedTempUnk210; this->unk_212 += 0xBB8; @@ -343,11 +339,12 @@ void func_808B7FC0(BgSpot18Basket* this, PlayState* play) { func_808B7770(this, play, 0.3f); } - tempUnk210 = (this->unk_210 - 500) * 0.0006f; + { + f32 tempUnk210 = (this->unk_210 - 500) * 0.0006f; + f32 clampedTempUnk210 = CLAMP(tempUnk210, 0.0f, 1.5f); - clampedTempUnk210 = CLAMP(tempUnk210, 0.0f, 1.5f); - - func_800F436C(&this->dyna.actor.projectedPos, NA_SE_EV_WALL_MOVE_SP - SFX_FLAG, clampedTempUnk210); + func_800F436C(&this->dyna.actor.projectedPos, NA_SE_EV_WALL_MOVE_SP - SFX_FLAG, clampedTempUnk210); + } } void func_808B818C(BgSpot18Basket* this) { diff --git a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c index 6b3d8095a..4c284b9b1 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c @@ -111,7 +111,7 @@ s32 func_808B8910(BgSpot18Obj* this, PlayState* play) { case 2: PRINTF("Error : Obj出ç¾åˆ¤å®šãŒè¨­å®šã•れã¦ã„ãªã„(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot18_obj.c", 202, this->dyna.actor.params); - break; + return 0; default: PRINTF("Error : Obj出ç¾åˆ¤å®šå¤±æ•—(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot18_obj.c", 210, this->dyna.actor.params); @@ -235,11 +235,9 @@ void func_808B8E7C(BgSpot18Obj* this, PlayState* play) { void func_808B8EE0(BgSpot18Obj* this) { this->actionFunc = func_808B8F08; - this->dyna.actor.world.rot.y = 0; this->dyna.actor.speed = 0.0f; - this->dyna.actor.velocity.z = 0.0f; - this->dyna.actor.velocity.y = 0.0f; - this->dyna.actor.velocity.x = 0.0f; + this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; + this->dyna.actor.world.rot.y = 0; } void func_808B8F08(BgSpot18Obj* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c index ce21d366a..3f8968a84 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c @@ -47,8 +47,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 10, 70, 0, { 0 } }, diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_1.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_1.c index 4581452d7..f6f5e3da7 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_1.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_1.c @@ -5,75 +5,75 @@ CutsceneData D_808BB2F0[] = { CS_BEGIN_CUTSCENE(9, 425), CS_PLAYER_CUE_LIST(1), - CS_PLAYER_CUE(PLAYER_CUEID_12, 0, 256, 0x0000, 0x0000, 0x0000, 0, 54, 52, 0, 54, 52, 0.0f, 0.0f, 0.0f), + CS_PLAYER_CUE(PLAYER_CUEID_12, 0, 256, 0x0000, 0x0000, 0x0000, 0, 54, 52, 0, 54, 52, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_LIGHT_SETTING_LIST(1), - CS_LIGHT_SETTING(0x0001, 110, 111, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFE3, 0xFFFFFFC5, 0x00000000, 0xFFFFFFE3, 0xFFFFFFC5), + CS_LIGHT_SETTING(0x0001, 110, 111, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFE3, 0xFFFFFFC5, 0x00000000, 0xFFFFFFE3, 0xFFFFFFC5, 0x00000000, 0x00000000, 0x00000000), CS_MISC_LIST(1), CS_MISC(CS_MISC_SET_CSFLAG_1, 110, 111, 0x0000, 0x00000000, 0x00000000, 0x0000002E, 0xFFFFFFE6, 0x00000000, 0x0000002E, 0xFFFFFFE6, 0x00000000, 0x00000000, 0x00000000), CS_DESTINATION(CS_DEST_TEMPLE_OF_TIME_FROM_MASTER_SWORD, 230, 231), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 210, 230), CS_CAM_EYE_SPLINE(0, 241), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -42, 72, -39, 0x018C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -42, 72, -39, 0x019D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -42, 72, -39, 0x01AE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -42, 72, -39, 0x02A8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -42, 72, -39, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -42, 72, -39, 0x007A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -42, 72, -39, 0x0064), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -42, 72, -39, 0x0074), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -42, 72, -39, 0x005F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -42, 72, -39, 0x018C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -42, 72, -39, 0x019D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -42, 72, -39, 0x01AE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -42, 72, -39, 0x02A8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -42, 72, -39, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -42, 72, -39, 0x007A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -42, 72, -39, 0x0064), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -42, 72, -39, 0x0074), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -42, 72, -39, 0x005F), CS_CAM_EYE_SPLINE(80, 406), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1, 95, -19, 0x2F73), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1, 95, -19, 0x6B2F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1, 95, -19, 0x6169), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1, 95, -19, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1, 95, -19, 0x0005), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1, 129, -34, 0x7961), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1, 173, -19, 0x742F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -17, 217, -20, 0x2E64), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -24, 328, -12, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -27, 509, -2, 0x2F73), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -41, 813, 10, 0x6B2F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -60, 1285, 38, 0x6D61), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -58, 1910, 91, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -53, 2526, 133, 0x0005), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -33, 3445, 193, 0x7961), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 0, 3960, 225, 0x742F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 7, 4317, 245, 0x6565), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 7, 4316, 245, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 7, 4316, 245, 0x2F73), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, 7, 4316, 245, 0x6B2F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1, 95, -19, 0x2F73), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1, 95, -19, 0x6B2F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1, 95, -19, 0x6169), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1, 95, -19, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1, 95, -19, 0x0005), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1, 129, -34, 0x7961), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1, 173, -19, 0x742F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -17, 217, -20, 0x2E64), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -24, 328, -12, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -27, 509, -2, 0x2F73), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -41, 813, 10, 0x6B2F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -60, 1285, 38, 0x6D61), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -58, 1910, 91, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -53, 2526, 133, 0x0005), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -33, 3445, 193, 0x7961), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 0, 3960, 225, 0x742F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 7, 4317, 245, 0x6565), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 7, 4316, 245, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 7, 4316, 245, 0x2F73), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 7, 4316, 245, 0x6B2F), CS_CAM_AT_SPLINE(0, 270), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -20, 85, -9, 0x2F73), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -20, 85, -9, 0x6B2F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -20, 85, -9, 0x6169), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -20, 85, -9, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -20, 85, -9, 0x0005), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -20, 85, -9, 0x7961), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -20, 85, -9, 0x742F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -20, 85, -9, 0x2E64), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.0f, -20, 85, -9, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -20, 85, -9, 0x2F73), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -20, 85, -9, 0x6B2F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -20, 85, -9, 0x6169), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -20, 85, -9, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -20, 85, -9, 0x0005), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -20, 85, -9, 0x7961), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -20, 85, -9, 0x742F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -20, 85, -9, 0x2E64), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -20, 85, -9, 0x0000), CS_CAM_AT_SPLINE(80, 425), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 60.0f, -1, 112, 7, 0x2F73), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 60.0f, -1, 112, 7, 0x6B2F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 60.0f, -1, 112, 7, 0x6169), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 60.0f, -1, 112, 7, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 60.0f, -1, 112, 7, 0x0005), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.0f, -1, 117, 7, 0x7961), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 25, 60.0f, -1, 117, 7, 0x742F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 25, 60.0f, -1, 117, 7, 0x2E64), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.0f, -1, 117, 7, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.0f, -1, 117, 7, 0x2F73), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.0f, -1, 117, 7, 0x6B2F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.0f, -1, 117, 7, 0x6D61), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.0f, -1, 117, 7, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.0f, -1, 117, 7, 0x0005), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.0f, -1, 117, 7, 0x7961), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.0f, -1, 117, 7, 0x742F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.0f, -1, 117, 7, 0x6565), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.0f, -1, 117, 7, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.0f, -1, 117, 7, 0x2F73), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 20, 60.0f, -1, 117, 7, 0x6B2F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42700000, 60.0f), -1, 112, 7, 0x2F73), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42700000, 60.0f), -1, 112, 7, 0x6B2F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42700000, 60.0f), -1, 112, 7, 0x6169), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42700000, 60.0f), -1, 112, 7, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42700000, 60.0f), -1, 112, 7, 0x0005), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x7961), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 25, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x742F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 25, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x2E64), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x2F73), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x6B2F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x6D61), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x0005), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x7961), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x742F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x6565), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x2F73), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 20, CS_FLOAT(0x42700000, 60.0f), -1, 117, 7, 0x6B2F), CS_END(), }; // clang-format on diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_2.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_2.c index 40b2ac294..ca4c06b77 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_2.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_2.c @@ -5,91 +5,91 @@ CutsceneData D_808BB7A0[] = { CS_BEGIN_CUTSCENE(9, 368), CS_CAM_EYE_SPLINE(0, 126), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1, 101, -110, 0x616D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.0f, -1, 101, -110, 0x6964), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.0f, -1, 101, -110, 0x00FB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.0f, -1, 101, -110, 0x0111), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.0f, -1, 101, -109, 0x012D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.0f, -1, 71, -110, 0x0033), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.0f, -1, 72, -110, 0x00FB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.0f, -1, 72, -110, 0x00FB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.0f, -1, 72, -110, 0x2F68), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 40.0f, -1, 72, -110, 0x612F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1, 101, -110, 0x616D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42200000, 40.0f), -1, 101, -110, 0x6964), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42200000, 40.0f), -1, 101, -110, 0x00FB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42200000, 40.0f), -1, 101, -110, 0x0111), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42200000, 40.0f), -1, 101, -109, 0x012D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42200000, 40.0f), -1, 71, -110, 0x0033), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42200000, 40.0f), -1, 72, -110, 0x00FB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42200000, 40.0f), -1, 72, -110, 0x00FB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42200000, 40.0f), -1, 72, -110, 0x2F68), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42200000, 40.0f), -1, 72, -110, 0x612F), CS_CAM_EYE_SPLINE(58, 339), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.000004f, -9, 106, -3, 0xA1BC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -9, 106, -3, 0xA5F3), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -9, 106, -3, 0xA5EB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -9, 106, -3, 0xA5A2), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -67, 108, -53, 0xBAEE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -67, 108, -53, 0xC9B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -67, 108, -53, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -67, 108, -53, 0xA5A4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -67, 108, -53, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -83, 102, -42, 0xA5E1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -116, 81, -19, 0xA5D0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -118, 81, 54, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -106, 78, 116, 0xA5A6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -27, 75, 226, 0xA5E5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 121, 82, 312, 0xC0AE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 296, 76, 374, 0xA5E5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 565, 80, 257, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 614, 80, -1, 0xA5EB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 594, 80, -145, 0xA5E1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 475, 80, -380, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 323, 80, -513, 0xA5E1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 192, 80, -574, 0xA5D0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -45, 80, -604, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -142, 80, -589, 0xA5A6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -228, 80, -562, 0xA5E5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -376, 93, -477, 0xC0AE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -584, 95, -183, 0xA5E5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -613, 95, -34, 0x0020), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -595, 95, 161, 0xA5EB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700001, 60.000004f), -9, 106, -3, 0xA1BC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -9, 106, -3, 0xA5F3), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -9, 106, -3, 0xA5EB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -9, 106, -3, 0xA5A2), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -67, 108, -53, 0xBAEE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -67, 108, -53, 0xC9B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -67, 108, -53, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -67, 108, -53, 0xA5A4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -67, 108, -53, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -83, 102, -42, 0xA5E1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -116, 81, -19, 0xA5D0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -118, 81, 54, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -106, 78, 116, 0xA5A6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -27, 75, 226, 0xA5E5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 121, 82, 312, 0xC0AE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 296, 76, 374, 0xA5E5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 565, 80, 257, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 614, 80, -1, 0xA5EB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 594, 80, -145, 0xA5E1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 475, 80, -380, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 323, 80, -513, 0xA5E1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 192, 80, -574, 0xA5D0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -45, 80, -604, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -142, 80, -589, 0xA5A6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -228, 80, -562, 0xA5E5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -376, 93, -477, 0xC0AE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -584, 95, -183, 0xA5E5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -613, 95, -34, 0x0020), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -595, 95, 161, 0xA5EB), CS_CAM_AT_SPLINE(0, 155), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 40.4f, -1, 111, 5, 0xA1BC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 40.0f, -1, 111, 5, 0xA5F3), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 40.0f, -1, 111, 5, 0xA5EB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 40.0f, -1, 111, 5, 0xA5A2), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 40.0f, -1, 111, 5, 0xBAEE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 40.0f, -1, 104, 8, 0xC9B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 40.0f, -1, 104, 8, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.0f, -1, 104, 8, 0xA5A4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.0f, -1, 104, 8, 0x0020), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 40.0f, -1, 104, 8, 0xA5E1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x4221999A, 40.4f), -1, 111, 5, 0xA1BC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42200000, 40.0f), -1, 111, 5, 0xA5F3), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42200000, 40.0f), -1, 111, 5, 0xA5EB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42200000, 40.0f), -1, 111, 5, 0xA5A2), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42200000, 40.0f), -1, 111, 5, 0xBAEE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42200000, 40.0f), -1, 104, 8, 0xC9B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42200000, 40.0f), -1, 104, 8, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42200000, 40.0f), -1, 104, 8, 0xA5A4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42200000, 40.0f), -1, 104, 8, 0x0020), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42200000, 40.0f), -1, 104, 8, 0xA5E1), CS_CAM_AT_SPLINE(58, 368), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 60.000004f, 0, 120, 12, 0xA1BC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 60.0f, 0, 120, 12, 0xA5F3), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 60.0f, 0, 120, 12, 0xA5EB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, 0, 120, 12, 0xA5A2), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 60.0f, -1, 95, 11, 0xBAEE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 60.0f, -1, 95, 11, 0xC9B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 60.0f, -1, 95, 11, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 60.0f, -1, 95, 11, 0xA5A4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 60.0f, -1, 95, 11, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, -3, 95, 8, 0xA5E1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, -3, 95, 8, 0xA5D0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, -3, 95, 8, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, -3, 95, 8, 0xA5A6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, -3, 95, 8, 0xA5E5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, -3, 95, 8, 0xC0AE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, -3, 95, 8, 0xA5E5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, -3, 95, 8, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, -3, 95, 8, 0xA5EB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, -3, 95, 8, 0xA5E1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, -3, 95, 8, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 60.0f, -3, 95, 8, 0xA5E1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 60.0f, -3, 95, 8, 0xA5D0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 60.0f, -3, 95, 8, 0x0020), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 60.0f, -3, 95, 8, 0xA5A6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 60.0f, -3, 95, 8, 0xA5E5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 60.0f, -3, 95, 8, 0xC0AE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 60.0f, -3, 95, 8, 0xA5E5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 60.0f, -3, 95, 8, 0x0020), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.0f, -3, 95, 8, 0xA5EB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42700001, 60.000004f), 0, 120, 12, 0xA1BC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42700000, 60.0f), 0, 120, 12, 0xA5F3), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42700000, 60.0f), 0, 120, 12, 0xA5EB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), 0, 120, 12, 0xA5A2), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42700000, 60.0f), -1, 95, 11, 0xBAEE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42700000, 60.0f), -1, 95, 11, 0xC9B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42700000, 60.0f), -1, 95, 11, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42700000, 60.0f), -1, 95, 11, 0xA5A4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x42700000, 60.0f), -1, 95, 11, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5E1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5D0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5A6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5E5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xC0AE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5E5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5EB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5E1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5E1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5D0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0x0020), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5A6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5E5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xC0AE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5E5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0x0020), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -3, 95, 8, 0xA5EB), CS_PLAYER_CUE_LIST(1), - CS_PLAYER_CUE(PLAYER_CUEID_12, 0, 180, 0x0000, 0x0000, 0x0000, 0, 28, -10, 0, -14, 9, 0.0f, -0.23333333f, 0.0f), + CS_PLAYER_CUE(PLAYER_CUEID_12, 0, 180, 0x0000, 0x0000, 0x0000, 0, 28, -10, 0, -14, 9, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xBE6EEEEF, -0.23333333f), CS_FLOAT(0x0, 0.0f)), CS_LIGHT_SETTING_LIST(1), - CS_LIGHT_SETTING(0x0001, 90, 91, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFF2, 0x00000024, 0x00000000, 0xFFFFFFF2, 0x00000024), + CS_LIGHT_SETTING(0x0001, 90, 91, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFF2, 0x00000024, 0x00000000, 0xFFFFFFF2, 0x00000024, 0x00000000, 0x00000000, 0x00000000), CS_MISC_LIST(1), CS_MISC(CS_MISC_SET_CSFLAG_1, 90, 91, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFF8, 0xFFFFFFDD, 0x00000000, 0xFFFFFFF8, 0xFFFFFFDD, 0x00000000, 0x00000000, 0x00000000), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 190, 210), diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_3.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_3.c index 4eb289cc4..f7f8d0067 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_3.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd_cutscene_data_3.c @@ -7,13 +7,13 @@ CutsceneData D_808BBD90[] = { CS_UNK_DATA_LIST(0x00000021, 1), CS_UNK_DATA(0x00010000, 0x0BB80000, 0x00000000, 0x00000000, 0xFFFFFFF8, 0xFFFFFFFF, 0x00000000, 0xFFFFFFF8, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000), CS_PLAYER_CUE_LIST(3), - CS_PLAYER_CUE(PLAYER_CUEID_5, 0, 1, 0x0000, 0x8000, 0x0000, 0, 0, 820, 0, 0, 820, 0.0f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_2, 1, 16, 0x0000, 0x8000, 0x0000, 0, 0, 820, 0, 0, 720, 0.0f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 16, 176, 0x0000, 0x8000, 0x0000, 0, 0, 720, 0, 0, 720, 0.0f, 0.0f, 1.4e-45f), + CS_PLAYER_CUE(PLAYER_CUEID_5, 0, 1, 0x0000, 0x8000, 0x0000, 0, 0, 820, 0, 0, 820, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_2, 1, 16, 0x0000, 0x8000, 0x0000, 0, 0, 820, 0, 0, 720, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 16, 176, 0x0000, 0x8000, 0x0000, 0, 0, 720, 0, 0, 720, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), CS_ACTOR_CUE_LIST(62, 3), - CS_ACTOR_CUE(0x0004, 40, 70, 0x7D74, 0x0000, 0x0000, -1, 49, 719, 1, 47, 687, 0.06666667f, -0.06666667f, -0.06666667f), - CS_ACTOR_CUE(0x0004, 70, 220, 0x8010, 0x0000, 0x0000, 1, 47, 687, 0, 134, 21, -0.006666667f, 0.58f, 0.006666667f), - CS_ACTOR_CUE(0x0002, 220, 272, 0x8000, 0x0000, 0x0000, 0, 134, 21, 0, 101, 2, 0.0f, -0.63461536f, 0.0f), + CS_ACTOR_CUE(0x0004, 40, 70, 0x7D74, 0x0000, 0x0000, -1, 49, 719, 1, 47, 687, CS_FLOAT(0x3D888889, 0.06666667f), CS_FLOAT(0xBD888889, -0.06666667f), CS_FLOAT(0xBD888889, -0.06666667f)), + CS_ACTOR_CUE(0x0004, 70, 220, 0x8010, 0x0000, 0x0000, 1, 47, 687, 0, 134, 21, CS_FLOAT(0xBBDA740E, -0.006666667f), CS_FLOAT(0x3F147AE1, 0.58f), CS_FLOAT(0x3BDA740E, 0.006666667f)), + CS_ACTOR_CUE(0x0002, 220, 272, 0x8000, 0x0000, 0x0000, 0, 134, 21, 0, 101, 2, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xBF227627, -0.63461536f), CS_FLOAT(0x0, 0.0f)), CS_MISC_LIST(1), CS_MISC(CS_MISC_STOP_CUTSCENE, 340, 341, 0x0000, 0x00000000, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFD, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFD, 0x00000000, 0x00000000, 0x00000000), CS_TEXT_LIST(6), @@ -24,73 +24,73 @@ CutsceneData D_808BBD90[] = { CS_TEXT_NONE(260, 290), CS_TEXT(0x70E8, 290, 320, 0x0000, 0x0000, 0x0000), CS_CAM_EYE_SPLINE(0, 251), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -59, 12, 690, 0x0222), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -59, 12, 690, 0x00FA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -59, 12, 690, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -59, 12, 690, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -59, 12, 690, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -31, 24, 701, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -31, 24, 701, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -31, 24, 701, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -31, 24, 701, 0x2D70), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -31, 24, 701, 0x0085), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -31, 24, 701, 0x01E6), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -31, 24, 701, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -59, 12, 690, 0x0222), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -59, 12, 690, 0x00FA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -59, 12, 690, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -59, 12, 690, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -59, 12, 690, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -31, 24, 701, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -31, 24, 701, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -31, 24, 701, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -31, 24, 701, 0x2D70), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -31, 24, 701, 0x0085), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -31, 24, 701, 0x01E6), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -31, 24, 701, 0x0000), CS_CAM_EYE_SPLINE(90, 331), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -154, 92, 236, 0x0222), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -154, 92, 236, 0x00FA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -154, 92, 236, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -154, 92, 236, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -154, 92, 236, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -154, 92, 236, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -154, 92, 236, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -154, 92, 236, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -154, 92, 236, 0x2D70), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -154, 92, 236, 0x0222), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -154, 92, 236, 0x00FA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -154, 92, 236, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -154, 92, 236, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -154, 92, 236, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -154, 92, 236, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -154, 92, 236, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -154, 92, 236, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -154, 92, 236, 0x2D70), CS_CAM_EYE_SPLINE(220, 491), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.000004f, -2, 122, 39, 0x0222), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.000004f, -2, 122, 39, 0x00FA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.000004f, -2, 102, 39, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.000004f, -2, 90, 39, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.000004f, -2, 81, 62, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.000004f, -2, 81, 62, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.000004f, -2, 81, 62, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.000004f, -2, 81, 62, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.000004f, -2, 81, 62, 0x2D70), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.000004f, -2, 81, 62, 0x0085), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700001, 60.000004f), -2, 122, 39, 0x0222), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700001, 60.000004f), -2, 122, 39, 0x00FA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700001, 60.000004f), -2, 102, 39, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700001, 60.000004f), -2, 90, 39, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700001, 60.000004f), -2, 81, 62, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700001, 60.000004f), -2, 81, 62, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700001, 60.000004f), -2, 81, 62, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700001, 60.000004f), -2, 81, 62, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700001, 60.000004f), -2, 81, 62, 0x2D70), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700001, 60.000004f), -2, 81, 62, 0x0085), CS_CAM_AT_SPLINE(0, 280), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 43, 52, 716, 0x0222), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 43, 52, 716, 0x00FA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, 43, 52, 716, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, 43, 52, 716, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, 43, 52, 716, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.0f, 63, 86, 722, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 63, 86, 722, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 63, 86, 722, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 63, 86, 722, 0x2D70), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 63, 85, 721, 0x0085), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 63, 85, 721, 0x01E6), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.0f, 62, 85, 721, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 43, 52, 716, 0x0222), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 43, 52, 716, 0x00FA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), 43, 52, 716, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), 43, 52, 716, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), 43, 52, 716, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42700000, 60.0f), 63, 86, 722, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 63, 86, 722, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 63, 86, 722, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 63, 86, 722, 0x2D70), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 63, 85, 721, 0x0085), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 63, 85, 721, 0x01E6), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 62, 85, 721, 0x0000), CS_CAM_AT_SPLINE(90, 360), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -105, 83, 366, 0x0222), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -104, 83, 364, 0x00FA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -63, 83, 339, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -16, 99, 255, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -30, 111, 177, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -80, 112, 121, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -80, 112, 121, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -80, 112, 121, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.0f, -80, 112, 121, 0x2D70), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -105, 83, 366, 0x0222), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -104, 83, 364, 0x00FA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -63, 83, 339, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -16, 99, 255, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -30, 111, 177, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -80, 112, 121, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -80, 112, 121, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -80, 112, 121, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -80, 112, 121, 0x2D70), CS_CAM_AT_SPLINE(220, 520), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.000004f, 0, 137, -55, 0x0222), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.000004f, 0, 137, -55, 0x00FA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.000004f, 0, 117, -55, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.000004f, 0, 105, -55, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.000004f, 0, 98, -31, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.000004f, 0, 98, -31, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.000004f, 0, 98, -31, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.000004f, 0, 98, -31, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.000004f, 0, 98, -31, 0x2D70), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.000004f, 0, 98, -31, 0x0085), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700001, 60.000004f), 0, 137, -55, 0x0222), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700001, 60.000004f), 0, 137, -55, 0x00FA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700001, 60.000004f), 0, 117, -55, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700001, 60.000004f), 0, 105, -55, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700001, 60.000004f), 0, 98, -31, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700001, 60.000004f), 0, 98, -31, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700001, 60.000004f), 0, 98, -31, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700001, 60.000004f), 0, 98, -31, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700001, 60.000004f), 0, 98, -31, 0x2D70), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42700001, 60.000004f), 0, 98, -31, 0x0085), CS_END(), }; // clang-format on diff --git a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth_cutscene_data.c b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth_cutscene_data.c index d905e2e62..0d06793b6 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth_cutscene_data.c +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth_cutscene_data.c @@ -7,40 +7,40 @@ CutsceneData D_808BCE20[] = { CS_UNK_DATA_LIST(0x00000015, 1), CS_UNK_DATA(0x00010000, 0x0BB80000, 0x00000000, 0x00000000, 0x0000000F, 0xFFFFFFDE, 0x00000000, 0x0000000F, 0xFFFFFFDE, 0x00000000, 0x00000000, 0x00000000), CS_PLAYER_CUE_LIST(2), - CS_PLAYER_CUE(PLAYER_CUEID_2, 0, 33, 0x54B2, 0x0000, 0x0000, 2614, 0, -451, 2808, 0, -559, 5.878788f, 0.0f, -5.878788f), - CS_PLAYER_CUE(PLAYER_CUEID_4, 33, 42, 0x5945, 0x0000, 0x0000, 2808, 0, -559, 2857, 0, -594, 5.4444447f, 0.0f, -5.4444447f), + CS_PLAYER_CUE(PLAYER_CUEID_2, 0, 33, 0x54B2, 0x0000, 0x0000, 2614, 0, -451, 2808, 0, -559, CS_FLOAT(0x40BC1F08, 5.878788f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xC0BC1F08, -5.878788f)), + CS_PLAYER_CUE(PLAYER_CUEID_4, 33, 42, 0x5945, 0x0000, 0x0000, 2808, 0, -559, 2857, 0, -594, CS_FLOAT(0x40AE38E4, 5.4444447f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xC0AE38E4, -5.4444447f)), CS_CAM_EYE_SPLINE(0, 1091), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 47.199955f, 2753, 46, -354, 0x59A8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 47.199955f, 2753, 46, -354, 0x20B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 47.199955f, 2753, 46, -354, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 47.199955f, 2753, 46, -354, 0x6430), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 47.199955f, 2753, 46, -354, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2753, 46, -354, 0x59A8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2753, 46, -354, 0x20B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2753, 46, -354, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2753, 46, -354, 0x6430), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2753, 46, -354, 0x0000), CS_CAM_EYE_SPLINE(60, 1271), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 47.199955f, 2753, 46, -354, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 47.199955f, 2753, 46, -354, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 47.199955f, 2753, 46, -354, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 47.199955f, 2705, 67, -302, 0x2D9A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 47.199955f, 2596, 127, -195, 0x005E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 47.199955f, 2596, 127, -195, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 47.199955f, 2596, 127, -195, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 47.199955f, 2596, 127, -195, 0x5B80), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 47.199955f, 2596, 127, -195, 0x7805), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2753, 46, -354, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2753, 46, -354, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2753, 46, -354, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2705, 67, -302, 0x2D9A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2596, 127, -195, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2596, 127, -195, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2596, 127, -195, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2596, 127, -195, 0x5B80), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x423CCCC1, 47.199955f), 2596, 127, -195, 0x7805), CS_CAM_AT_SPLINE(0, 1120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 47.199955f, 2788, 23, -453, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 47.199955f, 2787, 23, -453, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 47.199955f, 2787, 23, -453, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 47.199955f, 2787, 23, -453, 0x2D9A), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 47.199955f, 2787, 23, -453, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423CCCC1, 47.199955f), 2788, 23, -453, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423CCCC1, 47.199955f), 2787, 23, -453, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x423CCCC1, 47.199955f), 2787, 23, -453, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423CCCC1, 47.199955f), 2787, 23, -453, 0x2D9A), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x423CCCC1, 47.199955f), 2787, 23, -453, 0x005E), CS_CAM_AT_SPLINE(60, 1300), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 47.199955f, 2788, 23, -453, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 47.199955f, 2787, 23, -453, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 47.199955f, 2787, 23, -453, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 47.199955f, 2777, 72, -378, 0x2D9A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 47.199955f, 2673, 127, -267, 0x005E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 47.199955f, 2673, 127, -267, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 47.199955f, 2673, 127, -267, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 47.199955f, 2673, 127, -267, 0x5B80), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 47.199955f, 2673, 127, -267, 0x7805), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423CCCC1, 47.199955f), 2788, 23, -453, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423CCCC1, 47.199955f), 2787, 23, -453, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423CCCC1, 47.199955f), 2787, 23, -453, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423CCCC1, 47.199955f), 2777, 72, -378, 0x2D9A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423CCCC1, 47.199955f), 2673, 127, -267, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423CCCC1, 47.199955f), 2673, 127, -267, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x423CCCC1, 47.199955f), 2673, 127, -267, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423CCCC1, 47.199955f), 2673, 127, -267, 0x5B80), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x423CCCC1, 47.199955f), 2673, 127, -267, 0x7805), CS_TEXT_LIST(4), CS_TEXT_NONE(0, 40), CS_TEXT(0x107D, 40, 60, 0x0000, 0xFFFF, 0xFFFF), @@ -49,12 +49,12 @@ CutsceneData D_808BCE20[] = { CS_MISC_LIST(1), CS_MISC(CS_MISC_STOP_CUTSCENE, 180, 200, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFF7, 0xFFFFFFDB, 0x00000000, 0xFFFFFFF7, 0xFFFFFFDB, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(46, 1), - CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, -41, -28, 0, -41, -28, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, -41, -28, 0, -41, -28, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(62, 4), - CS_ACTOR_CUE(0x0001, 0, 1, 0x0000, 0x0000, 0x0000, 2668, 46, -490, 2668, 46, -490, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0004, 1, 50, 0x5479, 0x0000, 0x0000, 2668, 46, -490, 2890, 43, -612, 4.5306125f, -0.06122449f, -4.5306125f), - CS_ACTOR_CUE(0x0004, 50, 100, 0x505C, 0x0000, 0x0000, 2890, 43, -612, 3109, 121, -705, 4.38f, 1.56f, -4.38f), - CS_ACTOR_CUE(0x0001, 100, 2084, 0x0000, 0x0000, 0x0000, 3109, 121, -705, 3109, 121, -705, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 1, 0x0000, 0x0000, 0x0000, 2668, 46, -490, 2668, 46, -490, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0004, 1, 50, 0x5479, 0x0000, 0x0000, 2668, 46, -490, 2890, 43, -612, CS_FLOAT(0x4090FAC7, 4.5306125f), CS_FLOAT(0xBD7AC688, -0.06122449f), CS_FLOAT(0xC090FAC7, -4.5306125f)), + CS_ACTOR_CUE(0x0004, 50, 100, 0x505C, 0x0000, 0x0000, 2890, 43, -612, 3109, 121, -705, CS_FLOAT(0x408C28F6, 4.38f), CS_FLOAT(0x3FC7AE14, 1.56f), CS_FLOAT(0xC08C28F6, -4.38f)), + CS_ACTOR_CUE(0x0001, 100, 2084, 0x0000, 0x0000, 0x0000, 3109, 121, -705, 3109, 121, -705, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_START_SEQ_LIST(1), CS_START_SEQ(NA_BGM_DEKU_TREE_CS, 140, 141, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFBA, 0x00000094, 0x00000000, 0xFFFFFFBA, 0x00000094), CS_FADE_OUT_SEQ_LIST(1), @@ -69,31 +69,31 @@ CutsceneData D_808BD2A0[] = { CS_MISC_LIST(1), CS_MISC(CS_MISC_STOP_CUTSCENE, 90, 172, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFE3, 0x00000012, 0x00000000, 0xFFFFFFE3, 0x00000012, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(46, 1), - CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, -27, 26, 0, -27, 26, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, -27, 26, 0, -27, 26, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_CAM_EYE_SPLINE(0, 1091), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 3740, -141, -530, 0x7065), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.999928f, 3740, -141, -530, 0x6167), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.999928f, 3740, -141, -530, 0x6D5D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.999928f, 3740, -141, -530, 0xF348), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 40.999928f, 3740, -141, -530, 0x9D94), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 3740, -141, -530, 0x7065), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFED, 40.999928f), 3740, -141, -530, 0x6167), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFED, 40.999928f), 3740, -141, -530, 0x6D5D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFED, 40.999928f), 3740, -141, -530, 0xF348), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4223FFED, 40.999928f), 3740, -141, -530, 0x9D94), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(60, 1151), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -4, 5, 49, 0x7065), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -4, 5, 49, 0x6167), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -4, 5, 49, 0x6D5D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -4, 5, 49, 0xF348), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -4, 5, 49, 0x9D94), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -4, 5, 49, 0x7065), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -4, 5, 49, 0x6167), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -4, 5, 49, 0x6D5D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -4, 5, 49, 0xF348), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -4, 5, 49, 0x9D94), CS_CAM_AT_SPLINE(0, 1120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.999928f, 3777, -89, -605, 0x7065), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.999928f, 3777, -89, -605, 0x6167), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 40.999928f, 3776, -89, -605, 0x6D5D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.999928f, 3776, -89, -605, 0xF348), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 40.999928f, 3776, -89, -604, 0x9D94), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFED, 40.999928f), 3777, -89, -605, 0x7065), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFED, 40.999928f), 3777, -89, -605, 0x6167), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4223FFED, 40.999928f), 3776, -89, -605, 0x6D5D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFED, 40.999928f), 3776, -89, -605, 0xF348), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4223FFED, 40.999928f), 3776, -89, -604, 0x9D94), CS_CAM_AT_SPLINE_REL_TO_PLAYER(60, 1180), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 1, 35, -36, 0x7065), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 1, 35, -36, 0x6167), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 60.0f, 1, 35, -36, 0x6D5D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 1, 35, -36, 0xF348), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.0f, 1, 35, -36, 0x9D94), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 1, 35, -36, 0x7065), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 1, 35, -36, 0x6167), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42700000, 60.0f), 1, 35, -36, 0x6D5D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 1, 35, -36, 0xF348), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 1, 35, -36, 0x9D94), CS_TEXT_LIST(2), CS_TEXT_NONE(0, 20), CS_TEXT(0x1016, 20, 80, 0x0000, 0xFFFF, 0xFFFF), @@ -107,24 +107,24 @@ CutsceneData D_808BD520[] = { CS_UNK_DATA_LIST(0x00000015, 1), CS_UNK_DATA(0x00010000, 0x0BB80000, 0x00000000, 0x00000000, 0x0000000F, 0xFFFFFFDE, 0x00000000, 0x0000000F, 0xFFFFFFDE, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(46, 2), - CS_ACTOR_CUE(0x0001, 0, 20, 0x0000, 0x0000, 0x0000, 42, 0, 77, 42, 0, 77, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0003, 20, 357, 0x0000, 0x0000, 0x0000, 42, 0, 77, 42, 0, 77, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 20, 0x0000, 0x0000, 0x0000, 42, 0, 77, 42, 0, 77, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 20, 357, 0x0000, 0x0000, 0x0000, 42, 0, 77, 42, 0, 77, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_CAM_EYE_SPLINE(0, 1151), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 3740, -141, -530, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.999928f, 3740, -141, -530, 0x00FB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.999928f, 3740, -141, -530, 0x010C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.999928f, 3740, -141, -530, 0x0198), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.999928f, 3740, -141, -530, 0x019A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.999928f, 3740, -141, -530, 0x01AB), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 40.999928f, 3739, -141, -530, 0x01BC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 3740, -141, -530, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFED, 40.999928f), 3740, -141, -530, 0x00FB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFED, 40.999928f), 3740, -141, -530, 0x010C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFED, 40.999928f), 3740, -141, -530, 0x0198), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFED, 40.999928f), 3740, -141, -530, 0x019A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFED, 40.999928f), 3740, -141, -530, 0x01AB), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4223FFED, 40.999928f), 3739, -141, -530, 0x01BC), CS_CAM_AT_SPLINE(0, 1180), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.999928f, 3777, -89, -605, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.999928f, 3777, -89, -605, 0x00FB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.999928f, 3777, -89, -605, 0x010C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.999928f, 3763, -126, -621, 0x0198), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 40.999928f, 3763, -126, -621, 0x019A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.999928f, 3763, -126, -621, 0x01AB), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 40.999928f, 3765, -118, -617, 0x01BC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFED, 40.999928f), 3777, -89, -605, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFED, 40.999928f), 3777, -89, -605, 0x00FB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFED, 40.999928f), 3777, -89, -605, 0x010C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFED, 40.999928f), 3763, -126, -621, 0x0198), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4223FFED, 40.999928f), 3763, -126, -621, 0x019A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFED, 40.999928f), 3763, -126, -621, 0x01AB), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4223FFED, 40.999928f), 3765, -118, -617, 0x01BC), CS_TEXT_LIST(2), CS_TEXT_NONE(0, 20), CS_TEXT(0x1017, 20, 60, 0x0000, 0xFFFF, 0xFFFF), @@ -142,19 +142,19 @@ CutsceneData D_808BD790[] = { CS_UNK_DATA_LIST(0x00000015, 1), CS_UNK_DATA(0x00010000, 0x0BB80000, 0x00000000, 0x00000000, 0x0000000F, 0xFFFFFFDE, 0x00000000, 0x0000000F, 0xFFFFFFDE, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(46, 1), - CS_ACTOR_CUE(0x0001, 0, 119, 0x0000, 0x0000, 0x0000, 42, 0, 77, 42, 0, 77, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 119, 0x0000, 0x0000, 0x0000, 42, 0, 77, 42, 0, 77, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_CAM_EYE_SPLINE(0, 1091), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 75.59984f, 3716, 790, -1171, 0x54EC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 75.59984f, 3716, 790, -1171, 0x555C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 75.59984f, 3716, 790, -1171, 0x55CC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 75.59984f, 3716, 790, -1171, 0x563C), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 75.59984f, 3716, 790, -1171, 0x56AC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4297331E, 75.59984f), 3716, 790, -1171, 0x54EC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4297331E, 75.59984f), 3716, 790, -1171, 0x555C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4297331E, 75.59984f), 3716, 790, -1171, 0x55CC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4297331E, 75.59984f), 3716, 790, -1171, 0x563C), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4297331E, 75.59984f), 3716, 790, -1171, 0x56AC), CS_CAM_AT_SPLINE(0, 1120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 75.59984f, 3769, 718, -1186, 0x54EC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 75.59984f, 3769, 718, -1186, 0x555C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 75.59984f, 3769, 718, -1186, 0x55CC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 75.59984f, 3769, 718, -1186, 0x563C), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 75.59984f, 3769, 718, -1186, 0x56AC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4297331E, 75.59984f), 3769, 718, -1186, 0x54EC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4297331E, 75.59984f), 3769, 718, -1186, 0x555C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4297331E, 75.59984f), 3769, 718, -1186, 0x55CC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4297331E, 75.59984f), 3769, 718, -1186, 0x563C), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4297331E, 75.59984f), 3769, 718, -1186, 0x56AC), CS_TEXT_LIST(2), CS_TEXT_NONE(0, 20), CS_TEXT(0x1018, 20, 60, 0x0000, 0xFFFF, 0xFFFF), diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c index 706cbdee0..0b32afe5e 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c @@ -171,10 +171,10 @@ void BgYdanHasi_Update(Actor* thisx, PlayState* play) { void BgYdanHasi_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { gDTSlidingPlatformDL, gDTWaterPlaneDL, gDTRisingPlatformsDL }; - BgYdanHasi* this = (BgYdanHasi*)thisx; + s16 params = thisx->params; - if (this->dyna.actor.params == HASI_WATER_BLOCK || this->dyna.actor.params == HASI_THREE_BLOCKS) { - Gfx_DrawDListOpa(play, dLists[this->dyna.actor.params]); + if (params == HASI_WATER_BLOCK || params == HASI_THREE_BLOCKS) { + Gfx_DrawDListOpa(play, dLists[params]); } else { OPEN_DISPS(play->state.gfxCtx, "../z_bg_ydan_hasi.c", 577); diff --git a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c index 5a5e654cf..9d141c297 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c @@ -38,8 +38,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK0, { 0x20000000, 0x00, 0x04 }, { 0x00000004, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_WOOD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_WOOD, + ACELEM_ON, OCELEM_NONE, }, { { { 220.0f, -10.0f, 0.0f }, { 220.0f, 10.0f, 0.0f }, { -220.0f, 10.0f, 0.0f } } }, @@ -49,8 +49,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK0, { 0x20000000, 0x00, 0x04 }, { 0x00000004, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_WOOD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_WOOD, + ACELEM_ON, OCELEM_NONE, }, { { { 16.0f, 0.0f, 0.0f }, { 16.0f, 135.0f, 0.0f }, { -16.0f, 135.0f, 0.0f } } }, diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index 03114d162..1a5d2e366 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -42,8 +42,8 @@ static ColliderTrisElementInit sTrisItemsInit[2] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0x00020800, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 75.0f, -8.0f, 75.0f }, { -75.0f, -8.0f, 75.0f }, { -75.0f, -8.0f, -75.0f } } }, @@ -53,8 +53,8 @@ static ColliderTrisElementInit sTrisItemsInit[2] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0x00020800, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 140.0f, 288.8f, 0.0f }, { -140.0f, 288.0f, 0.0f }, { -140.0f, 0.0f, 0.0f } } }, @@ -417,6 +417,9 @@ void BgYdanSp_Draw(Actor* thisx, PlayState* play) { MtxF mtxF; OPEN_DISPS(play->state.gfxCtx, "../z_bg_ydan_sp.c", 781); + + if (1) {} + Gfx_SetupDL_25Xlu(play->state.gfxCtx); if (thisx->params == WEB_WALL) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_ydan_sp.c", 787), diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 632faf17e..a502fb6f2 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -105,27 +105,29 @@ void func_808C12C4(u8* arg1, s16 arg2) { func_808C1278(SEGMENTED_TO_VIRTUAL(object_kingdodongo_Tex_016E10), arg1, arg2); } -void func_808C1554(void* arg0, void* floorTex, s32 arg2, f32 arg3) { - u16* temp_s3 = SEGMENTED_TO_VIRTUAL(arg0); - u16* temp_s1 = SEGMENTED_TO_VIRTUAL(floorTex); +void func_808C1554(u16* arg0, u16* floorTex, s32 arg2, f32 arg3) { + s32 pad[2]; s16 i; s16 i2; u16 sp54[2048]; s16 temp; - s16 temp2; + + arg0 = SEGMENTED_TO_VIRTUAL(arg0); + floorTex = SEGMENTED_TO_VIRTUAL(floorTex); for (i = 0; i < 2048; i += 32) { temp = sinf((((i / 32) + (s16)((arg2 * 50.0f) / 100.0f)) & 0x1F) * (M_PI / 16)) * arg3; for (i2 = 0; i2 < 32; i2++) { - sp54[i + ((temp + i2) & 0x1F)] = temp_s1[i + i2]; + sp54[i + ((temp + i2) & 0x1F)] = floorTex[i + i2]; } } for (i = 0; i < 32; i++) { temp = sinf(((i + (s16)((arg2 * 80.0f) / 100.0f)) & 0x1F) * (M_PI / 16)) * arg3; temp *= 32; for (i2 = 0; i2 < 2048; i2 += 32) { - temp2 = (temp + i2) & 0x7FF; - temp_s3[i + temp2] = sp54[i + i2]; + s16 temp2 = (temp + i2) & 0x7FF; + + arg0[i + temp2] = sp54[i + i2]; } } } @@ -179,9 +181,6 @@ s32 BossDodongo_AteExplosive(BossDodongo* this, PlayState* play) { void BossDodongo_Init(Actor* thisx, PlayState* play) { BossDodongo* this = (BossDodongo*)thisx; s16 i; - u16* temp_s1_3; - u16* temp_s2; - u32 temp_v0; play->specialEffects = this->effects; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -202,8 +201,9 @@ void BossDodongo_Init(Actor* thisx, PlayState* play) { Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->items); if (Flags_GetClear(play, play->roomCtx.curRoom.num)) { // KD is dead - temp_s1_3 = SEGMENTED_TO_VIRTUAL(gDodongosCavernBossLavaFloorTex); - temp_s2 = SEGMENTED_TO_VIRTUAL(sLavaFloorRockTex); + u16* temp_s1_3 = SEGMENTED_TO_VIRTUAL(gDodongosCavernBossLavaFloorTex); + u16* temp_s2 = SEGMENTED_TO_VIRTUAL(sLavaFloorRockTex); + u32 temp_v0; Actor_Kill(&this->actor); Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, -890.0f, -1523.76f, -3304.0f, 0, 0, 0, @@ -488,8 +488,7 @@ void BossDodongo_SetupRoll(BossDodongo* this) { } void BossDodongo_SetupBlowFire(BossDodongo* this) { - this->actor.speed = 0.0f; - this->unk_1E4 = 0.0f; + this->actor.speed = this->unk_1E4 = 0.0f; Animation_Change(&this->skelAnime, &object_kingdodongo_Anim_0061D4, 1.0f, 0.0f, Animation_GetLastFrame(&object_kingdodongo_Anim_0061D4), ANIMMODE_ONCE, 0.0f); this->actionFunc = BossDodongo_BlowFire; @@ -913,8 +912,8 @@ void BossDodongo_Update(Actor* thisx, PlayState* play2) { Math_SmoothStepToF(&this->colorFilterMax, 1099.0f, 1, 10.0f, 0.0); } else { Math_SmoothStepToF(&this->colorFilterR, play->lightCtx.fogColor[0], 1, 5.0f, 0.0); - Math_SmoothStepToF(&this->colorFilterG, play->lightCtx.fogColor[1], 1.0f, 5.0f, 0.0); - Math_SmoothStepToF(&this->colorFilterB, play->lightCtx.fogColor[2], 1.0f, 5.0f, 0.0); + Math_SmoothStepToF(&this->colorFilterG, play->lightCtx.fogColor[1], 1, 5.0f, 0.0); + Math_SmoothStepToF(&this->colorFilterB, play->lightCtx.fogColor[2], 1, 5.0f, 0.0); Math_SmoothStepToF(&this->colorFilterMin, play->lightCtx.fogNear, 1.0, 5.0f, 0.0); Math_SmoothStepToF(&this->colorFilterMax, 1000.0f, 1, 5.0f, 0.0); } @@ -992,16 +991,17 @@ void BossDodongo_Update(Actor* thisx, PlayState* play2) { } } - func_808C1554(gDodongosCavernBossLavaFloorTex, sLavaFloorLavaTex, this->unk_19E, this->unk_224); + func_808C1554((u16*)gDodongosCavernBossLavaFloorTex, (u16*)sLavaFloorLavaTex, this->unk_19E, this->unk_224); } if (this->unk_1C6 != 0) { u16* ptr1 = SEGMENTED_TO_VIRTUAL(sLavaFloorLavaTex); u16* ptr2 = SEGMENTED_TO_VIRTUAL(sLavaFloorRockTex); s16 i2; + s16 new_var; for (i2 = 0; i2 < 20; i2++) { - s16 new_var = this->unk_1C2 & 0x7FF; + new_var = this->unk_1C2 & 0x7FF; ptr1[new_var] = ptr2[new_var]; this->unk_1C2 += 37; @@ -1239,12 +1239,12 @@ void BossDodongo_UpdateDamage(BossDodongo* this, PlayState* play) { if (this->unk_1C0 == 0) { if (this->actionFunc == BossDodongo_Inhale) { for (i = 0; i < 19; i++) { - if (this->collider.elements[i].base.bumperFlags & BUMP_HIT) { + if (this->collider.elements[i].base.acElemFlags & ACELEM_HIT) { acHitElem = this->collider.elements[i].base.acHitElem; - if ((acHitElem->toucher.dmgFlags & DMG_BOOMERANG) || - (acHitElem->toucher.dmgFlags & DMG_SLINGSHOT)) { - this->collider.elements[i].base.bumperFlags &= ~BUMP_HIT; + if ((acHitElem->atDmgInfo.dmgFlags & DMG_BOOMERANG) || + (acHitElem->atDmgInfo.dmgFlags & DMG_SLINGSHOT)) { + this->collider.elements[i].base.acElemFlags &= ~ACELEM_HIT; this->unk_1C0 = 2; BossDodongo_SetupWalk(this); this->unk_1DA = 0x32; @@ -1254,11 +1254,11 @@ void BossDodongo_UpdateDamage(BossDodongo* this, PlayState* play) { } } - if (this->collider.elements[0].base.bumperFlags & BUMP_HIT) { - this->collider.elements[0].base.bumperFlags &= ~BUMP_HIT; + if (this->collider.elements[0].base.acElemFlags & ACELEM_HIT) { + this->collider.elements[0].base.acElemFlags &= ~ACELEM_HIT; acHitElem = this->collider.elements[0].base.acHitElem; if ((this->actionFunc == BossDodongo_Vulnerable) || (this->actionFunc == BossDodongo_LayDown)) { - swordDamage = damage = CollisionCheck_GetSwordDamage(acHitElem->toucher.dmgFlags); + swordDamage = damage = CollisionCheck_GetSwordDamage(acHitElem->atDmgInfo.dmgFlags); if (damage != 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_K_DAMAGE); @@ -1272,8 +1272,7 @@ void BossDodongo_UpdateDamage(BossDodongo* this, PlayState* play) { } void BossDodongo_SetupDeathCutscene(BossDodongo* this) { - this->actor.speed = 0.0f; - this->unk_1E4 = 0.0f; + this->actor.speed = this->unk_1E4 = 0.0f; Animation_Change(&this->skelAnime, &object_kingdodongo_Anim_002D0C, 1.0f, 0.0f, Animation_GetLastFrame(&object_kingdodongo_Anim_002D0C), ANIMMODE_ONCE, -5.0f); this->actionFunc = BossDodongo_DeathCutscene; diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo_data.inc.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo_data.inc.c index 3a62ce533..189b0b94f 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo_data.inc.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo_data.inc.c @@ -16,8 +16,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK3, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 7, { { 8500, 1200, 0 }, 40 }, 100 }, @@ -27,8 +27,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK3, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 33, { { 2000, -2000, 0 }, 60 }, 100 }, @@ -38,8 +38,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 1, { { 0, 0, 0 }, 60 }, 100 }, @@ -49,8 +49,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 15, { { 0, 0, 0 }, 20 }, 100 }, @@ -60,8 +60,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 16, { { 0, 0, 0 }, 30 }, 100 }, @@ -71,8 +71,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 17, { { 0, 0, 0 }, 40 }, 100 }, @@ -82,8 +82,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 22, { { 0, 0, 0 }, 30 }, 100 }, @@ -93,8 +93,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 23, { { 0, 0, 0 }, 20 }, 100 }, @@ -104,8 +104,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 24, { { 0, 0, 0 }, 30 }, 100 }, @@ -115,8 +115,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 29, { { 0, 0, 0 }, 30 }, 100 }, @@ -126,8 +126,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 30, { { 0, 0, 0 }, 30 }, 100 }, @@ -137,8 +137,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 31, { { 0, 0, 0 }, 30 }, 100 }, @@ -148,8 +148,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 32, { { 0, 0, 0 }, 50 }, 100 }, @@ -159,8 +159,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 38, { { 0, 0, 0 }, 30 }, 100 }, @@ -170,8 +170,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 39, { { 0, 0, 0 }, 30 }, 100 }, @@ -181,8 +181,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 40, { { 0, 0, 0 }, 40 }, 100 }, @@ -192,8 +192,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 45, { { 0, 0, 0 }, 30 }, 100 }, @@ -203,8 +203,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 46, { { 0, 0, 0 }, 30 }, 100 }, @@ -214,8 +214,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 47, { { 0, 0, 0 }, 40 }, 100 }, diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 172fd4c5f..6ba94dbed 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -258,7 +258,6 @@ static Vec3f sCeilingTargets[] = { void BossFd_Fly(BossFd* this, PlayState* play) { u8 sp1CF = false; - u8 temp_rand; s16 i1; s16 i2; s16 i3; @@ -272,7 +271,6 @@ void BossFd_Fly(BossFd* this, PlayState* play) { f32 temp_y; f32 temp_x; f32 temp_z; - f32 temp; SkelAnime_Update(&this->skelAnimeHead); SkelAnime_Update(&this->skelAnimeRightArm); @@ -476,13 +474,13 @@ void BossFd_Fly(BossFd* this, PlayState* play) { this->subCamAtVel.y = 85.56f; this->subCamAtVel.z = 25.0f; } else { - // the following `temp` stuff is probably fake but is required to match + // the following `temp_z` stuff is probably fake but is required to match // it's optimized to 1.0f because sp1CF is false at this point, but the 0.1f ends up in rodata - temp = 0.1f; + temp_z = 0.1f; if (!sp1CF) { - temp = 1.0f; + temp_z = 1.0f; } - Math_ApproachF(&this->subCamShake, 2.0f, temp, 0.1 * 0.08f); + Math_ApproachF(&this->subCamShake, 2.0f, temp_z, 0.1 * 0.08f); this->subCamAtYOffset = Math_CosS(this->work[BFD_MOVE_TIMER] * 0x8000) * this->subCamShake; } if (this->timers[3] == 160) { @@ -561,6 +559,8 @@ void BossFd_Fly(BossFd* this, PlayState* play) { this->timers[0] = 0; this->timers[1] = 100; } else { + u8 temp_rand; + if (this->introState != BFD_CS_NONE) { this->holeIndex = 6; } else { @@ -919,12 +919,6 @@ void BossFd_Fly(BossFd* this, PlayState* play) { if (!this->work[BFD_STOP_FLAG]) { s16 i4; - Vec3f spE0[3]; - Vec3f spBC[3]; - f32 phi_f20; - f32 padB4; - f32 padB0; - f32 padAC; Math_ApproachS(&this->actor.world.rot.y, angleToTarget, 0xA, this->fwork[BFD_TURN_RATE]); @@ -993,6 +987,8 @@ void BossFd_Fly(BossFd* this, PlayState* play) { } if (!sp1CF) { + Vec3f spE0[3]; + Vec3f spBC[3]; spE0[0].x = spE0[0].y = Math_SinS(this->work[BFD_MOVE_TIMER] * 1500.0f) * 3000.0f; spE0[1].x = Math_SinS(this->work[BFD_MOVE_TIMER] * 2000.0f) * 4000.0f; spE0[1].y = Math_SinS(this->work[BFD_MOVE_TIMER] * 2200.0f) * 4000.0f; @@ -1012,7 +1008,11 @@ void BossFd_Fly(BossFd* this, PlayState* play) { } } else { for (i2 = 0; i2 < 3; i2++) { - phi_f20 = 0.0f; + f32 phi_f20 = 0.0f; + f32 padB4; + f32 padB0; + f32 padAC; + Math_ApproachZeroF(&this->rightArmRot[i2].y, 0.1f, 100.0f); Math_ApproachZeroF(&this->leftArmRot[i2].y, 0.1f, 100.0f); if (i2 == 0) { @@ -1027,14 +1027,16 @@ void BossFd_Fly(BossFd* this, PlayState* play) { void BossFd_Wait(BossFd* this, PlayState* play) { if (this->handoffSignal == FD2_SIGNAL_FLY) { // Set by BossFd2 - u8 temp_rand; - this->handoffSignal = FD2_SIGNAL_NONE; BossFd_SetupFly(this, play); - do { - temp_rand = Rand_ZeroFloat(8.9f); - } while (temp_rand == this->holeIndex); - this->holeIndex = temp_rand; + { + u8 temp_rand; + + do { + temp_rand = Rand_ZeroFloat(8.9f); + } while (temp_rand == this->holeIndex); + this->holeIndex = temp_rand; + } if (1) {} // Needed for matching this->targetPosition.x = sHoleLocations[this->holeIndex].x; this->targetPosition.y = sHoleLocations[this->holeIndex].y - 200.0f; @@ -1071,7 +1073,6 @@ void BossFd_Effects(BossFd* this, PlayState* play) { s16 eyeStates[] = { EYE_OPEN, EYE_HALF, EYE_CLOSED, EYE_CLOSED, EYE_HALF }; f32 temp_x; f32 temp_z; - s16 i; if (1) {} // Needed for match @@ -1088,6 +1089,8 @@ void BossFd_Effects(BossFd* this, PlayState* play) { play->envCtx.prevLightSetting = 0; Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.05f); } else if (this->fogMode == 2) { + s16 pad; + this->fogMode--; play->envCtx.lightSettingOverride = 0; Math_ApproachF(&play->envCtx.lightBlend, 0.55f + 0.05f * Math_SinS(this->work[BFD_VAR_TIMER] * 0x3E00), 1.0f, @@ -1096,6 +1099,8 @@ void BossFd_Effects(BossFd* this, PlayState* play) { play->envCtx.lightSetting = 3; play->envCtx.prevLightSetting = 0; } else if (this->fogMode == 10) { + s16 pad; + this->fogMode = 1; play->envCtx.lightSettingOverride = 0; Math_ApproachF(&play->envCtx.lightBlend, 0.21f + 0.07f * Math_SinS(this->work[BFD_VAR_TIMER] * 0xC00), 1.0f, @@ -1150,7 +1155,7 @@ void BossFd_Effects(BossFd* this, PlayState* play) { Vec3f spawnVel1; Vec3f spawnAccel1; Vec3f spawnPos1; - s32 pad; + s16 i; Audio_PlaySfxGeneral(NA_SE_EN_VALVAISA_APPEAR - SFX_FLAG, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1220,6 +1225,7 @@ void BossFd_Effects(BossFd* this, PlayState* play) { breathOpacity = (this->fireBreathTimer >= 6) ? 255 : this->fireBreathTimer * 50; } if (breathOpacity != 0) { + s16 i; f32 spawnAngleX; f32 spawnAngleY; Vec3f spawnSpeed2 = { 0.0f, 0.0f, 0.0f }; @@ -1281,11 +1287,11 @@ void BossFd_CollisionCheck(BossFd* this, PlayState* play) { ColliderJntSphElement* headCollider = &this->collider.elements[0]; ColliderElement* acHitElem; - if (headCollider->base.bumperFlags & BUMP_HIT) { - headCollider->base.bumperFlags &= ~BUMP_HIT; + if (headCollider->base.acElemFlags & ACELEM_HIT) { + headCollider->base.acElemFlags &= ~ACELEM_HIT; acHitElem = headCollider->base.acHitElem; this->actor.colChkInfo.health -= 2; - if (acHitElem->toucher.dmgFlags & DMG_ARROW_ICE) { + if (acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_ICE) { this->actor.colChkInfo.health -= 2; } if ((s8)this->actor.colChkInfo.health <= 2) { @@ -1299,12 +1305,8 @@ void BossFd_CollisionCheck(BossFd* this, PlayState* play) { } void BossFd_Update(Actor* thisx, PlayState* play) { - s32 pad; - BossFd* this = (BossFd*)thisx; - f32 headGlow; - f32 rManeGlow; - f32 lManeGlow; s16 i; + BossFd* this = (BossFd*)thisx; PRINTF("FD MOVE START \n"); this->work[BFD_VAR_TIMER]++; @@ -1339,47 +1341,55 @@ void BossFd_Update(Actor* thisx, PlayState* play) { this->fwork[BFD_TEX2_SCROLL_X] += 3.0f; this->fwork[BFD_TEX2_SCROLL_Y] -= 2.0f; - Math_ApproachF(&this->fwork[BFD_BODY_TEX2_ALPHA], (this->work[BFD_VAR_TIMER] & 0x10) ? 30.0f : 158.0f, 1.0f, 8.0f); - if (this->skinSegments == 0) { - this->fwork[BFD_HEAD_TEX2_ALPHA] = this->fwork[BFD_BODY_TEX2_ALPHA]; - } else { - headGlow = (this->work[BFD_VAR_TIMER] & 4) ? 0.0f : 255.0f; - Math_ApproachF(&this->fwork[BFD_HEAD_TEX2_ALPHA], headGlow, 1.0f, 64.0f); - } + if (1) { + f32 headGlow; + f32 rManeGlow; + f32 lManeGlow; + s32 pad; - headGlow = (this->work[BFD_VAR_TIMER] & 8) ? 128.0f : 255.0f; - rManeGlow = ((this->work[BFD_VAR_TIMER] + 3) & 8) ? 128.0f : 255.0f; - lManeGlow = ((this->work[BFD_VAR_TIMER] + 6) & 8) ? 128.0f : 255.0f; + Math_ApproachF(&this->fwork[BFD_BODY_TEX2_ALPHA], (this->work[BFD_VAR_TIMER] & 0x10) ? 30.0f : 158.0f, 1.0f, + 8.0f); + if (this->skinSegments == 0) { + this->fwork[BFD_HEAD_TEX2_ALPHA] = this->fwork[BFD_BODY_TEX2_ALPHA]; + } else { + headGlow = (this->work[BFD_VAR_TIMER] & 4) ? 0.0f : 255.0f; + Math_ApproachF(&this->fwork[BFD_HEAD_TEX2_ALPHA], headGlow, 1.0f, 64.0f); + } - Math_ApproachF(&this->fwork[BFD_MANE_COLOR_CENTER], headGlow, 1.0f, 16.0f); - Math_ApproachF(&this->fwork[BFD_MANE_COLOR_RIGHT], rManeGlow, 1.0f, 16.0f); - Math_ApproachF(&this->fwork[BFD_MANE_COLOR_LEFT], lManeGlow, 1.0f, 16.0f); + headGlow = (this->work[BFD_VAR_TIMER] & 8) ? 128.0f : 255.0f; + rManeGlow = ((this->work[BFD_VAR_TIMER] + 3) & 8) ? 128.0f : 255.0f; + lManeGlow = ((this->work[BFD_VAR_TIMER] + 6) & 8) ? 128.0f : 255.0f; - if (this->work[BFD_ROCK_TIMER] != 0) { - this->work[BFD_ROCK_TIMER]--; - if ((this->work[BFD_ROCK_TIMER] % 16) == 0) { - EnVbBall* bossFdRock = (EnVbBall*)Actor_SpawnAsChild( - &play->actorCtx, &this->actor, play, ACTOR_EN_VB_BALL, this->actor.world.pos.x, 1000.0f, - this->actor.world.pos.z, 0, 0, (s16)Rand_ZeroFloat(50.0f) + 130, 100); + Math_ApproachF(&this->fwork[BFD_MANE_COLOR_CENTER], headGlow, 1.0f, 16.0f); + Math_ApproachF(&this->fwork[BFD_MANE_COLOR_RIGHT], rManeGlow, 1.0f, 16.0f); + Math_ApproachF(&this->fwork[BFD_MANE_COLOR_LEFT], lManeGlow, 1.0f, 16.0f); - if (bossFdRock != NULL) { - for (i = 0; i < 10; i++) { - Vec3f debrisVel = { 0.0f, 0.0f, 0.0f }; - Vec3f debrisAccel = { 0.0f, -1.0f, 0.0f }; - Vec3f debrisPos; + if (this->work[BFD_ROCK_TIMER] != 0) { + this->work[BFD_ROCK_TIMER]--; + if ((this->work[BFD_ROCK_TIMER] % 16) == 0) { + EnVbBall* bossFdRock = (EnVbBall*)Actor_SpawnAsChild( + &play->actorCtx, &this->actor, play, ACTOR_EN_VB_BALL, this->actor.world.pos.x, 1000.0f, + this->actor.world.pos.z, 0, 0, (s16)Rand_ZeroFloat(50.0f) + 130, 100); - debrisPos.x = Rand_CenteredFloat(300.0f) + bossFdRock->actor.world.pos.x; - debrisPos.y = Rand_CenteredFloat(300.0f) + bossFdRock->actor.world.pos.y; - debrisPos.z = Rand_CenteredFloat(300.0f) + bossFdRock->actor.world.pos.z; + if (bossFdRock != NULL) { + for (i = 0; i < 10; i++) { + Vec3f debrisVel = { 0.0f, 0.0f, 0.0f }; + Vec3f debrisAccel = { 0.0f, -1.0f, 0.0f }; + Vec3f debrisPos; - BossFd_SpawnDebris(this->effects, &debrisPos, &debrisVel, &debrisAccel, - (s16)Rand_ZeroFloat(15.0f) + 20); + debrisPos.x = Rand_CenteredFloat(300.0f) + bossFdRock->actor.world.pos.x; + debrisPos.y = Rand_CenteredFloat(300.0f) + bossFdRock->actor.world.pos.y; + debrisPos.z = Rand_CenteredFloat(300.0f) + bossFdRock->actor.world.pos.z; + + BossFd_SpawnDebris(this->effects, &debrisPos, &debrisVel, &debrisAccel, + (s16)Rand_ZeroFloat(15.0f) + 20); + } } } } } - if (1) { // Needed for matching, and also to define new variables + if (1) { Vec3f emberVel = { 0.0f, 0.0f, 0.0f }; Vec3f emberAccel = { 0.0f, 0.0f, 0.0f }; Vec3f emberPos; @@ -1432,7 +1442,7 @@ void BossFd_UpdateEffects(BossFd* this, PlayState* play) { Color_RGB8 colors[4] = { { 255, 128, 0 }, { 255, 0, 0 }, { 255, 255, 0 }, { 255, 0, 0 } }; Vec3f diff; s16 i1; - s16 i2; + s16 cInd; for (i1 = 0; i1 < BOSSFD_EFFECT_COUNT; i1++, effect++) { if (effect->type != BFD_FX_NONE) { @@ -1446,7 +1456,7 @@ void BossFd_UpdateEffects(BossFd* this, PlayState* play) { effect->velocity.y += effect->accel.y; effect->velocity.z += effect->accel.z; if (effect->type == BFD_FX_EMBER) { - s16 cInd = effect->timer1 % 4; + cInd = effect->timer1 % 4; effect->color.r = colors[cInd].r; effect->color.g = colors[cInd].g; @@ -1477,6 +1487,8 @@ void BossFd_UpdateEffects(BossFd* this, PlayState* play) { this->timers[3] = 50; func_8002F6D4(play, NULL, 5.0f, effect->kbAngle, 0.0f, 0x30); if (!player->bodyIsBurning) { + s16 i2; + for (i2 = 0; i2 < PLAYER_BODYPART_MAX; i2++) { player->bodyFlameTimers[i2] = Rand_S16Offset(0, 200); } @@ -1883,20 +1895,19 @@ void BossFd_DrawBody(PlayState* play, BossFd* this) { Vec3f spF0 = { 0.0f, 0.0f, 0.0f }; Vec3f spE4; Vec3s spDC; - f32 padD8; + f32 spD8; + f32 spD4; if (this->bodyFallApart[i] < 2) { - f32 spD4 = 0.1f; + spD8 = spD4 = 0.1f; - temp_float = 0.1f; Matrix_Translate(0.0f, 0.0f, -1100.0f, MTXMODE_APPLY); Matrix_RotateY(-M_PI, MTXMODE_APPLY); if (i >= 14) { f32 sp84 = 1.0f - ((i - 14) * 0.2f); Matrix_Scale(sp84, sp84, 1.0f, MTXMODE_APPLY); - spD4 = 0.1f * sp84; - temp_float = 0.1f * sp84; + spD4 = spD8 = spD8 * sp84; } Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_fd.c", 4768), @@ -1913,7 +1924,7 @@ void BossFd_DrawBody(PlayState* play, BossFd* this) { bones = (EnVbBall*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_VB_BALL, spE4.x, spE4.y, spE4.z, spDC.x, spDC.y, spDC.z, i + 200); - bones->actor.scale.x = this->actor.scale.x * temp_float; + bones->actor.scale.x = this->actor.scale.x * spD8; bones->actor.scale.y = this->actor.scale.y * spD4; bones->actor.scale.z = this->actor.scale.z * 0.1f; } diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd_colchk.inc.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd_colchk.inc.c index c7b6a8b80..2e437fdf8 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd_colchk.inc.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd_colchk.inc.c @@ -6,8 +6,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK3, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 20 }, 100 }, @@ -17,8 +17,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 1, { { 0, 0, 0 }, 20 }, 100 }, @@ -28,8 +28,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 2, { { 0, 0, 0 }, 20 }, 100 }, @@ -39,8 +39,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 3, { { 0, 0, 0 }, 20 }, 100 }, @@ -50,8 +50,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 4, { { 0, 0, 0 }, 20 }, 100 }, @@ -61,8 +61,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 5, { { 0, 0, 0 }, 20 }, 100 }, @@ -72,8 +72,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 6, { { 0, 0, 0 }, 20 }, 100 }, @@ -83,8 +83,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 7, { { 0, 0, 0 }, 20 }, 100 }, @@ -94,8 +94,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 8, { { 0, 0, 0 }, 20 }, 100 }, @@ -105,8 +105,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 9, { { 0, 0, 0 }, 20 }, 100 }, @@ -116,8 +116,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 10, { { 0, 0, 0 }, 20 }, 100 }, @@ -127,8 +127,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 11, { { 0, 0, 0 }, 20 }, 100 }, @@ -138,8 +138,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 12, { { 0, 0, 0 }, 20 }, 100 }, @@ -149,8 +149,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 13, { { 0, 0, 0 }, 20 }, 100 }, @@ -160,8 +160,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 14, { { 0, 0, 0 }, 18 }, 100 }, @@ -171,8 +171,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 15, { { 0, 0, 0 }, 16 }, 100 }, @@ -182,8 +182,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 16, { { 0, 0, 0 }, 14 }, 100 }, @@ -193,8 +193,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 17, { { 0, 0, 0 }, 12 }, 100 }, @@ -204,8 +204,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[19] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 18, { { 0, 0, 0 }, 10 }, 100 }, diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index 16a9ad1fd..7a0895bdc 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -224,11 +224,10 @@ void BossFd2_SetupEmerge(BossFd2* this, PlayState* play) { } void BossFd2_Emerge(BossFd2* this, PlayState* play) { - s8 health; + s16 holeTime; BossFd* bossFd = (BossFd*)this->actor.parent; Player* player = GET_PLAYER(play); s16 i; - s16 holeTime; PRINTF("UP 1 mode %d\n", this->work[FD2_ACTION_STATE]); SkelAnime_Update(&this->skelAnime); @@ -239,6 +238,8 @@ void BossFd2_Emerge(BossFd2* this, PlayState* play) { PRINTF("PL time %x \n", player); PRINTF("MT time %x \n", bossFd); if ((this->timers[0] == 0) && (player->actor.world.pos.y > 70.0f)) { + s8 health; + PRINTF("UP 1.6 \n"); bossFd->faceExposed = 0; bossFd->holePosition.x = this->actor.world.pos.x; @@ -645,7 +646,6 @@ void BossFd2_Death(BossFd2* this, PlayState* play) { f32 pad3; f32 pad2; f32 pad1; - f32 cameraShake; SkelAnime* skelAnime = &this->skelAnime; SkelAnime_Update(skelAnime); @@ -766,6 +766,8 @@ void BossFd2_Death(BossFd2* this, PlayState* play) { this->subCamEyeNext.y = 140.0f; Math_ApproachF(&this->subCamEyeNext.z, 220.0f, 0.5f, 1.15f); if (bossFd->work[BFD_CAM_SHAKE_TIMER] != 0) { + f32 cameraShake; + bossFd->work[BFD_CAM_SHAKE_TIMER]--; cameraShake = bossFd->work[BFD_CAM_SHAKE_TIMER] / 0.5f; if (cameraShake >= 20.0f) { @@ -813,8 +815,8 @@ void BossFd2_CollisionCheck(BossFd2* this, PlayState* play) { Player* player = GET_PLAYER(play); for (i = 0; i < ARRAY_COUNT(this->elements); i++) { - if (this->collider.elements[i].base.toucherFlags & TOUCH_HIT) { - this->collider.elements[i].base.toucherFlags &= ~TOUCH_HIT; + if (this->collider.elements[i].base.atElemFlags & ATELEM_HIT) { + this->collider.elements[i].base.atElemFlags &= ~ATELEM_HIT; Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); } } @@ -827,12 +829,12 @@ void BossFd2_CollisionCheck(BossFd2* this, PlayState* play) { this->collider.base.colType = COLTYPE_HIT3; } - if (this->collider.elements[0].base.bumperFlags & BUMP_HIT) { - this->collider.elements[0].base.bumperFlags &= ~BUMP_HIT; + if (this->collider.elements[0].base.acElemFlags & ACELEM_HIT) { + this->collider.elements[0].base.acElemFlags &= ~ACELEM_HIT; acHitElem = this->collider.elements[0].base.acHitElem; if (!bossFd->faceExposed) { - if (acHitElem->toucher.dmgFlags & DMG_HAMMER) { + if (acHitElem->atDmgInfo.dmgFlags & DMG_HAMMER) { bossFd->actor.colChkInfo.health -= 2; if ((s8)bossFd->actor.colChkInfo.health <= 2) { bossFd->actor.colChkInfo.health = 1; @@ -863,12 +865,12 @@ void BossFd2_CollisionCheck(BossFd2* this, PlayState* play) { u8 canKill = false; u8 damage; - if ((damage = CollisionCheck_GetSwordDamage(acHitElem->toucher.dmgFlags)) == 0) { - damage = (acHitElem->toucher.dmgFlags & DMG_ARROW_ICE) ? 4 : 2; + if ((damage = CollisionCheck_GetSwordDamage(acHitElem->atDmgInfo.dmgFlags)) == 0) { + damage = (acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_ICE) ? 4 : 2; } else { canKill = true; } - if (acHitElem->toucher.dmgFlags & DMG_HOOKSHOT) { + if (acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT) { damage = 0; } if (((s8)bossFd->actor.colChkInfo.health > 2) || canKill) { @@ -1061,7 +1063,7 @@ void BossFd2_UpdateMane(BossFd2* this, PlayState* play, Vec3f* head, Vec3f* pos, f32 spE8[10] = { 0.4f, 0.6f, 0.8f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; s16 i; Vec3f temp_vec; - f32 temp_f2; + f32 temp_radius; f32 phi_f0; f32 temp_angleX; f32 temp_angleY; @@ -1089,9 +1091,8 @@ void BossFd2_UpdateMane(BossFd2* this, PlayState* play, Vec3f* head, Vec3f* pos, temp_vec.x = (pos + i)->x + (pull + i)->x - (pos + i - 1)->x; phi_f0 = (pos + i)->y + (pull + i)->y - 2.0f + sp138[i]; - temp_f2 = (pos + i - 1)->y + sp110[i]; - if (phi_f0 > temp_f2) { - phi_f0 = temp_f2; + if (phi_f0 > (pos + i - 1)->y + sp110[i]) { + phi_f0 = (pos + i - 1)->y + sp110[i]; } if ((head->y >= -910.0f) && (phi_f0 < 110.0f)) { phi_f0 = 110.0f; @@ -1100,7 +1101,8 @@ void BossFd2_UpdateMane(BossFd2* this, PlayState* play, Vec3f* head, Vec3f* pos, temp_vec.z = (pos + i)->z + (pull + i)->z - (pos + i - 1)->z; temp_angleY = Math_Atan2F(temp_vec.z, temp_vec.x); - temp_angleX = -Math_Atan2F(sqrtf(SQ(temp_vec.x) + SQ(temp_vec.z)), temp_vec.y); + temp_radius = sqrtf(SQ(temp_vec.x) + SQ(temp_vec.z)); + temp_angleX = -Math_Atan2F(temp_radius, temp_vec.y); (rot + i - 1)->y = temp_angleY; (rot + i - 1)->x = temp_angleX; spBC.x = 0.0f; diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2_colchk.inc.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2_colchk.inc.c index f888dc486..4ec506540 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2_colchk.inc.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2_colchk.inc.c @@ -6,8 +6,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { ELEMTYPE_UNK3, { 0xFFCFFFFF, 0x00, 0x20 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 35, { { 6000, 0, 0 }, 21 }, 100 }, @@ -17,8 +17,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x20 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 18, { { 4000, 0, 0 }, 13 }, 100 }, @@ -28,8 +28,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x20 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 19, { { 3000, 0, 0 }, 13 }, 100 }, @@ -39,8 +39,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x20 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 20, { { 4000, 0, 0 }, 15 }, 100 }, @@ -50,8 +50,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x20 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 24, { { 4000, 0, 0 }, 13 }, 100 }, @@ -61,8 +61,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x20 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 25, { { 3000, 0, 0 }, 13 }, 100 }, @@ -72,8 +72,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x20 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 26, { { 3500, 1500, 0 }, 15 }, 100 }, @@ -83,8 +83,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x20 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 17, { { 0, 0, 0 }, 26 }, 100 }, @@ -94,8 +94,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x20 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 30, { { 0, 0, 0 }, 17 }, 100 }, diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 0e401ef75..049872436 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -70,8 +70,8 @@ static ColliderCylinderInit sDorfCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 20, 80, -50, { 0, 0, 0 } }, @@ -90,8 +90,8 @@ static ColliderCylinderInit sLightBallCylinderInit = { ELEMTYPE_UNK6, { 0x00100700, 0x00, 0x08 }, { 0x0D900740, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 20, 30, -15, { 0, 0, 0 } }, @@ -184,6 +184,8 @@ void BossGanonEff_SpawnLightRay(PlayState* play, Vec3f* pos, Vec3f* velocity, Ve for (i = 0; i < 150; i++, eff++) { if (eff->type == GDF_EFF_NONE) { + s32 pad; + eff->type = GDF_EFF_LIGHT_RAY; eff->pos = *pos; eff->velocity = *velocity; @@ -1222,9 +1224,6 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { Vec3f sp98; Vec3f sp8C; Vec3f sp80; - Vec3f sp74; - Camera* mainCam; - Vec3f sp64; gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment); @@ -1570,7 +1569,8 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { } if (this->csTimer == 190) { - sp74 = this->actor.world.pos; + Vec3f sp74 = this->actor.world.pos; + sp74.y = 4102.0f; BossGanonEff_SpawnDustDark(play, &sp74, 0.2f, 0.7f); } @@ -1782,7 +1782,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { this->csCamAt.z = (sZelda->actor.world.pos.z - 25.0f) + 80.0f; if (this->csTimer > 50) { - mainCam = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); mainCam->eye = this->csCamEye; mainCam->eyeNext = this->csCamEye; @@ -1807,6 +1807,8 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { } if (this->csCamIndex != 0) { + Vec3f sp64; + if (moveCam) { Math_ApproachF(&this->csCamEye.x, this->csCamTargetEye.x, this->csCamMovementScale, this->csCamEyeMaxStep.x * this->csCamMaxStepScale); @@ -1830,10 +1832,10 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { void BossGanon_SetupPoundFloor(BossGanon* this, PlayState* play) { this->unk_1C2 = 0; - this->timers[0] = 40; - this->actionFunc = BossGanon_PoundFloor; this->actor.velocity.x = 0.0f; this->actor.velocity.y = 0.0f; + this->timers[0] = 40; + this->actionFunc = BossGanon_PoundFloor; this->fwork[GDF_CENTER_POS] = 100.0f; } @@ -1844,8 +1846,6 @@ void BossGanon_PoundFloor(BossGanon* this, PlayState* play) { f32 targetPosZ; Vec3f sp6C; Vec3f sp60; - Vec3f sp54; - Vec3f sp48; SkelAnime_Update(&this->skelAnime); @@ -1951,13 +1951,15 @@ void BossGanon_PoundFloor(BossGanon* this, PlayState* play) { } if ((this->unk_19C == 35) || (this->unk_19C == 30) || (this->unk_19C == 25)) { - sp54 = this->actor.world.pos; + Vec3f sp54 = this->actor.world.pos; + sp54.y = 0.0f; BossGanonEff_SpawnDustLight(play, &sp54, 0, 3.0f, this->unk_19C - 25); } if (this->unk_19C == 35) { - sp48 = this->actor.world.pos; + Vec3f sp48 = this->actor.world.pos; + sp48.y = 0.0f; BossGanonEff_SpawnShockwave(play, &sp48, 0, 3.0f); } @@ -1965,9 +1967,9 @@ void BossGanon_PoundFloor(BossGanon* this, PlayState* play) { void BossGanon_SetupChargeBigMagic(BossGanon* this, PlayState* play) { this->unk_1C2 = 0; - this->timers[0] = 30; this->actor.velocity.x = 0.0f; this->actor.velocity.y = 0.0f; + this->timers[0] = 30; this->fwork[GDF_CENTER_POS] = 100.0f; this->unk_1AA = Rand_ZeroFloat(20000.0f); this->unk_1AC = 0; @@ -2689,14 +2691,14 @@ void BossGanon_UpdateDamage(BossGanon* this, PlayState* play) { acHitElem = this->collider.elem.acHitElem; if ((this->actionFunc == BossGanon_HitByLightBall) || (this->actionFunc == BossGanon_ChargeBigMagic)) { - if (acHitElem->toucher.dmgFlags & DMG_ARROW_LIGHT) { + if (acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_LIGHT) { BossGanon_SetupVulnerable(this, play); this->timers[2] = 0; Actor_PlaySfx(&this->actor, NA_SE_EN_GANON_DAMAGE1); this->unk_1A6 = 15; } } else if ((this->actionFunc == BossGanon_Vulnerable) && (this->unk_1C2 >= 3)) { - if (!(acHitElem->toucher.dmgFlags & DMG_HOOKSHOT)) { + if (!(acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT)) { u8 hitWithSword = false; u8 damage; Vec3f sp50; @@ -2710,7 +2712,7 @@ void BossGanon_UpdateDamage(BossGanon* this, PlayState* play) { 0x1E); } - damage = flags = CollisionCheck_GetSwordDamage(acHitElem->toucher.dmgFlags); + damage = flags = CollisionCheck_GetSwordDamage(acHitElem->atDmgInfo.dmgFlags); if (flags == 0) { damage = 2; @@ -2744,7 +2746,7 @@ void BossGanon_UpdateDamage(BossGanon* this, PlayState* play) { sCape->tearTimer = 1; } } - } else if (acHitElem->toucher.dmgFlags & DMG_RANGED) { + } else if (acHitElem->atDmgInfo.dmgFlags & DMG_RANGED) { Actor_PlaySfx(&this->actor, 0); for (i = 0; i < ARRAY_COUNT(sCape->strands); i++) { @@ -3333,14 +3335,14 @@ f32 BossGanon_RandZeroOne(void) { } void BossGanon_DrawShock(BossGanon* this, PlayState* play) { - s32 pad; - GraphicsContext* gfxCtx = play->state.gfxCtx; + GameState* gameState = &play->state; + GraphicsContext* gfxCtx = gameState->gfxCtx; s16 i; OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 7350); if ((this->unk_2E8 != 0) || (this->unk_2E6 != 0)) { - Gfx_SetupDL_25Xlu(play->state.gfxCtx); + Gfx_SetupDL_25Xlu(gameState->gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 0); gSPDisplayList(POLY_XLU_DISP++, gGanondorfLightBallMaterialDL); @@ -3373,7 +3375,7 @@ void BossGanon_DrawShock(BossGanon* this, PlayState* play) { if (this->shockGlow) { gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 64, 1, 0, + Gfx_TwoTexScroll(gameState->gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 64, 1, 0, (this->unk_1A2 + i) * -15, 32, 64)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 255, 170, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128); @@ -3389,14 +3391,14 @@ void BossGanon_DrawShock(BossGanon* this, PlayState* play) { } void BossGanon_DrawHandLightBall(BossGanon* this, PlayState* play) { - s32 pad; - GraphicsContext* gfxCtx = play->state.gfxCtx; + GameState* gameState = &play->state; + GraphicsContext* gfxCtx = gameState->gfxCtx; s32 alpha; OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 7476); if (this->handLightBallScale > 0.0f) { - Gfx_SetupDL_25Xlu(play->state.gfxCtx); + Gfx_SetupDL_25Xlu(gameState->gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); if ((this->unk_1A2 % 2) != 0) { @@ -3420,7 +3422,7 @@ void BossGanon_DrawHandLightBall(BossGanon* this, PlayState* play) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 155, alpha); Matrix_Translate(this->unk_260.x, 0.0f, this->unk_260.z, MTXMODE_NEW); Matrix_Scale(this->handLightBallScale * 0.75f, 1.0f, this->handLightBallScale * 0.75f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon.c", 7531), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon.c", 7531), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGanondorfLightCoreDL); @@ -3429,21 +3431,21 @@ void BossGanon_DrawHandLightBall(BossGanon* this, PlayState* play) { } void BossGanon_DrawBigMagicCharge(BossGanon* this, PlayState* play) { - s32 pad; + GameState* gameState = &play->state; f32 yRot; - GraphicsContext* gfxCtx = play->state.gfxCtx; + GraphicsContext* gfxCtx = gameState->gfxCtx; s16 i; OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 7548); if (this->unk_284 > 0.0f) { - Gfx_SetupDL_25Xlu(play->state.gfxCtx); + Gfx_SetupDL_25Xlu(gameState->gfxCtx); // light flecks gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s8)this->unk_290); gDPSetEnvColor(POLY_XLU_DISP++, 200, 255, 0, 128); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, this->unk_1A2 * -2, 0, 0x40, 0x40, 1, 0, + Gfx_TwoTexScroll(gameState->gfxCtx, G_TX_RENDERTILE, this->unk_1A2 * -2, 0, 0x40, 0x40, 1, 0, this->unk_1A2 * 0xA, 0x40, 0x40)); Matrix_Translate(this->unk_278.x, this->unk_278.y, this->unk_278.z, MTXMODE_NEW); Matrix_ReplaceRotation(&play->billboardMtxF); @@ -3460,14 +3462,14 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 100, (s8)this->unk_288); gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, 0, this->unk_1A2 * -4, + Gfx_TwoTexScroll(gameState->gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, 0, this->unk_1A2 * -4, 0x20, 0x20)); gSPDisplayList(POLY_XLU_DISP++, gGanondorfBigMagicBGCircleDL); // yellow background dot gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 150, 170, 0, (s8)this->unk_288); gSPSegment(POLY_XLU_DISP++, 0x0A, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, this->unk_1A2 * 2, + Gfx_TwoTexScroll(gameState->gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, this->unk_1A2 * 2, this->unk_1A2 * -0x14, 0x40, 0x40)); gSPDisplayList(POLY_XLU_DISP++, gGanondorfDotDL); @@ -3509,15 +3511,17 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, PlayState* play) { Matrix_Pop(); } + if (1) {} + CLOSE_DISPS(gfxCtx, "../z_boss_ganon.c", 7721); } } void BossGanon_DrawTriforce(BossGanon* this, PlayState* play) { - s32 pad; + GameState* gameState = &play->state; if (this->fwork[GDF_TRIFORCE_PRIM_A] > 0.0f) { - OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7732); + OPEN_DISPS(gameState->gfxCtx, "../z_boss_ganon.c", 7732); Matrix_Push(); @@ -3555,26 +3559,26 @@ void BossGanon_DrawTriforce(BossGanon* this, PlayState* play) { } Matrix_Scale(this->fwork[GDF_TRIFORCE_SCALE], this->fwork[GDF_TRIFORCE_SCALE], 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon.c", 7779), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon.c", 7779), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanondorfTriforceDL)); Matrix_Pop(); - CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7782); + CLOSE_DISPS(gameState->gfxCtx, "../z_boss_ganon.c", 7782); } } void BossGanon_DrawDarkVortex(BossGanon* this, PlayState* play) { - s32 pad; + GameState* gameState = &play->state; if (this->fwork[GDF_VORTEX_ALPHA] > 0.0f) { - OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7792); + OPEN_DISPS(gameState->gfxCtx, "../z_boss_ganon.c", 7792); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, this->unk_1A2 * -8, 0, 0x20, 0x40, 1, + Gfx_TwoTexScroll(gameState->gfxCtx, G_TX_RENDERTILE, this->unk_1A2 * -8, 0, 0x20, 0x40, 1, this->unk_1A2 * -4, this->unk_1A2 * -8, 0x20, 0x20)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 0, 200, (s8)this->fwork[GDF_VORTEX_ALPHA]); gDPSetEnvColor(POLY_XLU_DISP++, 130, 0, 0, 128); @@ -3590,13 +3594,13 @@ void BossGanon_DrawDarkVortex(BossGanon* this, PlayState* play) { Matrix_Scale(this->fwork[GDF_VORTEX_SCALE], this->fwork[GDF_VORTEX_SCALE], this->fwork[GDF_VORTEX_SCALE], MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon.c", 7841), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon.c", 7841), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanondorfVortexDL)); Matrix_Pop(); - CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7844); + CLOSE_DISPS(gameState->gfxCtx, "../z_boss_ganon.c", 7844); } } @@ -3746,13 +3750,13 @@ void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, PlayState* play) { } void BossGanon_DrawShadowTexture(void* tex, BossGanon* this, PlayState* play) { - s32 pad; + GameState* gameState = &play->state; f32 zOffset; - GraphicsContext* gfxCtx = play->state.gfxCtx; + GraphicsContext* gfxCtx = gameState->gfxCtx; OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 8372); - Gfx_SetupDL_25Opa(play->state.gfxCtx); + Gfx_SetupDL_25Opa(gameState->gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 50); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); @@ -3764,7 +3768,7 @@ void BossGanon_DrawShadowTexture(void* tex, BossGanon* this, PlayState* play) { } Matrix_Scale(0.95000005f, 1.0f, 0.95000005f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon.c", 8396), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon.c", 8396), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGanondorfShadowSetupDL); gDPLoadTextureBlock(POLY_OPA_DISP++, tex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP, @@ -3836,6 +3840,8 @@ s32 BossGanon_CheckFallingPlatforms(BossGanon* this, PlayState* play, Vec3f* che f32 zDiff = platform->dyna.actor.world.pos.z - checkPos->z; if ((fabsf(xDiff) < 60.0f) && (yDiff < 20.0f) && (yDiff > -20.0f) && (fabsf(zDiff) < 60.0f)) { + s32 pad; + platform->isFalling = true; platform->visibleSides = OTYUKA_SIDE_ALL; @@ -3935,7 +3941,7 @@ void BossGanon_LightBall_Update(Actor* thisx, PlayState* play2) { this->collider.base.acFlags &= ~AC_HIT; - if ((hitWithBottle == false) && (acHitElem->toucher.dmgFlags & DMG_SHIELD)) { + if ((hitWithBottle == false) && (acHitElem->atDmgInfo.dmgFlags & DMG_SHIELD)) { spBA = 2; Audio_PlaySfxGeneral(NA_SE_IT_SHIELD_REFLECT_MG, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, @@ -3972,6 +3978,7 @@ void BossGanon_LightBall_Update(Actor* thisx, PlayState* play2) { this->unk_1C2 = 1; } else { this->unk_1C2 = 3; + break; } } } @@ -4162,6 +4169,8 @@ void BossGanon_LightBall_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, gGanondorfSquareDL); } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 9911); } @@ -4170,14 +4179,6 @@ void func_808E1EB4(Actor* thisx, PlayState* play2) { BossGanon* this = (BossGanon*)thisx; PlayState* play = play2; BossGanon* dorf = (BossGanon*)this->actor.parent; - f32 xDiff; - f32 yDiff; - f32 zDiff; - f32 xzDist; - s16 xRotTarget; - s16 yRotTarget; - Vec3f vel; - Vec3f accel; this->unk_1A2++; dorf->envLightMode = 1; @@ -4207,6 +4208,15 @@ void func_808E1EB4(Actor* thisx, PlayState* play2) { this->unk_1C2 = 1; } } else if (this->unk_1C2 == 1) { + f32 xDiff; + f32 yDiff; + f32 zDiff; + f32 xzDist; + s16 xRotTarget; + s16 yRotTarget; + Vec3f vel; + Vec3f accel; + xDiff = dorf->unk_1FC.x - this->actor.world.pos.x; yDiff = dorf->unk_1FC.y - this->actor.world.pos.y; zDiff = dorf->unk_1FC.z - this->actor.world.pos.z; @@ -4305,8 +4315,6 @@ void func_808E2544(Actor* thisx, PlayState* play) { BossGanon* dorf = (BossGanon*)this->actor.parent; s32 pad; Player* player = GET_PLAYER(play); - ColliderElement* acHitElem; - Vec3f sp60; this->unk_1A2++; Actor_SetScale(&this->actor, 0.01f); @@ -4415,11 +4423,11 @@ void func_808E2544(Actor* thisx, PlayState* play) { } if (this->collider.base.acFlags & AC_HIT) { - acHitElem = this->collider.elem.acHitElem; + ColliderElement* acHitElem = this->collider.elem.acHitElem; this->collider.base.acFlags &= ~AC_HIT; - if (!(acHitElem->toucher.dmgFlags & DMG_SHIELD) || Player_HasMirrorShieldEquipped(play)) { + if (!(acHitElem->atDmgInfo.dmgFlags & DMG_SHIELD) || Player_HasMirrorShieldEquipped(play)) { Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); this->unk_1C2 = 0xC; this->actor.speed = -30.0f; @@ -4524,6 +4532,8 @@ void func_808E2544(Actor* thisx, PlayState* play) { } if (numEffects) { + Vec3f sp60; + SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EN_FANTOM_THUNDER); for (i = 0; i < numEffects; i++) { @@ -4676,6 +4686,8 @@ void BossGanon_UpdateEffects(PlayState* play) { Math_ApproachF(&eff->unk_38, eff->unk_40, 1.0f, (eff->unk_40 / 15.0f) * 4.0f); } else if (eff->type == GDF_EFF_SHOCK) { + s32 pad4; + if (eff->unk_2E == GDF_SHOCK_DORF_YELLOW) { bodyPart = (s16)Rand_ZeroFloat(13.9f) + 1; diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index f70e75bfd..ced201f7b 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -97,14 +97,14 @@ void func_808FD210(PlayState* play, Vec3f* arg1) { effects[0].type = 1; effects[0].position = *arg1; - effects[0].unk_2E = 0; - effects[0].unk_01 = 0; effects[0].velocity.x = 25.0f; effects[0].velocity.y = 15.0f; effects[0].velocity.z = 0.0f; effects[0].accel.x = 0.0f; effects[0].accel.y = -1.0f; effects[0].accel.z = 0.0f; + effects[0].unk_2E = 0; + effects[0].unk_01 = 0; } void func_808FD27C(PlayState* play, Vec3f* position, Vec3f* velocity, f32 scale) { @@ -751,16 +751,16 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { this->subCamEye.x = effects[0].position.x + 70.0f; this->subCamEye.y = effects[0].position.y - 30.0f; this->subCamEye.z = effects[0].position.z + 70.0f; + if ((this->unk_398 & 3) == 0) { + Sfx_PlaySfxCentered(NA_SE_IT_SWORD_SWING); + } + if (this->unk_398 == 25) { + Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_87); + this->unk_39C = 25; + this->unk_398 = 0; + } + break; } - if ((this->unk_398 & 3) == 0) { - Sfx_PlaySfxCentered(NA_SE_IT_SWORD_SWING); - } - if (this->unk_398 == 25) { - Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_87); - this->unk_39C = 25; - this->unk_398 = 0; - } - break; case 25: SkelAnime_Update(&this->skelAnime); this->subCamEye.x = (player->actor.world.pos.x - 40.0f) + 80.0f; @@ -895,7 +895,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { // fake, tricks the compiler into putting some pointers on the stack if (zero) { - PRINTF(NULL, 0, 0); + osSyncPrintf(NULL, 0, 0); } this->subCamAt.y += this->unk_41C; Play_SetCameraAtEyeUp(play, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); @@ -1283,9 +1283,6 @@ void func_80900890(BossGanon2* this, PlayState* play) { Player* player; Camera* mainCam2; Camera* mainCam3; - s32 pad; - f32 temp_f12; - f32 temp_f2; mainCam1 = Play_GetCamera(play, CAM_ID_MAIN); player = GET_PLAYER(play); @@ -1341,6 +1338,8 @@ void func_80900890(BossGanon2* this, PlayState* play) { Message_StartTextbox(play, 0x70D7, NULL); } if ((this->unk_1A2[1] < 30) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) { + s32 pad; + mainCam2 = Play_GetCamera(play, CAM_ID_MAIN); mainCam2->eye = this->subCamEye; mainCam2->eyeNext = this->subCamEye; @@ -1403,8 +1402,8 @@ void func_80900890(BossGanon2* this, PlayState* play) { } if ((this->unk_1A2[0] == 0) || (this->unk_334 != 0)) { - temp_f2 = -200.0f - player->actor.world.pos.x; - temp_f12 = -200.0f - player->actor.world.pos.z; + f32 temp_f2 = -200.0f - player->actor.world.pos.x; + f32 temp_f12 = -200.0f - player->actor.world.pos.z; if (sqrtf(SQ(temp_f2) + SQ(temp_f12)) <= 784.0f) { Animation_MorphToPlayOnce(&this->skelAnime, &gGanonGetUpAnim, 0.0f); @@ -1466,10 +1465,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) { Player* player; f32 temp_f14; f32 temp_f12; - Camera* mainCam; s16 temp_a0_2; - f32 phi_f0; - s32 phi_a1; player = GET_PLAYER(play); this->unk_398++; @@ -1619,7 +1615,8 @@ void func_8090120C(BossGanon2* this, PlayState* play) { this->subCamAt.y = player->actor.world.pos.y + 40.0f; this->subCamAt.z = player->actor.world.pos.z; if (this->unk_398 == 166) { - mainCam = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); + mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; @@ -1676,6 +1673,9 @@ void func_8090120C(BossGanon2* this, PlayState* play) { this->subCamAt.y = 1117.0f; this->subCamAt.z = -11.0f; } else { + f32 phi_f0; + s32 phi_a1; + if (this->unk_398 < 30) { phi_a1 = 0; } else if (this->unk_398 < 43) { @@ -1842,10 +1842,10 @@ void func_80902348(BossGanon2* this, PlayState* play) { if (this->unk_316 == 0) { for (i = 0; i < ARRAY_COUNT(this->unk_864); i++) { - if (this->unk_444.elements[i].base.bumperFlags & BUMP_HIT) { - this->unk_444.elements[i].base.bumperFlags &= ~BUMP_HIT; - } else if (this->unk_444.elements[i].base.toucherFlags & TOUCH_HIT) { - this->unk_444.elements[i].base.toucherFlags &= ~TOUCH_HIT; + if (this->unk_444.elements[i].base.acElemFlags & ACELEM_HIT) { + this->unk_444.elements[i].base.acElemFlags &= ~ACELEM_HIT; + } else if (this->unk_444.elements[i].base.atElemFlags & ATELEM_HIT) { + this->unk_444.elements[i].base.atElemFlags &= ~ATELEM_HIT; if (this->unk_312 == 1) { phi_v0_2 = 0x1800; @@ -1862,6 +1862,8 @@ void func_80902348(BossGanon2* this, PlayState* play) { } if (this->unk_324 > 0.0f) { + s16 pad; + player = GET_PLAYER(play); temp_f2 = -200.0f - player->actor.world.pos.x; temp_f12 = -200.0f - player->actor.world.pos.z; @@ -1887,23 +1889,23 @@ void BossGanon2_CollisionCheck(BossGanon2* this, PlayState* play) { PRINTF("this->no_hit_time %d\n", this->unk_316); if (this->unk_316 != 0 || ((this->unk_334 == 0) && (this->actionFunc == func_80900890))) { for (i = 0; i < ARRAY_COUNT(this->unk_464); i++) { - this->unk_424.elements[i].base.bumperFlags &= ~BUMP_HIT; + this->unk_424.elements[i].base.acElemFlags &= ~ACELEM_HIT; } } PRINTF("this->look_on %d\n", this->unk_313); if (this->unk_313) { if (this->actionFunc != func_808FFFE0) { - if (this->unk_424.elements[0].base.bumperFlags & BUMP_HIT) { - this->unk_424.elements[0].base.bumperFlags &= ~BUMP_HIT; + if (this->unk_424.elements[0].base.acElemFlags & ACELEM_HIT) { + this->unk_424.elements[0].base.acElemFlags &= ~ACELEM_HIT; acHitElem = this->unk_424.elements[0].base.acHitElem; - if ((acHitElem->toucher.dmgFlags & DMG_ARROW_LIGHT) && (this->actionFunc != func_80900890)) { + if ((acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_LIGHT) && (this->actionFunc != func_80900890)) { func_809000A0(this, play); Actor_PlaySfx(&this->actor, NA_SE_EN_FANTOM_HIT_THUNDER); Actor_PlaySfx(&this->actor, NA_SE_EN_MGANON_DAMAGE); Audio_StopSfxById(NA_SE_EN_MGANON_UNARI); } else if ((this->actionFunc == func_80900890) && - (acHitElem->toucher.dmgFlags & (DMG_JUMP_MASTER | DMG_SPIN_MASTER | DMG_SLASH_MASTER))) { + (acHitElem->atDmgInfo.dmgFlags & (DMG_JUMP_MASTER | DMG_SPIN_MASTER | DMG_SLASH_MASTER))) { this->unk_316 = 60; this->unk_342 = 5; Actor_PlaySfx(&this->actor, NA_SE_EN_MGANON_DAMAGE); @@ -1926,8 +1928,8 @@ void BossGanon2_CollisionCheck(BossGanon2* this, PlayState* play) { } } } else { - if (this->unk_424.elements[15].base.bumperFlags & BUMP_HIT) { - this->unk_424.elements[15].base.bumperFlags &= ~BUMP_HIT; + if (this->unk_424.elements[15].base.acElemFlags & ACELEM_HIT) { + this->unk_424.elements[15].base.acElemFlags &= ~ACELEM_HIT; acHitElem = this->unk_424.elements[15].base.acHitElem; this->unk_316 = 60; this->unk_344 = 0x32; @@ -1935,8 +1937,8 @@ void BossGanon2_CollisionCheck(BossGanon2* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_MGANON_DAMAGE); Audio_StopSfxById(NA_SE_EN_MGANON_UNARI); phi_v1_2 = 1; - if (acHitElem->toucher.dmgFlags & (DMG_JUMP_MASTER | DMG_SPIN_MASTER | DMG_SLASH_MASTER)) { - if (acHitElem->toucher.dmgFlags & DMG_JUMP_MASTER) { + if (acHitElem->atDmgInfo.dmgFlags & (DMG_JUMP_MASTER | DMG_SPIN_MASTER | DMG_SLASH_MASTER)) { + if (acHitElem->atDmgInfo.dmgFlags & DMG_JUMP_MASTER) { phi_v1_2 = 4; } else { phi_v1_2 = 2; @@ -1962,12 +1964,6 @@ void BossGanon2_Update(Actor* thisx, PlayState* play) { BossGanon2* this = (BossGanon2*)thisx; s32 pad; s16 i; - f32 phi_f2; - u16 i2; - Vec3f sp58; - Vec3f sp4C; - f32 angle; - f32 sp44; if ((this->unk_337 == 0) || (this->unk_337 == 2)) { BossGanon2_SetObjectSegment(this, play, OBJECT_GANON_ANIME3, false); @@ -2051,6 +2047,8 @@ void BossGanon2_Update(Actor* thisx, PlayState* play) { } for (i = 0; i < ARRAY_COUNT(this->unk_348); i++) { + f32 phi_f2; + if (i == 0) { phi_f2 = 0.2f; } else if (i == 1) { @@ -2175,6 +2173,12 @@ void BossGanon2_Update(Actor* thisx, PlayState* play) { this->unk_339 = 0; } if (D_80906D78 != 0) { + u16 i2; + Vec3f sp58; + Vec3f sp4C; + f32 angle; + f32 sp44; + D_80906D78 = 0; for (i2 = 0; i2 < 100; i2++) { @@ -2413,37 +2417,37 @@ void func_80903F38(BossGanon2* this, PlayState* play) { } void func_80904108(BossGanon2* this, PlayState* play) { - s32 pad; + GameState* gameState = &play->state; if (this->unk_324 > 0.0f) { - OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5131); + OPEN_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5131); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (s32)play->gameplayFrames, 0, 32, 64, 1, + Gfx_TwoTexScroll(gameState->gfxCtx, G_TX_RENDERTILE, (s32)play->gameplayFrames, 0, 32, 64, 1, -play->gameplayFrames * 2, -play->gameplayFrames * 8, 32, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 200, 0, (s8)this->unk_324); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128); Matrix_Translate(-200.0f, 1086.0f, -200.0f, MTXMODE_NEW); Matrix_Scale(0.098000005f, 0.1f, 0.098000005f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon2.c", 5183), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon2.c", 5183), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanonFireRingDL)); Matrix_Pop(); - CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5186); + CLOSE_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5186); } } void func_80904340(BossGanon2* this, PlayState* play) { + GameState* gameState = &play->state; s16 i; - f32 rand; - f32 angle; f32 sin; f32 cos; + f32 rand; - OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5196); + OPEN_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5196); Matrix_Push(); if ((this->unk_330 != 0) || (this->unk_328 != 0)) { @@ -2461,37 +2465,36 @@ void func_80904340(BossGanon2* this, PlayState* play) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->unk_328); BossGanon2_InitRand(this->unk_340 + 1, 0x71AC - this->unk_340, 0x263A); - rand = BossGanon2_RandZeroOne(); - if (1) {} + rand = BossGanon2_RandZeroOne() * M_PI; for (i = 0; i < 5; i++) { - angle = (i * (2 * M_PI / 5)) + (rand * M_PI); - sin = 5000.0f * sinf(angle); - cos = 5000.0f * cosf(angle); + sin = 5000.0f * sinf((i * (2 * M_PI / 5)) + rand); + cos = 5000.0f * cosf((i * (2 * M_PI / 5)) + rand); Matrix_Translate(-200.0f + sin, 4786.0f, -200.0f + cos, MTXMODE_NEW); Matrix_Scale(this->unk_32C, this->unk_32C, this->unk_32C, MTXMODE_APPLY); - Matrix_RotateY(angle, MTXMODE_APPLY); + Matrix_RotateY((i * (2 * M_PI / 5)) + rand, MTXMODE_APPLY); Matrix_RotateZ((BossGanon2_RandZeroOne() - 0.5f) * 100.0f * 0.01f, MTXMODE_APPLY); if (BossGanon2_RandZeroOne() < 0.5f) { Matrix_RotateY(M_PI, MTXMODE_APPLY); } - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon2.c", 5250), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon2.c", 5250), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanonLightningDL)); } } Matrix_Pop(); - CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5255); + if (1) {} + CLOSE_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5255); } void func_8090464C(BossGanon2* this, PlayState* play) { - s32 pad; + GameState* gameState = &play->state; if (this->unk_1B4 > 0.0f) { - OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5264); + OPEN_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5264); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); @@ -2501,12 +2504,12 @@ void func_8090464C(BossGanon2* this, PlayState* play) { Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_RotateZ(-0.2f, MTXMODE_APPLY); Matrix_Scale(0.6f, 0.6f, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon2.c", 5290), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon2.c", 5290), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanonTriforceDL)); Matrix_Pop(); - CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5293); + CLOSE_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5293); } } @@ -2610,13 +2613,13 @@ void BossGanon2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* } void func_80904D88(BossGanon2* this, PlayState* play) { - s32 pad; + GameState* gameState = &play->state; s16 i; - OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5575); + OPEN_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5575); if (this->unk_30C > 0.0f) { - Gfx_SetupDL_25Xlu(play->state.gfxCtx); + Gfx_SetupDL_25Xlu(gameState->gfxCtx); if (this->unk_380 > 0.0f) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 0); @@ -2631,22 +2634,24 @@ void func_80904D88(BossGanon2* this, PlayState* play) { Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_30C, this->unk_30C, this->unk_30C, MTXMODE_APPLY); Matrix_RotateZ(Rand_CenteredFloat(M_PI), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon2.c", 5618), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon2.c", 5618), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGanonLightOrbModelDL); } } - CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5622); + if (1) {} + + CLOSE_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5622); } void func_80904FC8(BossGanon2* this, PlayState* play) { - s32 pad; + GameState* gameState = &play->state; - OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5632); + OPEN_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5632); if (this->unk_384 > 0.0f) { - Gfx_SetupDL_25Xlu(play->state.gfxCtx); + Gfx_SetupDL_25Xlu(gameState->gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 200); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 0); gSPDisplayList(POLY_XLU_DISP++, gGanonLightOrbMaterialDL); @@ -2655,29 +2660,30 @@ void func_80904FC8(BossGanon2* this, PlayState* play) { Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk_384, this->unk_384, this->unk_384, MTXMODE_APPLY); Matrix_RotateZ(this->unk_388, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon2.c", 5661), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon2.c", 5661), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanonLightOrbModelDL)); Matrix_RotateZ(this->unk_388 * -2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon2.c", 5664), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon2.c", 5664), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanonLightOrbModelDL)); } - CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5667); + CLOSE_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5667); } void func_8090523C(BossGanon2* this, PlayState* play) { - Player* player; + GameState* gameState = &play->state; f32 phi_f20; - OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5675); + OPEN_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5675); if (this->unk_38C > 0.0f) { s8 i; + Player* player; player = GET_PLAYER(play); - Gfx_SetupDL_25Xlu(play->state.gfxCtx); + Gfx_SetupDL_25Xlu(gameState->gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s16)this->unk_38C); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 255, 0); gSPDisplayList(POLY_XLU_DISP++, gGanonLightOrbMaterialDL); @@ -2695,13 +2701,13 @@ void func_8090523C(BossGanon2* this, PlayState* play) { Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(200.0f * phi_f20, 200.0f * phi_f20, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(Rand_ZeroFloat(2.0f * M_PI), MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon2.c", 5721), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon2.c", 5721), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanonLightOrbModelDL)); } } - CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5725); + CLOSE_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5725); } void BossGanon2_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { @@ -2725,15 +2731,15 @@ void BossGanon2_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s } void func_80905674(BossGanon2* this, PlayState* play) { - s32 pad; + GameState* gameState = &play->state; if (this->unk_380 > 0.0f) { - OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5772); + OPEN_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5772); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, this->unk_19C * -8, 0, 32, 64, 1, + Gfx_TwoTexScroll(gameState->gfxCtx, G_TX_RENDERTILE, this->unk_19C * -8, 0, 32, 64, 1, this->unk_19C * -4, this->unk_19C * -8, 32, 32)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s16)this->unk_37C); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 128); @@ -2742,12 +2748,12 @@ void func_80905674(BossGanon2* this, PlayState* play) { Matrix_RotateY(-M_PI / 4.0f, MTXMODE_APPLY); Matrix_Scale(0.040000003f, 0.040000003f, this->unk_380, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon2.c", 5814), + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon2.c", 5814), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanonZeldaMagicDL)); Matrix_Pop(); - CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 5817); + CLOSE_DISPS(gameState->gfxCtx, "../z_boss_ganon2.c", 5817); } } @@ -2829,14 +2835,15 @@ void BossGanon2_Draw(Actor* thisx, PlayState* play) { } void BossGanon2_UpdateEffects(BossGanon2* this, PlayState* play) { - s32 pad[5]; + s32 pad[4]; Player* player = GET_PLAYER(play); BossGanon2Effect* effect = play->specialEffects; - Vec3f sp78; s16 i; for (i = 0; i < BOSS_GANON2_EFFECT_COUNT; i++, effect++) { if (effect->type != 0) { + Vec3f sp78; + effect->position.x += effect->velocity.x; effect->position.y += effect->velocity.y; effect->position.z += effect->velocity.z; @@ -2845,6 +2852,8 @@ void BossGanon2_UpdateEffects(BossGanon2* this, PlayState* play) { effect->velocity.y += effect->accel.y; effect->velocity.z += effect->accel.z; if (effect->type == 1) { + s32 pad2; + if (effect->unk_2E == 0) { effect->unk_38.z += 1.0f; effect->unk_38.y = (2.0f * M_PI) / 5.0f; @@ -2908,6 +2917,7 @@ void BossGanon2_DrawEffects(PlayState* play) { Vec3f spA0; f32 temp_f0; f32 angle; + s32 pad; Gfx_SetupDL_25Xlu(play->state.gfxCtx); spA0.x = play->envCtx.dirLight1.params.dir.x; @@ -3057,13 +3067,13 @@ void BossGanon2_GenShadowTexture(void* shadowTexture, BossGanon2* this, PlayStat } void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, PlayState* play) { - s32 pad; - GraphicsContext* gfxCtx = play->state.gfxCtx; + GameState* gameState = &play->state; s16 alpha; + GraphicsContext* gfxCtx = gameState->gfxCtx; OPEN_DISPS(gfxCtx, "../z_boss_ganon2.c", 6430); - Gfx_SetupDL_25Opa(play->state.gfxCtx); + Gfx_SetupDL_25Opa(gameState->gfxCtx); if ((play->envCtx.lightSetting == 1) || (play->envCtx.lightSetting == 2)) { alpha = (s16)(play->envCtx.lightBlend * 180.0f) + 30; @@ -3075,7 +3085,7 @@ void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, PlaySta gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.floorHeight, this->actor.world.pos.z - 20.0f, MTXMODE_NEW); Matrix_Scale(1.65f, 1.0f, 1.65f, MTXMODE_APPLY); - gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon2.c", 6457), + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon2.c", 6457), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGanonShadowMaterialDL); gDPLoadTextureBlock(POLY_OPA_DISP++, shadowTexture, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP, diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.inc.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.inc.c index 407e0f020..f31a97410 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.inc.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.inc.c @@ -29,8 +29,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -40,8 +40,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 1, { { 0, 0, 0 }, 30 }, 100 }, @@ -51,8 +51,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 2, { { 0, 0, 0 }, 30 }, 100 }, @@ -62,8 +62,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 3, { { 0, 0, 0 }, 20 }, 100 }, @@ -73,8 +73,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 4, { { 0, 0, 0 }, 20 }, 100 }, @@ -84,8 +84,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 5, { { 0, 0, 0 }, 20 }, 100 }, @@ -95,8 +95,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 6, { { 0, 0, 0 }, 20 }, 100 }, @@ -106,8 +106,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 7, { { 0, 0, 0 }, 20 }, 100 }, @@ -117,8 +117,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 8, { { 0, 0, 0 }, 20 }, 100 }, @@ -128,8 +128,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 9, { { 0, 0, 0 }, 20 }, 100 }, @@ -139,8 +139,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 10, { { 0, 0, 0 }, 20 }, 100 }, @@ -150,8 +150,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 11, { { 0, 0, 0 }, 20 }, 100 }, @@ -161,8 +161,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 12, { { 0, 0, 0 }, 20 }, 100 }, @@ -172,8 +172,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 13, { { 0, 0, 0 }, 20 }, 100 }, @@ -183,8 +183,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 14, { { 0, 0, 0 }, 20 }, 100 }, @@ -194,8 +194,8 @@ static ColliderJntSphElementInit sJntSphItemsInit1[] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 15, { { 0, 0, 0 }, 30 }, 100 }, @@ -221,8 +221,8 @@ static ColliderJntSphElementInit sJntSphItemsInit2[] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x40 }, { 0xFFDFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 15, { { 0, 0, 0 }, 45 }, 100 }, @@ -232,8 +232,8 @@ static ColliderJntSphElementInit sJntSphItemsInit2[] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x40 }, { 0xFFDFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 16, { { 0, 0, 0 }, 45 }, 100 }, diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index 248357509..dae6502be 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -94,8 +94,8 @@ static ColliderCylinderInit sCylinderInitBody = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 30, 90, -50, { 0, 0, 0 } }, @@ -114,8 +114,8 @@ static ColliderCylinderInit sCylinderInitSpear = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x30 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 20, 30, -20, { 0, 0, 0 } }, @@ -1239,14 +1239,14 @@ void BossGanondrof_CollisionCheck(BossGanondrof* this, PlayState* play) { } if (this->flyMode != GND_FLY_PAINTING) { if (acHit && (this->actionFunc != BossGanondrof_Stunned) && - (acHitElem->toucher.dmgFlags & DMG_RANGED)) { + (acHitElem->atDmgInfo.dmgFlags & DMG_RANGED)) { Actor_PlaySfx(&this->actor, NA_SE_NONE); PRINTF("hit != 0 \n"); } else if (this->actionFunc != BossGanondrof_Charge) { if (this->returnCount == 0) { u8 dmg; u8 canKill = false; - s32 dmgFlags = acHitElem->toucher.dmgFlags; + s32 dmgFlags = acHitElem->atDmgInfo.dmgFlags; if (dmgFlags & DMG_HOOKSHOT) { return; @@ -1273,7 +1273,7 @@ void BossGanondrof_CollisionCheck(BossGanondrof* this, PlayState* play) { } else { Actor_PlaySfx(&this->actor, NA_SE_NONE); } - } else if (acHit && (acHitElem->toucher.dmgFlags & DMG_RANGED)) { + } else if (acHit && (acHitElem->atDmgInfo.dmgFlags & DMG_RANGED)) { this->work[GND_INVINC_TIMER] = 10; this->actor.colChkInfo.health -= 2; horse->hitTimer = 20; @@ -1293,8 +1293,8 @@ void BossGanondrof_Update(Actor* thisx, PlayState* play) { s32 pad2; s16 i; s32 pad; - BossGanondrof* this = (BossGanondrof*)thisx; EnfHG* horse; + BossGanondrof* this = (BossGanondrof*)thisx; PRINTF("MOVE START %d\n", this->actor.params); this->actor.flags &= ~ACTOR_FLAG_10; @@ -1303,8 +1303,8 @@ void BossGanondrof_Update(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); return; } - this->work[GND_VARIANCE_TIMER]++; horse = (EnfHG*)this->actor.child; + this->work[GND_VARIANCE_TIMER]++; PRINTF("MOVE START EEEEEEEEEEEEEEEEEEEEEE%d\n", this->actor.params); this->actionFunc(this, play); @@ -1520,6 +1520,7 @@ void BossGanondrof_Draw(Actor* thisx, PlayState* play) { BossGanondrof_PostLimbDraw, this); PRINTF("DRAW 22\n"); POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); + if (1) {} CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganondrof.c", 3814); PRINTF("DRAW END %d\n", this->actor.params); } diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index cb7f787c6..bdbf0fcf0 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -67,8 +67,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK3, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_EYE, { { 0, 0, 1200 }, 20 }, 100 }, @@ -78,8 +78,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_TAIL4, { { 0, 0, 0 }, 20 }, 100 }, @@ -89,8 +89,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_TAIL3, { { 0, 0, 0 }, 15 }, 100 }, @@ -100,8 +100,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_TAIL2, { { 0, 0, 0 }, 12 }, 100 }, @@ -111,8 +111,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_TAIL1, { { 0, 0, 0 }, 25 }, 100 }, @@ -122,8 +122,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_R_FEET, { { 0, 0, 0 }, 30 }, 100 }, @@ -133,8 +133,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_R_SHIN, { { 0, 0, 0 }, 15 }, 100 }, @@ -144,8 +144,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_R_THIGH_SHELL, { { 0, 0, 0 }, 15 }, 100 }, @@ -155,8 +155,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_L_ANTENNA_CLAW, { { 0, 0, 0 }, 20 }, 100 }, @@ -166,8 +166,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_R_ANTENNA_CLAW, { { 0, 0, 0 }, 20 }, 100 }, @@ -177,8 +177,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_L_FEET, { { 0, 0, 0 }, 30 }, 100 }, @@ -188,8 +188,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_L_SHIN, { { 0, 0, 0 }, 15 }, 100 }, @@ -199,8 +199,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[13] = { ELEMTYPE_UNK2, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { BOSSGOMA_LIMB_L_THIGH_SHELL, { { 0, 0, 0 }, 15 }, 100 }, @@ -672,7 +672,8 @@ void BossGoma_SetupEncounterState4(BossGoma* this, PlayState* play) { void BossGoma_Encounter(BossGoma* this, PlayState* play) { Camera* mainCam; Player* player = GET_PLAYER(play); - s32 pad[2]; + f32 s; + s32 pad; Math_ApproachZeroF(&this->actor.speed, 0.5f, 2.0f); @@ -761,7 +762,8 @@ void BossGoma_Encounter(BossGoma* this, PlayState* play) { } if (this->frameCount >= 228) { - mainCam = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); + mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; @@ -909,8 +911,7 @@ void BossGoma_Encounter(BossGoma* this, PlayState* play) { this->subCamAt.z = this->actor.world.pos.z; if (this->framesUntilNextAction != 0) { - f32 s = sinf(this->framesUntilNextAction * 3.1415f * 0.5f); - + s = sinf(this->framesUntilNextAction * 3.1415f * 0.5f); this->subCamAt.y = this->framesUntilNextAction * s * 0.7f + this->actor.world.pos.y; } else { Math_ApproachF(&this->subCamAt.y, this->actor.focus.pos.y, 0.1f, 10.0f); @@ -1301,7 +1302,7 @@ void BossGoma_FloorAttack(BossGoma* this, PlayState* play) { switch (this->actionState) { case 0: for (i = 0; i < this->collider.count; i++) { - if (this->collider.elements[i].base.toucherFlags & TOUCH_HIT) { + if (this->collider.elements[i].base.atElemFlags & ATELEM_HIT) { this->framesUntilNextAction = 10; break; } @@ -1811,15 +1812,15 @@ void BossGoma_UpdateHit(BossGoma* this, PlayState* play) { s32 damage; if (this->eyeClosedTimer == 0 && this->actionFunc != BossGoma_CeilingSpawnGohmas && - (this->collider.elements[0].base.bumperFlags & BUMP_HIT)) { - this->collider.elements[0].base.bumperFlags &= ~BUMP_HIT; + (this->collider.elements[0].base.acElemFlags & ACELEM_HIT)) { + this->collider.elements[0].base.acElemFlags &= ~ACELEM_HIT; if (this->actionFunc == BossGoma_CeilingMoveToCenter || this->actionFunc == BossGoma_CeilingIdle || this->actionFunc == BossGoma_CeilingPrepareSpawnGohmas) { BossGoma_SetupFallStruckDown(this); Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_DAM2); } else if (this->actionFunc == BossGoma_FloorStunned && - (damage = CollisionCheck_GetSwordDamage(acHitElem->toucher.dmgFlags)) != 0) { + (damage = CollisionCheck_GetSwordDamage(acHitElem->atDmgInfo.dmgFlags)) != 0) { this->actor.colChkInfo.health -= damage; if ((s8)this->actor.colChkInfo.health > 0) { @@ -1833,14 +1834,14 @@ void BossGoma_UpdateHit(BossGoma* this, PlayState* play) { this->invincibilityFrames = 10; } else if (this->actionFunc != BossGoma_FloorStunned && this->patienceTimer != 0 && - (acHitElem->toucher.dmgFlags & (DMG_SLINGSHOT | DMG_DEKU_NUT))) { + (acHitElem->atDmgInfo.dmgFlags & (DMG_SLINGSHOT | DMG_DEKU_NUT))) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_DAM2); Audio_StopSfxById(NA_SE_EN_GOMA_CRY1); this->invincibilityFrames = 10; BossGoma_SetupFloorStunned(this); this->sfxFaintTimer = 100; - if (acHitElem->toucher.dmgFlags & DMG_DEKU_NUT) { + if (acHitElem->atDmgInfo.dmgFlags & DMG_DEKU_NUT) { this->framesUntilNextAction = 40; } else { this->framesUntilNextAction = 90; @@ -2047,9 +2048,8 @@ void BossGoma_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r static Vec3f zero = { 0.0f, 0.0f, 0.0f }; Vec3f childPos; Vec3s childRot; - EnGoma* babyGohma; BossGoma* this = (BossGoma*)thisx; - s32 pad; + s32 pad[2]; MtxF mtx; if (limbIndex == BOSSGOMA_LIMB_TAIL4) { // tail end/last part @@ -2073,6 +2073,8 @@ void BossGoma_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r } if (this->deadLimbsState[limbIndex] == 1) { + EnGoma* babyGohma; + this->deadLimbsState[limbIndex] = 2; Matrix_MultVec3f(&zero, &childPos); Matrix_Get(&mtx); diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 99447a19b..94021d0ee 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -407,51 +407,14 @@ void BossMo_SetupTentacle(BossMo* this, PlayState* play) { } void BossMo_Tentacle(BossMo* this, PlayState* play) { - s16 tentXrot; - s16 sp1B4 = 0; - s32 buttons; - Player* player = GET_PLAYER(play); - s16 indS0; s16 indS1; - Camera* mainCam1; - Camera* mainCam2; - BossMo* otherTent = (BossMo*)this->otherTent; - f32 maxSwingRateX; - f32 maxSwingLagX; - f32 maxSwingSizeX; - f32 maxSwingRateZ; - f32 maxSwingLagZ; - f32 maxSwingSizeZ; - f32 swingRateAccel; - f32 swingSizeAccel; - s16 rippleCount; - s16 indT5; - Vec3f ripplePos; - f32 randAngle; - f32 randFloat; + s16 sp1B4 = 0; + Player* player = GET_PLAYER(play); f32 tempf1; f32 tempf2; f32 sin; f32 cos; - f32 temp; - f32 dx; - f32 dy; - f32 dz; - Vec3f sp138; - Vec3f sp12C; - Vec3f sp120; - s32 pad11C; - s32 pad118; - s32 pad114; - s32 pad110; - s32 pad10C; - s32 pad108; - Vec3f spFC; - Vec3f spF0; - f32 padEC; - Vec3f spE0; - Vec3f spD4; - Vec3f spC8; + BossMo* otherTent = (BossMo*)this->otherTent; if (this->work[MO_TENT_ACTION_STATE] <= MO_TENT_DEATH_3) { this->actor.world.pos.y = MO_WATER_LEVEL(play); @@ -460,6 +423,15 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { (this->work[MO_TENT_ACTION_STATE] >= MO_TENT_DEATH_START) || (this->work[MO_TENT_ACTION_STATE] == MO_TENT_RETREAT) || (this->work[MO_TENT_ACTION_STATE] == MO_TENT_SWING) || (this->work[MO_TENT_ACTION_STATE] == MO_TENT_SHAKE)) { + f32 maxSwingRateX; + f32 maxSwingLagX; + f32 maxSwingSizeX; + f32 maxSwingRateZ; + f32 maxSwingLagZ; + f32 maxSwingSizeZ; + f32 swingRateAccel; + f32 swingSizeAccel; + if (this->work[MO_TENT_ACTION_STATE] == MO_TENT_READY) { if (sMorphaCore->csState != MO_BATTLE) { maxSwingRateX = 2000.0f; @@ -570,25 +542,33 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { this->timers[0] = 60; } } - if (this->timers[0] > 50) { - rippleCount = 1; - } else if (this->timers[0] > 40) { - rippleCount = 3; - } else if (this->timers[0] > 30) { - rippleCount = 5; - } else if (this->timers[0] > 20) { - rippleCount = 8; - } else { - rippleCount = 3; - } - for (indS1 = 0; indS1 < rippleCount; indS1++) { - randFloat = Rand_ZeroFloat(50.0f); - randAngle = Rand_ZeroFloat(0x10000); - ripplePos = this->actor.world.pos; - ripplePos.x += sinf(randAngle) * randFloat; - ripplePos.z += cosf(randAngle) * randFloat; - ripplePos.y = MO_WATER_LEVEL(play); - BossMo_SpawnRipple(play->specialEffects, &ripplePos, 40.0f, 110.0f, 80, 290, MO_FX_SMALL_RIPPLE); + if (1) { + s16 rippleCount; + Vec3f ripplePos; + f32 randAngle; + f32 randFloat; + s32 pad; + + if (this->timers[0] > 50) { + rippleCount = 1; + } else if (this->timers[0] > 40) { + rippleCount = 3; + } else if (this->timers[0] > 30) { + rippleCount = 5; + } else if (this->timers[0] > 20) { + rippleCount = 8; + } else { + rippleCount = 3; + } + for (indS1 = 0; indS1 < rippleCount; indS1++) { + randFloat = Rand_ZeroFloat(50.0f); + randAngle = Rand_ZeroFloat(0x10000); + ripplePos = this->actor.world.pos; + ripplePos.x += sinf(randAngle) * randFloat; + ripplePos.z += cosf(randAngle) * randFloat; + ripplePos.y = MO_WATER_LEVEL(play); + BossMo_SpawnRipple(play->specialEffects, &ripplePos, 40.0f, 110.0f, 80, 290, MO_FX_SMALL_RIPPLE); + } } break; case MO_TENT_READY: @@ -634,7 +614,8 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { this->attackAngleMod = Rand_CenteredFloat(0x1000); } } else { - tentXrot = this->tentRot[28].x; + s16 tentXrot = this->tentRot[28].x; + if ((this->timers[0] == 0) && (tentXrot >= 0) && (sp1B4 < 0)) { this->work[MO_TENT_ACTION_STATE] = MO_TENT_ATTACK; if (this == sMorphaTent1) { @@ -661,9 +642,10 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachF(&this->tentMaxAngle, 0.5f, 1.0f, 0.01); Math_ApproachF(&this->tentSpeed, 160.0f, 1.0f, 50.0f); if ((this->timers[0] == 0) || (this->playerHitTimer != 0)) { - dx = this->tentPos[22].x - player->actor.world.pos.x; - dy = this->tentPos[22].y - player->actor.world.pos.y; - dz = this->tentPos[22].z - player->actor.world.pos.z; + f32 dx = this->tentPos[22].x - player->actor.world.pos.x; + f32 dy = this->tentPos[22].y - player->actor.world.pos.y; + f32 dz = this->tentPos[22].z - player->actor.world.pos.z; + if ((fabsf(dy) < 50.0f) && !HAS_LINK(otherTent) && (sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 120.0f)) { this->tentMaxAngle = .001f; this->work[MO_TENT_ACTION_STATE] = MO_TENT_CURL; @@ -765,7 +747,8 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachS(&player->actor.shape.rot.y, this->grabPosRot.rot.y, 2, 0x7D0); Math_ApproachS(&player->actor.shape.rot.z, this->grabPosRot.rot.z, 2, 0x7D0); if (this->timers[0] == 0) { - mainCam1 = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); + this->work[MO_TENT_ACTION_STATE] = MO_TENT_SHAKE; this->tentMaxAngle = .001f; this->fwork[MO_TENT_SWING_RATE_X] = this->fwork[MO_TENT_SWING_RATE_Z] = @@ -778,8 +761,8 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); - this->subCamEye = mainCam1->eye; - this->subCamAt = mainCam1->at; + this->subCamEye = mainCam->eye; + this->subCamAt = mainCam->at; this->subCamYaw = Math_FAtan2F(this->subCamEye.x - this->actor.world.pos.x, this->subCamEye.z - this->actor.world.pos.z); this->subCamYawRate = 0; @@ -798,12 +781,14 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { } Math_ApproachF(&this->waterLevelMod, -5.0f, 0.1f, 0.4f); sp1B4 = this->tentRot[15].x; - buttons = play->state.input[0].press.button; - if (CHECK_BTN_ALL(buttons, BTN_A) || CHECK_BTN_ALL(buttons, BTN_B)) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { this->mashCounter++; } for (indS1 = 0; indS1 < 41; indS1++) { if (indS1 < 20) { + f32 temp; + sin = Math_SinS(((s16)this->fwork[MO_TENT_SWING_LAG_X] * indS1) + this->xSwing); tempf1 = this->fwork[MO_TENT_SWING_SIZE_X] * (indS1 * 0.025f * sin); cos = Math_SinS(((s16)this->fwork[MO_TENT_SWING_LAG_Z] * indS1) + this->zSwing); @@ -828,7 +813,8 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachF(&this->tentSpeed, 480.0f, 1.0f, 10.0f); Math_ApproachF(&this->tentPulse, 0.3f, 0.5f, 0.03f); if ((this->mashCounter >= 40) || (this->timers[0] == 0)) { - tentXrot = this->tentRot[15].x; + s16 tentXrot = this->tentRot[15].x; + if ((tentXrot < 0) && (sp1B4 >= 0)) { this->work[MO_TENT_ACTION_STATE] = MO_TENT_RETREAT; this->work[MO_TENT_INVINC_TIMER] = 50; @@ -844,6 +830,9 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { } } if (this->subCamId != SUB_CAM_ID_DONE) { + Vec3f sp138; + Vec3f sp12C; + sp138.x = 0; sp138.y = 100.0f; sp138.z = 200.0f; @@ -869,6 +858,12 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { } Math_ApproachF(&this->tentRippleSize, 0.15f, 0.5f, 0.01); if (this->meltIndex < 41) { + Vec3f sp120; + s16 indS0; + s32 pad118; + s32 pad114; + s32 pad110; + for (indS0 = 0; indS0 < 10; indS0++) { sp120 = this->tentPos[this->meltIndex]; sp120.x += Rand_CenteredFloat(30.0f); @@ -895,10 +890,11 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachF(&this->subCamAt.z, player->actor.world.pos.z, 0.5f, 50.0f); Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); if (player->actor.world.pos.y <= 42.0f) { - mainCam2 = Play_GetCamera(play, CAM_ID_MAIN); - mainCam2->eye = this->subCamEye; - mainCam2->eyeNext = this->subCamEye; - mainCam2->at = this->subCamAt; + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); + + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); @@ -917,11 +913,14 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachF(&this->tentMaxAngle, 0.5f, 1.0f, 0.01); Math_ApproachF(&this->tentSpeed, 320.0f, 1.0f, 50.0f); if (this->timers[0] == 0) { + s16 indS0; + Vec3f spFC; + Vec3f spF0; + this->actor.flags &= ~ACTOR_FLAG_0; Math_ApproachF(&this->baseAlpha, 0.0, 1.0f, 5.0f); for (indS1 = 0; indS1 < 40; indS1++) { - indT5 = Rand_ZeroFloat(20.9f); - indS0 = sTentSpawnIndex[indT5]; + indS0 = sTentSpawnIndex[(s16)Rand_ZeroFloat(20.9f)]; spFC.x = 0; spFC.y = 0; spFC.z = 0; @@ -1067,6 +1066,8 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachF(&this->tentSpeed, 0.1f, 1.0f, 0.005f); this->actor.velocity.y = 0.0; } else { + f32 padEC; + this->fwork[MO_TENT_MAX_STRETCH] = 0.2f; this->fwork[MO_TENT_MAX_STRETCH] += Math_SinS(this->work[MO_TENT_MOVE_TIMER] * 0x2000) * 0.05f; padEC = Math_CosS(this->work[MO_TENT_MOVE_TIMER] * 0x2000) * 0.0005f; @@ -1081,6 +1082,10 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { this->timers[0] = 60; Sfx_PlaySfxAtPos(&this->tentTipPos, NA_SE_EN_MOFER_CORE_JUMP); for (indS1 = 0; indS1 < 300; indS1++) { + Vec3f spE0; + Vec3f spD4; + Vec3f spC8; + spC8.x = 0.0; spC8.y = 0.0; spC8.z = indS1 * 0.03f; @@ -1137,27 +1142,27 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { void BossMo_TentCollisionCheck(BossMo* this, PlayState* play) { s16 i1; + s16 i2; + ColliderElement* acHitElem; for (i1 = 0; i1 < ARRAY_COUNT(this->tentElements); i1++) { - if (this->tentCollider.elements[i1].base.bumperFlags & BUMP_HIT) { - s16 i2; - ColliderElement* acHitElem; + if (this->tentCollider.elements[i1].base.acElemFlags & ACELEM_HIT) { for (i2 = 0; i2 < 19; i2++) { - this->tentCollider.elements[i2].base.bumperFlags &= ~BUMP_HIT; - this->tentCollider.elements[i2].base.toucherFlags &= ~TOUCH_HIT; + this->tentCollider.elements[i2].base.acElemFlags &= ~ACELEM_HIT; + this->tentCollider.elements[i2].base.atElemFlags &= ~ATELEM_HIT; } acHitElem = this->tentCollider.elements[i1].base.acHitElem; this->work[MO_TENT_INVINC_TIMER] = 5; - if (acHitElem->toucher.dmgFlags & DMG_MAGIC_FIRE) { + if (acHitElem->atDmgInfo.dmgFlags & DMG_MAGIC_FIRE) { Sfx_PlaySfxAtPos(&this->tentTipPos, NA_SE_EN_MOFER_CUT); this->cutIndex = 15; this->meltIndex = this->cutIndex + 1; this->work[MO_TENT_ACTION_STATE] = MO_TENT_CUT; this->timers[0] = 40; this->cutScale = 1.0f; - } else if (acHitElem->toucher.dmgFlags & (DMG_JUMP_MASTER | DMG_JUMP_GIANT | DMG_SPIN_MASTER | - DMG_SPIN_GIANT | DMG_SLASH_GIANT | DMG_SLASH_MASTER)) { + } else if (acHitElem->atDmgInfo.dmgFlags & (DMG_JUMP_MASTER | DMG_JUMP_GIANT | DMG_SPIN_MASTER | + DMG_SPIN_GIANT | DMG_SLASH_GIANT | DMG_SLASH_MASTER)) { this->playerHitTimer = 5; } this->tentRippleSize = 0.2f; @@ -1175,8 +1180,8 @@ void BossMo_TentCollisionCheck(BossMo* this, PlayState* play) { Rand_ZeroFloat(0.08f) + 0.13f); } break; - } else if (this->tentCollider.elements[i1].base.toucherFlags & TOUCH_HIT) { - this->tentCollider.elements[i1].base.toucherFlags &= ~TOUCH_HIT; + } else if (this->tentCollider.elements[i1].base.atElemFlags & ATELEM_HIT) { + this->tentCollider.elements[i1].base.atElemFlags &= ~ATELEM_HIT; this->playerHitTimer = 5; break; } @@ -1352,13 +1357,14 @@ void BossMo_IntroCs(BossMo* this, PlayState* play) { this->work[MO_TENT_ACTION_STATE] = MO_CORE_INTRO_REVEAL; this->actor.flags &= ~ACTOR_FLAG_0; sMorphaTent1->actor.flags |= ACTOR_FLAG_0; - } else { - sMorphaTent1->xSwing = 0xCEC; - sMorphaTent1->fwork[MO_TENT_SWING_RATE_X] = 0.0f; - sMorphaTent1->fwork[MO_TENT_SWING_LAG_X] = 1000.0f; - sMorphaTent1->fwork[MO_TENT_SWING_SIZE_X] = 2500.0f; - break; + goto intro_reveal; } + sMorphaTent1->xSwing = 0xCEC; + sMorphaTent1->fwork[MO_TENT_SWING_RATE_X] = 0.0f; + sMorphaTent1->fwork[MO_TENT_SWING_LAG_X] = 1000.0f; + sMorphaTent1->fwork[MO_TENT_SWING_SIZE_X] = 2500.0f; + break; + intro_reveal: case MO_INTRO_REVEAL: if (this->timers[2] >= 160) { this->subCamEye.x = 150.0f; @@ -1749,13 +1755,13 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) { // "hit!!" PRINTF("Core_Damage_check 当りï¼ï¼\n"); this->coreCollider.base.acFlags &= ~AC_HIT; - if ((acHitElem->toucher.dmgFlags & DMG_MAGIC_FIRE) && (this->work[MO_TENT_ACTION_STATE] == MO_CORE_ATTACK)) { + if ((acHitElem->atDmgInfo.dmgFlags & DMG_MAGIC_FIRE) && (this->work[MO_TENT_ACTION_STATE] == MO_CORE_ATTACK)) { this->work[MO_TENT_ACTION_STATE] = MO_CORE_RETREAT; } // "hit 2 !!" PRINTF("Core_Damage_check 当り 2 ï¼ï¼\n"); if ((this->work[MO_TENT_ACTION_STATE] != MO_CORE_UNDERWATER) && (this->work[MO_TENT_INVINC_TIMER] == 0)) { - u8 damage = CollisionCheck_GetSwordDamage(acHitElem->toucher.dmgFlags); + u8 damage = CollisionCheck_GetSwordDamage(acHitElem->atDmgInfo.dmgFlags); if ((damage != 0) && (this->work[MO_TENT_ACTION_STATE] < MO_CORE_ATTACK)) { // "sword hit !!" @@ -1793,7 +1799,8 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) { } } this->work[MO_TENT_INVINC_TIMER] = 10; - } else if (!(acHitElem->toucher.dmgFlags & DMG_SHIELD) && (acHitElem->toucher.dmgFlags & DMG_HOOKSHOT)) { + } else if (!(acHitElem->atDmgInfo.dmgFlags & DMG_SHIELD) && + (acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT)) { if (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_ATTACK) { Sfx_PlaySfxAtPos(&sMorphaTent1->tentTipPos, NA_SE_EN_MOFER_CUT); sMorphaTent1->cutIndex = this->work[MO_CORE_POS_IN_TENT]; @@ -1858,13 +1865,6 @@ void BossMo_Core(BossMo* this, PlayState* play) { s16 index; // not on stack f32 sp88; s32 pad84; - f32 sp80; - f32 sp7C; - Vec3f sp70; - Vec3f sp64; - f32 sp60; - f32 sp5C; - f32 sp58; this->waterTex1x += -1.0f; this->waterTex1y += -1.0f; @@ -2028,6 +2028,11 @@ void BossMo_Core(BossMo* this, PlayState* play) { Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.5f, this->actor.speed); Math_ApproachF(&this->actor.speed, 30.0f, 1.0f, 1.0f); } else { + f32 sp80; + f32 sp7C; + Vec3f sp70; + Vec3f sp64; + switch (this->work[MO_TENT_ACTION_STATE]) { case MO_CORE_MOVE: sp80 = Math_SinS(this->work[MO_TENT_VAR_TIMER] * 0x800) * 100.0f; @@ -2165,6 +2170,9 @@ void BossMo_Core(BossMo* this, PlayState* play) { } else { this->timers[3] = 8; for (i = 0; i < 10; i++) { + f32 sp60; + f32 sp5C; + sp5C = Rand_ZeroFloat(3.14f); sp60 = Rand_ZeroFloat(0.6f) + 1.6f; effectVelocity.x = Math_SinS(((i * (f32)0x10000) / 10.0f) + sp5C) * sp60; @@ -2187,6 +2195,8 @@ void BossMo_Core(BossMo* this, PlayState* play) { } if ((this->actor.world.pos.y < MO_WATER_LEVEL(play)) || (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_ATTACK)) { for (i = 0; i < 3; i++) { + f32 sp58; + effectAccel.x = effectAccel.z = 0.0f; effectVelocity.x = effectVelocity.y = effectVelocity.z = 0.0f; if (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_ATTACK) { @@ -2687,7 +2697,8 @@ void BossMo_DrawCore(Actor* thisx, PlayState* play) { sp84 = this->subCamAt.z - this->subCamEye.z; temp = SQ(sp8C) + SQ(sp84); sp7C = Math_FAtan2F(sp8C, sp84); - sp78 = -Math_FAtan2F(sp88, sqrtf(temp)); + temp = sqrtf(temp); + sp78 = -Math_FAtan2F(sp88, temp); sp6C.x = 0.0f; sp6C.y = 0.0f; @@ -2725,7 +2736,6 @@ void BossMo_DrawTent(Actor* thisx, PlayState* play) { u16 texCoordScale; OPEN_DISPS(play->state.gfxCtx, "../z_boss_mo.c", 6958); - if (1) {} Gfx_SetupDL_25Opa(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, (s8)(this->baseAlpha * 1.5f)); gDPSetEnvColor(POLY_OPA_DISP++, 150, 150, 150, 0); @@ -2743,6 +2753,7 @@ void BossMo_DrawTent(Actor* thisx, PlayState* play) { if (this->drawActor) { BossMo_DrawTentacle(this, play); } + if (1) {} CLOSE_DISPS(play->state.gfxCtx, "../z_boss_mo.c", 7023); } diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo_colchk.inc.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo_colchk.inc.c index 3826a4485..0ae73dadb 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo_colchk.inc.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo_colchk.inc.c @@ -7,8 +7,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 0 }, 100 }, @@ -18,8 +18,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 1, { { 0, 0, 0 }, 0 }, 100 }, @@ -29,8 +29,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 2, { { 0, 0, 0 }, 30 }, 100 }, @@ -40,8 +40,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 3, { { 0, 0, 0 }, 24 }, 100 }, @@ -51,8 +51,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 4, { { 0, 0, 0 }, 22 }, 100 }, @@ -62,8 +62,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 5, { { 0, 0, 0 }, 20 }, 100 }, @@ -73,8 +73,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 6, { { 0, 0, 0 }, 18 }, 100 }, @@ -84,8 +84,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 7, { { 0, 0, 0 }, 16 }, 100 }, @@ -95,8 +95,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 8, { { 0, 0, 0 }, 14 }, 100 }, @@ -106,8 +106,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 9, { { 0, 0, 0 }, 12 }, 100 }, @@ -117,8 +117,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 10, { { 0, 0, 0 }, 10 }, 100 }, @@ -128,8 +128,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 11, { { 0, 0, 0 }, 10 }, 100 }, @@ -139,8 +139,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 12, { { 0, 0, 0 }, 10 }, 100 }, @@ -150,8 +150,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 13, { { 0, 0, 0 }, 10 }, 100 }, @@ -161,8 +161,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 14, { { 0, 0, 0 }, 10 }, 100 }, @@ -172,8 +172,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 15, { { 0, 0, 0 }, 10 }, 100 }, @@ -183,8 +183,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 16, { { 0, 0, 0 }, 10 }, 100 }, @@ -194,8 +194,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 17, { { 0, 0, 0 }, 10 }, 100 }, @@ -205,8 +205,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[19] = { ELEMTYPE_UNK4, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 18, { { 0, 0, 0 }, 10 }, 100 }, @@ -239,8 +239,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFDFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 20, 40, -20, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index df893e790..dd2136039 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -363,10 +363,11 @@ void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) { player->actor.world.pos.x = sRoomCenter.x; player->actor.world.pos.y = ROOM_CENTER_Y + 1000.0f; player->actor.world.pos.z = sRoomCenter.z; - player->speedXZ = player->actor.velocity.y = 0.0f; + player->speedXZ = 0.0f; player->actor.shape.rot.y = -0x8000; player->zTargetYaw = -0x8000; player->yaw = -0x8000; + player->actor.velocity.y = 0.0f; player->fallStartHeight = 0; player->stateFlags1 |= PLAYER_STATE1_5; @@ -654,8 +655,10 @@ void BossSst_HeadNeutral(BossSst* this, PlayState* play) { } if (this->timer == 0) { - if ((GET_PLAYER(play)->actor.world.pos.y > -50.0f) && - !(GET_PLAYER(play)->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_13 | PLAYER_STATE1_14))) { + Player* player = GET_PLAYER(play); + + if ((player->actor.world.pos.y > -50.0f) && + !(player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_13 | PLAYER_STATE1_14))) { sHands[Rand_ZeroOne() <= 0.5f]->ready = true; BossSst_HeadSetupWait(this); } else { @@ -825,9 +828,8 @@ void BossSst_HeadSetupStunned(BossSst* this) { } void BossSst_HeadStunned(BossSst* this, PlayState* play) { - f32 bounce; - s32 animFinish; f32 currentFrame; + s32 animFinish; Math_StepToF(&sHandOffsets[LEFT].z, 600.0f, 20.0f); Math_StepToF(&sHandOffsets[RIGHT].z, 600.0f, 20.0f); @@ -837,7 +839,8 @@ void BossSst_HeadStunned(BossSst* this, PlayState* play) { animFinish = SkelAnime_Update(&this->skelAnime); currentFrame = this->skelAnime.curFrame; if (currentFrame <= 6.0f) { - bounce = (sinf((M_PI / 11) * currentFrame) * 100.0f) + (this->actor.home.pos.y - 180.0f); + f32 bounce = (sinf((M_PI / 11) * currentFrame) * 100.0f) + (this->actor.home.pos.y - 180.0f); + if (this->actor.world.pos.y < bounce) { this->actor.world.pos.y = bounce; } @@ -870,10 +873,10 @@ void BossSst_HeadStunned(BossSst* this, PlayState* play) { void BossSst_HeadSetupVulnerable(BossSst* this) { Animation_MorphToLoop(&this->skelAnime, &gBongoHeadStunnedAnim, -5.0f); this->colliderCyl.base.acFlags |= AC_ON; - this->colliderCyl.elem.bumper.dmgFlags = DMG_SWORD | DMG_DEKU_STICK; + this->colliderCyl.elem.acDmgInfo.dmgFlags = DMG_SWORD | DMG_DEKU_STICK; this->actor.speed = 0.0f; - this->colliderJntSph.elements[10].base.bumperFlags |= (BUMP_ON | BUMP_HOOKABLE); - this->colliderJntSph.elements[0].base.bumperFlags &= ~BUMP_ON; + this->colliderJntSph.elements[10].base.acElemFlags |= (ACELEM_ON | ACELEM_HOOKABLE); + this->colliderJntSph.elements[0].base.acElemFlags &= ~ACELEM_ON; if (this->actionFunc != BossSst_HeadDamage) { this->timer = 50; } @@ -929,9 +932,9 @@ void BossSst_HeadDamage(BossSst* this, PlayState* play) { void BossSst_HeadSetupRecover(BossSst* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gBongoHeadRecoverAnim, -5.0f); this->colliderCyl.base.acFlags &= ~AC_ON; - this->colliderCyl.elem.bumper.dmgFlags = DMG_DEFAULT; - this->colliderJntSph.elements[10].base.bumperFlags &= ~(BUMP_ON | BUMP_HOOKABLE); - this->colliderJntSph.elements[0].base.bumperFlags |= BUMP_ON; + this->colliderCyl.elem.acDmgInfo.dmgFlags = DMG_DEFAULT; + this->colliderJntSph.elements[10].base.acElemFlags &= ~(ACELEM_ON | ACELEM_HOOKABLE); + this->colliderJntSph.elements[0].base.acElemFlags |= ACELEM_ON; this->vVanish = true; this->actor.speed = 5.0f; this->actionFunc = BossSst_HeadRecover; @@ -1565,7 +1568,6 @@ void BossSst_HandSetupSweep(BossSst* this) { void BossSst_HandSweep(BossSst* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 newTargetYaw; SkelAnime_Update(&this->skelAnime); this->handAngSpeed += 0x60; @@ -1575,6 +1577,8 @@ void BossSst_HandSweep(BossSst* this, PlayState* play) { this->colliderJntSph.base.ocFlags1 &= ~OC1_NO_PUSH; BossSst_HandSetupRetreat(this); } else if (this->colliderJntSph.base.atFlags & AT_HIT) { + s16 newTargetYaw; + this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); this->ready = true; func_8002F71C(play, &this->actor, 5.0f, this->actor.shape.rot.y - (this->vParity * 0x3800), 0.0f); @@ -2496,7 +2500,7 @@ void BossSst_HandSetDamage(BossSst* this, s32 damage) { this->colliderJntSph.base.atFlags |= AT_ON; for (i = 0; i < 11; i++) { - this->colliderJntSph.elements[i].base.toucher.damage = damage; + this->colliderJntSph.elements[i].base.atDmgInfo.damage = damage; } } @@ -2772,57 +2776,41 @@ void BossSst_DrawHand(Actor* thisx, PlayState* play) { s32 BossSst_OverrideHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { BossSst* this = (BossSst*)thisx; - s32 shakeAmp; - s32 pad; - s32 timer12; - f32 shakeMod; if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS) && this->vVanish) { *dList = NULL; } else if (this->actionFunc == BossSst_HeadThrash) { // Animation modifications for death cutscene - shakeAmp = (this->timer / 10) + 1; + s32 shakeAmp = (this->timer / 10) + 1; + if ((limbIndex == 3) || (limbIndex == 39) || (limbIndex == 42)) { - - shakeMod = sinf(this->timer * (M_PI / 5)); - rot->x += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * shakeMod; - - shakeMod = sinf((this->timer % 5) * (M_PI / 5)); - rot->z -= ((0x800 * Rand_ZeroOne() + 0x1000) / 0x10) * shakeAmp * shakeMod + 0x1000; + rot->x += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * sinf(this->timer * (M_PI / 5)); + rot->z -= + ((0x800 * Rand_ZeroOne() + 0x1000) / 0x10) * shakeAmp * sinf((this->timer % 5) * (M_PI / 5)) + 0x1000; if (limbIndex == 3) { - - shakeMod = sinf(this->timer * (M_PI / 5)); - rot->y += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * shakeMod; + rot->y += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * sinf(this->timer * (M_PI / 5)); } } else if ((limbIndex == 5) || (limbIndex == 6)) { - - shakeMod = sinf((this->timer % 5) * (M_PI / 5)); - rot->z -= ((0x280 * Rand_ZeroOne() + 0x500) / 0x10) * shakeAmp * shakeMod + 0x500; + rot->z -= + ((0x280 * Rand_ZeroOne() + 0x500) / 0x10) * shakeAmp * sinf((this->timer % 5) * (M_PI / 5)) + 0x500; if (limbIndex == 5) { - - shakeMod = sinf(this->timer * (M_PI / 5)); - rot->x += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * shakeMod; - - shakeMod = sinf(this->timer * (M_PI / 5)); - rot->y += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * shakeMod; + rot->x += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * sinf(this->timer * (M_PI / 5)); + rot->y += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * sinf(this->timer * (M_PI / 5)); } } else if (limbIndex == 2) { - shakeMod = sinf(this->timer * (M_PI / 5)); - rot->x += ((0x200 * Rand_ZeroOne() + 0x400) / 0x10) * shakeAmp * shakeMod; - - shakeMod = sinf(this->timer * (M_PI / 5)); - rot->y += ((0x200 * Rand_ZeroOne() + 0x400) / 0x10) * shakeAmp * shakeMod; - - shakeMod = sinf((this->timer % 5) * (M_PI / 5)); - rot->z -= ((0x100 * Rand_ZeroOne() + 0x200) / 0x10) * shakeAmp * shakeMod + 0x200; + rot->x += ((0x200 * Rand_ZeroOne() + 0x400) / 0x10) * shakeAmp * sinf(this->timer * (M_PI / 5)); + rot->y += ((0x200 * Rand_ZeroOne() + 0x400) / 0x10) * shakeAmp * sinf(this->timer * (M_PI / 5)); + rot->z -= + ((0x100 * Rand_ZeroOne() + 0x200) / 0x10) * shakeAmp * sinf((this->timer % 5) * (M_PI / 5)) + 0x200; } } else if (this->actionFunc == BossSst_HeadDeath) { + s32 timer12; + if (this->timer > 48) { timer12 = this->timer - 36; } else { - pad = ((this->timer > 6) ? 6 : this->timer); - timer12 = pad * 2; + timer12 = ((this->timer > 6) ? 6 : this->timer) * 2; } if ((limbIndex == 3) || (limbIndex == 39) || (limbIndex == 42)) { @@ -2947,14 +2935,16 @@ void BossSst_SpawnHeadShadow(BossSst* this) { s32 i; f32 sn; f32 cs; + BossSstEffect* shadow; + Vec3f* offset; this->effectMode = BONGO_SHADOW; sn = Math_SinS(this->actor.shape.rot.y); cs = Math_CosS(this->actor.shape.rot.y); for (i = 0; i < 3; i++) { - BossSstEffect* shadow = &this->effects[i]; - Vec3f* offset = &shadowOffset[i]; + shadow = &this->effects[i]; + offset = &shadowOffset[i]; shadow->pos.x = this->actor.world.pos.x + (sn * offset->z) + (cs * offset->x); shadow->pos.y = 0.0f; @@ -2983,12 +2973,13 @@ void BossSst_SpawnShockwave(BossSst* this) { s32 i; s32 scale = 120; s32 alpha = 250; + BossSstEffect* shockwave; Actor_PlaySfx(&this->actor, NA_SE_EN_SHADEST_HAND_WAVE); this->effectMode = BONGO_SHOCKWAVE; for (i = 0; i < 3; i++) { - BossSstEffect* shockwave = &this->effects[i]; + shockwave = &this->effects[i]; Math_Vec3f_Copy(&shockwave->pos, &this->actor.world.pos); shockwave->move = (i + 9) * 2; @@ -3049,6 +3040,7 @@ void BossSst_SpawnIceShard(BossSst* this) { s32 i; Vec3f spawnPos; f32 offXZ; + BossSstEffect* ice; this->effectMode = BONGO_ICE; offXZ = Math_CosS(this->actor.shape.rot.x) * 50.0f; @@ -3057,7 +3049,7 @@ void BossSst_SpawnIceShard(BossSst* this) { spawnPos.z = Math_SinS(this->actor.shape.rot.y) * offXZ + this->actor.world.pos.z; for (i = 0; i < 18; i++) { - BossSstEffect* ice = &this->effects[i]; + ice = &this->effects[i]; Math_Vec3f_Copy(&ice->pos, &spawnPos); ice->status = 1; @@ -3120,9 +3112,12 @@ void BossSst_UpdateEffects(Actor* thisx, PlayState* play) { this->effectMode = BONGO_NULL; } } else if (this->effectMode == BONGO_SHOCKWAVE) { + BossSstEffect* effect2; + s32 scale; + for (i = 0; i < 3; i++) { - BossSstEffect* effect2 = &this->effects[i]; - s32 scale = effect2->move * 2; + effect2 = &this->effects[i]; + scale = effect2->move * 2; effect2->scale += CLAMP_MAX(scale, 20) + i; if (effect2->move != 0) { diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst_colchk.inc.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst_colchk.inc.c index 16b7c4e8d..f73bfac8e 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst_colchk.inc.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst_colchk.inc.c @@ -6,8 +6,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHand[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 2, { { 2000, -1500, 250 }, 65 }, 100 }, @@ -17,8 +17,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHand[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 10, { { 0, 0, 0 }, 22 }, 100 }, @@ -28,8 +28,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHand[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 11, { { 500, 0, 0 }, 22 }, 100 }, @@ -39,8 +39,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHand[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 15, { { -250, -250, 0 }, 25 }, 100 }, @@ -50,8 +50,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHand[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 16, { { 500, -250, 0 }, 25 }, 100 }, @@ -61,8 +61,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHand[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 20, { { 250, -250, 0 }, 25 }, 100 }, @@ -72,8 +72,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHand[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 21, { { 500, -250, 0 }, 25 }, 100 }, @@ -83,8 +83,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHand[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 25, { { 0, 0, 0 }, 27 }, 100 }, @@ -94,8 +94,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHand[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 26, { { 750, 0, 0 }, 26 }, 100 }, @@ -105,8 +105,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHand[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 5, { { 750, -150, 0 }, 21 }, 100 }, @@ -116,8 +116,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHand[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 6, { { 750, 0, 0 }, 20 }, 100 }, @@ -143,8 +143,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHead[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x30 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 7, { { 1500, 0, 0 }, 70 }, 100 }, @@ -154,8 +154,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHead[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x30 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 6, { { 0, 0, 0 }, 75 }, 100 }, @@ -165,8 +165,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHead[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x30 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 4, { { 5000, 0, 0 }, 120 }, 100 }, @@ -176,8 +176,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHead[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x30 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 3, { { -2500, 0, 0 }, 150 }, 100 }, @@ -187,8 +187,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHead[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x30 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 43, { { 1500, 0, 0 }, 80 }, 100 }, @@ -198,8 +198,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHead[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x30 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 43, { { 7500, 0, 0 }, 70 }, 100 }, @@ -209,8 +209,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHead[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x30 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 44, { { 3000, 0, 0 }, 60 }, 100 }, @@ -220,8 +220,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHead[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x30 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 40, { { 1500, 0, 0 }, 80 }, 100 }, @@ -231,8 +231,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHead[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x30 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 40, { { 7500, 0, 0 }, 70 }, 100 }, @@ -242,8 +242,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHead[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x30 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 41, { { 3000, 0, 0 }, 60 }, 100 }, @@ -253,8 +253,8 @@ static ColliderJntSphElementInit sJntSphItemsInitHead[11] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x30 }, { 0x00000080, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 8, { { 1500, 0, 0 }, 70 }, 100 }, @@ -287,8 +287,8 @@ static ColliderCylinderInit sCylinderInitHead = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 85, 100, -50, { 0, 0, 0 } }, @@ -307,8 +307,8 @@ static ColliderCylinderInit sCylinderInitHand = { ELEMTYPE_UNK0, { 0x20000000, 0x04, 0x10 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 85, 1, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index c01a1b590..437224515 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -144,8 +144,8 @@ static ColliderCylinderInit sCylinderInitBlasts = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x30 }, { 0x00100000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 25, 35, -17, { 0, 0, 0 } }, @@ -164,8 +164,8 @@ static ColliderCylinderInit sCylinderInitKoumeKotake = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x20 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 45, 120, -30, { 0, 0, 0 } }, @@ -184,8 +184,8 @@ static ColliderCylinderInit sCylinderInitTwinrova = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x20 }, { 0xFFCDFFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 45, 120, -30, { 0, 0, 0 } }, @@ -464,7 +464,7 @@ void BossTw_Init(Actor* thisx, PlayState* play2) { if (this->actor.params == TW_FIRE_BLAST || this->actor.params == TW_FIRE_BLAST_GROUND) { this->actionFunc = BossTw_BlastFire; - this->collider.elem.toucher.effect = 1; + this->collider.elem.atDmgInfo.effect = 1; } else if (this->actor.params == TW_ICE_BLAST || this->actor.params == TW_ICE_BLAST_GROUND) { this->actionFunc = BossTw_BlastIce; } else if (this->actor.params >= TW_DEATHBALL_KOTAKE) { @@ -790,7 +790,6 @@ s32 BossTw_BeamHitPlayerCheck(BossTw* this, PlayState* play) { Vec3f offset; Vec3f beamDistFromPlayer; Player* player = GET_PLAYER(play); - s16 i; offset.x = player->actor.world.pos.x - this->beamOrigin.x; offset.y = player->actor.world.pos.y - this->beamOrigin.y; @@ -812,6 +811,8 @@ s32 BossTw_BeamHitPlayerCheck(BossTw* this, PlayState* play) { sFreezeState = 1; } } else if (!player->bodyIsBurning) { + s16 i; + for (i = 0; i < PLAYER_BODYPART_MAX; i++) { player->bodyFlameTimers[i] = Rand_S16Offset(0, 200); } @@ -3096,7 +3097,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, PlayState* play2) { ColliderElement* acHitElem = this->collider.elem.acHitElem; this->collider.base.acFlags &= ~AC_HIT; - if (acHitElem->toucher.dmgFlags & (DMG_SLINGSHOT | DMG_ARROW)) {} + if (acHitElem->atDmgInfo.dmgFlags & (DMG_SLINGSHOT | DMG_ARROW)) {} } } else if (this->collider.base.acFlags & AC_HIT) { u8 damage; @@ -3105,7 +3106,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, PlayState* play2) { this->collider.base.acFlags &= ~AC_HIT; swordDamage = false; - damage = CollisionCheck_GetSwordDamage(acHitElem->toucher.dmgFlags); + damage = CollisionCheck_GetSwordDamage(acHitElem->atDmgInfo.dmgFlags); if (damage == 0) { damage = 2; @@ -3113,7 +3114,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, PlayState* play2) { swordDamage = true; } - if (!(acHitElem->toucher.dmgFlags & DMG_HOOKSHOT)) { + if (!(acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT)) { if (((s8)this->actor.colChkInfo.health < 3) && !swordDamage) { damage = 0; } @@ -3301,6 +3302,8 @@ void func_80941BC0(BossTw* this, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaEffectHaloDL)); Matrix_Pop(); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6461); } @@ -3533,9 +3536,10 @@ void BossTw_Draw(Actor* thisx, PlayState* play2) { } if (this->actor.params == TW_KOTAKE) { + Vec3f diff; + if (this->workf[UNK_F9] > 0.0f) { if (this->workf[UNK_F11] > 0.0f) { - Vec3f diff; diff.x = this->groundBlastPos2.x - player->actor.world.pos.x; diff.y = this->groundBlastPos2.y - player->actor.world.pos.y; diff.z = this->groundBlastPos2.z - player->actor.world.pos.z; @@ -3564,6 +3568,8 @@ void BossTw_Draw(Actor* thisx, PlayState* play2) { } } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7123); } @@ -4077,7 +4083,7 @@ void BossTw_BlastFire(BossTw* this, PlayState* play) { break; } - { + if (1) { f32 sp4C = sGroundBlastType == 2 ? 3.0f : 1.0f; Math_ApproachF(&sKoumePtr->workf[UNK_F9], 0.0f, 1.0f, 10.0f * sp4C); @@ -4231,6 +4237,8 @@ void BossTw_BlastIce(BossTw* this, PlayState* play) { case TW_ICE_BLAST_GROUND: if (this->timers[0] != 0) { + s32 pad; + if (this->timers[0] == 1) { sEnvType = 0; } @@ -4242,7 +4250,6 @@ void BossTw_BlastIce(BossTw* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); if (this->timers[0] > (sTwinrovaPtr->actionFunc == BossTw_Wait ? 70 : 20)) { - s32 pad; Vec3f pos; Vec3f velocity; Vec3f accel; @@ -4320,17 +4327,18 @@ void BossTw_BlastIce(BossTw* this, PlayState* play) { s32 BossTw_BlastShieldCheck(BossTw* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 ret = false; - ColliderElement* acHitElem; if (1) {} if (this->csState1 == 1) { if (this->collider.base.acFlags & AC_HIT) { + ColliderElement* acHitElem; + this->collider.base.acFlags &= ~AC_HIT; this->collider.base.atFlags &= ~AT_HIT; acHitElem = this->collider.elem.acHitElem; - if (acHitElem->toucher.dmgFlags & DMG_SHIELD) { + if (acHitElem->atDmgInfo.dmgFlags & DMG_SHIELD) { this->work[INVINC_TIMER] = 7; play->envCtx.lightBlend = 1.0f; Rumble_Request(0.0f, 100, 5, 4); @@ -4565,17 +4573,6 @@ void BossTw_UpdateEffects(PlayState* play) { s16 j; s16 colorIdx; Vec3f off; - Vec3f spF4; - Vec3f spE8; - Vec3f spDC; - Vec3f spD0; - f32 phi_f22; - Vec3f spC0; - Vec3f spB4; - Vec3f spA8; - s16 spA6; - f32 phi_f0; - Actor* unk44; for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) { if (eff->type != TWEFF_NONE) { @@ -4654,6 +4651,10 @@ void BossTw_UpdateEffects(PlayState* play) { off.z = sTwinrovaPtr->actor.world.pos.z - eff->pos.z; if (sTwinrovaPtr->actionFunc != BossTw_TwinrovaStun) { + Vec3f spF4; + Vec3f spE8; + Vec3f spDC; + if ((SQ(off.x) + SQ(off.y) + SQ(off.z)) < SQ(60.0f)) { for (j = 0; j < 50; j++) { spF4.x = sTwinrovaPtr->actor.world.pos.x + Rand_CenteredFloat(35.0f); @@ -4715,6 +4716,8 @@ void BossTw_UpdateEffects(PlayState* play) { Math_ApproachF(&eff->workf[EFF_DIST], 1000.0f, 1.0f, 10.0f); if (eff->work[EFF_UNKS1] >= 0x10) { if ((eff->work[EFF_UNKS1] == 16) && (sp113 == 0)) { + Vec3f spD0; + sp113 = 1; spD0 = eff->pos; if (eff->pos.y > 40.0f) { @@ -4722,8 +4725,7 @@ void BossTw_UpdateEffects(PlayState* play) { } else { spD0.y = -50.0f; } - sTwinrovaPtr->groundBlastPos.y = phi_f0 = BossTw_GetFloorY(&spD0); - if (phi_f0 >= 0.0f) { + if ((sTwinrovaPtr->groundBlastPos.y = BossTw_GetFloorY(&spD0)) >= 0.0f) { if (sTwinrovaPtr->groundBlastPos.y != 35.0f) { sTwinrovaPtr->groundBlastPos.x = eff->pos.x; sTwinrovaPtr->groundBlastPos.z = eff->pos.z; @@ -4790,7 +4792,7 @@ void BossTw_UpdateEffects(PlayState* play) { } } else if (eff->type == TWEFF_PLYR_FRZ) { if (eff->work[EFF_ARGS] < eff->frame) { - phi_f0 = 1.0f; + f32 phi_f0 = 1.0f; if (eff->target != NULL || sGroundBlastType == 1) { phi_f0 *= 3.0f; @@ -4834,7 +4836,11 @@ void BossTw_UpdateEffects(PlayState* play) { } if ((eff->workf[EFF_DIST] > 0.4f) && ((eff->frame & 7) == 0)) { - spA6 = Rand_ZeroFloat(PLAYER_BODYPART_MAX - 0.1f); + Vec3f spC0; + Vec3f spB4; + Vec3f spA8; + s16 spA6 = Rand_ZeroFloat(PLAYER_BODYPART_MAX - 0.1f); + f32 phi_f22; if (eff->target == NULL) { spC0.x = player->bodyPartsPos[spA6].x + Rand_CenteredFloat(5.0f); @@ -4842,7 +4848,8 @@ void BossTw_UpdateEffects(PlayState* play) { spC0.z = player->bodyPartsPos[spA6].z + Rand_CenteredFloat(5.0f); phi_f22 = 10.0f; } else { - unk44 = eff->target; + Actor* unk44 = eff->target; + spC0.x = unk44->world.pos.x + Rand_CenteredFloat(40.0f); spC0.y = unk44->world.pos.y + Rand_CenteredFloat(40.0f); spC0.z = unk44->world.pos.z + Rand_CenteredFloat(40.0f); @@ -4899,10 +4906,11 @@ void BossTw_DrawEffects(PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); s16 phi_s4; - BossTwEffect* currentEffect = play->specialEffects; + BossTwEffect* currentEffect; BossTwEffect* effectHead; GraphicsContext* gfxCtx = play->state.gfxCtx; + currentEffect = play->specialEffects; effectHead = currentEffect; OPEN_DISPS(gfxCtx, "../z_boss_tw.c", 9592); @@ -5028,10 +5036,10 @@ void BossTw_DrawEffects(PlayState* play) { currentEffect = effectHead; for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) { - Actor* actor; - Vec3f off; - if (currentEffect->type == TWEFF_PLYR_FRZ) { + Actor* actor; + Vec3f off; + if (materialFlag == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceSurroundingPlayerMaterialDL)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, 255); @@ -5204,7 +5212,7 @@ void BossTw_TwinrovaShootBlast(BossTw* this, PlayState* play) { sEnvType = twMagic->blastType + 1; - { + if (1) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 554c45e5a..49a3b69f6 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -213,8 +213,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFEF, 0x03, 0x08 }, { 0x00000010, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 85, 120, 0, { 0, 0, 0 } }, @@ -226,8 +226,8 @@ static ColliderJntSphElementInit sJntSphElementsInitSupport[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000010, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 25 }, 100 }, @@ -253,8 +253,8 @@ static ColliderJntSphElementInit sJntSphElementsInitBari[1] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x03, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -287,8 +287,8 @@ static ColliderQuadInit sQuadInit = { ELEMTYPE_UNK0, { 0x20000000, 0x03, 0x04 }, { 0x00000010, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL | ATELEM_UNK7, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -1121,7 +1121,6 @@ void BossVa_SetupBodyPhase2(BossVa* this, PlayState* play) { void BossVa_BodyPhase2(BossVa* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f sp48; if (this->actor.colorFilterTimer == 0) { sPhase2Timer++; @@ -1129,7 +1128,7 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 160); this->actor.colorFilterTimer = this->invincibilityTimer; } else { - this->colliderBody.elem.bumper.dmgFlags = DMG_BOOMERANG; + this->colliderBody.elem.acDmgInfo.dmgFlags = DMG_BOOMERANG; } } @@ -1139,7 +1138,7 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) { if (this->colliderBody.base.ac->id == ACTOR_EN_BOOM) { sPhase2Timer &= 0xFE00; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 160); - this->colliderBody.elem.bumper.dmgFlags = DMG_SWORD | DMG_BOOMERANG | DMG_DEKU_STICK; + this->colliderBody.elem.acDmgInfo.dmgFlags = DMG_SWORD | DMG_BOOMERANG | DMG_DEKU_STICK; } else { sKillBari++; if ((this->actor.colorFilterTimer != 0) && !(this->actor.colorFilterParams & 0x4000)) { @@ -1166,7 +1165,8 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) { } if ((sPhase2Timer > 10) && !(sPhase2Timer & 7) && (this->actor.speed == 1.0f)) { - sp48 = this->actor.world.pos; + Vec3f sp48 = this->actor.world.pos; + sp48.y += 310.0f + (this->actor.shape.yOffset * this->actor.scale.y); sp48.x += -10.0f; sp48.z += 220.0f; @@ -1217,7 +1217,7 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) { } void BossVa_SetupBodyPhase3(BossVa* this) { - this->colliderBody.elem.bumper.dmgFlags = DMG_BOOMERANG; + this->colliderBody.elem.acDmgInfo.dmgFlags = DMG_BOOMERANG; this->actor.speed = 0.0f; sPhase3StopMoving = false; BossVa_SetupAction(this, BossVa_BodyPhase3); @@ -1421,7 +1421,7 @@ void BossVa_BodyPhase4(BossVa* this, PlayState* play) { } Math_SmoothStepToF(&this->actor.speed, ((sFightPhase - PHASE_4 + 1) * 1.5f) + 4.0f, 1.0f, 0.25f, 0.0f); } - this->colliderBody.elem.bumper.dmgFlags = DMG_BOOMERANG; + this->colliderBody.elem.acDmgInfo.dmgFlags = DMG_BOOMERANG; } else { Math_SmoothStepToS(&this->vaBodySpinRate, 0, 1, 0x96, 0); if (this->timer > 0) { @@ -1429,7 +1429,7 @@ void BossVa_BodyPhase4(BossVa* this, PlayState* play) { this->timer = 35; } Math_SmoothStepToF(&this->actor.shape.yOffset, -480.0f, 1.0f, 30.0f, 0.0f); - this->colliderBody.elem.bumper.dmgFlags = DMG_SWORD | DMG_BOOMERANG | DMG_DEKU_STICK; + this->colliderBody.elem.acDmgInfo.dmgFlags = DMG_SWORD | DMG_BOOMERANG | DMG_DEKU_STICK; this->timer--; } else { if ((player->stateFlags1 & PLAYER_STATE1_26) && (this->timer < -60)) { @@ -1918,19 +1918,6 @@ void BossVa_ZapperAttack(BossVa* this, PlayState* play) { u32 sp88; Vec3f sp7C; s32 pad3; - f32 sp74; - s32 i; - s16 sp6E; - s16 sp6C; - f32 sp68; - f32 sp64; - f32 sp60; - f32 sp5C; - s16 sp5A; - s16 sp58; - s16 sp56; - s16 sp54; - f32 sp50; boomerang = BossVa_FindBoomerang(play); @@ -1939,6 +1926,20 @@ void BossVa_ZapperAttack(BossVa* this, PlayState* play) { sp7C.y += 10.0f; sp8E = 0x3E80; } else { + f32 sp74; + s32 i; + s16 sp6E; + s16 sp6C; + f32 sp68; + f32 sp64; + f32 sp60; + f32 sp5C; + s16 sp5A; + s16 sp58; + s16 sp56; + s16 sp54; + f32 sp50; + sp74 = R_UPDATE_RATE * 0.5f; sp8E = 0x4650; @@ -3148,6 +3149,8 @@ void BossVa_BariPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* gSPDisplayList(POLY_XLU_DISP++, *dList); } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_va.c", 4517); } @@ -3279,10 +3282,6 @@ void BossVa_UpdateEffects(PlayState* play) { s16 spB6; s16 i; f32 spB0; - f32 spAC; - s16 pitch; - BossVa* refActor2; - BossVa* refActor; for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) { if (effect->type == VA_NONE) { @@ -3300,15 +3299,16 @@ void BossVa_UpdateEffects(PlayState* play) { effect->velocity.z += effect->accel.z; if ((effect->type == VA_LARGE_SPARK) || (effect->type == VA_SMALL_SPARK)) { - refActor = effect->parent; + BossVa* refActor = effect->parent; effect->rot.z += (s16)(Rand_ZeroOne() * 0x4E20) + 0x2000; effect->rot.y += (s16)(Rand_ZeroOne() * 0x2710) + 0x2000; if ((effect->mode == SPARK_TETHER) || (effect->mode == SPARK_UNUSED)) { - pitch = effect->rot.x - Math_Vec3f_Pitch(&refActor->actor.world.pos, &GET_BODY(refActor)->unk_1D8); - spAC = Math_SinS(refActor->actor.world.rot.y); - effect->pos.x = refActor->actor.world.pos.x - (effect->offset.x * spAC); + s16 pitch = effect->rot.x - Math_Vec3f_Pitch(&refActor->actor.world.pos, &GET_BODY(refActor)->unk_1D8); + + spB0 = Math_SinS(refActor->actor.world.rot.y); + effect->pos.x = refActor->actor.world.pos.x - (effect->offset.x * spB0); spB0 = Math_CosS(refActor->actor.world.rot.y); effect->pos.z = refActor->actor.world.pos.z - (effect->offset.x * spB0); spB0 = Math_CosS(-pitch); @@ -3347,13 +3347,13 @@ void BossVa_UpdateEffects(PlayState* play) { } if (effect->type == VA_SPARK_BALL) { - refActor2 = effect->parent; + BossVa* refActor = effect->parent; effect->rot.z += (s16)(Rand_ZeroOne() * 0x2710) + 0x24A8; - effect->pos.x = effect->offset.x + refActor2->actor.world.pos.x; + effect->pos.x = effect->offset.x + refActor->actor.world.pos.x; effect->pos.y = - refActor2->actor.world.pos.y + 310.0f + (refActor2->actor.shape.yOffset * refActor2->actor.scale.y); - effect->pos.z = effect->offset.z + refActor2->actor.world.pos.z; + refActor->actor.world.pos.y + 310.0f + (refActor->actor.shape.yOffset * refActor->actor.scale.y); + effect->pos.z = effect->offset.z + refActor->actor.world.pos.z; effect->mode = (effect->mode + 1) & 7; if (effect->timer < 100) { @@ -3378,9 +3378,9 @@ void BossVa_UpdateEffects(PlayState* play) { if (effect->type == VA_BLOOD) { if (effect->mode < BLOOD_SPOT) { + f32 floorY; Vec3f checkPos; CollisionPoly* groundPoly; - f32 floorY; checkPos = effect->pos; checkPos.y -= effect->velocity.y + 4.0f; @@ -3415,9 +3415,9 @@ void BossVa_UpdateEffects(PlayState* play) { if (effect->type == VA_GORE) { if (effect->mode == GORE_PERMANENT) { + f32 floorY; Vec3f checkPos; CollisionPoly* groundPoly; - f32 floorY; checkPos = effect->pos; checkPos.y -= effect->velocity.y + 4.0f; @@ -3452,10 +3452,9 @@ void BossVa_UpdateEffects(PlayState* play) { } if (effect->type == VA_TUMOR) { + BossVa* refActor = effect->parent; s16 yaw; - refActor = effect->parent; - effect->rot.z += 0x157C; effect->envColor[3] = (s16)(Math_SinS(effect->rot.z) * 50.0f) + 80; Math_SmoothStepToF(&effect->scale, effect->scaleMod, 1.0f, 0.01f, 0.005f); @@ -3982,7 +3981,7 @@ void BossVa_DrawDoor(PlayState* play, s16 scale) { Matrix_Get(&doorMtx); - for (i = 0; i < 8; i++, segAngle -= M_PI / 4) { + for (i = 0; i < 8; i++) { Matrix_Put(&doorMtx); Matrix_RotateZ(segAngle, MTXMODE_APPLY); Matrix_Translate(0.0f, doorPieceLength[i] * yScale, 0.0f, MTXMODE_APPLY); @@ -3990,6 +3989,7 @@ void BossVa_DrawDoor(PlayState* play, s16 scale) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_va.c", 5621), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, doorPieceDispList[i]); + segAngle -= M_PI / 4; } CLOSE_DISPS(play->state.gfxCtx, "../z_boss_va.c", 5629); diff --git a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index 1a8b35ee4..c2b949c27 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -775,8 +775,6 @@ void func_80968FB0(Actor* thisx, PlayState* play) { f32 scaleFactor; s32 pad; - if (1) {} - OPEN_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1386); Gfx_SetupDL_25Xlu(play->state.gfxCtx); @@ -787,6 +785,7 @@ void func_80968FB0(Actor* thisx, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, displayList); gDPPipeSync(displayList++); + if (displayList) {} gDPSetPrimColor(displayList++, 0, 0x80, 255, 255, 255, this->unk_293); gDPSetRenderMode(displayList++, G_RM_PASS, G_RM_ZB_CLD_SURF2); gSPEndDisplayList(displayList++); diff --git a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c index d5ff49ceb..83955865d 100644 --- a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c +++ b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c @@ -16,7 +16,6 @@ void DemoDu_Draw(Actor* thisx, PlayState* play); static s32 sUnused = 0; -#pragma asmproc recurse #include "z_demo_du_cutscene_data.inc.c" static void* sEyeTextures[] = { gDaruniaEyeOpenTex, gDaruniaEyeOpeningTex, gDaruniaEyeShutTex, gDaruniaEyeClosingTex }; @@ -68,6 +67,7 @@ void DemoDu_SetMouthTexIndex(DemoDu* this, s16 mouthTexIndex) { this->mouthTexIndex = mouthTexIndex; } +#if IS_DEBUG // Resets all the values used in this cutscene. void DemoDu_CsAfterGanon_Reset(DemoDu* this) { this->updateIndex = CS_CHAMBERAFTERGANON_SUBSCENE(0); @@ -87,12 +87,12 @@ void DemoDu_CsAfterGanon_CheckIfShouldReset(DemoDu* this, PlayState* play) { DemoDu_CsAfterGanon_Reset(this); } D_8096CE94 = false; - return; } } else if (!D_8096CE94) { D_8096CE94 = true; } } +#endif s32 DemoDu_UpdateSkelAnime(DemoDu* this) { return SkelAnime_Update(&this->skelAnime); @@ -104,8 +104,11 @@ void DemoDu_UpdateBgCheckInfo(DemoDu* this, PlayState* play) { CsCmdActorCue* DemoDu_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } + return NULL; } @@ -774,7 +777,9 @@ void DemoDu_CsAfterGanon_BackTo01(DemoDu* this, PlayState* play) { void DemoDu_UpdateCs_AG_00(DemoDu* this, PlayState* play) { DemoDu_CsAfterGanon_AdvanceTo01(this, play); +#if IS_DEBUG DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); +#endif } void DemoDu_UpdateCs_AG_01(DemoDu* this, PlayState* play) { @@ -782,7 +787,9 @@ void DemoDu_UpdateCs_AG_01(DemoDu* this, PlayState* play) { DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); DemoDu_CsAfterGanon_AdvanceTo02(this, play); +#if IS_DEBUG DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); +#endif } void DemoDu_UpdateCs_AG_02(DemoDu* this, PlayState* play) { @@ -790,7 +797,9 @@ void DemoDu_UpdateCs_AG_02(DemoDu* this, PlayState* play) { DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); DemoDu_CsAfterGanon_BackTo01(this, play); +#if IS_DEBUG DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); +#endif } // Similar to DemoDu_Draw_01, but this uses POLY_XLU_DISP. Also uses this->shadowAlpha for setting the env color. diff --git a/src/overlays/actors/ovl_Demo_Du/z_demo_du_cutscene_data.inc.c b/src/overlays/actors/ovl_Demo_Du/z_demo_du_cutscene_data.inc.c index 5d4e1a787..37506612a 100644 --- a/src/overlays/actors/ovl_Demo_Du/z_demo_du_cutscene_data.inc.c +++ b/src/overlays/actors/ovl_Demo_Du/z_demo_du_cutscene_data.inc.c @@ -7,31 +7,31 @@ static CutsceneData D_8096C1A4[] = { CS_UNK_DATA_LIST(0x00000020, 1), CS_UNK_DATA(0x00010000, 0x0BB80000, 0x00000000, 0x00000000, 0xFFFFFFFC, 0x00000002, 0x00000000, 0xFFFFFFFC, 0x00000002, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(31, 5), - CS_ACTOR_CUE(0x0001, 0, 546, 0x0000, 0x0000, 0x0000, 0, 216, -10, 0, 216, -10, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 546, 547, 0x0000, 0x0000, 0x0000, 0, 216, -10, 0, 216, -10, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0004, 547, 616, 0x0000, 0x0000, 0x0000, 0, 216, -10, 0, 216, -10, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 616, 667, 0x0000, 0x0000, 0x0000, 0, 216, -10, 0, 82, 0, 0.0f, -2.627451f, 0.0f), - CS_ACTOR_CUE(0x0003, 667, 2834, 0x0000, 0x0000, 0x0000, 0, 82, 0, 0, 82, 0, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 546, 0x0000, 0x0000, 0x0000, 0, 216, -10, 0, 216, -10, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 546, 547, 0x0000, 0x0000, 0x0000, 0, 216, -10, 0, 216, -10, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0004, 547, 616, 0x0000, 0x0000, 0x0000, 0, 216, -10, 0, 216, -10, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 616, 667, 0x0000, 0x0000, 0x0000, 0, 216, -10, 0, 82, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xC0282828, -2.627451f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 667, 2834, 0x0000, 0x0000, 0x0000, 0, 82, 0, 0, 82, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_PLAYER_CUE_LIST(3), - CS_PLAYER_CUE(PLAYER_CUEID_13, 0, 280, 0x0000, 0x6AAA, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 1.401298464324817e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 280, 531, 0x0000, 0x6AAA, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 1.401298464324817e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_19, 531, 1716, 0x0000, 0xEAAA, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 1.401298464324817e-45f), + CS_PLAYER_CUE(PLAYER_CUEID_13, 0, 280, 0x0000, 0x6AAA, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 280, 531, 0x0000, 0x6AAA, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_19, 531, 1716, 0x0000, 0xEAAA, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), CS_ACTOR_CUE_LIST(41, 3), - CS_ACTOR_CUE(0x0001, 0, 170, 0x0000, 0x0000, 0x0000, 98, 6, -169, 98, 6, -169, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 170, 465, 0x0000, 0x0000, 0x0000, 98, 6, -169, 98, 6, -169, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0003, 465, 2915, 0x0000, 0x0000, 0x0000, 98, 6, -169, 98, 6, -169, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 170, 0x0000, 0x0000, 0x0000, 98, 6, -169, 98, 6, -169, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 170, 465, 0x0000, 0x0000, 0x0000, 98, 6, -169, 98, 6, -169, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 465, 2915, 0x0000, 0x0000, 0x0000, 98, 6, -169, 98, 6, -169, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(49, 1), - CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, -16, -121, 0, -16, -121, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, -16, -121, 0, -16, -121, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 530, 539), CS_TRANSITION(CS_TRANS_GRAY_FILL_OUT, 540, 570), CS_LIGHT_SETTING_LIST(2), - CS_LIGHT_SETTING(0x0000, 0, 10, 0x0000, 0x00000000, 0xFFFFFFDC, 0x00000000, 0x00000018, 0xFFFFFFDC, 0x00000000, 0x00000018), - CS_LIGHT_SETTING(0x0000, 10, 3000, 0x0000, 0x00000000, 0xFFFFFFDC, 0x00000000, 0x00000018, 0xFFFFFFDC, 0x00000000, 0x00000018), + CS_LIGHT_SETTING(0x0000, 0, 10, 0x0000, 0x00000000, 0xFFFFFFDC, 0x00000000, 0x00000018, 0xFFFFFFDC, 0x00000000, 0x00000018, 0x00000000, 0x00000000, 0x00000000), + CS_LIGHT_SETTING(0x0000, 10, 3000, 0x0000, 0x00000000, 0xFFFFFFDC, 0x00000000, 0x00000018, 0xFFFFFFDC, 0x00000000, 0x00000018, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(39, 1), - CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, 0, -2, 0, 0, -2, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, 0, -2, 0, 0, -2, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 805, 835), CS_ACTOR_CUE_LIST(62, 1), - CS_ACTOR_CUE(0x0004, 0, 3000, 0x0000, 0x0000, 0x0000, 32, 80, -51, 32, 80, -51, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0004, 0, 3000, 0x0000, 0x0000, 0x0000, 32, 80, -51, 32, 80, -51, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_DESTINATION(CS_DEST_DEATH_MOUNTAIN_CRATER_FROM_CHAMBER_OF_SAGES, 905, 1030), CS_START_SEQ_LIST(1), CS_START_SEQ(NA_BGM_MEDALLION_GET, 615, 616, 0x0000, 0x00000000, 0xFFFFFF97, 0x00000000, 0x00000030, 0xFFFFFF97, 0x00000000, 0x00000030), @@ -49,139 +49,139 @@ static CutsceneData D_8096C1A4[] = { CS_TEXT_NONE(805, 865), CS_TEXT(0x303D, 865, 875, 0x0000, 0x0000, 0x0000), CS_CAM_EYE_SPLINE(0, 1361), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4f, -85, 3211, 795, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4f, -85, 3211, 795, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4f, -85, 2925, 795, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4f, 70, 974, 497, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4f, 320, 268, 296, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4f, 312, 190, 150, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4f, 261, 61, -65, 0x013F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4f, 261, 61, -65, 0x014E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4f, 261, 61, -65, 0x015F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.4f, 261, 61, -65, 0x0161), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271999A, 60.4f), -85, 3211, 795, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271999A, 60.4f), -85, 3211, 795, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271999A, 60.4f), -85, 2925, 795, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271999A, 60.4f), 70, 974, 497, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271999A, 60.4f), 320, 268, 296, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271999A, 60.4f), 312, 190, 150, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271999A, 60.4f), 261, 61, -65, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271999A, 60.4f), 261, 61, -65, 0x014E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271999A, 60.4f), 261, 61, -65, 0x015F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4271999A, 60.4f), 261, 61, -65, 0x0161), CS_CAM_EYE_SPLINE(263, 509), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 29.399885f, 89, 30, -103, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.2f, 89, 30, -103, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.2f, 89, 30, -103, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.2f, 89, 30, -103, 0x00E8), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.2f, 89, 30, -103, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41EB32F7, 29.399885f), 89, 30, -103, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4270CCCD, 60.2f), 89, 30, -103, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4270CCCD, 60.2f), 89, 30, -103, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4270CCCD, 60.2f), 89, 30, -103, 0x00E8), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4270CCCD, 60.2f), 89, 30, -103, 0x00EA), CS_CAM_EYE_SPLINE(333, 1424), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.999947f, 114, 50, -116, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.999947f, 114, 50, -116, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.999947f, 114, 50, -116, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.999947f, 114, 50, -116, 0x00E8), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.999947f, 114, 50, -116, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4237FFF2, 45.999947f), 114, 50, -116, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4237FFF2, 45.999947f), 114, 50, -116, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4237FFF2, 45.999947f), 114, 50, -116, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4237FFF2, 45.999947f), 114, 50, -116, 0x00E8), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4237FFF2, 45.999947f), 114, 50, -116, 0x00EA), CS_CAM_EYE_SPLINE(403, 1494), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, 26, 45, -10, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, 26, 45, -10, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, 26, 45, -10, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, 26, 45, -10, 0x00E8), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.599945f, 26, 45, -10, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), 26, 45, -10, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), 26, 45, -10, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), 26, 45, -10, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), 26, 45, -10, 0x00E8), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), 26, 45, -10, 0x00EA), CS_CAM_EYE_SPLINE(443, 1624), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 11, 23, -17, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 11, 23, -17, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 27, 31, -45, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 45, 40, -76, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 45, 40, -76, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 45, 40, -76, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 45, 40, -76, 0x013F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.399944f, 45, 40, -76, 0x002E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 11, 23, -17, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 11, 23, -17, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 27, 31, -45, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 45, 40, -76, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 45, 40, -76, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 45, 40, -76, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 45, 40, -76, 0x013F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 45, 40, -76, 0x002E), CS_CAM_EYE_SPLINE(473, 1604), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.199944f, 192, 29, -246, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.199944f, 192, 29, -246, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.199944f, 192, 29, -246, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.199944f, 192, 29, -246, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.39992f, 192, 278, -246, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.39992f, 192, 278, -246, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.39992f, 192, 278, -246, 0x013F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.39992f, 192, 278, -246, 0x002E), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 70.39992f, 192, 278, -246, 0x0063), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4234CCBE, 45.199944f), 192, 29, -246, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4234CCBE, 45.199944f), 192, 29, -246, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4234CCBE, 45.199944f), 192, 29, -246, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4234CCBE, 45.199944f), 192, 29, -246, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428CCCC2, 70.39992f), 192, 278, -246, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428CCCC2, 70.39992f), 192, 278, -246, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428CCCC2, 70.39992f), 192, 278, -246, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428CCCC2, 70.39992f), 192, 278, -246, 0x002E), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x428CCCC2, 70.39992f), 192, 278, -246, 0x0063), CS_CAM_EYE_SPLINE(539, 881), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 13, 854, 2, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 853, 5, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -3, 853, 5, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -9, 853, -6, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -2, 852, -17, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 852, -17, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 16, 852, -6, 0x013F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 852, 5, 0x002E), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -3, 851, 5, 0x0063), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 13, 854, 2, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 853, 5, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -3, 853, 5, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -9, 853, -6, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -2, 852, -17, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 852, -17, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 16, 852, -6, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 852, 5, 0x002E), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -3, 851, 5, 0x0063), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(615, 1796), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 33, -27, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 33, -27, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 68, -26, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x013F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 68.599945f, 0, 103, -26, 0x002E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 33, -27, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 33, -27, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 68, -26, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x013F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x002E), CS_CAM_AT_SPLINE(0, 1390), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 60, 60.4f, -115, 3163, 585, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 60, 60.4f, -115, 3163, 585, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 60, 60.4f, -115, 2877, 585, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.4f, 27, 824, 348, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, 60.4f, 197, 143, 174, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, 60.4f, 147, 100, 55, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, 60.4f, 55, 35, -65, 0x013F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 60.4f, 55, 35, -65, 0x014E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.4f, 55, 35, -65, 0x015F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.4f, 56, 35, -65, 0x0161), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 60, CS_FLOAT(0x4271999A, 60.4f), -115, 3163, 585, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 60, CS_FLOAT(0x4271999A, 60.4f), -115, 3163, 585, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 60, CS_FLOAT(0x4271999A, 60.4f), -115, 2877, 585, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4271999A, 60.4f), 27, 824, 348, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, CS_FLOAT(0x4271999A, 60.4f), 197, 143, 174, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, CS_FLOAT(0x4271999A, 60.4f), 147, 100, 55, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, CS_FLOAT(0x4271999A, 60.4f), 55, 35, -65, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4271999A, 60.4f), 55, 35, -65, 0x014E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4271999A, 60.4f), 55, 35, -65, 0x015F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4271999A, 60.4f), 56, 35, -65, 0x0161), CS_CAM_AT_SPLINE(263, 538), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 78.99979f, 87, 157, -391, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 82, 78.79979f, 87, 157, -391, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 103, 70.79991f, 87, 157, -391, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.2f, 87, 157, -391, 0x00E8), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.2f, 87, 157, -391, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x429DFFE4, 78.99979f), 87, 157, -391, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 82, CS_FLOAT(0x429D997E, 78.79979f), 87, 157, -391, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 103, CS_FLOAT(0x428D998E, 70.79991f), 87, 157, -391, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4270CCCD, 60.2f), 87, 157, -391, 0x00E8), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4270CCCD, 60.2f), 87, 157, -391, 0x00EA), CS_CAM_AT_SPLINE(333, 1453), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.999947f, -52, 127, -309, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.999947f, -52, 127, -309, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.999947f, -52, 127, -309, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.999947f, -52, 127, -309, 0x00E8), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.999947f, -52, 127, -309, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4237FFF2, 45.999947f), -52, 127, -309, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4237FFF2, 45.999947f), -52, 127, -309, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4237FFF2, 45.999947f), -52, 127, -309, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4237FFF2, 45.999947f), -52, 127, -309, 0x00E8), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4237FFF2, 45.999947f), -52, 127, -309, 0x00EA), CS_CAM_AT_SPLINE(403, 1523), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, -269, 186, 13, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, -269, 186, 13, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.599945f, -269, 186, 13, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, -269, 186, 13, 0x00E8), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.599945f, -269, 186, 13, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -269, 186, 13, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -269, 186, 13, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42366658, 45.599945f), -269, 186, 13, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -269, 186, 13, 0x00E8), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -269, 186, 13, 0x00EA), CS_CAM_AT_SPLINE(443, 1653), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 163, 70, -283, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 163, 70, -283, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 177, 74, -309, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 193, 92, -337, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 193, 92, -337, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.399944f, 192, 91, -336, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 192, 91, -336, 0x013F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.399944f, 192, 91, -336, 0x002E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 163, 70, -283, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 163, 70, -283, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 177, 74, -309, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 193, 92, -337, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 193, 92, -337, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998B, 45.399944f), 192, 91, -336, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 192, 91, -336, 0x013F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 192, 91, -336, 0x002E), CS_CAM_AT_SPLINE(473, 1633), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 45.199944f, -9, 57, -53, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 45.199944f, -9, 57, -53, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 45.199944f, -9, 57, -54, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 45.999947f, -8, 57, -54, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 70.39992f, 149, 547, -205, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 70.39992f, 149, 547, -205, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 70.39992f, 149, 547, -205, 0x013F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.39992f, 149, 547, -205, 0x002E), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 70.39992f, 149, 547, -205, 0x0063), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x4234CCBE, 45.199944f), -9, 57, -53, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x4234CCBE, 45.199944f), -9, 57, -53, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x4234CCBE, 45.199944f), -9, 57, -54, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x4237FFF2, 45.999947f), -8, 57, -54, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x428CCCC2, 70.39992f), 149, 547, -205, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x428CCCC2, 70.39992f), 149, 547, -205, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x428CCCC2, 70.39992f), 149, 547, -205, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428CCCC2, 70.39992f), 149, 547, -205, 0x002E), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x428CCCC2, 70.39992f), 149, 547, -205, 0x0063), CS_CAM_AT_SPLINE(539, 930), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 60.0f, 3, 6, -6, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, 60.0f, 3, 6, -6, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 50.999966f, 3, 6, -6, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 20.59985f, 3, 6, -6, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 51, 10.799838f, 3, 6, -6, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.399838f, 3, 6, -6, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.399838f, 3, 6, -6, 0x013F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.199839f, 3, 6, -6, 0x002E), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 50, 10.999838f, 3, 6, -6, 0x0063), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42700000, 60.0f), 3, 6, -6, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, CS_FLOAT(0x42700000, 60.0f), 3, 6, -6, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x424BFFF7, 50.999966f), 3, 6, -6, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x41A4CC7E, 20.59985f), 3, 6, -6, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 51, CS_FLOAT(0x412CCC23, 10.799838f), 3, 6, -6, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x412665BD, 10.399838f), 3, 6, -6, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x412665BD, 10.399838f), 3, 6, -6, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4123328A, 10.199839f), 3, 6, -6, 0x002E), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 50, CS_FLOAT(0x412FFF56, 10.999838f), 3, 6, -6, 0x0063), CS_CAM_AT_SPLINE_REL_TO_PLAYER(615, 1825), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 100, 5, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 101, 6, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 1, 99, 41, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 68.599945f, 0, 42, 16, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x013F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 68.599945f, 0, 42, 16, 0x002E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 100, 5, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 101, 6, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 1, 99, 41, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x013F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x002E), CS_END(), }; // clang-format on diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 91dc9bf45..fa4879e26 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -334,10 +334,12 @@ void DemoEc_UseAnimationObject(DemoEc* this, PlayState* play) { CsCmdActorCue* DemoEc_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; - } else { - return NULL; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } + + return NULL; } void DemoEc_SetStartPosRotFromCue(DemoEc* this, PlayState* play, s32 cueChannel) { diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index 7a7c8be05..e5db2e88a 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -1808,21 +1808,21 @@ void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play) { void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; - u8* alpha; - Gfx* disp; + uintptr_t flashDList = (uintptr_t)gEffFlash1DL; + s32 pad2; OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2842); if (!DemoEffect_CheckForCue(this, play, 1)) { - if (this->light.flicker == 0) { this->light.flicker = 1; } else { - disp = (Gfx*)(uintptr_t)gEffFlash1DL; // necessary to match but probably fake - alpha = &this->light.alpha; Gfx_SetupDL_25Xlu(play->state.gfxCtx); + // `(*this).light.alpha` is probably fake and indicates that `alpha` + // may have been part of an array (possibly a "workbuf" array + // instead of the union of structs we have now). gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, this->primXluColor[0], this->primXluColor[1], - this->primXluColor[2], *alpha); + this->primXluColor[2], (*this).light.alpha); gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255); Matrix_Scale(((this->light.scaleFlag & 1) * 0.05f) + 1.0f, ((this->light.scaleFlag & 1) * 0.05f) + 1.0f, ((this->light.scaleFlag & 1) * 0.05f) + 1.0f, MTXMODE_APPLY); @@ -1831,14 +1831,13 @@ void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play) { Matrix_RotateZ(DEG_TO_RAD(this->light.rotation), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2866), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); - if (disp) {}; - gSPDisplayList(POLY_XLU_DISP++, disp); + gSPDisplayList(POLY_XLU_DISP++, flashDList); Matrix_Pop(); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(-(f32)this->light.rotation), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2874), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, disp); + gSPDisplayList(POLY_XLU_DISP++, flashDList); } } @@ -2004,8 +2003,8 @@ s32 DemoEffect_OverrideLimbDrawTimeWarp(PlayState* play, SkelCurve* skelCurve, s } void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play) { - DemoEffect* this = (DemoEffect*)thisx; GraphicsContext* gfxCtx = play->state.gfxCtx; + DemoEffect* this = (DemoEffect*)thisx; u8 effectType = (this->actor.params & 0x00FF); if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL || diff --git a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c index 1189fd3bc..b80f41997 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -52,7 +52,9 @@ void DemoExt_PlayVortexSFX(DemoExt* this) { CsCmdActorCue* DemoExt_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } return NULL; diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index 7bbd6c7ea..e3f0565eb 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -165,7 +165,9 @@ void func_809782A0(DemoGeff* this, PlayState* play) { void func_80978308(DemoGeff* this, PlayState* play) { func_809781FC(this, play); func_809782A0(this, play); +#if IS_DEBUG func_80978030(this, play); +#endif } void func_80978344(DemoGeff* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 867bd9aeb..b19eed0f2 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -27,8 +27,8 @@ static ColliderCylinderInitType1 sCylinderInit1 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 30, 100, 0, { 0, 0, 0 } }, @@ -46,8 +46,8 @@ static ColliderCylinderInitType1 sCylinderInit2 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 25, 110, 0, { 0, 0, 0 } }, @@ -65,8 +65,8 @@ static ColliderCylinderInitType1 sCylinderInit3 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 25, 200, 0, { 0, 0, 0 } }, @@ -263,7 +263,7 @@ s32 DemoGj_InitSetIndices(DemoGj* this, PlayState* play, s32 updateMode, s32 dra } void DemoGj_DrawCommon(DemoGj* this, PlayState* play, Gfx* displayList) { - if (kREG(0) == 0) { + if (!IS_DEBUG || kREG(0) == 0) { GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_demo_gj.c", 1163); @@ -454,7 +454,7 @@ s32 DemoGj_IsGanondorfFloatingInAir(DemoGj* this, PlayState* play) { void DemoGj_SetupMovement(DemoGj* this, PlayState* play) { Actor* actor = &this->dyna.actor; - Player* player; + s32 pad; Vec3f* pos = &actor->world.pos; Vec3s* unk_172; f32 xDistance; @@ -544,7 +544,8 @@ void DemoGj_SetupMovement(DemoGj* this, PlayState* play) { } if (xDistance == 0.0f && zDistance == 0.0f) { - player = GET_PLAYER(play); + Player* player = GET_PLAYER(play); + xDistance = player->actor.world.pos.x - pos->x; zDistance = player->actor.world.pos.z - pos->z; @@ -974,8 +975,10 @@ void DemoGj_InitDestructableRubble1(DemoGj* this, PlayState* play) { DemoGj_InitCylinder(this, play, &this->cylinders[2], &sCylinderInit1); } +#if IS_DEBUG void DemoGj_DoNothing1(DemoGj* this, PlayState* play) { } +#endif /* * Moves the ColliderCylinder's relative to the actor's position. @@ -1092,7 +1095,9 @@ void DemoGj_Update15(DemoGj* this, PlayState* play) { // func_8097B370 void DemoGj_Update18(DemoGj* this, PlayState* play) { func_8097B22C(this, play); +#if IS_DEBUG DemoGj_DoNothing1(this, play); +#endif } void DemoGj_DrawDestructableRubble1(DemoGj* this, PlayState* play) { @@ -1107,8 +1112,10 @@ void DemoGj_InitDestructableRubble2(DemoGj* this, PlayState* play) { DemoGj_InitCylinder(this, play, &this->cylinders[2], &sCylinderInit2); } +#if IS_DEBUG void DemoGj_DoNothing2(DemoGj* this, PlayState* play) { } +#endif // Moves the ColliderCylinder's relative to the actor's position. void func_8097B450(DemoGj* this, PlayState* play) { @@ -1223,7 +1230,9 @@ void DemoGj_Update16(DemoGj* this, PlayState* play) { // func_8097B894 void DemoGj_Update19(DemoGj* this, PlayState* play) { func_8097B750(this, play); +#if IS_DEBUG DemoGj_DoNothing2(this, play); +#endif } void DemoGj_DemoGj_InitDestructableRubble2(DemoGj* this, PlayState* play) { @@ -1236,8 +1245,10 @@ void DemoGj_InitDestructableRubbleTall(DemoGj* this, PlayState* play) { DemoGj_InitCylinder(this, play, &this->cylinders[0], &sCylinderInit3); } +#if IS_DEBUG void DemoGj_DoNothing3(DemoGj* this, PlayState* play) { } +#endif void DemoGj_DirectedDoubleExplosion(DemoGj* this, PlayState* play, Vec3f* direction) { Vec3f pos; @@ -1308,7 +1319,9 @@ void DemoGj_Update17(DemoGj* this, PlayState* play) { // func_8097BBA8 void DemoGj_Update20(DemoGj* this, PlayState* play) { func_8097BA48(this, play); +#if IS_DEBUG DemoGj_DoNothing3(this, play); +#endif } void DemoGj_DemoGj_InitDestructableRubbleTall(DemoGj* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index 730b63d49..432b8ce63 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -209,9 +209,12 @@ s32 func_8097CDB0(DemoGo* this, PlayState* play, u16 cueId) { CutsceneContext* csCtx = &play->csCtx; s32 cueChannel = DemoGo_GetCueChannel(this); - if ((csCtx->state != CS_STATE_IDLE) && (csCtx->actorCues[cueChannel] != NULL) && - (csCtx->actorCues[cueChannel]->id == cueId)) { - return true; + if (csCtx->state != CS_STATE_IDLE) { + CsCmdActorCue* cue = csCtx->actorCues[cueChannel]; + + if (cue != NULL && cue->id == cueId) { + return true; + } } return false; @@ -341,13 +344,13 @@ void func_8097D29C(DemoGo* this, PlayState* play) { s16 eyeTexIdx = this->unk_190; SkelAnime* skelAnime = &this->skelAnime; void* eyeTexture = sEyeTextures[eyeTexIdx]; - void* mouthTexture = gGoronCsMouthSmileTex; + s32 pad2; OPEN_DISPS(play->state.gfxCtx, "../z_demo_go.c", 732); Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTexture)); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gGoronCsMouthSmileTex)); SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, this); diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index 5190d79c6..52b213ef9 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -265,7 +265,6 @@ void func_8097E454(PlayState* play, Vec3f* spawnerPos, Vec3f* velocity, Vec3f* a s16 phi_s0; s16 dustScaleStep = 15.0f * scale; f32 dustScale = 300.0f * scale; - Vec3f pos; if ((!FrameAdvance_IsEnabled(play)) && (arg7 > 0) && (arg6 > 0)) { frames = (ABS((s32)play->gameplayFrames) % arg7); @@ -273,6 +272,7 @@ void func_8097E454(PlayState* play, Vec3f* spawnerPos, Vec3f* velocity, Vec3f* a increment = 0x10000 / arg6; for (i = frames; i < arg6; i += arg7) { + Vec3f pos; pos.x = (Math_SinS(phi_s0) * arg4) + spawnerPos->x; pos.y = spawnerPos->y; @@ -437,7 +437,7 @@ void func_8097ED64(DemoGt* this, PlayState* play, s32 cueChannel) { } u8 DemoGt_IsCutsceneLayer(void) { - if (kREG(2) != 0) { + if (IS_DEBUG && (kREG(2) != 0)) { return true; } else if (!IS_CUTSCENE_LAYER) { return false; @@ -503,7 +503,7 @@ void func_8097EF40(DemoGt* this, PlayState* play) { Vec3f* pos = &this->dyna.actor.world.pos; s32 pad; - if ((kREG(1) == 20) || (csCurFrame == 220)) { + if ((IS_DEBUG && (kREG(1) == 20)) || (csCurFrame == 220)) { dustPos.x = pos->x + 256.0f; dustPos.y = pos->y + 679.0f; dustPos.z = pos->z + 82.0f; @@ -526,7 +526,12 @@ void func_8097F0AC(DemoGt* this, PlayState* play) { u16 csCurFrame = play->csCtx.curFrame; s32 pad2; - if ((csCurFrame == 140) || (kREG(1) == 19)) { +#if IS_DEBUG + if (csCurFrame == 140 || kREG(1) == 19) +#else + if (csCurFrame == 140) +#endif + { sp38.x = this->dyna.actor.world.pos.x + 260.0f; sp38.y = this->dyna.actor.world.pos.y + 340.0f; sp38.z = this->dyna.actor.world.pos.z + 45.0f; @@ -562,7 +567,6 @@ void func_8097F280(DemoGt* this, PlayState* play) { s32* unk178 = this->unk_178; s32* unk188 = this->unk_188; s32* unk198 = this->unk_198; - f32 temp_f0; if (play->csCtx.curFrame < 160) { unk178[0] = 100; @@ -576,7 +580,7 @@ void func_8097F280(DemoGt* this, PlayState* play) { unk198[0]++; unk198[1]--; } else if (play->csCtx.curFrame < 170) { - temp_f0 = Environment_LerpWeightAccelDecel(170, 160, play->csCtx.curFrame, 0, 0); + f32 temp_f0 = Environment_LerpWeightAccelDecel(170, 160, play->csCtx.curFrame, 0, 0); unk178[0] = (temp_f0 * -63.0f) + 163.0f; unk178[1] = (temp_f0 * -155.0f) + 255.0f; @@ -700,13 +704,14 @@ void func_8097F960(DemoGt* this, PlayState* play) { } void func_8097F96C(DemoGt* this, PlayState* play) { - static Actor* cloudRing = NULL; s32 pad[4]; Vec3f pos; Actor* actor; u16 csCurFrame = play->csCtx.curFrame; - if (((csCurFrame > 1059) && (csCurFrame < 1062)) || kREG(1) == 17) { + if (((csCurFrame > 1059) && (csCurFrame < 1062)) || (IS_DEBUG && (kREG(1) == 17))) { + static Actor* cloudRing = NULL; + pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 612.0f; pos.z = this->dyna.actor.world.pos.z; @@ -730,7 +735,7 @@ void func_8097FA1C(DemoGt* this, PlayState* play) { Vec3f velOffset = { -12.0f, -17.0, 5.0 }; s32 pad1[3]; - if (((csCurFrame > 502) && !(csCurFrame >= 581)) || (kREG(1) == 5)) { + if (((csCurFrame > 502) && !(csCurFrame >= 581)) || (IS_DEBUG && (kREG(1) == 5))) { dustPos.x = pos->x + 300.0f; dustPos.y = pos->y + 360.0f; dustPos.z = pos->z - 377.0f; @@ -739,19 +744,20 @@ void func_8097FA1C(DemoGt* this, PlayState* play) { } void func_8097FAFC(DemoGt* this, PlayState* play) { - static Vec3f velocity = { 0.0f, 1.0f, 0.0f }; - static Vec3f accel = { 0.0f, 0.0f, 0.0f }; - static f32 arg4 = 280.0f; - static f32 scale = 8.0f; - static s32 arg6 = 11; - static s32 arg7 = 1; - static s16 life = 3; s32 pad[2]; u16 csCurFrame = play->csCtx.curFrame; Vec3f pos; f32 new_var = -200.0; - if (((csCurFrame > 582) && (csCurFrame < 683)) || (kREG(1) == 6)) { + if (((csCurFrame > 582) && (csCurFrame < 683)) || (IS_DEBUG && (kREG(1) == 6))) { + static Vec3f velocity = { 0.0f, 1.0f, 0.0f }; + static Vec3f accel = { 0.0f, 0.0f, 0.0f }; + static f32 arg4 = 280.0f; + static f32 scale = 8.0f; + static s32 arg6 = 11; + static s32 arg7 = 1; + static s16 life = 3; + pos = this->dyna.actor.world.pos; pos.y += 680.0f; @@ -773,7 +779,7 @@ void func_8097FC1C(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; - if (csCurFrame > 682 || kREG(1) == 7) { + if (csCurFrame > 682 || (IS_DEBUG && (kREG(1) == 7))) { dustPos.x = pos->x + 260.0f; dustPos.y = pos->y + 360.0f; dustPos.z = pos->z + 260.0f; @@ -786,7 +792,12 @@ void func_8097FCE4(DemoGt* this, PlayState* play) { Vec3f vec; u16 csCurFrame = play->csCtx.curFrame; - if (csCurFrame == 503 || kREG(1) == 4) { +#if IS_DEBUG + if (csCurFrame == 503 || kREG(1) == 4) +#else + if (csCurFrame == 503) +#endif + { vec.x = this->dyna.actor.world.pos.x + 300.0f; vec.y = this->dyna.actor.world.pos.y + 560.0f; vec.z = this->dyna.actor.world.pos.z - 377.0f; @@ -881,12 +892,13 @@ void func_80980178(DemoGt* this, PlayState* play) { } void func_80980184(DemoGt* this, PlayState* play) { - static Actor* cloudRing = NULL; s32 pad[4]; Vec3f pos; Actor* actor; if ((play->csCtx.curFrame > 1027) && (play->csCtx.curFrame < 1031)) { + static Actor* cloudRing = NULL; + pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 247.0f; pos.z = this->dyna.actor.world.pos.z; @@ -903,12 +915,13 @@ void func_80980184(DemoGt* this, PlayState* play) { } void func_80980218(DemoGt* this, PlayState* play) { - static Actor* cloudRing = NULL; s32 pad[4]; Vec3f pos; Actor* actor; if ((play->csCtx.curFrame > 997) && (play->csCtx.curFrame < 1001)) { + static Actor* cloudRing = NULL; + pos.x = this->dyna.actor.home.pos.x; pos.y = this->dyna.actor.home.pos.y + 38.0f; pos.z = this->dyna.actor.home.pos.z; @@ -964,7 +977,7 @@ void func_80980430(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -3.0f, 0.0f }; s32 pad1[3]; - if (csCurFrame > 709 || kREG(1) == 8) { + if (csCurFrame > 709 || (IS_DEBUG && (kREG(1) == 8))) { dustPos.x = pos->x + 760.0f; dustPos.y = pos->y - 40.0f; dustPos.z = pos->z - 240.0f; @@ -980,7 +993,7 @@ void func_80980504(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; - if ((csCurFrame > 704) || kREG(1) == 9) { + if ((csCurFrame > 704) || (IS_DEBUG && (kREG(1) == 9))) { dustPos.x = pos->x + 830.0f; dustPos.y = pos->y + 60.0f; dustPos.z = pos->z + 390.0f; @@ -996,7 +1009,7 @@ void func_809805D8(DemoGt* this, PlayState* play) { Vec3f velOffset = { 15.0f, -26.0, 0.0f }; s32 pad1[3]; - if (((csCurFrame > 739) && (csCurFrame < 781)) || kREG(1) == 11) { + if (((csCurFrame > 739) && (csCurFrame < 781)) || (IS_DEBUG && (kREG(1) == 11))) { dustPos.x = homePos->x + 550.0f; dustPos.y = homePos->y - 110.0f; dustPos.z = homePos->z + 50.0f; @@ -1012,7 +1025,7 @@ void func_809806B8(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; - if ((csCurFrame > 964) || (kREG(1) == 12)) { + if ((csCurFrame > 964) || (IS_DEBUG && (kREG(1) == 12))) { dustPos.x = pos->x + 460.0f; dustPos.y = pos->y + 60.0f; dustPos.z = pos->z + 760.0f; @@ -1028,7 +1041,7 @@ void func_8098078C(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; - if ((csCurFrame > 939) || (kREG(1) == 14)) { + if ((csCurFrame > 939) || (IS_DEBUG && (kREG(1) == 14))) { dustPos.x = pos->x + 360.0f; dustPos.y = pos->y + 70.0f; dustPos.z = pos->z - 640.0f; @@ -1042,7 +1055,7 @@ void func_8098085C(DemoGt* this, PlayState* play) { u16 csCurFrame = play->csCtx.curFrame; Vec3f* pos = &this->dyna.actor.world.pos; - if ((csCurFrame == 58) || (kREG(1) == 1)) { + if ((csCurFrame == 58) || (IS_DEBUG && (kREG(1) == 1))) { sp28.x = pos->x + 900.0f; sp28.y = pos->y - 50.0f; sp28.z = pos->z + 93.0f; @@ -1068,7 +1081,7 @@ void func_809809C0(DemoGt* this, PlayState* play2) { Vec3f sp54; s16 pad[3]; - if (((csCurFrame > 469) && (csCurFrame < 481)) || (kREG(1) == 3)) { + if (((csCurFrame > 469) && (csCurFrame < 481)) || (IS_DEBUG && (kREG(1) == 3))) { Vec3f sp40 = { 20.0f, 6.0f, 0.0f }; Vec3f sp34 = { 0.0f, 0.0f, 0.0f }; s16 pad2[3]; @@ -1088,7 +1101,7 @@ void func_80980AD4(DemoGt* this, PlayState* play) { Vec3f pos; u16 csCurFrame = play->csCtx.curFrame; - if ((csCurFrame == 477) || (kREG(2) == 1)) { + if ((csCurFrame == 477) || (IS_DEBUG && (kREG(2) == 1))) { pos.x = this->dyna.actor.world.pos.x + 790.0f; pos.y = this->dyna.actor.world.pos.y + 60.0f; pos.z = this->dyna.actor.world.pos.z + 23.0f; @@ -1103,7 +1116,7 @@ void func_80980B68(DemoGt* this, PlayState* play) { Vec3f pos; u16 csCurFrame = play->csCtx.curFrame; - if ((csCurFrame == 317) || (kREG(3) == 1)) { + if ((csCurFrame == 317) || (IS_DEBUG && (kREG(3) == 1))) { pos.x = this->dyna.actor.world.pos.x + 980.0f; pos.y = this->dyna.actor.world.pos.y + 410.0f; pos.z = this->dyna.actor.world.pos.z - 177.0f; @@ -1117,7 +1130,7 @@ void func_80980BFC(DemoGt* this, PlayState* play) { Vec3f pos; u16 csCurFrame = play->csCtx.curFrame; - if ((csCurFrame == 740) || (kREG(4) == 1)) { + if ((csCurFrame == 740) || (IS_DEBUG && (kREG(4) == 1))) { pos.x = this->dyna.actor.world.pos.x + 790.0f; pos.y = this->dyna.actor.world.pos.y + 60.0f; pos.z = this->dyna.actor.world.pos.z + 23.0f; @@ -1288,7 +1301,6 @@ void DemoGt_Draw4(DemoGt* this, PlayState* play2) { if (!FrameAdvance_IsEnabled(play)) { func_80980F8C(this, play); } - Matrix_Pop(); Gfx_SetupDL_25Opa(gfxCtx); @@ -1322,7 +1334,7 @@ void func_80981458(DemoGt* this, PlayState* play) { Vec3f dustPos; u16 csCurFrame = play->csCtx.curFrame; - if (((csCurFrame > 855) && (csCurFrame < 891)) || (kREG(1) == 13)) { + if (((csCurFrame > 855) && (csCurFrame < 891)) || (IS_DEBUG && (kREG(1) == 13))) { Vec3f velOffset = { 0.0f, -30.0f, 0.0f }; s32 pad1[3]; diff --git a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c index dd1d7e3cc..199fb04f7 100644 --- a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c +++ b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c @@ -36,8 +36,11 @@ s32 DemoIk_UpdateSkelAnime(DemoIk* this) { CsCmdActorCue* DemoIk_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } + return NULL; } @@ -256,8 +259,8 @@ void DemoIk_Type1Action2(DemoIk* this, PlayState* play) { } void DemoIk_Type1PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - DemoIk* this = (DemoIk*)thisx; GraphicsContext* gfxCtx = play->state.gfxCtx; + DemoIk* this = (DemoIk*)thisx; OPEN_DISPS(gfxCtx, "../z_demo_ik_inArmer.c", 385); if (limbIndex == 1) { diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 71e2ee06e..00db512d3 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -58,7 +58,9 @@ static void* sEyeTextures[] = { gImpaEyeClosedTex, }; +#if IS_DEBUG static u32 D_8098783C = 0; +#endif static ColliderCylinderInitType1 sCylinderInit = { { @@ -72,7 +74,6 @@ static ColliderCylinderInitType1 sCylinderInit = { { 25, 80, 0, { 0, 0, 0 } }, }; -#pragma asmproc recurse #include "z_demo_im_cutscene_data.inc.c" static DemoImActionFunc sActionFuncs[] = { @@ -118,6 +119,7 @@ void func_80984BE0(DemoIm* this) { } } +#if IS_DEBUG void func_80984C68(DemoIm* this) { this->action = 7; this->drawConfig = 0; @@ -143,6 +145,7 @@ void func_80984C8C(DemoIm* this, PlayState* play) { } } } +#endif void DemoIm_InitCollider(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; @@ -497,7 +500,9 @@ void func_80985B34(DemoIm* this, PlayState* play) { void func_80985C10(DemoIm* this, PlayState* play) { func_80985948(this, play); +#if IS_DEBUG func_80984C8C(this, play); +#endif } void func_80985C40(DemoIm* this, PlayState* play) { @@ -505,7 +510,9 @@ void func_80985C40(DemoIm* this, PlayState* play) { DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_809859E0(this, play); +#if IS_DEBUG func_80984C8C(this, play); +#endif } void func_80985C94(DemoIm* this, PlayState* play) { @@ -513,7 +520,9 @@ void func_80985C94(DemoIm* this, PlayState* play) { DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_80985B34(this, play); +#if IS_DEBUG func_80984C8C(this, play); +#endif } void DemoIm_DrawTranslucent(DemoIm* this, PlayState* play) { @@ -899,6 +908,8 @@ void func_80986BF8(DemoIm* this, PlayState* play) { void func_80986C30(DemoIm* this, PlayState* play) { if (func_80986A5C(this, play)) { + s32 pad; + play->csCtx.script = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardLullabyCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_59); @@ -924,10 +935,15 @@ void func_80986CFC(DemoIm* this, PlayState* play) { } void func_80986D40(DemoIm* this, PlayState* play) { +#if IS_DEBUG if (gSaveContext.sceneLayer == 6) { this->action = 19; this->drawConfig = 1; - } else if (GET_EVENTCHKINF(EVENTCHKINF_80)) { + return; + } +#endif + + if (GET_EVENTCHKINF(EVENTCHKINF_80)) { Actor_Kill(&this->actor); } else if (!GET_EVENTCHKINF(EVENTCHKINF_59)) { this->action = 23; diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im_cutscene_data.inc.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im_cutscene_data.inc.c index b01d9494d..46b08bc12 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im_cutscene_data.inc.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im_cutscene_data.inc.c @@ -7,30 +7,30 @@ static CutsceneData D_8098786C[] = { CS_UNK_DATA_LIST(0x00000020, 1), CS_UNK_DATA(0x00010000, 0x0BB80000, 0x00000000, 0x00000000, 0xFFFFFFFC, 0x00000002, 0x00000000, 0xFFFFFFFC, 0x00000002, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(31, 5), - CS_ACTOR_CUE(0x0001, 0, 697, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 697, 698, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0004, 698, 768, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 768, 817, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 82, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0003, 817, 2666, 0x0000, 0x0000, 0x0000, 0, 82, 0, 0, 82, 0, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 697, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 697, 698, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0004, 698, 768, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 768, 817, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 82, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 817, 2666, 0x0000, 0x0000, 0x0000, 0, 82, 0, 0, 82, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_PLAYER_CUE_LIST(3), - CS_PLAYER_CUE(PLAYER_CUEID_13, 0, 300, 0x0000, 0x0000, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 0.0f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 300, 661, 0x0000, 0xEAAA, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 0.0f), - CS_PLAYER_CUE(PLAYER_CUEID_19, 661, 1934, 0x0000, 0x6AAA, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 0.0f), + CS_PLAYER_CUE(PLAYER_CUEID_13, 0, 300, 0x0000, 0x0000, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 300, 661, 0x0000, 0xEAAA, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_PLAYER_CUE(PLAYER_CUEID_19, 661, 1934, 0x0000, 0x6AAA, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(44, 3), - CS_ACTOR_CUE(0x0001, 0, 145, 0x0000, 0x0000, 0x0000, -97, 6, 169, -97, 6, 169, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 145, 615, 0x0000, 0x0000, 0x0000, -97, 6, 169, -97, 6, 169, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0003, 615, 1906, 0x0000, 0x0000, 0x0000, -97, 6, 169, -97, 6, 169, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 145, 0x0000, 0x0000, 0x0000, -97, 6, 169, -97, 6, 169, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 145, 615, 0x0000, 0x0000, 0x0000, -97, 6, 169, -97, 6, 169, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 615, 1906, 0x0000, 0x0000, 0x0000, -97, 6, 169, -97, 6, 169, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(49, 1), - CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, -22, 0, -55, -22, 0, -55, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, -22, 0, -55, -22, 0, -55, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_LIGHT_SETTING_LIST(2), - CS_LIGHT_SETTING(0x0001, 0, 10, 0x0000, 0x00000000, 0xFFFFFFFE, 0x00000000, 0x0000000D, 0xFFFFFFFE, 0x00000000, 0x0000000D), - CS_LIGHT_SETTING(0x0001, 10, 3000, 0x0000, 0x00000000, 0xFFFFFFFE, 0x00000000, 0x0000000D, 0xFFFFFFFE, 0x00000000, 0x0000000D), + CS_LIGHT_SETTING(0x0001, 0, 10, 0x0000, 0x00000000, 0xFFFFFFFE, 0x00000000, 0x0000000D, 0xFFFFFFFE, 0x00000000, 0x0000000D, 0x00000000, 0x00000000, 0x00000000), + CS_LIGHT_SETTING(0x0001, 10, 3000, 0x0000, 0x00000000, 0xFFFFFFFE, 0x00000000, 0x0000000D, 0xFFFFFFFE, 0x00000000, 0x0000000D, 0x00000000, 0x00000000, 0x00000000), CS_TRANSITION(CS_TRANS_GRAY_FILL_OUT, 694, 724), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 960, 990), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 683, 692), CS_ACTOR_CUE_LIST(62, 2), - CS_ACTOR_CUE(0x0001, 0, 10, 0x0000, 0x0000, 0x0000, 64, 80, 130, 64, 80, 130, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0004, 10, 3000, 0x0000, 0x0000, 0x0000, 64, 80, 130, 64, 80, 130, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 10, 0x0000, 0x0000, 0x0000, 64, 80, 130, 64, 80, 130, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0004, 10, 3000, 0x0000, 0x0000, 0x0000, 64, 80, 130, 64, 80, 130, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_START_SEQ_LIST(1), CS_START_SEQ(NA_BGM_MEDALLION_GET, 770, 771, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFC9, 0x0000005C, 0x00000000, 0xFFFFFFC9, 0x0000005C), CS_TEXT_LIST(14), @@ -52,171 +52,171 @@ static CutsceneData D_8098786C[] = { CS_FADE_OUT_SEQ_LIST(1), CS_FADE_OUT_SEQ(CS_FADE_OUT_BGM_MAIN, 673, 723, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFC1, 0x00000058, 0x00000000, 0xFFFFFFC1, 0x00000058), CS_CAM_EYE_SPLINE(0, 341), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 33, 225, -58, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 33, 225, -58, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 33, 225, -58, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 33, 106, -58, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 33, 23, -58, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 11, 10, -18, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 11, 10, -18, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 11, 10, -18, 0xE6A0), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.600002f, 11, 10, -18, 0x7C53), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 33, 225, -58, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 33, 225, -58, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 33, 225, -58, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 33, 106, -58, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 33, 23, -58, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 11, 10, -18, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 11, 10, -18, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 11, 10, -18, 0xE6A0), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 11, 10, -18, 0x7C53), CS_CAM_EYE_SPLINE(263, 504), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 22.626957f, -49, 13, 158, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 22.626957f, -49, 13, 158, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 22.626957f, -49, 13, 158, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 22.626957f, -21, 22, 150, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 33.226997f, -21, 22, 150, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 33.226997f, -21, 22, 150, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 33.226997f, -21, 22, 150, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 33.226997f, -21, 22, 150, 0xE6A0), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 33.226997f, -21, 22, 150, 0x7C53), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41B50402, 22.626957f), -49, 13, 158, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41B50402, 22.626957f), -49, 13, 158, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41B50402, 22.626957f), -49, 13, 158, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41B50402, 22.626957f), -21, 22, 150, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4204E872, 33.226997f), -21, 22, 150, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4204E872, 33.226997f), -21, 22, 150, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4204E872, 33.226997f), -21, 22, 150, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4204E872, 33.226997f), -21, 22, 150, 0xE6A0), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4204E872, 33.226997f), -21, 22, 150, 0x7C53), CS_CAM_EYE_SPLINE(363, 824), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -67, 8, 117, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -67, 8, 117, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -67, 8, 117, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -67, 8, 117, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -67, 8, 117, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -67, 8, 117, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.79991f, -67, 8, 117, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.79991f, -67, 8, 117, 0xE6A0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.79991f, -67, 8, 117, 0x7C53), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.79991f, -67, 8, 117, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 70.79991f, -67, 8, 117, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -67, 8, 117, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -67, 8, 117, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -67, 8, 117, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -67, 8, 117, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -67, 8, 117, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -67, 8, 117, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D998E, 70.79991f), -67, 8, 117, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D998E, 70.79991f), -67, 8, 117, 0xE6A0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D998E, 70.79991f), -67, 8, 117, 0x7C53), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D998E, 70.79991f), -67, 8, 117, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x428D998E, 70.79991f), -67, 8, 117, 0x0000), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(413, 1504), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 19.99985f, -53, 28, 45, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 19.99985f, -53, 28, 45, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 19.99985f, -53, 28, 45, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 19.99985f, -53, 28, 45, 0x7C50), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 19.99985f, -53, 28, 45, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x419FFFB1, 19.99985f), -53, 28, 45, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x419FFFB1, 19.99985f), -53, 28, 45, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x419FFFB1, 19.99985f), -53, 28, 45, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x419FFFB1, 19.99985f), -53, 28, 45, 0x7C50), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x419FFFB1, 19.99985f), -53, 28, 45, 0x0000), CS_CAM_EYE_SPLINE(483, 1684), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.91906f, -67, 8, 117, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.91906f, -67, 8, 117, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.91906f, -67, 8, 117, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.91906f, -71, 15, 124, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.91906f, -73, 29, 131, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.91906f, -78, 40, 140, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.91906f, -78, 40, 140, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.91906f, -78, 40, 140, 0xE6A0), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 68.91906f, -78, 40, 140, 0x7C53), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289D68F, 68.91906f), -67, 8, 117, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289D68F, 68.91906f), -67, 8, 117, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289D68F, 68.91906f), -67, 8, 117, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289D68F, 68.91906f), -71, 15, 124, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289D68F, 68.91906f), -73, 29, 131, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289D68F, 68.91906f), -78, 40, 140, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289D68F, 68.91906f), -78, 40, 140, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289D68F, 68.91906f), -78, 40, 140, 0xE6A0), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4289D68F, 68.91906f), -78, 40, 140, 0x7C53), CS_CAM_EYE_SPLINE(553, 1644), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, -39, 34, 201, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, -39, 34, 201, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, -39, 34, 201, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, -39, 34, 201, 0x7C50), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.599945f, -39, 34, 201, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -39, 34, 201, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -39, 34, 201, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -39, 34, 201, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -39, 34, 201, 0x7C50), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -39, 34, 201, 0x0000), CS_CAM_EYE_SPLINE(623, 819), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.599915f, 9, 13, -17, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.599915f, 9, 13, -17, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.599915f, 9, 13, -17, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.599915f, 9, 71, -17, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 126.999054f, 9, 385, -17, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 126.999054f, 9, 385, -17, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 126.999054f, 9, 385, -17, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 126.999054f, 9, 385, -17, 0xE6A0), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 126.999054f, 9, 385, -17, 0x7C53), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 9, 13, -17, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 9, 13, -17, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 9, 13, -17, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 9, 71, -17, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42FDFF84, 126.999054f), 9, 385, -17, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42FDFF84, 126.999054f), 9, 385, -17, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42FDFF84, 126.999054f), 9, 385, -17, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42FDFF84, 126.999054f), 9, 385, -17, 0xE6A0), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42FDFF84, 126.999054f), 9, 385, -17, 0x7C53), CS_CAM_EYE_SPLINE(693, 1035), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 13, 854, 2, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 853, 5, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -3, 853, 5, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -9, 853, -6, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -2, 852, -17, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 852, -17, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 16, 852, -6, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 852, 5, 0xE6A0), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -3, 851, 5, 0x7C53), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 13, 854, 2, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 853, 5, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -3, 853, 5, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -9, 853, -6, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -2, 852, -17, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 852, -17, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 16, 852, -6, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 852, 5, 0xE6A0), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -3, 851, 5, 0x7C53), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(769, 1950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 33, -27, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 33, -27, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 68, -26, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 68.599945f, 0, 103, -26, 0xE6A0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 33, -27, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 33, -27, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 68, -26, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0xE6A0), CS_CAM_AT_SPLINE(0, 370), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -21, 21, 42, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 60.600002f, -21, 21, 42, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 60.600002f, -21, 21, 42, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 60.600002f, -78, 86, 144, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 60.600002f, -80, 21, 142, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 60.600002f, -99, 31, 177, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -99, 31, 177, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -99, 31, 177, 0xE6A0), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.600002f, -99, 31, 177, 0x7C53), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -21, 21, 42, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42726667, 60.600002f), -21, 21, 42, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42726667, 60.600002f), -21, 21, 42, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42726667, 60.600002f), -78, 86, 144, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42726667, 60.600002f), -80, 21, 142, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42726667, 60.600002f), -99, 31, 177, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -99, 31, 177, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -99, 31, 177, 0xE6A0), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -99, 31, 177, 0x7C53), CS_CAM_AT_SPLINE(263, 533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 22.626957f, -309, 11, 229, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 22.626957f, -309, 11, 229, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 22.626957f, -309, 11, 229, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 33.226997f, -258, 133, 191, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 33.226997f, -258, 133, 191, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 33.226997f, -258, 133, 191, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 33.226997f, -258, 133, 191, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 33.226997f, -258, 133, 191, 0xE6A0), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 33.226997f, -258, 133, 191, 0x7C53), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41B50402, 22.626957f), -309, 11, 229, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41B50402, 22.626957f), -309, 11, 229, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41B50402, 22.626957f), -309, 11, 229, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4204E872, 33.226997f), -258, 133, 191, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4204E872, 33.226997f), -258, 133, 191, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4204E872, 33.226997f), -258, 133, 191, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4204E872, 33.226997f), -258, 133, 191, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4204E872, 33.226997f), -258, 133, 191, 0xE6A0), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4204E872, 33.226997f), -258, 133, 191, 0x7C53), CS_CAM_AT_SPLINE(363, 853), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 68.79994f, 68, 109, -103, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 68.99994f, 68, 109, -103, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 68.79994f, 67, 109, -103, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 68.599945f, 189, 109, 92, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 68.599945f, 57, 108, 341, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 70.79991f, -186, 107, 341, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 70.79991f, -186, 107, 341, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 70.79991f, -186, 107, 341, 0xE6A0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.79991f, -186, 107, 341, 0x7C53), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.79991f, -186, 107, 341, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 70.79991f, -186, 107, 341, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42899992, 68.79994f), 68, 109, -103, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4289FFF8, 68.99994f), 68, 109, -103, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42899992, 68.79994f), 67, 109, -103, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4289332C, 68.599945f), 189, 109, 92, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4289332C, 68.599945f), 57, 108, 341, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x428D998E, 70.79991f), -186, 107, 341, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x428D998E, 70.79991f), -186, 107, 341, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x428D998E, 70.79991f), -186, 107, 341, 0xE6A0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428D998E, 70.79991f), -186, 107, 341, 0x7C53), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428D998E, 70.79991f), -186, 107, 341, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x428D998E, 70.79991f), -186, 107, 341, 0x0000), CS_CAM_AT_SPLINE_REL_TO_PLAYER(413, 1533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 19.99985f, 171, 122, -106, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 19.99985f, 171, 122, -106, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 19.99985f, 171, 122, -106, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 19.99985f, 170, 122, -106, 0x7C50), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 19.99985f, 170, 122, -106, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x419FFFB1, 19.99985f), 171, 122, -106, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x419FFFB1, 19.99985f), 171, 122, -106, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x419FFFB1, 19.99985f), 171, 122, -106, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x419FFFB1, 19.99985f), 170, 122, -106, 0x7C50), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x419FFFB1, 19.99985f), 170, 122, -106, 0x0000), CS_CAM_AT_SPLINE(483, 1713), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x01, 20, 68.91906f, -191, 132, 327, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 68.91906f, -191, 132, 327, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0xFF, 30, 68.91906f, -190, 131, 326, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, 68.91906f, -189, 154, 324, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x01, 30, 68.91906f, -194, 162, 331, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.91906f, -199, 172, 339, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 68.91906f, -199, 172, 339, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.91906f, -199, 172, 339, 0xE6A0), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 68.91906f, -199, 172, 339, 0x7C53), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x01, 20, CS_FLOAT(0x4289D68F, 68.91906f), -191, 132, 327, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x4289D68F, 68.91906f), -191, 132, 327, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0xFF, 30, CS_FLOAT(0x4289D68F, 68.91906f), -190, 131, 326, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, CS_FLOAT(0x4289D68F, 68.91906f), -189, 154, 324, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x01, 30, CS_FLOAT(0x4289D68F, 68.91906f), -194, 162, 331, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289D68F, 68.91906f), -199, 172, 339, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4289D68F, 68.91906f), -199, 172, 339, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289D68F, 68.91906f), -199, 172, 339, 0xE6A0), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4289D68F, 68.91906f), -199, 172, 339, 0x7C53), CS_CAM_AT_SPLINE(553, 1673), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, -234, 123, 37, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, -234, 123, 37, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.599945f, -234, 123, 37, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, -234, 123, 37, 0x7C50), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.599945f, -233, 123, 37, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -234, 123, 37, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -234, 123, 37, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42366658, 45.599945f), -234, 123, 37, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -234, 123, 37, 0x7C50), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -233, 123, 37, 0x0000), CS_CAM_AT_SPLINE(623, 848), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.599915f, -52, 17, 91, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.599915f, -52, 17, 91, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 70.599915f, -52, 17, 91, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 70.599915f, -52, 75, 91, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 126.999054f, -5, 503, 9, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 126.999054f, -5, 503, 9, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 126.999054f, -5, 503, 9, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 126.999054f, -5, 503, 9, 0xE6A0), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 126.999054f, -5, 503, 9, 0x7C53), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428D3328, 70.599915f), -52, 17, 91, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428D3328, 70.599915f), -52, 17, 91, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x428D3328, 70.599915f), -52, 17, 91, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x428D3328, 70.599915f), -52, 75, 91, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42FDFF84, 126.999054f), -5, 503, 9, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42FDFF84, 126.999054f), -5, 503, 9, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42FDFF84, 126.999054f), -5, 503, 9, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42FDFF84, 126.999054f), -5, 503, 9, 0xE6A0), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42FDFF84, 126.999054f), -5, 503, 9, 0x7C53), CS_CAM_AT_SPLINE(693, 1084), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 60.0f, 3, 6, -6, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, 60.0f, 3, 6, -6, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 50.999966f, 3, 6, -6, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 20.59985f, 3, 6, -6, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 51, 10.799838f, 3, 6, -6, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.399838f, 3, 6, -6, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.399838f, 3, 6, -6, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.199839f, 3, 6, -6, 0xE6A0), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 50, 10.999838f, 3, 6, -6, 0x7C53), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42700000, 60.0f), 3, 6, -6, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, CS_FLOAT(0x42700000, 60.0f), 3, 6, -6, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x424BFFF7, 50.999966f), 3, 6, -6, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x41A4CC7E, 20.59985f), 3, 6, -6, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 51, CS_FLOAT(0x412CCC23, 10.799838f), 3, 6, -6, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x412665BD, 10.399838f), 3, 6, -6, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x412665BD, 10.399838f), 3, 6, -6, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4123328A, 10.199839f), 3, 6, -6, 0xE6A0), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 50, CS_FLOAT(0x412FFF56, 10.999838f), 3, 6, -6, 0x7C53), CS_CAM_AT_SPLINE_REL_TO_PLAYER(769, 1979), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 100, 5, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 101, 6, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 1, 99, 41, 0x0950), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x7C50), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 68.599945f, 0, 42, 16, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 68.599945f, 0, 42, 16, 0xE6A0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 100, 5, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 101, 6, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 1, 99, 41, 0x0950), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x7C50), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0xE6A0), CS_END(), }; // clang-format on diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 103ddcb3c..f2f194175 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -277,7 +277,6 @@ void DemoKankyo_Destroy(Actor* thisx, PlayState* play) { void DemoKankyo_SetupType(DemoKankyo* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 temp; if (this->actor.objectSlot == this->requiredObjectSlot) { switch (this->actor.params) { @@ -302,12 +301,14 @@ void DemoKankyo_SetupType(DemoKankyo* this, PlayState* play) { play->envCtx.screenFillColor[2] = 0xFF; play->envCtx.fillScreen = false; if (this->warpTimer < 21 && this->warpTimer >= 15) { - temp = (this->warpTimer - 15.0f) / 5.0f; + f32 temp = (this->warpTimer - 15.0f) / 5.0f; + play->envCtx.fillScreen = true; play->envCtx.screenFillColor[3] = 255 - 255 * temp; } if (this->warpTimer < 15 && this->warpTimer >= 4) { - temp = (this->warpTimer - 4.0f) / 10.0f; + f32 temp = (this->warpTimer - 4.0f) / 10.0f; + play->envCtx.fillScreen = true; play->envCtx.screenFillColor[3] = 255 * temp; } diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data1.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data1.c index f50afa536..f46747a1a 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data1.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data1.c @@ -5,21 +5,21 @@ CutsceneData gAdultWarpInCS[] = { CS_BEGIN_CUTSCENE(2, 164), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(0, 135), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 31, 79, 59, 0x010F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 31, 78, 60, 0x0120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 32, 78, 60, 0x0131), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 30, 79, 59, 0x01F4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 30, 78, 60, 0x01F6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 30, 78, 60, 0x0207), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.324856f, 30, 78, 60, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 31, 79, 59, 0x010F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 31, 78, 60, 0x0120), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 32, 78, 60, 0x0131), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 30, 79, 59, 0x01F4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 30, 78, 60, 0x01F6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 30, 78, 60, 0x0207), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 30, 78, 60, 0x0000), CS_CAM_AT_SPLINE_REL_TO_PLAYER(0, 164), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324856f, 11, 50, 23, 0x010F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324856f, 11, 48, 22, 0x0120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 60.324856f, 11, 48, 22, 0x0131), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 60.324856f, 57, 101, 21, 0x01F4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324856f, 57, 101, 21, 0x01F6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324856f, 57, 101, 21, 0x0207), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.324856f, 57, 101, 21, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA7, 60.324856f), 11, 50, 23, 0x010F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA7, 60.324856f), 11, 48, 22, 0x0120), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x42714CA7, 60.324856f), 11, 48, 22, 0x0131), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x42714CA7, 60.324856f), 57, 101, 21, 0x01F4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA7, 60.324856f), 57, 101, 21, 0x01F6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA7, 60.324856f), 57, 101, 21, 0x0207), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42714CA7, 60.324856f), 57, 101, 21, 0x0000), CS_END(), }; // clang-format on diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data2.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data2.c index 2e320e199..b98b84992 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data2.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data2.c @@ -5,23 +5,23 @@ CutsceneData gAdultWarpOutCS[] = { CS_BEGIN_CUTSCENE(5, 1167), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(0, 1138), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 31, 82, 61, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 31, 82, 61, 0xA1BC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 31, 82, 61, 0xA5E1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 31, 82, 61, 0xA5CB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 31, 82, 61, 0xA5EB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 31, 82, 61, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 31, 82, 61, 0xA1BC), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.32486f, 31, 82, 61, 0xA5E1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 31, 82, 61, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 31, 82, 61, 0xA1BC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 31, 82, 61, 0xA5E1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 31, 82, 61, 0xA5CB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 31, 82, 61, 0xA5EB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 31, 82, 61, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 31, 82, 61, 0xA1BC), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 31, 82, 61, 0xA5E1), CS_CAM_AT_SPLINE_REL_TO_PLAYER(0, 1167), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.32486f, 55, 99, 31, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.32486f, 55, 99, 31, 0xA1BC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.32486f, 55, 99, 31, 0xA5E1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 60.32486f, 17, 59, 31, 0xA5CB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.32486f, 17, 59, 31, 0xA5EB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 60.32486f, 17, 59, 31, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.32486f, 17, 59, 31, 0xA1BC), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.32486f, 17, 59, 31, 0xA5E1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA8, 60.32486f), 55, 99, 31, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA8, 60.32486f), 55, 99, 31, 0xA1BC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42714CA8, 60.32486f), 55, 99, 31, 0xA5E1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x42714CA8, 60.32486f), 17, 59, 31, 0xA5CB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA8, 60.32486f), 17, 59, 31, 0xA5EB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42714CA8, 60.32486f), 17, 59, 31, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA8, 60.32486f), 17, 59, 31, 0xA1BC), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42714CA8, 60.32486f), 17, 59, 31, 0xA5E1), CS_TRANSITION(CS_TRANS_GRAY_FILL_OUT, 36, 46), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 30, 35), CS_MISC_LIST(1), diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data3.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data3.c index f846a28e3..512eb4749 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data3.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data3.c @@ -5,21 +5,21 @@ CutsceneData gAdultWarpInToTCS[] = { CS_BEGIN_CUTSCENE(2, 118), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(0, 89), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 71.32476f, 53, 53, 40, 0x010F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 53, 53, 40, 0x0120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 53, 53, 40, 0x0131), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.599915f, 58, 102, 48, 0x01F4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.599915f, 58, 102, 48, 0x01F6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.599915f, 58, 102, 48, 0x0207), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 70.599915f, 58, 102, 48, 0x0047), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428EA647, 71.32476f), 53, 53, 40, 0x010F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 53, 53, 40, 0x0120), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 53, 53, 40, 0x0131), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 58, 102, 48, 0x01F4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 58, 102, 48, 0x01F6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 58, 102, 48, 0x0207), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 58, 102, 48, 0x0047), CS_CAM_AT_SPLINE_REL_TO_PLAYER(0, 118), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 70.52477f, 11, 29, 10, 0x010F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 70.39992f, 11, 29, 10, 0x0120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 70.599915f, 11, 29, 10, 0x0131), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 70.599915f, 29, 71, 25, 0x01F4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.599915f, 29, 71, 25, 0x01F6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.599915f, 29, 71, 25, 0x0207), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 70.599915f, 29, 71, 25, 0x0047), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x428D0CAF, 70.52477f), 11, 29, 10, 0x010F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x428CCCC2, 70.39992f), 11, 29, 10, 0x0120), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x428D3328, 70.599915f), 11, 29, 10, 0x0131), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x428D3328, 70.599915f), 29, 71, 25, 0x01F4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428D3328, 70.599915f), 29, 71, 25, 0x01F6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428D3328, 70.599915f), 29, 71, 25, 0x0207), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x428D3328, 70.599915f), 29, 71, 25, 0x0047), CS_END(), }; // clang-format on diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data4.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data4.c index 32db920cd..ac79db625 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data4.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data4.c @@ -7,17 +7,17 @@ CutsceneData gAdultWarpOutToTCS[] = { CS_TRANSITION(CS_TRANS_GRAY_FILL_OUT, 36, 46), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 30, 35), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(0, 1091), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 42, 89, 50, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 42, 89, 50, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 42, 89, 50, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 42, 89, 50, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.32486f, 42, 89, 50, 0x29D0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 42, 89, 50, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 42, 89, 50, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 42, 89, 50, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 42, 89, 50, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 42, 89, 50, 0x29D0), CS_CAM_AT_SPLINE_REL_TO_PLAYER(0, 1120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.32486f, 24, 66, 29, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.32486f, 24, 66, 29, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 60.32486f, 24, 66, 29, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.32486f, 24, 66, 29, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.32486f, 24, 66, 29, 0x29D0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA8, 60.32486f), 24, 66, 29, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA8, 60.32486f), 24, 66, 29, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42714CA8, 60.32486f), 24, 66, 29, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA8, 60.32486f), 24, 66, 29, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42714CA8, 60.32486f), 24, 66, 29, 0x29D0), CS_MISC_LIST(1), CS_MISC(CS_MISC_STOP_CUTSCENE, 95, 96, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFEE, 0xFFFFFFF3, 0x00000000, 0xFFFFFFEE, 0xFFFFFFF3, 0x00000000, 0x00000000, 0x00000000), CS_END(), diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data5.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data5.c index 68617f1d4..c0af714eb 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data5.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data5.c @@ -5,23 +5,23 @@ CutsceneData gChildWarpInCS[] = { CS_BEGIN_CUTSCENE(2, 1164), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(0, 1135), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 31, 68, 59, 0x010F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 32, 68, 60, 0x0120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 31, 69, 59, 0x0131), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 31, 64, 59, 0x01F4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 31, 64, 59, 0x01F6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 31, 64, 59, 0x0207), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324856f, 31, 64, 59, 0xB46C), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.324856f, 31, 64, 59, 0x05BC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 31, 68, 59, 0x010F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 32, 68, 60, 0x0120), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 31, 69, 59, 0x0131), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 31, 64, 59, 0x01F4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 31, 64, 59, 0x01F6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 31, 64, 59, 0x0207), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 31, 64, 59, 0xB46C), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42714CA7, 60.324856f), 31, 64, 59, 0x05BC), CS_CAM_AT_SPLINE_REL_TO_PLAYER(0, 1164), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324856f, 12, 40, 22, 0x010F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324856f, 11, 38, 22, 0x0120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 60.324856f, 11, 39, 22, 0x0131), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 60.324856f, 57, 86, 21, 0x01F4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324856f, 57, 86, 21, 0x01F6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 60.324856f, 57, 86, 21, 0x0207), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324856f, 57, 86, 21, 0xB46C), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.324856f, 57, 86, 21, 0x05BC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA7, 60.324856f), 12, 40, 22, 0x010F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA7, 60.324856f), 11, 38, 22, 0x0120), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x42714CA7, 60.324856f), 11, 39, 22, 0x0131), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x42714CA7, 60.324856f), 57, 86, 21, 0x01F4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA7, 60.324856f), 57, 86, 21, 0x01F6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42714CA7, 60.324856f), 57, 86, 21, 0x0207), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA7, 60.324856f), 57, 86, 21, 0xB46C), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42714CA7, 60.324856f), 57, 86, 21, 0x05BC), CS_END(), }; // clang-format on diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data6.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data6.c index 14af0d2b1..17db7679a 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data6.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data6.c @@ -7,23 +7,23 @@ CutsceneData gChildWarpOutCS[] = { CS_TRANSITION(CS_TRANS_GRAY_FILL_OUT, 36, 46), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 30, 35), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(0, 1138), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 30, 63, 61, 0xA8A5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 30, 63, 61, 0xA3D9), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.32486f, 30, 63, 61, 0xF3A5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324863f, 29, 61, 59, 0xA5D5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324863f, 29, 61, 59, 0xA5E7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324863f, 29, 61, 59, 0xA5EC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324863f, 29, 61, 59, 0xBCA5), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.324863f, 29, 61, 59, 0xEEC0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 30, 63, 61, 0xA8A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 30, 63, 61, 0xA3D9), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA8, 60.32486f), 30, 63, 61, 0xF3A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA9, 60.324863f), 29, 61, 59, 0xA5D5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA9, 60.324863f), 29, 61, 59, 0xA5E7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA9, 60.324863f), 29, 61, 59, 0xA5EC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CA9, 60.324863f), 29, 61, 59, 0xBCA5), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42714CA9, 60.324863f), 29, 61, 59, 0xEEC0), CS_CAM_AT_SPLINE_REL_TO_PLAYER(0, 1167), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.32486f, 54, 79, 31, 0xA8A5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.32486f, 54, 80, 31, 0xA3D9), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.32486f, 54, 79, 31, 0xF3A5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 60.324863f, 15, 42, 30, 0xA5D5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324863f, 15, 42, 30, 0xA5E7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 60.324863f, 15, 42, 30, 0xA5EC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324863f, 15, 42, 30, 0xBCA5), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.324863f, 15, 42, 30, 0xEEC0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA8, 60.32486f), 54, 79, 31, 0xA8A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA8, 60.32486f), 54, 80, 31, 0xA3D9), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42714CA8, 60.32486f), 54, 79, 31, 0xF3A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x42714CA9, 60.324863f), 15, 42, 30, 0xA5D5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA9, 60.324863f), 15, 42, 30, 0xA5E7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42714CA9, 60.324863f), 15, 42, 30, 0xA5EC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CA9, 60.324863f), 15, 42, 30, 0xBCA5), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42714CA9, 60.324863f), 15, 42, 30, 0xEEC0), CS_MISC_LIST(1), CS_MISC(CS_MISC_STOP_CUTSCENE, 95, 96, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFEF, 0xFFFFFFCD, 0x00000000, 0xFFFFFFEF, 0xFFFFFFCD, 0x00000000, 0x00000000, 0x00000000), CS_END(), diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data7.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data7.c index ecb2b57bd..f5ce4770a 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data7.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data7.c @@ -5,23 +5,23 @@ CutsceneData gChildWarpInToTCS[] = { CS_BEGIN_CUTSCENE(2, 1118), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(0, 1089), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 71.32476f, 53, 53, 40, 0x010F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 53, 53, 40, 0x0120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 53, 53, 40, 0x0131), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.599915f, 58, 89, 47, 0x01F4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.599915f, 58, 89, 47, 0x01F6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.599915f, 58, 89, 47, 0x0207), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.599915f, 58, 89, 47, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 70.599915f, 58, 89, 47, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428EA647, 71.32476f), 53, 53, 40, 0x010F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 53, 53, 40, 0x0120), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 53, 53, 40, 0x0131), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 58, 89, 47, 0x01F4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 58, 89, 47, 0x01F6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 58, 89, 47, 0x0207), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 58, 89, 47, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x428D3328, 70.599915f), 58, 89, 47, 0x0000), CS_CAM_AT_SPLINE_REL_TO_PLAYER(0, 1118), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 70.52477f, 11, 29, 10, 0x010F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 70.39992f, 11, 29, 10, 0x0120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 70.599915f, 11, 29, 10, 0x0131), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 70.599915f, 29, 58, 25, 0x01F4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.599915f, 29, 58, 25, 0x01F6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 70.599915f, 29, 58, 25, 0x0207), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.599915f, 29, 58, 25, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 70.599915f, 29, 58, 25, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x428D0CAF, 70.52477f), 11, 29, 10, 0x010F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x428CCCC2, 70.39992f), 11, 29, 10, 0x0120), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x428D3328, 70.599915f), 11, 29, 10, 0x0131), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x428D3328, 70.599915f), 29, 58, 25, 0x01F4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428D3328, 70.599915f), 29, 58, 25, 0x01F6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x428D3328, 70.599915f), 29, 58, 25, 0x0207), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428D3328, 70.599915f), 29, 58, 25, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x428D3328, 70.599915f), 29, 58, 25, 0x0000), CS_END(), }; // clang-format on diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data8.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data8.c index a087ed7e9..e61672a66 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data8.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo_cutscene_data8.c @@ -7,17 +7,17 @@ CutsceneData gChildWarpOutToTCS[] = { CS_TRANSITION(CS_TRANS_GRAY_FILL_OUT, 36, 46), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 30, 35), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(0, 1091), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324867f, 41, 75, 49, 0x1F1C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324867f, 41, 75, 49, 0x1F8C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324867f, 41, 75, 49, 0x1FFC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.324867f, 41, 75, 49, 0x206C), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.324867f, 41, 75, 49, 0x20DC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CAA, 60.324867f), 41, 75, 49, 0x1F1C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CAA, 60.324867f), 41, 75, 49, 0x1F8C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CAA, 60.324867f), 41, 75, 49, 0x1FFC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42714CAA, 60.324867f), 41, 75, 49, 0x206C), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42714CAA, 60.324867f), 41, 75, 49, 0x20DC), CS_CAM_AT_SPLINE_REL_TO_PLAYER(0, 1120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324867f, 24, 52, 29, 0x1F1C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324867f, 24, 52, 29, 0x1F8C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 60.324867f, 24, 52, 29, 0x1FFC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.324867f, 24, 52, 29, 0x206C), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.324867f, 24, 52, 29, 0x20DC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CAA, 60.324867f), 24, 52, 29, 0x1F1C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CAA, 60.324867f), 24, 52, 29, 0x1F8C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42714CAA, 60.324867f), 24, 52, 29, 0x1FFC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42714CAA, 60.324867f), 24, 52, 29, 0x206C), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42714CAA, 60.324867f), 24, 52, 29, 0x20DC), CS_MISC_LIST(1), CS_MISC(CS_MISC_STOP_CUTSCENE, 95, 96, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFDF, 0x00000019, 0x00000000, 0xFFFFFFDF, 0x00000019, 0x00000000, 0x00000000, 0x00000000), CS_END(), diff --git a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c index 7f4d6aef4..9568574a4 100644 --- a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c +++ b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c @@ -46,8 +46,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x20000000, 0x07, 0x04 }, { 0x00002000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 680, 220, 120, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index d67bab473..5107668b8 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -69,9 +69,10 @@ static void* sMouthTextures[] = { gSariaMouthSmilingOpenTex, gSariaMouthFrowningTex, }; +#if IS_DEBUG static u32 D_80990108 = 0; +#endif -#pragma asmproc recurse #include "z_demo_sa_cutscene_data.inc.c" static DemoSaActionFunc sActionFuncs[] = { @@ -127,6 +128,7 @@ void DemoSa_SetMouthIndex(DemoSa* this, s16 mouthIndex) { this->mouthIndex = mouthIndex; } +#if IS_DEBUG void func_8098E530(DemoSa* this) { this->action = 7; this->drawConfig = 0; @@ -150,6 +152,7 @@ void func_8098E554(DemoSa* this, PlayState* play) { *something = 1; } } +#endif void func_8098E5C8(DemoSa* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); @@ -161,7 +164,9 @@ s32 DemoSa_UpdateSkelAnime(DemoSa* this) { CsCmdActorCue* DemoSa_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } return NULL; @@ -439,7 +444,9 @@ void func_8098F050(DemoSa* this, PlayState* play) { void func_8098F0E8(DemoSa* this, PlayState* play) { func_8098EEA8(this, play); +#if IS_DEBUG func_8098E554(this, play); +#endif } void func_8098F118(DemoSa* this, PlayState* play) { @@ -447,7 +454,9 @@ void func_8098F118(DemoSa* this, PlayState* play) { DemoSa_UpdateSkelAnime(this); func_8098E480(this); func_8098EEFC(this, play); +#if IS_DEBUG func_8098E554(this, play); +#endif } void func_8098F16C(DemoSa* this, PlayState* play) { @@ -455,7 +464,9 @@ void func_8098F16C(DemoSa* this, PlayState* play) { DemoSa_UpdateSkelAnime(this); func_8098EDB0(this); func_8098F050(this, play); +#if IS_DEBUG func_8098E554(this, play); +#endif } void DemoSa_DrawXlu(DemoSa* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa_cutscene_data.inc.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa_cutscene_data.inc.c index 5fe48c709..4f0e530ac 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa_cutscene_data.inc.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa_cutscene_data.inc.c @@ -7,26 +7,26 @@ static CutsceneData D_8099010C[] = { CS_UNK_DATA_LIST(0x00000020, 1), CS_UNK_DATA(0x00010000, 0x0BB80000, 0x00000000, 0x00000000, 0xFFFFFFFC, 0x00000002, 0x00000000, 0xFFFFFFFC, 0x00000002, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(31, 5), - CS_ACTOR_CUE(0x0001, 0, 612, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 612, 613, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0004, 613, 684, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 684, 732, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 82, 0, 0.0f, -2.7916667f, 0.0f), - CS_ACTOR_CUE(0x0003, 732, 2912, 0x0000, 0x0000, 0x0000, 0, 82, 0, 0, 82, 0, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 612, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 612, 613, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0004, 613, 684, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 684, 732, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 82, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xC032AAAB, -2.7916667f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 732, 2912, 0x0000, 0x0000, 0x0000, 0, 82, 0, 0, 82, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_PLAYER_CUE_LIST(3), - CS_PLAYER_CUE(PLAYER_CUEID_13, 0, 261, 0x0000, 0x0000, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 0.0f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 261, 600, 0x0000, 0x9555, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 0.0f), - CS_PLAYER_CUE(PLAYER_CUEID_19, 600, 1243, 0x0000, 0x1555, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 0.0f), + CS_PLAYER_CUE(PLAYER_CUEID_13, 0, 261, 0x0000, 0x0000, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 261, 600, 0x0000, 0x9555, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_PLAYER_CUE(PLAYER_CUEID_19, 600, 1243, 0x0000, 0x1555, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(43, 3), - CS_ACTOR_CUE(0x0001, 0, 165, 0x0000, 0x0000, 0x0000, -98, 6, -169, -98, 6, -169, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 165, 466, 0x0000, 0x0000, 0x0000, -98, 6, -169, -98, 6, -169, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0003, 466, 3001, 0x0000, 0x0000, 0x0000, -98, 6, -169, -98, 6, -169, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 165, 0x0000, 0x0000, 0x0000, -98, 6, -169, -98, 6, -169, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 165, 466, 0x0000, 0x0000, 0x0000, -98, 6, -169, -98, 6, -169, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 466, 3001, 0x0000, 0x0000, 0x0000, -98, 6, -169, -98, 6, -169, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 590, 607), CS_TRANSITION(CS_TRANS_GRAY_FILL_OUT, 617, 647), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 875, 905), CS_ACTOR_CUE_LIST(49, 1), - CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, -98, 0, 98, -98, 0, 98, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, -98, 0, 98, -98, 0, 98, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(62, 1), - CS_ACTOR_CUE(0x0004, 0, 3000, 0x0000, 0x0000, 0x0000, -35, 97, -60, -35, 97, -60, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0004, 0, 3000, 0x0000, 0x0000, 0x0000, -35, 97, -60, -35, 97, -60, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_DESTINATION(CS_DEST_KOKIRI_FOREST_FROM_CHAMBER_OF_SAGES, 974, 1050), CS_TEXT_LIST(10), CS_TEXT_NONE(0, 303), @@ -44,141 +44,141 @@ static CutsceneData D_8099010C[] = { CS_FADE_OUT_SEQ_LIST(1), CS_FADE_OUT_SEQ(CS_FADE_OUT_BGM_MAIN, 550, 600, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFC4, 0x00000066, 0x00000000, 0xFFFFFFC4, 0x00000066), CS_CAM_EYE_SPLINE(0, 1241), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 170.1984f, 159, 2758, 43, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 170.1984f, 159, 2758, 43, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 170.1984f, 159, 2409, 43, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 170.1984f, 159, 202, 43, 0x0073), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 158, 222, 42, 0x0061), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 158, 149, 42, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 158, 111, 42, 0x006D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 158, 111, 42, 0x0065), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 158, 111, 42, 0x0061), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.399944f, 158, 111, 42, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x432A32CA, 170.1984f), 159, 2758, 43, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x432A32CA, 170.1984f), 159, 2758, 43, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x432A32CA, 170.1984f), 159, 2409, 43, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x432A32CA, 170.1984f), 159, 202, 43, 0x0073), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 158, 222, 42, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 158, 149, 42, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 158, 111, 42, 0x006D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 158, 111, 42, 0x0065), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 158, 111, 42, 0x0061), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 158, 111, 42, 0x0061), CS_CAM_EYE_SPLINE(190, 391), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.99993f, -91, 18, -158, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.99993f, -90, 17, -157, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.99993f, -90, 31, -157, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.99993f, -90, 37, -157, 0x0073), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.99993f, -90, 37, -157, 0x0061), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.99993f, -90, 37, -157, 0x006F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 40.99993f, -90, 37, -157, 0x006D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFEE, 40.99993f), -91, 18, -158, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFEE, 40.99993f), -90, 17, -157, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFEE, 40.99993f), -90, 31, -157, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFEE, 40.99993f), -90, 37, -157, 0x0073), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFEE, 40.99993f), -90, 37, -157, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4223FFEE, 40.99993f), -90, 37, -157, 0x006F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4223FFEE, 40.99993f), -90, 37, -157, 0x006D), CS_CAM_EYE_SPLINE(263, 1354), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 24.399864f, 7, 97, 127, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 24.399864f, 7, 97, 127, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 24.399864f, 7, 97, 127, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 24.399864f, 7, 97, 127, 0x0073), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 24.399864f, 7, 97, 127, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41C332EC, 24.399864f), 7, 97, 127, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41C332EC, 24.399864f), 7, 97, 127, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41C332EC, 24.399864f), 7, 97, 127, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41C332EC, 24.399864f), 7, 97, 127, 0x0073), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x41C332EC, 24.399864f), 7, 97, 127, 0x0061), CS_CAM_EYE_SPLINE(333, 1424), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -279, 103, 68, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -279, 103, 68, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -279, 103, 68, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -279, 103, 68, 0x0073), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.399944f, -279, 103, 68, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -279, 103, 68, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -279, 103, 68, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -279, 103, 68, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -279, 103, 68, 0x0073), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -279, 103, 68, 0x0061), CS_CAM_EYE_SPLINE(403, 1494), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.39995f, -52, 35, -83, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.39995f, -52, 35, -83, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.39995f, -52, 35, -83, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.39995f, -52, 35, -83, 0x0073), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.39995f, -52, 35, -83, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), -52, 35, -83, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), -52, 35, -83, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), -52, 35, -83, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), -52, 35, -83, 0x0073), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), -52, 35, -83, 0x0061), CS_CAM_EYE_SPLINE(473, 1716), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.39995f, -65, 61, -111, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.39995f, -65, 61, -111, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.39995f, -51, 74, -86, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600006f, 0, 136, 11, 0x0073), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600006f, 386, 514, 736, 0x0061), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 80.399765f, 579, 156, 1099, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 80.399765f, 579, 156, 1099, 0x006D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 50.599964f, 579, 156, 1099, 0x0065), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 50.599964f, 579, 156, 1099, 0x0061), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 50.599964f, 579, 156, 1099, 0x0061), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 50.599964f, 579, 156, 1099, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), -65, 61, -111, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), -65, 61, -111, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), -51, 74, -86, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), 0, 136, 11, 0x0073), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), 386, 514, 736, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42A0CCAE, 80.399765f), 579, 156, 1099, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42A0CCAE, 80.399765f), 579, 156, 1099, 0x006D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x424A665D, 50.599964f), 579, 156, 1099, 0x0065), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x424A665D, 50.599964f), 579, 156, 1099, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x424A665D, 50.599964f), 579, 156, 1099, 0x0061), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x424A665D, 50.599964f), 579, 156, 1099, 0x0072), CS_CAM_EYE_SPLINE(609, 951), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 13, 854, 2, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 853, 5, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -3, 853, 5, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -9, 853, -6, 0x0073), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -2, 852, -17, 0x0061), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 852, -17, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 16, 852, -6, 0x006D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 852, 5, 0x0065), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -3, 851, 5, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 13, 854, 2, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 853, 5, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -3, 853, 5, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -9, 853, -6, 0x0073), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -2, 852, -17, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 852, -17, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 16, 852, -6, 0x006D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 852, 5, 0x0065), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -3, 851, 5, 0x0061), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(685, 1866), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 33, -27, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 33, -27, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 68, -26, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x0073), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x0061), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x006D), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 68.599945f, 0, 103, -26, 0x0065), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 33, -27, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 33, -27, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 68, -26, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x0073), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x006D), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x0065), CS_CAM_AT_SPLINE(0, 1270), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 170.1984f, 154, 2596, 41, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 170.1984f, 154, 2596, 41, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 170.1984f, 154, 2248, 41, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 170.1984f, 154, 42, 41, 0x0073), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.2f, 82, 94, 23, 0x0061), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 50.999966f, 33, 79, 0, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 30, 62, -14, 0x006D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.399944f, 30, 62, -14, 0x0065), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 30, 62, -14, 0x0061), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.399944f, 31, 62, -14, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x432A32CA, 170.1984f), 154, 2596, 41, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x432A32CA, 170.1984f), 154, 2596, 41, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x432A32CA, 170.1984f), 154, 2248, 41, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x432A32CA, 170.1984f), 154, 42, 41, 0x0073), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4270CCCD, 60.2f), 82, 94, 23, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x424BFFF7, 50.999966f), 33, 79, 0, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 30, 62, -14, 0x006D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998B, 45.399944f), 30, 62, -14, 0x0065), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 30, 62, -14, 0x0061), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 31, 62, -14, 0x0061), CS_CAM_AT_SPLINE(190, 420), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 40.99993f, 13, 42, 20, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.99993f, 12, 47, 18, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.99993f, 11, 50, 20, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.99993f, 11, 53, 20, 0x0073), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.99993f, 11, 53, 20, 0x0061), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.99993f, 11, 53, 20, 0x006F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 40.99993f, 11, 53, 20, 0x006D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4223FFEE, 40.99993f), 13, 42, 20, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFEE, 40.99993f), 12, 47, 18, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFEE, 40.99993f), 11, 50, 20, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFEE, 40.99993f), 11, 53, 20, 0x0073), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFEE, 40.99993f), 11, 53, 20, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4223FFEE, 40.99993f), 11, 53, 20, 0x006F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4223FFEE, 40.99993f), 11, 53, 20, 0x006D), CS_CAM_AT_SPLINE(263, 1383), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 24.399864f, -42, 17, -150, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 24.399864f, -42, 17, -150, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 24.399864f, -42, 17, -150, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 24.399864f, -42, 17, -150, 0x0073), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 24.399864f, -42, 17, -150, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41C332EC, 24.399864f), -42, 17, -150, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41C332EC, 24.399864f), -42, 17, -150, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x41C332EC, 24.399864f), -42, 17, -150, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41C332EC, 24.399864f), -42, 17, -150, 0x0073), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x41C332EC, 24.399864f), -42, 17, -150, 0x0061), CS_CAM_AT_SPLINE(333, 1453), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x01, 30, 45.199944f, -26, 13, -85, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -26, 13, -85, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.399944f, -26, 13, -85, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -26, 13, -85, 0x0073), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.399944f, -26, 13, -85, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x01, 30, CS_FLOAT(0x4234CCBE, 45.199944f), -26, 13, -85, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -26, 13, -85, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998B, 45.399944f), -26, 13, -85, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -26, 13, -85, 0x0073), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -26, 13, -85, 0x0061), CS_CAM_AT_SPLINE(403, 1523), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 30.799892f, -226, 10, -419, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 30.999893f, -226, 10, -419, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 35.59991f, -226, 10, -419, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.39993f, -226, 10, -418, 0x0073), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.39995f, -226, 10, -418, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41F6662E, 30.799892f), -226, 10, -419, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41F7FFC8, 30.999893f), -226, 10, -419, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x420E664F, 35.59991f), -226, 10, -419, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42219987, 40.39993f), -226, 10, -418, 0x0073), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998C, 45.39995f), -226, 10, -418, 0x0061), CS_CAM_AT_SPLINE(473, 1745), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.39995f, -218, -88, -396, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.39995f, -218, -88, -396, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.39995f, -204, -75, -370, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 65.399994f, -149, -10, -269, 0x0073), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 25, 70.79991f, 287, 239, 551, 0x0061), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 80.399765f, 570, 493, 1083, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 50.399963f, 578, 492, 1097, 0x006D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 50.599964f, 578, 492, 1097, 0x0065), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 50.599964f, 578, 491, 1097, 0x0061), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 27, 50.599964f, 578, 491, 1097, 0x0061), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 50.599964f, 578, 491, 1097, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998C, 45.39995f), -218, -88, -396, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998C, 45.39995f), -218, -88, -396, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998C, 45.39995f), -204, -75, -370, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4282CCCC, 65.399994f), -149, -10, -269, 0x0073), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 25, CS_FLOAT(0x428D998E, 70.79991f), 287, 239, 551, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42A0CCAE, 80.399765f), 570, 493, 1083, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42499990, 50.399963f), 578, 492, 1097, 0x006D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x424A665D, 50.599964f), 578, 492, 1097, 0x0065), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x424A665D, 50.599964f), 578, 491, 1097, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 27, CS_FLOAT(0x424A665D, 50.599964f), 578, 491, 1097, 0x0061), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x424A665D, 50.599964f), 578, 491, 1097, 0x0072), CS_CAM_AT_SPLINE(609, 1000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 60.0f, 3, 6, -6, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, 60.0f, 3, 6, -6, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 50.999966f, 3, 6, -6, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 20.59985f, 3, 6, -6, 0x0073), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 51, 10.799838f, 3, 6, -6, 0x0061), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.399838f, 3, 6, -6, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.399838f, 3, 6, -6, 0x006D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.199839f, 3, 6, -6, 0x0065), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 50, 10.999838f, 3, 6, -6, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42700000, 60.0f), 3, 6, -6, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, CS_FLOAT(0x42700000, 60.0f), 3, 6, -6, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x424BFFF7, 50.999966f), 3, 6, -6, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x41A4CC7E, 20.59985f), 3, 6, -6, 0x0073), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 51, CS_FLOAT(0x412CCC23, 10.799838f), 3, 6, -6, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x412665BD, 10.399838f), 3, 6, -6, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x412665BD, 10.399838f), 3, 6, -6, 0x006D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4123328A, 10.199839f), 3, 6, -6, 0x0065), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 50, CS_FLOAT(0x412FFF56, 10.999838f), 3, 6, -6, 0x0061), CS_CAM_AT_SPLINE_REL_TO_PLAYER(685, 1895), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 100, 5, 0x0072), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 101, 6, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 1, 99, 41, 0x002F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x0073), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x0061), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 68.599945f, 0, 42, 16, 0x006F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x006D), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 68.599945f, 0, 42, 16, 0x0065), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 100, 5, 0x0072), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 101, 6, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 1, 99, 41, 0x002F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x0073), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x0061), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x006F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x006D), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x0065), CS_END(), }; // clang-format on diff --git a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c index ec5397750..19272d504 100644 --- a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c +++ b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c @@ -58,12 +58,10 @@ void func_80991298(DemoShd* this, PlayState* play) { } if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorCue* cue = play->csCtx.actorCues[0]; - - if (cue != NULL) { - if (cue->id == 2) { + if (play->csCtx.actorCues[0] != NULL) { + if (play->csCtx.actorCues[0]->id == 2) { if (!(this->unk_14C & 1)) { - this->unk_14E = cue->startPos.x; + this->unk_14E = play->csCtx.actorCues[0]->startPos.x; } this->unk_14C |= 1; } else { @@ -73,12 +71,10 @@ void func_80991298(DemoShd* this, PlayState* play) { } if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorCue* cue = play->csCtx.actorCues[1]; - - if (cue != NULL) { - if (cue->id == 2) { + if (play->csCtx.actorCues[1] != NULL) { + if (play->csCtx.actorCues[1]->id == 2) { if (!(this->unk_14C & 2)) { - this->unk_14E = cue->startPos.x; + this->unk_14E = play->csCtx.actorCues[1]->startPos.x; } this->unk_14C |= 2; } else { @@ -101,8 +97,6 @@ void DemoShd_Draw(Actor* thisx, PlayState* play) { s32 pad; u32 unk_14E = this->unk_14E; - if (1) {} // Necessary to match, can be anywhere in the function - OPEN_DISPS(play->state.gfxCtx, "../z_demo_shd.c", 726); Gfx_SetupDL_25Xlu(play->state.gfxCtx); @@ -123,5 +117,7 @@ void DemoShd_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, D_809934B8); } + if (1) {} // Necessary to match + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_shd.c", 762); } diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 5482623bd..5487a20b4 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -43,8 +43,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0x00000048, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 50, 10, 0, { 0 } }, diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c index d9b03e169..26630ef77 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c @@ -54,8 +54,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0x0001FFEE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { 20, 100, 0, { 0, 0, 0 } }, @@ -67,8 +67,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 100 }, 100 }, @@ -423,10 +423,10 @@ void DoorKiller_Wait(DoorKiller* this, PlayState* play) { if (DoorKiller_IsHit(&this->actor, play)) { // AC cylinder: wobble if hit by most weapons, die if hit by explosives or hammer - if (this->colliderCylinder.elem.acHitElem->toucher.dmgFlags & (DMG_RANGED | DMG_SLASH | DMG_DEKU_STICK)) { + if (this->colliderCylinder.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_RANGED | DMG_SLASH | DMG_DEKU_STICK)) { this->timer = 16; this->actionFunc = DoorKiller_Wobble; - } else if (this->colliderCylinder.elem.acHitElem->toucher.dmgFlags & (DMG_HAMMER_SWING | DMG_EXPLOSIVE)) { + } else if (this->colliderCylinder.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_HAMMER_SWING | DMG_EXPLOSIVE)) { DoorKiller_SpawnRubble(&this->actor, play); this->actionFunc = DoorKiller_Die; SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_KDOOR_BREAK); 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 9637be78c..4926bdc7b 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -896,9 +896,7 @@ void DoorShutter_PhantomGanonBarsRaise(DoorShutter* this, PlayState* play) { f32 targetOffsetY; PRINTF("FHG SAKU START !!\n"); - if (this->isActive != 0) { - this->isActive--; - } + DECR(this->isActive); targetOffsetY = (this->isActive % 2 != 0) ? -3.0f : 0.0f; Math_SmoothStepToF(&this->dyna.actor.world.pos.y, -34.0f + targetOffsetY, 1.0f, 20.0f, 0.0f); PRINTF("FHG SAKU END !!\n"); @@ -975,6 +973,9 @@ s32 DoorShutter_ShouldDraw(DoorShutter* this, PlayState* play) { void DoorShutter_Draw(Actor* thisx, PlayState* play) { DoorShutter* this = (DoorShutter*)thisx; + if (1) {} + if (1) {} + //! @bug This actor is not fully initialized until the required object dependency is loaded. //! In most cases, the check for objectSlot to equal requiredObjectSlot prevents the actor //! from drawing until initialization is complete. However if the required object is the same as the 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 52c111c58..dbddf1799 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -456,12 +456,10 @@ s32 DoorWarp1_PlayerInRange(DoorWarp1* this, PlayState* play) { } void DoorWarp1_ChildWarpIdle(DoorWarp1* this, PlayState* play) { - Player* player; - Actor_PlaySfx(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); if (DoorWarp1_PlayerInRange(this, play)) { - player = GET_PLAYER(play); + Player* player = GET_PLAYER(play); Audio_PlaySfxGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -830,12 +828,10 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } void DoorWarp1_Destination(DoorWarp1* this, PlayState* play) { - f32 alphaFrac; + f32 alphaFrac = 1.0f; - this->warpTimer++; this->unk_194 = 5.0f; - - alphaFrac = 1.0f; + this->warpTimer++; if (this->warpTimer < 20) { alphaFrac = this->warpTimer / 20.f; } else if (this->warpTimer >= 60) { diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 1c07031a0..893360582 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -273,31 +273,32 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, PlayState* play2) { Gfx_SetupDL_25Opa(gfxCtx); gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 128, 128, 128, 255); - gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 0); initialPositions = this->initialPositions; distanceTraveled = this->distanceTraveled; + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 128, 128, 128, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 0); gSPSegment(POLY_XLU_DISP++, 0x08, sEmptyDL); - for (i = 0; i < 64; i++, initialPositions++, distanceTraveled++) { - if (!(*distanceTraveled < 1.0f)) { - continue; + for (i = 0; i < 64; i++) { + if (*distanceTraveled < 1.0f) { + aux = 1.0f - SQ(*distanceTraveled); + Matrix_Translate(this->actor.world.pos.x + (initialPositions->x * ((this->dx * aux) + (1.0f - this->dx))), + this->actor.world.pos.y + (initialPositions->y * ((this->dy * aux) + (1.0f - this->dy))), + this->actor.world.pos.z + (initialPositions->z * ((this->dz * aux) + (1.0f - this->dz))), + MTXMODE_NEW); + + Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gfxCtx, "../z_eff_dust.c", 449), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); } - aux = 1.0f - SQ(*distanceTraveled); - Matrix_Translate(this->actor.world.pos.x + (initialPositions->x * ((this->dx * aux) + (1.0f - this->dx))), - this->actor.world.pos.y + (initialPositions->y * ((this->dy * aux) + (1.0f - this->dy))), - this->actor.world.pos.z + (initialPositions->z * ((this->dz * aux) + (1.0f - this->dz))), - MTXMODE_NEW); - - Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY); - Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gfxCtx, "../z_eff_dust.c", 449), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); + initialPositions++; + distanceTraveled++; } CLOSE_DISPS(gfxCtx, "../z_eff_dust.c", 458); @@ -318,6 +319,10 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, PlayState* play2) { Gfx_SetupDL_25Opa(gfxCtx); gDPPipeSync(POLY_XLU_DISP++); + + initialPositions = this->initialPositions; + distanceTraveled = this->distanceTraveled; + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); if (player->unk_858 >= 0.85f) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); @@ -325,34 +330,32 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, PlayState* play2) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 0); } - initialPositions = this->initialPositions; - distanceTraveled = this->distanceTraveled; - gSPSegment(POLY_XLU_DISP++, 0x08, sEmptyDL); - for (i = 0; i < 64; i++, initialPositions++, distanceTraveled++) { - if (!(*distanceTraveled < 1.0f)) { - continue; + for (i = 0; i < 64; i++) { + if (*distanceTraveled < 1.0f) { + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, *distanceTraveled * 255); + + aux = 1.0f - SQ(*distanceTraveled); + + Matrix_Mult(&player->mf_9E0, MTXMODE_NEW); + + Matrix_Translate(initialPositions->x * ((this->dx * aux) + (1.0f - this->dx)), + initialPositions->y * (1.0f - *distanceTraveled) + 320.0f, + initialPositions->z * (1.0f - *distanceTraveled) + -20.0f, MTXMODE_APPLY); + + Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, + *distanceTraveled * this->scalingFactor, MTXMODE_APPLY); + + Matrix_ReplaceRotation(&play->billboardMtxF); + + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gfxCtx, "../z_eff_dust.c", 506), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); } - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, *distanceTraveled * 255); - - aux = 1.0f - SQ(*distanceTraveled); - - Matrix_Mult(&player->mf_9E0, MTXMODE_NEW); - - Matrix_Translate(initialPositions->x * ((this->dx * aux) + (1.0f - this->dx)), - initialPositions->y * (1.0f - *distanceTraveled) + 320.0f, - initialPositions->z * (1.0f - *distanceTraveled) + -20.0f, MTXMODE_APPLY); - - Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, - *distanceTraveled * this->scalingFactor, MTXMODE_APPLY); - - Matrix_ReplaceRotation(&play->billboardMtxF); - - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gfxCtx, "../z_eff_dust.c", 506), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); + initialPositions++; + distanceTraveled++; } CLOSE_DISPS(gfxCtx, "../z_eff_dust.c", 515); diff --git a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index dfa44b0cd..bb00233e9 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -13,7 +13,9 @@ void ElfMsg_Init(Actor* thisx, PlayState* play); void ElfMsg_Destroy(Actor* thisx, PlayState* play); void ElfMsg_Update(Actor* thisx, PlayState* play); +#if IS_DEBUG void ElfMsg_Draw(Actor* thisx, PlayState* play); +#endif void ElfMsg_CallNaviCuboid(ElfMsg* this, PlayState* play); void ElfMsg_CallNaviCylinder(ElfMsg* this, PlayState* play); @@ -27,7 +29,11 @@ ActorInit Elf_Msg_InitVars = { /**/ ElfMsg_Init, /**/ ElfMsg_Destroy, /**/ ElfMsg_Update, +#if IS_DEBUG /**/ ElfMsg_Draw, +#else + /**/ NULL, +#endif }; static InitChainEntry sInitChain[] = { @@ -163,6 +169,7 @@ void ElfMsg_Update(Actor* thisx, PlayState* play) { } } +#if IS_DEBUG #include "assets/overlays/ovl_Elf_Msg/ovl_Elf_Msg.c" void ElfMsg_Draw(Actor* thisx, PlayState* play) { @@ -191,3 +198,4 @@ void ElfMsg_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_elf_msg.c", 457); } +#endif diff --git a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c index d36f9813c..e449fd3cf 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -12,7 +12,9 @@ void ElfMsg2_Init(Actor* thisx, PlayState* play); void ElfMsg2_Destroy(Actor* thisx, PlayState* play); void ElfMsg2_Update(Actor* thisx, PlayState* play); +#if IS_DEBUG void ElfMsg2_Draw(Actor* thisx, PlayState* play); +#endif s32 ElfMsg2_GetMessageId(ElfMsg2* this); void ElfMsg2_WaitUntilActivated(ElfMsg2* this, PlayState* play); @@ -27,7 +29,11 @@ ActorInit Elf_Msg2_InitVars = { /**/ ElfMsg2_Init, /**/ ElfMsg2_Destroy, /**/ ElfMsg2_Update, +#if IS_DEBUG /**/ ElfMsg2_Draw, +#else + /**/ NULL, +#endif }; static InitChainEntry sInitChain[] = { @@ -147,6 +153,7 @@ void ElfMsg2_Update(Actor* thisx, PlayState* play) { } } +#if IS_DEBUG #include "assets/overlays/ovl_Elf_Msg2/ovl_Elf_Msg2.c" void ElfMsg2_Draw(Actor* thisx, PlayState* play) { @@ -165,3 +172,4 @@ void ElfMsg2_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_elf_msg2.c", 367); } +#endif diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index 932308eb2..bed0a0be6 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -64,8 +64,8 @@ static ColliderCylinderInit sHurtCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 15, 70, 0, { 0, 0, 0 } }, @@ -84,8 +84,8 @@ static ColliderCylinderInit sBlockCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00400106, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 15, 70, 0, { 0, 0, 0 } }, @@ -104,8 +104,8 @@ static ColliderQuadInit sQuadInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -782,7 +782,6 @@ void EnAm_TransformSwordHitbox(Actor* thisx, PlayState* play) { void EnAm_UpdateDamage(EnAm* this, PlayState* play) { s32 pad; - Vec3f sparkPos; if (this->deathTimer == 0) { if (this->blockCollider.base.acFlags & AC_BOUNCED) { @@ -810,7 +809,8 @@ void EnAm_UpdateDamage(EnAm* this, PlayState* play) { this->dyna.actor.colChkInfo.health = 0; } } else if (this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_STUN) { - sparkPos = this->dyna.actor.world.pos; + Vec3f sparkPos = this->dyna.actor.world.pos; + sparkPos.y += 50.0f; CollisionCheck_SpawnShieldParticlesMetal(play, &sparkPos); } @@ -836,8 +836,6 @@ void EnAm_Update(Actor* thisx, PlayState* play) { EnBom* bomb; Vec3f dustPos; s32 i; - f32 dustPosScale; - s32 pad1; if (this->dyna.actor.params != ARMOS_STATUE) { EnAm_UpdateDamage(this, play); @@ -854,7 +852,8 @@ void EnAm_Update(Actor* thisx, PlayState* play) { this->deathTimer--; if (this->deathTimer == 0) { - dustPosScale = play->gameplayFrames * 10; + f32 dustPosScale = play->gameplayFrames * 10; + s32 pad1; EnAm_SpawnEffects(this, play); bomb = @@ -943,9 +942,9 @@ static Vec3f sIcePosOffsets[] = { }; void EnAm_Draw(Actor* thisx, PlayState* play) { - s32 pad; - Vec3f sp68; EnAm* this = (EnAm*)thisx; + Vec3f sp68; + s32 index; OPEN_DISPS(play->state.gfxCtx, "../z_en_am.c", 1580); @@ -959,7 +958,6 @@ void EnAm_Draw(Actor* thisx, PlayState* play) { this->iceTimer--; if ((this->iceTimer % 4) == 0) { - s32 index; index = this->iceTimer >> 2; diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index bf9f2fe92..1e9dbb933 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -51,8 +51,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 30, 40, 0, { 0 } }, diff --git a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c index b8280d1a9..a370e6b36 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -50,8 +50,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 29, 103, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c index 897d21667..19851e173 100644 --- a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c +++ b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c @@ -44,8 +44,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { 0, 0, 0, { 0, 0, 0 } }, @@ -113,7 +113,7 @@ void func_809B27D8(EnAnubiceFire* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); this->cylinder.base.atFlags &= ~(AT_HIT | AT_BOUNCED | AT_TYPE_ENEMY); this->cylinder.base.atFlags |= AT_TYPE_PLAYER; - this->cylinder.elem.toucher.dmgFlags = DMG_DEKU_STICK; + this->cylinder.elem.atDmgInfo.dmgFlags = DMG_DEKU_STICK; this->unk_15A = 30; this->actor.params = 1; this->actor.velocity.x *= -1.0f; diff --git a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c index 772b1c137..b76b38f06 100644 --- a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c +++ b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c @@ -99,7 +99,7 @@ void EnAnubiceTag_Update(Actor* thisx, PlayState* play) { void EnAnubiceTag_Draw(Actor* thisx, PlayState* play) { EnAnubiceTag* this = (EnAnubiceTag*)thisx; - if (BREG(0) != 0) { + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index 84a05c3b1..75aa432f7 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -44,8 +44,8 @@ static ColliderQuadInit sColliderInit = { ELEMTYPE_UNK2, { 0x00000020, 0x00, 0x01 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_NEAREST | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_NEAREST | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -121,15 +121,15 @@ void EnArrow_Init(Actor* thisx, PlayState* play) { Collider_SetQuad(play, &this->collider, &this->actor, &sColliderInit); if (this->actor.params <= ARROW_NORMAL) { - this->collider.elem.toucherFlags &= ~TOUCH_SFX_MASK; - this->collider.elem.toucherFlags |= TOUCH_SFX_NORMAL; + this->collider.elem.atElemFlags &= ~ATELEM_SFX_MASK; + this->collider.elem.atElemFlags |= ATELEM_SFX_NORMAL; } if (this->actor.params < 0) { this->collider.base.atFlags = (AT_ON | AT_TYPE_ENEMY); } else if (this->actor.params <= ARROW_SEED) { - this->collider.elem.toucher.dmgFlags = dmgFlags[this->actor.params]; - LOG_HEX("this->at_info.cl_elem.at_btl_info.at_type", this->collider.elem.toucher.dmgFlags, + this->collider.elem.atDmgInfo.dmgFlags = dmgFlags[this->actor.params]; + LOG_HEX("this->at_info.cl_elem.at_btl_info.at_type", this->collider.elem.atDmgInfo.dmgFlags, "../z_en_arrow.c", 707); } } @@ -246,8 +246,6 @@ void EnArrow_Fly(EnArrow* this, PlayState* play) { s32 atTouched; u16 sfxId; Actor* hitActor; - Vec3f sp60; - Vec3f sp54; if (DECR(this->timer) == 0) { Actor_Kill(&this->actor); @@ -300,10 +298,10 @@ void EnArrow_Fly(EnArrow* this, PlayState* play) { this->hitFlags |= 1; this->hitFlags |= 2; - if (this->collider.elem.atHitElem->bumperFlags & BUMP_HIT) { - this->actor.world.pos.x = this->collider.elem.atHitElem->bumper.hitPos.x; - this->actor.world.pos.y = this->collider.elem.atHitElem->bumper.hitPos.y; - this->actor.world.pos.z = this->collider.elem.atHitElem->bumper.hitPos.z; + if (this->collider.elem.atHitElem->acElemFlags & ACELEM_HIT) { + this->actor.world.pos.x = this->collider.elem.atHitElem->acDmgInfo.hitPos.x; + this->actor.world.pos.y = this->collider.elem.atHitElem->acDmgInfo.hitPos.y; + this->actor.world.pos.z = this->collider.elem.atHitElem->acDmgInfo.hitPos.z; } func_809B3CEC(play, this); @@ -342,6 +340,9 @@ void EnArrow_Fly(EnArrow* this, PlayState* play) { if (this->hitActor != NULL) { if (this->hitActor->update != NULL) { + Vec3f sp60; + Vec3f sp54; + Math_Vec3f_Sum(&this->unk_210, &this->unk_250, &sp60); Math_Vec3f_Sum(&this->actor.world.pos, &this->unk_250, &sp54); diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index c5c439238..f42593a57 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -297,8 +297,6 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { EnAttackNiw* this = (EnAttackNiw*)thisx; EnNiw* cucco; Player* player = GET_PLAYER(play); - s32 pad; - Vec3f sp30; PlayState* play2 = play; this->unk_28C++; @@ -343,6 +341,9 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { } if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actionFunc != func_809B5C18)) { + Vec3f sp30; + s32 pad; + Math_Vec3f_Copy(&sp30, &this->actor.world.pos); sp30.y += this->actor.yDistToWater; EffectSsGSplash_Spawn(play, &sp30, NULL, NULL, 0, 0x190); diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/src/overlays/actors/ovl_En_Ba/z_en_ba.c index 965df7954..133cffe45 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -43,8 +43,8 @@ static ColliderJntSphElementInit sJntSphElementInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000010, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 8, { { 0, 0, 0 }, 20 }, 100 }, @@ -54,8 +54,8 @@ static ColliderJntSphElementInit sJntSphElementInit[2] = { ELEMTYPE_UNK0, { 0x20000000, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { 13, { { 0, 0, 0 }, 25 }, 100 }, @@ -235,6 +235,7 @@ void EnBa_SwingAtPlayer(EnBa* this, PlayState* play) { s16 phi_fp; Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 60.0f, 1.0f, 10.0f, 0.0f); + if ((this->actor.xzDistToPlayer <= 175.0f) || (this->unk_31A != 0)) { if (this->unk_318 == 20) { Actor_PlaySfx(&this->actor, NA_SE_EN_BALINADE_HAND_UP); @@ -300,16 +301,22 @@ void EnBa_SwingAtPlayer(EnBa* this, PlayState* play) { } this->unk_2A8[13].x = this->unk_2A8[12].x; this->unk_2A8[13].y = this->unk_2A8[12].y; + + //! @bug This code being located here gives multiple opportunities for the current action to change + //! before damage handling can be done. + //! By, for example, taking damage on the same frame the collider contacts Player, a different action + //! will run and `AT_HIT` will remain set. Then when returning back to this action, Player + //! will get knocked back instantly, even though there was no apparent collision. + //! Handling `AT_HIT` directly in Update, where it can run every frame, would help catch these edge cases. if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; if (this->collider.base.at == &player->actor) { func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); } } + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); - return; - } - if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & PLAYER_STATE1_26)) { + } else if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & PLAYER_STATE1_26)) { EnBa_SetupIdle(this); } else { EnBa_SetupSwingAtPlayer(this); @@ -492,6 +499,7 @@ void EnBa_Draw(Actor* thisx, PlayState* play) { Matrix_RotateZYX(this->unk_2A8[i].x, this->unk_2A8[i].y, this->unk_2A8[i].z, MTXMODE_APPLY); Matrix_Scale(this->unk_200[i].x, this->unk_200[i].y, this->unk_200[i].z, MTXMODE_APPLY); if ((i == 6) || (i == 13)) { + if (mtx) {} switch (i) { case 13: Collider_UpdateSpheres(i, &this->collider); diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index b6bca7f72..63875b009 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -213,8 +213,8 @@ static ColliderJntSphElementInit sJntSphElementInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 0, { { 0, -120, 0 }, 4 }, 300 }, @@ -291,9 +291,10 @@ void EnBb_SpawnFlameTrail(PlayState* play, EnBb* this, s16 startAtZero) { void EnBb_KillFlameTrail(EnBb* this) { Actor* actor = &this->actor; + Actor* nextActor; while (actor->child != NULL) { - Actor* nextActor = actor->child; + nextActor = actor->child; if (nextActor->id == ACTOR_EN_BB) { nextActor->parent = NULL; @@ -330,9 +331,9 @@ void EnBb_Init(Actor* thisx, PlayState* play) { this->timer = 0; this->flameScaleY = 80.0f; this->flameScaleX = 100.0f; - this->collider.elements[0].base.toucherFlags = TOUCH_ON | TOUCH_SFX_HARD; - this->collider.elements[0].base.toucher.dmgFlags = DMG_DEFAULT; - this->collider.elements[0].base.toucher.damage = 8; + this->collider.elements[0].base.atElemFlags = ATELEM_ON | ATELEM_SFX_HARD; + this->collider.elements[0].base.atDmgInfo.dmgFlags = DMG_DEFAULT; + this->collider.elements[0].base.atDmgInfo.damage = 8; this->bobSize = this->actionState * 20.0f; this->flamePrimAlpha = 255; this->moveMode = BBMOVE_NORMAL; @@ -350,7 +351,7 @@ void EnBb_Init(Actor* thisx, PlayState* play) { thisx->naviEnemyId = NAVI_ENEMY_RED_BUBBLE; thisx->colChkInfo.damageTable = &sDamageTableRed; this->flameEnvColor.r = 255; - this->collider.elements[0].base.toucher.effect = 1; + this->collider.elements[0].base.atDmgInfo.effect = 1; EnBb_SetupRed(play, this); break; case ENBB_WHITE: @@ -408,10 +409,10 @@ void EnBb_Destroy(Actor* thisx, PlayState* play) { void EnBb_SetupFlameTrail(EnBb* this) { this->action = BB_FLAME_TRAIL; this->moveMode = BBMOVE_NOCLIP; - this->actor.flags &= ~ACTOR_FLAG_0; this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; this->actor.speed = 0.0f; + this->actor.flags &= ~ACTOR_FLAG_0; EnBb_SetupAction(this, EnBb_FlameTrail); } @@ -1154,7 +1155,7 @@ void EnBb_CollisionCheck(EnBb* this, PlayState* play) { Actor_SetDropFlag(&this->actor, &this->collider.elements[0].base, false); switch (this->dmgEffect) { case 7: - this->actor.freezeTimer = this->collider.elements[0].base.acHitElem->toucher.damage; + this->actor.freezeTimer = this->collider.elements[0].base.acHitElem->atDmgInfo.damage; FALLTHROUGH; case 5: this->fireIceTimer = 0x30; @@ -1164,7 +1165,7 @@ void EnBb_CollisionCheck(EnBb* this, PlayState* play) { //! Din's Fire on a white bubble will do just that. The mechanism is complex and described below. goto block_15; case 6: - this->actor.freezeTimer = this->collider.elements[0].base.acHitElem->toucher.damage; + this->actor.freezeTimer = this->collider.elements[0].base.acHitElem->atDmgInfo.damage; break; case 8: case 9: diff --git a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c index 1febc7976..ba1920a32 100644 --- a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c +++ b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c @@ -121,9 +121,7 @@ void func_809BC2A4(EnBdfire* this, PlayState* play) { void func_809BC598(EnBdfire* this, PlayState* play) { s16 quarterTurn; Player* player = GET_PLAYER(play); - f32 distToBurn; BossDodongo* bossDodongo; - s16 i; bossDodongo = ((BossDodongo*)this->actor.parent); this->unk_158 = bossDodongo->unk_1A2; @@ -164,8 +162,11 @@ void func_809BC598(EnBdfire* this, PlayState* play) { return; } } else if (!player->bodyIsBurning) { - distToBurn = (this->actor.scale.x * 130.0f) / 4.2000003f; + f32 distToBurn = (this->actor.scale.x * 130.0f) / 4.2000003f; + if (this->actor.xyzDistToPlayerSq < SQ(distToBurn)) { + s16 i; + for (i = 0; i < 18; i++) { player->bodyFlameTimers[i] = Rand_S16Offset(0, 200); } 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 e58bd6b2a..23c7bb6db 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -48,8 +48,8 @@ static ColliderJntSphElementInit sJntSphElementInit[1] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_ON, OCELEM_ON, }, { 1, { { 0, 45, -30 }, 75 }, 100 }, @@ -82,8 +82,8 @@ static ColliderCylinderInit sCylinderInit[] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x08 }, { 0xFFCFFFE7, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_ON, OCELEM_ON, }, { 50, 100, 0, { 30, 0, 12 } } }, @@ -99,8 +99,8 @@ static ColliderCylinderInit sCylinderInit[] = { ELEMTYPE_UNK1, { 0x20000000, 0x00, 0x08 }, { 0xFFCFFFE7, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_ON, OCELEM_ON, }, { 50, 100, 0, { -30, 0, 12 } } }, @@ -333,7 +333,7 @@ void func_809BD524(EnBigokuta* this) { this->unk_19A = 0; this->cylinder[0].base.atFlags |= AT_ON; Actor_PlaySfx(&this->actor, NA_SE_EN_DAIOCTA_MAHI); - if (this->collider.elements[0].base.acHitElem->toucher.dmgFlags & DMG_DEKU_NUT) { + if (this->collider.elements[0].base.acHitElem->atDmgInfo.dmgFlags & DMG_DEKU_NUT) { this->unk_195 = true; this->unk_196 = 20; } else { @@ -837,6 +837,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, temp_f0, temp_f0, temp_f0, 255); + if (1) {} CLOSE_DISPS(play->state.gfxCtx, "../z_en_bigokuta.c", 1945); } } else if (limbIndex == 10) { @@ -848,7 +849,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec } gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, intensity, intensity, intensity, intensity); - + if (1) {} CLOSE_DISPS(play->state.gfxCtx, "../z_en_bigokuta.c", 1972); } else if (limbIndex == 17 && this->actionFunc == func_809BE26C) { if (this->unk_198 < 5) { diff --git a/src/overlays/actors/ovl_En_Bili/z_en_bili.c b/src/overlays/actors/ovl_En_Bili/z_en_bili.c index de0a12eeb..b7b4d5d76 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -53,8 +53,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x03, 0x08 }, { 0xFFCFFFFF, 0x01, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_ON, OCELEM_ON, }, { 9, 28, -20, { 0, 0, 0 } }, @@ -141,14 +141,14 @@ void EnBili_Destroy(Actor* thisx, PlayState* play) { void EnBili_SetupFloatIdle(EnBili* this) { this->actor.speed = 0.7f; - this->collider.elem.bumper.effect = 1; // Shock? + this->collider.elem.acDmgInfo.effect = 1; // Shock? this->timer = 32; - this->collider.base.atFlags |= AT_ON; - this->collider.base.acFlags |= AC_ON; - this->actionFunc = EnBili_FloatIdle; this->actor.home.pos.y = this->actor.world.pos.y; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; + this->collider.base.atFlags |= AT_ON; + this->collider.base.acFlags |= AC_ON; + this->actionFunc = EnBili_FloatIdle; } /** @@ -237,7 +237,7 @@ void EnBili_SetupDie(EnBili* this) { */ void EnBili_SetupStunned(EnBili* this) { this->timer = 80; - this->collider.elem.bumper.effect = 0; + this->collider.elem.acDmgInfo.effect = 0; this->actor.gravity = -1.0f; this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 150, COLORFILTER_BUFFLAG_XLU, 80); @@ -586,7 +586,7 @@ void EnBili_UpdateDamage(EnBili* this, PlayState* play) { EnBili_SetupBurnt(this); } - if (this->collider.elem.acHitElem->toucher.dmgFlags & DMG_ARROW) { + if (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_ARROW) { this->actor.flags |= ACTOR_FLAG_4; } } diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index c95cfed5a..245963f8c 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -43,8 +43,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0x0003F828, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 6, 11, 14, { 0, 0, 0 } }, @@ -56,8 +56,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0x00000008, 0x00, 0x08 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 0 }, 100 }, @@ -101,7 +101,7 @@ void EnBom_Init(Actor* thisx, PlayState* play) { Collider_InitJntSph(play, &this->explosionCollider); Collider_SetCylinder(play, &this->bombCollider, thisx, &sCylinderInit); Collider_SetJntSph(play, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]); - this->explosionColliderItems[0].base.toucher.damage += (thisx->shape.rot.z & 0xFF00) >> 8; + this->explosionColliderItems[0].base.atDmgInfo.damage += (thisx->shape.rot.z & 0xFF00) >> 8; thisx->shape.rot.z &= 0xFF; if (thisx->shape.rot.z & 0x80) { @@ -241,7 +241,7 @@ void EnBom_Update(Actor* thisx, PlayState* play2) { } if ((thisx->xzDistToPlayer >= 20.0f) || (ABS(thisx->yDistToPlayer) >= 80.0f)) { - this->bumpOn = true; + this->colliderSetOC = true; } this->actionFunc(this, play); @@ -333,8 +333,8 @@ void EnBom_Update(Actor* thisx, PlayState* play2) { if (thisx->params <= BOMB_BODY) { Collider_UpdateCylinder(thisx, &this->bombCollider); - // if link is not holding the bomb anymore and bump conditions are met, subscribe to OC - if (!Actor_HasParent(thisx, play) && this->bumpOn) { + // if link is not holding the bomb anymore and conditions for OC are met, subscribe to OC + if (!Actor_HasParent(thisx, play) && this->colliderSetOC) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->bombCollider.base); } @@ -359,7 +359,7 @@ void EnBom_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBom* this = (EnBom*)thisx; -#if OOT_DEBUG +#if IS_DEBUG if (1) {} #endif diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.h b/src/overlays/actors/ovl_En_Bom/z_en_bom.h index 7399d6edd..aebadfa06 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.h +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.h @@ -16,7 +16,7 @@ typedef struct EnBom { /* 0x01F8 */ s16 timer; /* 0x01FA */ s16 flashSpeedScale; /* 0x01FC */ f32 flashIntensity; - /* 0x0200 */ u8 bumpOn; + /* 0x0200 */ u8 colliderSetOC; /* 0x0204 */ EnBomActionFunc actionFunc; } EnBom; // size = 0x0208 diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index df24a602e..5af68e436 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -33,8 +33,8 @@ static ColliderJntSphElementInit sJntSphElemInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 1, { { 0, 0, 0 }, 12 }, 100 }, diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index 6d0ecbc27..f4864d530 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -46,8 +46,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0x0003F828, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 9, 18, 10, { 0, 0, 0 } }, @@ -59,8 +59,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0x00000008, 0x00, 0x08 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 0 }, 100 }, @@ -121,7 +121,7 @@ void EnBombf_Init(Actor* thisx, PlayState* play) { EnBombf_SetupAction(this, EnBombf_Move); } else { thisx->colChkInfo.mass = MASS_IMMOVABLE; - this->bumpOn = true; + this->colliderSetOC = true; this->flowerBombScale = 1.0f; EnBombf_SetupGrowBomb(this, thisx->params); } @@ -320,13 +320,13 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { s32 pad[2]; EnBombf* this = (EnBombf*)thisx; - if ((this->isFuseEnabled) && (this->timer != 0)) { + if (this->isFuseEnabled && (this->timer != 0)) { this->timer--; } - if ((!this->bumpOn) && (!Actor_HasParent(thisx, play)) && + if (!this->colliderSetOC && !Actor_HasParent(thisx, play) && ((thisx->xzDistToPlayer >= 20.0f) || (ABS(thisx->yDistToPlayer) >= 80.0f))) { - this->bumpOn = true; + this->colliderSetOC = true; } this->actionFunc(this, play); @@ -444,7 +444,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(thisx, &this->bombCollider); - if ((this->flowerBombScale >= 1.0f) && (this->bumpOn)) { + if ((this->flowerBombScale >= 1.0f) && this->colliderSetOC) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->bombCollider.base); } @@ -474,7 +474,7 @@ Gfx* EnBombf_NewMtxDList(GraphicsContext* gfxCtx, PlayState* play) { Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(displayListHead++, MATRIX_NEW(gfxCtx, "../z_en_bombf.c", 1021), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPEndDisplayList(displayListHead); + gSPEndDisplayList(displayListHead++); return displayList; } @@ -482,8 +482,6 @@ void EnBombf_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBombf* this = (EnBombf*)thisx; - if (1) {} - OPEN_DISPS(play->state.gfxCtx, "../z_en_bombf.c", 1034); if (thisx->params <= BOMBFLOWER_BODY) { @@ -510,5 +508,7 @@ void EnBombf_Draw(Actor* thisx, PlayState* play) { Collider_UpdateSpheres(0, &this->explosionCollider); } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bombf.c", 1063); } diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h index 02d10b7c4..226dfebef 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h @@ -16,7 +16,7 @@ typedef struct EnBombf { /* 0x01F8 */ s16 timer; /* 0x01FC */ EnBombfActionFunc actionFunc; /* 0x0200 */ s32 isFuseEnabled; // enables the ability to ignite and tick down to explode - /* 0x0204 */ u8 bumpOn; + /* 0x0204 */ u8 colliderSetOC; /* 0x0206 */ s16 flashSpeedScale; /* 0x0208 */ f32 flashIntensity; /* 0x020C */ f32 flowerBombScale; diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 579cc5920..e5697f91c 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -41,8 +41,8 @@ static ColliderQuadInit sQuadInit = { ELEMTYPE_UNK2, { 0x00000010, 0x00, 0x01 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_NEAREST | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_NEAREST | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -272,5 +272,7 @@ void EnBoom_Draw(Actor* thisx, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBoomerangRefDL); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_boom.c", 604); } diff --git a/src/overlays/actors/ovl_En_Brob/z_en_brob.c b/src/overlays/actors/ovl_En_Brob/z_en_brob.c index 64aa97e4d..99e9775ea 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.c +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.c @@ -47,8 +47,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK1, { 0xFFCFFFFF, 0x03, 0x08 }, { 0xFFCFFFFF, 0x01, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_ON, OCELEM_ON, }, { 8000, 11000, -5000, { 0, 0, 0 } }, @@ -263,8 +263,8 @@ void EnBrob_Update(Actor* thisx, PlayState* play2) { acHits[0] = (this->colliders[0].base.acFlags & AC_HIT) != 0; acHits[1] = (this->colliders[1].base.acFlags & AC_HIT) != 0; - if ((acHits[0] && (this->colliders[0].elem.acHitElem->toucher.dmgFlags & DMG_BOOMERANG)) || - (acHits[1] && (this->colliders[1].elem.acHitElem->toucher.dmgFlags & DMG_BOOMERANG))) { + if ((acHits[0] && (this->colliders[0].elem.acHitElem->atDmgInfo.dmgFlags & DMG_BOOMERANG)) || + (acHits[1] && (this->colliders[1].elem.acHitElem->atDmgInfo.dmgFlags & DMG_BOOMERANG))) { for (i = 0; i < 2; i++) { this->colliders[i].base.atFlags &= ~(AT_HIT | AT_BOUNCED); @@ -273,8 +273,8 @@ void EnBrob_Update(Actor* thisx, PlayState* play2) { EnBrob_SetupStunned(this); } else if ((this->colliders[0].base.atFlags & AT_HIT) || (this->colliders[1].base.atFlags & AT_HIT) || - (acHits[0] && (this->colliders[0].elem.acHitElem->toucher.dmgFlags & DMG_SLASH_KOKIRI)) || - (acHits[1] && (this->colliders[1].elem.acHitElem->toucher.dmgFlags & DMG_SLASH_KOKIRI))) { + (acHits[0] && (this->colliders[0].elem.acHitElem->atDmgInfo.dmgFlags & DMG_SLASH_KOKIRI)) || + (acHits[1] && (this->colliders[1].elem.acHitElem->atDmgInfo.dmgFlags & DMG_SLASH_KOKIRI))) { if (this->actionFunc == EnBrob_MoveUp && !(this->colliders[0].base.atFlags & AT_BOUNCED) && !(this->colliders[1].base.atFlags & AT_BOUNCED)) { diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index 23f49a462..902520173 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -30,8 +30,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x04 }, { 0xFFCFD753, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 16 }, 100 }, @@ -41,8 +41,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00002824, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_NO_AT_INFO | BUMP_NO_DAMAGE | BUMP_NO_SWORD_SFX | BUMP_NO_HITMARK, + ATELEM_NONE, + ACELEM_ON | ACELEM_NO_AT_INFO | ACELEM_NO_DAMAGE | ACELEM_NO_SWORD_SFX | ACELEM_NO_HITMARK, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 16 }, 100 }, @@ -97,10 +97,10 @@ void EnBubble_SetDimensions(EnBubble* this, f32 dim) { u32 func_809CBCBC(EnBubble* this) { ColliderElement* elem = &this->colliderSphere.elements[0].base; - elem->toucher.dmgFlags = DMG_EXPLOSIVE; - elem->toucher.effect = 0; - elem->toucher.damage = 4; - elem->toucherFlags = TOUCH_ON; + elem->atDmgInfo.dmgFlags = DMG_EXPLOSIVE; + elem->atDmgInfo.effect = 0; + elem->atDmgInfo.damage = 4; + elem->atElemFlags = ATELEM_ON; this->actor.velocity.y = 0.0f; return 6; } @@ -112,7 +112,7 @@ u32 func_809CBCEC(EnBubble* this) { } void EnBubble_DamagePlayer(EnBubble* this, PlayState* play) { - s32 damage = -this->colliderSphere.elements[0].base.toucher.damage; + s32 damage = -this->colliderSphere.elements[0].base.atDmgInfo.damage; play->damagePlayer(play, damage); func_8002F7A0(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); @@ -196,7 +196,7 @@ void EnBubble_Vec3fNormalize(Vec3f* vec) { void EnBubble_Fly(EnBubble* this, PlayState* play) { CollisionPoly* poly; - Actor* bumpActor; + Actor* attackerActor; Vec3f sp84; Vec3f sp78; Vec3f sp6C; @@ -206,21 +206,21 @@ void EnBubble_Fly(EnBubble* this, PlayState* play) { s32 bgId; u8 bounceCount; - if (this->colliderSphere.elements[1].base.bumperFlags & BUMP_HIT) { - bumpActor = this->colliderSphere.base.ac; - this->normalizedBumpVelocity = bumpActor->velocity; - EnBubble_Vec3fNormalize(&this->normalizedBumpVelocity); - this->velocityFromBump.x += (this->normalizedBumpVelocity.x * 3.0f); - this->velocityFromBump.y += (this->normalizedBumpVelocity.y * 3.0f); - this->velocityFromBump.z += (this->normalizedBumpVelocity.z * 3.0f); + if (this->colliderSphere.elements[1].base.acElemFlags & ACELEM_HIT) { + attackerActor = this->colliderSphere.base.ac; + this->normalizedAttackerVelocity = attackerActor->velocity; + EnBubble_Vec3fNormalize(&this->normalizedAttackerVelocity); + this->velocityFromAttack.x += (this->normalizedAttackerVelocity.x * 3.0f); + this->velocityFromAttack.y += (this->normalizedAttackerVelocity.y * 3.0f); + this->velocityFromAttack.z += (this->normalizedAttackerVelocity.z * 3.0f); } this->sinkSpeed -= 0.1f; if (this->sinkSpeed < this->actor.minVelocityY) { this->sinkSpeed = this->actor.minVelocityY; } - sp54.x = this->velocityFromBounce.x + this->velocityFromBump.x; - sp54.y = this->velocityFromBounce.y + this->velocityFromBump.y + this->sinkSpeed; - sp54.z = this->velocityFromBounce.z + this->velocityFromBump.z; + sp54.x = this->velocityFromBounce.x + this->velocityFromAttack.x; + sp54.y = this->velocityFromBounce.y + this->velocityFromAttack.y + this->sinkSpeed; + sp54.z = this->velocityFromBounce.z + this->velocityFromAttack.z; EnBubble_Vec3fNormalize(&sp54); sp78.x = this->actor.world.pos.x; @@ -243,7 +243,7 @@ void EnBubble_Fly(EnBubble* this, PlayState* play) { this->bounceCount = 0; } bounceSpeed = (this->bounceCount == 0) ? 3.6000001f : 3.0f; - this->velocityFromBump.x = this->velocityFromBump.y = this->velocityFromBump.z = 0.0f; + this->velocityFromAttack.x = this->velocityFromAttack.y = this->velocityFromAttack.z = 0.0f; this->velocityFromBounce.x = (this->bounceDirection.x * bounceSpeed); this->velocityFromBounce.y = (this->bounceDirection.y * bounceSpeed); this->velocityFromBounce.z = (this->bounceDirection.z * bounceSpeed); @@ -262,7 +262,7 @@ void EnBubble_Fly(EnBubble* this, PlayState* play) { this->bounceCount = 0; } bounceSpeed = (this->bounceCount == 0) ? 3.6000001f : 3.0f; - this->velocityFromBump.x = this->velocityFromBump.y = this->velocityFromBump.z = 0.0f; + this->velocityFromAttack.x = this->velocityFromAttack.y = this->velocityFromAttack.z = 0.0f; this->velocityFromBounce.x = (this->bounceDirection.x * bounceSpeed); this->velocityFromBounce.y = (this->bounceDirection.y * bounceSpeed); this->velocityFromBounce.z = (this->bounceDirection.z * bounceSpeed); @@ -271,12 +271,12 @@ void EnBubble_Fly(EnBubble* this, PlayState* play) { this->graphicRotSpeed = 128.0f; this->graphicEccentricity = 0.48f; } - this->actor.velocity.x = this->velocityFromBounce.x + this->velocityFromBump.x; - this->actor.velocity.y = this->velocityFromBounce.y + this->velocityFromBump.y + this->sinkSpeed; - this->actor.velocity.z = this->velocityFromBounce.z + this->velocityFromBump.z; - Math_ApproachF(&this->velocityFromBump.x, 0.0f, 0.3f, 0.1f); - Math_ApproachF(&this->velocityFromBump.y, 0.0f, 0.3f, 0.1f); - Math_ApproachF(&this->velocityFromBump.z, 0.0f, 0.3f, 0.1f); + this->actor.velocity.x = this->velocityFromBounce.x + this->velocityFromAttack.x; + this->actor.velocity.y = this->velocityFromBounce.y + this->velocityFromAttack.y + this->sinkSpeed; + this->actor.velocity.z = this->velocityFromBounce.z + this->velocityFromAttack.z; + Math_ApproachF(&this->velocityFromAttack.x, 0.0f, 0.3f, 0.1f); + Math_ApproachF(&this->velocityFromAttack.y, 0.0f, 0.3f, 0.1f); + Math_ApproachF(&this->velocityFromAttack.z, 0.0f, 0.3f, 0.1f); } u32 func_809CC648(EnBubble* this) { @@ -284,7 +284,7 @@ u32 func_809CC648(EnBubble* this) { return false; } this->colliderSphere.base.acFlags &= ~AC_HIT; - if (this->colliderSphere.elements[1].base.bumperFlags & BUMP_HIT) { + if (this->colliderSphere.elements[1].base.acElemFlags & ACELEM_HIT) { this->unk_1F0.x = this->colliderSphere.base.ac->velocity.x / 10.0f; this->unk_1F0.y = this->colliderSphere.base.ac->velocity.y / 10.0f; this->unk_1F0.z = this->colliderSphere.base.ac->velocity.z / 10.0f; @@ -425,6 +425,8 @@ void EnBubble_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, gBubbleDL); } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bubble.c", 1226); if (this->actionFunc != EnBubble_Disappear) { diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h index 938d1b2fd..d75376881 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.h @@ -27,8 +27,8 @@ typedef struct EnBubble { /* 0x0228 */ u8 bounceCount; /* 0x022C */ Vec3f bounceDirection; /* 0x0238 */ Vec3f velocityFromBounce; - /* 0x0244 */ Vec3f normalizedBumpVelocity; - /* 0x0250 */ Vec3f velocityFromBump; + /* 0x0244 */ Vec3f normalizedAttackerVelocity; + /* 0x0250 */ Vec3f velocityFromAttack; /* 0x025C */ f32 sinkSpeed; } EnBubble; // size = 0x0260 diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index 42f549b75..e91e59d47 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -30,8 +30,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x000, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 5 }, 100 } }, diff --git a/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/src/overlays/actors/ovl_En_Bw/z_en_bw.c index 4a5b89f85..538055540 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -58,8 +58,8 @@ static ColliderCylinderInit sCylinderInit1 = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x08 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { 30, 65, 0, { 0, 0, 0 } }, @@ -78,8 +78,8 @@ static ColliderCylinderInit sCylinderInit2 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 30, 35, 0, { 0, 0, 0 } }, @@ -766,7 +766,7 @@ void EnBw_Update(Actor* thisx, PlayState* play2) { func_8002836C(play, &thisx->world.pos, &velocity, &accel, &sp50, &sp4C, 0x3C, 0, 0x14); } if (this->unk_248 <= 0.4f) { - this->collider1.elem.toucher.effect = 0; + this->collider1.elem.atDmgInfo.effect = 0; if (((play->gameplayFrames & 1) == 0) && (this->unk_220 < 5) && (this->unk_23C == 0)) { accel.y = -0.1f; velocity.x = Rand_CenteredFloat(4.0f); @@ -786,7 +786,7 @@ void EnBw_Update(Actor* thisx, PlayState* play2) { 20.0f - (this->unk_248 * 40.0f)); } } else { - this->collider1.elem.toucher.effect = 1; + this->collider1.elem.atDmgInfo.effect = 1; } this->unk_234 = Actor_TestFloorInDirection(thisx, play, 50.0f, thisx->world.rot.y); @@ -859,7 +859,7 @@ void EnBw_Draw(Actor* thisx, PlayState* play2) { POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBw_OverrideLimbDraw, NULL, this, POLY_OPA_DISP); } else { - Gfx_SetupDL_25Xlu(play->state.gfxCtx); + Gfx_SetupDL_25Xlu(play2->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 0, 0, 0, this->color1.a); gDPSetEnvColor(POLY_XLU_DISP++, this->color1.r, this->color1.g, this->color1.b, this->color1.a); @@ -906,5 +906,8 @@ void EnBw_Draw(Actor* thisx, PlayState* play2) { EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &icePos, 0x96, 0x96, 0x96, 0xFA, 0xEB, 0xF5, 0xFF, 1.3f); } } + + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bw.c", 1521); } diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/src/overlays/actors/ovl_En_Bx/z_en_bx.c index 0e6b72e03..c0c9fb703 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -39,8 +39,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK1, { 0xFFCFFFFF, 0x03, 0x04 }, { 0xFFCFFFFF, 0x01, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { 60, 100, 100, { 0, 0, 0 } }, @@ -59,8 +59,8 @@ static ColliderQuadInit sQuadInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x03, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -205,6 +205,7 @@ void EnBx_Draw(Actor* thisx, PlayState* play) { s32 pad; Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, 4 * sizeof(Mtx)); s16 i; + s16 off; OPEN_DISPS(play->state.gfxCtx, "../z_en_bx.c", 464); @@ -226,7 +227,7 @@ void EnBx_Draw(Actor* thisx, PlayState* play) { thisx->scale.z = thisx->scale.x = (Math_CosS(this->unk_14E) * 0.0075f) + 0.015f; for (i = 3; i >= 0; i--) { - s16 off = (0x2000 * i); + off = (0x2000 * i); this->unk_184[i].z = this->unk_184[i].x = (Math_CosS(this->unk_14E + off) * 0.0075f) + 0.015f; this->unk_1B4[i].x = thisx->shape.rot.x; diff --git a/src/overlays/actors/ovl_En_Changer/z_en_changer.c b/src/overlays/actors/ovl_En_Changer/z_en_changer.c index cf5e1efe3..5a7ec629c 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.c +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.c @@ -282,7 +282,7 @@ void EnChanger_Update(Actor* thisx, PlayState* play) { this->timer--; } - if (BREG(0)) { + if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); 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 f415f0f10..a47186b62 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 @@ -47,8 +47,8 @@ static ColliderCylinderInit sArwingCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFDFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 15, 30, 10, { 0, 0, 0 } }, @@ -67,8 +67,8 @@ static ColliderCylinderInit sLaserCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFDFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 15, 30, 10, { 0, 0, 0 } }, @@ -283,11 +283,15 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { * This is used for the ground flash display lists and Arwing shadow display lists to snap onto the floor. */ void EnClearTag_CalculateFloorTangent(EnClearTag* this) { + f32 x; + f32 y; + f32 z; + // If there is a floor poly below the Arwing, calculate the floor tangent. if (this->actor.floorPoly != NULL) { - f32 x = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); - f32 y = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); - f32 z = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); + x = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); + y = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); + z = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); this->floorTangent.x = -Math_FAtan2F(-z * y, 1.0f); this->floorTangent.z = Math_FAtan2F(-x * y, 1.0f); diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index 2c9b8753e..a9e667089 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -51,8 +51,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 30, 40, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index caa64d300..af8ec2dab 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -36,8 +36,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_ON, OCELEM_ON, }, { 1, { { 0, 0, 0 }, 20 }, 100 }, @@ -285,8 +285,6 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 facingPlayer; - Vec3f pos; - s16 target; SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -296,6 +294,9 @@ void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { facingPlayer = Actor_IsFacingPlayer(&this->actor, 0x2800); if (facingPlayer) { + Vec3f pos; + s16 target; + pos.x = player->actor.world.pos.x; pos.y = player->actor.world.pos.y + 20.0f; pos.z = player->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.c b/src/overlays/actors/ovl_En_Cs/z_en_cs.c index 31790ebee..d99e29120 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -40,8 +40,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 18, 63, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 711ecafe2..c99af3995 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -66,8 +66,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 18, 66, 0, { 0, 0, 0 } }, @@ -488,14 +488,15 @@ void EnDaiku_UpdateSubCamera(EnDaiku* this, PlayState* play) { void EnDaiku_EscapeSuccess(EnDaiku* this, PlayState* play) { static Vec3f D_809E4148 = { 0.0f, 0.0f, 120.0f }; - Actor* gerudoGuard; - Vec3f vec; Play_ClearCamera(play, this->subCamId); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); this->subCamActive = false; if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { + Actor* gerudoGuard; + Vec3f vec; + Matrix_RotateY(BINANG_TO_RAD(this->initRot.y), MTXMODE_NEW); Matrix_MultVec3f(&D_809E4148, &vec); gerudoGuard = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_GE3, this->initPos.x + vec.x, this->initPos.y + vec.y, @@ -504,9 +505,10 @@ void EnDaiku_EscapeSuccess(EnDaiku* this, PlayState* play) { if (gerudoGuard == NULL) { Actor_Kill(&this->actor); } - } else { - Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_7); + return; } + + Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_7); } /** @@ -605,6 +607,8 @@ void EnDaiku_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDaiku_OverrideLimbDraw, EnDaiku_PostLimbDraw, this); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku.c", 1255); } diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c index 66a136fcc..f5e31493c 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c @@ -49,8 +49,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 18, 66, 0, { 0, 0, 0 } }, @@ -562,5 +562,7 @@ void EnDaikuKakariko_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDaikuKakariko_OverrideLimbDraw, EnDaikuKakariko_PostLimbDraw, thisx); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku_kakariko.c", 1151); } diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 73bf8d932..265e58cc0 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -47,8 +47,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[7] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_ON, OCELEM_ON, }, { 1, { { 0, 100, 1000 }, 15 }, 100 }, @@ -58,8 +58,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[7] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 51, { { 0, 0, 1500 }, 8 }, 100 }, @@ -69,8 +69,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[7] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 52, { { 0, 0, 500 }, 8 }, 100 }, @@ -80,8 +80,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[7] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 53, { { 0, 0, 1500 }, 8 }, 100 }, @@ -91,8 +91,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[7] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 54, { { 0, 0, 500 }, 8 }, 100 }, @@ -102,8 +102,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[7] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 55, { { 0, 0, 1500 }, 8 }, 100 }, @@ -113,8 +113,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[7] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 56, { { 0, 0, 500 }, 8 }, 100 }, @@ -282,7 +282,7 @@ void EnDekubaba_DisableACColliderElems(EnDekubaba* this) { s32 i; for (i = 1; i < ARRAY_COUNT(this->colliderElements); i++) { - this->collider.elements[i].base.bumperFlags &= ~BUMP_ON; + this->collider.elements[i].base.acElemFlags &= ~ACELEM_ON; } } @@ -417,7 +417,7 @@ void EnDekubaba_SetupStunnedVertical(EnDekubaba* this) { s32 i; for (i = 1; i < ARRAY_COUNT(this->colliderElements); i++) { - this->collider.elements[i].base.bumperFlags |= BUMP_ON; + this->collider.elements[i].base.acElemFlags |= ACELEM_ON; } if (this->timer == 1) { diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index 6fd1207fe..6e14eba6c 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -55,8 +55,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 18, 32, 0, { 0, 0, 0 } }, @@ -204,7 +204,7 @@ void EnDekunuts_SetupGasp(EnDekunuts* this) { void EnDekunuts_SetupBeDamaged(EnDekunuts* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gDekuNutsDamageAnim, -3.0f); - if (this->collider.elem.acHitElem->toucher.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) { + if (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) { this->actor.world.rot.y = this->collider.base.ac->world.rot.y; } else { this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, this->collider.base.ac) + 0x8000; diff --git a/src/overlays/actors/ovl_En_Dh/z_en_dh.c b/src/overlays/actors/ovl_En_Dh/z_en_dh.c index 14c454455..ccf7f4af2 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -56,8 +56,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 35, 70, 0, { 0, 0, 0 } }, @@ -69,8 +69,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON | OCELEM_UNK3, }, { 1, { { 0, 0, 0 }, 20 }, 100 }, @@ -296,16 +296,14 @@ void EnDh_SetupAttack(EnDh* this) { } void EnDh_Attack(EnDh* this, PlayState* play) { - s32 pad; - if (SkelAnime_Update(&this->skelAnime)) { this->actionState++; } else if ((this->actor.xzDistToPlayer > 100.0f) || !Actor_IsFacingPlayer(&this->actor, 60 * 0x10000 / 360)) { Animation_Change(&this->skelAnime, &object_dh_Anim_004658, -1.0f, this->skelAnime.curFrame, 0.0f, ANIMMODE_ONCE, -4.0f); this->actionState = 4; - this->collider2.base.atFlags = this->collider2.elements[0].base.toucherFlags = AT_NONE; // also TOUCH_NONE - this->collider2.elements[0].base.toucher.dmgFlags = this->collider2.elements[0].base.toucher.damage = 0; + this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags = AT_NONE; // also ATELEM_NONE + this->collider2.elements[0].base.atDmgInfo.dmgFlags = this->collider2.elements[0].base.atDmgInfo.damage = 0; } switch (this->actionState) { case 1: @@ -318,16 +316,17 @@ void EnDh_Attack(EnDh* this, PlayState* play) { break; case 2: if (this->skelAnime.curFrame >= 4.0f) { - this->collider2.base.atFlags = this->collider2.elements[0].base.toucherFlags = - AT_ON | AT_TYPE_ENEMY; // also TOUCH_ON | TOUCH_SFX_WOOD - this->collider2.elements[0].base.toucher.dmgFlags = DMG_DEFAULT; - this->collider2.elements[0].base.toucher.damage = 8; + this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags = + AT_ON | AT_TYPE_ENEMY; // also ATELEM_ON | ATELEM_SFX_WOOD + this->collider2.elements[0].base.atDmgInfo.dmgFlags = DMG_DEFAULT; + this->collider2.elements[0].base.atDmgInfo.damage = 8; } if (this->collider2.base.atFlags & AT_BOUNCED) { this->collider2.base.atFlags &= ~(AT_HIT | AT_BOUNCED); - this->collider2.base.atFlags = this->collider2.elements[0].base.toucherFlags = - AT_NONE; // also TOUCH_NONE - this->collider2.elements[0].base.toucher.dmgFlags = this->collider2.elements[0].base.toucher.damage = 0; + this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags = + AT_NONE; // also ATELEM_NONE + this->collider2.elements[0].base.atDmgInfo.dmgFlags = + this->collider2.elements[0].base.atDmgInfo.damage = 0; this->actionState++; } else if (this->collider2.base.atFlags & AT_HIT) { this->collider2.base.atFlags &= ~AT_HIT; @@ -336,6 +335,8 @@ void EnDh_Attack(EnDh* this, PlayState* play) { break; case 3: if ((this->actor.xzDistToPlayer <= 100.0f) && (Actor_IsFacingPlayer(&this->actor, 60 * 0x10000 / 360))) { + s32 pad; + Animation_Change(&this->skelAnime, &object_dh_Anim_004658, 1.0f, 20.0f, Animation_GetLastFrame(&object_dh_Anim_004658), ANIMMODE_ONCE, -6.0f); this->actionState = 0; @@ -343,9 +344,10 @@ void EnDh_Attack(EnDh* this, PlayState* play) { Animation_Change(&this->skelAnime, &object_dh_Anim_004658, -1.0f, Animation_GetLastFrame(&object_dh_Anim_004658), 0.0f, ANIMMODE_ONCE, -4.0f); this->actionState++; - this->collider2.base.atFlags = this->collider2.elements[0].base.toucherFlags = - AT_NONE; // also TOUCH_NONE - this->collider2.elements[0].base.toucher.dmgFlags = this->collider2.elements[0].base.toucher.damage = 0; + this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags = + AT_NONE; // also ATELEM_NONE + this->collider2.elements[0].base.atDmgInfo.dmgFlags = + this->collider2.elements[0].base.atDmgInfo.damage = 0; } break; case 5: @@ -374,10 +376,10 @@ void EnDh_Burrow(EnDh* this, PlayState* play) { case 0: this->actionState++; this->drawDirtWave++; - this->collider1.base.atFlags = this->collider1.elem.toucherFlags = - AT_ON | AT_TYPE_ENEMY; // also TOUCH_ON | TOUCH_SFX_WOOD - this->collider1.elem.toucher.dmgFlags = DMG_DEFAULT; - this->collider1.elem.toucher.damage = 4; + this->collider1.base.atFlags = this->collider1.elem.atElemFlags = + AT_ON | AT_TYPE_ENEMY; // also ATELEM_ON | ATELEM_SFX_WOOD + this->collider1.elem.atDmgInfo.dmgFlags = DMG_DEFAULT; + this->collider1.elem.atDmgInfo.damage = 4; FALLTHROUGH; case 1: this->dirtWavePhase += 0x47E; @@ -393,8 +395,8 @@ void EnDh_Burrow(EnDh* this, PlayState* play) { case 2: this->drawDirtWave = false; this->collider1.dim.radius = 35; - this->collider1.base.atFlags = this->collider1.elem.toucherFlags = AT_NONE; // Also TOUCH_NONE - this->collider1.elem.toucher.dmgFlags = this->collider1.elem.toucher.damage = 0; + this->collider1.base.atFlags = this->collider1.elem.atElemFlags = AT_NONE; // Also ATELEM_NONE + this->collider1.elem.atDmgInfo.dmgFlags = this->collider1.elem.atDmgInfo.damage = 0; EnDh_SetupWait(this); break; } @@ -477,8 +479,8 @@ void EnDh_CollisionCheck(EnDh* this, PlayState* play) { if ((this->collider2.base.acFlags & AC_HIT) && !this->retreat) { this->collider2.base.acFlags &= ~AC_HIT; if ((this->actor.colChkInfo.damageEffect != 0) && (this->actor.colChkInfo.damageEffect != 6)) { - this->collider2.base.atFlags = this->collider2.elements[0].base.toucherFlags = AT_NONE; // also TOUCH_NONE - this->collider2.elements[0].base.toucher.dmgFlags = this->collider2.elements[0].base.toucher.damage = 0; + this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags = AT_NONE; // also ATELEM_NONE + this->collider2.elements[0].base.atDmgInfo.dmgFlags = this->collider2.elements[0].base.atDmgInfo.damage = 0; if (player->unk_844 != 0) { this->unk_258 = player->unk_845; } diff --git a/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/src/overlays/actors/ovl_En_Dha/z_en_dha.c index b78ff7260..17ec0b85e 100644 --- a/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -76,8 +76,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 1, { { 0, 0, 0 }, 12 }, 100 }, @@ -87,8 +87,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 2, { { 3200, 0, 0 }, 10 }, 100 }, @@ -98,8 +98,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 3, { { 1200, 0, 0 }, 10 }, 100 }, @@ -109,8 +109,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 4, { { 2700, 0, 0 }, 10 }, 100 }, @@ -120,8 +120,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 5, { { 1200, 0, 0 }, 10 }, 100 }, diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index df3e4ceab..d0ba25207 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -61,8 +61,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_NONE | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 10, 10, 0, { 0, 0, 0 } }, @@ -125,6 +125,8 @@ void EnDivingGame_SpawnRuppy(EnDivingGame* this, PlayState* play) { } s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) { + s32 rupeesNeeded; + if ((gSaveContext.timerState == TIMER_STATE_STOP) && !Play_InCsMode(play)) { // Failed. gSaveContext.timerState = TIMER_STATE_OFF; @@ -138,7 +140,7 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) { this->actionFunc = func_809EE048; return true; } else { - s32 rupeesNeeded = 5; + rupeesNeeded = 5; if (GET_EVENTCHKINF(EVENTCHKINF_38)) { rupeesNeeded = 10; diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 233d17d61..315f6d50c 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -66,8 +66,8 @@ static ColliderCylinderInitType1 sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 18, 32, 0, { 0, 0, 0 } }, @@ -77,6 +77,7 @@ static u16 sStartingTextIds[] = { 0x10A0, 0x10A1, 0x10A2, 0x10CA, 0x10CB, 0x10CC, 0x10CD, 0x10CE, 0x10CF, 0x10DC, 0x10DD, }; +#if IS_DEBUG static char* sItemDebugTxt[] = { "デクã®å®Ÿå£²ã‚Š ", // "Deku Nuts" "ãƒ‡ã‚¯ã®æ£’売り ", // "Deku Sticks" @@ -90,6 +91,7 @@ static char* sItemDebugTxt[] = { "ãƒ‡ã‚¯ã®æ£’æŒã¦ã‚‹æ•°ã‚’増やã™", // "Deku Stick Upgrade" "デクã®å®ŸæŒã¦ã‚‹æ•°ã‚’増やã™", // "Deku Nut Upgrade" }; +#endif static DnsItemEntry sItemDekuNuts = { 20, 5, GI_DEKU_NUTS_5_2, EnDns_CanBuyDekuNuts, EnDns_PayForDekuNuts }; static DnsItemEntry sItemDekuSticks = { 15, 1, GI_DEKU_STICKS_1, EnDns_CanBuyDekuSticks, EnDns_PayPrice }; @@ -154,7 +156,7 @@ void EnDns_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->bumpOn = true; + this->isColliderEnabled = true; this->standOnGround = true; this->dropCollectible = false; this->actor.speed = 0.0f; @@ -432,7 +434,7 @@ void EnDns_SetupBurrow(EnDns* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->dnsItemEntry->payment(this); this->dropCollectible = true; - this->bumpOn = false; + this->isColliderEnabled = false; this->actor.flags &= ~ACTOR_FLAG_0; EnDns_ChangeAnim(this, DNS_ANIM_BURROW); this->actionFunc = EnDns_Burrow; @@ -440,7 +442,7 @@ void EnDns_SetupBurrow(EnDns* this, PlayState* play) { } else { this->dnsItemEntry->payment(this); this->dropCollectible = true; - this->bumpOn = false; + this->isColliderEnabled = false; this->actor.flags &= ~ACTOR_FLAG_0; EnDns_ChangeAnim(this, DNS_ANIM_BURROW); this->actionFunc = EnDns_Burrow; @@ -449,7 +451,7 @@ void EnDns_SetupBurrow(EnDns* this, PlayState* play) { void EnDns_SetupNoSaleBurrow(EnDns* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - this->bumpOn = false; + this->isColliderEnabled = false; this->actor.flags &= ~ACTOR_FLAG_0; EnDns_ChangeAnim(this, DNS_ANIM_BURROW); this->actionFunc = EnDns_Burrow; @@ -513,7 +515,7 @@ void EnDns_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_2); } - if (this->bumpOn) { + if (this->isColliderEnabled) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.h b/src/overlays/actors/ovl_En_Dns/z_en_dns.h index fe931bec3..a6ef63223 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -58,7 +58,7 @@ typedef struct EnDns { /* 0x026C */ ColliderCylinder collider; /* 0x02B8 */ s16 dustTimer; /* 0x02BA */ u8 animIndex; // set but not read - /* 0x02BB */ u8 bumpOn; + /* 0x02BB */ u8 isColliderEnabled; /* 0x02BC */ u8 standOnGround; /* 0x02BD */ u8 dropCollectible; /* 0x02C0 */ DnsItemEntry* dnsItemEntry; diff --git a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c index 4add13e11..87e667374 100644 --- a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c +++ b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c @@ -123,7 +123,11 @@ void EnDntDemo_Judge(EnDntDemo* this, PlayState* play) { this->leaderSignal = DNT_SIGNAL_NONE; this->actionFunc = EnDntDemo_Results; } else if ((this->actor.xzDistToPlayer > 30.0f) || (Player_GetMask(play) == 0)) { - this->debugArrowTimer++; + + if (IS_ACTOR_DEBUG_ENABLED) { + this->debugArrowTimer++; + } + if (this->subCamId != SUB_CAM_ID_DONE) { this->subCamId = SUB_CAM_ID_DONE; } @@ -137,7 +141,11 @@ void EnDntDemo_Judge(EnDntDemo* this, PlayState* play) { if ((Player_GetMask(play) != 0) && (this->subCamId == SUB_CAM_ID_DONE)) { this->subCamId = OnePointCutscene_Init(play, 2220, -99, &this->scrubs[3]->actor, CAM_ID_MAIN); } - this->debugArrowTimer = 0; + + if (IS_ACTOR_DEBUG_ENABLED) { + this->debugArrowTimer = 0; + } + if (this->judgeTimer == 40) { for (i = 0; i < 9; i++) { this->scrubs[i]->stageSignal = DNT_SIGNAL_LOOK; @@ -185,8 +193,8 @@ void EnDntDemo_Judge(EnDntDemo* this, PlayState* play) { case PLAYER_MASK_ZORA: case PLAYER_MASK_GERUDO: rand9 = Rand_ZeroFloat(8.99f); - maskIdx = Player_GetMask(play); - maskIdx--; + // fake match, possible alternative is `maskIdx = Player_GetMask(play); maskIdx--;` on one line + maskIdx = (s16)Player_GetMask(play) - 1; if (rand9 == 8) { ignore = true; delay = 8; @@ -265,6 +273,9 @@ void EnDntDemo_Judge(EnDntDemo* this, PlayState* play) { void EnDntDemo_Results(EnDntDemo* this, PlayState* play) { s32 i; + s16 offsetAngle; + Vec3f leaderPos; + f32 offsetDist; if (this->leaderSignal != DNT_SIGNAL_NONE) { for (i = 0; i < 9; i++) { @@ -284,9 +295,8 @@ void EnDntDemo_Results(EnDntDemo* this, PlayState* play) { this->actionFunc = EnDntDemo_Prize; } else if (this->prize == DNT_PRIZE_STICK) { for (i = 0; i < 9; i++) { - s16 offsetAngle = -this->leader->actor.shape.rot.y; - Vec3f leaderPos = this->leader->actor.world.pos; - f32 offsetDist; + offsetAngle = -this->leader->actor.shape.rot.y; + leaderPos = this->leader->actor.world.pos; if (!(i & 1)) { offsetAngle -= 0x59D8; @@ -324,7 +334,8 @@ void EnDntDemo_Update(Actor* thisx, PlayState* play) { this->unkTimer1--; } this->actionFunc(this, play); - if (BREG(0)) { + + if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { if (this->debugArrowTimer != 0) { if (!(this->debugArrowTimer & 1)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, diff --git a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h index 4349a972e..6597530e2 100644 --- a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h +++ b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h @@ -14,7 +14,7 @@ typedef struct EnDntDemo { /* 0x0150 */ s16 judgeTimer; /* 0x0152 */ s16 unkTimer1; /* 0x0154 */ s16 unkTimer2; - /* 0x0156 */ s16 debugArrowTimer; + /* 0x0156 */ s16 debugArrowTimer; // ENABLE_ACTOR_DEBUGGER /* 0x0158 */ s16 leaderSignal; /* 0x015A */ s16 action; /* 0x015C */ s16 prize; diff --git a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index 59c8ed95d..eb354cf91 100644 --- a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -64,8 +64,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 30, 80, 0, { 0, 0, 0 } }, @@ -373,10 +373,12 @@ void EnDntJiji_Update(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.015f); this->unkTimer++; - if (BREG(0)) { + + if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { // "time" PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ 時間 ☆☆☆☆☆ %d\n" VT_RST, this->timer); } + if ((this->timer > 1) && (this->timer != 0)) { this->timer--; } diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index f1fefedd8..ff9f9cc71 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -81,8 +81,8 @@ static ColliderCylinderInit sBodyCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 16, 46, 0, { 0, 0, 0 } }, @@ -101,8 +101,8 @@ static ColliderQuadInit sTargetQuadInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x0001F824, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -216,24 +216,31 @@ void EnDntNomal_TargetWait(EnDntNomal* this, PlayState* play) { f32 dz; Vec3f scoreAccel = { 0.0f, 0.0f, 0.0f }; Vec3f scoreVel = { 0.0f, 0.0f, 0.0f }; + s32 pad; - this->targetVtx[0].x = this->targetVtx[1].x = this->targetVtx[2].x = this->targetVtx[3].x = targetX; + this->targetVtx[0].x = targetX; + this->targetVtx[0].y = targetY - 24.0f; + this->targetVtx[0].z = targetZ + 24.0f; - this->targetVtx[1].y = this->targetVtx[0].y = targetY - 24.0f; + this->targetVtx[1].x = targetX; + this->targetVtx[1].y = targetY - 24.0f; + this->targetVtx[1].z = targetZ - 24.0f; - this->targetVtx[2].z = this->targetVtx[0].z = targetZ + 24.0f; + this->targetVtx[2].x = targetX; + this->targetVtx[2].y = targetY + 24.0f; + this->targetVtx[2].z = targetZ + 24.0f; - this->targetVtx[3].z = this->targetVtx[1].z = targetZ - 24.0f; - - this->targetVtx[3].y = this->targetVtx[2].y = targetY + 24.0f; + this->targetVtx[3].x = targetX; + this->targetVtx[3].y = targetY + 24.0f; + this->targetVtx[3].z = targetZ - 24.0f; SkelAnime_Update(&this->skelAnime); if ((this->targetQuad.base.acFlags & AC_HIT) || BREG(0)) { this->targetQuad.base.acFlags &= ~AC_HIT; - dx = fabsf(targetX - this->targetQuad.elem.bumper.hitPos.x); - dy = fabsf(targetY - this->targetQuad.elem.bumper.hitPos.y); - dz = fabsf(targetZ - this->targetQuad.elem.bumper.hitPos.z); + dx = fabsf(targetX - this->targetQuad.elem.acDmgInfo.hitPos.x); + dy = fabsf(targetY - this->targetQuad.elem.acDmgInfo.hitPos.y); + dz = fabsf(targetZ - this->targetQuad.elem.acDmgInfo.hitPos.z); scoreVel.y = 5.0f; diff --git a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c index e3f78aee6..f5f594088 100644 --- a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c +++ b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c @@ -56,8 +56,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFC5FFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 18, 20, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index e9a04f9ef..6ae9701d5 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -54,8 +54,8 @@ static ColliderJntSphElementInit sBodyElementsInit[6] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 15, { { 0, 0, 0 }, 17 }, 100 }, @@ -65,8 +65,8 @@ static ColliderJntSphElementInit sBodyElementsInit[6] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 14, { { 0, 0, 0 }, 15 }, 100 }, @@ -76,8 +76,8 @@ static ColliderJntSphElementInit sBodyElementsInit[6] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 13, { { 0, 0, 0 }, 10 }, 100 }, @@ -87,8 +87,8 @@ static ColliderJntSphElementInit sBodyElementsInit[6] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 21, { { 0, 0, 0 }, 20 }, 100 }, @@ -98,8 +98,8 @@ static ColliderJntSphElementInit sBodyElementsInit[6] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 28, { { 0, 0, 0 }, 20 }, 100 }, @@ -109,8 +109,8 @@ static ColliderJntSphElementInit sBodyElementsInit[6] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x0D800691, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON | OCELEM_UNK3, }, { 6, { { 0, 0, 0 }, 35 }, 100 }, @@ -136,8 +136,8 @@ static ColliderTrisElementInit sHardElementsInit[3] = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xF24BF96E, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE | BUMP_NO_AT_INFO, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO, OCELEM_NONE, }, { { { -10.0f, 14.0f, 2.0f }, { -10.0f, -6.0f, 2.0f }, { 9.0f, 14.0f, 2.0f } } }, @@ -147,8 +147,8 @@ static ColliderTrisElementInit sHardElementsInit[3] = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xFFCBF96E, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE | BUMP_NO_AT_INFO, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO, OCELEM_NONE, }, { { { -10.0f, -6.0f, 2.0f }, { 9.0f, -6.0f, 2.0f }, { 9.0f, 14.0f, 2.0f } } }, @@ -158,8 +158,8 @@ static ColliderTrisElementInit sHardElementsInit[3] = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xFFCBF96E, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE | BUMP_NO_AT_INFO, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO, OCELEM_NONE, }, { { { -10.0f, -6.0f, 2.0f }, { 9.0f, -6.0f, 2.0f }, { 9.0f, 14.0f, 2.0f } } }, @@ -192,8 +192,8 @@ static ColliderQuadInit sAttackQuadInit = { ELEMTYPE_UNK0, { 0x20000000, 0x01, 0x10 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL | ATELEM_UNK7, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -605,13 +605,13 @@ void EnDodongo_SweepTail(EnDodongo* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if ((this->timer != 0) || (ABS(yawDiff1) < 0x4000)) { - this->sphElements[2].base.toucherFlags = TOUCH_NONE; - this->sphElements[1].base.toucherFlags = TOUCH_NONE; + this->sphElements[2].base.atElemFlags = ATELEM_NONE; + this->sphElements[1].base.atElemFlags = ATELEM_NONE; this->colliderBody.base.atFlags = AT_NONE; - this->sphElements[2].base.toucher.dmgFlags = 0; - this->sphElements[1].base.toucher.dmgFlags = 0; - this->sphElements[2].base.toucher.damage = 0; - this->sphElements[1].base.toucher.damage = 0; + this->sphElements[2].base.atDmgInfo.dmgFlags = 0; + this->sphElements[1].base.atDmgInfo.dmgFlags = 0; + this->sphElements[2].base.atDmgInfo.damage = 0; + this->sphElements[1].base.atDmgInfo.damage = 0; EnDodongo_SetupBreatheFire(this); this->timer = Rand_S16Offset(5, 10); } else { @@ -628,10 +628,10 @@ void EnDodongo_SweepTail(EnDodongo* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_J_TAIL); Animation_PlayOnceSetSpeed(&this->skelAnime, animation, 2.0f); this->timer = 18; - this->colliderBody.base.atFlags = this->sphElements[1].base.toucherFlags = - this->sphElements[2].base.toucherFlags = AT_ON | AT_TYPE_ENEMY; // also TOUCH_ON | TOUCH_SFX_WOOD - this->sphElements[1].base.toucher.dmgFlags = this->sphElements[2].base.toucher.dmgFlags = DMG_DEFAULT; - this->sphElements[1].base.toucher.damage = this->sphElements[2].base.toucher.damage = 8; + this->colliderBody.base.atFlags = this->sphElements[1].base.atElemFlags = + this->sphElements[2].base.atElemFlags = AT_ON | AT_TYPE_ENEMY; // also ATELEM_ON | ATELEM_SFX_WOOD + this->sphElements[1].base.atDmgInfo.dmgFlags = this->sphElements[2].base.atDmgInfo.dmgFlags = DMG_DEFAULT; + this->sphElements[1].base.atDmgInfo.damage = this->sphElements[2].base.atDmgInfo.damage = 8; } } else if (this->timer > 1) { Vec3f tailPos; diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index ab7e62486..be4c04dd9 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -46,8 +46,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 16, 20, 0, { 0 } }, diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 5f04f6159..7a087c0b9 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -173,10 +173,9 @@ void EnDoor_Destroy(Actor* thisx, PlayState* play) { } void EnDoor_SetupType(EnDoor* this, PlayState* play) { - s32 doorType; - if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { - doorType = ENDOOR_GET_TYPE(&this->actor); + s32 doorType = ENDOOR_GET_TYPE(&this->actor); + this->actor.flags &= ~ACTOR_FLAG_4; this->actor.objectSlot = this->requiredObjectSlot; this->actionFunc = EnDoor_Idle; @@ -191,7 +190,9 @@ void EnDoor_SetupType(EnDoor* this, PlayState* play) { this->lockTimer = 10; } } else if (doorType == DOOR_AJAR) { - if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor) > DOOR_AJAR_SLAM_RANGE) { + Player* player = GET_PLAYER(play); + + if (Actor_WorldDistXZToActor(&this->actor, &player->actor) > DOOR_AJAR_SLAM_RANGE) { this->actionFunc = EnDoor_AjarWait; this->actor.world.rot.y = -0x1800; } @@ -217,7 +218,6 @@ void EnDoor_Idle(EnDoor* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 doorType; Vec3f playerPosRelToDoor; - s16 yawDiff; doorType = ENDOOR_GET_TYPE(&this->actor); func_8002DBD0(&this->actor, &playerPosRelToDoor, &player->actor.world.pos); @@ -233,7 +233,8 @@ void EnDoor_Idle(EnDoor* this, PlayState* play) { } else if (!Player_InCsMode(play)) { if (fabsf(playerPosRelToDoor.y) < 20.0f && fabsf(playerPosRelToDoor.x) < 20.0f && fabsf(playerPosRelToDoor.z) < 50.0f) { - yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; + s16 yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; + if (playerPosRelToDoor.z > 0.0f) { yawDiff = 0x8000 - yawDiff; } @@ -293,9 +294,6 @@ void EnDoor_AjarClose(EnDoor* this, PlayState* play) { } void EnDoor_Open(EnDoor* this, PlayState* play) { - s32 i; - s32 numEffects; - if (DECR(this->lockTimer) == 0) { if (SkelAnime_Update(&this->skelAnime)) { this->actionFunc = EnDoor_Idle; @@ -307,7 +305,9 @@ void EnDoor_Open(EnDoor* this, PlayState* play) { ? NA_SE_EV_IRON_DOOR_OPEN : NA_SE_OC_DOOR_OPEN); if (this->skelAnime.playSpeed < 1.5f) { - numEffects = (s32)(Rand_ZeroOne() * 30.0f) + 50; + s32 numEffects = (s32)(Rand_ZeroOne() * 30.0f) + 50; + s32 i; + for (i = 0; i < numEffects; i++) { EffectSsBubble_Spawn(play, &this->actor.world.pos, 60.0f, 100.0f, 50.0f, 0.15f); } @@ -329,25 +329,22 @@ void EnDoor_Update(Actor* thisx, PlayState* play) { } s32 EnDoor_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - s32 pad; - TransitionActorEntry* transitionEntry; - Gfx** doorDLists; - s32 pad2; - s16 rotDiff; - s32 doorDListIndex; - EnDoor* this = (EnDoor*)thisx; - if (limbIndex == 4) { - doorDLists = sDoorDLists[this->dListIndex]; + EnDoor* this = (EnDoor*)thisx; + TransitionActorEntry* transitionEntry; + Gfx** doorDLists = sDoorDLists[this->dListIndex]; + transitionEntry = &play->transiActorCtx.list[GET_TRANSITION_ACTOR_INDEX(&this->actor)]; rot->z += this->actor.world.rot.y; if ((play->roomCtx.prevRoom.num >= 0) || (transitionEntry->sides[0].room == transitionEntry->sides[1].room)) { // Draw the side of the door that is visible to the camera - rotDiff = this->actor.shape.rot.y + this->skelAnime.jointTable[3].z + rot->z - - Math_Vec3f_Yaw(&play->view.eye, &this->actor.world.pos); + s16 rotDiff = this->actor.shape.rot.y + this->skelAnime.jointTable[3].z + rot->z - + Math_Vec3f_Yaw(&play->view.eye, &this->actor.world.pos); + *dList = (ABS(rotDiff) < 0x4000) ? doorDLists[0] : doorDLists[1]; } else { - doorDListIndex = this->unk_192; + s32 doorDListIndex = this->unk_192; + if (transitionEntry->sides[0].room != this->actor.room) { doorDListIndex ^= 1; } diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/src/overlays/actors/ovl_En_Ds/z_en_ds.c index 05c4c1a78..3d8e0e57c 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -215,6 +215,8 @@ void EnDs_Wait(EnDs* this, PlayState* play) { player->actor.textId = 0x500C; this->actionFunc = EnDs_OfferBluePotion; } else { + s16 pad; + if (INV_CONTENT(ITEM_ODD_MUSHROOM) == ITEM_ODD_MUSHROOM) { player->actor.textId = 0x5049; } else { diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index ea124d043..65f4b90bf 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -47,8 +47,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 20, 46, 0, { 0, 0, 0 } }, @@ -362,13 +362,15 @@ void func_809FE4A4(EnDu* this, PlayState* play) { void func_809FE638(EnDu* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & PLAYER_STATE1_29)) { - OnePointCutscene_Init(play, 3330, -99, &this->actor, CAM_ID_MAIN); - player->actor.shape.rot.y = player->actor.world.rot.y = this->actor.world.rot.y + 0x7FFF; - Audio_PlayFanfare(NA_BGM_APPEAR); - EnDu_SetupAction(this, func_809FE6CC); - this->unk_1E2 = 0x32; + if (player->stateFlags1 & PLAYER_STATE1_29) { + return; } + + OnePointCutscene_Init(play, 3330, -99, &this->actor, CAM_ID_MAIN); + player->actor.shape.rot.y = player->actor.world.rot.y = this->actor.world.rot.y + 0x7FFF; + Audio_PlayFanfare(NA_BGM_APPEAR); + EnDu_SetupAction(this, func_809FE6CC); + this->unk_1E2 = 0x32; } void func_809FE6CC(EnDu* this, PlayState* play) { @@ -527,11 +529,13 @@ void func_809FEC14(EnDu* this, PlayState* play) { } void func_809FEC70(EnDu* this, PlayState* play) { + f32 xzRange; + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; EnDu_SetupAction(this, func_809FECE4); } else { - f32 xzRange = this->actor.xzDistToPlayer + 1.0f; + xzRange = this->actor.xzDistToPlayer + 1.0f; Actor_OfferGetItem(&this->actor, play, GI_GORONS_BRACELET, xzRange, fabsf(this->actor.yDistToPlayer) + 1.0f); } diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c index 189607433..0f9fb333e 100644 --- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c +++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c @@ -93,8 +93,8 @@ void EnDyExtra_Draw(Actor* thisx, PlayState* play) { static u8 D_809FFC50[] = { 0x02, 0x01, 0x01, 0x02, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x02, 0x00 }; EnDyExtra* this = (EnDyExtra*)thisx; - s32 pad; GraphicsContext* gfxCtx = play->state.gfxCtx; + s32 pad; Vtx* vertices = SEGMENTED_TO_VIRTUAL(gGreatFairySpiralBeamVtx); s32 i; u8 unk[3]; diff --git a/src/overlays/actors/ovl_En_Eg/z_en_eg.c b/src/overlays/actors/ovl_En_Eg/z_en_eg.c index c53100ada..252eb3c00 100644 --- a/src/overlays/actors/ovl_En_Eg/z_en_eg.c +++ b/src/overlays/actors/ovl_En_Eg/z_en_eg.c @@ -48,7 +48,7 @@ void EnEg_Init(Actor* thisx, PlayState* play) { } void func_809FFDC8(EnEg* this, PlayState* play) { - if (!sVoided && (gSaveContext.subTimerSeconds <= 0) && Flags_GetSwitch(play, 0x36) && (kREG(0) == 0)) { + if (!sVoided && (gSaveContext.subTimerSeconds <= 0) && Flags_GetSwitch(play, 0x36) && (!IS_DEBUG || kREG(0) == 0)) { // Void the player out Play_TriggerRespawn(play); gSaveContext.respawnFlag = -2; diff --git a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c index 6b4a7a860..ebfa1c6e1 100644 --- a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c +++ b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c @@ -60,8 +60,8 @@ static ColliderCylinderInit sColCylInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x04, 0x08 }, { 0x00000019, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_ON, OCELEM_ON, }, { 27, 17, -10, { 0, 0, 0 } }, @@ -178,7 +178,7 @@ void EnEiyer_RotateAroundHome(EnEiyer* this) { } void EnEiyer_SetupAppearFromGround(EnEiyer* this) { - this->collider.elem.bumper.dmgFlags = DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT; + this->collider.elem.acDmgInfo.dmgFlags = DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT; Animation_PlayLoop(&this->skelanime, &gStingerIdleAnim); this->actor.world.pos.x = this->actor.home.pos.x; @@ -228,7 +228,7 @@ void EnEiyer_SetupInactive(EnEiyer* this) { void EnEiyer_SetupAmbush(EnEiyer* this, PlayState* play) { this->actor.speed = 0.0f; Animation_PlayOnce(&this->skelanime, &gStingerBackflipAnim); - this->collider.elem.bumper.dmgFlags = DMG_DEFAULT; + this->collider.elem.acDmgInfo.dmgFlags = DMG_DEFAULT; this->basePos = this->actor.world.pos; this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.flags |= ACTOR_FLAG_IGNORE_QUAKE; @@ -290,23 +290,23 @@ void EnEiyer_SetupDie(EnEiyer* this) { this->timer = 20; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 200, COLORFILTER_BUFFLAG_OPA, 40); - if (this->collider.elem.bumper.dmgFlags != (DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT)) { + if (this->collider.elem.acDmgInfo.dmgFlags != (DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT)) { this->actor.speed = 6.0f; Animation_MorphToLoop(&this->skelanime, &gStingerHitAnim, -3.0f); } else { this->actor.speed -= 6.0f; } - this->collider.elem.bumper.dmgFlags = DMG_DEFAULT; + this->collider.elem.acDmgInfo.dmgFlags = DMG_DEFAULT; this->collider.base.atFlags &= ~AT_ON; this->collider.base.acFlags &= ~AC_ON; this->actionFunc = EnEiyer_Die; } void EnEiyer_SetupDead(EnEiyer* this) { - this->actor.colorFilterParams |= 0x2000; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; + this->actor.colorFilterParams |= 0x2000; this->actionFunc = EnEiyer_Dead; } @@ -612,7 +612,7 @@ void EnEiyer_UpdateDamage(EnEiyer* this, PlayState* play) { } // If underground, one hit kill - if (this->collider.elem.bumper.dmgFlags == (DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT)) { + if (this->collider.elem.acDmgInfo.dmgFlags == (DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT)) { if (this->actor.colChkInfo.damage == 0) { EnEiyer_SetupAmbush(this, play); } else { @@ -687,7 +687,7 @@ s32 EnEiyer_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos->z += 2500.0f; } - if (this->collider.elem.bumper.dmgFlags == (DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT) && limbIndex != 9 && + if (this->collider.elem.acDmgInfo.dmgFlags == (DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT) && limbIndex != 9 && limbIndex != 10) { *dList = NULL; } diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index fb9d11871..70f9ccd12 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -808,7 +808,6 @@ void func_80A03AB0(EnElf* this, PlayState* play) { void EnElf_UpdateLights(EnElf* this, PlayState* play) { s16 glowLightRadius; - Player* player; glowLightRadius = 100; @@ -817,7 +816,8 @@ void EnElf_UpdateLights(EnElf* this, PlayState* play) { } if (this->fairyFlags & 0x20) { - player = GET_PLAYER(play); + Player* player = GET_PLAYER(play); + Lights_PointNoGlowSetInfo(&this->lightInfoNoGlow, player->actor.world.pos.x, (s16)(player->actor.world.pos.y) + 60.0f, player->actor.world.pos.z, 255, 255, 255, 200); @@ -1379,9 +1379,15 @@ void func_80A053F0(Actor* thisx, PlayState* play) { if (player->naviTextId == 0) { if (player->unk_664 == NULL) { +#if IS_DEBUG if (((gSaveContext.save.info.playerData.naviTimer >= 600) && (gSaveContext.save.info.playerData.naviTimer <= 3000)) || - (nREG(89) != 0)) { + (nREG(89) != 0)) +#else + if ((gSaveContext.save.info.playerData.naviTimer >= 600) && + (gSaveContext.save.info.playerData.naviTimer <= 3000)) +#endif + { player->naviTextId = QuestHint_GetNaviTextId(play); if (player->naviTextId == 0x15F) { @@ -1417,6 +1423,7 @@ void func_80A053F0(Actor* thisx, PlayState* play) { this->actionFunc(this, play); thisx->shape.rot.y = this->unk_2BC; +#if IS_DEBUG // `gSaveContext.save.info.sceneFlags[127].chest` (like in the debug string) instead of `HIGH_SCORE(HS_HBA)` // matches too, but, with how the `SaveContext` struct is currently defined, it is an out-of-bounds read in the // `sceneFlags` array. It is theorized the original `room_inf` (currently `sceneFlags`) was an array of length @@ -1426,6 +1433,7 @@ void func_80A053F0(Actor* thisx, PlayState* play) { if ((nREG(81) != 0) && (HIGH_SCORE(HS_HBA) != 0)) { LOG_NUM("z_common_data.memory.information.room_inf[127][ 0 ]", HIGH_SCORE(HS_HBA), "../z_en_elf.c", 2595); } +#endif if (!Play_InCsMode(play)) { if (gSaveContext.save.info.playerData.naviTimer < 25800) { @@ -1535,7 +1543,7 @@ void EnElf_Draw(Actor* thisx, PlayState* play) { gDPSetRenderMode(dListHead++, G_RM_PASS, G_RM_ZB_CLD_SURF2); } - gSPEndDisplayList(dListHead++); + gSPEndDisplayList(dListHead); gDPSetEnvColor(POLY_XLU_DISP++, (u8)this->outerColor.r, (u8)this->outerColor.g, (u8)this->outerColor.b, (u8)(envAlpha * alphaScale)); POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index d942e56c7..ef537e5f8 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -51,6 +51,8 @@ void EnEncount1_Init(Actor* thisx, PlayState* play) { spawnRange = 120.0f + (40.0f * this->actor.world.rot.z); this->spawnRange = spawnRange; + if (1) {} + PRINTF("\n\n"); // "It's an enemy spawner!" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 敵発生ゾーンã§ãŸï¼ ☆☆☆☆☆ %x\n" VT_RST, this->actor.params); @@ -102,7 +104,10 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, PlayState* play) { f32 floorY; EnReeba* leever; - this->outOfRangeTimer = 0; + if (IS_ACTOR_DEBUG_ENABLED) { + this->outOfRangeTimer = 0; + } + spawnPos = this->actor.world.pos; if ((this->timer == 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->curNumSpawn <= this->maxCurSpawns) && @@ -185,9 +190,14 @@ void EnEncount1_SpawnTektites(EnEncount1* this, PlayState* play) { this->timer = 10; if ((fabsf(player->actor.world.pos.y - this->actor.world.pos.y) > 100.0f) || (this->actor.xzDistToPlayer > this->spawnRange)) { - this->outOfRangeTimer++; + if (IS_ACTOR_DEBUG_ENABLED) { + this->outOfRangeTimer++; + } } else { - this->outOfRangeTimer = 0; + if (IS_ACTOR_DEBUG_ENABLED) { + this->outOfRangeTimer = 0; + } + if ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) { spawnPos.x = this->actor.world.pos.x + Rand_CenteredFloat(50.0f); spawnPos.y = this->actor.world.pos.y + 120.0f; @@ -228,7 +238,9 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play) { if (play->sceneId != SCENE_HYRULE_FIELD) { if ((fabsf(player->actor.world.pos.y - this->actor.world.pos.y) > 100.0f) || (this->actor.xzDistToPlayer > this->spawnRange)) { - this->outOfRangeTimer++; + if (IS_ACTOR_DEBUG_ENABLED) { + this->outOfRangeTimer++; + } return; } } else if (IS_DAY || (Player_GetMask(play) == PLAYER_MASK_BUNNY)) { @@ -236,7 +248,10 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play) { return; } - this->outOfRangeTimer = 0; + if (IS_ACTOR_DEBUG_ENABLED) { + this->outOfRangeTimer = 0; + } + spawnPos = this->actor.world.pos; if ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) { while ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) { @@ -322,7 +337,7 @@ void EnEncount1_Update(Actor* thisx, PlayState* play) { this->updateFunc(this, play); - if (BREG(0) != 0) { + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { if (this->outOfRangeTimer != 0) { if ((this->outOfRangeTimer & 1) == 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h index efd770f26..5fffa776c 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.h @@ -19,7 +19,7 @@ typedef struct EnEncount1 { /* 0x0154 */ s16 spawnType; /* 0x0156 */ s16 maxTotalSpawns; /* 0x0158 */ s16 totalNumSpawn; - /* 0x015A */ s16 outOfRangeTimer; + /* 0x015A */ s16 outOfRangeTimer; // ENABLE_ACTOR_DEBUGGER /* 0x015C */ s16 fieldSpawnTimer; /* 0x015E */ s16 killCount; /* 0x0160 */ s16 numLeeverSpawns; diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index 7efa5a09a..cab41eec9 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -338,9 +338,9 @@ void EnEncount2_UpdateEffects(EnEncount2* this, PlayState* play) { } void EnEncount2_DrawEffects(Actor* thisx, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; EnEncount2* this = (EnEncount2*)thisx; EnEncount2Effect* effect = this->effects; - GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; s32 objectSlot; diff --git a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c index 3417ca144..f36ea3256 100644 --- a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c +++ b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c @@ -315,6 +315,7 @@ void EnExRuppy_WaitToBlowUp(EnExRuppy* this, PlayState* play) { f32 distToBlowUp = 50.0f; s16 explosionScale; s16 explosionScaleStep; + s32 pad; if (this->type == 2) { distToBlowUp = 30.0f; diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 2b7f6bedd..fe2eadd28 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -48,8 +48,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040088, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 21, { { 1600, 0, 0 }, 5 }, 300 }, @@ -59,8 +59,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 12, { { 1600, 0, 0 }, 5 }, 400 }, @@ -70,8 +70,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 14, { { 800, 0, 0 }, 4 }, 300 }, @@ -81,8 +81,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 15, { { 1600, 0, 0 }, 4 }, 300 }, @@ -92,8 +92,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 16, { { 2000, 0, 0 }, 4 }, 300 }, @@ -103,8 +103,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 17, { { 800, 0, 0 }, 4 }, 300 }, @@ -114,8 +114,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 18, { { 1600, 0, 0 }, 4 }, 300 }, @@ -125,8 +125,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 19, { { 2000, 0, 0 }, 4 }, 300 }, @@ -136,8 +136,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 4, { { 2200, 0, 0 }, 4 }, 400 }, @@ -147,8 +147,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 4, { { 5000, 0, 0 }, 4 }, 300 }, @@ -158,8 +158,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 8, { { 2200, 0, 0 }, 4 }, 400 }, @@ -169,8 +169,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00040008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 8, { { 5000, 0, 0 }, 4 }, 300 }, @@ -283,7 +283,7 @@ s32 EnFd_ColliderCheck(EnFd* this, PlayState* play) { return false; } elem = &this->collider.elements[0].base; - if (elem->acHitElem != NULL && (elem->acHitElem->toucher.dmgFlags & DMG_HOOKSHOT)) { + if (elem->acHitElem != NULL && (elem->acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT)) { return false; } @@ -773,11 +773,11 @@ void EnFd_Draw(Actor* thisx, PlayState* play) { if (this->actionFunc != EnFd_Reappear && !(this->fadeAlpha < 0.9f)) { if (1) {} Gfx_SetupDL_25Xlu(play->state.gfxCtx); - clampedHealth = CLAMP(thisx->colChkInfo.health - 1, 0, 23); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, primColors[clampedHealth / 8].r, primColors[clampedHealth / 8].g, - primColors[clampedHealth / 8].b, (u8)this->fadeAlpha); - gDPSetEnvColor(POLY_XLU_DISP++, envColors[clampedHealth / 8].r, envColors[clampedHealth / 8].g, - envColors[clampedHealth / 8].b, (u8)this->fadeAlpha); + clampedHealth = CLAMP(thisx->colChkInfo.health - 1, 0, 23) / 8; + gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, primColors[clampedHealth].r, primColors[clampedHealth].g, + primColors[clampedHealth].b, (u8)this->fadeAlpha); + gDPSetEnvColor(POLY_XLU_DISP++, envColors[clampedHealth].r, envColors[clampedHealth].g, + envColors[clampedHealth].b, (u8)this->fadeAlpha); gSPSegment(POLY_XLU_DISP++, 0x8, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x40, 1, 0, 0xFF - (u8)(frames * 6), 8, 0x40)); @@ -875,9 +875,10 @@ void EnFd_DrawEffectsFlames(EnFd* this, PlayState* play) { static void* dustTextures[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, }; - s32 materialFlag; s16 i; s16 idx; + s16 pad; + s16 materialFlag; EnFdEffect* eff = this->effects; OPEN_DISPS(play->state.gfxCtx, "../z_en_fd.c", 1969); diff --git a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c index 6f836144e..d15f8c58a 100644 --- a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c +++ b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c @@ -37,8 +37,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x08 }, { 0x0D840008, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 12, 46, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index f48348162..8d0a8f2a6 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -69,8 +69,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK6, { 0x00100700, 0x03, 0x20 }, { 0x0D900700, 0x00, 0x00 }, - TOUCH_ON, - BUMP_ON, + ATELEM_ON, + ACELEM_ON, OCELEM_ON, }, { 20, 30, 10, { 0, 0, 0 } }, @@ -283,7 +283,6 @@ void EnFhgFire_LightningTrail(EnFhgFire* this, PlayState* play) { void EnFhgFire_LightningShock(EnFhgFire* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f pos; if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; @@ -291,7 +290,8 @@ void EnFhgFire_LightningShock(EnFhgFire* this, PlayState* play) { } if (Rand_ZeroOne() < 0.5f) { - pos = this->actor.world.pos; + Vec3f pos = this->actor.world.pos; + pos.y -= 20.0f; EffectSsFhgFlash_SpawnShock(play, &this->actor, &pos, 200, FHGFLASH_SHOCK_NO_ACTOR); } @@ -447,7 +447,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { Actor_SetScale(&this->actor, 5.25f); } this->actor.shape.rot.z += (s16)(Rand_ZeroOne() * 0x4E20) + 0x4000; - { + if (1) { u8 lightBallColor1 = FHGFLASH_LIGHTBALL_GREEN; s16 i1; Vec3f spD4; @@ -491,7 +491,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { (s16)(Rand_ZeroOne() * 25.0f) + 50, FHGFLASH_LIGHTBALL_GREEN); } canBottleReflect2 = canBottleReflect1; - if (!canBottleReflect2 && (acHitElem->toucher.dmgFlags & DMG_SHIELD)) { + if (!canBottleReflect2 && (acHitElem->atDmgInfo.dmgFlags & DMG_SHIELD)) { killMode = BALL_IMPACT; Audio_PlaySfxGeneral(NA_SE_IT_SHIELD_REFLECT_MG, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, @@ -527,7 +527,9 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { &gSfxDefaultReverb); Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); } - } else if (sqrtf(SQ(dxL) + SQ(dyL) + SQ(dzL)) <= 25.0f) { + break; + } + if (sqrtf(SQ(dxL) + SQ(dyL) + SQ(dzL)) <= 25.0f) { killMode = BALL_BURST; Actor_PlaySfx(&this->actor, NA_SE_EN_FANTOM_HIT_THUNDER); if ((bossGnd->flyMode >= GND_FLY_VOLLEY) && (this->work[FHGFIRE_RETURN_COUNT] >= 2)) { @@ -642,7 +644,6 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { void EnFhgFire_PhantomWarp(EnFhgFire* this, PlayState* play) { EnfHG* horse = (EnfHG*)this->actor.parent; - f32 scrollDirection; this->fwork[FHGFIRE_WARP_TEX_1_X] += 25.0f * this->fwork[FHGFIRE_WARP_TEX_SPEED]; this->fwork[FHGFIRE_WARP_TEX_1_Y] -= 40.0f * this->fwork[FHGFIRE_WARP_TEX_SPEED]; @@ -662,7 +663,8 @@ void EnFhgFire_PhantomWarp(EnFhgFire* this, PlayState* play) { } if (this->work[FHGFIRE_TIMER] > 50) { - scrollDirection = 1.0f; + f32 scrollDirection = 1.0f; + if (this->actor.params > FHGFIRE_WARP_EMERGE) { scrollDirection = -1.0f; } diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index 5a92f9128..cc5a1ff01 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -40,8 +40,8 @@ static ColliderCylinderInit D_80A12CA0 = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x09, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { 30, 30, -10, { 0, 0, 0 } }, @@ -60,8 +60,8 @@ static ColliderCylinderInit D_80A12CCC = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { 30, 30, -10, { 0, 0, 0 } }, @@ -283,7 +283,8 @@ void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, PlayState* play) { } else { this->playerNearby = 0; } - if (BREG(0) != 0) { + + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); @@ -309,6 +310,7 @@ void EnFireRock_Update(Actor* thisx, PlayState* play) { s16 setCollision; Player* player = GET_PLAYER(play); Actor* playerActor = &GET_PLAYER(play)->actor; + f32 temp; if (this->timer2 != 0) { this->timer2--; @@ -319,8 +321,6 @@ void EnFireRock_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (this->type != FIRE_ROCK_CEILING_SPOT_SPAWNER) { - f32 temp; - this->rockRotation.x += this->angularVelocity.x; this->rockRotation.y += this->angularVelocity.y; this->rockRotation.z += this->angularVelocity.z; diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index d48103610..760140aed 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -52,8 +52,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_ON, OCELEM_ON, }, { 1, { { 0, 1000, 0 }, 15 }, 100 }, @@ -118,7 +118,7 @@ static InitChainEntry sInitChain[] = { void EnFirefly_Extinguish(EnFirefly* this) { this->actor.params += 2; - this->collider.elements[0].base.toucher.effect = 0; // None + this->collider.elements[0].base.atDmgInfo.effect = 0; // None this->auraType = KEESE_AURA_NONE; this->onFire = false; this->actor.naviEnemyId = NAVI_ENEMY_KEESE; @@ -130,7 +130,7 @@ void EnFirefly_Ignite(EnFirefly* this) { } else { this->actor.params -= 2; } - this->collider.elements[0].base.toucher.effect = 1; // Fire + this->collider.elements[0].base.atDmgInfo.effect = 1; // Fire this->auraType = KEESE_AURA_FIRE; this->onFire = true; this->actor.naviEnemyId = NAVI_ENEMY_FIRE_KEESE; @@ -174,10 +174,10 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { } if (this->actor.params == KEESE_ICE_FLY) { - this->collider.elements[0].base.toucher.effect = 2; // Ice + this->collider.elements[0].base.atDmgInfo.effect = 2; // Ice this->actor.naviEnemyId = NAVI_ENEMY_ICE_KEESE; } else { - this->collider.elements[0].base.toucher.effect = 0; // Nothing + this->collider.elements[0].base.atDmgInfo.effect = 0; // Nothing this->actor.naviEnemyId = NAVI_ENEMY_KEESE; } @@ -287,8 +287,8 @@ void EnFirefly_SetupDisturbDiveAttack(EnFirefly* this) { this->skelAnime.playSpeed = 3.0f; this->actor.shape.rot.x = 0x1554; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - this->actor.speed = 3.0f; this->timer = 50; + this->actor.speed = 3.0f; this->actionFunc = EnFirefly_DisturbDiveAttack; } diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 051e5e1cb..e008be1d2 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -43,8 +43,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 5 }, 100 }, @@ -472,11 +472,11 @@ void EnFish_Dropped_FlopOnGround(EnFish* this, PlayState* play) { void EnFish_Dropped_SetupSwimAway(EnFish* this) { this->actor.home.pos = this->actor.world.pos; - this->actor.flags |= ACTOR_FLAG_4; - this->timer = 200; this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; this->actor.shape.yOffset = 0.0f; + this->actor.flags |= ACTOR_FLAG_4; + this->timer = 200; EnFish_SetInWaterAnimation(this); this->actionFunc = EnFish_Dropped_SwimAway; this->unk_250 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; @@ -624,6 +624,8 @@ void EnFish_UpdateCutscene(EnFish* this, PlayState* play) { f32 lerp; s32 bgId; + if (play) {} + if (cue == NULL) { // "Warning : DEMO ended without dousa (action) 3 termination being called" PRINTF("Warning : dousa 3 消滅 ãŒå‘¼ã°ã‚Œãšã«ãƒ‡ãƒ¢ãŒçµ‚了ã—ãŸ(%s %d)(arg_data 0x%04x)\n", "../z_en_sakana.c", 1169, diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index e1ed9d58e..41dd2cfdc 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -69,8 +69,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x04, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 25, 40, 0, { 0, 0, 0 } }, @@ -292,7 +292,7 @@ void EnFloormas_SetupSplit(EnFloormas* this) { ANIMMODE_ONCE, 0.0f); this->collider.dim.radius = sCylinderInit.dim.radius * 0.6f; this->collider.dim.height = sCylinderInit.dim.height * 0.6f; - this->collider.elem.bumperFlags &= ~BUMP_HOOKABLE; + this->collider.elem.acElemFlags &= ~ACELEM_HOOKABLE; this->actor.speed = 4.0f; this->actor.velocity.y = 7.0f; // using div creates a signed check. @@ -389,7 +389,7 @@ void EnFloormas_SetupSmallWait(EnFloormas* this) { void EnFloormas_SetupTakeDamage(EnFloormas* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gWallmasterDamageAnim, -3.0f); - if (this->collider.elem.acHitElem->toucher.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) { + if (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) { this->actor.world.rot.y = this->collider.base.ac->world.rot.y; } else { this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, this->collider.base.ac) + 0x8000; @@ -914,7 +914,7 @@ void EnFloormas_Merge(EnFloormas* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_4; EnFloormas_MakeVulnerable(this); this->actor.params = 0; - this->collider.elem.bumperFlags |= BUMP_HOOKABLE; + this->collider.elem.acElemFlags |= ACELEM_HOOKABLE; this->actor.colChkInfo.health = sColChkInfoInit.health; EnFloormas_SetupStand(this); } else { @@ -985,7 +985,7 @@ void EnFloormas_ColliderCheck(EnFloormas* this, PlayState* play) { if (this->actor.scale.x < 0.01f) { isSmall = true; } - if (isSmall && this->collider.elem.acHitElem->toucher.dmgFlags & DMG_HOOKSHOT) { + if (isSmall && this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT) { this->actor.colChkInfo.damage = 2; this->actor.colChkInfo.damageEffect = 0; } diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index c6d57d238..0046c8224 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -723,20 +723,17 @@ void EnFr_ListeningToOcarinaNotes(EnFr* this, PlayState* play) { } void EnFr_ChildSong(EnFr* this, PlayState* play) { - EnFr* frog; - u8 songIndex; - if (this->jumpCounter < 48) { if (this->jumpCounter % 4 == 0) { EnFr_SetupJumpingUp(this, sJumpOrder[(this->jumpCounter >> 2) & 7]); } } else { - songIndex = this->songIndex; - if (songIndex == FROG_STORMS) { + if (this->songIndex == FROG_STORMS) { this->actor.textId = 0x40AA; EnFr_SetupReward(this, play, false); - } else if (!FROG_HAS_SONG_BEEN_PLAYED(songIndex)) { - frog = sEnFrPointers.frogs[sSongToFrog[songIndex]]; + } else if (!FROG_HAS_SONG_BEEN_PLAYED(this->songIndex)) { + EnFr* frog = sEnFrPointers.frogs[sSongToFrog[this->songIndex]]; + Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); if (frog->actionFunc == EnFr_ChooseJumpFromLogSpot) { frog->isJumpingUp = true; @@ -800,10 +797,10 @@ void EnFr_CheckOcarinaInputFrogSong(u8 ocarinaNote) { void EnFr_DeactivateButterfly(void) { s32 frogIndex; - EnFr* frog; for (frogIndex = 0; frogIndex < ARRAY_COUNT(sEnFrPointers.frogs); frogIndex++) { - frog = sEnFrPointers.frogs[frogIndex]; + EnFr* frog = sEnFrPointers.frogs[frogIndex]; + frog->isButterflyDrawn = false; } } @@ -863,21 +860,18 @@ void EnFr_OcarinaMistake(EnFr* this, PlayState* play) { } void EnFr_ContinueFrogSong(EnFr* this, PlayState* play) { - s32 counter; - EnFr* frog; - s32 i; - if (this->frogSongTimer == 0) { EnFr_OcarinaMistake(this, play); } else { this->frogSongTimer--; if (play->msgCtx.msgMode == MSGMODE_FROGS_PLAYING) { - counter = 0; + s32 counter = 0; + s32 i; + for (i = 0; i < ARRAY_COUNT(sEnFrPointers.frogs); i++) { - frog = sEnFrPointers.frogs[i]; - if (frog != NULL && frog->actionFunc == EnFr_ChooseJumpFromLogSpot) { - continue; - } else { + EnFr* frog = sEnFrPointers.frogs[i]; + + if (frog == NULL || frog->actionFunc != EnFr_ChooseJumpFromLogSpot) { counter++; } } @@ -971,8 +965,6 @@ void EnFr_SetReward(EnFr* this, PlayState* play) { } void EnFr_Deactivate(EnFr* this, PlayState* play) { - EnFr* frogLoop1; - EnFr* frogLoop2; s32 frogIndex; // Originally was going to have separate butterfly actor @@ -983,28 +975,30 @@ void EnFr_Deactivate(EnFr* this, PlayState* play) { } for (frogIndex = 0; frogIndex < ARRAY_COUNT(sEnFrPointers.frogs); frogIndex++) { - frogLoop1 = sEnFrPointers.frogs[frogIndex]; - if (frogLoop1 == NULL) { + EnFr* frog = sEnFrPointers.frogs[frogIndex]; + + if (frog == NULL) { PRINTF(VT_COL(RED, WHITE)); // "There are no frogs!?" PRINTF("%s[%d]カエルãŒã„ãªã„ï¼ï¼Ÿ\n", "../z_en_fr.c", 1604); PRINTF(VT_RST); return; - } else if (frogLoop1->isDeactivating != true) { + } else if (frog->isDeactivating != true) { return; } } for (frogIndex = 0; frogIndex < ARRAY_COUNT(sEnFrPointers.frogs); frogIndex++) { - frogLoop2 = sEnFrPointers.frogs[frogIndex]; - if (frogLoop2 == NULL) { + EnFr* frog = sEnFrPointers.frogs[frogIndex]; + + if (frog == NULL) { PRINTF(VT_COL(RED, WHITE)); // "There are no frogs!?" PRINTF("%s[%d]カエルãŒã„ãªã„ï¼ï¼Ÿ\n", "../z_en_fr.c", 1618); PRINTF(VT_RST); return; } - frogLoop2->isDeactivating = false; + frog->isDeactivating = false; } play->msgCtx.ocarinaMode = OCARINA_MODE_04; @@ -1035,11 +1029,12 @@ void EnFr_SetIdle(EnFr* this, PlayState* play) { void EnFr_UpdateIdle(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; - if (BREG(0)) { + if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } + this->jumpCounter++; this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index aac5b16ae..9f1008485 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -53,8 +53,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 30, 40, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index 57b04ae52..4170af674 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -42,8 +42,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x04 }, { 0xFFCFFFFE, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 2, { { 1200, 0, 0 }, 16 }, 100 }, @@ -139,7 +139,7 @@ s32 EnFw_CheckCollider(EnFw* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { elem = &this->collider.elements[0].base; - if (elem->acHitElem->toucher.dmgFlags & DMG_HOOKSHOT) { + if (elem->acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT) { this->lastDmgHook = true; } else { this->lastDmgHook = false; diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 8a67e84b5..3e4b6ec49 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -69,8 +69,8 @@ static ColliderCylinderInitType1 sCylinderInit1 = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0xFFCE0FDB, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 30, 80, 0, { 0, 0, 0 } }, @@ -88,8 +88,8 @@ static ColliderCylinderInitType1 sCylinderInit2 = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0x0001F024, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 35, 80, 0, { 0, 0, 0 } }, @@ -107,8 +107,8 @@ static ColliderCylinderInitType1 sCylinderInit3 = { ELEMTYPE_UNK0, { 0x20000000, 0x02, 0x08 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { 20, 30, -15, { 0, 0, 0 } }, @@ -256,6 +256,8 @@ void EnFz_Damaged(EnFz* this, PlayState* play, Vec3f* vec, s32 numEffects, f32 u f32 scale; s32 life; + accel.x = accel.z = 0.0f; + accel.y = -1.0f; primColor.r = 155; primColor.g = 255; primColor.b = 255; @@ -263,8 +265,6 @@ void EnFz_Damaged(EnFz* this, PlayState* play, Vec3f* vec, s32 numEffects, f32 u envColor.r = 200; envColor.g = 200; envColor.b = 200; - accel.x = accel.z = 0.0f; - accel.y = -1.0f; for (i = 0; i < numEffects; i++) { scale = Rand_CenteredFloat(0.3f) + 0.6f; @@ -476,10 +476,10 @@ void EnFz_MoveTowardsPlayer(EnFz* this, PlayState* play) { void EnFz_SetupAimForFreeze(EnFz* this) { this->state = 1; - this->timer = 40; - this->actionFunc = EnFz_AimForFreeze; this->speedXZ = 0.0f; this->actor.speed = 0.0f; + this->timer = 40; + this->actionFunc = EnFz_AimForFreeze; } void EnFz_AimForFreeze(EnFz* this, PlayState* play) { @@ -547,16 +547,16 @@ void EnFz_BlowSmoke(EnFz* this, PlayState* play) { void EnFz_SetupDespawn(EnFz* this, PlayState* play) { this->state = 0; + this->speedXZ = 0.0f; + this->actor.gravity = 0.0f; + this->actor.velocity.y = 0.0f; + this->actor.speed = 0.0f; this->updateBgInfo = true; this->isFreezing = false; this->isDespawning = true; this->actor.flags &= ~ACTOR_FLAG_0; this->isActive = false; this->timer = 60; - this->speedXZ = 0.0f; - this->actor.gravity = 0.0f; - this->actor.velocity.y = 0.0f; - this->actor.speed = 0.0f; Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x60); this->actionFunc = EnFz_Despawn; @@ -573,9 +573,9 @@ void EnFz_SetupMelt(EnFz* this) { this->isFreezing = false; this->isDespawning = true; this->actor.flags &= ~ACTOR_FLAG_0; - this->actionFunc = EnFz_Melt; this->actor.speed = 0.0f; this->speedXZ = 0.0f; + this->actionFunc = EnFz_Melt; } void EnFz_Melt(EnFz* this, PlayState* play) { @@ -859,10 +859,10 @@ void EnFz_UpdateIceSmoke(EnFz* this, PlayState* play) { } void EnFz_DrawEffects(EnFz* this, PlayState* play) { - EnFzEffect* effect = this->effects; s16 i; GraphicsContext* gfxCtx = play->state.gfxCtx; u8 materialFlag = 0; + EnFzEffect* effect = this->effects; OPEN_DISPS(gfxCtx, "../z_en_fz.c", 1384); @@ -872,7 +872,7 @@ void EnFz_DrawEffects(EnFz* this, PlayState* play) { if (effect->type > 0) { gDPPipeSync(POLY_XLU_DISP++); - if (!materialFlag) { + if (materialFlag == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFreezardSteamStartDL)); materialFlag++; } diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index 48ddb587d..a048b6b73 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -52,8 +52,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 13, 40, 0, { 0, 0, 0 } }, @@ -80,6 +80,8 @@ void EnGSwitch_Init(Actor* thisx, PlayState* play) { s32 pad; EnGSwitch* this = (EnGSwitch*)thisx; + if (play) {} + this->type = (this->actor.params >> 0xC) & 0xF; this->switchFlag = this->actor.params & 0x3F; this->numEffects = EN_GSWITCH_EFFECT_COUNT; @@ -135,7 +137,7 @@ void EnGSwitch_Init(Actor* thisx, PlayState* play) { this->actor.scale.x = 0.25f; this->actor.scale.y = 0.45f; this->actor.scale.z = 0.25f; - this->collider.elem.bumper.dmgFlags = DMG_ARROW; + this->collider.elem.acDmgInfo.dmgFlags = DMG_ARROW; this->objectId = OBJECT_TSUBO; this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, this->objectId); if (this->requiredObjectSlot < 0) { @@ -181,9 +183,9 @@ void EnGSwitch_Break(EnGSwitch* this, PlayState* play) { randPos.x = this->actor.world.pos.x + Rand_CenteredFloat(40.0f); randPos.y = this->actor.world.pos.y + 30.0f + Rand_CenteredFloat(35.0f); randPos.z = this->actor.world.pos.z + Rand_CenteredFloat(40.0f); - hitPos.x = this->collider.elem.bumper.hitPos.x; - hitPos.y = this->collider.elem.bumper.hitPos.y; - hitPos.z = this->collider.elem.bumper.hitPos.z; + hitPos.x = this->collider.elem.acDmgInfo.hitPos.x; + hitPos.y = this->collider.elem.acDmgInfo.hitPos.y; + hitPos.z = this->collider.elem.acDmgInfo.hitPos.z; EffectSsHitMark_SpawnCustomScale(play, EFFECT_HITMARK_WHITE, 700, &hitPos); if (this->type == ENGSWITCH_ARCHERY_POT) { velocity.y = 15.0f; @@ -443,7 +445,8 @@ void EnGSwitch_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } - if (BREG(0) && (this->type == ENGSWITCH_SILVER_TRACKER)) { + + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) && (this->type == ENGSWITCH_SILVER_TRACKER)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); @@ -456,6 +459,9 @@ void EnGSwitch_DrawPot(Actor* thisx, PlayState* play) { if (!this->broken) { OPEN_DISPS(play->state.gfxCtx, "../z_en_g_switch.c", 918); + + if (1) {} + Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_en_g_switch.c", 925), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -491,12 +497,12 @@ void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play) { void EnGSwitch_SpawnEffects(EnGSwitch* this, Vec3f* pos, s16 scale, s16 colorIdx) { EnGSwitchEffect* effect = this->effects; s16 i; + Vec3f baseVel; + f32 pitch; + f32 yaw; for (i = 0; i < this->numEffects; i++, effect++) { if (!effect->flag) { - Vec3f baseVel; - f32 pitch; - f32 yaw; effect->pos = *pos; effect->scale = scale; diff --git a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c index 0aea93667..2ccb862d6 100644 --- a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c +++ b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c @@ -391,14 +391,14 @@ void EnGanonMant_Draw(Actor* thisx, PlayState* play) { f32 diffHalfDist; f32 yDiff; f32 yaw; - Vec3f* rightPos; - Vec3f* leftPos; - s16 strandIdx; - Vec3f midpoint; - s16 nextStrandIdx; if (this->updateHasRun) { // Only run this if update has run since last draw + Vec3f* rightPos; + Vec3f* leftPos; + s16 strandIdx; + Vec3f midpoint; + s16 nextStrandIdx; // Choose endpoints if (this->attachRightArmTimer != 0.0f) { diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/src/overlays/actors/ovl_En_Gb/z_en_gb.c index 4ee2521ae..ad08fbdac 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -56,8 +56,8 @@ static ColliderCylinderInitType1 sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 40, 75, 0, { 0, 0, 0 } }, @@ -76,8 +76,8 @@ static ColliderCylinderInitType1 sBottlesCylindersInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 4, 20, 0, { 0, 0, 0 } }, @@ -94,8 +94,8 @@ static ColliderCylinderInitType1 sBottlesCylindersInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 4, 20, 0, { 0, 0, 0 } }, @@ -112,8 +112,8 @@ static ColliderCylinderInitType1 sBottlesCylindersInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 10, 20, 0, { 0, 0, 0 } }, @@ -183,6 +183,8 @@ void EnGb_Init(Actor* thisx, PlayState* play) { this->actionTimer = (s16)Rand_ZeroFloat(100.0f) + 100; for (i = 0; i < ARRAY_COUNT(sCagedSoulPositions); i++) { + s32 pad; + this->cagedSouls[i].infoIdx = (s32)Rand_ZeroFloat(30.0f) % 3; this->cagedSouls[i].unk_14.x = this->cagedSouls[i].translation.x = sCagedSoulPositions[i].x + this->dyna.actor.world.pos.x; @@ -280,6 +282,8 @@ void func_80A2F83C(EnGb* this, PlayState* play) { } } if (Actor_TalkOfferAccepted(&this->dyna.actor, play)) { + s32 pad; + switch (func_8002F368(play)) { case EXCH_ITEM_NONE: func_80A2F180(this); @@ -294,9 +298,7 @@ void func_80A2F83C(EnGb* this, PlayState* play) { this->actionFunc = func_80A2FA50; break; } - return; - } - if (this->dyna.actor.xzDistToPlayer < 100.0f) { + } else if (this->dyna.actor.xzDistToPlayer < 100.0f) { Actor_OfferTalkExchangeEquiCylinder(&this->dyna.actor, play, 100.0f, EXCH_ITEM_BOTTLE_POE); } } @@ -440,7 +442,6 @@ void EnGb_Draw(Actor* thisx, PlayState* play) { void EnGb_UpdateCagedSouls(EnGb* this, PlayState* play) { f32 temp_f20; - s16 rot; s32 i; for (i = 0; i < 4; i++) { @@ -499,12 +500,14 @@ void EnGb_UpdateCagedSouls(EnGb* this, PlayState* play) { this->cagedSouls[i].translation.y = this->cagedSouls[i].unk_14.y + temp_f20; this->cagedSouls[i].translation.z = this->cagedSouls[i].unk_14.z; } else if (i == 1) { - rot = this->dyna.actor.world.rot.y - 0x4000; + s16 rot = this->dyna.actor.world.rot.y - 0x4000; + this->cagedSouls[i].translation.x = this->cagedSouls[i].unk_14.x + Math_SinS(rot) * temp_f20; this->cagedSouls[i].translation.z = this->cagedSouls[i].unk_14.z + Math_CosS(rot) * temp_f20; this->cagedSouls[i].translation.y = this->cagedSouls[i].unk_14.y; } else { - rot = this->dyna.actor.world.rot.y + 0x4000; + s16 rot = this->dyna.actor.world.rot.y + 0x4000; + this->cagedSouls[i].translation.x = this->cagedSouls[i].unk_14.x + Math_SinS(rot) * temp_f20; this->cagedSouls[i].translation.z = this->cagedSouls[i].unk_14.z + Math_CosS(rot) * temp_f20; this->cagedSouls[i].translation.y = this->cagedSouls[i].unk_14.y; diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index cbd0d7284..405cfc066 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -64,8 +64,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000702, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 20, 40, 0, { 0, 0, 0 } }, 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 705faf604..40b2b9df5 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -80,8 +80,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x000007A2, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 20, 60, 0, { 0, 0, 0 } }, @@ -112,8 +112,8 @@ void EnGe2_ChangeAction(EnGe2* this, s32 i) { } void EnGe2_Init(Actor* thisx, PlayState* play) { - s32 pad; EnGe2* this = (EnGe2*)thisx; + s16 params = this->actor.params; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoPurpleSkel, NULL, this->jointTable, this->morphTable, 22); @@ -133,7 +133,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { this->actor.world.rot.z = 0; this->actor.shape.rot.z = 0; - switch (this->actor.params & 0xFF) { + switch (thisx->params & 0xFF) { case GE2_TYPE_PATROLLING: EnGe2_ChangeAction(this, GE2_ACTION_WALK); if (EnGe2_CheckCarpentersFreed()) { @@ -156,6 +156,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { break; default: ASSERT(0, "0", "../z_en_ge2.c", 418); + break; } this->stateFlags = 0; @@ -165,7 +166,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { this->actor.minVelocityY = -4.0f; this->actor.gravity = -1.0f; this->walkDirection = this->actor.world.rot.y; - this->walkDuration = ((this->actor.params & 0xFF00) >> 8) * 10; + this->walkDuration = ((thisx->params & 0xFF00) >> 8) * 10; } void EnGe2_Destroy(Actor* thisx, PlayState* play) { @@ -555,7 +556,7 @@ void EnGe2_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); } else if (this->collider.base.acFlags & AC_HIT) { if ((this->collider.elem.acHitElem != NULL) && - (this->collider.elem.acHitElem->toucher.dmgFlags & DMG_HOOKSHOT)) { + (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT)) { //! @bug duration parameter is larger than 255 which messes with the internal bitpacking of the colorfilter. //! Because of the duration being tracked as an unsigned byte it ends up being truncated to 144 Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 400); @@ -606,8 +607,9 @@ void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - if ((this->collider.base.acFlags & AC_HIT) && ((this->collider.elem.acHitElem == NULL) || - !(this->collider.elem.acHitElem->toucher.dmgFlags & DMG_HOOKSHOT))) { + if ((this->collider.base.acFlags & AC_HIT) && + ((this->collider.elem.acHitElem == NULL) || + !(this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT))) { this->actor.colorFilterTimer = 0; EnGe2_ChangeAction(this, GE2_ACTION_KNOCKEDOUT); this->timer = 100; 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 0f3e0d480..df33dc59e 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -43,8 +43,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000722, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 20, 50, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c index ea9772ca0..8ef486c42 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -94,8 +94,8 @@ static ColliderCylinderInit sBodyCylInit = { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 20, 50, 0, { 0, 0, 0 } }, @@ -107,8 +107,8 @@ static ColliderTrisElementInit sBlockTrisElementsInit[2] = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xFFC1FFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { -10.0f, 14.0f, 2.0f }, { -10.0f, -6.0f, 2.0f }, { 9.0f, 14.0f, 2.0f } } }, @@ -118,8 +118,8 @@ static ColliderTrisElementInit sBlockTrisElementsInit[2] = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xFFC1FFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { -10.0f, -6.0f, 2.0f }, { 9.0f, -6.0f, 2.0f }, { 9.0f, 14.0f, 2.0f } } }, @@ -152,8 +152,8 @@ static ColliderQuadInit sSwordQuadInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL | ATELEM_UNK7, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -274,7 +274,6 @@ s32 EnGeldB_ReactToPlayer(PlayState* play, EnGeldB* this, s16 arg2) { Actor* thisx = &this->actor; s16 angleToWall; s16 angleToLink; - Actor* bomb; angleToWall = thisx->wallYaw - thisx->shape.rot.y; angleToWall = ABS(angleToWall); @@ -306,22 +305,29 @@ s32 EnGeldB_ReactToPlayer(PlayState* play, EnGeldB* this, s16 arg2) { EnGeldB_SetupRollBack(this); return true; } - } else if ((bomb = Actor_FindNearby(play, thisx, -1, ACTORCAT_EXPLOSIVE, 80.0f)) != NULL) { - thisx->shape.rot.y = thisx->world.rot.y = thisx->yawTowardsPlayer; - if (((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (angleToWall < 0x2EE0)) || (bomb->id == ACTOR_EN_BOM_CHU)) { - if ((bomb->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(thisx, bomb) < 80.0f) && - ((s16)(thisx->shape.rot.y - (bomb->world.rot.y - 0x8000)) < 0x3E80)) { - EnGeldB_SetupJump(this); - return true; + } else { + Actor* bomb = Actor_FindNearby(play, thisx, -1, ACTORCAT_EXPLOSIVE, 80.0f); + + if (bomb != NULL) { + thisx->shape.rot.y = thisx->world.rot.y = thisx->yawTowardsPlayer; + if (((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (angleToWall < 0x2EE0)) || + (bomb->id == ACTOR_EN_BOM_CHU)) { + if ((bomb->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(thisx, bomb) < 80.0f) && + ((s16)(thisx->shape.rot.y - (bomb->world.rot.y - 0x8000)) < 0x3E80)) { + EnGeldB_SetupJump(this); + return true; + } else { + EnGeldB_SetupSidestep(this, play); + return true; + } } else { - EnGeldB_SetupSidestep(this, play); + EnGeldB_SetupRollBack(this); return true; } - } else { - EnGeldB_SetupRollBack(this); - return true; } - } else if (arg2) { + } + + if (arg2) { if (angleToLink >= 0x1B58) { EnGeldB_SetupSidestep(this, play); return true; diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index e05caa58f..7194d7ee2 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -79,6 +79,7 @@ ActorInit En_GirlA_InitVars = { /**/ NULL, }; +#if IS_DEBUG static char* sShopItemDescriptions[] = { "デクã®å®ŸÃ—5 ", // "Deku nut x5" "矢×30 ", // "Arrow x30" @@ -131,6 +132,7 @@ static char* sShopItemDescriptions[] = { "赤クスリ ", // "Red medicine" "赤クスリ " // "Red medicine" }; +#endif static s16 sMaskShopItems[8] = { ITEM_MASK_KEATON, ITEM_MASK_SPOOKY, ITEM_MASK_SKULL, ITEM_MASK_BUNNY_HOOD, @@ -895,12 +897,11 @@ void EnGirlA_Noop(EnGirlA* this, PlayState* play) { void EnGirlA_SetItemDescription(PlayState* play, EnGirlA* this) { ShopItemEntry* tmp = &shopItemEntries[this->actor.params]; s32 params = this->actor.params; - s32 maskId; - s32 isMaskFreeToBorrow; if ((this->actor.params >= SI_KEATON_MASK) && (this->actor.params <= SI_MASK_OF_TRUTH)) { - maskId = this->actor.params - SI_KEATON_MASK; - isMaskFreeToBorrow = false; + s32 maskId = this->actor.params - SI_KEATON_MASK; + s32 isMaskFreeToBorrow = false; + switch (this->actor.params) { case SI_KEATON_MASK: if (GET_ITEMGETINF(ITEMGETINF_38)) { diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index c0ee8b7cf..46f0a2ec0 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -50,8 +50,8 @@ static ColliderCylinderInitType1 sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 100, 120, 0, { 0, 0, 0 } }, 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 3ff17461f..f648a2f91 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -59,8 +59,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 20, 46, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 278c4679d..b5b699676 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -85,8 +85,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 40, 65, 0, { 0, 0, 0 } }, @@ -1344,7 +1344,7 @@ void EnGo2_GetItemAnimation(EnGo2* this, PlayState* play) { void EnGo2_SetupRolling(EnGo2* this, PlayState* play) { if ((this->actor.params & 0x1F) == GORON_CITY_ROLLING_BIG || (this->actor.params & 0x1F) == GORON_CITY_LINK) { - this->collider.elem.bumperFlags = BUMP_ON; + this->collider.elem.acElemFlags = ACELEM_ON; this->actor.speed = GET_INFTABLE(INFTABLE_11E) ? 6.0f : 3.6000001f; } else { this->actor.speed = 6.0f; @@ -1368,7 +1368,7 @@ void EnGo2_StopRolling(EnGo2* this, PlayState* play) { } } } else { - this->collider.elem.bumperFlags = BUMP_NONE; + this->collider.elem.acElemFlags = ACELEM_NONE; } this->actor.shape.rot = this->actor.world.rot; diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/src/overlays/actors/ovl_En_Goma/z_en_goma.c index a281827ae..1734511c5 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -67,8 +67,8 @@ static ColliderCylinderInit D_80A4B7A0 = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFDFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 15, 30, 10, { 0, 0, 0 } }, @@ -87,8 +87,8 @@ static ColliderCylinderInit D_80A4B7CC = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFDFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 15, 30, 10, { 0, 0, 0 } }, @@ -397,13 +397,13 @@ void EnGoma_SetupDead(EnGoma* this) { } void EnGoma_Dead(EnGoma* this, PlayState* play) { - Vec3f accel; - Vec3f pos; - SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speed, 1.0f, 2.0f); if (this->actionTimer == 2) { + Vec3f accel; + Vec3f pos; + pos.x = this->actor.world.pos.x; pos.y = (this->actor.world.pos.y + 5.0f) - 10.0f; pos.z = this->actor.world.pos.z; @@ -604,7 +604,6 @@ void EnGoma_LookAtPlayer(EnGoma* this, PlayState* play) { } void EnGoma_UpdateHit(EnGoma* this, PlayState* play) { - static Vec3f sShieldKnockbackVel = { 0.0f, 0.0f, 20.0f }; Player* player = GET_PLAYER(play); if (this->hurtTimer != 0) { @@ -624,7 +623,7 @@ void EnGoma_UpdateHit(EnGoma* this, PlayState* play) { this->colCyl2.base.acFlags &= ~AC_HIT; if (this->gomaType == ENGOMA_NORMAL) { - u32 dmgFlags = acHitElem->toucher.dmgFlags; + u32 dmgFlags = acHitElem->atDmgInfo.dmgFlags; if (dmgFlags & DMG_SHIELD) { if (this->actionFunc == EnGoma_Jump) { @@ -632,6 +631,8 @@ void EnGoma_UpdateHit(EnGoma* this, PlayState* play) { this->actor.velocity.y = 0.0f; this->actor.speed = -5.0f; } else { + static Vec3f sShieldKnockbackVel = { 0.0f, 0.0f, 20.0f }; + Matrix_RotateY(BINANG_TO_RAD_ALT(player->actor.shape.rot.y), MTXMODE_NEW); Matrix_MultVec3f(&sShieldKnockbackVel, &this->shieldKnockbackVel); this->invincibilityTimer = 5; diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 7742d2f57..a60d6e4e1 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -61,8 +61,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x20000000, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 58 }, 100 }, @@ -84,7 +84,13 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 60, MASS_HEAVY }; -static f32 sUnused[] = { 10.0f, 9.2f }; +static f32 sSpeeds[] = { 10.0f, 9.2f }; + +#if IS_DEBUG +#define EN_GOROIWA_SPEED(this) (R_EN_GOROIWA_SPEED * 0.01f) +#else +#define EN_GOROIWA_SPEED(this) sSpeeds[(this)->isInKokiri] +#endif void EnGoroiwa_UpdateCollider(EnGoroiwa* this) { static f32 yOffsets[] = { 0.0f, 59.5f }; @@ -129,10 +135,14 @@ s32 EnGoroiwa_Vec3fNormalize(Vec3f* ret, Vec3f* a) { void EnGoroiwa_SetSpeed(EnGoroiwa* this, PlayState* play) { if (play->sceneId == SCENE_KOKIRI_FOREST) { this->isInKokiri = true; +#if IS_DEBUG R_EN_GOROIWA_SPEED = 920; +#endif } else { this->isInKokiri = false; +#if IS_DEBUG R_EN_GOROIWA_SPEED = 1000; +#endif } } @@ -242,11 +252,13 @@ s32 EnGoroiwa_GetAscendDirection(EnGoroiwa* this, PlayState* play) { Vec3s* currentPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->currentWaypoint; if (nextPointPos->x == currentPointPos->x && nextPointPos->z == currentPointPos->z) { +#if IS_DEBUG if (nextPointPos->y == currentPointPos->y) { // "Error: Invalid path data (points overlap)" PRINTF("Error : ãƒ¬ãƒ¼ãƒ«ãƒ‡ãƒ¼ã‚¿ä¸æ­£(点ãŒé‡ãªã£ã¦ã„ã‚‹)"); PRINTF("(%s %d)(arg_data 0x%04x)\n", "../z_en_gr.c", 559, this->actor.params); } +#endif if (nextPointPos->y > currentPointPos->y) { return 1; @@ -299,7 +311,7 @@ s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, PlayState* play) { s32 pad; Vec3s* nextPointPos; - Math_StepToF(&this->actor.speed, R_EN_GOROIWA_SPEED * 0.01f, 0.3f); + Math_StepToF(&this->actor.speed, EN_GOROIWA_SPEED(this), 0.3f); Actor_UpdateVelocityXZGravity(&this->actor); path = &play->pathList[this->actor.params & 0xFF]; nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; @@ -322,7 +334,7 @@ s32 EnGoroiwa_Move(EnGoroiwa* this, PlayState* play) { nextPointPosF.x = nextPointPos->x; nextPointPosF.y = nextPointPos->y; nextPointPosF.z = nextPointPos->z; - Math_StepToF(&this->actor.speed, R_EN_GOROIWA_SPEED * 0.01f, 0.3f); + Math_StepToF(&this->actor.speed, EN_GOROIWA_SPEED(this), 0.3f); if (Math3D_Vec3fDistSq(&nextPointPosF, &this->actor.world.pos) < SQ(5.0f)) { Math_Vec3f_Diff(&nextPointPosF, &this->actor.world.pos, &posDiff); } else { @@ -346,7 +358,7 @@ s32 EnGoroiwa_MoveUpToNextWaypoint(EnGoroiwa* this, PlayState* play) { Path* path = &play->pathList[this->actor.params & 0xFF]; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; - Math_StepToF(&this->actor.velocity.y, (R_EN_GOROIWA_SPEED * 0.01f) * 0.5f, 0.18f); + Math_StepToF(&this->actor.velocity.y, EN_GOROIWA_SPEED(this) * 0.5f, 0.18f); this->actor.world.pos.x = nextPointPos->x; this->actor.world.pos.z = nextPointPos->z; return Math_StepToF(&this->actor.world.pos.y, nextPointPos->y, fabsf(this->actor.velocity.y)); @@ -435,7 +447,6 @@ void EnGoroiwa_UpdateRotation(EnGoroiwa* this, PlayState* play) { Vec3f rollAxis; Vec3f unitRollAxis; MtxF mtx; - Vec3f unusedDiff; if (this->stateFlags & ENGOROIWA_RETAIN_ROT_SPEED) { rollAngleDiff = this->prevRollAngleDiff; @@ -446,6 +457,8 @@ void EnGoroiwa_UpdateRotation(EnGoroiwa* this, PlayState* play) { rollAngleDiff *= this->rollRotSpeed; rollAxisPtr = &rollAxis; if (this->stateFlags & ENGOROIWA_RETAIN_ROT_SPEED) { + Vec3f unusedDiff; + /* * EnGoroiwa_GetPrevWaypointDiff has no side effects and its result goes unused, * its result was probably meant to be used instead of the actor's velocity in the 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 2563fd6ba..64e7dbfef 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -46,8 +46,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 21, 48, 0, { 0, 0, 0 } }, @@ -139,9 +139,15 @@ s32 func_80A4E3EC(EnGs* this, PlayState* play) { void func_80A4E470(EnGs* this, PlayState* play) { Player* player = GET_PLAYER(play); +#if IS_DEBUG bREG(15) = 0; +#endif + if (this->actor.xzDistToPlayer <= 100.0f) { +#if IS_DEBUG bREG(15) = 1; +#endif + if (this->unk_19D == 0) { player->stateFlags2 |= PLAYER_STATE2_23; if (player->stateFlags2 & PLAYER_STATE2_24) { @@ -285,19 +291,6 @@ void func_80A4EB3C(EnGs* this, PlayState* play) { } void func_80A4ED34(EnGs* this, PlayState* play) { - static Color_RGBA8 flashRed = { 255, 50, 50, 0 }; - static Color_RGBA8 flashBlue = { 50, 50, 255, 0 }; - static Color_RGBA8 baseWhite = { 255, 255, 255, 0 }; - static Vec3f dustAccel = { 0.0f, -0.3f, 0.0f }; - static Color_RGBA8 dustPrim = { 200, 200, 200, 128 }; - static Color_RGBA8 dustEnv = { 100, 100, 100, 0 }; - static Vec3f bomb2Velocity = { 0.0f, 0.0f, 0.0f }; - static Vec3f bomb2Accel = { 0.0f, 0.0f, 0.0f }; - u8 i; - Vec3f dustPos; - Vec3f dustVelocity; - Vec3f bomb2Pos; - if (this->unk_19F == 0) { this->unk_200 = 40; this->unk_19F++; @@ -312,6 +305,10 @@ void func_80A4ED34(EnGs* this, PlayState* play) { } if (this->unk_19F == 2) { + static Color_RGBA8 flashRed = { 255, 50, 50, 0 }; + static Color_RGBA8 flashBlue = { 50, 50, 255, 0 }; + static Color_RGBA8 baseWhite = { 255, 255, 255, 0 }; + this->unk_200--; Color_RGBA8_Copy(&this->flashColor, &baseWhite); if ((this->unk_200 < 80) && ((this->unk_200 % 20) < 8)) { @@ -337,7 +334,15 @@ void func_80A4ED34(EnGs* this, PlayState* play) { } if (this->unk_19F == 3) { + u8 i; + for (i = 0; i < 3; i++) { + static Vec3f dustAccel = { 0.0f, -0.3f, 0.0f }; + static Color_RGBA8 dustPrim = { 200, 200, 200, 128 }; + static Color_RGBA8 dustEnv = { 100, 100, 100, 0 }; + Vec3f dustPos; + Vec3f dustVelocity; + dustVelocity.x = Rand_CenteredFloat(15.0f); dustVelocity.y = Rand_ZeroFloat(-1.0f); dustVelocity.z = Rand_CenteredFloat(15.0f); @@ -362,6 +367,10 @@ void func_80A4ED34(EnGs* this, PlayState* play) { if (this->unk_19F == 4) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1); if (this->actor.bgCheckFlags & (BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING)) { + static Vec3f bomb2Velocity = { 0.0f, 0.0f, 0.0f }; + static Vec3f bomb2Accel = { 0.0f, 0.0f, 0.0f }; + Vec3f bomb2Pos; + bomb2Pos.x = this->actor.world.pos.x; bomb2Pos.y = this->actor.world.pos.y; bomb2Pos.z = this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Hata/z_en_hata.c b/src/overlays/actors/ovl_En_Hata/z_en_hata.c index 4e80c5a5a..dcf9aca99 100644 --- a/src/overlays/actors/ovl_En_Hata/z_en_hata.c +++ b/src/overlays/actors/ovl_En_Hata/z_en_hata.c @@ -40,8 +40,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000080, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE | ATELEM_SFX_NORMAL, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 16, 246, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index 905c1213c..fb4fbd167 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -10,7 +10,7 @@ #define FLAGS ACTOR_FLAG_4 -void EnHeishi1_Init(Actor* thisx, PlayState* play); +void EnHeishi1_Init(Actor* thisx, PlayState* play2); void EnHeishi1_Destroy(Actor* thisx, PlayState* play); void EnHeishi1_Update(Actor* thisx, PlayState* play); void EnHeishi1_Draw(Actor* thisx, PlayState* play); @@ -63,8 +63,8 @@ static s32 sBgCamIndices[] = { static s16 sWaypoints[] = { 0, 4, 1, 5, 2, 6, 3, 7 }; -void EnHeishi1_Init(Actor* thisx, PlayState* play) { - s32 pad; +void EnHeishi1_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; EnHeishi1* this = (EnHeishi1*)thisx; Vec3f rupeePos; s32 i; @@ -182,7 +182,7 @@ void EnHeishi1_Walk(EnHeishi1* this, PlayState* play) { Math_ApproachF(&this->headAngle, this->headAngleTarget, this->headTurnSpeedScale, this->headTurnSpeedMax); - if ((this->path == BREG(1)) && (BREG(0) != 0)) { + if (IS_ACTOR_DEBUG_ENABLED && (this->path == BREG(1)) && (BREG(0) != 0)) { PRINTF(VT_FGCOL(RED) " 種類 %d\n" VT_RST, this->path); PRINTF(VT_FGCOL(RED) " ã±ã™ %d\n" VT_RST, this->waypoint); PRINTF(VT_FGCOL(RED) " å転 %d\n" VT_RST, this->bodyTurnSpeed); @@ -300,7 +300,7 @@ void EnHeishi1_Wait(EnHeishi1* this, PlayState* play) { Math_ApproachF(&this->headAngle, this->headAngleTarget, this->headTurnSpeedScale, this->headTurnSpeedMax + this->headTurnSpeedMax); - if ((this->path == BREG(1)) && (BREG(0) != 0)) { + if (IS_ACTOR_DEBUG_ENABLED && (this->path == BREG(1)) && (BREG(0) != 0)) { PRINTF(VT_FGCOL(GREEN) " 種類 %d\n" VT_RST, this->path); PRINTF(VT_FGCOL(GREEN) " ã±ã™ %d\n" VT_RST, this->waypoint); PRINTF(VT_FGCOL(GREEN) " å転 %d\n" VT_RST, this->bodyTurnSpeed); @@ -490,7 +490,7 @@ void EnHeishi1_Draw(Actor* thisx, PlayState* play) { this); func_80033C30(&this->actor.world.pos, &matrixScale, 0xFF, play); - if ((this->path == BREG(1)) && (BREG(0) != 0)) { + if (IS_ACTOR_DEBUG_ENABLED && (this->path == BREG(1)) && (BREG(0) != 0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y + 100.0f, this->actor.world.pos.z, 17000, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index c7e05bc86..762fa5d6c 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -17,7 +17,7 @@ void EnHeishi2_Init(Actor* thisx, PlayState* play); void EnHeishi2_Destroy(Actor* thisx, PlayState* play); void EnHeishi2_Update(Actor* thisx, PlayState* play); -void EnHeishi2_Draw(Actor* thisx, PlayState* play); +void EnHeishi2_Draw(Actor* thisx, PlayState* play2); void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play); void EnHeishi2_DoNothing1(EnHeishi2* this, PlayState* play); @@ -75,8 +75,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 33, 40, 0, { 0, 0, 0 } }, @@ -389,7 +389,6 @@ void func_80A5399C(EnHeishi2* this, PlayState* play) { void func_80A53AD4(EnHeishi2* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 exchangeItemId; s16 yawDiffTemp; s16 yawDiff; @@ -400,8 +399,10 @@ void func_80A53AD4(EnHeishi2* this, PlayState* play) { this->actor.textId = 0x200E; } this->unk_300 = TEXT_STATE_DONE; + if (Actor_TalkOfferAccepted(&this->actor, play)) { - exchangeItemId = func_8002F368(play); + s32 exchangeItemId = func_8002F368(play); + if (exchangeItemId == EXCH_ITEM_ZELDAS_LETTER) { Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); player->actor.textId = 0x2010; @@ -410,12 +411,14 @@ void func_80A53AD4(EnHeishi2* this, PlayState* play) { } else if (exchangeItemId != EXCH_ITEM_NONE) { player->actor.textId = 0x200F; } - } else { - yawDiffTemp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - yawDiff = ABS(yawDiffTemp); - if (!(120.0f < this->actor.xzDistToPlayer) && (yawDiff < 0x4300)) { - Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 100.0f, EXCH_ITEM_ZELDAS_LETTER); - } + return; + } + + yawDiffTemp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + yawDiff = ABS(yawDiffTemp); + + if (!(120.0f < this->actor.xzDistToPlayer) && (yawDiff < 0x4300)) { + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 100.0f, EXCH_ITEM_ZELDAS_LETTER); } } @@ -834,9 +837,9 @@ void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_en_heishi2.c", 1777); } -void EnHeishi2_Draw(Actor* thisx, PlayState* play) { +void EnHeishi2_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = (PlayState*)play2; EnHeishi2* this = (EnHeishi2*)thisx; - Mtx* mtx; s32 linkChildObjectSlot; OPEN_DISPS(play->state.gfxCtx, "../z_en_heishi2.c", 1792); @@ -848,6 +851,8 @@ void EnHeishi2_Draw(Actor* thisx, PlayState* play) { if ((this->type == 5) && GET_INFTABLE(INFTABLE_77)) { linkChildObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_LINK_CHILD); if (linkChildObjectSlot >= 0) { + Mtx* mtx; + Matrix_Put(&this->mtxf_330); Matrix_Translate(-570.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(70), MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c index 1f33fb4b4..c38744ea2 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c @@ -50,8 +50,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 15, 70, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index b0a853b02..373d28ca9 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -48,8 +48,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 33, 40, 0, { 0, 0, 0 } }, @@ -211,6 +211,8 @@ void func_80A56614(EnHeishi4* this, PlayState* play) { } void func_80A5673C(EnHeishi4* this, PlayState* play) { + f32 frames; + if (GET_EVENTCHKINF(EVENTCHKINF_45)) { PRINTF(VT_FGCOL(YELLOW) " ☆☆☆☆☆ マスターソードç¥å…¥æ‰‹ï¼ ☆☆☆☆☆ \n" VT_RST); Actor_Kill(&this->actor); @@ -219,7 +221,7 @@ void func_80A5673C(EnHeishi4* this, PlayState* play) { this->unk_284 = 0; if (GET_EVENTCHKINF(EVENTCHKINF_80)) { if (!GET_INFTABLE(INFTABLE_6C)) { - f32 frames = Animation_GetLastFrame(&gEnHeishiDyingGuardAnim_00C444); + frames = Animation_GetLastFrame(&gEnHeishiDyingGuardAnim_00C444); Animation_Change(&this->skelAnime, &gEnHeishiDyingGuardAnim_00C444, 1.0f, 0.0f, (s16)frames, ANIMMODE_LOOP, -10.0f); this->actor.textId = 0x7007; diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c index c9007ebd9..08468d132 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c @@ -52,8 +52,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 18, 32, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index e55c65d34..403f92d92 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -221,7 +221,7 @@ void EnHoll_HorizontalVisibleNarrow(EnHoll* this, PlayState* play) { void EnHoll_HorizontalInvisible(EnHoll* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 useViewEye = gDebugCamEnabled || play->csCtx.state != CS_STATE_IDLE; + s32 useViewEye = IS_DEBUG_CAM_ENABLED || play->csCtx.state != CS_STATE_IDLE; Vec3f relSubjectPos; s32 isKokiriLayer8; f32 hollHalfWidth; @@ -256,14 +256,12 @@ void EnHoll_HorizontalInvisible(EnHoll* this, PlayState* play) { void EnHoll_VerticalDownBgCoverLarge(EnHoll* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 absYDistToPlayer = fabsf(this->actor.yDistToPlayer); - s32 transitionActorIndex; if (this->actor.xzDistToPlayer < ENHOLL_V_DOWN_RADIUS && // Nothing happens if `absYDistToPlayer > ENHOLL_V_DOWN_BGCOVER_YDIST`, // so this check may as well compare to ENHOLL_V_DOWN_BGCOVER_YDIST absYDistToPlayer < (ENHOLL_V_DOWN_BGCOVER_YDIST + 95.0f)) { - - transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor); + s32 transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor); if (absYDistToPlayer < ENHOLL_V_DOWN_LOAD_YDIST) { play->bgCoverAlpha = 255; @@ -295,8 +293,6 @@ void EnHoll_VerticalDownBgCoverLarge(EnHoll* this, PlayState* play) { void EnHoll_VerticalBgCover(EnHoll* this, PlayState* play) { f32 absYDistToPlayer; - s32 side; - s32 transitionActorIndex; if ((this->actor.xzDistToPlayer < ENHOLL_V_RADIUS) && (absYDistToPlayer = fabsf(this->actor.yDistToPlayer), absYDistToPlayer < ENHOLL_V_BGCOVER_BGCOVER_YDIST)) { @@ -309,8 +305,9 @@ void EnHoll_VerticalBgCover(EnHoll* this, PlayState* play) { } if (absYDistToPlayer > ENHOLL_V_BGCOVER_LOAD_YDIST) { - transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor); - side = (this->actor.yDistToPlayer > 0.0f) ? 0 : 1; + s32 transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor); + s32 side = (this->actor.yDistToPlayer > 0.0f) ? 0 : 1; + this->actor.room = play->transiActorCtx.list[transitionActorIndex].sides[side].room; if (this->actor.room != play->roomCtx.curRoom.num && func_8009728C(play, &play->roomCtx, this->actor.room)) { @@ -348,10 +345,6 @@ void EnHoll_VerticalInvisible(EnHoll* this, PlayState* play) { void EnHoll_HorizontalBgCoverSwitchFlag(EnHoll* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f relPlayerPos; - f32 orthogonalDistToPlayer; - s32 side; - s32 transitionActorIndex; if (!Flags_GetSwitch(play, ENHOLL_GET_SWITCH_FLAG(&this->actor))) { if (this->resetBgCoverAlpha) { @@ -359,15 +352,17 @@ void EnHoll_HorizontalBgCoverSwitchFlag(EnHoll* this, PlayState* play) { this->resetBgCoverAlpha = false; } } else { + Vec3f relPlayerPos; + f32 orthogonalDistToPlayer; + func_8002DBD0(&this->actor, &relPlayerPos, &player->actor.world.pos); orthogonalDistToPlayer = fabsf(relPlayerPos.z); if (ENHOLL_H_Y_MIN < relPlayerPos.y && relPlayerPos.y < ENHOLL_H_Y_MAX && fabsf(relPlayerPos.x) < ENHOLL_H_HALFWIDTH && orthogonalDistToPlayer < ENHOLL_H_SWITCHFLAG_BGCOVER_DEPTH) { + s32 transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor); this->resetBgCoverAlpha = true; - transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor); - play->bgCoverAlpha = 255 - (s32)((orthogonalDistToPlayer - ENHOLL_H_SWITCHFLAG_LOAD_DEPTH) * (255 / (ENHOLL_H_SWITCHFLAG_BGCOVER_DEPTH - ENHOLL_H_SWITCHFLAG_LOAD_DEPTH) + 0.8f)); @@ -378,7 +373,8 @@ void EnHoll_HorizontalBgCoverSwitchFlag(EnHoll* this, PlayState* play) { } if (orthogonalDistToPlayer < ENHOLL_H_SWITCHFLAG_LOAD_DEPTH) { - side = (relPlayerPos.z < 0.0f) ? 0 : 1; + s32 side = (relPlayerPos.z < 0.0f) ? 0 : 1; + this->actor.room = play->transiActorCtx.list[transitionActorIndex].sides[side].room; if (this->actor.room != play->roomCtx.curRoom.num && func_8009728C(play, &play->roomCtx, this->actor.room)) { diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index 5b9ecb221..8e3a20b26 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -66,8 +66,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK4, { 0x00000000, 0x00, 0x00 }, { 0x0001F824, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 23.0f, 8.5f }, { -23.0f, 0.0f, 8.5f }, { 0.0f, -23.0f, 8.5f } } }, @@ -77,8 +77,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x0001F824, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 23.0f, 8.5f }, { 0.0f, -23.0f, 8.5f }, { 23.0f, 0.0f, 8.5f } } }, @@ -111,8 +111,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00100000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_ON, OCELEM_ON, }, { 10, 25, 0, { 0, 0, 0 } }, 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 351b29267..43937fd02 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -91,8 +91,8 @@ static ColliderCylinderInit sCylinderInit1 = { ELEMTYPE_UNK0, { 0x00000400, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_ON, }, { 20, 70, 0, { 0, 0, 0 } }, @@ -111,8 +111,8 @@ static ColliderCylinderInit sCylinderInit2 = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 20, 70, 0, { 0, 0, 0 } }, @@ -124,8 +124,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x0001F824, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_NO_AT_INFO | BUMP_NO_DAMAGE | BUMP_NO_SWORD_SFX | BUMP_NO_HITMARK, + ATELEM_NONE, + ACELEM_ON | ACELEM_NO_AT_INFO | ACELEM_NO_DAMAGE | ACELEM_NO_SWORD_SFX | ACELEM_NO_HITMARK, OCELEM_ON, }, { 13, { { 0, 0, 0 }, 20 }, 100 }, @@ -529,14 +529,13 @@ void EnHorse_RotateToPoint(EnHorse* this, PlayState* play, Vec3f* pos, s16 turnA void EnHorse_UpdateIngoRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceInfo) { Vec3f curWaypointPos; Vec3f prevWaypointPos; - f32 playerDist; + s32 prevWaypoint; f32 sp50; s16 relPlayerYaw; f32 px; f32 pz; f32 d; f32 distSq; - s32 prevWaypoint; EnHorse_RaceWaypointPos(raceInfo->waypoints, this->curRaceWaypoint, &curWaypointPos); Math3D_RotateXZPlane(&curWaypointPos, raceInfo->waypoints[this->curRaceWaypoint].angle, &px, &pz, &d); @@ -559,14 +558,15 @@ void EnHorse_UpdateIngoRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceIn EnHorse_RotateToPoint(this, play, &curWaypointPos, 400); if (distSq < SQ(300.0f)) { - playerDist = this->actor.xzDistToPlayer; - if (playerDist < 130.0f || this->jntSph.elements[0].base.ocElemFlags & OCELEM_HIT) { + if (this->actor.xzDistToPlayer < 130.0f || this->jntSph.elements[0].base.ocElemFlags & OCELEM_HIT) { + s32 pad; + if (Math_SinS(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0.0f) { this->actor.world.rot.y -= 280; } else { this->actor.world.rot.y += 280; } - } else if (playerDist < 300.0f) { + } else if (this->actor.xzDistToPlayer < 300.0f) { if (Math_SinS(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0.0f) { this->actor.world.rot.y += 280; } else { @@ -1320,8 +1320,7 @@ void EnHorse_MountedTrot(EnHorse* this, PlayState* play) { } void EnHorse_StartGallopingInterruptable(EnHorse* this) { - this->noInputTimerMax = 0; - this->noInputTimer = 0; + this->noInputTimerMax = this->noInputTimer = 0; EnHorse_StartGalloping(this); } @@ -1334,8 +1333,7 @@ void EnHorse_StartGalloping(EnHorse* this) { } void EnHorse_MountedGallopReset(EnHorse* this) { - this->noInputTimerMax = 0; - this->noInputTimer = 0; + this->noInputTimerMax = this->noInputTimer = 0; this->action = ENHORSE_ACT_MOUNTED_GALLOP; this->animationIdx = ENHORSE_ANIM_GALLOP; this->unk_234 = 0; @@ -1498,8 +1496,7 @@ void EnHorse_Stopping(EnHorse* this, PlayState* play) { } void EnHorse_StartReversingInterruptable(EnHorse* this) { - this->noInputTimerMax = 0; - this->noInputTimer = 0; + this->noInputTimerMax = this->noInputTimer = 0; EnHorse_StartReversing(this); } @@ -1906,7 +1903,6 @@ void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) { void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { f32 distToPlayer; - f32 angleDiff; R_EPONAS_SONG_PLAYED = false; distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); @@ -1914,6 +1910,8 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { // First rotate if the player is behind if ((this->playerDir == PLAYER_DIR_BACK_R || this->playerDir == PLAYER_DIR_BACK_L) && (distToPlayer > 300.0f && !(this->stateFlags & ENHORSE_TURNING_TO_PLAYER))) { + f32 angleDiff; + this->animationIdx = ENHORSE_ANIM_REARING; this->stateFlags |= ENHORSE_TURNING_TO_PLAYER; this->angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); @@ -2182,6 +2180,8 @@ void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { f32 temp_f2; + Vec3s* jointTable; + f32 y; if (this->cutsceneFlags & 1) { EnHorse_CsMoveToPoint(this, play, cue); @@ -2210,9 +2210,6 @@ void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { } if (SkelAnime_Update(&this->skin.skelAnime) || (temp_f2 > 19.0f && this->actor.world.pos.y < (this->actor.floorHeight - this->actor.velocity.y) + 80.0f)) { - Vec3s* jointTable; - f32 y; - this->cutsceneFlags |= 1; Audio_PlaySfxGeneral(NA_SE_EV_HORSE_LAND, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -3411,8 +3408,9 @@ void EnHorse_UpdatePlayerDir(EnHorse* this, PlayState* play) { s16 angle; f32 s; f32 c; + Player* player = GET_PLAYER(play); - angle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; + angle = Actor_WorldYawTowardActor(&this->actor, &player->actor) - this->actor.world.rot.y; s = Math_SinS(angle); c = Math_CosS(angle); if (s > 0.8660254f) { // sin(60 degrees) diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index ed63cd139..53c09dc47 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -136,12 +136,14 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play) Player* player = GET_PLAYER(play); s32 i; EnHorse* ingoHorse; - EnHorse* horse; + Player* player2 = player; if ((this->startTimer > 50) && !(this->startFlags & INGORACE_SET_TIMER)) { this->startFlags |= INGORACE_SET_TIMER; Interface_SetTimer(0); } else if ((this->startTimer > 80) && (player->rideActor != NULL) && !(this->startFlags & INGORACE_PLAYER_MOVE)) { + EnHorse* horse; + this->startFlags |= INGORACE_PLAYER_MOVE; horse = (EnHorse*)player->rideActor; horse->inRace = 1; @@ -175,8 +177,6 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play) } if (this->result == INGORACE_NO_RESULT) { - Player* player2 = player; - if ((player2->rideActor != NULL) && (this->playerCheck[2] == 1) && AT_FINISH_LINE(player2->rideActor)) { this->playerFinish++; if (this->playerFinish > 0) { @@ -319,6 +319,8 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play s32 i; Player* player = GET_PLAYER(play); EnHorse* horse; + Player* player2 = player; + f32 dist; if (!(this->raceFlags & MALONRACE_PLAYER_ON_MARK) && AT_FINISH_LINE(player->rideActor)) { this->raceFlags |= MALONRACE_PLAYER_ON_MARK; @@ -330,10 +332,12 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play this->raceFlags |= MALONRACE_SET_TIMER; Interface_SetTimer(0); } else if ((this->startTimer > 80) && (player->rideActor != NULL) && !(this->raceFlags & MALONRACE_PLAYER_MOVE)) { - this->raceFlags |= MALONRACE_PLAYER_MOVE; - horse = (EnHorse*)player->rideActor; + EnHorse* rideHorse; - horse->inRace = 1; + this->raceFlags |= MALONRACE_PLAYER_MOVE; + rideHorse = (EnHorse*)player->rideActor; + + rideHorse->inRace = 1; } else if ((this->startTimer > 81) && !(this->raceFlags & MALONRACE_START_SFX)) { this->raceFlags |= MALONRACE_START_SFX; Audio_PlaySfxGeneral(NA_SE_SY_START_SHOT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -342,9 +346,6 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play this->startTimer++; if (this->result == MALONRACE_NO_RESULT) { - Player* player2 = player; - f32 dist; - for (i = 0; i < 16; i++) { if ((this->lapCount == 0) && (i >= 8)) { break; diff --git a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c index f8f6c7994..0b324c308 100644 --- a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c +++ b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c @@ -55,8 +55,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 40, 100, 0, { 0, 0, 0 } }, @@ -68,8 +68,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 13, { { 0, 0, 0 }, 20 }, 100 }, diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index 8c50ffc8d..698a02630 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -48,8 +48,8 @@ static ColliderCylinderInitType1 sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 20, 100, 0, { 0, 0, 0 } }, @@ -61,8 +61,8 @@ static ColliderJntSphElementInit sJntSphElementInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 13, { { 0, 0, 0 }, 10 }, 100 }, @@ -344,8 +344,6 @@ void func_80A6A068(EnHorseLinkChild* this, PlayState* play) { f32 distFromLink; s32 animationEnded; s32 newAnimationIdx; - f32 distFromHome; - f32 distLinkFromHome; func_80A69F5C(this, play); player = GET_PLAYER(play); @@ -369,8 +367,9 @@ void func_80A6A068(EnHorseLinkChild* this, PlayState* play) { animationEnded = SkelAnime_Update(&this->skin.skelAnime); if (animationEnded || (this->animationIdx == 1) || (this->animationIdx == 0)) { if (GET_EVENTCHKINF(EVENTCHKINF_TALKED_TO_CHILD_MALON_AT_RANCH)) { - distFromHome = Math3D_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos); - distLinkFromHome = Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &this->actor.home.pos); + f32 distFromHome = Math3D_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos); + f32 distLinkFromHome = Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &this->actor.home.pos); + if (distLinkFromHome > 250.0f) { if (distFromHome >= 300.0f) { newAnimationIdx = 4; diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index 01a1ebc24..443dcf15c 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -31,7 +31,7 @@ typedef enum { void EnHorseNormal_Init(Actor* thisx, PlayState* play); void EnHorseNormal_Destroy(Actor* thisx, PlayState* play); void EnHorseNormal_Update(Actor* thisx, PlayState* play); -void EnHorseNormal_Draw(Actor* thisx, PlayState* play); +void EnHorseNormal_Draw(Actor* thisx, PlayState* play2); void func_80A6B91C(EnHorseNormal* this, PlayState* play); void func_80A6BC48(EnHorseNormal* this); @@ -70,8 +70,8 @@ static ColliderCylinderInit sCylinderInit1 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 40, 100, 0, { 0, 0, 0 } }, @@ -90,8 +90,8 @@ static ColliderCylinderInit sCylinderInit2 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 60, 100, 0, { 0, 0, 0 } }, @@ -103,8 +103,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 11, { { 0, 0, 0 }, 20 }, 100 }, @@ -333,10 +333,10 @@ void EnHorseNormal_CycleAnimations(EnHorseNormal* this, PlayState* play) { void func_80A6BC48(EnHorseNormal* this) { this->action = HORSE_WANDER; this->animationIdx = 0; - this->unk_21C = 0; - this->unk_21E = 0; this->actor.speed = 0.0f; this->unk_218 = 0.0f; + this->unk_21C = 0; + this->unk_21E = 0; Animation_Change(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } @@ -484,10 +484,10 @@ void EnHorseNormal_Wander(EnHorseNormal* this, PlayState* play) { void func_80A6C4CC(EnHorseNormal* this) { this->action = HORSE_WAIT; this->animationIdx = 0; - this->unk_21C = 0; - this->unk_21E = 0; this->actor.speed = 0.0f; this->unk_218 = 0.0f; + this->unk_21C = 0; + this->unk_21E = 0; Animation_Change(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } @@ -516,11 +516,11 @@ void EnHorseNormal_Wait(EnHorseNormal* this, PlayState* play) { void func_80A6C6B0(EnHorseNormal* this) { this->action = HORSE_WAIT_CLONE; this->animationIdx = 0; + this->actor.speed = 0.0f; + this->unk_218 = 0.0f; this->unk_21C = 0; this->unk_21E = 0; this->actor.flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5; - this->actor.speed = 0.0f; - this->unk_218 = 0.0f; Animation_Change(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } @@ -648,9 +648,9 @@ void func_80A6CC88(PlayState* play, EnHorseNormal* this, Vec3f* arg2) { } } -void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { +void EnHorseNormal_Draw(Actor* thisx, PlayState* play2) { EnHorseNormal* this = (EnHorseNormal*)thisx; - Mtx* mtx2; + PlayState* play = (PlayState*)play2; OPEN_DISPS(play->state.gfxCtx, "../z_en_horse_normal.c", 2224); @@ -662,7 +662,7 @@ void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { if (this->action == HORSE_WAIT_CLONE) { MtxF skinMtx; - Mtx* mtx1; + Mtx* mtx; Vec3f clonePos = { 0.0f, 0.0f, 0.0f }; s16 cloneRotY; f32 distFromGround = this->actor.world.pos.y - this->actor.floorHeight; @@ -702,12 +702,12 @@ void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { this->actor.shape.rot.x, cloneRotY, this->actor.shape.rot.z, clonePos.x, (this->actor.shape.yOffset * this->actor.scale.y) + clonePos.y, clonePos.z); - mtx1 = SkinMatrix_MtxFToNewMtx(play->state.gfxCtx, &skinMtx); - if (mtx1 == NULL) { + mtx = SkinMatrix_MtxFToNewMtx(play->state.gfxCtx, &skinMtx); + if (mtx == NULL) { return; } gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPMatrix(POLY_OPA_DISP++, mtx1, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); func_800A63CC(&this->actor, play, &this->skin, NULL, NULL, true, 0, SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS | SKIN_DRAW_FLAG_CUSTOM_MATRIX); this->cloneCollider.dim.pos.x = clonePos.x; @@ -720,9 +720,9 @@ void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { temp_f0_4 = (1.0f - (distFromGround * 0.01f)) * this->actor.shape.shadowScale; Matrix_Scale(this->actor.scale.x * temp_f0_4, 1.0f, this->actor.scale.z * temp_f0_4, MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(cloneRotY), MTXMODE_APPLY); - mtx2 = MATRIX_NEW(play->state.gfxCtx, "../z_en_horse_normal.c", 2329); - if (mtx2 != NULL) { - gSPMatrix(POLY_XLU_DISP++, mtx2, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + mtx = MATRIX_NEW(play->state.gfxCtx, "../z_en_horse_normal.c", 2329); + if (mtx != NULL) { + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gHorseShadowDL); } } diff --git a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c index e3bd35ec3..e3da728e8 100644 --- a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c +++ b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c @@ -46,8 +46,8 @@ static ColliderCylinderInitType1 sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 40, 100, 0, { 0, 0, 0 } }, @@ -59,8 +59,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 13, { { 0, 0, 0 }, 20 }, 100 }, 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 7fb650ef7..09b1da8dd 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -43,8 +43,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 40, 40, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c index 5d402a3c4..d84e35c4e 100644 --- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c +++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c @@ -41,8 +41,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 40, 40, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index b0ae4a235..37e0666f3 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -57,8 +57,8 @@ static ColliderCylinderInit sColCylInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 20, 46, 0, { 0, 0, 0 } }, @@ -1106,8 +1106,6 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po u8 i; void* ptr; - if (1) {} - OPEN_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2170); if (limbIndex == 15) { @@ -1143,6 +1141,8 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po rot->z += Math_CosS(this->unk_23C[limbIndex]) * 200.0f; } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2228); return false; diff --git a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c index 10d4addae..a03d2cfd0 100644 --- a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c +++ b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c @@ -49,8 +49,8 @@ static ColliderCylinderInit sCylinderInitCapturableFlame = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 25, 80, 0, { 0, 0, 0 } }, @@ -69,8 +69,8 @@ static ColliderCylinderInit sCylinderInitDroppedFlame = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 12, 60, 0, { 0, 0, 0 } }, @@ -356,9 +356,13 @@ void EnIceHono_Update(Actor* thisx, PlayState* play) { sin156 = Math_SinS(this->unk_156); sin154 = Math_SinS(this->unk_154); intensity = (Rand_ZeroOne() * 0.05f) + ((sin154 * 0.125f) + (sin156 * 0.1f)) + 0.425f; + +#if IS_DEBUG if ((intensity > 0.7f) || (intensity < 0.2f)) { PRINTF("ã‚りãˆãªã„値(ratio = %f)\n", intensity); // "impossible value(ratio = %f)" } +#endif + Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, (s16)this->actor.world.pos.y + 10, this->actor.world.pos.z, (s32)(155.0f * intensity), (s32)(210.0f * intensity), (s32)(255.0f * intensity), 1400); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 618aaddfa..da82e0725 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -78,8 +78,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 25, 80, 0, { 0, 0, 0 } }, @@ -91,8 +91,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xFFC3FFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_NO_AT_INFO, + ATELEM_NONE, + ACELEM_ON | ACELEM_NO_AT_INFO, OCELEM_NONE, }, { { { -10.0f, 14.0f, 2.0f }, { -10.0f, -6.0f, 2.0f }, { 9.0f, 14.0f, 2.0f } } }, @@ -102,8 +102,8 @@ static ColliderTrisElementInit sTrisElementsInit[2] = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xFFC3FFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_NO_AT_INFO, + ATELEM_NONE, + ACELEM_ON | ACELEM_NO_AT_INFO, OCELEM_NONE, }, { { { -10.0f, -6.0f, 2.0f }, { 9.0f, -6.0f, 2.0f }, { 9.0f, 14.0f, 2.0f } } }, @@ -136,8 +136,8 @@ static ColliderQuadInit sQuadInit = { ELEMTYPE_UNK0, { 0x20000000, 0x00, 0x40 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL | ATELEM_UNK7, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -708,18 +708,13 @@ void EnIk_Die(EnIk* this, PlayState* play) { } void EnIk_UpdateDamage(EnIk* this, PlayState* play) { - f32 frames; - s16 pad; - u8 prevHealth; - s32 damageEffect; - Vec3f sparksPos; if ((this->unk_2F8 == 3) || (this->unk_2F8 == 2)) { return; } if (this->shieldCollider.base.acFlags & AC_BOUNCED) { - frames = Animation_GetLastFrame(&gIronKnuckleBlockAnim) - 2.0f; + f32 frames = Animation_GetLastFrame(&gIronKnuckleBlockAnim) - 2.0f; if (this->skelAnime.curFrame < frames) { this->skelAnime.curFrame = frames; @@ -728,7 +723,11 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { this->shieldCollider.base.acFlags &= ~AC_BOUNCED; this->bodyCollider.base.acFlags &= ~AC_HIT; } else if (this->bodyCollider.base.acFlags & AC_HIT) { - sparksPos = this->actor.world.pos; + s16 pad; + u8 prevHealth; + s32 damageEffect; + Vec3f sparksPos = this->actor.world.pos; + sparksPos.y += 50.0f; Actor_SetDropFlag(&this->actor, &this->bodyCollider.elem, true); @@ -1120,10 +1119,12 @@ s32 EnIk_UpdateSkelAnime(EnIk* this) { CsCmdActorCue* EnIk_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; - } else { - return NULL; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } + + return NULL; } void EnIk_SetStartPosRotFromCue(EnIk* this, PlayState* play, s32 cueChannel) { diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 7ffd18223..f41fd6fe1 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -49,8 +49,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 18, 46, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/src/overlays/actors/ovl_En_Insect/z_en_insect.c index 63d11a8b6..8d2bd997f 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -60,8 +60,8 @@ static ColliderJntSphElementInit sColliderItemInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 5 }, 100 }, diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index c89b0aef0..dd598c51f 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -51,9 +51,9 @@ static f32 D_80A7FA28[] = { 0.0f, 0.005f }; // the sizes of these arrays are very large and take up way more space than it needs to. // coincidentally the sizes are the same as the ID for NA_SE_EV_ROCK_BROKEN, which may explain a mistake that could // have been made here -static u16 sBreakSfxIds[0x2852] = { NA_SE_EV_ROCK_BROKEN, NA_SE_EV_WALL_BROKEN }; +static u16 sBreakSfxIds[] = { NA_SE_EV_ROCK_BROKEN, NA_SE_EV_WALL_BROKEN }; -static u8 sBreakSfxDurations[0x2852] = { 20, 40 }; +static u8 sBreakSfxDurations[] = { 20, 40 }; static EnIshiEffectSpawnFunc sFragmentSpawnFuncs[] = { EnIshi_SpawnFragmentsSmall, EnIshi_SpawnFragmentsLarge }; @@ -73,8 +73,8 @@ static ColliderCylinderInit sCylinderInits[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x4FC1FFFE, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 10, 18, -2, { 0, 0, 0 } }, @@ -92,8 +92,8 @@ static ColliderCylinderInit sCylinderInits[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x4FC1FFF6, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 55, 70, 0, { 0, 0, 0 } }, @@ -356,7 +356,7 @@ void EnIshi_Wait(EnIshi* this, PlayState* play) { EnIshi_SpawnBugs(this, play); } } else if ((this->collider.base.acFlags & AC_HIT) && (type == ROCK_SMALL) && - this->collider.elem.acHitElem->toucher.dmgFlags & (DMG_HAMMER | DMG_EXPLOSIVE)) { + this->collider.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_HAMMER | DMG_EXPLOSIVE)) { EnIshi_DropCollectible(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, sBreakSfxDurations[type], sBreakSfxIds[type]); sFragmentSpawnFuncs[type](this, play); diff --git a/src/overlays/actors/ovl_En_It/z_en_it.c b/src/overlays/actors/ovl_En_It/z_en_it.c index d12620916..39c0a913d 100644 --- a/src/overlays/actors/ovl_En_It/z_en_it.c +++ b/src/overlays/actors/ovl_En_It/z_en_it.c @@ -25,8 +25,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 40, 10, 0, { 0 } }, diff --git a/src/overlays/actors/ovl_En_Jj/z_en_jj.c b/src/overlays/actors/ovl_En_Jj/z_en_jj.c index 5411cab0d..9162737dc 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -42,7 +42,6 @@ ActorInit En_Jj_InitVars = { static s32 sUnused = 0; -#pragma asmproc recurse #include "z_en_jj_cutscene_data.inc.c" static s32 sUnused2[] = { 0, 0 }; @@ -60,8 +59,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000004, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 170, 150, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.inc.c b/src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.inc.c index 4f29c43c3..14331f81d 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.inc.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.inc.c @@ -5,154 +5,154 @@ static CutsceneData D_80A88164[] = { CS_BEGIN_CUTSCENE(26, 1629), CS_PLAYER_CUE_LIST(4), - CS_PLAYER_CUE(PLAYER_CUEID_5, 0, 240, 0x0000, 0x4000, 0x0000, -1732, 52, -44, -1732, 52, -44, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_3, 240, 255, 0x0000, 0x4000, 0x0000, -1732, 52, -44, -1732, 52, -44, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_6, 255, 285, 0x0000, 0x4000, 0x0000, -1732, 52, -44, -1732, 52, -44, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_32, 285, 300, 0x0000, 0xC000, 0x0000, -1732, 52, -44, -1537, 109, -44, 1.1393037e-29f, 0.0f, 1.4e-45f), + CS_PLAYER_CUE(PLAYER_CUEID_5, 0, 240, 0x0000, 0x4000, 0x0000, -1732, 52, -44, -1732, 52, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_3, 240, 255, 0x0000, 0x4000, 0x0000, -1732, 52, -44, -1732, 52, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_6, 255, 285, 0x0000, 0x4000, 0x0000, -1732, 52, -44, -1732, 52, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_32, 285, 300, 0x0000, 0xC000, 0x0000, -1732, 52, -44, -1537, 109, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), CS_ACTOR_CUE_LIST(68, 4), - CS_ACTOR_CUE(0x0001, 0, 234, 0x0000, 0x4000, 0x0000, -1665, 52, -44, -1665, 52, -44, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_ACTOR_CUE(0x0002, 234, 241, 0x41F8, 0x0000, 0x0000, -1665, 52, -44, -1603, 130, -47, 8.857142f, 11.142858f, -8.857142f), - CS_ACTOR_CUE(0x0002, 241, 280, 0x4031, 0x0000, 0x0000, -1603, 130, -47, -549, 130, -52, 27.02564f, 0.0f, -27.02564f), - CS_ACTOR_CUE(0x0003, 280, 300, 0x0000, 0x0000, 0x0000, -549, 130, -52, -549, 130, -52, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 234, 0x0000, 0x4000, 0x0000, -1665, 52, -44, -1665, 52, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_ACTOR_CUE(0x0002, 234, 241, 0x41F8, 0x0000, 0x0000, -1665, 52, -44, -1603, 130, -47, CS_FLOAT(0x410DB6DB, 8.857142f), CS_FLOAT(0x41324925, 11.142858f), CS_FLOAT(0xC10DB6DB, -8.857142f)), + CS_ACTOR_CUE(0x0002, 241, 280, 0x4031, 0x0000, 0x0000, -1603, 130, -47, -549, 130, -52, CS_FLOAT(0x41D83483, 27.02564f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xC1D83483, -27.02564f)), + CS_ACTOR_CUE(0x0003, 280, 300, 0x0000, 0x0000, 0x0000, -549, 130, -52, -549, 130, -52, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(67, 5), - CS_ACTOR_CUE(0x0001, 0, 93, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0003, 93, 121, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0001, 121, 146, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 146, 241, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0001, 241, 441, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 93, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 93, 121, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0001, 121, 146, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 146, 241, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0001, 241, 441, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(69, 3), - CS_ACTOR_CUE(0x0001, 0, 90, 0x0000, 0x0000, 0x0000, 0, -33, 9, 0, -33, 9, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 90, 330, 0x0000, 0x0000, 0x0000, 0, -33, 9, 0, -62, 22, 0.0f, -0.12083333f, 0.0f), - CS_ACTOR_CUE(0x0003, 330, 380, 0x0000, 0x0000, 0x0000, 0, -62, 22, 0, -62, 22, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 90, 0x0000, 0x0000, 0x0000, 0, -33, 9, 0, -33, 9, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 90, 330, 0x0000, 0x0000, 0x0000, 0, -33, 9, 0, -62, 22, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xBDF77777, -0.12083333f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 330, 380, 0x0000, 0x0000, 0x0000, 0, -62, 22, 0, -62, 22, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_MISC_LIST(1), CS_MISC(CS_MISC_STOP_CUTSCENE, 1095, 1161, 0x0000, 0x00000000, 0xFFFFFFD2, 0x00000000, 0xFFFFFFD0, 0xFFFFFFD2, 0x00000000, 0xFFFFFFD0, 0x00000000, 0x00000000, 0x00000000), CS_TRANSITION(CS_TRANS_TRIGGER_INSTANCE, 0, 10), CS_PLAYER_CUE_LIST(1), - CS_PLAYER_CUE(PLAYER_CUEID_53, 300, 1629, 0x0000, 0x0000, 0x0000, -1630, 52, -52, -1630, 52, -52, 0.0f, 0.0f, 0.0f), + CS_PLAYER_CUE(PLAYER_CUEID_53, 300, 1629, 0x0000, 0x0000, 0x0000, -1630, 52, -52, -1630, 52, -52, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_CAM_EYE_SPLINE(0, 1091), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1641, 95, -41, 0x015C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1641, 95, -41, 0x016D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1641, 95, -41, 0x017E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1641, 95, -41, 0x0223), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.399944f, -1641, 95, -41, 0x7065), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x015C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x016D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x017E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0223), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x7065), CS_CAM_EYE_SPLINE(60, 1151), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1532, 251, 222, 0x015C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1532, 251, 222, 0x016D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1532, 251, 222, 0x017E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1532, 251, 222, 0x0223), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.399944f, -1532, 251, 222, 0x7065), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x015C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x016D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x017E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x0223), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x7065), CS_CAM_EYE_SPLINE(90, 351), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1698, 382, 455, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1698, 382, 455, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1698, 382, 455, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1694, 380, 451, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 32.999897f, -1694, 380, 451, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 32.999897f, -1694, 380, 451, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 32.999897f, -1694, 380, 451, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 32.999897f, -1694, 380, 451, 0x0164), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 32.999897f, -1694, 380, 451, 0xAD78), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1698, 382, 455, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1698, 382, 455, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1698, 382, 455, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1694, 380, 451, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0x0164), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0xAD78), CS_CAM_EYE_SPLINE(220, 392), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1641, 95, -41, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1641, 95, -41, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1641, 95, -41, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1641, 95, -41, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1641, 95, -41, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1641, 95, -41, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.399944f, -1641, 95, -41, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0000), CS_CAM_EYE_SPLINE(240, 1331), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, -1810, 65, -15, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, -1810, 65, -15, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, -1810, 65, -15, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, -1810, 65, -15, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.599945f, -1810, 65, -15, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0xAC10), CS_CAM_EYE_SPLINE(280, 1371), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, -1531, 95, -7, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, -1531, 95, -7, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, -1531, 95, -7, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, -1531, 95, -7, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.599945f, -1531, 95, -7, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0xAC10), CS_CAM_EYE_SPLINE(310, 1421), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1717, 83, -59, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1717, 83, -59, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1649, 177, -59, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1533, 224, -59, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -1243, 180, -59, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -953, 71, -55, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -953, 71, -55, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, -953, 71, -55, 0x0164), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.399944f, -953, 71, -55, 0xAD78), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1717, 83, -59, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1717, 83, -59, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1649, 177, -59, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1533, 224, -59, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1243, 180, -59, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -953, 71, -55, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -953, 71, -55, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -953, 71, -55, 0x0164), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -953, 71, -55, 0xAD78), CS_CAM_EYE_SPLINE(355, 1466), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1830, 103, 18, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1830, 103, 18, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1830, 103, 18, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1830, 103, 18, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1830, 103, 18, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1830, 103, 18, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.600002f, -1830, 103, 18, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x0000), CS_CAM_AT_SPLINE(0, 1120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -1724, -5, -45, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -1724, -5, -45, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.399944f, -1724, -5, -45, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -1724, -5, -45, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.399944f, -1724, -5, -45, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0xAC10), CS_CAM_AT_SPLINE(60, 1180), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -1440, 241, 134, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -1440, 241, 134, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.399944f, -1440, 241, 134, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -1440, 241, 134, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.399944f, -1440, 241, 134, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0xAC10), CS_CAM_AT_SPLINE(90, 380), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -1610, 348, 373, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -1610, 348, 373, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 45.399944f, -1610, 348, 373, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 35.399906f, -1614, 338, 367, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 32.999897f, -1614, 338, 367, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 32.999897f, -1614, 338, 367, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 32.999897f, -1614, 338, 367, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 32.999897f, -1614, 338, 367, 0x0164), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 32.999897f, -1614, 338, 367, 0xAD78), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1610, 348, 373, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1610, 348, 373, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4235998B, 45.399944f), -1610, 348, 373, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x420D9981, 35.399906f), -1614, 338, 367, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0x0164), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0xAD78), CS_CAM_AT_SPLINE(220, 421), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -1724, -5, -45, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 70, 45.399944f, -1724, -5, -45, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, 45.399944f, -1724, -5, -45, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 6, 45.799946f, -1593, 150, -146, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -1531, 152, -75, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -1531, 152, -75, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.399944f, -1531, 152, -75, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 70, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 6, CS_FLOAT(0x42373325, 45.799946f), -1593, 150, -146, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1531, 152, -75, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1531, 152, -75, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1531, 152, -75, 0x0000), CS_CAM_AT_SPLINE(240, 1360), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, -1712, 74, -37, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, -1712, 74, -37, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.599945f, -1712, 74, -37, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, -1712, 74, -37, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.599945f, -1712, 74, -37, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0xAC10), CS_CAM_AT_SPLINE(280, 1400), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, -1619, 99, -50, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, -1619, 99, -50, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.599945f, -1619, 99, -50, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, -1619, 99, -50, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.599945f, -1619, 99, -50, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0xAC10), CS_CAM_AT_SPLINE(310, 1450), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x0B, 30, 90.9996f, -1610, 141, -59, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x09, 10, 90.79961f, -1599, 114, -57, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0xFC, 10, 90.39961f, -1528, 192, -54, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 90.59961f, -1427, 164, -54, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0xCB, 10, 90.39961f, -1138, 119, -37, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x20, 10, 90.39961f, -832, 50, -51, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.399944f, -836, 35, -51, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, -836, 35, -51, 0x0164), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.399944f, -836, 35, -51, 0xAD78), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x0B, 30, CS_FLOAT(0x42B5FFCC, 90.9996f), -1610, 141, -59, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x09, 10, CS_FLOAT(0x42B59966, 90.79961f), -1599, 114, -57, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0xFC, 10, CS_FLOAT(0x42B4CC9A, 90.39961f), -1528, 192, -54, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42B53300, 90.59961f), -1427, 164, -54, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0xCB, 10, CS_FLOAT(0x42B4CC9A, 90.39961f), -1138, 119, -37, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x20, 10, CS_FLOAT(0x42B4CC9A, 90.39961f), -832, 50, -51, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998B, 45.399944f), -836, 35, -51, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -836, 35, -51, 0x0164), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -836, 35, -51, 0xAD78), CS_CAM_AT_SPLINE(355, 1495), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -1706, 111, -6, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -1706, 111, -6, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.600002f, -1706, 111, -6, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.600002f, -1721, 82, -42, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 60.600002f, -1721, 82, -42, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -1721, 82, -42, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.600002f, -1721, 82, -42, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1706, 111, -6, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1706, 111, -6, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42726667, 60.600002f), -1706, 111, -6, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42726667, 60.600002f), -1721, 82, -42, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42726667, 60.600002f), -1721, 82, -42, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1721, 82, -42, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1721, 82, -42, 0x0000), CS_TRANSITION(CS_TRANS_BLACK_FILL_IN, 335, 342), CS_DESTINATION(CS_DEST_JABU_JABU, 345, 395), CS_ACTOR_CUE_LIST(62, 1), - CS_ACTOR_CUE(0x0001, 305, 494, 0x0000, 0x0000, 0x0000, -1399, 452, -53, -1399, 452, -53, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 305, 494, 0x0000, 0x0000, 0x0000, -1399, 452, -53, -1399, 452, -53, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_END(), }; // clang-format on diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index 9f1766c90..667ebf740 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -41,8 +41,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 30, 40, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index f8895308c..f6fcd43c6 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -88,8 +88,8 @@ void func_80A89A6C(EnJsjutan* this, PlayState* play) { Vtx* phi_s0_2; Vec3f sp108; Vec3f spFC; - Actor* actorProfessor; - Actor* actorBeanGuy; + f32 rotX; + f32 rotZ; f32 dxVtx; f32 dyVtx; f32 dzVtx; @@ -148,6 +148,9 @@ void func_80A89A6C(EnJsjutan* this, PlayState* play) { // Credits scene. The magic carpet man is friends with the bean guy and the lakeside professor. if ((gSaveContext.save.entranceIndex == ENTR_LON_LON_RANCH_0) && (gSaveContext.sceneLayer == 8)) { + Actor* actorProfessor; + Actor* actorBeanGuy; + isInCreditsScene = true; actorProfessor = play->actorCtx.actorLists[ACTORCAT_NPC].head; @@ -320,10 +323,6 @@ void func_80A89A6C(EnJsjutan* this, PlayState* play) { // Fancy math to smooth each part of the wave considering its neighborhood. for (i = 0; i < ARRAY_COUNT(sCarpetOddVtx); i++, carpetVtx++) { - f32 rotX; - f32 rotZ; - s32 pad; - // Carpet size is 12x12. if ((i % 12) == 11) { // Last column. j = i - 1; 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 e5913e48c..0d7cd9d83 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -35,8 +35,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_NONE | ACELEM_HOOKABLE, OCELEM_ON, }, { 20, 70, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index c24e366fe..a3dd8a23a 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -23,8 +23,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 20, 70, 0, { 0, 0, 0 } }, @@ -114,10 +114,13 @@ void EnKakasi2_Destroy(Actor* thisx, PlayState* play) { void func_80A90264(EnKakasi2* this, PlayState* play) { Player* player = GET_PLAYER(play); - this->unk_194++; + if (IS_ACTOR_DEBUG_ENABLED) { + this->unk_194++; + } - if ((BREG(1) != 0) && (this->actor.xzDistToPlayer < this->maxSpawnDistance.x) && + if (IS_DEBUG && (BREG(1) != 0) && (this->actor.xzDistToPlayer < this->maxSpawnDistance.x) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < this->maxSpawnDistance.y)) { + // debug feature? this->actor.draw = func_80A90948; Collider_InitCylinder(play, &this->collider); @@ -136,8 +139,10 @@ void func_80A90264(EnKakasi2* this, PlayState* play) { } else if ((this->actor.xzDistToPlayer < this->maxSpawnDistance.x) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < this->maxSpawnDistance.y) && GET_EVENTCHKINF(EVENTCHKINF_9C)) { + if (IS_ACTOR_DEBUG_ENABLED) { + this->unk_194 = 0; + } - this->unk_194 = 0; if (play->msgCtx.ocarinaMode == OCARINA_MODE_0B) { if (this->switchFlag >= 0) { Flags_SetSwitch(play, this->switchFlag); @@ -213,7 +218,8 @@ void EnKakasi2_Update(Actor* thisx, PlayState* play2) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - if (BREG(0) != 0) { + + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { if (BREG(5) != 0) { PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ this->actor.player_distance ☆☆☆☆☆ %f\n" VT_RST, this->actor.xzDistToPlayer); PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ this->hosei.x ☆☆☆☆☆ %f\n" VT_RST, this->maxSpawnDistance.x); diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h index 9309c1672..43c335d93 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.h @@ -12,7 +12,7 @@ typedef struct EnKakasi2 { /* 0x0000 */ Actor actor; /* 0x014C */ EnKakasi2ActionFunc actionFunc; /* 0x0150 */ SkelAnime skelAnime; - /* 0x0194 */ s16 unk_194; + /* 0x0194 */ s16 unk_194; // ENABLE_ACTOR_DEBUGGER /* 0x0196 */ s16 switchFlag; /* 0x0198 */ s16 unk_198; /* 0x019C */ Vec3f maxSpawnDistance; diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index 37b536f0b..669596dd8 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -39,8 +39,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 20, 70, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index d14687b63..dd9aecd4e 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -100,8 +100,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 20, 50, 5, { 0, 0, 0 } }, @@ -194,10 +194,14 @@ static u16 sCutFlags[] = { }; void EnKanban_SetFloorRot(EnKanban* this) { + f32 nx; + f32 ny; + f32 nz; + if (this->actor.floorPoly != NULL) { - f32 nx = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); - f32 ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); - f32 nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); + nx = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); + ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); + nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); this->floorRot.x = -Math_FAtan2F(-nz * ny, 1.0f); this->floorRot.z = Math_FAtan2F(-nx * ny, 1.0f); @@ -299,7 +303,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play2) { s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; u8 i; - if (acHitElem->toucher.dmgFlags & DMG_SLASH) { + if (acHitElem->atDmgInfo.dmgFlags & DMG_SLASH) { this->cutType = sCutTypes[player->meleeWeaponAnimation]; } else { this->cutType = CUT_POST; @@ -437,7 +441,6 @@ void EnKanban_Update(Actor* thisx, PlayState* play2) { f32 tempY; f32 tempZ; f32 tempYDistToWater; - u8 onGround; Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 50.0f, @@ -460,107 +463,112 @@ void EnKanban_Update(Actor* thisx, PlayState* play2) { this->actor.yDistToWater = tempYDistToWater; PRINTF(VT_RST); - onGround = (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); - if (this->spinXFlag) { - this->spinRot.x += this->spinVel.x; - this->spinVel.x -= 0x800; - if ((this->spinRot.x <= 0) && onGround) { - this->spinRot.x = 0; - this->spinVel.x = 0; + + if (1) { + u8 onGround = (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); + + if (this->spinXFlag) { + this->spinRot.x += this->spinVel.x; + this->spinVel.x -= 0x800; + if ((this->spinRot.x <= 0) && onGround) { + this->spinRot.x = 0; + this->spinVel.x = 0; + } + } else { + this->spinRot.x -= this->spinVel.x; + this->spinVel.x -= 0x800; + if ((this->spinRot.x >= 0) && onGround) { + this->spinRot.x = 0; + this->spinVel.x = 0; + } } - } else { - this->spinRot.x -= this->spinVel.x; - this->spinVel.x -= 0x800; - if ((this->spinRot.x >= 0) && onGround) { - this->spinRot.x = 0; - this->spinVel.x = 0; + if (this->spinVel.x < -0xC00) { + this->spinVel.x = -0xC00; } - } - if (this->spinVel.x < -0xC00) { - this->spinVel.x = -0xC00; - } - if (this->spinZFlag) { - this->spinRot.z += this->spinVel.z; - this->spinVel.z -= 0x800; - if ((this->spinRot.z <= 0) && onGround) { - this->spinRot.z = 0; - this->spinVel.z = 0; + if (this->spinZFlag) { + this->spinRot.z += this->spinVel.z; + this->spinVel.z -= 0x800; + if ((this->spinRot.z <= 0) && onGround) { + this->spinRot.z = 0; + this->spinVel.z = 0; + } + } else { + this->spinRot.z -= this->spinVel.z; + this->spinVel.z -= 0x800; + if ((this->spinRot.z >= 0) && onGround) { + this->spinRot.z = 0; + this->spinVel.z = 0; + } } - } else { - this->spinRot.z -= this->spinVel.z; - this->spinVel.z -= 0x800; - if ((this->spinRot.z >= 0) && onGround) { - this->spinRot.z = 0; - this->spinVel.z = 0; + if (this->spinVel.z < -0xC00) { + this->spinVel.z = -0xC00; + } + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + this->actor.speed *= -0.5f; + Actor_PlaySfx(&this->actor, NA_SE_EV_WOODPLATE_BOUND); + } + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { + this->actionState = ENKANBAN_WATER; + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_DROP_WATER); + this->bounceX = this->bounceZ = 0; + this->actor.world.pos.y += this->actor.yDistToWater; + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 0, (this->partCount * 20) + 300); + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 150, 650, 0); + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 300, 800, 5); + this->actor.velocity.y = 0.0f; + this->actor.gravity = 0.0f; + PRINTF(" WAT Y = %f\n", this->actor.yDistToWater); + PRINTF(" POS Y = %f\n", this->actor.world.pos.y); + PRINTF(" GROUND Y = %f\n", this->actor.floorHeight); + break; + } + + if (onGround) { + if (this->bounceCount <= 0) { + this->bounceCount++; + this->actor.velocity.y *= -0.3f; + this->actor.world.rot.y += (s16)Rand_CenteredFloat(16384.0f); + } else { + this->actor.velocity.y = 0.0f; + } + this->actor.speed *= 0.7f; + if ((this->spinRot.x == 0) && (this->bounceX != 0)) { + this->spinVel.x = this->bounceX * 0x200; + if (this->bounceX != 0) { + this->bounceX -= 5; + if (this->bounceX <= 0) { + this->bounceX = 0; + } + } + if (Rand_ZeroOne() < 0.5f) { + this->spinXFlag = true; + } else { + this->spinXFlag = false; + } + bounced = true; + } + if ((this->spinRot.z == 0) && (this->bounceZ != 0)) { + this->spinVel.z = this->bounceZ * 0x200; + if (this->bounceZ != 0) { + this->bounceZ -= 5; + if (this->bounceZ <= 0) { + this->bounceZ = 0; + } + } + if (Rand_ZeroOne() < 0.5f) { + this->spinZFlag = true; + } else { + this->spinZFlag = false; + } + bounced = true; + } + Math_ApproachS(&this->actor.shape.rot.x, this->direction * 0x4000, 1, 0x2000); + } else { + this->actor.shape.rot.y += this->spinVel.y; + this->actor.shape.rot.x += this->direction * 0x7D0; } - } - if (this->spinVel.z < -0xC00) { - this->spinVel.z = -0xC00; - } - if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - this->actor.speed *= -0.5f; - Actor_PlaySfx(&this->actor, NA_SE_EV_WOODPLATE_BOUND); - } - if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { - this->actionState = ENKANBAN_WATER; - Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_DROP_WATER); - this->bounceX = this->bounceZ = 0; - this->actor.world.pos.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 0, (this->partCount * 20) + 300); - EffectSsGRipple_Spawn(play, &this->actor.world.pos, 150, 650, 0); - EffectSsGRipple_Spawn(play, &this->actor.world.pos, 300, 800, 5); - this->actor.velocity.y = 0.0f; - this->actor.gravity = 0.0f; - PRINTF(" WAT Y = %f\n", this->actor.yDistToWater); - PRINTF(" POS Y = %f\n", this->actor.world.pos.y); - PRINTF(" GROUND Y = %f\n", this->actor.floorHeight); - break; } - if (onGround) { - if (this->bounceCount <= 0) { - this->bounceCount++; - this->actor.velocity.y *= -0.3f; - this->actor.world.rot.y += (s16)Rand_CenteredFloat(16384.0f); - } else { - this->actor.velocity.y = 0.0f; - } - this->actor.speed *= 0.7f; - if ((this->spinRot.x == 0) && (this->bounceX != 0)) { - this->spinVel.x = this->bounceX * 0x200; - if (this->bounceX != 0) { - this->bounceX -= 5; - if (this->bounceX <= 0) { - this->bounceX = 0; - } - } - if (Rand_ZeroOne() < 0.5f) { - this->spinXFlag = true; - } else { - this->spinXFlag = false; - } - bounced = true; - } - if ((this->spinRot.z == 0) && (this->bounceZ != 0)) { - this->spinVel.z = this->bounceZ * 0x200; - if (this->bounceZ != 0) { - this->bounceZ -= 5; - if (this->bounceZ <= 0) { - this->bounceZ = 0; - } - } - if (Rand_ZeroOne() < 0.5f) { - this->spinZFlag = true; - } else { - this->spinZFlag = false; - } - bounced = true; - } - Math_ApproachS(&this->actor.shape.rot.x, this->direction * 0x4000, 1, 0x2000); - } else { - this->actor.shape.rot.y += this->spinVel.y; - this->actor.shape.rot.x += this->direction * 0x7D0; - } if (bounced) { s16 dustCount; s16 j; diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index 523b04152..53fb55984 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -54,8 +54,8 @@ static ColliderCylinderInit sBodyColliderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 7, 25, 0, { 0, 0, 0 } }, @@ -74,8 +74,8 @@ static ColliderCylinderInit sHeadColliderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_NONE, OCELEM_ON, }, { 4, 25, 0, { 0, 0, 0 } }, @@ -125,7 +125,7 @@ void EnKarebaba_ResetCollider(EnKarebaba* this) { this->bodyCollider.dim.height = 25; this->bodyCollider.base.colType = COLTYPE_HARD; this->bodyCollider.base.acFlags |= AC_HARD; - this->bodyCollider.elem.bumper.dmgFlags = DMG_DEFAULT; + this->bodyCollider.elem.acDmgInfo.dmgFlags = DMG_DEFAULT; this->headCollider.dim.height = 25; } @@ -155,7 +155,7 @@ void EnKarebaba_SetupUpright(EnKarebaba* this) { Actor_SetScale(&this->actor, 0.01f); this->bodyCollider.base.colType = COLTYPE_HIT6; this->bodyCollider.base.acFlags &= ~AC_HARD; - this->bodyCollider.elem.bumper.dmgFlags = + this->bodyCollider.elem.acDmgInfo.dmgFlags = !LINK_IS_ADULT ? ((DMG_SWORD | DMG_BOOMERANG) & ~DMG_JUMP_MASTER) : (DMG_SWORD | DMG_BOOMERANG); this->bodyCollider.dim.radius = 15; this->bodyCollider.dim.height = 80; diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 3fbf93702..6436d55c0 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -55,8 +55,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 20, 46, 0, { 0, 0, 0 } }, @@ -957,7 +957,7 @@ s32 EnKo_AdultSaved(EnKo* this, PlayState* play) { void func_80A9877C(EnKo* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((play->csCtx.state != CS_STATE_IDLE) || gDebugCamEnabled) { + if ((play->csCtx.state != CS_STATE_IDLE) || (IS_DEBUG_CAM_ENABLED != 0)) { this->interactInfo.trackPos = play->view.eye; this->interactInfo.yOffset = 40.0f; if (ENKO_TYPE != ENKO_TYPE_CHILD_0) { @@ -1097,7 +1097,8 @@ void func_80A98DB4(EnKo* this, PlayState* play) { this->modelAlpha = 255.0f; return; } - if ((play->csCtx.state != CS_STATE_IDLE) || gDebugCamEnabled) { + + if (play->csCtx.state != CS_STATE_IDLE || IS_DEBUG_CAM_ENABLED != 0) { dist = Math_Vec3f_DistXYZ(&this->actor.world.pos, &play->view.eye) * 0.25f; } else { dist = this->actor.xzDistToPlayer; diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index 4dbfaeaca..3e6bbb6c7 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -68,8 +68,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x4FC00758, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 12, 44, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index 837f86f87..ce431636a 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -47,8 +47,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 80, 120, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c index 038bb1bf1..5de655778 100644 --- a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c +++ b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c @@ -37,8 +37,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK2, { 0x00000001, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 200, 200, 0, { 0 } }, diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index 4b20f4018..2bc483153 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -37,8 +37,8 @@ static ColliderCylinderInit D_80AA0420 = { ELEMTYPE_UNK2, { 0x00000001, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_ON, OCELEM_ON, }, { 200, 200, 0, { 0, 0, 0 } }, @@ -47,13 +47,6 @@ static ColliderCylinderInit D_80AA0420 = { static u32 D_80AA044C[] = { DMG_SPIN_MASTER, DMG_SPIN_KOKIRI, DMG_SPIN_GIANT }; static u32 D_80AA0458[] = { DMG_JUMP_MASTER, DMG_JUMP_KOKIRI, DMG_JUMP_GIANT }; -static u16 sSfxIds[] = { - NA_SE_IT_ROLLING_CUT_LV2, - NA_SE_IT_ROLLING_CUT_LV1, - NA_SE_IT_ROLLING_CUT_LV2, - NA_SE_IT_ROLLING_CUT_LV1, -}; - // Setup action void func_80A9EFE0(EnMThunder* this, EnMThunderActionFunc actionFunc) { this->actionFunc = actionFunc; @@ -97,7 +90,7 @@ void EnMThunder_Init(Actor* thisx, PlayState* play2) { player->stateFlags2 &= ~PLAYER_STATE2_17; this->unk_1CA = 1; - this->collider.elem.toucher.dmgFlags = D_80AA044C[this->unk_1C7]; + this->collider.elem.atDmgInfo.dmgFlags = D_80AA044C[this->unk_1C7]; this->unk_1C6 = 1; this->unk_1C9 = ((this->unk_1C7 == 1) ? 2 : 4); func_80A9EFE0(this, func_80A9F9B4); @@ -196,19 +189,30 @@ void func_80A9F408(EnMThunder* this, PlayState* play) { gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP; } if (player->unk_858 < 0.85f) { - this->collider.elem.toucher.dmgFlags = D_80AA044C[this->unk_1C7]; + this->collider.elem.atDmgInfo.dmgFlags = D_80AA044C[this->unk_1C7]; this->unk_1C6 = 1; this->unk_1C9 = ((this->unk_1C7 == 1) ? 2 : 4); } else { - this->collider.elem.toucher.dmgFlags = D_80AA0458[this->unk_1C7]; + this->collider.elem.atDmgInfo.dmgFlags = D_80AA0458[this->unk_1C7]; this->unk_1C6 = 0; this->unk_1C9 = ((this->unk_1C7 == 1) ? 4 : 8); } func_80A9EFE0(this, func_80A9F9B4); this->unk_1C4 = 8; - Audio_PlaySfxGeneral(sSfxIds[this->unk_1C6], &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + + { + static u16 sSfxIds[] = { + NA_SE_IT_ROLLING_CUT_LV2, + NA_SE_IT_ROLLING_CUT_LV1, + NA_SE_IT_ROLLING_CUT_LV2, + NA_SE_IT_ROLLING_CUT_LV1, + }; + + Audio_PlaySfxGeneral(sSfxIds[this->unk_1C6], &player->actor.projectedPos, 4, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + } + this->unk_1AC = 1.0f; return; } diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index a0da7b0cd..26795a516 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -48,8 +48,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 18, 46, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 626529198..d840a4b53 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -42,8 +42,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 18, 46, 0, { 0, 0, 0 } }, @@ -264,8 +264,8 @@ void func_80AA204C(EnMa2* this, PlayState* play) { Player* player = GET_PLAYER(play); if (player->stateFlags2 & PLAYER_STATE2_24) { - player->unk_6A8 = &this->actor; player->stateFlags2 |= PLAYER_STATE2_25; + player->unk_6A8 = &this->actor; Message_StartOcarina(play, OCARINA_ACTION_CHECK_EPONA); this->actionFunc = func_80AA20E4; } else if (this->actor.xzDistToPlayer < 30.0f + this->collider.dim.radius) { diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index e769d9366..2bbc18563 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -45,8 +45,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 18, 46, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index e3f40128a..b4913e56a 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -269,8 +269,8 @@ void EnMag_DrawTextureI8(Gfx** gfxP, void* texture, s16 texWidth, s16 texHeight, gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_I, G_IM_SIZ_8b, texWidth, texHeight, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, - G_TX_RENDERTILE, 0, 0, dsdx, dtdy); + gSPTextureRectangle(gfx++, WIDE_INCR(rectLeft, (u16)WIDE_GET_4_3) << 2, rectTop << 2, (rectLeft + rectWidth) << 2, + (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, WIDE_DIV(dsdx, WIDE_GET_RATIO), dtdy); *gfxP = gfx; } @@ -291,8 +291,9 @@ void EnMag_DrawEffectTextures(Gfx** gfxP, void* maskTex, void* effectTex, s16 ma gDPSetTileSize(gfx++, 1, 0, this->effectScroll & 0x7F, 31 << 2, (31 << 2) + (this->effectScroll & 0x7F)); } - gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, - G_TX_RENDERTILE, 0, 0, dsdx, dtdy); + gSPTextureRectangle(gfx++, WIDE_INCR(rectLeft, (u16)(WIDE_GET_16_9 * 10.0f)) << 2, rectTop << 2, + (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, + WIDE_DIV(dsdx, WIDE_GET_RATIO), dtdy); *gfxP = gfx; } @@ -334,7 +335,8 @@ void EnMag_DrawImageRGBA32(Gfx** gfxP, s16 centerX, s16 centerY, u8* source, u32 gDPLoadTile(gfx++, G_TX_LOADTILE, 0, 0, (width - 1) << 2, (textureHeight - 1) << 2); gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + (s32)width) << 2, - (rectTop + textureHeight) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + (rectTop + textureHeight) << 2, G_TX_RENDERTILE, 0, 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), + 1 << 10); curTexture += textureSize; rectTop += textureHeight; @@ -366,7 +368,7 @@ void EnMag_DrawCharTexture(Gfx** gfxP, u8* texture, s32 rectLeft, s32 rectTop) { G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + YREG(2)) << 2, (rectTop + YREG(2)) << 2, - G_TX_RENDERTILE, 0, 0, YREG(0), YREG(0)); + G_TX_RENDERTILE, 0, 0, WIDE_DIV(YREG(0), WIDE_GET_RATIO), YREG(0)); *gfxP = gfx; } @@ -413,7 +415,8 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { if ((s16)this->effectPrimLodFrac != 0) { for (k = 0, i = 0, rectTop = 0; i < 3; i++, rectTop += 64) { - for (j = 0, rectLeft = 56; j < 3; j++, k++, rectLeft += 64) { + for (j = 0, rectLeft = WIDE_INCR(56, (u16)(WIDE_GET_RATIO * 10.0f)); j < 3; + j++, k++, rectLeft += WIDE_INCR(64, -(u16)(WIDE_GET_16_9 * 10.0f))) { EnMag_DrawEffectTextures(&gfx, effectMaskTextures[k], gTitleFlameEffectTex, 64, 64, 32, 32, rectLeft, rectTop, 64, 64, 1024, 1024, 1, 1, k, this); } @@ -423,7 +426,7 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { gDPSetPrimColor(gfx++, 0, 0, 255, 255, 255, (s16)this->mainAlpha); if ((s16)this->mainAlpha != 0) { - EnMag_DrawImageRGBA32(&gfx, 152, 100, (u8*)gTitleZeldaShieldLogoMQTex, 160, 160); + EnMag_DrawImageRGBA32(&gfx, WIDE_INCR(152, 20), 100, (u8*)gTitleZeldaShieldLogoMQTex, 160, 160); } Gfx_SetupDL_39Ptr(&gfx); @@ -456,7 +459,7 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { gDPPipeSync(gfx++); gDPSetPrimColor(gfx++, 0, 0, 255, 255, 255, (s16)this->subAlpha); - EnMag_DrawImageRGBA32(&gfx, 174, 145, (u8*)gTitleMasterQuestSubtitleTex, 128, 32); + EnMag_DrawImageRGBA32(&gfx, WIDE_INCR(174, 10), 145, (u8*)gTitleMasterQuestSubtitleTex, 128, 32); } Gfx_SetupDL_39Ptr(&gfx); @@ -472,7 +475,8 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfx++, 78 << 2, 198 << 2, 238 << 2, 214 << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + gSPTextureRectangle(gfx++, WIDE_INCR((78 << 2), (u16)(WIDE_GET_RATIO * 100.0f)), 198 << 2, 238 << 2, 214 << 2, + G_TX_RENDERTILE, 0, 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); } if (gSaveContext.fileNum == 0xFEDC) { @@ -488,13 +492,13 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { 0); gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, textAlpha); - rectLeft = VREG(19) + 1; + rectLeft = WIDE_INCR(VREG(19) + 1, (WIDE_GET_16_9 * 10.0f)); for (i = 0; i < ARRAY_COUNT(noControllerFontIndices); i++) { EnMag_DrawCharTexture(&gfx, font->fontBuf + noControllerFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft, YREG(10) + 172); - rectLeft += VREG(21); + rectLeft += WIDE_MULT(VREG(21), WIDE_GET_RATIO); if (i == 1) { - rectLeft += VREG(23); + rectLeft += WIDE_MULT(VREG(23), WIDE_GET_RATIO); } } @@ -502,13 +506,13 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { gDPPipeSync(gfx++); gDPSetPrimColor(gfx++, 0, 0, 100, 255, 255, textAlpha); - rectLeft = VREG(19); + rectLeft = WIDE_INCR(VREG(19) + 1, (WIDE_GET_16_9 * 10.0f)); for (i = 0; i < ARRAY_COUNT(noControllerFontIndices); i++) { EnMag_DrawCharTexture(&gfx, font->fontBuf + noControllerFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft, YREG(10) + 171); - rectLeft += VREG(21); + rectLeft += WIDE_MULT(VREG(21), WIDE_GET_RATIO); if (i == 1) { - rectLeft += VREG(23); + rectLeft += WIDE_MULT(VREG(23), WIDE_GET_RATIO); } } } else if (this->copyrightAlpha >= 200.0f) { @@ -524,13 +528,13 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { 0); gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, textAlpha); - rectLeft = YREG(7) + 1; + rectLeft = WIDE_INCR(YREG(7) + 1, (WIDE_GET_4_3 * 10.0f)); for (i = 0; i < ARRAY_COUNT(pressStartFontIndices); i++) { EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft, YREG(10) + 172); - rectLeft += YREG(8); + rectLeft += WIDE_MULT(YREG(8), WIDE_GET_RATIO); if (i == 4) { - rectLeft += YREG(9); + rectLeft += WIDE_MULT(YREG(9), WIDE_GET_RATIO); } } @@ -538,13 +542,13 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { gDPPipeSync(gfx++); gDPSetPrimColor(gfx++, 0, 0, YREG(4), YREG(5), YREG(6), textAlpha); - rectLeft = YREG(7); + rectLeft = WIDE_INCR(YREG(7) + 1, (WIDE_GET_4_3 * 10.0f)); for (i = 0; i < ARRAY_COUNT(pressStartFontIndices); i++) { EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft, YREG(10) + 171); - rectLeft += YREG(8); + rectLeft += WIDE_MULT(YREG(8), WIDE_GET_RATIO); if (i == 4) { - rectLeft += YREG(9); + rectLeft += WIDE_MULT(YREG(9), WIDE_GET_RATIO); } } } diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 44f1e6433..92f3aac85 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -102,8 +102,8 @@ static ColliderCylinderInit sBodyColliderInit = { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 20, 70, 0, { 0, 0, 0 } }, @@ -115,8 +115,8 @@ static ColliderTrisElementInit sFrontShieldingTrisInit[2] = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE | BUMP_NO_AT_INFO, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO, OCELEM_NONE, }, { { { -10.0f, 14.0f, 2.0f }, { -10.0f, -6.0f, 2.0f }, { 9.0f, 14.0f, 2.0f } } }, @@ -126,8 +126,8 @@ static ColliderTrisElementInit sFrontShieldingTrisInit[2] = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE | BUMP_NO_AT_INFO, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO, OCELEM_NONE, }, { { { -10.0f, -6.0f, 2.0f }, { 9.0f, -6.0f, 2.0f }, { 9.0f, 14.0f, 2.0f } } }, @@ -160,8 +160,8 @@ static ColliderQuadInit sAttackColliderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -296,7 +296,7 @@ void EnMb_Init(Actor* thisx, PlayState* play) { this->actor.uncullZoneScale = 800.0f; this->actor.uncullZoneDownward = 1800.0f; this->playerDetectionRange = 710.0f; - this->attackCollider.elem.toucher.dmgFlags = DMG_UNBLOCKABLE; + this->attackCollider.elem.atDmgInfo.dmgFlags = DMG_UNBLOCKABLE; relYawFromPlayer = this->actor.world.rot.y - Math_Vec3f_Yaw(&this->actor.world.pos, &player->actor.world.pos); @@ -1052,13 +1052,13 @@ void EnMb_ClubDamaged(EnMb* this, PlayState* play) { } void EnMb_ClubDamagedWhileKneeling(EnMb* this, PlayState* play) { - s32 pad; - if (SkelAnime_Update(&this->skelAnime)) { if (this->timer3 != 0) { this->timer3--; if (this->timer3 == 0) { if (this->timer1 == 0) { + s32 pad; + Animation_Change(&this->skelAnime, &gEnMbClubStandUpAnim, 3.0f, 0.0f, Animation_GetLastFrame(&gEnMbClubStandUpAnim), ANIMMODE_ONCE_INTERP, 0.0f); this->timer1 = 1; diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 5b9a9c5cd..7d33ed89e 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -46,8 +46,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 36, 46, 0, { 0, 0, 0 } }, @@ -568,7 +568,7 @@ void func_80AAB158(EnMd* this, PlayState* play) { temp2 = 1; } - if ((play->csCtx.state != CS_STATE_IDLE) || gDebugCamEnabled) { + if ((play->csCtx.state != CS_STATE_IDLE) || IS_DEBUG_CAM_ENABLED) { this->interactInfo.trackPos = play->view.eye; this->interactInfo.yOffset = 40.0f; trackingMode = NPC_TRACKING_HEAD_AND_TORSO; diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index 7660cf4bc..d65a6f037 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -41,8 +41,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 30, 40, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index 6ad429adb..2375b5e6c 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -64,8 +64,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 18, 63, 0, { 0, 0, 0 } }, @@ -512,8 +512,6 @@ void EnMm_Draw(Actor* thisx, PlayState* play) { s32 pad; EnMm* this = (EnMm*)thisx; - if (0) {} - OPEN_DISPS(play->state.gfxCtx, "../z_en_mm.c", 1065); Gfx_SetupDL_25Opa(play->state.gfxCtx); @@ -560,6 +558,8 @@ void EnMm_Draw(Actor* thisx, PlayState* play) { } } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_mm.c", 1141); } diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index 8a683c462..74636b9e2 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -60,8 +60,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000004, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 18, 63, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.c b/src/overlays/actors/ovl_En_Mu/z_en_mu.c index 48df82e4e..d6a8f2af0 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.c +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.c @@ -30,8 +30,8 @@ static ColliderCylinderInit D_80AB0BD0 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 100, 70, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index ba8d1da1f..d411e0f24 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -70,8 +70,8 @@ static ColliderCylinderInitType1 sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 25, 80, 0, { 0, 0, 0 } }, @@ -83,9 +83,10 @@ static void* sEyeTextures[] = { gNabooruEyeClosedTex, }; +#if IS_DEBUG static s32 D_80AB4318 = 0; +#endif -#pragma asmproc recurse #include "z_en_nb_cutscene_data.inc.c" s32 EnNb_GetPath(EnNb* this) { @@ -193,6 +194,7 @@ void EnNb_UpdateEyes(EnNb* this) { } } +#if IS_DEBUG void func_80AB11EC(EnNb* this) { this->action = NB_ACTION_7; this->drawMode = NB_DRAW_NOTHING; @@ -220,6 +222,7 @@ void func_80AB1210(EnNb* this, PlayState* play) { } } } +#endif void func_80AB1284(EnNb* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2); @@ -231,7 +234,9 @@ s32 EnNb_UpdateSkelAnime(EnNb* this) { CsCmdActorCue* EnNb_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } return NULL; @@ -528,7 +533,9 @@ void EnNb_SetupLightOrb(EnNb* this, PlayState* play) { void EnNb_Hide(EnNb* this, PlayState* play) { EnNb_SetupHide(this, play); +#if IS_DEBUG func_80AB1210(this, play); +#endif } void EnNb_Fade(EnNb* this, PlayState* play) { @@ -536,7 +543,9 @@ void EnNb_Fade(EnNb* this, PlayState* play) { EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_CheckToFade(this, play); +#if IS_DEBUG func_80AB1210(this, play); +#endif } void EnNb_CreateLightOrb(EnNb* this, PlayState* play) { @@ -544,7 +553,9 @@ void EnNb_CreateLightOrb(EnNb* this, PlayState* play) { EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_SetupLightOrb(this, play); +#if IS_DEBUG func_80AB1210(this, play); +#endif } void EnNb_DrawTransparency(EnNb* this, PlayState* play) { @@ -1119,6 +1130,8 @@ void EnNb_CrawlspaceSpawnCheck(EnNb* this, PlayState* play) { this->action = NB_CROUCH_CRAWLSPACE; this->drawMode = NB_DRAW_DEFAULT; } else { + s32 pad; + EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsAnim, 0, 0.0f, 0); this->headTurnFlag = 1; this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -1208,6 +1221,8 @@ void EnNb_SetupIdleCrawlspace(EnNb* this, s32 animFinished) { void func_80AB3838(EnNb* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { + s32 pad; + this->action = NB_IN_DIALOG; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -1300,6 +1315,8 @@ void func_80AB3A7C(EnNb* this, PlayState* play, s32 animFinished) { void func_80AB3B04(EnNb* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { + s32 pad; + this->action = NB_ACTION_30; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -1470,6 +1487,8 @@ s32 EnNb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (this->headTurnFlag != 0) { if (limbIndex == NB_LIMB_TORSO) { + s32 pad; + rot->x += interactInfo->torsoRot.y; rot->y -= interactInfo->torsoRot.x; ret = false; diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb_cutscene_data.inc.c b/src/overlays/actors/ovl_En_Nb/z_en_nb_cutscene_data.inc.c index fc6743ef7..13614e7c3 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb_cutscene_data.inc.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb_cutscene_data.inc.c @@ -7,25 +7,25 @@ static CutsceneData D_80AB431C[] = { CS_UNK_DATA_LIST(0x00000020, 1), CS_UNK_DATA(0x00010000, 0x0BB80000, 0x00000000, 0x00000000, 0xFFFFFFFC, 0x00000002, 0x00000000, 0xFFFFFFFC, 0x00000002, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(31, 5), - CS_ACTOR_CUE(0x0001, 0, 501, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 501, 502, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0004, 502, 573, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 573, 621, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 82, 0, 0.0f, -2.7916667f, 0.0f), - CS_ACTOR_CUE(0x0003, 621, 3011, 0x0000, 0x0000, 0x0000, 0, 82, 0, 0, 82, 0, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 501, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 501, 502, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0004, 502, 573, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 573, 621, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 82, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xC032AAAB, -2.7916667f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 621, 3011, 0x0000, 0x0000, 0x0000, 0, 82, 0, 0, 82, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_PLAYER_CUE_LIST(3), - CS_PLAYER_CUE(PLAYER_CUEID_13, 0, 240, 0x0000, 0x1555, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 1.401298464324817e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 240, 461, 0x0000, 0x1555, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 1.401298464324817e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_19, 461, 1616, 0x0000, 0x9555, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 1.401298464324817e-45f), + CS_PLAYER_CUE(PLAYER_CUEID_13, 0, 240, 0x0000, 0x1555, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 240, 461, 0x0000, 0x1555, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_19, 461, 1616, 0x0000, 0x9555, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), CS_ACTOR_CUE_LIST(49, 1), - CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, -16, -121, 0, -16, -121, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, -16, -121, 0, -16, -121, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_LIGHT_SETTING_LIST(1), - CS_LIGHT_SETTING(0x0003, 0, 3000, 0x0000, 0x00000000, 0xFFFFFF9E, 0x00000000, 0x0000002F, 0xFFFFFF9E, 0x00000000, 0x0000002F), + CS_LIGHT_SETTING(0x0003, 0, 3000, 0x0000, 0x00000000, 0xFFFFFF9E, 0x00000000, 0x0000002F, 0xFFFFFF9E, 0x00000000, 0x0000002F, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(39, 1), - CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, 0, -2, 0, 0, -2, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, 0, -2, 0, 0, -2, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(40, 3), - CS_ACTOR_CUE(0x0001, 0, 145, 0x0000, 0x0000, 0x0000, -97, 6, -167, -97, 6, -167, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 145, 431, 0x0000, 0x0000, 0x0000, -97, 6, -167, -97, 6, -167, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0003, 431, 1399, 0x0000, 0x0000, 0x0000, -97, 6, -167, -97, 6, -167, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 145, 0x0000, 0x0000, 0x0000, -97, 6, -167, -97, 6, -167, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 145, 431, 0x0000, 0x0000, 0x0000, -97, 6, -167, -97, 6, -167, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 431, 1399, 0x0000, 0x0000, 0x0000, -97, 6, -167, -97, 6, -167, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_TRANSITION(CS_TRANS_GRAY_FILL_OUT, 500, 530), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 489, 499), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 765, 795), @@ -41,130 +41,130 @@ static CutsceneData D_80AB431C[] = { CS_TEXT_NONE(765, 825), CS_TEXT(0x6036, 825, 835, 0x0000, 0x0000, 0x0000), CS_ACTOR_CUE_LIST(62, 1), - CS_ACTOR_CUE(0x0004, 0, 3000, 0x0000, 0x0000, 0x0000, 50, 80, 56, 50, 80, 56, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0004, 0, 3000, 0x0000, 0x0000, 0x0000, 50, 80, 56, 50, 80, 56, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_DESTINATION(CS_DEST_DESERT_COLOSSUS_FROM_CHAMBER_OF_SAGES, 865, 907), CS_START_SEQ_LIST(1), CS_START_SEQ(NA_BGM_MEDALLION_GET, 575, 576, 0x0000, 0x00000000, 0xFFFFFFEF, 0x00000000, 0x00000034, 0xFFFFFFEF, 0x00000000, 0x00000034), CS_FADE_OUT_SEQ_LIST(1), CS_FADE_OUT_SEQ(CS_FADE_OUT_BGM_MAIN, 479, 529, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFC7, 0x0000005C, 0x00000000, 0xFFFFFFC7, 0x0000005C), CS_CAM_EYE_SPLINE(0, 366), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -269, 89, -454, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -269, 89, -454, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -269, 89, -454, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -223, 75, -377, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -92, 31, -157, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, 13, 15, 19, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, 49, 28, 77, 0x013F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, 74, 20, 122, 0x014E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 50.599964f, 74, 20, 122, 0x015F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 74, 20, 122, 0x0161), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 74, 20, 122, 0x300A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 74, 20, 122, 0x656F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.399944f, 74, 20, 122, 0x676F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -269, 89, -454, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -269, 89, -454, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -269, 89, -454, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -223, 75, -377, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -92, 31, -157, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), 13, 15, 19, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), 49, 28, 77, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), 74, 20, 122, 0x014E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x424A665D, 50.599964f), 74, 20, 122, 0x015F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 74, 20, 122, 0x0161), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 74, 20, 122, 0x300A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 74, 20, 122, 0x656F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 74, 20, 122, 0x676F), CS_CAM_EYE_SPLINE(263, 2484), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 62.004566f, 134, 19, 198, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 62.004566f, 134, 19, 198, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 62.004566f, 134, 43, 198, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 62.004566f, 133, 60, 197, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 62.004566f, 133, 60, 197, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 62.004566f, 133, 60, 197, 0x013D), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 62.004566f, 133, 60, 197, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x427804AD, 62.004566f), 134, 19, 198, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x427804AD, 62.004566f), 134, 19, 198, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x427804AD, 62.004566f), 134, 43, 198, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x427804AD, 62.004566f), 133, 60, 197, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x427804AD, 62.004566f), 133, 60, 197, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x427804AD, 62.004566f), 133, 60, 197, 0x013D), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x427804AD, 62.004566f), 133, 60, 197, 0x013F), CS_CAM_EYE_SPLINE(363, 1595), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.399925f, 116, 21, 45, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.399925f, 116, 21, 45, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.399925f, 116, 21, 45, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.399925f, 117, 24, 69, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.399925f, 105, 46, 117, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.399925f, 105, 46, 117, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.399925f, 105, 46, 117, 0x013F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 40.399925f, 105, 46, 117, 0x002E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42219986, 40.399925f), 116, 21, 45, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42219986, 40.399925f), 116, 21, 45, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42219986, 40.399925f), 116, 21, 45, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42219986, 40.399925f), 117, 24, 69, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42219986, 40.399925f), 105, 46, 117, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42219986, 40.399925f), 105, 46, 117, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42219986, 40.399925f), 105, 46, 117, 0x013F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42219986, 40.399925f), 105, 46, 117, 0x002E), CS_CAM_EYE_SPLINE(433, 1594), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, 139, 33, -108, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, 139, 33, -108, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, 140, 81, -109, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.599945f, 140, 252, -109, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 140, 252, -109, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 140, 252, -109, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 140, 252, -109, 0x013F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.600002f, 140, 252, -109, 0x002E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), 139, 33, -108, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), 139, 33, -108, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), 140, 81, -109, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), 140, 252, -109, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 140, 252, -109, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 140, 252, -109, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 140, 252, -109, 0x013F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 140, 252, -109, 0x002E), CS_CAM_EYE_SPLINE(498, 840), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 13, 854, 2, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 853, 5, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -3, 853, 5, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -9, 853, -6, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -2, 852, -17, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 852, -17, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 16, 852, -6, 0x013F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 852, 5, 0x002E), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -3, 851, 5, 0x0063), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 13, 854, 2, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 853, 5, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -3, 853, 5, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -9, 853, -6, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -2, 852, -17, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 852, -17, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 16, 852, -6, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 852, 5, 0x002E), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -3, 851, 5, 0x0063), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(574, 1755), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 33, -27, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 33, -27, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 68, -26, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x013F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 68.599945f, 0, 103, -26, 0x002E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 33, -27, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 33, -27, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 68, -26, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x013F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x002E), CS_CAM_AT_SPLINE(0, 395), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.800003f, -141, 51, -239, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.800003f, -141, 51, -239, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.800003f, -141, 52, -239, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.800003f, -96, 32, -164, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.800003f, 34, 19, 56, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.800003f, 138, 2, 230, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.800003f, 165, 22, 286, 0x013F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 35, 55.799984f, 181, 116, 315, 0x014E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 50.599964f, 175, 134, 305, 0x015F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 172, 142, 300, 0x0161), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 171, 142, 300, 0x300A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 171, 141, 299, 0x656F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.399944f, 171, 141, 299, 0x676F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42733334, 60.800003f), -141, 51, -239, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42733334, 60.800003f), -141, 51, -239, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42733334, 60.800003f), -141, 52, -239, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42733334, 60.800003f), -96, 32, -164, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42733334, 60.800003f), 34, 19, 56, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42733334, 60.800003f), 138, 2, 230, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42733334, 60.800003f), 165, 22, 286, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 35, CS_FLOAT(0x425F332F, 55.799984f), 181, 116, 315, 0x014E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x424A665D, 50.599964f), 175, 134, 305, 0x015F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 172, 142, 300, 0x0161), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 171, 142, 300, 0x300A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 171, 141, 299, 0x656F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 171, 141, 299, 0x676F), CS_CAM_AT_SPLINE(263, 2513), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 70, 62.004566f, -67, 36, 17, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 70, 62.004566f, -67, 32, 17, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 62.004566f, -66, 34, 18, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 62.004566f, -60, 24, 23, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 62.004566f, -60, 22, 23, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 62.004566f, -60, 19, 23, 0x013D), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 62.004566f, -60, 18, 23, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 70, CS_FLOAT(0x427804AD, 62.004566f), -67, 36, 17, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 70, CS_FLOAT(0x427804AD, 62.004566f), -67, 32, 17, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x427804AD, 62.004566f), -66, 34, 18, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x427804AD, 62.004566f), -60, 24, 23, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x427804AD, 62.004566f), -60, 22, 23, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x427804AD, 62.004566f), -60, 19, 23, 0x013D), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x427804AD, 62.004566f), -60, 18, 23, 0x013F), CS_CAM_AT_SPLINE(363, 1624), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.399925f, 34, 58, 269, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.399925f, 34, 58, 269, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 40.399925f, 34, 58, 269, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 40.399925f, 42, 74, 293, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 41, 40.399925f, 22, 93, 336, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 40.399925f, 22, 93, 336, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.399925f, 22, 93, 336, 0x013F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 40.399925f, 22, 93, 336, 0x002E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42219986, 40.399925f), 34, 58, 269, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42219986, 40.399925f), 34, 58, 269, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42219986, 40.399925f), 34, 58, 269, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42219986, 40.399925f), 42, 74, 293, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 41, CS_FLOAT(0x42219986, 40.399925f), 22, 93, 336, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42219986, 40.399925f), 22, 93, 336, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42219986, 40.399925f), 22, 93, 336, 0x013F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42219986, 40.399925f), 22, 93, 336, 0x002E), CS_CAM_AT_SPLINE(433, 1623), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, 4, 14, 108, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.599945f, 4, 14, 108, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 50.999966f, 4, 76, 108, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 70.599915f, 111, 501, -62, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.599915f, 111, 500, -62, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 70.599915f, 111, 500, -62, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.39992f, 111, 500, -62, 0x013F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 70.39992f, 111, 500, -62, 0x002E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), 4, 14, 108, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), 4, 14, 108, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x424BFFF7, 50.999966f), 4, 76, 108, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x428D3328, 70.599915f), 111, 501, -62, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428D3328, 70.599915f), 111, 500, -62, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x428D3328, 70.599915f), 111, 500, -62, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428CCCC2, 70.39992f), 111, 500, -62, 0x013F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x428CCCC2, 70.39992f), 111, 500, -62, 0x002E), CS_CAM_AT_SPLINE(498, 889), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 60.0f, 3, 6, -6, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, 60.0f, 3, 6, -6, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 50.999966f, 3, 6, -6, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 20.59985f, 3, 6, -6, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 51, 10.799838f, 3, 6, -6, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.399838f, 3, 6, -6, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.399838f, 3, 6, -6, 0x013F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.199839f, 3, 6, -6, 0x002E), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 50, 10.999838f, 3, 6, -6, 0x0063), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42700000, 60.0f), 3, 6, -6, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, CS_FLOAT(0x42700000, 60.0f), 3, 6, -6, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x424BFFF7, 50.999966f), 3, 6, -6, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x41A4CC7E, 20.59985f), 3, 6, -6, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 51, CS_FLOAT(0x412CCC23, 10.799838f), 3, 6, -6, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x412665BD, 10.399838f), 3, 6, -6, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x412665BD, 10.399838f), 3, 6, -6, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4123328A, 10.199839f), 3, 6, -6, 0x002E), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 50, CS_FLOAT(0x412FFF56, 10.999838f), 3, 6, -6, 0x0063), CS_CAM_AT_SPLINE_REL_TO_PLAYER(574, 1784), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 100, 5, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 101, 6, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 1, 99, 41, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 68.599945f, 0, 42, 16, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x013F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 68.599945f, 0, 42, 16, 0x002E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 100, 5, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 101, 6, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 1, 99, 41, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x013F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x002E), CS_END(), }; // clang-format on diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 51d3df4a4..09963b6e8 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -86,8 +86,8 @@ static ColliderCylinderInit sCylinderInit1 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 15, 25, 4, { 0, 0, 0 } }, @@ -106,8 +106,8 @@ static ColliderCylinderInit sCylinderInit2 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 15, 25, 4, { 0, 0, 0 } }, @@ -886,14 +886,9 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { Vec3f accel; s32 pad2; f32 scale; - Vec3f cam; f32 dist; - f32 camResult; - s32 pad3[10]; if (1) {} // Required to match - if (1) {} - if (1) {} this->unk_294++; @@ -914,10 +909,10 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { scale = Rand_ZeroFloat(6.0f) + 6.0f; if (this->unk_2A6 == 2 && this->unk_304 != 0) { - pos.y += 10; + pos.y += 10.0f; } if (this->unk_304 == 0) { - scale = Rand_ZeroFloat(2.0f) + 2; + scale = Rand_ZeroFloat(2.0f) + 2.0f; } vel.x = Rand_CenteredFloat(3.0f); @@ -933,42 +928,19 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { } EnNiw_UpdateEffects(this, play); - if (this->timer1 != 0) { - this->timer1--; - } - if (this->timer2 != 0) { - this->timer2--; - } - if (this->timer3 != 0) { - this->timer3--; - } - if (this->timer4 != 0) { - this->timer4--; - } - if (this->timer5 != 0) { - this->timer5--; - } - if (this->timer7 != 0) { - this->timer7--; - } - if (this->timer6 != 0) { - this->timer6--; - } - if (this->sfxTimer1 != 0) { - this->sfxTimer1--; - } - if (this->sfxTimer2 != 0) { - this->sfxTimer2--; - } - if (this->sfxTimer3 != 0) { - this->sfxTimer3--; - } - if (this->timer8 != 0) { - this->timer8--; - } - if (this->timer9 != 0) { - this->timer9--; - } + DECR(this->timer1); + DECR(this->timer2); + DECR(this->timer3); + DECR(this->timer4); + DECR(this->timer5); + DECR(this->timer7); + DECR(this->timer6); + DECR(this->sfxTimer1); + DECR(this->sfxTimer2); + DECR(this->sfxTimer3); + DECR(this->timer8); + DECR(this->timer9); + thisx->shape.rot = thisx->world.rot; thisx->shape.shadowScale = 15.0f; this->actionFunc(this, play); @@ -986,6 +958,10 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { UPDBGCHECKINFO_FLAG_4); } if (thisx->floorHeight <= BGCHECK_Y_MIN || thisx->floorHeight >= 32000.0f) { + Vec3f cam; + f32 camResult; + s32 pad3[10]; + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 上下? ☆☆☆☆☆ %f\n" VT_RST, thisx->floorHeight); cam.x = play->view.at.x - play->view.eye.x; cam.y = play->view.at.y - play->view.eye.y; diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c index b1dadf4c1..33c98d4f8 100644 --- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c +++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c @@ -44,8 +44,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 10, 30, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 847710b58..72c581218 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -11,7 +11,7 @@ void EnNiwLady_Destroy(Actor* thisx, PlayState* play); void EnNiwLady_Update(Actor* thisx, PlayState* play); void func_80AB9F24(EnNiwLady* this, PlayState* play); -void EnNiwLady_Draw(Actor* thisx, PlayState* play); +void EnNiwLady_Draw(Actor* thisx, PlayState* play2); void func_80ABA21C(EnNiwLady* this, PlayState* play); void func_80ABAD38(EnNiwLady* this, PlayState* play); void func_80ABA778(EnNiwLady* this, PlayState* play); @@ -59,8 +59,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 10, 10, 0, { 0, 0, 0 } }, @@ -199,6 +199,7 @@ void func_80ABA21C(EnNiwLady* this, PlayState* play) { void func_80ABA244(EnNiwLady* this, PlayState* play) { EnNiw* currentCucco; + s32 pad[2]; s32 phi_s1; this->cuccosInPen = 0; @@ -223,7 +224,7 @@ void func_80ABA244(EnNiwLady* this, PlayState* play) { } currentCucco = (EnNiw*)currentCucco->actor.next; } - if (BREG(7) != 0) { + if (IS_DEBUG && BREG(7) != 0) { this->cuccosInPen = BREG(7) - 1; } phi_s1 = this->cuccosInPen; @@ -358,13 +359,13 @@ void func_80ABA778(EnNiwLady* this, PlayState* play) { void func_80ABA878(EnNiwLady* this, PlayState* play) { Player* player = GET_PLAYER(play); - s8 playerExchangeItemId; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE)) { this->unk_26E = 11; } if (Actor_TalkOfferAccepted(&this->actor, play)) { - playerExchangeItemId = func_8002F368(play); + s8 playerExchangeItemId = func_8002F368(play); + if ((playerExchangeItemId == EXCH_ITEM_POCKET_CUCCO) && GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) { Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); player->actor.textId = sTradeItemTextIds[5]; @@ -379,9 +380,10 @@ void func_80ABA878(EnNiwLady* this, PlayState* play) { this->unk_26E = this->unk_27A + 21; this->actionFunc = !this->unk_273 ? func_80ABA778 : func_80ABA9B8; } - } else { - Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 50.0f, EXCH_ITEM_POCKET_CUCCO); + return; } + + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 50.0f, EXCH_ITEM_POCKET_CUCCO); } void func_80ABA9B8(EnNiwLady* this, PlayState* play) { @@ -573,10 +575,10 @@ s32 EnNiwLady_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 return false; } -void EnNiwLady_Draw(Actor* thisx, PlayState* play) { +void EnNiwLady_Draw(Actor* thisx, PlayState* play2) { static void* sEyeTextures[] = { gCuccoLadyEyeOpenTex, gCuccoLadyEyeHalfTex, gCuccoLadyEyeClosedTex }; EnNiwLady* this = (EnNiwLady*)thisx; - s32 pad; + PlayState* play = (PlayState*)play2; OPEN_DISPS(play->state.gfxCtx, "../z_en_niw_lady.c", 1347); if (this->unk_27E != 0) { diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 1e927ba11..1d05b78c3 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -47,8 +47,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_WOOD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_WOOD, + ACELEM_ON, OCELEM_ON, }, { 13, 13, 0, { 0 } }, @@ -120,7 +120,7 @@ void func_80ABBBA8(EnNutsball* this, PlayState* play) { this->collider.base.atFlags &= ~AT_TYPE_ENEMY & ~AT_BOUNCED & ~AT_HIT; this->collider.base.atFlags |= AT_TYPE_PLAYER; - this->collider.elem.toucher.dmgFlags = DMG_DEKU_STICK; + this->collider.elem.atDmgInfo.dmgFlags = DMG_DEKU_STICK; Matrix_MtxFToYXZRotS(&player->shieldMf, &sp4C, 0); this->actor.world.rot.y = sp4C.y + 0x8000; this->timer = 30; 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 c9909e977..a662e0240 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -47,8 +47,8 @@ static ColliderJntSphElementInit sJntSphElementInit = { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 10 }, 100 }, diff --git a/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/src/overlays/actors/ovl_En_Ny/z_en_ny.c index 0ec08037f..fd1332245 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -41,8 +41,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x04, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 15 }, 100 }, @@ -139,8 +139,8 @@ void EnNy_Init(Actor* thisx, PlayState* play) { PRINTF("ダミーニュウ イニシャル[ %d ] ï¼ï¼\n", this->actor.params); PRINTF("En_Ny_actor_move2[ %x ] ï¼ï¼\n", EnNy_UpdateUnused); this->actor.colChkInfo.mass = 0xFF; - this->collider.base.colType = COLTYPE_METAL; this->actor.update = EnNy_UpdateUnused; + this->collider.base.colType = COLTYPE_METAL; } } @@ -305,9 +305,9 @@ s32 EnNy_CollisionCheck(EnNy* this, PlayState* play) { } else { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - effectPos.x = this->collider.elements[0].base.bumper.hitPos.x; - effectPos.y = this->collider.elements[0].base.bumper.hitPos.y; - effectPos.z = this->collider.elements[0].base.bumper.hitPos.z; + effectPos.x = this->collider.elements[0].base.acDmgInfo.hitPos.x; + effectPos.y = this->collider.elements[0].base.acDmgInfo.hitPos.y; + effectPos.z = this->collider.elements[0].base.acDmgInfo.hitPos.z; if ((this->unk_1E0 == 0.25f) && (this->unk_1D4 == 0xFF)) { switch (this->actor.colChkInfo.damageEffect) { case 0xE: @@ -368,7 +368,6 @@ void EnNy_Update(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; f32 temp_f20; f32 temp_f22; - s32 i; this->timer++; temp_f20 = this->unk_1E0 - 0.25f; @@ -391,6 +390,8 @@ void EnNy_Update(Actor* thisx, PlayState* play) { this->unk_1F0 = temp_f22; this->actor.world.pos.y += temp_f22; if (EnNy_CollisionCheck(this, play) != 0) { + s32 i; + for (i = 0; i < 8; i++) { this->unk_1F8[i].x = (Rand_CenteredFloat(20.0f) + this->actor.world.pos.x); this->unk_1F8[i].y = (Rand_CenteredFloat(20.0f) + this->actor.world.pos.y); diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index d898af9d8..331d8c709 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -115,7 +115,8 @@ void EnOkarinaEffect_Update(Actor* thisx, PlayState* play) { EnOkarinaEffect* this = (EnOkarinaEffect*)thisx; this->actionFunc(this, play); - if (BREG(0) != 0) { + + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0xFF, 0, 0xFF, 0xFF, 4, play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index 70c2d33c6..ae781817e 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -110,7 +110,11 @@ void func_80ABEF2C(EnOkarinaTag* this, PlayState* play) { u16 ocarinaSong; player = GET_PLAYER(play); - this->unk_15A++; + + if (IS_ACTOR_DEBUG_ENABLED) { + this->unk_15A++; + } + if ((this->switchFlag >= 0) && (Flags_GetSwitch(play, this->switchFlag))) { this->actor.flags &= ~ACTOR_FLAG_0; } else { @@ -131,7 +135,9 @@ void func_80ABEF2C(EnOkarinaTag* this, PlayState* play) { this->actionFunc = func_80ABF0CC; } else if ((this->actor.xzDistToPlayer < (50.0f + this->interactRange) && ((fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 40.0f)))) { - this->unk_15A = 0; + if (IS_ACTOR_DEBUG_ENABLED) { + this->unk_15A = 0; + } player->unk_6A8 = &this->actor; } } @@ -186,7 +192,10 @@ void func_80ABF0CC(EnOkarinaTag* this, PlayState* play) { void func_80ABF28C(EnOkarinaTag* this, PlayState* play) { Player* player = GET_PLAYER(play); - this->unk_15A++; + if (IS_ACTOR_DEBUG_ENABLED) { + this->unk_15A++; + } + if ((this->ocarinaSong != 6) || (gSaveContext.save.info.scarecrowSpawnSongSet)) { if ((this->switchFlag >= 0) && Flags_GetSwitch(play, this->switchFlag)) { this->actor.flags &= ~ACTOR_FLAG_0; @@ -219,7 +228,9 @@ void func_80ABF28C(EnOkarinaTag* this, PlayState* play) { this->actionFunc = func_80ABF4C8; } else if ((this->actor.xzDistToPlayer < (50.0f + this->interactRange)) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 40.0f)) { - this->unk_15A = 0; + if (IS_ACTOR_DEBUG_ENABLED) { + this->unk_15A = 0; + } player->stateFlags2 |= PLAYER_STATE2_23; } } @@ -286,13 +297,17 @@ void func_80ABF708(EnOkarinaTag* this, PlayState* play) { this->actionFunc = func_80ABF7CC; } else { yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y; - this->unk_15A++; + + if (IS_ACTOR_DEBUG_ENABLED) { + this->unk_15A++; + } + if (!(this->actor.xzDistToPlayer > 120.0f)) { if (CHECK_QUEST_ITEM(QUEST_SONG_SUN)) { this->actor.textId = 0x5021; } yawDiffNew = ABS(yawDiff); - if (yawDiffNew < 0x4300) { + if (IS_ACTOR_DEBUG_ENABLED && yawDiffNew < 0x4300) { this->unk_15A = 0; Actor_OfferTalk(&this->actor, play, 70.0f); } @@ -318,7 +333,8 @@ void EnOkarinaTag_Update(Actor* thisx, PlayState* play) { EnOkarinaTag* this = (EnOkarinaTag*)thisx; this->actionFunc(this, play); - if (BREG(0) != 0) { + + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { if (this->unk_15A != 0) { if (!(this->unk_15A & 1)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h index 1192d0cfc..8a6f4bfa5 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.h @@ -16,7 +16,7 @@ typedef struct EnOkarinaTag { /* 0x0154 */ s16 switchFlag; /* 0x0156 */ char unk_156[0x2]; /* 0x0158 */ s16 unk_158; - /* 0x015A */ s16 unk_15A; + /* 0x015A */ s16 unk_15A; // ENABLE_ACTOR_DEBUGGER /* 0x015C */ f32 interactRange; } EnOkarinaTag; // size = 0x0160 diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag_cutscene_data.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag_cutscene_data.c index 1725be2f0..fe0ecb8ec 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag_cutscene_data.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag_cutscene_data.c @@ -6,23 +6,23 @@ CutsceneData D_80ABF9D0[] = { CS_BEGIN_CUTSCENE(4, 360), CS_DESTINATION(CS_DEST_KAKARIKO_VILLAGE_DRAIN_WELL, 200, 201), CS_CAM_EYE_SPLINE(0, 331), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 3100, 201, -100, 0x3235), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 3100, 201, -100, 0x3336), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 3100, 201, -100, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 3178, 201, 113, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 3178, 201, 113, 0x3235), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 3178, 201, 113, 0x3238), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 3178, 201, 113, 0x3639), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, 3178, 201, 113, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 3100, 201, -100, 0x3235), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 3100, 201, -100, 0x3336), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 3100, 201, -100, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 3178, 201, 113, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 3178, 201, 113, 0x3235), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 3178, 201, 113, 0x3238), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 3178, 201, 113, 0x3639), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 3178, 201, 113, 0x2C20), CS_CAM_AT_SPLINE(0, 360), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 3054, 137, -64, 0x3235), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 3054, 137, -64, 0x3336), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 90, 60.0f, 3054, 137, -64, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 90, 60.0f, 3118, 142, 96, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 3118, 142, 96, 0x3235), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 3118, 142, 96, 0x3238), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 3118, 142, 96, 0x3639), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.0f, 3118, 142, 96, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 3054, 137, -64, 0x3235), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 3054, 137, -64, 0x3336), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 90, CS_FLOAT(0x42700000, 60.0f), 3054, 137, -64, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 90, CS_FLOAT(0x42700000, 60.0f), 3118, 142, 96, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 3118, 142, 96, 0x3235), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 3118, 142, 96, 0x3238), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 3118, 142, 96, 0x3639), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 3118, 142, 96, 0x2C20), CS_MISC_LIST(1), CS_MISC(CS_MISC_SET_FLAG_FAST_WINDMILL, 30, 31, 0x0000, 0x00000000, 0xFFFFFFFE, 0x00000000, 0x00000002, 0xFFFFFFFE, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000), CS_END(), @@ -33,17 +33,17 @@ CutsceneData D_80ABFB40[] = { CS_UNK_DATA_LIST(0x00000021, 1), CS_UNK_DATA(0x00010000, 0x0BB80000, 0x00000000, 0x00000000, 0xFFFFFFAA, 0xFFFFFFAE, 0x00000000, 0xFFFFFFAA, 0xFFFFFFAE, 0x00000000, 0x00000000, 0x00000000), CS_PLAYER_CUE_LIST(3), - CS_PLAYER_CUE(PLAYER_CUEID_17, 0, 80, 0x0000, 0x8000, 0x0000, 0, -40, 1400, 0, -40, 1400, 0.0f, 0.0f, 1.401298464324817e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_18, 80, 201, 0x0000, 0x8000, 0x0000, 0, -40, 1400, 0, -40, 1400, 0.0f, 0.0f, 1.401298464324817e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 201, 662, 0x0000, 0x8000, 0x0000, 0, -40, 1400, 0, -40, 1400, 0.0f, 0.0f, 1.401298464324817e-45f), + CS_PLAYER_CUE(PLAYER_CUEID_17, 0, 80, 0x0000, 0x8000, 0x0000, 0, -40, 1400, 0, -40, 1400, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_18, 80, 201, 0x0000, 0x8000, 0x0000, 0, -40, 1400, 0, -40, 1400, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 201, 662, 0x0000, 0x8000, 0x0000, 0, -40, 1400, 0, -40, 1400, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), CS_MISC_LIST(1), CS_MISC(CS_MISC_TRIFORCE_FLASH, 510, 611, 0x0000, 0x00000000, 0xFFFFFFFF, 0x00000000, 0x00000000, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(48, 1), - CS_ACTOR_CUE(0x0003, 160, 289, 0x0000, 0x0000, 0x0000, 0, 20, 1400, 0, 60, 1400, 0.0f, 0.31007752f, 0.0f), + CS_ACTOR_CUE(0x0003, 160, 289, 0x0000, 0x0000, 0x0000, 0, 20, 1400, 0, 60, 1400, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x3E9EC27B, 0.31007752f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(48, 3), - CS_ACTOR_CUE(0x0004, 340, 420, 0x0000, 0x0000, 0x0000, 0, 120, 1335, 0, 40, 1335, 0.0f, -1.0f, 0.0f), - CS_ACTOR_CUE(0x0004, 420, 465, 0x0000, 0x0000, 0x0000, 0, 40, 1335, 0, 16, 1335, 0.0f, -0.53333336f, 0.0f), - CS_ACTOR_CUE(0x0002, 465, 519, 0x0000, 0x0000, 0x0000, 0, 16, 1335, 0, 16, 1335, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0004, 340, 420, 0x0000, 0x0000, 0x0000, 0, 120, 1335, 0, 40, 1335, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xBF800000, -1.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0004, 420, 465, 0x0000, 0x0000, 0x0000, 0, 40, 1335, 0, 16, 1335, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xBF088889, -0.53333336f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 465, 519, 0x0000, 0x0000, 0x0000, 0, 16, 1335, 0, 16, 1335, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_MISC_LIST(1), CS_MISC(CS_MISC_SET_CSFLAG_0, 620, 621, 0x0000, 0x00000000, 0x00000001, 0x00000000, 0xFFFFFFFF, 0x00000001, 0x00000000, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 338, 341), @@ -55,83 +55,83 @@ CutsceneData D_80ABFB40[] = { CS_START_SEQ_LIST(1), CS_START_SEQ(NA_BGM_DOOR_OF_TIME, 560, 561, 0x0000, 0x00000000, 0x00000003, 0x00000000, 0x00000004, 0x00000003, 0x00000000, 0x00000004), CS_CAM_EYE_SPLINE(0, 451), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 2, 11, 1397, 0xA220), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 2, 11, 1397, 0xB820), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 2, 11, 1397, 0xD0A1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 0, 27, 1445, 0xBAEE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 56, 27, 1385, 0xA5AF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -19, 27, 1341, 0xAE0A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -44, -4, 1429, 0xA8A5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -44, -4, 1429, 0xA5ED), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -44, -4, 1429, 0xA220), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -44, -4, 1429, 0xA5A4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -44, -4, 1429, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -44, -4, 1429, 0xC9A5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -44, -4, 1429, 0xA5A2), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -44, -4, 1429, 0xA5BB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -44, -4, 1429, 0xAE0A), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -44, -4, 1429, 0xB3A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 2, 11, 1397, 0xA220), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 2, 11, 1397, 0xB820), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 2, 11, 1397, 0xD0A1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 0, 27, 1445, 0xBAEE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 56, 27, 1385, 0xA5AF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -19, 27, 1341, 0xAE0A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -44, -4, 1429, 0xA8A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -44, -4, 1429, 0xA5ED), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -44, -4, 1429, 0xA220), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -44, -4, 1429, 0xA5A4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -44, -4, 1429, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -44, -4, 1429, 0xC9A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -44, -4, 1429, 0xA5A2), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -44, -4, 1429, 0xA5BB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -44, -4, 1429, 0xAE0A), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -44, -4, 1429, 0xB3A5), CS_CAM_EYE_SPLINE(340, 1461), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -6, 15, 1560, 0xA220), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -6, 15, 1560, 0xB820), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -6, 15, 1560, 0xD0A1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -6, 15, 1560, 0xBAEE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -6, 15, 1560, 0xA5AF), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -6, 15, 1560, 0xAE0A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -6, 15, 1560, 0xA220), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -6, 15, 1560, 0xB820), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -6, 15, 1560, 0xD0A1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -6, 15, 1560, 0xBAEE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -6, 15, 1560, 0xA5AF), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -6, 15, 1560, 0xAE0A), CS_CAM_EYE_SPLINE(490, 941), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 0, 264, 1379, 0xA220), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 0, 264, 1379, 0xB820), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 0, 264, 1379, 0xD0A1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 0, 264, 1379, 0xBAEE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 0, 153, 1379, 0xA5AF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 55, 32, 1398, 0xAE0A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 111, -38, 1511, 0xA8A5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 111, -38, 1511, 0xA5ED), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 111, -38, 1511, 0xA220), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 111, -38, 1511, 0xA5A4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 111, -38, 1511, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 111, -38, 1511, 0xC9A5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 111, -38, 1511, 0xA5A2), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, 111, -38, 1511, 0xA5BB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 0, 264, 1379, 0xA220), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 0, 264, 1379, 0xB820), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 0, 264, 1379, 0xD0A1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 0, 264, 1379, 0xBAEE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 0, 153, 1379, 0xA5AF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 55, 32, 1398, 0xAE0A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 111, -38, 1511, 0xA8A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 111, -38, 1511, 0xA5ED), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 111, -38, 1511, 0xA220), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 111, -38, 1511, 0xA5A4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 111, -38, 1511, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 111, -38, 1511, 0xC9A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 111, -38, 1511, 0xA5A2), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 111, -38, 1511, 0xA5BB), CS_CAM_AT_SPLINE(0, 480), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 2, 36, 1335, 0xA220), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 2, 36, 1335, 0xB820), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 2, 36, 1335, 0xD0A1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 0, -8, 1391, 0xBAEE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 1, -5, 1398, 0xA5AF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -2, -3, 1394, 0xAE0A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 5, 0, 1399, 0xA8A5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 1, 14, 1399, 0xA5ED), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -9, 33, 1402, 0xA220), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -14, 41, 1409, 0xA5A4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -14, 41, 1409, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -14, 41, 1409, 0xC9A5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -14, 41, 1409, 0xA5A2), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -14, 41, 1409, 0xA5BB), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -14, 41, 1409, 0xAE0A), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.0f, -14, 41, 1409, 0xB3A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 2, 36, 1335, 0xA220), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 2, 36, 1335, 0xB820), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 2, 36, 1335, 0xD0A1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 0, -8, 1391, 0xBAEE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 1, -5, 1398, 0xA5AF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -2, -3, 1394, 0xAE0A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 5, 0, 1399, 0xA8A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 1, 14, 1399, 0xA5ED), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -9, 33, 1402, 0xA220), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -14, 41, 1409, 0xA5A4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -14, 41, 1409, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -14, 41, 1409, 0xC9A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -14, 41, 1409, 0xA5A2), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -14, 41, 1409, 0xA5BB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -14, 41, 1409, 0xAE0A), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -14, 41, 1409, 0xB3A5), CS_CAM_AT_SPLINE(340, 1490), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -3, 48, 1414, 0xA220), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -3, 48, 1414, 0xB820), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 60.0f, -3, 48, 1414, 0xD0A1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -3, 48, 1414, 0xBAEE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -3, 47, 1414, 0xA5AF), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.0f, -3, 47, 1414, 0xAE0A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -3, 48, 1414, 0xA220), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -3, 48, 1414, 0xB820), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42700000, 60.0f), -3, 48, 1414, 0xD0A1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -3, 48, 1414, 0xBAEE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -3, 47, 1414, 0xA5AF), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -3, 47, 1414, 0xAE0A), CS_CAM_AT_SPLINE(490, 970), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 0, 264, 1274, 0xA220), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 60, 60.0f, 0, 264, 1274, 0xB820), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 60, 60.0f, 0, 264, 1274, 0xD0A1), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 0, 264, 1274, 0xBAEE), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 0, 170, 1275, 0xA5AF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 10, 51, 1306, 0xAE0A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 68, -2, 1424, 0xA8A5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 68, -2, 1424, 0xA5ED), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 68, -2, 1424, 0xA220), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 68, -2, 1424, 0xA5A4), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 68, -2, 1424, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 68, -2, 1424, 0xC9A5), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, 68, -2, 1424, 0xA5A2), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.0f, 68, -2, 1424, 0xA5BB), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 0, 264, 1274, 0xA220), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 60, CS_FLOAT(0x42700000, 60.0f), 0, 264, 1274, 0xB820), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 60, CS_FLOAT(0x42700000, 60.0f), 0, 264, 1274, 0xD0A1), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 0, 264, 1274, 0xBAEE), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 0, 170, 1275, 0xA5AF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 10, 51, 1306, 0xAE0A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 68, -2, 1424, 0xA8A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 68, -2, 1424, 0xA5ED), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 68, -2, 1424, 0xA220), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 68, -2, 1424, 0xA5A4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 68, -2, 1424, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 68, -2, 1424, 0xC9A5), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 68, -2, 1424, 0xA5A2), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), 68, -2, 1424, 0xA5BB), CS_END(), }; // clang-format on diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 61d2ea57a..3b4bbb26f 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -44,8 +44,8 @@ static ColliderCylinderInit sProjectileColliderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_ON, OCELEM_ON, }, { 13, 20, 0, { 0, 0, 0 } }, @@ -64,8 +64,8 @@ static ColliderCylinderInit sOctorockColliderInit = { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 20, 40, -30, { 0, 0, 0 } }, @@ -490,7 +490,7 @@ void EnOkuta_ProjectileFly(EnOkuta* this, PlayState* play) { this->collider.base.atFlags & AT_BOUNCED) { this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED | AT_TYPE_ENEMY); this->collider.base.atFlags |= AT_TYPE_PLAYER; - this->collider.elem.toucher.dmgFlags = DMG_DEKU_STICK; + this->collider.elem.atDmgInfo.dmgFlags = DMG_DEKU_STICK; Matrix_MtxFToYXZRotS(&player->shieldMf, &shieldRot, 0); this->actor.world.rot.y = shieldRot.y + 0x8000; this->timer = 30; @@ -679,10 +679,11 @@ s32 EnOkuta_GetSnoutScale(EnOkuta* this, f32 curFrame, Vec3f* scale) { s32 EnOkuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnOkuta* this = (EnOkuta*)thisx; - f32 curFrame = this->skelAnime.curFrame; + f32 curFrame; Vec3f scale; s32 doScale = false; + curFrame = this->skelAnime.curFrame; if (this->actionFunc == EnOkuta_Die) { curFrame += this->timer; } diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 1f8d80e66..aa931effe 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -125,8 +125,8 @@ static ColliderCylinderInitType1 sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_NONE | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 30, 80, 0, { 0, 0, 0 } }, @@ -141,6 +141,7 @@ static s16 sItemShelfRot[] = { 0xEAAC, 0xEAAC, 0xEAAC, 0xEAAC, 0x1554, 0x1554, 0 // unused values? static s16 D_80AC8904[] = { 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025 }; +#if IS_DEBUG static char* sShopkeeperPrintName[] = { "コキリã®åº— ", // "Kokiri Shop" "薬屋 ", // "Potion Shop" @@ -154,6 +155,7 @@ static char* sShopkeeperPrintName[] = { "インゴーã®åº—", // "Ingo Store" "ãŠé¢å±‹ ", // "Mask Shop" }; +#endif typedef struct { /* 0x00 */ s16 objId; @@ -888,6 +890,8 @@ void EnOssan_State_StartConversation(EnOssan* this, PlayState* play, Player* pla if (this->actor.params == OSSAN_TYPE_MASK && dialogState == TEXT_STATE_CHOICE) { if (!EnOssan_TestEndInteraction(this, play, &play->state.input[0]) && Message_ShouldAdvance(play)) { + s32 pad; + switch (play->msgCtx.choiceIndex) { case 0: EnOssan_StartShopping(play, this); @@ -1691,6 +1695,8 @@ void EnOssan_State_ContinueShoppingPrompt(EnOssan* this, PlayState* play, Player selectedItem = this->shelfSlots[this->cursorIndex]; selectedItem->updateStockedItemFunc(play, selectedItem); if (!EnOssan_TestEndInteraction(this, play, &play->state.input[0])) { + s32 pad; + switch (play->msgCtx.choiceIndex) { case 0: PRINTF(VT_FGCOL(YELLOW) "★★★ ç¶šã‘るよï¼ï¼ ★★★" VT_RST "\n"); @@ -2253,12 +2259,13 @@ void EnOssan_DrawCursor(PlayState* play, EnOssan* this, f32 x, f32 y, f32 z, u8 gDPLoadTextureBlock_4b(OVERLAY_DISP++, gSelectionCursorTex, G_IM_FMT_IA, 16, 16, 0, G_TX_MIRROR | G_TX_WRAP, G_TX_MIRROR | G_TX_WRAP, 4, 4, G_TX_NOLOD, G_TX_NOLOD); w = 16.0f * z; - ulx = (x - w) * 4.0f; + ulx = WIDE_INCR(((x - w) * 4.0f), 25); uly = (y - w) * 4.0f; - lrx = (x + w) * 4.0f; + lrx = WIDE_INCR(((x + w) * 4.0f), -22); lry = (y + w) * 4.0f; dsdx = (1.0f / z) * 1024.0f; - gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, 0, 0, dsdx, dsdx); + gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, 0, 0, WIDE_DIV(dsdx, WIDE_GET_RATIO), + dsdx); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4215); } @@ -2275,15 +2282,17 @@ void EnOssan_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32 gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a); w = 8.0f * z; + ulx = (x - w) * 4.0f; + lrx = (x + w) * 4.0f; + h = 12.0f * z; + uly = (y - h) * 4.0f; + lry = (y + h) * 4.0f; + texCoordScale = (1.0f / z) * 1024; dsdx = texCoordScale * dx; dtdy = dy * texCoordScale; - ulx = (x - w) * 4.0f; - uly = (y - h) * 4.0f; - lrx = (x + w) * 4.0f; - lry = (y + h) * 4.0f; gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy); CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4242); } diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index e0789d814..b67d863e3 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -90,8 +90,8 @@ static ColliderCylinderInit sOwlCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 30, 40, 0, { 0, 0, 0 } }, @@ -1368,6 +1368,7 @@ void func_80ACD2CC(EnOwl* this, PlayState* play) { Vec3f pos; s32 angle; f32 t = func_80ACD1C4(play, 7); + f32 phi_f2; pos.x = play->csCtx.actorCues[7]->startPos.x; pos.y = play->csCtx.actorCues[7]->startPos.y; @@ -1379,8 +1380,7 @@ void func_80ACD2CC(EnOwl* this, PlayState* play) { angle = (s16)((t * angle) + this->actor.world.rot.z); angle = (u16)angle; if (this->actionFlags & 4) { - f32 phi_f2 = play->csCtx.actorCues[7]->rot.x; - + phi_f2 = play->csCtx.actorCues[7]->rot.x; phi_f2 *= 10.0f * (360.0f / 0x10000); if (phi_f2 < 0.0f) { phi_f2 += 360.0f; diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 973b02717..8fa9e1a49 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -65,8 +65,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 50, 160, -70, { 0, 0, 0 } }, @@ -78,8 +78,8 @@ static ColliderJntSphElementInit sJntSphElemInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 20 }, 100 }, @@ -112,8 +112,8 @@ static ColliderQuadInit sQuadInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -231,7 +231,7 @@ void EnPeehat_Init(Actor* thisx, PlayState* play) { this->colCylinder.dim.radius = 25; this->colCylinder.dim.height = 15; this->colCylinder.dim.yShift = -5; - this->colCylinder.elem.bumper.dmgFlags = DMG_ARROW | DMG_SLINGSHOT; + this->colCylinder.elem.acDmgInfo.dmgFlags = DMG_ARROW | DMG_SLINGSHOT; this->colQuad.base.atFlags = AT_ON | AT_TYPE_ENEMY; this->colQuad.base.acFlags = AC_ON | AC_TYPE_PLAYER; this->actor.naviEnemyId = NAVI_ENEMY_PEAHAT_LARVA; @@ -416,6 +416,8 @@ void EnPeehat_Ground_SetStateRise(EnPeehat* this) { } void EnPeehat_Ground_StateRise(EnPeehat* this, PlayState* play) { + Vec3f pos; + Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 50.0f, 0.0f); if (Math_SmoothStepToS(&this->bladeRotVel, 4000, 1, 800, 0) == 0) { if (this->animTimer != 0) { @@ -433,7 +435,7 @@ void EnPeehat_Ground_StateRise(EnPeehat* this, PlayState* play) { this->actor.world.pos.y += 6.5f; } if (this->actor.world.pos.y - this->actor.floorHeight < 80.0f) { - Vec3f pos = this->actor.world.pos; + pos = this->actor.world.pos; pos.y = this->actor.floorHeight; func_80033480(play, &pos, 90.0f, 1, 0x96, 100, 1); } @@ -457,6 +459,8 @@ void EnPeehat_Flying_SetStateRise(EnPeehat* this) { } void EnPeehat_Flying_StateRise(EnPeehat* this, PlayState* play) { + Vec3f pos; + Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 50.0f, 0.0f); if (Math_SmoothStepToS(&this->bladeRotVel, 4000, 1, 800, 0) == 0) { if (this->animTimer != 0) { @@ -476,7 +480,7 @@ void EnPeehat_Flying_StateRise(EnPeehat* this, PlayState* play) { this->actor.world.pos.y += 18.0f; } if (this->actor.world.pos.y - this->actor.floorHeight < 80.0f) { - Vec3f pos = this->actor.world.pos; + pos = this->actor.world.pos; pos.y = this->actor.floorHeight; func_80033480(play, &pos, 90.0f, 1, 0x96, 100, 1); } @@ -854,12 +858,11 @@ void EnPeehat_SetStateExplode(EnPeehat* this) { } void EnPeehat_StateExplode(EnPeehat* this, PlayState* play) { - EnBom* bomb; s32 pad[2]; if (this->animTimer == 5) { - bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x602, 0); + EnBom* bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x602, 0); if (bomb != NULL) { bomb->timer = 0; } @@ -919,6 +922,10 @@ void EnPeehat_Update(Actor* thisx, PlayState* play) { EnPeehat* this = (EnPeehat*)thisx; s32 i; Player* player = GET_PLAYER(play); + Vec3f posResult; + CollisionPoly* poly; + s32 bgId; + Vec3f* posB; // If Adult Peahat if (thisx->params <= 0) { @@ -978,10 +985,8 @@ void EnPeehat_Update(Actor* thisx, PlayState* play) { // if PEAHAT_TYPE_GROUNDED if (thisx->params < 0 && (thisx->flags & ACTOR_FLAG_6)) { for (i = 1; i >= 0; i--) { - Vec3f posResult; - CollisionPoly* poly = NULL; - s32 bgId; - Vec3f* posB = &this->bladeTip[i]; + poly = NULL; + posB = &this->bladeTip[i]; if (BgCheck_EntityLineTest1(&play->colCtx, &thisx->world.pos, posB, &posResult, &poly, true, true, false, true, &bgId) == true) { diff --git a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c index 2f6a161ce..3f814e796 100644 --- a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c +++ b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c @@ -44,8 +44,8 @@ static ColliderCylinderInit sColliderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 25, 50, 20, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index 9c2de6468..f67ce8d4e 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -58,8 +58,8 @@ static ColliderCylinderInit D_80AD7080 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 25, 50, 20, { 0, 0, 0 } }, @@ -78,8 +78,8 @@ static ColliderCylinderInit D_80AD70AC = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x01, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 10, 30, 0, { 0, 0, 0 } }, @@ -263,7 +263,7 @@ void EnPoField_SetupFlee(EnPoField* this) { void EnPoField_SetupDamage(EnPoField* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gPoeFieldDamagedAnim, -6.0f); - if (this->collider.elem.acHitElem->toucher.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) { + if (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) { this->actor.world.rot.y = this->collider.base.ac->world.rot.y; } else { this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, this->collider.base.ac) + 0x8000; @@ -795,6 +795,9 @@ void EnPoField_DrawFlame(EnPoField* this, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_en_po_field.c", 1709), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_field.c", 1712); } } @@ -996,6 +999,9 @@ void EnPoField_DrawSoul(Actor* thisx, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPoeFieldSoulDL); } + + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_field.c", 2149); EnPoField_DrawFlame(this, play); } diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c index f526e0508..4106c8f0c 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c @@ -58,8 +58,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 30, 52, 0, { 0, 0, 0 } }, @@ -290,8 +290,6 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, PlayState* play) { Vec3f vec; f32 multiplier; s32 pad; - Vec3f sp60; - s32 pad1; this->actionTimer++; if (this->actionTimer < 8) { @@ -323,6 +321,9 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, PlayState* play) { } if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.001f) != 0) { if (this->hookshotSlotFull != 0) { + Vec3f sp60; + s32 pad1; + sp60.x = this->actor.world.pos.x; sp60.y = this->actor.floorHeight; sp60.z = this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 27da379c4..1315e00b9 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -86,8 +86,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0x4FC7FFEA, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 18, 60, 15, { 0, 0, 0 } }, @@ -210,7 +210,7 @@ void EnPoSisters_Init(Actor* thisx, PlayState* play) { } else { this->actor.flags &= ~(ACTOR_FLAG_9 | ACTOR_FLAG_14); this->collider.elem.elemType = ELEMTYPE_UNK4; - this->collider.elem.bumper.dmgFlags |= DMG_DEKU_NUT; + this->collider.elem.acDmgInfo.dmgFlags |= DMG_DEKU_NUT; this->collider.base.ocFlags1 = OC1_NONE; func_80AD9C24(this, NULL); } @@ -301,7 +301,7 @@ void func_80AD9568(EnPoSisters* this) { void func_80AD95D8(EnPoSisters* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gPoeSistersDamagedAnim, -3.0f); if (this->collider.base.ac != NULL) { - this->actor.world.rot.y = (this->collider.elem.acHitElem->toucher.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) + this->actor.world.rot.y = (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) ? this->collider.base.ac->world.rot.y : Actor_WorldYawTowardActor(&this->actor, this->collider.base.ac) + 0x8000; } @@ -744,7 +744,7 @@ void func_80ADAD54(EnPoSisters* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->unk_22E.a = 0; - this->collider.elem.bumper.dmgFlags = DMG_MAGIC_ICE | DMG_MAGIC_FIRE | DMG_DEKU_NUT; + this->collider.elem.acDmgInfo.dmgFlags = DMG_MAGIC_ICE | DMG_MAGIC_FIRE | DMG_DEKU_NUT; func_80AD93C4(this); } else { endFrame = this->skelAnime.endFrame; @@ -757,8 +757,8 @@ void func_80ADAE6C(EnPoSisters* this, PlayState* play) { this->unk_22E.a = 255; if (this->unk_194 != 0) { this->unk_199 |= 1; - this->collider.elem.bumper.dmgFlags = (DMG_SWORD | DMG_ARROW | DMG_HAMMER | DMG_MAGIC_ICE | DMG_MAGIC_FIRE | - DMG_HOOKSHOT | DMG_EXPLOSIVE | DMG_DEKU_STICK); + this->collider.elem.acDmgInfo.dmgFlags = (DMG_SWORD | DMG_ARROW | DMG_HAMMER | DMG_MAGIC_ICE | + DMG_MAGIC_FIRE | DMG_HOOKSHOT | DMG_EXPLOSIVE | DMG_DEKU_STICK); if (this->unk_19A != 0) { this->unk_19A--; } diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index ee737aaab..10af76099 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -67,8 +67,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 20, 40, 20, { 0, 0, 0 } }, @@ -80,8 +80,8 @@ static ColliderJntSphElementInit D_80AE1AA0[1] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 18, { { 0, 1400, 0 }, 10 }, 100 }, @@ -293,7 +293,7 @@ void func_80ADE28C(EnPoh* this) { } else { Animation_PlayOnce(&this->skelAnime, &gPoeComposerDamagedAnim); } - if (this->colliderCyl.elem.acHitElem->toucher.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) { + if (this->colliderCyl.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) { this->actor.world.rot.y = this->colliderCyl.base.ac->world.rot.y; } else { this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, this->colliderCyl.base.ac) + 0x8000; 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 21a4869bb..cae3ead4e 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -77,8 +77,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 20, 70, 0, { 0, 0, 0 } }, @@ -466,10 +466,12 @@ void EnRd_SetupWalkToParent(EnRd* this) { * fade away. */ void EnRd_WalkToParent(EnRd* this, PlayState* play) { + s32 pad; + s16 targetY; + Vec3f parentPos; + if (this->actor.parent != NULL) { - s32 pad; - s16 targetY; - Vec3f parentPos = this->actor.parent->world.pos; + parentPos = this->actor.parent->world.pos; targetY = Actor_WorldYawTowardPoint(&this->actor, &parentPos); @@ -992,5 +994,7 @@ void EnRd_Draw(Actor* thisx, PlayState* play) { func_80033C30(&thisPos, &sShadowScale, this->alpha, play); } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_rd.c", 1735); } diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index 609d9087e..b89ed2e9c 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -100,8 +100,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x08, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 20, 40, 0, { 0, 0, 0 } }, @@ -126,14 +126,14 @@ void EnReeba_Init(Actor* thisx, PlayState* play) { this->scale = 0.04f; if (this->type != LEEVER_TYPE_SMALL) { + this->scale *= 1.5f; this->collider.dim.radius = 35; this->collider.dim.height = 45; - this->scale *= 1.5f; // "Reeba Boss Appears %f" PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ リーãƒã¼ã™ç™»å ´ ☆☆☆☆☆ %f\n" VT_RST, this->scale); this->actor.colChkInfo.health = 20; - this->collider.elem.toucher.effect = 4; - this->collider.elem.toucher.damage = 16; + this->collider.elem.atDmgInfo.effect = 4; + this->collider.elem.atDmgInfo.damage = 16; Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } @@ -326,7 +326,7 @@ void EnReeba_MoveBig(EnReeba* this, PlayState* play) { } } -void EnReeba_Bumped(EnReeba* this, PlayState* play) { +void EnReeba_Recoiled(EnReeba* this, PlayState* play) { Math_ApproachZeroF(&this->actor.speed, 1.0f, 0.3f); if (this->moveTimer == 0) { @@ -399,17 +399,18 @@ void EnReeba_SetupStunned(EnReeba* this, PlayState* play) { } void EnReeba_Stunned(EnReeba* this, PlayState* play) { - Vec3f pos; - f32 scale; - if (this->waitTimer != 0) { if (this->actor.speed < 0.0f) { this->actor.speed += 1.0f; } + return; } else { this->actor.speed = 0.0f; if ((this->stunType == LEEVER_STUN_OTHER) || (this->actor.colChkInfo.health != 0)) { + Vec3f pos; + f32 scale; + if (this->stunType == LEEVER_STUN_ICE) { pos.x = this->actor.world.pos.x + Rand_CenteredFloat(20.0f); pos.y = this->actor.world.pos.y + Rand_CenteredFloat(20.0f); @@ -425,10 +426,11 @@ void EnReeba_Stunned(EnReeba* this, PlayState* play) { this->waitTimer = 66; this->actionfunc = EnReeba_StunRecover; - } else { - this->waitTimer = 30; - this->actionfunc = EnReeba_StunDie; + return; } + + this->waitTimer = 30; + this->actionfunc = EnReeba_StunDie; } } @@ -638,7 +640,7 @@ void EnReeba_Update(Actor* thisx, PlayState* play2) { this->actor.speed = 8.0f; this->actor.world.rot.y *= -1.0f; this->moveTimer = 14; - this->actionfunc = EnReeba_Bumped; + this->actionfunc = EnReeba_Recoiled; return; } } @@ -693,7 +695,7 @@ void EnReeba_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_en_reeba.c", 1088); - if (BREG(0)) { + if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { Vec3f debugPos; debugPos.x = (Math_SinS(this->actor.world.rot.y) * 30.0f) + this->actor.world.pos.x; diff --git a/src/overlays/actors/ovl_En_Rl/z_en_rl.c b/src/overlays/actors/ovl_En_Rl/z_en_rl.c index 068bd64b6..ba8cf7dc0 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -50,6 +50,7 @@ void func_80AE72D0(EnRl* this) { } } +#if IS_DEBUG void func_80AE7358(EnRl* this) { Animation_Change(&this->skelAnime, &object_rl_Anim_000A3C, 1.0f, 0.0f, Animation_GetLastFrame(&object_rl_Anim_000A3C), ANIMMODE_LOOP, 0.0f); @@ -75,6 +76,7 @@ void func_80AE73D8(EnRl* this, PlayState* play) { D_80AE81AC = 1; } } +#endif void func_80AE744C(EnRl* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); @@ -243,8 +245,9 @@ void func_80AE79A4(EnRl* this, PlayState* play) { void func_80AE7AF8(EnRl* this, PlayState* play) { if (func_80AE74B4(this, play, 3, 0)) { - Animation_Change(&this->skelAnime, &object_rl_Anim_00040C, 1.0f, 0.0f, - Animation_GetLastFrame(&object_rl_Anim_00040C), ANIMMODE_ONCE, -8.0f); + f32 frame = Animation_GetLastFrame(&object_rl_Anim_00040C); + + Animation_Change(&this->skelAnime, &object_rl_Anim_00040C, 1.0f, 0.0f, frame, ANIMMODE_ONCE, -8.0f); this->action = 6; } else if (func_80AE74FC(this, play, 4, 0)) { this->action = 5; @@ -269,7 +272,9 @@ void func_80AE7BF8(EnRl* this, s32 arg1) { void func_80AE7C64(EnRl* this, PlayState* play) { func_80AE7954(this, play); +#if IS_DEBUG func_80AE73D8(this, play); +#endif } void func_80AE7C94(EnRl* this, PlayState* play) { @@ -277,7 +282,9 @@ void func_80AE7C94(EnRl* this, PlayState* play) { func_80AE7494(this); func_80AE72D0(this); func_80AE79A4(this, play); +#if IS_DEBUG func_80AE73D8(this, play); +#endif } void func_80AE7CE8(EnRl* this, PlayState* play) { @@ -287,7 +294,9 @@ void func_80AE7CE8(EnRl* this, PlayState* play) { temp = func_80AE7494(this); func_80AE72D0(this); func_80AE7BF8(this, temp); +#if IS_DEBUG func_80AE73D8(this, play); +#endif } void func_80AE7D40(EnRl* this, PlayState* play) { @@ -295,7 +304,9 @@ void func_80AE7D40(EnRl* this, PlayState* play) { func_80AE7494(this); func_80AE72D0(this); func_80AE7AF8(this, play); +#if IS_DEBUG func_80AE73D8(this, play); +#endif } void func_80AE7D94(EnRl* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index b2bf3132b..850ea93d5 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -76,10 +76,12 @@ ActorInit En_Rr_InitVars = { /**/ EnRr_Draw, }; +#if IS_DEBUG static char* sDropNames[] = { // "type 7", "small magic jar", "arrow", "fairy", "20 rupees", "50 rupees" "タイプ7 ", "魔法ã®å£·å°", "矢 ", "妖精 ", "20ルピー ", "50ルピー ", }; +#endif static ColliderCylinderInitType1 sCylinderInit1 = { { @@ -93,8 +95,8 @@ static ColliderCylinderInitType1 sCylinderInit1 = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 30, 55, 0, { 0, 0, 0 } }, @@ -112,8 +114,8 @@ static ColliderCylinderInitType1 sCylinderInit2 = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 20, 20, -10, { 0, 0, 0 } }, @@ -337,8 +339,8 @@ void EnRr_SetupDamage(EnRr* this) { s32 i; this->reachState = 0; - this->actionTimer = 20; this->segMoveRate = 0.0f; + this->actionTimer = 20; this->segPhaseVelTarget = 2500.0f; this->pulseSizeTarget = 0.0f; this->wobbleSizeTarget = 0.0f; @@ -417,9 +419,9 @@ void EnRr_CollisionCheck(EnRr* this, PlayState* play) { this->collider2.base.acFlags &= ~AC_HIT; // "Kakin" (not sure what this means) PRINTF(VT_FGCOL(GREEN) "カキン(%d)ï¼ï¼" VT_RST "\n", this->frameCount); - hitPos.x = this->collider2.elem.bumper.hitPos.x; - hitPos.y = this->collider2.elem.bumper.hitPos.y; - hitPos.z = this->collider2.elem.bumper.hitPos.z; + hitPos.x = this->collider2.elem.acDmgInfo.hitPos.x; + hitPos.y = this->collider2.elem.acDmgInfo.hitPos.y; + hitPos.z = this->collider2.elem.acDmgInfo.hitPos.z; CollisionCheck_SpawnShieldParticlesMetal2(play, &hitPos); } else { if (this->collider1.base.acFlags & AC_HIT) { @@ -427,9 +429,9 @@ void EnRr_CollisionCheck(EnRr* this, PlayState* play) { this->collider1.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect != 0) { - hitPos.x = this->collider1.elem.bumper.hitPos.x; - hitPos.y = this->collider1.elem.bumper.hitPos.y; - hitPos.z = this->collider1.elem.bumper.hitPos.z; + hitPos.x = this->collider1.elem.acDmgInfo.hitPos.x; + hitPos.y = this->collider1.elem.acDmgInfo.hitPos.y; + hitPos.z = this->collider1.elem.acDmgInfo.hitPos.z; CollisionCheck_BlueBlood(play, NULL, &hitPos); } switch (this->actor.colChkInfo.damageEffect) { diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 0fbbdb75d..5c100327e 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -106,7 +106,6 @@ static void* sMouthTextures[] = { static s32 sUnused = 0; -#pragma asmproc recurse #include "z_en_ru1_cutscene_data.inc.c" static u32 D_80AF1938 = 0; @@ -341,6 +340,7 @@ s32 func_80AEB1B4(PlayState* play) { return Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING; } +#if IS_DEBUG void func_80AEB1D8(EnRu1* this) { this->action = 36; this->drawConfig = 0; @@ -358,6 +358,7 @@ void func_80AEB220(EnRu1* this, PlayState* play) { func_80AEB1D8(this); } } +#endif void func_80AEB264(EnRu1* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { s32 pad[2]; @@ -634,10 +635,10 @@ void func_80AEBD94(EnRu1* this, PlayState* play) { void func_80AEBE3C(EnRu1* this, PlayState* play, s32 arg2) { s32 pad[2]; - f32 frameCount; if (arg2 != 0) { - frameCount = Animation_GetLastFrame(&gRutoChildTreadWaterAnim); + f32 frameCount = Animation_GetLastFrame(&gRutoChildTreadWaterAnim); + func_80AEB7D0(this); Animation_Change(&this->skelAnime, &gRutoChildTreadWaterAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); this->action = 3; @@ -661,6 +662,8 @@ void func_80AEBEC8(EnRu1* this, PlayState* play) { void func_80AEBF60(EnRu1* this, PlayState* play) { if (func_80AEB480(play, 6)) { + s32 pad; + func_80AEB7D0(this); this->action = 5; this->unk_364 = this->actor.world.pos; @@ -759,14 +762,14 @@ void func_80AEC2C0(EnRu1* this, PlayState* play) { } void func_80AEC320(EnRu1* this, PlayState* play) { - s8 actorRoom; - if (!GET_INFTABLE(INFTABLE_141)) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->action = 7; EnRu1_SetMouthIndex(this, 1); } else if (GET_INFTABLE(INFTABLE_147) && !GET_INFTABLE(INFTABLE_140) && !GET_INFTABLE(INFTABLE_145)) { if (!func_80AEB020(this, play)) { + s8 actorRoom; + func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); actorRoom = this->actor.room; this->action = 22; @@ -911,6 +914,8 @@ void func_80AEC9C4(EnRu1* this) { void func_80AECA18(EnRu1* this) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + s32 pad; + this->action = 13; this->unk_26C = 0.0f; this->actor.velocity.y = 0.0f; @@ -1168,11 +1173,11 @@ void func_80AED414(EnRu1* this, PlayState* play) { } void func_80AED44C(EnRu1* this, PlayState* play) { - s8 actorRoom; - if (GET_INFTABLE(INFTABLE_141) && !GET_INFTABLE(INFTABLE_145) && !GET_INFTABLE(INFTABLE_140) && !GET_INFTABLE(INFTABLE_147)) { if (!func_80AEB020(this, play)) { + s8 actorRoom; + func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); actorRoom = this->actor.room; this->action = 22; @@ -1253,12 +1258,13 @@ void func_80AED6F8(PlayState* play) { } void func_80AED738(EnRu1* this, PlayState* play) { - u32 temp_v0; - if (func_80AED624(this, play)) { + s32 pad; + this->unk_2A4 += 1.0f; if (this->unk_2A4 < 20.0f) { - temp_v0 = ((20.0f - this->unk_2A4) * 255.0f) / 20.0f; + u32 temp_v0 = ((20.0f - this->unk_2A4) * 255.0f) / 20.0f; + this->alpha = temp_v0; this->actor.shape.shadowAlpha = temp_v0; } else { @@ -1321,17 +1327,13 @@ void func_80AEDAE0(EnRu1* this, PlayState* play) { } void func_80AEDB30(EnRu1* this, PlayState* play) { - DynaPolyActor* dynaPolyActor; f32* velocityY; f32* speedXZ; f32* gravity; - s16 wallYaw; - s16 rotY; - s32 temp_a1_2; - s32 temp_a0; - s32 phi_v1; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + DynaPolyActor* dynaPolyActor; + velocityY = &this->actor.velocity.y; dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); if (*velocityY <= 0.0f) { @@ -1368,6 +1370,8 @@ void func_80AEDB30(EnRu1* this, PlayState* play) { } } if (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) { + s32 pad; + speedXZ = &this->actor.speed; velocityY = &this->actor.velocity.y; if (*speedXZ >= (kREG(27) * 0.01f) + 3.0f) { @@ -1383,6 +1387,12 @@ void func_80AEDB30(EnRu1* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { speedXZ = &this->actor.speed; if (*speedXZ != 0.0f) { + s16 wallYaw; + s16 rotY; + s32 temp_a1_2; + s32 temp_a0; + s32 phi_v1; + rotY = this->actor.world.rot.y; wallYaw = this->actor.wallYaw; temp_a0 = (wallYaw * 2) - rotY; @@ -1443,7 +1453,6 @@ void func_80AEE050(EnRu1* this) { s32 pad; f32 sp28; f32 sp24; - f32 temp_f10; EnRu1* thisx = this; // necessary to match if (this->unk_350 == 0) { @@ -1476,6 +1485,8 @@ void func_80AEE050(EnRu1* this) { this->unk_350 = 2; this->unk_360 = 0.0f; } else { + f32 temp_f10; + sp28 = this->unk_358; sp24 = this->unk_354; temp_f10 = Math_CosS(this->unk_35C) * -sp28; @@ -1561,6 +1572,8 @@ void func_80AEE488(EnRu1* this, PlayState* play) { this->action = 31; func_80AED520(this, play); } else if (!func_80AEE394(this, play) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + s32 pad; + this->actor.minVelocityY = -((kREG(24) * 0.01f) + 6.8f); this->actor.gravity = -((kREG(23) * 0.01f) + 1.3f); this->action = 28; @@ -1571,11 +1584,16 @@ void func_80AEE568(EnRu1* this, PlayState* play) { if (!func_80AEE394(this, play)) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speed == 0.0f) && (this->actor.minVelocityY == 0.0f)) { + s32 pad; + func_80AEE02C(this); Actor_OfferCarry(&this->actor, play); this->action = 27; func_80AEADD8(this); - } else if (this->actor.yDistToWater > 0.0f) { + return; + } + + if (this->actor.yDistToWater > 0.0f) { this->action = 29; this->unk_350 = 0; } @@ -1617,13 +1635,13 @@ s32 func_80AEE6D0(EnRu1* this, PlayState* play) { } void func_80AEE7C4(EnRu1* this, PlayState* play) { - f32 frameCount; - s32 pad[13]; + s32 pad[9]; Player* player; f32* unk_370 = &this->unk_370; if (Actor_HasNoParent(&this->actor, play)) { - frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); + f32 frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); + Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); func_80AED6DC(this, play); this->actor.speed *= (kREG(25) * 0.01f) + 1.0f; @@ -1633,45 +1651,49 @@ void func_80AEE7C4(EnRu1* this, PlayState* play) { func_80AED57C(this); this->action = 28; *unk_370 = 0.0f; - return; - } + } else if (func_80AEE6D0(this, play)) { + s32 pad; - if (func_80AEE6D0(this, play)) { *unk_370 = 0.0f; - return; - } + } else { + player = GET_PLAYER(play); + if (player->stateFlags2 & PLAYER_STATE2_28) { + this->unk_370 += 1.0f; + if (this->action != 32) { + if (*unk_370 > 30.0f) { + if (Rand_S16Offset(0, 3) == 0) { + f32 frameCount = Animation_GetLastFrame(&gRutoChildSquirmAnim); - player = GET_PLAYER(play); - if (player->stateFlags2 & PLAYER_STATE2_28) { - this->unk_370 += 1.0f; - if (this->action != 32) { - if (*unk_370 > 30.0f) { - if (Rand_S16Offset(0, 3) == 0) { - frameCount = Animation_GetLastFrame(&gRutoChildSquirmAnim); - Animation_Change(&this->skelAnime, &gRutoChildSquirmAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, - -8.0f); - func_80AED5DC(this); - this->action = 32; + Animation_Change(&this->skelAnime, &gRutoChildSquirmAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, + -8.0f); + func_80AED5DC(this); + this->action = 32; + } + *unk_370 = 0.0f; + } + } else { + if (*unk_370 > 50.0f) { + f32 frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); + + Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, + -8.0f); + this->action = 31; + *unk_370 = 0.0f; } - *unk_370 = 0.0f; } } else { - if (*unk_370 > 50.0f) { - frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); - Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); - this->action = 31; - *unk_370 = 0.0f; - } + f32 frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); + + Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); + *unk_370 = 0.0f; } - } else { - frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); - Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); - *unk_370 = 0.0f; } } s32 func_80AEEAC8(EnRu1* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + s32 pad; + func_80AEE02C(this); Actor_OfferCarry(&this->actor, play); this->action = 27; @@ -1809,10 +1831,9 @@ void func_80AEF080(EnRu1* this) { } s32 func_80AEF0BC(EnRu1* this, PlayState* play) { - s32 frameCount; - if (GET_INFTABLE(INFTABLE_142)) { - frameCount = Animation_GetLastFrame(&gRutoChildSitAnim); + f32 frameCount = Animation_GetLastFrame(&gRutoChildSitAnim); + Animation_Change(&this->skelAnime, &gRutoChildSitAnim, 1.0f, 0, frameCount, ANIMMODE_ONCE, -8.0f); play->msgCtx.msgMode = MSGMODE_PAUSED; this->action = 26; @@ -2001,7 +2022,7 @@ void func_80AEF890(EnRu1* this, PlayState* play) { s32 pad[2]; s8 curRoomNum; - if (!IS_CUTSCENE_LAYER && (EnRu1_IsCsStateIdle(play))) { + if (!(IS_DEBUG && IS_CUTSCENE_LAYER) && EnRu1_IsCsStateIdle(play)) { curRoomNum = play->roomCtx.curRoom.num; SET_INFTABLE(INFTABLE_145); Flags_SetSwitch(play, func_80AEADE0(this)); @@ -2034,7 +2055,9 @@ void func_80AEF9D8(EnRu1* this, PlayState* play) { EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF624(this, play); +#if IS_DEBUG func_80AEB220(this, play); +#endif } void func_80AEFA2C(EnRu1* this, PlayState* play) { @@ -2048,7 +2071,9 @@ void func_80AEFA2C(EnRu1* this, PlayState* play) { func_80AEF5B8(this); func_80AEF40C(this); func_80AEF728(this, something); +#if IS_DEBUG func_80AEB220(this, play); +#endif } void func_80AEFAAC(EnRu1* this, PlayState* play) { @@ -2056,7 +2081,9 @@ void func_80AEFAAC(EnRu1* this, PlayState* play) { func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); func_80AEF79C(this, play); +#if IS_DEBUG func_80AEB220(this, play); +#endif } void func_80AEFB04(EnRu1* this, PlayState* play) { @@ -2067,7 +2094,9 @@ void func_80AEFB04(EnRu1* this, PlayState* play) { something = EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF820(this, something); +#if IS_DEBUG func_80AEB220(this, play); +#endif } void func_80AEFB68(EnRu1* this, PlayState* play) { @@ -2076,7 +2105,9 @@ void func_80AEFB68(EnRu1* this, PlayState* play) { EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF890(this, play); +#if IS_DEBUG func_80AEB220(this, play); +#endif } void func_80AEFBC8(EnRu1* this, PlayState* play) { @@ -2095,6 +2126,8 @@ void func_80AEFC24(EnRu1* this, PlayState* play) { void func_80AEFC54(EnRu1* this, PlayState* play) { if (GET_INFTABLE(INFTABLE_145) && !GET_INFTABLE(INFTABLE_146)) { + s32 pad; + func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->action = 41; this->unk_28C = EnRu1_FindSwitch(play); @@ -2197,6 +2230,7 @@ void func_80AEFF94(EnRu1* this, PlayState* play) { } } +#if IS_DEBUG void func_80AF0050(EnRu1* this, PlayState* play) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->action = 36; @@ -2204,6 +2238,7 @@ void func_80AF0050(EnRu1* this, PlayState* play) { this->unk_28C = EnRu1_FindSwitch(play); this->actor.room = -1; } +#endif void EnRu1_Update(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; @@ -2246,9 +2281,11 @@ void EnRu1_Init(Actor* thisx, PlayState* play) { case 6: func_80AEFF94(this, play); break; +#if IS_DEBUG case 10: func_80AF0050(this, play); break; +#endif default: Actor_Kill(&this->actor); // "Relevant arge_data = %d unacceptable" @@ -2288,10 +2325,11 @@ s32 EnRu1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p void EnRu1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnRu1* this = (EnRu1*)thisx; - Vec3f vec1; - Vec3f vec2; if (limbIndex == RUTO_CHILD_HEAD) { + Vec3f vec1; + Vec3f vec2; + vec1 = sMultVec; Matrix_MultVec3f(&vec1, &vec2); this->actor.focus.pos.x = vec2.x; diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1_cutscene_data.inc.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1_cutscene_data.inc.c index ade4ca4fa..6e8c8f4d3 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1_cutscene_data.inc.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1_cutscene_data.inc.c @@ -5,21 +5,21 @@ static CutsceneData D_80AF0880[] = { CS_BEGIN_CUTSCENE(15, 1306), CS_PLAYER_CUE_LIST(10), - CS_PLAYER_CUE(PLAYER_CUEID_39, 0, 50, 0x0000, 0x6C16, 0x0000, 12, -340, -2810, 12, -340, -2810, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_3, 50, 70, 0x0000, 0x6C16, 0x0000, 12, -340, -2810, 12, -340, -2810, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 70, 109, 0x0000, 0x6C16, 0x0000, 12, -340, -2810, 12, -340, -2810, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_2, 109, 135, 0x0000, 0x6C16, 0x0000, 12, -340, -2810, 100, -340, -2991, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 135, 199, 0x0000, 0x6C16, 0x0000, 100, -340, -2991, 100, -340, -2991, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_3, 199, 219, 0x0000, 0x6C16, 0x0000, 100, -340, -2991, 100, -340, -2991, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 219, 259, 0x0000, 0x6C16, 0x0000, 100, -340, -2991, 100, -340, -2991, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_3, 259, 276, 0x0000, 0x6C16, 0x0000, 100, -340, -2991, 100, -340, -2991, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_2, 276, 297, 0x0000, 0x6C16, 0x0000, 100, -340, -2991, 182, -340, -3132, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 297, 843, 0x0000, 0x6C16, 0x0000, 182, -340, -3132, 182, -340, -3132, 1.1393037e-29f, 0.0f, 1.4e-45f), + CS_PLAYER_CUE(PLAYER_CUEID_39, 0, 50, 0x0000, 0x6C16, 0x0000, 12, -340, -2810, 12, -340, -2810, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_3, 50, 70, 0x0000, 0x6C16, 0x0000, 12, -340, -2810, 12, -340, -2810, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 70, 109, 0x0000, 0x6C16, 0x0000, 12, -340, -2810, 12, -340, -2810, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_2, 109, 135, 0x0000, 0x6C16, 0x0000, 12, -340, -2810, 100, -340, -2991, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 135, 199, 0x0000, 0x6C16, 0x0000, 100, -340, -2991, 100, -340, -2991, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_3, 199, 219, 0x0000, 0x6C16, 0x0000, 100, -340, -2991, 100, -340, -2991, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 219, 259, 0x0000, 0x6C16, 0x0000, 100, -340, -2991, 100, -340, -2991, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_3, 259, 276, 0x0000, 0x6C16, 0x0000, 100, -340, -2991, 100, -340, -2991, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_2, 276, 297, 0x0000, 0x6C16, 0x0000, 100, -340, -2991, 182, -340, -3132, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 297, 843, 0x0000, 0x6C16, 0x0000, 182, -340, -3132, 182, -340, -3132, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), CS_ACTOR_CUE_LIST(63, 4), - CS_ACTOR_CUE(0x0002, 0, 178, 0x0000, 0xEC16, 0x0000, 127, -340, -3041, 127, -340, -3041, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_ACTOR_CUE(0x0003, 178, 245, 0x0000, 0x6C16, 0x0000, 127, -340, -3041, 127, -340, -3041, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_ACTOR_CUE(0x0004, 245, 260, 0x0000, 0x6C16, 0x0000, 127, -340, -3041, 127, -340, -3041, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_ACTOR_CUE(0x0005, 260, 396, 0x0000, 0x6C16, 0x0000, 127, -340, -3041, 127, -340, -3041, 1.1393037e-29f, 0.0f, 1.4e-45f), + CS_ACTOR_CUE(0x0002, 0, 178, 0x0000, 0xEC16, 0x0000, 127, -340, -3041, 127, -340, -3041, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_ACTOR_CUE(0x0003, 178, 245, 0x0000, 0x6C16, 0x0000, 127, -340, -3041, 127, -340, -3041, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_ACTOR_CUE(0x0004, 245, 260, 0x0000, 0x6C16, 0x0000, 127, -340, -3041, 127, -340, -3041, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_ACTOR_CUE(0x0005, 260, 396, 0x0000, 0x6C16, 0x0000, 127, -340, -3041, 127, -340, -3041, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), CS_MISC_LIST(1), CS_MISC(CS_MISC_STOP_CUTSCENE, 315, 345, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFC0, 0x00000032, 0x00000000, 0xFFFFFFC0, 0x00000032, 0x00000000, 0x00000000, 0x00000000), CS_TEXT_LIST(4), @@ -28,83 +28,83 @@ static CutsceneData D_80AF0880[] = { CS_TEXT_NONE(175, 252), CS_TEXT(0x401E, 252, 300, 0x0000, 0xFFFF, 0xFFFF), CS_CAM_EYE_SPLINE(0, 247), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 55, -290, -2749, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 55, -290, -2749, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 55, -290, -2749, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 55, -290, -2749, 0xE243), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 30.799889f, 55, -290, -2749, 0x005E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 30.799889f, 55, -290, -2749, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 30.799889f, 55, -290, -2749, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 30.799889f, 55, -290, -2749, 0x5B80), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 30.799889f, 55, -290, -2749, 0x49B4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 55, -290, -2749, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 55, -290, -2749, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 55, -290, -2749, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 55, -290, -2749, 0xE243), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41F6662C, 30.799889f), 55, -290, -2749, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41F6662C, 30.799889f), 55, -290, -2749, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41F6662C, 30.799889f), 55, -290, -2749, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41F6662C, 30.799889f), 55, -290, -2749, 0x5B80), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x41F6662C, 30.799889f), 55, -290, -2749, 0x49B4), CS_CAM_EYE_SPLINE(73, 208), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 99, -307, -2985, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 99, -307, -2985, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 99, -307, -2985, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 99, -307, -2985, 0xE243), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 99, -307, -2985, 0x005E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.399944f, 99, -307, -2985, 0xFFFF), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.399944f, 99, -307, -2985, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 99, -307, -2985, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 99, -307, -2985, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 99, -307, -2985, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 99, -307, -2985, 0xE243), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 99, -307, -2985, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 99, -307, -2985, 0xFFFF), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), 99, -307, -2985, 0x0000), CS_CAM_EYE_SPLINE(116, 1207), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.799946f, 155, -276, -2911, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.799946f, 155, -276, -2911, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.799946f, 155, -276, -2911, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.799946f, 155, -276, -2911, 0xE243), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.799946f, 155, -276, -2911, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42373325, 45.799946f), 155, -276, -2911, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42373325, 45.799946f), 155, -276, -2911, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42373325, 45.799946f), 155, -276, -2911, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42373325, 45.799946f), 155, -276, -2911, 0xE243), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42373325, 45.799946f), 155, -276, -2911, 0x005E), CS_CAM_EYE_SPLINE(186, 1277), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.39995f, 77, -315, -2992, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.39995f, 77, -315, -2992, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.39995f, 77, -315, -2992, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.39995f, 77, -315, -2992, 0xE243), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.39995f, 77, -315, -2992, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), 77, -315, -2992, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), 77, -315, -2992, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), 77, -315, -2992, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), 77, -315, -2992, 0xE243), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998C, 45.39995f), 77, -315, -2992, 0x005E), CS_CAM_EYE_SPLINE(256, 425), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 28.199883f, 350, -237, -3314, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 28.199883f, 350, -237, -3314, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 28.199883f, 350, -237, -3314, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 28.199883f, 350, -237, -3314, 0xE243), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 46.799953f, 350, -237, -3314, 0x005E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 46.799953f, 350, -237, -3314, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 46.799953f, 350, -237, -3314, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 46.799953f, 350, -237, -3314, 0x5B80), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41E1995C, 28.199883f), 350, -237, -3314, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41E1995C, 28.199883f), 350, -237, -3314, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41E1995C, 28.199883f), 350, -237, -3314, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41E1995C, 28.199883f), 350, -237, -3314, 0xE243), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423B3327, 46.799953f), 350, -237, -3314, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423B3327, 46.799953f), 350, -237, -3314, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x423B3327, 46.799953f), 350, -237, -3314, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x423B3327, 46.799953f), 350, -237, -3314, 0x5B80), CS_CAM_AT_SPLINE(0, 276), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 45.399944f, 40, -256, -2823, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 45.399944f, 40, -256, -2823, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, 45.399944f, 22, -313, -2823, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 45.399944f, 23, -313, -2823, 0xE243), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 6, 30.799889f, 73, -298, -2828, 0x005E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 30.799889f, 73, -298, -2828, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 30.799889f, 73, -298, -2828, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 30.799889f, 73, -298, -2828, 0x5B80), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 30.799889f, 73, -298, -2828, 0x49B4), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4235998B, 45.399944f), 40, -256, -2823, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4235998B, 45.399944f), 40, -256, -2823, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, CS_FLOAT(0x4235998B, 45.399944f), 22, -313, -2823, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x4235998B, 45.399944f), 23, -313, -2823, 0xE243), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 6, CS_FLOAT(0x41F6662C, 30.799889f), 73, -298, -2828, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41F6662C, 30.799889f), 73, -298, -2828, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41F6662C, 30.799889f), 73, -298, -2828, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41F6662C, 30.799889f), 73, -298, -2828, 0x5B80), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x41F6662C, 30.799889f), 73, -298, -2828, 0x49B4), CS_CAM_AT_SPLINE(73, 237), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.2f, 136, -314, -3060, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 60.600002f, 136, -314, -3060, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 45.399944f, 136, -314, -3060, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 136, -314, -3060, 0xE243), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 136, -314, -3060, 0x005E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.399944f, 135, -313, -3060, 0xFFFF), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.399944f, 135, -313, -3059, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4270CCCD, 60.2f), 136, -314, -3060, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x42726667, 60.600002f), 136, -314, -3060, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x4235998B, 45.399944f), 136, -314, -3060, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 136, -314, -3060, 0xE243), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 136, -314, -3060, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 135, -313, -3060, 0xFFFF), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), 135, -313, -3059, 0x0000), CS_CAM_AT_SPLINE(116, 1236), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.799946f, 132, -305, -2969, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.799946f, 132, -304, -2969, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.799946f, 133, -304, -2969, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.799946f, 133, -304, -2969, 0xE243), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.799946f, 133, -304, -2969, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42373325, 45.799946f), 132, -305, -2969, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42373325, 45.799946f), 132, -304, -2969, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42373325, 45.799946f), 133, -304, -2969, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42373325, 45.799946f), 133, -304, -2969, 0xE243), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42373325, 45.799946f), 133, -304, -2969, 0x005E), CS_CAM_AT_SPLINE(186, 1306), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.39995f, 138, -301, -3032, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.39995f, 138, -301, -3032, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.39995f, 138, -301, -3032, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.39995f, 138, -301, -3032, 0xE243), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.39995f, 138, -301, -3032, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998C, 45.39995f), 138, -301, -3032, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998C, 45.39995f), 138, -301, -3032, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998C, 45.39995f), 138, -301, -3032, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998C, 45.39995f), 138, -301, -3032, 0xE243), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998C, 45.39995f), 138, -301, -3032, 0x005E), CS_CAM_AT_SPLINE(256, 454), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 28.199883f, 307, -254, -3258, 0x20BA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 28.199883f, 307, -254, -3258, 0x44B8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 9, 28.199883f, 307, -254, -3258, 0x8080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 9, 46.799953f, 304, -273, -3273, 0xE243), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 46.799953f, 304, -272, -3274, 0x005E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 46.799953f, 304, -272, -3274, 0xFFFF), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 46.799953f, 304, -272, -3274, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 46.799953f, 305, -272, -3274, 0x5B80), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41E1995C, 28.199883f), 307, -254, -3258, 0x20BA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41E1995C, 28.199883f), 307, -254, -3258, 0x44B8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 9, CS_FLOAT(0x41E1995C, 28.199883f), 307, -254, -3258, 0x8080), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 9, CS_FLOAT(0x423B3327, 46.799953f), 304, -273, -3273, 0xE243), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423B3327, 46.799953f), 304, -272, -3274, 0x005E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423B3327, 46.799953f), 304, -272, -3274, 0xFFFF), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x423B3327, 46.799953f), 304, -272, -3274, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x423B3327, 46.799953f), 305, -272, -3274, 0x5B80), CS_START_SEQ_LIST(1), CS_START_SEQ(NA_BGM_APPEAR, 74, 75, 0x0000, 0x00000000, 0xFFFFFFF1, 0x00000000, 0x0000004E, 0xFFFFFFF1, 0x00000000, 0x0000004E), CS_END(), @@ -115,24 +115,24 @@ static u32 D_80AF10A0 = 0; static CutsceneData D_80AF10A4[] = { CS_BEGIN_CUTSCENE(14, 1299), CS_PLAYER_CUE_LIST(3), - CS_PLAYER_CUE(PLAYER_CUEID_5, 0, 272, 0x0000, 0xC000, 0x0000, -1085, -1025, -3347, -1085, -1025, -3347, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_3, 272, 292, 0x0000, 0xC000, 0x0000, -1085, -1025, -3347, -1085, -1025, -3347, 1.1393037e-29f, 0.0f, 1.4e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 292, 777, 0x0000, 0xC000, 0x0000, -1085, -1025, -3347, -1085, -1025, -3347, 1.1393037e-29f, 0.0f, 1.4e-45f), + CS_PLAYER_CUE(PLAYER_CUEID_5, 0, 272, 0x0000, 0xC000, 0x0000, -1085, -1025, -3347, -1085, -1025, -3347, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_3, 272, 292, 0x0000, 0xC000, 0x0000, -1085, -1025, -3347, -1085, -1025, -3347, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 292, 777, 0x0000, 0xC000, 0x0000, -1085, -1025, -3347, -1085, -1025, -3347, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), CS_MISC_LIST(1), CS_MISC(CS_MISC_STOP_CUTSCENE, 330, 627, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFC0, 0x00000032, 0x00000000, 0xFFFFFFC0, 0x00000032, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(66, 3), - CS_ACTOR_CUE(0x0001, 0, 40, 0x0000, 0x4000, 0x0000, -1352, -969, -3341, -1352, -969, -3341, 0.0f, 0.0f, 1.4e-45f), - CS_ACTOR_CUE(0x0002, 40, 213, 0x0000, 0x4000, 0x0000, -1352, -969, -3341, -1360, -969, -3343, 0.0f, 0.0f, 1.4e-45f), - CS_ACTOR_CUE(0x0003, 213, 1000, 0x0000, 0x4000, 0x0000, -1360, -969, -3343, -1360, -969, -3343, 0.0f, 0.0f, 1.4e-45f), + CS_ACTOR_CUE(0x0001, 0, 40, 0x0000, 0x4000, 0x0000, -1352, -969, -3341, -1352, -969, -3341, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_ACTOR_CUE(0x0002, 40, 213, 0x0000, 0x4000, 0x0000, -1352, -969, -3341, -1360, -969, -3343, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_ACTOR_CUE(0x0003, 213, 1000, 0x0000, 0x4000, 0x0000, -1360, -969, -3343, -1360, -969, -3343, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), CS_ACTOR_CUE_LIST(48, 1), - CS_ACTOR_CUE(0x0002, 0, 90, 0x0000, 0x0000, 0x0000, -1360, -963, -3343, -1360, -963, -3343, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0002, 0, 90, 0x0000, 0x0000, 0x0000, -1360, -963, -3343, -1360, -963, -3343, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(48, 2), - CS_ACTOR_CUE(0x0002, 90, 211, 0x0000, 0x0000, 0x0000, -1352, -922, -3341, -1352, -922, -3341, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0006, 211, 311, 0x0000, 0x0000, 0x0000, -1352, -922, -3341, -1352, -922, -3341, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0002, 90, 211, 0x0000, 0x0000, 0x0000, -1352, -922, -3341, -1352, -922, -3341, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0006, 211, 311, 0x0000, 0x0000, 0x0000, -1352, -922, -3341, -1352, -922, -3341, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(62, 3), - CS_ACTOR_CUE(0x0004, 0, 210, 0x0000, 0x0000, 0x0000, -1065, -972, -3305, -1065, -978, -3305, 0.0f, -0.028571429f, 0.0f), - CS_ACTOR_CUE(0x0004, 210, 220, 0x8000, 0x0000, 0x0000, -1065, -978, -3305, -1065, -973, -3344, 0.0f, 0.5f, 0.0f), - CS_ACTOR_CUE(0x0004, 220, 410, 0x0000, 0x0000, 0x0000, -1065, -973, -3344, -1065, -976, -3344, 0.0f, -0.015789473f, 0.0f), + CS_ACTOR_CUE(0x0004, 0, 210, 0x0000, 0x0000, 0x0000, -1065, -972, -3305, -1065, -978, -3305, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xBCEA0EA1, -0.028571429f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0004, 210, 220, 0x8000, 0x0000, 0x0000, -1065, -978, -3305, -1065, -973, -3344, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x3F000000, 0.5f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0004, 220, 410, 0x0000, 0x0000, 0x0000, -1065, -973, -3344, -1065, -976, -3344, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xBC8158ED, -0.015789473f), CS_FLOAT(0x0, 0.0f)), CS_TEXT_LIST(6), CS_TEXT_NONE(0, 162), CS_TEXT(0x4050, 162, 211, 0x0000, 0xFFFF, 0xFFFF), @@ -143,59 +143,59 @@ static CutsceneData D_80AF10A4[] = { CS_START_SEQ_LIST(1), CS_START_SEQ(NA_BGM_ITEM_GET, 112, 113, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFC7, 0x000000B1, 0x00000000, 0xFFFFFFC7, 0x000000B1), CS_CAM_EYE_SPLINE(0, 1176), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 41.9066f, -1390, -948, -3339, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.706596f, -1390, -948, -3339, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.706596f, -1390, -948, -3339, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.706596f, -1418, -938, -3337, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.10661f, -1418, -938, -3337, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.10661f, -1418, -938, -3337, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.10661f, -1418, -938, -3337, 0x013F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.10661f, -1418, -938, -3337, 0x006D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4227A05C, 41.9066f), -1390, -948, -3339, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4222D38E, 40.706596f), -1390, -948, -3339, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4222D38E, 40.706596f), -1390, -948, -3339, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4222D38E, 40.706596f), -1418, -938, -3337, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42346D2B, 45.10661f), -1418, -938, -3337, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42346D2B, 45.10661f), -1418, -938, -3337, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42346D2B, 45.10661f), -1418, -938, -3337, 0x013F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42346D2B, 45.10661f), -1418, -938, -3337, 0x006D), CS_CAM_EYE_SPLINE(91, 1270), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 44.906612f, -1319, -934, -3343, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 44.70661f, -1319, -936, -3344, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 44.70661f, -1319, -936, -3344, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 44.70661f, -1319, -936, -3344, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 44.70661f, -1326, -904, -3342, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.906673f, -1326, -904, -3342, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.906673f, -1326, -904, -3342, 0x013F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.906673f, -1326, -904, -3342, 0x014E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.906673f, -1326, -904, -3342, 0x015F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.906673f, -1326, -904, -3342, 0x0161), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.906673f, -1326, -1024, -3342, 0x652E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4233A05F, 44.906612f), -1319, -934, -3343, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4232D392, 44.70661f), -1319, -936, -3344, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4232D392, 44.70661f), -1319, -936, -3344, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4232D392, 44.70661f), -1319, -936, -3344, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4232D392, 44.70661f), -1326, -904, -3342, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4273A06F, 60.906673f), -1326, -904, -3342, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4273A06F, 60.906673f), -1326, -904, -3342, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4273A06F, 60.906673f), -1326, -904, -3342, 0x014E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4273A06F, 60.906673f), -1326, -904, -3342, 0x015F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4273A06F, 60.906673f), -1326, -904, -3342, 0x0161), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4273A06F, 60.906673f), -1326, -1024, -3342, 0x652E), CS_CAM_EYE_SPLINE(211, 332), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 30.306555f, -1471, -819, -3149, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 30.306555f, -1471, -819, -3149, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 30.306555f, -1471, -819, -3149, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 30.306555f, -1471, -819, -3149, 0x00E8), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 30.306555f, -1471, -819, -3149, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41F273D3, 30.306555f), -1471, -819, -3149, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41F273D3, 30.306555f), -1471, -819, -3149, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41F273D3, 30.306555f), -1471, -819, -3149, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x41F273D3, 30.306555f), -1471, -819, -3149, 0x00E8), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x41F273D3, 30.306555f), -1471, -819, -3149, 0x00EA), CS_CAM_AT_SPLINE(0, 1205), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.706596f, -1295, -1003, -3352, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 40.706596f, -1296, -1003, -3352, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 40.706596f, -1296, -1003, -3352, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 45.10661f, -1314, -969, -3346, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.10661f, -1313, -970, -3346, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.10661f, -1313, -969, -3346, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.10661f, -1313, -970, -3346, 0x013F), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.10661f, -1313, -970, -3346, 0x006D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4222D38E, 40.706596f), -1295, -1003, -3352, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4222D38E, 40.706596f), -1296, -1003, -3352, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x4222D38E, 40.706596f), -1296, -1003, -3352, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42346D2B, 45.10661f), -1314, -969, -3346, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42346D2B, 45.10661f), -1313, -970, -3346, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42346D2B, 45.10661f), -1313, -969, -3346, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42346D2B, 45.10661f), -1313, -970, -3346, 0x013F), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42346D2B, 45.10661f), -1313, -970, -3346, 0x006D), CS_CAM_AT_SPLINE(91, 1299), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 44.70661f, -1405, -988, -3343, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 44.70661f, -1406, -989, -3344, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 44.70661f, -1406, -989, -3344, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 44.70661f, -1406, -989, -3344, 0x00E8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, 60.906673f, -1393, -978, -3342, 0x00EA), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.906673f, -1393, -977, -3342, 0x013D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.906673f, -1393, -977, -3342, 0x013F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 60.906673f, -1393, -977, -3342, 0x014E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.906673f, -1393, -977, -3342, 0x015F), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.906673f, -1393, -977, -3342, 0x0161), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.906673f, -1401, -1094, -3347, 0x652E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4232D392, 44.70661f), -1405, -988, -3343, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x4232D392, 44.70661f), -1406, -989, -3344, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x4232D392, 44.70661f), -1406, -989, -3344, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x4232D392, 44.70661f), -1406, -989, -3344, 0x00E8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 7, CS_FLOAT(0x4273A06F, 60.906673f), -1393, -978, -3342, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4273A06F, 60.906673f), -1393, -977, -3342, 0x013D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4273A06F, 60.906673f), -1393, -977, -3342, 0x013F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4273A06F, 60.906673f), -1393, -977, -3342, 0x014E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4273A06F, 60.906673f), -1393, -977, -3342, 0x015F), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4273A06F, 60.906673f), -1393, -977, -3342, 0x0161), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4273A06F, 60.906673f), -1401, -1094, -3347, 0x652E), CS_CAM_AT_SPLINE(211, 361), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 30.306555f, -1426, -857, -3190, 0x00C6), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 30.306555f, -1426, -857, -3190, 0x00C8), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 30.306555f, -1426, -857, -3190, 0x00D7), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 30.306555f, -1426, -857, -3190, 0x00E8), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 30.306555f, -1426, -857, -3190, 0x00EA), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41F273D3, 30.306555f), -1426, -857, -3190, 0x00C6), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41F273D3, 30.306555f), -1426, -857, -3190, 0x00C8), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41F273D3, 30.306555f), -1426, -857, -3190, 0x00D7), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x41F273D3, 30.306555f), -1426, -857, -3190, 0x00E8), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x41F273D3, 30.306555f), -1426, -857, -3190, 0x00EA), CS_END(), }; @@ -206,31 +206,31 @@ static CutsceneData D_80AF1728[] = { CS_MISC_LIST(1), CS_MISC(CS_MISC_STOP_CUTSCENE, 75, 627, 0x0000, 0x00000000, 0x00000000, 0xFFFFFFC0, 0x00000032, 0x00000000, 0xFFFFFFC0, 0x00000032, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(48, 1), - CS_ACTOR_CUE(0x0002, 0, 90, 0x0000, 0x0000, 0x0000, -1360, -963, -3343, -1360, -963, -3343, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0002, 0, 90, 0x0000, 0x0000, 0x0000, -1360, -963, -3343, -1360, -963, -3343, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_CAM_EYE_SPLINE(0, 1091), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.599983f, -1381, -958, -3331, 0x8BC0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.599983f, -1381, -958, -3331, 0x2200), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.599983f, -1381, -958, -3331, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 40.599983f, -1381, -958, -3331, 0xD0E8), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 40.599983f, -1381, -958, -3331, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42226662, 40.599983f), -1381, -958, -3331, 0x8BC0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42226662, 40.599983f), -1381, -958, -3331, 0x2200), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42226662, 40.599983f), -1381, -958, -3331, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42226662, 40.599983f), -1381, -958, -3331, 0xD0E8), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42226662, 40.599983f), -1381, -958, -3331, 0x0000), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(40, 1131), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 50.800022f, 19, 40, 53, 0x8BC0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 50.800022f, 19, 40, 53, 0x2200), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 50.800022f, 19, 40, 53, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 50.800022f, 19, 40, 53, 0xD0E8), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 50.800022f, 19, 40, 53, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x424B3339, 50.800022f), 19, 40, 53, 0x8BC0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x424B3339, 50.800022f), 19, 40, 53, 0x2200), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x424B3339, 50.800022f), 19, 40, 53, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x424B3339, 50.800022f), 19, 40, 53, 0xD0E8), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x424B3339, 50.800022f), 19, 40, 53, 0x0000), CS_CAM_AT_SPLINE(0, 1120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.599983f, -1224, -979, -3366, 0x8BC0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.599983f, -1224, -979, -3366, 0x2200), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 40.599983f, -1224, -979, -3366, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 40.599983f, -1224, -979, -3366, 0xD0E8), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 40.599983f, -1224, -979, -3366, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42226662, 40.599983f), -1224, -979, -3366, 0x8BC0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42226662, 40.599983f), -1224, -979, -3366, 0x2200), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42226662, 40.599983f), -1224, -979, -3366, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42226662, 40.599983f), -1224, -979, -3366, 0xD0E8), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42226662, 40.599983f), -1224, -979, -3366, 0x0000), CS_CAM_AT_SPLINE_REL_TO_PLAYER(40, 1160), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 50.800022f, -35, 56, -93, 0x8BC0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 50.800022f, -35, 56, -93, 0x2200), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 50.800022f, -35, 56, -93, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 50.800022f, -35, 56, -93, 0xD0E8), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 50.800022f, -35, 56, -93, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x424B3339, 50.800022f), -35, 56, -93, 0x8BC0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x424B3339, 50.800022f), -35, 56, -93, 0x2200), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x424B3339, 50.800022f), -35, 56, -93, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x424B3339, 50.800022f), -35, 56, -93, 0xD0E8), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x424B3339, 50.800022f), -35, 56, -93, 0x0000), CS_TEXT_LIST(2), CS_TEXT_NONE(0, 35), CS_TEXT(0x404F, 35, 70, 0x0000, 0xFFFF, 0xFFFF), diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index b86112f53..98e705ce7 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -61,9 +61,10 @@ static void* sEyeTextures[] = { gAdultRutoEyeClosedTex, }; +#if IS_DEBUG static UNK_TYPE D_80AF4118 = 0; +#endif -#pragma asmproc recurse #include "z_en_ru2_cutscene_data.inc.c" static EnRu2ActionFunc sActionFuncs[] = { @@ -137,6 +138,7 @@ s32 func_80AF26A0(EnRu2* this) { return params & 0xFF; } +#if IS_DEBUG void func_80AF26AC(EnRu2* this) { this->action = 7; this->drawConfig = 0; @@ -164,6 +166,7 @@ void func_80AF26D0(EnRu2* this, PlayState* play) { } } } +#endif void func_80AF2744(EnRu2* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2); @@ -175,8 +178,11 @@ s32 EnRu2_UpdateSkelAnime(EnRu2* this) { CsCmdActorCue* EnRu2_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } + return NULL; } @@ -447,7 +453,9 @@ void func_80AF30AC(EnRu2* this, PlayState* play) { void func_80AF3144(EnRu2* this, PlayState* play) { func_80AF2F04(this, play); +#if IS_DEBUG func_80AF26D0(this, play); +#endif } void func_80AF3174(EnRu2* this, PlayState* play) { @@ -455,7 +463,9 @@ void func_80AF3174(EnRu2* this, PlayState* play) { EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF2F58(this, play); +#if IS_DEBUG func_80AF26D0(this, play); +#endif } void func_80AF31C8(EnRu2* this, PlayState* play) { @@ -463,7 +473,9 @@ void func_80AF31C8(EnRu2* this, PlayState* play) { EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF30AC(this, play); +#if IS_DEBUG func_80AF26D0(this, play); +#endif } void func_80AF321C(EnRu2* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2_cutscene_data.inc.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2_cutscene_data.inc.c index efc9e0cf4..5a46e4101 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2_cutscene_data.inc.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2_cutscene_data.inc.c @@ -7,198 +7,198 @@ static CutsceneData D_80AF411C[] = { CS_UNK_DATA_LIST(0x00000020, 1), CS_UNK_DATA(0x00010000, 0x0BB80000, 0x00000000, 0x00000000, 0xFFFFFFFC, 0x00000002, 0x00000000, 0xFFFFFFFC, 0x00000002, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(31, 5), - CS_ACTOR_CUE(0x0001, 0, 829, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 829, 830, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0004, 830, 898, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 898, 948, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 82, 0, 0.0f, -2.68f, 0.0f), - CS_ACTOR_CUE(0x0003, 948, 3338, 0x0000, 0x0000, 0x0000, 0, 82, 0, 0, 82, 0, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 829, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 829, 830, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0004, 830, 898, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 216, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 898, 948, 0x0000, 0x0000, 0x0000, 0, 216, 0, 0, 82, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xC02B851F, -2.68f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 948, 3338, 0x0000, 0x0000, 0x0000, 0, 82, 0, 0, 82, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_PLAYER_CUE_LIST(5), - CS_PLAYER_CUE(PLAYER_CUEID_13, 0, 240, 0x0000, 0x0000, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 0.0f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 240, 520, 0x0000, 0x4000, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 0.0f), - CS_PLAYER_CUE(PLAYER_CUEID_3, 520, 550, 0x0000, 0x4000, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 0.0f), - CS_PLAYER_CUE(PLAYER_CUEID_5, 550, 801, 0x0000, 0x4000, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 0.0f), - CS_PLAYER_CUE(PLAYER_CUEID_19, 801, 1956, 0x0000, 0xC000, 0x0000, 0, 6, 0, 0, 6, 0, 0.0f, 0.0f, 0.0f), + CS_PLAYER_CUE(PLAYER_CUEID_13, 0, 240, 0x0000, 0x0000, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 240, 520, 0x0000, 0x4000, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_PLAYER_CUE(PLAYER_CUEID_3, 520, 550, 0x0000, 0x4000, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_PLAYER_CUE(PLAYER_CUEID_5, 550, 801, 0x0000, 0x4000, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_PLAYER_CUE(PLAYER_CUEID_19, 801, 1956, 0x0000, 0xC000, 0x0000, 0, 6, 0, 0, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(49, 1), - CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, -16, -121, 0, -16, -121, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, -16, -121, 0, -16, -121, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_LIGHT_SETTING_LIST(5), - CS_LIGHT_SETTING(0x0004, 0, 384, 0x0000, 0x00000000, 0xFFFFFFA1, 0x00000000, 0x00000058, 0xFFFFFFA1, 0x00000000, 0x00000058), - CS_LIGHT_SETTING(0x0005, 384, 454, 0x0000, 0x00000000, 0xFFFFFFA1, 0x00000000, 0x00000058, 0xFFFFFFA1, 0x00000000, 0x00000058), - CS_LIGHT_SETTING(0x0004, 454, 554, 0x0000, 0x00000000, 0xFFFFFFA1, 0x00000000, 0x00000058, 0xFFFFFFA1, 0x00000000, 0x00000058), - CS_LIGHT_SETTING(0x0005, 554, 624, 0x0000, 0x00000000, 0xFFFFFFA1, 0x00000000, 0x00000058, 0xFFFFFFA1, 0x00000000, 0x00000058), - CS_LIGHT_SETTING(0x0004, 624, 3001, 0x0000, 0x00000000, 0xFFFFFFA1, 0x00000000, 0x00000058, 0xFFFFFFA1, 0x00000000, 0x00000058), + CS_LIGHT_SETTING(0x0004, 0, 384, 0x0000, 0x00000000, 0xFFFFFFA1, 0x00000000, 0x00000058, 0xFFFFFFA1, 0x00000000, 0x00000058, 0x00000000, 0x00000000, 0x00000000), + CS_LIGHT_SETTING(0x0005, 384, 454, 0x0000, 0x00000000, 0xFFFFFFA1, 0x00000000, 0x00000058, 0xFFFFFFA1, 0x00000000, 0x00000058, 0x00000000, 0x00000000, 0x00000000), + CS_LIGHT_SETTING(0x0004, 454, 554, 0x0000, 0x00000000, 0xFFFFFFA1, 0x00000000, 0x00000058, 0xFFFFFFA1, 0x00000000, 0x00000058, 0x00000000, 0x00000000, 0x00000000), + CS_LIGHT_SETTING(0x0005, 554, 624, 0x0000, 0x00000000, 0xFFFFFFA1, 0x00000000, 0x00000058, 0xFFFFFFA1, 0x00000000, 0x00000058, 0x00000000, 0x00000000, 0x00000000), + CS_LIGHT_SETTING(0x0004, 624, 3001, 0x0000, 0x00000000, 0xFFFFFFA1, 0x00000000, 0x00000058, 0xFFFFFFA1, 0x00000000, 0x00000058, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(39, 1), - CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, 0, -2, 0, 0, -2, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 3000, 0x0000, 0x0000, 0x0000, 0, 0, -2, 0, 0, -2, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_ACTOR_CUE_LIST(42, 3), - CS_ACTOR_CUE(0x0001, 0, 146, 0x0000, 0x0000, 0x0000, 195, 6, 0, 195, 6, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0002, 146, 754, 0x0000, 0x0000, 0x0000, 195, 6, 0, 195, 6, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0003, 754, 2628, 0x0000, 0x0000, 0x0000, 195, 6, 0, 195, 6, 0, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0001, 0, 146, 0x0000, 0x0000, 0x0000, 195, 6, 0, 195, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 146, 754, 0x0000, 0x0000, 0x0000, 195, 6, 0, 195, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 754, 2628, 0x0000, 0x0000, 0x0000, 195, 6, 0, 195, 6, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 810, 823), CS_TRANSITION(CS_TRANS_GRAY_FILL_OUT, 825, 855), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 1090, 1121), CS_CAM_EYE_SPLINE(0, 301), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 175.39832f, -617, 30, 71, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 175.39832f, -617, 30, 71, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 175.39832f, -617, 30, 71, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 175.39832f, -617, 30, 71, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 175.39832f, -617, 30, 71, 0x1F98), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 175.39832f, -617, 30, 71, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 145.79877f, -456, 107, 56, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -76, 54, 71, 0x0164), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 116, 54, 96, 0x2100), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 236, 11, 64, 0x0049), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 236, 11, 64, 0x204C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, 236, 11, 64, 0xE990), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.600002f, 236, 11, 64, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x432F65F8, 175.39832f), -617, 30, 71, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x432F65F8, 175.39832f), -617, 30, 71, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x432F65F8, 175.39832f), -617, 30, 71, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x432F65F8, 175.39832f), -617, 30, 71, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x432F65F8, 175.39832f), -617, 30, 71, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x432F65F8, 175.39832f), -617, 30, 71, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4311CC7C, 145.79877f), -456, 107, 56, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -76, 54, 71, 0x0164), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 116, 54, 96, 0x2100), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 236, 11, 64, 0x0049), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 236, 11, 64, 0x204C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 236, 11, 64, 0xE990), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), 236, 11, 64, 0x0000), CS_CAM_EYE_SPLINE(263, 1484), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 42.22703f, 161, 53, 26, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 42.22703f, 161, 53, 26, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 42.22703f, 161, 53, 26, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 42.22703f, 130, 9, 96, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 42.22703f, 130, 9, 96, 0x1F98), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 42.22703f, 130, 9, 96, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 42.22703f, 130, 9, 96, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 42.22703f, 130, 9, 96, 0x0164), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4228E87B, 42.22703f), 161, 53, 26, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4228E87B, 42.22703f), 161, 53, 26, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4228E87B, 42.22703f), 161, 53, 26, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4228E87B, 42.22703f), 130, 9, 96, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4228E87B, 42.22703f), 130, 9, 96, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4228E87B, 42.22703f), 130, 9, 96, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4228E87B, 42.22703f), 130, 9, 96, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4228E87B, 42.22703f), 130, 9, 96, 0x0164), CS_CAM_EYE_SPLINE(383, 1474), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.22702f, 207, 45, 34, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.22702f, 207, 45, 34, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.22702f, 207, 45, 34, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.22702f, 207, 45, 34, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 70.22702f, 207, 45, 34, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428C743C, 70.22702f), 207, 45, 34, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428C743C, 70.22702f), 207, 45, 34, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428C743C, 70.22702f), 207, 45, 34, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428C743C, 70.22702f), 207, 45, 34, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x428C743C, 70.22702f), 207, 45, 34, 0x1F98), CS_CAM_EYE_SPLINE(453, 1544), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.027042f, -58, 90, 70, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.027042f, -58, 90, 70, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.027042f, -58, 90, 70, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.027042f, -58, 90, 70, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.027042f, -58, 90, 70, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42341BB1, 45.027042f), -58, 90, 70, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42341BB1, 45.027042f), -58, 90, 70, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42341BB1, 45.027042f), -58, 90, 70, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42341BB1, 45.027042f), -58, 90, 70, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42341BB1, 45.027042f), -58, 90, 70, 0x1F98), CS_CAM_EYE_SPLINE(553, 1644), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.22702f, 207, 45, 34, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.22702f, 207, 45, 34, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.22702f, 207, 45, 34, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.22702f, 207, 45, 34, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 70.22702f, 207, 45, 34, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428C743C, 70.22702f), 207, 45, 34, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428C743C, 70.22702f), 207, 45, 34, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428C743C, 70.22702f), 207, 45, 34, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428C743C, 70.22702f), 207, 45, 34, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x428C743C, 70.22702f), 207, 45, 34, 0x1F98), CS_CAM_EYE_SPLINE(623, 1714), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4271f, 161, 59, 0, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4271f, 161, 59, 0, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4271f, 161, 59, 0, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4271f, 161, 59, 0, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.4271f, 161, 59, 0, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 161, 59, 0, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 161, 59, 0, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 161, 59, 0, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 161, 59, 0, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 161, 59, 0, 0x1F98), CS_CAM_EYE_SPLINE(693, 1784), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4271f, 151, 82, 35, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4271f, 151, 82, 35, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4271f, 151, 82, 35, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4271f, 151, 82, 35, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.4271f, 151, 82, 35, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 151, 82, 35, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 151, 82, 35, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 151, 82, 35, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 151, 82, 35, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 151, 82, 35, 0x1F98), CS_CAM_EYE_SPLINE(763, 944), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4271f, 230, 7, 24, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4271f, 230, 7, 24, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4271f, 230, 7, 24, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.4271f, 207, 62, 15, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.42702f, 230, 240, 24, 0x1F98), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.42702f, 230, 240, 24, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 70.42702f, 230, 240, 24, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 70.42702f, 230, 240, 24, 0x0164), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 230, 7, 24, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 230, 7, 24, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 230, 7, 24, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4271B55A, 60.4271f), 207, 62, 15, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428CDAA2, 70.42702f), 230, 240, 24, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428CDAA2, 70.42702f), 230, 240, 24, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x428CDAA2, 70.42702f), 230, 240, 24, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x428CDAA2, 70.42702f), 230, 240, 24, 0x0164), CS_CAM_EYE_SPLINE(823, 1165), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 13, 854, 2, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 853, 5, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -3, 853, 5, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -9, 853, -6, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -2, 852, -17, 0x1F98), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 852, -17, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 16, 852, -6, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, 9, 852, 5, 0x0164), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -3, 851, 5, 0x2100), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 13, 854, 2, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 853, 5, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -3, 853, 5, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -9, 853, -6, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -2, 852, -17, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 852, -17, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 16, 852, -6, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), 9, 852, 5, 0x0164), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -3, 851, 5, 0x2100), CS_CAM_EYE_SPLINE_REL_TO_PLAYER(899, 2080), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 33, -27, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 33, -27, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 68, -26, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x1F98), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 68.599945f, 0, 103, -26, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 68.599945f, 0, 103, -26, 0x0164), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 33, -27, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 33, -27, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 68, -26, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4289332C, 68.599945f), 0, 103, -26, 0x0164), CS_CAM_AT_SPLINE(0, 330), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x1E, 20, 175.39832f, -649, -75, 101, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0xE2, 20, 175.39832f, -652, -75, 98, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x1E, 20, 175.39832f, -658, -75, 87, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0xE2, 20, 175.39832f, -678, 127, 71, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 175.39832f, -727, 0, 71, 0x1F98), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 145.79877f, -513, 0, 43, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -349, 89, 47, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, 6, 61, 1, 0x0164), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, 33, 66, 28, 0x2100), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, 158, 42, 1, 0x0049), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, 158, 42, 1, 0x204C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, 158, 42, 1, 0xE990), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.600002f, 158, 42, 1, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x1E, 20, CS_FLOAT(0x432F65F8, 175.39832f), -649, -75, 101, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0xE2, 20, CS_FLOAT(0x432F65F8, 175.39832f), -652, -75, 98, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x1E, 20, CS_FLOAT(0x432F65F8, 175.39832f), -658, -75, 87, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0xE2, 20, CS_FLOAT(0x432F65F8, 175.39832f), -678, 127, 71, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x432F65F8, 175.39832f), -727, 0, 71, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x4311CC7C, 145.79877f), -513, 0, 43, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -349, 89, 47, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), 6, 61, 1, 0x0164), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), 33, 66, 28, 0x2100), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), 158, 42, 1, 0x0049), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), 158, 42, 1, 0x204C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), 158, 42, 1, 0xE990), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), 158, 42, 1, 0x0000), CS_CAM_AT_SPLINE(263, 1513), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 42.22703f, 322, 62, -122, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 42.22703f, 322, 62, -122, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 42.22703f, 322, 62, -122, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 42.22703f, 232, 63, -83, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 42.22703f, 232, 63, -83, 0x1F98), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 42.22703f, 232, 63, -83, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 42.22703f, 232, 63, -83, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 42.22703f, 232, 63, -83, 0x0164), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4228E87B, 42.22703f), 322, 62, -122, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4228E87B, 42.22703f), 322, 62, -122, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4228E87B, 42.22703f), 322, 62, -122, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4228E87B, 42.22703f), 232, 63, -83, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4228E87B, 42.22703f), 232, 63, -83, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4228E87B, 42.22703f), 232, 63, -83, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4228E87B, 42.22703f), 232, 63, -83, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4228E87B, 42.22703f), 232, 63, -83, 0x0164), CS_CAM_AT_SPLINE(383, 1503), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.22702f, 51, 62, -105, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.22702f, 51, 62, -105, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 70.22702f, 51, 62, -105, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.22702f, 51, 62, -105, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 70.22702f, 51, 62, -105, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428C743C, 70.22702f), 51, 62, -105, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428C743C, 70.22702f), 51, 62, -105, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x428C743C, 70.22702f), 51, 62, -105, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428C743C, 70.22702f), 51, 62, -105, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x428C743C, 70.22702f), 51, 62, -105, 0x1F98), CS_CAM_AT_SPLINE(453, 1573), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.027042f, 102, 22, -31, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.027042f, 102, 22, -31, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 45.027042f, 102, 22, -31, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.027042f, 102, 22, -31, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.027042f, 102, 22, -31, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42341BB1, 45.027042f), 102, 22, -31, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42341BB1, 45.027042f), 102, 22, -31, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42341BB1, 45.027042f), 102, 22, -31, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42341BB1, 45.027042f), 102, 22, -31, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42341BB1, 45.027042f), 102, 22, -31, 0x1F98), CS_CAM_AT_SPLINE(553, 1673), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.22702f, 51, 62, -105, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.22702f, 51, 62, -105, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 70.22702f, 51, 62, -105, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.22702f, 51, 62, -105, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 70.22702f, 51, 62, -105, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428C743C, 70.22702f), 51, 62, -105, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428C743C, 70.22702f), 51, 62, -105, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x428C743C, 70.22702f), 51, 62, -105, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428C743C, 70.22702f), 51, 62, -105, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x428C743C, 70.22702f), 51, 62, -105, 0x1F98), CS_CAM_AT_SPLINE(623, 1743), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.4271f, 347, 22, 0, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.4271f, 347, 22, 0, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 60.4271f, 347, 22, 0, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.4271f, 347, 22, 0, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.4271f, 347, 22, 0, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4271B55A, 60.4271f), 347, 22, 0, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4271B55A, 60.4271f), 347, 22, 0, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4271B55A, 60.4271f), 347, 22, 0, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4271B55A, 60.4271f), 347, 22, 0, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4271B55A, 60.4271f), 347, 22, 0, 0x1F98), CS_CAM_AT_SPLINE(693, 1813), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.4271f, 258, -30, -54, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.4271f, 258, -30, -54, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 60.4271f, 258, -30, -54, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.4271f, 258, -30, -54, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.4271f, 258, -30, -54, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4271B55A, 60.4271f), 258, -30, -54, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4271B55A, 60.4271f), 258, -30, -54, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4271B55A, 60.4271f), 258, -30, -54, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4271B55A, 60.4271f), 258, -30, -54, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4271B55A, 60.4271f), 258, -30, -54, 0x1F98), CS_CAM_AT_SPLINE(763, 973), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.4271f, 96, 105, -29, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, 60.4271f, 96, 105, -29, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 60.4271f, 96, 105, -29, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, 60.0271f, 110, 196, -26, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 70.42702f, 185, 399, 6, 0x1F98), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.42702f, 185, 399, 6, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 70.42702f, 185, 399, 6, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 70.42702f, 185, 399, 6, 0x0164), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4271B55A, 60.4271f), 96, 105, -29, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, CS_FLOAT(0x4271B55A, 60.4271f), 96, 105, -29, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x4271B55A, 60.4271f), 96, 105, -29, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 15, CS_FLOAT(0x42701BC0, 60.0271f), 110, 196, -26, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x428CDAA2, 70.42702f), 185, 399, 6, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428CDAA2, 70.42702f), 185, 399, 6, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x428CDAA2, 70.42702f), 185, 399, 6, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x428CDAA2, 70.42702f), 185, 399, 6, 0x0164), CS_CAM_AT_SPLINE(823, 1214), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 60.0f, 3, 6, -6, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, 60.0f, 3, 6, -6, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 50.999966f, 3, 6, -6, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 20.59985f, 3, 6, -6, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 51, 10.799838f, 3, 6, -6, 0x1F98), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.399838f, 3, 6, -6, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.399838f, 3, 6, -6, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, 10.199839f, 3, 6, -6, 0x0164), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 50, 10.999838f, 3, 6, -6, 0x2100), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x42700000, 60.0f), 3, 6, -6, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 40, CS_FLOAT(0x42700000, 60.0f), 3, 6, -6, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x424BFFF7, 50.999966f), 3, 6, -6, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x41A4CC7E, 20.59985f), 3, 6, -6, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 51, CS_FLOAT(0x412CCC23, 10.799838f), 3, 6, -6, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x412665BD, 10.399838f), 3, 6, -6, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x412665BD, 10.399838f), 3, 6, -6, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4123328A, 10.199839f), 3, 6, -6, 0x0164), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 50, CS_FLOAT(0x412FFF56, 10.999838f), 3, 6, -6, 0x2100), CS_CAM_AT_SPLINE_REL_TO_PLAYER(899, 2109), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 100, 5, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 101, 6, 0x1FBC), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 1, 99, 41, 0xD5E0), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x1F98), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, 68.599945f, 0, 42, 16, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 68.599945f, 0, 42, 16, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 68.599945f, 0, 42, 16, 0x0164), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 100, 5, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 101, 6, 0x1FBC), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 1, 99, 41, 0xD5E0), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x1F98), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4289332C, 68.599945f), 0, 42, 16, 0x0164), CS_ACTOR_CUE_LIST(62, 1), - CS_ACTOR_CUE(0x0004, 0, 3000, 0xC10F, 0x0000, 0x0000, 77, 80, -2, 0, 80, 0, -0.025666667f, 0.0f, 0.025666667f), + CS_ACTOR_CUE(0x0004, 0, 3000, 0xC10F, 0x0000, 0x0000, 77, 80, -2, 0, 80, 0, CS_FLOAT(0xBCD242E7, -0.025666667f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x3CD242E7, 0.025666667f)), CS_TEXT_LIST(14), CS_TEXT_NONE(0, 394), CS_TEXT(0x4041, 394, 444, 0x0000, 0x0000, 0x0000), diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 2994a7a7f..d60aa4e40 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -58,8 +58,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 20, 46, 0, { 0, 0, 0 } }, @@ -613,10 +613,12 @@ void func_80AF6448(EnSa* this, PlayState* play) { } void func_80AF67D0(EnSa* this, PlayState* play) { - if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { - Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 0.0f, 10.0f, 0.0f, ANIMMODE_ONCE, -10.0f); - this->actionFunc = func_80AF6448; + if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { + return; } + + Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 0.0f, 10.0f, 0.0f, ANIMMODE_ONCE, -10.0f); + this->actionFunc = func_80AF6448; } void func_80AF683C(EnSa* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index 07b4d9042..5c3499be2 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -388,7 +388,7 @@ s32 EnSb_UpdateDamage(EnSb* this, PlayState* play) { FALLTHROUGH; case 15: // explosions, arrow, hammer, ice arrow, light arrow, spirit arrow, shadow arrow if (EnSb_IsVulnerable(this)) { - hitY = this->collider.elem.bumper.hitPos.y - this->actor.world.pos.y; + hitY = this->collider.elem.acDmgInfo.hitPos.y - this->actor.world.pos.y; yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((hitY < 30.0f) && (hitY > 10.0f) && (yawDiff >= -0x1FFF) && (yawDiff < 0x2000)) { Actor_ApplyDamage(&this->actor); @@ -406,7 +406,7 @@ s32 EnSb_UpdateDamage(EnSb* this, PlayState* play) { case 1: // hookshot/longshot case 13: // all sword damage if (EnSb_IsVulnerable(this)) { - hitY = this->collider.elem.bumper.hitPos.y - this->actor.world.pos.y; + hitY = this->collider.elem.acDmgInfo.hitPos.y - this->actor.world.pos.y; yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((hitY < 30.0f) && (hitY > 10.0f) && (yawDiff >= -0x1FFF) && (yawDiff < 0x2000)) { Actor_ApplyDamage(&this->actor); @@ -430,9 +430,9 @@ s32 EnSb_UpdateDamage(EnSb* this, PlayState* play) { // if player attack didn't do damage, play recoil sound effect and spawn sparks if (!tookDamage) { - hitPoint.x = this->collider.elem.bumper.hitPos.x; - hitPoint.y = this->collider.elem.bumper.hitPos.y; - hitPoint.z = this->collider.elem.bumper.hitPos.z; + hitPoint.x = this->collider.elem.acDmgInfo.hitPos.x; + hitPoint.y = this->collider.elem.acDmgInfo.hitPos.y; + hitPoint.z = this->collider.elem.acDmgInfo.hitPos.z; CollisionCheck_SpawnShieldParticlesMetal2(play, &hitPoint); } } diff --git a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c index 406f96ce9..b351d6888 100644 --- a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c +++ b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c @@ -46,8 +46,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 20, 40, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.c b/src/overlays/actors/ovl_En_Si/z_en_si.c index b121facd3..33c7ce2f2 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -31,8 +31,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000090, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 20, 18, 2, { 0, 0, 0 } }, @@ -93,7 +93,9 @@ void func_80AFB768(EnSi* this, PlayState* play) { if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; Item_Give(play, ITEM_SKULL_TOKEN); - player->actor.freezeTimer = 10; + if (!DISABLE_PLAYER_FREEZE) { + player->actor.freezeTimer = 10; + } Message_StartTextbox(play, 0xB4, NULL); Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); this->actionFunc = func_80AFB950; @@ -115,7 +117,9 @@ void func_80AFB89C(EnSi* this, PlayState* play) { if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) { Item_Give(play, ITEM_SKULL_TOKEN); - player->actor.freezeTimer = 10; + if (!DISABLE_PLAYER_FREEZE) { + player->actor.freezeTimer = 10; + } Message_StartTextbox(play, 0xB4, NULL); Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); this->actionFunc = func_80AFB950; @@ -125,7 +129,7 @@ void func_80AFB89C(EnSi* this, PlayState* play) { void func_80AFB950(EnSi* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (Message_GetState(&play->msgCtx) != TEXT_STATE_CLOSING) { + if (!DISABLE_PLAYER_FREEZE && Message_GetState(&play->msgCtx) != TEXT_STATE_CLOSING) { player->actor.freezeTimer = 10; } else { SET_GS_FLAGS((this->actor.params & 0x1F00) >> 8, this->actor.params & 0xFF); diff --git a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c index 79a4ba9d9..0d28bea18 100644 --- a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c +++ b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c @@ -118,8 +118,6 @@ void func_80AFBE8C(EnSiofuki* this, PlayState* play) { f32 dZ; s16 angle; s16 dAngle; - f32 dist2d; - f32 speedScale; dX = player->actor.world.pos.x - this->dyna.actor.world.pos.x; dY = player->actor.world.pos.y - this->dyna.actor.world.pos.y; @@ -139,7 +137,8 @@ void func_80AFBE8C(EnSiofuki* this, PlayState* play) { this->appliedSpeed = 0.0f; this->targetAppliedSpeed = 0.0f; } else { - dist2d = sqrtf(SQ(dX) + SQ(dZ)); + f32 dist2d = sqrtf(SQ(dX) + SQ(dZ)); + this->applySpeed = true; this->splashTimer = 0; angle = RAD_TO_BINANG(Math_FAtan2F(dX, dZ)); @@ -149,6 +148,8 @@ void func_80AFBE8C(EnSiofuki* this, PlayState* play) { Math_SmoothStepToF(&player->actor.world.pos.y, this->dyna.actor.world.pos.y, 0.5f, 4.0f, 1.0f); if ((dAngle < 0x4000) && (dAngle > -0x4000)) { + f32 speedScale; + this->appliedYaw = player->actor.world.rot.y ^ 0x8000; speedScale = dist2d / (this->dyna.actor.scale.x * 40.0f * 10.0f); speedScale = CLAMP_MIN(speedScale, 0.0f); @@ -292,6 +293,9 @@ void EnSiofuki_Draw(Actor* thisx, PlayState* play) { gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, x, y, 64, 64, 1, x, y, 64, 64)); gSPDisplayList(POLY_XLU_DISP++, object_siofuki_DL_000B70); + + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_siofuki.c", 674); if (this->sfxFlags & 1) { diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 3fd564e7a..d6cfb0bbc 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -46,8 +46,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[2] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { 15, { { 0, 0, 0 }, 10 }, 100 }, @@ -57,8 +57,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 1, { { 0, 0, 0 }, 20 }, 100 }, @@ -531,10 +531,10 @@ void EnSkb_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSkb_OverrideLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSkb* this = (EnSkb*)thisx; + PlayState* play = (PlayState*)play2; s16 color; - s16 pad[2]; if (limbIndex == 11) { if ((this->breakFlags & 2) == 0) { // head limb, head is still attached diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index ab0ab2a23..46b7798b8 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -183,8 +183,8 @@ static ColliderCylinderInitType1 D_80B01678 = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x0, 0x08 }, { 0xFFCFFFFF, 0x0, 0x0 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 8, 48, 0, { 0, 0, 0 } }, @@ -364,7 +364,6 @@ void EnSkj_Init(Actor* thisx, PlayState* play2) { EnSkj* this = (EnSkj*)thisx; PlayState* play = play2; s32 pad; - Player* player; Actor_ProcessInitChain(thisx, sInitChain); switch (type) { @@ -445,13 +444,18 @@ void EnSkj_Init(Actor* thisx, PlayState* play2) { this->actor.gravity = -1.0f; EnSkj_CalculateCenter(this); - player = GET_PLAYER(play); - PRINTF("Player_X : %f\n", player->actor.world.pos.x); - PRINTF("Player_Z : %f\n", player->actor.world.pos.z); - PRINTF("World_X : %f\n", this->actor.world.pos.x); - PRINTF("World_Z : %f\n", this->actor.world.pos.z); - PRINTF("Center_X : %f\n", this->center.x); - PRINTF("Center_Z : %f\n\n", this->center.z); +#if IS_DEBUG + { + Player* player = GET_PLAYER(play); + + PRINTF("Player_X : %f\n", player->actor.world.pos.x); + PRINTF("Player_Z : %f\n", player->actor.world.pos.z); + PRINTF("World_X : %f\n", this->actor.world.pos.x); + PRINTF("World_Z : %f\n", this->actor.world.pos.z); + PRINTF("Center_X : %f\n", this->center.x); + PRINTF("Center_Z : %f\n\n", this->center.z); + } +#endif break; } @@ -581,9 +585,9 @@ s32 EnSkj_CollisionCheck(EnSkj* this, PlayState* play) { this->collider.base.acFlags &= ~AC_HIT; switch (this->actor.colChkInfo.damageEffect) { case 0xF: - effectPos.x = this->collider.elem.bumper.hitPos.x; - effectPos.y = this->collider.elem.bumper.hitPos.y; - effectPos.z = this->collider.elem.bumper.hitPos.z; + effectPos.x = this->collider.elem.acDmgInfo.hitPos.x; + effectPos.y = this->collider.elem.acDmgInfo.hitPos.y; + effectPos.z = this->collider.elem.acDmgInfo.hitPos.z; EnSkj_SpawnBlood(play, &effectPos); EffectSsHitMark_SpawnFixedScale(play, 1, &effectPos); @@ -1345,7 +1349,7 @@ void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, PlayState* play) { D_80B01EA0 = Actor_TalkOfferAccepted(&this->actor, play); - if (BREG(0) != 0) { + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); @@ -1502,15 +1506,15 @@ void EnSkj_OfferNextRound(EnSkj* this, PlayState* play) { } void EnSkj_WaitForOfferResponse(EnSkj* this, PlayState* play) { - Player* player; - if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { - case 0: // yes - player = GET_PLAYER(play); + case 0: { // yes + Player* player = GET_PLAYER(play); + player->stateFlags3 |= PLAYER_STATE3_5; // makes player take ocarina out right away after closing box this->actionFunc = EnSkj_SetupWaitForOcarina; break; + } case 1: // no this->actionFunc = EnSkj_CleanupOcarinaGame; break; @@ -1587,7 +1591,7 @@ void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, PlayState* play) { this->actor.focus.pos.y = -90.0f; this->actor.focus.pos.z = 450.0f; - if (BREG(0) != 0) { + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c index 36521ba7e..df3f584f9 100644 --- a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c +++ b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c @@ -40,8 +40,8 @@ static ColliderCylinderInitType1 sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 10, 4, -2, { 0, 0, 0 } }, 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 61fbe3fe8..e7b9d3ee0 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -55,8 +55,8 @@ static ColliderCylinderInit sCylinderInit1 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { 32, 50, -24, { 0, 0, 0 } }, @@ -77,8 +77,8 @@ static ColliderCylinderInit sCylinderInit2 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 20, 60, -30, { 0, 0, 0 } }, @@ -90,8 +90,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 1, { { 0, -240, 0 }, 28 }, 100 }, @@ -200,15 +200,15 @@ void EnSsh_InitColliders(EnSsh* this, PlayState* play) { Collider_SetCylinder(play, &this->colCylinder[i], &this->actor, cylinders[i]); } - this->colCylinder[0].elem.bumper.dmgFlags = + this->colCylinder[0].elem.acDmgInfo.dmgFlags = DMG_ARROW | DMG_MAGIC_FIRE | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_EXPLOSIVE | DMG_DEKU_NUT; - this->colCylinder[1].elem.bumper.dmgFlags = + this->colCylinder[1].elem.acDmgInfo.dmgFlags = DMG_DEFAULT & ~(DMG_ARROW | DMG_MAGIC_FIRE | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_EXPLOSIVE | DMG_DEKU_NUT) & ~(DMG_MAGIC_LIGHT | DMG_MAGIC_ICE); this->colCylinder[2].base.colType = COLTYPE_METAL; - this->colCylinder[2].elem.bumperFlags = BUMP_ON | BUMP_HOOKABLE | BUMP_NO_AT_INFO; + this->colCylinder[2].elem.acElemFlags = ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO; this->colCylinder[2].elem.elemType = ELEMTYPE_UNK2; - this->colCylinder[2].elem.bumper.dmgFlags = + this->colCylinder[2].elem.acDmgInfo.dmgFlags = DMG_DEFAULT & ~(DMG_ARROW | DMG_MAGIC_FIRE | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_EXPLOSIVE | DMG_DEKU_NUT); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(2), &sColChkInfoInit); @@ -438,13 +438,13 @@ void EnSsh_CheckBodyStickHit(EnSsh* this, PlayState* play) { Player* player = GET_PLAYER(play); if (player->unk_860 != 0) { - elem->bumper.dmgFlags |= DMG_DEKU_STICK; - this->colCylinder[1].elem.bumper.dmgFlags &= ~DMG_DEKU_STICK; - this->colCylinder[2].elem.bumper.dmgFlags &= ~DMG_DEKU_STICK; + elem->acDmgInfo.dmgFlags |= DMG_DEKU_STICK; + this->colCylinder[1].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; + this->colCylinder[2].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; } else { - elem->bumper.dmgFlags &= ~DMG_DEKU_STICK; - this->colCylinder[1].elem.bumper.dmgFlags |= DMG_DEKU_STICK; - this->colCylinder[2].elem.bumper.dmgFlags |= DMG_DEKU_STICK; + elem->acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; + this->colCylinder[1].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK; + this->colCylinder[2].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK; } } 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 55aa065dd..b7983ad59 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -48,8 +48,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { 32, 50, -24, { 0, 0, 0 } }, @@ -70,8 +70,8 @@ static ColliderCylinderInit sCylinderInit2 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 20, 60, -30, { 0, 0, 0 } }, @@ -83,8 +83,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_ON, }, { 1, { { 0, -240, 0 }, 28 }, 100 }, @@ -285,16 +285,16 @@ void EnSt_InitColliders(EnSt* this, PlayState* play) { Collider_SetCylinder(play, &this->colCylinder[i], &this->actor, cylinders[i]); } - this->colCylinder[0].elem.bumper.dmgFlags = + this->colCylinder[0].elem.acDmgInfo.dmgFlags = DMG_MAGIC_FIRE | DMG_ARROW | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT; - this->colCylinder[1].elem.bumper.dmgFlags = + this->colCylinder[1].elem.acDmgInfo.dmgFlags = DMG_DEFAULT & ~(DMG_MAGIC_FIRE | DMG_ARROW | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT) & ~(DMG_MAGIC_LIGHT | DMG_MAGIC_ICE); this->colCylinder[2].base.colType = COLTYPE_METAL; - this->colCylinder[2].elem.bumperFlags = BUMP_ON | BUMP_HOOKABLE | BUMP_NO_AT_INFO; + this->colCylinder[2].elem.acElemFlags = ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO; this->colCylinder[2].elem.elemType = ELEMTYPE_UNK2; - this->colCylinder[2].elem.bumper.dmgFlags = + this->colCylinder[2].elem.acDmgInfo.dmgFlags = DMG_DEFAULT & ~(DMG_MAGIC_FIRE | DMG_ARROW | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT); @@ -309,13 +309,13 @@ void EnSt_CheckBodyStickHit(EnSt* this, PlayState* play) { Player* player = GET_PLAYER(play); if (player->unk_860 != 0) { - bodyElem->bumper.dmgFlags |= DMG_DEKU_STICK; - this->colCylinder[1].elem.bumper.dmgFlags &= ~DMG_DEKU_STICK; - this->colCylinder[2].elem.bumper.dmgFlags &= ~DMG_DEKU_STICK; + bodyElem->acDmgInfo.dmgFlags |= DMG_DEKU_STICK; + this->colCylinder[1].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; + this->colCylinder[2].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; } else { - bodyElem->bumper.dmgFlags &= ~DMG_DEKU_STICK; - this->colCylinder[1].elem.bumper.dmgFlags |= DMG_DEKU_STICK; - this->colCylinder[2].elem.bumper.dmgFlags |= DMG_DEKU_STICK; + bodyElem->acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK; + this->colCylinder[1].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK; + this->colCylinder[2].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK; } } @@ -431,14 +431,14 @@ s32 EnSt_CheckHitBackside(EnSt* this, PlayState* play) { if (cyl->base.acFlags & AC_HIT) { cyl->base.acFlags &= ~AC_HIT; hit = true; - flags |= cyl->elem.acHitElem->toucher.dmgFlags; + flags |= cyl->elem.acHitElem->atDmgInfo.dmgFlags; } cyl = &this->colCylinder[1]; if (cyl->base.acFlags & AC_HIT) { cyl->base.acFlags &= ~AC_HIT; hit = true; - flags |= cyl->elem.acHitElem->toucher.dmgFlags; + flags |= cyl->elem.acHitElem->atDmgInfo.dmgFlags; } if (!hit) { diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 2918e8ade..66416baba 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -49,8 +49,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 30, 40, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 240beec6c..6ffffd208 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -283,7 +283,7 @@ void EnSw_Init(Actor* thisx, PlayState* play) { this->actor.scale.x = 0.0f; FALLTHROUGH; case 1: - this->collider.elements[0].base.toucher.damage *= 2; + this->collider.elements[0].base.atDmgInfo.damage *= 2; this->actor.naviEnemyId = NAVI_ENEMY_GOLD_SKULLTULA; this->actor.colChkInfo.health *= 2; this->actor.flags &= ~ACTOR_FLAG_0; @@ -538,14 +538,14 @@ void func_80B0D590(EnSw* this, PlayState* play) { if (((this->actor.params & 0xE000) >> 0xD) == 2) { if (this->actor.scale.x < 0.0139999995f) { - this->collider.elements[0].base.toucherFlags = TOUCH_NONE; - this->collider.elements[0].base.bumperFlags = BUMP_NONE; + this->collider.elements[0].base.atElemFlags = ATELEM_NONE; + this->collider.elements[0].base.acElemFlags = ACELEM_NONE; this->collider.elements[0].base.ocElemFlags = OCELEM_NONE; } if (this->actor.scale.x >= 0.0139999995f) { - this->collider.elements[0].base.toucherFlags = TOUCH_ON; - this->collider.elements[0].base.bumperFlags = BUMP_ON; + this->collider.elements[0].base.atElemFlags = ATELEM_ON; + this->collider.elements[0].base.acElemFlags = ACELEM_ON; this->collider.elements[0].base.ocElemFlags = OCELEM_ON; } diff --git a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index b40a57038..7bc74fe59 100644 --- a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c +++ b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c @@ -342,7 +342,8 @@ void EnSyatekiItm_Update(Actor* thisx, PlayState* play) { if (this->unkTimer != 0) { this->unkTimer--; } - if (BREG(0)) { + + if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 4aa759f56..4afe18684 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -40,7 +40,9 @@ void EnSyatekiMan_RestartGame(EnSyatekiMan* this, PlayState* play); void EnSyatekiMan_BlinkWait(EnSyatekiMan* this); void EnSyatekiMan_Blink(EnSyatekiMan* this); +#if IS_DEBUG void EnSyatekiMan_SetBgm(void); +#endif ActorInit En_Syateki_Man_InitVars = { /**/ ACTOR_EN_SYATEKI_MAN, @@ -54,6 +56,7 @@ ActorInit En_Syateki_Man_InitVars = { /**/ EnSyatekiMan_Draw, }; +#if IS_DEBUG static u16 sBgmList[] = { NA_BGM_GENERAL_SFX, NA_BGM_NATURE_AMBIENCE, @@ -144,6 +147,7 @@ static u16 sBgmList[] = { NA_BGM_GANON_BOSS, NA_BGM_END_DEMO, }; +#endif static s16 sTextIds[] = { 0x2B, 0x2E, 0xC8, 0x2D }; @@ -468,7 +472,11 @@ void EnSyatekiMan_Update(Actor* thisx, PlayState* play) { this->timer--; } this->actionFunc(this, play); + +#if IS_DEBUG EnSyatekiMan_SetBgm(); +#endif + this->blinkFunc(this); this->actor.focus.pos.y = 70.0f; Actor_SetFocus(&this->actor, 70.0f); @@ -503,9 +511,11 @@ void EnSyatekiMan_Draw(Actor* thisx, PlayState* play) { EnSyatekiMan_OverrideLimbDraw, NULL, this); } +#if IS_DEBUG void EnSyatekiMan_SetBgm(void) { if (BREG(80)) { BREG(80) = false; SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, sBgmList[BREG(81)]); } } +#endif diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index 5d306488a..9da826cd6 100644 --- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -51,8 +51,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 10, 20, 4, { 0, 0, 0 } }, @@ -760,9 +760,11 @@ void EnSyatekiNiw_UpdateEffects(EnSyatekiNiw* this, PlayState* play) { void EnSyatekiNiw_DrawEffects(EnSyatekiNiw* this, PlayState* play) { GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; - EnSyatekiNiwEffect* effect = &this->effects[0]; + EnSyatekiNiwEffect* effect; u8 materialFlag = 0; + effect = &this->effects[0]; + OPEN_DISPS(gfxCtx, "../z_en_syateki_niw.c", 1234); Gfx_SetupDL_25Xlu(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index 0cd64c8cd..b9575cf6e 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -82,8 +82,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000004, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 30, 40, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Tana/z_en_tana.c b/src/overlays/actors/ovl_En_Tana/z_en_tana.c index aa7aeb97f..d0fe9cc39 100644 --- a/src/overlays/actors/ovl_En_Tana/z_en_tana.c +++ b/src/overlays/actors/ovl_En_Tana/z_en_tana.c @@ -27,6 +27,7 @@ ActorInit En_Tana_InitVars = { /**/ NULL, }; +#if IS_DEBUG //! @bug A third entry is missing here. When printing the string indexed by `params` for type 2, the //! next data entry will be dereferenced and print garbage, stopping any future printing. //! In a non-matching context, this can cause a crash if the next item isn't a valid pointer. @@ -37,6 +38,7 @@ static const char* sShelfTypes[] = { "", #endif }; +#endif static const ActorFunc sDrawFuncs[] = { EnTana_DrawWoodenShelves, diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.c b/src/overlays/actors/ovl_En_Test/z_en_test.c index e050fc332..1371a2adb 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -150,8 +150,8 @@ static ColliderCylinderInit sBodyColliderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 25, 65, 0, { 0, 0, 0 } }, @@ -170,8 +170,8 @@ static ColliderCylinderInit sShieldColliderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFC1FFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 20, 70, -50, { 0, 0, 0 } }, @@ -190,8 +190,8 @@ static ColliderQuadInit sSwordColliderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL | ATELEM_UNK7, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -568,12 +568,11 @@ void EnTest_SetupWalkAndBlock(EnTest* this) { void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { s32 pad; f32 checkDist = 0.0f; - s32 pad1; + s32 absPlaySpeed; s32 prevFrame; s32 beforeCurFrame; f32 playSpeed; Player* player = GET_PLAYER(play); - s32 absPlaySpeed; s16 yawDiff; if (!EnTest_ReactToProjectile(play, this)) { @@ -601,6 +600,8 @@ void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { } if (ABS(this->actor.speed) < 3.0f) { + s32 pad; + Animation_Change(&this->skelAnime, &gStalfosSlowAdvanceAnim, 0.0f, this->skelAnime.curFrame, Animation_GetLastFrame(&gStalfosSlowAdvanceAnim), 0, -6.0f); playSpeed = this->actor.speed * 10.0f; @@ -898,7 +899,7 @@ void EnTest_SetupSlashDown(EnTest* this) { this->unk_7C8 = 0x10; this->actor.speed = 0.0f; EnTest_SetupAction(this, EnTest_SlashDown); - this->swordCollider.elem.toucher.damage = 16; + this->swordCollider.elem.atDmgInfo.damage = 16; if (this->unk_7DE != 0) { this->unk_7DE = 3; @@ -995,7 +996,7 @@ void EnTest_SetupSlashUp(EnTest* this) { Animation_PlayOnce(&this->skelAnime, &gStalfosUpSlashAnim); this->swordCollider.base.atFlags &= ~AT_BOUNCED; this->unk_7C8 = 0x11; - this->swordCollider.elem.toucher.damage = 16; + this->swordCollider.elem.atDmgInfo.damage = 16; this->actor.speed = 0.0f; EnTest_SetupAction(this, EnTest_SlashUp); @@ -1084,7 +1085,7 @@ void EnTest_SetupJumpslash(EnTest* this) { this->actor.world.rot.y = this->actor.shape.rot.y; this->swordCollider.base.atFlags &= ~AT_BOUNCED; EnTest_SetupAction(this, EnTest_Jumpslash); - this->swordCollider.elem.toucher.damage = 32; + this->swordCollider.elem.atDmgInfo.damage = 32; if (this->unk_7DE != 0) { this->unk_7DE = 3; @@ -1819,9 +1820,9 @@ void EnTest_Update(Actor* thisx, PlayState* play) { } } -s32 EnTest_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnTest_OverrideLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnTest* this = (EnTest*)thisx; - s32 pad; + PlayState* play = (PlayState*)play2; if (limbIndex == STALFOS_LIMB_HEAD_ROOT) { rot->x += this->headRot.y; diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c index 4e00d3bc3..403ea500f 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -29,8 +29,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 20, 64, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index cdd8d3402..adf19950a 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -92,8 +92,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 0, { { 0, 1500, 0 }, 20 }, 100 }, @@ -265,7 +265,6 @@ void EnTite_SetupAttack(EnTite* this) { void EnTite_Attack(EnTite* this, PlayState* play) { s16 angleToPlayer; s32 attackState; - Vec3f ripplePos; if (SkelAnime_Update(&this->skelAnime)) { attackState = this->vAttackState; // for deciding whether to change animation @@ -303,7 +302,8 @@ void EnTite_Attack(EnTite* this, PlayState* play) { } else { this->actor.gravity = 0.0f; if (this->actor.velocity.y < -8.0f) { - ripplePos = this->actor.world.pos; + Vec3f ripplePos = this->actor.world.pos; + ripplePos.y += this->actor.yDistToWater; this->vAttackState++; // TEKTITE_SUBMERGED this->actor.velocity.y *= 0.75f; diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index d0e331f7c..b48964c8f 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -150,8 +150,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 30, 52, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 24eef2901..8c3c1c90a 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -104,8 +104,8 @@ void EnTorch2_Init(Actor* thisx, PlayState* play2) { this->meleeWeaponQuads[0].base.atFlags = this->meleeWeaponQuads[1].base.atFlags = AT_ON | AT_TYPE_ENEMY; this->meleeWeaponQuads[0].base.acFlags = this->meleeWeaponQuads[1].base.acFlags = AC_ON | AC_HARD | AC_TYPE_PLAYER; this->meleeWeaponQuads[0].base.colType = this->meleeWeaponQuads[1].base.colType = COLTYPE_METAL; - this->meleeWeaponQuads[0].elem.toucher.damage = this->meleeWeaponQuads[1].elem.toucher.damage = 8; - this->meleeWeaponQuads[0].elem.bumperFlags = this->meleeWeaponQuads[1].elem.bumperFlags = BUMP_ON; + this->meleeWeaponQuads[0].elem.atDmgInfo.damage = this->meleeWeaponQuads[1].elem.atDmgInfo.damage = 8; + this->meleeWeaponQuads[0].elem.acElemFlags = this->meleeWeaponQuads[1].elem.acElemFlags = ACELEM_ON; this->shieldQuad.base.atFlags = AT_ON | AT_TYPE_ENEMY; this->shieldQuad.base.acFlags = AC_ON | AC_HARD | AC_TYPE_PLAYER; this->actor.colChkInfo.damageTable = &sDamageTable; @@ -202,15 +202,10 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { Input* input = &sInput; Camera* mainCam; s16 sp66; - u8 staggerThreshold; s8 stickY; - s32 pad60; + u32 pad54; Actor* attackItem; s16 sp5A; - s16 pad58; - u32 pad54; - f32 sp50; - s16 sp4E; sp5A = player->actor.shape.rot.y - this->actor.shape.rot.y; input->cur.button = 0; @@ -410,44 +405,47 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { // Handles movement and attacks when not reacting to Link's actions sStickAngle = thisx->yawTowardsPlayer; - sp50 = 0.0f; if ((90.0f >= this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 70.0f) && (ABS(sp5A) >= 0x7800) && (this->actor.isTargeted || !(player->stateFlags1 & PLAYER_STATE1_22))) { EnTorch2_SwingSword(play, input, this); - } else if (((this->actor.xzDistToPlayer <= 70.0f) || - ((this->actor.xzDistToPlayer <= 80.0f + sp50) && - (player->meleeWeaponState != 0))) && - (this->meleeWeaponState == 0)) { - if (!EnTorch2_SwingSword(play, input, this) && (this->meleeWeaponState == 0) && - (sCounterState == 0)) { - EnTorch2_Backflip(this, input, &this->actor); - } - } else if (this->actor.xzDistToPlayer <= 50 + sp50) { - sStickTilt = 127.0f; - sStickAngle = this->actor.yawTowardsPlayer; - if (!this->actor.isTargeted) { - Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0); - } - } else if (this->actor.xzDistToPlayer > 100.0f + sp50) { - if ((player->meleeWeaponState == 0) || - !((player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) && - (player->meleeWeaponAnimation <= PLAYER_MWA_BIG_SPIN_2H)) || - (this->actor.xzDistToPlayer >= 280.0f)) { + } else { + f32 sp50 = 0.0f; + + if (((this->actor.xzDistToPlayer <= 70.0f) || + ((this->actor.xzDistToPlayer <= 80.0f + sp50) && (player->meleeWeaponState != 0))) && + (this->meleeWeaponState == 0)) { + if (!EnTorch2_SwingSword(play, input, this) && (this->meleeWeaponState == 0) && + (sCounterState == 0)) { + EnTorch2_Backflip(this, input, &this->actor); + } + } else if (this->actor.xzDistToPlayer <= 50 + sp50) { sStickTilt = 127.0f; sStickAngle = this->actor.yawTowardsPlayer; if (!this->actor.isTargeted) { Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0); } - } else { - EnTorch2_Backflip(this, input, &this->actor); - } - } else if (((ABS(sp5A) < 0x7800) && (ABS(sp5A) >= 0x3000)) || - !EnTorch2_SwingSword(play, input, this)) { - sStickAngle = this->actor.yawTowardsPlayer; - sStickTilt = 127.0f; - if (!this->actor.isTargeted) { - Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0); + } else if (this->actor.xzDistToPlayer > 100.0f + sp50) { + if ((player->meleeWeaponState == 0) || + !((player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) && + (player->meleeWeaponAnimation <= PLAYER_MWA_BIG_SPIN_2H)) || + (this->actor.xzDistToPlayer >= 280.0f)) { + sStickTilt = 127.0f; + sStickAngle = this->actor.yawTowardsPlayer; + if (!this->actor.isTargeted) { + Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, + 0); + } + } else { + EnTorch2_Backflip(this, input, &this->actor); + } + } else if (((ABS(sp5A) < 0x7800) && (ABS(sp5A) >= 0x3000)) || + !EnTorch2_SwingSword(play, input, this)) { + sStickAngle = this->actor.yawTowardsPlayer; + sStickTilt = 127.0f; + if (!this->actor.isTargeted) { + Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0); + } } } } @@ -495,8 +493,9 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { this->actor.world.pos.x = (Math_SinS(player->actor.shape.rot.y) * -120.0f) + player->actor.world.pos.x; this->actor.world.pos.z = (Math_CosS(player->actor.shape.rot.y) * -120.0f) + player->actor.world.pos.z; if (Actor_WorldDistXYZToPoint(&this->actor, &sSpawnPoint) > 800.0f) { - sp50 = Rand_ZeroOne() * 20.0f; - sp4E = Rand_CenteredFloat(4000.0f); + f32 sp50 = Rand_ZeroOne() * 20.0f; + s16 sp4E = Rand_CenteredFloat(4000.0f); + this->actor.shape.rot.y = this->actor.world.rot.y = Math_Vec3f_Yaw(&sSpawnPoint, &player->actor.world.pos); this->actor.world.pos.x = @@ -640,7 +639,8 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { * if he's had to counter with enough different sword animations in a row. */ if (this->speedXZ == -18.0f) { - staggerThreshold = (u32)Rand_CenteredFloat(2.0f) + 6; + u8 staggerThreshold = (u32)Rand_CenteredFloat(2.0f) + 6; + if (gSaveContext.save.info.playerData.health < 0x50) { staggerThreshold = (u32)Rand_CenteredFloat(2.0f) + 3; } diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c index 4d57b44c5..38e5f46d5 100644 --- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c +++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c @@ -43,8 +43,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 18, 63, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Tp/z_en_tp.c b/src/overlays/actors/ovl_En_Tp/z_en_tp.c index 218f5615f..73282570e 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -57,8 +57,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x03, 0x08 }, { 0xFFCFFFFF, 0x01, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 4 }, 100 }, diff --git a/src/overlays/actors/ovl_En_Tr/z_en_tr.c b/src/overlays/actors/ovl_En_Tr/z_en_tr.c index e1f05e02c..fa9a5fca8 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -241,6 +241,8 @@ void func_80B23254(EnTr* this, PlayState* play, s32 arg2, f32 arg3, f32 scale) { } void EnTr_ShrinkVanish(EnTr* this, PlayState* play) { + s32 temp_hi; + if (this->timer >= 17) { this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->timer * 0x28F)) + 0x3D68; } else { @@ -248,7 +250,7 @@ void EnTr_ShrinkVanish(EnTr* this, PlayState* play) { Actor_SetScale(&this->actor, this->actor.scale.x * 0.9f); this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->timer * 0x28F)) + 0x3D68; } else if (this->timer > 0) { - s32 temp_hi = (this->timer * 2) % 7; + temp_hi = (this->timer * 2) % 7; func_80B23254(this, play, temp_hi, 5.0f, 0.2f); func_80B23254(this, play, (temp_hi + 1) % 7, 5.0f, 0.2f); diff --git a/src/overlays/actors/ovl_En_Trap/z_en_trap.c b/src/overlays/actors/ovl_En_Trap/z_en_trap.c index 8bdcea003..6c21a07c2 100644 --- a/src/overlays/actors/ovl_En_Trap/z_en_trap.c +++ b/src/overlays/actors/ovl_En_Trap/z_en_trap.c @@ -55,7 +55,7 @@ static ColliderCylinderInit sCylinderInit = { OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00001000, 0x00, 0x00 }, TOUCH_NONE, BUMP_ON, OCELEM_ON }, + { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00001000, 0x00, 0x00 }, ATELEM_NONE, ACELEM_ON, OCELEM_ON }, { 30, 20, 0, { 0, 0, 0 } }, }; @@ -135,7 +135,6 @@ void EnTrap_Update(Actor* thisx, PlayState* play) { Vec3f colPoint; // unused return value from function CollisionPoly* colPoly; // unused return value from function s32 bgId; // unused return value from function - f32 temp_cond; touchingActor = false; blockedOnReturn = false; @@ -209,7 +208,8 @@ void EnTrap_Update(Actor* thisx, PlayState* play) { Actor_PlaySfx(thisx, NA_SE_EV_SPINE_TRAP_MOVE); } } else if (thisx->params & SPIKETRAP_MODE_CIRCULAR) { - temp_cond = Math_SinS(this->vAngularPos); + f32 temp_cond = Math_SinS(this->vAngularPos); + this->vAngularPos += this->vAngularVel; // Every full circle make a sound: if ((temp_cond < 0.0f) && (Math_SinS(this->vAngularPos) >= 0.0f)) { diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index 28bf2a3a2..45d19e4f2 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -33,8 +33,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { 9, 23, 0, { 0 } }, diff --git a/src/overlays/actors/ovl_En_Vali/z_en_vali.c b/src/overlays/actors/ovl_En_Vali/z_en_vali.c index 2af941834..b48c0e3e2 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -54,8 +54,8 @@ static ColliderQuadInit sQuadInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x07, 0x08 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -74,8 +74,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x07, 0x08 }, { 0xFFCFFFFF, 0x01, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 17, 35, -15, { 0, 0, 0 } }, @@ -258,7 +258,7 @@ void EnVali_SetupStunned(EnVali* this) { this->timer = 80; this->actor.velocity.y = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_XLU, 80); - this->bodyCollider.elem.bumper.effect = 0; + this->bodyCollider.elem.acDmgInfo.effect = 0; Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); this->actor.velocity.y = 1.0f; this->actionFunc = EnVali_Stunned; @@ -448,7 +448,7 @@ void EnVali_Stunned(EnVali* this, PlayState* play) { } if (this->timer == 0) { - this->bodyCollider.elem.bumper.effect = 1; // Shock? + this->bodyCollider.elem.acDmgInfo.effect = 1; // Shock? EnVali_SetupFloatIdle(this); } } @@ -572,10 +572,10 @@ void EnVali_Update(Actor* thisx, PlayState* play) { void EnVali_PulseOutside(EnVali* this, f32 curFrame, Vec3f* scale) { f32 scaleChange; + s32 scalePhase; if (this->actionFunc == EnVali_Attacked) { - s32 scalePhase = 20 - (this->lightningTimer % 20); - + scalePhase = 20 - (this->lightningTimer % 20); if (scalePhase >= 10) { scalePhase -= 10; } @@ -607,10 +607,10 @@ void EnVali_PulseOutside(EnVali* this, f32 curFrame, Vec3f* scale) { void EnVali_PulseInsides(EnVali* this, f32 curFrame, Vec3f* scale) { f32 scaleChange; + s32 scalePhase; if (this->actionFunc == EnVali_Attacked) { - s32 scalePhase = 20 - (this->lightningTimer % 20); - + scalePhase = 20 - (this->lightningTimer % 20); if (scalePhase >= 10) { scalePhase -= 10; } diff --git a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c index ce7803bc4..695b88014 100644 --- a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c +++ b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c @@ -41,8 +41,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK6, { 0x00100700, 0x00, 0x20 }, { 0x00100700, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 20, 30, 10, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index d10ebe453..25f13383c 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -48,8 +48,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 25, 70, 0, { 0, 0, 0 } }, @@ -68,8 +68,8 @@ static ColliderQuadInit sQuadInit1 = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL | ATELEM_UNK7, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -88,8 +88,8 @@ static ColliderQuadInit sQuadInit2 = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -368,15 +368,13 @@ void EnVm_SetupDie(EnVm* this) { } void EnVm_Die(EnVm* this, PlayState* play) { - EnBom* bomb; - this->beamRot.x += 0x5DC; this->headRotY += 0x9C4; Actor_MoveXZGravity(&this->actor); if (--this->timer == 0) { - bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x6FF, BOMB_BODY); + EnBom* bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x6FF, BOMB_BODY); if (bomb != NULL) { bomb->timer = 0; diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c index d865c5e48..d34602624 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c @@ -147,7 +147,7 @@ void EnWallTubo_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (BREG(0)) { + if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); 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 11e0c9b11..645b077de 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -63,8 +63,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 30, 40, 0, { 0 } }, @@ -219,7 +219,7 @@ void EnWallmas_SetupReturnToCeiling(EnWallmas* this) { void EnWallmas_SetupTakeDamage(EnWallmas* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gWallmasterDamageAnim, -3.0f); - if (this->collider.elem.acHitElem->toucher.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) { + if (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_ARROW | DMG_SLINGSHOT)) { this->actor.world.rot.y = this->collider.base.ac->world.rot.y; } else { this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, this->collider.base.ac) + 0x8000; @@ -609,6 +609,8 @@ void EnWallmas_DrawXlu(EnWallmas* this, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_en_wallmas.c", 1421), G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_wallmas.c", 1426); } diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 3c89d4bf4..01a300070 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -326,7 +326,8 @@ void EnWeatherTag_Update(Actor* thisx, PlayState* play) { EnWeatherTag* this = (EnWeatherTag*)thisx; this->actionFunc(this, play); - if (BREG(0) != 0) { + + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c index d5e321ff5..693e2796c 100644 --- a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c +++ b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c @@ -51,8 +51,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_ON, OCELEM_ON, }, { 16, 10, -6, { 0, 0, 0 } }, @@ -199,9 +199,9 @@ void func_80B32724(EnWeiyer* this) { } void func_80B327B0(EnWeiyer* this) { - this->actor.colorFilterParams |= 0x2000; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; + this->actor.colorFilterParams |= 0x2000; this->actionFunc = func_80B33338; } diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 27d164114..a0088fc69 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -49,8 +49,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[4] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { WOLFOS_LIMB_FRONT_RIGHT_CLAW, { { 0, 0, 0 }, 15 }, 100 }, @@ -60,8 +60,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[4] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { WOLFOS_LIMB_FRONT_LEFT_CLAW, { { 0, 0, 0 }, 15 }, 100 }, @@ -71,8 +71,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[4] = { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xFFC1FFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { WOLFOS_LIMB_HEAD, { { 800, 0, 0 }, 25 }, 100 }, @@ -82,8 +82,8 @@ static ColliderJntSphElementInit sJntSphItemsInit[4] = { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xFFC1FFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { WOLFOS_LIMB_THORAX, { { 0, 0, 0 }, 30 }, 100 }, @@ -116,8 +116,8 @@ static ColliderCylinderInit sBodyCylinderInit = { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 20, 50, 0, { 0, 0, 0 } }, @@ -136,8 +136,8 @@ static ColliderCylinderInit sTailCylinderInit = { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 15, 20, -15, { 0, 0, 0 } }, @@ -241,8 +241,8 @@ void EnWf_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosWhiteSkel, &gWolfosWaitingAnim, this->jointTable, this->morphTable, WOLFOS_LIMB_MAX); Actor_SetScale(thisx, 0.01f); - this->colliderSpheres.elements[0].base.toucher.damage = this->colliderSpheres.elements[1].base.toucher.damage = - 8; + this->colliderSpheres.elements[0].base.atDmgInfo.damage = + this->colliderSpheres.elements[1].base.atDmgInfo.damage = 8; thisx->naviEnemyId = NAVI_ENEMY_WHITE_WOLFOS; } @@ -285,7 +285,6 @@ s32 EnWf_ChangeAction(PlayState* play, EnWf* this, s16 mustChoose) { s32 pad; s16 wallYawDiff; s16 playerYawDiff; - Actor* explosive; wallYawDiff = this->actor.wallYaw - this->actor.shape.rot.y; wallYawDiff = ABS(wallYawDiff); @@ -321,26 +320,27 @@ s32 EnWf_ChangeAction(PlayState* play, EnWf* this, s16 mustChoose) { EnWf_SetupBackflipAway(this); return true; } - } + } else { + Actor* explosive = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); - explosive = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); + if (explosive != NULL) { + this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (explosive != NULL) { - this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - - if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (wallYawDiff < 0x2EE0)) || - (explosive->id == ACTOR_EN_BOM_CHU)) { - if ((explosive->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && - (s16)((this->actor.shape.rot.y - explosive->world.rot.y) + 0x8000) < 0x3E80) { - EnWf_SetupSomersaultAndAttack(this); - return true; + if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (wallYawDiff < 0x2EE0)) || + (explosive->id == ACTOR_EN_BOM_CHU)) { + if ((explosive->id == ACTOR_EN_BOM_CHU) && + (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && + (s16)((this->actor.shape.rot.y - explosive->world.rot.y) + 0x8000) < 0x3E80) { + EnWf_SetupSomersaultAndAttack(this); + return true; + } else { + EnWf_SetupSidestep(this, play); + return true; + } } else { - EnWf_SetupSidestep(this, play); + EnWf_SetupBackflipAway(this); return true; } - } else { - EnWf_SetupBackflipAway(this); - return true; } } diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c index 5f4d3f546..6f1c803c1 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c @@ -34,8 +34,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 20, 30, 0, { 0, 0, 0 } }, @@ -159,7 +159,7 @@ void EnWonderItem_Init(Actor* thisx, PlayState* play) { colTypeIndex = this->actor.world.rot.z & 0xFF; Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->collider.elem.bumper.dmgFlags = damageFlags[colTypeIndex]; + this->collider.elem.acDmgInfo.dmgFlags = damageFlags[colTypeIndex]; this->collider.dim.radius = 20; this->collider.dim.height = 30; this->updateFunc = EnWonderItem_InteractSwitch; @@ -188,7 +188,7 @@ void EnWonderItem_Init(Actor* thisx, PlayState* play) { case WONDERITEM_BOMB_SOLDIER: Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->collider.elem.bumper.dmgFlags = DMG_SLINGSHOT; + this->collider.elem.acDmgInfo.dmgFlags = DMG_SLINGSHOT; this->unkPos = this->actor.world.pos; this->collider.dim.radius = 35; this->collider.dim.height = 75; @@ -206,15 +206,18 @@ void EnWonderItem_Init(Actor* thisx, PlayState* play) { void EnWonderItem_MultitagFree(EnWonderItem* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 prevTagFlags = this->tagFlags; + s16 prevTagFlags = this->tagFlags; s32 i; s32 mask; + f32 dx; + f32 dy; + f32 dz; for (i = 0, mask = 1; i < this->numTagPoints; i++, mask <<= 1) { if (!(prevTagFlags & mask)) { - f32 dx = player->actor.world.pos.x - sTagPointsFree[i].x; - f32 dy = player->actor.world.pos.y - sTagPointsFree[i].y; - f32 dz = player->actor.world.pos.z - sTagPointsFree[i].z; + dx = player->actor.world.pos.x - sTagPointsFree[i].x; + dy = player->actor.world.pos.y - sTagPointsFree[i].y; + dz = player->actor.world.pos.z - sTagPointsFree[i].z; if (sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 50.0f) { this->tagFlags |= mask; @@ -222,7 +225,7 @@ void EnWonderItem_MultitagFree(EnWonderItem* this, PlayState* play) { this->timer = this->timerMod + 81; return; } - if (BREG(0) != 0) { + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { DebugDisplay_AddObject(sTagPointsFree[i].x, sTagPointsFree[i].y, sTagPointsFree[i].z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); @@ -269,15 +272,18 @@ void EnWonderItem_ProximitySwitch(EnWonderItem* this, PlayState* play) { void EnWonderItem_MultitagOrdered(EnWonderItem* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 prevTagFlags = this->tagFlags; + s16 prevTagFlags = this->tagFlags; s32 i; s32 mask; + f32 dx; + f32 dy; + f32 dz; for (i = 0, mask = 1; i < this->numTagPoints; i++, mask <<= 1) { if (!(prevTagFlags & mask)) { - f32 dx = player->actor.world.pos.x - sTagPointsOrdered[i].x; - f32 dy = player->actor.world.pos.y - sTagPointsOrdered[i].y; - f32 dz = player->actor.world.pos.z - sTagPointsOrdered[i].z; + dx = player->actor.world.pos.x - sTagPointsOrdered[i].x; + dy = player->actor.world.pos.y - sTagPointsOrdered[i].y; + dz = player->actor.world.pos.z - sTagPointsOrdered[i].z; if (sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 50.0f) { if (prevTagFlags & mask) { @@ -292,7 +298,7 @@ void EnWonderItem_MultitagOrdered(EnWonderItem* this, PlayState* play) { Actor_Kill(&this->actor); return; } - } else if (BREG(0) != 0) { + } else if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { DebugDisplay_AddObject(sTagPointsOrdered[i].x, sTagPointsOrdered[i].y, sTagPointsOrdered[i].z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); @@ -358,7 +364,8 @@ void EnWonderItem_Update(Actor* thisx, PlayState* play) { if (this->wonderMode > 12) { colorIndex = 0; } - if (BREG(0) != 0) { + + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, debugArrowColors[colorIndex], debugArrowColors[colorIndex + 1], diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h index 398977d11..117b763c6 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.h @@ -18,7 +18,7 @@ typedef struct EnWonderItem { /* 0x015A */ s16 dropCount; /* 0x015C */ s16 timer; /* 0x015E */ s16 tagFlags; - /* 0x015A */ s16 tagCount; + /* 0x0160 */ s16 tagCount; /* 0x0162 */ s16 switchFlag; /* 0x0164 */ char unk_164[4]; /* 0x0168 */ s16 nextTag; diff --git a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c index ecdd5252d..56fdd5b04 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c @@ -85,8 +85,8 @@ void func_80B391CC(EnWonderTalk* this, PlayState* play) { PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ æ—¥è¨˜å¸³ã‚¹ã‚¿ãƒ¼ãƒˆï¼ â˜†â˜†â˜†â˜†â˜† \n" VT_RST); this->actor.textId = 0x5002; this->unk_156 = TEXT_STATE_CHOICE; - this->height = 30.0f; this->unk_15C = 40.0f; + this->height = 30.0f; // "Attention coordinates" PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 注目座標\t \t☆☆☆☆☆ %f\n" VT_RST, 30.0f); break; @@ -239,7 +239,7 @@ void EnWonderTalk_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_SetFocus(&this->actor, this->height); - if (BREG(0) != 0) { + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { if (this->unk_15A != 0) { if ((this->unk_15A & 1) == 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, diff --git a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c index 77abdf216..b70a8cf18 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c @@ -130,7 +130,8 @@ void func_80B3A15C(EnWonderTalk2* this, PlayState* play) { if (!((this->actor.xzDistToPlayer > 40.0f + this->triggerRange) || (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) > 100.0f) || (yawDiff >= 0x4000))) { - if (this->unk_158 >= 2) { + + if (IS_DEBUG && this->unk_158 >= 2) { PRINTF("\n\n"); // "Transparent Message Kimi Set" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 逿˜Žãƒ¡ãƒƒã‚»ãƒ¼ã‚¸å›ã›ã£ã¨ %x\n" VT_RST, this->actor.params); @@ -218,7 +219,8 @@ void func_80B3A4F8(EnWonderTalk2* this, PlayState* play) { if (((this->actor.xzDistToPlayer < (40.0f + this->triggerRange)) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 100.0f)) && !Play_InCsMode(play)) { - if (this->unk_158 >= 2) { + + if (IS_DEBUG && this->unk_158 >= 2) { PRINTF("\n\n"); // "Transparent Message Kimi Seto" PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 逿˜Žãƒ¡ãƒƒã‚»ãƒ¼ã‚¸å›ã›ã£ã¨ %x\n" VT_RST, this->actor.params); @@ -249,6 +251,7 @@ void func_80B3A4F8(EnWonderTalk2* this, PlayState* play) { PRINTF("\n\n"); } + this->unk_158 = 0; if (!this->unk_156) { Message_StartTextbox(play, this->actor.textId, NULL); @@ -275,7 +278,7 @@ void EnWonderTalk2_Update(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->actor, this->height); - if (BREG(0) != 0) { + if (IS_ACTOR_DEBUG_ENABLED && BREG(0) != 0) { if (this->unk_158 != 0) { if ((this->unk_158 & 1) == 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index 6b6267848..6845d3983 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -58,8 +58,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK5, { 0x00000000, 0x00, 0x00 }, { 0x0FC0074A, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 18, 60, 0, { 0, 0, 0 } }, @@ -306,18 +306,13 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnWood02* this = (EnWood02*)thisx; f32 wobbleAmplitude; - u8 new_var; - u8 phi_v0; - s32 pad; - Vec3f dropsSpawnPt; - s32 i; - s32 leavesParams; // Despawn extra trees in a group if out of range if ((this->spawnType == WOOD_SPAWN_SPAWNED) && (this->actor.parent != NULL)) { if (!(this->actor.flags & ACTOR_FLAG_6)) { - new_var = this->unk_14E[0]; - phi_v0 = 0; + u8 new_var = this->unk_14E[0]; + u8 phi_v0 = 0; + s32 pad; if (this->unk_14C < 0) { phi_v0 = 0x80; @@ -338,7 +333,8 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { } if (this->actor.home.rot.y != 0) { - dropsSpawnPt = this->actor.world.pos; + Vec3f dropsSpawnPt = this->actor.world.pos; + dropsSpawnPt.y += 200.0f; if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) { @@ -355,7 +351,8 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { // Spawn falling leaves if (this->unk_14C >= -1) { - leavesParams = WOOD_LEAF_GREEN; + s32 i; + s32 leavesParams = WOOD_LEAF_GREEN; if ((this->actor.params == WOOD_TREE_OVAL_YELLOW_SPAWNER) || (this->actor.params == WOOD_TREE_OVAL_YELLOW_SPAWNED)) { diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index d6fb2b59b..23335edd7 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -40,8 +40,8 @@ static ColliderCylinderInitType1 sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 25, 80, 0, { 0, 0, 0 } }, @@ -226,8 +226,9 @@ void func_80B3C7D4(EnXc* this, s32 action1, s32 action2, s32 action3) { } } +#if IS_DEBUG s32 EnXc_NoCutscenePlaying(PlayState* play) { - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { return true; } return false; @@ -244,6 +245,7 @@ void func_80B3C888(EnXc* this, PlayState* play) { func_80B3C820(this); } } +#endif void func_80B3C8CC(EnXc* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; @@ -280,6 +282,8 @@ void func_80B3C9EC(EnXc* this) { void func_80B3CA38(EnXc* this, PlayState* play) { // If Player is adult but hasn't learned Minuet of Forest if (!GET_EVENTCHKINF(EVENTCHKINF_50) && LINK_IS_ADULT) { + s32 pad; + this->action = SHEIK_ACTION_INIT; } else { Actor_Kill(&this->actor); @@ -287,12 +291,17 @@ void func_80B3CA38(EnXc* this, PlayState* play) { } s32 EnXc_MinuetCS(EnXc* this, PlayState* play) { - if (this->actor.params == SHEIK_TYPE_MINUET) { - Player* player = GET_PLAYER(play); - f32 z = player->actor.world.pos.z; + Player* player; + f32 playerPosZ; - if (z < -2225.0f) { + if (this->actor.params == SHEIK_TYPE_MINUET) { + player = GET_PLAYER(play); + playerPosZ = player->actor.world.pos.z; + + if (playerPosZ < -2225.0f) { if (!Play_InCsMode(play)) { + s32 pad; + play->csCtx.script = SEGMENTED_TO_VIRTUAL(gMinuetCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_50); @@ -308,6 +317,8 @@ s32 EnXc_MinuetCS(EnXc* this, PlayState* play) { void func_80B3CB58(EnXc* this, PlayState* play) { // If hasn't learned Bolero and Player is Adult if (!GET_EVENTCHKINF(EVENTCHKINF_51) && LINK_IS_ADULT) { + s32 pad; + this->action = SHEIK_ACTION_INIT; } else { Actor_Kill(&this->actor); @@ -324,6 +335,8 @@ s32 EnXc_BoleroCS(EnXc* this, PlayState* play) { if ((posRot->pos.x > -784.0f) && (posRot->pos.x < -584.0f) && (posRot->pos.y > 447.0f) && (posRot->pos.y < 647.0f) && (posRot->pos.z > -446.0f) && (posRot->pos.z < -246.0f) && !Play_InCsMode(play)) { + s32 pad; + play->csCtx.script = SEGMENTED_TO_VIRTUAL(gDeathMountainCraterBoleroCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_51); @@ -336,9 +349,10 @@ s32 EnXc_BoleroCS(EnXc* this, PlayState* play) { } void EnXc_SetupSerenadeAction(EnXc* this, PlayState* play) { - // Player is adult and does not have iron boots and has not learned Serenade - if (!CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && !GET_EVENTCHKINF(EVENTCHKINF_52) && + if (!(CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && IS_DEBUG) && !GET_EVENTCHKINF(EVENTCHKINF_52) && LINK_IS_ADULT) { + s32 pad; + this->action = SHEIK_ACTION_SERENADE; PRINTF("æ°´ã®ã‚»ãƒ¬ãƒŠãƒ¼ãƒ‡ シーク誕生!!!!!!!!!!!!!!!!!!\n"); } else { @@ -354,15 +368,18 @@ s32 EnXc_SerenadeCS(EnXc* this, PlayState* play) { if (CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && !GET_EVENTCHKINF(EVENTCHKINF_52) && !(stateFlags & PLAYER_STATE1_29) && !Play_InCsMode(play)) { + s32 pad; + Cutscene_SetScript(play, gIceCavernSerenadeCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_52); // Learned Serenade of Water Flag Item_Give(play, ITEM_SONG_SERENADE); PRINTF("ブーツをå–ã£ãŸ!!!!!!!!!!!!!!!!!!\n"); return true; + } else { + PRINTF("ã¯ã‚„ãブーツをå–ã‚‹ã¹ã—!!!!!!!!!!!!!!!!!!\n"); + return false; } - PRINTF("ã¯ã‚„ãブーツをå–ã‚‹ã¹ã—!!!!!!!!!!!!!!!!!!\n"); - return false; } return true; } @@ -455,7 +472,6 @@ void EnXc_SetColossusWindSFX(PlayState* play) { if (gSaveContext.sceneLayer == 4) { static s32 D_80B41D90 = 0; static Vec3f sPos = { 0.0f, 0.0f, 0.0f }; - static f32 sMaxSpeed = 0.0f; static Vec3f D_80B42DB0; s32 pad; s16 sceneId = play->sceneId; @@ -470,10 +486,12 @@ void EnXc_SetColossusWindSFX(PlayState* play) { if (D_80B41D90 != 0) { f32 speed = Math3D_Vec3f_DistXYZ(&D_80B42DB0, eye) / 7.058922f; +#if IS_DEBUG + static f32 sMaxSpeed = 0.0f; sMaxSpeed = CLAMP_MIN(sMaxSpeed, speed); - PRINTF("MAX speed = %f\n", sMaxSpeed); +#endif speed = CLAMP_MAX(speed, 2.0f); func_800F436C(&sPos, NA_SE_EV_FLYING_AIR - SFX_FLAG, 0.6f + (0.4f * speed)); @@ -784,6 +802,8 @@ void EnXc_SetupHarpPutawayAction(EnXc* this, PlayState* play) { curFrame = this->skelAnime.curFrame; animFrameCount = this->skelAnime.endFrame; if (curFrame >= animFrameCount) { + s32 pad; + Animation_Change(&this->skelAnime, &gSheikInitialHarpAnim, -1.0f, Animation_GetLastFrame(&gSheikInitialHarpAnim), 0.0f, ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_PUT_HARP_AWAY; @@ -873,6 +893,8 @@ void EnXc_SetupDisappear(EnXc* this, PlayState* play) { // Sheik fades away if end of Bolero CS, kill actor otherwise if (sceneId == SCENE_DEATH_MOUNTAIN_CRATER) { + s32 pad; + this->action = SHEIK_ACTION_FADE; this->drawMode = SHEIK_DRAW_NOTHING; this->actor.shape.shadowAlpha = 0; @@ -1666,7 +1688,9 @@ void EnXc_ActionFunc54(EnXc* this, PlayState* play) { EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); EnXc_SetupShowTriforceAction(this, play); +#if IS_DEBUG func_80B3C888(this, play); +#endif } void EnXc_ShowTriforce(EnXc* this, PlayState* play) { @@ -1677,7 +1701,9 @@ void EnXc_ShowTriforce(EnXc* this, PlayState* play) { EnXc_CalcTriforce(&this->actor, play); func_80B3FAE0(this); EnXc_SetupShowTriforceIdleAction(this, animFinished); +#if IS_DEBUG func_80B3C888(this, play); +#endif } void EnXc_ShowTriforceIdle(EnXc* this, PlayState* play) { @@ -1814,11 +1840,13 @@ void EnXc_SetupDefenseStance(Actor* thisx) { } void EnXc_SetupContortions(EnXc* this, PlayState* play) { - s32 pad; + s32 pad[2]; SkelAnime* skelAnime = &this->skelAnime; - f32 frameCount = Animation_GetLastFrame(&gSheikIdleAnim); - Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); +#if IS_DEBUG + Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikIdleAnim), ANIMMODE_LOOP, + 0.0f); +#endif func_80B3C588(this, play, 4); func_80B3C964(this, play); Animation_Change(skelAnime, &gSheikContortionsAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikContortionsAnim), @@ -2171,6 +2199,8 @@ void EnXc_InitTempleOfTime(EnXc* this, PlayState* play) { void EnXc_SetupDialogueAction(EnXc* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { + s32 pad; + this->action = SHEIK_ACTION_IN_DIALOGUE; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -2339,9 +2369,11 @@ void EnXc_Init(Actor* thisx, PlayState* play) { case SHEIK_TYPE_9: EnXc_InitTempleOfTime(this, play); break; +#if IS_DEBUG case SHEIK_TYPE_0: EnXc_DoNothing(this, play); break; +#endif default: PRINTF(VT_FGCOL(RED) " En_Oa2 ã® arg_data ãŒãŠã‹ã—ã„!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); EnXc_DoNothing(this, play); @@ -2353,6 +2385,8 @@ s32 EnXc_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (this->unk_30C != 0) { if (limbIndex == 9) { + s32 pad; + rot->x += this->interactInfo.torsoRot.y; rot->y -= this->interactInfo.torsoRot.x; } else if (limbIndex == 16) { diff --git a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c index 8eeb0e034..7f05638f0 100644 --- a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c +++ b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c @@ -27,8 +27,8 @@ static ColliderQuadInit sQuadInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x0001F824, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_NONE | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -128,9 +128,9 @@ void func_80B42F74(EnYabusameMark* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - arrowHitPos.x = this->collider.elem.bumper.hitPos.x; - arrowHitPos.y = this->collider.elem.bumper.hitPos.y; - arrowHitPos.z = this->collider.elem.bumper.hitPos.z; + arrowHitPos.x = this->collider.elem.acDmgInfo.hitPos.x; + arrowHitPos.y = this->collider.elem.acDmgInfo.hitPos.y; + arrowHitPos.z = this->collider.elem.acDmgInfo.hitPos.z; effectVelocity.y = 15.0f; @@ -194,6 +194,8 @@ void EnYabusameMark_Update(Actor* thisx, PlayState* play) { arrayIndex = this->typeIndex * 4; vertexArray = &sCollisionVertices[arrayIndex]; + if (1) {} + this->vertexA.x = vertexArray[0].x + this->actor.world.pos.x; this->vertexA.y = vertexArray[0].y + this->actor.world.pos.y; this->vertexA.z = vertexArray[0].z + this->actor.world.pos.z; @@ -212,7 +214,8 @@ void EnYabusameMark_Update(Actor* thisx, PlayState* play) { Collider_SetQuadVertices(&this->collider, &this->vertexA, &this->vertexB, &this->vertexC, &this->vertexD); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - if (BREG(0)) { + + if (IS_ACTOR_DEBUG_ENABLED && BREG(0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0, 0xFF, 0, 0xFF, 4, play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c index e6d39e6a5..c133bde62 100644 --- a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c +++ b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c @@ -43,8 +43,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x04 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_HARD, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_ON, OCELEM_ON, }, { 28, 8, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index 9d1c93926..05ef602b3 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -124,8 +124,8 @@ static ColliderCylinderInit sBodyCylinderInit = { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 20, 70, 0, { 0, 0, 0 } }, @@ -144,8 +144,8 @@ static ColliderQuadInit sSwordQuadInit = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x08 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL | ATELEM_UNK7, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -412,9 +412,12 @@ s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, P s16 curLoopPlatform = PLATFORM_INDEX_DOWNSTAIRS_INNER_MAX; // Will never retreat to the last two s16 minIndex = PLATFORM_INDEX_DOWNSTAIRS_MIN; f32 largeMaxRange = 99999.0f; - s16 altNextPlatform = -1; - s16 nextPlatform = -1; - s16 playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, initialPlatform); + s16 nextPlatform; + s16 altNextPlatform; + s16 playerPlatform; + + altNextPlatform = nextPlatform = -1; + playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, initialPlatform); // Set up search constraints // Upstairs @@ -436,9 +439,12 @@ s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, P if ((curLoopPlatform == initialPlatform) || (curLoopPlatform == playerPlatform)) { continue; } - if ((playerPlatform == -1) && - (Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]) < playerMaxDist)) { - continue; + if (playerPlatform == -1) { + s16 pad; + + if (Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]) < playerMaxDist) { + continue; + } } distToCurLoopPlatform = Math_Vec3f_DistXYZ(pos, &sPlatformPositions[curLoopPlatform]); @@ -490,6 +496,7 @@ s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, Pl f32 largeMaxRange = 99999.0f; s16 phi_s2 = curPlatform; s16 phi_s3 = arg2; + f32 curPlatformDistToPlayer; // Upstairs if (pos->y > 200.0f) { @@ -503,7 +510,7 @@ s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, Pl continue; } if (curLoopPlatform != nextPlatform) { - f32 curPlatformDistToPlayer = + curPlatformDistToPlayer = Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]); if (curPlatformDistToPlayer < smallMaxRange) { @@ -1783,27 +1790,31 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { if (this->unk_3F8) { this->actor.speed = -this->actor.speed; } - } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || - !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y + 0x3FFF)) { - if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - if (this->actor.speed >= 0.0f) { - phi_v0_4 = this->actor.shape.rot.y + 0x3FFF; + } else { + s16 pad; + + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y + 0x3FFF)) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + if (this->actor.speed >= 0.0f) { + phi_v0_4 = this->actor.shape.rot.y + 0x3FFF; + } else { + phi_v0_4 = this->actor.shape.rot.y - 0x3FFF; + } + + phi_v0_4 = this->actor.wallYaw - phi_v0_4; } else { - phi_v0_4 = this->actor.shape.rot.y - 0x3FFF; + this->actor.speed *= -0.8f; + phi_v0_4 = 0; } - phi_v0_4 = this->actor.wallYaw - phi_v0_4; - } else { - this->actor.speed *= -0.8f; - phi_v0_4 = 0; - } - - if (ABS(phi_v0_4) > 0x4000) { - this->actor.speed *= -0.8f; - if (this->actor.speed < 0.0f) { - this->actor.speed -= 0.5f; - } else { - this->actor.speed += 0.5f; + if (ABS(phi_v0_4) > 0x4000) { + this->actor.speed *= -0.8f; + if (this->actor.speed < 0.0f) { + this->actor.speed -= 0.5f; + } else { + this->actor.speed += 0.5f; + } } } } @@ -1873,6 +1884,8 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { } else if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) && (D_80B4A1B4 == this->actor.params)) { EnZf_SetupHopAndTaunt(this); } else { + s16 pad; + this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && @@ -1889,10 +1902,8 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { this->unk_3F0--; } if (prevFrame != (s32)this->skelAnime.curFrame) { - s32 afterPrevFrame = absPlaySpeed + prevFrame; - - if (((beforeCurFrame < 14) && (afterPrevFrame >= 16)) || - ((beforeCurFrame < 27) && (afterPrevFrame >= 29))) { + if (((beforeCurFrame < 14) && (absPlaySpeed + prevFrame >= 16)) || + ((beforeCurFrame < 27) && (absPlaySpeed + prevFrame >= 29))) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } } diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index 8815b37ba..aed5c9b0f 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -52,8 +52,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 20, 46, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1_cutscene_data.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1_cutscene_data.c index 7895f776b..d0b011d45 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1_cutscene_data.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1_cutscene_data.c @@ -5,227 +5,227 @@ CutsceneData D_80B4C5D0[] = { CS_BEGIN_CUTSCENE(28, 3000), CS_PLAYER_CUE_LIST(3), - CS_PLAYER_CUE(PLAYER_CUEID_5, 400, 1211, 0x0000, 0xC000, 0x0000, -422, 84, 1, -422, 84, 1, 1.1266861702801002e-29f, 0.0f, 1.401298464324817e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_1, 1211, 1241, 0x0000, 0xC000, 0x0000, -422, 84, 1, -483, 84, 0, 1.1266861702801002e-29f, 0.0f, 1.401298464324817e-45f), - CS_PLAYER_CUE(PLAYER_CUEID_41, 1241, 1311, 0x0000, 0xC000, 0x0000, -483, 84, 0, -483, 84, 0, 1.1266861702801002e-29f, 0.0f, 1.401298464324817e-45f), + CS_PLAYER_CUE(PLAYER_CUEID_5, 400, 1211, 0x0000, 0xC000, 0x0000, -422, 84, 1, -422, 84, 1, CS_FLOAT(0xF6484E4, 1.1266862e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_1, 1211, 1241, 0x0000, 0xC000, 0x0000, -422, 84, 1, -483, 84, 0, CS_FLOAT(0xF6484E4, 1.1266862e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_41, 1241, 1311, 0x0000, 0xC000, 0x0000, -483, 84, 0, -483, 84, 0, CS_FLOAT(0xF6484E4, 1.1266862e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), CS_ACTOR_CUE_LIST(18, 1), - CS_ACTOR_CUE(0x0007, 1170, 1316, 0x7477, 0x0000, 0x0000, -485, 84, 0, -469, 85, -55, 0.10958904f, 0.006849315f, -0.10958904f), + CS_ACTOR_CUE(0x0007, 1170, 1316, 0x7477, 0x0000, 0x0000, -485, 84, 0, -469, 85, -55, CS_FLOAT(0x3DE07038, 0.10958904f), CS_FLOAT(0x3BE07038, 0.006849315f), CS_FLOAT(0xBDE07038, -0.10958904f)), CS_UNK_DATA_LIST(0x00000049, 1), CS_UNK_DATA(0x00010000, 0x0BB80000, 0x00000000, 0x00000000, 0xFFFFFFE8, 0x00000003, 0x00000000, 0xFFFFFFE8, 0x00000003, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(16, 3), - CS_ACTOR_CUE(0x0009, 1220, 1310, 0x8000, 0x0000, 0x0000, -890, 90, 150, -890, 90, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x000A, 1310, 1449, 0x0000, 0x0000, 0x0000, -890, 90, 0, -890, 90, 0, 0.0f, 0.0f, 0.0f), - CS_ACTOR_CUE(0x0004, 1449, 1457, 0x0000, 0x0000, 0x0000, -890, 90, 0, -890, 90, 0, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0009, 1220, 1310, 0x8000, 0x0000, 0x0000, -890, 90, 150, -890, 90, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x000A, 1310, 1449, 0x0000, 0x0000, 0x0000, -890, 90, 0, -890, 90, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0004, 1449, 1457, 0x0000, 0x0000, 0x0000, -890, 90, 0, -890, 90, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_MISC_LIST(1), CS_MISC(CS_MISC_STOP_CUTSCENE, 1460, 1461, 0x0000, 0x00000000, 0xFFFFFFFF, 0x00000000, 0x00000002, 0xFFFFFFFF, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000), CS_ACTOR_CUE_LIST(29, 1), - CS_ACTOR_CUE(0x0002, 330, 763, 0x0000, 0x0000, 0x0000, -1250, 150, 0, -1250, 150, 0, 0.0f, 0.0f, 0.0f), + CS_ACTOR_CUE(0x0002, 330, 763, 0x0000, 0x0000, 0x0000, -1250, 150, 0, -1250, 150, 0, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 200, 231), CS_TRANSITION(CS_TRANS_GRAY_FILL_OUT, 230, 271), CS_TRANSITION(CS_TRANS_GRAY_FILL_IN, 860, 870), CS_TRANSITION(CS_TRANS_GRAY_FILL_OUT, 875, 900), CS_CAM_EYE_SPLINE(0, 331), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -447, 128, 1, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -447, 128, 1, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -447, 128, 1, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -447, 128, 1, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -392, 145, 1, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -318, 168, 1, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -222, 198, 1, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -146, 221, 1, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -132, 222, 1, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -66, 267, 1, 0x3632), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -66, 267, 1, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -66, 267, 1, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -66, 267, 1, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.800003f, -66, 267, 1, 0x3533), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.800003f, -66, 267, 1, 0x3336), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -447, 128, 1, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -447, 128, 1, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -447, 128, 1, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -447, 128, 1, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -392, 145, 1, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -318, 168, 1, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -222, 198, 1, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -146, 221, 1, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -132, 222, 1, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -66, 267, 1, 0x3632), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -66, 267, 1, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -66, 267, 1, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -66, 267, 1, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -66, 267, 1, 0x3533), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42733334, 60.800003f), -66, 267, 1, 0x3336), CS_CAM_EYE_SPLINE(230, 1631), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1220, 445, 24, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1220, 445, 24, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1220, 445, 24, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1220, 445, 24, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1220, 445, 24, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1220, 445, 24, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1220, 445, 24, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1220, 445, 24, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1220, 445, 24, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1220, 259, 24, 0x3632), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1220, 189, 24, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1135, 198, 81, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -1132, 119, 84, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1199, 137, 36, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x3336), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x332C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x3231), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x3232), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x2034), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x3331), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x3434), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x312C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x3136), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x3336), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x332C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x200A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600002f, -1218, 127, 22, 0x3136), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.600002f, -1218, 127, 22, 0x3336), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1220, 445, 24, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1220, 445, 24, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1220, 445, 24, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1220, 445, 24, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1220, 445, 24, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1220, 445, 24, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1220, 445, 24, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1220, 445, 24, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1220, 445, 24, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1220, 259, 24, 0x3632), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1220, 189, 24, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1135, 198, 81, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -1132, 119, 84, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1199, 137, 36, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x3336), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x332C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x3231), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x3232), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x2034), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x3331), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x3434), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x312C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x3136), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x3336), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x332C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x200A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x3136), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1218, 127, 22, 0x3336), CS_CAM_EYE_SPLINE(810, 1041), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600006f, -1218, 127, 22, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600006f, -1218, 127, 22, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600006f, -1218, 127, 22, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600006f, -1218, 88, 21, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600006f, -1208, -52, 23, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600006f, -1201, -114, 26, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600006f, -1201, -114, 26, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600006f, -1201, -114, 26, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600006f, -1201, -114, 26, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.600006f, -1201, -114, 26, 0x3632), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.600006f, -1201, -114, 26, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), -1218, 127, 22, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), -1218, 127, 22, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), -1218, 127, 22, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), -1218, 88, 21, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), -1208, -52, 23, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), -1201, -114, 26, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), -1201, -114, 26, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), -1201, -114, 26, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), -1201, -114, 26, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), -1201, -114, 26, 0x3632), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42726668, 60.600006f), -1201, -114, 26, 0x3639), CS_CAM_EYE_SPLINE(870, 1261), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 80.274445f, -59, 160, 320, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.074677f, -59, 160, 320, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.074677f, -59, 160, 320, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.074677f, -59, 160, 320, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.074677f, -115, 148, 249, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.074677f, -190, 126, 192, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.074677f, -286, 105, 135, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.074677f, -357, 108, 87, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.074677f, -394, 104, 53, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.074677f, -394, 104, 53, 0x3632), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.074677f, -394, 104, 53, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.074677f, -394, 104, 53, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.074677f, -394, 104, 53, 0x2031), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.074677f, -394, 104, 53, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42A08C84, 80.274445f), -59, 160, 320, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -59, 160, 320, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -59, 160, 320, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -59, 160, 320, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -115, 148, 249, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -190, 126, 192, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -286, 105, 135, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -357, 108, 87, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -394, 104, 53, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -394, 104, 53, 0x3632), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -394, 104, 53, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -394, 104, 53, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -394, 104, 53, 0x2031), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42704C78, 60.074677f), -394, 104, 53, 0x3533), CS_CAM_EYE_SPLINE(1160, 1401), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -459, 175, 80, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -459, 175, 80, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -459, 175, 80, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -459, 175, 80, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -459, 175, 80, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -459, 175, 80, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -459, 175, 80, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 60.0f, -459, 175, 80, 0x392C), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 60.0f, -459, 175, 80, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -459, 175, 80, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -459, 175, 80, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -459, 175, 80, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -459, 175, 80, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -459, 175, 80, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -459, 175, 80, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -459, 175, 80, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -459, 175, 80, 0x392C), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42700000, 60.0f), -459, 175, 80, 0x2032), CS_CAM_EYE_SPLINE(1260, 1411), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.199944f, -461, 133, 0, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.199944f, -461, 133, 0, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.199944f, -461, 133, 0, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.199944f, -461, 133, 0, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 45.199944f, -461, 133, 0, 0x2032), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 45.199944f, -461, 133, 0, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4234CCBE, 45.199944f), -461, 133, 0, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4234CCBE, 45.199944f), -461, 133, 0, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4234CCBE, 45.199944f), -461, 133, 0, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4234CCBE, 45.199944f), -461, 133, 0, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4234CCBE, 45.199944f), -461, 133, 0, 0x2032), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4234CCBE, 45.199944f), -461, 133, 0, 0x3533), CS_CAM_EYE_SPLINE(1320, 1531), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 10.999838f, -488, 124, -6, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 10.999838f, -488, 124, -6, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 10.999838f, -488, 124, -6, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 10.999838f, -488, 124, -6, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 10.999838f, -488, 124, -6, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 10.999838f, -488, 124, -6, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, 10.999838f, -488, 124, -6, 0x3639), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, 10.999838f, -488, 124, -6, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x412FFF56, 10.999838f), -488, 124, -6, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x412FFF56, 10.999838f), -488, 124, -6, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x412FFF56, 10.999838f), -488, 124, -6, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x412FFF56, 10.999838f), -488, 124, -6, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x412FFF56, 10.999838f), -488, 124, -6, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x412FFF56, 10.999838f), -488, 124, -6, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x412FFF56, 10.999838f), -488, 124, -6, 0x3639), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x412FFF56, 10.999838f), -488, 124, -6, 0x392C), CS_CAM_AT_SPLINE(0, 360), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -506, 110, 1, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.800003f, -506, 110, 1, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.800003f, -506, 110, 1, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.800003f, -506, 110, 1, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 25, 60.800003f, -451, 127, 1, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 25, 60.800003f, -380, 149, 1, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.800003f, -291, 177, 1, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.800003f, -224, 210, 1, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.800003f, -213, 230, 1, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.800003f, -143, 291, 1, 0x3632), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.800003f, -135, 308, 1, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.800003f, -127, 319, 1, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.800003f, -120, 326, 1, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.800003f, -120, 326, 1, 0x3533), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.800003f, -120, 326, 1, 0x3336), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -506, 110, 1, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42733334, 60.800003f), -506, 110, 1, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42733334, 60.800003f), -506, 110, 1, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42733334, 60.800003f), -506, 110, 1, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 25, CS_FLOAT(0x42733334, 60.800003f), -451, 127, 1, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 25, CS_FLOAT(0x42733334, 60.800003f), -380, 149, 1, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42733334, 60.800003f), -291, 177, 1, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42733334, 60.800003f), -224, 210, 1, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42733334, 60.800003f), -213, 230, 1, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42733334, 60.800003f), -143, 291, 1, 0x3632), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42733334, 60.800003f), -135, 308, 1, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42733334, 60.800003f), -127, 319, 1, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42733334, 60.800003f), -120, 326, 1, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42733334, 60.800003f), -120, 326, 1, 0x3533), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42733334, 60.800003f), -120, 326, 1, 0x3336), CS_CAM_AT_SPLINE(230, 1710), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -1246, 413, 5, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -1246, 413, 5, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -1246, 413, 5, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -1246, 413, 5, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -1246, 413, 5, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -1246, 413, 5, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -1246, 413, 5, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -1246, 413, 5, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -1246, 413, 5, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -1245, 227, 5, 0x3632), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -1245, 158, 5, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -1180, 178, 50, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, 60.0f, -1178, 131, 51, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, 60.600002f, -1240, 146, 6, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -1253, 153, -3, 0x3336), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -1253, 153, -3, 0x332C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -1253, 153, -3, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -1253, 153, -3, 0x3231), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -1253, 153, -3, 0x3232), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -1252, 152, -2, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -1252, 152, -2, 0x2034), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, 60.600002f, -1252, 152, -2, 0x3331), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, 60.600002f, -1252, 152, -2, 0x3434), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, 60.600002f, -1252, 152, -2, 0x312C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, 60.600002f, -1251, 151, -1, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, 60.600002f, -1251, 151, -1, 0x3136), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, 60.600002f, -1251, 151, -1, 0x3336), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, 60.600002f, -1251, 151, -1, 0x332C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, 60.600002f, -1251, 151, -1, 0x200A), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600002f, -1251, 151, -1, 0x3136), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 80, 60.600002f, -1251, 151, -1, 0x3336), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -1246, 413, 5, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -1246, 413, 5, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -1246, 413, 5, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -1246, 413, 5, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -1246, 413, 5, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -1246, 413, 5, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -1246, 413, 5, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -1246, 413, 5, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -1246, 413, 5, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -1245, 227, 5, 0x3632), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -1245, 158, 5, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -1180, 178, 50, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, CS_FLOAT(0x42700000, 60.0f), -1178, 131, 51, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, CS_FLOAT(0x42726667, 60.600002f), -1240, 146, 6, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1253, 153, -3, 0x3336), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1253, 153, -3, 0x332C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1253, 153, -3, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1253, 153, -3, 0x3231), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1253, 153, -3, 0x3232), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1252, 152, -2, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1252, 152, -2, 0x2034), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, CS_FLOAT(0x42726667, 60.600002f), -1252, 152, -2, 0x3331), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, CS_FLOAT(0x42726667, 60.600002f), -1252, 152, -2, 0x3434), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, CS_FLOAT(0x42726667, 60.600002f), -1252, 152, -2, 0x312C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, CS_FLOAT(0x42726667, 60.600002f), -1251, 151, -1, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, CS_FLOAT(0x42726667, 60.600002f), -1251, 151, -1, 0x3136), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, CS_FLOAT(0x42726667, 60.600002f), -1251, 151, -1, 0x3336), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, CS_FLOAT(0x42726667, 60.600002f), -1251, 151, -1, 0x332C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 80, CS_FLOAT(0x42726667, 60.600002f), -1251, 151, -1, 0x200A), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1251, 151, -1, 0x3136), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 80, CS_FLOAT(0x42726667, 60.600002f), -1251, 151, -1, 0x3336), CS_CAM_AT_SPLINE(810, 1070), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600006f, -1251, 151, -1, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600006f, -1251, 151, -1, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, 60.600006f, -1250, 150, 0, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.600006f, -1241, 125, 5, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.600006f, -1226, -13, 10, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, 60.600006f, -1218, -73, 26, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600006f, -1218, -73, 26, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600006f, -1218, -73, 26, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600006f, -1218, -73, 26, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.600006f, -1218, -73, 26, 0x3632), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.600006f, -1218, -73, 26, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726668, 60.600006f), -1251, 151, -1, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726668, 60.600006f), -1251, 151, -1, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 20, CS_FLOAT(0x42726668, 60.600006f), -1250, 150, 0, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42726668, 60.600006f), -1241, 125, 5, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42726668, 60.600006f), -1226, -13, 10, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42726668, 60.600006f), -1218, -73, 26, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726668, 60.600006f), -1218, -73, 26, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726668, 60.600006f), -1218, -73, 26, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726668, 60.600006f), -1218, -73, 26, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726668, 60.600006f), -1218, -73, 26, 0x3632), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42726668, 60.600006f), -1218, -73, 26, 0x3639), CS_CAM_AT_SPLINE(870, 1290), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -45, 240, 241, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -45, 240, 241, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -56, 219, 224, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -85, 183, 212, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -204, 134, 183, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -280, 116, 125, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -376, 104, 69, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -440, 107, 13, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -467, 110, -25, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -467, 110, -25, 0x3632), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -467, 110, -25, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -467, 110, -25, 0x392C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.074677f, -467, 110, -25, 0x2031), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.074677f, -467, 110, -25, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -45, 240, 241, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -45, 240, 241, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -56, 219, 224, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -85, 183, 212, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -204, 134, 183, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -280, 116, 125, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -376, 104, 69, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -440, 107, 13, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -467, 110, -25, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -467, 110, -25, 0x3632), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -467, 110, -25, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -467, 110, -25, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -467, 110, -25, 0x2031), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42704C78, 60.074677f), -467, 110, -25, 0x3533), CS_CAM_AT_SPLINE(1160, 1430), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -456, 138, 16, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -456, 138, 16, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -456, 138, 16, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -456, 138, 16, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -456, 138, 16, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -456, 138, 16, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -456, 138, 16, 0x3639), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 60.0f, -456, 138, 16, 0x392C), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 60.0f, -456, 138, 16, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -456, 138, 16, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -456, 138, 16, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -456, 138, 16, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -456, 138, 16, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -456, 138, 16, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -456, 138, 16, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -456, 138, 16, 0x3639), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -456, 138, 16, 0x392C), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42700000, 60.0f), -456, 138, 16, 0x2032), CS_CAM_AT_SPLINE(1260, 1440), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.199944f, -535, 133, 0, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.199944f, -535, 133, 0, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.199944f, -535, 133, 0, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.199944f, -535, 133, 0, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 45.199944f, -535, 133, 0, 0x2032), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 45.199944f, -535, 133, 0, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4234CCBE, 45.199944f), -535, 133, 0, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4234CCBE, 45.199944f), -535, 133, 0, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4234CCBE, 45.199944f), -535, 133, 0, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4234CCBE, 45.199944f), -535, 133, 0, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4234CCBE, 45.199944f), -535, 133, 0, 0x2032), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4234CCBE, 45.199944f), -535, 133, 0, 0x3533), CS_CAM_AT_SPLINE(1320, 1560), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 10.999838f, -1349, 124, -6, 0x2031), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 10.999838f, -1349, 124, -6, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 10.999838f, -1349, 124, -6, 0x3833), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 10.999838f, -1349, 124, -6, 0x2C20), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 10.999838f, -1349, 124, -6, 0x2032), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 10.999838f, -1349, 124, -6, 0x3533), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, 10.999838f, -1349, 124, -6, 0x3639), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, 10.999838f, -1349, 124, -6, 0x392C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x412FFF56, 10.999838f), -1349, 124, -6, 0x2031), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x412FFF56, 10.999838f), -1349, 124, -6, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x412FFF56, 10.999838f), -1349, 124, -6, 0x3833), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x412FFF56, 10.999838f), -1349, 124, -6, 0x2C20), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x412FFF56, 10.999838f), -1349, 124, -6, 0x2032), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x412FFF56, 10.999838f), -1349, 124, -6, 0x3533), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x412FFF56, 10.999838f), -1349, 124, -6, 0x3639), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x412FFF56, 10.999838f), -1349, 124, -6, 0x392C), CS_TEXT_LIST(10), CS_TEXT_NONE(0, 50), CS_TEXT(0x7035, 50, 190, 0x0000, 0xFFFF, 0xFFFF), diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index f0a2d69a2..b8489bbe6 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -212,8 +212,11 @@ s32 EnZl2_UpdateSkelAnime(EnZl2* this) { CsCmdActorCue* EnZl2_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } + return NULL; } @@ -334,7 +337,11 @@ void func_80B4EF64(EnZl2* this, s16 arg1, s32 arg2) { } if (arg2 == 2) { + s32 pad; + if ((this->action == 5) || (this->action == 30)) { + s32 temp_t0; + curFrame = this->skelAnime.curFrame; unk_278 = this->unk_278; temp_t0 = (s32)((3500.0f * curFrame) / unk_278) + phi_a0; @@ -343,13 +350,15 @@ void func_80B4EF64(EnZl2* this, s16 arg1, s32 arg2) { phi_v0 /= -2; } } else if ((this->action == 6) || (this->action == 31)) { - temp_t0 = phi_a0 + 0xDAC; + s32 temp_t0 = phi_a0 + 0xDAC; + if (temp_t0 >= temp_v1) { temp_v1 = temp_t0; phi_v0 /= -2; } } else if (this->action == 20) { - temp_t0 = phi_a0 - 0x3E8; + s32 temp_t0 = phi_a0 - 0x3E8; + if (temp_t0 >= temp_v1) { temp_v1 = temp_t0; phi_v0 /= -2; @@ -453,29 +462,35 @@ s32 func_80B4F45C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s Matrix_Translate(362.0f, -133.0f, 0.0f, MTXMODE_APPLY); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 0); func_80B4F230(this, sp2C.x, 1); func_80B4EF64(this, sp2C.z, 2); } + Matrix_RotateZYX(unk_1DC[0] + kREG(31), unk_1DC[1] + kREG(32), unk_1DC[2] + kREG(33), MTXMODE_APPLY); Matrix_Translate(-188.0f, -184.0f, 0.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp74[0], "../z_en_zl2.c", 1056); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 3); func_80B4F230(this, sp2C.x, 4); } + Matrix_RotateZYX(unk_1DC[3] + kREG(34), unk_1DC[4] + kREG(35), unk_1DC[5] + kREG(36), MTXMODE_APPLY); Matrix_Translate(-410.0f, -184.0f, 0.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp74[1], "../z_en_zl2.c", 1100); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 6); func_80B4F230(this, sp2C.x, 7); } + Matrix_RotateZYX(unk_1DC[6] + kREG(37), unk_1DC[7] + kREG(38), unk_1DC[8] + kREG(39), MTXMODE_APPLY); Matrix_Translate(-1019.0f, -26.0f, 0.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp74[2], "../z_en_zl2.c", 1120); @@ -484,21 +499,25 @@ s32 func_80B4F45C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s Matrix_Translate(467.0f, 265.0f, 389.0f, MTXMODE_APPLY); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 9); func_80B4F230(this, sp2C.x, 10); func_80B4EF64(this, sp2C.z, 11); } + Matrix_RotateZYX(unk_1DC[9] + kREG(40), unk_1DC[10] + kREG(41), unk_1DC[11] + kREG(42), MTXMODE_APPLY); Matrix_Translate(-427.0f, -1.0f, -3.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp74[3], "../z_en_zl2.c", 1145); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 12); func_80B4F230(this, sp2C.x, 13); func_80B4EF64(this, sp2C.z, 14); } + Matrix_RotateZYX(unk_1DC[12] + kREG(43), unk_1DC[13] + kREG(44), unk_1DC[14] + kREG(45), MTXMODE_APPLY); Matrix_Translate(-446.0f, -52.0f, 84.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp74[4], "../z_en_zl2.c", 1164); @@ -507,21 +526,25 @@ s32 func_80B4F45C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s Matrix_Translate(467.0f, 265.0f, -389.0f, MTXMODE_APPLY); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 15); func_80B4F230(this, sp2C.x, 16); func_80B4EF64(this, sp2C.z, 17); } + Matrix_RotateZYX(unk_1DC[15] + kREG(46), unk_1DC[16] + kREG(47), unk_1DC[17] + kREG(48), MTXMODE_APPLY); Matrix_Translate(-427.0f, -1.0f, 3.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp74[5], "../z_en_zl2.c", 1189); Matrix_Get(&sp34); Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B4EE38(this, sp2C.y, 18); func_80B4F230(this, sp2C.x, 19); func_80B4EF64(this, sp2C.z, 20); } + Matrix_RotateZYX(unk_1DC[18] + kREG(49), unk_1DC[19] + kREG(50), unk_1DC[20] + kREG(51), MTXMODE_APPLY); Matrix_Translate(-446.0f, -52.0f, -84.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp74[6], "../z_en_zl2.c", 1208); @@ -1563,9 +1586,11 @@ void func_80B52114(EnZl2* this, PlayState* play) { case 4: func_80B51D0C(this, play); break; +#if IS_DEBUG case 0: func_80B4FD90(this, play); break; +#endif default: PRINTF(VT_FGCOL(RED) " En_Oa2 ã® arg_data ãŒãŠã‹ã—ã„!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); func_80B4FD90(this, play); @@ -1578,10 +1603,12 @@ void func_80B521A0(EnZl2* this, PlayState* play) { s32 objectSlot = Object_GetSlot(objectCtx, OBJECT_ZL2_ANIME1); s32 pad2; +#if IS_DEBUG if (objectSlot < 0) { PRINTF(VT_FGCOL(RED) "En_Zl2_main_bankアニメーションã®ãƒãƒ³ã‚¯ã‚’読ã‚ãªã„!!!!!!!!!!!!\n" VT_RST); return; } +#endif if (Object_IsLoaded(objectCtx, objectSlot)) { this->zl2Anime1ObjectSlot = objectSlot; diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 24e97ebd1..29ecedbf1 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -32,8 +32,8 @@ static ColliderCylinderInitType1 sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 25, 80, 0, { 0, 0, 0 } }, @@ -271,7 +271,6 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { s32 temp_a0; s32 phi_v0; s32 phi_v1; - s32 phi_v1_2; if (idx == 2) { phi_a1 = 15000; @@ -315,18 +314,26 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (idx == 2 && (action == 5 || action == 24)) { if (phi_v1 != 0) { + s32 pad; + phi_v0 -= (phi_v1 - phi_v0) / 10; } } else if (idx == 2 && action == 22 && skelAnime->mode == 2) { if (phi_v1 != 0) { + s32 pad; + phi_v0 -= (phi_v1 - phi_v0) / 10; } } else if (idx == 2 && (action == 20 || action == 21) && skelAnime->mode == 2) { if (phi_v1 != 0) { + s32 pad; + phi_v0 -= (phi_v1 - phi_v0) / 10; } } else { if (phi_v1 != 0) { + s32 pad; + phi_v0 += (phi_v1 - phi_v0) / 16; } } @@ -352,8 +359,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E0 = this->unk_3E0; + s32 phi_v1_2 = (s32)(((unk_3E0 - curFrame) / unk_3E0) * -2000.0f) + phi_a1; - phi_v1_2 = (s32)(((unk_3E0 - curFrame) / unk_3E0) * -2000.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -365,8 +372,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E4 = this->unk_3E4; + s32 phi_v1_2 = (s32)((curFrame / unk_3E4) * -2000.0f) + phi_a1; - phi_v1_2 = (s32)((curFrame / unk_3E4) * -2000.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -374,7 +381,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 - 2000; + s32 phi_v1_2 = phi_a1 - 2000; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -386,6 +394,7 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3F4 = this->unk_3F4; + s32 phi_v1_2; if (curFrame <= 42.0f) { phi_v1_2 = phi_a1 - 2000; @@ -400,7 +409,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 + 4200; + s32 phi_v1_2 = phi_a1 + 4200; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -412,8 +422,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3EC = this->unk_3EC; + s32 phi_v1_2 = (s32)(((curFrame / unk_3EC) * -5200.0f) + 4200.0f) + phi_a1; - phi_v1_2 = (s32)(((curFrame / unk_3EC) * -5200.0f) + 4200.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -421,7 +431,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 - 2000; + s32 phi_v1_2 = phi_a1 - 2000; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -433,8 +444,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3F0 = this->unk_3F0; + s32 phi_v1_2 = (s32)(((curFrame / unk_3F0) * -7600.0f) + -2000.0f) + phi_a1; - phi_v1_2 = (s32)(((curFrame / unk_3F0) * -7600.0f) + -2000.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -442,7 +453,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 - 9600; + s32 phi_v1_2 = phi_a1 - 9600; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -454,8 +466,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E8 = this->unk_3E8; + s32 phi_v1_2 = (s32)(((curFrame / unk_3E8) * 21000.0f) + -9600.0f) + phi_a1; - phi_v1_2 = (s32)(((curFrame / unk_3E8) * 21000.0f) + -9600.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -463,7 +475,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 + 11400; + s32 phi_v1_2 = phi_a1 + 11400; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -477,8 +490,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E0 = this->unk_3E0; + s32 phi_v1_2 = (s32)((curFrame / unk_3E0) * -7000.0f) + phi_a1; - phi_v1_2 = (s32)((curFrame / unk_3E0) * -7000.0f) + phi_a1; if (temp_a0 >= phi_v1_2) { temp_a0 = phi_v1_2; if (phi_v0 > 0) { @@ -486,7 +499,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 - 7000; + s32 phi_v1_2 = phi_a1 - 7000; + if (temp_a0 >= phi_v1_2) { temp_a0 = phi_v1_2; if (phi_v0 > 0) { @@ -498,8 +512,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E4 = this->unk_3E4; + s32 phi_v1_2 = (s32)(((unk_3E4 - curFrame) / unk_3E4) * -7000.0f) + phi_a1; - phi_v1_2 = (s32)(((unk_3E4 - curFrame) / unk_3E4) * -7000.0f) + phi_a1; if (temp_a0 >= phi_v1_2) { temp_a0 = phi_v1_2; if (phi_v0 > 0) { @@ -582,17 +596,18 @@ void func_80B54360(EnZl3* this, s16 arg1, s32 arg2) { } s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { - s32 pad[3]; + s32 pad[2]; EnZl3* this = (EnZl3*)thisx; - s16* unk_28C = this->unk_28C; - Mtx* sp78; - MtxF sp38; - Vec3s sp30; Vec3s* headRot = &this->interactInfo.headRot; Vec3s* torsoRot = &this->interactInfo.torsoRot; if (limbIndex == 14) { - sp78 = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 7); + Mtx* sp78 = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 7); + MtxF sp38; + Vec3s sp30; + s16* unk_28C = this->unk_28C; + s32 pad2; + rot->x += headRot->y; rot->z += headRot->x; gSPSegment((*gfx)++, 0x0C, sp78); @@ -604,27 +619,33 @@ s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s Matrix_Translate(362.0f, -133.0f, 0.0f, MTXMODE_APPLY); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 0); func_80B54360(this, sp30.x, 1); func_80B53B64(this, sp30.z, 2); } + Matrix_RotateZYX(unk_28C[0] + kREG(31), unk_28C[1] + kREG(32), unk_28C[2] + kREG(33), MTXMODE_APPLY); Matrix_Translate(-188.0f, -184.0f, 0.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp78[0], "../z_en_zl3.c", 1490); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 3); } + Matrix_RotateZYX(unk_28C[3] + kREG(34), unk_28C[4] + kREG(35), unk_28C[5] + kREG(36), MTXMODE_APPLY); Matrix_Translate(-410.0f, -184.0f, 0.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp78[1], "../z_en_zl3.c", 1534); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B54360(this, sp30.x, 7); } + Matrix_RotateZYX(unk_28C[6] + kREG(37), unk_28C[7] + kREG(38), unk_28C[8] + kREG(39), MTXMODE_APPLY); Matrix_Translate(-1019.0f, -26.0f, 0.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp78[2], "../z_en_zl3.c", 1554); @@ -633,21 +654,25 @@ s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s Matrix_Translate(467.0f, 265.0f, 389.0f, MTXMODE_APPLY); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 9); func_80B54360(this, sp30.x, 10); func_80B53B64(this, sp30.z, 11); } + Matrix_RotateZYX(unk_28C[9] + kREG(40), unk_28C[10] + kREG(41), unk_28C[11] + kREG(42), MTXMODE_APPLY); Matrix_Translate(-427.0f, -1.0f, -3.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp78[3], "../z_en_zl3.c", 1579); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 12); func_80B54360(this, sp30.x, 13); func_80B53B64(this, sp30.z, 14); } + Matrix_RotateZYX(unk_28C[12] + kREG(43), unk_28C[13] + kREG(44), unk_28C[14] + kREG(45), MTXMODE_APPLY); Matrix_Translate(-446.0f, -52.0f, 84.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp78[4], "../z_en_zl3.c", 1598); @@ -656,21 +681,25 @@ s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s Matrix_Translate(467.0f, 265.0f, -389.0f, MTXMODE_APPLY); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 15); func_80B54360(this, sp30.x, 16); func_80B53B64(this, sp30.z, 17); } + Matrix_RotateZYX(unk_28C[15] + kREG(46), unk_28C[16] + kREG(47), unk_28C[17] + kREG(48), MTXMODE_APPLY); Matrix_Translate(-427.0f, -1.0f, 3.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp78[5], "../z_en_zl3.c", 1623); Matrix_Get(&sp38); Matrix_MtxFToYXZRotS(&sp38, &sp30, 0); + if (!FrameAdvance_IsEnabled(play)) { func_80B53980(this, sp30.y, 18); func_80B54360(this, sp30.x, 19); func_80B53B64(this, sp30.z, 20); } + Matrix_RotateZYX(unk_28C[18] + kREG(49), unk_28C[19] + kREG(50), unk_28C[20] + kREG(51), MTXMODE_APPLY); Matrix_Translate(-446.0f, -52.0f, -84.0f, MTXMODE_APPLY); MATRIX_TO_MTX(&sp78[6], "../z_en_zl3.c", 1642); @@ -687,16 +716,16 @@ s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s void EnZl3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnZl3* this = (EnZl3*)thisx; s32 pad; - Vec3f sp34; - s32 pad2; - Vec3f sp24; - Vec3f sp18; if (limbIndex == 13) { - sp34 = D_80B5A46C; + Vec3f sp34 = D_80B5A46C; + s32 pad2; + Matrix_MultVec3f(&sp34, &this->unk_31C); } else if (limbIndex == 14) { - sp24 = D_80B5A478; + Vec3f sp24 = D_80B5A478; + Vec3f sp18; + Matrix_MultVec3f(&sp24, &sp18); this->actor.focus.pos.x = sp18.x; this->actor.focus.pos.y = sp18.y; @@ -796,6 +825,8 @@ void func_80B55054(EnZl3* this) { f32* temp_v0 = &this->unk_2EC; if (*temp_v0 < 19.0f) { + s32 pad; + ((DoorWarp1*)child)->crystalAlpha = (20.0f - *temp_v0) * 12.75f; *temp_v0 += 1.0f; } else { @@ -1777,8 +1808,12 @@ void func_80B5764C(EnZl3* this, PlayState* play) { } s32 func_80B576C8(EnZl3* this, PlayState* play) { - if (func_80B575F0(this, play) && (this->unk_3D8 == 0)) { - return 1; + if (func_80B575F0(this, play)) { + s32 pad; + + if (this->unk_3D8 == 0) { + return 1; + } } return 0; } @@ -1986,6 +2021,8 @@ s32 func_80B57D80(EnZl3* this, PlayState* play) { void func_80B57EAC(EnZl3* this, PlayState* play) { if (func_80B57324(this, play)) { + s32 pad; + this->action = 26; } else { func_80B57350(this, play); @@ -2028,6 +2065,8 @@ void func_80B58014(EnZl3* this, PlayState* play) { this->action = 29; func_80B538B0(this); } else if (func_80B57C8C(this) && func_80B57F84(this, play)) { + s32 pad; + OnePointCutscene_Init(play, 4000, -99, &this->actor, CAM_ID_MAIN); this->unk_3D0 = 0; } else if (func_80B576C8(this, play) && func_80B575B0(this, play) && !Play_InCsMode(play)) { @@ -2129,7 +2168,7 @@ void func_80B584B4(EnZl3* this, PlayState* play) { } void func_80B58624(EnZl3* this, PlayState* play) { - s32 pad[4]; + s32 pad[3]; f32* unk_3CC = &this->unk_3CC; if (*unk_3CC == (kREG(18) + 10.0f)) { @@ -2137,6 +2176,8 @@ void func_80B58624(EnZl3* this, PlayState* play) { func_80B54E14(this, &gZelda2Anime2Anim_008050, 0, -12.0f, 0); func_80B5772C(this, play); } else if (*unk_3CC == kREG(19) + 20.0f) { + s32 pad2; + *unk_3CC += 1.0f; this->actor.textId = 0x71AC; Message_StartTextbox(play, this->actor.textId, NULL); @@ -2508,9 +2549,9 @@ s32 func_80B59768(EnZl3* this, PlayState* play) { } void func_80B59828(EnZl3* this, PlayState* play) { - if (func_80B59698(this, play) || (!func_80B56EE4(this, play) && func_80B57890(this, play))) { - s16 newRotY; + s16 newRotY; + if (func_80B59698(this, play) || (!func_80B56EE4(this, play) && func_80B57890(this, play))) { func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, 0.0f, 0); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; func_80B56F10(this, play); @@ -2616,10 +2657,12 @@ void func_80B59DB8(EnZl3* this, PlayState* play) { s32 objectSlot = Object_GetSlot(objectCtx, OBJECT_ZL2_ANIME2); s32 pad2; +#if IS_DEBUG if (objectSlot < 0) { PRINTF(VT_FGCOL(RED) "En_Zl3_main_bankアニメーションã®ãƒãƒ³ã‚¯ã‚’読ã‚ãªã„!!!!!!!!!!!!\n" VT_RST); return; } +#endif if (Object_IsLoaded(objectCtx, objectSlot)) { this->zl2Anime2ObjectSlot = objectSlot; diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 95ba59deb..00fdde50a 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -83,8 +83,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 10, 44, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index b80f97ad0..e71af51b6 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -290,8 +290,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 26, 64, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c index 7a5502c4b..37771a389 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c @@ -32,7 +32,7 @@ typedef enum { } EnfHGIntroState; void EnfHG_Init(Actor* thisx, PlayState* play2); -void EnfHG_Destroy(Actor* thisx, PlayState* play); +void EnfHG_Destroy(Actor* thisx, PlayState* play2); void EnfHG_Update(Actor* thisx, PlayState* play); void EnfHG_Draw(Actor* thisx, PlayState* play); @@ -89,8 +89,8 @@ void EnfHG_Init(Actor* thisx, PlayState* play2) { } } -void EnfHG_Destroy(Actor* thisx, PlayState* play) { - s32 pad; +void EnfHG_Destroy(Actor* thisx, PlayState* play2) { + PlayState* play = (PlayState*)play2; EnfHG* this = (EnfHG*)thisx; PRINTF("F DT1\n"); @@ -651,6 +651,7 @@ void EnfHG_Retreat(EnfHG* this, PlayState* play) { BossGanondrof* bossGnd = (BossGanondrof*)this->actor.parent; s16 paintingIdxReal; s16 paintingIdxFake; + Actor* child; if (this->actor.params != GND_REAL_BOSS) { this->killActor = true; @@ -664,10 +665,11 @@ void EnfHG_Retreat(EnfHG* this, PlayState* play) { do { paintingIdxFake = Rand_ZeroOne() * 5.99f; } while (paintingIdxFake == paintingIdxReal); - PRINTF("ac1 = %x `````````````````````````````````````````````````\n", - Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANONDROF, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, - 0, paintingIdxFake + GND_FAKE_BOSS)); + + child = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANONDROF, + this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, + 0, paintingIdxFake + GND_FAKE_BOSS); + PRINTF("ac1 = %x `````````````````````````````````````````````````\n", child); } } } diff --git a/src/overlays/actors/ovl_End_Title/z_end_title.c b/src/overlays/actors/ovl_End_Title/z_end_title.c index f3c2d3a94..9c71f7e81 100644 --- a/src/overlays/actors/ovl_End_Title/z_end_title.c +++ b/src/overlays/actors/ovl_End_Title/z_end_title.c @@ -28,12 +28,35 @@ ActorInit End_Title_InitVars = { #include "assets/overlays/ovl_End_Title/ovl_End_Title.c" +static Gfx sWidePresentedByNintendoDL[] = { +#if ENABLE_WIDESCREEN + gsDPPipeSync(), + gsDPSetTextureLUT(G_TT_NONE), + gsDPSetRenderMode(G_RM_PASS, G_RM_XLU_SURF2), + gsSPClearGeometryMode(G_CULL_BACK | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR), + gsDPSetCombineLERP(PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0, + COMBINED), + gsDPSetEnvColor(200, 230, 225, 255), + gsDPLoadTextureTile(sNintendoLeftTex, G_IM_FMT_IA, G_IM_SIZ_8b, 64, 0, 0, 0, 63, 47, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD), + gsSPTextureRectangle(0x0184 + 20 + 30, 0x0168, 0x0280 - 0x40 + 19 + 30, 0x0224, G_TX_RENDERTILE, 0, 0, + (1 << 10) / WIDE_GET_RATIO, 0x0400), + gsDPLoadTextureTile(sNintendoRightTex, G_IM_FMT_IA, G_IM_SIZ_8b, 64, 0, 0, 0, 63, 47, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD), + gsSPTextureRectangle(0x0280 - 0x40 + 19 + 30, 0x0168, 0x037C - 76, 0x0224, G_TX_RENDERTILE, 0, 0, + (1 << 10) / WIDE_GET_RATIO, 0x0400), + gsDPLoadTextureTile(sPresentedByTex, G_IM_FMT_IA, G_IM_SIZ_8b, 96, 0, 0, 0, 95, 15, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD), + gsSPTextureRectangle(0x01C4 + 30, 0x0140, 0x0340, 0x017C, G_TX_RENDERTILE, 0, 0, (1 << 10) / WIDE_GET_RATIO, + 0x0400), + gsSPEndDisplayList(), +#endif +}; + void EndTitle_Init(Actor* thisx, PlayState* play) { EndTitle* this = (EndTitle*)thisx; - this->endAlpha = 0; - this->tlozAlpha = 0; - this->ootAlpha = 0; + this->endAlpha = this->tlozAlpha = this->ootAlpha = 0; if (this->actor.params == 1) { this->actor.draw = EndTitle_DrawNintendoLogo; } @@ -124,7 +147,7 @@ void EndTitle_DrawNintendoLogo(Actor* thisx, PlayState* play) { OVERLAY_DISP = Gfx_SetupDL_64(OVERLAY_DISP); gDPSetPrimColor(OVERLAY_DISP++, 0, 0x80, 0, 0, 0, this->endAlpha); - gSPDisplayList(OVERLAY_DISP++, sPresentedByNintendoDL); + gSPDisplayList(OVERLAY_DISP++, (USE_WIDESCREEN ? sWidePresentedByNintendoDL : sPresentedByNintendoDL)); CLOSE_DISPS(play->state.gfxCtx, "../z_end_title.c", 600); } diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 210786956..96d041bae 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -14,6 +14,12 @@ #define WATER_SURFACE_Y(play) play->colCtx.colHeader->waterBoxes->ySurface +#if IS_DEBUG +#define KREG_DEBUG(i) KREG(i) +#else +#define KREG_DEBUG(i) 0 +#endif + void Fishing_Init(Actor* thisx, PlayState* play2); void Fishing_Destroy(Actor* thisx, PlayState* play2); void Fishing_UpdateFish(Actor* thisx, PlayState* play2); @@ -194,8 +200,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -205,8 +211,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -216,8 +222,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -227,8 +233,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -238,8 +244,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -249,8 +255,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -260,8 +266,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -271,8 +277,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -282,8 +288,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -293,8 +299,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -304,8 +310,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -315,8 +321,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[12] = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x00, 0x10 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 30 }, 100 }, @@ -830,13 +836,19 @@ void Fishing_Init(Actor* thisx, PlayState* play2) { Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); +#if IS_DEBUG if (KREG(5) != 0) { sLinkAge = LINK_AGE_CHILD; } else { sLinkAge = gSaveContext.save.linkAge; } +#else + sLinkAge = gSaveContext.save.linkAge; +#endif if (thisx->params < EN_FISH_PARAM) { + FishingGroupFish* fish; + sReelLock = 0; sFishingMain = this; Collider_InitJntSph(play, &sFishingMain->collider); @@ -902,13 +914,20 @@ void Fishing_Init(Actor* thisx, PlayState* play2) { sFishingFoggy = 0; } - if (((sFishGameNumber & 7) == 6) || (KREG(3) != 0)) { +#if IS_DEBUG + if (((sFishGameNumber & 7) == 6) || (KREG(3) != 0)) +#else + if ((sFishGameNumber & 7) == 6) +#endif + { sStormChanceTimer = 100; +#if IS_DEBUG if (KREG(3) != 0) { KREG(3) = 0; HIGH_SCORE(HS_FISHING) &= ~(HS_FISH_PLAYED * 255); HIGH_SCORE(HS_FISHING) |= (HS_FISH_PLAYED * 6); } +#endif } else { sStormChanceTimer = 0; } @@ -926,7 +945,7 @@ void Fishing_Init(Actor* thisx, PlayState* play2) { sFishGroupAngle3 = 4.6f; for (i = 0; i < GROUP_FISH_COUNT; i++) { - FishingGroupFish* fish = &sGroupFishes[i]; + fish = &sGroupFishes[i]; fish->type = FS_GROUP_FISH_NORMAL; @@ -961,7 +980,12 @@ void Fishing_Init(Actor* thisx, PlayState* play2) { ENKANBAN_FISHING); Actor_Spawn(&play->actorCtx, play, ACTOR_FISHING, 0.0f, 0.0f, 0.0f, 0, 0, 0, 200); - if ((KREG(1) == 1) || ((sFishGameNumber & 3) == 3)) { +#if IS_DEBUG + if ((KREG(1) == 1) || ((sFishGameNumber & 3) == 3)) +#else + if ((sFishGameNumber & 3) == 3) +#endif + { if (sLinkAge != LINK_AGE_CHILD) { fishCount = 16; } else { @@ -975,46 +999,50 @@ void Fishing_Init(Actor* thisx, PlayState* play2) { Actor_Spawn(&play->actorCtx, play, ACTOR_FISHING, sFishInits[i].pos.x, sFishInits[i].pos.y, sFishInits[i].pos.z, 0, Rand_ZeroFloat(0x10000), 0, 100 + i); } + + return; + } + + if ((thisx->params < (EN_FISH_PARAM + 15)) || (thisx->params == EN_FISH_AQUARIUM)) { + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, NULL, NULL, 0); + Animation_MorphToLoop(&this->skelAnime, &gFishingFishAnim, 0.0f); } else { - if ((thisx->params < (EN_FISH_PARAM + 15)) || (thisx->params == EN_FISH_AQUARIUM)) { - SkelAnime_InitFlex(play, &this->skelAnime, &gFishingFishSkel, &gFishingFishAnim, NULL, NULL, 0); - Animation_MorphToLoop(&this->skelAnime, &gFishingFishAnim, 0.0f); - } else { - SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, NULL, NULL, 0); - Animation_MorphToLoop(&this->skelAnime, &gFishingLoachAnim, 0.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, NULL, NULL, 0); + Animation_MorphToLoop(&this->skelAnime, &gFishingLoachAnim, 0.0f); + } + + SkelAnime_Update(&this->skelAnime); + + if (thisx->params == EN_FISH_AQUARIUM) { + this->fishState = 100; + Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP); + thisx->targetMode = 0; + thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; + this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); + } else { + this->fishState = 10; + this->fishStateNext = 10; + + this->isLoach = sFishInits[thisx->params - EN_FISH_PARAM].isLoach; + this->perception = sFishInits[thisx->params - EN_FISH_PARAM].perception; + this->fishLength = sFishInits[thisx->params - EN_FISH_PARAM].baseLength; + + this->fishLength += Rand_ZeroFloat(4.99999f); + + // small chance to make big fish even bigger. + if ((this->fishLength >= 65.0f) && (Rand_ZeroOne() < 0.05f)) { + this->fishLength += Rand_ZeroFloat(7.99999f); } - SkelAnime_Update(&this->skelAnime); +#if IS_DEBUG + if (KREG(6) != 0) { + this->fishLength = KREG(6) + 80.0f; + } +#endif - if (thisx->params == EN_FISH_AQUARIUM) { - this->fishState = 100; - Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP); - thisx->targetMode = 0; - thisx->flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; - this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); - } else { - this->fishState = 10; - this->fishStateNext = 10; - - this->isLoach = sFishInits[thisx->params - EN_FISH_PARAM].isLoach; - this->perception = sFishInits[thisx->params - EN_FISH_PARAM].perception; - this->fishLength = sFishInits[thisx->params - EN_FISH_PARAM].baseLength; - - this->fishLength += Rand_ZeroFloat(4.99999f); - - // small chance to make big fish even bigger. - if ((this->fishLength >= 65.0f) && (Rand_ZeroOne() < 0.05f)) { - this->fishLength += Rand_ZeroFloat(7.99999f); - } - - if (KREG(6) != 0) { - this->fishLength = KREG(6) + 80.0f; - } - - // "Come back when you get older! The fish will be bigger, too!" - if (sLinkAge == LINK_AGE_CHILD) { - this->fishLength *= 0.73f; - } + // "Come back when you get older! The fish will be bigger, too!" + if (sLinkAge == LINK_AGE_CHILD) { + this->fishLength *= 0.73f; } } } @@ -1433,7 +1461,7 @@ void Fishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* rot, f32 temp_f20; Vec3f posSrc = { 0.0f, 0.0f, 0.0f }; Vec3f posStep; - f32 lineLength; + f32 phi_f12; Vec3f tempPos; Vec3f segPos; f32 sp94; @@ -1441,8 +1469,6 @@ void Fishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* rot, f32 sp8C; f32 sqDistXZ; f32 temp_f18; - f32 phi_f12; - f32 phi_f2; if (D_80B7A6A4 != 0) { tempPos = *basePos; @@ -1452,12 +1478,12 @@ void Fishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* rot, sp90 = segPos.y - tempPos.y; sp8C = segPos.z - tempPos.z; - lineLength = sqrtf(SQ(sp94) + SQ(sp90) + SQ(sp8C)) * 0.97f; - if (lineLength > 1000.0f) { - lineLength = 1000.0f; + temp_f20 = sqrtf(SQ(sp94) + SQ(sp90) + SQ(sp8C)) * 0.97f; + if (temp_f20 > 1000.0f) { + temp_f20 = 1000.0f; } - sRodLineSpooled = 200.0f - (lineLength * 200.0f * 0.001f); + sRodLineSpooled = 200.0f - (temp_f20 * 200.0f * 0.001f); } spooled = sRodLineSpooled; @@ -1489,10 +1515,13 @@ void Fishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* rot, } if (sLureEquipped == FS_LURE_SINKING) { + s32 pad; + if (spD8 < phi_f12) { phi_f12 = ((sqrtf(sqDistXZ) - 920.0f) * 0.147f) + WATER_SURFACE_Y(play); if (spD8 > phi_f12) { - phi_f2 = (spD8 - phi_f12) * 0.05f; + f32 phi_f2 = (spD8 - phi_f12) * 0.05f; + if (phi_f2 > 0.29999998f) { phi_f2 = 0.29999998f; } @@ -1506,7 +1535,8 @@ void Fishing_UpdateLine(PlayState* play, Vec3f* basePos, Vec3f* pos, Vec3f* rot, } } else if (i > LINE_SEG_COUNT - 10) { if (spD8 > phi_f12) { - phi_f2 = (spD8 - phi_f12) * 0.2f; + f32 phi_f2 = (spD8 - phi_f12) * 0.2f; + if (phi_f2 > temp_f18) { phi_f2 = temp_f18; } @@ -1690,6 +1720,7 @@ void Fishing_UpdateSinkingLure(PlayState* play) { f32 offsetX; f32 offsetZ; Player* player = GET_PLAYER(play); + Vec3f* pos; posSrc.z = 0.85f; @@ -1712,7 +1743,7 @@ void Fishing_UpdateSinkingLure(PlayState* play) { } for (i = 1; i < SINKING_LURE_SEG_COUNT; i++) { - Vec3f* pos = sSinkingLurePos; + pos = sSinkingLurePos; if ((i < 10) && (sRodCastState == 5)) { offsetX = (10 - i) * sp88.x * 0.1f; @@ -2103,28 +2134,20 @@ static Vec3f sSoundPos = { 0.0f, 0.0f, 0.0f }; void Fishing_UpdateLure(Fishing* this, PlayState* play) { f32 spE4; f32 spE0; - s16 timer; + s16 i; s16 spDC; f32 spD8; f32 spD4; f32 spD0; f32 lengthCasted; f32 lureXZLen; - s16 i; + f32 phi_f0; Player* player = GET_PLAYER(play); Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f spA8; Vec3f sp9C; Vec3f sp90; Input* input = &play->state.input[0]; - Vec3f sp80; - f32 sp7C; - f32 sp78; - f32 phi_f0; - f32 wiggle; - Vec3f sp64; - Vec3f sp58; - s32 pad; sLureTimer++; @@ -2200,6 +2223,7 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { case 0: sSinkingLureSegmentIndex = 0; +#if IS_DEBUG if (KREG(14) != 0) { KREG(14) = 0; sLureEquipped = FS_LURE_SINKING - sLureEquipped; @@ -2207,6 +2231,7 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { sPondOwnerTextIdIndex = 0; } } +#endif Math_ApproachF(&sRodLineSpooled, 195.0f, 1.0f, 1.0f); @@ -2284,9 +2309,10 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { lureXZLen = SQ(sLurePos.x) + SQ(sLurePos.z); if (lureXZLen > SQ(920.0f)) { - if ((KREG(56) != 0) || (sLurePos.y > 160.0f) || (sLurePos.x < 80.0f) || (sLurePos.x > 180.0f) || + if ((KREG_DEBUG(56) != 0) || (sLurePos.y > 160.0f) || (sLurePos.x < 80.0f) || (sLurePos.x > 180.0f) || (sLurePos.z > 1350.0f) || (sLurePos.z < 1100.0f) || (sLurePos.y < 45.0f)) { - sp80 = this->actor.world.pos; + Vec3f sp80 = this->actor.world.pos; + this->actor.prevPos = this->actor.world.pos = sLurePos; Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_6); @@ -2339,8 +2365,9 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { sLurePosDelta.y *= 0.2f; for (i = 0; i < 50; i++) { - sp7C = Rand_ZeroFloat(1.5f) + 0.5f; - sp78 = Rand_ZeroFloat(6.28f); + f32 sp7C = Rand_ZeroFloat(1.5f) + 0.5f; + f32 sp78 = Rand_ZeroFloat(6.28f); + s32 pad; sp9C.x = sinf(sp78) * sp7C; sp9C.z = cosf(sp78) * sp7C; @@ -2415,8 +2442,8 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { lureXZLen = SQ(sLurePos.x) + SQ(sLurePos.z); if (lureXZLen < SQ(920.0f)) { - if (sLurePos.y <= (spE4 + 4.0f)) { - wiggle = 0.0f; + if (sLurePos.y <= spE4 + 4) { + f32 wiggle = 0.0f; if (D_80B7E150 == 0) { if (fabsf(input->rel.stick_x) > 30.0f) { @@ -2457,7 +2484,7 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { sLureWigglePosY = fabsf(wiggle) * 6.0f; sLureRot.x = 0.0f; sLureRotXTarget = 0.5f; - sRodLineSpooled += (fabsf(wiggle) * (7.5f + (KREG(25) * 0.1f))); + sRodLineSpooled += (fabsf(wiggle) * (7.5f + (KREG_DEBUG(25) * 0.1f))); func_800F436C(&sSoundPos, NA_SE_EV_LURE_MOVE_W, (wiggle * 1.999f * 0.25f) + 0.75f); @@ -2517,6 +2544,8 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { Matrix_RotateY(sLureRot.y, MTXMODE_NEW); if (sLureEquipped == FS_LURE_SINKING) { + Vec3f sp64; + Matrix_MultVec3f(&sp90, &sp64); sLureLineSegPosDelta.x = sp64.x; sLureLineSegPosDelta.z = sp64.z; @@ -2538,7 +2567,8 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { } } else if (sReelLinePos[LINE_SEG_COUNT - 1].y < (WATER_SURFACE_Y(play) + phi_f0)) { if (sLureEquipped == FS_LURE_SINKING) { - sp58 = this->actor.world.pos; + Vec3f sp58 = this->actor.world.pos; + this->actor.prevPos = this->actor.world.pos = sLurePos; Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_6); @@ -2611,8 +2641,8 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { } if ((sLurePos.y <= (WATER_SURFACE_Y(play) + 4.0f)) && (sLurePos.y >= (WATER_SURFACE_Y(play) - 4.0f))) { + s16 timer = 63; - timer = 63; if (CHECK_BTN_ALL(input->cur.button, BTN_A) || (sLureWigglePosY > 1.0f)) { timer = 1; } @@ -2633,7 +2663,7 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { if (CHECK_BTN_ALL(input->cur.button, BTN_A)) { if ((SQ(sLurePos.x) + SQ(sLurePos.z)) > SQ(920.0f)) { - sRodLineSpooled += (1.0f + (KREG(65) * 0.1f)); + sRodLineSpooled += (1.0f + (KREG_DEBUG(65) * 0.1f)); } else { sRodLineSpooled += sRodReelingSpeed; } @@ -2897,7 +2927,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { s16 rotXTarget; s16 rotYtarget; s16 rotZScale; - s16 timer; + u8 phi_v0_2; s16 spF6; s16 rotXScale; s16 rotXStep; @@ -2912,13 +2942,9 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { f32 phi_f2; Vec3f bubblePos; Vec3f spB8; - u8 phi_v0_2; f32 temp_f0; f32 temp; - s32 pad; f32 rumbleStrength; - u16 attempts; - u8 rumbleStrength8; this->actor.uncullZoneForward = 700.0f; this->actor.uncullZoneScale = 50.0f; @@ -2978,7 +3004,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { phi_f0 = 1.0f; phi_f2 = 1.0f; if (this->actor.world.pos.y > WATER_SURFACE_Y(play)) { - phi_f0 = (KREG(64) * 0.1f) + 1.5f; + phi_f0 = (KREG_DEBUG(64) * 0.1f) + 1.5f; phi_f2 = 3.0f; } Math_ApproachF(&this->fishLimbRotPhaseMag, this->unk_194 * phi_f0, 1.0f, 500.0f * phi_f2); @@ -3125,11 +3151,13 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { } } +#if IS_DEBUG if (KREG(15) != 0) { KREG(15) = 0; this->fishState = 7; this->timerArray[3] = (s16)Rand_ZeroFloat(150.0f) + 2000; } +#endif break; case 0: @@ -3225,8 +3253,10 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { if (this->unk_1A4 == 0) { this->fishState = 10; this->fishStateNext = 10; - } else if ((KREG(2) != 0) || (((this->unk_1A4 & 0x7FF) == 0) && (this->unk_1A4 < 15000))) { + } else if ((KREG_DEBUG(2) != 0) || (((this->unk_1A4 & 0x7FF) == 0) && (this->unk_1A4 < 15000))) { +#if IS_DEBUG KREG(2) = 0; +#endif this->fishState = -2; this->actor.world.rot.x = this->actor.shape.rot.x = 0; this->fishTargetPos.y = WATER_SURFACE_Y(play) + 10.0f; @@ -3325,7 +3355,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { (this->actor.world.pos.y - this->fishTargetPos.y) * 0.1f); } - Math_ApproachF(&this->rotationStep, 8192.0f, 1.0f, (KREG(16) * 128) + 384.0f); + Math_ApproachF(&this->rotationStep, 8192.0f, 1.0f, (KREG_DEBUG(16) * 128) + 384.0f); if (CHECK_BTN_ALL(input->press.button, BTN_A)) { this->perception += 0.005f; } @@ -3385,8 +3415,14 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { chance *= 5.0f; } +#if IS_DEBUG if (((this->timerArray[0] == 1) || (Rand_ZeroOne() < chance)) && - ((Rand_ZeroOne() < (this->perception * multiplier)) || ((this->isLoach + 1) == KREG(69)))) { + ((Rand_ZeroOne() < (this->perception * multiplier)) || ((this->isLoach + 1) == KREG(69)))) +#else + if (((this->timerArray[0] == 1) || (Rand_ZeroOne() < chance)) && + (Rand_ZeroOne() < (this->perception * multiplier))) +#endif + { if (this->isLoach == 0) { this->fishState = 3; this->unk_190 = 1.2f; @@ -3477,6 +3513,8 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_190 = 1.0f; this->unk_194 = 2000.0f; } else if (distToTarget < 10.0f) { + s16 timer; + if (Fishing_SplashBySize(this, play, false)) { Fishing_FishLeapSfx(this, false); } @@ -3626,6 +3664,8 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { } if (this->actor.world.pos.y < WATER_SURFACE_Y(play)) { + f32 rumbleStrength; + if (this->timerArray[1] > 30) { phi_v0_2 = 7; } else { @@ -3633,6 +3673,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { } if (((this->stateAndTimer & phi_v0_2) == 0) && (Rand_ZeroOne() < 0.75f) && (sRumbleDelay == 0)) { + if (this->fishLength >= 70.0f) { rumbleStrength = 255.0f; } else if (this->fishLength >= 60.0f) { @@ -3654,6 +3695,8 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { if (this->timerArray[1] > 30) { if (this->timerArray[0] == 0) { + u16 attempts; + multiVecSrc.x = 0.0f; multiVecSrc.y = 0.0f; multiVecSrc.z = 200.0f; @@ -3673,6 +3716,8 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { } if ((Rand_ZeroOne() < 0.1f) && (this->timerArray[3] == 0)) { + u8 rumbleStrength8; + if (this->fishLength >= 60.0f) { rumbleStrength8 = 255; } else if (this->fishLength >= 50.0f) { @@ -3800,7 +3845,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { if ((sRodCastState < 3) || ((sReelLock != 0) && (sFishFightTime > 50)) || (sFishFightTime >= 6000) || ((sLureBitTimer == 0) && (sLineHooked == 0)) || (sRodPullback == 0) || (((sLureTimer & 0x7F) == 0) && (Rand_ZeroOne() < 0.05f) && (sLureEquipped != FS_LURE_SINKING) && - (KREG(69) == 0))) { + (KREG_DEBUG(69) == 0))) { sFishingCaughtTextDelay = 20; if ((sLureBitTimer == 0) && (sLineHooked == 0)) { @@ -3830,7 +3875,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { sFishingMusicDelay = 50; sRodReelingSpeed = 0.5f; this->unk_152 = 0; - } else if (this->actor.xzDistToPlayer < (KREG(59) + 50.0f)) { + } else if (this->actor.xzDistToPlayer < (KREG_DEBUG(59) + 50.0f)) { this->fishState = 6; this->timerArray[0] = 100; player->unk_860 = 3; @@ -4507,6 +4552,8 @@ void Fishing_DrawPondProps(PlayState* play) { Matrix_Pop(); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_fishing.c", 7805); } @@ -5051,7 +5098,9 @@ void Fishing_HandleOwnerDialog(Fishing* this, PlayState* play) { break; case 22: +#if IS_DEBUG if (play) {} +#endif if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { this->stateAndTimer = 0; @@ -5109,10 +5158,11 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { f32 target; f32 subCamAtMaxVelFrac; f32 lureDistXZ; - s32 pad; + Camera* mainCam; Player* player = GET_PLAYER(play); Input* input = &play->state.input[0]; +#if IS_DEBUG if (0) { // Strings existing only in rodata PRINTF(VT_FGCOL(GREEN)); @@ -5121,6 +5171,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { PRINTF("ys %x\n"); PRINTF(VT_RST); } +#endif playerShadowAlpha = player->actor.shape.shadowAlpha; @@ -5175,8 +5226,10 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { f32 dy = sOwnerHeadPos.y - sLurePos.y; f32 dz = sOwnerHeadPos.z - sLurePos.z; - if ((sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 25.0f) || (KREG(77) > 0)) { + if ((sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 25.0f) || (KREG_DEBUG(77) > 0)) { +#if IS_DEBUG KREG(77) = 0; +#endif sOwnerHair = FS_OWNER_BALD; sIsOwnersHatHooked = true; Message_StartTextbox(play, 0x4087, NULL); @@ -5190,10 +5243,12 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { HIGH_SCORE(HS_FISHING) &= ~HS_FISH_STOLE_HAT; } +#if IS_DEBUG if (KREG(77) < 0) { KREG(77) = 0; sIsOwnersHatSunk = true; } +#endif if (sFishingCaughtTextDelay != 0) { sFishingCaughtTextDelay--; @@ -5237,7 +5292,10 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); } +#if IS_DEBUG if (KREG(0) != 0) { + s32 pad[3]; + KREG(0) = 0; sLureEquipped = FS_LURE_STOCK; sFishingPlayerCinematicState = 20; @@ -5245,6 +5303,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20); } +#endif if (sFishingCinematicTimer != 0) { sFishingCinematicTimer--; @@ -5255,9 +5314,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { case 0: break; - case 1: { - Camera* mainCam; - + case 1: sSubCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); @@ -5272,7 +5329,6 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_B_MINIMAP); sSubCamVelFactor = 0.0f; FALLTHROUGH; - } case 2: Letterbox_SetSizeTarget(27); @@ -5374,6 +5430,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { mainCam->eye = sSubCamEye; mainCam->eyeNext = sSubCamEye; mainCam->at = sSubCamAt; + } Play_ReturnToMainCam(play, sSubCamId, 0); Cutscene_StopManual(play, &play->csCtx); sFishingPlayerCinematicState = 0; @@ -5383,11 +5440,8 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { player->unk_860 = -5; D_80B7E0B0 = 5; break; - } - - case 10: { // owner tells you to return the rod. - Camera* mainCam; + case 10: // owner tells you to return the rod. Cutscene_StartManual(play, &play->csCtx); sSubCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); @@ -5404,7 +5458,6 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { sFishingPlayerCinematicState = 11; Rumble_Override(0.0f, 150, 10, 10); FALLTHROUGH; - } case 11: player->actor.world.pos.z = 1360.0f; @@ -5428,9 +5481,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { } break; - case 20: { // found the sinking lure - Camera* mainCam; - + case 20: // found the sinking lure Cutscene_StartManual(play, &play->csCtx); sSubCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); @@ -5448,7 +5499,6 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { sCatchCamX = 45.0f; sFishingCinematicTimer = 10; FALLTHROUGH; - } case 21: if ((sFishingCinematicTimer == 0) && Message_ShouldAdvance(play)) { @@ -5596,6 +5646,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { } } +#if IS_DEBUG if (sREG(15) != 0) { if (sStormStrengthTarget != (sREG(15) - 1)) { if (sStormStrengthTarget == 0) { @@ -5616,6 +5667,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { } sREG(14) = 0; +#endif PRINTF(VT_FGCOL(GREEN)); PRINTF("zelda_time %x\n", ((void)0, gSaveContext.save.dayTime)); @@ -5706,10 +5758,12 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { // convert length to weight. Theoretical max of 59 lbs (127^2*.0036+.5) gSaveContext.minigameScore = (SQ((f32)sFishLengthToWeigh) * 0.0036f) + 0.5f; +#if IS_DEBUG if (BREG(26) != 0) { BREG(26) = 0; Message_StartTextbox(play, 0x407B + BREG(27), NULL); } +#endif PRINTF("HI_SCORE = %x\n", HIGH_SCORE(HS_FISHING)); } diff --git a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c index aefb205dd..cf51ce3d2 100644 --- a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c +++ b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c @@ -31,8 +31,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000004, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 15, 15, 0, { 0, 0, 0 } }, @@ -219,6 +219,9 @@ void ItemShield_Draw(Actor* thisx, PlayState* play) { if (!(this->unk_19C & 2)) { OPEN_DISPS(play->state.gfxCtx, "../z_item_shield.c", 457); + if (FIX_ANNOYING_GLITCH) { + gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList); + } Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_item_shield.c", 460), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c index 170e0bafc..2d3053bfc 100644 --- a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -76,8 +76,6 @@ void MagicDark_DiamondUpdate(Actor* thisx, PlayState* play) { s16 nayrusLoveTimer = gSaveContext.nayrusLoveTimer; s32 msgMode = play->msgCtx.msgMode; - if (1) {} - // See `ACTOROVL_ALLOC_ABSOLUTE` //! @bug This condition is too broad, the actor will also be killed by warp songs. But warp songs do not use an //! actor which uses `ACTOROVL_ALLOC_ABSOLUTE`. There is no reason to kill the actor in this case. @@ -90,6 +88,8 @@ void MagicDark_DiamondUpdate(Actor* thisx, PlayState* play) { } if (nayrusLoveTimer >= 1200) { + if (1) {} + player->invincibilityTimer = 0; gSaveContext.nayrusLoveTimer = 0; Actor_Kill(thisx); diff --git a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c index 0e32deee9..e861cc84e 100644 --- a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c +++ b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c @@ -57,8 +57,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00020000, 0x00, 0x01 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_NONE, OCELEM_NONE, }, { 9, 9, 0, { 0, 0, 0 } }, @@ -133,9 +133,9 @@ void MagicFire_Update(Actor* thisx, PlayState* play) { } if (this->action == DF_ACTION_EXPAND_SLOWLY) { - this->collider.elem.toucher.damage = this->actionTimer + 25; + this->collider.elem.atDmgInfo.damage = this->actionTimer + 25; } else if (this->action == DF_ACTION_STOP_EXPANDING) { - this->collider.elem.toucher.damage = this->actionTimer; + this->collider.elem.atDmgInfo.damage = this->actionTimer; } Collider_UpdateCylinder(&this->actor, &this->collider); this->collider.dim.radius = (this->actor.scale.x * 325.0f); diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index 889a9ccaf..8c200e3da 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -57,8 +57,8 @@ static ColliderQuadInit sQuadInit = { ELEMTYPE_UNK0, { 0x00200000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -70,8 +70,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0x00200000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { 0, { { 0, 0, 0 }, 50 }, 100 }, @@ -373,8 +373,6 @@ void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection* f32 spE8[3]; f32 polyNormal[3]; MtxF* shieldMtx; - Vec3f vecA; - Vec3f vecC; shieldMtx = &player->shieldMf; @@ -390,75 +388,80 @@ void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection* vecD.y = spE8[1] + vecB.y; vecD.z = spE8[2] + vecB.z; - vecA.x = vecB.x + (shieldMtx->xx * 300.0f); - vecA.y = vecB.y + (shieldMtx->yx * 300.0f); - vecA.z = vecB.z + (shieldMtx->zx * 300.0f); + { + Vec3f vecA; + Vec3f vecC; - vecC.x = vecD.x + (shieldMtx->xx * 300.0f); - vecC.y = vecD.y + (shieldMtx->yx * 300.0f); - vecC.z = vecD.z + (shieldMtx->zx * 300.0f); + vecA.x = vecB.x + (shieldMtx->xx * 300.0f); + vecA.y = vecB.y + (shieldMtx->yx * 300.0f); + vecA.z = vecB.z + (shieldMtx->zx * 300.0f); - Collider_SetQuadVertices(&this->shieldRay, &vecA, &vecB, &vecC, &vecD); + vecC.x = vecD.x + (shieldMtx->xx * 300.0f); + vecC.y = vecD.y + (shieldMtx->yx * 300.0f); + vecC.z = vecD.z + (shieldMtx->zx * 300.0f); - for (i = 0; i < 6; i++) { - if (reflection[i].reflectionPoly != NULL) { - polyNormal[0] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.x); - polyNormal[1] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.y); - polyNormal[2] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.z); + Collider_SetQuadVertices(&this->shieldRay, &vecA, &vecB, &vecC, &vecD); - if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2], reflection[i].reflectionPoly->dist, - &vecB, &vecD, &sp118, 1)) { + for (i = 0; i < 6; i++) { + if (reflection[i].reflectionPoly != NULL) { + polyNormal[0] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.x); + polyNormal[1] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.y); + polyNormal[2] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.z); - reflection[i].pos.x = sp118.x; - reflection[i].pos.y = sp118.y; - reflection[i].pos.z = sp118.z; + if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2], + reflection[i].reflectionPoly->dist, &vecB, &vecD, &sp118, 1)) { - temp_f0 = sqrtf(SQ(sp118.x - vecB.x) + SQ(sp118.y - vecB.y) + SQ(sp118.z - vecB.z)); + reflection[i].pos.x = sp118.x; + reflection[i].pos.y = sp118.y; + reflection[i].pos.z = sp118.z; - if (temp_f0 < (this->reflectIntensity * 600.0f)) { - reflection[i].opacity = 200; + temp_f0 = sqrtf(SQ(sp118.x - vecB.x) + SQ(sp118.y - vecB.y) + SQ(sp118.z - vecB.z)); + + if (temp_f0 < (this->reflectIntensity * 600.0f)) { + reflection[i].opacity = 200; + } else { + reflection[i].opacity = (s32)(800.0f - temp_f0); + } + + sp10C.x = (shieldMtx->xx * 100.0f) + vecB.x; + sp10C.y = (shieldMtx->yx * 100.0f) + vecB.y; + sp10C.z = (shieldMtx->zx * 100.0f) + vecB.z; + + sp100.x = (spE8[0] * 4.0f) + sp10C.x; + sp100.y = (spE8[1] * 4.0f) + sp10C.y; + sp100.z = (spE8[2] * 4.0f) + sp10C.z; + + reflection[i].mtx.zw = 0.0f; + + reflection[i].mtx.xx = reflection[i].mtx.yy = reflection[i].mtx.zz = reflection[i].mtx.ww = 1.0f; + reflection[i].mtx.yx = reflection[i].mtx.zx = reflection[i].mtx.wx = reflection[i].mtx.xy = + reflection[i].mtx.zy = reflection[i].mtx.wy = reflection[i].mtx.xz = reflection[i].mtx.yz = + reflection[i].mtx.wz = reflection[i].mtx.xw = reflection[i].mtx.yw = reflection[i].mtx.zw; + + if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2], + reflection[i].reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) { + reflection[i].mtx.xx = intersection.x - sp118.x; + reflection[i].mtx.yx = intersection.y - sp118.y; + reflection[i].mtx.zx = intersection.z - sp118.z; + } + + sp10C.x = (shieldMtx->xy * 100.0f) + vecB.x; + sp10C.y = (shieldMtx->yy * 100.0f) + vecB.y; + sp10C.z = (shieldMtx->zy * 100.0f) + vecB.z; + + sp100.x = (spE8[0] * 4.0f) + sp10C.x; + sp100.y = (spE8[1] * 4.0f) + sp10C.y; + sp100.z = (spE8[2] * 4.0f) + sp10C.z; + + if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2], + reflection[i].reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) { + reflection[i].mtx.xy = intersection.x - sp118.x; + reflection[i].mtx.yy = intersection.y - sp118.y; + reflection[i].mtx.zy = intersection.z - sp118.z; + } } else { - reflection[i].opacity = (s32)(800.0f - temp_f0); + reflection[i].reflectionPoly = NULL; } - - sp10C.x = (shieldMtx->xx * 100.0f) + vecB.x; - sp10C.y = (shieldMtx->yx * 100.0f) + vecB.y; - sp10C.z = (shieldMtx->zx * 100.0f) + vecB.z; - - sp100.x = (spE8[0] * 4.0f) + sp10C.x; - sp100.y = (spE8[1] * 4.0f) + sp10C.y; - sp100.z = (spE8[2] * 4.0f) + sp10C.z; - - reflection[i].mtx.zw = 0.0f; - - reflection[i].mtx.xx = reflection[i].mtx.yy = reflection[i].mtx.zz = reflection[i].mtx.ww = 1.0f; - reflection[i].mtx.yx = reflection[i].mtx.zx = reflection[i].mtx.wx = reflection[i].mtx.xy = - reflection[i].mtx.zy = reflection[i].mtx.wy = reflection[i].mtx.xz = reflection[i].mtx.yz = - reflection[i].mtx.wz = reflection[i].mtx.xw = reflection[i].mtx.yw = reflection[i].mtx.zw; - - if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2], - reflection[i].reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) { - reflection[i].mtx.xx = intersection.x - sp118.x; - reflection[i].mtx.yx = intersection.y - sp118.y; - reflection[i].mtx.zx = intersection.z - sp118.z; - } - - sp10C.x = (shieldMtx->xy * 100.0f) + vecB.x; - sp10C.y = (shieldMtx->yy * 100.0f) + vecB.y; - sp10C.z = (shieldMtx->zy * 100.0f) + vecB.z; - - sp100.x = (spE8[0] * 4.0f) + sp10C.x; - sp100.y = (spE8[1] * 4.0f) + sp10C.y; - sp100.z = (spE8[2] * 4.0f) + sp10C.z; - - if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2], - reflection[i].reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) { - reflection[i].mtx.xy = intersection.x - sp118.x; - reflection[i].mtx.yy = intersection.y - sp118.y; - reflection[i].mtx.zy = intersection.z - sp118.z; - } - } else { - reflection[i].reflectionPoly = NULL; } } } 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 fb7db74af..b99e05c11 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -97,8 +97,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 64, 30, -31, { 0, 0, 0 } }, @@ -135,19 +135,20 @@ void ObjBean_InitCollider(Actor* thisx, PlayState* play) { void ObjBean_InitDynaPoly(ObjBean* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; - CollisionHeader* colHeader; - s32 pad2; - - colHeader = NULL; + CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_bean.c", 374, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void ObjBean_FindFloor(ObjBean* this, PlayState* play) { @@ -240,14 +241,8 @@ void ObjBean_FollowPath(ObjBean* this, PlayState* play) { Path* path; Vec3f acell; Vec3f pathPointsFloat; - f32 speed; - Vec3s* nextPathPoint; - Vec3s* currentPoint; - Vec3s* sp4C; - Vec3f sp40; - Vec3f sp34; - f32 sp30; f32 mag; + Vec3s* nextPathPoint; Math_StepToF(&this->dyna.actor.speed, sBeanSpeeds[this->unk_1F6].velocity, sBeanSpeeds[this->unk_1F6].accel); path = &play->pathList[(this->dyna.actor.params >> 8) & 0x1F]; @@ -257,8 +252,13 @@ void ObjBean_FollowPath(ObjBean* this, PlayState* play) { Math_Vec3f_Diff(&pathPointsFloat, &this->pathPoints, &acell); mag = Math3D_Vec3fMagnitude(&acell); - speed = CLAMP_MIN(this->dyna.actor.speed, 0.5f); - if (speed > mag) { + if (CLAMP_MIN(this->dyna.actor.speed, 0.5f) > mag) { + Vec3s* currentPoint; + Vec3s* sp4C; + Vec3f sp40; + Vec3f sp34; + f32 sp30; + currentPoint = &((Vec3s*)SEGMENTED_TO_VIRTUAL(path->points))[this->currentPointIndex]; Math_Vec3f_Copy(&this->pathPoints, &pathPointsFloat); @@ -469,7 +469,7 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); if (LINK_AGE_IN_YEARS == YEARS_ADULT) { - if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || (mREG(1) == 1)) { + if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) || (IS_DEBUG && mREG(1) == 1)) { path = (this->dyna.actor.params >> 8) & 0x1F; if (path == 0x1F) { PRINTF(VT_COL(RED, WHITE)); @@ -504,7 +504,7 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->dyna.actor); return; } - } else if ((Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) != 0) || (mREG(1) == 1)) { + } else if ((Flags_GetSwitch(play, this->dyna.actor.params & 0x3F) != 0) || (IS_DEBUG && mREG(1) == 1)) { ObjBean_SetupWaitForWater(this); } else { ObjBean_SetupWaitForBean(this); diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index 8428f3467..dc7cd70d9 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -43,8 +43,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x4FC1FFFE, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 55, 70, 0, { 0 } }, @@ -125,7 +125,7 @@ void ObjBombiwa_Update(Actor* thisx, PlayState* play) { s32 pad; if ((func_80033684(play, &this->actor) != NULL) || - ((this->collider.base.acFlags & AC_HIT) && (this->collider.elem.acHitElem->toucher.dmgFlags & DMG_HAMMER))) { + ((this->collider.base.acFlags & AC_HIT) && (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HAMMER))) { ObjBombiwa_Break(this, play); Flags_SetSwitch(play, this->actor.params & 0x3F); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EV_WALL_BROKEN); 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 69b311e48..1c071363c 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -38,8 +38,8 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x4001FFFE, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 15 }, 100 }, @@ -176,7 +176,7 @@ void ObjComb_Wait(ObjComb* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - dmgFlags = this->collider.elements[0].base.acHitElem->toucher.dmgFlags; + dmgFlags = this->collider.elements[0].base.acHitElem->atDmgInfo.dmgFlags; if (dmgFlags & (DMG_HAMMER | DMG_ARROW | DMG_SLINGSHOT | DMG_DEKU_STICK)) { this->unk_1B0 = 1500; } else { diff --git a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c index fa22cfaab..6cea4d407 100644 --- a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c +++ b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c @@ -46,16 +46,19 @@ void ObjElevator_SetupAction(ObjElevator* this, ObjElevatorActionFunc actionFunc void func_80B92B08(ObjElevator* this, PlayState* play, CollisionHeader* collision, s32 flag) { s16 pad1; CollisionHeader* colHeader = NULL; - s16 pad2; - Actor* thisx = &this->dyna.actor; DynaPolyActor_Init(&this->dyna, flag); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { - PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_elevator.c", 136, thisx->id, - thisx->params); + s32 pad2; + + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_elevator.c", 136, + this->dyna.actor.id, this->dyna.actor.params); } +#endif } void ObjElevator_Init(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c index cae5d2733..3eb9e3347 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c @@ -39,8 +39,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x4FC1FFF6, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 50, 70, 0, { 0, 0, 0 } }, @@ -170,7 +170,7 @@ void ObjHamishi_Update(Actor* thisx, PlayState* play) { ObjHamishi_Shake(this); - if ((this->collider.base.acFlags & AC_HIT) && (this->collider.elem.acHitElem->toucher.dmgFlags & DMG_HAMMER)) { + if ((this->collider.base.acFlags & AC_HIT) && (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HAMMER)) { this->collider.base.acFlags &= ~AC_HIT; this->hitCount++; if (this->hitCount < 2) { diff --git a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c index 76ce2203c..6dea87f6b 100644 --- a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c +++ b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c @@ -39,8 +39,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_NONE, + ATELEM_NONE, + ACELEM_NONE, OCELEM_ON, }, { 8, 10, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index edf6b71a6..d1367a4b4 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -55,15 +55,19 @@ void ObjHsblock_SetupAction(ObjHsblock* this, ObjHsblockActionFunc actionFunc) { void func_80B93B68(ObjHsblock* this, PlayState* play, CollisionHeader* collision, s32 moveFlags) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2[2]; DynaPolyActor_Init(&this->dyna, moveFlags); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_hsblock.c", 163, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void func_80B93BF0(ObjHsblock* this, PlayState* play) { @@ -94,9 +98,11 @@ void ObjHsblock_Init(Actor* thisx, PlayState* play) { } } +#if IS_DEBUG mREG(13) = 255; mREG(14) = 255; mREG(15) = 255; +#endif } void ObjHsblock_Destroy(Actor* thisx, PlayState* play) { @@ -158,9 +164,16 @@ void ObjHsblock_Draw(Actor* thisx, PlayState* play) { if (play->sceneId == SCENE_FIRE_TEMPLE) { color = &sFireTempleColor; } else { +#if IS_DEBUG defaultColor.r = mREG(13); defaultColor.g = mREG(14); defaultColor.b = mREG(15); +#else + defaultColor.r = 255; + defaultColor.g = 255; + defaultColor.b = 255; +#endif + color = &defaultColor; } diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 04a3096d5..736ba66f7 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -42,8 +42,8 @@ static ColliderCylinderInit sCylinderInitIce = { ELEMTYPE_UNK0, { 0xFFCFFFFF, 0x02, 0x00 }, { 0x00020800, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NONE, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NONE, + ACELEM_ON, OCELEM_ON, }, { 50, 120, 0, { 0, 0, 0 } }, @@ -62,8 +62,8 @@ static ColliderCylinderInit sCylinderInitHard = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x4E01F7F6, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 50, 120, 0, { 0, 0, 0 } }, @@ -117,7 +117,7 @@ void ObjIcePoly_Idle(ObjIcePoly* this, PlayState* play) { Vec3f pos; if (this->colliderIce.base.acFlags & AC_HIT) { - this->meltTimer = -this->colliderIce.elem.acHitElem->toucher.damage; + this->meltTimer = -this->colliderIce.elem.acHitElem->atDmgInfo.damage; this->actor.focus.rot.y = this->actor.yawTowardsPlayer; OnePointCutscene_Init(play, 5120, 40, &this->actor, CAM_ID_MAIN); this->actionFunc = ObjIcePoly_Melt; diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 9b2fe8884..c7752a489 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -47,8 +47,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000002, 0x00, 0x01 }, { 0x4FC00748, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 12, 27, 0, { 0, 0, 0 } }, diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c index 2954fb171..bfcc4bbf2 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -42,8 +42,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x40000040, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 31, 48, 0, { 0, 0, 0 } }, @@ -125,8 +125,8 @@ void ObjKibako2_Init(Actor* thisx, PlayState* play) { ObjKibako2_InitCollider(thisx, play); CollisionHeader_GetVirtual(&gLargeCrateCol, &colHeader); bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - this->collectibleFlag = this->dyna.actor.home.rot.z & 0x3F; this->dyna.bgId = bgId; + this->collectibleFlag = this->dyna.actor.home.rot.z & 0x3F; this->actionFunc = ObjKibako2_Idle; this->dyna.actor.home.rot.z = this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z = this->dyna.actor.world.rot.x = this->dyna.actor.shape.rot.x = 0; diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index 63f6635a3..0112cc09c 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -64,16 +64,19 @@ void ObjLift_SetupAction(ObjLift* this, ObjLiftActionFunc actionFunc) { void ObjLift_InitDynaPoly(ObjLift* this, PlayState* play, CollisionHeader* collision, s32 flags) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_lift.c", 188, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void ObjLift_SpawnFragments(ObjLift* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index e03527e4c..bb3bb5633 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -53,8 +53,8 @@ static ColliderJntSphElementInit sColliderJntSphElementInit[] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00200000, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 0, { { 0, 0, 0 }, 19 }, 100 }, diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index 4968e8ec6..0ecf75fcd 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -109,9 +109,12 @@ void ObjMure_Init(Actor* thisx, PlayState* play) { this->actionFunc = ObjMure_InitialAction; PRINTF("ç¾¤ã‚Œãªæ•µ (arg_data 0x%04x)(chNum(%d) ptn(%d) svNum(%d) type(%d))\n", thisx->params, this->chNum, this->ptn, this->svNum, this->type); + +#if IS_DEBUG if (ObjMure_GetMaxChildSpawns(this) <= 0) { PRINTF("Warning : 個体数ãŒè¨­å®šã•れã¦ã„ã¾ã›ã‚“(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 268, thisx->params); } +#endif } void ObjMure_Destroy(Actor* thisx, PlayState* play) { @@ -125,48 +128,52 @@ s32 ObjMure_GetMaxChildSpawns(ObjMure* this) { } void ObjMure_GetSpawnPos(Vec3f* outPos, Vec3f* inPos, s32 ptn, s32 idx) { +#if IS_DEBUG if (ptn >= 4) { PRINTF("ãŠã‹ã—ãªã® (%s %d)\n", "../z_obj_mure.c", 307); } +#endif + *outPos = *inPos; } void ObjMure_SpawnActors0(ObjMure* this, PlayState* play) { - ActorContext* ac; + Actor* actor = &this->actor; s32 i; Vec3f pos; s32 pad; s32 maxChildren = ObjMure_GetMaxChildSpawns(this); for (i = 0; i < maxChildren; i++) { +#if IS_DEBUG if (this->children[i] != NULL) { // "Error: I already have a child(%s %d)(arg_data 0x%04x)" - PRINTF("Error : æ—¢ã«å­ä¾›ãŒã„ã‚‹(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 333, this->actor.params); + PRINTF("Error : æ—¢ã«å­ä¾›ãŒã„ã‚‹(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 333, actor->params); } +#endif + switch (this->childrenStates[i]) { case OBJMURE_CHILD_STATE_1: break; case OBJMURE_CHILD_STATE_2: - ac = &play->actorCtx; - ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); + ObjMure_GetSpawnPos(&pos, &actor->world.pos, this->ptn, i); this->children[i] = - Actor_Spawn(ac, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, - this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type]); + Actor_Spawn(&play->actorCtx, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, + actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, sSpawnParams[this->type]); if (this->children[i] != NULL) { this->children[i]->flags |= ACTOR_FLAG_ENKUSA_CUT; - this->children[i]->room = this->actor.room; + this->children[i]->room = actor->room; } else { PRINTF("warning 発生失敗 (%s %d)\n", "../z_obj_mure.c", 359); } break; default: - ac = &play->actorCtx; - ObjMure_GetSpawnPos(&pos, &this->actor.world.pos, this->ptn, i); + ObjMure_GetSpawnPos(&pos, &actor->world.pos, this->ptn, i); this->children[i] = - Actor_Spawn(ac, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, this->actor.world.rot.x, - this->actor.world.rot.y, this->actor.world.rot.z, sSpawnParams[this->type]); + Actor_Spawn(&play->actorCtx, play, sSpawnActorIds[this->type], pos.x, pos.y, pos.z, + actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, sSpawnParams[this->type]); if (this->children[i] != NULL) { - this->children[i]->room = this->actor.room; + this->children[i]->room = actor->room; } else { PRINTF("warning 発生失敗 (%s %d)\n", "../z_obj_mure.c", 382); } @@ -175,21 +182,23 @@ void ObjMure_SpawnActors0(ObjMure* this, PlayState* play) { } } -void ObjMure_SpawnActors1(ObjMure* this, PlayState* play) { - ActorContext* ac = (ActorContext*)play; // fake match +void ObjMure_SpawnActors1(ObjMure* this, PlayState* play2) { + PlayState* play = play2; Actor* actor = &this->actor; Vec3f spawnPos; s32 maxChildren = ObjMure_GetMaxChildSpawns(this); s32 i; for (i = 0; i < maxChildren; i++) { +#if IS_DEBUG if (this->children[i] != NULL) { PRINTF("Error : æ—¢ã«å­ä¾›ãŒã„ã‚‹(%s %d)(arg_data 0x%04x)\n", "../z_obj_mure.c", 407, actor->params); } - ac = &play->actorCtx; +#endif + ObjMure_GetSpawnPos(&spawnPos, &actor->world.pos, this->ptn, i); - this->children[i] = Actor_Spawn(ac, play, sSpawnActorIds[this->type], spawnPos.x, spawnPos.y, spawnPos.z, - actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, + this->children[i] = Actor_Spawn(&play2->actorCtx, play, sSpawnActorIds[this->type], spawnPos.x, spawnPos.y, + spawnPos.z, actor->world.rot.x, actor->world.rot.y, actor->world.rot.z, (this->type == 4 && i == 0) ? 1 : sSpawnParams[this->type]); if (this->children[i] != NULL) { this->childrenStates[i] = OBJMURE_CHILD_STATE_0; diff --git a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c index a2f2ecf3a..a53531460 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c @@ -106,9 +106,10 @@ void func_80B9ABA0(ObjMure3* this, PlayState* play) { void func_80B9ACE4(ObjMure3* this, PlayState* play) { s16 count = sRupeeCounts[(this->actor.params >> 13) & 7]; s32 i; + EnItem00** collectible; for (i = 0; i < count; i++) { - EnItem00** collectible = &this->unk_150[i]; + collectible = &this->unk_150[i]; if (!((this->unk_16C >> i) & 1) && (*collectible != NULL)) { if (Actor_HasParent(&(*collectible)->actor, play) || ((*collectible)->actor.update == NULL)) { diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index b8b6fbcf2..ee18e649d 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -87,17 +87,20 @@ static Vec2f sFaceDirection[] = { void ObjOshihiki_InitDynapoly(ObjOshihiki* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + // "Warning : move BG registration failure" PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_oshihiki.c", 280, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void ObjOshihiki_RotateXZ(Vec3f* out, Vec3f* in, f32 sn, f32 cs) { @@ -242,14 +245,13 @@ void ObjOshihiki_SetTexture(ObjOshihiki* this, PlayState* play) { } } -void ObjOshihiki_SetColor(ObjOshihiki* this, PlayState* play) { - Color_RGB8* src; +void ObjOshihiki_SetColor(ObjOshihiki* this, PlayState* play2) { + PlayState* play = play2; + s16 paramsColorIdx = (this->dyna.actor.params >> 6) & 3; Color_RGB8* color = &this->color; - s16 paramsColorIdx; + Color_RGB8* src; s32 i; - paramsColorIdx = (this->dyna.actor.params >> 6) & 3; - for (i = 0; i < ARRAY_COUNT(sSceneIds); i++) { if (sSceneIds[i] == play->sceneId) { break; @@ -315,14 +317,12 @@ void ObjOshihiki_Destroy(Actor* thisx, PlayState* play) { } void ObjOshihiki_SetFloors(ObjOshihiki* this, PlayState* play) { + s32 pad; + Vec3f colCheckPoint; + Vec3f colCheckOffset; s32 i; for (i = 0; i < 5; i++) { - Vec3f colCheckPoint; - Vec3f colCheckOffset; - CollisionPoly** floorPoly; - s32* floorBgId; - colCheckOffset.x = sColCheckPoints[i].x * (this->dyna.actor.scale.x * 10.0f); colCheckOffset.y = sColCheckPoints[i].y * (this->dyna.actor.scale.y * 10.0f); colCheckOffset.z = sColCheckPoints[i].z * (this->dyna.actor.scale.z * 10.0f); @@ -331,10 +331,8 @@ void ObjOshihiki_SetFloors(ObjOshihiki* this, PlayState* play) { colCheckPoint.y += this->dyna.actor.prevPos.y; colCheckPoint.z += this->dyna.actor.world.pos.z; - floorPoly = &this->floorPolys[i]; - floorBgId = &this->floorBgIds[i]; - this->floorHeights[i] = - BgCheck_EntityRaycastDown6(&play->colCtx, floorPoly, floorBgId, &this->dyna.actor, &colCheckPoint, 0.0f); + this->floorHeights[i] = BgCheck_EntityRaycastDown6(&play->colCtx, &this->floorPolys[i], &this->floorBgIds[i], + &this->dyna.actor, &colCheckPoint, 0.0f); } } @@ -445,9 +443,9 @@ s32 ObjOshihiki_MoveWithBlockUnder(ObjOshihiki* this, PlayState* play) { void ObjOshihiki_SetupOnScene(ObjOshihiki* this, PlayState* play) { this->stateFlags |= PUSHBLOCK_SETUP_ON_SCENE; - this->actionFunc = ObjOshihiki_OnScene; this->dyna.actor.gravity = 0.0f; this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; + this->actionFunc = ObjOshihiki_OnScene; } void ObjOshihiki_OnScene(ObjOshihiki* this, PlayState* play) { @@ -472,9 +470,9 @@ void ObjOshihiki_OnScene(ObjOshihiki* this, PlayState* play) { void ObjOshihiki_SetupOnActor(ObjOshihiki* this, PlayState* play) { this->stateFlags |= PUSHBLOCK_SETUP_ON_ACTOR; - this->actionFunc = ObjOshihiki_OnActor; this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; this->dyna.actor.gravity = -1.0f; + this->actionFunc = ObjOshihiki_OnActor; } void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { @@ -543,10 +541,10 @@ void ObjOshihiki_Push(ObjOshihiki* this, PlayState* play) { f32 pushDistSigned; s32 stopFlag; - this->pushSpeed += 0.5f; + this->pushSpeed += 0.5f * BLOCK_PUSH_SPEED; this->stateFlags |= PUSHBLOCK_PUSH; - this->pushSpeed = CLAMP_MAX(this->pushSpeed, 2.0f); - stopFlag = Math_StepToF(&this->pushDist, 20.0f, this->pushSpeed); + this->pushSpeed = CLAMP_MAX(this->pushSpeed, 2.0f * BLOCK_PUSH_SPEED); + stopFlag = Math_StepToF(&this->pushDist, 20.0f * BLOCK_PUSH_SPEED, this->pushSpeed); pushDistSigned = ((this->direction >= 0.0f) ? 1.0f : -1.0f) * this->pushDist; thisx->world.pos.x = thisx->home.pos.x + (pushDistSigned * this->yawSin); thisx->world.pos.z = thisx->home.pos.z + (pushDistSigned * this->yawCos); @@ -649,6 +647,7 @@ void ObjOshihiki_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_obj_oshihiki.c", 1308), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); +#if IS_DEBUG switch (play->sceneId) { case SCENE_DEKU_TREE: case SCENE_DODONGOS_CAVERN: @@ -664,6 +663,9 @@ void ObjOshihiki_Draw(Actor* thisx, PlayState* play) { gDPSetEnvColor(POLY_OPA_DISP++, mREG(13), mREG(14), mREG(15), 255); break; } +#else + gDPSetEnvColor(POLY_OPA_DISP++, this->color.r, this->color.g, this->color.b, 255); +#endif gSPDisplayList(POLY_OPA_DISP++, gPushBlockDL); CLOSE_DISPS(play->state.gfxCtx, "../z_obj_oshihiki.c", 1334); diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 089c78164..e36277c19 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -76,8 +76,8 @@ static ColliderTrisElementInit sRustyFloorTrisElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x40000040, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { -20.0f, 19.0f, -20.0f }, { -20.0f, 19.0f, 20.0f }, { 20.0f, 19.0f, 20.0f } } }, @@ -87,8 +87,8 @@ static ColliderTrisElementInit sRustyFloorTrisElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x40000040, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 20.0f, 19.0f, 20.0f }, { 20.0f, 19.0f, -20.0f }, { -20.0f, 19.0f, -20.0f } } }, @@ -114,8 +114,8 @@ static ColliderTrisElementInit sEyeTrisElementsInit[2] = { ELEMTYPE_UNK4, { 0x00000000, 0x00, 0x00 }, { 0x0001F824, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 23.0f, 8.5f }, { -23.0f, 0.0f, 8.5f }, { 0.0f, -23.0f, 8.5f } } }, @@ -125,8 +125,8 @@ static ColliderTrisElementInit sEyeTrisElementsInit[2] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x0001F824, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 23.0f, 8.5f }, { 0.0f, -23.0f, 8.5f }, { 23.0f, 0.0f, 8.5f } } }, @@ -152,8 +152,8 @@ static ColliderJntSphElementInit sCrystalJntSphElementInit[1] = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xEFC1FFFE, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 0, { { 0, 300, 0 }, 20 }, 100 }, @@ -192,17 +192,20 @@ void ObjSwitch_RotateY(Vec3f* dest, Vec3f* src, s16 rotY) { void ObjSwitch_InitDynaPoly(ObjSwitch* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) { s32 pad; CollisionHeader* colHeader = NULL; - s32 pad2; DynaPolyActor_Init(&this->dyna, moveFlag); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); +#if IS_DEBUG if (this->dyna.bgId == BG_ACTOR_MAX) { + s32 pad2; + // "Warning : move BG registration failure" PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_switch.c", 531, this->dyna.actor.id, this->dyna.actor.params); } +#endif } void ObjSwitch_InitJntSphCollider(ObjSwitch* this, PlayState* play, ColliderJntSphInit* colliderJntSphInit) { diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 9e1c15429..7ea6b73d3 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -41,8 +41,8 @@ static ColliderCylinderInit sCylInitStand = { ELEMTYPE_UNK2, { 0x00100000, 0x00, 0x00 }, { 0xEE01FFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON | BUMP_HOOKABLE, + ATELEM_NONE, + ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, { 12, 45, 0, { 0, 0, 0 } }, @@ -61,8 +61,8 @@ static ColliderCylinderInit sCylInitFlame = { ELEMTYPE_UNK2, { 0x00000000, 0x00, 0x00 }, { 0x00020820, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_NONE, }, { 15, 45, 45, { 0, 0, 0 } }, @@ -171,7 +171,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { } } if (this->colliderFlame.base.acFlags & AC_HIT) { - dmgFlags = this->colliderFlame.elem.acHitElem->toucher.dmgFlags; + dmgFlags = this->colliderFlame.elem.acHitElem->atDmgInfo.dmgFlags; if (dmgFlags & (DMG_FIRE | DMG_ARROW_NORMAL)) { interactionType = 1; } @@ -197,7 +197,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { arrow = (EnArrow*)this->colliderFlame.base.ac; if ((arrow->actor.update != NULL) && (arrow->actor.id == ACTOR_EN_ARROW)) { arrow->actor.params = 0; - arrow->collider.elem.toucher.dmgFlags = DMG_ARROW_FIRE; + arrow->collider.elem.atDmgInfo.dmgFlags = DMG_ARROW_FIRE; } } if ((0 <= this->litTimer) && (this->litTimer < (50 * litTimeScale + 100)) && (torchType != 0)) { @@ -283,6 +283,8 @@ void ObjSyokudai_Draw(Actor* thisx, PlayState* play) { } flameScale *= 0.0027f; + if (1) {} + Gfx_SetupDL_25Xlu(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index 0096e6731..e089a1148 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -67,8 +67,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000002, 0x00, 0x01 }, { 0x4FC1FFFE, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_ON, }, { 9, 26, 0, { 0, 0, 0 } }, @@ -246,7 +246,7 @@ void ObjTsubo_Idle(ObjTsubo* this, PlayState* play) { ObjTsubo_SpawnCollectible(this, play); Actor_Kill(&this->actor); } else if ((this->collider.base.acFlags & AC_HIT) && - (this->collider.elem.acHitElem->toucher.dmgFlags & + (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_SWORD | DMG_RANGED | DMG_HAMMER | DMG_BOOMERANG | DMG_EXPLOSIVE))) { ObjTsubo_AirBreak(this, play); ObjTsubo_SpawnCollectible(this, play); diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index 76d6eff60..73919d7d3 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -74,39 +74,37 @@ void ObjWarp2block_Spawn(ObjWarp2block* this, PlayState* play) { } s32 func_80BA1ECC(ObjWarp2block* this, PlayState* play) { - s32 pad; - Actor* temp_a3; - Player* player; - Vec3f sp20; - f32 temp_f2; - if (DynaPolyActor_IsPlayerAbove(&this->dyna)) { return 0; - } - - temp_a3 = this->dyna.actor.child; - player = GET_PLAYER(play); - if ((this->dyna.actor.xzDistToPlayer <= sDistances[(((this->dyna.actor.params >> 0xB) & 7))]) || - (temp_a3->xzDistToPlayer <= sDistances[(((temp_a3->params >> 0xB) & 7))])) { - - func_8002DBD0(&this->dyna.actor, &sp20, &player->actor.world.pos); - temp_f2 = (this->dyna.actor.scale.x * 50.0f) + 6.0f; - - if (!(temp_f2 < fabsf(sp20.x)) && !(temp_f2 < fabsf(sp20.z))) { - return 0; - } - - func_8002DBD0(temp_a3, &sp20, &player->actor.world.pos); - temp_f2 = (temp_a3->scale.x * 50.0f) + 6.0f; - - if (!(temp_f2 < fabsf(sp20.x)) && !(temp_f2 < fabsf(sp20.z))) { - return 0; - } } else { - return 0; - } + s32 pad; + Actor* temp_a3 = this->dyna.actor.child; + Player* player = GET_PLAYER(play); + Vec3f sp20; + f32 temp_f2; - return 1; + if ((this->dyna.actor.xzDistToPlayer <= sDistances[(((this->dyna.actor.params >> 0xB) & 7))]) || + (temp_a3->xzDistToPlayer <= sDistances[(((temp_a3->params >> 0xB) & 7))])) { + + func_8002DBD0(&this->dyna.actor, &sp20, &player->actor.world.pos); + temp_f2 = (this->dyna.actor.scale.x * 50.0f) + 6.0f; + + if (!(temp_f2 < fabsf(sp20.x)) && !(temp_f2 < fabsf(sp20.z))) { + return 0; + } + + func_8002DBD0(temp_a3, &sp20, &player->actor.world.pos); + temp_f2 = (temp_a3->scale.x * 50.0f) + 6.0f; + + if (!(temp_f2 < fabsf(sp20.x)) && !(temp_f2 < fabsf(sp20.z))) { + return 0; + } + } else { + return 0; + } + + return 1; + } } void ObjWarp2block_SwapWithChild(ObjWarp2block* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 64ee2c89d..5ce4d3b6b 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -860,6 +860,8 @@ void ObjectKankyo_DrawSunGraveSpark(Actor* thisx, PlayState* play2) { (u8)(255 * this->effects[0].amplitude), 255 - (u8)(255 * this->effects[0].amplitude), this->effects[0].alpha); + if (1) {} + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_object_kankyo.c", 1416), G_MTX_LOAD); diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index 27373e2b7..b4a696fec 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -124,5 +124,7 @@ void OceffWipe_Draw(Actor* thisx, PlayState* play) { 32, 1, 0 - scroll, scroll * (-2), 32, 32)); gSPDisplayList(POLY_XLU_DISP++, sFrustumDL); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_oceff_wipe.c", 398); } diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 6bb83051e..a6afa9baa 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -52,8 +52,8 @@ static ColliderCylinderInit sCylinderInit = { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000020, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 30, 60, 0, { 0, 0, 0 } }, @@ -163,7 +163,6 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play) { Player* player = GET_PLAYER(play); EnItem00* collectible; s32 pad; - Vec3f spawnPos; if (this->collider.base.acFlags & AC_HIT) { Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); @@ -174,6 +173,8 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play) { if (1) {} gSaveContext.cutsceneTrigger = 1; } else { + Vec3f spawnPos; + spawnPos.x = 700.0f; spawnPos.y = -800.0f; spawnPos.z = 7261.0f; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index e50810bab..ce59257e6 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -179,7 +179,6 @@ void func_80846978(PlayState* play, Player* this); void func_808469BC(PlayState* play, Player* this); void func_80846A68(PlayState* play, Player* this); void Player_UpdateCommon(Player* this, PlayState* play, Input* input); -s32 func_8084FCAC(Player* this, PlayState* play); void func_8084FF7C(Player* this); void Player_UpdateBunnyEars(Player* this); void func_80851008(PlayState* play, Player* this, void* anim); @@ -263,6 +262,7 @@ s32 Player_TryCsAction(PlayState* play, Actor* actor, s32 csAction); void func_80853080(Player* this, PlayState* play); s32 Player_InflictDamage(PlayState* play, s32 damage); void func_80853148(PlayState* play, Actor* actor); +u32 Player_GetGIAllocSize(); void Player_Action_80840450(Player* this, PlayState* play); void Player_Action_808407CC(Player* this, PlayState* play); @@ -493,7 +493,7 @@ static PlayerAgeProperties sAgeProperties[] = { }, }; -static u32 D_808535D0 = false; +static u32 sNoclipEnabled = false; static f32 sControlStickMagnitude = 0.0f; static s16 sControlStickAngle = 0; static s16 D_808535DC = 0; @@ -1605,7 +1605,6 @@ static LinkAnimationHeader* D_808543D4[] = { &gPlayerAnim_link_hook_wait, }; -// return type can't be void due to regalloc in func_8084FCAC BAD_RETURN(s32) Player_ZeroSpeedXZ(Player* this) { this->actor.speed = 0.0f; this->speedXZ = 0.0f; @@ -2063,10 +2062,10 @@ LinkAnimationHeader* func_80833338(Player* this) { } s32 func_80833350(Player* this) { - LinkAnimationHeader** entry; - s32 i; - if (func_80833338(this) != this->skelAnime.animation) { + LinkAnimationHeader** entry; + s32 i; + for (i = 0, entry = &D_80853D7C[0][0]; i < 28; i++, entry++) { if (this->skelAnime.animation == *entry) { return i + 1; @@ -2247,9 +2246,9 @@ void Player_InitBoomerangIA(PlayState* play, Player* this) { } void Player_InitItemAction(PlayState* play, Player* this, s8 itemAction) { - this->unk_860 = 0; this->unk_85C = 0.0f; this->unk_858 = 0.0f; + this->unk_860 = 0; this->heldItemAction = this->itemAction = itemAction; this->modelGroup = this->nextModelGroup; @@ -3414,10 +3413,12 @@ void func_808368EC(Player* this, PlayState* play) { s16 previousYaw = this->actor.shape.rot.y; if (!(this->stateFlags2 & (PLAYER_STATE2_5 | PLAYER_STATE2_6))) { - if ((this->unk_664 != NULL) && + Actor* unk_664 = this->unk_664; + + if ((unk_664 != NULL) && ((play->actorCtx.targetCtx.unk_4B != 0) || (this->actor.category != ACTORCAT_PLAYER))) { - Math_ScaledStepToS(&this->actor.shape.rot.y, - Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos), 4000); + Math_ScaledStepToS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &unk_664->focus.pos), + 4000); } else if ((this->stateFlags1 & PLAYER_STATE1_17) && !(this->stateFlags2 & (PLAYER_STATE2_5 | PLAYER_STATE2_6))) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->zTargetYaw, 4000); @@ -4007,12 +4008,12 @@ s32 func_80837818(Player* this) { } void func_80837918(Player* this, s32 quadIndex, u32 dmgFlags) { - this->meleeWeaponQuads[quadIndex].elem.toucher.dmgFlags = dmgFlags; + this->meleeWeaponQuads[quadIndex].elem.atDmgInfo.dmgFlags = dmgFlags; if (dmgFlags == DMG_DEKU_STICK) { - this->meleeWeaponQuads[quadIndex].elem.toucherFlags = TOUCH_ON | TOUCH_NEAREST | TOUCH_SFX_WOOD; + this->meleeWeaponQuads[quadIndex].elem.atElemFlags = ATELEM_ON | ATELEM_NEAREST | ATELEM_SFX_WOOD; } else { - this->meleeWeaponQuads[quadIndex].elem.toucherFlags = TOUCH_ON | TOUCH_NEAREST; + this->meleeWeaponQuads[quadIndex].elem.atElemFlags = ATELEM_ON | ATELEM_NEAREST; } } @@ -4394,7 +4395,7 @@ s32 func_808382DC(Player* this, PlayState* play) { } } - if (sp64 && (this->shieldQuad.elem.acHitElem->toucher.effect == 1)) { + if (sp64 && (this->shieldQuad.elem.acHitElem->atDmgInfo.effect == 1)) { func_8083819C(this, play); } @@ -4480,9 +4481,6 @@ s32 Player_ActionChange_12(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 sp34; f32 temp; - f32 wallPolyNormalX; - f32 wallPolyNormalZ; - f32 sp24; if (!(this->stateFlags1 & PLAYER_STATE1_11) && (this->ledgeClimbType >= PLAYER_LEDGE_CLIMB_2) && (!(this->stateFlags1 & PLAYER_STATE1_27) || (this->ageProperties->unk_14 > this->yDistToLedge))) { @@ -4524,9 +4522,9 @@ s32 Player_ActionChange_12(Player* this, PlayState* play) { anim = &gPlayerAnim_link_normal_250jump_start; this->speedXZ = 1.0f; } else { - wallPolyNormalX = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.x); - wallPolyNormalZ = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.z); - sp24 = this->distToInteractWall + 0.5f; + f32 wallPolyNormalX = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.x); + f32 wallPolyNormalZ = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.z); + f32 sp24 = this->distToInteractWall + 0.5f; this->stateFlags1 |= PLAYER_STATE1_14; @@ -4666,9 +4664,6 @@ u8 sReturnEntranceGroupIndices[] = { s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) { s32 exitIndex; s32 temp; - s32 sp34; - f32 speedXZ; - s32 yaw; if (this->actor.category == ACTORCAT_PLAYER) { exitIndex = 0; @@ -4677,8 +4672,7 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol (this->csAction == PLAYER_CSACTION_NONE) && !(this->stateFlags1 & PLAYER_STATE1_0) && (((poly != NULL) && (exitIndex = SurfaceType_GetExitIndex(&play->colCtx, poly, bgId), exitIndex != 0)) || (func_8083816C(sFloorType) && (this->floorProperty == FLOOR_PROPERTY_12)))) { - - sp34 = this->unk_A84 - (s32)this->actor.world.pos.y; + s32 sp34 = this->unk_A84 - (s32)this->actor.world.pos.y; if (!(this->stateFlags1 & (PLAYER_STATE1_23 | PLAYER_STATE1_27 | PLAYER_STATE1_29)) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (sp34 < 100) && (sYDistToFloor > 100.0f)) { @@ -4727,7 +4721,8 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; } else { - speedXZ = this->speedXZ; + f32 speedXZ = this->speedXZ; + s32 yaw; if (speedXZ < 0.0f) { this->actor.world.rot.y += 0x8000; @@ -4851,19 +4846,14 @@ s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, Colli } s32 Player_ActionChange_1(Player* this, PlayState* play) { - SlidingDoorActorBase* slidingDoor; - DoorActorBase* door; + Actor* attachedActor; + s32 pad3; s32 doorDirection; f32 sp78; f32 sp74; Actor* doorActor; f32 sp6C; - s32 pad3; s32 frontRoom; - Actor* attachedActor; - LinkAnimationHeader* sp5C; - CollisionPoly* groundPoly; - Vec3f checkPos; if ((this->doorType != PLAYER_DOORTYPE_NONE) && (!(this->stateFlags1 & PLAYER_STATE1_11) || @@ -4882,7 +4872,7 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) { sp74 = Math_SinS(doorActor->shape.rot.y); if (this->doorType == PLAYER_DOORTYPE_SLIDING) { - slidingDoor = (SlidingDoorActorBase*)doorActor; + SlidingDoorActorBase* slidingDoor = (SlidingDoorActorBase*)doorActor; this->yaw = slidingDoor->dyna.actor.home.rot.y; if (doorDirection > 0) { @@ -4926,7 +4916,8 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) { } } else { // The door actor can be either EnDoor or DoorKiller. - door = (DoorActorBase*)doorActor; + DoorActorBase* door = (DoorActorBase*)doorActor; + LinkAnimationHeader* sp5C; door->openAnim = (doorDirection < 0.0f) ? (LINK_IS_ADULT ? DOOR_OPEN_ANIM_ADULT_L : DOOR_OPEN_ANIM_CHILD_L) @@ -4983,6 +4974,9 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) { Actor_DisableLens(play); if (ENDOOR_GET_TYPE(doorActor) == DOOR_SCENEEXIT) { + CollisionPoly* groundPoly; + Vec3f checkPos; + checkPos.x = doorActor->world.pos.x - (sp6C * sp74); checkPos.y = doorActor->world.pos.y + 10.0f; checkPos.z = doorActor->world.pos.z - (sp6C * sp78); @@ -5138,8 +5132,8 @@ void func_8083A2F8(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_6 | PLAYER_STATE1_29; if (this->actor.textId != 0) { - Message_StartTextbox(play, this->actor.textId, this->targetActor); - this->unk_664 = this->targetActor; + Message_StartTextbox(play, this->actor.textId, this->talkActor); + this->unk_664 = this->talkActor; } } @@ -5222,16 +5216,16 @@ void func_8083A5C4(PlayState* play, Player* this, CollisionPoly* arg2, f32 arg3, } s32 func_8083A6AC(Player* this, PlayState* play) { - CollisionPoly* sp84; - s32 sp80; - Vec3f sp74; - Vec3f sp68; - f32 temp1; - //! @bug `floorPitch` and `floorPitchAlt` are cleared to 0 before this function is called, because the player //! left the ground. The angles will always be zero and therefore will always pass these checks. //! The intention seems to be to prevent ledge hanging or vine grabbing when walking off of a steep enough slope. if ((this->actor.yDistToWater < -80.0f) && (ABS(this->floorPitch) < 0xAAA) && (ABS(this->floorPitchAlt) < 0xAAA)) { + CollisionPoly* sp84; + s32 sp80; + Vec3f sp74; + Vec3f sp68; + f32 temp1; + sp74.x = this->actor.prevPos.x - this->actor.world.pos.x; sp74.z = this->actor.prevPos.z - this->actor.world.pos.z; @@ -5427,7 +5421,6 @@ void func_8083AE40(Player* this, s16 objectId) { size = gObjectTable[objectId].vromEnd - gObjectTable[objectId].vromStart; LOG_HEX("size", size, "../z_player.c", 9090); - ASSERT(size <= 1024 * 8, "size <= 1024 * 8", "../z_player.c", 9091); DMA_REQUEST_ASYNC(&this->giObjectDmaRequest, this->giObjectSegment, gObjectTable[objectId].vromStart, size, 0, &this->giObjectLoadQueue, NULL, "../z_player.c", 9099); @@ -5506,7 +5499,7 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { s32 sp2C; s32 sp28; GetItemEntry* giEntry; - Actor* targetActor; + Actor* talkActor; if ((this->unk_6AD != 0) && (func_808332B8(this) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & PLAYER_STATE1_23))) { @@ -5533,9 +5526,9 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { (sp28 = Player_ActionToBottle(this, this->itemAction) - 1, ((sp28 >= 0) && (sp28 < 6) && ((this->itemAction > PLAYER_IA_BOTTLE_POE) || - ((this->targetActor != NULL) && (((this->itemAction == PLAYER_IA_BOTTLE_POE) && - (this->exchangeItemId == EXCH_ITEM_BOTTLE_POE)) || - (this->exchangeItemId == EXCH_ITEM_BOTTLE_BLUE_FIRE))))))) { + ((this->talkActor != NULL) && (((this->itemAction == PLAYER_IA_BOTTLE_POE) && + (this->exchangeItemId == EXCH_ITEM_BOTTLE_POE)) || + (this->exchangeItemId == EXCH_ITEM_BOTTLE_BLUE_FIRE))))))) { if ((play->actorCtx.titleCtx.delayTimer == 0) && (play->actorCtx.titleCtx.alpha == 0)) { func_80835DE4(play, this, Player_Action_8084F104, 0); @@ -5553,9 +5546,9 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { sp2C = sp28 + 0x18; } - targetActor = this->targetActor; + talkActor = this->talkActor; - if ((targetActor != NULL) && + if ((talkActor != NULL) && ((this->exchangeItemId == sp2C) || (this->exchangeItemId == EXCH_ITEM_BOTTLE_BLUE_FIRE) || ((this->exchangeItemId == EXCH_ITEM_BOTTLE_POE) && (this->itemAction == PLAYER_IA_BOTTLE_BIG_POE)) || @@ -5570,8 +5563,8 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { this->av2.actionVar2 = 0x50; this->av1.actionVar1 = -1; } - targetActor->flags |= ACTOR_FLAG_TALK; - this->unk_664 = this->targetActor; + talkActor->flags |= ACTOR_FLAG_TALK; + this->unk_664 = this->talkActor; } else if (sp2C == EXCH_ITEM_BOTTLE_RUTOS_LETTER) { this->av1.actionVar1 = 1; this->actor.textId = 0x4005; @@ -5649,7 +5642,7 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { } s32 Player_ActionChange_4(Player* this, PlayState* play) { - Actor* sp34 = this->targetActor; + Actor* sp34 = this->talkActor; Actor* sp30 = this->unk_664; Actor* sp2C = NULL; s32 sp28 = 0; @@ -5698,7 +5691,7 @@ s32 Player_ActionChange_4(Player* this, PlayState* play) { } sp34 = sp2C; - this->targetActor = NULL; + this->talkActor = NULL; if (sp28 || !sp24) { sp2C->textId = ABS(this->naviTextId); @@ -6030,8 +6023,6 @@ static struct_80854554 D_80854554[] = { }; s32 func_8083C6B8(PlayState* play, Player* this) { - Vec3f sp24; - if (sUseHeldItem) { if (Player_GetBottleHeld(this) >= 0) { Player_SetupAction(play, this, Player_Action_8084ECA4, 0); @@ -6048,11 +6039,12 @@ s32 func_8083C6B8(PlayState* play, Player* this) { } if (this->heldItemAction == PLAYER_IA_FISHING_POLE) { - sp24 = this->actor.world.pos; - sp24.y += 50.0f; + Vec3f rodCheckPos = this->actor.world.pos; + + rodCheckPos.y += 50.0f; if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.world.pos.z > 1300.0f) || - BgCheck_SphVsFirstPoly(&play->colCtx, &sp24, 20.0f)) { + BgCheck_SphVsFirstPoly(&play->colCtx, &rodCheckPos, 20.0f)) { Sfx_PlaySfxCentered(NA_SE_SY_ERROR); return 0; } @@ -6389,15 +6381,15 @@ void func_8083D53C(PlayState* play, Player* this) { void func_8083D6EC(PlayState* play, Player* this) { Vec3f ripplePos; - f32 temp1; - f32 temp2; - f32 temp3; - f32 temp4; this->actor.minVelocityY = -20.0f; this->actor.gravity = REG(68) / 100.0f; if (func_8083816C(sFloorType)) { + f32 temp1; + f32 temp2; + f32 temp3; + temp1 = fabsf(this->speedXZ) * 20.0f; temp3 = 0.0f; @@ -6439,6 +6431,8 @@ void func_8083D6EC(PlayState* play, Player* this) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (this->actor.yDistToWater < 50.0f) { + f32 temp4; + temp4 = fabsf(this->bodyPartsPos[PLAYER_BODYPART_WAIST].x - this->unk_A88.x) + fabsf(this->bodyPartsPos[PLAYER_BODYPART_WAIST].y - this->unk_A88.y) + fabsf(this->bodyPartsPos[PLAYER_BODYPART_WAIST].z - this->unk_A88.z); @@ -6535,18 +6529,22 @@ void func_8083DC54(Player* this, PlayState* play) { } void func_8083DDC8(Player* this, PlayState* play) { - s16 temp1; - s16 temp2; - if (!func_8002DD78(this) && !func_808334B4(this) && (this->speedXZ > 5.0f)) { + s16 temp1; + s16 temp2; + temp1 = this->speedXZ * 200.0f; temp2 = (s16)(this->yaw - this->actor.shape.rot.y) * this->speedXZ * 0.1f; + temp1 = CLAMP(temp1, -4000, 4000); temp2 = CLAMP(-temp2, -4000, 4000); + Math_ScaledStepToS(&this->unk_6BC, temp1, 900); this->unk_6B6 = -(f32)this->unk_6BC * 0.5f; + Math_ScaledStepToS(&this->unk_6BA, temp2, 300); Math_ScaledStepToS(&this->unk_6C0, temp2, 200); + this->unk_6AE |= 0x168; } else { func_8083DC54(this, play); @@ -6582,13 +6580,14 @@ static struct_80854578 D_80854578[] = { s32 Player_ActionChange_3(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; - f32 unk_04; - f32 unk_08; - f32 sp38; - f32 sp34; - s32 temp; if ((rideActor != NULL) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { + f32 unk_04; + f32 unk_08; + f32 sp38; + f32 sp34; + s32 temp; + sp38 = Math_CosS(rideActor->actor.shape.rot.y); sp34 = Math_SinS(rideActor->actor.shape.rot.y); @@ -6605,6 +6604,7 @@ s32 Player_ActionChange_3(Player* this, PlayState* play) { unk_04 = D_80854578[temp].unk_04; unk_08 = D_80854578[temp].unk_08; + this->actor.world.pos.x = rideActor->actor.world.pos.x + rideActor->riderPos.x + ((unk_04 * sp38) + (unk_08 * sp34)); this->actor.world.pos.z = @@ -6618,9 +6618,11 @@ s32 Player_ActionChange_3(Player* this, PlayState* play) { Player_AnimReplaceApplyFlags(play, this, ANIM_FLAG_0 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_PLAYER_SETMOVE | ANIM_FLAG_NO_MOVE | ANIM_FLAG_PLAYER_7); + this->actor.parent = this->rideActor; func_80832224(this); Actor_DisableLens(play); + return 1; } @@ -6707,24 +6709,33 @@ void func_8083E4C4(PlayState* play, Player* this, GetItemEntry* giEntry) { Sfx_PlaySfxCentered((this->getItemId < 0) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM); } +#if IS_DEBUG +#define DEBUG_iREG_67 iREG(67) +#else +#define DEBUG_iREG_67 0 +#endif + s32 Player_ActionChange_2(Player* this, PlayState* play) { Actor* interactedActor; - if (iREG(67) || + if (DEBUG_iREG_67 || (((interactedActor = this->interactRangeActor) != NULL) && TitleCard_Clear(play, &play->actorCtx.titleCtx))) { - if (iREG(67) || (this->getItemId > GI_NONE)) { - if (iREG(67)) { + if (DEBUG_iREG_67 || (this->getItemId > GI_NONE)) { + if (DEBUG_iREG_67) { this->getItemId = iREG(68); } if (this->getItemId < GI_MAX) { GetItemEntry* giEntry = &sGetItemTable[this->getItemId - 1]; +#if IS_DEBUG if ((interactedActor != &this->actor) && !iREG(67)) { interactedActor->parent = &this->actor; } - iREG(67) = false; +#else + interactedActor->parent = &this->actor; +#endif if ((Item_CheckObtainability(giEntry->itemId) == ITEM_NONE) || (play->sceneId == SCENE_BOMBCHU_BOWLING_ALLEY)) { @@ -6973,15 +6984,15 @@ void func_8083F070(Player* this, LinkAnimationHeader* anim, PlayState* play) { * @return true if Player chooses to enter crawlspace */ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWallFlags) { - CollisionPoly* wallPoly; - Vec3f wallVertices[3]; - f32 xVertex1; - f32 xVertex2; - f32 zVertex1; - f32 zVertex2; - s32 i; - if (!LINK_IS_ADULT && !(this->stateFlags1 & PLAYER_STATE1_27) && (interactWallFlags & WALL_FLAG_CRAWLSPACE)) { + CollisionPoly* wallPoly; + Vec3f wallVertices[3]; + f32 xVertex1; + f32 xVertex2; + f32 zVertex1; + f32 zVertex2; + s32 i; + wallPoly = this->actor.wallPoly; CollisionPoly_GetVerticesByBgId(wallPoly, this->actor.wallBgId, &play->colCtx, wallVertices); @@ -7342,14 +7353,14 @@ s32 func_80840058(Player* this, f32* arg1, s16* arg2, PlayState* play) { func_8083DC54(this, play); if ((*arg1 != 0.0f) || (ABS(this->unk_87C) > 400)) { - s16 temp1 = *arg2 - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); - u16 temp2 = (ABS(temp1) - 0x2000) & 0xFFFF; + s16 temp1 = *arg2 - (u16)Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); + u16 temp2 = (ABS(temp1) - 0x2000); if ((temp2 < 0x4000) || (this->unk_87C != 0)) { return -1; - } else { - return 1; } + + return 1; } return 0; @@ -7773,6 +7784,8 @@ void func_80841138(Player* this, PlayState* play) { f32 temp2; if (this->unk_864 < 1.0f) { + s32 pad; + temp1 = R_UPDATE_RATE * 0.5f; func_8084029C(this, REG(35) / 1000.0f); LinkAnimation_LoadToJoint(play, &this->skelAnime, @@ -7836,7 +7849,6 @@ void Player_Action_808414F8(Player* this, PlayState* play) { f32 speedTarget; s16 yawTarget; s32 sp2C; - s16 sp2A; func_80841138(this, play); @@ -7860,7 +7872,7 @@ void Player_Action_808414F8(Player* this, PlayState* play) { } } } else { - sp2A = yawTarget - this->yaw; + s16 sp2A = yawTarget - this->yaw; Math_AsymStepToF(&this->speedXZ, speedTarget * 1.5f, 1.5f, 2.0f); Math_ScaledStepToS(&this->yaw, yawTarget, sp2A * 0.1f); @@ -7929,8 +7941,6 @@ void Player_Action_8084193C(Player* this, PlayState* play) { f32 speedTarget; s16 yawTarget; s32 temp1; - s16 temp2; - s32 temp3; func_80841860(play, this); @@ -7950,42 +7960,37 @@ void Player_Action_8084193C(Player* this, PlayState* play) { if (temp1 > 0) { func_8083C858(this, play); - return; - } - - if (temp1 < 0) { + } else if (temp1 < 0) { if (func_80833B2C(this)) { func_8083CB2C(this, yawTarget, play); } else { func_8083CBF0(this, yawTarget, play); } - return; - } - - if ((this->speedXZ < 3.6f) && (speedTarget < 4.0f)) { + } else if ((this->speedXZ < 3.6f) && (speedTarget < 4.0f)) { if (!func_8008E9C4(this) && func_80833B2C(this)) { func_8083CB94(this, play); } else { func_80839F90(this, play); } - return; - } + } else { + s16 temp2; + s32 temp3; - func_80840138(this, speedTarget, yawTarget); + func_80840138(this, speedTarget, yawTarget); - temp2 = yawTarget - this->yaw; - temp3 = ABS(temp2); + temp2 = yawTarget - this->yaw; + temp3 = ABS(temp2); - if (temp3 > 0x4000) { - if (Math_StepToF(&this->speedXZ, 0.0f, 3.0f) != 0) { - this->yaw = yawTarget; + if (temp3 > 0x4000) { + if (Math_StepToF(&this->speedXZ, 0.0f, 3.0f) != 0) { + this->yaw = yawTarget; + } + } else { + speedTarget *= 0.9f; + Math_AsymStepToF(&this->speedXZ, speedTarget, 2.0f, 3.0f); + Math_ScaledStepToS(&this->yaw, yawTarget, temp3 * 0.1f); } - return; } - - speedTarget *= 0.9f; - Math_AsymStepToF(&this->speedXZ, speedTarget, 2.0f, 3.0f); - Math_ScaledStepToS(&this->yaw, yawTarget, temp3 * 0.1f); } } @@ -8073,6 +8078,8 @@ void func_80841EE4(Player* this, PlayState* play) { f32 temp2; if (this->unk_864 < 1.0f) { + s32 pad; + temp1 = R_UPDATE_RATE * 0.5f; func_8084029C(this, REG(35) / 1000.0f); @@ -8128,6 +8135,10 @@ void Player_Action_80842180(Player* this, PlayState* play) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); + if (MM_BUNNY_HOOD && this->currentMask == PLAYER_MASK_BUNNY) { + speedTarget *= MM_BUNNY_HOOD_SPEED; + } + if (!func_8083C484(this, &speedTarget, &yawTarget)) { func_8083DF68(this, speedTarget, yawTarget); func_8083DDC8(this, play); @@ -8472,15 +8483,6 @@ s32 func_80842DF4(PlayState* play, Player* this) { } void Player_Action_80843188(Player* this, PlayState* play) { - f32 sp54; - f32 sp50; - s16 sp4E; - s16 sp4C; - s16 sp4A; - s16 sp48; - s16 sp46; - f32 sp40; - if (LinkAnimation_Update(play, &this->skelAnime)) { if (!Player_IsChildWithHylianShield(this)) { Player_AnimPlayLoop(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense_wait, this->modelAnimType)); @@ -8498,6 +8500,15 @@ void Player_Action_80843188(Player* this, PlayState* play) { func_8083721C(this); if (this->av2.actionVar2 != 0) { + f32 sp54; + f32 sp50; + s16 sp4E; + s16 sp4C; + s16 sp4A; + s16 sp48; + s16 sp46; + f32 sp40; + sp54 = sControlInput->rel.stick_y * 100; sp50 = sControlInput->rel.stick_x * -120; sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); @@ -8866,8 +8877,10 @@ void Player_Action_8084411C(Player* this, PlayState* play) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + Actor* heldActor; + if (this->stateFlags1 & PLAYER_STATE1_11) { - Actor* heldActor = this->heldActor; + heldActor = this->heldActor; if (!func_80835644(play, this, heldActor) && (heldActor->id == ACTOR_EN_NIW) && CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { @@ -9096,12 +9109,12 @@ void Player_Action_80844AF4(Player* this, PlayState* play) { } s32 func_80844BE4(Player* this, PlayState* play) { - s32 temp; - if (Player_StartCsAction(play, this)) { this->stateFlags2 |= PLAYER_STATE2_17; } else { if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { + s32 temp; + if ((this->unk_858 >= 0.85f) || func_808375D8(this)) { temp = D_80854384[Player_HoldsTwoHandedWeapon(this)]; } else { @@ -9327,7 +9340,6 @@ void Player_Action_80845308(Player* this, PlayState* play) { void Player_Action_80845668(Player* this, PlayState* play) { s32 sp3C; - f32 temp1; s32 temp2; f32 temp3; @@ -9338,7 +9350,7 @@ void Player_Action_80845668(Player* this, PlayState* play) { this->speedXZ = 1.0f; if (LinkAnimation_OnFrame(&this->skelAnime, 8.0f)) { - temp1 = this->yDistToLedge; + f32 temp1 = this->yDistToLedge; if (temp1 > this->ageProperties->unk_0C) { temp1 = this->ageProperties->unk_0C; @@ -9356,7 +9368,6 @@ void Player_Action_80845668(Player* this, PlayState* play) { func_80838940(this, NULL, temp1, play, NA_SE_VO_LI_AUTO_JUMP); this->av2.actionVar2 = -1; - return; } } else { temp2 = func_808374A0(play, this, &this->skelAnime, 4.0f); @@ -9478,12 +9489,6 @@ s32 func_80845C68(PlayState* play, s32 arg1) { } void Player_Action_80845CA4(Player* this, PlayState* play) { - f32 sp3C; - s32 temp; - f32 sp34; - s32 sp30; - s32 pad; - if (!Player_ActionChange_13(this, play)) { if (this->av2.actionVar2 == 0) { LinkAnimation_Update(play, &this->skelAnime); @@ -9493,9 +9498,10 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { this->av2.actionVar2 = 1; } } else if (this->av1.actionVar1 == 0) { - sp3C = 5.0f * D_808535E8; + f32 sp3C = 5.0f * D_808535E8; + s32 temp = func_80845BA0(play, this, &sp3C, -1); - if (func_80845BA0(play, this, &sp3C, -1) < 30) { + if (temp < 30) { this->av1.actionVar1 = 1; this->stateFlags1 |= PLAYER_STATE1_29; @@ -9503,8 +9509,9 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { this->unk_450.z = this->unk_45C.z; } } else { - sp34 = 5.0f; - sp30 = 20; + f32 sp34 = 5.0f; + s32 sp30 = 20; + s32 sp2C; if (this->stateFlags1 & PLAYER_STATE1_0) { sp34 = gSaveContext.entranceSpeed; @@ -9520,10 +9527,10 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { sp30 = -1; } - temp = func_80845BA0(play, this, &sp34, sp30); + sp2C = func_80845BA0(play, this, &sp34, sp30); if ((this->av2.actionVar2 == 0) || - ((temp == 0) && (this->speedXZ == 0.0f) && + ((sp2C == 0) && (this->speedXZ == 0.0f) && (Play_GetCamera(play, CAM_ID_MAIN)->stateFlags & CAM_STATE_CAM_FUNC_FINISH))) { Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); @@ -9577,10 +9584,7 @@ void Player_Action_80846050(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80839F90(this, play); func_80835688(this, play); - return; - } - - if (LinkAnimation_OnFrame(&this->skelAnime, 4.0f)) { + } else if (LinkAnimation_OnFrame(&this->skelAnime, 4.0f)) { Actor* interactRangeActor = this->interactRangeActor; if (!func_80835644(play, this, interactRangeActor)) { @@ -9592,10 +9596,9 @@ void Player_Action_80846050(Player* this, PlayState* play) { BGCHECKFLAG_CEILING | BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH | BGCHECKFLAG_GROUND_STRICT); this->unk_3BC.y = interactRangeActor->shape.rot.y - this->actor.shape.rot.y; } - return; + } else { + Math_ScaledStepToS(&this->unk_3BC.y, 0, 4000); } - - Math_ScaledStepToS(&this->unk_3BC.y, 0, 4000); } static AnimSfxEntry D_8085461C[] = { @@ -9608,20 +9611,14 @@ void Player_Action_80846120(Player* this, PlayState* play) { if (!Player_ActionChange_13(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_heavy_carry_end, play); } - return; - } - - if (LinkAnimation_OnFrame(&this->skelAnime, 41.0f)) { + } else if (LinkAnimation_OnFrame(&this->skelAnime, 41.0f)) { BgHeavyBlock* heavyBlock = (BgHeavyBlock*)this->interactRangeActor; this->heldActor = &heavyBlock->dyna.actor; this->actor.child = &heavyBlock->dyna.actor; heavyBlock->dyna.actor.parent = &this->actor; func_8002DBD0(&heavyBlock->dyna.actor, &heavyBlock->unk_164, &this->leftHandPos); - return; - } - - if (LinkAnimation_OnFrame(&this->skelAnime, 229.0f)) { + } else if (LinkAnimation_OnFrame(&this->skelAnime, 229.0f)) { Actor* heldActor = this->heldActor; heldActor->speed = Math_SinS(heldActor->shape.rot.x) * 40.0f; @@ -9629,10 +9626,9 @@ void Player_Action_80846120(Player* this, PlayState* play) { heldActor->gravity = -2.0f; heldActor->minVelocityY = -30.0f; Player_DetachHeldActor(play, this); - return; + } else { + Player_ProcessAnimSfxList(this, D_8085461C); } - - Player_ProcessAnimSfxList(this, D_8085461C); } void Player_Action_80846260(Player* this, PlayState* play) { @@ -9641,24 +9637,16 @@ void Player_Action_80846260(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_silver_wait); this->av2.actionVar2 = 1; - return; - } - - if (this->av2.actionVar2 == 0) { + } else if (this->av2.actionVar2 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 27.0f)) { Actor* interactRangeActor = this->interactRangeActor; this->heldActor = interactRangeActor; this->actor.child = interactRangeActor; interactRangeActor->parent = &this->actor; - return; - } - - if (LinkAnimation_OnFrame(&this->skelAnime, 25.0f)) { + } else if (LinkAnimation_OnFrame(&this->skelAnime, 25.0f)) { func_80832698(this, NA_SE_VO_LI_SWORD_L); - return; } - } else if (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { Player_SetupAction(play, this, Player_Action_80846358, 1); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_silver_throw); @@ -9753,8 +9741,8 @@ static ColliderCylinderInit D_80854624 = { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_NONE, - BUMP_ON, + ATELEM_NONE, + ACELEM_ON, OCELEM_ON, }, { 12, 60, 0, { 0, 0, 0 } }, @@ -9773,8 +9761,8 @@ static ColliderQuadInit D_80854650 = { ELEMTYPE_UNK2, { 0x00000100, 0x00, 0x01 }, { 0xFFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_NONE, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -9793,8 +9781,8 @@ static ColliderQuadInit D_808546A0 = { ELEMTYPE_UNK2, { 0x00100000, 0x00, 0x00 }, { 0xDFCFFFFF, 0x00, 0x00 }, - TOUCH_ON | TOUCH_SFX_NORMAL, - BUMP_ON, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, OCELEM_NONE, }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, @@ -9955,6 +9943,28 @@ static void (*D_80854738[])(PlayState* play, Player* this) = { static Vec3f D_80854778 = { 0.0f, 50.0f, 0.0f }; +/** + * Iterates in the get item table to get the largest GI object size + */ +u32 Player_GetGIAllocSize() { + u32 i = 0, curSize = 0, allocSize = PLAYER_ALLOC_GI_MIN; + + for (i = 0; i < ARRAY_COUNT(sGetItemTable); i++) { + u16 curGIObjectID = sGetItemTable[i].objectId; + + if (curGIObjectID != OBJECT_INVALID) { + RomFile curObject = gObjectTable[curGIObjectID]; + curSize = curObject.vromEnd - curObject.vromStart; + + if (curSize > allocSize) { + allocSize = curSize; + } + } + } + + return allocSize + 16; +} + void Player_Init(Actor* thisx, PlayState* play2) { Player* this = (Player*)thisx; PlayState* play = play2; @@ -9985,7 +9995,15 @@ void Player_Init(Actor* thisx, PlayState* play2) { Player_SetEquipmentData(play, this); this->prevBoots = this->currentBoots; Player_InitCommon(this, play, gPlayerSkelHeaders[((void)0, gSaveContext.save.linkAge)]); - this->giObjectSegment = (void*)(((uintptr_t)ZELDA_ARENA_MALLOC(0x3008, "../z_player.c", 17175) + 8) & ~0xF); + + u32 giAllocSize = Player_GetGIAllocSize(); + if (ENABLE_AUTO_GI_ALLOC) { + this->giObjectSegment = (void*)ALIGN16((uintptr_t)ZELDA_ARENA_MALLOC(giAllocSize, __FILE__, __LINE__)); + } else { + ASSERT(giAllocSize < 0x3008, "[HackerOoT:ERROR]: GI Object larger than the allocated size.", __FILE__, + __LINE__); + this->giObjectSegment = (void*)(((uintptr_t)ZELDA_ARENA_MALLOC(0x3008, "../z_player.c", 17175) + 8) & ~0xF); + } respawnFlag = gSaveContext.respawnFlag; @@ -10081,10 +10099,9 @@ void func_808471F4(s16* pValue) { } void func_80847298(Player* this) { - s16 sp26; - if (!(this->unk_6AE & 2)) { - sp26 = this->actor.focus.rot.y - this->actor.shape.rot.y; + s16 sp26 = this->actor.focus.rot.y - this->actor.shape.rot.y; + func_808471F4(&sp26); this->actor.focus.rot.y = this->actor.shape.rot.y + sp26; } @@ -10130,9 +10147,6 @@ void func_80847298(Player* this) { static f32 D_80854784[] = { 120.0f, 240.0f, 360.0f }; -static u8 sDiveDoActions[] = { DO_ACTION_1, DO_ACTION_2, DO_ACTION_3, DO_ACTION_4, - DO_ACTION_5, DO_ACTION_6, DO_ACTION_7, DO_ACTION_8 }; - void func_808473D4(PlayState* play, Player* this) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && (this->actor.category == ACTORCAT_PLAYER)) { Actor* heldActor = this->heldActor; @@ -10172,8 +10186,8 @@ void func_808473D4(PlayState* play, Player* this) { doAction = DO_ACTION_CLIMB; } else if ((this->stateFlags1 & PLAYER_STATE1_23) && !EN_HORSE_CHECK_4((EnHorse*)this->rideActor) && (Player_Action_8084D3E4 != this->actionFunc)) { - if ((this->stateFlags2 & PLAYER_STATE2_1) && (this->targetActor != NULL)) { - if (this->targetActor->category == ACTORCAT_NPC) { + if ((this->stateFlags2 & PLAYER_STATE2_1) && (this->talkActor != NULL)) { + if (this->talkActor->category == ACTORCAT_NPC) { doAction = DO_ACTION_SPEAK; } else { doAction = DO_ACTION_CHECK; @@ -10181,8 +10195,8 @@ void func_808473D4(PlayState* play, Player* this) { } else if (!func_8002DD78(this) && !(this->stateFlags1 & PLAYER_STATE1_20)) { doAction = DO_ACTION_FASTER; } - } else if ((this->stateFlags2 & PLAYER_STATE2_1) && (this->targetActor != NULL)) { - if (this->targetActor->category == ACTORCAT_NPC) { + } else if ((this->stateFlags2 & PLAYER_STATE2_1) && (this->talkActor != NULL)) { + if (this->talkActor->category == ACTORCAT_NPC) { doAction = DO_ACTION_SPEAK; } else { doAction = DO_ACTION_CHECK; @@ -10205,6 +10219,9 @@ void func_808473D4(PlayState* play, Player* this) { (this->getItemId < GI_MAX)) { doAction = DO_ACTION_GRAB; } else if (this->stateFlags2 & PLAYER_STATE2_11) { + static u8 sDiveDoActions[] = { DO_ACTION_1, DO_ACTION_2, DO_ACTION_3, DO_ACTION_4, + DO_ACTION_5, DO_ACTION_6, DO_ACTION_7, DO_ACTION_8 }; + sp24 = (D_80854784[CUR_UPG_VALUE(UPG_SCALE)] - this->actor.yDistToWater) / 40.0f; sp24 = CLAMP(sp24, 0, 7); doAction = sDiveDoActions[sp24]; @@ -10752,15 +10769,15 @@ void Player_UpdateBodyBurn(PlayState* play, Player* this) { sp54 = (s32)(this->speedXZ * 0.4f) + 1; } - spawnedFlame = false; - timerPtr = this->bodyFlameTimers; - if (this->stateFlags2 & PLAYER_STATE2_3) { sp58 = 100; } else { sp58 = 0; } + spawnedFlame = false; + timerPtr = this->bodyFlameTimers; + func_8083819C(this, play); for (i = 0; i < PLAYER_BODYPART_MAX; i++, timerPtr++) { @@ -11024,9 +11041,9 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } Math_ScaledStepToS(&this->unk_6C2, 0, 400); - func_80032CB4(this->unk_3A8, 20, 80, 6); - this->actor.shape.face = this->unk_3A8[0] + ((play->gameplayFrames & 32) ? 0 : 3); + FaceChange_UpdateBlinking(&this->faceChange, 20, 80, 6); + this->actor.shape.face = this->faceChange.face + ((play->gameplayFrames & 32) ? 0 : 3); if (this->currentMask == PLAYER_MASK_BUNNY) { Player_UpdateBunnyEars(this); @@ -11228,10 +11245,10 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { func_808368EC(this, play); if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TALK)) { - this->targetActorDistance = 0.0f; + this->talkActorDistance = 0.0f; } else { - this->targetActor = NULL; - this->targetActorDistance = MAXFLOAT; + this->talkActor = NULL; + this->talkActorDistance = MAXFLOAT; this->exchangeItemId = EXCH_ITEM_NONE; } @@ -11316,58 +11333,74 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Collider_ResetQuadAT(play, &this->shieldQuad.base); } -static Vec3f D_80854838 = { 0.0f, 0.0f, -30.0f }; +#if IS_DEBUG +s32 Player_UpdateNoclip(Player* this, PlayState* play); +#endif void Player_Update(Actor* thisx, PlayState* play) { - static Vec3f sDogSpawnPos; Player* this = (Player*)thisx; s32 dogParams; s32 pad; - Input sp44; - Actor* dog; + Input input; - if (func_8084FCAC(this, play)) { - if (gSaveContext.dogParams < 0) { - if (Object_GetSlot(&play->objectCtx, OBJECT_DOG) < 0) { - gSaveContext.dogParams = 0; - } else { - gSaveContext.dogParams &= 0x7FFF; - Player_GetRelativePosition(this, &this->actor.world.pos, &D_80854838, &sDogSpawnPos); - dogParams = gSaveContext.dogParams; +#if IS_DEBUG + if (!Player_UpdateNoclip(this, play)) { + goto skip_update; + } +#endif - dog = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_DOG, sDogSpawnPos.x, sDogSpawnPos.y, sDogSpawnPos.z, - 0, this->actor.shape.rot.y, 0, dogParams | 0x8000); - if (dog != NULL) { - dog->room = 0; - } - } - } + if (gSaveContext.dogParams < 0) { + static Vec3f sDogSpawnOffset = { 0.0f, 0.0f, -30.0f }; + static Vec3f sDogSpawnPos; - if ((this->interactRangeActor != NULL) && (this->interactRangeActor->update == NULL)) { - this->interactRangeActor = NULL; - } - - if ((this->heldActor != NULL) && (this->heldActor->update == NULL)) { - Player_DetachHeldActor(play, this); - } - - if (this->stateFlags1 & (PLAYER_STATE1_5 | PLAYER_STATE1_29)) { - bzero(&sp44, sizeof(sp44)); + if (Object_GetSlot(&play->objectCtx, OBJECT_DOG) < 0) { + gSaveContext.dogParams = 0; } else { - sp44 = play->state.input[0]; - if (this->unk_88E != 0) { - sp44.cur.button &= ~(BTN_A | BTN_B | BTN_CUP); - sp44.press.button &= ~(BTN_A | BTN_B | BTN_CUP); + Actor* dog; + + gSaveContext.dogParams &= 0x7FFF; + Player_GetRelativePosition(this, &this->actor.world.pos, &sDogSpawnOffset, &sDogSpawnPos); + dogParams = gSaveContext.dogParams; + + dog = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_DOG, sDogSpawnPos.x, sDogSpawnPos.y, sDogSpawnPos.z, 0, + this->actor.shape.rot.y, 0, dogParams | 0x8000); + if (dog != NULL) { + dog->room = 0; } } - - Player_UpdateCommon(this, play, &sp44); } - MREG(52) = this->actor.world.pos.x; - MREG(53) = this->actor.world.pos.y; - MREG(54) = this->actor.world.pos.z; - MREG(55) = this->actor.world.rot.y; + if ((this->interactRangeActor != NULL) && (this->interactRangeActor->update == NULL)) { + this->interactRangeActor = NULL; + } + + if ((this->heldActor != NULL) && (this->heldActor->update == NULL)) { + Player_DetachHeldActor(play, this); + } + + if (this->stateFlags1 & (PLAYER_STATE1_5 | PLAYER_STATE1_29)) { + bzero(&input, sizeof(input)); + } else { + input = play->state.input[0]; + + if (this->unk_88E != 0) { + input.cur.button &= ~(BTN_A | BTN_B | BTN_CUP); + input.press.button &= ~(BTN_A | BTN_B | BTN_CUP); + } + } + + Player_UpdateCommon(this, play, &input); + +skip_update:; + { + s32 pad; + + MREG(52) = this->actor.world.pos.x; + MREG(53) = this->actor.world.pos.y; + MREG(54) = this->actor.world.pos.z; + + MREG(55) = this->actor.world.rot.y; + } } typedef struct { @@ -11387,8 +11420,6 @@ static Gfx* sMaskDlists[PLAYER_MASK_MAX - 1] = { static Vec3s D_80854864 = { 0, 0, 0 }; void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, OverrideLimbDrawOpa overrideLimbDraw) { - static s32 D_8085486C = 255; - OPEN_DISPS(play->state.gfxCtx, "../z_player.c", 19228); gSPSegment(POLY_OPA_DISP++, 0x0C, cullDList); @@ -11425,15 +11456,14 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, } if ((this->currentBoots == PLAYER_BOOTS_HOVER) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - !(this->stateFlags1 & PLAYER_STATE1_23) && (this->hoverBootsTimer != 0)) { - s32 sp5C; - s32 hoverBootsTimer = this->hoverBootsTimer; + !(this->stateFlags1 & PLAYER_STATE1_23) && ((u32)this->hoverBootsTimer != 0)) { + static s32 D_8085486C = 255; if (this->hoverBootsTimer < 19) { - if (hoverBootsTimer >= 15) { - D_8085486C = (19 - hoverBootsTimer) * 51.0f; - } else if (hoverBootsTimer < 19) { - sp5C = hoverBootsTimer; + if (this->hoverBootsTimer >= 15) { + D_8085486C = (19 - this->hoverBootsTimer) * 51.0f; + } else if (this->hoverBootsTimer < 19) { + s32 sp5C = this->hoverBootsTimer; if (sp5C > 9) { sp5C = 9; @@ -11460,6 +11490,8 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, } } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_player.c", 19328); } @@ -11771,14 +11803,14 @@ void Player_Action_8084B530(Player* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_TALK; - if (!CHECK_FLAG_ALL(this->targetActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { + if (!CHECK_FLAG_ALL(this->talkActor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2)) { this->stateFlags2 &= ~PLAYER_STATE2_13; } Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); if (!func_8084B4D4(play, this) && !func_8084B3CC(play, this) && !Player_StartCsAction(play, this)) { - if ((this->targetActor != this->interactRangeActor) || !Player_ActionChange_2(this, play)) { + if ((this->talkActor != this->interactRangeActor) || !Player_ActionChange_2(this, play)) { if (this->stateFlags1 & PLAYER_STATE1_23) { s32 sp24 = this->av2.actionVar2; func_8083A360(play, this); @@ -11802,7 +11834,7 @@ void Player_Action_8084B530(Player* this, PlayState* play) { } else if (!func_8008E9C4(this) && LinkAnimation_Update(play, &this->skelAnime)) { if (this->skelAnime.moveFlags != 0) { func_80832DBC(this); - if ((this->targetActor->category == ACTORCAT_NPC) && (this->heldItemAction != PLAYER_IA_FISHING_POLE)) { + if ((this->talkActor->category == ACTORCAT_NPC) && (this->heldItemAction != PLAYER_IA_FISHING_POLE)) { Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_talk_free); } else { Player_AnimPlayLoop(play, this, func_80833338(this)); @@ -11854,10 +11886,6 @@ static AnimSfxEntry D_80854870[] = { }; void Player_Action_8084B898(Player* this, PlayState* play) { - f32 speedTarget; - s16 yawTarget; - s32 temp; - this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; if (func_80832CB0(play, this, &gPlayerAnim_link_normal_pushing)) { @@ -11872,6 +11900,10 @@ void Player_Action_8084B898(Player* this, PlayState* play) { func_8083F524(play, this); if (!func_8083F9D0(play, this)) { + f32 speedTarget; + s16 yawTarget; + s32 temp; + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); temp = func_8083FFB8(this, &speedTarget, &yawTarget); if (temp < 0) { @@ -11897,18 +11929,8 @@ static AnimSfxEntry D_80854878[] = { static Vec3f D_80854880 = { 0.0f, 26.0f, -40.0f }; void Player_Action_8084B9E4(Player* this, PlayState* play) { - LinkAnimationHeader* anim; - f32 speedTarget; - s16 yawTarget; - s32 temp1; - Vec3f sp5C; - f32 temp2; - CollisionPoly* sp54; - s32 sp50; - Vec3f sp44; - Vec3f sp38; + LinkAnimationHeader* anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_pulling, this->modelAnimType); - anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_pulling, this->modelAnimType); this->stateFlags2 |= PLAYER_STATE2_0 | PLAYER_STATE2_6 | PLAYER_STATE2_8; if (func_80832CB0(play, this, anim)) { @@ -11918,6 +11940,7 @@ void Player_Action_8084B9E4(Player* this, PlayState* play) { if (LinkAnimation_OnFrame(&this->skelAnime, 11.0f)) { func_80832698(this, NA_SE_VO_LI_PUSH); } + if (!IS_DEBUG) {} } else { Player_ProcessAnimSfxList(this, D_80854878); } @@ -11926,6 +11949,10 @@ void Player_Action_8084B9E4(Player* this, PlayState* play) { func_8083F524(play, this); if (!func_8083F9D0(play, this)) { + f32 speedTarget; + s16 yawTarget; + s32 temp1; + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); temp1 = func_8083FFB8(this, &speedTarget, &yawTarget); if (temp1 > 0) { @@ -11938,6 +11965,13 @@ void Player_Action_8084B9E4(Player* this, PlayState* play) { } if (this->stateFlags2 & PLAYER_STATE2_4) { + Vec3f sp5C; + f32 temp2; + CollisionPoly* sp54; + s32 sp50; + Vec3f sp44; + Vec3f sp38; + temp2 = func_8083973C(play, this, &D_80854880, &sp5C) - this->actor.world.pos.y; if (fabsf(temp2) < 20.0f) { sp44.x = this->actor.world.pos.x; @@ -12040,7 +12074,7 @@ void Player_Action_8084BF1C(Player* this, PlayState* play) { Vec3f sp6C; s32 sp68; Vec3f sp5C; - f32 temp_f0; + DynaPolyActor* wallPolyActor; LinkAnimationHeader* anim1; LinkAnimationHeader* anim2; @@ -12074,7 +12108,7 @@ void Player_Action_8084BF1C(Player* this, PlayState* play) { if (this->av2.actionVar2 >= 0) { if ((this->actor.wallPoly != NULL) && (this->actor.wallBgId != BGCHECK_SCENE)) { - DynaPolyActor* wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); + wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); if (wallPolyActor != NULL) { Math_Vec3f_Diff(&wallPolyActor->actor.world.pos, &wallPolyActor->actor.prevPos, &sp6C); Math_Vec3f_Sum(&this->actor.world.pos, &sp6C, &this->actor.world.pos); @@ -12094,6 +12128,8 @@ void Player_Action_8084BF1C(Player* this, PlayState* play) { } if (sp84 != 0) { + f32 temp_f0; + sp68 = this->av1.actionVar1 + this->av2.actionVar2; if (sp84 > 0) { @@ -12653,14 +12689,14 @@ void func_8084D5CC(PlayState* play, Player* this) { } void Player_Action_8084D610(Player* this, PlayState* play) { - f32 speedTarget; - s16 yawTarget; - func_80832CB0(play, this, &gPlayerAnim_link_swimer_swim_wait); func_8084B000(this); if (!func_8083224C(play) && !Player_TryActionChangeList(play, this, sActionChangeList11, true) && !func_8083D12C(play, this, sControlInput)) { + f32 speedTarget; + s16 yawTarget; + if (this->unk_6AD != 1) { this->unk_6AD = 0; } @@ -13002,12 +13038,12 @@ void Player_Action_8084E3C4(Player* this, PlayState* play) { if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); - if ((this->targetActor != NULL) && (this->targetActor == this->unk_6A8)) { - func_80853148(play, this->targetActor); + if ((this->talkActor != NULL) && (this->talkActor == this->unk_6A8)) { + func_80853148(play, this->talkActor); } else if (this->naviTextId < 0) { - this->targetActor = this->naviActor; + this->talkActor = this->naviActor; this->naviActor->textId = -this->naviTextId; - func_80853148(play, this->targetActor); + func_80853148(play, this->talkActor); } else if (!Player_ActionChange_13(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_okarina_end, play); } @@ -13015,6 +13051,8 @@ void Player_Action_8084E3C4(Player* this, PlayState* play) { this->stateFlags2 &= ~(PLAYER_STATE2_23 | PLAYER_STATE2_24 | PLAYER_STATE2_25); this->unk_6A8 = NULL; } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_02) { + s32 pad; + gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex = sWarpSongEntrances[play->msgCtx.lastPlayedSong]; gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams = 0x5FF; gSaveContext.respawn[RESPAWN_MODE_RETURN].data = play->msgCtx.lastPlayedSong; @@ -13069,8 +13107,8 @@ void Player_Action_8084E6D4(Player* this, PlayState* play) { } if (func_8084DFF4(play, this) && (this->av2.actionVar2 == 1)) { - cond = ((this->targetActor != NULL) && (this->exchangeItemId < 0)) || - (this->stateFlags3 & PLAYER_STATE3_5); + cond = + ((this->talkActor != NULL) && (this->exchangeItemId < 0)) || (this->stateFlags3 & PLAYER_STATE3_5); if (cond || (gSaveContext.healthAccumulator == 0)) { if (cond) { @@ -13078,7 +13116,7 @@ void Player_Action_8084E6D4(Player* this, PlayState* play) { this->exchangeItemId = EXCH_ITEM_NONE; if (func_8084B4D4(play, this) == 0) { - func_80853148(play, this->targetActor); + func_80853148(play, this->talkActor); } } else { func_8084DFAC(play, this); @@ -13166,13 +13204,13 @@ void Player_Action_8084E9AC(Player* this, PlayState* play) { } } -static u8 D_808549FC[] = { - 0x01, 0x03, 0x02, 0x04, 0x04, -}; - void Player_Action_8084EAC0(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->av2.actionVar2 == 0) { + static u8 D_808549FC[] = { + 0x01, 0x03, 0x02, 0x04, 0x04, + }; + if (this->itemAction == PLAYER_IA_BOTTLE_POE) { s32 rand = Rand_S16Offset(-1, 3); @@ -13207,11 +13245,10 @@ void Player_Action_8084EAC0(Player* this, PlayState* play) { Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_wait); this->av2.actionVar2 = 1; - return; + } else { + func_8083C0E8(this, play); + Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); } - - func_8083C0E8(this, play); - Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); } else if (this->av2.actionVar2 == 1) { if ((gSaveContext.healthAccumulator == 0) && (gSaveContext.magicState != MAGIC_STATE_FILL)) { Player_AnimChangeOnceMorphAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_end); @@ -13332,10 +13369,7 @@ void Player_Action_8084EFC0(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_8083C0E8(this, play); Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); - return; - } - - if (LinkAnimation_OnFrame(&this->skelAnime, 76.0f)) { + } else if (LinkAnimation_OnFrame(&this->skelAnime, 76.0f)) { BottleDropInfo* dropInfo = &D_80854A28[this->itemAction - PLAYER_IA_BOTTLE_FISH]; Actor_Spawn(&play->actorCtx, play, dropInfo->actorId, @@ -13344,10 +13378,9 @@ void Player_Action_8084EFC0(Player* this, PlayState* play) { 0, dropInfo->actorParams); Player_UpdateBottleHeld(play, this, ITEM_BOTTLE_EMPTY, PLAYER_IA_BOTTLE); - return; + } else { + Player_ProcessAnimSfxList(this, D_80854A34); } - - Player_ProcessAnimSfxList(this, D_80854A34); } static AnimSfxEntry D_80854A3C[] = { @@ -13361,14 +13394,14 @@ void Player_Action_8084F104(Player* this, PlayState* play) { if (this->av2.actionVar2 < 0) { func_8083C0E8(this, play); } else if (this->exchangeItemId == EXCH_ITEM_NONE) { - Actor* targetActor = this->targetActor; + Actor* talkActor = this->talkActor; this->unk_862 = 0; - if (targetActor->textId != 0xFFFF) { + if (talkActor->textId != 0xFFFF) { this->actor.flags |= ACTOR_FLAG_TALK; } - func_80853148(play, targetActor); + func_80853148(play, talkActor); } else { GetItemEntry* giEntry = &sGetItemTable[D_80854528[this->exchangeItemId - 1] - 1]; @@ -13377,6 +13410,8 @@ void Player_Action_8084F104(Player* this, PlayState* play) { } if (this->av2.actionVar2 == 0) { + s32 pad; + Message_StartTextbox(play, this->actor.textId, &this->actor); if ((this->itemAction == PLAYER_IA_CHICKEN) || (this->itemAction == PLAYER_IA_POCKET_CUCCO)) { @@ -13633,75 +13668,99 @@ void Player_Action_8084FBF4(Player* this, PlayState* play) { func_8002F8F0(&this->actor, NA_SE_VO_LI_TAKEN_AWAY - SFX_FLAG + this->ageProperties->unk_92); } -s32 func_8084FCAC(Player* this, PlayState* play) { - sControlInput = &play->state.input[0]; +#if IS_DEBUG +/** + * Updates the "Noclip" debug feature, which allows the player to fly around anywhere + * in the world and clip through any collision. + * + * Noclip can be toggled on and off with two different button combos: + * Hold L + R + A and press B + * or + * Hold L and press D-pad right + * + * To control Noclip mode: + * - Move horizontally with the 4 D-pad directions + * - Move up with B + * - Move down with A + * - Hold R to move faster + * + * With Noclip enabled, another button combination can be pressed to set all "temp clear" flags + * in the current room. To do so hold L and press D-pad left. + * + * @return true if Noclip is disabled, false if enabled + */ +s32 Player_UpdateNoclip(Player* this, PlayState* play) { + if (ENABLE_NO_CLIP) { + sControlInput = &play->state.input[0]; - if ((CHECK_BTN_ALL(sControlInput->cur.button, BTN_A | BTN_L | BTN_R) && - CHECK_BTN_ALL(sControlInput->press.button, BTN_B)) || - (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DRIGHT))) { + if ((CHECK_BTN_ALL(sControlInput->cur.button, BTN_L | BTN_R | BTN_A) && + CHECK_BTN_ALL(sControlInput->press.button, BTN_B)) || + (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && + CHECK_BTN_ALL(sControlInput->press.button, BTN_DRIGHT))) { - D_808535D0 ^= 1; + sNoclipEnabled ^= 1; - if (D_808535D0) { - Camera_RequestMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_Z_AIM); - } - } - - if (D_808535D0) { - f32 speed; - - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { - speed = 100.0f; - } else { - speed = 20.0f; + if (sNoclipEnabled) { + Camera_RequestMode(Play_GetCamera(play, CAM_ID_MAIN), CAM_MODE_Z_AIM); + } } - DebugCamera_ScreenText(3, 2, "DEBUG MODE"); + if (sNoclipEnabled) { + f32 speed; - if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_L)) { - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { - this->actor.world.pos.y += speed; - } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A)) { - this->actor.world.pos.y -= speed; + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { + speed = 100.0f; + } else { + speed = 20.0f; } - if (CHECK_BTN_ANY(sControlInput->cur.button, BTN_DUP | BTN_DLEFT | BTN_DDOWN | BTN_DRIGHT)) { - s16 angle; - s16 temp; + DebugCamera_ScreenText(3, 2, "DEBUG MODE"); - angle = temp = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); - - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_DDOWN)) { - angle = temp + 0x8000; - } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_DLEFT)) { - angle = temp + 0x4000; - } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_DRIGHT)) { - angle = temp - 0x4000; + if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { + this->actor.world.pos.y += speed; + } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A)) { + this->actor.world.pos.y -= speed; } - this->actor.world.pos.x += speed * Math_SinS(angle); - this->actor.world.pos.z += speed * Math_CosS(angle); + if (CHECK_BTN_ANY(sControlInput->cur.button, BTN_DUP | BTN_DLEFT | BTN_DDOWN | BTN_DRIGHT)) { + s16 angle; + s16 temp; + + angle = temp = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); + + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_DDOWN)) { + angle = temp + 0x8000; + } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_DLEFT)) { + angle = temp + 0x4000; + } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_DRIGHT)) { + angle = temp - 0x4000; + } + + this->actor.world.pos.x += speed * Math_SinS(angle); + this->actor.world.pos.z += speed * Math_CosS(angle); + } } + + Player_ZeroSpeedXZ(this); + + this->actor.gravity = 0.0f; + this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; + + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && + CHECK_BTN_ALL(sControlInput->press.button, BTN_DLEFT)) { + Flags_SetTempClear(play, play->roomCtx.curRoom.num); + } + + Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); + + return false; } - - Player_ZeroSpeedXZ(this); - - this->actor.gravity = 0.0f; - this->actor.velocity.z = 0.0f; - this->actor.velocity.y = 0.0f; - this->actor.velocity.x = 0.0f; - - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DLEFT)) { - Flags_SetTempClear(play, play->roomCtx.curRoom.num); - } - - Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); - - return 0; } - return 1; + return true; } +#endif void func_8084FF7C(Player* this) { this->unk_858 += this->unk_85C; @@ -13891,7 +13950,7 @@ void Player_Action_8085063C(Player* this, PlayState* play) { if (play->msgCtx.choiceIndex == 1) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = -respawnData; - gSaveContext.save.info.fw.set = 0; + gSaveContext.save.info.fwMain.set = 0; Sfx_PlaySfxAtPos(&gSaveContext.respawn[RESPAWN_MODE_TOP].pos, NA_SE_PL_MAGIC_WIND_VANISH); } @@ -13936,27 +13995,6 @@ static LinkAnimationHeader* D_80854A70[] = { static u8 D_80854A7C[] = { 70, 10, 10 }; -static AnimSfxEntry D_80854A80[] = { - { NA_SE_PL_SKIP, ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, - { NA_SE_VO_LI_SWORD_N, ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 26) }, -}; - -static AnimSfxEntry D_80854A8C[][2] = { - { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, - { NA_SE_VO_LI_MAGIC_FROL, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 30) }, - }, - { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, - { NA_SE_VO_LI_MAGIC_NALE, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 44) }, - }, - { - { NA_SE_VO_LI_MAGIC_ATTACK, ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, - { NA_SE_IT_SWORD_SWING_HARD, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, - }, -}; - void Player_Action_808507F4(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->av1.actionVar1 < 0) { @@ -13993,22 +14031,44 @@ void Player_Action_808507F4(Player* this, PlayState* play) { if (this->av2.actionVar2 == 0) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = 1; Play_SetupRespawnPoint(play, RESPAWN_MODE_TOP, 0x6FF); - gSaveContext.save.info.fw.set = 1; - gSaveContext.save.info.fw.pos.x = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.x; - gSaveContext.save.info.fw.pos.y = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.y; - gSaveContext.save.info.fw.pos.z = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.z; - gSaveContext.save.info.fw.yaw = gSaveContext.respawn[RESPAWN_MODE_DOWN].yaw; - gSaveContext.save.info.fw.playerParams = 0x6FF; - gSaveContext.save.info.fw.entranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex; - gSaveContext.save.info.fw.roomIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].roomIndex; - gSaveContext.save.info.fw.tempSwchFlags = gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags; - gSaveContext.save.info.fw.tempCollectFlags = gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags; + gSaveContext.save.info.fwMain.set = 1; + gSaveContext.save.info.fwMain.pos.x = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.x; + gSaveContext.save.info.fwMain.pos.y = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.y; + gSaveContext.save.info.fwMain.pos.z = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.z; + gSaveContext.save.info.fwMain.yaw = gSaveContext.respawn[RESPAWN_MODE_DOWN].yaw; + gSaveContext.save.info.fwMain.playerParams = 0x6FF; + gSaveContext.save.info.fwMain.entranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex; + gSaveContext.save.info.fwMain.roomIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].roomIndex; + gSaveContext.save.info.fwMain.tempSwchFlags = gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags; + gSaveContext.save.info.fwMain.tempCollectFlags = + gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags; this->av2.actionVar2 = 2; } } else if (this->av1.actionVar1 >= 0) { if (this->av2.actionVar2 == 0) { + static AnimSfxEntry D_80854A80[] = { + { NA_SE_PL_SKIP, ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, + { NA_SE_VO_LI_SWORD_N, ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 26) }, + }; + Player_ProcessAnimSfxList(this, D_80854A80); } else if (this->av2.actionVar2 == 1) { + static AnimSfxEntry D_80854A8C[][2] = { + { + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, + { NA_SE_VO_LI_MAGIC_FROL, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 30) }, + }, + { + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, + { NA_SE_VO_LI_MAGIC_NALE, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 44) }, + }, + { + { NA_SE_VO_LI_MAGIC_ATTACK, ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, + { NA_SE_IT_SWORD_SWING_HARD, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, + }, + }; + Player_ProcessAnimSfxList(this, D_80854A8C[this->av1.actionVar1]); if ((this->av1.actionVar1 == 2) && LinkAnimation_OnFrame(&this->skelAnime, 30.0f)) { this->stateFlags1 &= ~(PLAYER_STATE1_28 | PLAYER_STATE1_29); @@ -14025,8 +14085,6 @@ void Player_Action_808507F4(Player* this, PlayState* play) { } void Player_Action_80850AEC(Player* this, PlayState* play) { - f32 temp; - this->stateFlags2 |= PLAYER_STATE2_5; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -14036,13 +14094,13 @@ void Player_Action_80850AEC(Player* this, PlayState* play) { Math_Vec3f_Sum(&this->actor.world.pos, &this->actor.velocity, &this->actor.world.pos); if (func_80834FBC(this)) { + f32 temp; + Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.world.pos); Player_ProcessSceneCollision(play, this); temp = this->actor.world.pos.y - this->actor.floorHeight; - if (temp > 20.0f) { - temp = 20.0f; - } + temp = CLAMP_MAX(temp, 20.0f); this->actor.world.rot.x = this->actor.shape.rot.x = 0; this->actor.world.pos.y -= temp; @@ -14052,10 +14110,7 @@ void Player_Action_80850AEC(Player* this, PlayState* play) { this->stateFlags2 &= ~PLAYER_STATE2_10; this->actor.bgCheckFlags |= BGCHECKFLAG_GROUND; this->stateFlags1 |= PLAYER_STATE1_2; - return; - } - - if ((this->skelAnime.animation != &gPlayerAnim_link_hook_fly_start) || (4.0f <= this->skelAnime.curFrame)) { + } else if ((this->skelAnime.animation != &gPlayerAnim_link_hook_fly_start) || (4.0f <= this->skelAnime.curFrame)) { this->actor.gravity = 0.0f; Math_ScaledStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x, 0x800); Player_RequestRumble(this, 100, 2, 100, 0); @@ -15121,7 +15176,6 @@ void func_80852C0C(PlayState* play, Player* this, s32 csAction) { void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cueUnused) { CsCmdActorCue* cue = play->csCtx.playerCue; s32 pad; - s32 csAction; if (play->csCtx.state == CS_STATE_STOP) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); @@ -15132,34 +15186,35 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cueUnused) { if (cue == NULL) { this->actor.flags &= ~ACTOR_FLAG_6; - return; - } + } else { + s32 csAction; - if (this->cueId != cue->id) { - csAction = sCueToCsActionMap[cue->id]; + if (this->cueId != cue->id) { + csAction = sCueToCsActionMap[cue->id]; - if (csAction >= PLAYER_CSACTION_NONE) { - if ((csAction == PLAYER_CSACTION_3) || (csAction == PLAYER_CSACTION_4)) { - func_80852A54(play, this, cue); - } else { - func_808529D0(play, this, cue); + if (csAction >= PLAYER_CSACTION_NONE) { + if ((csAction == PLAYER_CSACTION_3) || (csAction == PLAYER_CSACTION_4)) { + func_80852A54(play, this, cue); + } else { + func_808529D0(play, this, cue); + } } + + D_80858AA0 = this->skelAnime.moveFlags; + + func_80832DBC(this); + PRINTF("TOOL MODE=%d\n", csAction); + func_80852C0C(play, this, ABS(csAction)); + func_80852B4C(play, this, cue, &D_80854B18[ABS(csAction)]); + + this->av2.actionVar2 = 0; + this->av1.actionVar1 = 0; + this->cueId = cue->id; } - D_80858AA0 = this->skelAnime.moveFlags; - - func_80832DBC(this); - PRINTF("TOOL MODE=%d\n", csAction); - func_80852C0C(play, this, ABS(csAction)); - func_80852B4C(play, this, cue, &D_80854B18[ABS(csAction)]); - - this->av2.actionVar2 = 0; - this->av1.actionVar1 = 0; - this->cueId = cue->id; + csAction = sCueToCsActionMap[this->cueId]; + func_80852B4C(play, this, cue, &D_80854E50[ABS(csAction)]); } - - csAction = sCueToCsActionMap[this->cueId]; - func_80852B4C(play, this, cue, &D_80854E50[ABS(csAction)]); } void Player_Action_CsAction(Player* this, PlayState* play) { @@ -15250,12 +15305,12 @@ void func_80853148(PlayState* play, Actor* actor) { Player* this = GET_PLAYER(play); s32 pad; - if ((this->targetActor != NULL) || (actor == this->naviActor) || + if ((this->talkActor != NULL) || (actor == this->naviActor) || CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_18)) { actor->flags |= ACTOR_FLAG_TALK; } - this->targetActor = actor; + this->talkActor = actor; this->exchangeItemId = EXCH_ITEM_NONE; if (actor->textId == 0xFFFF) { @@ -15308,7 +15363,7 @@ void func_80853148(PlayState* play, Actor* actor) { this->stateFlags1 |= PLAYER_STATE1_6 | PLAYER_STATE1_29; } - if ((this->naviActor == this->targetActor) && ((this->targetActor->textId & 0xFF00) != 0x200)) { + if ((this->naviActor == this->talkActor) && ((this->talkActor->textId & 0xFF00) != 0x200)) { this->naviActor->flags |= ACTOR_FLAG_TALK; func_80835EA4(play, 0xB); } diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c index aed5572b3..5edefefc2 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c @@ -63,6 +63,7 @@ void EffectSsBomb_Draw(PlayState* play, u32 index, EffectSs* this) { SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); + if (1) {} SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult); diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c index 401328c4f..34572a978 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c @@ -124,6 +124,7 @@ void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this) { scale = this->rScale * 0.01f; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); + if (1) {} SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard); SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult); 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 4387b9284..8f6eb2e9f 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 @@ -58,10 +58,7 @@ void EffectSsBubble_Draw(PlayState* play, u32 index, EffectSs* this) { void EffectSsBubble_Update(PlayState* play, u32 index, EffectSs* this) { WaterBox* waterBox; - f32 waterSurfaceY; - Vec3f ripplePos; - - waterSurfaceY = this->pos.y; + f32 waterSurfaceY = this->pos.y; // kill bubble if it's out of range of a water box if (!WaterBox_GetSurface1(play, &play->colCtx, this->pos.x, this->pos.z, &waterSurfaceY, &waterBox)) { @@ -70,6 +67,8 @@ void EffectSsBubble_Update(PlayState* play, u32 index, EffectSs* this) { } if (waterSurfaceY < this->pos.y) { + Vec3f ripplePos; + ripplePos.x = this->pos.x; ripplePos.y = waterSurfaceY; ripplePos.z = this->pos.z; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c index a0cfd80c3..dff7cea06 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c @@ -29,7 +29,6 @@ EffectSsInit Effect_Ss_Dead_Dd_InitVars = { }; u32 EffectSsDeadDd_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { - s32 i; EffectSsDeadDdInitParams* initParams = (EffectSsDeadDdInitParams*)initParamsx; if (initParams->type == 0) { @@ -58,6 +57,8 @@ u32 EffectSsDeadDd_Init(PlayState* play, u32 index, EffectSs* this, void* initPa this->rEnvColorB = initParams->envColor.b; } else if (initParams->type == 1) { + s32 i; + this->life = initParams->life; this->rScaleStep = initParams->scaleStep; this->rAlphaMode = 0; diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c index 1910c5914..62dfc4472 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c @@ -37,7 +37,6 @@ static EffectSsUpdateFunc sUpdateFuncs[] = { }; u32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { - s32 randColorOffset; EffectSsDustInitParams* initParams = (EffectSsDustInitParams*)initParamsx; Math_Vec3f_Copy(&this->pos, &initParams->pos); @@ -49,7 +48,8 @@ u32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initPara this->draw = EffectSsDust_Draw; if (initParams->drawFlags & 4) { - randColorOffset = Rand_ZeroOne() * 20.0f - 10.0f; + s32 randColorOffset = Rand_ZeroOne() * 20.0f - 10.0f; + this->rPrimColorR = initParams->primColor.r + randColorOffset; this->rPrimColorG = initParams->primColor.g + randColorOffset; this->rPrimColorB = initParams->primColor.b + randColorOffset; 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 618759146..471bed5f7 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 @@ -26,13 +26,11 @@ EffectSsInit Effect_Ss_Extra_InitVars = { u32 EffectSsExtra_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsExtraInitParams* initParams = (EffectSsExtraInitParams*)initParamsx; s32 pad; - s32 objectSlot; - uintptr_t oldSeg6; - - objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_YABUSAME_POINT); + s32 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_YABUSAME_POINT); if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { - oldSeg6 = gSegments[6]; + uintptr_t oldSeg6 = gSegments[6]; + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); this->pos = initParams->pos; this->velocity = initParams->velocity; diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index 186ed8876..c427ddca6 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -172,21 +172,20 @@ void EffectSsFhgFlash_UpdateLightBall(PlayState* play, u32 index, EffectSs* this void EffectSsFhgFlash_UpdateShock(PlayState* play, u32 index, EffectSs* this) { s16 randBodyPart; - Player* player; - BossGanondrof* phantomGanon; - s16 rotStep; + s16 rotStep = Rand_ZeroOne() * 20000.0f; - rotStep = Rand_ZeroOne() * 20000.0f; this->rXZRot += rotStep + 0x4000; if (this->rParam == FHGFLASH_SHOCK_PLAYER) { - player = GET_PLAYER(play); + Player* player = GET_PLAYER(play); + randBodyPart = Rand_ZeroFloat(PLAYER_BODYPART_MAX - 0.1f); this->pos.x = player->bodyPartsPos[randBodyPart].x + Rand_CenteredFloat(10.0f); this->pos.y = player->bodyPartsPos[randBodyPart].y + Rand_CenteredFloat(15.0f); this->pos.z = player->bodyPartsPos[randBodyPart].z + Rand_CenteredFloat(10.0f); } else if (this->rParam == FHGFLASH_SHOCK_PG) { - phantomGanon = (BossGanondrof*)this->actor; + BossGanondrof* phantomGanon = (BossGanondrof*)this->actor; + randBodyPart = Rand_ZeroFloat(23.9f); this->pos.x = phantomGanon->bodyPartsPos[randBodyPart].x + Rand_CenteredFloat(15.0f); this->pos.y = phantomGanon->bodyPartsPos[randBodyPart].y + Rand_CenteredFloat(20.0f); @@ -194,6 +193,8 @@ void EffectSsFhgFlash_UpdateShock(PlayState* play, u32 index, EffectSs* this) { } if (this->life < 100) { + s32 pad; + this->rAlpha -= 50; if (this->rAlpha < 0) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c index 89bd57929..3e8c54d8a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c @@ -24,12 +24,12 @@ u32 EffectSsIceSmoke_Init(PlayState* play, u32 index, EffectSs* this, void* init EffectSsIceSmokeInitParams* initParams = (EffectSsIceSmokeInitParams*)initParamsx; s32 pad; s32 objectSlot; - uintptr_t prevSeg6; objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_FZ); if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { - prevSeg6 = gSegments[6]; + uintptr_t prevSeg6 = gSegments[6]; + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment); Math_Vec3f_Copy(&this->pos, &initParams->pos); Math_Vec3f_Copy(&this->velocity, &initParams->velocity); @@ -61,6 +61,10 @@ void EffectSsIceSmoke_Draw(PlayState* play, u32 index, EffectSs* this) { OPEN_DISPS(play->state.gfxCtx, "../z_eff_ss_ice_smoke.c", 155); +#if !IS_DEBUG + if (1) {} +#endif + objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_FZ); if ((objectSlot >= 0) && Object_IsLoaded(&play->objectCtx, objectSlot)) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c index b466818ad..7a2684f48 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c @@ -78,9 +78,11 @@ u32 EffectSsKakera_Init(PlayState* play, u32 index, EffectSs* this, void* initPa f32 func_809A9818(f32 arg0, f32 arg1) { f32 temp_f2; +#if IS_DEBUG if (arg1 < 0.0f) { PRINTF("範囲ãŒãƒžã‚¤ãƒŠã‚¹ï¼ï¼(randomD_sectionUniformity)\n"); } +#endif temp_f2 = Rand_ZeroOne() * arg1; return ((temp_f2 * 2.0f) - arg1) + arg0; 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 7aaa867f8..5ee3a70cb 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 @@ -79,10 +79,9 @@ void EffectSsSibuki_Draw(PlayState* play, u32 index, EffectSs* this) { } void EffectSsSibuki_Update(PlayState* play, u32 index, EffectSs* this) { - s32 pad[3]; - f32 xzVelScale; - s16 yaw; Player* player = GET_PLAYER(play); + s32 pad[2]; + f32 xzVelScale; if (this->pos.y <= player->actor.floorHeight) { this->life = 0; @@ -92,7 +91,8 @@ void EffectSsSibuki_Update(PlayState* play, u32 index, EffectSs* this) { this->rMoveDelay--; if (this->rMoveDelay == 0) { - yaw = Camera_GetInputDirYaw(Play_GetCamera(play, CAM_ID_MAIN)); + s16 yaw = Camera_GetInputDirYaw(Play_GetCamera(play, CAM_ID_MAIN)); + xzVelScale = ((200.0f + KREG(20)) * 0.01f) + ((0.1f * Rand_ZeroOne()) * (KREG(23) + 20.0f)); if (this->rDirection != 0) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c index af8e8e9a1..45846446f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_eff_ss_stone1.c @@ -62,6 +62,7 @@ void EffectSsStone1_Draw(PlayState* play, u32 index, EffectSs* this) { scale = (mfW < 1500.0f) ? 3.0f : (mfW / 1500.0f) * 3.0f; Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + if (1) {} gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gfxCtx, "../z_eff_ss_stone1.c", 168), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Gfx_SetupDL_61Xlu(gfxCtx); diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 13a4e4603..e2e809ba9 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -382,7 +382,7 @@ void FileSelect_PulsateCursor(GameState* thisx) { SramContext* sramCtx = &this->sramCtx; Input* debugInput = &this->state.input[2]; -#if OOT_DEBUG +#if IS_DEBUG if (CHECK_BTN_ALL(debugInput->press.button, BTN_DLEFT)) { sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language = LANGUAGE_ENG; *((u8*)0x80000002) = LANGUAGE_ENG; @@ -1441,8 +1441,7 @@ void FileSelect_FadeOut(GameState* thisx) { void FileSelect_LoadGame(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; -#if OOT_DEBUG - if (this->buttonIndex == FS_BTN_SELECT_FILE_1) { + if (MAP_SELECT_ON_FILE_1 && this->buttonIndex == FS_BTN_SELECT_FILE_1) { Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); gSaveContext.fileNum = this->buttonIndex; @@ -1450,9 +1449,7 @@ void FileSelect_LoadGame(GameState* thisx) { gSaveContext.gameMode = GAMEMODE_NORMAL; SET_NEXT_GAMESTATE(&this->state, MapSelect_Init, MapSelectState); this->state.running = false; - } else -#endif - { + } else { Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); gSaveContext.fileNum = this->buttonIndex; @@ -1691,8 +1688,8 @@ void FileSelect_Main(GameState* thisx) { gDPLoadTextureBlock(POLY_OPA_DISP++, controlsTextures[gSaveContext.language], G_IM_FMT_IA, G_IM_SIZ_8b, 144, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(POLY_OPA_DISP++, 90 << 2, 204 << 2, 234 << 2, 220 << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, - 1 << 10); + gSPTextureRectangle(POLY_OPA_DISP++, WIDE_INCR(90, 10) << 2, 204 << 2, 234 << 2, 220 << 2, G_TX_RENDERTILE, 0, + 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); } gDPPipeSync(POLY_OPA_DISP++); diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index 7b24564cf..c6e24e310 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -7,12 +7,58 @@ #include "global.h" void TitleSetup_SetupTitleScreen(TitleSetupState* this) { - gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN; + gSaveContext.gameMode = GAMEMODE_NORMAL; + + if (IS_MAP_SELECT_ENABLED && BOOT_TO_MAP_SELECT) { + this->state.running = false; + SET_NEXT_GAMESTATE(&this->state, MapSelect_Init, MapSelectState); + return; + } + + if (BOOT_TO_FILE_SELECT) { + gSaveContext.gameMode = GAMEMODE_FILE_SELECT; + this->state.running = false; + SET_NEXT_GAMESTATE(&this->state, FileSelect_Init, FileSelectState); + return; + } + + if (BOOT_TO_SCENE || BOOT_TO_SCENE_NEW_GAME_ONLY) { + u8 i; + + if (BOOT_TO_SCENE_NEW_GAME_ONLY) { + Sram_InitNewSave(); + } else { + Sram_InitDebugSave(); + } + + gSaveContext.save.linkAge = BOOT_AGE; + gSaveContext.save.entranceIndex = BOOT_ENTRANCE; + gSaveContext.save.cutsceneIndex = BOOT_CUTSCENE; + gSaveContext.nextDayTime = BOOT_TIME; + gSaveContext.respawnFlag = 0; + gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = ENTR_LOAD_OPENING; + gWeatherMode = WEATHER_MODE_CLEAR; + gSaveContext.magicFillTarget = gSaveContext.save.info.playerData.magic; + gSaveContext.magicCapacity = 0; + gSaveContext.save.info.playerData.magicLevel = gSaveContext.save.info.playerData.magic = 0; + gSaveContext.forceRisingButtonAlphas = false; + + gSaveContext.nextHudVisibilityMode = gSaveContext.hudVisibilityMode = gSaveContext.hudVisibilityModeTimer = + HUD_VISIBILITY_NO_CHANGE; + + for (i = 0; i < ARRAY_COUNT(gSaveContext.buttonStatus); i++) { + gSaveContext.buttonStatus[i] = BTN_ENABLED; + } + } else { + gSaveContext.gameMode = GAMEMODE_TITLE_SCREEN; + gSaveContext.save.linkAge = LINK_AGE_ADULT; + Sram_InitDebugSave(); + gSaveContext.save.cutsceneIndex = 0xFFF3; + gSaveContext.sceneLayer = 7; + } + + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); this->state.running = false; - gSaveContext.save.linkAge = LINK_AGE_ADULT; - Sram_InitDebugSave(); - gSaveContext.save.cutsceneIndex = 0xFFF3; - gSaveContext.sceneLayer = 7; SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 5836fb9d0..b7bd8e9ef 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -3,11 +3,387 @@ * Overlay: ovl_select * Description: Debug Scene Select Menu */ - #include "ultra64.h" #include "global.h" #include "terminal.h" #include "alloca.h" +#include "z_select.h" + +void MapSelect_Init(GameState* thisx) { + MapSelectState* this = (MapSelectState*)thisx; + u32 size; + s32 pad; + u8 i; + + this->state.main = MapSelect_Main; + this->state.destroy = MapSelect_Destroy; + this->scenes = sScenes; + this->topDisplayedScene = 0; + this->currentScene = 0; + this->pageDownStops[0] = 0; // Hyrule Field + this->pageDownStops[1] = 19; // Temple Of Time + this->pageDownStops[2] = 37; // Treasure Chest Game + this->pageDownStops[3] = 51; // Gravekeeper's Hut + this->pageDownStops[4] = 59; // Zora Shop + this->pageDownStops[5] = 73; // Bottom of the Well + this->pageDownStops[6] = 91; // Escaping Ganon's Tower 3 + this->pageDownIndex = 0; + this->sceneTotal = ARRAY_COUNT(sScenes); + View_Init(&this->view, this->state.gfxCtx); + this->view.flags = (VIEW_PROJECTION_ORTHO | VIEW_VIEWPORT); + this->verticalInputAccumulator = 0; + this->verticalInput = 0; + this->timerUp = 0; + this->timerDown = 0; + this->lockUp = false; + this->lockDown = false; + + this->showControls = false; + this->toggleBGM = false; + this->isBGMPlaying = false; + this->sceneLayer = 0; + this->selectedSceneColor = 5; // Red by default + + size = (uintptr_t)_z_select_staticSegmentRomEnd - (uintptr_t)_z_select_staticSegmentRomStart; + + if ((dREG(80) >= 0) && (dREG(80) < this->sceneTotal)) { + this->currentScene = dREG(80); + this->topDisplayedScene = dREG(81); + this->pageDownIndex = dREG(82); + } + R_UPDATE_RATE = 1; + + gSaveContext.save.linkAge = BOOT_AGE; + gSaveContext.save.cutsceneIndex = 0xFFEF; + + // turning the sfx volume back on + SEQCMD_SET_SEQPLAYER_VOLUME(SEQ_PLAYER_BGM_MAIN, 0, 10); + +#ifdef BOOT_TO_MAP_SELECT + gSaveContext.fileNum = 0xFF; + gSaveContext.save.linkAge = BOOT_AGE; + this->sceneLayer = (BOOT_CUTSCENE > 1) ? (BOOT_CUTSCENE & 0x000F) + 2 : BOOT_CUTSCENE; + for (i = 1; i < this->sceneTotal; i++) { + if (this->scenes[i].entranceIndex == BOOT_ENTRANCE) { + this->currentScene = i; + this->topDisplayedScene = i - 1; + break; + } + } +#endif + +#ifdef MAP_SELECT_BGM + this->toggleBGM = true; +#else +#define MAP_SELECT_BGM NA_BGM_NO_MUSIC +#endif +} + +void MapSelect_Main(GameState* thisx) { + MapSelectState* this = (MapSelectState*)thisx; + + MapSelect_UpdateMenu(this); + MapSelect_Draw(this); +} + +void MapSelect_Draw(MapSelectState* this) { + GraphicsContext* gfxCtx = this->state.gfxCtx; + + OPEN_DISPS(gfxCtx, __FILE__, __LINE__); + + gSPSegment(POLY_OPA_DISP++, 0x00, NULL); + Gfx_SetupFrame(gfxCtx, 0, 0, 0); + SET_FULLSCREEN_VIEWPORT(&this->view); + View_Apply(&this->view, VIEW_ALL); + + if (!this->state.running) { + MapSelect_DrawLoadingScreen(this); + } else { + MapSelect_DrawMenu(this); + } + + CLOSE_DISPS(gfxCtx, __FILE__, __LINE__); +} + +void MapSelect_Destroy(GameState* thisx) { + PRINTF("%c", BEL); + // "view_cleanup will hang, so it won't be called" + PRINTF("*** view_cleanupã¯ãƒãƒ³ã‚°ã‚¢ãƒƒãƒ—ã™ã‚‹ã®ã§ã€å‘¼ã°ãªã„ ***\n"); +} + +void MapSelect_UpdateMenu(MapSelectState* this) { + Input* input = &this->state.input[0]; + s32 pad; + SceneSelectEntry* selectedScene; + u16 sfx, sfxIndex; + + if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { + this->showControls = !this->showControls; + Audio_PlaySfxGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + } + + // change the color of the selected scene, red by default + if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + if (this->selectedSceneColor == (ARRAY_COUNT(sColors) - 1)) { + this->selectedSceneColor = 0; + } else { + this->selectedSceneColor++; + } + + if (this->selectedSceneColor == 1) { + this->selectedSceneColor++; + } + } + + if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + if (this->selectedSceneColor == 0) { + this->selectedSceneColor = (ARRAY_COUNT(sColors) - 1); + } else { + this->selectedSceneColor--; + } + + if (this->selectedSceneColor == 1) { + this->selectedSceneColor--; + } + } + + // Play/Stop BGM + if (this->toggleBGM && !this->isBGMPlaying) { + this->isBGMPlaying = true; + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, MAP_SELECT_BGM); + } else if (!this->toggleBGM) { + this->isBGMPlaying = false; + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); + } + + // when the controls screen is shown + if (this->showControls) { + if (CHECK_BTN_ALL(input->press.button, BTN_L)) { + this->toggleBGM = !this->toggleBGM; + } + + // prevent changing the value of the main screen + return; + } + + if (this->verticalInputAccumulator == 0) { + // load the scene + if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START)) { + selectedScene = &this->scenes[this->currentScene]; + if (selectedScene->loadFunc != NULL) { + selectedScene->loadFunc(this, selectedScene->entranceIndex); + } + } + + // change age + if (CHECK_BTN_ALL(input->press.button, BTN_B)) { + gSaveContext.save.linkAge = !gSaveContext.save.linkAge; + if (LINK_IS_CHILD) { + sfxIndex = ((u16)(Rand_ZeroOne() * 100) % ARRAY_COUNT(childLinkSfx)); + sfxIndex = (sfxIndex < ARRAY_COUNT(childLinkSfx)) ? sfxIndex : 0; + sfx = childLinkSfx[sfxIndex]; + } else { + sfxIndex = ((u16)(Rand_ZeroOne() * 100) % ARRAY_COUNT(adultLinkSfx)); + sfxIndex = (sfxIndex < ARRAY_COUNT(adultLinkSfx)) ? sfxIndex : 0; + sfx = adultLinkSfx[sfxIndex]; + } + Audio_PlaySfxGeneral(sfx, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultReverb); + } + + // change scene layer + if (CHECK_BTN_ALL(input->press.button, BTN_R)) { + if (this->sceneLayer == 12) { + this->sceneLayer = 0; + } else { + this->sceneLayer++; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_Z)) { + if (this->sceneLayer == 0) { + this->sceneLayer = 12; + } else { + this->sceneLayer--; + } + } + + if (CHECK_BTN_ALL(input->press.button, BTN_R) || CHECK_BTN_ALL(input->press.button, BTN_Z)) { + Audio_PlaySfxGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + } + + // scroll up + if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) { + if (this->lockUp == true) { + this->timerUp = 0; + } + if (this->timerUp == 0) { + this->timerUp = 20; + this->lockUp = true; + Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + this->verticalInput = R_UPDATE_RATE; + } + } + + if (CHECK_BTN_ALL(input->cur.button, BTN_DUP) && this->timerUp == 0) { + Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + this->verticalInput = R_UPDATE_RATE * 3; + } + + // scroll down + if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) { + if (this->lockDown == true) { + this->timerDown = 0; + } + if (this->timerDown == 0) { + this->timerDown = 20; + this->lockDown = true; + Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + this->verticalInput = -R_UPDATE_RATE; + } + } + + if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN) && (this->timerDown == 0)) { + Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + this->verticalInput = -R_UPDATE_RATE * 3; + } + + // other scrolling options + if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) || CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) { + Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + this->verticalInput = R_UPDATE_RATE; + } + + if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT) || CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) { + Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + this->verticalInput = -R_UPDATE_RATE; + } + } + + if (CHECK_BTN_ALL(input->press.button, BTN_L)) { + this->pageDownIndex++; + this->pageDownIndex = + (this->pageDownIndex + ARRAY_COUNT(this->pageDownStops)) % ARRAY_COUNT(this->pageDownStops); + this->currentScene = this->topDisplayedScene = this->pageDownStops[this->pageDownIndex]; + } + + this->verticalInputAccumulator += this->verticalInput; + + if (this->verticalInputAccumulator < -7) { + this->verticalInput = 0; + this->verticalInputAccumulator = 0; + + this->currentScene++; + this->currentScene = (this->currentScene + this->sceneTotal) % this->sceneTotal; + + if (this->currentScene == ((this->topDisplayedScene + this->sceneTotal + 19) % this->sceneTotal)) { + this->topDisplayedScene++; + this->topDisplayedScene = (this->topDisplayedScene + this->sceneTotal) % this->sceneTotal; + } + } + + if (this->verticalInputAccumulator > 7) { + this->verticalInput = 0; + this->verticalInputAccumulator = 0; + + if (this->currentScene == this->topDisplayedScene) { + this->topDisplayedScene -= 2; + this->topDisplayedScene = (this->topDisplayedScene + this->sceneTotal) % this->sceneTotal; + } + + this->currentScene--; + this->currentScene = (this->currentScene + this->sceneTotal) % this->sceneTotal; + + if (this->currentScene == ((this->topDisplayedScene + this->sceneTotal) % this->sceneTotal)) { + this->topDisplayedScene--; + this->topDisplayedScene = (this->topDisplayedScene + this->sceneTotal) % this->sceneTotal; + } + } + + this->currentScene = (this->currentScene + this->sceneTotal) % this->sceneTotal; + this->topDisplayedScene = (this->topDisplayedScene + this->sceneTotal) % this->sceneTotal; + + dREG(80) = this->currentScene; + dREG(81) = this->topDisplayedScene; + dREG(82) = this->pageDownIndex; + + if (this->timerUp != 0) { + this->timerUp--; + } + + if (this->timerUp == 0) { + this->lockUp = false; + } + + if (this->timerDown != 0) { + this->timerDown--; + } + + if (this->timerDown == 0) { + this->lockDown = false; + } +} + +void MapSelect_DrawMenu(MapSelectState* this) { + GraphicsContext* gfxCtx = this->state.gfxCtx; + GfxPrint* printer; + + OPEN_DISPS(gfxCtx, __FILE__, __LINE__); + + gSPSegment(POLY_OPA_DISP++, 0x00, NULL); + Gfx_SetupFrame(gfxCtx, 0, 0, 0); + SET_FULLSCREEN_VIEWPORT(&this->view); + View_Apply(&this->view, VIEW_ALL); + Gfx_SetupDL_28Opa(gfxCtx); + + printer = alloca(sizeof(GfxPrint)); + GfxPrint_Init(printer); + GfxPrint_Open(printer, POLY_OPA_DISP); + + GfxPrint_SetColor(printer, 255, 155, 150, 255); + GfxPrint_SetPos(printer, 12, 2); + GfxPrint_Printf(printer, "Zelda Map Select"); + + if (!this->showControls) { + MapSelect_PrintMenu(this, printer); + MapSelect_PrintAgeSetting(this, printer, ((void)0, gSaveContext.save.linkAge)); + MapSelect_PrintSceneLayerSetting(this, printer); + } + MapSelect_PrintControls(this, printer); + + POLY_OPA_DISP = GfxPrint_Close(printer); + GfxPrint_Destroy(printer); + + CLOSE_DISPS(gfxCtx, __FILE__, __LINE__); +} + +void MapSelect_DrawLoadingScreen(MapSelectState* this) { + GraphicsContext* gfxCtx = this->state.gfxCtx; + GfxPrint* printer; + + OPEN_DISPS(gfxCtx, __FILE__, __LINE__); + + gSPSegment(POLY_OPA_DISP++, 0x00, NULL); + Gfx_SetupFrame(gfxCtx, 0, 0, 0); + SET_FULLSCREEN_VIEWPORT(&this->view); + View_Apply(&this->view, VIEW_ALL); + Gfx_SetupDL_28Opa(gfxCtx); + + printer = alloca(sizeof(GfxPrint)); + GfxPrint_Init(printer); + GfxPrint_Open(printer, POLY_OPA_DISP); + MapSelect_PrintLoadingMessage(this, printer, 15); + POLY_OPA_DISP = GfxPrint_Close(printer); + GfxPrint_Destroy(printer); + + CLOSE_DISPS(gfxCtx, __FILE__, __LINE__); +} void MapSelect_LoadTitle(MapSelectState* this) { this->state.running = false; @@ -32,729 +408,170 @@ void MapSelect_LoadGame(MapSelectState* this, s32 entranceIndex) { gSaveContext.forceRisingButtonAlphas = gSaveContext.nextHudVisibilityMode = gSaveContext.hudVisibilityMode = gSaveContext.hudVisibilityModeTimer = 0; // false, HUD_VISIBILITY_NO_CHANGE SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0); - gSaveContext.save.entranceIndex = entranceIndex; + gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = gSaveContext.save.entranceIndex = entranceIndex; gSaveContext.respawnFlag = 0; - gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = ENTR_LOAD_OPENING; gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = 0xFF; gSaveContext.showTitleCard = true; gWeatherMode = WEATHER_MODE_CLEAR; - this->state.running = false; SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } -// "Translation" (Actual name) -static SceneSelectEntry sScenes[] = { - { " 1:SPOT00", MapSelect_LoadGame, ENTR_HYRULE_FIELD_0 }, - { " 2:SPOT01", MapSelect_LoadGame, ENTR_KAKARIKO_VILLAGE_0 }, - { " 3:SPOT02", MapSelect_LoadGame, ENTR_GRAVEYARD_0 }, - { " 4:SPOT03", MapSelect_LoadGame, ENTR_ZORAS_RIVER_0 }, - { " 5:SPOT04", MapSelect_LoadGame, ENTR_KOKIRI_FOREST_0 }, - { " 6:SPOT05", MapSelect_LoadGame, ENTR_SACRED_FOREST_MEADOW_0 }, - { " 7:SPOT06", MapSelect_LoadGame, ENTR_LAKE_HYLIA_0 }, - { " 8:SPOT07", MapSelect_LoadGame, ENTR_ZORAS_DOMAIN_0 }, - { " 9:SPOT08", MapSelect_LoadGame, ENTR_ZORAS_FOUNTAIN_0 }, - { "10:SPOT09", MapSelect_LoadGame, ENTR_GERUDO_VALLEY_0 }, - { "11:SPOT10", MapSelect_LoadGame, ENTR_LOST_WOODS_0 }, - { "12:SPOT11", MapSelect_LoadGame, ENTR_DESERT_COLOSSUS_0 }, - { "13:SPOT12", MapSelect_LoadGame, ENTR_GERUDOS_FORTRESS_0 }, - { "14:SPOT13", MapSelect_LoadGame, ENTR_HAUNTED_WASTELAND_0 }, - { "15:SPOT15", MapSelect_LoadGame, ENTR_HYRULE_CASTLE_0 }, - { "16:SPOT16", MapSelect_LoadGame, ENTR_DEATH_MOUNTAIN_TRAIL_0 }, - { "17:SPOT17", MapSelect_LoadGame, ENTR_DEATH_MOUNTAIN_CRATER_0 }, - { "18:SPOT18", MapSelect_LoadGame, ENTR_GORON_CITY_0 }, - { "19:SPOT20", MapSelect_LoadGame, ENTR_LON_LON_RANCH_0 }, - // "20: Chamber of Time" - { "20:" GFXP_HIRAGANA "トキノï¾", MapSelect_LoadGame, ENTR_TEMPLE_OF_TIME_0 }, - // "21: Chamber of the Sages" - { "21:" GFXP_HIRAGANA "ï½¹ï¾ï½¼ï¾žï½¬ï¾‰ï¾", MapSelect_LoadGame, ENTR_CHAMBER_OF_THE_SAGES_0 }, - // "22: Target Range" - { "22:" GFXP_HIRAGANA "シャテキジョウ", MapSelect_LoadGame, ENTR_SHOOTING_GALLERY_0 }, - // "23: Hyrule Garden Game" - { "23:" GFXP_KATAKANA "ハイラル" GFXP_HIRAGANA "ニワ" GFXP_KATAKANA "ゲーム", MapSelect_LoadGame, - ENTR_CASTLE_COURTYARD_GUARDS_DAY_0 }, - // "24: Grave Dive Hole" - { "24:" GFXP_HIRAGANA "ハカシタトビコï¾ï½±ï¾…", MapSelect_LoadGame, ENTR_REDEAD_GRAVE_0 }, - // "25: Grave Dive Hole 2" - { "25:" GFXP_HIRAGANA "ハカシタトビコï¾ï½±ï¾… 2", MapSelect_LoadGame, ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN_0 }, - // "26: Royal Family's Grave" - { "26:" GFXP_HIRAGANA "オウケ ノ ハカアナ", MapSelect_LoadGame, ENTR_ROYAL_FAMILYS_TOMB_0 }, - // "27: Great Fairy's Fountain" - { "27:" GFXP_HIRAGANA "ダイヨウセイノイズï¾", MapSelect_LoadGame, ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0 }, - // "28: Fairy Dive Hole" - { "28:" GFXP_HIRAGANA "ï¾„ï¾‹ï¾žï½ºï¾ ï¾–ï½³ï½¾ï½² アナ", MapSelect_LoadGame, ENTR_FAIRYS_FOUNTAIN_0 }, - // "29: Magic Stone Fairy's Fountain" - { "29:" GFXP_HIRAGANA "ï¾ï¾Žï½³ï½¾ï½· ヨウセイノイズï¾", MapSelect_LoadGame, ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0 }, - // "30: Final Battle With Ganon" - { "30:" GFXP_KATAKANA "ガノï¾" GFXP_HIRAGANA "サイシュウセï¾", MapSelect_LoadGame, ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_0 }, - // "31: Hyrule Inner Garden" - { "31:" GFXP_KATAKANA "ハイラル" GFXP_HIRAGANA "ナカニワ", MapSelect_LoadGame, ENTR_CASTLE_COURTYARD_ZELDA_0 }, - // "32: Fishing" - { "32:" GFXP_HIRAGANA "ツリボリ", MapSelect_LoadGame, ENTR_FISHING_POND_0 }, - // "33: Bombchu Bowling" - { "33:" GFXP_KATAKANA "ボムï¾ï½­ï½³ï¾Žï¾žï½°ï¾˜ï¾ï½¸ï¾ž", MapSelect_LoadGame, ENTR_BOMBCHU_BOWLING_ALLEY_0 }, - // "34: Lon Lon Ranch - Storehouse 1" (Talon's House) - { "34:" GFXP_KATAKANA "ï¾›ï¾ï¾›ï¾" GFXP_HIRAGANA "ボクジョウ ソウコ 1", MapSelect_LoadGame, ENTR_LON_LON_BUILDINGS_0 }, - // "35: Lon Lon Ranch - Storehouse 2" (Ranch Silo) - { "35:" GFXP_KATAKANA "ï¾›ï¾ï¾›ï¾" GFXP_HIRAGANA "ボクジョウ ソウコ 2", MapSelect_LoadGame, ENTR_LON_LON_BUILDINGS_1 }, - // "36: Lookout Hut" - { "36:" GFXP_HIRAGANA "ï¾ï¾Šï¾˜ ゴヤ", MapSelect_LoadGame, ENTR_MARKET_GUARD_HOUSE_0 }, - // "37: Magic Potion Shop" - { "37:" GFXP_HIRAGANA "ï¾ï¾Žï½³ ノ クスリヤ", MapSelect_LoadGame, ENTR_POTION_SHOP_GRANNY_0 }, - // "38: Treasure Chest Shop" - { "38:" GFXP_HIRAGANA "タカラバコヤ", MapSelect_LoadGame, ENTR_TREASURE_BOX_SHOP_0 }, - // "39: Gold Skulltula House" - { "39:" GFXP_HIRAGANA "ï½·ï¾ " GFXP_KATAKANA "スタルï¾ï½­ï¾— ハウス", MapSelect_LoadGame, ENTR_HOUSE_OF_SKULLTULA_0 }, - // "40: Castle Town - Entrance" (Market Entrance) - { "40:" GFXP_HIRAGANA "ジョウカï¾ï¾ イリグï¾", MapSelect_LoadGame, ENTR_MARKET_ENTRANCE_DAY_0 }, - // "41: Castle Town" (Market) - { "41:" GFXP_HIRAGANA "ジョウカï¾ï¾", MapSelect_LoadGame, ENTR_MARKET_DAY_0 }, - // "42: Back Alley" (Back Alley) - { "42:" GFXP_HIRAGANA "ウラロジ", MapSelect_LoadGame, ENTR_BACK_ALLEY_DAY_0 }, - // "43: In Front of the Temple of Time" (Temple of Time Exterior) - { "43:" GFXP_HIRAGANA "トキノシï¾ï¾ƒï¾žï¾ ï¾ï½´", MapSelect_LoadGame, ENTR_TEMPLE_OF_TIME_EXTERIOR_DAY_0 }, - // "44: Link's House" - { "44:" GFXP_HIRAGANA "リï¾ï½¸ï¾‰ï½²ï½´", MapSelect_LoadGame, ENTR_LINKS_HOUSE_0 }, - // "45: Kakariko Village Row House" - { "45:" GFXP_KATAKANA "カカリコ" GFXP_HIRAGANA "ムラノナガヤ", MapSelect_LoadGame, ENTR_KAKARIKO_CENTER_GUEST_HOUSE_0 }, - // "46: Back Alley House" - { "46:" GFXP_HIRAGANA "ウラロジノ イエ", MapSelect_LoadGame, ENTR_BACK_ALLEY_HOUSE_0 }, - // "47: Kokiri Village - Know-It-All Brothers' House" - { "47:" GFXP_HIRAGANA "コキリノムラ モノシリキョウダイノイエ", MapSelect_LoadGame, ENTR_KNOW_IT_ALL_BROS_HOUSE_0 }, - // "48: Kokiri Village - Twins' House" - { "48:" GFXP_HIRAGANA "コキリノムラ フタゴノイエ", MapSelect_LoadGame, ENTR_TWINS_HOUSE_0 }, - // "49: Kokiri Village - Mido's House" - { "49:" GFXP_HIRAGANA "コキリノムラ " GFXP_KATAKANA "ï¾ï¾„゙" GFXP_HIRAGANA "ノイエ", MapSelect_LoadGame, ENTR_MIDOS_HOUSE_0 }, - // "50: Kokiri Village - Saria's House" - { "50:" GFXP_HIRAGANA "コキリノムラ " GFXP_KATAKANA "サリア" GFXP_HIRAGANA "ノイエ", MapSelect_LoadGame, ENTR_SARIAS_HOUSE_0 }, - // "51: Stable" - { "51:" GFXP_HIRAGANA "ï½³ï¾ï½ºï¾žï¾”", MapSelect_LoadGame, ENTR_STABLE_0 }, - // "52: Grave Keeper's House" - { "52:" GFXP_HIRAGANA "ハカモリノイエ", MapSelect_LoadGame, ENTR_GRAVEKEEPERS_HUT_0 }, - // "53: Back Alley - Dog Lady's House" - { "53:" GFXP_HIRAGANA "ウラロジ イヌオバサï¾ï¾‰ï½²ï½´", MapSelect_LoadGame, ENTR_DOG_LADY_HOUSE_0 }, - // "54: Kakariko Village - Impa's House" - { "54:" GFXP_HIRAGANA "カカリコムラ " GFXP_KATAKANA "ï½²ï¾ï¾Šï¾Ÿ" GFXP_HIRAGANA "ノイエ", MapSelect_LoadGame, ENTR_IMPAS_HOUSE_0 }, - // "55: Hylia Laboratory" - { "55:" GFXP_KATAKANA "ハイリア" GFXP_HIRAGANA " ï½¹ï¾ï½·ï½­ï½³ï½¼ï¾žï½®", MapSelect_LoadGame, ENTR_LAKESIDE_LABORATORY_0 }, - // "56: Tent" - { "56:" GFXP_KATAKANA "テï¾ï¾„", MapSelect_LoadGame, ENTR_CARPENTERS_TENT_0 }, - // "57: Shield Shop" - { "57:" GFXP_HIRAGANA "タテノï¾ï½¾", MapSelect_LoadGame, ENTR_BAZAAR_0 }, - // "58: Kokiri Shop" - { "58:" GFXP_HIRAGANA "コキリゾクノï¾ï½¾", MapSelect_LoadGame, ENTR_KOKIRI_SHOP_0 }, - // "59: Goron Shop" - { "59:" GFXP_KATAKANA "ゴロï¾" GFXP_HIRAGANA "ノï¾ï½¾", MapSelect_LoadGame, ENTR_GORON_SHOP_0 }, - // "60: Zora Shop" - { "60:" GFXP_KATAKANA "ゾーラ" GFXP_HIRAGANA "ノï¾ï½¾", MapSelect_LoadGame, ENTR_ZORA_SHOP_0 }, - // "61: Kakariko Village - Potion Shop" - { "61:" GFXP_KATAKANA "カカリコ" GFXP_HIRAGANA "ムラ クスリヤ", MapSelect_LoadGame, ENTR_POTION_SHOP_KAKARIKO_0 }, - // "62: Castle Town - Potion Shop" - { "62:" GFXP_HIRAGANA "ジョウカï¾ï¾ クスリヤ", MapSelect_LoadGame, ENTR_POTION_SHOP_MARKET_0 }, - // "63: Back Alley - Night Shop" - { "63:" GFXP_HIRAGANA "ウラロジ ヨルノï¾ï½¾", MapSelect_LoadGame, ENTR_BOMBCHU_SHOP_0 }, - // "64: Mask Shop" - { "64:" GFXP_HIRAGANA "オメï¾ï¾”", MapSelect_LoadGame, ENTR_HAPPY_MASK_SHOP_0 }, - // "65: Gerudo Training Area" - { "65:" GFXP_KATAKANA "ゲルド" GFXP_HIRAGANA "ノシュウレï¾ï½¼ï¾žï½®ï½³", MapSelect_LoadGame, ENTR_GERUDO_TRAINING_GROUND_0 }, - // "66: Fairy Tree Dungeon" - { "66:" GFXP_HIRAGANA "ヨウセイノキノ " GFXP_KATAKANA "ダï¾ï½¼ï¾žï½®ï¾", MapSelect_LoadGame, ENTR_DEKU_TREE_0 }, - // "67: Fairy Tree Dungeon - Boss" - { "67:" GFXP_HIRAGANA "ヨウセイノキノ " GFXP_KATAKANA "ダï¾ï½¼ï¾žï½®ï¾ ボス", MapSelect_LoadGame, ENTR_DEKU_TREE_BOSS_0 }, - // "68: Dondogo Dungeon" - { "68:" GFXP_KATAKANA "ドドï¾ï½ºï¾ž ダï¾ï½¼ï¾žï½®ï¾", MapSelect_LoadGame, ENTR_DODONGOS_CAVERN_0 }, - // "69: Dondogo Dungeon - Boss" - { "69:" GFXP_KATAKANA "ドドï¾ï½ºï¾ž ダï¾ï½¼ï¾žï½®ï¾ ボス", MapSelect_LoadGame, ENTR_DODONGOS_CAVERN_BOSS_0 }, - // "70: Giant Fish Dungeon" - { "70:" GFXP_HIRAGANA "キョダイギョ " GFXP_KATAKANA "ダï¾ï½¼ï¾žï½®ï¾", MapSelect_LoadGame, ENTR_JABU_JABU_0 }, - // "71: Giant Fish Dungeon - Boss" - { "71:" GFXP_HIRAGANA "キョダイギョ " GFXP_KATAKANA "ダï¾ï½¼ï¾žï½®ï¾ ボス", MapSelect_LoadGame, ENTR_JABU_JABU_BOSS_0 }, - // "72: Forest Temple" - { "72:" GFXP_HIRAGANA "モリノシï¾ï¾ƒï¾žï¾", MapSelect_LoadGame, ENTR_FOREST_TEMPLE_0 }, - // "73: Forest Temple - Boss" - { "73:" GFXP_HIRAGANA "モリノシï¾ï¾ƒï¾žï¾ " GFXP_KATAKANA "ボス", MapSelect_LoadGame, ENTR_FOREST_TEMPLE_BOSS_0 }, - // "74: Dungeon Below the Well" - { "74:" GFXP_HIRAGANA "イドシタ " GFXP_KATAKANA "ダï¾ï½¼ï¾žï½®ï¾", MapSelect_LoadGame, ENTR_BOTTOM_OF_THE_WELL_0 }, - // "75: Dungeon Beneath the Graves" - { "75:" GFXP_HIRAGANA "ハカシタ " GFXP_KATAKANA "ダï¾ï½¼ï¾žï½®ï¾", MapSelect_LoadGame, ENTR_SHADOW_TEMPLE_0 }, - // "76: Dungeon Beneath the Graves - Boss" - { "76:" GFXP_HIRAGANA "ハカシタ " GFXP_KATAKANA "ダï¾ï½¼ï¾žï½®ï¾ ボス", MapSelect_LoadGame, ENTR_SHADOW_TEMPLE_BOSS_0 }, - // "77: Fire Temple" - { "77:" GFXP_HIRAGANA "ヒノシï¾ï¾ƒï¾žï¾", MapSelect_LoadGame, ENTR_FIRE_TEMPLE_0 }, - // "78: Fire Temple - Boss" - { "78:" GFXP_HIRAGANA "ヒノシï¾ï¾ƒï¾žï¾ " GFXP_KATAKANA "ボス", MapSelect_LoadGame, ENTR_FIRE_TEMPLE_BOSS_0 }, - // "79: Water Temple" - { "79:" GFXP_HIRAGANA "ï¾ï½½ï¾žï¾‰ï½¼ï¾ï¾ƒï¾žï¾", MapSelect_LoadGame, ENTR_WATER_TEMPLE_0 }, - // "80: Water Temple - Boss" - { "80:" GFXP_HIRAGANA "ï¾ï½½ï¾žï¾‰ï½¼ï¾ï¾ƒï¾žï¾ " GFXP_KATAKANA "ボス", MapSelect_LoadGame, ENTR_WATER_TEMPLE_BOSS_0 }, - // "81: Evil Goddess Statue Dungeon" - { "81:" GFXP_HIRAGANA "ジャシï¾ï½¿ï¾žï½³ " GFXP_KATAKANA "ダï¾ï½¼ï¾žï½®ï¾", MapSelect_LoadGame, ENTR_SPIRIT_TEMPLE_0 }, - // "82: Evil Goddess Statue Dungeon - Iron Knuckle" (Iron Knuckle's Lair) - { "82:" GFXP_HIRAGANA "ジャシï¾ï½¿ï¾žï½³ " GFXP_KATAKANA "ダï¾ï½¼ï¾žï½®ï¾ アイアï¾ï¾…ック", MapSelect_LoadGame, ENTR_SPIRIT_TEMPLE_BOSS_0 }, - // "83: Evil Goddess Statue Dungeon - Boss" (Twinrova's Lair) - { "83:" GFXP_HIRAGANA "ジャシï¾ï½¿ï¾žï½³ " GFXP_KATAKANA "ダï¾ï½¼ï¾žï½®ï¾ ボス", MapSelect_LoadGame, ENTR_SPIRIT_TEMPLE_BOSS_2 }, - // "84: Ganon's Tower" - { "84:" GFXP_KATAKANA "ガノï¾" GFXP_HIRAGANA "ノトウ", MapSelect_LoadGame, ENTR_GANONS_TOWER_0 }, - // "85: Ganon's Tower - Boss" - { "85:" GFXP_KATAKANA "ガノï¾" GFXP_HIRAGANA "ノトウ" GFXP_KATAKANA "ボス", MapSelect_LoadGame, ENTR_GANONDORF_BOSS_0 }, - // "86: Ice Cavern" - { "86:" GFXP_HIRAGANA "コオリノドウクツ", MapSelect_LoadGame, ENTR_ICE_CAVERN_0 }, - // "87: Relay Beneath the Graves" (Dampé's Grave) - { "87:" GFXP_HIRAGANA "ハカシタ" GFXP_KATAKANA "リレー", MapSelect_LoadGame, ENTR_WINDMILL_AND_DAMPES_GRAVE_0 }, - // "88: Ganon's Basement Dungeon" - { "88:" GFXP_KATAKANA "ガノï¾" GFXP_HIRAGANA "ï¾ï½¶ " GFXP_KATAKANA "ダï¾ï½¼ï¾žï½®ï¾", MapSelect_LoadGame, - ENTR_INSIDE_GANONS_CASTLE_0 }, - // "89: Final Battle With Ganon - Cutscene & Battle" - { "89:" GFXP_KATAKANA "ガノï¾" GFXP_HIRAGANA "ï½»ï½²ï½¼ï½­ï½³ï½¾ï¾ " GFXP_KATAKANA "デモ & バトル", MapSelect_LoadGame, - ENTR_GANON_BOSS_0 }, - // "90: Ganon's Tower Aftermath 1" (Escaping Ganon's Tower 1) - { "90:" GFXP_KATAKANA "ガノï¾" GFXP_HIRAGANA "ノトウ ソノゴ 1", MapSelect_LoadGame, - ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_0 }, - // "91: Ganon's Tower Aftermath 2" (Escaping Ganon's Tower 2) - { "91:" GFXP_KATAKANA "ガノï¾" GFXP_HIRAGANA "ノトウ ソノゴ 2", MapSelect_LoadGame, - ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_2 }, - // "92: Ganon's Tower Aftermath 3" (Escaping Ganon's Tower 3) - { "92:" GFXP_KATAKANA "ガノï¾" GFXP_HIRAGANA "ノトウ ソノゴ 3", MapSelect_LoadGame, - ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_4 }, - // "93: Ganon's Tower Aftermath 4" (Escaping Ganon's Tower 4) - { "93:" GFXP_KATAKANA "ガノï¾" GFXP_HIRAGANA "ノトウ ソノゴ 4", MapSelect_LoadGame, - ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_6 }, - // "94: Ganon's Basement Aftermath" - { "94:" GFXP_KATAKANA "ガノï¾" GFXP_HIRAGANA "ï¾ï½¶ ソノゴ", MapSelect_LoadGame, ENTR_INSIDE_GANONS_CASTLE_COLLAPSE_0 }, - // "95: Gerudo Passage 1-2" (Thieves' Hideout 1) - { "95:" GFXP_KATAKANA "ゲルド" GFXP_HIRAGANA "ツウロ 1-2", MapSelect_LoadGame, ENTR_THIEVES_HIDEOUT_0 }, - // "96: Gerudo Passage 3-4 9-10" (Thieves' Hideout 2) - { "96:" GFXP_KATAKANA "ゲルド" GFXP_HIRAGANA "ツウロ 3-4 9-10", MapSelect_LoadGame, ENTR_THIEVES_HIDEOUT_2 }, - // "97: Gerudo Passage 5-6" (Thieves' Hideout 3) - { "97:" GFXP_KATAKANA "ゲルド" GFXP_HIRAGANA "ツウロ 5-6", MapSelect_LoadGame, ENTR_THIEVES_HIDEOUT_4 }, - // "98: Gerudo Passage 7-8" (Thieves' Hideout 4) - { "98:" GFXP_KATAKANA "ゲルド" GFXP_HIRAGANA "ツウロ 7-8", MapSelect_LoadGame, ENTR_THIEVES_HIDEOUT_6 }, - // "99: Gerudo Passage 11-12" (Thieves' Hideout 5) - { "99:" GFXP_KATAKANA "ゲルド" GFXP_HIRAGANA "ツウロ 11-12", MapSelect_LoadGame, ENTR_THIEVES_HIDEOUT_10 }, - // "100: Gerudo Passage 13" (Thieves' Hideout 6) - { "100:" GFXP_KATAKANA "ゲルド" GFXP_HIRAGANA "ツウロ 13", MapSelect_LoadGame, ENTR_THIEVES_HIDEOUT_12 }, - // "101: Hidden Dive Hole 0" (Grotto 0 - Gossip Stone & Chest) - { "101:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 0", MapSelect_LoadGame, ENTR_GROTTOS_0 }, - // "102: Hidden Dive Hole 1" (Grotto 1 - Skulltula & Gold Skulltula) - { "102:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 1", MapSelect_LoadGame, ENTR_GROTTOS_1 }, - // "103: Hidden Dive Hole 2" (Grotto 2 - Business Scrub & Heart Piece) - { "103:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 2", MapSelect_LoadGame, ENTR_GROTTOS_2 }, - // "104: Hidden Dive Hole 3" (Grotto 3 - Redeads) - { "104:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 3", MapSelect_LoadGame, ENTR_GROTTOS_3 }, - // "105: Hidden Dive Hole 4" (Grotto 4 - 3 Business Scrubs) - { "105:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 4", MapSelect_LoadGame, ENTR_GROTTOS_4 }, - // "106: Hidden Dive Hole 5" (Grotto 5 - Gossip Stone, Skulltula, Cow) - { "106:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 5", MapSelect_LoadGame, ENTR_GROTTOS_5 }, - // "107: Hidden Dive Hole 6" (Grotto 6 - Octorok) - { "107:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 6", MapSelect_LoadGame, ENTR_GROTTOS_6 }, - // "108: Hidden Dive Hole 7" (Grotto 7 - Business Scrub & Deku Nut Upgrade) - { "108:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 7", MapSelect_LoadGame, ENTR_GROTTOS_7 }, - // "109: Hidden Dive Hole 8" (Grotto 8 - 2 Wolfos) - { "109:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 8", MapSelect_LoadGame, ENTR_GROTTOS_8 }, - // "110: Hidden Dive Hole 9" (Grotto 9 - Bombable Walls) - { "110:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 9", MapSelect_LoadGame, ENTR_GROTTOS_9 }, - // "111: Hidden Dive Hole 10" (Grotto 10 - 2 Business Scrubs) - { "111:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 10", MapSelect_LoadGame, ENTR_GROTTOS_10 }, - // "112: Hidden Dive Hole 11" (Grotto 11 - Tektite & Heart Piece) - { "112:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 11", MapSelect_LoadGame, ENTR_GROTTOS_11 }, - // "113: Hidden Dive Hole 12" (Grotto 12 - Deku Stage) - { "113:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 12", MapSelect_LoadGame, ENTR_GROTTOS_12 }, - // "114: Hidden Dive Hole 13" (Grotto 13 - Rupees & Cow) - { "114:" GFXP_HIRAGANA "カクシトビコï¾ï½±ï¾… 13", MapSelect_LoadGame, ENTR_GROTTOS_13 }, - // "115: Hyrule Cutscenes" - { "115:" GFXP_KATAKANA "ハイラル デモ", MapSelect_LoadGame, ENTR_CUTSCENE_MAP_0 }, -#if OOT_DEBUG - // "116: Special Room (Treasure Chest Warp)" (Ganondorf Test Room) - { "116:" GFXP_HIRAGANA "ï¾ï¾žï½¯ï½¼ï¾‚ (タカラバコ" GFXP_KATAKANA "ワープ)", MapSelect_LoadGame, ENTR_BESITU_0 }, - // "117: Sasaki Test" (Sasa Test) - { "117:" GFXP_HIRAGANA "ササ" GFXP_KATAKANA "テスト", MapSelect_LoadGame, ENTR_SASATEST_0 }, - // "118: Test Map" (Jungle Gym) - { "118:" GFXP_KATAKANA "テストï¾ï½¯ï¾Œï¾Ÿ", MapSelect_LoadGame, ENTR_TEST01_0 }, - // "119: Test Room" (Treasure Chest Room) - { "119:" GFXP_KATAKANA "テストルーム", MapSelect_LoadGame, ENTR_TESTROOM_0 }, - // "120: Stalfos Miniboss Room" (Stalfos Miniboss Room) - { "120:" GFXP_HIRAGANA "ï¾ï½­ï½³" GFXP_KATAKANA "スタロフォス" GFXP_HIRAGANA "ï¾ï¾žï¾”", MapSelect_LoadGame, ENTR_SYOTES_0 }, - // "121: Boss Stalfos Room" (Stalfos Boss Room) - { "121:" GFXP_KATAKANA "ボススタロフォス" GFXP_HIRAGANA "ï¾ï¾žï¾”", MapSelect_LoadGame, ENTR_SYOTES2_0 }, - // "122: Stal" (Sutaru) - { "122:Sutaru", MapSelect_LoadGame, ENTR_SUTARU_0 }, - // "123: Test Area" - { "123:jikkenjyou", MapSelect_LoadGame, ENTR_TEST_SHOOTING_GALLERY_0 }, - // "124: Depth Test" (Depth Test) - { "124:depth" GFXP_KATAKANA "テスト", MapSelect_LoadGame, ENTR_DEPTH_TEST_0 }, - // "125: Hyrule Garden Game 2" (Early Hyrule Garden Game) - { "125:" GFXP_KATAKANA "ハイラル" GFXP_HIRAGANA "ニワ" GFXP_KATAKANA "ゲーム2", MapSelect_LoadGame, ENTR_HAIRAL_NIWA2_0 }, -#endif - // "title" (Title Screen) - { "title", (void*)MapSelect_LoadTitle, 0 }, -}; - -void MapSelect_UpdateMenu(MapSelectState* this) { - Input* input = &this->state.input[0]; - s32 pad; - SceneSelectEntry* selectedScene; - - if (this->verticalInputAccumulator == 0) { - if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START)) { - selectedScene = &this->scenes[this->currentScene]; - if (selectedScene->loadFunc != NULL) { - selectedScene->loadFunc(this, selectedScene->entranceIndex); - } - } - - if (CHECK_BTN_ALL(input->press.button, BTN_B)) { - if (LINK_AGE_IN_YEARS == YEARS_ADULT) { - gSaveContext.save.linkAge = LINK_AGE_CHILD; - } else { - gSaveContext.save.linkAge = LINK_AGE_ADULT; - } - } - - if (CHECK_BTN_ALL(input->press.button, BTN_Z)) { - if (gSaveContext.save.cutsceneIndex == 0x8000) { - gSaveContext.save.cutsceneIndex = 0; - } else if (gSaveContext.save.cutsceneIndex == 0) { - gSaveContext.save.cutsceneIndex = 0xFFF0; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF0) { - gSaveContext.save.cutsceneIndex = 0xFFF1; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF1) { - gSaveContext.save.cutsceneIndex = 0xFFF2; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF2) { - gSaveContext.save.cutsceneIndex = 0xFFF3; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF3) { - gSaveContext.save.cutsceneIndex = 0xFFF4; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF4) { - gSaveContext.save.cutsceneIndex = 0xFFF5; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF5) { - gSaveContext.save.cutsceneIndex = 0xFFF6; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF6) { - gSaveContext.save.cutsceneIndex = 0xFFF7; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF7) { - gSaveContext.save.cutsceneIndex = 0xFFF8; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF8) { - gSaveContext.save.cutsceneIndex = 0xFFF9; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF9) { - gSaveContext.save.cutsceneIndex = 0xFFFA; - } else if (gSaveContext.save.cutsceneIndex == 0xFFFA) { - gSaveContext.save.cutsceneIndex = 0x8000; - } - } else if (CHECK_BTN_ALL(input->press.button, BTN_R)) { - if (gSaveContext.save.cutsceneIndex == 0x8000) { - gSaveContext.save.cutsceneIndex = 0xFFFA; - } else if (gSaveContext.save.cutsceneIndex == 0) { - gSaveContext.save.cutsceneIndex = 0x8000; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF0) { - gSaveContext.save.cutsceneIndex = 0; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF1) { - gSaveContext.save.cutsceneIndex = 0xFFF0; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF2) { - gSaveContext.save.cutsceneIndex = 0xFFF1; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF3) { - gSaveContext.save.cutsceneIndex = 0xFFF2; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF4) { - gSaveContext.save.cutsceneIndex = 0xFFF3; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF5) { - gSaveContext.save.cutsceneIndex = 0xFFF4; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF6) { - gSaveContext.save.cutsceneIndex = 0xFFF5; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF7) { - gSaveContext.save.cutsceneIndex = 0xFFF6; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF8) { - gSaveContext.save.cutsceneIndex = 0xFFF7; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF9) { - gSaveContext.save.cutsceneIndex = 0xFFF8; - } else if (gSaveContext.save.cutsceneIndex == 0xFFFA) { - gSaveContext.save.cutsceneIndex = 0xFFF9; - } - } - - gSaveContext.save.nightFlag = 0; - if (gSaveContext.save.cutsceneIndex == 0) { - gSaveContext.save.nightFlag = 1; - } - - // user can change "opt", but it doesn't do anything - if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) { - this->opt--; - } - if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { - this->opt++; - } - - if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) { - if (this->lockUp == true) { - this->timerUp = 0; - } - if (this->timerUp == 0) { - this->timerUp = 20; - this->lockUp = true; - Audio_PlaySfxGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - this->verticalInput = R_UPDATE_RATE; - } - } - - if (CHECK_BTN_ALL(input->cur.button, BTN_DUP) && this->timerUp == 0) { - Audio_PlaySfxGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - this->verticalInput = R_UPDATE_RATE * 3; - } - - if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) { - if (this->lockDown == true) { - this->timerDown = 0; - } - if (this->timerDown == 0) { - this->timerDown = 20; - this->lockDown = true; - Audio_PlaySfxGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - this->verticalInput = -R_UPDATE_RATE; - } - } - - if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN) && (this->timerDown == 0)) { - Audio_PlaySfxGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - this->verticalInput = -R_UPDATE_RATE * 3; - } - - if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) || CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) { - Audio_PlaySfxGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - this->verticalInput = R_UPDATE_RATE; - } - - if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT) || CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) { - Audio_PlaySfxGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - this->verticalInput = -R_UPDATE_RATE; - } - } - - if (CHECK_BTN_ALL(input->press.button, BTN_L)) { - this->pageDownIndex++; - this->pageDownIndex = - (this->pageDownIndex + ARRAY_COUNT(this->pageDownStops)) % ARRAY_COUNT(this->pageDownStops); - this->currentScene = this->topDisplayedScene = this->pageDownStops[this->pageDownIndex]; - } - - this->verticalInputAccumulator += this->verticalInput; - - if (this->verticalInputAccumulator < -7) { - this->verticalInput = 0; - this->verticalInputAccumulator = 0; - - this->currentScene++; - this->currentScene = (this->currentScene + this->count) % this->count; - - if (this->currentScene == ((this->topDisplayedScene + this->count + 19) % this->count)) { - this->topDisplayedScene++; - this->topDisplayedScene = (this->topDisplayedScene + this->count) % this->count; - } - } - - if (this->verticalInputAccumulator > 7) { - this->verticalInput = 0; - this->verticalInputAccumulator = 0; - - if (this->currentScene == this->topDisplayedScene) { - this->topDisplayedScene -= 2; - this->topDisplayedScene = (this->topDisplayedScene + this->count) % this->count; - } - - this->currentScene--; - this->currentScene = (this->currentScene + this->count) % this->count; - - if (this->currentScene == ((this->topDisplayedScene + this->count) % this->count)) { - this->topDisplayedScene--; - this->topDisplayedScene = (this->topDisplayedScene + this->count) % this->count; - } - } - - this->currentScene = (this->currentScene + this->count) % this->count; - this->topDisplayedScene = (this->topDisplayedScene + this->count) % this->count; - - dREG(80) = this->currentScene; - dREG(81) = this->topDisplayedScene; - dREG(82) = this->pageDownIndex; - - if (this->timerUp != 0) { - this->timerUp--; - } - - if (this->timerUp == 0) { - this->lockUp = false; - } - - if (this->timerDown != 0) { - this->timerDown--; - } - - if (this->timerDown == 0) { - this->lockDown = false; - } -} - void MapSelect_PrintMenu(MapSelectState* this, GfxPrint* printer) { s32 scene; s32 i; char* name; - GfxPrint_SetColor(printer, 255, 155, 150, 255); - GfxPrint_SetPos(printer, 12, 2); - GfxPrint_Printf(printer, "ZELDA MAP SELECT"); - GfxPrint_SetColor(printer, 255, 255, 255, 255); - for (i = 0; i < 20; i++) { - GfxPrint_SetPos(printer, 9, i + 4); + GfxPrint_SetPos(printer, 4, i + 4); - scene = (this->topDisplayedScene + i + this->count) % this->count; + scene = (this->topDisplayedScene + i + this->sceneTotal) % this->sceneTotal; if (scene == this->currentScene) { - GfxPrint_SetColor(printer, 255, 20, 20, 255); + GfxPrint_SetColor(printer, sColors[this->selectedSceneColor].r, sColors[this->selectedSceneColor].g, + sColors[this->selectedSceneColor].b, sColors[this->selectedSceneColor].a); } else { GfxPrint_SetColor(printer, 200, 200, 55, 255); } name = this->scenes[scene].name; if (name == NULL) { - name = "**Null**"; + name = "Unknown Scene"; } - GfxPrint_Printf(printer, "%s", name); - }; + if (!scene) { + // Title Screen + GfxPrint_Printf(printer, "%s", name); + } else { + GfxPrint_Printf(printer, "%03d: %s", scene, name); + } - GfxPrint_SetColor(printer, 155, 55, 150, 255); - GfxPrint_SetPos(printer, 20, 26); - GfxPrint_Printf(printer, "OPT=%d", this->opt); + if (scene == this->currentScene) { + GfxPrint_SetPos(printer, 3, i + 4); + GfxPrint_Printf(printer, ">"); + } + }; } -static const char* sLoadingMessages[] = { - // "Please wait a minute" - GFXP_HIRAGANA "シバラクオï¾ï¾ï½¸ï¾€ï¾žï½»ï½²", - // "Hold on a sec" - GFXP_HIRAGANA "ï¾ï½®ï½¯ï¾„ ï¾ï½¯ï¾ƒï¾ˆ", - // "Wait a moment" - GFXP_KATAKANA "ウェイト ï½± モーメï¾ï¾„", - // "Loading" - GFXP_KATAKANA "ロード" GFXP_HIRAGANA "ï¾ï½­ï½³", - // "Now working" - GFXP_HIRAGANA "ï¾…ï½³ ワーキï¾ï½¸ï¾ž", - // "Now creating" - GFXP_HIRAGANA "ï½²ï¾ ï¾‚ï½¸ï½¯ï¾ƒï¾ï½½", - // "It's not broken" - GFXP_HIRAGANA "コショウジャナイヨ", - // "Coffee Break" - GFXP_KATAKANA "コーヒー ブレイク", - // "Please set B side" - GFXP_KATAKANA "Bï¾’ï¾ï½¦ï½¾ï½¯ï¾„シテクダサイ", - // "Be patient, now" - GFXP_HIRAGANA "ジット" GFXP_KATAKANA "ガï¾ï¾" GFXP_HIRAGANA "ノ" GFXP_KATAKANA "コ" GFXP_HIRAGANA "デアッタ", - // "Please wait just a minute" - GFXP_HIRAGANA "ï½²ï¾ï½¼ï¾Šï¾žï¾—クオï¾ï¾ï½¸ï¾€ï¾žï½»ï½²", - // "Don't worry, don't worry. Take a break, take a break." - GFXP_HIRAGANA "アワテナイアワテナイ。ヒトヤスï¾ï¾‹ï¾„ヤスï¾ï½¡", -}; - -void MapSelect_PrintLoadingMessage(MapSelectState* this, GfxPrint* printer) { +void MapSelect_PrintLoadingMessage(MapSelectState* this, GfxPrint* printer, u8 yPos) { s32 randomMsg; - GfxPrint_SetPos(printer, 10, 15); + GfxPrint_SetPos(printer, 3, yPos); GfxPrint_SetColor(printer, 255, 255, 255, 255); randomMsg = Rand_ZeroOne() * ARRAY_COUNT(sLoadingMessages); GfxPrint_Printf(printer, "%s", sLoadingMessages[randomMsg]); } -static const char* sAgeLabels[] = { - GFXP_HIRAGANA "17(ワカモノ)", // "17(young)" - GFXP_HIRAGANA "5(ワカスギ)", // "5(very young)" -}; - void MapSelect_PrintAgeSetting(MapSelectState* this, GfxPrint* printer, s32 age) { - GfxPrint_SetPos(printer, 4, 26); - GfxPrint_SetColor(printer, 255, 255, 55, 255); - GfxPrint_Printf(printer, "Age:%s", sAgeLabels[age]); + GfxPrint_SetPos(printer, 4, 25); + GfxPrint_SetColor(printer, 55, 255, 55, 255); + GfxPrint_Printf(printer, "Link's Age: %s", sAgeLabels[age]); } -void MapSelect_PrintCutsceneSetting(MapSelectState* this, GfxPrint* printer, u16 csIndex) { +void MapSelect_PrintSceneLayerSetting(MapSelectState* this, GfxPrint* printer) { char* label; - GfxPrint_SetPos(printer, 4, 25); - GfxPrint_SetColor(printer, 255, 255, 55, 255); + GfxPrint_SetPos(printer, 4, 26); + GfxPrint_SetColor(printer, 127, 255, 55, 255); - switch (csIndex) { + gSaveContext.save.nightFlag = 0; + + switch (this->sceneLayer) { case 0: - label = GFXP_HIRAGANA " ï¾–ï¾™ " GFXP_KATAKANA "ゴロï¾"; + label = "Daytime"; + gSaveContext.save.dayTime = CLOCK_TIME(12, 0); + gSaveContext.save.cutsceneIndex = 0xFFEF; + break; + case 1: + label = "Nighttime"; gSaveContext.save.dayTime = CLOCK_TIME(0, 0); + gSaveContext.save.nightFlag = 1; + gSaveContext.save.cutsceneIndex = 0xFFEF; break; - case 0x8000: - // clang-format off - gSaveContext.save.dayTime = CLOCK_TIME(12, 0); label = GFXP_HIRAGANA "オヒル " GFXP_KATAKANA "ジャラ"; - // clang-format on + case 2: + label = "Cutscene 0"; + gSaveContext.save.dayTime = CLOCK_TIME(12, 0); + gSaveContext.save.cutsceneIndex = 0xFFF0; break; - case 0xFFF0: - // clang-format off - gSaveContext.save.dayTime = CLOCK_TIME(12, 0); label = "デモ00"; - // clang-format on + case 3: + label = "Cutscene 1"; + gSaveContext.save.cutsceneIndex = 0xFFF1; break; - case 0xFFF1: - label = "デモ01"; + case 4: + label = "Cutscene 2"; + gSaveContext.save.cutsceneIndex = 0xFFF2; break; - case 0xFFF2: - label = "デモ02"; + case 5: + label = "Cutscene 3"; + gSaveContext.save.cutsceneIndex = 0xFFF3; break; - case 0xFFF3: - label = "デモ03"; + case 6: + label = "Cutscene 4"; + gSaveContext.save.cutsceneIndex = 0xFFF4; break; - case 0xFFF4: - label = "デモ04"; + case 7: + label = "Cutscene 5"; + gSaveContext.save.cutsceneIndex = 0xFFF5; break; - case 0xFFF5: - label = "デモ05"; + case 8: + label = "Cutscene 6"; + gSaveContext.save.cutsceneIndex = 0xFFF6; break; - case 0xFFF6: - label = "デモ06"; + case 9: + label = "Cutscene 7"; + gSaveContext.save.cutsceneIndex = 0xFFF7; break; - case 0xFFF7: - label = "デモ07"; + case 10: + label = "Cutscene 8"; + gSaveContext.save.cutsceneIndex = 0xFFF8; break; - case 0xFFF8: - label = "デモ08"; + case 11: + label = "Cutscene 9"; + gSaveContext.save.cutsceneIndex = 0xFFF9; break; - case 0xFFF9: - label = "デモ09"; + case 12: + label = "Cutscene 10"; + gSaveContext.save.cutsceneIndex = 0xFFFA; break; - case 0xFFFA: - label = "デモ0A"; + default: + label = "Unknown Layer"; + gSaveContext.save.cutsceneIndex = 0xFFEF; break; }; gSaveContext.skyboxTime = gSaveContext.save.dayTime; - GfxPrint_Printf(printer, "Stage:" GFXP_KATAKANA "%s", label); + GfxPrint_SetColor(printer, 155, 55, 150, 255); + GfxPrint_Printf(printer, "Scene Layer: %s", label); } -void MapSelect_DrawMenu(MapSelectState* this) { - GraphicsContext* gfxCtx = this->state.gfxCtx; - GfxPrint* printer; +void MapSelect_PrintControls(MapSelectState* this, GfxPrint* printer) { + u8 i, posY = 2; + Color_RGBA8 colors; - OPEN_DISPS(gfxCtx, "../z_select.c", 930); + for (i = 0; i < ARRAY_COUNT(sControlLabels); i++) { + // only print "show/hide controls" on the main screen + if (!this->showControls && (i > 0)) { + return; + } - gSPSegment(POLY_OPA_DISP++, 0x00, NULL); - Gfx_SetupFrame(gfxCtx, 0, 0, 0); - SET_FULLSCREEN_VIEWPORT(&this->view); - View_Apply(&this->view, VIEW_ALL); - Gfx_SetupDL_28Opa(gfxCtx); + // for anything but "Show/Hide Controls", + // increment Y-Pos by 2, else set it to 27 + // to move it at the bottom of the screen + if (i > 0) { + posY += 2; + } else { + posY = 27; + } - printer = alloca(sizeof(GfxPrint)); - GfxPrint_Init(printer); - GfxPrint_Open(printer, POLY_OPA_DISP); - MapSelect_PrintMenu(this, printer); - MapSelect_PrintAgeSetting(this, printer, ((void)0, gSaveContext.save.linkAge)); - MapSelect_PrintCutsceneSetting(this, printer, ((void)0, gSaveContext.save.cutsceneIndex)); - POLY_OPA_DISP = GfxPrint_Close(printer); - GfxPrint_Destroy(printer); + colors = sColors[i]; - CLOSE_DISPS(gfxCtx, "../z_select.c", 966); -} + GfxPrint_SetPos(printer, 4, posY); + GfxPrint_SetColor(printer, colors.r, colors.g, colors.b, colors.a); + GfxPrint_Printf(printer, sControlLabels[i]); -void MapSelect_DrawLoadingScreen(MapSelectState* this) { - GraphicsContext* gfxCtx = this->state.gfxCtx; - GfxPrint* printer; - - OPEN_DISPS(gfxCtx, "../z_select.c", 977); - - gSPSegment(POLY_OPA_DISP++, 0x00, NULL); - Gfx_SetupFrame(gfxCtx, 0, 0, 0); - SET_FULLSCREEN_VIEWPORT(&this->view); - View_Apply(&this->view, VIEW_ALL); - Gfx_SetupDL_28Opa(gfxCtx); - - printer = alloca(sizeof(GfxPrint)); - GfxPrint_Init(printer); - GfxPrint_Open(printer, POLY_OPA_DISP); - MapSelect_PrintLoadingMessage(this, printer); - POLY_OPA_DISP = GfxPrint_Close(printer); - GfxPrint_Destroy(printer); - - CLOSE_DISPS(gfxCtx, "../z_select.c", 1006); -} - -void MapSelect_Draw(MapSelectState* this) { - GraphicsContext* gfxCtx = this->state.gfxCtx; - - OPEN_DISPS(gfxCtx, "../z_select.c", 1013); - - gSPSegment(POLY_OPA_DISP++, 0x00, NULL); - Gfx_SetupFrame(gfxCtx, 0, 0, 0); - SET_FULLSCREEN_VIEWPORT(&this->view); - View_Apply(&this->view, VIEW_ALL); - - if (!this->state.running) { - MapSelect_DrawLoadingScreen(this); - } else { - MapSelect_DrawMenu(this); + // reset the position after the "show/hide" print + if (i == 0) { + posY = 2; + } } - - CLOSE_DISPS(gfxCtx, "../z_select.c", 1037); -} - -void MapSelect_Main(GameState* thisx) { - MapSelectState* this = (MapSelectState*)thisx; - - MapSelect_UpdateMenu(this); - MapSelect_Draw(this); -} - -void MapSelect_Destroy(GameState* thisx) { - PRINTF("%c", BEL); - // "view_cleanup will hang, so it won't be called" - PRINTF("*** view_cleanupã¯ãƒãƒ³ã‚°ã‚¢ãƒƒãƒ—ã™ã‚‹ã®ã§ã€å‘¼ã°ãªã„ ***\n"); -} - -void MapSelect_Init(GameState* thisx) { - MapSelectState* this = (MapSelectState*)thisx; - - this->state.main = MapSelect_Main; - this->state.destroy = MapSelect_Destroy; - this->scenes = sScenes; - this->topDisplayedScene = 0; - this->currentScene = 0; - this->pageDownStops[0] = 0; // Hyrule Field - this->pageDownStops[1] = 19; // Temple Of Time - this->pageDownStops[2] = 37; // Treasure Chest Game - this->pageDownStops[3] = 51; // Gravekeeper's Hut - this->pageDownStops[4] = 59; // Zora Shop - this->pageDownStops[5] = 73; // Bottom of the Well - this->pageDownStops[6] = 91; // Escaping Ganon's Tower 3 - this->pageDownIndex = 0; - this->opt = 0; - this->count = ARRAY_COUNT(sScenes); - View_Init(&this->view, this->state.gfxCtx); - this->view.flags = (VIEW_PROJECTION_ORTHO | VIEW_VIEWPORT); - this->verticalInputAccumulator = 0; - this->verticalInput = 0; - this->timerUp = 0; - this->timerDown = 0; - this->lockUp = 0; - this->lockDown = 0; - this->unk_234 = 0; - - if ((dREG(80) >= 0) && (dREG(80) < this->count)) { - this->currentScene = dREG(80); - this->topDisplayedScene = dREG(81); - this->pageDownIndex = dREG(82); - } - - R_UPDATE_RATE = 1; - - { - u32 size = (uintptr_t)_z_select_staticSegmentRomEnd - (uintptr_t)_z_select_staticSegmentRomStart; - - this->staticSegment = GAME_STATE_ALLOC(&this->state, size, "../z_select.c", 1114); - DMA_REQUEST_SYNC(this->staticSegment, (uintptr_t)_z_select_staticSegmentRomStart, size, "../z_select.c", 1115); - } - - gSaveContext.save.cutsceneIndex = 0x8000; - gSaveContext.save.linkAge = LINK_AGE_CHILD; } diff --git a/src/overlays/gamestates/ovl_select/z_select.h b/src/overlays/gamestates/ovl_select/z_select.h new file mode 100644 index 000000000..e4d9cfaba --- /dev/null +++ b/src/overlays/gamestates/ovl_select/z_select.h @@ -0,0 +1,257 @@ +#ifndef Z_SELECT_H +#define Z_SELECT_H + +#include "config.h" + +void MapSelect_Init(GameState* thisx); +void MapSelect_Main(GameState* thisx); +void MapSelect_Draw(MapSelectState* this); +void MapSelect_Destroy(GameState* thisx); +void MapSelect_UpdateMenu(MapSelectState* this); +void MapSelect_DrawMenu(MapSelectState* this); +void MapSelect_DrawLoadingScreen(MapSelectState* this); +void MapSelect_LoadTitle(MapSelectState* this); +void MapSelect_LoadGame(MapSelectState* this, s32 entranceIndex); +void MapSelect_PrintMenu(MapSelectState* this, GfxPrint* printer); +void MapSelect_PrintLoadingMessage(MapSelectState* this, GfxPrint* printer, u8 yPos); +void MapSelect_PrintAgeSetting(MapSelectState* this, GfxPrint* printer, s32 age); +void MapSelect_PrintSceneLayerSetting(MapSelectState* this, GfxPrint* printer); +void MapSelect_PrintControls(MapSelectState* this, GfxPrint* printer); + +static const char* sAgeLabels[] = { + "Adult", + "Child", +}; + +static const char* sLoadingMessages[] = { + "Please wait a minute", + "Hold on a sec", + "Wait a moment", + "Loading", + "Now working", + "Now creating", + "It's not broken", + "Coffee Break", + "Please set B side", + "Be patient, now", + "Please wait just a minute", + "Don't worry, don't worry. Take a break, take a break", +}; + +// The first element of the next 3 arrays needs to stay at the index 0 + +static const char* sControlLabels[] = { + "[C-Down]: Show/Hide Controls", + "[D-Pad]: Select Scene", + "[B]: Change Link's Age", + "[Z],[R]: Change the Scene Layer", + "[A],[Start]: Load the scene", + "[C-Left/Right]: Selection Color", // only for selected scene color in the list + "[L],Controls Page: Play/Stop BGM", +}; + +static const Color_RGBA8 sColors[] = { + { 255, 127, 0, 255 }, // Orange + { 200, 200, 55, 255 }, // Yellow + { 55, 255, 55, 255 }, // Green + { 155, 55, 150, 255 }, // Purple + { 0, 127, 255, 255 }, // Blue + { 255, 20, 20, 255 }, // Red + { 255, 255, 255, 255 }, // White +}; + +static SceneSelectEntry sScenes[] = { + { "Title Screen", (void*)MapSelect_LoadTitle, 0 }, + { "Hyrule Field", MapSelect_LoadGame, ENTR_HYRULE_FIELD_0 }, + { "Kakariko Village", MapSelect_LoadGame, ENTR_KAKARIKO_VILLAGE_0 }, + { "Graveyard", MapSelect_LoadGame, ENTR_GRAVEYARD_0 }, + { "Zora's River", MapSelect_LoadGame, ENTR_ZORAS_RIVER_0 }, + { "Kokiri Forest", MapSelect_LoadGame, ENTR_KOKIRI_FOREST_0 }, + { "Sacred Forest Meadow", MapSelect_LoadGame, ENTR_SACRED_FOREST_MEADOW_0 }, + { "Lake Hylia", MapSelect_LoadGame, ENTR_LAKE_HYLIA_0 }, + { "Zora's Domain", MapSelect_LoadGame, ENTR_ZORAS_DOMAIN_0 }, + { "Zora's Fountain", MapSelect_LoadGame, ENTR_ZORAS_FOUNTAIN_0 }, + { "Gerudo Valley", MapSelect_LoadGame, ENTR_GERUDO_VALLEY_0 }, + { "Lost Woods", MapSelect_LoadGame, ENTR_LOST_WOODS_0 }, + { "Desert Colossus", MapSelect_LoadGame, ENTR_DESERT_COLOSSUS_0 }, + { "Gerudo's Fortress", MapSelect_LoadGame, ENTR_GERUDOS_FORTRESS_0 }, + { "Haunted Wasteland", MapSelect_LoadGame, ENTR_HAUNTED_WASTELAND_0 }, + { "Hyrule Castle", MapSelect_LoadGame, ENTR_HYRULE_CASTLE_0 }, + { "Death Mountain Trail", MapSelect_LoadGame, ENTR_DEATH_MOUNTAIN_TRAIL_0 }, + { "Death Mountain Crater", MapSelect_LoadGame, ENTR_DEATH_MOUNTAIN_CRATER_0 }, + { "Goron City", MapSelect_LoadGame, ENTR_GORON_CITY_0 }, + { "Lon Lon Ranch", MapSelect_LoadGame, ENTR_LON_LON_RANCH_0 }, + { "Temple Of Time", MapSelect_LoadGame, ENTR_TEMPLE_OF_TIME_0 }, + { "Chamber of Sages", MapSelect_LoadGame, ENTR_CHAMBER_OF_THE_SAGES_0 }, + { "Shooting Gallery", MapSelect_LoadGame, ENTR_SHOOTING_GALLERY_0 }, + { "Castle Courtyard Game", MapSelect_LoadGame, ENTR_CASTLE_COURTYARD_GUARDS_DAY_0 }, + { "Heart Piece Grave", MapSelect_LoadGame, ENTR_REDEAD_GRAVE_0 }, + { "Hylian Shield Grave", MapSelect_LoadGame, ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN_0 }, + { "Royal Family's Tomb", MapSelect_LoadGame, ENTR_ROYAL_FAMILYS_TOMB_0 }, + { "Great Fairy's Fountain (Din)", MapSelect_LoadGame, ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC_0 }, + { "Great Fairy's Fountain (Farore)", MapSelect_LoadGame, ENTR_FAIRYS_FOUNTAIN_0 }, + { "Great Fairy's Fountain (Nayru)", MapSelect_LoadGame, ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS_0 }, + { "Ganon's Tower - Collapsing", MapSelect_LoadGame, ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_0 }, + { "Castle Courtyard", MapSelect_LoadGame, ENTR_CASTLE_COURTYARD_ZELDA_0 }, + { "Fishing Pond", MapSelect_LoadGame, ENTR_FISHING_POND_0 }, + { "Bombchu Bowling Alley", MapSelect_LoadGame, ENTR_BOMBCHU_BOWLING_ALLEY_0 }, + { "Lon Lon Ranch House", MapSelect_LoadGame, ENTR_LON_LON_BUILDINGS_0 }, + { "Lon Lon Ranch Silo", MapSelect_LoadGame, ENTR_LON_LON_BUILDINGS_1 }, + { "Lots O' Pots", MapSelect_LoadGame, ENTR_MARKET_GUARD_HOUSE_0 }, + { "Potion Shop", MapSelect_LoadGame, ENTR_POTION_SHOP_GRANNY_0 }, + { "Treasure Chest Game", MapSelect_LoadGame, ENTR_TREASURE_BOX_SHOP_0 }, + { "House Of Skulltula", MapSelect_LoadGame, ENTR_HOUSE_OF_SKULLTULA_0 }, + { "Market Entrance", MapSelect_LoadGame, ENTR_MARKET_ENTRANCE_DAY_0 }, + { "Market", MapSelect_LoadGame, ENTR_MARKET_DAY_0 }, + { "Back Alley", MapSelect_LoadGame, ENTR_BACK_ALLEY_DAY_0 }, + { "Temple of Time Exterior", MapSelect_LoadGame, ENTR_TEMPLE_OF_TIME_EXTERIOR_DAY_0 }, + { "Link's House", MapSelect_LoadGame, ENTR_LINKS_HOUSE_0 }, + { "Kakariko House 1", MapSelect_LoadGame, ENTR_KAKARIKO_CENTER_GUEST_HOUSE_0 }, + { "Back Alley House 1", MapSelect_LoadGame, ENTR_BACK_ALLEY_HOUSE_0 }, + { "House of Know-it-All Brothers", MapSelect_LoadGame, ENTR_KNOW_IT_ALL_BROS_HOUSE_0 }, + { "House of Twins", MapSelect_LoadGame, ENTR_TWINS_HOUSE_0 }, + { "Mido's House", MapSelect_LoadGame, ENTR_MIDOS_HOUSE_0 }, + { "Saria's House", MapSelect_LoadGame, ENTR_SARIAS_HOUSE_0 }, + { "Stable", MapSelect_LoadGame, ENTR_STABLE_0 }, + { "Grave Keeper's Hut", MapSelect_LoadGame, ENTR_GRAVEKEEPERS_HUT_0 }, + { "Dog Lady's House", MapSelect_LoadGame, ENTR_DOG_LADY_HOUSE_0 }, + { "Impa's House", MapSelect_LoadGame, ENTR_IMPAS_HOUSE_0 }, + { "Lakeside Laboratory", MapSelect_LoadGame, ENTR_LAKESIDE_LABORATORY_0 }, + { "Running Man's Tent", MapSelect_LoadGame, ENTR_CARPENTERS_TENT_0 }, + { "Bazaar", MapSelect_LoadGame, ENTR_BAZAAR_0 }, + { "Kokiri Shop", MapSelect_LoadGame, ENTR_KOKIRI_SHOP_0 }, + { "Goron Shop", MapSelect_LoadGame, ENTR_GORON_SHOP_0 }, + { "Zora Shop", MapSelect_LoadGame, ENTR_ZORA_SHOP_0 }, + { "Kakariko Potion Shop", MapSelect_LoadGame, ENTR_POTION_SHOP_KAKARIKO_0 }, + { "Potion Shop", MapSelect_LoadGame, ENTR_POTION_SHOP_MARKET_0 }, + { "Bombchu Shop ", MapSelect_LoadGame, ENTR_BOMBCHU_SHOP_0 }, + { "Happy Mask Shop", MapSelect_LoadGame, ENTR_HAPPY_MASK_SHOP_0 }, + { "Gerudo Training Ground", MapSelect_LoadGame, ENTR_GERUDO_TRAINING_GROUND_0 }, + { "Inside the Deku Tree", MapSelect_LoadGame, ENTR_DEKU_TREE_0 }, + { "Gohma's Lair", MapSelect_LoadGame, ENTR_DEKU_TREE_BOSS_0 }, + { "Dodongo's Cavern", MapSelect_LoadGame, ENTR_DODONGOS_CAVERN_0 }, + { "King Dodongo's Lair", MapSelect_LoadGame, ENTR_DODONGOS_CAVERN_BOSS_0 }, + { "Inside Jabu-Jabu's Belly", MapSelect_LoadGame, ENTR_JABU_JABU_0 }, + { "Barinade's Lair", MapSelect_LoadGame, ENTR_JABU_JABU_BOSS_0 }, + { "Forest Temple", MapSelect_LoadGame, ENTR_FOREST_TEMPLE_0 }, + { "Phantom Ganon's Lair", MapSelect_LoadGame, ENTR_FOREST_TEMPLE_BOSS_0 }, + { "Bottom of the Well", MapSelect_LoadGame, ENTR_BOTTOM_OF_THE_WELL_0 }, + { "Shadow Temple", MapSelect_LoadGame, ENTR_SHADOW_TEMPLE_0 }, + { "Bongo Bongo's Lair", MapSelect_LoadGame, ENTR_SHADOW_TEMPLE_BOSS_0 }, + { "Fire Temple", MapSelect_LoadGame, ENTR_FIRE_TEMPLE_0 }, + { "Volvagia's Lair", MapSelect_LoadGame, ENTR_FIRE_TEMPLE_BOSS_0 }, + { "Water Temple", MapSelect_LoadGame, ENTR_WATER_TEMPLE_0 }, + { "Morpha's Lair", MapSelect_LoadGame, ENTR_WATER_TEMPLE_BOSS_0 }, + { "Spirit Temple", MapSelect_LoadGame, ENTR_SPIRIT_TEMPLE_0 }, + { "Iron Knuckle's Lair", MapSelect_LoadGame, ENTR_SPIRIT_TEMPLE_BOSS_0 }, + { "Twinrova's Lair", MapSelect_LoadGame, ENTR_SPIRIT_TEMPLE_BOSS_2 }, + { "Ganon's Tower", MapSelect_LoadGame, ENTR_GANONS_TOWER_0 }, + { "Ganondorf's Lair", MapSelect_LoadGame, ENTR_GANONDORF_BOSS_0 }, + { "Ice Cavern", MapSelect_LoadGame, ENTR_ICE_CAVERN_0 }, + { "Dampe's Grave (Windmill)", MapSelect_LoadGame, ENTR_WINDMILL_AND_DAMPES_GRAVE_0 }, + { "Inside Ganon's Castle", MapSelect_LoadGame, ENTR_INSIDE_GANONS_CASTLE_0 }, + { "Ganon's Lair", MapSelect_LoadGame, ENTR_GANON_BOSS_0 }, + { "Escaping Ganon's Castle 1", MapSelect_LoadGame, ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_0 }, + { "Escaping Ganon's Castle 2", MapSelect_LoadGame, ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_2 }, + { "Escaping Ganon's Castle 3", MapSelect_LoadGame, ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_4 }, + { "Escaping Ganon's Castle 4", MapSelect_LoadGame, ENTR_GANONS_TOWER_COLLAPSE_INTERIOR_6 }, + { "Escaping Ganon's Castle 5", MapSelect_LoadGame, ENTR_INSIDE_GANONS_CASTLE_COLLAPSE_0 }, + { "Thieves' Hideout 1-2", MapSelect_LoadGame, ENTR_THIEVES_HIDEOUT_0 }, + { "Thieves' Hideout 3-4 9-10", MapSelect_LoadGame, ENTR_THIEVES_HIDEOUT_2 }, + { "Thieves' Hideout 5-6", MapSelect_LoadGame, ENTR_THIEVES_HIDEOUT_4 }, + { "Thieves' Hideout 7-8", MapSelect_LoadGame, ENTR_THIEVES_HIDEOUT_6 }, + { "Thieves' Hideout 11-12", MapSelect_LoadGame, ENTR_THIEVES_HIDEOUT_10 }, + { "Thieves' Hideout 13", MapSelect_LoadGame, ENTR_THIEVES_HIDEOUT_12 }, + { "Generic Grotto", MapSelect_LoadGame, ENTR_GROTTOS_0 }, + { "Grotto 1", MapSelect_LoadGame, ENTR_GROTTOS_1 }, + { "Heart Piece Scrub Grotto", MapSelect_LoadGame, ENTR_GROTTOS_2 }, + { "Kakariko Redead Grotto", MapSelect_LoadGame, ENTR_GROTTOS_3 }, + { "Grotto 4", MapSelect_LoadGame, ENTR_GROTTOS_4 }, + { "Hyrule Field Cow Grotto", MapSelect_LoadGame, ENTR_GROTTOS_5 }, + { "Octorock Grotto", MapSelect_LoadGame, ENTR_GROTTOS_6 }, + { "Grotto 7", MapSelect_LoadGame, ENTR_GROTTOS_7 }, + { "Wolfos Grotto", MapSelect_LoadGame, ENTR_GROTTOS_8 }, + { "Grotto 9", MapSelect_LoadGame, ENTR_GROTTOS_9 }, + { "Grotto 10", MapSelect_LoadGame, ENTR_GROTTOS_10 }, + { "Tektite Grotto", MapSelect_LoadGame, ENTR_GROTTOS_11 }, + { "Deku Theater Grotto", MapSelect_LoadGame, ENTR_GROTTOS_12 }, + { "Death Mountain Trail Cow Grotto", MapSelect_LoadGame, ENTR_GROTTOS_13 }, + { "Cutscene Map", MapSelect_LoadGame, ENTR_CUTSCENE_MAP_0 }, +#if CAN_INCLUDE_TEST_SCENES + { "Test Room", MapSelect_LoadGame, ENTR_BESITU_0 }, + { "SRD Map", MapSelect_LoadGame, ENTR_SASATEST_0 }, + { "Test Map", MapSelect_LoadGame, ENTR_TEST01_0 }, + { "Treasure Chest Warp", MapSelect_LoadGame, ENTR_TESTROOM_0 }, + { "Stalfos Miniboss Room", MapSelect_LoadGame, ENTR_SYOTES_0 }, + { "Stalfos Boss Room", MapSelect_LoadGame, ENTR_SYOTES2_0 }, + { "Dark Link Room", MapSelect_LoadGame, ENTR_SUTARU_0 }, + { "Shooting Gallery Duplicate", MapSelect_LoadGame, ENTR_TEST_SHOOTING_GALLERY_0 }, + { "Depth Test", MapSelect_LoadGame, ENTR_DEPTH_TEST_0 }, + { "Hyrule Garden Game (Broken)", MapSelect_LoadGame, ENTR_HAIRAL_NIWA2_0 }, +#endif +}; + +static const s16 childLinkSfx[] = { + NA_SE_VO_LI_SWORD_N_KID, + NA_SE_VO_LI_ROLLING_CUT_KID, + NA_SE_VO_LI_HANG_KID, + NA_SE_VO_LI_CLIMB_END_KID, + NA_SE_VO_LI_DAMAGE_S_KID, + NA_SE_VO_LI_FREEZE_KID, + NA_SE_VO_LI_FALL_S_KID, + NA_SE_VO_LI_FALL_L_KID, + NA_SE_VO_LI_BREATH_REST_KID, + NA_SE_VO_LI_BREATH_DRINK_KID, + NA_SE_VO_LI_DOWN_KID, + NA_SE_VO_LI_TAKEN_AWAY_KID, + NA_SE_VO_LI_HELD_KID, + NA_SE_VO_LI_SNEEZE_KID, + NA_SE_VO_LI_SWEAT_KID, + NA_SE_VO_LI_DRINK_KID, + NA_SE_VO_LI_RELAX_KID, + NA_SE_VO_LI_SWORD_PUTAWAY_KID, + NA_SE_VO_LI_GROAN_KID, + NA_SE_VO_LI_AUTO_JUMP_KID, + NA_SE_VO_LI_MAGIC_NALE_KID, + NA_SE_VO_LI_SURPRISE_KID, + NA_SE_VO_LI_MAGIC_FROL_KID, + NA_SE_VO_LI_PUSH_KID, + NA_SE_VO_LI_HOOKSHOT_HANG_KID, + NA_SE_VO_LI_LAND_DAMAGE_S_KID, + NA_SE_VO_LI_MAGIC_ATTACK_KID, + NA_SE_VO_BL_DOWN_KID, +}; + +static const u16 adultLinkSfx[] = { + NA_SE_VO_LI_SWORD_N, + NA_SE_VO_LI_SWORD_L, + NA_SE_VO_LI_LASH, + NA_SE_VO_LI_HANG, + NA_SE_VO_LI_CLIMB_END, + NA_SE_VO_LI_DAMAGE_S, + NA_SE_VO_LI_FREEZE, + NA_SE_VO_LI_FALL_S, + NA_SE_VO_LI_FALL_L, + NA_SE_VO_LI_BREATH_REST, + NA_SE_VO_LI_BREATH_DRINK, + NA_SE_VO_LI_DOWN, + NA_SE_VO_LI_TAKEN_AWAY, + NA_SE_VO_LI_HELD, + NA_SE_VO_LI_SNEEZE, + NA_SE_VO_LI_SWEAT, + NA_SE_VO_LI_DRINK, + NA_SE_VO_LI_RELAX, + NA_SE_VO_LI_SWORD_PUTAWAY, + NA_SE_VO_LI_GROAN, + NA_SE_VO_LI_AUTO_JUMP, + NA_SE_VO_LI_MAGIC_NALE, + NA_SE_VO_LI_SURPRISE, + NA_SE_VO_LI_MAGIC_FROL, + NA_SE_VO_LI_PUSH, + NA_SE_VO_LI_HOOKSHOT_HANG, + NA_SE_VO_LI_LAND_DAMAGE_S, + NA_SE_VO_LI_MAGIC_ATTACK, + NA_SE_VO_BL_DOWN, +}; + +#endif diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 78d4058ee..c2cb3b1cc 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -8,34 +8,67 @@ #include "alloca.h" #include "assets/textures/nintendo_rogo_static/nintendo_rogo_static.h" -#if OOT_DEBUG void ConsoleLogo_PrintBuildInfo(Gfx** gfxP) { - Gfx* gfx; - GfxPrint* printer; + if (IS_DEBUG) { + Gfx* gfx; + GfxPrint* printer; - gfx = *gfxP; - gfx = Gfx_SetupDL_28(gfx); - printer = alloca(sizeof(GfxPrint)); - GfxPrint_Init(printer); - GfxPrint_Open(printer, gfx); - GfxPrint_SetColor(printer, 255, 155, 255, 255); - GfxPrint_SetPos(printer, 9, 21); - GfxPrint_Printf(printer, "NOT MARIO CLUB VERSION"); - GfxPrint_SetColor(printer, 255, 255, 255, 255); - GfxPrint_SetPos(printer, 7, 23); - GfxPrint_Printf(printer, "[Creator:%s]", gBuildTeam); - GfxPrint_SetPos(printer, 7, 24); - GfxPrint_Printf(printer, "[Date:%s]", gBuildDate); - gfx = GfxPrint_Close(printer); - GfxPrint_Destroy(printer); - *gfxP = gfx; + gfx = *gfxP; + gfx = Gfx_SetupDL_28(gfx); + printer = alloca(sizeof(GfxPrint)); + GfxPrint_Init(printer); + GfxPrint_Open(printer, gfx); + + GfxPrint_SetColor(printer, 255, 255, 255, 255); + + GfxPrint_SetPos(printer, WIDE_MULT(7, WIDE_GET_16_9), 22); + GfxPrint_Printf(printer, "[Author:%s]", gBuildAuthor); + + GfxPrint_SetPos(printer, WIDE_MULT(7, WIDE_GET_16_9), 23); + GfxPrint_Printf(printer, "[Date:%s]", gBuildDate); + + GfxPrint_SetPos(printer, WIDE_MULT(7, WIDE_GET_16_9), 24); + GfxPrint_Printf(printer, "[Version:%s]", gBuildGitVersion); + + GfxPrint_SetPos(printer, WIDE_MULT(7, WIDE_GET_16_9), 25); + GfxPrint_Printf(printer, "[Build Option:%s]", gBuildMakeOption); + + if (ENABLE_F3DEX3) { + GfxPrint_SetPos(printer, WIDE_MULT(7, WIDE_GET_16_9), 27); + GfxPrint_Printf(printer, "Powered by F3DEX3!"); + } + + gfx = GfxPrint_Close(printer); + GfxPrint_Destroy(printer); + *gfxP = gfx; + } } -#endif // Note: In other rom versions this function also updates unk_1D4, coverAlpha, addAlpha, visibleDuration to calculate // the fade-in/fade-out + the duration of the n64 logo animation void ConsoleLogo_Calc(ConsoleLogoState* this) { - this->exit = true; + if (SKIP_N64_BOOT_LOGO) { + this->exit = true; + } else { + if (this->coverAlpha == 0 && this->visibleDuration != 0) { + this->timer--; + this->visibleDuration--; + if (this->timer == 0) { + this->timer = 400; + } + } else { + this->coverAlpha += this->addAlpha; + if (this->coverAlpha <= 0) { + this->coverAlpha = 0; + this->addAlpha = MM_N64_BOOT_LOGO ? 12 : 3; + } else if (this->coverAlpha >= 255) { + this->coverAlpha = 255; + this->exit = true; + } + } + this->uls = this->ult & 0x7F; + this->ult++; + } } void ConsoleLogo_SetupView(ConsoleLogoState* this, f32 x, f32 y, f32 z) { @@ -84,7 +117,7 @@ void ConsoleLogo_Draw(ConsoleLogoState* this) { gSPSetLights1(POLY_OPA_DISP++, sTitleLights); ConsoleLogo_SetupView(this, 0, 150.0, 300.0); Gfx_SetupDL_25Opa(this->state.gfxCtx); - Matrix_Translate(-53.0, -5.0, 0, MTXMODE_NEW); + Matrix_Translate(WIDE_INCR(-53.0, -8.0), -5.0, 0, MTXMODE_NEW); Matrix_Scale(1.0, 1.0, 1.0, MTXMODE_APPLY); Matrix_RotateZYX(0, sTitleRotY, 0, MTXMODE_APPLY); @@ -108,8 +141,8 @@ void ConsoleLogo_Draw(ConsoleLogoState* this) { G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gDPSetTileSize(POLY_OPA_DISP++, 1, this->uls, (this->ult & 0x7F) - (idx << 2), 0, 0); - gSPTextureRectangle(POLY_OPA_DISP++, 97 << 2, y << 2, 289 << 2, (y + 2) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, - 1 << 10); + gSPTextureRectangle(POLY_OPA_DISP++, WIDE_INCR(97, 8) << 2, y << 2, 289 << 2, (y + 2) << 2, G_TX_RENDERTILE, 0, + 0, WIDE_DIV((1 << 10), WIDE_GET_RATIO), 1 << 10); } Environment_FillScreen(this->state.gfxCtx, 0, 0, 0, (s16)this->coverAlpha, FILL_SCREEN_XLU); @@ -130,14 +163,9 @@ void ConsoleLogo_Main(GameState* thisx) { ConsoleLogo_Calc(this); ConsoleLogo_Draw(this); -#if OOT_DEBUG - if (gIsCtrlr2Valid) { - Gfx* gfx = POLY_OPA_DISP; - - ConsoleLogo_PrintBuildInfo(&gfx); - POLY_OPA_DISP = gfx; + if (IS_DEBUG) { + ConsoleLogo_PrintBuildInfo(&POLY_OPA_DISP); } -#endif if (this->exit) { gSaveContext.seqId = (u8)NA_BGM_DISABLED; @@ -173,8 +201,8 @@ void ConsoleLogo_Init(GameState* thisx) { gSaveContext.fileNum = 0xFF; Sram_Alloc(&this->state, &this->sramCtx); this->ult = 0; - this->unk_1D4 = 0x14; + this->timer = 20; this->coverAlpha = 255; - this->addAlpha = -3; + this->addAlpha = MM_N64_BOOT_LOGO ? -12 : -3; this->visibleDuration = 0x3C; } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index a372bdf15..ae13be22e 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -464,10 +464,11 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { } if (pauseCtx->state == PAUSE_STATE_MAIN) { + sp21A += 4; + gDPPipeSync(POLY_OPA_DISP++); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - sp21A += 4; if ((pauseCtx->cursorSpecialPos == 0) && (sp216 >= 6) && (sp216 < 0x12)) { if ((pauseCtx->mainState < PAUSE_MAIN_STATE_3) || (pauseCtx->mainState == PAUSE_MAIN_STATE_5) || (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) { @@ -484,7 +485,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); if (pauseCtx->ocarinaStaff->pos != 0) { - if (D_8082A11C + 1 == pauseCtx->ocarinaStaff->pos) { + if (D_8082A11C == (pauseCtx->ocarinaStaff->pos - 1)) { D_8082A11C++; D_8082A124[pauseCtx->ocarinaStaff->pos - 1] = pauseCtx->ocarinaStaff->buttonIndex; } @@ -510,7 +511,12 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gDPPipeSync(POLY_OPA_DISP++); if (D_8082A124[sp218] == 0) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 80, 255, 150, D_8082A150[sp218]); + Color_RGB8 color = { 80, 255, 150 }; + if (N64_BTN_COLORS) { + color.g = 150; + color.b = 255; + } + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color.r, color.g, color.b, D_8082A150[sp218]); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, D_8082A150[sp218]); } @@ -541,7 +547,12 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { if (pauseCtx->mainState == PAUSE_MAIN_STATE_8) { if (gOcarinaSongButtons[sp224].buttonsIndex[phi_s3] == OCARINA_BTN_A) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 80, 255, 150, 200); + Color_RGB8 color = { 80, 255, 150 }; + if (N64_BTN_COLORS) { + color.g = 150; + color.b = 255; + } + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color.r, color.g, color.b, 200); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, 200); } @@ -596,7 +607,12 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gDPPipeSync(POLY_OPA_DISP++); if (D_8082A124[phi_s3] == 0) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 80, 255, 150, D_8082A150[phi_s3]); + Color_RGB8 color = { 80, 255, 150 }; + if (N64_BTN_COLORS) { + color.g = 150; + color.b = 255; + } + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color.r, color.g, color.b, D_8082A150[phi_s3]); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, D_8082A150[phi_s3]); } @@ -660,16 +676,16 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); } - phi_s0 = 0; + cursorItem = 0; for (sp21A = 0; sp21A < 3; sp21A++, sp218 += 4) { - if ((sp21A >= 2) || (sp208[sp21A] != 0) || (phi_s0 != 0)) { + if ((sp21A >= 2) || (sp208[sp21A] != 0) || (cursorItem != 0)) { gDPLoadTextureBlock(POLY_OPA_DISP++, ((u8*)gCounterDigit0Tex + (8 * 16 * sp208[sp21A])), G_IM_FMT_I, G_IM_SIZ_8b, 8, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSP1Quadrangle(POLY_OPA_DISP++, sp218, sp218 + 2, sp218 + 3, sp218 + 1, 0); - phi_s0 = 1; + cursorItem = 1; } } } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c index bdd17f011..a6ffcb52e 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c @@ -41,37 +41,37 @@ void KaleidoScope_DrawDebugEditorText(Gfx** gfxP) { GfxPrint_Init(&printer); GfxPrint_Open(&printer, *gfxP); - GfxPrint_SetPos(&printer, 4, 2); + GfxPrint_SetPos(&printer, 3, 2); GfxPrint_SetColor(&printer, 255, 60, 0, 255); - GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ルピー"); // "Rupee" - GfxPrint_SetPos(&printer, 15, 2); - GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ハート"); // "Heart" + GfxPrint_Printf(&printer, "%s", "Rupee"); + GfxPrint_SetPos(&printer, 13, 2); + GfxPrint_Printf(&printer, "%s", "Heart"); GfxPrint_SetPos(&printer, 26, 3); GfxPrint_Printf(&printer, "%s", "/4"); GfxPrint_SetPos(&printer, 4, 5); - GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "アイテム"); // "Item" + GfxPrint_Printf(&printer, "%s", "Item"); GfxPrint_SetPos(&printer, 4, 13); GfxPrint_Printf(&printer, "%s", "KEY"); GfxPrint_SetPos(&printer, 4, 15); - GfxPrint_Printf(&printer, "%s", GFXP_HIRAGANA "ソウビ"); // "Equipment" + GfxPrint_Printf(&printer, "%s", "Eq."); // "Equipment" GfxPrint_SetPos(&printer, 23, 14); - GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ï½¹ï¾"); // "Sword" + GfxPrint_Printf(&printer, "%s", "Sw"); // "Sword" GfxPrint_SetPos(&printer, 23, 15); - GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "タテ"); // "Shield" + GfxPrint_Printf(&printer, "%s", "Sh"); // "Shield" GfxPrint_SetPos(&printer, 4, 17); GfxPrint_Printf(&printer, "%s", "MAP"); GfxPrint_SetPos(&printer, 4, 19); - GfxPrint_Printf(&printer, "%s", GFXP_HIRAGANA "フウイï¾"); // "Seal" + GfxPrint_Printf(&printer, "%s", "Med."); // "Seal", medallions GfxPrint_SetPos(&printer, 20, 19); - GfxPrint_Printf(&printer, "%s", GFXP_HIRAGANA "セイレイセキ"); // "Spiritual Stone" + GfxPrint_Printf(&printer, "%s", "Stones"); GfxPrint_SetPos(&printer, 4, 21); - GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "オカリナ"); // "Ocarina" + GfxPrint_Printf(&printer, "%s", "Songs"); GfxPrint_SetPos(&printer, 4, 24); - GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "コレクト"); // "Collect" - GfxPrint_SetPos(&printer, 14, 24); - GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "ï½·ï¾ï½½ï¾€"); // "Skulltula" + GfxPrint_Printf(&printer, "%s", "Quest"); // "Collect" (stone of agony/gerudo card) + GfxPrint_SetPos(&printer, 12, 24); + GfxPrint_Printf(&printer, "%s", "Tokens"); // "Skulltula" GfxPrint_SetPos(&printer, 23, 24); - GfxPrint_Printf(&printer, "%s", GFXP_KATAKANA "カケラ"); // "Gold Token" + GfxPrint_Printf(&printer, "%s", "HP"); // heart pieces GfxPrint_SetPos(&printer, 28, 24); GfxPrint_Printf(&printer, "%s", "/4"); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index e5a3a9918..529bb6142 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -16,8 +16,6 @@ static u8 sEquipmentItemOffsets[] = { 0x00, 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x00, 0x06, 0x07, 0x08, 0x00, 0x09, 0x0A, 0x0B, }; -static s16 sEquipTimer = 0; - void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u32 height) { PauseContext* pauseCtx = &play->pauseCtx; u8* curTexture; @@ -119,6 +117,7 @@ void KaleidoScope_DrawPlayerWork(PlayState* play) { void KaleidoScope_ProcessPlayerPreRender(PlayState* play); void KaleidoScope_DrawEquipment(PlayState* play) { + static s16 sEquipTimer = 0; PauseContext* pauseCtx = &play->pauseCtx; Input* input = &play->state.input[0]; u16 i; @@ -437,8 +436,8 @@ void KaleidoScope_DrawEquipment(PlayState* play) { cursorSlot = pauseCtx->cursorPoint[PAUSE_EQUIP]; - pauseCtx->cursorItem[PAUSE_EQUIP] = cursorItem; pauseCtx->cursorSlot[PAUSE_EQUIP] = cursorSlot; + pauseCtx->cursorItem[PAUSE_EQUIP] = cursorItem; PRINTF("kscope->select_name[Display_Equipment] = %d\n", pauseCtx->cursorItem[PAUSE_EQUIP]); @@ -552,8 +551,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { if (LINK_AGE_IN_YEARS == YEARS_CHILD) { point = CUR_UPG_VALUE(sChildUpgrades[i]); - if (1) {} - if ((point != 0) && (CUR_UPG_VALUE(sChildUpgrades[i]) != 0)) { + if (((u32)point != 0) && (CUR_UPG_VALUE(sChildUpgrades[i]) != 0)) { KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[sChildUpgradeItemBases[i] + point - 1], ITEM_ICON_WIDTH, ITEM_ICON_HEIGHT, 0); @@ -606,7 +604,5 @@ void KaleidoScope_DrawEquipment(PlayState* play) { Gfx_SetupDL_42Opa(play->state.gfxCtx); KaleidoScope_DrawEquipmentImage(play, pauseCtx->playerSegment, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT); - if (gUpgradeMasks[0]) {} - CLOSE_DISPS(play->state.gfxCtx, "../z_kaleido_equipment.c", 609); } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index 090fa4114..8f0bcd979 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -118,6 +118,10 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { pauseCtx->stickAdjX = 40; } +#if !IS_DEBUG + if (&gSaveContext) {} +#endif + if (ABS(pauseCtx->stickAdjX) > 30) { cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; cursorX = pauseCtx->cursorX[PAUSE_ITEM]; @@ -125,9 +129,11 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { PRINTF("now=%d ccc=%d\n", cursorPoint, cursorItem); +#if IS_DEBUG // Seems necessary to match if (pauseCtx->cursorX[PAUSE_ITEM]) {} if (gSaveContext.save.info.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]) {} +#endif while (moveCursorResult == 0) { if (pauseCtx->stickAdjX < -30) { @@ -535,7 +541,9 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { offsetX = ABS(pauseCtx->equipAnimX - bowItemVtx->v.ob[0] * 10) / sEquipMoveTimer; offsetY = ABS(pauseCtx->equipAnimY - bowItemVtx->v.ob[1] * 10) / sEquipMoveTimer; } else { - offsetX = ABS(pauseCtx->equipAnimX - sCButtonPosX[pauseCtx->equipTargetCBtn]) / sEquipMoveTimer; + offsetX = + ABS(pauseCtx->equipAnimX - WIDE_C_VAL(sCButtonPosX[pauseCtx->equipTargetCBtn], pauseCtx->equipTargetCBtn)) / + sEquipMoveTimer; offsetY = ABS(pauseCtx->equipAnimY - sCButtonPosY[pauseCtx->equipTargetCBtn]) / sEquipMoveTimer; } @@ -565,7 +573,8 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { pauseCtx->equipAnimY += offsetY; } } else { - if (pauseCtx->equipAnimX >= sCButtonPosX[pauseCtx->equipTargetCBtn]) { + if (pauseCtx->equipAnimX >= + WIDE_C_VAL(sCButtonPosX[pauseCtx->equipTargetCBtn], pauseCtx->equipTargetCBtn)) { pauseCtx->equipAnimX -= offsetX; } else { pauseCtx->equipAnimX += offsetX; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c index 5bf7b93d4..dd1c1bf8d 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c @@ -495,7 +495,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) { gDPPipeSync(POLY_OPA_DISP++); - if (HREG(15) == 0) { + if (!IS_DEBUG || (HREG(15) == 0)) { gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT); gDPLoadTLUT_pal256(POLY_OPA_DISP++, gWorldMapImageTLUT); @@ -540,11 +540,13 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) { POLY_OPA_DISP = gfx; } +#if IS_DEBUG if (HREG(15) == 2) { HREG(15) = 1; HREG(14) = 6100; HREG(13) = 5300; } +#endif if (ZREG(38) == 0) { gDPPipeSync(POLY_OPA_DISP++); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h index d352ad678..b3aed0daa 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h @@ -27,7 +27,7 @@ extern u8 gAreaGsFlags[]; void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx); s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point); -void KaleidoScope_DrawDebugEditor(PlayState* play); +void KaleidoScope_DrawDebugEditor(PlayState* play); // ENABLE_INV_EDITOR void KaleidoScope_DrawPlayerWork(PlayState* play); void KaleidoScope_DrawEquipment(PlayState* play); void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 0cecf55e2..3ce74d2d8 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -325,7 +325,11 @@ static void* sCursorTexs[] = { static s16 sCursorColors[][3] = { { 255, 255, 255 }, { 255, 255, 0 }, +#if N64_BTN_COLORS + { 0, 50, 255 }, +#else { 0, 255, 50 }, +#endif }; static void* sSavePromptTexs[] = { @@ -383,9 +387,11 @@ void KaleidoScope_SetupPlayerPreRender(PlayState* play) { } void KaleidoScope_ProcessPlayerPreRender(void) { - Sleep_Msec(50); - PreRender_ApplyFilters(&sPlayerPreRender); - PreRender_Destroy(&sPlayerPreRender); + if (ENABLE_PAUSE_BG_AA) { + Sleep_Msec(50); + PreRender_ApplyFilters(&sPlayerPreRender); + PreRender_Destroy(&sPlayerPreRender); + } } Gfx* KaleidoScope_QuadTextureIA4(Gfx* gfx, void* texture, s16 width, s16 height, u16 point) { @@ -406,6 +412,8 @@ Gfx* KaleidoScope_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, void KaleidoScope_OverridePalIndexCI4(u8* texture, s32 size, s32 targetIndex, s32 newIndex) { s32 i; + s32 index1; + s32 index2; targetIndex &= 0xF; newIndex &= 0xF; @@ -415,9 +423,6 @@ void KaleidoScope_OverridePalIndexCI4(u8* texture, s32 size, s32 targetIndex, s3 } for (i = 0; i < size; i++) { - s32 index1; - s32 index2; - index1 = index2 = texture[i]; index1 = (index1 >> 4) & 0xF; @@ -518,7 +523,7 @@ void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) { } void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) { - if ((pauseCtx->debugState == 0) && CHECK_BTN_ALL(input->press.button, BTN_L)) { + if (IS_INV_EDITOR_ENABLED && (pauseCtx->debugState == 0) && CHECK_BTN_ALL(input->press.button, BTN_L)) { pauseCtx->debugState = 1; return; } @@ -556,20 +561,19 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) { void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) { PauseContext* pauseCtx = &play->pauseCtx; - u16 temp; + s32 pad; OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 955); - temp = pauseCtx->mainState; - - if ((((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (temp == PAUSE_MAIN_STATE_8)) && + if (((((u32)pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) && (pauseCtx->state == PAUSE_STATE_MAIN)) || ((pauseCtx->pageIndex == PAUSE_QUEST) && - ((temp < PAUSE_MAIN_STATE_3) || (temp == PAUSE_MAIN_STATE_5) || (temp == PAUSE_MAIN_STATE_8)))) { + ((pauseCtx->mainState < PAUSE_MAIN_STATE_3) || (pauseCtx->mainState == PAUSE_MAIN_STATE_5) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_8)))) { + s16 i; + s16 j; if (pauseCtx->pageIndex == pageIndex) { - s16 i; - s16 j; gDPPipeSync(POLY_OPA_DISP++); gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, @@ -630,10 +634,17 @@ Gfx* KaleidoScope_DrawPageSections(Gfx* gfx, Vtx* vertices, void** textures) { } void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { +#if N64_BTN_COLORS + static s16 D_8082ACF4[][3] = { + { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 255, 255, 0 }, { 0, 0, 0 }, + { 0, 0, 0 }, { 255, 255, 0 }, { 0, 50, 255 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 50, 255 }, + }; +#else static s16 D_8082ACF4[][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 255, 255, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 255, 255, 0 }, { 0, 255, 50 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 255, 50 }, }; +#endif static s16 D_8082AD3C = 20; static s16 D_8082AD40 = 0; static s16 sStickXRepeatTimer = 0; @@ -645,6 +656,12 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { s16 stepG; s16 stepB; + Color_RGB8 color = { 100, 255, 100 }; + if (N64_BTN_COLORS) { + color.g = 100; + color.b = 255; + } + OPEN_DISPS(gfxCtx, "../z_kaleido_scope_PAL.c", 1100); if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { @@ -966,7 +983,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 255, 100, VREG(61)); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color.r, color.g, color.b, VREG(61)); if (pauseCtx->promptChoice == 0) { gSPDisplayList(POLY_OPA_DISP++, gPromptCursorLeftDL); @@ -991,7 +1008,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 255, 100, VREG(61)); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color.r, color.g, color.b, VREG(61)); if (pauseCtx->promptChoice == 0) { gSPDisplayList(POLY_OPA_DISP++, gPromptCursorLeftDL); @@ -1279,6 +1296,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { ITEM_NAME_TEX_HEIGHT, 0); } +#if IS_DEBUG if (pauseCtx->pageIndex == PAUSE_MAP) { if (YREG(7) != 0) { PRINTF(VT_FGCOL(YELLOW)); @@ -1291,6 +1309,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { gAreaGsFlags[D_8082AE30[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]]); } } +#endif if ((pauseCtx->pageIndex == PAUSE_MAP) && !sInDungeonScene) { if (GET_GS_FLAGS(D_8082AE30[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]) == @@ -1913,7 +1932,6 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) { PauseContext* pauseCtx = &play->pauseCtx; s16 phi_t1; s16 phi_t2; - s16 phi_t2_2; s16 phi_t3; s16 phi_t4; s16 phi_t5; @@ -2282,7 +2300,7 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->questVtx = GRAPH_ALLOC(gfxCtx, 188 * sizeof(Vtx)); for (phi_t4 = 0, phi_t3 = 0; phi_t3 < 47; phi_t3++, phi_t4 += 4) { - phi_t2_2 = D_8082B1F8[phi_t3]; + s16 phi_t2_2 = D_8082B1F8[phi_t3]; if ((phi_t3 < 6) || (phi_t3 >= 41)) { pauseCtx->questVtx[phi_t4 + 0].v.ob[0] = pauseCtx->questVtx[phi_t4 + 2].v.ob[0] = D_8082B138[phi_t3]; @@ -2399,6 +2417,12 @@ void KaleidoScope_DrawGameOver(PlayState* play) { CLOSE_DISPS(gfxCtx, "../z_kaleido_scope_PAL.c", 3169); } +#if IS_DEBUG && (ENABLE_INV_EDITOR || ENABLE_EVENT_EDITOR) +#define CAN_DRAW_PAUSE_MENU (pauseCtx->debugState == 0) +#else +#define CAN_DRAW_PAUSE_MENU true +#endif + void KaleidoScope_Draw(PlayState* play) { Input* input = &play->state.input[0]; PauseContext* pauseCtx = &play->pauseCtx; @@ -2417,7 +2441,7 @@ void KaleidoScope_Draw(PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x0C, pauseCtx->iconItemAltSegment); gSPSegment(POLY_OPA_DISP++, 0x0D, pauseCtx->iconItemLangSegment); - if (pauseCtx->debugState == 0) { + if (CAN_DRAW_PAUSE_MENU) { KaleidoScope_SetView(pauseCtx, pauseCtx->eye.x, pauseCtx->eye.y, pauseCtx->eye.z); Gfx_SetupDL_42Opa(play->state.gfxCtx); @@ -2439,7 +2463,8 @@ void KaleidoScope_Draw(PlayState* play) { KaleidoScope_DrawGameOver(play); } - if ((pauseCtx->debugState == 1) || (pauseCtx->debugState == 2)) { + if (IS_DEBUG && + ((ENABLE_INV_EDITOR && (pauseCtx->debugState == 1)) || (ENABLE_EVENT_EDITOR && (pauseCtx->debugState == 2)))) { KaleidoScope_DrawDebugEditor(play); } @@ -3281,7 +3306,9 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->alpha = 0; } } else { - pauseCtx->debugState = 0; + if (IS_DEBUG && (ENABLE_INV_EDITOR || ENABLE_EVENT_EDITOR)) { + pauseCtx->debugState = 0; + } pauseCtx->state = PAUSE_STATE_RESUME_GAMEPLAY; pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = 160.0f; pauseCtx->namedItem = PAUSE_ITEM_NONE; @@ -3289,6 +3316,9 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->unk_204 = -434.0f; } break; + + default: + break; } break; @@ -3601,7 +3631,9 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->alpha = 0; } } else { - pauseCtx->debugState = 0; + if (IS_INV_EDITOR_ENABLED) { + pauseCtx->debugState = 0; + } pauseCtx->state = PAUSE_STATE_RESUME_GAMEPLAY; pauseCtx->unk_200 = 160.0f; pauseCtx->unk_1FC = 160.0f; @@ -3653,7 +3685,7 @@ void KaleidoScope_Update(PlayState* play) { PRINTF("i=%d LAST_TIME_TYPE=%d\n", i, gSaveContext.prevHudVisibilityMode); gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; Interface_ChangeHudVisibilityMode(gSaveContext.prevHudVisibilityMode); - player->targetActor = NULL; + player->talkActor = NULL; Player_SetEquipmentData(play, player); PRINTF(VT_RST); break; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c index 29191c689..0a3c23f7e 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -127,7 +127,13 @@ void PauseMapMark_DrawForDungeon(PlayState* play) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); Matrix_Push(); - Matrix_Translate(GREG(92) + markPoint->x, GREG(93) + markPoint->y, 0.0f, MTXMODE_APPLY); + +#if IS_DEBUG + Matrix_Translate(markPoint->x + GREG(92), markPoint->y + GREG(93), 0.0f, MTXMODE_APPLY); +#else + Matrix_Translate(markPoint->x, markPoint->y, 0.0f, MTXMODE_APPLY); +#endif + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_lmap_mark.c", 272), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/sym_info.py b/sym_info.py index 1ef09b2fc..dd6af0356 100755 --- a/sym_info.py +++ b/sym_info.py @@ -9,7 +9,7 @@ import mapfile_parser def symInfoMain(): parser = argparse.ArgumentParser(description="Display various information about a symbol or address.") parser.add_argument("symname", help="symbol name or VROM/VRAM address to lookup") - parser.add_argument("-v", "--oot-version", help="Which version should be processed", default="gc-eu-mq-dbg") + parser.add_argument("-v", "--oot-version", help="Which version should be processed", default="hackeroot-mq") parser.add_argument("-e", "--expected", dest="use_expected", action="store_true", help="use the map file in expected/build/ instead of build/") args = parser.parse_args() diff --git a/tools/.gitignore b/tools/.gitignore index 4dff1be3a..d8f678349 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -7,5 +7,9 @@ mkldscript reloc_prereq vtxdis yaz0 +gzinject/gzinject +gzinject/obj/* +z64compress/z64compress +z64compress/o/* graphovl/ diff --git a/tools/Flips/.gitattributes b/tools/Flips/.gitattributes new file mode 100644 index 000000000..2efbd2076 --- /dev/null +++ b/tools/Flips/.gitattributes @@ -0,0 +1,3 @@ +libdivsufsort-2.0.1/** linguist-vendored +divsufsort.c linguist-vendored +divsufsort.h linguist-vendored diff --git a/tools/Flips/.gitignore b/tools/Flips/.gitignore new file mode 100644 index 000000000..552e6f459 --- /dev/null +++ b/tools/Flips/.gitignore @@ -0,0 +1,8 @@ +obj/ +flips +flips.exe + +*.obj +flips.res +*.pgc +*.pgd diff --git a/tools/Flips/COPYING b/tools/Flips/COPYING new file mode 100644 index 000000000..e7460264e --- /dev/null +++ b/tools/Flips/COPYING @@ -0,0 +1,11 @@ +Floating IPS is licensed under GNU General Public License, version 3.0 or higher. The full legal + text can be found in COPYING.gpl3; a rough interpretation (for non-lawyers only) follows: + +- You must credit the author. Don't claim it as your own. You may modify it and take credit for your + modifications, but the author (Alcaro) must be credited for the original software. +- If you modify this software, it must clearly be labeled as a modification. +- Any applications containing any part of this software must provide the full source code needed to + modify and rebuild this application, under the same license. Including this interpretation is + optional. +- The author claims no copyright over input, output, or error messages generated by this tool. Use + it however you want. diff --git a/tools/Flips/COPYING.gpl3 b/tools/Flips/COPYING.gpl3 new file mode 100644 index 000000000..94a9ed024 --- /dev/null +++ b/tools/Flips/COPYING.gpl3 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/tools/Flips/Makefile b/tools/Flips/Makefile new file mode 100644 index 000000000..b3d5aeb07 --- /dev/null +++ b/tools/Flips/Makefile @@ -0,0 +1,119 @@ +#This script creates a debug-optimized binary by default. If you're on Linux, you'll get a faster binary from make.sh. + +SRCDIR := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))) + +CFLAGS_gtk = -DFLIPS_GTK $(GTKFLAGS) $(GTKLIBS) +CFLAGS_windows := -DFLIPS_WINDOWS -mwindows -lgdi32 -lcomdlg32 -lcomctl32 -luser32 -lkernel32 -lshell32 -ladvapi32 +CFLAGS_cli := -DFLIPS_CLI + +CFLAGS_G = -fno-rtti -fno-exceptions -DNDEBUG -Wall + +FNAME_gtk := flips +FNAME_windows := flips.exe +FNAME_cli := flips + +CXX ?= g++ +CFLAGS ?= -g + +XFILES := + +SOURCES := $(SRCDIR)/*.cpp + +PREFIX ?= /usr +BINDIR ?= $(PREFIX)/bin +DATAROOTDIR ?= $(PREFIX)/share +DATADIR ?= $(DATAROOTDIR) + +ifeq ($(TARGET),win) + override TARGET := windows +endif + +ifeq ($(TARGET),) + targetmachine := $(shell $(CXX) -dumpmachine) + ifneq ($(findstring mingw,$(targetmachine)),) + TARGET := windows + else ifneq ($(findstring linux,$(targetmachine)),) + TARGET := gtk + else + TARGET := + endif +endif + +ifeq ($(TARGET),) + uname := $(shell uname -a) + ifeq ($(uname),) + TARGET := windows + else ifneq ($(findstring CYGWIN,$(uname)),) + TARGET := windows + else ifneq ($(findstring Darwin,$(uname)),) + TARGET := cli + else + TARGET := gtk + endif +endif + +ifeq ($(TARGET),gtk) + ifeq ($(GTKFLAGS),) + GTKFLAGS := $(shell pkg-config --cflags --libs gtk+-3.0) + endif + ifeq ($(GTKFLAGS),) + $(warning pkg-config can't find gtk+-3.0, or pkg-config itself can't be found) + $(warning if you have the needed files installed, specify their locations and names with `make GTKFLAGS='-I/usr/include' GTKLIBS='-L/usr/lib -lgtk'') + $(warning if not, the package names under Debian and derivates are `pkg-config libgtk-3-dev'; for other distros, consult a search engine) + TARGET := cli + ifeq ($(TARGET),gtk) + $(warning build will now fail) + else + $(warning switching to CLI build) + endif + endif +endif + +all: $(FNAME_$(TARGET)) +obj: + mkdir obj +clean: | obj + rm obj/* || true + +ifeq ($(TARGET),windows) + XFILES += obj/rc.o +obj/rc.o: flips.rc flips.h | obj + windres flips.rc obj/rc.o +endif + +MOREFLAGS := $(CFLAGS_$(TARGET)) + +DIVSUF := $(SRCDIR)/libdivsufsort-2.0.1 +SOURCES += $(DIVSUF)/lib/divsufsort.c $(DIVSUF)/lib/sssort.c $(DIVSUF)/lib/trsort.c +MOREFLAGS += -I$(DIVSUF)/include -DHAVE_CONFIG_H -D__STDC_FORMAT_MACROS + +ifeq ($(TARGET),gtk) + CFLAGS_G += -fopenmp +endif + +$(FNAME_$(TARGET)): $(SOURCES) $(XFILES) + $(CXX) $^ -std=c++98 $(CFLAGS_G) $(MOREFLAGS) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) $(LFLAGS) -o$@ +ifeq ($(CFLAGS),-g) + echo 'Compiled Floating IPS in debug mode; for better performance, use ./make.sh instead' +endif + +ifeq ($(TARGET),gtk) +install: all + mkdir -p $(DESTDIR)$(BINDIR) + mkdir -p $(DESTDIR)$(DATAROOTDIR)/applications + mkdir -p $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps + mkdir -p $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/symbolic/apps + mkdir -p $(DESTDIR)$(DATAROOTDIR)/metainfo + install -p -m755 $(FNAME_$(TARGET)) $(DESTDIR)$(BINDIR) + install -p -m755 $(SRCDIR)/data/com.github.Alcaro.Flips.desktop $(DESTDIR)$(DATAROOTDIR)/applications + install -p -m644 $(SRCDIR)/data/com.github.Alcaro.Flips.svg $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps + install -p -m644 $(SRCDIR)/data/com.github.Alcaro.Flips-symbolic.svg $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/symbolic/apps + install -p -m644 $(SRCDIR)/data/com.github.Alcaro.Flips.metainfo.xml $(DESTDIR)$(DATAROOTDIR)/metainfo + +uninstall: + rm -f $(DESTDIR)$(BINDIR)/$(FNAME_$(TARGET)) + rm -f $(DESTDIR)$(DATAROOTDIR)/applications/com.github.Alcaro.Flips.desktop + rm -f $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/scalable/apps/com.github.Alcaro.Flips.svg + rm -f $(DESTDIR)$(DATAROOTDIR)/icons/hicolor/symbolic/apps/com.github.Alcaro.Flips-symbolic.svg + rm -f $(DESTDIR)$(DATAROOTDIR)/metainfo/com.github.Alcaro.Flips.metainfo.xml +endif diff --git a/tools/Flips/README.md b/tools/Flips/README.md new file mode 100644 index 000000000..15cd0d1e5 --- /dev/null +++ b/tools/Flips/README.md @@ -0,0 +1,39 @@ +Floating IPS (or Flips) is a patcher for IPS and BPS files, aiming for a simple interface yet plenty of power under the hood. + +Features: +- Creates the smallest BPS patches of any known tool in existence, and is faster than any other comparable creator +- Creates the smallest IPS patches of any known tool in existence, too (but only a little smaller, Lunar IPS is quite good) +- Fully-featured GUIs under Windows and GTK+, including command line support; can also be a pure command line program +- Can apply multiple patches to the same ROM, creating a huge pile of ROMs (GUI only) +- Can remembers which ROMs you've used, and use them again if it thinks it's correct (BPS only, GUI only) +- Can launch other programs after patching the ROMs; together with the above, this allows you to double click a BPS to launch an emulator (GUI only) + +Floating IPS is in maintenance mode. Bug reports and pull requests will be processed, but feature requests are unlikely to be implemented. There will be no formal releases within any forseeable future; users should consider every commit a release. + +Third-party forks, or separate tools, covering usecases this version doesn't (this only acknowledges their existence, and is not an endorsement; I haven't used most of them): +- [Floating IPS](https://github.com/Alcaro/Flips); the original Floating IPS, in case you're currently looking at a fork +- [MultiPatch](https://projects.sappharad.com/tools/multipatch.html), OSX, applies BPS/IPS/UPS/PPF/Xdelta/bsdiff/Ninja2, creates BPS/IPS/XDelta/bsdiff +- [QtFloatingIPS](https://github.com/covarianttensor/QtFloatingIPS), Flips port to OSX (may work on others too) +- [Wh0ba Floating IPS](https://wh0ba.github.io/repo/), Flips port to iOS/Cydia +- [RomPatcher.js](https://www.marcrobledo.com/RomPatcher.js/), JavaScript, applies APS/BPS/IPS/PPF/RUP/UPS/Xdelta, creates APS/BPS/IPS/RUP/UPS +- There are many tools that offer a strict subset of Flips functionality (Lunar IPS, beat, etc). I'm not listing them here. + +Compilation - Linux: +- `sudo apt-get install g++ build-essential`; for GUI support, also `sudo apt-get install libgtk-3-dev pkg-config`; adjust for your distro if necessary +- `./make.sh` to build an optimized binary; for development, use `make CFLAGS=-g` (ignore make-maintainer.sh) +- Alternatively, if you prefer binaries, `flatpak install com.github.Alcaro.Flips` + +Compilation - OSX, other Unix, or anything else with a C++ compiler: +- Install a C++ compiler +- `clang++ *.c *.cpp -O3 -o flips` (with changes as appropriate) +- For GTK GUI support, use some suitable variant of `clang++ *.c *.cpp -O3 -o flips -DFLIPS_GTK -lgtk3` +- For better optimizations (profiling/etc), extract the appropriate commands from Makefile and make.sh + +Compilation - Windows: +- Install [mingw-w64](https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/seh/), or similar +- `mingw32-make CFLAGS=-O3` (GUI is automatically enabled), or extract the appropriate optimization commands from make.sh +- Alternatively, [here's a binary](https://www.smwcentral.net/?p=section&a=details&id=11474) (though it's quite outdated). + +Usage: +- If GUI is enabled, just run the program. File pickers' window titles tell what they want; Enable automatic ROM picker and Run in Emulator can cause file pickers to appear and disappear depending on the chosen patch, making usage less predictable, so it's disabled by default. +- For CLI use, see `./flips --help`. Available both with or without GUI support (though Windows CLI use from interactive prompts is slightly screwy, due to OS limitations). diff --git a/tools/Flips/appveyor.yml b/tools/Flips/appveyor.yml new file mode 100644 index 000000000..ec8d5f9a0 --- /dev/null +++ b/tools/Flips/appveyor.yml @@ -0,0 +1,13 @@ +version: appveyor.{build} +image: + - Visual Studio 2017 + - Ubuntu +environment: + MINGW_DIR: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0 +install: + - cmd: set PATH=%MINGW_DIR%\mingw64\bin;%PATH% + - sh: sudo apt update + - sh: sudo apt -y install libgtk-3-dev +build_script: + - cmd: mingw32-make.exe TARGET=windows CFLAGS=-O3 + - sh: make \ No newline at end of file diff --git a/tools/Flips/bps.ico b/tools/Flips/bps.ico new file mode 100644 index 000000000..9beb98ba5 Binary files /dev/null and b/tools/Flips/bps.ico differ diff --git a/tools/Flips/bps_spec.md b/tools/Flips/bps_spec.md new file mode 100644 index 000000000..caf300a6e --- /dev/null +++ b/tools/Flips/bps_spec.md @@ -0,0 +1,238 @@ +# BPS File Format Specification + +_by byuu. Public domain._ https://byuu.org/ + +BPS patches encode the differences between two files. + + string "BPS1" + number source-size + number target-size + number metadata-size + string metadata[metadata-size] + repeat { + number action | ((length - 1) << 2) + action 0: SourceRead { + } + action 1: TargetRead { + byte[] length + } + action 2: SourceCopy { + number negative | (abs(offset) << 1) + } + action 3: TargetCopy { + number negative | (abs(offset) << 1) + } + } + uint32 source-checksum + uint32 target-checksum + uint32 patch-checksum + +## Synonyms + +A few terms are used interchangeably as appropriate. + +* source = original file (input) +* target = modified file (output) +* number = variable-length integer encoding + +## Linear creation + +Rather than encoding a list of changes to files (insert data here, delete data +here, modify data here, ...); beat patches encode the steps needed to create a +new file from an old file. That is to say, the target file starts off as an +empty, zero-byte file. The patch commands tell us how to write each and every +byte of the target file sequentially. + +## Variable-length number encoding + +Rather than limit the maximum file size supported to 16MB (24-bit) or 4GB +(32-bit), beat patches use a variable-length encoding to support any number of +bits, and thus, any possible file size. + +The basic idea is that we encode the lowest seven bits of the number, and then +the eighth bit of each byte is a flag to say whether the full number has been +represented or not. If set, this is the last byte of the number. If not, then +we shift out the low seven bits and repeat until the number is fully encoded. + +One last optimization is to subtract one after each encode. Without this, one +could encode '1' with 0x81 or 0x01 0x80, producing an ambiguity. + +Decoding is the inverse of the above process. + +Below are C++ implementations of this idea. Note that we are using uint64 for +the data type: this will limit beat patches created with these algorithms to +64-bit file sizes. If 128-bit integers were available, they could be used +instead. Of course, it's silly to even imagine patching a file larger than 16 +exabytes, but beat does allow it. + +**Encoding** + + void encode(uint64 data) { + while(true) { + uint8 x = data & 0x7f; + data >>= 7; + if(data == 0) { + write(0x80 | x); + break; + } + write(x); + data--; + } + } + +**Decoding** + + uint64 decode() { + uint64 data = 0, shift = 1; + while(true) { + uint8 x = read(); + data += (x & 0x7f) * shift; + if(x & 0x80) break; + shift <<= 7; + data += shift; + } + return data; + } + +-------------------------------------------------------------------------------- + +## Header + +First, we have the file format marker, "BPS1". We then encode the source and +target file sizes. Next, we encode optional metadata. If no metadata is present, +store an encoded zero here (0x80 per above.) Otherwise, specify the length of +the metadata. + +Note that officially, metadata should be XML version 1.0 encoding UTF-8 data, +and the metadata-size specifies the actual length. As in, there is no +null-terminator after the metadata. However, the actual contents here are +entirely domain-specific, so literally anything can go here and the patch will +still be considered valid. + +## Transfer lengths + +We store lengths as length - 1 to prevent ambiguities. There is no sense in +encoding a command that ultimately does nothing. This also slightly helps with +patch size reduction in some cases. + +## Relative offsets + +beat patches keep track of the current file offsets in both the source and +target files separately. Reading from either increments their respective offsets +automatically. + +As such, offsets are encoded relatively to the current positions. These offsets +can move the read cursors forward or backward. To support negative numbers with +variable-integer encoding requires us to store the negative flag as the lowest +bit, followed by the absolute value (eg abs(-1) = 1) + +Note, and this is very important, for obvious reasons you cannot read from +before the start or after the end of the file. Further, you cannot read beyond +the current target write output offsets, as that data is not yet available. +Attempting to do so instantly makes the patch invalid and will abort patching +entirely. + +**outputOffset:** this is a value that starts at zero. Every time a byte is +written to the target file, this offset is incremented by one. + +**sourceRelativeOffset:** this is a value that starts at zero. SourceCopy will +adjust this value by a signed amount, and then increment the value by one for +each read performed by said command. This value can never be less than zero, or +greater than or equal to the source file size. + +**targetRelativeOffset:** this is a value that starts at zero. TargetCopy will +adjust this value by a signed amount, and then increment the value by one for +each read performed by said command. This value can never be less than zero, or +greater than or equal to the outputOffset. + +## Repeat + +Commands repeat until the end of the patch. This can be detected by testing the +patch read location, and stopping when offset() >= size() - 12. Where 12 is the +number of bytes in the patch footer. + + void action() { + uint64 data = decode(); + uint64 command = data & 3; + uint64 length = (data >> 2) + 1; + } + +## SourceRead + +This command copies bytes from the source file to the target file. Since both +the patch creator and applier will have access to the entire source file, the +actual bytes to output do not need to be stored here. + +This command is rarely useful in delta patch creation, and is mainly intended to +allow for linear-based patchers. However, at times it can be useful even in +delta patches when data is the same in both source and target files at the same +location. + + void sourceRead() { + while(length--) { + target[outputOffset] = source[outputOffset]; + outputOffset++; + } + } + +## TargetRead + +When a file is modified, new data is thus created. This command can store said +data so that it can be written to the target file. This time, the actual data is +not available to the patch applier, so it is stored directly inside the patch. + + void targetRead() { + while(length--) { + target[outputOffset++] = read(); + } + } + +## SourceCopy + +This command treats the entire source file as a dictionary, similarly to LZ +compression. An offset is supplied to seek the sourceRelativeOffset to the +desired location, and then data is copied from said offset to the target file. + + void sourceCopy() { + uint64 data = decode(); + sourceRelativeOffset += (data & 1 ? -1 : +1) * (data >> 1); + while(length--) { + target[outputOffset++] = source[sourceRelativeOffset++]; + } + } + +## TargetCopy + +This command treats all of the data that has already been written to the target +file as a dictionary. By referencing already written data, we can optimize +repeated data in the target file that does not exist in the source file. + +This can allow for efficient run-length encoding. For instance, say 16MB of +0x00s appear in a row in only the target file. We can use TargetRead to write a +single 0x00. Now we can use TargetCopy to point at this byte, and set the length +to 16MB-1. The effect will be that the target output size grows as the command +runs, thus repeating the data. + + void targetCopy() { + uint64 data = decode(); + targetRelativeOffset += (data & 1 ? -1 : +1) * (data >> 1); + while(length--) { + target[outputOffset++] = target[targetRelativeOffset++]; + } + } + +## Footer + +Checksum information appears at the bottom of the file. The idea is to allow a +patcher to calculate this information as the patch is being produced. The source +checksum verifies that the input file is correct, and the target checksum +verifies that the patch has been applied successfully. Finally, the patch itself +has a checksum. The patch checksum is the checksum of every byte before it. In +other words, it does not include the last four bytes for obvious reasons. This +ensures the patch itself has not been corrupted. + +Note that checksums are stored in CRC32 format. The intention of checksums is to +verify against corruption and mistakenly incorrect files. The idea was to keep +the file format simple, so cryptographically secure hashes were not used here. +If security is a grave concern, SHA256 or better hashes can be stored in the +manifest data. Otherwise, beat is not the right file format for such uses. diff --git a/tools/Flips/configure b/tools/Flips/configure new file mode 100755 index 000000000..00371513e --- /dev/null +++ b/tools/Flips/configure @@ -0,0 +1,13 @@ +#!/bin/sh + +# This script does nothing, other than trick people into running it and print the manual. +# Since configure is usually run before make, and people tend to read its output +# (to find which dependencies are missing), it's the best place to put compilation instructions. +cat <>4); + crc = crctable_4bits[(crc^(data[i]>>4))&0x0F] ^ (crc>>4); + } + return ~crc; +} diff --git a/tools/Flips/crc32.h b/tools/Flips/crc32.h new file mode 100644 index 000000000..9a2854249 --- /dev/null +++ b/tools/Flips/crc32.h @@ -0,0 +1,10 @@ +//Module name: crc32 +//Author: Alcaro +//Date: June 3, 2015 +//Licence: GPL v3.0 or higher + +#include +#include + +uint32_t crc32_update(const uint8_t* data, size_t len, uint32_t crc); +static inline uint32_t crc32(const uint8_t* data, size_t len) { return crc32_update(data, len, 0); } diff --git a/tools/Flips/data/com.github.Alcaro.Flips-symbolic.svg b/tools/Flips/data/com.github.Alcaro.Flips-symbolic.svg new file mode 100644 index 000000000..7e9ab2374 --- /dev/null +++ b/tools/Flips/data/com.github.Alcaro.Flips-symbolic.svg @@ -0,0 +1,68 @@ + + + + + + image/svg+xml + + + + + + + + + + diff --git a/tools/Flips/data/com.github.Alcaro.Flips.desktop b/tools/Flips/data/com.github.Alcaro.Flips.desktop new file mode 100644 index 000000000..923a5bb68 --- /dev/null +++ b/tools/Flips/data/com.github.Alcaro.Flips.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +Name=Flips +GenericName=Patcher +Comment=A patcher for IPS and BPS files +# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! +Keywords=ips;bps;patcher; +Exec=flips %U +# Translators: Do NOT translate or transliterate this text (this is an icon file name)! +Icon=com.github.Alcaro.Flips +Terminal=false +X-GNOME-SingleWindow=true +Type=Application +StartupNotify=true +Categories=GNOME;GTK;Utility;RevisionControl; +MimeType=application/x-bps-patch;application/x-ips-patch; diff --git a/tools/Flips/data/com.github.Alcaro.Flips.metainfo.xml b/tools/Flips/data/com.github.Alcaro.Flips.metainfo.xml new file mode 100644 index 000000000..873eb1571 --- /dev/null +++ b/tools/Flips/data/com.github.Alcaro.Flips.metainfo.xml @@ -0,0 +1,41 @@ + + + + com.github.Alcaro.Flips + CC0-1.0 + GPL-3.0+ + Flips + A patcher for IPS and BPS files + + +

+ Flips is a patcher for IPS and BPS files, aiming for a simple interface + yet plenty of power under the hood. +

+
+ + + + https://raw.githubusercontent.com/Alcaro/Flips/master/data/flips-main-window.png + + + https://raw.githubusercontent.com/Alcaro/Flips/master/data/flips-preferences-window.png + + + + + + + + + flips + + + com.github.Alcaro.Flips.desktop + https://github.com/Alcaro/Flips + https://github.com/Alcaro/Flips/issues + Alcaro + floating_at_muncher.se + + +
diff --git a/tools/Flips/data/com.github.Alcaro.Flips.svg b/tools/Flips/data/com.github.Alcaro.Flips.svg new file mode 100644 index 000000000..c3d6229bd --- /dev/null +++ b/tools/Flips/data/com.github.Alcaro.Flips.svg @@ -0,0 +1,194 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/Flips/divsufsort.c b/tools/Flips/divsufsort.c new file mode 100644 index 000000000..9bbac4532 --- /dev/null +++ b/tools/Flips/divsufsort.c @@ -0,0 +1,1782 @@ +/* + * divsufsort.c for libdivsufsort-lite + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#ifdef _OPENMP +# include +#endif +#include "divsufsort.h" + + +/*- Constants -*/ +#define INLINE __inline +#if defined(ALPHABET_SIZE) && (ALPHABET_SIZE < 1) +# undef ALPHABET_SIZE +#endif +#if !defined(ALPHABET_SIZE) +# define ALPHABET_SIZE (256) +#endif +#define BUCKET_A_SIZE (ALPHABET_SIZE) +#define BUCKET_B_SIZE (ALPHABET_SIZE * ALPHABET_SIZE) +#if defined(SS_INSERTIONSORT_THRESHOLD) +# if SS_INSERTIONSORT_THRESHOLD < 1 +# undef SS_INSERTIONSORT_THRESHOLD +# define SS_INSERTIONSORT_THRESHOLD (1) +# endif +#else +# define SS_INSERTIONSORT_THRESHOLD (8) +#endif +#if defined(SS_BLOCKSIZE) +# if SS_BLOCKSIZE < 0 +# undef SS_BLOCKSIZE +# define SS_BLOCKSIZE (0) +# elif 32768 <= SS_BLOCKSIZE +# undef SS_BLOCKSIZE +# define SS_BLOCKSIZE (32767) +# endif +#else +# define SS_BLOCKSIZE (1024) +#endif +/* minstacksize = log(SS_BLOCKSIZE) / log(3) * 2 */ +#if SS_BLOCKSIZE == 0 +# define SS_MISORT_STACKSIZE (96) +#elif SS_BLOCKSIZE <= 4096 +# define SS_MISORT_STACKSIZE (16) +#else +# define SS_MISORT_STACKSIZE (24) +#endif +#define SS_SMERGE_STACKSIZE (32) +#define TR_INSERTIONSORT_THRESHOLD (8) +#define TR_STACKSIZE (64) + + +/*- Macros -*/ +#ifndef SWAP +# define SWAP(_a, _b) do { t = (_a); (_a) = (_b); (_b) = t; } while(0) +#endif /* SWAP */ +#ifndef MIN +# define MIN(_a, _b) (((_a) < (_b)) ? (_a) : (_b)) +#endif /* MIN */ +#ifndef MAX +# define MAX(_a, _b) (((_a) > (_b)) ? (_a) : (_b)) +#endif /* MAX */ +#define STACK_PUSH(_a, _b, _c, _d)\ + do {\ + assert(ssize < STACK_SIZE);\ + stack[ssize].a = (_a), stack[ssize].b = (_b),\ + stack[ssize].c = (_c), stack[ssize++].d = (_d);\ + } while(0) +#define STACK_PUSH5(_a, _b, _c, _d, _e)\ + do {\ + assert(ssize < STACK_SIZE);\ + stack[ssize].a = (_a), stack[ssize].b = (_b),\ + stack[ssize].c = (_c), stack[ssize].d = (_d), stack[ssize++].e = (_e);\ + } while(0) +#define STACK_POP(_a, _b, _c, _d)\ + do {\ + assert(0 <= ssize);\ + if(ssize == 0) { return; }\ + (_a) = stack[--ssize].a, (_b) = stack[ssize].b,\ + (_c) = stack[ssize].c, (_d) = stack[ssize].d;\ + } while(0) +#define STACK_POP5(_a, _b, _c, _d, _e)\ + do {\ + assert(0 <= ssize);\ + if(ssize == 0) { return; }\ + (_a) = stack[--ssize].a, (_b) = stack[ssize].b,\ + (_c) = stack[ssize].c, (_d) = stack[ssize].d, (_e) = stack[ssize].e;\ + } while(0) +#define BUCKET_A(_c0) bucket_A[(_c0)] +#if ALPHABET_SIZE == 256 +#define BUCKET_B(_c0, _c1) (bucket_B[((_c1) << 8) | (_c0)]) +#define BUCKET_BSTAR(_c0, _c1) (bucket_B[((_c0) << 8) | (_c1)]) +#else +#define BUCKET_B(_c0, _c1) (bucket_B[(_c1) * ALPHABET_SIZE + (_c0)]) +#define BUCKET_BSTAR(_c0, _c1) (bucket_B[(_c0) * ALPHABET_SIZE + (_c1)]) +#endif + + +/*- Private Functions -*/ + +static const int lg_table[256]= { + -1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 +}; + +#if (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) + +static INLINE +int +ss_ilg(int n) { +#if SS_BLOCKSIZE == 0 + return (n & 0xffff0000) ? + ((n & 0xff000000) ? + 24 + lg_table[(n >> 24) & 0xff] : + 16 + lg_table[(n >> 16) & 0xff]) : + ((n & 0x0000ff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff]); +#elif SS_BLOCKSIZE < 256 + return lg_table[n]; +#else + return (n & 0xff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff]; +#endif +} + +#endif /* (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) */ + +#if SS_BLOCKSIZE != 0 + +static const int sqq_table[256] = { + 0, 16, 22, 27, 32, 35, 39, 42, 45, 48, 50, 53, 55, 57, 59, 61, + 64, 65, 67, 69, 71, 73, 75, 76, 78, 80, 81, 83, 84, 86, 87, 89, + 90, 91, 93, 94, 96, 97, 98, 99, 101, 102, 103, 104, 106, 107, 108, 109, +110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, +128, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, +143, 144, 144, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 155, +156, 157, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, +169, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 178, 179, 180, +181, 181, 182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191, +192, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 201, +202, 203, 203, 204, 204, 205, 206, 206, 207, 208, 208, 209, 209, 210, 211, 211, +212, 212, 213, 214, 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 221, +221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, 227, 228, 229, 229, 230, +230, 231, 231, 232, 232, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, +239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, +247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 +}; + +static INLINE +int +ss_isqrt(int x) { + int y, e; + + if(x >= (SS_BLOCKSIZE * SS_BLOCKSIZE)) { return SS_BLOCKSIZE; } + e = (x & 0xffff0000) ? + ((x & 0xff000000) ? + 24 + lg_table[(x >> 24) & 0xff] : + 16 + lg_table[(x >> 16) & 0xff]) : + ((x & 0x0000ff00) ? + 8 + lg_table[(x >> 8) & 0xff] : + 0 + lg_table[(x >> 0) & 0xff]); + + if(e >= 16) { + y = sqq_table[x >> ((e - 6) - (e & 1))] << ((e >> 1) - 7); + if(e >= 24) { y = (y + 1 + x / y) >> 1; } + y = (y + 1 + x / y) >> 1; + } else if(e >= 8) { + y = (sqq_table[x >> ((e - 6) - (e & 1))] >> (7 - (e >> 1))) + 1; + } else { + return sqq_table[x] >> 4; + } + + return (x < (y * y)) ? y - 1 : y; +} + +#endif /* SS_BLOCKSIZE != 0 */ + + +/*---------------------------------------------------------------------------*/ + +/* Compares two suffixes. */ +static INLINE +int +ss_compare(const unsigned char *T, + const int *p1, const int *p2, + int depth) { + const unsigned char *U1, *U2, *U1n, *U2n; + + for(U1 = T + depth + *p1, + U2 = T + depth + *p2, + U1n = T + *(p1 + 1) + 2, + U2n = T + *(p2 + 1) + 2; + (U1 < U1n) && (U2 < U2n) && (*U1 == *U2); + ++U1, ++U2) { + } + + return U1 < U1n ? + (U2 < U2n ? *U1 - *U2 : 1) : + (U2 < U2n ? -1 : 0); +} + + +/*---------------------------------------------------------------------------*/ + +#if (SS_BLOCKSIZE != 1) && (SS_INSERTIONSORT_THRESHOLD != 1) + +/* Insertionsort for small size groups */ +static +void +ss_insertionsort(const unsigned char *T, const int *PA, + int *first, int *last, int depth) { + int *i, *j; + int t; + int r; + + for(i = last - 2; first <= i; --i) { + for(t = *i, j = i + 1; 0 < (r = ss_compare(T, PA + t, PA + *j, depth));) { + do { *(j - 1) = *j; } while((++j < last) && (*j < 0)); + if(last <= j) { break; } + } + if(r == 0) { *j = ~*j; } + *(j - 1) = t; + } +} + +#endif /* (SS_BLOCKSIZE != 1) && (SS_INSERTIONSORT_THRESHOLD != 1) */ + + +/*---------------------------------------------------------------------------*/ + +#if (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) + +static INLINE +void +ss_fixdown(const unsigned char *Td, const int *PA, + int *SA, int i, int size) { + int j, k; + int v; + int c, d, e; + + for(v = SA[i], c = Td[PA[v]]; (j = 2 * i + 1) < size; SA[i] = SA[k], i = k) { + d = Td[PA[SA[k = j++]]]; + if(d < (e = Td[PA[SA[j]]])) { k = j; d = e; } + if(d <= c) { break; } + } + SA[i] = v; +} + +/* Simple top-down heapsort. */ +static +void +ss_heapsort(const unsigned char *Td, const int *PA, int *SA, int size) { + int i, m; + int t; + + m = size; + if((size % 2) == 0) { + m--; + if(Td[PA[SA[m / 2]]] < Td[PA[SA[m]]]) { SWAP(SA[m], SA[m / 2]); } + } + + for(i = m / 2 - 1; 0 <= i; --i) { ss_fixdown(Td, PA, SA, i, m); } + if((size % 2) == 0) { SWAP(SA[0], SA[m]); ss_fixdown(Td, PA, SA, 0, m); } + for(i = m - 1; 0 < i; --i) { + t = SA[0], SA[0] = SA[i]; + ss_fixdown(Td, PA, SA, 0, i); + SA[i] = t; + } +} + + +/*---------------------------------------------------------------------------*/ + +/* Returns the median of three elements. */ +static INLINE +int * +ss_median3(const unsigned char *Td, const int *PA, + int *v1, int *v2, int *v3) { + int *t; + if(Td[PA[*v1]] > Td[PA[*v2]]) { SWAP(v1, v2); } + if(Td[PA[*v2]] > Td[PA[*v3]]) { + if(Td[PA[*v1]] > Td[PA[*v3]]) { return v1; } + else { return v3; } + } + return v2; +} + +/* Returns the median of five elements. */ +static INLINE +int * +ss_median5(const unsigned char *Td, const int *PA, + int *v1, int *v2, int *v3, int *v4, int *v5) { + int *t; + if(Td[PA[*v2]] > Td[PA[*v3]]) { SWAP(v2, v3); } + if(Td[PA[*v4]] > Td[PA[*v5]]) { SWAP(v4, v5); } + if(Td[PA[*v2]] > Td[PA[*v4]]) { SWAP(v2, v4); SWAP(v3, v5); } + if(Td[PA[*v1]] > Td[PA[*v3]]) { SWAP(v1, v3); } + if(Td[PA[*v1]] > Td[PA[*v4]]) { SWAP(v1, v4); SWAP(v3, v5); } + if(Td[PA[*v3]] > Td[PA[*v4]]) { return v4; } + return v3; +} + +/* Returns the pivot element. */ +static INLINE +int * +ss_pivot(const unsigned char *Td, const int *PA, int *first, int *last) { + int *middle; + int t; + + t = last - first; + middle = first + t / 2; + + if(t <= 512) { + if(t <= 32) { + return ss_median3(Td, PA, first, middle, last - 1); + } else { + t >>= 2; + return ss_median5(Td, PA, first, first + t, middle, last - 1 - t, last - 1); + } + } + t >>= 3; + first = ss_median3(Td, PA, first, first + t, first + (t << 1)); + middle = ss_median3(Td, PA, middle - t, middle, middle + t); + last = ss_median3(Td, PA, last - 1 - (t << 1), last - 1 - t, last - 1); + return ss_median3(Td, PA, first, middle, last); +} + + +/*---------------------------------------------------------------------------*/ + +/* Binary partition for substrings. */ +static INLINE +int * +ss_partition(const int *PA, + int *first, int *last, int depth) { + int *a, *b; + int t; + for(a = first - 1, b = last;;) { + for(; (++a < b) && ((PA[*a] + depth) >= (PA[*a + 1] + 1));) { *a = ~*a; } + for(; (a < --b) && ((PA[*b] + depth) < (PA[*b + 1] + 1));) { } + if(b <= a) { break; } + t = ~*b; + *b = *a; + *a = t; + } + if(first < a) { *first = ~*first; } + return a; +} + +/* Multikey introsort for medium size groups. */ +static +void +ss_mintrosort(const unsigned char *T, const int *PA, + int *first, int *last, + int depth) { +#define STACK_SIZE SS_MISORT_STACKSIZE + struct { int *a, *b, c; int d; } stack[STACK_SIZE]; + const unsigned char *Td; + int *a, *b, *c, *d, *e, *f; + int s, t; + int ssize; + int limit; + int v, x = 0; + + for(ssize = 0, limit = ss_ilg(last - first);;) { + + if((last - first) <= SS_INSERTIONSORT_THRESHOLD) { +#if 1 < SS_INSERTIONSORT_THRESHOLD + if(1 < (last - first)) { ss_insertionsort(T, PA, first, last, depth); } +#endif + STACK_POP(first, last, depth, limit); + continue; + } + + Td = T + depth; + if(limit-- == 0) { ss_heapsort(Td, PA, first, last - first); } + if(limit < 0) { + for(a = first + 1, v = Td[PA[*first]]; a < last; ++a) { + if((x = Td[PA[*a]]) != v) { + if(1 < (a - first)) { break; } + v = x; + first = a; + } + } + if(Td[PA[*first] - 1] < v) { + first = ss_partition(PA, first, a, depth); + } + if((a - first) <= (last - a)) { + if(1 < (a - first)) { + STACK_PUSH(a, last, depth, -1); + last = a, depth += 1, limit = ss_ilg(a - first); + } else { + first = a, limit = -1; + } + } else { + if(1 < (last - a)) { + STACK_PUSH(first, a, depth + 1, ss_ilg(a - first)); + first = a, limit = -1; + } else { + last = a, depth += 1, limit = ss_ilg(a - first); + } + } + continue; + } + + /* choose pivot */ + a = ss_pivot(Td, PA, first, last); + v = Td[PA[*a]]; + SWAP(*first, *a); + + /* partition */ + for(b = first; (++b < last) && ((x = Td[PA[*b]]) == v);) { } + if(((a = b) < last) && (x < v)) { + for(; (++b < last) && ((x = Td[PA[*b]]) <= v);) { + if(x == v) { SWAP(*b, *a); ++a; } + } + } + for(c = last; (b < --c) && ((x = Td[PA[*c]]) == v);) { } + if((b < (d = c)) && (x > v)) { + for(; (b < --c) && ((x = Td[PA[*c]]) >= v);) { + if(x == v) { SWAP(*c, *d); --d; } + } + } + for(; b < c;) { + SWAP(*b, *c); + for(; (++b < c) && ((x = Td[PA[*b]]) <= v);) { + if(x == v) { SWAP(*b, *a); ++a; } + } + for(; (b < --c) && ((x = Td[PA[*c]]) >= v);) { + if(x == v) { SWAP(*c, *d); --d; } + } + } + + if(a <= d) { + c = b - 1; + + if((s = a - first) > (t = b - a)) { s = t; } + for(e = first, f = b - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } + if((s = d - c) > (t = last - d - 1)) { s = t; } + for(e = b, f = last - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } + + a = first + (b - a), c = last - (d - c); + b = (v <= Td[PA[*a] - 1]) ? a : ss_partition(PA, a, c, depth); + + if((a - first) <= (last - c)) { + if((last - c) <= (c - b)) { + STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); + STACK_PUSH(c, last, depth, limit); + last = a; + } else if((a - first) <= (c - b)) { + STACK_PUSH(c, last, depth, limit); + STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); + last = a; + } else { + STACK_PUSH(c, last, depth, limit); + STACK_PUSH(first, a, depth, limit); + first = b, last = c, depth += 1, limit = ss_ilg(c - b); + } + } else { + if((a - first) <= (c - b)) { + STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); + STACK_PUSH(first, a, depth, limit); + first = c; + } else if((last - c) <= (c - b)) { + STACK_PUSH(first, a, depth, limit); + STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); + first = c; + } else { + STACK_PUSH(first, a, depth, limit); + STACK_PUSH(c, last, depth, limit); + first = b, last = c, depth += 1, limit = ss_ilg(c - b); + } + } + } else { + limit += 1; + if(Td[PA[*first] - 1] < v) { + first = ss_partition(PA, first, last, depth); + limit = ss_ilg(last - first); + } + depth += 1; + } + } +#undef STACK_SIZE +} + +#endif /* (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) */ + + +/*---------------------------------------------------------------------------*/ + +#if SS_BLOCKSIZE != 0 + +static INLINE +void +ss_blockswap(int *a, int *b, int n) { + int t; + for(; 0 < n; --n, ++a, ++b) { + t = *a, *a = *b, *b = t; + } +} + +static INLINE +void +ss_rotate(int *first, int *middle, int *last) { + int *a, *b, t; + int l, r; + l = middle - first, r = last - middle; + for(; (0 < l) && (0 < r);) { + if(l == r) { ss_blockswap(first, middle, l); break; } + if(l < r) { + a = last - 1, b = middle - 1; + t = *a; + do { + *a-- = *b, *b-- = *a; + if(b < first) { + *a = t; + last = a; + if((r -= l + 1) <= l) { break; } + a -= 1, b = middle - 1; + t = *a; + } + } while(1); + } else { + a = first, b = middle; + t = *a; + do { + *a++ = *b, *b++ = *a; + if(last <= b) { + *a = t; + first = a + 1; + if((l -= r + 1) <= r) { break; } + a += 1, b = middle; + t = *a; + } + } while(1); + } + } +} + + +/*---------------------------------------------------------------------------*/ + +static +void +ss_inplacemerge(const unsigned char *T, const int *PA, + int *first, int *middle, int *last, + int depth) { + const int *p; + int *a, *b; + int len, half; + int q, r; + int x; + + for(;;) { + if(*(last - 1) < 0) { x = 1; p = PA + ~*(last - 1); } + else { x = 0; p = PA + *(last - 1); } + for(a = first, len = middle - first, half = len >> 1, r = -1; + 0 < len; + len = half, half >>= 1) { + b = a + half; + q = ss_compare(T, PA + ((0 <= *b) ? *b : ~*b), p, depth); + if(q < 0) { + a = b + 1; + half -= (len & 1) ^ 1; + } else { + r = q; + } + } + if(a < middle) { + if(r == 0) { *a = ~*a; } + ss_rotate(a, middle, last); + last -= middle - a; + middle = a; + if(first == middle) { break; } + } + --last; + if(x != 0) { while(*--last < 0) { } } + if(middle == last) { break; } + } +} + + +/*---------------------------------------------------------------------------*/ + +/* Merge-forward with internal buffer. */ +static +void +ss_mergeforward(const unsigned char *T, const int *PA, + int *first, int *middle, int *last, + int *buf, int depth) { + int *a, *b, *c, *bufend; + int t; + int r; + + bufend = buf + (middle - first) - 1; + ss_blockswap(buf, first, middle - first); + + for(t = *(a = first), b = buf, c = middle;;) { + r = ss_compare(T, PA + *b, PA + *c, depth); + if(r < 0) { + do { + *a++ = *b; + if(bufend <= b) { *bufend = t; return; } + *b++ = *a; + } while(*b < 0); + } else if(r > 0) { + do { + *a++ = *c, *c++ = *a; + if(last <= c) { + while(b < bufend) { *a++ = *b, *b++ = *a; } + *a = *b, *b = t; + return; + } + } while(*c < 0); + } else { + *c = ~*c; + do { + *a++ = *b; + if(bufend <= b) { *bufend = t; return; } + *b++ = *a; + } while(*b < 0); + + do { + *a++ = *c, *c++ = *a; + if(last <= c) { + while(b < bufend) { *a++ = *b, *b++ = *a; } + *a = *b, *b = t; + return; + } + } while(*c < 0); + } + } +} + +/* Merge-backward with internal buffer. */ +static +void +ss_mergebackward(const unsigned char *T, const int *PA, + int *first, int *middle, int *last, + int *buf, int depth) { + const int *p1, *p2; + int *a, *b, *c, *bufend; + int t; + int r; + int x; + + bufend = buf + (last - middle) - 1; + ss_blockswap(buf, middle, last - middle); + + x = 0; + if(*bufend < 0) { p1 = PA + ~*bufend; x |= 1; } + else { p1 = PA + *bufend; } + if(*(middle - 1) < 0) { p2 = PA + ~*(middle - 1); x |= 2; } + else { p2 = PA + *(middle - 1); } + for(t = *(a = last - 1), b = bufend, c = middle - 1;;) { + r = ss_compare(T, p1, p2, depth); + if(0 < r) { + if(x & 1) { do { *a-- = *b, *b-- = *a; } while(*b < 0); x ^= 1; } + *a-- = *b; + if(b <= buf) { *buf = t; break; } + *b-- = *a; + if(*b < 0) { p1 = PA + ~*b; x |= 1; } + else { p1 = PA + *b; } + } else if(r < 0) { + if(x & 2) { do { *a-- = *c, *c-- = *a; } while(*c < 0); x ^= 2; } + *a-- = *c, *c-- = *a; + if(c < first) { + while(buf < b) { *a-- = *b, *b-- = *a; } + *a = *b, *b = t; + break; + } + if(*c < 0) { p2 = PA + ~*c; x |= 2; } + else { p2 = PA + *c; } + } else { + if(x & 1) { do { *a-- = *b, *b-- = *a; } while(*b < 0); x ^= 1; } + *a-- = ~*b; + if(b <= buf) { *buf = t; break; } + *b-- = *a; + if(x & 2) { do { *a-- = *c, *c-- = *a; } while(*c < 0); x ^= 2; } + *a-- = *c, *c-- = *a; + if(c < first) { + while(buf < b) { *a-- = *b, *b-- = *a; } + *a = *b, *b = t; + break; + } + if(*b < 0) { p1 = PA + ~*b; x |= 1; } + else { p1 = PA + *b; } + if(*c < 0) { p2 = PA + ~*c; x |= 2; } + else { p2 = PA + *c; } + } + } +} + +/* D&C based merge. */ +static +void +ss_swapmerge(const unsigned char *T, const int *PA, + int *first, int *middle, int *last, + int *buf, int bufsize, int depth) { +#define STACK_SIZE SS_SMERGE_STACKSIZE +#define GETIDX(a) ((0 <= (a)) ? (a) : (~(a))) +#define MERGE_CHECK(a, b, c)\ + do {\ + if(((c) & 1) ||\ + (((c) & 2) && (ss_compare(T, PA + GETIDX(*((a) - 1)), PA + *(a), depth) == 0))) {\ + *(a) = ~*(a);\ + }\ + if(((c) & 4) && ((ss_compare(T, PA + GETIDX(*((b) - 1)), PA + *(b), depth) == 0))) {\ + *(b) = ~*(b);\ + }\ + } while(0) + struct { int *a, *b, *c; int d; } stack[STACK_SIZE]; + int *l, *r, *lm, *rm; + int m, len, half; + int ssize; + int check, next; + + for(check = 0, ssize = 0;;) { + if((last - middle) <= bufsize) { + if((first < middle) && (middle < last)) { + ss_mergebackward(T, PA, first, middle, last, buf, depth); + } + MERGE_CHECK(first, last, check); + STACK_POP(first, middle, last, check); + continue; + } + + if((middle - first) <= bufsize) { + if(first < middle) { + ss_mergeforward(T, PA, first, middle, last, buf, depth); + } + MERGE_CHECK(first, last, check); + STACK_POP(first, middle, last, check); + continue; + } + + for(m = 0, len = MIN(middle - first, last - middle), half = len >> 1; + 0 < len; + len = half, half >>= 1) { + if(ss_compare(T, PA + GETIDX(*(middle + m + half)), + PA + GETIDX(*(middle - m - half - 1)), depth) < 0) { + m += half + 1; + half -= (len & 1) ^ 1; + } + } + + if(0 < m) { + lm = middle - m, rm = middle + m; + ss_blockswap(lm, middle, m); + l = r = middle, next = 0; + if(rm < last) { + if(*rm < 0) { + *rm = ~*rm; + if(first < lm) { for(; *--l < 0;) { } next |= 4; } + next |= 1; + } else if(first < lm) { + for(; *r < 0; ++r) { } + next |= 2; + } + } + + if((l - first) <= (last - r)) { + STACK_PUSH(r, rm, last, (next & 3) | (check & 4)); + middle = lm, last = l, check = (check & 3) | (next & 4); + } else { + if((next & 2) && (r == middle)) { next ^= 6; } + STACK_PUSH(first, lm, l, (check & 3) | (next & 4)); + first = r, middle = rm, check = (next & 3) | (check & 4); + } + } else { + if(ss_compare(T, PA + GETIDX(*(middle - 1)), PA + *middle, depth) == 0) { + *middle = ~*middle; + } + MERGE_CHECK(first, last, check); + STACK_POP(first, middle, last, check); + } + } +#undef STACK_SIZE +} + +#endif /* SS_BLOCKSIZE != 0 */ + + +/*---------------------------------------------------------------------------*/ + +/* Substring sort */ +static +void +sssort(const unsigned char *T, const int *PA, + int *first, int *last, + int *buf, int bufsize, + int depth, int n, int lastsuffix) { + int *a; +#if SS_BLOCKSIZE != 0 + int *b, *middle, *curbuf; + int j, k, curbufsize, limit; +#endif + int i; + + if(lastsuffix != 0) { ++first; } + +#if SS_BLOCKSIZE == 0 + ss_mintrosort(T, PA, first, last, depth); +#else + if((bufsize < SS_BLOCKSIZE) && + (bufsize < (last - first)) && + (bufsize < (limit = ss_isqrt(last - first)))) { + if(SS_BLOCKSIZE < limit) { limit = SS_BLOCKSIZE; } + buf = middle = last - limit, bufsize = limit; + } else { + middle = last, limit = 0; + } + for(a = first, i = 0; SS_BLOCKSIZE < (middle - a); a += SS_BLOCKSIZE, ++i) { +#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE + ss_mintrosort(T, PA, a, a + SS_BLOCKSIZE, depth); +#elif 1 < SS_BLOCKSIZE + ss_insertionsort(T, PA, a, a + SS_BLOCKSIZE, depth); +#endif + curbufsize = last - (a + SS_BLOCKSIZE); + curbuf = a + SS_BLOCKSIZE; + if(curbufsize <= bufsize) { curbufsize = bufsize, curbuf = buf; } + for(b = a, k = SS_BLOCKSIZE, j = i; j & 1; b -= k, k <<= 1, j >>= 1) { + ss_swapmerge(T, PA, b - k, b, b + k, curbuf, curbufsize, depth); + } + } +#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE + ss_mintrosort(T, PA, a, middle, depth); +#elif 1 < SS_BLOCKSIZE + ss_insertionsort(T, PA, a, middle, depth); +#endif + for(k = SS_BLOCKSIZE; i != 0; k <<= 1, i >>= 1) { + if(i & 1) { + ss_swapmerge(T, PA, a - k, a, middle, buf, bufsize, depth); + a -= k; + } + } + if(limit != 0) { +#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE + ss_mintrosort(T, PA, middle, last, depth); +#elif 1 < SS_BLOCKSIZE + ss_insertionsort(T, PA, middle, last, depth); +#endif + ss_inplacemerge(T, PA, first, middle, last, depth); + } +#endif + + if(lastsuffix != 0) { + /* Insert last type B* suffix. */ + int PAi[2]; PAi[0] = PA[*(first - 1)], PAi[1] = n - 2; + for(a = first, i = *(first - 1); + (a < last) && ((*a < 0) || (0 < ss_compare(T, &(PAi[0]), PA + *a, depth))); + ++a) { + *(a - 1) = *a; + } + *(a - 1) = i; + } +} + + +/*---------------------------------------------------------------------------*/ + +static INLINE +int +tr_ilg(int n) { + return (n & 0xffff0000) ? + ((n & 0xff000000) ? + 24 + lg_table[(n >> 24) & 0xff] : + 16 + lg_table[(n >> 16) & 0xff]) : + ((n & 0x0000ff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff]); +} + + +/*---------------------------------------------------------------------------*/ + +/* Simple insertionsort for small size groups. */ +static +void +tr_insertionsort(const int *ISAd, int *first, int *last) { + int *a, *b; + int t, r; + + for(a = first + 1; a < last; ++a) { + for(t = *a, b = a - 1; 0 > (r = ISAd[t] - ISAd[*b]);) { + do { *(b + 1) = *b; } while((first <= --b) && (*b < 0)); + if(b < first) { break; } + } + if(r == 0) { *b = ~*b; } + *(b + 1) = t; + } +} + + +/*---------------------------------------------------------------------------*/ + +static INLINE +void +tr_fixdown(const int *ISAd, int *SA, int i, int size) { + int j, k; + int v; + int c, d, e; + + for(v = SA[i], c = ISAd[v]; (j = 2 * i + 1) < size; SA[i] = SA[k], i = k) { + d = ISAd[SA[k = j++]]; + if(d < (e = ISAd[SA[j]])) { k = j; d = e; } + if(d <= c) { break; } + } + SA[i] = v; +} + +/* Simple top-down heapsort. */ +static +void +tr_heapsort(const int *ISAd, int *SA, int size) { + int i, m; + int t; + + m = size; + if((size % 2) == 0) { + m--; + if(ISAd[SA[m / 2]] < ISAd[SA[m]]) { SWAP(SA[m], SA[m / 2]); } + } + + for(i = m / 2 - 1; 0 <= i; --i) { tr_fixdown(ISAd, SA, i, m); } + if((size % 2) == 0) { SWAP(SA[0], SA[m]); tr_fixdown(ISAd, SA, 0, m); } + for(i = m - 1; 0 < i; --i) { + t = SA[0], SA[0] = SA[i]; + tr_fixdown(ISAd, SA, 0, i); + SA[i] = t; + } +} + + +/*---------------------------------------------------------------------------*/ + +/* Returns the median of three elements. */ +static INLINE +int * +tr_median3(const int *ISAd, int *v1, int *v2, int *v3) { + int *t; + if(ISAd[*v1] > ISAd[*v2]) { SWAP(v1, v2); } + if(ISAd[*v2] > ISAd[*v3]) { + if(ISAd[*v1] > ISAd[*v3]) { return v1; } + else { return v3; } + } + return v2; +} + +/* Returns the median of five elements. */ +static INLINE +int * +tr_median5(const int *ISAd, + int *v1, int *v2, int *v3, int *v4, int *v5) { + int *t; + if(ISAd[*v2] > ISAd[*v3]) { SWAP(v2, v3); } + if(ISAd[*v4] > ISAd[*v5]) { SWAP(v4, v5); } + if(ISAd[*v2] > ISAd[*v4]) { SWAP(v2, v4); SWAP(v3, v5); } + if(ISAd[*v1] > ISAd[*v3]) { SWAP(v1, v3); } + if(ISAd[*v1] > ISAd[*v4]) { SWAP(v1, v4); SWAP(v3, v5); } + if(ISAd[*v3] > ISAd[*v4]) { return v4; } + return v3; +} + +/* Returns the pivot element. */ +static INLINE +int * +tr_pivot(const int *ISAd, int *first, int *last) { + int *middle; + int t; + + t = last - first; + middle = first + t / 2; + + if(t <= 512) { + if(t <= 32) { + return tr_median3(ISAd, first, middle, last - 1); + } else { + t >>= 2; + return tr_median5(ISAd, first, first + t, middle, last - 1 - t, last - 1); + } + } + t >>= 3; + first = tr_median3(ISAd, first, first + t, first + (t << 1)); + middle = tr_median3(ISAd, middle - t, middle, middle + t); + last = tr_median3(ISAd, last - 1 - (t << 1), last - 1 - t, last - 1); + return tr_median3(ISAd, first, middle, last); +} + + +/*---------------------------------------------------------------------------*/ + +typedef struct _trbudget_t trbudget_t; +struct _trbudget_t { + int chance; + int remain; + int incval; + int count; +}; + +static INLINE +void +trbudget_init(trbudget_t *budget, int chance, int incval) { + budget->chance = chance; + budget->remain = budget->incval = incval; +} + +static INLINE +int +trbudget_check(trbudget_t *budget, int size) { + if(size <= budget->remain) { budget->remain -= size; return 1; } + if(budget->chance == 0) { budget->count += size; return 0; } + budget->remain += budget->incval - size; + budget->chance -= 1; + return 1; +} + + +/*---------------------------------------------------------------------------*/ + +static INLINE +void +tr_partition(const int *ISAd, + int *first, int *middle, int *last, + int **pa, int **pb, int v) { + int *a, *b, *c, *d, *e, *f; + int t, s; + int x = 0; + + for(b = middle - 1; (++b < last) && ((x = ISAd[*b]) == v);) { } + if(((a = b) < last) && (x < v)) { + for(; (++b < last) && ((x = ISAd[*b]) <= v);) { + if(x == v) { SWAP(*b, *a); ++a; } + } + } + for(c = last; (b < --c) && ((x = ISAd[*c]) == v);) { } + if((b < (d = c)) && (x > v)) { + for(; (b < --c) && ((x = ISAd[*c]) >= v);) { + if(x == v) { SWAP(*c, *d); --d; } + } + } + for(; b < c;) { + SWAP(*b, *c); + for(; (++b < c) && ((x = ISAd[*b]) <= v);) { + if(x == v) { SWAP(*b, *a); ++a; } + } + for(; (b < --c) && ((x = ISAd[*c]) >= v);) { + if(x == v) { SWAP(*c, *d); --d; } + } + } + + if(a <= d) { + c = b - 1; + if((s = a - first) > (t = b - a)) { s = t; } + for(e = first, f = b - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } + if((s = d - c) > (t = last - d - 1)) { s = t; } + for(e = b, f = last - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } + first += (b - a), last -= (d - c); + } + *pa = first, *pb = last; +} + +static +void +tr_copy(int *ISA, const int *SA, + int *first, int *a, int *b, int *last, + int depth) { + /* sort suffixes of middle partition + by using sorted order of suffixes of left and right partition. */ + int *c, *d, *e; + int s, v; + + v = b - SA - 1; + for(c = first, d = a - 1; c <= d; ++c) { + if((0 <= (s = *c - depth)) && (ISA[s] == v)) { + *++d = s; + ISA[s] = d - SA; + } + } + for(c = last - 1, e = d + 1, d = b; e < d; --c) { + if((0 <= (s = *c - depth)) && (ISA[s] == v)) { + *--d = s; + ISA[s] = d - SA; + } + } +} + +static +void +tr_partialcopy(int *ISA, const int *SA, + int *first, int *a, int *b, int *last, + int depth) { + int *c, *d, *e; + int s, v; + int rank, lastrank, newrank = -1; + + v = b - SA - 1; + lastrank = -1; + for(c = first, d = a - 1; c <= d; ++c) { + if((0 <= (s = *c - depth)) && (ISA[s] == v)) { + *++d = s; + rank = ISA[s + depth]; + if(lastrank != rank) { lastrank = rank; newrank = d - SA; } + ISA[s] = newrank; + } + } + + lastrank = -1; + for(e = d; first <= e; --e) { + rank = ISA[*e]; + if(lastrank != rank) { lastrank = rank; newrank = e - SA; } + if(newrank != rank) { ISA[*e] = newrank; } + } + + lastrank = -1; + for(c = last - 1, e = d + 1, d = b; e < d; --c) { + if((0 <= (s = *c - depth)) && (ISA[s] == v)) { + *--d = s; + rank = ISA[s + depth]; + if(lastrank != rank) { lastrank = rank; newrank = d - SA; } + ISA[s] = newrank; + } + } +} + +static +void +tr_introsort(int *ISA, const int *ISAd, + int *SA, int *first, int *last, + trbudget_t *budget) { +#define STACK_SIZE TR_STACKSIZE + struct { const int *a; int *b, *c; int d, e; }stack[STACK_SIZE]; + int *a, *b, *c; + int t; + int v, x = 0; + int incr = ISAd - ISA; + int limit, next; + int ssize, trlink = -1; + + for(ssize = 0, limit = tr_ilg(last - first);;) { + + if(limit < 0) { + if(limit == -1) { + /* tandem repeat partition */ + tr_partition(ISAd - incr, first, first, last, &a, &b, last - SA - 1); + + /* update ranks */ + if(a < last) { + for(c = first, v = a - SA - 1; c < a; ++c) { ISA[*c] = v; } + } + if(b < last) { + for(c = a, v = b - SA - 1; c < b; ++c) { ISA[*c] = v; } + } + + /* push */ + if(1 < (b - a)) { + STACK_PUSH5(NULL, a, b, 0, 0); + STACK_PUSH5(ISAd - incr, first, last, -2, trlink); + trlink = ssize - 2; + } + if((a - first) <= (last - b)) { + if(1 < (a - first)) { + STACK_PUSH5(ISAd, b, last, tr_ilg(last - b), trlink); + last = a, limit = tr_ilg(a - first); + } else if(1 < (last - b)) { + first = b, limit = tr_ilg(last - b); + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } else { + if(1 < (last - b)) { + STACK_PUSH5(ISAd, first, a, tr_ilg(a - first), trlink); + first = b, limit = tr_ilg(last - b); + } else if(1 < (a - first)) { + last = a, limit = tr_ilg(a - first); + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + } else if(limit == -2) { + /* tandem repeat copy */ + a = stack[--ssize].b, b = stack[ssize].c; + if(stack[ssize].d == 0) { + tr_copy(ISA, SA, first, a, b, last, ISAd - ISA); + } else { + if(0 <= trlink) { stack[trlink].d = -1; } + tr_partialcopy(ISA, SA, first, a, b, last, ISAd - ISA); + } + STACK_POP5(ISAd, first, last, limit, trlink); + } else { + /* sorted partition */ + if(0 <= *first) { + a = first; + do { ISA[*a] = a - SA; } while((++a < last) && (0 <= *a)); + first = a; + } + if(first < last) { + a = first; do { *a = ~*a; } while(*++a < 0); + next = (ISA[*a] != ISAd[*a]) ? tr_ilg(a - first + 1) : -1; + if(++a < last) { for(b = first, v = a - SA - 1; b < a; ++b) { ISA[*b] = v; } } + + /* push */ + if(trbudget_check(budget, a - first)) { + if((a - first) <= (last - a)) { + STACK_PUSH5(ISAd, a, last, -3, trlink); + ISAd += incr, last = a, limit = next; + } else { + if(1 < (last - a)) { + STACK_PUSH5(ISAd + incr, first, a, next, trlink); + first = a, limit = -3; + } else { + ISAd += incr, last = a, limit = next; + } + } + } else { + if(0 <= trlink) { stack[trlink].d = -1; } + if(1 < (last - a)) { + first = a, limit = -3; + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + continue; + } + + if((last - first) <= TR_INSERTIONSORT_THRESHOLD) { + tr_insertionsort(ISAd, first, last); + limit = -3; + continue; + } + + if(limit-- == 0) { + tr_heapsort(ISAd, first, last - first); + for(a = last - 1; first < a; a = b) { + for(x = ISAd[*a], b = a - 1; (first <= b) && (ISAd[*b] == x); --b) { *b = ~*b; } + } + limit = -3; + continue; + } + + /* choose pivot */ + a = tr_pivot(ISAd, first, last); + SWAP(*first, *a); + v = ISAd[*first]; + + /* partition */ + tr_partition(ISAd, first, first + 1, last, &a, &b, v); + if((last - first) != (b - a)) { + next = (ISA[*a] != v) ? tr_ilg(b - a) : -1; + + /* update ranks */ + for(c = first, v = a - SA - 1; c < a; ++c) { ISA[*c] = v; } + if(b < last) { for(c = a, v = b - SA - 1; c < b; ++c) { ISA[*c] = v; } } + + /* push */ + if((1 < (b - a)) && (trbudget_check(budget, b - a))) { + if((a - first) <= (last - b)) { + if((last - b) <= (b - a)) { + if(1 < (a - first)) { + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + STACK_PUSH5(ISAd, b, last, limit, trlink); + last = a; + } else if(1 < (last - b)) { + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + first = b; + } else { + ISAd += incr, first = a, last = b, limit = next; + } + } else if((a - first) <= (b - a)) { + if(1 < (a - first)) { + STACK_PUSH5(ISAd, b, last, limit, trlink); + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + last = a; + } else { + STACK_PUSH5(ISAd, b, last, limit, trlink); + ISAd += incr, first = a, last = b, limit = next; + } + } else { + STACK_PUSH5(ISAd, b, last, limit, trlink); + STACK_PUSH5(ISAd, first, a, limit, trlink); + ISAd += incr, first = a, last = b, limit = next; + } + } else { + if((a - first) <= (b - a)) { + if(1 < (last - b)) { + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + STACK_PUSH5(ISAd, first, a, limit, trlink); + first = b; + } else if(1 < (a - first)) { + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + last = a; + } else { + ISAd += incr, first = a, last = b, limit = next; + } + } else if((last - b) <= (b - a)) { + if(1 < (last - b)) { + STACK_PUSH5(ISAd, first, a, limit, trlink); + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + first = b; + } else { + STACK_PUSH5(ISAd, first, a, limit, trlink); + ISAd += incr, first = a, last = b, limit = next; + } + } else { + STACK_PUSH5(ISAd, first, a, limit, trlink); + STACK_PUSH5(ISAd, b, last, limit, trlink); + ISAd += incr, first = a, last = b, limit = next; + } + } + } else { + if((1 < (b - a)) && (0 <= trlink)) { stack[trlink].d = -1; } + if((a - first) <= (last - b)) { + if(1 < (a - first)) { + STACK_PUSH5(ISAd, b, last, limit, trlink); + last = a; + } else if(1 < (last - b)) { + first = b; + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } else { + if(1 < (last - b)) { + STACK_PUSH5(ISAd, first, a, limit, trlink); + first = b; + } else if(1 < (a - first)) { + last = a; + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + } + } else { + if(trbudget_check(budget, last - first)) { + limit = tr_ilg(last - first), ISAd += incr; + } else { + if(0 <= trlink) { stack[trlink].d = -1; } + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + } +#undef STACK_SIZE +} + + + +/*---------------------------------------------------------------------------*/ + +/* Tandem repeat sort */ +static +void +trsort(int *ISA, int *SA, int n, int depth) { + int *ISAd; + int *first, *last; + trbudget_t budget; + int t, skip, unsorted; + + trbudget_init(&budget, tr_ilg(n) * 2 / 3, n); +/* trbudget_init(&budget, tr_ilg(n) * 3 / 4, n); */ + for(ISAd = ISA + depth; -n < *SA; ISAd += ISAd - ISA) { + first = SA; + skip = 0; + unsorted = 0; + do { + if((t = *first) < 0) { first -= t; skip += t; } + else { + if(skip != 0) { *(first + skip) = skip; skip = 0; } + last = SA + ISA[t] + 1; + if(1 < (last - first)) { + budget.count = 0; + tr_introsort(ISA, ISAd, SA, first, last, &budget); + if(budget.count != 0) { unsorted += budget.count; } + else { skip = first - last; } + } else if((last - first) == 1) { + skip = -1; + } + first = last; + } + } while(first < (SA + n)); + if(skip != 0) { *(first + skip) = skip; } + if(unsorted == 0) { break; } + } +} + + +/*---------------------------------------------------------------------------*/ + +/* Sorts suffixes of type B*. */ +static +int +sort_typeBstar(const unsigned char *T, int *SA, + int *bucket_A, int *bucket_B, + int n) { + int *PAb, *ISAb, *buf; +#ifdef _OPENMP + int *curbuf; + int l; +#endif + int i, j, k, t, m, bufsize; + int c0, c1; +#ifdef _OPENMP + int d0, d1; + int tmp; +#endif + + /* Initialize bucket arrays. */ + for(i = 0; i < BUCKET_A_SIZE; ++i) { bucket_A[i] = 0; } + for(i = 0; i < BUCKET_B_SIZE; ++i) { bucket_B[i] = 0; } + + /* Count the number of occurrences of the first one or two characters of each + type A, B and B* suffix. Moreover, store the beginning position of all + type B* suffixes into the array SA. */ + for(i = n - 1, m = n, c0 = T[n - 1]; 0 <= i;) { + /* type A suffix. */ + do { ++BUCKET_A(c1 = c0); } while((0 <= --i) && ((c0 = T[i]) >= c1)); + if(0 <= i) { + /* type B* suffix. */ + ++BUCKET_BSTAR(c0, c1); + SA[--m] = i; + /* type B suffix. */ + for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) <= c1); --i, c1 = c0) { + ++BUCKET_B(c0, c1); + } + } + } + m = n - m; +/* +note: + A type B* suffix is lexicographically smaller than a type B suffix that + begins with the same first two characters. +*/ + + /* Calculate the index of start/end point of each bucket. */ + for(c0 = 0, i = 0, j = 0; c0 < ALPHABET_SIZE; ++c0) { + t = i + BUCKET_A(c0); + BUCKET_A(c0) = i + j; /* start point */ + i = t + BUCKET_B(c0, c0); + for(c1 = c0 + 1; c1 < ALPHABET_SIZE; ++c1) { + j += BUCKET_BSTAR(c0, c1); + BUCKET_BSTAR(c0, c1) = j; /* end point */ + i += BUCKET_B(c0, c1); + } + } + + if(0 < m) { + /* Sort the type B* suffixes by their first two characters. */ + PAb = SA + n - m; ISAb = SA + m; + for(i = m - 2; 0 <= i; --i) { + t = PAb[i], c0 = T[t], c1 = T[t + 1]; + SA[--BUCKET_BSTAR(c0, c1)] = i; + } + t = PAb[m - 1], c0 = T[t], c1 = T[t + 1]; + SA[--BUCKET_BSTAR(c0, c1)] = m - 1; + + /* Sort the type B* substrings using sssort. */ +#ifdef _OPENMP + tmp = omp_get_max_threads(); + buf = SA + m, bufsize = (n - (2 * m)) / tmp; + c0 = ALPHABET_SIZE - 2, c1 = ALPHABET_SIZE - 1, j = m; +#pragma omp parallel default(shared) private(curbuf, k, l, d0, d1, tmp) + { + tmp = omp_get_thread_num(); + curbuf = buf + tmp * bufsize; + k = 0; + for(;;) { + #pragma omp critical(sssort_lock) + { + if(0 < (l = j)) { + d0 = c0, d1 = c1; + do { + k = BUCKET_BSTAR(d0, d1); + if(--d1 <= d0) { + d1 = ALPHABET_SIZE - 1; + if(--d0 < 0) { break; } + } + } while(((l - k) <= 1) && (0 < (l = k))); + c0 = d0, c1 = d1, j = k; + } + } + if(l == 0) { break; } + sssort(T, PAb, SA + k, SA + l, + curbuf, bufsize, 2, n, *(SA + k) == (m - 1)); + } + } +#else + buf = SA + m, bufsize = n - (2 * m); + for(c0 = ALPHABET_SIZE - 2, j = m; 0 < j; --c0) { + for(c1 = ALPHABET_SIZE - 1; c0 < c1; j = i, --c1) { + i = BUCKET_BSTAR(c0, c1); + if(1 < (j - i)) { + sssort(T, PAb, SA + i, SA + j, + buf, bufsize, 2, n, *(SA + i) == (m - 1)); + } + } + } +#endif + + /* Compute ranks of type B* substrings. */ + for(i = m - 1; 0 <= i; --i) { + if(0 <= SA[i]) { + j = i; + do { ISAb[SA[i]] = i; } while((0 <= --i) && (0 <= SA[i])); + SA[i + 1] = i - j; + if(i <= 0) { break; } + } + j = i; + do { ISAb[SA[i] = ~SA[i]] = j; } while(SA[--i] < 0); + ISAb[SA[i]] = j; + } + + /* Construct the inverse suffix array of type B* suffixes using trsort. */ + trsort(ISAb, SA, m, 1); + + /* Set the sorted order of tyoe B* suffixes. */ + for(i = n - 1, j = m, c0 = T[n - 1]; 0 <= i;) { + for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) >= c1); --i, c1 = c0) { } + if(0 <= i) { + t = i; + for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) <= c1); --i, c1 = c0) { } + SA[ISAb[--j]] = ((t == 0) || (1 < (t - i))) ? t : ~t; + } + } + + /* Calculate the index of start/end point of each bucket. */ + BUCKET_B(ALPHABET_SIZE - 1, ALPHABET_SIZE - 1) = n; /* end point */ + for(c0 = ALPHABET_SIZE - 2, k = m - 1; 0 <= c0; --c0) { + i = BUCKET_A(c0 + 1) - 1; + for(c1 = ALPHABET_SIZE - 1; c0 < c1; --c1) { + t = i - BUCKET_B(c0, c1); + BUCKET_B(c0, c1) = i; /* end point */ + + /* Move all type B* suffixes to the correct position. */ + for(i = t, j = BUCKET_BSTAR(c0, c1); + j <= k; + --i, --k) { SA[i] = SA[k]; } + } + BUCKET_BSTAR(c0, c0 + 1) = i - BUCKET_B(c0, c0) + 1; /* start point */ + BUCKET_B(c0, c0) = i; /* end point */ + } + } + + return m; +} + +/* Constructs the suffix array by using the sorted order of type B* suffixes. */ +static +void +construct_SA(const unsigned char *T, int *SA, + int *bucket_A, int *bucket_B, + int n, int m) { + int *i, *j, *k; + int s; + int c0, c1, c2; + + if(0 < m) { + /* Construct the sorted order of type B suffixes by using + the sorted order of type B* suffixes. */ + for(c1 = ALPHABET_SIZE - 2; 0 <= c1; --c1) { + /* Scan the suffix array from right to left. */ + for(i = SA + BUCKET_BSTAR(c1, c1 + 1), + j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1; + i <= j; + --j) { + if(0 < (s = *j)) { + assert(T[s] == c1); + assert(((s + 1) < n) && (T[s] <= T[s + 1])); + assert(T[s - 1] <= T[s]); + *j = ~s; + c0 = T[--s]; + if((0 < s) && (T[s - 1] > c0)) { s = ~s; } + if(c0 != c2) { + if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; } + k = SA + BUCKET_B(c2 = c0, c1); + } + assert(k < j); + *k-- = s; + } else { + assert(((s == 0) && (T[s] == c1)) || (s < 0)); + *j = ~s; + } + } + } + } + + /* Construct the suffix array by using + the sorted order of type B suffixes. */ + k = SA + BUCKET_A(c2 = T[n - 1]); + *k++ = (T[n - 2] < c2) ? ~(n - 1) : (n - 1); + /* Scan the suffix array from left to right. */ + for(i = SA, j = SA + n; i < j; ++i) { + if(0 < (s = *i)) { + assert(T[s - 1] >= T[s]); + c0 = T[--s]; + if((s == 0) || (T[s - 1] < c0)) { s = ~s; } + if(c0 != c2) { + BUCKET_A(c2) = k - SA; + k = SA + BUCKET_A(c2 = c0); + } + assert(i < k); + *k++ = s; + } else { + assert(s < 0); + *i = ~s; + } + } +} + +/* Constructs the burrows-wheeler transformed string directly + by using the sorted order of type B* suffixes. */ +static +int +construct_BWT(const unsigned char *T, int *SA, + int *bucket_A, int *bucket_B, + int n, int m) { + int *i, *j, *k, *orig; + int s; + int c0, c1, c2; + + if(0 < m) { + /* Construct the sorted order of type B suffixes by using + the sorted order of type B* suffixes. */ + for(c1 = ALPHABET_SIZE - 2; 0 <= c1; --c1) { + /* Scan the suffix array from right to left. */ + for(i = SA + BUCKET_BSTAR(c1, c1 + 1), + j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1; + i <= j; + --j) { + if(0 < (s = *j)) { + assert(T[s] == c1); + assert(((s + 1) < n) && (T[s] <= T[s + 1])); + assert(T[s - 1] <= T[s]); + c0 = T[--s]; + *j = ~((int)c0); + if((0 < s) && (T[s - 1] > c0)) { s = ~s; } + if(c0 != c2) { + if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; } + k = SA + BUCKET_B(c2 = c0, c1); + } + assert(k < j); + *k-- = s; + } else if(s != 0) { + *j = ~s; +#ifndef NDEBUG + } else { + assert(T[s] == c1); +#endif + } + } + } + } + + /* Construct the BWTed string by using + the sorted order of type B suffixes. */ + k = SA + BUCKET_A(c2 = T[n - 1]); + *k++ = (T[n - 2] < c2) ? ~((int)T[n - 2]) : (n - 1); + /* Scan the suffix array from left to right. */ + for(i = SA, j = SA + n, orig = SA; i < j; ++i) { + if(0 < (s = *i)) { + assert(T[s - 1] >= T[s]); + c0 = T[--s]; + *i = c0; + if((0 < s) && (T[s - 1] < c0)) { s = ~((int)T[s - 1]); } + if(c0 != c2) { + BUCKET_A(c2) = k - SA; + k = SA + BUCKET_A(c2 = c0); + } + assert(i < k); + *k++ = s; + } else if(s != 0) { + *i = ~s; + } else { + orig = i; + } + } + + return orig - SA; +} + + +/*---------------------------------------------------------------------------*/ + +/*- Function -*/ + +int +divsufsort(const unsigned char *T, int *SA, int n) { + int *bucket_A, *bucket_B; + int m; + int err = 0; + + /* Check arguments. */ + if((T == NULL) || (SA == NULL) || (n < 0)) { return -1; } + else if(n == 0) { return 0; } + else if(n == 1) { SA[0] = 0; return 0; } + else if(n == 2) { m = (T[0] < T[1]); SA[m ^ 1] = 0, SA[m] = 1; return 0; } + + bucket_A = (int *)malloc(BUCKET_A_SIZE * sizeof(int)); + bucket_B = (int *)malloc(BUCKET_B_SIZE * sizeof(int)); + + /* Suffixsort. */ + if((bucket_A != NULL) && (bucket_B != NULL)) { + m = sort_typeBstar(T, SA, bucket_A, bucket_B, n); + construct_SA(T, SA, bucket_A, bucket_B, n, m); + } else { + err = -2; + } + + free(bucket_B); + free(bucket_A); + + return err; +} + +int +divbwt(const unsigned char *T, unsigned char *U, int *A, int n) { + int *B; + int *bucket_A, *bucket_B; + int m, pidx, i; + + /* Check arguments. */ + if((T == NULL) || (U == NULL) || (n < 0)) { return -1; } + else if(n <= 1) { if(n == 1) { U[0] = T[0]; } return n; } + + if((B = A) == NULL) { B = (int *)malloc((size_t)(n + 1) * sizeof(int)); } + bucket_A = (int *)malloc(BUCKET_A_SIZE * sizeof(int)); + bucket_B = (int *)malloc(BUCKET_B_SIZE * sizeof(int)); + + /* Burrows-Wheeler Transform. */ + if((B != NULL) && (bucket_A != NULL) && (bucket_B != NULL)) { + m = sort_typeBstar(T, B, bucket_A, bucket_B, n); + pidx = construct_BWT(T, B, bucket_A, bucket_B, n, m); + + /* Copy to output string. */ + U[0] = T[n - 1]; + for(i = 0; i < pidx; ++i) { U[i + 1] = (unsigned char)B[i]; } + for(i += 1; i < n; ++i) { U[i] = (unsigned char)B[i]; } + pidx += 1; + } else { + pidx = -2; + } + + free(bucket_B); + free(bucket_A); + if(A == NULL) { free(B); } + + return pidx; +} diff --git a/tools/Flips/divsufsort.h b/tools/Flips/divsufsort.h new file mode 100644 index 000000000..8d8952e9b --- /dev/null +++ b/tools/Flips/divsufsort.h @@ -0,0 +1,63 @@ +/* + * divsufsort.h for libdivsufsort-lite + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _DIVSUFSORT_H +#define _DIVSUFSORT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/*- Prototypes -*/ + +/** + * Constructs the suffix array of a given string. + * @param T[0..n-1] The input string. + * @param SA[0..n-1] The output array of suffixes. + * @param n The length of the given string. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +int +divsufsort(const unsigned char *T, int *SA, int n); + +/** + * Constructs the burrows-wheeler transformed string of a given string. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param A[0..n-1] The temporary array. (can be NULL) + * @param n The length of the given string. + * @return The primary index if no error occurred, -1 or -2 otherwise. + */ +int +divbwt(const unsigned char *T, unsigned char *U, int *A, int n); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* _DIVSUFSORT_H */ diff --git a/tools/Flips/flatpak/com.github.Alcaro.Flips.json b/tools/Flips/flatpak/com.github.Alcaro.Flips.json new file mode 100644 index 000000000..f840a29f0 --- /dev/null +++ b/tools/Flips/flatpak/com.github.Alcaro.Flips.json @@ -0,0 +1,36 @@ +{ + "app-id" : "com.github.Alcaro.Flips", + "runtime" : "org.gnome.Platform", + "runtime-version" : "42", + "sdk" : "org.gnome.Sdk", + "command" : "flips", + "finish-args" : [ + /* X11 + XShm access */ + "--share=ipc", + "--socket=fallback-x11", + /* Wayland access */ + "--socket=wayland", + /* OpenGL + DRI access */ + "--device=dri", + /* Needed to save patched ROMs */ + "--filesystem=home", + /* Needed to find the ROMs and patches */ + "--filesystem=host:ro" + ], + "modules" : [ + { + "name" : "flips", + "buildsystem" : "simple", + "build-commands": [ + "sh make.sh", + "make install PREFIX=/app" + ], + "sources" : [ + { + "type" : "git", + "url" : "https://github.com/Alcaro/Flips.git" + } + ] + } + ] +} diff --git a/tools/Flips/flips-cli.cpp b/tools/Flips/flips-cli.cpp new file mode 100644 index 000000000..16b4b933c --- /dev/null +++ b/tools/Flips/flips-cli.cpp @@ -0,0 +1,18 @@ +//Module name: Floating IPS, command line frontend +//Author: Alcaro +//Date: See Git history +//Licence: GPL v3.0 or higher + +#include "flips.h" + +#ifdef FLIPS_CLI +file* file::create(const char * filename) { return file::create_libc(filename); } +bool file::exists(const char * filename) { return file::exists_libc(filename); } +filewrite* filewrite::create(const char * filename) { return filewrite::create_libc(filename); } +filemap* filemap::create(const char * filename) { return filemap::create_fallback(filename); } + +int main(int argc, char * argv[]) +{ + return flipsmain(argc, argv); +} +#endif diff --git a/tools/Flips/flips-gtk.cpp b/tools/Flips/flips-gtk.cpp new file mode 100644 index 000000000..72c70a79c --- /dev/null +++ b/tools/Flips/flips-gtk.cpp @@ -0,0 +1,1091 @@ +//Module name: Floating IPS, GTK+ frontend +//Author: Alcaro +//Date: See Git history +//Licence: GPL v3.0 or higher + +//List of assumptions made whose correctness is not guaranteed by GTK+: +//The character '9' is as wide as the widest of '0' '1' '2' '3' '4' '5' '6' '7' '8' '9'. +// Failure leads to: The BPS delta creation progress window being a little too small. +// Fixable: Not hard, but unlikely to be worth it. +//g_spawn_async does not write to argv or its pointed-to strings. +// Failure leads to: Corrupting the configuration. +// Fixable: Not hard, but unlikely to be worth it. + +#include "flips.h" + +#ifdef FLIPS_GTK +#define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_10 +//I'd prefer enabling this, but that makes the GTK headers throw about 500 warnings about GtkFileChooserNative. probably missing ifdef +//#define GDK_VERSION_MAX_ALLOWED GDK_VERSION_3_10 +#include + +class file_gtk : public file { + size_t size; + GFileInputStream* io; + +public: + static file* create(const char * filename) + { + GFile* file = g_file_new_for_commandline_arg(filename); + GFileInputStream* io=g_file_read(file, NULL, NULL); + g_object_unref(file); + if (!io) return NULL; + return new file_gtk(io); + } + +private: + file_gtk(GFileInputStream* io) : io(io) + { + GFileInfo* info = g_file_input_stream_query_info(io, G_FILE_ATTRIBUTE_STANDARD_SIZE, NULL, NULL); + size = g_file_info_get_size(info); + g_object_unref(info); + } + +public: + size_t len() { return size; } + + bool read(uint8_t* target, size_t start, size_t len) + { + g_seekable_seek(G_SEEKABLE(io), start, G_SEEK_SET, NULL, NULL); + gsize actualsize; + return (g_input_stream_read_all(G_INPUT_STREAM(io), target, len, &actualsize, NULL, NULL) && actualsize == len); + } + + ~file_gtk() { g_object_unref(io); } +}; + +file* file::create(const char * filename) { return file_gtk::create(filename); } +bool file::exists(const char * filename) +{ + GFile* file = g_file_new_for_commandline_arg(filename); + bool ret = g_file_query_exists(file, NULL); + g_object_unref(file); + return ret; +} + + +class filewrite_gtk : public filewrite { + GOutputStream* io; + +public: + static filewrite* create(const char * filename) + { + GFile* file = g_file_new_for_commandline_arg(filename); + if (!file) return NULL; + GFileOutputStream* io = g_file_replace(file, NULL, false, G_FILE_CREATE_NONE, NULL, NULL); + g_object_unref(file); + if (!io) return NULL; + return new filewrite_gtk(G_OUTPUT_STREAM(io)); + } + +private: + filewrite_gtk(GOutputStream* io) : io(io) {} + +public: + bool append(const uint8_t* data, size_t len) + { + return g_output_stream_write_all(io, data, len, NULL, NULL, NULL); + } + + ~filewrite_gtk() { g_object_unref(io); } +}; + +filewrite* filewrite::create(const char * filename) +{ + filewrite* ret = filewrite_gtk::create(filename); // g_file_create tries to create /.goutputstream-asdfghjkl + if (!ret) ret = filewrite::create_libc(filename); // if it fails (for example /dev/.goutputstream-foobar), try this instead + return ret; +} + + +class filemap_gtk : public filemap { +public: + GMappedFile* mapfile; + + static filemap* create(const char * filename) + { + GMappedFile* mapfile = g_mapped_file_new(filename, false, NULL); + if (!mapfile) return NULL; + return new filemap_gtk(mapfile); + } + + filemap_gtk(GMappedFile* mapfile) : mapfile(mapfile) {} + + size_t len() { return g_mapped_file_get_length(mapfile); } + const uint8_t * ptr() { return (uint8_t*)g_mapped_file_get_contents(mapfile); } + + ~filemap_gtk() { g_mapped_file_unref(mapfile); } +}; +filemap* filemap::create(const char * filename) +{ + filemap* ret = filemap_gtk::create(filename); + if (!ret) ret = filemap::create_fallback(filename); + return ret; +} + + + +static bool canShowGUI; +static GtkWidget* window; +static bool isFlatpak; + +//struct { +// char signature[9]; +// unsigned int lastPatchType; +// bool createFromAllFiles; +// bool openInEmulatorOnAssoc; +// bool autoSelectRom; +// gchar * emulator; +//} static state; +//#define cfgversion 5 + +static GtkWidget* windowBpsd; +static GtkWidget* labelBpsd; +static bool bpsdCancel; + +//static void bpsdeltaCancel(GtkWindow* widget, gpointer user_data) +//{ +// bpsdCancel=true; +//} + +void bpsdeltaBegin() +{ + bpsdCancel=false; + windowBpsd=gtk_window_new(GTK_WINDOW_TOPLEVEL); + if (window) + { + gtk_window_set_modal(GTK_WINDOW(windowBpsd), true); + gtk_window_set_transient_for(GTK_WINDOW(windowBpsd), GTK_WINDOW(window)); + } + gtk_window_set_title(GTK_WINDOW(windowBpsd), flipsversion); + + labelBpsd=gtk_label_new("Please wait... 99.9%"); + gtk_container_add(GTK_CONTAINER(windowBpsd), labelBpsd); + GtkRequisition size; + gtk_widget_get_preferred_size(labelBpsd, NULL, &size); + gtk_label_set_text(GTK_LABEL(labelBpsd), "Please wait... 0.0%"); + gtk_widget_set_size_request(labelBpsd, size.width, size.height); + gtk_window_set_resizable(GTK_WINDOW(windowBpsd), false); + + gtk_misc_set_alignment(GTK_MISC(labelBpsd), 0.0f, 0.5f); + + gtk_widget_show_all(windowBpsd); +} + +bool bpsdeltaProgress(void* userdata, size_t done, size_t total) +{ + if (bpsdeltaGetProgress(done, total)) + { + gtk_label_set_text(GTK_LABEL(labelBpsd), bpsdProgStr); + } + gtk_main_iteration_do(false); + return !bpsdCancel; +} + +void bpsdeltaEnd() +{ + if (!bpsdCancel) gtk_widget_destroy(windowBpsd); +} + +//'force' sets the filename even if the file doesn't exist +static void setoutpath(GtkFileChooser* dialog, const char * name, bool force) +{ + if (!name) return; + + gtk_file_chooser_set_uri(dialog, name); + if (!force) return; + gchar* filename = g_filename_from_uri(name, NULL, NULL); + if (filename) + { + gchar* basename = g_path_get_basename(filename); + gtk_file_chooser_set_current_name(dialog, basename ? basename : filename); + g_free(filename); + g_free(basename); + } +} + +static char * SelectRom(const char * defaultname, const char * title, bool isForSaving) +{ + GtkWidget* dialog; + if (!isForSaving) + { + dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(window), GTK_FILE_CHOOSER_ACTION_OPEN, + "_Cancel", GTK_RESPONSE_CANCEL, "_Open", GTK_RESPONSE_ACCEPT, NULL); + setoutpath(GTK_FILE_CHOOSER(dialog), defaultname, false); + } + else + { + dialog = gtk_file_chooser_dialog_new(title, GTK_WINDOW(window), GTK_FILE_CHOOSER_ACTION_SAVE, + "_Cancel", GTK_RESPONSE_CANCEL, "_Save", GTK_RESPONSE_ACCEPT, NULL); + setoutpath(GTK_FILE_CHOOSER(dialog), defaultname, true); + gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), true); + } + + GtkFileFilter* filterRom = gtk_file_filter_new(); + gtk_file_filter_set_name(filterRom, "Most Common ROM Files"); + gtk_file_filter_add_pattern(filterRom, "*.smc"); + gtk_file_filter_add_pattern(filterRom, "*.sfc"); + gtk_file_filter_add_pattern(filterRom, "*.nes"); + gtk_file_filter_add_pattern(filterRom, "*.gb"); + gtk_file_filter_add_pattern(filterRom, "*.gbc"); + gtk_file_filter_add_pattern(filterRom, "*.gba"); + gtk_file_filter_add_pattern(filterRom, "*.nds"); + gtk_file_filter_add_pattern(filterRom, "*.vb"); + gtk_file_filter_add_pattern(filterRom, "*.sms"); + gtk_file_filter_add_pattern(filterRom, "*.smd"); + gtk_file_filter_add_pattern(filterRom, "*.md"); + gtk_file_filter_add_pattern(filterRom, "*.ngp"); + gtk_file_filter_add_pattern(filterRom, "*.n64"); + gtk_file_filter_add_pattern(filterRom, "*.z64"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filterRom); + + GtkFileFilter* filterAll = gtk_file_filter_new(); + gtk_file_filter_set_name(filterAll, "All files"); + gtk_file_filter_add_pattern(filterAll, "*"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filterAll); + + if (cfg.getint("allfiles")) gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filterAll); + else gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(dialog), filterRom); + + char * ret=NULL; + if (gtk_dialog_run(GTK_DIALOG(dialog))==GTK_RESPONSE_ACCEPT) + { + ret=gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog)); + } + + GtkFileFilter* thisfilter=gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(dialog)); + cfg.setint("allfiles", (thisfilter==filterAll)); + + gtk_widget_destroy(dialog); + return ret; +} + +//returns path if demandLocal, else URI +static GSList * SelectPatches(bool allowMulti, bool demandLocal) +{ + GtkWidget* dialog=gtk_file_chooser_dialog_new(allowMulti?"Select Patches to Use":"Select Patch to Use", GTK_WINDOW(window), GTK_FILE_CHOOSER_ACTION_OPEN, + "_Cancel", GTK_RESPONSE_CANCEL, "_Open", GTK_RESPONSE_ACCEPT, NULL); + gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), allowMulti); + gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), demandLocal); + + GtkFileFilter* filter; + + filter=gtk_file_filter_new(); + gtk_file_filter_set_name(filter, "All supported patches (*.bps, *.ips)"); + gtk_file_filter_add_pattern(filter, "*.bps"); + gtk_file_filter_add_pattern(filter, "*.ips"); + gtk_file_filter_add_pattern(filter, "*.ups"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); + //apparently the file chooser takes ownership of the filter. would be nice to document that in gtk_file_chooser_set_filter... + + filter=gtk_file_filter_new(); + gtk_file_filter_set_name(filter, "All files"); + gtk_file_filter_add_pattern(filter, "*"); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); + + if (gtk_dialog_run(GTK_DIALOG(dialog))!=GTK_RESPONSE_ACCEPT) + { + gtk_widget_destroy(dialog); + return NULL; + } + + GSList * ret; + if (demandLocal) ret=gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog)); + else ret=gtk_file_chooser_get_uris(GTK_FILE_CHOOSER(dialog)); + gtk_widget_destroy(dialog); + return ret; +} + +static void ShowMessage(struct errorinfo errinf) +{ + GtkMessageType errorlevels[]={ GTK_MESSAGE_OTHER, GTK_MESSAGE_OTHER, GTK_MESSAGE_WARNING, GTK_MESSAGE_WARNING, GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR }; + GtkWidget* dialog=gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, errorlevels[errinf.level], GTK_BUTTONS_CLOSE, "%s",errinf.description); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +} + + + +enum worsterrorauto { ea_none, ea_warning, ea_invalid, ea_io_rom_write, ea_io_rom_read, ea_no_auto, ea_io_read_patch }; + +struct multiapplystateauto { + enum worsterrorauto error; + bool anySuccess; + + const char * foundRom; + bool canUseFoundRom; + bool usingFoundRom; +}; + +static void ApplyPatchMultiAutoSub(gpointer data, gpointer user_data) +{ +#define max(a,b) ((a)>(b)?(a):(b)) +#define error(which) do { state->error=max(state->error, which); } while(0) + gchar * patchpath=(gchar*)data; + struct multiapplystateauto * state=(struct multiapplystateauto*)user_data; + + file* patch = file::create(patchpath); + if (!patch) + { + state->canUseFoundRom=false; + error(ea_io_read_patch); + return; + } + + bool possible; + const char * rompath=FindRomForPatch(patch, &possible); + if (state->usingFoundRom) + { + if (!rompath) rompath=state->foundRom; + else goto cleanup; + } + else + { + if (!rompath) + { + if (possible) state->canUseFoundRom=false; + error(ea_no_auto); + goto cleanup; + } + } + if (!state->foundRom) state->foundRom=rompath; + if (state->foundRom!=rompath) state->canUseFoundRom=false; + + { + const char * romext=GetExtension(rompath); + gchar * outrompath=g_strndup(patchpath, strlen(patchpath)+strlen(romext)+1); + strcpy(GetExtension(outrompath), romext); + + struct errorinfo errinf=ApplyPatchMem(patch, rompath, true, outrompath, NULL, true); + if (errinf.level==el_broken) error(ea_invalid); + if (errinf.level==el_notthis) error(ea_no_auto); + if (errinf.level==el_warning) error(ea_warning); + if (errinf.levelanySuccess=true; + else state->canUseFoundRom=false; + g_free(outrompath); + } + +cleanup: + delete patch; +#undef max +#undef error +} + +static bool ApplyPatchMultiAuto(GSList * filenames) +{ + struct multiapplystateauto state; + state.error=ea_none; + state.anySuccess=false; + + state.foundRom=NULL; + state.canUseFoundRom=true; + state.usingFoundRom=false; + + g_slist_foreach(filenames, ApplyPatchMultiAutoSub, &state); + if (state.error==ea_no_auto && state.foundRom && state.canUseFoundRom) + { + state.usingFoundRom=true; + state.error=ea_none; + g_slist_foreach(filenames, ApplyPatchMultiAutoSub, &state); + } + + if (state.anySuccess) + { + struct errorinfo messages[8]={ + { el_ok, "The patches were applied successfully!" },//ea_none + { el_warning, "The patches were applied, but one or more may be mangled or improperly created..." },//ea_warning + { el_warning, "Some patches were applied, but not all of the given patches are valid..." },//ea_invalid + { el_warning, "Some patches were applied, but not all of the desired ROMs could be created..." },//ea_rom_io_write + { el_warning, "Some patches were applied, but not all of the input ROMs could be read..." },//ea_io_rom_read + { el_warning, "Some patches were applied, but not all of the required input ROMs could be located..." },//ea_no_auto + { el_warning, "Some patches were applied, but not all of the given patches could be read..." },//ea_io_read_patch + { el_broken, NULL },//ea_no_found + }; + ShowMessage(messages[state.error]); + return true; + } + return false; +} + + + +enum worsterror { e_none, e_warning_notthis, e_warning, e_invalid_this, e_invalid, e_io_write, e_io_read, e_io_read_rom }; + +struct multiapplystate { + const gchar * romext; + struct mem rommem; + bool anySuccess; + bool removeHeaders; + enum worsterror worsterror; +}; + +static void ApplyPatchMulti(gpointer data, gpointer user_data) +{ + char * patchname=(char*)data; + struct multiapplystate * state=(struct multiapplystate*)user_data; +#define max(a,b) ((a)>(b)?(a):(b)) +#define error(which) do { state->worsterror=max(state->worsterror, which); } while(0) + + file* patch = file::create(patchname); + if (patch) + { + char * outromname=g_strndup(patchname, strlen(patchname)+strlen(state->romext)+1); + char * outromext=GetExtension(outromname); + strcpy(outromext, state->romext); + + struct errorinfo errinf=ApplyPatchMem2(patch, state->rommem, state->removeHeaders, true, outromname, NULL); + if (errinf.level==el_broken) error(e_invalid); + if (errinf.level==el_notthis) error(e_invalid_this); + if (errinf.level==el_warning) error(e_warning); + if (errinf.level==el_unlikelythis) error(e_warning_notthis); + if (errinf.levelanySuccess=true; + + delete patch; + g_free(outromname); + } + else error(e_io_read); + g_free(data); +#undef max +#undef error +} + +static void a_ApplyPatch(GtkButton* widget, gpointer user_data) +{ + gchar * filename=(gchar*)user_data; + GSList * filenames=NULL; + if (!filename) + { + filenames=SelectPatches(true, false); + if (!filenames) return; + if (!filenames->next) filename=(gchar*)filenames->data; + } + if (filename)//do not change to else, this is set if the user picks only one file + { + struct errorinfo errinf; + file* patchfile = file::create(filename); + if (!patchfile) + { + errinf=(struct errorinfo){ el_broken, "Couldn't read input patch. What exactly are you doing?" }; + ShowMessage(errinf); + return; + } + + char * inromname=NULL; + if (cfg.getint("autorom")) inromname=g_strdup(FindRomForPatch(patchfile, NULL)); // g_strdup(NULL) is NULL + if (!inromname) inromname=SelectRom(filename, "Select File to Patch", false); + if (!inromname) goto cleanup; + + { + const char * inromext=GetExtension(inromname); + if (!inromext) inromext=""; + + char * outromname_d=g_strndup(filename, strlen(filename)+strlen(inromext)+1); + char * ext=GetExtension(outromname_d); + strcpy(ext, inromext); + + char * outromname=SelectRom(outromname_d, "Select Output File", true); + if (outromname) + { + struct errorinfo errinf=ApplyPatchMem(patchfile, inromname, true, outromname, NULL, cfg.getint("autorom")); + ShowMessage(errinf); + } + g_free(inromname); + g_free(outromname_d); + g_free(outromname); + } + + cleanup: + delete patchfile; + } + else + { + if (cfg.getint("autorom")) + { + if (ApplyPatchMultiAuto(filenames)) + { + g_slist_free_full(filenames, g_free); + return; + } + } + + struct multiapplystate state; + //picking one at random isn't always correct, but it's better than nothing + char * inromname=SelectRom((gchar*)filenames->data, "Select Base File", false); + if (!inromname) return; + state.romext=GetExtension(inromname); + if (!*state.romext) state.romext=".sfc"; + filemap* map=filemap::create(inromname); + state.rommem=map->get(); + state.removeHeaders=shouldRemoveHeader(inromname, state.rommem.len); + state.worsterror=e_none; + state.anySuccess=false; + g_slist_foreach(filenames, ApplyPatchMulti, &state); + g_free(inromname); + delete map; + struct errorinfo errormessages[2][8]={ + { + //no error-free + { el_ok, NULL },//e_none + { el_warning, NULL},//e_warning_notthis + { el_warning, NULL},//e_warning + { el_broken, "None of these are valid patches for this ROM!" },//e_invalid_this + { el_broken, "None of these are valid patches!" },//e_invalid + { el_broken, "Couldn't write any ROMs. Are you on a read-only medium?" },//e_io_write + { el_broken, "Couldn't read any patches. What exactly are you doing?" },//e_io_read + { el_broken, "Couldn't read the input ROM. What exactly are you doing?" },//e_io_read_rom + },{ + //at least one error-free + { el_ok, "The patches were applied successfully!" },//e_none + { el_warning, "The patches were applied, but one or more is unlikely to be intended for this ROM..." },//e_warning_notthis + { el_warning, "The patches were applied, but one or more may be mangled or improperly created..." },//e_warning + { el_warning, "Some patches were applied, but not all of the given patches are valid for this ROM..." },//e_invalid_this + { el_warning, "Some patches were applied, but not all of the given patches are valid..." },//e_invalid + { el_warning, "Some patches were applied, but not all of the desired ROMs could be created..." },//e_io_write + { el_warning, "Some patches were applied, but not all of the given patches could be read..." },//e_io_read + { el_broken, NULL,//e_io_read_rom + }, + }}; + ShowMessage(errormessages[state.anySuccess][state.worsterror]); + } + g_slist_free(filenames); +} + +static void a_CreatePatch(GtkButton* widget, gpointer user_data) +{ + char * inrom=NULL; + char * outrom=NULL; + char * patchname=NULL; + + inrom=SelectRom(NULL, "Select ORIGINAL UNMODIFIED File to Use", false); + if (!inrom) goto cleanup; + outrom=SelectRom(inrom, "Select NEW MODIFIED File to Use", false); + if (!outrom) goto cleanup; + if (!strcmp(inrom, outrom)) + { + ShowMessage((struct errorinfo){ el_broken, "That's the same file! You should really use two different files." }); + goto cleanup; + } + + struct { + const char * filter; + const char * description; + } static const typeinfo[]={ + { "*.bps", "BPS Patch File" }, + { "*.ips", "IPS Patch File" }, + }; + static const int numtypeinfo = sizeof(typeinfo)/sizeof(*typeinfo); + + int lasttype; + lasttype = cfg.getint("lasttype", ty_bps); + { + char * defpatchname=g_strndup(outrom, strlen(outrom)+4+1); + char * ext=GetExtension(defpatchname); + strcpy(ext, typeinfo[lasttype-1].filter+1); + + GtkWidget* dialog=gtk_file_chooser_dialog_new("Select File to Save As", GTK_WINDOW(window), GTK_FILE_CHOOSER_ACTION_SAVE, + "_Cancel", GTK_RESPONSE_CANCEL, "_Save", GTK_RESPONSE_ACCEPT, NULL); + setoutpath(GTK_FILE_CHOOSER(dialog), defpatchname, true); + gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), true); + + GtkFileFilter* filters[numtypeinfo]; + for (size_t i=0;inotify(self, pspec); + } + }; + wrap filter_updater = { GTK_FILE_CHOOSER(dialog), filters, lasttype-1 }; + g_signal_connect(dialog, "notify::filter", G_CALLBACK(&wrap::notify_s), &filter_updater); + + if (gtk_dialog_run(GTK_DIALOG(dialog))==GTK_RESPONSE_ACCEPT) + { + patchname=gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog)); + } + + GtkFileFilter* filter=gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(dialog)); + for (int i=0;idata; + g_slist_free(patchnames); + } + + file* patchfile = file::create(patchname); + gchar * romname=NULL; + { + if (!patchfile) + { + ShowMessage((struct errorinfo){ el_broken, "Couldn't read input patch. What exactly are you doing?" }); + goto cleanup; + } + + if (cfg.getint("autorom")) romname=g_strdup(FindRomForPatch(patchfile, NULL)); // g_strdup(NULL) is NULL + if (!romname) + { + char* patch_uri = g_filename_to_uri(patchname, NULL, NULL); + romname=SelectRom(patch_uri, "Select Base File", false); + g_free(patch_uri); + } + if (!romname) goto cleanup; + + if (!GetEmuFor(romname)) a_SetEmulatorFor(NULL, romname); + if (!GetEmuFor(romname)) goto cleanup; + + //gchar * outromname; + //gint fd=g_file_open_tmp("flipsXXXXXX.smc", &outromname, NULL); + + gchar * outromname_rel=g_strndup(patchname, strlen(patchname)+4+1); + strcpy(GetExtension(outromname_rel), GetExtension(romname)); + + GFile* outrom_file=g_file_new_for_commandline_arg(outromname_rel); + g_free(outromname_rel); + gchar * outromname; + if (g_file_is_native(outrom_file)) outromname=g_file_get_path(outrom_file); + else outromname=g_file_get_uri(outrom_file); + g_object_unref(outrom_file); + + struct errorinfo errinf=ApplyPatchMem(patchfile, romname, true, outromname, NULL, cfg.getint("autorom")); + if (errinf.level!=el_ok) ShowMessage(errinf); + if (errinf.level>=el_notthis) goto cleanup; + + gchar * patchend=GetBaseName(patchname); + *patchend='\0'; + + const gchar * argv[3]; + argv[0]=GetEmuFor(romname); + argv[1]=outromname; + argv[2]=NULL; + + GPid pid; + GError* error=NULL; + if (!g_spawn_async(*patchname ? patchname : NULL, (gchar**)argv, NULL, G_SPAWN_DEFAULT, NULL, NULL, &pid, &error)) + { + //g_unlink(tempname);//apparently this one isn't in the headers. + ShowMessage((struct errorinfo){ el_broken, error->message }); + g_error_free(error); + } + else g_spawn_close_pid(pid); + g_free(outromname); + //close(fd); + } + +cleanup: + delete patchfile; + g_free(patchname); + g_free(romname); +} + +static void flatpakDisable(GtkWidget* widget) +{ + if (isFlatpak) + { + gtk_widget_set_sensitive(widget, false); + gtk_widget_set_tooltip_text(widget, "Running in emulators is not available in Flatpak"); + } +} + +static void a_SetEmulator(GtkButton* widget, gpointer user_data); +static void a_ShowSettings(GtkButton* widget, gpointer user_data) +{ + //used mnemonics: + //E - Select Emulator + //M - Create ROM + //U - Run in Emulator + //A - Enable automatic ROM selector + + GtkWidget* settingswindow=gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(settingswindow), flipsversion); + gtk_window_set_resizable(GTK_WINDOW(settingswindow), false); + gtk_window_set_modal(GTK_WINDOW(settingswindow), true); + gtk_window_set_transient_for(GTK_WINDOW(settingswindow), GTK_WINDOW(window)); + g_signal_connect(settingswindow, "destroy", G_CALLBACK(gtk_main_quit), NULL); + + GtkGrid* grid=GTK_GRID(gtk_grid_new()); + gtk_grid_set_row_spacing(grid, 3); + + GtkWidget* button=gtk_button_new_with_mnemonic("Select _Emulator"); + g_signal_connect(button, "clicked", G_CALLBACK(a_SetEmulator), settingswindow); + gtk_grid_attach(grid, button, 0,0, 1,1); + flatpakDisable(button); + + GtkWidget* text=gtk_label_new("When opening through associations:"); + gtk_grid_attach(grid, text, 0,1, 1,1); + + GtkGrid* radioGrid=GTK_GRID(gtk_grid_new()); + gtk_grid_set_column_homogeneous(radioGrid, true); + GtkWidget* emuAssoc; + emuAssoc=gtk_radio_button_new_with_mnemonic(NULL, "Create RO_M"); + gtk_grid_attach(radioGrid, emuAssoc, 0,0, 1,1); + emuAssoc=gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(emuAssoc), "R_un in Emulator"); + gtk_grid_attach(radioGrid, emuAssoc, 1,0, 1,1); + g_object_ref(emuAssoc);//otherwise it, and its value, gets eaten when I close the window, before I can save its value anywhere + flatpakDisable(emuAssoc); + if (cfg.getint("assocemu")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(emuAssoc), true); + gtk_grid_attach(grid, GTK_WIDGET(radioGrid), 0,2, 1,1); + + GtkWidget* autoRom; + autoRom=gtk_check_button_new_with_mnemonic("Enable _automatic ROM selector"); + if (cfg.getint("autorom")) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(autoRom), true); + g_object_ref(autoRom); + gtk_grid_attach(grid, autoRom, 0,3, 1,1); + flatpakDisable(autoRom); + + gtk_container_add(GTK_CONTAINER(settingswindow), GTK_WIDGET(grid)); + + gtk_widget_show_all(settingswindow); + gtk_main(); + + cfg.setint("assocemu", (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(emuAssoc)))); + cfg.setint("autorom", (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(autoRom)))); + g_object_unref(emuAssoc); + g_object_unref(autoRom); +} + +static gboolean filterExecOnly(const GtkFileFilterInfo* filter_info, gpointer data) +{ + GFile* file=g_file_new_for_uri(filter_info->uri); + GFileInfo* info=g_file_query_info(file, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, G_FILE_QUERY_INFO_NONE, NULL, NULL); + bool ret=g_file_info_get_attribute_boolean(info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE); + g_object_unref(file); + g_object_unref(info); + return ret; +} + +static void a_SetEmulatorFor(GtkButton* widget, gpointer user_data) +{ + GtkWidget* dialog=gtk_file_chooser_dialog_new("Select Emulator to Use", GTK_WINDOW(window), GTK_FILE_CHOOSER_ACTION_OPEN, + "_Cancel", GTK_RESPONSE_CANCEL, "_Open", GTK_RESPONSE_ACCEPT, NULL); + gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), true); + + GtkFileFilter* filter=gtk_file_filter_new(); + gtk_file_filter_set_name(filter, "Executable files"); + gtk_file_filter_add_custom(filter, GTK_FILE_FILTER_URI, filterExecOnly, NULL, NULL); + gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); + + const char * emu_path = GetEmuFor((const char*)user_data); + char* emu_uri = emu_path ? g_filename_to_uri(emu_path, NULL, NULL) : NULL; + setoutpath(GTK_FILE_CHOOSER(dialog), emu_uri, false); + g_free(emu_uri); + + if (gtk_dialog_run(GTK_DIALOG(dialog))==GTK_RESPONSE_ACCEPT) + { + SetEmuFor((const char*)user_data, gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog))); + } + + gtk_widget_destroy(dialog); +} + +static void SetEmuActivate(GtkTreeView* tree_view, GtkTreePath* path, GtkTreeViewColumn* column, gpointer user_data) +{ + GtkListStore* list = GTK_LIST_STORE(gtk_tree_view_get_model(tree_view)); + + GtkTreeModel* model = gtk_tree_view_get_model(tree_view); + GtkTreeIter iter; + gtk_tree_model_get_iter(model, &iter, path); + + char* ext; + gtk_tree_model_get(model, &iter, 0,&ext, -1); + char* name = g_strdup_printf(".%s", ext); + + a_SetEmulatorFor(NULL, name); + gtk_list_store_set(list, &iter, 1,GetEmuFor(name), -1); + + g_free(name); + g_free(ext); +} + +static void SetEmuDelete(GtkButton* widget, gpointer user_data) +{ + GtkTreeView* listview = GTK_TREE_VIEW(user_data); + GList* list = gtk_tree_selection_get_selected_rows(gtk_tree_view_get_selection(listview), NULL); + if (!list) return; + + GtkTreeModel* model = gtk_tree_view_get_model(listview); + GtkTreeIter it; + gtk_tree_model_get_iter(model, &it, (GtkTreePath*)list->data); + + char* ext; + gtk_tree_model_get(model, &it, 0,&ext, -1); + char* name = g_strdup_printf("emu.%s", ext); + cfg.set(name, NULL); + g_free(name); + g_free(ext); + + gtk_list_store_remove(GTK_LIST_STORE(model), &it); + g_list_free_full(list, (GDestroyNotify)gtk_tree_path_free); +} + +static void a_SetEmulator(GtkButton* widget, gpointer user_data) +{ + GtkWidget* emuwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(emuwindow), flipsversion); + gtk_window_set_modal(GTK_WINDOW(emuwindow), true); + gtk_window_set_transient_for(GTK_WINDOW(emuwindow), GTK_WINDOW(user_data)); + gtk_window_set_default_size (GTK_WINDOW(emuwindow), 300, 200); + g_signal_connect(emuwindow, "destroy", G_CALLBACK(gtk_main_quit), NULL); + + GtkGrid* grid = GTK_GRID(gtk_grid_new()); + gtk_grid_set_row_spacing(grid, 3); + + GtkListStore* list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); + for (size_t i=0;i=10+1+1+1+1+4+4 && !memcmp(cfgin.ptr, "FlipscfgG", 9) && cfgin.ptr[9]==cfgversion) +// { +// state.lastPatchType=cfgin.ptr[10]; +// state.createFromAllFiles=cfgin.ptr[11]; +// state.openInEmulatorOnAssoc=cfgin.ptr[12]; +// state.autoSelectRom=cfgin.ptr[13]; +// int len=0; +// len|=cfgin.ptr[14]<<24; +// len|=cfgin.ptr[15]<<16; +// len|=cfgin.ptr[16]<<8; +// len|=cfgin.ptr[17]<<0; +// if (len==0) state.emulator=NULL; +// else +// { +// state.emulator=(gchar*)g_malloc(len+1); +// memcpy(state.emulator, cfgin.ptr+22, len); +// state.emulator[len]=0; +// } +// struct mem romlist={cfgin.ptr+22+len, 0}; +// romlist.len|=cfgin.ptr[18]<<24; +// romlist.len|=cfgin.ptr[19]<<16; +// romlist.len|=cfgin.ptr[20]<<8; +// romlist.len|=cfgin.ptr[21]<<0; +// SetRomList(romlist); +// } +// else +// { +// memset(&state, 0, sizeof(state)); +// state.lastPatchType=ty_bps; +// } +// free(cfgin.ptr); +//} + +int GUIShow(const char * filename) +{ + if (!canShowGUI) + { + g_warning("couldn't parse command line arguments, what are you doing?"); + usage(); + } + + //copied a few lines from libgtk, I don't want to call gtk_init if I'm not going to poke the GUI + GdkDisplay* display=gdk_display_open(gdk_get_display_arg_name()); + if (!display) display=gdk_display_get_default(); + if (!display) + { + g_warning("couldn't connect to display, fix it or use command line"); + usage(); + } + gdk_display_manager_set_default_display(gdk_display_manager_get(), display); + + if (filename) + { + window=NULL; + if (cfg.getint("assocemu")==false) a_ApplyPatch(NULL, g_strdup(filename)); + else a_ApplyRun(NULL, g_strdup(filename)); + return 0; + } + + window=gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), flipsversion); + gtk_window_set_resizable(GTK_WINDOW(window), false); + g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); + + GtkGrid* grid=GTK_GRID(gtk_grid_new()); + gtk_grid_set_row_homogeneous(grid, true); + gtk_grid_set_column_homogeneous(grid, true); + gtk_grid_set_row_spacing(grid, 5); + gtk_grid_set_column_spacing(grid, 5); + GtkWidget* button; +#define button(x, y, text, function) \ + button=gtk_button_new_with_mnemonic(text); \ + g_signal_connect(button, "clicked", function, NULL); \ + gtk_grid_attach(grid, button, x, y, 1, 1); + button(0,0, "_Apply Patch", G_CALLBACK(a_ApplyPatch)); + button(1,0, "_Create Patch", G_CALLBACK(a_CreatePatch)); + button(0,1, "Apply and _Run", G_CALLBACK(a_ApplyRun)); + flatpakDisable(button); + button(1,1, "_Settings", G_CALLBACK(a_ShowSettings)); +#undef button + + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(grid)); + + gtk_widget_show_all(window); + gtk_main(); + + //int emulen=state.emulator?strlen(state.emulator):0; + //struct mem romlist=GetRomList(); + //struct mem cfgout=(struct mem){ NULL, 10+1+1+1+1+4+4+emulen+romlist.len }; + //cfgout.ptr=(uint8_t*)g_malloc(cfgout.len); + //memcpy(cfgout.ptr, "FlipscfgG", 9); + //cfgout.ptr[9]=cfgversion; + //cfgout.ptr[10]=state.lastPatchType; + //cfgout.ptr[11]=state.createFromAllFiles; + //cfgout.ptr[12]=state.openInEmulatorOnAssoc; + //cfgout.ptr[13]=state.autoSelectRom; + //cfgout.ptr[14]=emulen>>24; + //cfgout.ptr[15]=emulen>>16; + //cfgout.ptr[16]=emulen>>8; + //cfgout.ptr[17]=emulen>>0; + //cfgout.ptr[18]=romlist.len>>24; + //cfgout.ptr[19]=romlist.len>>16; + //cfgout.ptr[20]=romlist.len>>8; + //cfgout.ptr[21]=romlist.len>>0; + //memcpy(cfgout.ptr+22, state.emulator, emulen); + //memcpy(cfgout.ptr+22+emulen, romlist.ptr, romlist.len); + //filewrite::write(get_cfgpath(), cfgout); + + return 0; +} + +int main(int argc, char * argv[]) +{ + g_set_prgname("com.github.Alcaro.Flips"); + canShowGUI = gtk_parse_args(&argc, &argv); + isFlatpak = (access("/.flatpak-info", F_OK) == 0); + cfg.init_file(g_build_filename(g_get_user_config_dir(), "flipscfg", NULL)); + return flipsmain(argc, argv); +} +#endif diff --git a/tools/Flips/flips-w32.cpp b/tools/Flips/flips-w32.cpp new file mode 100644 index 000000000..771984e86 --- /dev/null +++ b/tools/Flips/flips-w32.cpp @@ -0,0 +1,986 @@ +//Module name: Floating IPS, Windows frontend +//Author: Alcaro +//Date: See Git history +//Licence: GPL v3.0 or higher + +#include "flips.h" + +#ifdef FLIPS_WINDOWS +class file_w32 : public file { + size_t size; + HANDLE io; + +public: + static file* create(LPCWSTR filename) + { + HANDLE io = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (io==INVALID_HANDLE_VALUE) return NULL; + return new file_w32(io, (size_t)0); + } + +private: + file_w32(HANDLE io, uint32_t sizetsize) : io(io) + { + size = GetFileSize(io, NULL); + } + + file_w32(HANDLE io, uint64_t sizetsize) : io(io) + { + GetFileSizeEx(io, (PLARGE_INTEGER)&size); + } + +public: + size_t len() { return size; } + + bool read(uint8_t* target, size_t start, size_t len) + { + OVERLAPPED ov = {0}; + ov.Offset = start; + ov.OffsetHigh = start>>16>>16; + DWORD actuallen; + return (ReadFile(io, target, len, &actuallen, &ov) && len==actuallen); + } + + ~file_w32() { CloseHandle(io); } +}; + +file* file::create(LPCWSTR filename) { return file_w32::create(filename); } +bool file::exists(LPCWSTR filename) { return GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES; } + + +class filewrite_w32 : public filewrite { + HANDLE io; + +public: + static filewrite* create(LPCWSTR filename) + { + HANDLE io = CreateFile(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (!io) return NULL; + return new filewrite_w32(io); + } + +private: + filewrite_w32(HANDLE io) : io(io) {} + +public: + bool append(const uint8_t* data, size_t len) + { + DWORD truelen; + return (WriteFile(io, data, len, &truelen, NULL) && truelen==len); + } + + ~filewrite_w32() { CloseHandle(io); } +}; + +filewrite* filewrite::create(LPCWSTR filename) { return filewrite_w32::create(filename); } + + +//TODO: implement properly +//also ensure input==output works if implementing this, rather than getting a file sharing violation +//applies even when selecting multiple patches, of which one overwrites input +filemap* filemap::create(LPCWSTR filename) { return filemap::create_fallback(filename); } + + +HWND hwndMain=NULL; +HWND hwndSettings=NULL; + +struct { + char signature[9]; + unsigned char cfgversion; + unsigned char lastRomType; + bool openInEmulatorOnAssoc; + bool enableAutoRomSelector; + enum patchtype lastPatchType; + int windowleft; + int windowtop; +} static state; +#define mycfgversion 2 +WCHAR * st_emulator=NULL; +void set_st_emulator_len(LPCWSTR newemu, int len) +{ + free(st_emulator); + st_emulator=(WCHAR*)malloc((len+1)*sizeof(WCHAR)); + if (newemu) memcpy(st_emulator, newemu, len*sizeof(WCHAR)); + st_emulator[len]='\0'; +} +void set_st_emulator(LPCWSTR newemu) +{ + set_st_emulator_len(newemu, wcslen(newemu)); +} + + +HWND hwndProgress; +LRESULT CALLBACK bpsdProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + +bool bpsdCancel; + +void bpsdeltaBegin() +{ + bpsdCancel=false; + RECT mainwndpos; + GetWindowRect(hwndMain, &mainwndpos); + hwndProgress=CreateWindowA( + "floatingmunchers", flipsversion, + WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_BORDER, + mainwndpos.left+53, mainwndpos.top+27, 101, 39, hwndMain, NULL, GetModuleHandle(NULL), NULL); + SetWindowLongPtrA(hwndProgress, GWLP_WNDPROC, (LONG_PTR)bpsdProgressWndProc); + + ShowWindow(hwndProgress, SW_SHOW); + EnableWindow(hwndMain, FALSE); + + bpsdeltaProgress(NULL, 0, 1); +} + +bool bpsdeltaProgress(void* userdata, size_t done, size_t total) +{ + if (!bpsdeltaGetProgress(done, total)) return !bpsdCancel; + if (hwndProgress) InvalidateRect(hwndProgress, NULL, false); + MSG Msg; + while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&Msg); + return !bpsdCancel; +} + +LRESULT CALLBACK bpsdProgressWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + case WM_ERASEBKGND: return TRUE; + case WM_PAINT: + { + PAINTSTRUCT ps; + RECT rc; + BeginPaint(hwnd, &ps); + GetClientRect(hwnd, &rc); + FillRect(ps.hdc, &rc, GetSysColorBrush(COLOR_3DFACE)); + SetBkColor(ps.hdc, GetSysColor(COLOR_3DFACE)); + SelectObject(ps.hdc, (HFONT)GetStockObject(DEFAULT_GUI_FONT)); + DrawTextA(ps.hdc, bpsdProgStr, -1, &rc, DT_CENTER | DT_NOCLIP); + EndPaint(hwnd, &ps); + } + break; + case WM_CLOSE: + bpsdCancel=true; + break; + default: + return DefWindowProcA(hwnd, uMsg, wParam, lParam); + } + return 0; +} + +void bpsdeltaEnd() +{ + EnableWindow(hwndMain, TRUE); + DestroyWindow(hwndProgress); + hwndProgress=NULL; +} + + +bool SelectRom(LPWSTR filename, LPCWSTR title, bool output) +{ + OPENFILENAME ofn; + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize=sizeof(ofn); + ofn.hwndOwner=hwndMain; + ofn.lpstrFilter=TEXT("Most Common ROM Files\0*.smc;*.sfc;*.nes;*.gb;*.gbc;*.gba;*.nds;*.vb;*.sms;*.smd;*.md;*.ngp;*.n64;*.z64\0All Files (*.*)\0*.*\0"); + ofn.lpstrFile=filename; + ofn.nMaxFile=MAX_PATH; + ofn.nFilterIndex=state.lastRomType; + ofn.lpstrTitle=title; + ofn.Flags=OFN_PATHMUSTEXIST|(output?OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT:OFN_FILEMUSTEXIST); + ofn.lpstrDefExt=TEXT("smc"); + if (!output && !GetOpenFileName(&ofn)) return false; + if ( output && !GetSaveFileName(&ofn)) return false; + state.lastRomType=ofn.nFilterIndex; + return true; +} + +UINT mboxtype[]={ MB_OK, MB_OK, MB_OK|MB_ICONWARNING, MB_OK|MB_ICONWARNING, MB_OK|MB_ICONERROR, MB_OK|MB_ICONERROR }; + +LPCWSTR patchextensions[]={ + NULL,//unused, ty_null + TEXT("bps"), + TEXT("ips"), +}; + +static struct errorinfo error(errorlevel level, const char * text) +{ + struct errorinfo errinf = { level, text }; + return errinf; +} + +int a_ApplyPatch(LPCWSTR clipatchname) +{ + WCHAR patchnames[65536]; + patchnames[0]='\0'; + bool multiplePatches; + if (clipatchname) + { + multiplePatches=false; + wcscpy(patchnames, clipatchname); + } + else + { + //get patch names + OPENFILENAME ofn; + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize=sizeof(ofn); + ofn.hwndOwner=hwndMain; + ofn.lpstrFilter=TEXT("All supported patches (*.ips, *.bps)\0*.ips;*.bps;*.ups\0All files (*.*)\0*.*\0"); + ofn.lpstrFile=patchnames; + ofn.nMaxFile=65535; + ofn.lpstrTitle=TEXT("Select Patches to Use"); + ofn.Flags=OFN_HIDEREADONLY|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_ALLOWMULTISELECT|OFN_EXPLORER; + ofn.lpstrDefExt=patchextensions[state.lastPatchType]; + if (!GetOpenFileName(&ofn)) return 0; + multiplePatches=(ofn.nFileOffset && patchnames[ofn.nFileOffset-1]=='\0'); + } + + //get rom name and apply + + if (!multiplePatches) + { + file* patch = file::create(patchnames); + if (patch) + { + + WCHAR inromname_buf[MAX_PATH]; + LPCWSTR inromname=NULL; + if (state.enableAutoRomSelector) inromname=FindRomForPatch(patch, NULL); + if (!inromname) + { + inromname=inromname_buf; + inromname_buf[0]='\0'; + if (!SelectRom(inromname_buf, TEXT("Select File to Patch"), false)) goto cancel; + } + WCHAR outromname[MAX_PATH]; + wcscpy(outromname, inromname); + LPWSTR outrompath=GetBaseName(outromname); + LPWSTR patchpath=GetBaseName(patchnames); + if (outrompath && patchpath) + { + wcscpy(outrompath, patchpath); + LPWSTR outromext=GetExtension(outrompath); + LPWSTR inromext=GetExtension(inromname); + if (*inromext && *outromext) wcscpy(outromext, inromext); + } + if (!SelectRom(outromname, TEXT("Select Output File"), true)) goto cancel; + struct errorinfo errinf=ApplyPatchMem(patch, inromname, true, outromname, NULL, state.enableAutoRomSelector); + delete patch; + MessageBoxA(hwndMain, errinf.description, flipsversion, mboxtype[errinf.level]); + return errinf.level; + } + cancel: + delete patch; + return 0; + } + else + { +#define max(a, b) (a > b ? a : b) + if (state.enableAutoRomSelector) + { + LPCWSTR foundRom=NULL; + bool canUseFoundRom=true; + bool usingFoundRom=false; + + redo: ; + WCHAR thisFileNameWithPath[MAX_PATH]; + bool anySuccess=false; + enum { e_none, e_notice, e_warning, e_invalid, e_io_rom_write, e_io_rom_read, e_no_auto, e_io_read_patch } worsterror=e_none; + LPCSTR messages[8]={ + "The patches were applied successfully!",//e_none + "The patches were applied successfully!",//e_notice (ignore) + "The patches were applied, but one or more may be mangled or improperly created...",//e_warning + "Some patches were applied, but not all of the given patches are valid...",//e_invalid + "Some patches were applied, but not all of the desired ROMs could be created...",//e_rom_io_write + "Some patches were applied, but not all of the input ROMs could be read...",//e_io_rom_read + "Some patches were applied, but not all of the required input ROMs could be located...",//e_no_auto + "Some patches were applied, but not all of the given patches could be read...",//e_io_read_patch + }; + + wcscpy(thisFileNameWithPath, patchnames); + LPWSTR thisFileName=wcschr(thisFileNameWithPath, '\0'); + *thisFileName='\\'; + thisFileName++; + + LPWSTR thisPatchName=wcschr(patchnames, '\0')+1; + while (*thisPatchName) + { + wcscpy(thisFileName, thisPatchName); + file* patch = file::create(thisFileNameWithPath); + { + if (!patch) + { + worsterror=max(worsterror, e_io_read_patch); + canUseFoundRom=false; + goto multi_auto_next; + } + bool possible; + LPCWSTR romname=FindRomForPatch(patch, &possible); + if (usingFoundRom) + { + if (!romname) romname=foundRom; + else goto multi_auto_next; + } + else + { + if (!romname) + { + if (possible) canUseFoundRom=false; + worsterror=max(worsterror, e_no_auto); + goto multi_auto_next; + } + } + if (!foundRom) foundRom=romname; + if (foundRom!=romname) canUseFoundRom=false; + + wcscpy(GetExtension(thisFileName), GetExtension(romname)); + struct errorinfo errinf=ApplyPatchMem(patch, romname, true, thisFileNameWithPath, NULL, true); + + if (errinf.level==el_broken) worsterror=max(worsterror, e_invalid); + if (errinf.level==el_notthis) worsterror=max(worsterror, e_no_auto); + if (errinf.level==el_warning) worsterror=max(worsterror, e_warning); + if (errinf.levelget(); + bool anySuccess=false; + enum { e_none, e_notice, e_warning, e_invalid_this, e_invalid, e_io_write, e_io_read, e_io_read_rom } worsterror=e_none; + enum errorlevel severity[2][8]={ + { el_ok, el_ok, el_warning,el_broken, el_broken, el_broken, el_broken, el_broken }, + { el_ok, el_ok, el_warning,el_warning, el_warning, el_warning,el_warning,el_broken }, + }; + LPCSTR messages[2][8]={ + { + //no error-free + NULL,//e_none + NULL,//e_notice + NULL,//e_warning + "None of these are valid patches for this ROM!",//e_invalid_this + "None of these are valid patches!",//e_invalid + "Couldn't write any ROMs. Are you on a read-only medium?",//e_io_write + "Couldn't read any patches. What exactly are you doing?",//e_io_read + "Couldn't read the input ROM. What exactly are you doing?",//e_io_read_rom + },{ + //at least one error-free + "The patches were applied successfully!",//e_none + "The patches were applied successfully!",//e_notice + "The patches were applied, but one or more may be mangled or improperly created...",//e_warning + "Some patches were applied, but not all of the given patches are valid for this ROM...",//e_invalid_this + "Some patches were applied, but not all of the given patches are valid...",//e_invalid + "Some patches were applied, but not all of the desired ROMs could be created...",//e_io_write + "Some patches were applied, but not all of the given patches could be read...",//e_io_read + NULL,//e_io_read_rom + }, + }; + if (inrom.ptr) + { + bool removeheaders=shouldRemoveHeader(inromname, inrom.len); + while (*thisPatchName) + { + wcscpy(thisFileName, thisPatchName); + file* patch = file::create(thisFileNameWithPath); + if (patch) + { + LPWSTR patchExtension=GetExtension(thisFileName); + wcscpy(patchExtension, romExtension); + struct errorinfo errinf=ApplyPatchMem2(patch, inrom, removeheaders, true, thisFileNameWithPath, NULL); + + if (errinf.level==el_broken) worsterror=max(worsterror, e_invalid); + if (errinf.level==el_notthis) worsterror=max(worsterror, e_invalid_this); + if (errinf.level==el_warning) worsterror=max(worsterror, e_warning); + if (errinf.level=el_notthis) return el_broken; + + delete patch; + if (rommem.ptr) FreeFileMemory(rommem); + if (patchedmem.ptr) free(patchedmem.ptr); + + WCHAR cmdline[1+MAX_PATH+3+MAX_PATH+1+1]; + swprintf(cmdline, 1+MAX_PATH+3+MAX_PATH+1+1, TEXT("\"%ls\" \"%ls\""), st_emulator, outfilename); + WCHAR * dirend=GetBaseName(patchpath); + if (dirend) *dirend='\0'; + STARTUPINFO startupinfo; + ZeroMemory(&startupinfo, sizeof(STARTUPINFO)); + PROCESS_INFORMATION processinformation; + if (!CreateProcess(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, patchpath, &startupinfo, &processinformation)) + { + MessageBoxA(hwndMain, "Couldn't open emulator.", flipsversion, mboxtype[el_broken]); + //DeleteFile(tempfilename); + return el_broken; + } + + //I don't clean up the temp file when the emulator is done. + //- It would just force me to keep track of a bunch of state. + //- It'd force me to not exit when the window is closed. + //- The bsnes profile selector would confuse it. + //- The emulator may have created a bunch of other files, for example SRAM. + //Few other apps clean up anyways. + CloseHandle(processinformation.hProcess); + CloseHandle(processinformation.hThread); + return errinf.level; +} + +void a_AssignFileTypes(bool checkonly); + +HWND assocText; +HWND assocButton; +void a_ShowSettings() +{ + if (hwndSettings) + { + SetActiveWindow(hwndSettings); + return; + } + + hwndSettings=CreateWindowA( + "floatingmunchers", flipsversion, + WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_BORDER|WS_MINIMIZEBOX, + CW_USEDEFAULT, CW_USEDEFAULT, 3+6+202+6+3, 21 + 6+23+6+23+3+13+1+17+4+17+6 + 3, NULL, NULL, GetModuleHandle(NULL), NULL); + + HFONT hfont=(HFONT)GetStockObject(DEFAULT_GUI_FONT); + HWND item; + + int x=6; + int y=6; + int lineheight; + +#define endline(padding) do { x=6; y+=lineheight+padding; } while(0) +#define line(height) lineheight=height + +#define widget(type, style, text, w, h, action) \ + do { \ + int thisy=y+(lineheight-h)/2; \ + item=CreateWindowA(type, text, WS_CHILD|WS_TABSTOP|WS_VISIBLE|style, \ + x, thisy, w, h, hwndSettings, (HMENU)(action), GetModuleHandle(NULL), NULL); \ + SendMessage(item, WM_SETFONT, (WPARAM)hfont, 0); \ + x+=w+6; \ + } while(0) + +#define firstbutton(text, w, h, action) \ + widget(WC_BUTTONA, WS_GROUP|BS_DEFPUSHBUTTON, text, w, h, action) + +#define button(text, w, h, action) \ + widget(WC_BUTTONA, BS_PUSHBUTTON, text, w, h, action) + +#define labelL(text, w, h, action) \ + widget(WC_STATICA, SS_LEFT, text, w, h, action) +#define labelC(text, w, h, action) \ + widget(WC_STATICA, SS_CENTER, text, w, h, action) + +#define radio(text, w, h, action) \ + widget(WC_BUTTONA, BS_AUTORADIOBUTTON, text, w, h, action) +#define check(text, w, h, action) \ + widget(WC_BUTTONA, BS_AUTOCHECKBOX, text, w, h, action) + + line(23); + firstbutton("Select emulator", 202/*94*/, 23, 101); + endline(6); + + line(23); + button("Assign file types", 98, 23, 102); assocButton=item; + labelL("(can not be undone)", 98, 13, 0); assocText=item; + endline(3); + + line(13); + labelC("When opening through associations:", 175, 13, 0); + endline(1); + line(17); + radio("Create ROM", 79, 17, 103); Button_SetCheck(item, (state.openInEmulatorOnAssoc==false)); + radio("Run in emulator", 95, 17, 104); Button_SetCheck(item, (state.openInEmulatorOnAssoc==true)); + endline(4); + + line(17); + check("Enable automatic ROM selector", 202, 17, 105); Button_SetCheck(item, (state.enableAutoRomSelector)); + endline(3); + + ShowWindow(hwndSettings, SW_SHOW); +#undef firstbutton +#undef button +#undef label +#undef radio + //if (!fileTypesAssigned) button(6,68,200,23, "Assign File Types"); +} + +void key_core(bool checkonly, LPCWSTR path, LPCWSTR value, bool * p_hasExts, bool * p_refresh) +{ + HKEY hkey; + DWORD type; + WCHAR truepath[60]; + wcscpy(truepath, TEXT("Software\\Classes\\")); + wcscat(truepath, path); + WCHAR regval[MAX_PATH+30]; + DWORD regvallen; + bool hasExts=true; + if (checkonly) + { + regvallen=sizeof(regval); + if (RegOpenKeyEx(HKEY_CURRENT_USER, truepath, 0, KEY_READ, &hkey)!=ERROR_SUCCESS) goto add; + if (value && RegQueryValueEx(hkey, NULL, NULL, &type, (LPBYTE)regval, ®vallen)!=ERROR_SUCCESS) hasExts=false; + RegCloseKey(hkey); + if (!hasExts) goto add; + if (value && wcsncmp(regval, value, sizeof(regval)/sizeof(*regval))) *p_hasExts=false; + return; + } + else + { + add: + regvallen=sizeof(regval); + if (RegCreateKeyExW(HKEY_CURRENT_USER, truepath, 0, NULL, 0, KEY_WRITE, NULL, &hkey, NULL)==ERROR_SUCCESS) + { + if (value) RegSetValueExW(hkey, NULL, 0, REG_SZ, (BYTE*)value, (wcslen(value)+1)*sizeof(WCHAR)); + RegCloseKey(hkey); + } + if (path[0]=='.') *p_refresh=true; + return; + } +} + +void a_AssignFileTypes(bool checkonly) +{ + WCHAR outstring[MAX_PATH+30]; + outstring[0]='"'; + GetModuleFileNameW(NULL, outstring+1, MAX_PATH); + LPWSTR outstringend=wcschr(outstring, '\0'); + *outstringend='"'; + outstringend++; + + bool hasExts=true; + bool refresh=false; +#define key(path, value) \ + key_core(checkonly, TEXT(path), TEXT(value), &hasExts, &refresh) +#define key_path(path, value) \ + wcscpy(outstringend, TEXT(value)); key_core(checkonly, TEXT(path), outstring, &hasExts, &refresh) +#define key_touch(path) \ + key_core(checkonly, TEXT(path), NULL, &hasExts, &refresh) + + key(".ips", "FloatingIPSFileIPS"); + key("FloatingIPSFileIPS", "Floating IPS File"); + key_path("FloatingIPSFileIPS\\DefaultIcon", ",1"); + key_touch("FloatingIPSFileIPS\\shell"); + key_touch("FloatingIPSFileIPS\\shell\\open"); + key_path("FloatingIPSFileIPS\\shell\\open\\command", " \"%1\""); + + key(".bps", "FloatingIPSFileBPS"); + key("FloatingIPSFileBPS", "Floating IPS File"); + key_path("FloatingIPSFileBPS\\DefaultIcon", ",2"); + key_touch("FloatingIPSFileBPS\\shell"); + key_touch("FloatingIPSFileBPS\\shell\\open"); + key_path("FloatingIPSFileBPS\\shell\\open\\command", " \"%1\""); + + if (refresh) + { + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); + + if (hwndMain) + { + RECT wndpos; + GetWindowRect(hwndMain, &wndpos); + MoveWindow(hwndMain, wndpos.left, wndpos.top, 218, 93, true); + } + } + if (!checkonly || hasExts) + { + SetWindowText(assocText, TEXT("(already done)")); + Button_Enable(assocButton, false); + } +} + +LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + case WM_COMMAND: + { + if (wParam==1) a_ApplyPatch(NULL); + if (wParam==2) a_CreatePatch(); + if (wParam==3) a_ApplyRun(NULL); + if (wParam==4) a_ShowSettings(); + + if (wParam==101) a_SetEmulator(); + if (wParam==102) a_AssignFileTypes(false); + if (wParam==103) state.openInEmulatorOnAssoc=false; + if (wParam==104) state.openInEmulatorOnAssoc=true; + if (wParam==105) state.enableAutoRomSelector^=1; + } + break; + case WM_CLOSE: + { + if (hwnd==hwndMain && !IsIconic(hwnd)) + { + RECT wndpos; + GetWindowRect(hwnd, &wndpos); + state.windowleft=wndpos.left; + state.windowtop=wndpos.top; + } + DestroyWindow(hwnd); + } + break; + case WM_DESTROY: + { + if (hwnd==hwndMain) PostQuitMessage(0); + if (hwnd==hwndSettings) hwndSettings=NULL; + break; + } + default: + return DefWindowProcA(hwnd, uMsg, wParam, lParam); + } + return 0; +} + +static HFONT try_create_font(const char * name, int size) +{ + return CreateFontA(-size*96/72, 0, 0, 0, FW_NORMAL, + FALSE, FALSE, FALSE, DEFAULT_CHARSET, + OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, + name); +} + +int ShowMainWindow(HINSTANCE hInstance, int nCmdShow) +{ + WNDCLASSA wc; + wc.style=0; + wc.lpfnWndProc=WindowProc; + wc.cbClsExtra=0; + wc.cbWndExtra=0; + wc.hInstance=GetModuleHandle(NULL); + wc.hIcon=LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(0)); + wc.hCursor=LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground=GetSysColorBrush(COLOR_3DFACE);//(HBRUSH)(COLOR_WINDOW + 1); + wc.lpszMenuName=NULL; + wc.lpszClassName="floatingmunchers"; + RegisterClassA(&wc); + + MSG msg; + hwndMain=CreateWindowA( + "floatingmunchers", flipsversion, + WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_BORDER|WS_MINIMIZEBOX, + state.windowleft, state.windowtop, 204, 93, NULL, NULL, GetModuleHandle(NULL), NULL); + + HFONT hfont=try_create_font("Segoe UI", 9); + if (!hfont) hfont=try_create_font("MS Shell Dlg 2", 8); + if (!hfont) hfont=(HFONT)GetStockObject(DEFAULT_GUI_FONT); + + int buttonid=0; + HWND lastbutton; +#define button(x,y,w,h, text) \ + do { \ + lastbutton=CreateWindowA("BUTTON", text, WS_CHILD|WS_TABSTOP|WS_VISIBLE|(buttonid==0?(BS_DEFPUSHBUTTON|WS_GROUP):(BS_PUSHBUTTON)), \ + x, y, w, h, hwndMain, (HMENU)(uintptr_t)(buttonid+1), GetModuleHandle(NULL), NULL); \ + SendMessage(lastbutton, WM_SETFONT, (WPARAM)hfont, 0); \ + buttonid++; \ + } while(0) + button(6, 6, 90/*77*/,23, "Apply Patch"); SetActiveWindow(lastbutton); + button(104,6, 90/*83*/,23, "Create Patch"); + button(6, 37, 90/*90*/,23, "Apply and Run"); + button(104,37, 90/*59*/,23, "Settings"); + + ShowWindow(hwndMain, nCmdShow); + + a_AssignFileTypes(true); + + while (GetMessageA(&msg, NULL, 0, 0)>0) + { + if (!IsDialogMessageA(hwndMain, &msg)) + { + TranslateMessage(&msg); + DispatchMessageA(&msg); + } + } + + return msg.wParam; +} + +void GUIClaimConsole() +{ + //this one makes it act like a console app in all cases except it doesn't create a new console if + // not launched from one (it'd swiftly go away on app exit anyways), and it doesn't like being + // launched from cmd since cmd wants to run a new command if spawning a gui app (I can't make it + // not be a gui app because that flashes a console; it acts sanely from batch files) + + bool claimstdin=(GetFileType(GetStdHandle(STD_INPUT_HANDLE))==FILE_TYPE_UNKNOWN); + bool claimstdout=(GetFileType(GetStdHandle(STD_OUTPUT_HANDLE))==FILE_TYPE_UNKNOWN); + bool claimstderr=(GetFileType(GetStdHandle(STD_ERROR_HANDLE))==FILE_TYPE_UNKNOWN); + + if (claimstdin || claimstdout || claimstderr) AttachConsole(ATTACH_PARENT_PROCESS); + + if (claimstdin) freopen("CONIN$", "rt", stdin); + if (claimstdout) freopen("CONOUT$", "wt", stdout); + if (claimstderr) freopen("CONOUT$", "wt", stderr); + + if (claimstdout) fputc('\r', stdout); + if (claimstderr) fputc('\r', stderr); +} + +HINSTANCE hInstance_; +int nCmdShow_; + +WCHAR * get_cfgpath() +{ + static WCHAR cfgfname[MAX_PATH+8]; + GetModuleFileNameW(NULL, cfgfname, MAX_PATH); + WCHAR * ext=GetExtension(cfgfname); + if (ext) *ext='\0'; + wcscat(cfgfname, TEXT("cfg.bin")); + return cfgfname; +} + +void GUILoadConfig() +{ + memset(&state, 0, sizeof(state)); + struct mem configbin=ReadWholeFile(get_cfgpath()); + void* configbin_org=configbin.ptr; + if (configbin.len >= sizeof(state)) + { +#define readconfig(target, size) \ + if (size<0 || configbin.len < size) goto badconfig; \ + memcpy(target, configbin.ptr, size); \ + configbin.ptr += size; \ + configbin.len -= size + + readconfig(&state, sizeof(state)); + if (memcmp(state.signature, "FlipscfgW", sizeof(state.signature))!=0 || state.cfgversion!=mycfgversion) goto badconfig; + int emulen; + readconfig(&emulen, sizeof(emulen)); + set_st_emulator_len(NULL, emulen); + readconfig(st_emulator, (unsigned)emulen*sizeof(WCHAR)); + SetRomList(configbin); + } + else + { + badconfig: + memcpy(state.signature, "FlipscfgW", sizeof(state.signature)); + state.cfgversion=mycfgversion; + state.lastRomType=0; + state.openInEmulatorOnAssoc=false; + state.enableAutoRomSelector=false; + state.lastPatchType=ty_bps; + state.windowleft=CW_USEDEFAULT; + state.windowtop=CW_USEDEFAULT; + set_st_emulator(TEXT("")); + } + free(configbin_org); +} + +int GUIShow(LPCWSTR filename) +{ + GUILoadConfig(); + + INITCOMMONCONTROLSEX initctrls; + initctrls.dwSize=sizeof(initctrls); + initctrls.dwICC=ICC_STANDARD_CLASSES; + InitCommonControlsEx(&initctrls); + + int ret; + if (filename) + { + if (state.openInEmulatorOnAssoc==false) ret=a_ApplyPatch(filename); + else ret=a_ApplyRun(filename); + } + else ret=ShowMainWindow(hInstance_, nCmdShow_); + + HANDLE file=CreateFile(get_cfgpath(), GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL); + if (file!=INVALID_HANDLE_VALUE) + { + DWORD whocares; + WriteFile(file, &state, sizeof(state), &whocares, NULL); + int len=wcslen(st_emulator); + WriteFile(file, &len, sizeof(len), &whocares, NULL); + WriteFile(file, st_emulator, sizeof(WCHAR)*wcslen(st_emulator), &whocares, NULL); + struct mem romlist=GetRomList(); + WriteFile(file, romlist.ptr, romlist.len, &whocares, NULL); + CloseHandle(file); + } + + return ret; +} + +int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + hInstance_=hInstance; + nCmdShow_=nCmdShow; + int argc; + wchar_t ** argv=CommandLineToArgvW(GetCommandLineW(), &argc); + return flipsmain(argc, argv); +} +#endif diff --git a/tools/Flips/flips.Manifest b/tools/Flips/flips.Manifest new file mode 100644 index 000000000..44c44506a --- /dev/null +++ b/tools/Flips/flips.Manifest @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tools/Flips/flips.cpp b/tools/Flips/flips.cpp new file mode 100644 index 000000000..7a3142067 --- /dev/null +++ b/tools/Flips/flips.cpp @@ -0,0 +1,1444 @@ +//Module name: Floating IPS, shared core for all frontends +//Author: Alcaro +//Date: See Git history +//Licence: GPL v3.0 or higher + +#include "flips.h" +#include "crc32.h" + +#ifdef __MINGW32__ +//get rid of dependencies on libstdc++, they waste 200KB on this platform +void* operator new(size_t n) { return malloc(n); } // forget allocation failures, let them segfault. +void operator delete(void * p) { free(p); } +void operator delete(void * p, size_t n) { free(p); } +extern "C" void __cxa_pure_virtual() { abort(); } + +#if __GNUC__ && (__cpp_rtti || __cpp_exceptions) +#warning "Consider building with -fno-exceptions -fno-rtti, to avoid dependencies on libgcc_s_sjlj-1.dll and libstdc++-6.dll." +#endif +#endif + +//TODO: source ROM chooser +//given a target, from all known source ROMs with same extension, find the most similar +// read 1MB from each; check how many bytes are same and same location as target +// (only counting offsets where both source and target bytes are different from previous, to avoid false positives on long runs of 00) +// if one is >80% same (not counting repeated runs), and all others are <20%, use that +//if no match, multiple matches, or one or more half-matches: +// read first 64K from each of the listed sources, create BPS, and see if one is <20% of size of bps with blank source, while others are >70% +//if still nothing unambiguous: +// fail +//this goes on a separate thread + +//TODO: more manual GUI +// has three text fields, for patch / source / target, and 'pick' buttons nearby that open file dialogs +// also Create / Apply / ApplyRun buttons at the bottom +//auto selection (only if target field is blank): +// patch -> source (crc32 database) +// target -> source (algorithm above) +// target -> patch (set extension to bps) +// (source&patch) -> target (source extension, name/path from patch; also happens if triggering patch->source) +//all text fields are scrolled to the end on creation +//no auto selection in simple UI +//applying or creating clears patch/target, but keeps source +//ips creation is allowed, but only by changing filetype in picker, or editing text field; it does not keep last used type +// ips application remains unchanged +// multi-patching is allowed, each filename is wrapped in <>; if filename doesn't start or end with right char, it's a single name +// colon-separated or semicolon-separated are more common, but they're plausible (uncommon, but possible) in filenames +// (Super Mario World 2: Yoshi's Island, or Marios;Gate, for example), and I don't want to fail on that +// multi-creation is not allowed; technically feasible, but super rare, should probably be CLI instead +// if first file isn't found, it tries using the entire field as filename, in case it actually contains semicolon + + +//TODO: delete +struct mem ReadWholeFile(LPCWSTR filename) +{ + return file::read(filename); +} + +bool WriteWholeFile(LPCWSTR filename, struct mem data) +{ + return filewrite::write(filename, data); +} + +bool WriteWholeFileWithHeader(LPCWSTR filename, struct mem header, struct mem data) +{ + filewrite* f = filewrite::create(filename); + if (!f) return false; + bool ret = (f->append(header.ptr, 512) && f->append(data.ptr, data.len)); // do not use header.len, that'd prepend the entire file + delete f; + return ret; +} + +void FreeFileMemory(struct mem mem) +{ + free(mem.ptr); +} + + + + + +class file_libc : public file { + size_t size; + FILE* io; + +public: + static file* create(const char * filename) + { + FILE* f = fopen(filename, "rb"); + if (!f) return NULL; + return new file_libc(f); + } + +private: + file_libc(FILE* io) : io(io) + { + fseek(io, 0, SEEK_END); + size = ftell(io); + } + +public: + size_t len() { return size; } + + bool read(uint8_t* target, size_t start, size_t len) + { + fseek(io, start, SEEK_SET); + return (fread(target, 1,len, io) == len); + } + + ~file_libc() { fclose(io); } +}; +file* file::create_libc(const char * filename) { return file_libc::create(filename); } +bool file::exists_libc(const char * filename) +{ + FILE* f = fopen(filename, "rb"); + if (f) fclose(f); + return (bool)f; +} + + +class filewrite_libc : public filewrite { + FILE* io; + +public: + static filewrite* create(const char * filename) + { + FILE* f = fopen(filename, "wb"); + if (!f) return NULL; + return new filewrite_libc(f); + } + +private: + filewrite_libc(FILE* io) : io(io) {} + +public: + bool append(const uint8_t* data, size_t len) + { + return (fwrite(data, 1,len, io)==len); + } + + ~filewrite_libc() { fclose(io); } +}; + +filewrite* filewrite::create_libc(const char * filename) { return filewrite_libc::create(filename); } + + +class filemap_fallback : public filemap { +public: + size_t m_len; + uint8_t* m_ptr; + + static filemap* create(file* f) + { + if (!f) return NULL; + + size_t len = f->len(); + uint8_t* ptr = (uint8_t*)malloc(len); + if (!ptr) return NULL; + if (!f->read(ptr, 0, len)) { free(ptr); return NULL; } + return new filemap_fallback(f, len, ptr); + } + + size_t len() { return m_len; } + const uint8_t * ptr() { return m_ptr; } + + //delete the file early, to avoid file sharing issues on Windows (and because keeping it is useless) + // https://github.com/Alcaro/Flips/pull/14 + filemap_fallback(file* f, size_t len, uint8_t* ptr) : m_len(len), m_ptr(ptr) { delete f; } + ~filemap_fallback() { free(m_ptr); } +}; +filemap* filemap::create_fallback(LPCWSTR filename) +{ + return filemap_fallback::create(file::create(filename)); +} + + + + + +LPWSTR GetExtension(LPCWSTR fname) +{ + LPWSTR ptr1=(LPWSTR)fname; + LPWSTR ptr2; + ptr2=wcsrchr(ptr1, '/'); if (ptr2) ptr1=ptr2; +#ifdef FLIPS_WINDOWS + ptr2=wcsrchr(ptr1, '\\'); if (ptr2) ptr1=ptr2; +#endif + ptr2=wcsrchr(ptr1, '.'); if (ptr2) ptr1=ptr2; + if (*ptr1=='.') return ptr1; + else return wcsrchr(ptr1, '\0'); +} + +LPWSTR GetBaseName(LPCWSTR fname) +{ + LPWSTR ptr1=(LPWSTR)fname; + LPWSTR ptr2; + ptr2=wcsrchr(ptr1, '/'); if (ptr2) ptr1=ptr2+1; +#ifdef FLIPS_WINDOWS + ptr2=wcsrchr(ptr1, '\\'); if (ptr2) ptr1=ptr2+1; +#endif + return ptr1; +} + +bool forceKeepHeader=false; + +#ifndef FLIPS_CLI +bool guiActive=false; +#endif + + +struct mem file::read() +{ + struct mem out; + out.len = len(); + out.ptr = (uint8_t*)malloc(out.len + sizeof(WCHAR)); + memset(out.ptr + out.len, 0, sizeof(WCHAR)); + if (!read(out.ptr, 0, out.len)) + { + free(out.ptr); + struct mem err = {NULL, 0}; + return err; + } + return out; +} + +struct mem file::read(LPCWSTR filename) +{ + struct mem err = {NULL, 0}; + file* f = file::create(filename); + if (!f) return err; + struct mem ret = f->read(); + delete f; + return ret; +} + +bool filewrite::write(LPCWSTR filename, struct mem data) +{ + filewrite* f = filewrite::create(filename); + if (!f) return false; + bool ret = f->append(data.ptr, data.len); + delete f; + return ret; +} + + +class fileheader : public file { + file* child; + +public: + fileheader(file* child) : child(child) {} + + size_t len() { return child->len()-512; } + bool read(uint8_t* target, size_t start, size_t len) { return child->read(target, start+512, len); } + + ~fileheader() { delete child; } +}; + +class fileheadermap : public filemap { + filemap* child; + +public: + fileheadermap(filemap* child) : child(child) {} + + size_t len() { return child->len()-512; } + //bool read(uint8_t* target, size_t start, size_t len) { return child->read(target, start+512, len); } + const uint8_t* ptr() { return child->ptr()+512; } + + ~fileheadermap() { delete child; } +}; + + + + +const struct errorinfo ipserrors[]={ + { el_ok, NULL },//ips_ok + { el_unlikelythis, "The patch was applied, but is most likely not intended for this ROM." },//ips_notthis + { el_unlikelythis, "The patch was applied, but did nothing. You most likely already had the output file of this patch." },//ips_thisout + { el_warning, "The patch was applied, but appears scrambled or malformed." },//ips_suspicious + { el_broken, "The patch is broken and can't be used." },//ips_invalid + + { el_broken, "The IPS format does not support files larger than 16MB." },//ips_16MB + { el_warning, "The files are identical! The patch will do nothing." },//ips_identical + }; + +const struct errorinfo bpserrors[]={ + { el_ok, NULL },//bps_ok, + { el_notthis, "That's the output file already." },//bps_to_output + { el_notthis, "This patch is not intended for this ROM." },//bps_not_this + { el_broken, "This patch is broken and can't be used." },//bps_broken + { el_broken, "Couldn't read input patch." },//bps_io + + { el_warning, "The files are identical! The patch will do nothing." },//bps_identical + { el_broken, "These files are too big for this program to handle." },//bps_too_big + { el_broken, "These files are too big for this program to handle." },//bps_out_of_mem (same message as above, it's accurate for both.) + { el_broken, "Patch creation was canceled." },//bps_canceled + }; + +LPCWSTR GetManifestName(LPCWSTR romname) +{ + //static WCHAR manifestname[MAX_PATH]; + //wcscpy(manifestname, romname); + //LPWSTR manifestext=GetExtension(manifestname); + //if (!manifestext) manifestext=wcschr(manifestname, '\0'); + //wcscpy(manifestext, TEXT(".xml")); + //return manifestname; + + static WCHAR * manifestname=NULL; + if (manifestname) free(manifestname); + manifestname=(WCHAR*)malloc((wcslen(romname)+1+4)*sizeof(WCHAR)); + wcscpy(manifestname, romname); + LPWSTR manifestext=GetExtension(manifestname); + if (manifestext) wcscpy(manifestext, TEXT(".xml")); + return manifestname; +} + +enum patchtype IdentifyPatch(file* patch) +{ + size_t len = patch->len(); + uint8_t data[16]; + if (len>16) len=16; + + patch->read(data, 0, len); + if (len>=5 && !memcmp(data, "PATCH", 5)) return ty_ips; + if (len>=4 && !memcmp(data, "BPS1", 4)) return ty_bps; + if (len>=4 && !memcmp(data, "UPS1", 4)) return ty_ups; + return ty_null; +} + + + + + +//this is the most inefficient possible implementation, but since it only needs about 10 entries, +//performance is irrelevant +void config::init_raw(LPWSTR contents) +{ + LPCWSTR header = TEXT("[Flips]\n"); + + if (wcsncmp(contents, header, wcslen(header)) != 0) return; + contents += wcslen(header); + + //I need to somehow ensure that stepping backwards across whitespace doesn't go before the original string. + //This can be done with while (iswspace(*contents)) contents++;, but demanding the header above works just as well. + + while (true) + { + LPWSTR key; + LPWSTR keyend; + LPWSTR val; + LPWSTR valend; + + LPWSTR nextline = wcschr(contents, '\n'); + + if (nextline != NULL) valend = nextline; + else valend = wcschr(contents, '\0'); + //do not move inside the conditional, it screws up the strchr + while (iswspace(valend[-1])) valend--; + *valend = '\0'; + + LPWSTR sep = wcschr(contents, '='); + if (sep != NULL) + { + key = contents; + keyend = sep; + val = sep+1; + + while (iswspace(key[0])) key++; + while (iswspace(keyend[-1])) keyend--; + *keyend = '\0'; + while (iswspace(val[0])) val++; + + if (valend>val && keyend>key && iswalnum(key[0])) + { + set(key, val); + } + } + + if (!nextline) break; + contents = nextline+1; + while (contents && iswspace(*contents)) contents++; + } + + for (size_t i=0;i 0 && data.len%sizeof(WCHAR) == 0) + { + this->init_raw((LPWSTR)(data.ptr)); + } + free(data.ptr); + + this->filename = wcsdup(filename); +} + +void config::sort() +{ + //bubble sort, and called for every insertion... super fun + //but it's easy, it works, and it's fast for numentries=10 and there's no reason to go much higher than that + for (size_t i=0;i 0) + { + LPWSTR tmp = names[i]; + names[i] = names[j]; + names[j] = tmp; + + tmp = values[i]; + values[i] = values[j]; + values[j] = tmp; + } + } +} + +void config::set(LPCWSTR name, LPCWSTR value) +{ + for (size_t i=0;inumentries;i++) + { + if (!wcscmp(name, this->names[i])) + { + if (value == this->values[i]) + return; + free(this->values[i]); + if (value!=NULL) + { + this->values[i] = wcsdup(value); + } + else + { + free(this->names[i]); + + this->names[i] = this->names[this->numentries-1]; + this->values[i] = this->values[this->numentries-1]; + this->numentries--; + } + return; + } + } + + this->numentries++; + this->names = (LPWSTR*)realloc(this->names, sizeof(LPWSTR)*this->numentries); + this->values = (LPWSTR*)realloc(this->values, sizeof(LPWSTR)*this->numentries); + + this->names[this->numentries-1] = wcsdup(name); + this->values[this->numentries-1] = wcsdup(value); + + sort(); +} + +LPCWSTR config::get(LPCWSTR name, LPCWSTR def) +{ + for (size_t i=0;inumentries;i++) + { + if (!wcscmp(name, this->names[i])) + { + if (this->values[i]) return this->values[i]; + else return def; + } + } + return def; +} + +LPWSTR config::flatten() +{ + LPCWSTR header = TEXT("[Flips]\n#Changing this file may void your warranty. Do not report any bugs if you do.\n"); + + size_t len = wcslen(header); + for (size_t i=0;inumentries;i++) + { + if (this->values[i]!=NULL) + { + len += wcslen(this->names[i]) + 1 + wcslen(this->values[i]) + 1; + } + } + + LPWSTR ret = (LPWSTR)malloc((len+1)*sizeof(WCHAR)); + + LPWSTR at = ret; + at += wsprintf(at, TEXT("%s"), header); + for (size_t i=0;inumentries;i++) + { + if (this->values[i]!=NULL) + { + at += wsprintf(at, TEXT("%s=%s\n"), this->names[i], this->values[i]); + } + } + + return ret; +} + +config::~config() +{ + if (this->filename) + { + LPWSTR data = this->flatten(); +//puts(data); + struct mem m = { (uint8_t*)data, wcslen(data)*sizeof(WCHAR) }; + filewrite::write(this->filename, m); + free(data); + free(this->filename); + } + + for (size_t i=0;inumentries;i++) + { +//printf("#(%s)(%s)\n",this->names[i],this->values[i]); + free(this->names[i]); + free(this->values[i]); + } + free(this->names); + free(this->values); +} + +config cfg; + + + + +static LPWSTR EmuGetKey(LPCWSTR filename) +{ + static WCHAR ret[64]; + wsprintf(ret, TEXT("emu%s"), GetExtension(filename)); + return ret; +} + +LPCWSTR GetEmuFor(LPCWSTR filename) +{ + return cfg.get(EmuGetKey(filename)); +} + +void SetEmuFor(LPCWSTR filename, LPCWSTR emu) +{ + cfg.set(EmuGetKey(filename), emu); +} + + + + + +enum { + ch_crc32, + ch_last +}; +static LPCWSTR checkmap_typenames[] = { TEXT("rom.crc32.") }; +// sizeof rather than strlen to ensure compile-time evaluation; -1 for NUL +static const int checkmap_typenames_maxlen = sizeof("rom.crc32.")-1; +struct checkmap { + uint8_t* sum; + LPWSTR name; +}; +static struct checkmap * checkmap[ch_last]={NULL}; +static uint32_t checkmap_len[ch_last]={0}; +static const uint8_t checkmap_sum_size[]={ 4 }; +static const uint8_t checkmap_sum_size_max = 4; + +static const int CfgSumNameMaxLen = checkmap_typenames_maxlen + checkmap_sum_size_max*2 + 1; +static void CfgSumName(WCHAR* out, int type, const void* sum) +{ + const uint8_t* sum8 = (uint8_t*)sum; + wcscpy(out, checkmap_typenames[type]); + WCHAR* end = out + wcslen(checkmap_typenames[type]); + for (int i=0;isum=(uint8_t*)malloc(checkmap_sum_size[type]); + memcpy(item->sum, sum, checkmap_sum_size[type]); + item->name=wcsdup(filename); + + WCHAR cfgname[CfgSumNameMaxLen]; + CfgSumName(cfgname, type, sum); + cfg.set(cfgname, filename); +} + +struct mem GetRomList() +{ + struct mem out={NULL, 0}; + for (unsigned int type=0;type data.len) return; \ + memcpy(target, data.ptr, bytes); \ + data.ptr += bytes; \ + data.len -= bytes +#define read_discard(bytes) \ + if (bytes > data.len) return; \ + data.ptr += bytes; \ + data.len -= bytes + uint32_t count; + read(&count, sizeof(count)); + checkmap[type]=(struct checkmap*)malloc(sizeof(struct checkmap)*count*2);//overallocate so I won't need to round the count + + while (count--) + { + uint8_t hashlen; + read(&hashlen, sizeof(hashlen)); + uint16_t strlen; + read(&strlen, sizeof(strlen)); + if (hashlen==checkmap_sum_size[type]) + { + if (data.len < hashlen+strlen) return; + + struct checkmap* item=&checkmap[type][checkmap_len[type]++]; + item->sum=(uint8_t*)malloc(checkmap_sum_size[type]); + read(item->sum, hashlen); + item->name=(WCHAR*)malloc(strlen+sizeof(WCHAR)); + read(item->name, strlen); + memset((uint8_t*)item->name + strlen, 0, sizeof(WCHAR)); + } + else + { + read_discard(hashlen); + read_discard(strlen); + } + } +#undef read + } +} + +LPCWSTR FindRomForPatch(file* patch, bool * possibleToFind) +{ + if (possibleToFind) *possibleToFind=false; + enum patchtype patchtype=IdentifyPatch(patch); + if (patchtype==ty_bps) + { + struct bpsinfo info = bps_get_info(patch, false); + if (info.error) return NULL; + if (possibleToFind) *possibleToFind=true; + return FindRomForSum(ch_crc32, &info.crc_in); + } + //UPS has checksums too, but screw UPS. Nobody cares. + return NULL; +} + +void AddToRomList(file* patch, LPCWSTR path) +{ + enum patchtype patchtype=IdentifyPatch(patch); + if (patchtype==ty_bps) + { + struct bpsinfo info = bps_get_info(patch, false); + if (info.error) return; + AddRomForSum(ch_crc32, &info.crc_in, path); + } +} + +void AddConfigToRomList(LPCWSTR key, LPCWSTR value) +{ + int type; + uint8_t sum[checkmap_sum_size_max]; + if (CfgSumParseName(&type, sum, key)) + AddRomForSum(type, sum, value); +} + +void DeleteRomFromList(LPCWSTR path) +{ + for (unsigned int type=0;typeread(); // There's no real reason to remove this, no patcher knows how to handle these file objects. + + enum patchtype patchtype=IdentifyPatch(patch); + struct errorinfo errinf; + removeheader=(removeheader && patchtype==ty_bps); + if (removeheader) + { + inrom.ptr+=512; + inrom.len-=512; + } + struct mem outrom={NULL,0}; + struct mem manifest={NULL,0}; + + errinf=error(el_broken, "Unknown patch format."); + if (patchtype==ty_bps) + { + errinf=bpserrors[bps_apply(patchmem, inrom, &outrom, &manifest, !verifyinput)]; + if (errinf.level==el_notthis && !verifyinput && outrom.ptr) + errinf = error(el_warning, "This patch is not intended for this ROM (output created anyways)"); + if (errinf.level==el_notthis) + { + bpsinfo inf = bps_get_info(patch, false); + static char errtextbuf[2][256]; // ugly trick to get the nested invocation for the header remover to not screw up the error + static int errtextid=0; // makes it impossible to save the error strings, but Flips doesn't do that anyways + char* errtext=errtextbuf[errtextid]; + if (++errtextid == 2) errtextid=0; + if (inf.size_in != inrom.len) + { +//http://msdn.microsoft.com/en-us/library/vstudio/tcxf1dw6.aspx says %zX is not supported +//this is true up to and including Windows Vista; 7 adds support for it +//I could define it to "I", but my GCC does not acknowledge its legitimacy and throws bogus warnings +//nor does my GCC accept any supported alternative, so let's just nuke the entire warning. +//it's a poor solution, but it's the best I can find +#ifdef _WIN32 +# ifdef _WIN64 +# ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wformat" +# endif +# define z "I" +# else +# define z "" +# endif +#else +# define z "z" +#endif + sprintf(errtext, "This patch is not intended for this ROM. Expected file size %" z "u, got %" z "u.", inf.size_in, inrom.len); + errinf.description=errtext; + } + else + { + uint32_t crc = crc32(inrom.ptr, inrom.len); + if (inf.crc_in != crc) + { + sprintf(errtext, "This patch is not intended for this ROM. Expected checksum %.8X, got %.8X.", inf.crc_in, crc); + errinf.description=errtext; + } + } + } + } + if (patchtype==ty_ips) errinf=ipserrors[ips_apply(patchmem, inrom, &outrom)]; + if (patchtype==ty_ups) errinf=bpserrors[ups_apply(patchmem, inrom, &outrom)]; + if (errinf.level==el_ok) errinf.description="The patch was applied successfully!"; + + struct manifestinfo defmanifestinfo={true,false,NULL}; + if (!manifestinfo) manifestinfo=&defmanifestinfo; + if (manifestinfo->use) + { + if (manifest.ptr) + { + LPCWSTR manifestname; + if (manifestinfo->name) manifestname=manifestinfo->name; + else manifestname=GetManifestName(outromname); + if (!WriteWholeFile(manifestname, manifest) && manifestinfo->required) + { + if (errinf.level==el_ok) errinf=error(el_warning, "The patch was applied, but the manifest could not be created."); + } + } + else if (manifestinfo->required && errinf.level==el_ok) + { + errinf=error(el_warning, "The patch was applied, but there was no manifest present."); + } + } + + if (removeheader) + { + inrom.ptr-=512; + inrom.len+=512; + if (errinf.levelget(), verifyinput, + shouldRemoveHeader(inromname, inrom->len()), outromname, manifestinfo); + if (update_rom_list && errinf.level==el_ok) AddToRomList(patch, inromname); + delete inrom; + return errinf; +} + +struct errorinfo ApplyPatch(LPCWSTR patchname, LPCWSTR inromname, bool verifyinput, + LPCWSTR outromname, struct manifestinfo * manifestinfo, bool update_rom_list) +{ + file* patch = file::create(patchname); + if (!patch) + { + return error(el_broken, "Couldn't read input patch"); + } + struct errorinfo errinf=ApplyPatchMem(patch, inromname, verifyinput, outromname, manifestinfo, update_rom_list); + delete patch; + return errinf; +} + + +char bpsdProgStr[24]; +int bpsdLastPromille=-1; + +bool bpsdeltaGetProgress(size_t done, size_t total) +{ + if (total<1000) total=1000;//avoid div by zero + int promille=done/(total/1000);//don't set this to done*1000/total, it'd just give overflows on huge stuff. 100% is handled later + if (promille==bpsdLastPromille) return false; + bpsdLastPromille=promille; + if (promille>=1000) return false; + strcpy(bpsdProgStr, "Please wait... "); + bpsdProgStr[15]='0'+promille/100; + int digit1=((promille<100)?15:16); + bpsdProgStr[digit1+0]='0'+promille/10%10; + bpsdProgStr[digit1+1]='.'; + bpsdProgStr[digit1+2]='0'+promille%10; + bpsdProgStr[digit1+3]='%'; + bpsdProgStr[digit1+4]='\0'; + return true; +} + +bool bpsdeltaProgressCLI(void* userdata, size_t done, size_t total) +{ + if (!bpsdeltaGetProgress(done, total)) return true; + fputs(bpsdProgStr, stdout); + putchar('\r'); + fflush(stdout); + return true; +} + +struct errorinfo CreatePatchToMem(LPCWSTR inromname, LPCWSTR outromname, enum patchtype patchtype, + struct manifestinfo * manifestinfo, struct mem * patchmem) +{ + bool usemmap = (patchtype!=ty_bps && patchtype!=ty_bps_moremem); + + //pick roms + filemap* romsmap[2]={NULL, NULL}; + file* roms[2]={NULL, NULL}; + size_t lens[2]; + + for (int i=0;i<2;i++) + { + LPCWSTR romname=((i==0)?inromname:outromname); + + if (usemmap) + { + romsmap[i] = filemap::create(romname); + + if (!romsmap[i]) + { + if (i==1) delete romsmap[0]; + return error(el_broken, "Couldn't read this ROM."); + } + if (shouldRemoveHeader(romname, romsmap[i]->len()) && (patchtype==ty_bps || patchtype==ty_bps_linear || patchtype==ty_bps_moremem)) + { + romsmap[i] = new fileheadermap(romsmap[i]); + } + + lens[i] = romsmap[i]->len(); + } + else + { + roms[i] = file::create(romname); + + if (!roms[i]) + { + if (i==1) delete roms[0]; + return error(el_broken, "Couldn't read this ROM."); + } + if (shouldRemoveHeader(romname, roms[i]->len()) && (patchtype==ty_bps || patchtype==ty_bps_linear || patchtype==ty_bps_moremem)) + { + roms[i] = new fileheader(roms[i]); + } + lens[i] = roms[i]->len(); + } + } + + struct mem manifest={NULL,0}; + struct errorinfo manifesterr={el_ok, NULL}; + struct manifestinfo defmanifestinfo={true,false,NULL}; + if (!manifestinfo) manifestinfo=&defmanifestinfo; + if (patchtype==ty_bps || patchtype==ty_bps_linear || patchtype==ty_bps_moremem) + { + LPCWSTR manifestname; + if (manifestinfo->name) manifestname=manifestinfo->name; + else manifestname=GetManifestName(outromname); + manifest=ReadWholeFile(manifestname); + if (!manifest.ptr) manifesterr=error(el_warning, "The patch was created, but the manifest could not be read."); + } + else manifesterr=error(el_warning, "The patch was created, but this patch format does not support manifests."); + + struct errorinfo errinf={ el_broken, "Unknown patch format." }; + if (patchtype==ty_ips) + { + errinf=ipserrors[ips_create(romsmap[0]->get(), romsmap[1]->get(), patchmem)]; + } + if (patchtype==ty_bps || patchtype==ty_bps_moremem) + { +#ifndef FLIPS_CLI + if (guiActive) + { + bpsdeltaBegin(); + errinf=bpserrors[bps_create_delta(roms[0], roms[1], manifest, patchmem, bpsdeltaProgress, NULL, (patchtype==ty_bps_moremem))]; + bpsdeltaEnd(); + } + else +#endif + { + errinf=bpserrors[bps_create_delta(roms[0], roms[1], manifest, patchmem, bpsdeltaProgressCLI, NULL, (patchtype==ty_bps_moremem))]; + } + } + if (patchtype==ty_bps_linear) + { + errinf=bpserrors[bps_create_linear(romsmap[0]->get(), romsmap[1]->get(), manifest, patchmem)]; + } + FreeFileMemory(manifest); + if (errinf.level==el_ok) errinf.description="The patch was created successfully!"; + + if (manifestinfo->required && errinf.level==el_ok && manifesterr.level!=el_ok) errinf=manifesterr; + + if (errinf.level==el_ok && lens[0] > lens[1]) + { + errinf=error(el_warning, "The patch was created, but the input ROM is larger than the " + "output ROM. Double check whether you've gotten them backwards."); + } + + if (usemmap) + { + delete romsmap[0]; + delete romsmap[1]; + } + else + { + delete roms[0]; + delete roms[1]; + } + + return errinf; +} + +struct errorinfo CreatePatch(LPCWSTR inromname, LPCWSTR outromname, enum patchtype patchtype, + struct manifestinfo * manifestinfo, LPCWSTR patchname) +{ + struct mem patch={NULL,0}; + struct errorinfo errinf = CreatePatchToMem(inromname, outromname, patchtype, manifestinfo, &patch); + + if (errinf.levelread(meta.ptr, info.meta_start, info.meta_size); + + if (manifestinfo->required) + { + if (manifestinfo->name) + { + filewrite::write(manifestinfo->name, meta); + } + else + { + fwrite(meta.ptr, 1,meta.len, stdout); + free(meta.ptr); + return el_ok; + } + } + } + + LPCWSTR inromname = FindRomForPatch(patch, NULL); + //'z' macro defined above + printf("Input ROM: %" z "u bytes, CRC32 %.8X", info.size_in, info.crc_in); + if (inromname) wprintf(TEXT(", %s"), inromname); + puts(""); + + printf("Output ROM: %" z "u bytes, CRC32 %.8X\n", info.size_out, info.crc_out); + //floating point may lose a little precision, but it's easier than dodging overflows, and this + //is the output of inaccurate heuristics anyways, losing a little more makes no difference. + //Windows MulDiv could also work, but it's kinda nonportable. + //printf("Change index: %i / 1000\n", (int)(info.change_num / (float)info.change_denom * 1000)); + + if (info.meta_size) + { + printf("Metadata: %" z "u bytes:\n", info.meta_size); + char* meta_iter = (char*)meta.ptr; + char* meta_end = meta_iter + meta.len; + for (int i=0;i<3;i++) + { + int n_chars = meta_end-meta_iter; + if (n_chars > 75) n_chars = 75; + char* nextline = (char*)memchr(meta_iter, '\n', n_chars); + if (nextline && nextline-meta_iter < n_chars) n_chars = nextline-meta_iter; + if (!nextline && !n_chars) break; // wipe trailing linebreaks + printf(" %.*s\n", n_chars, meta_iter); + if (!nextline) break; + meta_iter = nextline+1; + } + } + + if (verbosity >= 1) + { + puts("Disassembly:"); + struct mem patchmem = patch->read(); + bps_disassemble(patchmem, stdout); + free(patchmem.ptr); + } + + free(meta.ptr); + return el_ok; + } + puts("No information available for this patch type"); + return el_broken; +} + + + +void usage() +{ + GUIClaimConsole(); + fputs( + // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 + flipsversion "\n" + "usage:\n" + " " +#ifndef FLIPS_CLI + "flips\n" + "or flips patch.bps\n" + "or " +#endif + "flips [--apply] [--exact] patch.bps rom.smc [outrom.smc]\n" + "or flips [--create] [--exact] [--bps | etc] clean.smc hack.smc [patch.bps]\n" + "\n" + // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 + "options:\n" + "-a --apply: apply IPS, BPS or UPS patch (default if given two arguments)\n" + " if output filename is not given, Flips defaults to patch.smc beside the patch\n" + "-c --create: create IPS or BPS patch (default if given three arguments)\n" + "-I --info: BPS files contain information about input and output roms, print it\n" + " with --verbose, disassemble the entire patch\n" + //" also estimates how much of the source file is retained\n" + //" anything under 400 is fine, anything over 600 should be treated with suspicion\n" + //(TODO: --info --verbose) + "-i --ips, -b -B --bps --bps-delta, --bps-delta-moremem, --bps-linear:\n" + " create this patch format instead of guessing based on file extension\n" + " ignored when applying\n" + " bps creation styles:\n" + " delta is the recommended and default one; it's a good balance between creation\n" + " performance and patch size\n" + " delta-moremem is usually slightly (~3%) faster than delta, but uses about\n" + " twice as much memory; it gives identical patches to delta\n" + " linear is the fastest, but tends to give pretty big patches\n" + " all BPS patchers can apply all patch styles, the only difference is file size\n" + " and creation performance\n" + "--exact: do not remove SMC headers when applying or creating a BPS patch\n" + " not recommended, may affect patcher compatibility\n" + "--ignore-checksum: accept checksum mismatches (BPS only)\n" + "-m or --manifest: emit or insert a manifest file as romname.xml (BPS only)\n" + "-mfilename or --manifest=filename: emit or insert a manifest file exactly here\n" + "-h -? --help: show this information\n" + "-v --version: show application version\n" + "\n" + // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 + , stdout); + exit(0); +} + + +int error_to_exit(errorlevel level) +{ + return (level >= el_notthis ? EXIT_FAILURE : EXIT_SUCCESS); +} +int flipsmain(int argc, WCHAR * argv[]) +{ + enum patchtype patchtype=ty_null; + enum { a_default, a_apply_filepicker, a_apply_given, a_create, a_info } action=a_default; + int numargs=0; + LPCWSTR arg[3]={NULL,NULL,NULL}; + bool hasFlags=false; + int verbosity = 0; + + bool ignoreChecksum=false; + + struct manifestinfo manifestinfo={false, false, NULL}; +// { +// bool use; +// bool required; +// LPCWSTR name; +// bool success; +//}; + for (int i=1;i FLIPS_WINDOWS, Linux -> FLIPS_GTK, anything +// else -> FLIPS_CLI). FLIPS_WINDOWS and FLIPS_CLI can be compiled under both C99 and C++98; +// FLIPS_GTK is only tested under C99. +// Note that picking the platform native frontend will bring a few advantages even if you only +// intend to use Flips from the command line; Windows gains access to filenames outside the 8bit +// charset, and GTK+ will gain the ability to handle files on URIs and not the local file system. +// +//All of these must be defined globally, or Flips will behave erratically. + +#if defined(FLIPS_WINDOWS) || defined(FLIPS_GTK) || defined(FLIPS_CLI) +//already picked +#elif defined(_WIN32) +#define FLIPS_WINDOWS +#elif defined(__linux__) +#define FLIPS_GTK +#else +#define FLIPS_CLI +#endif + +//#ifdef __cplusplus +//#define EXTERN_C extern "C" +//#else +//#define EXTERN_C +//#endif + +#define flipsversion "Floating IPS" + + +#if defined(FLIPS_WINDOWS) +#define UNICODE +#define _WIN32_WINNT 0x0501 +#define _WIN32_IE 0x0600 + +#define NOMINMAX // this seems automatically on in C++ - crazy. +#ifdef __MINGW32__ +#include +#undef __USE_MINGW_ANSI_STDIO // must remove this, to avoid a libgcc_s_sjlj-1.dll dependency on 32bit +#endif // comments say libstdc++ demands a POSIX printf, but I'm not using that, so I don't care +#include +#include +#include +#include +#include +#include +#include + +#define wcsicmp _wcsicmp // wcsicmp deprecated? okay, have a define +#define wcsdup _wcsdup +#define wtoi _wtoi + + +#else +#include +#include +#include +#include +#include + +//Flips uses Windows type names internally, since it's easier to #define them to Linux types than +//defining "const char *" to anything else. I could invent my own typedefs, but the only advantage +//that would bring over Windows types would be not being Windows types, and I don't see that as a +//valid argument. + +#define LPCWSTR const char * +#define LPWSTR char * +#define WCHAR char + +#define wcscpy strcpy +#define wcscat strcat +#define wcschr strchr +#define wcslen strlen +#define wcsdup strdup +#define wcsrchr strrchr +#define wcscmp strcmp +#define wcsncmp strncmp +#define wcsicmp strcasecmp +//#define wcsnicmp strncasecmp +#define wprintf printf +#define wsprintf sprintf +#define wscanf scanf +#define swscanf sscanf +#define wtoi atoi + +#define iswalnum isalnum +#define iswalpha isalpha +#define iswascii isascii +#define iswblank isblank +#define iswcntrl iscntrl +#define iswdigit isdigit +#define iswgraph isgraph +#define iswlower islower +#define iswprint isprint +#define iswpunct ispunct +#define iswspace isspace +#define iswupper isupper +#define iswxdigit isxdigit + +#define TEXT(text) text +//EXTERN_C int strcasecmp(const char *s1, const char *s2); + +//some platforms define strdup, some don't. +#define strdup strdup_flips +static inline char* strdup(const char * in) +{ + size_t len=strlen(in); + char * ret=(char*)malloc(len+1); + memcpy(ret, in, len+1); + return ret; +} +#endif + +#include "libbps.h" +#include "libips.h" +#include "libups.h" + +#ifndef __cplusplus +#include //If this file does not exist, remove it and uncomment the following three lines. +//#define bool int +//#define true 1 +//#define false 0 +#endif + + +//provided by Flips core +#include "global.h" + +enum patchtype { + ty_null, + ty_bps, + ty_ips, + + //non-recommended formats + ty_bps_linear, + ty_bps_moremem, + ty_ups, + + ty_shut_up_gcc +}; + +enum errorlevel { + el_ok, + el_notice, + el_unlikelythis, + el_warning, + el_notthis, + el_broken, + el_shut_up_gcc +}; + +struct errorinfo { + enum errorlevel level; + const char * description; +}; + +struct manifestinfo { + bool use; + bool required; + LPCWSTR name; +}; + +class file; +class filewrite; + +LPWSTR GetExtension(LPCWSTR fname); +LPWSTR GetBaseName(LPCWSTR fname); +bool shouldRemoveHeader(LPCWSTR romname, size_t romlen); + +class config +{ + LPWSTR filename; + + size_t numentries; + LPWSTR * names; + LPWSTR * values; + + //stupid c++, why is there no sane way to get the implementation out of the headers + void sort(); + +public: + + config() + { + numentries = 0; + names = NULL; + values = NULL; + } + + //This ends up writing a really ugly format on Windows: UTF-16, no BOM, LF endings. + //This is because Microsoft are rude and refuse to support UTF-8 properly. I'm not rewarding that. + //I'm catering to their shitty char type, that's way more than enough. + + //If the input is invalid, the object will ignore the invalid parts and remain valid. + //In particular, failure to initialize from a file will still update the file on destruction. + //Only init once, or it may leak memory or otherwise misbehave. + void init_file(LPCWSTR filename); + void init_raw(LPWSTR contents); // Modifies the input string. + + //The key may only contain alphanumerics, . and _. + //The value may not have leading or trailing whitespace, or contain \r or \n. + void set(LPCWSTR key, LPCWSTR value); // If NULL, the key is removed. This may alter or rearrange unrelated get{name,value}byid values. + LPCWSTR get(LPCWSTR key, LPCWSTR def = NULL); + + void setint(LPCWSTR key, int value) { WCHAR valstr[16]; wsprintf(valstr, TEXT("%i"), value); set(key, valstr); } + int getint(LPCWSTR key, int def = 0) { LPCWSTR val = get(key); return val ? wtoi(val) : def; } + + size_t getcount() { return numentries; } + LPCWSTR getnamebyid(size_t i) { return names[i]; } + LPCWSTR getvaluebyid(size_t i) { return values[i]; } + + LPWSTR flatten(); // free() this when you're done. + ~config(); // If you used init_file, this saves automatically. +}; +extern config cfg; + +//TODO: rewrite these +struct mem GetRomList(); +void SetRomList(struct mem data); +LPCWSTR FindRomForPatch(file* patch, bool * possibleToFind); +void AddToRomList(file* patch, LPCWSTR path); +void AddConfigToRomList(LPCWSTR key, LPCWSTR value); +void DeleteRomFromList(LPCWSTR path); + +LPCWSTR GetEmuFor(LPCWSTR filename); // NULL if none +void SetEmuFor(LPCWSTR filename, LPCWSTR emu); + +struct errorinfo ApplyPatchMem2(file* patch, struct mem inrom, bool removeheader, bool verifyinput, + LPCWSTR outromname, struct manifestinfo * manifestinfo); +struct errorinfo ApplyPatchMem(file* patch, LPCWSTR inromname, bool verifyinput, + LPCWSTR outromname, struct manifestinfo * manifestinfo, bool update_rom_list); +struct errorinfo ApplyPatch(LPCWSTR patchname, LPCWSTR inromname, bool verifyinput, + LPCWSTR outromname, struct manifestinfo * manifestinfo, bool update_rom_list); +//struct errorinfo CreatePatchToMem(file* inrom, file* outrom, enum patchtype patchtype, + //struct manifestinfo * manifestinfo, struct mem * patchmem); +//struct errorinfo CreatePatch(file* inrom, file* outrom, enum patchtype patchtype, + //struct manifestinfo * manifestinfo, LPCWSTR patchname); +struct errorinfo CreatePatchToMem(LPCWSTR inromname, LPCWSTR outromname, enum patchtype patchtype, + struct manifestinfo * manifestinfo, struct mem * patchmem); +struct errorinfo CreatePatch(LPCWSTR inromname, LPCWSTR outromname, enum patchtype patchtype, + struct manifestinfo * manifestinfo, LPCWSTR patchname); + +extern char bpsdProgStr[24]; +extern int bpsdLastPromille; +bool bpsdeltaGetProgress(size_t done, size_t total); + +int flipsmain(int argc, WCHAR * argv[]); +void usage();//does not return + + +//provided by the OS port +//several functions of file:: and filewrite:: also belong to the OS port + +//TODO: delete +struct mem ReadWholeFile(LPCWSTR filename); +bool WriteWholeFile(LPCWSTR filename, struct mem data); +bool WriteWholeFileWithHeader(LPCWSTR filename, struct mem header, struct mem data); +void FreeFileMemory(struct mem mem); + +void bpsdeltaBegin(); +bool bpsdeltaProgress(void* userdata, size_t done, size_t total); +void bpsdeltaEnd(); + +int GUIShow(LPCWSTR filename); +void GUILoadConfig(); +//LPCWSTR GUIGetFileFor(uint32_t crc32); // use FindRomForPatch instead +#ifdef FLIPS_WINDOWS +void GUIClaimConsole(); +#else +#define GUIClaimConsole() // all other platforms have consoles already +#endif + +//the OS port is responsible for main() diff --git a/tools/Flips/flips.ico b/tools/Flips/flips.ico new file mode 100644 index 000000000..a38c89e57 Binary files /dev/null and b/tools/Flips/flips.ico differ diff --git a/tools/Flips/flips.rc b/tools/Flips/flips.rc new file mode 100644 index 000000000..0ac64b4ca --- /dev/null +++ b/tools/Flips/flips.rc @@ -0,0 +1,28 @@ +#include + +0 ICON DISCARDABLE "flips.ico" +1 ICON DISCARDABLE "ips.ico" +2 ICON DISCARDABLE "bps.ico" +1 24 "flips.Manifest" + +VS_VERSION_INFO VERSIONINFO +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +FILEFLAGS 0 +//VS_FF_DEBUG VS_FF_PATCHED VS_FF_PRERELEASE VS_FF_PRIVATEBUILD VS_FF_SPECIALBUILD VS_FFI_FILEFLAGSMASK +FILEOS VOS__WINDOWS32 +FILETYPE VFT_APP +FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "Alcaro" + VALUE "FileDescription", "Flips Patch Utility" + VALUE "InternalName", "Floating IPS" + VALUE "LegalCopyright", "\xA9 2013-2021 Alcaro" + VALUE "OriginalFilename", "flips.exe" + VALUE "ProductName", "Floating IPS" + END + END +END diff --git a/tools/Flips/global.h b/tools/Flips/global.h new file mode 100644 index 000000000..d4940e65a --- /dev/null +++ b/tools/Flips/global.h @@ -0,0 +1,72 @@ +//Module name: Floating IPS, global header +//Author: Alcaro +//Date: See Git history +//Licence: GPL v3.0 or higher + +#ifndef struct_mem +#define struct_mem + +//the standard library can be assumed to exist +#include //size_t, SIZE_MAX +#include //uint8_t + +#ifndef SIZE_MAX +#define SIZE_MAX ((size_t)-1) +#endif + +struct mem { + uint8_t * ptr; + size_t len; +}; + +#if defined(FLIPS_WINDOWS) +#define LPCWSTR const wchar_t * +#else +#define LPCWSTR const char * +#endif + +#ifdef __cplusplus +//used by both Flips core/GUI and the BPS creator +class file { +public: + static file* create(LPCWSTR filename); + static file* create_libc(const char * filename); + static bool exists(LPCWSTR filename); + static bool exists_libc(const char * filename); + + virtual size_t len() = 0; + virtual bool read(uint8_t* target, size_t start, size_t len) = 0; + + //these two add sizeof(WCHAR) 00s after the actual data, so you can cast it to LPCWSTR + static struct mem read(LPCWSTR filename); // provided by Flips core + struct mem read(); // provided by Flips core + + virtual ~file() {} +}; + +class filemap { +public: + static filemap* create(LPCWSTR filename); + static filemap* create_fallback(LPCWSTR filename); + + virtual size_t len() = 0; + virtual const uint8_t * ptr() = 0; + struct mem get() { struct mem m = { (uint8_t*)ptr(), len() }; return m; } + + virtual ~filemap() {} +}; + +class filewrite { +public: + static filewrite* create(LPCWSTR filename); + static filewrite* create_libc(const char * filename); + + virtual bool append(const uint8_t* data, size_t len) = 0; + + static bool write(LPCWSTR filename, struct mem data); // provided by Flips core + + virtual ~filewrite() {} +}; +#endif + +#endif diff --git a/tools/Flips/ips.ico b/tools/Flips/ips.ico new file mode 100644 index 000000000..2c69ef00e Binary files /dev/null and b/tools/Flips/ips.ico differ diff --git a/tools/Flips/libbps-suf.cpp b/tools/Flips/libbps-suf.cpp new file mode 100644 index 000000000..d0dd33d37 --- /dev/null +++ b/tools/Flips/libbps-suf.cpp @@ -0,0 +1,900 @@ +//Module name: libbps-suf +//Author: Alcaro +//Date: See Git history +//Licence: GPL v3.0 or higher + + +#include "libbps.h" +#include "crc32.h" +#include +#include +#include +#include + +//These two give minor performance penalties and will print some random stuff to stdout. +//The former will verify the correctness of the output patch, the latter will print some performance data. +//Can be useful for debugging, but should be disabled for release builds. +#ifdef BPS_STANDALONE +#endif +//#define TEST_CORRECT +//#define TEST_PERF + +//If the suffix array of [0, 0, 0, 0] is [3, 2, 1, 0], set to true. If it's [0, 1, 2, 3], this is false. +//If it's [4, 3, 2, 1, 0] or [0, 1, 2, 3, 4], remove the 4 (easily done with some pointer math), and follow the above. +//If it's something else, get a non-broken array calculator. +#define EOF_IS_LAST false + +#if defined(TEST_CORRECT) || defined(TEST_PERF) +#include +#endif + +//Algorithm description: +// +//This is heavily built upon suffix sorting; the implementation I use, libdivsufsort, claims +// O(n log n) complexity, so I'll believe that. There is also SA-IS, which claims O(n), but if that +// is true, its constant factors are ridiculously high. +// +//The program starts by taking an equal amount of the source file and target file, concatenates that +// with target first, and suffix sorts it. +//It also calculates a reverse index, such that reverse[sorted[i]]==i. +// +//To find a match, it goes to reverse[outpos], and scans sorted[] up and down for the closest entry +// that either starts before the current output position, or is somewhere in the source file. +//As the source file comes last, the end-of-file marker (whose value is outside the range of a byte) +// is guaranteed to not be in the way for a better match. +//This is called O(n) times, and averages O(1) as at least 50% of sorted[] is in range. However, it +// is worst-case O(n) for sorted inputs, giving a total of O(n^2). +// +//It then checks which of the two candidates are superior, by checking how far they match each +// other, and then checking if the upper one has another correct byte. +//This is potentially O(n), but for each matched byte, another iteration is removed from the outer +// loop, so the sum of all calls is O(n). +// +//When the program approaches the end of the sorted area, it re-sorts twice as much as last time. +// This gives O(log n) calls to the suffix sorter. +//Given O(n log n) for one sorting step, the time taken is O(n/1 log n/1 + n/2 log n/2 + +// n/4 log n/4 + ...), which is strictly less than O(n/1 log n + n/2 log n + n/4 log n + ...), which +// equals O(2n log n), which is O(n log n). (The exact value of that infinite sum is 2n*log(n/2).) +// +//Many details were omitted from the above, but that's the basic setup. +// +//Thus, the program is O(max(n log n, n, n) = n log n) average and O(max(n log n, n^2, n) = n^2) +// worst case. +// +//I conclude that the task of finding, understanding and implementing a sub-O(n^2) algorithm for +// delta patching is resolved. + + +//Known cases where this function does not emit the optimal encoding: +//If a match in the target file would extend further than target_search_size, it is often skipped. +// Penalty: O(log n), with extremely low constants (it'd require a >256B match to be exactly there). +// Even for big files, the penalty is very likely to remain zero; even hitting double-digit bytes +// would require a file designed exactly for that. +//If multiple matches are equally good, it picks one at random, not the one that's cheaper to encode. +// Penalty: Likely O(n) or O(n log log n), with low constants. I'd guess ~1.4% for my 48MB test file. +//However, due to better heuristics and others' performance optimizations, this one still beats its +// competitors. + + +//Possible optimizations: +//divsufsort() takes approximately 2/3 of the total time. create_reverse_index() takes roughly a third of the remainder. +//Each iteration takes four times as long as the previous one. +//If each iteration takes 4 times as long as the previous one, then the last one takes 3/4 of the total time. +//Since divsufsort+create_reverse_index doesn't depend on anything else, the last iteration can be split off to its own thread. +//This would split it to +//Search, non-final: 2/9 * 1/4 = 2/36 +//Search, final: 2/9 * 3/4 = 6/36 +//Sort+rev, non-final: 7/9 * 1/4 = 7/36 +//Sort+rev, final: 7/9 * 3/4 = 21/36 +//All non-final must be done sequentially. Both Sort Final and non-final must be done before Search Final can start. +//This means the final time, if Sort Final is split off, is +//max(7/36+2/36, 21/36) + 6/36 = 27/36 = 3/4 +//of the original time. +//Due to +//- the considerable complexity costs (OpenMP doesn't seem able to represent the "insert a wait in +// the middle of this while loop" I would need) +//- the added memory use, approximately 25% higher - it's already high enough +//- libdivsufsort already using threads, which would make the gains lower +// and would increase complexity, as I have to ensure the big one remains threaded - +// and that the small ones are not, as that'd starve the big one +//I deem a possible 25% boost not worthwhile. + + +//Both sorting algorithms claim O(1) memory use (in addition to the bytes and the output). In +// addition to that, this algorithm uses (source.len*target.len)*(sizeof(uint8_t)+2*sizeof(off_t)) +// bytes of memory, plus the patch (the input/output files are read from disk). +//For most hardware, this is 9*(source.len+target.len), or 5*(source+target) for the slim one. + + +//I don't need 64bit support, it'd take 20GB RAM and way too long. +//#include "sais.cpp" +//template +//static void sufsort(sais_index_type* SA, const uint8_t* T, sais_index_type n) { +// if(n <= 1) { if(n == 1) SA[0] = 0; return; } +// sais_main(T, SA, 0, n, 256); +//} + +//According to , divsufsort achieves +// approximately half the time of SAIS for nearly all files, despite SAIS' promises of linear +// performance (divsufsort claims O(n log n)). + +//divsufsort only allocates O(1) for some radix/bucket sorting. SAIS seems constant too. +//I'd prefer to let them allocate from an array I give it, but divsuf doesn't allow that, and there +// are only half a dozen allocations per call anyways. + +#include "divsufsort.h" +static void sufsort(int32_t* SA, uint8_t* T, int32_t n) +{ + divsufsort(T, SA, n); +} + +#ifdef USE_DIVSUFSORT64 +#include "divsufsort64.h" + +static void sufsort(int64_t* SA, uint8_t* T, int64_t n) +{ + divsufsort(T, SA, n); +} +#endif + + + +template static T min(T a, T b) { return a static T max(T a, T b) { return a outbuflen) + { + if (!outbuflen) outbuflen = 128; + while (outlen+len > outbuflen) outbuflen *= 2; + out = (uint8_t*)realloc(out, outbuflen); + } + } + + void append(const uint8_t * data, size_t len) + { + reserve(len); + memcpy(out+outlen, data, len); + outlen+=len; + } + + void appendnum(size_t num) + { +#ifdef TEST_CORRECT + if (num > 1000000000) + printf("ERROR: Attempt to write %.8lX\n",(unsigned long)num),abort(); +#endif + reserve(sizeof(size_t)*8/7+1); + + while (num >= 128) + { + out[outlen++]=(num&0x7F); + num>>=7; + num--; + } + out[outlen++]=num|0x80; + } + + void appendnum32(uint32_t num) + { + reserve(4); + out[outlen++] = num>>0; + out[outlen++] = num>>8; + out[outlen++] = num>>16; + out[outlen++] = num>>24; + } + + static size_t maxsize() + { + return SIZE_MAX>>2; // can be reduced to SIZE_MAX>>1 by amending append_cmd, but the mallocs overflow at that point anyways. + } + + size_t sourcelen; + size_t targetlen; + const uint8_t* targetmem; + + enum bpscmd { SourceRead, TargetRead, SourceCopy, TargetCopy }; + + size_t outpos; + + size_t sourcecopypos; + size_t targetcopypos; + + size_t numtargetread; + + bps_creator(file* source, file* target, struct mem metadata) + { + outlen = 0; + outbuflen = 128; + out = (uint8_t*)malloc(outbuflen); + + outpos = 0; + + sourcelen = source->len(); + targetlen = target->len(); + + sourcecopypos = 0; + targetcopypos = 0; + + numtargetread = 0; + + append((const uint8_t*)"BPS1", 4); + appendnum(sourcelen); + appendnum(targetlen); + appendnum(metadata.len); + append(metadata.ptr, metadata.len); + + setProgress(NULL, NULL); + } + + + void move_target(const uint8_t* ptr) + { + targetmem = ptr; + } + + size_t encode_delta(size_t prev, size_t next) + { + bool negative = (next= 1+cost+hastargetread+(len==1); + } + + + //Return value is how many bytes were used. If you believe the given one sucks, use TargetRead and return 1. + size_t match(bool is_target, size_t pos, size_t len) + { + if (!use_match( + numtargetread, + (!is_target && pos==outpos) ? 1 : // SourceRead + (num_cost(abs_diff(pos, (is_target ? targetcopypos : sourcecopypos)))+1), + len + )) + { + return emit_target_read(); + } + + if (is_target) return emit_target_copy(pos, len); + else return emit_source_copy(pos, len); + } + + + bool (*prog_func)(void* userdata, size_t done, size_t total); + void* prog_dat; + + static bool prog_func_null(void* userdata, size_t done, size_t total) { return true; } + + void setProgress(bool (*progress)(void* userdata, size_t done, size_t total), void* userdata) + { + if (!progress) progress = prog_func_null; + + prog_func=progress; + prog_dat=userdata; + } + + bool progress(size_t done, size_t total) + { + return prog_func(prog_dat, done, total); + } + + + void finish(const uint8_t* source, const uint8_t* target) + { + flush_target_read(); +#ifdef TEST_CORRECT + if (outpos != targetlen) + puts("ERROR: patch creates wrong ROM size"),abort(); +#endif + + appendnum32(crc32(source, sourcelen)); + appendnum32(crc32(target, targetlen)); + appendnum32(crc32(out, outlen)); + } + + struct mem getpatch() + { + struct mem ret = { out, outlen }; + out = NULL; + return ret; + } + + ~bps_creator() { free(out); } +}; +} + + + +#ifdef TEST_PERF +static int match_len_n=0; +static int match_len_tot=0; +#endif + +template +static off_t match_len(const uint8_t* a, const uint8_t* b, off_t len) +{ + off_t i; + for (i=0;i +static off_t pick_best_of_two(const uint8_t* search, off_t searchlen, + const uint8_t* data, off_t datalen, + off_t a, off_t b, + off_t* bestlen) +{ + off_t commonlen = match_len(data+a, data+b, min(datalen-a, datalen-b)); + if (commonlen>=searchlen) + { + *bestlen=searchlen; + return a; + } + + if (a+commonlen +static off_t adjust_match(off_t match, const uint8_t* search, off_t searchlen, + const uint8_t* data,off_t datalen, off_t maxstart,off_t minstart, + const off_t* sorted, off_t sortedlen, + off_t* bestlen) +{ + off_t match_up = match; + off_t match_dn = match; + while (match_up>=0 && sorted[match_up]>=maxstart && sorted[match_up]=maxstart && sorted[match_dn]=sortedlen) + { + if (match_up<0 && match_dn>=sortedlen) + { + *bestlen=0; + return 0; + } + off_t pos = sorted[match_up<0 ? match_dn : match_up]; + *bestlen = match_len(search, data+pos, min(searchlen, datalen-pos)); + return pos; + } + + return pick_best_of_two(search,searchlen, data,datalen, sorted[match_up],sorted[match_dn], bestlen); +} + + + +static uint16_t read2_uc(const uint8_t* data) +{ + return data[0]<<8 | data[1]; +} + +template +static uint16_t read2(const uint8_t* data, off_t len) +{ + if (len>=2) return read2_uc(data); + else + { + uint16_t out = (EOF_IS_LAST ? 0xFFFF : 0x0000); + if (len==1) out = (data[0]<<8) | (out&0x00FF); + return out; + } +} + +template +static void create_buckets(const uint8_t* data, off_t* index, off_t len, off_t* buckets) +{ + off_t low = 0; + off_t high; + + for (int n=0;n<65536;n++) + { + //'low' remains from the previous iteration and is a known minimum + high = low+(len/131072)+1; // optimal value: slightly above a third of the distance to the next one + while (true) + { + if (high > len-1) break; + + off_t pos = index[high]; + uint16_t here = read2(data+pos, len-pos); + + if (here >= n) break; + else + { + off_t diff = high-low; + low = high; + high = high+diff*2; + } + } + if (high > len-1) high = len-1; + + + while (low < high) + { + off_t mid = low + (high-low)/2; + off_t midpos = index[mid]; + + uint16_t here = read2(data+midpos, len-midpos); + if (here < n) low = mid+1; + else high = mid; + } + buckets[n] = low; + } + + buckets[65536] = len; + +#ifdef TEST_CORRECT + if (buckets[0]!=0) + { + printf("e: buckets suck, [0]=%i\n", buckets[0]); + abort(); + } + for (int n=0;n<65536;n++) + { + off_t low = buckets[n]; + off_t high = buckets[n+1]; + for (off_t i=low;i +static off_t find_index(off_t pos, const uint8_t* data, off_t datalen, const off_t* index, const off_t* reverse, off_t* buckets) +{ + if (reverse) return reverse[pos]; + + uint16_t bucket = read2(data+pos, datalen-pos); +//printf("p=%i b=%i\n",pos,bucket); + + off_t low = buckets[bucket]; + off_t high = buckets[bucket+1]-1; + + off_t lowmatch = 2; + off_t highmatch = 2; + +//printf("b=%i r=%i(%i)-%i(%i)\n",bucket,low,read2(data+index[low],datalen-index[low]),high,read2(data+index[high],datalen-index[high])); +//fflush(stdout); + while (true) + { + off_t mid = low + (high-low)/2; + off_t midpos = index[mid]; + if (midpos == pos) return mid; +//printf("r=[%i]%i-%i \n",high-low,low,high,); +//fflush(stdout); +#ifdef TEST_CORRECT + if (low >= high) + { + printf("E: [%i](%i): stuck at %i(%i)-%i(%i)\n", pos, read2_uc(data+pos), + low, read2_uc(data+index[low]), high, read2_uc(data+index[high])); + int n=0; + while (index[n]!=pos) n++; + printf("correct one is %i(%i)\n",n, read2_uc(data+index[n])); + abort(); + } +#endif + + off_t matchlenstart = min(lowmatch, highmatch); + + off_t len = datalen - max(pos, midpos) - matchlenstart; + + const uint8_t* search = data+pos+matchlenstart; + const uint8_t* here = data+midpos+matchlenstart; + + while (len>0 && *search==*here) + { + search++; + here++; + len--; + } + + off_t matchlen = search-data-pos; + + bool less; + if (len > 0) less = (*here<*search); + else less = (here > search) ^ EOF_IS_LAST; + + if (less) + { + low = mid+1; + lowmatch = matchlen; + } + else + { + high = mid-1; + highmatch = matchlen; + } + + if (low+256 > high) + { + off_t i=low; + while (true) + { + if (index[i]==pos) return i; + i++; + } + } + } +} + + +template +static void create_reverse_index(off_t* index, off_t* reverse, off_t len) +{ +//testcase: linux 3.18.14 -> 4.0.4 .xz +//without: real23.544 user32.930 +//with: real22.636 user40.168 +//'user' jumps up quite a lot, while 'real' only moves a short bit +//I'm not sure why the tradeoff is so bad (do the cachelines bounce THAT badly?), but I deem it not worth it. +//#pragma omp parallel for + for (off_t i=0;i +static off_t nextsize(off_t outpos, off_t sortedsize, off_t targetlen) +{ + while (outpos >= sortedsize-256 && sortedsize < targetlen) + sortedsize = min(sortedsize*4+3, targetlen); + return sortedsize; +} + +template +off_t lerp(off_t x, off_t y, float frac) +{ + return x + (y-x)*frac; +} + +template +static bpserror bps_create_suf_core(file* source, file* target, bool moremem, struct bps_creator * out) +{ +#define error(which) do { err = which; goto error; } while(0) + bpserror err; + + size_t realsourcelen = source->len(); + size_t realtargetlen = target->len(); + + size_t overflowtest = realsourcelen + realtargetlen; + + //source+target length is bigger than size_t (how did that manage to get allocated?) + if (overflowtest < realsourcelen) return bps_too_big; + + //source+target doesn't fit in unsigned off_t + if ((size_t)(off_t)overflowtest != overflowtest) return bps_too_big; + + //source+target doesn't fit in signed off_t + if ((off_t)overflowtest < 0) return bps_too_big; + + //the mallocs would overflow + if (realsourcelen+realtargetlen >= SIZE_MAX/sizeof(off_t)) return bps_too_big; + + if (realsourcelen+realtargetlen >= out->maxsize()) return bps_too_big; + + + off_t sourcelen = realsourcelen; + off_t targetlen = realtargetlen; + + uint8_t* mem_joined = (uint8_t*)malloc(sizeof(uint8_t)*(realsourcelen+realtargetlen)); + + off_t* sorted = (off_t*)malloc(sizeof(off_t)*(realsourcelen+realtargetlen)); + + off_t* sorted_inverse = NULL; + if (moremem) sorted_inverse = (off_t*)malloc(sizeof(off_t)*(realsourcelen+realtargetlen)); + + off_t* buckets = NULL; + if (!sorted_inverse) buckets = (off_t*)malloc(sizeof(off_t)*65537); + + if (!sorted || !mem_joined || (!sorted_inverse && !buckets)) + { + free(mem_joined); + free(sorted); + free(sorted_inverse); + free(buckets); + return bps_out_of_mem; + } + + //sortedsize is how much of the target file is sorted + off_t sortedsize = targetlen; + //divide by 4 for each iteration, to avoid sorting 50% of the file (the sorter is slow) + while (sortedsize/4 > sourcelen && sortedsize > 1024) sortedsize >>= 2; + + off_t prevsortedsize = 0; + off_t outpos = 0; + + goto reindex; // jump into the middle so I won't need a special case to enter it + + while (outpos < targetlen) + { + if (outpos >= sortedsize-256 && sortedsize < targetlen) + { + sortedsize = nextsize(outpos, sortedsize, targetlen); + + reindex: + + //this isn't an exact science + const float percSort = sorted_inverse ? 0.67 : 0.50; + const float percInv = sorted_inverse ? 0.11 : 0.10; + //const float percFind = sorted_inverse ? 0.22 : 0.40; // unused + + const size_t progPreSort = lerp(prevsortedsize, sortedsize, 0); + const size_t progPreInv = lerp(prevsortedsize, sortedsize, percSort); + const size_t progPreFind = lerp(prevsortedsize, sortedsize, percSort+percInv); + + prevsortedsize = sortedsize; + + if (!out->progress(progPreSort, targetlen)) error(bps_canceled); + + if (!target->read(mem_joined, 0, sortedsize)) error(bps_io); + if (!source->read(mem_joined+sortedsize, 0, sourcelen)) error(bps_io); + out->move_target(mem_joined); + sufsort(sorted, mem_joined, sortedsize+sourcelen); + + if (!out->progress(progPreInv, targetlen)) error(bps_canceled); + + if (sorted_inverse) + create_reverse_index(sorted, sorted_inverse, sortedsize+sourcelen); + else + create_buckets(mem_joined, sorted, sortedsize+sourcelen, buckets); + + if (!out->progress(progPreFind, targetlen)) error(bps_canceled); + } + + off_t matchlen = 0; + off_t matchpos = adjust_match(find_index(outpos, mem_joined, sortedsize+sourcelen, sorted, sorted_inverse, buckets), + mem_joined+outpos, sortedsize-outpos, + mem_joined,sortedsize+sourcelen, outpos,sortedsize, + sorted, sortedsize+sourcelen, + &matchlen); + +#ifdef TEST_CORRECT + if (matchlen && matchpos >= outpos && matchpos < sortedsize) puts("ERROR: found match in invalid location"),abort(); + if (memcmp(mem_joined+matchpos, mem_joined+outpos, matchlen)) puts("ERROR: found match doesn't match"),abort(); +#endif + + off_t taken; + if (matchpos >= sortedsize) taken = out->match(false, matchpos-sortedsize, matchlen); + else taken = out->match(true, matchpos, matchlen); +#ifdef TEST_CORRECT + if (taken < 0) puts("ERROR: match() returned negative"),abort(); + if (matchlen >= 7 && taken < matchlen) printf("ERROR: match() took %i bytes, offered %i\n", taken, matchlen),abort(); +#endif + outpos += taken; + } + + out->finish(mem_joined+sortedsize, mem_joined); + + err = bps_ok; + +error: + free(buckets); + free(sorted_inverse); + free(sorted); + free(mem_joined); + + return err; +} + + +//template static bpserror bps_create_suf_pick(file* source, file* target, bool moremem, struct bps_creator * bps); +//template<> bpserror bps_create_suf_pick(file* source, file* target, bool moremem, struct bps_creator * bps) +//{ +// return bps_create_suf_core(source, target, moremem, bps); +//} +//template<> bpserror bps_create_suf_pick(file* source, file* target, bool moremem, struct bps_creator * bps) +//{ +// bpserror err = bps_create_suf_core(source, target, moremem, bps); +// if (err==bps_too_big) err = bps_create_suf_core(source, target, moremem, bps); +// return err; +//} + +//This one picks a function based on 32-bit integers if that fits. This halves memory use for common inputs. +//It also handles some stuff related to the BPS headers and footers. +bpserror bps_create_delta(file* source, file* target, struct mem metadata, struct mem * patchmem, + bool (*progress)(void* userdata, size_t done, size_t total), void* userdata, bool moremem) +{ + bps_creator bps(source, target, metadata); + bps.setProgress(progress, userdata); + + size_t maindata = bps.outlen; + + //off_t must be signed + bpserror err = bps_create_suf_core(source, target, moremem, &bps); + if (err!=bps_ok) return err; + + *patchmem = bps.getpatch(); + + while ((patchmem->ptr[maindata]&0x80) == 0x00) maindata++; + if (maindata==patchmem->len-12-1) return bps_identical; + return bps_ok; +} + +enum bpserror bps_create_delta_inmem(struct mem source, struct mem target, struct mem metadata, struct mem * patch, + bool (*progress)(void* userdata, size_t done, size_t total), void* userdata, + bool moremem) +{ + class memfile : public file { + public: + const uint8_t * m_ptr; + size_t m_len; + + size_t len() { return m_len; } + bool read(uint8_t* target, size_t start, size_t len) { memcpy(target, m_ptr+start, len); return true; } + + memfile(const uint8_t * ptr, size_t len) : m_ptr(ptr), m_len(len) {} + }; + + memfile sourcef(source.ptr, source.len); + memfile targetf(target.ptr, target.len); + + return bps_create_delta(&sourcef, &targetf, metadata, patch, progress, userdata, moremem); +} + + + + +#ifdef BPS_STANDALONE +#include +static struct mem ReadWholeFile(const char * filename) +{ + struct mem null = {NULL, 0}; + + FILE * file=fopen(filename, "rb"); + if (!file) return null; + fseek(file, 0, SEEK_END); + size_t len=ftell(file); + fseek(file, 0, SEEK_SET); + unsigned char * data=(unsigned char*)malloc(len); + size_t truelen=fread(data, 1,len, file); + fclose(file); + if (len!=truelen) + { + free(data); + return null; + } + + struct mem ret = { (unsigned char*)data, len }; + return ret; +} +static bool WriteWholeFile(const char * filename, struct mem data) +{ + FILE * file=fopen(filename, "wb"); + if (!file) return false; + unsigned int truelen=fwrite(data.ptr, 1,data.len, file); + fclose(file); + return (truelen==data.len); +} +int main(int argc, char * argv[]) +{ +//struct mem out = ReadWholeFile(argv[2]); +//printf("check=%.8X\n",crc32(out.ptr, out.len)); + +struct mem in = ReadWholeFile(argv[1]); +struct mem out = ReadWholeFile(argv[2]); +struct mem null = {NULL, 0}; +struct mem p={NULL,0}; +//int n=50; +//for(int i=0;i//malloc, realloc, free +#include //memcpy, memset +#include //uint8_t, uint32_t +#include "crc32.h"//crc32 + +static uint32_t read32(uint8_t * ptr) +{ + uint32_t out; + out =ptr[0]; + out|=ptr[1]<<8; + out|=ptr[2]<<16; + out|=ptr[3]<<24; + return out; +} + +enum { SourceRead, TargetRead, SourceCopy, TargetCopy }; + +static bool try_add(size_t& a, size_t b) +{ + if (SIZE_MAX-a < b) return false; + a+=b; + return true; +} + +static bool try_shift(size_t& a, size_t b) +{ + if (SIZE_MAX>>b < a) return false; + a<<=b; + return true; +} + +static bool decodenum(const uint8_t*& ptr, size_t& out) +{ + out=0; + unsigned int shift=0; + while (true) + { + uint8_t next=*ptr++; + size_t addthis=(next&0x7F); + if (shift) addthis++; + if (!try_shift(addthis, shift)) return false; + // unchecked because if it was shifted, the lowest bit is zero, and if not, it's <=0x7F. + if (!try_add(out, addthis)) return false; + if (next&0x80) return true; + shift+=7; + } +} + +#define error(which) do { error=which; goto exit; } while(0) +#define assert_sum(a,b) do { if (SIZE_MAX-(a)<(b)) error(bps_too_big); } while(0) +#define assert_shift(a,b) do { if (SIZE_MAX>>(b)<(a)) error(bps_too_big); } while(0) +enum bpserror bps_apply(struct mem patch, struct mem in, struct mem * out, struct mem * metadata, bool accept_wrong_input) +{ + enum bpserror error = bps_ok; + out->len=0; + out->ptr=NULL; + if (metadata) + { + metadata->len=0; + metadata->ptr=NULL; + } + if (patch.len<4+3+12) return bps_broken; + + if (true) + { +#define read8() (*(patchat++)) +#define decodeto(var) \ + do { \ + if (!decodenum(patchat, var)) error(bps_too_big); \ + } while(false) +#define write8(byte) (*(outat++)=byte) + + const uint8_t * patchat=patch.ptr; + const uint8_t * patchend=patch.ptr+patch.len-12; + + if (read8()!='B') error(bps_broken); + if (read8()!='P') error(bps_broken); + if (read8()!='S') error(bps_broken); + if (read8()!='1') error(bps_broken); + + uint32_t crc_in_e = read32(patch.ptr+patch.len-12); + uint32_t crc_out_e = read32(patch.ptr+patch.len-8); + uint32_t crc_patch_e = read32(patch.ptr+patch.len-4); + + uint32_t crc_in_a = crc32(in.ptr, in.len); + uint32_t crc_patch_a = crc32(patch.ptr, patch.len-4); + + if (crc_patch_a != crc_patch_e) error(bps_broken); + + size_t inlen; + decodeto(inlen); + + size_t outlen; + decodeto(outlen); + + if (inlen!=in.len || crc_in_a!=crc_in_e) + { + if (in.len==outlen && crc_in_a==crc_out_e) error=bps_to_output; + else error=bps_not_this; + if (!accept_wrong_input) goto exit; + } + + out->len=outlen; + out->ptr=(uint8_t*)malloc(outlen); + + const uint8_t * instart=in.ptr; + const uint8_t * inreadat=in.ptr; + const uint8_t * inend=in.ptr+in.len; + + uint8_t * outstart=out->ptr; + uint8_t * outreadat=out->ptr; + uint8_t * outat=out->ptr; + uint8_t * outend=out->ptr+out->len; + + size_t metadatalen; + decodeto(metadatalen); + + if (metadata && metadatalen) + { + metadata->len=metadatalen; + metadata->ptr=(uint8_t*)malloc(metadatalen+1); + for (size_t i=0;iptr[i]=read8(); + metadata->ptr[metadatalen]='\0';//just to be on the safe side - that metadata is assumed to be text, might as well terminate it + } + else + { + for (size_t i=0;i>2)+1; + int action=(thisinstr&3); + if (outat+length>outend) error(bps_broken); + + switch (action) + { + case SourceRead: + { + if (outat-outstart+length > in.len) error(bps_broken); + for (size_t i=0;ipatchend) error(bps_broken); + for (size_t i=0;i>1; + if ((encodeddistance&1)==0) inreadat+=distance; + else inreadat-=distance; + + if (inreadatinend) error(bps_broken); + for (size_t i=0;i>1; + if ((encodeddistance&1)==0) outreadat+=distance; + else outreadat-=distance; + + if (outreadat=outat || outreadat+length>outend) error(bps_broken); + for (size_t i=0;iptr, out->len); + + if (crc_out_a!=crc_out_e) + { + error=bps_not_this; + if (!accept_wrong_input) goto exit; + } + return error; +#undef read8 +#undef decodeto +#undef write8 + } + +exit: + free(out->ptr); + out->len=0; + out->ptr=NULL; + if (metadata) + { + free(metadata->ptr); + metadata->len=0; + metadata->ptr=NULL; + } + return error; +} + + + +#define write(val) \ + do { \ + out[outlen++]=(val); \ + if (outlen==outbuflen) \ + { \ + outbuflen*=2; \ + uint8_t* newout=(uint8_t*)realloc(out, outbuflen); \ + if (!newout) { free(out); return bps_out_of_mem; } \ + out=newout; \ + } \ + } while(0) +#define write32(val) \ + do { \ + uint32_t tmp=(val); \ + write(tmp); \ + write(tmp>>8); \ + write(tmp>>16); \ + write(tmp>>24); \ + } while(0) +#define writenum(val) \ + do { \ + size_t tmpval=(val); \ + while (true) \ + { \ + uint8_t tmpbyte=(tmpval&0x7F); \ + tmpval>>=7; \ + if (!tmpval) \ + { \ + write(tmpbyte|0x80); \ + break; \ + } \ + write(tmpbyte); \ + tmpval--; \ + } \ + } while(0) + +enum bpserror bps_create_linear(struct mem sourcemem, struct mem targetmem, struct mem metadata, struct mem * patchmem) +{ + if (sourcemem.len>=(SIZE_MAX>>2) - 16) return bps_too_big;//the 16 is just to be on the safe side, I don't think it's needed. + if (targetmem.len>=(SIZE_MAX>>2) - 16) return bps_too_big; + + const uint8_t * source=sourcemem.ptr; + const uint8_t * sourceend=sourcemem.ptr+sourcemem.len; + if (sourcemem.len>targetmem.len) sourceend=sourcemem.ptr+targetmem.len; + const uint8_t * targetbegin=targetmem.ptr; + const uint8_t * target=targetmem.ptr; + const uint8_t * targetend=targetmem.ptr+targetmem.len; + + const uint8_t * targetcopypos=targetbegin; + + size_t outbuflen=4096; + uint8_t * out=(uint8_t*)malloc(outbuflen); + if (!out) return bps_out_of_mem; + size_t outlen=0; + write('B'); + write('P'); + write('S'); + write('1'); + writenum(sourcemem.len); + writenum(targetmem.len); + writenum(metadata.len); + for (size_t i=0;i1 || numunchanged == (uintptr_t)(targetend-target)) + { + //assert_shift((numunchanged-1), 2); + writenum((numunchanged-1)<<2 | 0);//SourceRead + source+=numunchanged; + target+=numunchanged; + } + + size_t numchanged=0; + if (lastknownchange>target) numchanged=lastknownchange-target; + while ((source+numchanged>=sourceend || + source[numchanged]!=target[numchanged] || + source[numchanged+1]!=target[numchanged+1] || + source[numchanged+2]!=target[numchanged+2]) && + target+numchanged=sourceend) numchanged=targetend-target; + } + lastknownchange=target+numchanged; + if (numchanged) + { + //assert_shift((numchanged-1), 2); + size_t rle1start=(target==targetbegin); + while (true) + { + if ( + target[rle1start-1]==target[rle1start+0] && + target[rle1start+0]==target[rle1start+1] && + target[rle1start+1]==target[rle1start+2] && + target[rle1start+2]==target[rle1start+3]) + { + numchanged=rle1start; + break; + } + if ( + target[rle1start-2]==target[rle1start+0] && + target[rle1start-1]==target[rle1start+1] && + target[rle1start+0]==target[rle1start+2] && + target[rle1start+1]==target[rle1start+3] && + target[rle1start+2]==target[rle1start+4]) + { + numchanged=rle1start; + break; + } + if (rle1start+3>=numchanged) break; + rle1start++; + } + if (numchanged) + { + writenum((numchanged-1)<<2 | TargetRead); + for (size_t i=0;iptr=out; + patchmem->len=outlen; + + //while this may look like it can be fooled by a patch containing exactly one of any other command, it + // can't, because the ones that aren't SourceRead requires an argument + size_t i; + for (i=mainContentPos;(out[i]&0x80)==0x00;i++) {} + if (i==outlen-12-1) return bps_identical; + + return bps_ok; +} + +#undef write_nocrc +#undef write +#undef writenum + +void bps_free(struct mem mem) +{ + free(mem.ptr); +} +#undef error + + + +struct bpsinfo bps_get_info(file* patch, bool changefrac) +{ +#define error(why) do { ret.error=why; return ret; } while(0) + struct bpsinfo ret; + size_t len = patch->len(); + if (len<4+3+12) error(bps_broken); + + uint8_t top[256]; + if (!patch->read(top, 0, len>256 ? 256 : len)) error(bps_io); + if (memcmp(top, "BPS1", 4)) error(bps_broken); + + const uint8_t* patchdat=top+4; + if (!decodenum(patchdat, ret.size_in)) error(bps_too_big); + if (!decodenum(patchdat, ret.size_out)) error(bps_too_big); + + if (!decodenum(patchdat, ret.meta_size)) error(bps_too_big); + ret.meta_start = patchdat - top; + + uint8_t checksums[12]; + if (!patch->read(checksums, len-12, 12)) error(bps_io); + ret.crc_in = read32(checksums+0); + ret.crc_out = read32(checksums+4); + ret.crc_patch=read32(checksums+8); + + if (changefrac && ret.size_in>0) + { + //algorithm: each command adds its length to the numerator, unless it's above 32, in which case + // it adds 32; or if it's SourceRead, in which case it adds 0 + //denominator is just input length + uint8_t* patchbin=(uint8_t*)malloc(len); + patch->read(patchbin, 0, len); + size_t outpos=0; // position in the output file + size_t changeamt=0; // change score + const uint8_t* patchat=patchbin+(patchdat-top); + + size_t metasize; + if (!decodenum(patchat, metasize)) error(bps_too_big); + patchat+=metasize; + + const uint8_t* patchend=patchbin+len-12; + + while (patchat>2)+1; + int action=(thisinstr&3); + int min_len_32 = (length<32 ? length : 32); + + switch (action) + { + case SourceRead: + { + changeamt+=0; + } + break; + case TargetRead: + { + changeamt+=min_len_32; + patchat+=length; + } + break; + case SourceCopy: + case TargetCopy: + { + changeamt+=min_len_32; + size_t ignore; + decodenum(patchat, ignore); + } + break; + } + outpos+=length; + } + if (patchat>patchend || outpos>ret.size_out) error(bps_broken); + ret.change_num = (changeamt + +#ifdef _WIN32 +# ifdef _WIN64 +# ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wformat" +# endif +# define z "I" +# else +# define z "" +# endif +#else +# define z "z" +#endif + +void bps_disassemble(struct mem patch, FILE* out) +{ +#define read8() (*(patchat++)) +#define decodeto(var) decodenum(patchat, var) + const uint8_t * patchat=patch.ptr; + const uint8_t * patchend=patch.ptr+patch.len-12; + + if (read8() != 'B' || read8() != 'P' || read8() != 'S' || read8() != '1') + { + fprintf(out, "Not a BPS patch\n"); + return; + } + + size_t inreadat = 0; + size_t inlen; + decodeto(inlen); + + size_t outat = 0; + size_t outreadat = 0; + size_t outlen; + decodeto(outlen); + + size_t metadatalen; + decodeto(metadatalen); + + patchat += metadatalen; + + while (patchat>2)+1; + int action=(thisinstr&3); + + switch (action) + { + case SourceRead: + { + fprintf(out, "SourceRead %" z "u from %" z "u to %" z "u\n", length, outat, outat); + outat += length; + } + break; + case TargetRead: + { + fprintf(out, "TargetRead %" z "u to %" z "u\n", length, outat); + patchat += length; + outat += length; + } + break; + case SourceCopy: + { + size_t encodeddistance; + decodeto(encodeddistance); + size_t distance=encodeddistance>>1; + if ((encodeddistance&1)==0) inreadat+=distance; + else inreadat-=distance; + + fprintf(out, "SourceCopy %" z "u from %" z "u to %" z "u (rel %+" z "i)\n", length, inreadat, outat, inreadat-outat); + inreadat += length; + outat += length; + } + break; + case TargetCopy: + { + size_t encodeddistance; + decodeto(encodeddistance); + size_t distance=encodeddistance>>1; + if ((encodeddistance&1)==0) outreadat+=distance; + else outreadat-=distance; + + fprintf(out, "TargetCopy %" z "u from %" z "u to %" z "u (rel %+" z "i)\n", length, outreadat, outat, outreadat-outat); + outreadat += length; + outat += length; + } + break; + } + } + + if (patchat != patchend) + fprintf(out, "WARNING: patch pointer at %" z "u != %" z "u, corrupt patch?\n", patchat-patch.ptr, patchend-patch.ptr); + if (outat != outlen) + fprintf(out, "WARNING: output pointer at %" z "u != %" z "u, corrupt patch?\n", outat, outlen); +#undef read8 +#undef decodeto +} + + +#ifdef BPS_DEBUG +#warning Disable this in release versions. + +//Congratulations, you found the undocumented feature! It compares two equivalent BPS patches and tells where each one is more compact. +//It will crash or otherwise misbehave on invalid or non-equivalent patches. +//Have fun. +void bps_compare(struct mem patch1mem, struct mem patch2mem) +{ + const uint8_t * patch[2]={patch1mem.ptr, patch2mem.ptr}; + size_t patchpos[2]={0,0}; + size_t patchlen[2]={patch1mem.len-12, patch2mem.len-12}; + size_t patchoutpos[2]={0,0}; + + size_t patchcopypos[2][4]={0,0};//[0] and [1] are unused, but this is just debug code, it doesn't need to be neat. + +#define read8(id) (patch[id][patchpos[id]++]) +#define decodeto(id, var) \ + do { \ + var=0; \ + int shift=0; \ + while (true) \ + { \ + uint8_t next=read8(id); \ + size_t addthis=(next&0x7F)<=patchoutpos[1])}; + char describe[2][256]; + for (int i=0;i<2;i++) + { + if (step[i]) + { + size_t patchposstart=patchpos[i]; + decodeto(i, tempuint); + size_t len=(tempuint>>2)+1; + patchoutpos[i]+=len; + int action=(tempuint&3); +//enum { SourceRead, TargetRead, SourceCopy, TargetCopy }; + const char * actionnames[]={"SourceRead", "TargetRead", "SourceCopy", "TargetCopy"}; + if (action==TargetRead) patchpos[i]+=len; + if (action==SourceCopy || action==TargetCopy) + { + decodeto(i, tempuint); + int delta = tempuint>>1; + if (tempuint&1) delta=-delta; + patchcopypos[i][action]+=delta; + sprintf(describe[i], "%s from %zu (%+i) for %zu in %zu", actionnames[action], patchcopypos[i][action], delta, len, patchpos[i]-patchposstart); + patchcopypos[i][action]+=len; + } + else sprintf(describe[i], "%s from %zu for %zu in %zu", actionnames[action], patchoutpos[i], len, patchpos[i]-patchposstart); + if (!step[i^1]) + { + printf("%i: %s\n", i+1, describe[i]); + show=true; + } + } + } + if (step[0] && step[1]) + { + if (!strcmp(describe[0], describe[1])) /*printf("3: %s\n", describe[0])*/; + else + { + printf("1: %s\n2: %s\n", describe[0], describe[1]); + show=true; + } + } + if (patchoutpos[0]==patchoutpos[1]) + { + size_t used[2]={patchpos[0]-patchposatmatch[0], patchpos[1]-patchposatmatch[1]}; + char which='='; + if (used[0]used[1]) which='-'; + if (show) + { + printf("%c: %zu,%zu bytes since last match (%zu)\n", which, used[0], used[1], patchoutpos[0]); + show=false; + } + patchposatmatch[0]=patchpos[0]; + patchposatmatch[1]=patchpos[1]; + lastmatch=patchoutpos[0]; + } + } +#undef read8 +#undef decodeto +} + +static struct mem ReadWholeFile(const char * filename) +{ + struct mem null = {NULL, 0}; + + FILE * file=fopen(filename, "rb"); + if (!file) return null; + fseek(file, 0, SEEK_END); + size_t len=ftell(file); + fseek(file, 0, SEEK_SET); + unsigned char * data=(unsigned char*)malloc(len); + size_t truelen=fread(data, 1,len, file); + fclose(file); + if (len!=truelen) + { + free(data); + return null; + } + + struct mem ret = { (unsigned char*)data, len }; + return ret; +} + +int main(int argc,char**argv) +{ + if (argc==1) puts("bad arguments"); + if (argc==2) bps_dump(ReadWholeFile(argv[1])); + if (argc==3) bps_compare(ReadWholeFile(argv[1]),ReadWholeFile(argv[2])); +} +#endif diff --git a/tools/Flips/libbps.h b/tools/Flips/libbps.h new file mode 100644 index 000000000..db386b341 --- /dev/null +++ b/tools/Flips/libbps.h @@ -0,0 +1,108 @@ +//Module name: libbps +//Author: Alcaro +//Date: November 30, 2015 +//Licence: GPL v3.0 or higher + +#include "global.h" +#include +#include + +#ifndef __cplusplus +#include //bool; if this file does not exist (hi msvc), remove it and uncomment the following three lines. +//#define bool int +//#define true 1 +//#define false 0 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +enum bpserror { + bps_ok,//Patch applied or created successfully. + + bps_to_output,//You attempted to apply a patch to its output. + bps_not_this, //This is not the intended input file for this patch. + bps_broken, //This is not a BPS patch, or it's malformed somehow. + bps_io, //The patch could not be read. + + bps_identical, //The input files are identical. + bps_too_big, //Somehow, you're asking for something a size_t can't represent. + bps_out_of_mem,//Memory allocation failure. + bps_canceled, //The callback returned false. + + bps_shut_up_gcc//This one isn't used, it's just to kill a stray comma warning. +}; + +//Applies the given BPS patch to the given ROM and puts it in 'out'. Metadata, if present and +// requested ('metadata'!=NULL), is also returned. Send both to bps_free when you're done with them. +//If accept_wrong_input is true, it may return bps_to_output or bps_not_this, while putting non-NULL in out/metadata. +enum bpserror bps_apply(struct mem patch, struct mem in, struct mem * out, struct mem * metadata, bool accept_wrong_input); + +//Creates a BPS patch that converts source to target and stores it to patch. It is safe to give +// {NULL,0} as metadata. +enum bpserror bps_create_linear(struct mem source, struct mem target, struct mem metadata, struct mem * patch); + +#ifdef __cplusplus // TODO: make this functionality available from C and C-ABI-only languages +//Very similar to bps_create_linear; the difference is that this one takes longer to run, but +// generates smaller patches. +//Because it can take much longer, a progress meter is supplied; total is guaranteed to be constant +// between every call until this function returns, done is guaranteed to increase between each +// call, and done/total is an approximate percentage counter. Anything else is undefined; for +// example, progress may or may not be called for done=0, progress may or may not be called for +// done=total, done may or may not increase by the same amount between each call, and the duration +// between each call may or may not be constant. +//To cancel the patch creation, return false from the callback. +//It is safe to pass in NULL for the progress indicator if you're not interested. If the callback is +// NULL, it can obviously not be canceled that way (though if it's a CLI program, you can always +// Ctrl-C it). +//The 'moremem' flag makes it use about twice as much memory (9*(source+target) instead of 5*), but is usually slightly faster. +enum bpserror bps_create_delta(file* source, file* target, struct mem metadata, struct mem * patch, + bool (*progress)(void* userdata, size_t done, size_t total), void* userdata, + bool moremem); +#endif + +//Like the above, but takes struct mem rather than file*. Better use the above if possible, the +// creator takes 5*(source+target) in addition to whatever the source/target arguments need. +enum bpserror bps_create_delta_inmem(struct mem source, struct mem target, struct mem metadata, struct mem * patch, + bool (*progress)(void* userdata, size_t done, size_t total), void* userdata, + bool moremem); + +//Frees the memory returned in the output parameters of the above. Do not call it twice on the same +// input, nor on anything you got from anywhere else. bps_free is guaranteed to be equivalent to +// calling stdlib.h's free() on mem.ptr. +void bps_free(struct mem mem); + +#ifdef __cplusplus +struct bpsinfo { + enum bpserror error; // If this is not bps_ok, all other values are undefined. + + size_t size_in; + size_t size_out; + + uint32_t crc_in; + uint32_t crc_out; + uint32_t crc_patch; + + size_t meta_start; + size_t meta_size; + + //Tells approximately how much of the input ROM is changed compared to the output ROM. + //It's quite heuristic. The algorithm may change with or without notice. + //As of writing, I believe this is accurate to 2 significant digits in base 10. + //It's also more expensive to calculate than the other data, so it's optional. + //If you don't want it, their values are undefined. + //The denominator is always guaranteed nonzero, even if something else says it's undefined. + //Note that this can return success for invalid patches. + size_t change_num; + size_t change_denom; +}; +struct bpsinfo bps_get_info(file* patch, bool changefrac); +#endif + +#include +void bps_disassemble(struct mem patch, FILE* out); + +#ifdef __cplusplus +} +#endif diff --git a/tools/Flips/libdivsufsort-2.0.1/AUTHORS b/tools/Flips/libdivsufsort-2.0.1/AUTHORS new file mode 100644 index 000000000..1154fe9fa --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/AUTHORS @@ -0,0 +1,3 @@ +-- AUTHORS for libdivsufsort + +Yuta Mori diff --git a/tools/Flips/libdivsufsort-2.0.1/CMakeModules/AppendCompilerFlags.cmake b/tools/Flips/libdivsufsort-2.0.1/CMakeModules/AppendCompilerFlags.cmake new file mode 100644 index 000000000..58d3f99ec --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/CMakeModules/AppendCompilerFlags.cmake @@ -0,0 +1,38 @@ +include(CheckCSourceCompiles) +include(CheckCXXSourceCompiles) + +macro(append_c_compiler_flags _flags _name _result) + set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + string(REGEX REPLACE "[-+/ ]" "_" cname "${_name}") + string(TOUPPER "${cname}" cname) + foreach(flag ${_flags}) + string(REGEX REPLACE "^[-+/ ]+(.*)[-+/ ]*$" "\\1" flagname "${flag}") + string(REGEX REPLACE "[-+/ ]" "_" flagname "${flagname}") + string(TOUPPER "${flagname}" flagname) + set(have_flag "HAVE_${cname}_${flagname}") + set(CMAKE_REQUIRED_FLAGS "${flag}") + check_c_source_compiles("int main() { return 0; }" ${have_flag}) + if(${have_flag}) + set(${_result} "${${_result}} ${flag}") + endif(${have_flag}) + endforeach(flag) + set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS}) +endmacro(append_c_compiler_flags) + +macro(append_cxx_compiler_flags _flags _name _result) + set(SAFE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) + string(REGEX REPLACE "[-+/ ]" "_" cname "${_name}") + string(TOUPPER "${cname}" cname) + foreach(flag ${_flags}) + string(REGEX REPLACE "^[-+/ ]+(.*)[-+/ ]*$" "\\1" flagname "${flag}") + string(REGEX REPLACE "[-+/ ]" "_" flagname "${flagname}") + string(TOUPPER "${flagname}" flagname) + set(have_flag "HAVE_${cname}_${flagname}") + set(CMAKE_REQUIRED_FLAGS "${flag}") + check_cxx_source_compiles("int main() { return 0; }" ${have_flag}) + if(${have_flag}) + set(${_result} "${${_result}} ${flag}") + endif(${have_flag}) + endforeach(flag) + set(CMAKE_REQUIRED_FLAGS ${SAFE_CMAKE_REQUIRED_FLAGS}) +endmacro(append_cxx_compiler_flags) diff --git a/tools/Flips/libdivsufsort-2.0.1/CMakeModules/CheckFunctionKeywords.cmake b/tools/Flips/libdivsufsort-2.0.1/CMakeModules/CheckFunctionKeywords.cmake new file mode 100644 index 000000000..44601fd4e --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/CMakeModules/CheckFunctionKeywords.cmake @@ -0,0 +1,15 @@ +include(CheckCSourceCompiles) + +macro(check_function_keywords _wordlist) + set(${_result} "") + foreach(flag ${_wordlist}) + string(REGEX REPLACE "[-+/ ()]" "_" flagname "${flag}") + string(TOUPPER "${flagname}" flagname) + set(have_flag "HAVE_${flagname}") + check_c_source_compiles("${flag} void func(); void func() { } int main() { func(); return 0; }" ${have_flag}) + if(${have_flag} AND NOT ${_result}) + set(${_result} "${flag}") +# break() + endif(${have_flag} AND NOT ${_result}) + endforeach(flag) +endmacro(check_function_keywords) diff --git a/tools/Flips/libdivsufsort-2.0.1/CMakeModules/CheckLFS.cmake b/tools/Flips/libdivsufsort-2.0.1/CMakeModules/CheckLFS.cmake new file mode 100644 index 000000000..e2b009914 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/CMakeModules/CheckLFS.cmake @@ -0,0 +1,109 @@ +## Checks for large file support ## +include(CheckIncludeFile) +include(CheckSymbolExists) +include(CheckTypeSize) + +macro(check_lfs _isenable) + set(LFS_OFF_T "") + set(LFS_FOPEN "") + set(LFS_FSEEK "") + set(LFS_FTELL "") + set(LFS_PRID "") + + if(${_isenable}) + set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + -D_LARGEFILE_SOURCE -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 + -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS) + + check_include_file("sys/types.h" HAVE_SYS_TYPES_H) + check_include_file("inttypes.h" HAVE_INTTYPES_H) + check_include_file("stddef.h" HAVE_STDDEF_H) + check_include_file("stdint.h" HAVE_STDINT_H) + + # LFS type1: 8 <= sizeof(off_t), fseeko, ftello + check_type_size("off_t" SIZEOF_OFF_T) + if(SIZEOF_OFF_T GREATER 7) + check_symbol_exists("fseeko" "stdio.h" HAVE_FSEEKO) + check_symbol_exists("ftello" "stdio.h" HAVE_FTELLO) + if(HAVE_FSEEKO AND HAVE_FTELLO) + set(LFS_OFF_T "off_t") + set(LFS_FOPEN "fopen") + set(LFS_FSEEK "fseeko") + set(LFS_FTELL "ftello") + check_symbol_exists("PRIdMAX" "inttypes.h" HAVE_PRIDMAX) + if(HAVE_PRIDMAX) + set(LFS_PRID "PRIdMAX") + else(HAVE_PRIDMAX) + check_type_size("long" SIZEOF_LONG) + check_type_size("int" SIZEOF_INT) + if(SIZEOF_OFF_T GREATER SIZEOF_LONG) + set(LFS_PRID "\"lld\"") + elseif(SIZEOF_LONG GREATER SIZEOF_INT) + set(LFS_PRID "\"ld\"") + else(SIZEOF_OFF_T GREATER SIZEOF_LONG) + set(LFS_PRID "\"d\"") + endif(SIZEOF_OFF_T GREATER SIZEOF_LONG) + endif(HAVE_PRIDMAX) + endif(HAVE_FSEEKO AND HAVE_FTELLO) + endif(SIZEOF_OFF_T GREATER 7) + + # LFS type2: 8 <= sizeof(off64_t), fopen64, fseeko64, ftello64 + if(NOT LFS_OFF_T) + check_type_size("off64_t" SIZEOF_OFF64_T) + if(SIZEOF_OFF64_T GREATER 7) + check_symbol_exists("fopen64" "stdio.h" HAVE_FOPEN64) + check_symbol_exists("fseeko64" "stdio.h" HAVE_FSEEKO64) + check_symbol_exists("ftello64" "stdio.h" HAVE_FTELLO64) + if(HAVE_FOPEN64 AND HAVE_FSEEKO64 AND HAVE_FTELLO64) + set(LFS_OFF_T "off64_t") + set(LFS_FOPEN "fopen64") + set(LFS_FSEEK "fseeko64") + set(LFS_FTELL "ftello64") + check_symbol_exists("PRIdMAX" "inttypes.h" HAVE_PRIDMAX) + if(HAVE_PRIDMAX) + set(LFS_PRID "PRIdMAX") + else(HAVE_PRIDMAX) + check_type_size("long" SIZEOF_LONG) + check_type_size("int" SIZEOF_INT) + if(SIZEOF_OFF64_T GREATER SIZEOF_LONG) + set(LFS_PRID "\"lld\"") + elseif(SIZEOF_LONG GREATER SIZEOF_INT) + set(LFS_PRID "\"ld\"") + else(SIZEOF_OFF64_T GREATER SIZEOF_LONG) + set(LFS_PRID "\"d\"") + endif(SIZEOF_OFF64_T GREATER SIZEOF_LONG) + endif(HAVE_PRIDMAX) + endif(HAVE_FOPEN64 AND HAVE_FSEEKO64 AND HAVE_FTELLO64) + endif(SIZEOF_OFF64_T GREATER 7) + endif(NOT LFS_OFF_T) + + # LFS type3: 8 <= sizeof(__int64), _fseeki64, _ftelli64 + if(NOT LFS_OFF_T) + check_type_size("__int64" SIZEOF___INT64) + if(SIZEOF___INT64 GREATER 7) + check_symbol_exists("_fseeki64" "stdio.h" HAVE__FSEEKI64) + check_symbol_exists("_ftelli64" "stdio.h" HAVE__FTELLI64) + if(HAVE__FSEEKI64 AND HAVE__FTELLI64) + set(LFS_OFF_T "__int64") + set(LFS_FOPEN "fopen") + set(LFS_FSEEK "_fseeki64") + set(LFS_FTELL "_ftelli64") + set(LFS_PRID "\"I64d\"") + endif(HAVE__FSEEKI64 AND HAVE__FTELLI64) + endif(SIZEOF___INT64 GREATER 7) + endif(NOT LFS_OFF_T) + + set(CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") + endif(${_isenable}) + + if(NOT LFS_OFF_T) + ## not found + set(LFS_OFF_T "long") + set(LFS_FOPEN "fopen") + set(LFS_FSEEK "fseek") + set(LFS_FTELL "ftell") + set(LFS_PRID "\"ld\"") + endif(NOT LFS_OFF_T) + +endmacro(check_lfs) diff --git a/tools/Flips/libdivsufsort-2.0.1/CMakeModules/ProjectCPack.cmake b/tools/Flips/libdivsufsort-2.0.1/CMakeModules/ProjectCPack.cmake new file mode 100644 index 000000000..35694b1de --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/CMakeModules/ProjectCPack.cmake @@ -0,0 +1,38 @@ +# If the cmake version includes cpack, use it +IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}") + SET(CPACK_PACKAGE_VENDOR "${PROJECT_VENDOR}") + SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") + SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") + SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") + SET(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") + SET(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") +# SET(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${PROJECT_VERSION}") + SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION_FULL}") + + IF(NOT DEFINED CPACK_SYSTEM_NAME) + SET(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") + ENDIF(NOT DEFINED CPACK_SYSTEM_NAME) + + IF(${CPACK_SYSTEM_NAME} MATCHES Windows) + IF(CMAKE_CL_64) + SET(CPACK_SYSTEM_NAME win64-${CMAKE_SYSTEM_PROCESSOR}) + ELSE(CMAKE_CL_64) + SET(CPACK_SYSTEM_NAME win32-${CMAKE_SYSTEM_PROCESSOR}) + ENDIF(CMAKE_CL_64) + ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows) + + IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME) + SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}") + ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME) + + SET(CPACK_PACKAGE_CONTACT "${PROJECT_CONTACT}") + IF(UNIX) + SET(CPACK_STRIP_FILES "") + SET(CPACK_SOURCE_STRIP_FILES "") +# SET(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake") + ENDIF(UNIX) + SET(CPACK_SOURCE_IGNORE_FILES "/CVS/" "/build/" "/\\\\.build/" "/\\\\.svn/" "~$") + # include CPack model once all variables are set + INCLUDE(CPack) +ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") diff --git a/tools/Flips/libdivsufsort-2.0.1/CMakeModules/cmake_uninstall.cmake.in b/tools/Flips/libdivsufsort-2.0.1/CMakeModules/cmake_uninstall.cmake.in new file mode 100644 index 000000000..8366a8353 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/CMakeModules/cmake_uninstall.cmake.in @@ -0,0 +1,36 @@ +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") + +SET(NUM 0) +FOREACH(file ${files}) + IF(EXISTS "$ENV{DESTDIR}${file}") + MESSAGE(STATUS "Looking for \"$ENV{DESTDIR}${file}\" - found") + SET(UNINSTALL_CHECK_${NUM} 1) + ELSE(EXISTS "$ENV{DESTDIR}${file}") + MESSAGE(STATUS "Looking for \"$ENV{DESTDIR}${file}\" - not found") + SET(UNINSTALL_CHECK_${NUM} 0) + ENDIF(EXISTS "$ENV{DESTDIR}${file}") + MATH(EXPR NUM "1 + ${NUM}") +ENDFOREACH(file) + +SET(NUM 0) +FOREACH(file ${files}) + IF(${UNINSTALL_CHECK_${NUM}}) + MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF(NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF(NOT "${rm_retval}" STREQUAL 0) + ENDIF(${UNINSTALL_CHECK_${NUM}}) + MATH(EXPR NUM "1 + ${NUM}") +ENDFOREACH(file) + +FILE(REMOVE "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") diff --git a/tools/Flips/libdivsufsort-2.0.1/COPYING b/tools/Flips/libdivsufsort-2.0.1/COPYING new file mode 100644 index 000000000..a0a64324d --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/COPYING @@ -0,0 +1,27 @@ +The libdivsufsort copyright is as follows: + +Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +See also the libdivsufsort web site: + http://libdivsufsort.googlecode.com/ for more information. diff --git a/tools/Flips/libdivsufsort-2.0.1/ChangeLog b/tools/Flips/libdivsufsort-2.0.1/ChangeLog new file mode 100644 index 000000000..17044e018 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/ChangeLog @@ -0,0 +1,329 @@ +2010-11-11 Yuta Mori + Changed paths: + M /trunk/CMakeLists.txt + M /trunk/include/CMakeLists.txt + + Fixed some bugs in CMakeLists.txt. + +2008-08-24 Yuta Mori + Changed paths: + M /trunk/lib/divsufsort.c + + bug fix in divbwt. + +2008-08-23 Yuta Mori + Changed paths: + M /trunk/INSTALL + M /trunk/NEWS + M /trunk/README + M /trunk/include/divsufsort.h.cmake + M /trunk/pkgconfig/CMakeLists.txt + M /trunk/pkgconfig/libdivsufsort.pc.cmake + + Update files for 2.0.0. + +2008-08-23 Yuta Mori + Changed paths: + M /trunk/examples/sasearch.c + M /trunk/lib/sssort.c + + A few bug fixes. + +2008-07-28 Yuta Mori + Changed paths: + M /trunk/CMakeLists.txt + M /trunk/include/CMakeLists.txt + M /trunk/include/divsufsort.h.cmake + M /trunk/include/divsufsort_private.h + M /trunk/lib/CMakeLists.txt + M /trunk/lib/divsufsort.c + M /trunk/lib/trsort.c + M /trunk/lib/utils.c + M /trunk/pkgconfig/CMakeLists.txt + M /trunk/pkgconfig/libdivsufsort.pc.cmake + + Added 64-bit version of divsufsort. + +2008-07-19 Yuta Mori + Changed paths: + M /trunk/include/divsufsort_private.h + M /trunk/lib/sssort.c + + Fixed integer overflow in ss_isqrt(). + +2008-07-14 Yuta Mori + Changed paths: + M /trunk/examples/mksary.c + M /trunk/examples/sasearch.c + M /trunk/examples/suftest.c + M /trunk/examples/unbwt.c + + Rewrote examples. + +2008-07-13 Yuta Mori + Changed paths: + M /trunk/examples/bwt.c + + Rewrote bwt.c. + +2008-07-13 Yuta Mori + Changed paths: + A /trunk/CMakeModules/CheckLFS.cmake + A /trunk/include/lfs.h.cmake + + Added files... + +2008-07-13 Yuta Mori + Changed paths: + M /trunk/CMakeLists.txt + M /trunk/include/CMakeLists.txt + M /trunk/include/config.h.cmake + + Added LFS (Large File Support) files. + +2008-07-11 Yuta Mori + Changed paths: + M /trunk/CMakeLists.txt + + Fix version number. + +2008-07-11 Yuta Mori + Changed paths: + M /trunk/CMakeLists.txt + A /trunk/CMakeModules/ProjectCPack.cmake + M /trunk/COPYING + M /trunk/examples/bwt.c + M /trunk/examples/mksary.c + M /trunk/examples/sasearch.c + M /trunk/examples/suftest.c + M /trunk/examples/unbwt.c + M /trunk/include/config.h.cmake + M /trunk/include/divsufsort.h.cmake + M /trunk/include/divsufsort_private.h + M /trunk/lib/CMakeLists.txt + M /trunk/lib/divsufsort.c + A /trunk/lib/sssort.c (from /trunk/lib/substringsort.c:5) + D /trunk/lib/substringsort.c + M /trunk/lib/trsort.c + M /trunk/lib/utils.c + A /trunk/pkgconfig + A /trunk/pkgconfig/CMakeLists.txt + A /trunk/pkgconfig/libdivsufsort.pc.cmake + + Major rewrite of libdivsufsort. + Added CPack support to create the source package. + Added OpenMP support for sssort. + +2008-07-03 Yuta Mori + Changed paths: + A /trunk/CMakeLists.txt + A /trunk/CMakeModules + A /trunk/CMakeModules/AppendCompilerFlags.cmake + A /trunk/CMakeModules/CheckFunctionKeywords.cmake + A /trunk/CMakeModules/cmake_uninstall.cmake.in + M /trunk/INSTALL + D /trunk/Makefile.am + M /trunk/README + A /trunk/VERSION + D /trunk/configure.ac + A /trunk/examples/CMakeLists.txt + D /trunk/examples/Makefile.am + M /trunk/examples/sasearch.c + A /trunk/include/CMakeLists.txt + D /trunk/include/Makefile.am + A /trunk/include/config.h.cmake + A /trunk/include/divsufsort.h.cmake + D /trunk/include/divsufsort.h.in + A /trunk/include/divsufsort_private.h + D /trunk/include/divsufsort_private.h.in + A /trunk/lib/CMakeLists.txt + D /trunk/lib/Makefile.am + M /trunk/lib/divsufsort.c + D /trunk/lib/libdivsufsort.sym + M /trunk/lib/substringsort.c + M /trunk/lib/trsort.c + + The build system was changed to CMake. (http://www.cmake.org/) + +2008-06-26 Yuta Mori + Changed paths: + M /trunk/AUTHORS + M /trunk/configure.ac + + AUTHORS: Fixed email address. + +2008-02-23 Yuta Mori + + * lib/substringsort.c (_merge_backward): Bug fix. + * lib/trsort.c (_tr_introsort): Bug fix. + +2007-09-02 Yuta Mori + + * lib/trsort.c (_ls_introsort): Important bug fix. + +2007-07-15 Yuta Mori + + A few bug fixes. + + * lib/divsufsort.c (divbwt): Bug fix. + * lib/trsort.c (_tr_introsort): Bug fix. + * lib/utils.c (sa_search, sa_simplesearch): New functions. + * lib/libdivsufsort.sym: Update. + * include/divsufsort.h.in: Update. + * examples/sasearch.c: New file. + * examples/Makefile.am: Update. + * configure.ac: Update. + * NEWS: Update. + * README: Update. + +2007-04-14 Yuta Mori + + Change license to the MIT/X11 license. + Update all files for 1.2.0. + + * lib/libdivsufsort.sym: New file for libtool. + +2007-04-07 Yuta Mori + + Update files for 1.1.7. + +2007-04-07 Yuta Mori + + Replace drsort with tandem repeat sorting algorithm and Larsson-Sadakane sorting algorithm. + + * lib/trsort.c: New file. + * lib/drsort.c: Delete. + * lib/divsufsort.c: Update. + * lib/Makefile.am: Update. + * lib/divsufsort_private.h.in (LS_INSERTIONSORT_THRESHOLD, TR_INSERTIONSORT_THRESHOLD): New constants. + (DR_INSERTIONSORT_THRESHOLD): Delete. + (STACK_PUSH3, STACK_POP3): New macros. + +2007-03-31 Yuta Mori + + Update files for 1.1.6. + +2007-03-31 Yuta Mori + + Replace _ss_merge with new merge algorithms. + + * lib/substringsort.c (_ss_merge): Delete. + * lib/substringsort.c (_block_swap, _merge_forward, _merge_backward, _merge): New functions. + (substringsort): Update. + * lib/divsufsort.c (_sort_typeBstar, divsufsort, divbwt): Update. + * include/divsufsort_private.h.in (LOCALMERGE_BUFFERSIZE): New constant. + (SS_MERGESORT_QUEUESIZE): Delete. + +2007-03-24 Yuta Mori + + Update files for 1.1.5. + +2007-03-23 Yuta Mori + + Replace breadth-first introsort with new multikey introsort. + + * lib/substringsort.c (_compare): Update. + (_substring_partition): Update. + (_multikey_introsort): New function. + (_introsort, _bfintrosort): Delete. + (substringsort): Update. + * lib/divsufsort.c (_sort_typeBstar): Update. + +2007-03-21 Yuta Mori + + * lib/substringsort.c (_introsort): Convert introsort to a non-recursive algorithm. + (substringsort): Update. + * lib/divsufsort.c (_sort_typeBstar): Update. + +2007-03-21 Yuta Mori + + * include/divsufsort_private.h.in (STACK_SIZE): Rename from SS_STACK_SIZE. + (SS_BLOCKSIZE): Rename from SS_MKQSORT_THRESHOLD. + (SS_MKQSORT_DMAX, SS_DSWAP, SS_STACK_PUSH, SS_STACK_POP): Delete. + (STACK_PUSH, STACK_POP): New macros. + (substringsort): Update prototype. + +2007-03-17 Yuta Mori + + Update files for 1.1.4. + +2007-03-17 Yuta Mori + + * substringsort.c (_fixdown, _heapsort, _lg): New function. + (_introsort): Rename from _quicksort. Change to use new partitioning algorithm. + (_bfintrosort): Rename from _bfquicksort. + +2007-03-10 Yuta Mori + + Update files for 1.1.3. + +2007-03-10 Yuta Mori + + Replace depth-first multikey quicksort with new breadth-first ternary quicksort. + + * substringsort.c (_ss_compare_lcp, _ss_tqsort, _ss_mkqsort): Remove. + (_median3): Rename from _ss_median and rewrite. + (_pivot): Rename from _ss_pivot and rewrite. + (_median5, _substring_partition, _quicksort, _bfquicksort): New function. + +2007-03-03 Yuta Mori + + Update files for 1.1.2. + +2007-03-03 Yuta Mori + + * substringsort.c (_compare): Rename from _ss_compare and rewrite. + (_insertionsort): Rename from _ss_insertionsort and rewrite. + +2007-02-24 Yuta Mori + + Update files for 1.1.1. + +2007-02-24 Yuta Mori + + * lib/substringsort.c (_ss_getc): Remove. + +2007-02-17 Yuta Mori + + Update files for 1.1.0. + +2007-02-17 Yuta Mori + + * utils.c (bwtcheck): Remove. + +2007-02-11 Yuta Mori + + * lib/divsufsort.c, + include/divsufsort.h.in, + include/divsufsort_private.h.in: + Change to use a new improved two-stage sort algorithm (version 070210). + +2007-01-28 Yuta Mori + + * lib/divsufsort.c (_sort): Fix a bug that using wrong index. + +2007-01-28 Yuta Mori + + * examples/bwt.c: Rename from examples/bwt2.c. + * examples/unbwt.c: Rename from examples/unbwt2.c. + * examples/bwt1.c: Delete. + * examples/unbwt1.c: Delete. + +2007-01-28 Yuta Mori + + * lib/divsufsort.c, include/divsufsort_private.h.in: + Change to use new improved two-stage sort algorithm (version 070128). + +2007-01-24 Yuta Mori + + Remove use of libtool. + + * include/divsufsort_private.h.in: Rename from include/divsufsort_private.h. + +2007-01-24 Yuta Mori + + Initial import. + +;; Local Variables: +;; coding: utf-8 +;; End: diff --git a/tools/Flips/libdivsufsort-2.0.1/ChangeLog.old b/tools/Flips/libdivsufsort-2.0.1/ChangeLog.old new file mode 100644 index 000000000..df8de8eae --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/ChangeLog.old @@ -0,0 +1,67 @@ +Version 1.0.2 (2006-01-01): + + * Release 1.0.2 + +Version 1.0.2b (2005-12-11): + + * lib/divsufsort.c (_construct_typeBstar): Completely rewrite. + +Version 1.0.2a (2005-12-04): + + * lib/substringsort.c: Completely rewrite. + * lib/drsort.c: Completely rewrite. + * lib/divsufsort.c (_sort_typeBstar): Fix some bugs. + +Version 1.0.1 (2005-11-08): + + * Release 1.0.1 + +Version 1.0.1a (2005-11-06): + + * configure.ac: Add AM_ENABLE_STATIC, AM_DISABLE_SHARED and AC_LIBTOOL_WIN32_DLL + + * Makefile.am (EXTRA_DIST): Add ChangeLog.old. + + * lib/divsufsort.c (_construct_typeBstar): Fix. + + * AUTHORS: New file. + * ChangeLog: New file. + * ChangeLog.old: New file. + * INSTALL: New file. + * NEWS: New file. + +Version 1.0.0 (2005-10-31) + * Introduced autoconf and automake. + * Added new example programs. + +Version 0.2.1 (2005-08-27) + * divsufsort.c: Kao's algorithm was replaced with Improved Two-Stage algorithm. + * divsufsort.c: Reduced memory usage. + * substringsort.c: Added mergesort for sorting large groups of suffixes. + +Version 0.1.6 (2005-06-10) + * divsufsort.h: Renamed from libdivsufsort.h. (again...) + * divsufsort.c: Renamed from libdivsufsort.c. (again...) + * divsufsort.c: Reduced memory usage. + * substringsort.c, substringsort.h, drsort.c, drsort.h: Modify. + * mksary_mmap/makefile, mksary_mmap/mksary.c, + mksary_mmap/mmap.c, mksary_mmap/mmap.h: Removed. + +Version 0.1.5 (2005-04-07) + * libdivsufsort.c: ranksort and doublingsort were replaced with drsort. + * def.h, drsort.c, drsort.h: New file. + * doublingsort.c, doublingsort.h, ranksort.c, ranksort.h: Removed. + +Version 0.1.4 (2005-03-27) + * mksary/mksary.c, mksary_mmap/mksary.c, suftest.c: Added error handling. + +Version 0.1.3 (2005-01-28) + * mksary/makefile, mksary/mksary.c, mksary_mmap/makefile, + mksary_mmap/mksary.c, mksary_mmap/mmap.c, mksary_mmap/mmap.h: New file. + * libdivsufsort.c: Modify. + +Version 0.1.2 (2005-01-01) + * suftest.c: New file. + * libdivsufsort.c: Renamed from divsufsort.c. + * libdivsufsort.h: Renamed from divsufsort.h. + diff --git a/tools/Flips/libdivsufsort-2.0.1/INSTALL b/tools/Flips/libdivsufsort-2.0.1/INSTALL new file mode 100644 index 000000000..ba7ee0912 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/INSTALL @@ -0,0 +1,31 @@ +-- INSTALL for libdivsufsort + + +Requirements: +============= + + * CMake version 2.4.2 or newer (http://www.cmake.org/) + * An ANSI C compiler + * GNU Make + + +Compilation and Installation (with Unix Makefiles): +=================================================== + + 1. Create a 'build' directory in the package source directory. + + $ cd libdivsufsort-?.?.? + $ mkdir build + $ cd build + + 2. Configure the package for your system. + + $ cmake -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="/usr/local" .. + + 3. Compile the package. + + $ make + + 4. Install the library and header files. + + # make install diff --git a/tools/Flips/libdivsufsort-2.0.1/Makefile.am b/tools/Flips/libdivsufsort-2.0.1/Makefile.am new file mode 100644 index 000000000..493bd8a4b --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/Makefile.am @@ -0,0 +1,10 @@ +# Makefile.am for libdivsufsort + +SUBDIRS = include lib examples + +EXTRA_DIST = ChangeLog.old CMakeLists.txt VERSION CMakeModules pkgconfig + +ACLOCAL_AMFLAGS = -I m4 + +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck diff --git a/tools/Flips/libdivsufsort-2.0.1/Makefile.in b/tools/Flips/libdivsufsort-2.0.1/Makefile.in new file mode 100644 index 000000000..0696da77f --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/Makefile.in @@ -0,0 +1,736 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Makefile.am for libdivsufsort +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ + ChangeLog INSTALL NEWS config/config.guess config/config.sub \ + config/depcomp config/install-sh config/ltmain.sh \ + config/missing +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d "$(distdir)" \ + || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr "$(distdir)"; }; } +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIVSUFSORT_EXPORT = @DIVSUFSORT_EXPORT@ +DIVSUFSORT_IMPORT = @DIVSUFSORT_IMPORT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INCFILE = @INCFILE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LFS_FOPEN = @LFS_FOPEN@ +LFS_FSEEK = @LFS_FSEEK@ +LFS_FTELL = @LFS_FTELL@ +LFS_OFF_T = @LFS_OFF_T@ +LFS_PRID = @LFS_PRID@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PROJECT_DESCRIPTION = @PROJECT_DESCRIPTION@ +PROJECT_NAME = @PROJECT_NAME@ +PROJECT_URL = @PROJECT_URL@ +PROJECT_VERSION_FULL = @PROJECT_VERSION_FULL@ +RANLIB = @RANLIB@ +SAINDEX_PRId = @SAINDEX_PRId@ +SAINDEX_TYPE = @SAINDEX_TYPE@ +SAINT32_TYPE = @SAINT32_TYPE@ +SAINT64_PRId = @SAINT64_PRId@ +SAINT64_TYPE = @SAINT64_TYPE@ +SAINT_PRId = @SAINT_PRId@ +SAUCHAR_TYPE = @SAUCHAR_TYPE@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +W64BIT = @W64BIT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = include lib examples +EXTRA_DIST = ChangeLog.old CMakeLists.txt VERSION CMakeModules pkgconfig +ACLOCAL_AMFLAGS = -I m4 +all: all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @$(am__cd) '$(distuninstallcheck_dir)' \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ + dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ + distcheck distclean distclean-generic distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am + + +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tools/Flips/libdivsufsort-2.0.1/NEWS b/tools/Flips/libdivsufsort-2.0.1/NEWS new file mode 100644 index 000000000..f240fd1ef --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/NEWS @@ -0,0 +1,43 @@ +-- NEWS for libdivsufsort + +Changes in release 2.0.0 + + - The build system was changed to CMake. (http://www.cmake.org/) + - Improved the performance of the suffix-sorting algorithm. + - Added OpenMP support. + - Added 64-bit version of divsufsort. + +Changes in release 1.2.3 + + - Bug fixes. + +Changes in release 1.2.2 + + - An important bug fix. + +Changes in release 1.2.1 + + - A few bug fixes. + - New APIs: sa_search, sa_simplesearch. + +Changes in release 1.2.0 + + - Changed license to the MIT/X11 license, see COPYING. + - Improved the performance of the suffix array construction. + - Change to use a new improved two-stage sorting algorithm. + - Replace substringsort with a new sorting algorithm that uses + multikey introspective sorting algorithm and in-place/recursive + merging algorithm. + - Replace drsort with a new sorting algorithm that uses + multikey introspective sorting algorithm, Maniscalco's tandem + repeat sorting algorithm and Larsson-Sadakane sorting algorithm. + - New API: divbwt. + +Changes in release 1.0.2 + + - The performance of sorting has been improved. + - Fix some bugs. + +Changes in release 1.0.1 + + - The performance of sorting has been improved a little bit. diff --git a/tools/Flips/libdivsufsort-2.0.1/README b/tools/Flips/libdivsufsort-2.0.1/README new file mode 100644 index 000000000..8bb4ef0b2 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/README @@ -0,0 +1,250 @@ +libdivsufsort - A lightweight suffix-sorting library. +----------------------------------------------------- + +Introduction: +------------- + +The libdivsufsort project provides a fast, lightweight, and robust +C API library to construct the suffix array and the Burrows-Wheeler +transformed string for any input string of a constant-size alphabet. + +The suffix-sorting algorithm runs in O(n log n) worst-case time +using only 5n+O(1) bytes of memory space, where n is the length of +the input string. + +The latest version of libdivsufsort is available at: + http://libdivsufsort.googlecode.com/ + + +License: +-------- + +libdivsufsort is released under the MIT/X11 license. See the file +COPYING for more details. + + +APIs: +----- + + * Data types + typedef int32_t saint_t; + typedef int32_t saidx_t; + typedef uint8_t sauchar_t; + + * Constructs the suffix array of a given string. + * @param T[0..n-1] The input string. + * @param SA[0..n-1] The output array or suffixes. + * @param n The length of the given string. + * @return 0 if no error occurred, -1 or -2 otherwise. + saint_t + divsufsort(const sauchar_t *T, saidx_t *SA, saidx_t n); + + * Constructs the burrows-wheeler transformed string of a given string. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param A[0..n-1] The temporary array. (can be NULL) + * @param n The length of the given string. + * @return The primary index if no error occurred, -1 or -2 otherwise. + saidx_t + divbwt(const sauchar_t *T, sauchar_t *U, saidx_t *A, saidx_t n); + + * Constructs the burrows-wheeler transformed string of a given string and suffix array. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param SA[0..n-1] The suffix array. (can be NULL) + * @param n The length of the given string. + * @param idx The output primary index. + * @return 0 if no error occurred, -1 or -2 otherwise. + saint_t + bw_transform(const sauchar_t *T, sauchar_t *U, saidx_t *SA, + saidx_t n, saidx_t *idx); + + * Inverse BW-transforms a given BWTed string. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param A[0..n-1] The temporary array. (can be NULL) + * @param n The length of the given string. + * @param idx The primary index. + * @return 0 if no error occurred, -1 or -2 otherwise. + saint_t + inverse_bw_transform(const sauchar_t *T, sauchar_t *U, + saidx_t *A, saidx_t n, saidx_t idx); + + * Checks the correctness of a given suffix array. + * @param T[0..n-1] The input string. + * @param SA[0..n-1] The input suffix array. + * @param n The length of the given string. + * @param verbose The verbose mode. + * @return 0 if no error occurred. + saint_t + sufcheck(const sauchar_t *T, const saidx_t *SA, + saidx_t n, saint_t verbose); + + * Search for the pattern P in the string T. + * @param T[0..Tsize-1] The input string. + * @param Tsize The length of the given string. + * @param P[0..Psize-1] The input pattern string. + * @param Psize The length of the given pattern string. + * @param SA[0..SAsize-1] The input suffix array. + * @param SAsize The length of the given suffix array. + * @param idx The output index. + * @return The count of matches if no error occurred, -1 otherwise. + saidx_t + sa_search(const sauchar_t *T, saidx_t Tsize, + const sauchar_t *P, saidx_t Psize, + const saidx_t *SA, saidx_t SAsize, + saidx_t *idx); + + * Search for the character c in the string T. + * @param T[0..Tsize-1] The input string. + * @param Tsize The length of the given string. + * @param SA[0..SAsize-1] The input suffix array. + * @param SAsize The length of the given suffix array. + * @param c The input character. + * @param idx The output index. + * @return The count of matches if no error occurred, -1 otherwise. + saidx_t + sa_simplesearch(const sauchar_t *T, saidx_t Tsize, + const saidx_t *SA, saidx_t SAsize, + saint_t c, saidx_t *idx); + + * Returns the version string of libdivsufsort. + * @return the version string. + const char * + divsufsort_version(void); + + +Benchmark: +------------------ + += Specifications = +Processor: 2.66 GHz Intel Core 2 Duo E6750 +L1 Cache: (32 Kb + 32 Kb) x 2 +L2 Cache: 4 Mb +RAM: 2 Gb main memory +Operating system: Windows XP Home SP 3 (with Cygwin) +Compiler: GCC version 4.3.1 + += Programs = +Archon4r0 kvark's sorting algorithm http://forum.compression.ru/viewtopic.php?t=352 +BPR Bucket-Pointer Refinement algorithm http://bibiserv.techfak.uni-bielefeld.de/bpr/ +DC Difference-Cover algorithm (v = 32) http://www.cs.helsinki.fi/juha.karkkainen/publications/cpm03.tar.gz +DS Deep-Shallow sorting algorithm http://www.mfn.unipmn.it/~manzini/lightweight/ +divsufsort1 libdivsufsort version 1.2.3 http://libdivsufsort.googlecode.com/ +divsufsort2 libdivsufsort version 2.0.0 http://libdivsufsort.googlecode.com/ +KA Ko-Aluru algorithm http://ko.pang.cn.googlepages.com/software2 +KS Kärkkäinen-Sanders algorithm http://www.mpi-inf.mpg.de/~sanders/programs/suffix/ +MSufSort3 MSufSort version 3.1.1 beta http://www.michael-maniscalco.com/msufsort.htm +qsufsort Larsson-Sadakane algorithm http://www.larsson.dogma.net/research.html +sais Induced Sorting algorithm http://yuta.256.googlepages.com/sais + +All programs were compiled with gcc/g++ using '-O3 -fomit-frame-pointer -DNDEBUG' +optimization options. The times are the average of five runs, in seconds, and were +measured using the standard Unix/Cygwin 'time' command. (user + system) The spaces +were measured using the 'memusage' command. + += Testfiles = +Manzini's Large Corpus http://www.mfn.unipmn.it/~manzini/lightweight/corpus/ +The Gauntlet http://www.michael-maniscalco.com/testset/gauntlet/ + += Running times = + +== Manzini's Corpus == +Files Size Archon4r0 BPR DC DS divsufsort1 divsufsort2 KA KS MSufSort3 qsufsort sais +chr22.dna 34553758 6.030 6.196 22.694 7.514 5.404 5.362 16.980 50.006 7.132 10.642 10.796 +etext99 105277340 22.160 32.582 79.872 34.264 18.758 18.064 73.236 202.684 24.106 56.612 38.748 +gcc-3.0.tar 86630400 13.856 20.692 61.690 35.822 10.382 10.084 40.908 135.174 14.952 40.766 20.990 +howto 39422105 5.806 8.326 25.432 8.288 5.472 5.320 20.694 64.834 5.672 16.366 11.388 +jdk13c 69728899 18.106 22.252 61.234 32.182 9.260 9.010 34.172 101.096 11.314 39.792 16.396 +linux-2.4.5.tar 116254720 18.174 26.226 82.830 25.912 14.672 14.290 58.586 194.412 19.890 54.054 29.614 +rctail96 114711151 32.490 55.826 119.026 62.502 18.500 17.914 70.072 190.562 21.060 70.456 33.248 +rfc 116421901 20.736 35.404 91.284 29.666 16.116 15.658 64.390 196.500 17.936 61.436 32.224 +sprot34.dat 109617186 22.832 36.720 93.122 32.096 17.894 17.404 68.084 187.594 23.352 56.946 34.092 +w3c2 104201579 27.264 29.384 89.352 54.682 13.866 13.486 52.660 162.582 17.090 77.804 25.498 +totals 896819039 187.454 273.608 726.536 322.928 130.324 126.592 499.782 1485.444 162.504 484.874 252.994 + +== The Gauntlet == +Files Size Archon4r0 BPR DC DS divsufsort1 divsufsort2 KA KS MSufSort3 qsufsort sais +abac 200000 0.044 0.064 0.104 27.914 0.042 0.036 0.058 0.048 0.050 0.062 0.044 +abba 10500600 3.270 5.124 10.766 30.702 1.714 1.602 2.570 7.952 3.514 15.272 1.460 +book1x20 15375420 4.392 3.530 13.872 97.468 2.312 2.154 7.442 15.756 3.542 22.376 3.912 +fib_s14930352 14930352 12.728 10.830 18.524 179.040 3.638 3.588 3.544 10.232 6.700 18.224 2.542 +fss10 12078908 11.390 8.974 15.130 85.328 2.828 2.824 3.344 8.646 4.618 14.754 2.076 +fss9 2851443 1.002 1.210 1.644 5.256 0.410 0.416 0.618 1.290 0.554 2.836 0.336 +houston 3840000 0.344 0.708 2.226 118.960 0.118 0.128 0.520 0.744 0.242 1.230 0.238 +paper5x80 981924 0.110 0.154 0.454 0.806 0.092 0.090 0.210 0.256 0.144 0.448 0.110 +test1 2097152 0.332 2.132 1.108 8.680 0.268 0.280 0.376 1.066 1.302 2.762 0.202 +test2 2097152 0.710 0.616 1.110 8.682 0.180 0.176 0.374 1.076 3.354 2.768 0.206 +test3 2097152 0.488 213.154 1.164 1.772 0.220 0.226 0.388 1.082 0.922 3.246 0.212 +totals 67050103 34.810 246.496 66.102 564.608 11.822 11.520 19.444 48.148 24.942 83.978 11.338 + += Space (in MiBytes) = + +== Manzini's Corpus == +Files Size Archon4r0 BPR DC DS divsufsort1 divsufsort2 KA KS MSufSort3 qsufsort sais +chr22.dna 34553758 174.66 296.88 193.60 165.18 165.02 165.02 289.97 428.39 199.72 263.62 164.77 +etext99 105277340 531.13 915.48 589.85 503.23 502.25 502.25 907.34 1305.20 604.45 803.20 502.00 +gcc-3.0.tar 86630400 437.14 756.43 485.38 415.87 413.34 413.34 709.50 1074.01 497.79 660.94 413.09 +howto 39422105 199.20 367.53 220.88 188.45 188.23 188.23 331.54 488.75 227.67 300.77 187.98 +jdk13c 69728899 351.96 603.99 390.68 333.40 332.74 332.74 609.71 864.48 401.04 531.99 332.49 +linux-2.4.5.tar 116254720 586.46 1061.83 651.36 555.76 554.60 554.60 977.81 1441.30 667.39 886.95 554.35 +rctail96 114711151 578.68 987.64 642.71 548.32 547.24 547.24 1004.98 1422.16 658.43 875.18 546.99 +rfc 116421901 587.30 1005.85 652.29 556.53 555.39 555.39 956.52 1443.37 668.26 888.23 555.14 +sprot34.dat 109617186 553.01 941.95 614.17 524.03 522.95 522.95 930.06 1359.01 629.26 836.31 522.70 +w3c2 104201579 525.71 958.37 583.82 498.09 497.12 497.12 912.00 1291.87 598.82 795.00 496.87 +totals 896819039 4525.25 7895.95 5024.74 4288.86 4278.88 4278.88 7629.43 11118.54 5152.83 6842.19 4276.38 +mean - 5.29 9.23 5.88 5.01 5.00 5.00 8.92 13.00 6.02 8.00 5.00 + +== The Gauntlet == +Files Size Archon4r0 BPR DC DS divsufsort1 divsufsort2 KA KS MSufSort3 qsufsort sais +abac 200000 1.51 1.73 1.12 0.98 1.21 1.20 1.75 2.48 3.15 1.53 0.95 +abba 10500600 53.43 90.19 58.83 50.21 50.32 50.32 86.20 130.18 62.09 80.11 50.07 +book1x20 15375420 78.00 134.00 86.15 73.52 73.57 73.57 132.42 190.62 89.99 117.31 73.32 +fib_s14930352 14930352 75.75 128.15 83.65 71.71 71.44 71.44 117.16 185.10 87.43 113.91 71.19 +fss10 12078908 61.38 103.68 67.68 58.05 57.85 57.85 107.05 149.75 71.12 92.16 57.60 +fss9 2851443 14.87 24.48 15.98 13.71 13.85 13.85 25.27 35.35 18.32 21.76 13.60 +houston 3840000 19.85 36.96 21.52 18.46 18.56 18.56 28.79 47.58 23.98 29.30 18.31 +paper5x80 981924 5.45 11.40 5.50 4.72 4.93 4.93 8.59 12.17 7.63 7.49 4.68 +test1 2097152 11.07 82.00 11.75 10.10 10.25 10.25 18.34 25.99 14.01 16.00 10.00 +test2 2097152 11.07 82.00 11.75 10.10 10.25 10.25 18.34 25.99 14.01 16.00 10.00 +test3 2097152 11.07 82.00 11.75 10.05 10.25 10.25 18.34 26.00 14.63 16.00 10.12 +totals 67050103 343.45 776.59 375.68 321.61 322.48 322.47 562.25 831.21 406.36 511.57 319.84 +mean - 5.37 12.14 5.88 5.03 5.04 5.04 8.79 13.00 6.35 8.00 5.00 + + +Algorithm: +---------- + +libdivsufsort uses the following algorithms for suffix sorting. + - The improved version of Itho-Tanaka two-stage sorting algorithm. [2][6] + - A substring sorting/encoding technique. [1][3] + - Maniscalco's tandem repeat sorting algorithm. [5] + - Larsson-Sadakane sorting algorithm. [4] + + +References: +----------- + + 1. Stefan Burkhardt and Juha K"arkk"ainen. Fast lightweight suffix + array construction and checking. Proceedings of the 14th Annual + Symposium on Combinatorial Pattern Matching, LNCS 2676, + Springer, pp. 55-69, 2003. + + 2. Hideo Itoh and Hozumi Tanaka, An Efficient Method for in Memory + Construction of Suffix Arrays, Proceedings of the IEEE String + Processing and Information Retrieval Symposium, pp. 81-88, 1999. + + 3. Pang Ko and Srinivas Aluru, Space-efficient linear time + construction of suffix arrays, Proceedings of the 14th Annual + Symposium on Combinatorial Pattern Matching, pp. 200-210, 2003. + + 4. Jesper Larsson and Kunihiko Sadakane, Faster suffix sorting. + Technical report LU-CS-TR:99-214, Department of Computer + Science, Lund University, Sweden, 1999. + + 5. Michael Maniscalco, MSufSort. + http://www.michael-maniscalco.com/msufsort.htm + + 6. Yuta Mori, Short description of improved two-stage suffix sorting + algorithm, 2005. + http://homepage3.nifty.com/wpage/software/itssort.txt diff --git a/tools/Flips/libdivsufsort-2.0.1/VERSION b/tools/Flips/libdivsufsort-2.0.1/VERSION new file mode 100644 index 000000000..38f77a65b --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/VERSION @@ -0,0 +1 @@ +2.0.1 diff --git a/tools/Flips/libdivsufsort-2.0.1/aclocal.m4 b/tools/Flips/libdivsufsort-2.0.1/aclocal.m4 new file mode 100644 index 000000000..a9096d26b --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/aclocal.m4 @@ -0,0 +1,996 @@ +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, +[m4_warning([this file was generated for autoconf 2.67. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.11' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.11.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.11.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 10 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 5 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 16 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.62])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl +]) + +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless `enable' is passed literally. +# For symmetry, `disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], +[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/libtool.m4]) +m4_include([m4/ltoptions.m4]) +m4_include([m4/ltsugar.m4]) +m4_include([m4/ltversion.m4]) +m4_include([m4/lt~obsolete.m4]) diff --git a/tools/Flips/libdivsufsort-2.0.1/config/config.guess b/tools/Flips/libdivsufsort-2.0.1/config/config.guess new file mode 100755 index 000000000..c2246a4f7 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/config/config.guess @@ -0,0 +1,1502 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +timestamp='2009-12-30' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free +Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/tools/Flips/libdivsufsort-2.0.1/config/config.sub b/tools/Flips/libdivsufsort-2.0.1/config/config.sub new file mode 100755 index 000000000..c2d125724 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/config/config.sub @@ -0,0 +1,1714 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +timestamp='2010-01-22' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free +Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile-* | tilegx-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze) + basic_machine=microblaze-xilinx + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + # This must be matched before tile*. + tilegx*) + basic_machine=tilegx-unknown + os=-linux-gnu + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/tools/Flips/libdivsufsort-2.0.1/config/depcomp b/tools/Flips/libdivsufsort-2.0.1/config/depcomp new file mode 100755 index 000000000..df8eea7e4 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/config/depcomp @@ -0,0 +1,630 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free +# Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u="sed s,\\\\\\\\,/,g" + depmode=msvisualcpp +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> "$depfile" + echo >> "$depfile" + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/tools/Flips/libdivsufsort-2.0.1/config/install-sh b/tools/Flips/libdivsufsort-2.0.1/config/install-sh new file mode 100755 index 000000000..6781b987b --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/config/install-sh @@ -0,0 +1,520 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2009-04-28.21; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/tools/Flips/libdivsufsort-2.0.1/config/ltmain.sh b/tools/Flips/libdivsufsort-2.0.1/config/ltmain.sh new file mode 100755 index 000000000..7ed280bc9 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/config/ltmain.sh @@ -0,0 +1,8413 @@ +# Generated from ltmain.m4sh. + +# ltmain.sh (GNU libtool) 2.2.6b +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print informational messages (default) +# --version print version information +# -h, --help print short or long help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . + +PROGRAM=ltmain.sh +PACKAGE=libtool +VERSION="2.2.6b Debian-2.2.6b-2ubuntu1" +TIMESTAMP="" +package_revision=1.3017 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# NLS nuisances: We save the old values to restore during execute mode. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done + +$lt_unset CDPATH + + + + + +: ${CP="cp -f"} +: ${ECHO="echo"} +: ${EGREP="/bin/grep -E"} +: ${FGREP="/bin/grep -F"} +: ${GREP="/bin/grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="/bin/sed"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + +# Generated shell functions inserted here. + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + +# The name of this program: +# In the unlikely event $progname began with a '-', it would play havoc with +# func_echo (imagine progname=-n), so we prepend ./ in that case: +func_dirname_and_basename "$progpath" +progname=$func_basename_result +case $progname in + -*) progname=./$progname ;; +esac + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=: + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname${mode+: }$mode: $*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` + done + my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "X$my_tmpdir" | $Xsed +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "X$1" | $Xsed \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + + + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $SED -n '/^# Usage:/,/# -h/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + $ECHO + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help +# Echo long help message to standard output and exit. +func_help () +{ + $SED -n '/^# Usage:/,/# Report bugs to/ { + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + p + }' < "$progpath" + exit $? +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + func_error "missing argument for $1" + exit_cmd=exit +} + +exit_cmd=: + + + + + +# Check that we have a working $ECHO. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell, and then maybe $ECHO will work. + exec $SHELL "$progpath" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# Parse options once, thoroughly. This comes as soon as possible in +# the script to make things like `libtool --version' happen quickly. +{ + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac + + # Parse non-mode specific arguments: + while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --config) func_config ;; + + --debug) preserve_args="$preserve_args $opt" + func_echo "enabling shell trace mode" + opt_debug='set -x' + $opt_debug + ;; + + -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break + execute_dlfiles="$execute_dlfiles $1" + shift + ;; + + --dry-run | -n) opt_dry_run=: ;; + --features) func_features ;; + --finish) mode="finish" ;; + + --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break + case $1 in + # Valid mode arguments: + clean) ;; + compile) ;; + execute) ;; + finish) ;; + install) ;; + link) ;; + relink) ;; + uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; + esac + + mode="$1" + shift + ;; + + --preserve-dup-deps) + opt_duplicate_deps=: ;; + + --quiet|--silent) preserve_args="$preserve_args $opt" + opt_silent=: + ;; + + --verbose| -v) preserve_args="$preserve_args $opt" + opt_silent=false + ;; + + --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break + preserve_args="$preserve_args $opt $1" + func_enable_tag "$1" # tagname is set here + shift + ;; + + # Separate optargs to long options: + -dlopen=*|--mode=*|--tag=*) + func_opt_split "$opt" + set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} + shift + ;; + + -\?|-h) func_usage ;; + --help) opt_help=: ;; + --version) func_version ;; + + -*) func_fatal_help "unrecognized option \`$opt'" ;; + + *) nonopt="$opt" + break + ;; + esac + done + + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_duplicate_deps + ;; + esac + + # Having warned about all mis-specified options, bail out if + # anything was wrong. + $exit_cmd $EXIT_FAILURE +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +## ----------- ## +## Main. ## +## ----------- ## + +$opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + test -z "$mode" && func_fatal_error "error: you must specify a MODE." + + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$mode' for more information." +} + + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_ltwrapper_scriptname_result="" + if func_ltwrapper_executable_p "$1"; then + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" + fi +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_quote_for_eval "$arg" + CC_quoted="$CC_quoted $func_quote_for_eval_result" + done + case "$@ " in + " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T <?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + removelist="$removelist $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + removelist="$removelist $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + command="$command -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { +test "$mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$mode'" + ;; + esac + + $ECHO + $ECHO "Try \`$progname --help' for more information about other modes." + + exit $? +} + + # Now that we've collected a possible --mode arg, show help if necessary + $opt_help && func_mode_help + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_quote_for_eval "$file" + args="$args $func_quote_for_eval_result" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + $ECHO "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + fi +} + +test "$mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + $ECHO "X----------------------------------------------------------------------" | $Xsed + $ECHO "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + $ECHO + $ECHO "If you ever happen to want to link against installed libraries" + $ECHO "in a given directory, LIBDIR, you must either use libtool, and" + $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" + $ECHO "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" + $ECHO " during execution" + fi + if test -n "$runpath_var"; then + $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" + $ECHO " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $ECHO + + $ECHO "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" + $ECHO "pages." + ;; + *) + $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + $ECHO "X----------------------------------------------------------------------" | $Xsed + exit $EXIT_SUCCESS +} + +test "$mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $ECHO "X$nonopt" | $GREP shtool >/dev/null; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + install_prog="$install_prog$func_quote_for_eval_result" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + case " $install_prog " in + *[\\\ /]cp\ *) ;; + *) prev=$arg ;; + esac + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + install_prog="$install_prog $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_verbose "extracting global C symbols from \`$progfile'" + $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + $ECHO >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +" + case $host in + *cygwin* | *mingw* | *cegcc* ) + $ECHO >> "$output_objdir/$my_dlsyms" "\ +/* DATA imports from DLLs on WIN32 con't be const, because + runtime relocations are performed -- see ld's documentation + on pseudo-relocs. */" + lt_dlsym_const= ;; + *osf5*) + echo >> "$output_objdir/$my_dlsyms" "\ +/* This system does not cope well with relocations in const data */" + lt_dlsym_const= ;; + *) + lt_dlsym_const=const ;; + esac + + $ECHO >> "$output_objdir/$my_dlsyms" "\ +extern $lt_dlsym_const lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +$lt_dlsym_const lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + $ECHO >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) symtab_cflags="$symtab_cflags $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + + +# func_emit_wrapper_part1 [arg=no] +# +# Emit the first part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part1 () +{ + func_emit_wrapper_part1_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part1_arg1=$1 + fi + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + ECHO=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$ECHO works! + : + else + # Restart under the correct shell, and then maybe \$ECHO will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $ECHO "\ + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done +" +} +# end: func_emit_wrapper_part1 + +# func_emit_wrapper_part2 [arg=no] +# +# Emit the second part of a libtool wrapper script on stdout. +# For more information, see the description associated with +# func_emit_wrapper(), below. +func_emit_wrapper_part2 () +{ + func_emit_wrapper_part2_arg1=no + if test -n "$1" ; then + func_emit_wrapper_part2_arg1=$1 + fi + + $ECHO "\ + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} +# end: func_emit_wrapper_part2 + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=no + if test -n "$1" ; then + func_emit_wrapper_arg1=$1 + fi + + # split this up so that func_emit_cwrapperexe_src + # can call each part independently. + func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" + func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" +} + + +# func_to_host_path arg +# +# Convert paths to host format when used with build tools. +# Intended for use with "native" mingw (where libtool itself +# is running under the msys shell), or in the following cross- +# build environments: +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# where wine is equipped with the `winepath' executable. +# In the native mingw case, the (msys) shell automatically +# converts paths for any non-msys applications it launches, +# but that facility isn't available from inside the cwrapper. +# Similar accommodations are necessary for $host mingw and +# $build cygwin. Calling this function does no harm for other +# $host/$build combinations not listed above. +# +# ARG is the path (on $build) that should be converted to +# the proper representation for $host. The result is stored +# in $func_to_host_path_result. +func_to_host_path () +{ + func_to_host_path_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + case $build in + *mingw* ) # actually, msys + # awkward: cmd appends spaces to result + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_path_tmp1=`( cmd //c echo "$1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_path_tmp1=`cygpath -w "$1"` + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # Unfortunately, winepath does not exit with a non-zero + # error code, so we are forced to check the contents of + # stdout. On the other hand, if the command is not + # found, the shell will set an exit code of 127 and print + # *an error message* to stdout. So we must check for both + # error code of zero AND non-empty stdout, which explains + # the odd construction: + func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` + if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then + func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ + $SED -e "$lt_sed_naive_backslashify"` + else + # Allow warning below. + func_to_host_path_result="" + fi + ;; + esac + if test -z "$func_to_host_path_result" ; then + func_error "Could not determine host path corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_path_result="$1" + fi + ;; + esac + fi +} +# end: func_to_host_path + +# func_to_host_pathlist arg +# +# Convert pathlists to host format when used with build tools. +# See func_to_host_path(), above. This function supports the +# following $build/$host combinations (but does no harm for +# combinations not listed here): +# $build $host +# mingw (msys) mingw [e.g. native] +# cygwin mingw +# *nix + wine mingw +# +# Path separators are also converted from $build format to +# $host format. If ARG begins or ends with a path separator +# character, it is preserved (but converted to $host format) +# on output. +# +# ARG is a pathlist (on $build) that should be converted to +# the proper representation on $host. The result is stored +# in $func_to_host_pathlist_result. +func_to_host_pathlist () +{ + func_to_host_pathlist_result="$1" + if test -n "$1" ; then + case $host in + *mingw* ) + lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_to_host_pathlist_tmp2="$1" + # Once set for this call, this variable should not be + # reassigned. It is used in tha fallback case. + func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e 's|^:*||' -e 's|:*$||'` + case $build in + *mingw* ) # Actually, msys. + # Awkward: cmd appends spaces to result. + lt_sed_strip_trailing_spaces="s/[ ]*\$//" + func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + *cygwin* ) + func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ + $SED -e "$lt_sed_naive_backslashify"` + ;; + * ) + # unfortunately, winepath doesn't convert pathlists + func_to_host_pathlist_result="" + func_to_host_pathlist_oldIFS=$IFS + IFS=: + for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do + IFS=$func_to_host_pathlist_oldIFS + if test -n "$func_to_host_pathlist_f" ; then + func_to_host_path "$func_to_host_pathlist_f" + if test -n "$func_to_host_path_result" ; then + if test -z "$func_to_host_pathlist_result" ; then + func_to_host_pathlist_result="$func_to_host_path_result" + else + func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" + fi + fi + fi + IFS=: + done + IFS=$func_to_host_pathlist_oldIFS + ;; + esac + if test -z "$func_to_host_pathlist_result" ; then + func_error "Could not determine the host path(s) corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This may break if $1 contains DOS-style drive + # specifications. The fix is not to complicate the expression + # below, but for the user to provide a working wine installation + # with winepath so that path translation in the cross-to-mingw + # case works properly. + lt_replace_pathsep_nix_to_dos="s|:|;|g" + func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ + $SED -e "$lt_replace_pathsep_nix_to_dos"` + fi + # Now, add the leading and trailing path separators back + case "$1" in + :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" + ;; + esac + case "$1" in + *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" + ;; + esac + ;; + esac + fi +} +# end: func_to_host_pathlist + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +# define setmode _setmode +#else +# include +# include +# ifdef __CYGWIN__ +# include +# define HAVE_SETENV +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +#ifdef _MSC_VER +# define S_IXUSR _S_IEXEC +# define stat _stat +# ifndef _INTPTR_T_DEFINED +# define intptr_t int +# endif +#endif + +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifdef __CYGWIN__ +# define FOPEN_WB "wb" +#endif + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#undef LTWRAPPER_DEBUGPRINTF +#if defined DEBUGWRAPPER +# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args +static void +ltwrapper_debugprintf (const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); +} +#else +# define LTWRAPPER_DEBUGPRINTF(args) +#endif + +const char *program_name = NULL; + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_fatal (const char *message, ...); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_opt_process_env_set (const char *arg); +void lt_opt_process_env_prepend (const char *arg); +void lt_opt_process_env_append (const char *arg); +int lt_split_name_value (const char *arg, char** name, char** value); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); + +static const char *script_text_part1 = +EOF + + func_emit_wrapper_part1 yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ "/' -e 's/$/\\n"/' + echo ";" + cat <"))); + for (i = 0; i < newargc; i++) + { + LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); + } + +EOF + + case $host_os in + mingw*) + cat <<"EOF" + /* execv doesn't actually work on mingw as expected on unix */ + rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); + if (rval == -1) + { + /* failed to start process */ + LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); + return 127; + } + return rval; +EOF + ;; + *) + cat <<"EOF" + execv (lt_argv_zero, newargz); + return rval; /* =127, but avoids unused variable warning */ +EOF + ;; + esac + + cat <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void *p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), + string) : NULL; +} + +const char * +base_name (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha ((unsigned char) name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return base; +} + +int +check_executable (const char *path) +{ + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if ((stat (path, &st) >= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", + path ? (*path ? path : "EMPTY!") : "NULL!")); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", + wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", + tmp_pathspec)); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + char *errstr = strerror (errno); + lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal ("Could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} + +void +lt_setenv (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", + (name ? name : ""), + (value ? value : ""))); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +int +lt_split_name_value (const char *arg, char** name, char** value) +{ + const char *p; + int len; + if (!arg || !*arg) + return 1; + + p = strchr (arg, (int)'='); + + if (!p) + return 1; + + *value = xstrdup (++p); + + len = strlen (arg) - strlen (*value); + *name = XMALLOC (char, len); + strncpy (*name, arg, len-1); + (*name)[len - 1] = '\0'; + + return 0; +} + +void +lt_opt_process_env_set (const char *arg) +{ + char *name = NULL; + char *value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); + } + + lt_setenv (name, value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_prepend (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_opt_process_env_append (const char *arg) +{ + char *name = NULL; + char *value = NULL; + char *new_value = NULL; + + if (lt_split_name_value (arg, &name, &value) != 0) + { + XFREE (name); + XFREE (value); + lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); + } + + new_value = lt_extend_str (getenv (name), value, 1); + lt_setenv (name, new_value); + XFREE (new_value); + XFREE (name); + XFREE (value); +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + (name ? name : ""), + (value ? value : ""))); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + (name ? name : ""), + (value ? value : ""))); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + + +EOF +} +# end: func_emit_cwrapperexe_src + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) deplibs="$deplibs $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + weak_libs="$weak_libs $arg" + prev= + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname '-L' '' "$arg" + dir=$func_stripname_result + if test -z "$dir"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + arg="$arg $wl$func_quote_for_eval_result" + compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" + linker_flags="$linker_flags $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler + # -r[0-9][0-9]* specifies the processor on the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler + # +DA*, +DD* enable 64-bit mode on the HP compiler + # -q* pass through compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* pass through architecture-specific + # compiler args for GCC + # -F/path gives path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC + # @file GCC response files + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + compiler_flags="$compiler_flags $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_duplicate_deps ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + case $lib in + *.la) func_source "$lib" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` + case " $weak_libs " in + *" $deplib_base "*) ;; + *) deplibs="$deplibs $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + compiler_flags="$compiler_flags $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + dir=$func_stripname_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + $ECHO + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because the file extensions .$libext of this argument makes me believe" + $ECHO "*** that it is just a static archive that I should not use here." + else + $ECHO + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + newlib_search_path="$newlib_search_path $func_stripname_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) temp_rpath="$temp_rpath$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + notinst_deplibs="$notinst_deplibs $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + $ECHO + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $ECHO + $ECHO "*** And there doesn't seem to be a static archive available" + $ECHO "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $ECHO + $ECHO "*** Warning: This system can not link to static lib archive $lib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $ECHO "*** But as you try to build a module library, libtool will still create " + $ECHO "*** a static module, that should work as long as the dlopening application" + $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $ECHO + $ECHO "*** However, this would only work if libtool was able to extract symbol" + $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" + $ECHO "*** not find such a program. So, this module is probably useless." + $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if $opt_duplicate_deps ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_dirname "$deplib" "" "." + dir="$func_dirname_result" + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + $ECHO + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + *) + func_fatal_configuration "$modename: unknown library version type \`$version_type'" + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + libobjs="$libobjs $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + removelist="$removelist $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` + # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` + # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $ECHO + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $ECHO + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + $ECHO "*** I have the capability to make that library automatically link in when" + $ECHO "*** you link to this library. But I can only do this if you have a" + $ECHO "*** shared version of the library, which you do not appear to have" + $ECHO "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ + -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` + done + fi + if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | + $GREP . >/dev/null; then + $ECHO + if test "X$deplibs_check_method" = "Xnone"; then + $ECHO "*** Warning: inter-library dependencies are not supported in this platform." + else + $ECHO "*** Warning: inter-library dependencies are not known to be supported." + fi + $ECHO "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $ECHO + $ECHO "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + $ECHO "*** a static module, that should work as long as the dlopening" + $ECHO "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $ECHO + $ECHO "*** However, this would only work if libtool was able to extract symbol" + $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" + $ECHO "*** not find such a program. So, this module is probably useless." + $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $ECHO "*** The inter-library dependencies that have been dropped here will be" + $ECHO "*** automatically added whenever a program is linked with this library" + $ECHO "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $ECHO + $ECHO "*** Since this library must not contain undefined symbols," + $ECHO "*** because either the platform does not support them or" + $ECHO "*** it was explicitly requested with -no-undefined," + $ECHO "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + delfiles="$delfiles $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + func_len " $cmd" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + libobjs="$libobjs $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + output_la=`$ECHO "X$output" | $Xsed -e "$basename"` + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + $ECHO 'INPUT (' > $output + for obj in $save_libobjs + do + $ECHO "$obj" >> $output + done + $ECHO ')' >> $output + delfiles="$delfiles $output" + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + $ECHO "$obj" >> $output + done + delfiles="$delfiles $output" + output=$firstobj\"$file_list_spec$output\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=$obj + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + delfiles="$delfiles $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + libobjs="$libobjs $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + generated="$generated $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + new_libs="$new_libs -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$new_libs $deplib" ;; + esac + ;; + *) new_libs="$new_libs $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) dllsearchpath="$dllsearchpath:$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *cegcc) + # Disable wrappers for cegcc, we are cross compiling anyway. + wrappers_required=no + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $ECHO for shipping. + if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then + case $progpath in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; + *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; + esac + qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + oldobjs="$oldobjs $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $addlibs + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + + func_extract_archives $gentop $dlprefiles + oldobjs="$oldobjs $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $ECHO "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + generated="$generated $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + oldobjs="$oldobjs $gentop/$newobj" + ;; + *) oldobjs="$oldobjs $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + newdlfiles="$newdlfiles $libdir/$name" + ;; + *) newdlfiles="$newdlfiles $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + newdlprefiles="$newdlprefiles $libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$mode" = link || test "$mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) RM="$RM $arg"; rmforce=yes ;; + -*) RM="$RM $arg" ;; + *) files="$files $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + + case "$mode" in + clean) + case " $library_names " in + # " " in the beginning catches empty $dlname + *" $dlname "*) ;; + *) rmfiles="$rmfiles $objdir/$dlname" ;; + esac + test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + rmfiles="$rmfiles $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$mode" = uninstall || test "$mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff --git a/tools/Flips/libdivsufsort-2.0.1/config/missing b/tools/Flips/libdivsufsort-2.0.1/config/missing new file mode 100755 index 000000000..28055d2ae --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/config/missing @@ -0,0 +1,376 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + tar*) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar*) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/tools/Flips/libdivsufsort-2.0.1/configure b/tools/Flips/libdivsufsort-2.0.1/configure new file mode 100755 index 000000000..055a0fc73 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/configure @@ -0,0 +1,13977 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.67 for libdivsufsort 2.0.1. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and yuta.256@gmail.com +$0: about your system, including any error possibly output +$0: before this message. Then install a modern shell, or +$0: manually run the script under such a shell if you do +$0: have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +ECHO=${lt_ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<_LT_EOF +$* +_LT_EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null + then + break + fi + done + fi + + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : + else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$ECHO" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + ECHO='print -r' + elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + ECHO='printf %s\n' + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + ECHO="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + ECHO=echo + fi + fi + fi + fi + fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='libdivsufsort' +PACKAGE_TARNAME='libdivsufsort' +PACKAGE_VERSION='2.0.1' +PACKAGE_STRING='libdivsufsort 2.0.1' +PACKAGE_BUGREPORT='yuta.256@gmail.com' +PACKAGE_URL='' + +ac_unique_file="include/divsufsort.h.cmake" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +LFS_PRID +LFS_FSEEK +LFS_FTELL +LFS_FOPEN +LFS_OFF_T +DIVSUFSORT_IMPORT +DIVSUFSORT_EXPORT +W64BIT +SAINDEX_PRId +SAINDEX_TYPE +DIVSUFSORT64_FALSE +DIVSUFSORT64_TRUE +SAINT64_PRId +SAINT64_TYPE +SAINT_PRId +SAINT32_TYPE +SAUCHAR_TYPE +INCFILE +LIBTOOL_DEPS +CPP +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +lt_ECHO +RANLIB +AR +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +EGREP +GREP +SED +LIBTOOL +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +PROJECT_URL +PROJECT_VERSION_FULL +PROJECT_DESCRIPTION +PROJECT_NAME +LT_REVISION +LT_AGE +LT_CURRENT +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_os +target_vendor +target_cpu +target +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_maintainer_mode +enable_dependency_tracking +enable_shared +enable_static +with_pic +enable_fast_install +with_gnu_ld +enable_libtool_lock +enable_divsufsort64 +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures libdivsufsort 2.0.1 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/libdivsufsort] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of libdivsufsort 2.0.1:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-shared[=PKGS] build shared libraries [default=no] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-divsufsort64 build libdivsufsort64 + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +libdivsufsort configure 2.0.1 +generated by GNU Autoconf 2.67 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_func + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval "test \"\${$3+set}\"" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## --------------------------------- ## +## Report this to yuta.256@gmail.com ## +## --------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_type + +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by libdivsufsort $as_me 2.0.1, which was +generated by GNU Autoconf 2.67. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5 ; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_config_headers="$ac_config_headers include/config.h" + +ac_aux_dir= +for ac_dir in config "$srcdir"/config; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if test "${ac_cv_build+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if test "${ac_cv_host+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +$as_echo_n "checking target system type... " >&6; } +if test "${ac_cv_target+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +$as_echo "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- +am__api_version='1.11' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='libdivsufsort' + VERSION='2.0.1' + + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + +# LT_CURRENT = PROJECT_VERSION_MAJOR + PROJECT_VERSION_MINOR + 1 +# LT_AGE = PROJECT_VERSION_MINOR +# LT_REVISION = PROJECT_VERSION_PATCH +LT_CURRENT=3 + +LT_AGE=0 + +LT_REVISION=1 + +PROJECT_NAME=libdivsufsort + +PROJECT_DESCRIPTION="A lightweight suffix sorting library" + +PROJECT_VERSION_FULL=2.0.0 + +PROJECT_URL="http://libdivsufsort.googlecode.com/" + + +## Checks for programs. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5 ; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5 ; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5 ; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + + +## Checks for compiler output filename suffixes. + + + +## Check for build configuration. +#AM_DISABLE_STATIC +# Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=no +fi + + + + + + + + + +#AC_LIBTOOL_WIN32_DLL +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.2.6b' +macro_revision='1.3017' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if test "${ac_cv_path_SED+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if test "${ac_cv_path_FGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if test "${lt_cv_path_LD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if test "${lt_cv_prog_gnu_ld+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test "${lt_cv_path_NM+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$ac_tool_prefix"; then + for ac_prog in "dumpbin -symbols" "link -dump -symbols" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DUMPBIN+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in "dumpbin -symbols" "link -dump -symbols" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if test "${lt_cv_nm_interface+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:4888: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:4891: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:4894: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if test "${lt_cv_sys_max_cmd_len+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if test "${lt_cv_ld_reload_flag+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OBJDUMP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if test "${lt_cv_deplibs_check_method+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_AR+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + + + + + + + + + + + + + + + + + + + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 6100 "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if test "${lt_cv_cc_needs_belf+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_DSYMUTIL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_NMEDIT+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_LIPO+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OTOOL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_OTOOL64+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if test "${lt_cv_apple_cc_single_mod+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if test "${lt_cv_ld_exported_symbols_list+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5 ; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; pic_mode="$withval" +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if test "${lt_cv_objdir+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + + + + + + + + + + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7599: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7603: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 +$as_echo "$lt_prog_compiler_pic" >&6; } + + + + + + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test "${lt_cv_prog_compiler_pic_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:7938: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:7942: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test "${lt_cv_prog_compiler_static_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:8043: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:8047: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test "${lt_cv_prog_compiler_c_o+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:8098: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:8102: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu) + link_all_deplibs=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag= + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld='-rpath $libdir' + archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + link_all_deplibs=no + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='' + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=echo + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo(void) {} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 +$as_echo "$archive_cmds_need_lc" >&6; } + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = x""yes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if test "${ac_cv_lib_dld_shl_load+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if test "${ac_cv_lib_svld_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if test "${ac_cv_lib_dld_dld_link+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if test "${lt_cv_dlopen_self+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line 10482 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if test "${lt_cv_dlopen_self_static+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line 10578 "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + + +case "$target_os" in + cygwin* | mingw*) + LDFLAGS="$LDFLAGS -no-undefined" + ;; +esac + +## Checks for libraries. + +## Checks for header files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +for ac_header in inttypes.h memory.h stddef.h stdint.h stdlib.h string.h strings.h sys/types.h io.h fcntl.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +if test "$ac_cv_header_inttypes_h" == "yes"; then : + INCFILE="#include " + +elif test "$ac_cv_header_stdint_h" == "yes"; then : + INCFILE="#include " + +else + INCFILE="" + +fi + +## Checks for typedefs, structures, and compiler characteristics. +# sauchar_t +SAUCHAR_TYPE="" +ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" +if test "x$ac_cv_type_uint8_t" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINT8_T 1 +_ACEOF + + +fi + +if test "$ac_cv_type_uint8_t" = "yes"; then + SAUCHAR_TYPE="uint8_t" +fi +if test -z "$SAUCHAR_TYPE";then + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned char" >&5 +$as_echo_n "checking size of unsigned char... " >&6; } +if test "${ac_cv_sizeof_unsigned_char+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned char))" "ac_cv_sizeof_unsigned_char" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_unsigned_char" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (unsigned char) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_unsigned_char=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_char" >&5 +$as_echo "$ac_cv_sizeof_unsigned_char" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_UNSIGNED_CHAR $ac_cv_sizeof_unsigned_char +_ACEOF + + + if test "$ac_cv_sizeof_unsigned_char" = "1";then SAUCHAR_TYPE="unsigned char"; fi +fi +if test -z "$SAUCHAR_TYPE";then + as_fn_error $? "Cannot find unsigned 8-bit integer type" "$LINENO" 5 +fi + + +# saint_t and saidx_t +SAINT32_TYPE="" +ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" +if test "x$ac_cv_type_int32_t" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_INT32_T 1 +_ACEOF + + +fi + +if test "$ac_cv_type_int32_t" = "yes"; then + SAINT32_TYPE="int32_t"; + SAINT32_PRId="PRId32"; +fi +if test -z "$SAINT32_TYPE";then + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +$as_echo_n "checking size of int... " >&6; } +if test "${ac_cv_sizeof_int+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_int" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (int) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_int=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +$as_echo "$ac_cv_sizeof_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + + if test "$ac_cv_sizeof_int" = "4";then + SAINT32_TYPE="int"; + SAINT32_PRId="\"d\""; + fi +fi +if test -z "$SAINT32_TYPE";then + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +$as_echo_n "checking size of long... " >&6; } +if test "${ac_cv_sizeof_long+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +$as_echo "$ac_cv_sizeof_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + + if test "$ac_cv_sizeof_long" = "4"; then + SAINT32_TYPE="long"; + SAINT32_PRId="\"ld\""; + fi +fi +if test -z "$SAINT32_TYPE";then + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of __int32" >&5 +$as_echo_n "checking size of __int32... " >&6; } +if test "${ac_cv_sizeof___int32+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (__int32))" "ac_cv_sizeof___int32" "$ac_includes_default"; then : + +else + if test "$ac_cv_type___int32" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (__int32) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof___int32=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof___int32" >&5 +$as_echo "$ac_cv_sizeof___int32" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF___INT32 $ac_cv_sizeof___int32 +_ACEOF + + + if test "$ac_cv_sizeof___int32" = "4"; then + SAINT32_TYPE="__int32"; + SAINT32_PRId="\"I32d\""; + fi +fi +if test -z "$SAINT32_TYPE";then + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 +$as_echo_n "checking size of short... " >&6; } +if test "${ac_cv_sizeof_short+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_short" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (short) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_short=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 +$as_echo "$ac_cv_sizeof_short" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SHORT $ac_cv_sizeof_short +_ACEOF + + + if test "$ac_cv_sizeof_short" = "4"; then + SAINT32_TYPE="short"; + SAINT32_PRId="\"d\""; + fi +fi +if test -z "$SAINT32_TYPE";then + as_fn_error $? "Could not find 32-bit integer type" "$LINENO" 5 +fi + +SAINT_PRId="$SAINT32_PRId" + + +# Check whether --enable-divsufsort64 was given. +if test "${enable_divsufsort64+set}" = set; then : + enableval=$enable_divsufsort64; +fi + +if test "$enable_divsufsort64" = "yes"; then + # saint64_t + SAINT64_TYPE="" + ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default" +if test "x$ac_cv_type_int64_t" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_INT64_T 1 +_ACEOF + + +fi + + if test "$ac_cv_type_int64_t" = "yes"; then + SAINT64_TYPE="int64_t"; + SAINT64_PRId="PRId64"; + fi + if test -z "$SAINT64_TYPE";then + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 +$as_echo_n "checking size of long long... " >&6; } +if test "${ac_cv_sizeof_long_long+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long long) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_long_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 +$as_echo "$ac_cv_sizeof_long_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long +_ACEOF + + + if test "$ac_cv_sizeof_long_long" = "8";then + SAINT64_TYPE="long long"; + SAINT64_PRId="\"lld\""; + fi + fi + if test -z "$SAINT64_TYPE";then + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +$as_echo_n "checking size of long... " >&6; } +if test "${ac_cv_sizeof_long+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_long=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +$as_echo "$ac_cv_sizeof_long" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + + if test "$ac_cv_sizeof_long" = "8";then + SAINT64_TYPE="long"; + SAINT64_PRId="\"ld\""; + fi + fi + if test -z "$SAINT64_TYPE";then + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +$as_echo_n "checking size of int... " >&6; } +if test "${ac_cv_sizeof_int+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_int" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (int) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof_int=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +$as_echo "$ac_cv_sizeof_int" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + + if test "$ac_cv_sizeof_int" = "8";then + SAINT64_TYPE="int"; + SAINT64_PRId="\"d\""; + fi + fi + if test -z "$SAINT64_TYPE";then + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of __int64" >&5 +$as_echo_n "checking size of __int64... " >&6; } +if test "${ac_cv_sizeof___int64+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (__int64))" "ac_cv_sizeof___int64" "$ac_includes_default"; then : + +else + if test "$ac_cv_type___int64" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (__int64) +See \`config.log' for more details" "$LINENO" 5 ; } + else + ac_cv_sizeof___int64=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof___int64" >&5 +$as_echo "$ac_cv_sizeof___int64" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF___INT64 $ac_cv_sizeof___int64 +_ACEOF + + + if test "$ac_cv_sizeof___int64" = "8";then + SAINT64_TYPE="__int32"; + SAINT64_PRId="\"I64d\""; + fi + fi + if test -z "$SAINT64_TYPE";then + as_fn_error $? "Could not find 64-bit integer type" "$LINENO" 5 + fi + + ac_config_files="$ac_config_files include/divsufsort64.h:include/divsufsort64.h.in" + + + + +fi + + if test "$enable_divsufsort64" = "yes"; then + DIVSUFSORT64_TRUE= + DIVSUFSORT64_FALSE='#' +else + DIVSUFSORT64_TRUE='#' + DIVSUFSORT64_FALSE= +fi + + +SAINDEX_TYPE="$SAINT32_TYPE" + +SAINDEX_PRId="$SAINT32_PRId" + + + + + + +LFS_OFF_T=long + +LFS_FOPEN=fopen + +LFS_FTELL=ftell + +LFS_FSEEK=fseek + +LFS_PRID="\"ld\"" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if test "${ac_cv_c_const+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset cs; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if test "${ac_cv_c_inline+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + + +$as_echo "#define INLINE inline" >>confdefs.h + + +$as_echo "#define PROJECT_VERSION_FULL PACKAGE_VERSION" >>confdefs.h + + +## Checks for library functions. +for ac_header in stdlib.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STDLIB_H 1 +_ACEOF + +fi + +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 +$as_echo_n "checking for GNU libc compatible malloc... " >&6; } +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_malloc_0_nonnull=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif + +int +main () +{ +return ! malloc (0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_malloc_0_nonnull=yes +else + ac_cv_func_malloc_0_nonnull=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes; then : + +$as_echo "#define HAVE_MALLOC 1" >>confdefs.h + +else + $as_echo "#define HAVE_MALLOC 0" >>confdefs.h + + case " $LIBOBJS " in + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" + ;; +esac + + +$as_echo "#define malloc rpl_malloc" >>confdefs.h + +fi + + +for ac_func in fopen_s _setmode setmode _fileno +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "$ac_cv_func_setmode" = "yes"; then + if test "$ac_cv_func__setmode" = "no"; then + +$as_echo "#define _setmode setmode" >>confdefs.h + + +$as_echo "#define HAVE__SETMODE 1" >>confdefs.h + + fi +fi + +ac_config_files="$ac_config_files Makefile include/Makefile include/divsufsort.h:include/divsufsort.h.cmake include/lfs.h:include/lfs.h.cmake lib/Makefile examples/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${DIVSUFSORT64_TRUE}" && test -z "${DIVSUFSORT64_FALSE}"; then + as_fn_error $? "conditional \"DIVSUFSORT64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by libdivsufsort $as_me 2.0.1, which was +generated by GNU Autoconf 2.67. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +libdivsufsort config.status 2.0.1 +configured by $0, generated by GNU Autoconf 2.67, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' +macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' +macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' +enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' +pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' +host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' +host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' +host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' +build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' +build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' +build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' +SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' +Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' +GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' +EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' +FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' +LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' +NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' +LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' +ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' +exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' +lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' +reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' +AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' +STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' +RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' +compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' +GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' +SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' +ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' +need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' +LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' +libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' +fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' +need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' +version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' +runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' +libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' +soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' +finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' +old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' +striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# Quote evaled strings. +for var in SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +AR \ +AR_FLAGS \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +SHELL \ +ECHO \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_wl \ +lt_prog_compiler_pic \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_flag_spec_ld \ +hardcode_libdir_separator \ +fix_srcfile_path \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` + ;; +esac + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "include/divsufsort64.h") CONFIG_FILES="$CONFIG_FILES include/divsufsort64.h:include/divsufsort64.h.in" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "include/divsufsort.h") CONFIG_FILES="$CONFIG_FILES include/divsufsort.h:include/divsufsort.h.cmake" ;; + "include/lfs.h") CONFIG_FILES="$CONFIG_FILES include/lfs.h:include/lfs.h.cmake" ;; + "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; + "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that does not interpret backslashes. +ECHO=$lt_ECHO + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path=$lt_fix_srcfile_path + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $* )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[^=]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$@"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1+=\$2" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$1=\$$1\$2" +} + +_LT_EOF + ;; + esac + + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/tools/Flips/libdivsufsort-2.0.1/configure.ac b/tools/Flips/libdivsufsort-2.0.1/configure.ac new file mode 100644 index 000000000..497f914ce --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/configure.ac @@ -0,0 +1,198 @@ +## configure.ac for libdivsufsort + +AC_PREREQ(2.61) + +AC_INIT([libdivsufsort], [2.0.1], [yuta.256@gmail.com]) +AC_CONFIG_SRCDIR([include/divsufsort.h.cmake]) +AC_CONFIG_HEADER([include/config.h]) +AC_CONFIG_AUX_DIR([config]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CANONICAL_TARGET +AM_INIT_AUTOMAKE([-Wall -Werror foreign 1.10.1 no-define dist-bzip2]) +AM_MAINTAINER_MODE + +# LT_CURRENT = PROJECT_VERSION_MAJOR + PROJECT_VERSION_MINOR + 1 +# LT_AGE = PROJECT_VERSION_MINOR +# LT_REVISION = PROJECT_VERSION_PATCH +AC_SUBST(LT_CURRENT, 3) +AC_SUBST(LT_AGE, 0) +AC_SUBST(LT_REVISION, 1) +AC_SUBST([PROJECT_NAME], [libdivsufsort]) +AC_SUBST([PROJECT_DESCRIPTION], "A lightweight suffix sorting library") +AC_SUBST([PROJECT_VERSION_FULL], [2.0.0]) +AC_SUBST([PROJECT_URL], "http://libdivsufsort.googlecode.com/") + +## Checks for programs. +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_MAKE_SET + +## Checks for compiler output filename suffixes. +AC_OBJEXT +AC_EXEEXT + +## Check for build configuration. +#AM_DISABLE_STATIC +AM_DISABLE_SHARED +#AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL +AC_SUBST([LIBTOOL_DEPS]) + +case "$target_os" in + cygwin* | mingw*) + LDFLAGS="$LDFLAGS -no-undefined" + ;; +esac + +## Checks for libraries. + +## Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([inttypes.h memory.h stddef.h stdint.h stdlib.h string.h strings.h sys/types.h io.h fcntl.h]) +AS_IF([test "$ac_cv_header_inttypes_h" == "yes"], + [AC_SUBST([INCFILE], ["#include "])], + [test "$ac_cv_header_stdint_h" == "yes"], + [AC_SUBST([INCFILE], ["#include "])], + [AC_SUBST([INCFILE], [""])]) + +## Checks for typedefs, structures, and compiler characteristics. +# sauchar_t +SAUCHAR_TYPE="" +AC_CHECK_TYPES([uint8_t]) +if test "$ac_cv_type_uint8_t" = "yes"; then + SAUCHAR_TYPE="uint8_t" +fi +if test -z "$SAUCHAR_TYPE";then + AC_CHECK_SIZEOF([unsigned char], 1) + if test "$ac_cv_sizeof_unsigned_char" = "1";then SAUCHAR_TYPE="unsigned char"; fi +fi +if test -z "$SAUCHAR_TYPE";then + AC_MSG_ERROR([Cannot find unsigned 8-bit integer type]) +fi +AC_SUBST([SAUCHAR_TYPE]) + +# saint_t and saidx_t +SAINT32_TYPE="" +AC_CHECK_TYPES([int32_t]) +if test "$ac_cv_type_int32_t" = "yes"; then + SAINT32_TYPE="int32_t"; + SAINT32_PRId="PRId32"; +fi +if test -z "$SAINT32_TYPE";then + AC_CHECK_SIZEOF([int], 4) + if test "$ac_cv_sizeof_int" = "4";then + SAINT32_TYPE="int"; + SAINT32_PRId="\"d\""; + fi +fi +if test -z "$SAINT32_TYPE";then + AC_CHECK_SIZEOF([long], 4) + if test "$ac_cv_sizeof_long" = "4"; then + SAINT32_TYPE="long"; + SAINT32_PRId="\"ld\""; + fi +fi +if test -z "$SAINT32_TYPE";then + AC_CHECK_SIZEOF([__int32], 4) + if test "$ac_cv_sizeof___int32" = "4"; then + SAINT32_TYPE="__int32"; + SAINT32_PRId="\"I32d\""; + fi +fi +if test -z "$SAINT32_TYPE";then + AC_CHECK_SIZEOF([short], 4) + if test "$ac_cv_sizeof_short" = "4"; then + SAINT32_TYPE="short"; + SAINT32_PRId="\"d\""; + fi +fi +if test -z "$SAINT32_TYPE";then + AC_MSG_ERROR([Could not find 32-bit integer type]) +fi +AC_SUBST([SAINT32_TYPE]) +AC_SUBST([SAINT_PRId], "$SAINT32_PRId") + +AC_ARG_ENABLE(divsufsort64, AC_HELP_STRING([--enable-divsufsort64], [build libdivsufsort64])) +if test "$enable_divsufsort64" = "yes"; then + # saint64_t + SAINT64_TYPE="" + AC_CHECK_TYPES([int64_t]) + if test "$ac_cv_type_int64_t" = "yes"; then + SAINT64_TYPE="int64_t"; + SAINT64_PRId="PRId64"; + fi + if test -z "$SAINT64_TYPE";then + AC_CHECK_SIZEOF([long long], 8) + if test "$ac_cv_sizeof_long_long" = "8";then + SAINT64_TYPE="long long"; + SAINT64_PRId="\"lld\""; + fi + fi + if test -z "$SAINT64_TYPE";then + AC_CHECK_SIZEOF([long], 8) + if test "$ac_cv_sizeof_long" = "8";then + SAINT64_TYPE="long"; + SAINT64_PRId="\"ld\""; + fi + fi + if test -z "$SAINT64_TYPE";then + AC_CHECK_SIZEOF([int], 8) + if test "$ac_cv_sizeof_int" = "8";then + SAINT64_TYPE="int"; + SAINT64_PRId="\"d\""; + fi + fi + if test -z "$SAINT64_TYPE";then + AC_CHECK_SIZEOF([__int64], 8) + if test "$ac_cv_sizeof___int64" = "8";then + SAINT64_TYPE="__int32"; + SAINT64_PRId="\"I64d\""; + fi + fi + if test -z "$SAINT64_TYPE";then + AC_MSG_ERROR([Could not find 64-bit integer type]) + fi + + AC_CONFIG_FILES([include/divsufsort64.h:include/divsufsort64.h.in]) + + AC_SUBST([SAINT64_TYPE]) + AC_SUBST([SAINT64_PRId]) +fi + +AM_CONDITIONAL([DIVSUFSORT64], test "$enable_divsufsort64" = "yes") + +AC_SUBST([SAINDEX_TYPE], "$SAINT32_TYPE") +AC_SUBST([SAINDEX_PRId], "$SAINT32_PRId") +AC_SUBST([W64BIT], []) + +AC_SUBST([DIVSUFSORT_EXPORT], []) +AC_SUBST([DIVSUFSORT_IMPORT], []) + +AC_SUBST([LFS_OFF_T], [long]) +AC_SUBST([LFS_FOPEN], [fopen]) +AC_SUBST([LFS_FTELL], [ftell]) +AC_SUBST([LFS_FSEEK], [fseek]) +AC_SUBST([LFS_PRID], ["\"ld\""]) + +AC_C_CONST +AC_C_INLINE +AC_DEFINE(INLINE, [inline], [for inline]) +AC_DEFINE(PROJECT_VERSION_FULL, [PACKAGE_VERSION], [Define to the version of this package.]) + +## Checks for library functions. +AC_FUNC_MALLOC +AC_CHECK_FUNCS([fopen_s _setmode setmode _fileno]) +if test "$ac_cv_func_setmode" = "yes"; then + if test "$ac_cv_func__setmode" = "no"; then + AC_DEFINE(_setmode, [setmode], [for _setmode]) + AC_DEFINE(HAVE__SETMODE, 1, [for _setmode]) + fi +fi + +AC_CONFIG_FILES([Makefile + include/Makefile + include/divsufsort.h:include/divsufsort.h.cmake + include/lfs.h:include/lfs.h.cmake + lib/Makefile + examples/Makefile]) +AC_OUTPUT diff --git a/tools/Flips/libdivsufsort-2.0.1/examples/Makefile.am b/tools/Flips/libdivsufsort-2.0.1/examples/Makefile.am new file mode 100644 index 000000000..ba81b7d62 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/examples/Makefile.am @@ -0,0 +1,6 @@ +# Makefile.am for libdivsufsort + +noinst_PROGRAMS = suftest mksary sasearch bwt unbwt +LDADD = $(top_builddir)/lib/libdivsufsort.la + +EXTRA_DIST = CMakeLists.txt diff --git a/tools/Flips/libdivsufsort-2.0.1/examples/Makefile.in b/tools/Flips/libdivsufsort-2.0.1/examples/Makefile.in new file mode 100644 index 000000000..6c6bb6c7d --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/examples/Makefile.in @@ -0,0 +1,534 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Makefile.am for libdivsufsort + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +noinst_PROGRAMS = suftest$(EXEEXT) mksary$(EXEEXT) sasearch$(EXEEXT) \ + bwt$(EXEEXT) unbwt$(EXEEXT) +subdir = examples +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +bwt_SOURCES = bwt.c +bwt_OBJECTS = bwt.$(OBJEXT) +bwt_LDADD = $(LDADD) +bwt_DEPENDENCIES = $(top_builddir)/lib/libdivsufsort.la +mksary_SOURCES = mksary.c +mksary_OBJECTS = mksary.$(OBJEXT) +mksary_LDADD = $(LDADD) +mksary_DEPENDENCIES = $(top_builddir)/lib/libdivsufsort.la +sasearch_SOURCES = sasearch.c +sasearch_OBJECTS = sasearch.$(OBJEXT) +sasearch_LDADD = $(LDADD) +sasearch_DEPENDENCIES = $(top_builddir)/lib/libdivsufsort.la +suftest_SOURCES = suftest.c +suftest_OBJECTS = suftest.$(OBJEXT) +suftest_LDADD = $(LDADD) +suftest_DEPENDENCIES = $(top_builddir)/lib/libdivsufsort.la +unbwt_SOURCES = unbwt.c +unbwt_OBJECTS = unbwt.$(OBJEXT) +unbwt_LDADD = $(LDADD) +unbwt_DEPENDENCIES = $(top_builddir)/lib/libdivsufsort.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = bwt.c mksary.c sasearch.c suftest.c unbwt.c +DIST_SOURCES = bwt.c mksary.c sasearch.c suftest.c unbwt.c +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIVSUFSORT_EXPORT = @DIVSUFSORT_EXPORT@ +DIVSUFSORT_IMPORT = @DIVSUFSORT_IMPORT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INCFILE = @INCFILE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LFS_FOPEN = @LFS_FOPEN@ +LFS_FSEEK = @LFS_FSEEK@ +LFS_FTELL = @LFS_FTELL@ +LFS_OFF_T = @LFS_OFF_T@ +LFS_PRID = @LFS_PRID@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PROJECT_DESCRIPTION = @PROJECT_DESCRIPTION@ +PROJECT_NAME = @PROJECT_NAME@ +PROJECT_URL = @PROJECT_URL@ +PROJECT_VERSION_FULL = @PROJECT_VERSION_FULL@ +RANLIB = @RANLIB@ +SAINDEX_PRId = @SAINDEX_PRId@ +SAINDEX_TYPE = @SAINDEX_TYPE@ +SAINT32_TYPE = @SAINT32_TYPE@ +SAINT64_PRId = @SAINT64_PRId@ +SAINT64_TYPE = @SAINT64_TYPE@ +SAINT_PRId = @SAINT_PRId@ +SAUCHAR_TYPE = @SAUCHAR_TYPE@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +W64BIT = @W64BIT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +LDADD = $(top_builddir)/lib/libdivsufsort.la +EXTRA_DIST = CMakeLists.txt +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign examples/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +bwt$(EXEEXT): $(bwt_OBJECTS) $(bwt_DEPENDENCIES) + @rm -f bwt$(EXEEXT) + $(LINK) $(bwt_OBJECTS) $(bwt_LDADD) $(LIBS) +mksary$(EXEEXT): $(mksary_OBJECTS) $(mksary_DEPENDENCIES) + @rm -f mksary$(EXEEXT) + $(LINK) $(mksary_OBJECTS) $(mksary_LDADD) $(LIBS) +sasearch$(EXEEXT): $(sasearch_OBJECTS) $(sasearch_DEPENDENCIES) + @rm -f sasearch$(EXEEXT) + $(LINK) $(sasearch_OBJECTS) $(sasearch_LDADD) $(LIBS) +suftest$(EXEEXT): $(suftest_OBJECTS) $(suftest_DEPENDENCIES) + @rm -f suftest$(EXEEXT) + $(LINK) $(suftest_OBJECTS) $(suftest_LDADD) $(LIBS) +unbwt$(EXEEXT): $(unbwt_OBJECTS) $(unbwt_DEPENDENCIES) + @rm -f unbwt$(EXEEXT) + $(LINK) $(unbwt_OBJECTS) $(unbwt_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bwt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mksary.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sasearch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/suftest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unbwt.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tools/Flips/libdivsufsort-2.0.1/examples/bwt.c b/tools/Flips/libdivsufsort-2.0.1/examples/bwt.c new file mode 100644 index 000000000..5a362d017 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/examples/bwt.c @@ -0,0 +1,220 @@ +/* + * bwt.c for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#if HAVE_STRING_H +# include +#endif +#if HAVE_STDLIB_H +# include +#endif +#if HAVE_MEMORY_H +# include +#endif +#if HAVE_STDDEF_H +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_IO_H && HAVE_FCNTL_H +# include +# include +#endif +#include +#include +#include "lfs.h" + + +static +size_t +write_int(FILE *fp, saidx_t n) { + unsigned char c[4]; + c[0] = (unsigned char)((n >> 0) & 0xff), c[1] = (unsigned char)((n >> 8) & 0xff), + c[2] = (unsigned char)((n >> 16) & 0xff), c[3] = (unsigned char)((n >> 24) & 0xff); + return fwrite(c, sizeof(unsigned char), 4, fp); +} + +static +void +print_help(const char *progname, int status) { + fprintf(stderr, + "bwt, a burrows-wheeler transform program, version %s.\n", + divsufsort_version()); + fprintf(stderr, "usage: %s [-b num] INFILE OUTFILE\n", progname); + fprintf(stderr, " -b num set block size to num MiB [1..512] (default: 32)\n\n"); + exit(status); +} + +int +main(int argc, const char *argv[]) { + FILE *fp, *ofp; + const char *fname, *ofname; + sauchar_t *T; + saidx_t *SA; + LFS_OFF_T n; + size_t m; + saidx_t pidx; + clock_t start,finish; + saint_t i, blocksize = 32, needclose = 3; + + /* Check arguments. */ + if((argc == 1) || + (strcmp(argv[1], "-h") == 0) || + (strcmp(argv[1], "--help") == 0)) { print_help(argv[0], EXIT_SUCCESS); } + if((argc != 3) && (argc != 5)) { print_help(argv[0], EXIT_FAILURE); } + i = 1; + if(argc == 5) { + if(strcmp(argv[i], "-b") != 0) { print_help(argv[0], EXIT_FAILURE); } + blocksize = atoi(argv[i + 1]); + if(blocksize < 0) { blocksize = 1; } + else if(512 < blocksize) { blocksize = 512; } + i += 2; + } + blocksize <<= 20; + + /* Open a file for reading. */ + if(strcmp(argv[i], "-") != 0) { +#if HAVE_FOPEN_S + if(fopen_s(&fp, fname = argv[i], "rb") != 0) { +#else + if((fp = LFS_FOPEN(fname = argv[i], "rb")) == NULL) { +#endif + fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], fname); + perror(NULL); + exit(EXIT_FAILURE); + } + } else { +#if HAVE__SETMODE && HAVE__FILENO + if(_setmode(_fileno(stdin), _O_BINARY) == -1) { + fprintf(stderr, "%s: Cannot set mode: ", argv[0]); + perror(NULL); + exit(EXIT_FAILURE); + } +#endif + fp = stdin; + fname = "stdin"; + needclose ^= 1; + } + i += 1; + + /* Open a file for writing. */ + if(strcmp(argv[i], "-") != 0) { +#if HAVE_FOPEN_S + if(fopen_s(&ofp, ofname = argv[i], "wb") != 0) { +#else + if((ofp = LFS_FOPEN(ofname = argv[i], "wb")) == NULL) { +#endif + fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], ofname); + perror(NULL); + exit(EXIT_FAILURE); + } + } else { +#if HAVE__SETMODE && HAVE__FILENO + if(_setmode(_fileno(stdout), _O_BINARY) == -1) { + fprintf(stderr, "%s: Cannot set mode: ", argv[0]); + perror(NULL); + exit(EXIT_FAILURE); + } +#endif + ofp = stdout; + ofname = "stdout"; + needclose ^= 2; + } + + /* Get the file size. */ + if(LFS_FSEEK(fp, 0, SEEK_END) == 0) { + n = LFS_FTELL(fp); + rewind(fp); + if(n < 0) { + fprintf(stderr, "%s: Cannot ftell `%s': ", argv[0], fname); + perror(NULL); + exit(EXIT_FAILURE); + } + if(0x20000000L < n) { n = 0x20000000L; } + if((blocksize == 0) || (n < blocksize)) { blocksize = (saidx_t)n; } + } else if(blocksize == 0) { blocksize = 32 << 20; } + + /* Allocate 5blocksize bytes of memory. */ + T = (sauchar_t *)malloc(blocksize * sizeof(sauchar_t)); + SA = (saidx_t *)malloc(blocksize * sizeof(saidx_t)); + if((T == NULL) || (SA == NULL)) { + fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]); + exit(EXIT_FAILURE); + } + + /* Write the blocksize. */ + if(write_int(ofp, blocksize) != 4) { + fprintf(stderr, "%s: Cannot write to `%s': ", argv[0], ofname); + perror(NULL); + exit(EXIT_FAILURE); + } + + fprintf(stderr, " BWT (blocksize %" PRIdSAINT_T ") ... ", blocksize); + start = clock(); + for(n = 0; 0 < (m = fread(T, sizeof(sauchar_t), blocksize, fp)); n += m) { + /* Burrows-Wheeler Transform. */ + pidx = divbwt(T, T, SA, m); + if(pidx < 0) { + fprintf(stderr, "%s (bw_transform): %s.\n", + argv[0], + (pidx == -1) ? "Invalid arguments" : "Cannot allocate memory"); + exit(EXIT_FAILURE); + } + + /* Write the bwted data. */ + if((write_int(ofp, pidx) != 4) || + (fwrite(T, sizeof(sauchar_t), m, ofp) != m)) { + fprintf(stderr, "%s: Cannot write to `%s': ", argv[0], ofname); + perror(NULL); + exit(EXIT_FAILURE); + } + } + if(ferror(fp)) { + fprintf(stderr, "%s: Cannot read from `%s': ", argv[0], fname); + perror(NULL); + exit(EXIT_FAILURE); + } + finish = clock(); + fprintf(stderr, "%" PRIdOFF_T " bytes: %.4f sec\n", + n, (double)(finish - start) / (double)CLOCKS_PER_SEC); + + /* Close files */ + if(needclose & 1) { fclose(fp); } + if(needclose & 2) { fclose(ofp); } + + /* Deallocate memory. */ + free(SA); + free(T); + + return 0; +} diff --git a/tools/Flips/libdivsufsort-2.0.1/examples/mksary.c b/tools/Flips/libdivsufsort-2.0.1/examples/mksary.c new file mode 100644 index 000000000..b48177cf8 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/examples/mksary.c @@ -0,0 +1,193 @@ +/* + * mksary.c for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#if HAVE_STRING_H +# include +#endif +#if HAVE_STDLIB_H +# include +#endif +#if HAVE_MEMORY_H +# include +#endif +#if HAVE_STDDEF_H +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_IO_H && HAVE_FCNTL_H +# include +# include +#endif +#include +#include +#include "lfs.h" + + +static +void +print_help(const char *progname, int status) { + fprintf(stderr, + "mksary, a simple suffix array builder, version %s.\n", + divsufsort_version()); + fprintf(stderr, "usage: %s INFILE OUTFILE\n\n", progname); + exit(status); +} + +int +main(int argc, const char *argv[]) { + FILE *fp, *ofp; + const char *fname, *ofname; + sauchar_t *T; + saidx_t *SA; + LFS_OFF_T n; + clock_t start, finish; + saint_t needclose = 3; + + /* Check arguments. */ + if((argc == 1) || + (strcmp(argv[1], "-h") == 0) || + (strcmp(argv[1], "--help") == 0)) { print_help(argv[0], EXIT_SUCCESS); } + if(argc != 3) { print_help(argv[0], EXIT_FAILURE); } + + /* Open a file for reading. */ + if(strcmp(argv[1], "-") != 0) { +#if HAVE_FOPEN_S + if(fopen_s(&fp, fname = argv[1], "rb") != 0) { +#else + if((fp = LFS_FOPEN(fname = argv[1], "rb")) == NULL) { +#endif + fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], fname); + perror(NULL); + exit(EXIT_FAILURE); + } + } else { +#if HAVE__SETMODE && HAVE__FILENO + if(_setmode(_fileno(stdin), _O_BINARY) == -1) { + fprintf(stderr, "%s: Cannot set mode: ", argv[0]); + perror(NULL); + exit(EXIT_FAILURE); + } +#endif + fp = stdin; + fname = "stdin"; + needclose ^= 1; + } + + /* Open a file for writing. */ + if(strcmp(argv[2], "-") != 0) { +#if HAVE_FOPEN_S + if(fopen_s(&ofp, ofname = argv[2], "wb") != 0) { +#else + if((ofp = LFS_FOPEN(ofname = argv[2], "wb")) == NULL) { +#endif + fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], ofname); + perror(NULL); + exit(EXIT_FAILURE); + } + } else { +#if HAVE__SETMODE && HAVE__FILENO + if(_setmode(_fileno(stdout), _O_BINARY) == -1) { + fprintf(stderr, "%s: Cannot set mode: ", argv[0]); + perror(NULL); + exit(EXIT_FAILURE); + } +#endif + ofp = stdout; + ofname = "stdout"; + needclose ^= 2; + } + + /* Get the file size. */ + if(LFS_FSEEK(fp, 0, SEEK_END) == 0) { + n = LFS_FTELL(fp); + rewind(fp); + if(n < 0) { + fprintf(stderr, "%s: Cannot ftell `%s': ", argv[0], fname); + perror(NULL); + exit(EXIT_FAILURE); + } + if(0x7fffffff <= n) { + fprintf(stderr, "%s: Input file `%s' is too big.\n", argv[0], fname); + exit(EXIT_FAILURE); + } + } else { + fprintf(stderr, "%s: Cannot fseek `%s': ", argv[0], fname); + perror(NULL); + exit(EXIT_FAILURE); + } + + /* Allocate 5blocksize bytes of memory. */ + T = (sauchar_t *)malloc((size_t)n * sizeof(sauchar_t)); + SA = (saidx_t *)malloc((size_t)n * sizeof(saidx_t)); + if((T == NULL) || (SA == NULL)) { + fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]); + exit(EXIT_FAILURE); + } + + /* Read n bytes of data. */ + if(fread(T, sizeof(sauchar_t), (size_t)n, fp) != (size_t)n) { + fprintf(stderr, "%s: %s `%s': ", + argv[0], + (ferror(fp) || !feof(fp)) ? "Cannot read from" : "Unexpected EOF in", + fname); + perror(NULL); + exit(EXIT_FAILURE); + } + if(needclose & 1) { fclose(fp); } + + /* Construct the suffix array. */ + fprintf(stderr, "%s: %" PRIdOFF_T " bytes ... ", fname, n); + start = clock(); + if(divsufsort(T, SA, (saidx_t)n) != 0) { + fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]); + exit(EXIT_FAILURE); + } + finish = clock(); + fprintf(stderr, "%.4f sec\n", (double)(finish - start) / (double)CLOCKS_PER_SEC); + + /* Write the suffix array. */ + if(fwrite(SA, sizeof(saidx_t), (size_t)n, ofp) != (size_t)n) { + fprintf(stderr, "%s: Cannot write to `%s': ", argv[0], ofname); + perror(NULL); + exit(EXIT_FAILURE); + } + if(needclose & 2) { fclose(ofp); } + + /* Deallocate memory. */ + free(SA); + free(T); + + return 0; +} diff --git a/tools/Flips/libdivsufsort-2.0.1/examples/sasearch.c b/tools/Flips/libdivsufsort-2.0.1/examples/sasearch.c new file mode 100644 index 000000000..7e5ca4fe0 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/examples/sasearch.c @@ -0,0 +1,165 @@ +/* + * sasearch.c for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#if HAVE_STRING_H +# include +#endif +#if HAVE_STDLIB_H +# include +#endif +#if HAVE_MEMORY_H +# include +#endif +#if HAVE_STDDEF_H +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_IO_H && HAVE_FCNTL_H +# include +# include +#endif +#include +#include "lfs.h" + + +static +void +print_help(const char *progname, int status) { + fprintf(stderr, + "sasearch, a simple SA-based full-text search tool, version %s\n", + divsufsort_version()); + fprintf(stderr, "usage: %s PATTERN FILE SAFILE\n\n", progname); + exit(status); +} + +int +main(int argc, const char *argv[]) { + FILE *fp; + const char *P; + sauchar_t *T; + saidx_t *SA; + LFS_OFF_T n; + size_t Psize; + saidx_t i, size, left; + + if((argc == 1) || + (strcmp(argv[1], "-h") == 0) || + (strcmp(argv[1], "--help") == 0)) { print_help(argv[0], EXIT_SUCCESS); } + if(argc != 4) { print_help(argv[0], EXIT_FAILURE); } + + P = argv[1]; + Psize = strlen(P); + + /* Open a file for reading. */ +#if HAVE_FOPEN_S + if(fopen_s(&fp, argv[2], "rb") != 0) { +#else + if((fp = LFS_FOPEN(argv[2], "rb")) == NULL) { +#endif + fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], argv[2]); + perror(NULL); + exit(EXIT_FAILURE); + } + + /* Get the file size. */ + if(LFS_FSEEK(fp, 0, SEEK_END) == 0) { + n = LFS_FTELL(fp); + rewind(fp); + if(n < 0) { + fprintf(stderr, "%s: Cannot ftell `%s': ", argv[0], argv[2]); + perror(NULL); + exit(EXIT_FAILURE); + } + } else { + fprintf(stderr, "%s: Cannot fseek `%s': ", argv[0], argv[2]); + perror(NULL); + exit(EXIT_FAILURE); + } + + /* Allocate 5n bytes of memory. */ + T = (sauchar_t *)malloc((size_t)n * sizeof(sauchar_t)); + SA = (saidx_t *)malloc((size_t)n * sizeof(saidx_t)); + if((T == NULL) || (SA == NULL)) { + fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]); + exit(EXIT_FAILURE); + } + + /* Read n bytes of data. */ + if(fread(T, sizeof(sauchar_t), (size_t)n, fp) != (size_t)n) { + fprintf(stderr, "%s: %s `%s': ", + argv[0], + (ferror(fp) || !feof(fp)) ? "Cannot read from" : "Unexpected EOF in", + argv[2]); + perror(NULL); + exit(EXIT_FAILURE); + } + fclose(fp); + + /* Open the SA file for reading. */ +#if HAVE_FOPEN_S + if(fopen_s(&fp, argv[3], "rb") != 0) { +#else + if((fp = LFS_FOPEN(argv[3], "rb")) == NULL) { +#endif + fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], argv[3]); + perror(NULL); + exit(EXIT_FAILURE); + } + + /* Read n * sizeof(saidx_t) bytes of data. */ + if(fread(SA, sizeof(saidx_t), (size_t)n, fp) != (size_t)n) { + fprintf(stderr, "%s: %s `%s': ", + argv[0], + (ferror(fp) || !feof(fp)) ? "Cannot read from" : "Unexpected EOF in", + argv[3]); + perror(NULL); + exit(EXIT_FAILURE); + } + fclose(fp); + + /* Search and print */ + size = sa_search(T, (saidx_t)n, + (const sauchar_t *)P, (saidx_t)Psize, + SA, (saidx_t)n, &left); + for(i = 0; i < size; ++i) { + fprintf(stdout, "%" PRIdSAIDX_T "\n", SA[left + i]); + } + + /* Deallocate memory. */ + free(SA); + free(T); + + return 0; +} diff --git a/tools/Flips/libdivsufsort-2.0.1/examples/suftest.c b/tools/Flips/libdivsufsort-2.0.1/examples/suftest.c new file mode 100644 index 000000000..71892ac17 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/examples/suftest.c @@ -0,0 +1,164 @@ +/* + * suftest.c for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#if HAVE_STRING_H +# include +#endif +#if HAVE_STDLIB_H +# include +#endif +#if HAVE_MEMORY_H +# include +#endif +#if HAVE_STDDEF_H +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_IO_H && HAVE_FCNTL_H +# include +# include +#endif +#include +#include +#include "lfs.h" + + +static +void +print_help(const char *progname, int status) { + fprintf(stderr, + "suftest, a suffixsort tester, version %s.\n", + divsufsort_version()); + fprintf(stderr, "usage: %s FILE\n\n", progname); + exit(status); +} + +int +main(int argc, const char *argv[]) { + FILE *fp; + const char *fname; + sauchar_t *T; + saidx_t *SA; + LFS_OFF_T n; + clock_t start, finish; + saint_t needclose = 1; + + /* Check arguments. */ + if((argc == 1) || + (strcmp(argv[1], "-h") == 0) || + (strcmp(argv[1], "--help") == 0)) { print_help(argv[0], EXIT_SUCCESS); } + if(argc != 2) { print_help(argv[0], EXIT_FAILURE); } + + /* Open a file for reading. */ + if(strcmp(argv[1], "-") != 0) { +#if HAVE_FOPEN_S + if(fopen_s(&fp, fname = argv[1], "rb") != 0) { +#else + if((fp = LFS_FOPEN(fname = argv[1], "rb")) == NULL) { +#endif + fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], fname); + perror(NULL); + exit(EXIT_FAILURE); + } + } else { +#if HAVE__SETMODE && HAVE__FILENO + if(_setmode(_fileno(stdin), _O_BINARY) == -1) { + fprintf(stderr, "%s: Cannot set mode: ", argv[0]); + perror(NULL); + exit(EXIT_FAILURE); + } +#endif + fp = stdin; + fname = "stdin"; + needclose = 0; + } + + /* Get the file size. */ + if(LFS_FSEEK(fp, 0, SEEK_END) == 0) { + n = LFS_FTELL(fp); + rewind(fp); + if(n < 0) { + fprintf(stderr, "%s: Cannot ftell `%s': ", argv[0], fname); + perror(NULL); + exit(EXIT_FAILURE); + } + if(0x7fffffff <= n) { + fprintf(stderr, "%s: Input file `%s' is too big.\n", argv[0], fname); + exit(EXIT_FAILURE); + } + } else { + fprintf(stderr, "%s: Cannot fseek `%s': ", argv[0], fname); + perror(NULL); + exit(EXIT_FAILURE); + } + + /* Allocate 5n bytes of memory. */ + T = (sauchar_t *)malloc((size_t)n * sizeof(sauchar_t)); + SA = (saidx_t *)malloc((size_t)n * sizeof(saidx_t)); + if((T == NULL) || (SA == NULL)) { + fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]); + exit(EXIT_FAILURE); + } + + /* Read n bytes of data. */ + if(fread(T, sizeof(sauchar_t), (size_t)n, fp) != (size_t)n) { + fprintf(stderr, "%s: %s `%s': ", + argv[0], + (ferror(fp) || !feof(fp)) ? "Cannot read from" : "Unexpected EOF in", + argv[1]); + perror(NULL); + exit(EXIT_FAILURE); + } + if(needclose & 1) { fclose(fp); } + + /* Construct the suffix array. */ + fprintf(stderr, "%s: %" PRIdOFF_T " bytes ... ", fname, n); + start = clock(); + if(divsufsort(T, SA, (saidx_t)n) != 0) { + fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]); + exit(EXIT_FAILURE); + } + finish = clock(); + fprintf(stderr, "%.4f sec\n", (double)(finish - start) / (double)CLOCKS_PER_SEC); + + /* Check the suffix array. */ + if(sufcheck(T, SA, (saidx_t)n, 1) != 0) { exit(EXIT_FAILURE); } + + /* Deallocate memory. */ + free(SA); + free(T); + + return 0; +} diff --git a/tools/Flips/libdivsufsort-2.0.1/examples/unbwt.c b/tools/Flips/libdivsufsort-2.0.1/examples/unbwt.c new file mode 100644 index 000000000..c0f19e97a --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/examples/unbwt.c @@ -0,0 +1,207 @@ +/* + * unbwt.c for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#if HAVE_STRING_H +# include +#endif +#if HAVE_STDLIB_H +# include +#endif +#if HAVE_MEMORY_H +# include +#endif +#if HAVE_STDDEF_H +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_IO_H && HAVE_FCNTL_H +# include +# include +#endif +#include +#include +#include "lfs.h" + + +static +size_t +read_int(FILE *fp, saidx_t *n) { + unsigned char c[4]; + size_t m = fread(c, sizeof(unsigned char), 4, fp); + if(m == 4) { + *n = (c[0] << 0) | (c[1] << 8) | + (c[2] << 16) | (c[3] << 24); + } + return m; +} + +static +void +print_help(const char *progname, int status) { + fprintf(stderr, + "unbwt, an inverse burrows-wheeler transform program, version %s.\n", + divsufsort_version()); + fprintf(stderr, "usage: %s INFILE OUTFILE\n\n", progname); + exit(status); +} + +int +main(int argc, const char *argv[]) { + FILE *fp, *ofp; + const char *fname, *ofname; + sauchar_t *T; + saidx_t *A; + LFS_OFF_T n; + size_t m; + saidx_t pidx; + clock_t start, finish; + saint_t err, blocksize, needclose = 3; + + /* Check arguments. */ + if((argc == 1) || + (strcmp(argv[1], "-h") == 0) || + (strcmp(argv[1], "--help") == 0)) { print_help(argv[0], EXIT_SUCCESS); } + if(argc != 3) { print_help(argv[0], EXIT_FAILURE); } + + /* Open a file for reading. */ + if(strcmp(argv[1], "-") != 0) { +#if HAVE_FOPEN_S + if(fopen_s(&fp, fname = argv[1], "rb") != 0) { +#else + if((fp = LFS_FOPEN(fname = argv[1], "rb")) == NULL) { +#endif + fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], fname); + perror(NULL); + exit(EXIT_FAILURE); + } + } else { +#if HAVE__SETMODE && HAVE__FILENO + if(_setmode(_fileno(stdin), _O_BINARY) == -1) { + fprintf(stderr, "%s: Cannot set mode: ", argv[0]); + perror(NULL); + exit(EXIT_FAILURE); + } +#endif + fp = stdin; + fname = "stdin"; + needclose ^= 1; + } + + /* Open a file for writing. */ + if(strcmp(argv[2], "-") != 0) { +#if HAVE_FOPEN_S + if(fopen_s(&ofp, ofname = argv[2], "wb") != 0) { +#else + if((ofp = LFS_FOPEN(ofname = argv[2], "wb")) == NULL) { +#endif + fprintf(stderr, "%s: Cannot open file `%s': ", argv[0], ofname); + perror(NULL); + exit(EXIT_FAILURE); + } + } else { +#if HAVE__SETMODE && HAVE__FILENO + if(_setmode(_fileno(stdout), _O_BINARY) == -1) { + fprintf(stderr, "%s: Cannot set mode: ", argv[0]); + perror(NULL); + exit(EXIT_FAILURE); + } +#endif + ofp = stdout; + ofname = "stdout"; + needclose ^= 2; + } + + /* Read the blocksize. */ + if(read_int(fp, &blocksize) != 4) { + fprintf(stderr, "%s: Cannot read from `%s': ", argv[0], fname); + perror(NULL); + exit(EXIT_FAILURE); + } + + /* Allocate 5blocksize bytes of memory. */ + T = (sauchar_t *)malloc(blocksize * sizeof(sauchar_t)); + A = (saidx_t *)malloc(blocksize * sizeof(saidx_t)); + if((T == NULL) || (A == NULL)) { + fprintf(stderr, "%s: Cannot allocate memory.\n", argv[0]); + exit(EXIT_FAILURE); + } + + fprintf(stderr, "UnBWT (blocksize %" PRIdSAINT_T ") ... ", blocksize); + start = clock(); + for(n = 0; (m = read_int(fp, &pidx)) != 0; n += m) { + /* Read blocksize bytes of data. */ + if((m != 4) || ((m = fread(T, sizeof(sauchar_t), blocksize, fp)) == 0)) { + fprintf(stderr, "%s: %s `%s': ", + argv[0], + (ferror(fp) || !feof(fp)) ? "Cannot read from" : "Unexpected EOF in", + fname); + perror(NULL); + exit(EXIT_FAILURE); + } + + /* Inverse Burrows-Wheeler Transform. */ + if((err = inverse_bw_transform(T, T, A, m, pidx)) != 0) { + fprintf(stderr, "%s (reverseBWT): %s.\n", + argv[0], + (err == -1) ? "Invalid data" : "Cannot allocate memory"); + exit(EXIT_FAILURE); + } + + /* Write m bytes of data. */ + if(fwrite(T, sizeof(sauchar_t), m, ofp) != m) { + fprintf(stderr, "%s: Cannot write to `%s': ", argv[0], ofname); + perror(NULL); + exit(EXIT_FAILURE); + } + } + if(ferror(fp)) { + fprintf(stderr, "%s: Cannot read from `%s': ", argv[0], fname); + perror(NULL); + exit(EXIT_FAILURE); + } + finish = clock(); + fprintf(stderr, "%" PRIdOFF_T " bytes: %.4f sec\n", + n, (double)(finish - start) / (double)CLOCKS_PER_SEC); + + /* Close files */ + if(needclose & 1) { fclose(fp); } + if(needclose & 2) { fclose(ofp); } + + /* Deallocate memory. */ + free(A); + free(T); + + return 0; +} diff --git a/tools/Flips/libdivsufsort-2.0.1/include/Makefile.am b/tools/Flips/libdivsufsort-2.0.1/include/Makefile.am new file mode 100644 index 000000000..9bef60234 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/include/Makefile.am @@ -0,0 +1,7 @@ +# Makefile.am for libdivsufsort + +nodist_include_HEADERS = divsufsort.h +if DIVSUFSORT64 +nodist_include_HEADERS += divsufsort64.h +endif +EXTRA_DIST = divsufsort_private.h divsufsort.h.cmake divsufsort64.h.in config.h.cmake CMakeLists.txt lfs.h.cmake diff --git a/tools/Flips/libdivsufsort-2.0.1/include/Makefile.in b/tools/Flips/libdivsufsort-2.0.1/include/Makefile.in new file mode 100644 index 000000000..e43a1e33f --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/include/Makefile.in @@ -0,0 +1,508 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Makefile.am for libdivsufsort + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@DIVSUFSORT64_TRUE@am__append_1 = divsufsort64.h +subdir = include +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/config.h.in $(srcdir)/divsufsort.h.cmake \ + $(srcdir)/divsufsort64.h.in $(srcdir)/lfs.h.cmake +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = divsufsort64.h divsufsort.h lfs.h +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(includedir)" +HEADERS = $(nodist_include_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIVSUFSORT_EXPORT = @DIVSUFSORT_EXPORT@ +DIVSUFSORT_IMPORT = @DIVSUFSORT_IMPORT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INCFILE = @INCFILE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LFS_FOPEN = @LFS_FOPEN@ +LFS_FSEEK = @LFS_FSEEK@ +LFS_FTELL = @LFS_FTELL@ +LFS_OFF_T = @LFS_OFF_T@ +LFS_PRID = @LFS_PRID@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PROJECT_DESCRIPTION = @PROJECT_DESCRIPTION@ +PROJECT_NAME = @PROJECT_NAME@ +PROJECT_URL = @PROJECT_URL@ +PROJECT_VERSION_FULL = @PROJECT_VERSION_FULL@ +RANLIB = @RANLIB@ +SAINDEX_PRId = @SAINDEX_PRId@ +SAINDEX_TYPE = @SAINDEX_TYPE@ +SAINT32_TYPE = @SAINT32_TYPE@ +SAINT64_PRId = @SAINT64_PRId@ +SAINT64_TYPE = @SAINT64_TYPE@ +SAINT_PRId = @SAINT_PRId@ +SAUCHAR_TYPE = @SAUCHAR_TYPE@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +W64BIT = @W64BIT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +nodist_include_HEADERS = divsufsort.h $(am__append_1) +EXTRA_DIST = divsufsort_private.h divsufsort.h.cmake divsufsort64.h.in config.h.cmake CMakeLists.txt lfs.h.cmake +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign include/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status include/config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +divsufsort64.h: $(top_builddir)/config.status $(srcdir)/divsufsort64.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +divsufsort.h: $(top_builddir)/config.status $(srcdir)/divsufsort.h.cmake + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +lfs.h: $(top_builddir)/config.status $(srcdir)/lfs.h.cmake + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-nodist_includeHEADERS: $(nodist_include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" + @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-nodist_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includedir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) config.h +installdirs: + for dir in "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-nodist_includeHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-nodist_includeHEADERS + +.MAKE: all install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-nodist_includeHEADERS \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-nodist_includeHEADERS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tools/Flips/libdivsufsort-2.0.1/include/config.h b/tools/Flips/libdivsufsort-2.0.1/include/config.h new file mode 100644 index 000000000..d92a9d49a --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/include/config.h @@ -0,0 +1,133 @@ +/* include/config.h. Generated from config.h.in by configure. */ +/* include/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fopen_s' function. */ +/* #undef HAVE_FOPEN_S */ + +/* Define to 1 if the system has the type `int32_t'. */ +#define HAVE_INT32_T 1 + +/* Define to 1 if the system has the type `int64_t'. */ +/* #undef HAVE_INT64_T */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IO_H */ + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#define HAVE_MALLOC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `setmode' function. */ +/* #undef HAVE_SETMODE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if the system has the type `uint8_t'. */ +#define HAVE_UINT8_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `_fileno' function. */ +/* #undef HAVE__FILENO */ + +/* for _setmode */ +/* #undef HAVE__SETMODE */ + +/* for inline */ +#define INLINE inline + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "yuta.256@gmail.com" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libdivsufsort" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libdivsufsort 2.0.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libdivsufsort" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "2.0.1" + +/* Define to the version of this package. */ +#define PROJECT_VERSION_FULL PACKAGE_VERSION + +/* The size of `int', as computed by sizeof. */ +/* #undef SIZEOF_INT */ + +/* The size of `long', as computed by sizeof. */ +/* #undef SIZEOF_LONG */ + +/* The size of `long long', as computed by sizeof. */ +/* #undef SIZEOF_LONG_LONG */ + +/* The size of `short', as computed by sizeof. */ +/* #undef SIZEOF_SHORT */ + +/* The size of `unsigned char', as computed by sizeof. */ +/* #undef SIZEOF_UNSIGNED_CHAR */ + +/* The size of `__int32', as computed by sizeof. */ +/* #undef SIZEOF___INT32 */ + +/* The size of `__int64', as computed by sizeof. */ +/* #undef SIZEOF___INT64 */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* for _setmode */ +/* #undef _setmode */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +/* #undef malloc */ diff --git a/tools/Flips/libdivsufsort-2.0.1/include/config.h.cmake b/tools/Flips/libdivsufsort-2.0.1/include/config.h.cmake new file mode 100644 index 000000000..6a1cf47d8 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/include/config.h.cmake @@ -0,0 +1,81 @@ +/* + * config.h for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _CONFIG_H +#define _CONFIG_H 1 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** Define to the version of this package. **/ +#cmakedefine PROJECT_VERSION_FULL "${PROJECT_VERSION_FULL}" + +/** Define to 1 if you have the header files. **/ +#cmakedefine HAVE_INTTYPES_H 1 +#cmakedefine HAVE_STDDEF_H 1 +#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_STDLIB_H 1 +#cmakedefine HAVE_STRING_H 1 +#cmakedefine HAVE_STRINGS_H 1 +#cmakedefine HAVE_MEMORY_H 1 +#cmakedefine HAVE_SYS_TYPES_H 1 + +/** for WinIO **/ +#cmakedefine HAVE_IO_H 1 +#cmakedefine HAVE_FCNTL_H 1 +#cmakedefine HAVE__SETMODE 1 +#cmakedefine HAVE_SETMODE 1 +#cmakedefine HAVE__FILENO 1 +#cmakedefine HAVE_FOPEN_S 1 +#cmakedefine HAVE__O_BINARY 1 +#ifndef HAVE__SETMODE +# if HAVE_SETMODE +# define _setmode setmode +# define HAVE__SETMODE 1 +# endif +# if HAVE__SETMODE && !HAVE__O_BINARY +# define _O_BINARY 0 +# define HAVE__O_BINARY 1 +# endif +#endif + +/** for inline **/ +#ifndef INLINE +# define INLINE @INLINE@ +#endif + +/** for VC++ warning **/ +#ifdef _MSC_VER +#pragma warning(disable: 4127) +#endif + + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* _CONFIG_H */ diff --git a/tools/Flips/libdivsufsort-2.0.1/include/config.h.in b/tools/Flips/libdivsufsort-2.0.1/include/config.h.in new file mode 100644 index 000000000..703b07959 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/include/config.h.in @@ -0,0 +1,132 @@ +/* include/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `fopen_s' function. */ +#undef HAVE_FOPEN_S + +/* Define to 1 if the system has the type `int32_t'. */ +#undef HAVE_INT32_T + +/* Define to 1 if the system has the type `int64_t'. */ +#undef HAVE_INT64_T + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_IO_H + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `setmode' function. */ +#undef HAVE_SETMODE + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if the system has the type `uint8_t'. */ +#undef HAVE_UINT8_T + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `_fileno' function. */ +#undef HAVE__FILENO + +/* for _setmode */ +#undef HAVE__SETMODE + +/* for inline */ +#undef INLINE + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to the version of this package. */ +#undef PROJECT_VERSION_FULL + +/* The size of `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of `unsigned char', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_CHAR + +/* The size of `__int32', as computed by sizeof. */ +#undef SIZEOF___INT32 + +/* The size of `__int64', as computed by sizeof. */ +#undef SIZEOF___INT64 + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* for _setmode */ +#undef _setmode + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc diff --git a/tools/Flips/libdivsufsort-2.0.1/include/divsufsort.h b/tools/Flips/libdivsufsort-2.0.1/include/divsufsort.h new file mode 100644 index 000000000..6d3e64870 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/include/divsufsort.h @@ -0,0 +1,180 @@ +/* + * divsufsort.h for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _DIVSUFSORT_H +#define _DIVSUFSORT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +#ifndef DIVSUFSORT_API +# ifdef DIVSUFSORT_BUILD_DLL +# define DIVSUFSORT_API +# else +# define DIVSUFSORT_API +# endif +#endif + +/*- Datatypes -*/ +#ifndef SAUCHAR_T +#define SAUCHAR_T +typedef uint8_t sauchar_t; +#endif /* SAUCHAR_T */ +#ifndef SAINT_T +#define SAINT_T +typedef int32_t saint_t; +#endif /* SAINT_T */ +#ifndef SAIDX_T +#define SAIDX_T +typedef int32_t saidx_t; +#endif /* SAIDX_T */ +#ifndef PRIdSAINT_T +#define PRIdSAINT_T PRId32 +#endif /* PRIdSAINT_T */ +#ifndef PRIdSAIDX_T +#define PRIdSAIDX_T PRId32 +#endif /* PRIdSAIDX_T */ + + +/*- Prototypes -*/ + +/** + * Constructs the suffix array of a given string. + * @param T[0..n-1] The input string. + * @param SA[0..n-1] The output array of suffixes. + * @param n The length of the given string. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saint_t +divsufsort(const sauchar_t *T, saidx_t *SA, saidx_t n); + +/** + * Constructs the burrows-wheeler transformed string of a given string. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param A[0..n-1] The temporary array. (can be NULL) + * @param n The length of the given string. + * @return The primary index if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saidx_t +divbwt(const sauchar_t *T, sauchar_t *U, saidx_t *A, saidx_t n); + +/** + * Returns the version of the divsufsort library. + * @return The version number string. + */ +DIVSUFSORT_API +const char * +divsufsort_version(void); + + +/** + * Constructs the burrows-wheeler transformed string of a given string and suffix array. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param SA[0..n-1] The suffix array. (can be NULL) + * @param n The length of the given string. + * @param idx The output primary index. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saint_t +bw_transform(const sauchar_t *T, sauchar_t *U, + saidx_t *SA /* can NULL */, + saidx_t n, saidx_t *idx); + +/** + * Inverse BW-transforms a given BWTed string. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param A[0..n-1] The temporary array. (can be NULL) + * @param n The length of the given string. + * @param idx The primary index. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saint_t +inverse_bw_transform(const sauchar_t *T, sauchar_t *U, + saidx_t *A /* can NULL */, + saidx_t n, saidx_t idx); + +/** + * Checks the correctness of a given suffix array. + * @param T[0..n-1] The input string. + * @param SA[0..n-1] The input suffix array. + * @param n The length of the given string. + * @param verbose The verbose mode. + * @return 0 if no error occurred. + */ +DIVSUFSORT_API +saint_t +sufcheck(const sauchar_t *T, const saidx_t *SA, saidx_t n, saint_t verbose); + +/** + * Search for the pattern P in the string T. + * @param T[0..Tsize-1] The input string. + * @param Tsize The length of the given string. + * @param P[0..Psize-1] The input pattern string. + * @param Psize The length of the given pattern string. + * @param SA[0..SAsize-1] The input suffix array. + * @param SAsize The length of the given suffix array. + * @param idx The output index. + * @return The count of matches if no error occurred, -1 otherwise. + */ +DIVSUFSORT_API +saidx_t +sa_search(const sauchar_t *T, saidx_t Tsize, + const sauchar_t *P, saidx_t Psize, + const saidx_t *SA, saidx_t SAsize, + saidx_t *left); + +/** + * Search for the character c in the string T. + * @param T[0..Tsize-1] The input string. + * @param Tsize The length of the given string. + * @param SA[0..SAsize-1] The input suffix array. + * @param SAsize The length of the given suffix array. + * @param c The input character. + * @param idx The output index. + * @return The count of matches if no error occurred, -1 otherwise. + */ +DIVSUFSORT_API +saidx_t +sa_simplesearch(const sauchar_t *T, saidx_t Tsize, + const saidx_t *SA, saidx_t SAsize, + saint_t c, saidx_t *left); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* _DIVSUFSORT_H */ diff --git a/tools/Flips/libdivsufsort-2.0.1/include/divsufsort.h.cmake b/tools/Flips/libdivsufsort-2.0.1/include/divsufsort.h.cmake new file mode 100644 index 000000000..bcaba7c64 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/include/divsufsort.h.cmake @@ -0,0 +1,180 @@ +/* + * divsufsort@W64BIT@.h for libdivsufsort@W64BIT@ + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _DIVSUFSORT@W64BIT@_H +#define _DIVSUFSORT@W64BIT@_H 1 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +@INCFILE@ + +#ifndef DIVSUFSORT_API +# ifdef DIVSUFSORT_BUILD_DLL +# define DIVSUFSORT_API @DIVSUFSORT_EXPORT@ +# else +# define DIVSUFSORT_API @DIVSUFSORT_IMPORT@ +# endif +#endif + +/*- Datatypes -*/ +#ifndef SAUCHAR_T +#define SAUCHAR_T +typedef @SAUCHAR_TYPE@ sauchar_t; +#endif /* SAUCHAR_T */ +#ifndef SAINT_T +#define SAINT_T +typedef @SAINT32_TYPE@ saint_t; +#endif /* SAINT_T */ +#ifndef SAIDX@W64BIT@_T +#define SAIDX@W64BIT@_T +typedef @SAINDEX_TYPE@ saidx@W64BIT@_t; +#endif /* SAIDX@W64BIT@_T */ +#ifndef PRIdSAINT_T +#define PRIdSAINT_T @SAINT_PRId@ +#endif /* PRIdSAINT_T */ +#ifndef PRIdSAIDX@W64BIT@_T +#define PRIdSAIDX@W64BIT@_T @SAINDEX_PRId@ +#endif /* PRIdSAIDX@W64BIT@_T */ + + +/*- Prototypes -*/ + +/** + * Constructs the suffix array of a given string. + * @param T[0..n-1] The input string. + * @param SA[0..n-1] The output array of suffixes. + * @param n The length of the given string. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saint_t +divsufsort@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t *SA, saidx@W64BIT@_t n); + +/** + * Constructs the burrows-wheeler transformed string of a given string. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param A[0..n-1] The temporary array. (can be NULL) + * @param n The length of the given string. + * @return The primary index if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saidx@W64BIT@_t +divbwt@W64BIT@(const sauchar_t *T, sauchar_t *U, saidx@W64BIT@_t *A, saidx@W64BIT@_t n); + +/** + * Returns the version of the divsufsort library. + * @return The version number string. + */ +DIVSUFSORT_API +const char * +divsufsort@W64BIT@_version(void); + + +/** + * Constructs the burrows-wheeler transformed string of a given string and suffix array. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param SA[0..n-1] The suffix array. (can be NULL) + * @param n The length of the given string. + * @param idx The output primary index. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saint_t +bw_transform@W64BIT@(const sauchar_t *T, sauchar_t *U, + saidx@W64BIT@_t *SA /* can NULL */, + saidx@W64BIT@_t n, saidx@W64BIT@_t *idx); + +/** + * Inverse BW-transforms a given BWTed string. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param A[0..n-1] The temporary array. (can be NULL) + * @param n The length of the given string. + * @param idx The primary index. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saint_t +inverse_bw_transform@W64BIT@(const sauchar_t *T, sauchar_t *U, + saidx@W64BIT@_t *A /* can NULL */, + saidx@W64BIT@_t n, saidx@W64BIT@_t idx); + +/** + * Checks the correctness of a given suffix array. + * @param T[0..n-1] The input string. + * @param SA[0..n-1] The input suffix array. + * @param n The length of the given string. + * @param verbose The verbose mode. + * @return 0 if no error occurred. + */ +DIVSUFSORT_API +saint_t +sufcheck@W64BIT@(const sauchar_t *T, const saidx@W64BIT@_t *SA, saidx@W64BIT@_t n, saint_t verbose); + +/** + * Search for the pattern P in the string T. + * @param T[0..Tsize-1] The input string. + * @param Tsize The length of the given string. + * @param P[0..Psize-1] The input pattern string. + * @param Psize The length of the given pattern string. + * @param SA[0..SAsize-1] The input suffix array. + * @param SAsize The length of the given suffix array. + * @param idx The output index. + * @return The count of matches if no error occurred, -1 otherwise. + */ +DIVSUFSORT_API +saidx@W64BIT@_t +sa_search@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t Tsize, + const sauchar_t *P, saidx@W64BIT@_t Psize, + const saidx@W64BIT@_t *SA, saidx@W64BIT@_t SAsize, + saidx@W64BIT@_t *left); + +/** + * Search for the character c in the string T. + * @param T[0..Tsize-1] The input string. + * @param Tsize The length of the given string. + * @param SA[0..SAsize-1] The input suffix array. + * @param SAsize The length of the given suffix array. + * @param c The input character. + * @param idx The output index. + * @return The count of matches if no error occurred, -1 otherwise. + */ +DIVSUFSORT_API +saidx@W64BIT@_t +sa_simplesearch@W64BIT@(const sauchar_t *T, saidx@W64BIT@_t Tsize, + const saidx@W64BIT@_t *SA, saidx@W64BIT@_t SAsize, + saint_t c, saidx@W64BIT@_t *left); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* _DIVSUFSORT@W64BIT@_H */ diff --git a/tools/Flips/libdivsufsort-2.0.1/include/divsufsort64.h.in b/tools/Flips/libdivsufsort-2.0.1/include/divsufsort64.h.in new file mode 100644 index 000000000..ccb47d2a5 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/include/divsufsort64.h.in @@ -0,0 +1,180 @@ +/* + * divsufsort64.h for libdivsufsort64 + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _DIVSUFSORT64_H +#define _DIVSUFSORT64_H 1 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +@INCFILE@ + +#ifndef DIVSUFSORT_API +# ifdef DIVSUFSORT_BUILD_DLL +# define DIVSUFSORT_API @DIVSUFSORT_EXPORT@ +# else +# define DIVSUFSORT_API @DIVSUFSORT_IMPORT@ +# endif +#endif + +/*- Datatypes -*/ +#ifndef SAUCHAR_T +#define SAUCHAR_T +typedef @SAUCHAR_TYPE@ sauchar_t; +#endif /* SAUCHAR_T */ +#ifndef SAINT_T +#define SAINT_T +typedef @SAINT32_TYPE@ saint_t; +#endif /* SAINT_T */ +#ifndef SAIDX64_T +#define SAIDX64_T +typedef @SAINT64_TYPE@ saidx64_t; +#endif /* SAIDX64_T */ +#ifndef PRIdSAINT_T +#define PRIdSAINT_T @SAINT_PRId@ +#endif /* PRIdSAINT_T */ +#ifndef PRIdSAIDX64_T +#define PRIdSAIDX64_T @SAINT64_PRId@ +#endif /* PRIdSAIDX64_T */ + + +/*- Prototypes -*/ + +/** + * Constructs the suffix array of a given string. + * @param T[0..n-1] The input string. + * @param SA[0..n-1] The output array of suffixes. + * @param n The length of the given string. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saint_t +divsufsort64(const sauchar_t *T, saidx64_t *SA, saidx64_t n); + +/** + * Constructs the burrows-wheeler transformed string of a given string. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param A[0..n-1] The temporary array. (can be NULL) + * @param n The length of the given string. + * @return The primary index if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saidx64_t +divbwt64(const sauchar_t *T, sauchar_t *U, saidx64_t *A, saidx64_t n); + +/** + * Returns the version of the divsufsort library. + * @return The version number string. + */ +DIVSUFSORT_API +const char * +divsufsort64_version(void); + + +/** + * Constructs the burrows-wheeler transformed string of a given string and suffix array. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param SA[0..n-1] The suffix array. (can be NULL) + * @param n The length of the given string. + * @param idx The output primary index. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saint_t +bw_transform64(const sauchar_t *T, sauchar_t *U, + saidx64_t *SA /* can NULL */, + saidx64_t n, saidx64_t *idx); + +/** + * Inverse BW-transforms a given BWTed string. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param A[0..n-1] The temporary array. (can be NULL) + * @param n The length of the given string. + * @param idx The primary index. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saint_t +inverse_bw_transform64(const sauchar_t *T, sauchar_t *U, + saidx64_t *A /* can NULL */, + saidx64_t n, saidx64_t idx); + +/** + * Checks the correctness of a given suffix array. + * @param T[0..n-1] The input string. + * @param SA[0..n-1] The input suffix array. + * @param n The length of the given string. + * @param verbose The verbose mode. + * @return 0 if no error occurred. + */ +DIVSUFSORT_API +saint_t +sufcheck64(const sauchar_t *T, const saidx64_t *SA, saidx64_t n, saint_t verbose); + +/** + * Search for the pattern P in the string T. + * @param T[0..Tsize-1] The input string. + * @param Tsize The length of the given string. + * @param P[0..Psize-1] The input pattern string. + * @param Psize The length of the given pattern string. + * @param SA[0..SAsize-1] The input suffix array. + * @param SAsize The length of the given suffix array. + * @param idx The output index. + * @return The count of matches if no error occurred, -1 otherwise. + */ +DIVSUFSORT_API +saidx64_t +sa_search64(const sauchar_t *T, saidx64_t Tsize, + const sauchar_t *P, saidx64_t Psize, + const saidx64_t *SA, saidx64_t SAsize, + saidx64_t *left); + +/** + * Search for the character c in the string T. + * @param T[0..Tsize-1] The input string. + * @param Tsize The length of the given string. + * @param SA[0..SAsize-1] The input suffix array. + * @param SAsize The length of the given suffix array. + * @param c The input character. + * @param idx The output index. + * @return The count of matches if no error occurred, -1 otherwise. + */ +DIVSUFSORT_API +saidx64_t +sa_simplesearch64(const sauchar_t *T, saidx64_t Tsize, + const saidx64_t *SA, saidx64_t SAsize, + saint_t c, saidx64_t *left); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* _DIVSUFSORT64_H */ diff --git a/tools/Flips/libdivsufsort-2.0.1/include/divsufsort_private.h b/tools/Flips/libdivsufsort-2.0.1/include/divsufsort_private.h new file mode 100644 index 000000000..7e261c19d --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/include/divsufsort_private.h @@ -0,0 +1,207 @@ +/* + * divsufsort_private.h for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _DIVSUFSORT_PRIVATE_H +#define _DIVSUFSORT_PRIVATE_H 1 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#if HAVE_STRING_H +# include +#endif +#if HAVE_STDLIB_H +# include +#endif +#if HAVE_MEMORY_H +# include +#endif +#if HAVE_STDDEF_H +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if defined(BUILD_DIVSUFSORT64) +# include "divsufsort64.h" +# ifndef SAIDX_T +# define SAIDX_T +# define saidx_t saidx64_t +# endif /* SAIDX_T */ +# ifndef PRIdSAIDX_T +# define PRIdSAIDX_T PRIdSAIDX64_T +# endif /* PRIdSAIDX_T */ +# define divsufsort divsufsort64 +# define divbwt divbwt64 +# define divsufsort_version divsufsort64_version +# define bw_transform bw_transform64 +# define inverse_bw_transform inverse_bw_transform64 +# define sufcheck sufcheck64 +# define sa_search sa_search64 +# define sa_simplesearch sa_simplesearch64 +# define sssort sssort64 +# define trsort trsort64 +#else +# include "divsufsort.h" +#endif + + +/*- Constants -*/ +#if !defined(UINT8_MAX) +# define UINT8_MAX (255) +#endif /* UINT8_MAX */ +#if defined(ALPHABET_SIZE) && (ALPHABET_SIZE < 1) +# undef ALPHABET_SIZE +#endif +#if !defined(ALPHABET_SIZE) +# define ALPHABET_SIZE (UINT8_MAX + 1) +#endif +/* for divsufsort.c */ +#define BUCKET_A_SIZE (ALPHABET_SIZE) +#define BUCKET_B_SIZE (ALPHABET_SIZE * ALPHABET_SIZE) +/* for sssort.c */ +#if defined(SS_INSERTIONSORT_THRESHOLD) +# if SS_INSERTIONSORT_THRESHOLD < 1 +# undef SS_INSERTIONSORT_THRESHOLD +# define SS_INSERTIONSORT_THRESHOLD (1) +# endif +#else +# define SS_INSERTIONSORT_THRESHOLD (8) +#endif +#if defined(SS_BLOCKSIZE) +# if SS_BLOCKSIZE < 0 +# undef SS_BLOCKSIZE +# define SS_BLOCKSIZE (0) +# elif 32768 <= SS_BLOCKSIZE +# undef SS_BLOCKSIZE +# define SS_BLOCKSIZE (32767) +# endif +#else +# define SS_BLOCKSIZE (1024) +#endif +/* minstacksize = log(SS_BLOCKSIZE) / log(3) * 2 */ +#if SS_BLOCKSIZE == 0 +# if defined(BUILD_DIVSUFSORT64) +# define SS_MISORT_STACKSIZE (96) +# else +# define SS_MISORT_STACKSIZE (64) +# endif +#elif SS_BLOCKSIZE <= 4096 +# define SS_MISORT_STACKSIZE (16) +#else +# define SS_MISORT_STACKSIZE (24) +#endif +#if defined(BUILD_DIVSUFSORT64) +# define SS_SMERGE_STACKSIZE (64) +#else +# define SS_SMERGE_STACKSIZE (32) +#endif +/* for trsort.c */ +#define TR_INSERTIONSORT_THRESHOLD (8) +#if defined(BUILD_DIVSUFSORT64) +# define TR_STACKSIZE (96) +#else +# define TR_STACKSIZE (64) +#endif + + +/*- Macros -*/ +#ifndef SWAP +# define SWAP(_a, _b) do { t = (_a); (_a) = (_b); (_b) = t; } while(0) +#endif /* SWAP */ +#ifndef MIN +# define MIN(_a, _b) (((_a) < (_b)) ? (_a) : (_b)) +#endif /* MIN */ +#ifndef MAX +# define MAX(_a, _b) (((_a) > (_b)) ? (_a) : (_b)) +#endif /* MAX */ +#define STACK_PUSH(_a, _b, _c, _d)\ + do {\ + assert(ssize < STACK_SIZE);\ + stack[ssize].a = (_a), stack[ssize].b = (_b),\ + stack[ssize].c = (_c), stack[ssize++].d = (_d);\ + } while(0) +#define STACK_PUSH5(_a, _b, _c, _d, _e)\ + do {\ + assert(ssize < STACK_SIZE);\ + stack[ssize].a = (_a), stack[ssize].b = (_b),\ + stack[ssize].c = (_c), stack[ssize].d = (_d), stack[ssize++].e = (_e);\ + } while(0) +#define STACK_POP(_a, _b, _c, _d)\ + do {\ + assert(0 <= ssize);\ + if(ssize == 0) { return; }\ + (_a) = stack[--ssize].a, (_b) = stack[ssize].b,\ + (_c) = stack[ssize].c, (_d) = stack[ssize].d;\ + } while(0) +#define STACK_POP5(_a, _b, _c, _d, _e)\ + do {\ + assert(0 <= ssize);\ + if(ssize == 0) { return; }\ + (_a) = stack[--ssize].a, (_b) = stack[ssize].b,\ + (_c) = stack[ssize].c, (_d) = stack[ssize].d, (_e) = stack[ssize].e;\ + } while(0) +/* for divsufsort.c */ +#define BUCKET_A(_c0) bucket_A[(_c0)] +#if ALPHABET_SIZE == 256 +#define BUCKET_B(_c0, _c1) (bucket_B[((_c1) << 8) | (_c0)]) +#define BUCKET_BSTAR(_c0, _c1) (bucket_B[((_c0) << 8) | (_c1)]) +#else +#define BUCKET_B(_c0, _c1) (bucket_B[(_c1) * ALPHABET_SIZE + (_c0)]) +#define BUCKET_BSTAR(_c0, _c1) (bucket_B[(_c0) * ALPHABET_SIZE + (_c1)]) +#endif + + +/*- Private Prototypes -*/ +/* sssort.c */ +void +sssort(const sauchar_t *Td, const saidx_t *PA, + saidx_t *first, saidx_t *last, + saidx_t *buf, saidx_t bufsize, + saidx_t depth, saidx_t n, saint_t lastsuffix); +/* trsort.c */ +void +trsort(saidx_t *ISA, saidx_t *SA, saidx_t n, saidx_t depth); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* _DIVSUFSORT_PRIVATE_H */ diff --git a/tools/Flips/libdivsufsort-2.0.1/include/lfs.h.cmake b/tools/Flips/libdivsufsort-2.0.1/include/lfs.h.cmake new file mode 100644 index 000000000..d5b84a842 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/include/lfs.h.cmake @@ -0,0 +1,56 @@ +/* + * lfs.h for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _LFS_H +#define _LFS_H 1 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef __STRICT_ANSI__ +# define LFS_OFF_T @LFS_OFF_T@ +# define LFS_FOPEN @LFS_FOPEN@ +# define LFS_FTELL @LFS_FTELL@ +# define LFS_FSEEK @LFS_FSEEK@ +# define LFS_PRId @LFS_PRID@ +#else +# define LFS_OFF_T long +# define LFS_FOPEN fopen +# define LFS_FTELL ftell +# define LFS_FSEEK fseek +# define LFS_PRId "ld" +#endif +#ifndef PRIdOFF_T +# define PRIdOFF_T LFS_PRId +#endif + + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* _LFS_H */ diff --git a/tools/Flips/libdivsufsort-2.0.1/lib/Makefile.am b/tools/Flips/libdivsufsort-2.0.1/lib/Makefile.am new file mode 100644 index 000000000..7815b964c --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/lib/Makefile.am @@ -0,0 +1,15 @@ +# Makefile.am for libdivsufsort + +lib_LTLIBRARIES = libdivsufsort.la +libdivsufsort_la_SOURCES = divsufsort.c sssort.c trsort.c utils.c +libdivsufsort_la_CPPFLAGS = -I$(top_srcdir)/include +libdivsufsort_la_LDFLAGS = -version-info @LT_CURRENT@:@LT_REVISION@:@LT_AGE@ -export-symbols $(srcdir)/libdivsufsort.sym + +if DIVSUFSORT64 +lib_LTLIBRARIES += libdivsufsort64.la +libdivsufsort64_la_SOURCES = divsufsort.c sssort.c trsort.c utils.c +libdivsufsort64_la_CPPFLAGS = -I$(top_srcdir)/include -DBUILD_DIVSUFSORT64 +libdivsufsort64_la_LDFLAGS = -version-info @LT_CURRENT@:@LT_REVISION@:@LT_AGE@ -export-symbols $(srcdir)/libdivsufsort64.sym +endif + +EXTRA_DIST = libdivsufsort.sym libdivsufsort64.sym CMakeLists.txt diff --git a/tools/Flips/libdivsufsort-2.0.1/lib/Makefile.in b/tools/Flips/libdivsufsort-2.0.1/lib/Makefile.in new file mode 100644 index 000000000..929b64a70 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/lib/Makefile.in @@ -0,0 +1,637 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Makefile.am for libdivsufsort + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@DIVSUFSORT64_TRUE@am__append_1 = libdivsufsort64.la +subdir = lib +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libdivsufsort_la_LIBADD = +am_libdivsufsort_la_OBJECTS = libdivsufsort_la-divsufsort.lo \ + libdivsufsort_la-sssort.lo libdivsufsort_la-trsort.lo \ + libdivsufsort_la-utils.lo +libdivsufsort_la_OBJECTS = $(am_libdivsufsort_la_OBJECTS) +libdivsufsort_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libdivsufsort_la_LDFLAGS) $(LDFLAGS) -o $@ +libdivsufsort64_la_LIBADD = +am__libdivsufsort64_la_SOURCES_DIST = divsufsort.c sssort.c trsort.c \ + utils.c +@DIVSUFSORT64_TRUE@am_libdivsufsort64_la_OBJECTS = \ +@DIVSUFSORT64_TRUE@ libdivsufsort64_la-divsufsort.lo \ +@DIVSUFSORT64_TRUE@ libdivsufsort64_la-sssort.lo \ +@DIVSUFSORT64_TRUE@ libdivsufsort64_la-trsort.lo \ +@DIVSUFSORT64_TRUE@ libdivsufsort64_la-utils.lo +libdivsufsort64_la_OBJECTS = $(am_libdivsufsort64_la_OBJECTS) +libdivsufsort64_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libdivsufsort64_la_LDFLAGS) $(LDFLAGS) -o $@ +@DIVSUFSORT64_TRUE@am_libdivsufsort64_la_rpath = -rpath $(libdir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libdivsufsort_la_SOURCES) $(libdivsufsort64_la_SOURCES) +DIST_SOURCES = $(libdivsufsort_la_SOURCES) \ + $(am__libdivsufsort64_la_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIVSUFSORT_EXPORT = @DIVSUFSORT_EXPORT@ +DIVSUFSORT_IMPORT = @DIVSUFSORT_IMPORT@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INCFILE = @INCFILE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LFS_FOPEN = @LFS_FOPEN@ +LFS_FSEEK = @LFS_FSEEK@ +LFS_FTELL = @LFS_FTELL@ +LFS_OFF_T = @LFS_OFF_T@ +LFS_PRID = @LFS_PRID@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_DEPS = @LIBTOOL_DEPS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PROJECT_DESCRIPTION = @PROJECT_DESCRIPTION@ +PROJECT_NAME = @PROJECT_NAME@ +PROJECT_URL = @PROJECT_URL@ +PROJECT_VERSION_FULL = @PROJECT_VERSION_FULL@ +RANLIB = @RANLIB@ +SAINDEX_PRId = @SAINDEX_PRId@ +SAINDEX_TYPE = @SAINDEX_TYPE@ +SAINT32_TYPE = @SAINT32_TYPE@ +SAINT64_PRId = @SAINT64_PRId@ +SAINT64_TYPE = @SAINT64_TYPE@ +SAINT_PRId = @SAINT_PRId@ +SAUCHAR_TYPE = @SAUCHAR_TYPE@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +W64BIT = @W64BIT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +lib_LTLIBRARIES = libdivsufsort.la $(am__append_1) +libdivsufsort_la_SOURCES = divsufsort.c sssort.c trsort.c utils.c +libdivsufsort_la_CPPFLAGS = -I$(top_srcdir)/include +libdivsufsort_la_LDFLAGS = -version-info @LT_CURRENT@:@LT_REVISION@:@LT_AGE@ -export-symbols $(srcdir)/libdivsufsort.sym +@DIVSUFSORT64_TRUE@libdivsufsort64_la_SOURCES = divsufsort.c sssort.c trsort.c utils.c +@DIVSUFSORT64_TRUE@libdivsufsort64_la_CPPFLAGS = -I$(top_srcdir)/include -DBUILD_DIVSUFSORT64 +@DIVSUFSORT64_TRUE@libdivsufsort64_la_LDFLAGS = -version-info @LT_CURRENT@:@LT_REVISION@:@LT_AGE@ -export-symbols $(srcdir)/libdivsufsort64.sym +EXTRA_DIST = libdivsufsort.sym libdivsufsort64.sym CMakeLists.txt +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign lib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libdivsufsort.la: $(libdivsufsort_la_OBJECTS) $(libdivsufsort_la_DEPENDENCIES) + $(libdivsufsort_la_LINK) -rpath $(libdir) $(libdivsufsort_la_OBJECTS) $(libdivsufsort_la_LIBADD) $(LIBS) +libdivsufsort64.la: $(libdivsufsort64_la_OBJECTS) $(libdivsufsort64_la_DEPENDENCIES) + $(libdivsufsort64_la_LINK) $(am_libdivsufsort64_la_rpath) $(libdivsufsort64_la_OBJECTS) $(libdivsufsort64_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdivsufsort64_la-divsufsort.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdivsufsort64_la-sssort.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdivsufsort64_la-trsort.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdivsufsort64_la-utils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdivsufsort_la-divsufsort.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdivsufsort_la-sssort.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdivsufsort_la-trsort.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdivsufsort_la-utils.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libdivsufsort_la-divsufsort.lo: divsufsort.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdivsufsort_la-divsufsort.lo -MD -MP -MF $(DEPDIR)/libdivsufsort_la-divsufsort.Tpo -c -o libdivsufsort_la-divsufsort.lo `test -f 'divsufsort.c' || echo '$(srcdir)/'`divsufsort.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libdivsufsort_la-divsufsort.Tpo $(DEPDIR)/libdivsufsort_la-divsufsort.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='divsufsort.c' object='libdivsufsort_la-divsufsort.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdivsufsort_la-divsufsort.lo `test -f 'divsufsort.c' || echo '$(srcdir)/'`divsufsort.c + +libdivsufsort_la-sssort.lo: sssort.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdivsufsort_la-sssort.lo -MD -MP -MF $(DEPDIR)/libdivsufsort_la-sssort.Tpo -c -o libdivsufsort_la-sssort.lo `test -f 'sssort.c' || echo '$(srcdir)/'`sssort.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libdivsufsort_la-sssort.Tpo $(DEPDIR)/libdivsufsort_la-sssort.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sssort.c' object='libdivsufsort_la-sssort.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdivsufsort_la-sssort.lo `test -f 'sssort.c' || echo '$(srcdir)/'`sssort.c + +libdivsufsort_la-trsort.lo: trsort.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdivsufsort_la-trsort.lo -MD -MP -MF $(DEPDIR)/libdivsufsort_la-trsort.Tpo -c -o libdivsufsort_la-trsort.lo `test -f 'trsort.c' || echo '$(srcdir)/'`trsort.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libdivsufsort_la-trsort.Tpo $(DEPDIR)/libdivsufsort_la-trsort.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='trsort.c' object='libdivsufsort_la-trsort.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdivsufsort_la-trsort.lo `test -f 'trsort.c' || echo '$(srcdir)/'`trsort.c + +libdivsufsort_la-utils.lo: utils.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdivsufsort_la-utils.lo -MD -MP -MF $(DEPDIR)/libdivsufsort_la-utils.Tpo -c -o libdivsufsort_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libdivsufsort_la-utils.Tpo $(DEPDIR)/libdivsufsort_la-utils.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='libdivsufsort_la-utils.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdivsufsort_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c + +libdivsufsort64_la-divsufsort.lo: divsufsort.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort64_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdivsufsort64_la-divsufsort.lo -MD -MP -MF $(DEPDIR)/libdivsufsort64_la-divsufsort.Tpo -c -o libdivsufsort64_la-divsufsort.lo `test -f 'divsufsort.c' || echo '$(srcdir)/'`divsufsort.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libdivsufsort64_la-divsufsort.Tpo $(DEPDIR)/libdivsufsort64_la-divsufsort.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='divsufsort.c' object='libdivsufsort64_la-divsufsort.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort64_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdivsufsort64_la-divsufsort.lo `test -f 'divsufsort.c' || echo '$(srcdir)/'`divsufsort.c + +libdivsufsort64_la-sssort.lo: sssort.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort64_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdivsufsort64_la-sssort.lo -MD -MP -MF $(DEPDIR)/libdivsufsort64_la-sssort.Tpo -c -o libdivsufsort64_la-sssort.lo `test -f 'sssort.c' || echo '$(srcdir)/'`sssort.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libdivsufsort64_la-sssort.Tpo $(DEPDIR)/libdivsufsort64_la-sssort.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sssort.c' object='libdivsufsort64_la-sssort.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort64_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdivsufsort64_la-sssort.lo `test -f 'sssort.c' || echo '$(srcdir)/'`sssort.c + +libdivsufsort64_la-trsort.lo: trsort.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort64_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdivsufsort64_la-trsort.lo -MD -MP -MF $(DEPDIR)/libdivsufsort64_la-trsort.Tpo -c -o libdivsufsort64_la-trsort.lo `test -f 'trsort.c' || echo '$(srcdir)/'`trsort.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libdivsufsort64_la-trsort.Tpo $(DEPDIR)/libdivsufsort64_la-trsort.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='trsort.c' object='libdivsufsort64_la-trsort.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort64_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdivsufsort64_la-trsort.lo `test -f 'trsort.c' || echo '$(srcdir)/'`trsort.c + +libdivsufsort64_la-utils.lo: utils.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort64_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libdivsufsort64_la-utils.lo -MD -MP -MF $(DEPDIR)/libdivsufsort64_la-utils.Tpo -c -o libdivsufsort64_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libdivsufsort64_la-utils.Tpo $(DEPDIR)/libdivsufsort64_la-utils.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='libdivsufsort64_la-utils.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdivsufsort64_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libdivsufsort64_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tools/Flips/libdivsufsort-2.0.1/lib/divsufsort.c b/tools/Flips/libdivsufsort-2.0.1/lib/divsufsort.c new file mode 100644 index 000000000..9f64b4f48 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/lib/divsufsort.c @@ -0,0 +1,398 @@ +/* + * divsufsort.c for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "divsufsort_private.h" +#ifdef _OPENMP +# include +#endif + + +/*- Private Functions -*/ + +/* Sorts suffixes of type B*. */ +static +saidx_t +sort_typeBstar(const sauchar_t *T, saidx_t *SA, + saidx_t *bucket_A, saidx_t *bucket_B, + saidx_t n) { + saidx_t *PAb, *ISAb, *buf; +#ifdef _OPENMP + saidx_t *curbuf; + saidx_t l; +#endif + saidx_t i, j, k, t, m, bufsize; + saint_t c0, c1; +#ifdef _OPENMP + saint_t d0, d1; + int tmp; +#endif + + /* Initialize bucket arrays. */ + for(i = 0; i < BUCKET_A_SIZE; ++i) { bucket_A[i] = 0; } + for(i = 0; i < BUCKET_B_SIZE; ++i) { bucket_B[i] = 0; } + + /* Count the number of occurrences of the first one or two characters of each + type A, B and B* suffix. Moreover, store the beginning position of all + type B* suffixes into the array SA. */ + for(i = n - 1, m = n, c0 = T[n - 1]; 0 <= i;) { + /* type A suffix. */ + do { ++BUCKET_A(c1 = c0); } while((0 <= --i) && ((c0 = T[i]) >= c1)); + if(0 <= i) { + /* type B* suffix. */ + ++BUCKET_BSTAR(c0, c1); + SA[--m] = i; + /* type B suffix. */ + for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) <= c1); --i, c1 = c0) { + ++BUCKET_B(c0, c1); + } + } + } + m = n - m; +/* +note: + A type B* suffix is lexicographically smaller than a type B suffix that + begins with the same first two characters. +*/ + + /* Calculate the index of start/end point of each bucket. */ + for(c0 = 0, i = 0, j = 0; c0 < ALPHABET_SIZE; ++c0) { + t = i + BUCKET_A(c0); + BUCKET_A(c0) = i + j; /* start point */ + i = t + BUCKET_B(c0, c0); + for(c1 = c0 + 1; c1 < ALPHABET_SIZE; ++c1) { + j += BUCKET_BSTAR(c0, c1); + BUCKET_BSTAR(c0, c1) = j; /* end point */ + i += BUCKET_B(c0, c1); + } + } + + if(0 < m) { + /* Sort the type B* suffixes by their first two characters. */ + PAb = SA + n - m; ISAb = SA + m; + for(i = m - 2; 0 <= i; --i) { + t = PAb[i], c0 = T[t], c1 = T[t + 1]; + SA[--BUCKET_BSTAR(c0, c1)] = i; + } + t = PAb[m - 1], c0 = T[t], c1 = T[t + 1]; + SA[--BUCKET_BSTAR(c0, c1)] = m - 1; + + /* Sort the type B* substrings using sssort. */ +#ifdef _OPENMP + tmp = omp_get_max_threads(); + buf = SA + m, bufsize = (n - (2 * m)) / tmp; + c0 = ALPHABET_SIZE - 2, c1 = ALPHABET_SIZE - 1, j = m; +#pragma omp parallel default(shared) private(curbuf, k, l, d0, d1, tmp) + { + tmp = omp_get_thread_num(); + curbuf = buf + tmp * bufsize; + k = 0; + for(;;) { + #pragma omp critical(sssort_lock) + { + if(0 < (l = j)) { + d0 = c0, d1 = c1; + do { + k = BUCKET_BSTAR(d0, d1); + if(--d1 <= d0) { + d1 = ALPHABET_SIZE - 1; + if(--d0 < 0) { break; } + } + } while(((l - k) <= 1) && (0 < (l = k))); + c0 = d0, c1 = d1, j = k; + } + } + if(l == 0) { break; } + sssort(T, PAb, SA + k, SA + l, + curbuf, bufsize, 2, n, *(SA + k) == (m - 1)); + } + } +#else + buf = SA + m, bufsize = n - (2 * m); + for(c0 = ALPHABET_SIZE - 2, j = m; 0 < j; --c0) { + for(c1 = ALPHABET_SIZE - 1; c0 < c1; j = i, --c1) { + i = BUCKET_BSTAR(c0, c1); + if(1 < (j - i)) { + sssort(T, PAb, SA + i, SA + j, + buf, bufsize, 2, n, *(SA + i) == (m - 1)); + } + } + } +#endif + + /* Compute ranks of type B* substrings. */ + for(i = m - 1; 0 <= i; --i) { + if(0 <= SA[i]) { + j = i; + do { ISAb[SA[i]] = i; } while((0 <= --i) && (0 <= SA[i])); + SA[i + 1] = i - j; + if(i <= 0) { break; } + } + j = i; + do { ISAb[SA[i] = ~SA[i]] = j; } while(SA[--i] < 0); + ISAb[SA[i]] = j; + } + + /* Construct the inverse suffix array of type B* suffixes using trsort. */ + trsort(ISAb, SA, m, 1); + + /* Set the sorted order of tyoe B* suffixes. */ + for(i = n - 1, j = m, c0 = T[n - 1]; 0 <= i;) { + for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) >= c1); --i, c1 = c0) { } + if(0 <= i) { + t = i; + for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) <= c1); --i, c1 = c0) { } + SA[ISAb[--j]] = ((t == 0) || (1 < (t - i))) ? t : ~t; + } + } + + /* Calculate the index of start/end point of each bucket. */ + BUCKET_B(ALPHABET_SIZE - 1, ALPHABET_SIZE - 1) = n; /* end point */ + for(c0 = ALPHABET_SIZE - 2, k = m - 1; 0 <= c0; --c0) { + i = BUCKET_A(c0 + 1) - 1; + for(c1 = ALPHABET_SIZE - 1; c0 < c1; --c1) { + t = i - BUCKET_B(c0, c1); + BUCKET_B(c0, c1) = i; /* end point */ + + /* Move all type B* suffixes to the correct position. */ + for(i = t, j = BUCKET_BSTAR(c0, c1); + j <= k; + --i, --k) { SA[i] = SA[k]; } + } + BUCKET_BSTAR(c0, c0 + 1) = i - BUCKET_B(c0, c0) + 1; /* start point */ + BUCKET_B(c0, c0) = i; /* end point */ + } + } + + return m; +} + +/* Constructs the suffix array by using the sorted order of type B* suffixes. */ +static +void +construct_SA(const sauchar_t *T, saidx_t *SA, + saidx_t *bucket_A, saidx_t *bucket_B, + saidx_t n, saidx_t m) { + saidx_t *i, *j, *k; + saidx_t s; + saint_t c0, c1, c2; + + if(0 < m) { + /* Construct the sorted order of type B suffixes by using + the sorted order of type B* suffixes. */ + for(c1 = ALPHABET_SIZE - 2; 0 <= c1; --c1) { + /* Scan the suffix array from right to left. */ + for(i = SA + BUCKET_BSTAR(c1, c1 + 1), + j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1; + i <= j; + --j) { + if(0 < (s = *j)) { + assert(T[s] == c1); + assert(((s + 1) < n) && (T[s] <= T[s + 1])); + assert(T[s - 1] <= T[s]); + *j = ~s; + c0 = T[--s]; + if((0 < s) && (T[s - 1] > c0)) { s = ~s; } + if(c0 != c2) { + if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; } + k = SA + BUCKET_B(c2 = c0, c1); + } + assert(k < j); + *k-- = s; + } else { + assert(((s == 0) && (T[s] == c1)) || (s < 0)); + *j = ~s; + } + } + } + } + + /* Construct the suffix array by using + the sorted order of type B suffixes. */ + k = SA + BUCKET_A(c2 = T[n - 1]); + *k++ = (T[n - 2] < c2) ? ~(n - 1) : (n - 1); + /* Scan the suffix array from left to right. */ + for(i = SA, j = SA + n; i < j; ++i) { + if(0 < (s = *i)) { + assert(T[s - 1] >= T[s]); + c0 = T[--s]; + if((s == 0) || (T[s - 1] < c0)) { s = ~s; } + if(c0 != c2) { + BUCKET_A(c2) = k - SA; + k = SA + BUCKET_A(c2 = c0); + } + assert(i < k); + *k++ = s; + } else { + assert(s < 0); + *i = ~s; + } + } +} + +/* Constructs the burrows-wheeler transformed string directly + by using the sorted order of type B* suffixes. */ +static +saidx_t +construct_BWT(const sauchar_t *T, saidx_t *SA, + saidx_t *bucket_A, saidx_t *bucket_B, + saidx_t n, saidx_t m) { + saidx_t *i, *j, *k, *orig; + saidx_t s; + saint_t c0, c1, c2; + + if(0 < m) { + /* Construct the sorted order of type B suffixes by using + the sorted order of type B* suffixes. */ + for(c1 = ALPHABET_SIZE - 2; 0 <= c1; --c1) { + /* Scan the suffix array from right to left. */ + for(i = SA + BUCKET_BSTAR(c1, c1 + 1), + j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1; + i <= j; + --j) { + if(0 < (s = *j)) { + assert(T[s] == c1); + assert(((s + 1) < n) && (T[s] <= T[s + 1])); + assert(T[s - 1] <= T[s]); + c0 = T[--s]; + *j = ~((saidx_t)c0); + if((0 < s) && (T[s - 1] > c0)) { s = ~s; } + if(c0 != c2) { + if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; } + k = SA + BUCKET_B(c2 = c0, c1); + } + assert(k < j); + *k-- = s; + } else if(s != 0) { + *j = ~s; +#ifndef NDEBUG + } else { + assert(T[s] == c1); +#endif + } + } + } + } + + /* Construct the BWTed string by using + the sorted order of type B suffixes. */ + k = SA + BUCKET_A(c2 = T[n - 1]); + *k++ = (T[n - 2] < c2) ? ~((saidx_t)T[n - 2]) : (n - 1); + /* Scan the suffix array from left to right. */ + for(i = SA, j = SA + n, orig = SA; i < j; ++i) { + if(0 < (s = *i)) { + assert(T[s - 1] >= T[s]); + c0 = T[--s]; + *i = c0; + if((0 < s) && (T[s - 1] < c0)) { s = ~((saidx_t)T[s - 1]); } + if(c0 != c2) { + BUCKET_A(c2) = k - SA; + k = SA + BUCKET_A(c2 = c0); + } + assert(i < k); + *k++ = s; + } else if(s != 0) { + *i = ~s; + } else { + orig = i; + } + } + + return orig - SA; +} + + +/*---------------------------------------------------------------------------*/ + +/*- Function -*/ + +saint_t +divsufsort(const sauchar_t *T, saidx_t *SA, saidx_t n) { + saidx_t *bucket_A, *bucket_B; + saidx_t m; + saint_t err = 0; + + /* Check arguments. */ + if((T == NULL) || (SA == NULL) || (n < 0)) { return -1; } + else if(n == 0) { return 0; } + else if(n == 1) { SA[0] = 0; return 0; } + else if(n == 2) { m = (T[0] < T[1]); SA[m ^ 1] = 0, SA[m] = 1; return 0; } + + bucket_A = (saidx_t *)malloc(BUCKET_A_SIZE * sizeof(saidx_t)); + bucket_B = (saidx_t *)malloc(BUCKET_B_SIZE * sizeof(saidx_t)); + + /* Suffixsort. */ + if((bucket_A != NULL) && (bucket_B != NULL)) { + m = sort_typeBstar(T, SA, bucket_A, bucket_B, n); + construct_SA(T, SA, bucket_A, bucket_B, n, m); + } else { + err = -2; + } + + free(bucket_B); + free(bucket_A); + + return err; +} + +saidx_t +divbwt(const sauchar_t *T, sauchar_t *U, saidx_t *A, saidx_t n) { + saidx_t *B; + saidx_t *bucket_A, *bucket_B; + saidx_t m, pidx, i; + + /* Check arguments. */ + if((T == NULL) || (U == NULL) || (n < 0)) { return -1; } + else if(n <= 1) { if(n == 1) { U[0] = T[0]; } return n; } + + if((B = A) == NULL) { B = (saidx_t *)malloc((size_t)(n + 1) * sizeof(saidx_t)); } + bucket_A = (saidx_t *)malloc(BUCKET_A_SIZE * sizeof(saidx_t)); + bucket_B = (saidx_t *)malloc(BUCKET_B_SIZE * sizeof(saidx_t)); + + /* Burrows-Wheeler Transform. */ + if((B != NULL) && (bucket_A != NULL) && (bucket_B != NULL)) { + m = sort_typeBstar(T, B, bucket_A, bucket_B, n); + pidx = construct_BWT(T, B, bucket_A, bucket_B, n, m); + + /* Copy to output string. */ + U[0] = T[n - 1]; + for(i = 0; i < pidx; ++i) { U[i + 1] = (sauchar_t)B[i]; } + for(i += 1; i < n; ++i) { U[i] = (sauchar_t)B[i]; } + pidx += 1; + } else { + pidx = -2; + } + + free(bucket_B); + free(bucket_A); + if(A == NULL) { free(B); } + + return pidx; +} + +const char * +divsufsort_version(void) { + return PROJECT_VERSION_FULL; +} diff --git a/tools/Flips/libdivsufsort-2.0.1/lib/libdivsufsort.sym b/tools/Flips/libdivsufsort-2.0.1/lib/libdivsufsort.sym new file mode 100644 index 000000000..2dcda953a --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/lib/libdivsufsort.sym @@ -0,0 +1,8 @@ +divsufsort +divbwt +divsufsort_version +bw_transform +inverse_bw_transform +sufcheck +sa_search +sa_simplesearch diff --git a/tools/Flips/libdivsufsort-2.0.1/lib/libdivsufsort64.sym b/tools/Flips/libdivsufsort-2.0.1/lib/libdivsufsort64.sym new file mode 100644 index 000000000..e04c45196 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/lib/libdivsufsort64.sym @@ -0,0 +1,8 @@ +divsufsort64 +divbwt64 +divsufsort64_version +bw_transform64 +inverse_bw_transform64 +sufcheck64 +sa_search64 +sa_simplesearch64 diff --git a/tools/Flips/libdivsufsort-2.0.1/lib/sssort.c b/tools/Flips/libdivsufsort-2.0.1/lib/sssort.c new file mode 100644 index 000000000..4a18fd2ab --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/lib/sssort.c @@ -0,0 +1,815 @@ +/* + * sssort.c for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "divsufsort_private.h" + + +/*- Private Functions -*/ + +static const saint_t lg_table[256]= { + -1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 +}; + +#if (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) + +static INLINE +saint_t +ss_ilg(saidx_t n) { +#if SS_BLOCKSIZE == 0 +# if defined(BUILD_DIVSUFSORT64) + return (n >> 32) ? + ((n >> 48) ? + ((n >> 56) ? + 56 + lg_table[(n >> 56) & 0xff] : + 48 + lg_table[(n >> 48) & 0xff]) : + ((n >> 40) ? + 40 + lg_table[(n >> 40) & 0xff] : + 32 + lg_table[(n >> 32) & 0xff])) : + ((n & 0xffff0000) ? + ((n & 0xff000000) ? + 24 + lg_table[(n >> 24) & 0xff] : + 16 + lg_table[(n >> 16) & 0xff]) : + ((n & 0x0000ff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff])); +# else + return (n & 0xffff0000) ? + ((n & 0xff000000) ? + 24 + lg_table[(n >> 24) & 0xff] : + 16 + lg_table[(n >> 16) & 0xff]) : + ((n & 0x0000ff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff]); +# endif +#elif SS_BLOCKSIZE < 256 + return lg_table[n]; +#else + return (n & 0xff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff]; +#endif +} + +#endif /* (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) */ + +#if SS_BLOCKSIZE != 0 + +static const saint_t sqq_table[256] = { + 0, 16, 22, 27, 32, 35, 39, 42, 45, 48, 50, 53, 55, 57, 59, 61, + 64, 65, 67, 69, 71, 73, 75, 76, 78, 80, 81, 83, 84, 86, 87, 89, + 90, 91, 93, 94, 96, 97, 98, 99, 101, 102, 103, 104, 106, 107, 108, 109, +110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, +128, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, +143, 144, 144, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 155, +156, 157, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, +169, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 178, 179, 180, +181, 181, 182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191, +192, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 201, +202, 203, 203, 204, 204, 205, 206, 206, 207, 208, 208, 209, 209, 210, 211, 211, +212, 212, 213, 214, 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 221, +221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, 227, 228, 229, 229, 230, +230, 231, 231, 232, 232, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, +239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, +247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 +}; + +static INLINE +saidx_t +ss_isqrt(saidx_t x) { + saidx_t y, e; + + if(x >= (SS_BLOCKSIZE * SS_BLOCKSIZE)) { return SS_BLOCKSIZE; } + e = (x & 0xffff0000) ? + ((x & 0xff000000) ? + 24 + lg_table[(x >> 24) & 0xff] : + 16 + lg_table[(x >> 16) & 0xff]) : + ((x & 0x0000ff00) ? + 8 + lg_table[(x >> 8) & 0xff] : + 0 + lg_table[(x >> 0) & 0xff]); + + if(e >= 16) { + y = sqq_table[x >> ((e - 6) - (e & 1))] << ((e >> 1) - 7); + if(e >= 24) { y = (y + 1 + x / y) >> 1; } + y = (y + 1 + x / y) >> 1; + } else if(e >= 8) { + y = (sqq_table[x >> ((e - 6) - (e & 1))] >> (7 - (e >> 1))) + 1; + } else { + return sqq_table[x] >> 4; + } + + return (x < (y * y)) ? y - 1 : y; +} + +#endif /* SS_BLOCKSIZE != 0 */ + + +/*---------------------------------------------------------------------------*/ + +/* Compares two suffixes. */ +static INLINE +saint_t +ss_compare(const sauchar_t *T, + const saidx_t *p1, const saidx_t *p2, + saidx_t depth) { + const sauchar_t *U1, *U2, *U1n, *U2n; + + for(U1 = T + depth + *p1, + U2 = T + depth + *p2, + U1n = T + *(p1 + 1) + 2, + U2n = T + *(p2 + 1) + 2; + (U1 < U1n) && (U2 < U2n) && (*U1 == *U2); + ++U1, ++U2) { + } + + return U1 < U1n ? + (U2 < U2n ? *U1 - *U2 : 1) : + (U2 < U2n ? -1 : 0); +} + + +/*---------------------------------------------------------------------------*/ + +#if (SS_BLOCKSIZE != 1) && (SS_INSERTIONSORT_THRESHOLD != 1) + +/* Insertionsort for small size groups */ +static +void +ss_insertionsort(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *last, saidx_t depth) { + saidx_t *i, *j; + saidx_t t; + saint_t r; + + for(i = last - 2; first <= i; --i) { + for(t = *i, j = i + 1; 0 < (r = ss_compare(T, PA + t, PA + *j, depth));) { + do { *(j - 1) = *j; } while((++j < last) && (*j < 0)); + if(last <= j) { break; } + } + if(r == 0) { *j = ~*j; } + *(j - 1) = t; + } +} + +#endif /* (SS_BLOCKSIZE != 1) && (SS_INSERTIONSORT_THRESHOLD != 1) */ + + +/*---------------------------------------------------------------------------*/ + +#if (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) + +static INLINE +void +ss_fixdown(const sauchar_t *Td, const saidx_t *PA, + saidx_t *SA, saidx_t i, saidx_t size) { + saidx_t j, k; + saidx_t v; + saint_t c, d, e; + + for(v = SA[i], c = Td[PA[v]]; (j = 2 * i + 1) < size; SA[i] = SA[k], i = k) { + d = Td[PA[SA[k = j++]]]; + if(d < (e = Td[PA[SA[j]]])) { k = j; d = e; } + if(d <= c) { break; } + } + SA[i] = v; +} + +/* Simple top-down heapsort. */ +static +void +ss_heapsort(const sauchar_t *Td, const saidx_t *PA, saidx_t *SA, saidx_t size) { + saidx_t i, m; + saidx_t t; + + m = size; + if((size % 2) == 0) { + m--; + if(Td[PA[SA[m / 2]]] < Td[PA[SA[m]]]) { SWAP(SA[m], SA[m / 2]); } + } + + for(i = m / 2 - 1; 0 <= i; --i) { ss_fixdown(Td, PA, SA, i, m); } + if((size % 2) == 0) { SWAP(SA[0], SA[m]); ss_fixdown(Td, PA, SA, 0, m); } + for(i = m - 1; 0 < i; --i) { + t = SA[0], SA[0] = SA[i]; + ss_fixdown(Td, PA, SA, 0, i); + SA[i] = t; + } +} + + +/*---------------------------------------------------------------------------*/ + +/* Returns the median of three elements. */ +static INLINE +saidx_t * +ss_median3(const sauchar_t *Td, const saidx_t *PA, + saidx_t *v1, saidx_t *v2, saidx_t *v3) { + saidx_t *t; + if(Td[PA[*v1]] > Td[PA[*v2]]) { SWAP(v1, v2); } + if(Td[PA[*v2]] > Td[PA[*v3]]) { + if(Td[PA[*v1]] > Td[PA[*v3]]) { return v1; } + else { return v3; } + } + return v2; +} + +/* Returns the median of five elements. */ +static INLINE +saidx_t * +ss_median5(const sauchar_t *Td, const saidx_t *PA, + saidx_t *v1, saidx_t *v2, saidx_t *v3, saidx_t *v4, saidx_t *v5) { + saidx_t *t; + if(Td[PA[*v2]] > Td[PA[*v3]]) { SWAP(v2, v3); } + if(Td[PA[*v4]] > Td[PA[*v5]]) { SWAP(v4, v5); } + if(Td[PA[*v2]] > Td[PA[*v4]]) { SWAP(v2, v4); SWAP(v3, v5); } + if(Td[PA[*v1]] > Td[PA[*v3]]) { SWAP(v1, v3); } + if(Td[PA[*v1]] > Td[PA[*v4]]) { SWAP(v1, v4); SWAP(v3, v5); } + if(Td[PA[*v3]] > Td[PA[*v4]]) { return v4; } + return v3; +} + +/* Returns the pivot element. */ +static INLINE +saidx_t * +ss_pivot(const sauchar_t *Td, const saidx_t *PA, saidx_t *first, saidx_t *last) { + saidx_t *middle; + saidx_t t; + + t = last - first; + middle = first + t / 2; + + if(t <= 512) { + if(t <= 32) { + return ss_median3(Td, PA, first, middle, last - 1); + } else { + t >>= 2; + return ss_median5(Td, PA, first, first + t, middle, last - 1 - t, last - 1); + } + } + t >>= 3; + first = ss_median3(Td, PA, first, first + t, first + (t << 1)); + middle = ss_median3(Td, PA, middle - t, middle, middle + t); + last = ss_median3(Td, PA, last - 1 - (t << 1), last - 1 - t, last - 1); + return ss_median3(Td, PA, first, middle, last); +} + + +/*---------------------------------------------------------------------------*/ + +/* Binary partition for substrings. */ +static INLINE +saidx_t * +ss_partition(const saidx_t *PA, + saidx_t *first, saidx_t *last, saidx_t depth) { + saidx_t *a, *b; + saidx_t t; + for(a = first - 1, b = last;;) { + for(; (++a < b) && ((PA[*a] + depth) >= (PA[*a + 1] + 1));) { *a = ~*a; } + for(; (a < --b) && ((PA[*b] + depth) < (PA[*b + 1] + 1));) { } + if(b <= a) { break; } + t = ~*b; + *b = *a; + *a = t; + } + if(first < a) { *first = ~*first; } + return a; +} + +/* Multikey introsort for medium size groups. */ +static +void +ss_mintrosort(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *last, + saidx_t depth) { +#define STACK_SIZE SS_MISORT_STACKSIZE + struct { saidx_t *a, *b, c; saint_t d; } stack[STACK_SIZE]; + const sauchar_t *Td; + saidx_t *a, *b, *c, *d, *e, *f; + saidx_t s, t; + saint_t ssize; + saint_t limit; + saint_t v, x = 0; + + for(ssize = 0, limit = ss_ilg(last - first);;) { + + if((last - first) <= SS_INSERTIONSORT_THRESHOLD) { +#if 1 < SS_INSERTIONSORT_THRESHOLD + if(1 < (last - first)) { ss_insertionsort(T, PA, first, last, depth); } +#endif + STACK_POP(first, last, depth, limit); + continue; + } + + Td = T + depth; + if(limit-- == 0) { ss_heapsort(Td, PA, first, last - first); } + if(limit < 0) { + for(a = first + 1, v = Td[PA[*first]]; a < last; ++a) { + if((x = Td[PA[*a]]) != v) { + if(1 < (a - first)) { break; } + v = x; + first = a; + } + } + if(Td[PA[*first] - 1] < v) { + first = ss_partition(PA, first, a, depth); + } + if((a - first) <= (last - a)) { + if(1 < (a - first)) { + STACK_PUSH(a, last, depth, -1); + last = a, depth += 1, limit = ss_ilg(a - first); + } else { + first = a, limit = -1; + } + } else { + if(1 < (last - a)) { + STACK_PUSH(first, a, depth + 1, ss_ilg(a - first)); + first = a, limit = -1; + } else { + last = a, depth += 1, limit = ss_ilg(a - first); + } + } + continue; + } + + /* choose pivot */ + a = ss_pivot(Td, PA, first, last); + v = Td[PA[*a]]; + SWAP(*first, *a); + + /* partition */ + for(b = first; (++b < last) && ((x = Td[PA[*b]]) == v);) { } + if(((a = b) < last) && (x < v)) { + for(; (++b < last) && ((x = Td[PA[*b]]) <= v);) { + if(x == v) { SWAP(*b, *a); ++a; } + } + } + for(c = last; (b < --c) && ((x = Td[PA[*c]]) == v);) { } + if((b < (d = c)) && (x > v)) { + for(; (b < --c) && ((x = Td[PA[*c]]) >= v);) { + if(x == v) { SWAP(*c, *d); --d; } + } + } + for(; b < c;) { + SWAP(*b, *c); + for(; (++b < c) && ((x = Td[PA[*b]]) <= v);) { + if(x == v) { SWAP(*b, *a); ++a; } + } + for(; (b < --c) && ((x = Td[PA[*c]]) >= v);) { + if(x == v) { SWAP(*c, *d); --d; } + } + } + + if(a <= d) { + c = b - 1; + + if((s = a - first) > (t = b - a)) { s = t; } + for(e = first, f = b - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } + if((s = d - c) > (t = last - d - 1)) { s = t; } + for(e = b, f = last - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } + + a = first + (b - a), c = last - (d - c); + b = (v <= Td[PA[*a] - 1]) ? a : ss_partition(PA, a, c, depth); + + if((a - first) <= (last - c)) { + if((last - c) <= (c - b)) { + STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); + STACK_PUSH(c, last, depth, limit); + last = a; + } else if((a - first) <= (c - b)) { + STACK_PUSH(c, last, depth, limit); + STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); + last = a; + } else { + STACK_PUSH(c, last, depth, limit); + STACK_PUSH(first, a, depth, limit); + first = b, last = c, depth += 1, limit = ss_ilg(c - b); + } + } else { + if((a - first) <= (c - b)) { + STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); + STACK_PUSH(first, a, depth, limit); + first = c; + } else if((last - c) <= (c - b)) { + STACK_PUSH(first, a, depth, limit); + STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); + first = c; + } else { + STACK_PUSH(first, a, depth, limit); + STACK_PUSH(c, last, depth, limit); + first = b, last = c, depth += 1, limit = ss_ilg(c - b); + } + } + } else { + limit += 1; + if(Td[PA[*first] - 1] < v) { + first = ss_partition(PA, first, last, depth); + limit = ss_ilg(last - first); + } + depth += 1; + } + } +#undef STACK_SIZE +} + +#endif /* (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) */ + + +/*---------------------------------------------------------------------------*/ + +#if SS_BLOCKSIZE != 0 + +static INLINE +void +ss_blockswap(saidx_t *a, saidx_t *b, saidx_t n) { + saidx_t t; + for(; 0 < n; --n, ++a, ++b) { + t = *a, *a = *b, *b = t; + } +} + +static INLINE +void +ss_rotate(saidx_t *first, saidx_t *middle, saidx_t *last) { + saidx_t *a, *b, t; + saidx_t l, r; + l = middle - first, r = last - middle; + for(; (0 < l) && (0 < r);) { + if(l == r) { ss_blockswap(first, middle, l); break; } + if(l < r) { + a = last - 1, b = middle - 1; + t = *a; + do { + *a-- = *b, *b-- = *a; + if(b < first) { + *a = t; + last = a; + if((r -= l + 1) <= l) { break; } + a -= 1, b = middle - 1; + t = *a; + } + } while(1); + } else { + a = first, b = middle; + t = *a; + do { + *a++ = *b, *b++ = *a; + if(last <= b) { + *a = t; + first = a + 1; + if((l -= r + 1) <= r) { break; } + a += 1, b = middle; + t = *a; + } + } while(1); + } + } +} + + +/*---------------------------------------------------------------------------*/ + +static +void +ss_inplacemerge(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *middle, saidx_t *last, + saidx_t depth) { + const saidx_t *p; + saidx_t *a, *b; + saidx_t len, half; + saint_t q, r; + saint_t x; + + for(;;) { + if(*(last - 1) < 0) { x = 1; p = PA + ~*(last - 1); } + else { x = 0; p = PA + *(last - 1); } + for(a = first, len = middle - first, half = len >> 1, r = -1; + 0 < len; + len = half, half >>= 1) { + b = a + half; + q = ss_compare(T, PA + ((0 <= *b) ? *b : ~*b), p, depth); + if(q < 0) { + a = b + 1; + half -= (len & 1) ^ 1; + } else { + r = q; + } + } + if(a < middle) { + if(r == 0) { *a = ~*a; } + ss_rotate(a, middle, last); + last -= middle - a; + middle = a; + if(first == middle) { break; } + } + --last; + if(x != 0) { while(*--last < 0) { } } + if(middle == last) { break; } + } +} + + +/*---------------------------------------------------------------------------*/ + +/* Merge-forward with internal buffer. */ +static +void +ss_mergeforward(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *middle, saidx_t *last, + saidx_t *buf, saidx_t depth) { + saidx_t *a, *b, *c, *bufend; + saidx_t t; + saint_t r; + + bufend = buf + (middle - first) - 1; + ss_blockswap(buf, first, middle - first); + + for(t = *(a = first), b = buf, c = middle;;) { + r = ss_compare(T, PA + *b, PA + *c, depth); + if(r < 0) { + do { + *a++ = *b; + if(bufend <= b) { *bufend = t; return; } + *b++ = *a; + } while(*b < 0); + } else if(r > 0) { + do { + *a++ = *c, *c++ = *a; + if(last <= c) { + while(b < bufend) { *a++ = *b, *b++ = *a; } + *a = *b, *b = t; + return; + } + } while(*c < 0); + } else { + *c = ~*c; + do { + *a++ = *b; + if(bufend <= b) { *bufend = t; return; } + *b++ = *a; + } while(*b < 0); + + do { + *a++ = *c, *c++ = *a; + if(last <= c) { + while(b < bufend) { *a++ = *b, *b++ = *a; } + *a = *b, *b = t; + return; + } + } while(*c < 0); + } + } +} + +/* Merge-backward with internal buffer. */ +static +void +ss_mergebackward(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *middle, saidx_t *last, + saidx_t *buf, saidx_t depth) { + const saidx_t *p1, *p2; + saidx_t *a, *b, *c, *bufend; + saidx_t t; + saint_t r; + saint_t x; + + bufend = buf + (last - middle) - 1; + ss_blockswap(buf, middle, last - middle); + + x = 0; + if(*bufend < 0) { p1 = PA + ~*bufend; x |= 1; } + else { p1 = PA + *bufend; } + if(*(middle - 1) < 0) { p2 = PA + ~*(middle - 1); x |= 2; } + else { p2 = PA + *(middle - 1); } + for(t = *(a = last - 1), b = bufend, c = middle - 1;;) { + r = ss_compare(T, p1, p2, depth); + if(0 < r) { + if(x & 1) { do { *a-- = *b, *b-- = *a; } while(*b < 0); x ^= 1; } + *a-- = *b; + if(b <= buf) { *buf = t; break; } + *b-- = *a; + if(*b < 0) { p1 = PA + ~*b; x |= 1; } + else { p1 = PA + *b; } + } else if(r < 0) { + if(x & 2) { do { *a-- = *c, *c-- = *a; } while(*c < 0); x ^= 2; } + *a-- = *c, *c-- = *a; + if(c < first) { + while(buf < b) { *a-- = *b, *b-- = *a; } + *a = *b, *b = t; + break; + } + if(*c < 0) { p2 = PA + ~*c; x |= 2; } + else { p2 = PA + *c; } + } else { + if(x & 1) { do { *a-- = *b, *b-- = *a; } while(*b < 0); x ^= 1; } + *a-- = ~*b; + if(b <= buf) { *buf = t; break; } + *b-- = *a; + if(x & 2) { do { *a-- = *c, *c-- = *a; } while(*c < 0); x ^= 2; } + *a-- = *c, *c-- = *a; + if(c < first) { + while(buf < b) { *a-- = *b, *b-- = *a; } + *a = *b, *b = t; + break; + } + if(*b < 0) { p1 = PA + ~*b; x |= 1; } + else { p1 = PA + *b; } + if(*c < 0) { p2 = PA + ~*c; x |= 2; } + else { p2 = PA + *c; } + } + } +} + +/* D&C based merge. */ +static +void +ss_swapmerge(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *middle, saidx_t *last, + saidx_t *buf, saidx_t bufsize, saidx_t depth) { +#define STACK_SIZE SS_SMERGE_STACKSIZE +#define GETIDX(a) ((0 <= (a)) ? (a) : (~(a))) +#define MERGE_CHECK(a, b, c)\ + do {\ + if(((c) & 1) ||\ + (((c) & 2) && (ss_compare(T, PA + GETIDX(*((a) - 1)), PA + *(a), depth) == 0))) {\ + *(a) = ~*(a);\ + }\ + if(((c) & 4) && ((ss_compare(T, PA + GETIDX(*((b) - 1)), PA + *(b), depth) == 0))) {\ + *(b) = ~*(b);\ + }\ + } while(0) + struct { saidx_t *a, *b, *c; saint_t d; } stack[STACK_SIZE]; + saidx_t *l, *r, *lm, *rm; + saidx_t m, len, half; + saint_t ssize; + saint_t check, next; + + for(check = 0, ssize = 0;;) { + if((last - middle) <= bufsize) { + if((first < middle) && (middle < last)) { + ss_mergebackward(T, PA, first, middle, last, buf, depth); + } + MERGE_CHECK(first, last, check); + STACK_POP(first, middle, last, check); + continue; + } + + if((middle - first) <= bufsize) { + if(first < middle) { + ss_mergeforward(T, PA, first, middle, last, buf, depth); + } + MERGE_CHECK(first, last, check); + STACK_POP(first, middle, last, check); + continue; + } + + for(m = 0, len = MIN(middle - first, last - middle), half = len >> 1; + 0 < len; + len = half, half >>= 1) { + if(ss_compare(T, PA + GETIDX(*(middle + m + half)), + PA + GETIDX(*(middle - m - half - 1)), depth) < 0) { + m += half + 1; + half -= (len & 1) ^ 1; + } + } + + if(0 < m) { + lm = middle - m, rm = middle + m; + ss_blockswap(lm, middle, m); + l = r = middle, next = 0; + if(rm < last) { + if(*rm < 0) { + *rm = ~*rm; + if(first < lm) { for(; *--l < 0;) { } next |= 4; } + next |= 1; + } else if(first < lm) { + for(; *r < 0; ++r) { } + next |= 2; + } + } + + if((l - first) <= (last - r)) { + STACK_PUSH(r, rm, last, (next & 3) | (check & 4)); + middle = lm, last = l, check = (check & 3) | (next & 4); + } else { + if((next & 2) && (r == middle)) { next ^= 6; } + STACK_PUSH(first, lm, l, (check & 3) | (next & 4)); + first = r, middle = rm, check = (next & 3) | (check & 4); + } + } else { + if(ss_compare(T, PA + GETIDX(*(middle - 1)), PA + *middle, depth) == 0) { + *middle = ~*middle; + } + MERGE_CHECK(first, last, check); + STACK_POP(first, middle, last, check); + } + } +#undef STACK_SIZE +} + +#endif /* SS_BLOCKSIZE != 0 */ + + +/*---------------------------------------------------------------------------*/ + +/*- Function -*/ + +/* Substring sort */ +void +sssort(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *last, + saidx_t *buf, saidx_t bufsize, + saidx_t depth, saidx_t n, saint_t lastsuffix) { + saidx_t *a; +#if SS_BLOCKSIZE != 0 + saidx_t *b, *middle, *curbuf; + saidx_t j, k, curbufsize, limit; +#endif + saidx_t i; + + if(lastsuffix != 0) { ++first; } + +#if SS_BLOCKSIZE == 0 + ss_mintrosort(T, PA, first, last, depth); +#else + if((bufsize < SS_BLOCKSIZE) && + (bufsize < (last - first)) && + (bufsize < (limit = ss_isqrt(last - first)))) { + if(SS_BLOCKSIZE < limit) { limit = SS_BLOCKSIZE; } + buf = middle = last - limit, bufsize = limit; + } else { + middle = last, limit = 0; + } + for(a = first, i = 0; SS_BLOCKSIZE < (middle - a); a += SS_BLOCKSIZE, ++i) { +#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE + ss_mintrosort(T, PA, a, a + SS_BLOCKSIZE, depth); +#elif 1 < SS_BLOCKSIZE + ss_insertionsort(T, PA, a, a + SS_BLOCKSIZE, depth); +#endif + curbufsize = last - (a + SS_BLOCKSIZE); + curbuf = a + SS_BLOCKSIZE; + if(curbufsize <= bufsize) { curbufsize = bufsize, curbuf = buf; } + for(b = a, k = SS_BLOCKSIZE, j = i; j & 1; b -= k, k <<= 1, j >>= 1) { + ss_swapmerge(T, PA, b - k, b, b + k, curbuf, curbufsize, depth); + } + } +#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE + ss_mintrosort(T, PA, a, middle, depth); +#elif 1 < SS_BLOCKSIZE + ss_insertionsort(T, PA, a, middle, depth); +#endif + for(k = SS_BLOCKSIZE; i != 0; k <<= 1, i >>= 1) { + if(i & 1) { + ss_swapmerge(T, PA, a - k, a, middle, buf, bufsize, depth); + a -= k; + } + } + if(limit != 0) { +#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE + ss_mintrosort(T, PA, middle, last, depth); +#elif 1 < SS_BLOCKSIZE + ss_insertionsort(T, PA, middle, last, depth); +#endif + ss_inplacemerge(T, PA, first, middle, last, depth); + } +#endif + + if(lastsuffix != 0) { + /* Insert last type B* suffix. */ + saidx_t PAi[2]; PAi[0] = PA[*(first - 1)], PAi[1] = n - 2; + for(a = first, i = *(first - 1); + (a < last) && ((*a < 0) || (0 < ss_compare(T, &(PAi[0]), PA + *a, depth))); + ++a) { + *(a - 1) = *a; + } + *(a - 1) = i; + } +} diff --git a/tools/Flips/libdivsufsort-2.0.1/lib/trsort.c b/tools/Flips/libdivsufsort-2.0.1/lib/trsort.c new file mode 100644 index 000000000..6fe3e67ba --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/lib/trsort.c @@ -0,0 +1,586 @@ +/* + * trsort.c for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "divsufsort_private.h" + + +/*- Private Functions -*/ + +static const saint_t lg_table[256]= { + -1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 +}; + +static INLINE +saint_t +tr_ilg(saidx_t n) { +#if defined(BUILD_DIVSUFSORT64) + return (n >> 32) ? + ((n >> 48) ? + ((n >> 56) ? + 56 + lg_table[(n >> 56) & 0xff] : + 48 + lg_table[(n >> 48) & 0xff]) : + ((n >> 40) ? + 40 + lg_table[(n >> 40) & 0xff] : + 32 + lg_table[(n >> 32) & 0xff])) : + ((n & 0xffff0000) ? + ((n & 0xff000000) ? + 24 + lg_table[(n >> 24) & 0xff] : + 16 + lg_table[(n >> 16) & 0xff]) : + ((n & 0x0000ff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff])); +#else + return (n & 0xffff0000) ? + ((n & 0xff000000) ? + 24 + lg_table[(n >> 24) & 0xff] : + 16 + lg_table[(n >> 16) & 0xff]) : + ((n & 0x0000ff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff]); +#endif +} + + +/*---------------------------------------------------------------------------*/ + +/* Simple insertionsort for small size groups. */ +static +void +tr_insertionsort(const saidx_t *ISAd, saidx_t *first, saidx_t *last) { + saidx_t *a, *b; + saidx_t t, r; + + for(a = first + 1; a < last; ++a) { + for(t = *a, b = a - 1; 0 > (r = ISAd[t] - ISAd[*b]);) { + do { *(b + 1) = *b; } while((first <= --b) && (*b < 0)); + if(b < first) { break; } + } + if(r == 0) { *b = ~*b; } + *(b + 1) = t; + } +} + + +/*---------------------------------------------------------------------------*/ + +static INLINE +void +tr_fixdown(const saidx_t *ISAd, saidx_t *SA, saidx_t i, saidx_t size) { + saidx_t j, k; + saidx_t v; + saidx_t c, d, e; + + for(v = SA[i], c = ISAd[v]; (j = 2 * i + 1) < size; SA[i] = SA[k], i = k) { + d = ISAd[SA[k = j++]]; + if(d < (e = ISAd[SA[j]])) { k = j; d = e; } + if(d <= c) { break; } + } + SA[i] = v; +} + +/* Simple top-down heapsort. */ +static +void +tr_heapsort(const saidx_t *ISAd, saidx_t *SA, saidx_t size) { + saidx_t i, m; + saidx_t t; + + m = size; + if((size % 2) == 0) { + m--; + if(ISAd[SA[m / 2]] < ISAd[SA[m]]) { SWAP(SA[m], SA[m / 2]); } + } + + for(i = m / 2 - 1; 0 <= i; --i) { tr_fixdown(ISAd, SA, i, m); } + if((size % 2) == 0) { SWAP(SA[0], SA[m]); tr_fixdown(ISAd, SA, 0, m); } + for(i = m - 1; 0 < i; --i) { + t = SA[0], SA[0] = SA[i]; + tr_fixdown(ISAd, SA, 0, i); + SA[i] = t; + } +} + + +/*---------------------------------------------------------------------------*/ + +/* Returns the median of three elements. */ +static INLINE +saidx_t * +tr_median3(const saidx_t *ISAd, saidx_t *v1, saidx_t *v2, saidx_t *v3) { + saidx_t *t; + if(ISAd[*v1] > ISAd[*v2]) { SWAP(v1, v2); } + if(ISAd[*v2] > ISAd[*v3]) { + if(ISAd[*v1] > ISAd[*v3]) { return v1; } + else { return v3; } + } + return v2; +} + +/* Returns the median of five elements. */ +static INLINE +saidx_t * +tr_median5(const saidx_t *ISAd, + saidx_t *v1, saidx_t *v2, saidx_t *v3, saidx_t *v4, saidx_t *v5) { + saidx_t *t; + if(ISAd[*v2] > ISAd[*v3]) { SWAP(v2, v3); } + if(ISAd[*v4] > ISAd[*v5]) { SWAP(v4, v5); } + if(ISAd[*v2] > ISAd[*v4]) { SWAP(v2, v4); SWAP(v3, v5); } + if(ISAd[*v1] > ISAd[*v3]) { SWAP(v1, v3); } + if(ISAd[*v1] > ISAd[*v4]) { SWAP(v1, v4); SWAP(v3, v5); } + if(ISAd[*v3] > ISAd[*v4]) { return v4; } + return v3; +} + +/* Returns the pivot element. */ +static INLINE +saidx_t * +tr_pivot(const saidx_t *ISAd, saidx_t *first, saidx_t *last) { + saidx_t *middle; + saidx_t t; + + t = last - first; + middle = first + t / 2; + + if(t <= 512) { + if(t <= 32) { + return tr_median3(ISAd, first, middle, last - 1); + } else { + t >>= 2; + return tr_median5(ISAd, first, first + t, middle, last - 1 - t, last - 1); + } + } + t >>= 3; + first = tr_median3(ISAd, first, first + t, first + (t << 1)); + middle = tr_median3(ISAd, middle - t, middle, middle + t); + last = tr_median3(ISAd, last - 1 - (t << 1), last - 1 - t, last - 1); + return tr_median3(ISAd, first, middle, last); +} + + +/*---------------------------------------------------------------------------*/ + +typedef struct _trbudget_t trbudget_t; +struct _trbudget_t { + saidx_t chance; + saidx_t remain; + saidx_t incval; + saidx_t count; +}; + +static INLINE +void +trbudget_init(trbudget_t *budget, saidx_t chance, saidx_t incval) { + budget->chance = chance; + budget->remain = budget->incval = incval; +} + +static INLINE +saint_t +trbudget_check(trbudget_t *budget, saidx_t size) { + if(size <= budget->remain) { budget->remain -= size; return 1; } + if(budget->chance == 0) { budget->count += size; return 0; } + budget->remain += budget->incval - size; + budget->chance -= 1; + return 1; +} + + +/*---------------------------------------------------------------------------*/ + +static INLINE +void +tr_partition(const saidx_t *ISAd, + saidx_t *first, saidx_t *middle, saidx_t *last, + saidx_t **pa, saidx_t **pb, saidx_t v) { + saidx_t *a, *b, *c, *d, *e, *f; + saidx_t t, s; + saidx_t x = 0; + + for(b = middle - 1; (++b < last) && ((x = ISAd[*b]) == v);) { } + if(((a = b) < last) && (x < v)) { + for(; (++b < last) && ((x = ISAd[*b]) <= v);) { + if(x == v) { SWAP(*b, *a); ++a; } + } + } + for(c = last; (b < --c) && ((x = ISAd[*c]) == v);) { } + if((b < (d = c)) && (x > v)) { + for(; (b < --c) && ((x = ISAd[*c]) >= v);) { + if(x == v) { SWAP(*c, *d); --d; } + } + } + for(; b < c;) { + SWAP(*b, *c); + for(; (++b < c) && ((x = ISAd[*b]) <= v);) { + if(x == v) { SWAP(*b, *a); ++a; } + } + for(; (b < --c) && ((x = ISAd[*c]) >= v);) { + if(x == v) { SWAP(*c, *d); --d; } + } + } + + if(a <= d) { + c = b - 1; + if((s = a - first) > (t = b - a)) { s = t; } + for(e = first, f = b - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } + if((s = d - c) > (t = last - d - 1)) { s = t; } + for(e = b, f = last - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } + first += (b - a), last -= (d - c); + } + *pa = first, *pb = last; +} + +static +void +tr_copy(saidx_t *ISA, const saidx_t *SA, + saidx_t *first, saidx_t *a, saidx_t *b, saidx_t *last, + saidx_t depth) { + /* sort suffixes of middle partition + by using sorted order of suffixes of left and right partition. */ + saidx_t *c, *d, *e; + saidx_t s, v; + + v = b - SA - 1; + for(c = first, d = a - 1; c <= d; ++c) { + if((0 <= (s = *c - depth)) && (ISA[s] == v)) { + *++d = s; + ISA[s] = d - SA; + } + } + for(c = last - 1, e = d + 1, d = b; e < d; --c) { + if((0 <= (s = *c - depth)) && (ISA[s] == v)) { + *--d = s; + ISA[s] = d - SA; + } + } +} + +static +void +tr_partialcopy(saidx_t *ISA, const saidx_t *SA, + saidx_t *first, saidx_t *a, saidx_t *b, saidx_t *last, + saidx_t depth) { + saidx_t *c, *d, *e; + saidx_t s, v; + saidx_t rank, lastrank, newrank = -1; + + v = b - SA - 1; + lastrank = -1; + for(c = first, d = a - 1; c <= d; ++c) { + if((0 <= (s = *c - depth)) && (ISA[s] == v)) { + *++d = s; + rank = ISA[s + depth]; + if(lastrank != rank) { lastrank = rank; newrank = d - SA; } + ISA[s] = newrank; + } + } + + lastrank = -1; + for(e = d; first <= e; --e) { + rank = ISA[*e]; + if(lastrank != rank) { lastrank = rank; newrank = e - SA; } + if(newrank != rank) { ISA[*e] = newrank; } + } + + lastrank = -1; + for(c = last - 1, e = d + 1, d = b; e < d; --c) { + if((0 <= (s = *c - depth)) && (ISA[s] == v)) { + *--d = s; + rank = ISA[s + depth]; + if(lastrank != rank) { lastrank = rank; newrank = d - SA; } + ISA[s] = newrank; + } + } +} + +static +void +tr_introsort(saidx_t *ISA, const saidx_t *ISAd, + saidx_t *SA, saidx_t *first, saidx_t *last, + trbudget_t *budget) { +#define STACK_SIZE TR_STACKSIZE + struct { const saidx_t *a; saidx_t *b, *c; saint_t d, e; }stack[STACK_SIZE]; + saidx_t *a, *b, *c; + saidx_t t; + saidx_t v, x = 0; + saidx_t incr = ISAd - ISA; + saint_t limit, next; + saint_t ssize, trlink = -1; + + for(ssize = 0, limit = tr_ilg(last - first);;) { + + if(limit < 0) { + if(limit == -1) { + /* tandem repeat partition */ + tr_partition(ISAd - incr, first, first, last, &a, &b, last - SA - 1); + + /* update ranks */ + if(a < last) { + for(c = first, v = a - SA - 1; c < a; ++c) { ISA[*c] = v; } + } + if(b < last) { + for(c = a, v = b - SA - 1; c < b; ++c) { ISA[*c] = v; } + } + + /* push */ + if(1 < (b - a)) { + STACK_PUSH5(NULL, a, b, 0, 0); + STACK_PUSH5(ISAd - incr, first, last, -2, trlink); + trlink = ssize - 2; + } + if((a - first) <= (last - b)) { + if(1 < (a - first)) { + STACK_PUSH5(ISAd, b, last, tr_ilg(last - b), trlink); + last = a, limit = tr_ilg(a - first); + } else if(1 < (last - b)) { + first = b, limit = tr_ilg(last - b); + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } else { + if(1 < (last - b)) { + STACK_PUSH5(ISAd, first, a, tr_ilg(a - first), trlink); + first = b, limit = tr_ilg(last - b); + } else if(1 < (a - first)) { + last = a, limit = tr_ilg(a - first); + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + } else if(limit == -2) { + /* tandem repeat copy */ + a = stack[--ssize].b, b = stack[ssize].c; + if(stack[ssize].d == 0) { + tr_copy(ISA, SA, first, a, b, last, ISAd - ISA); + } else { + if(0 <= trlink) { stack[trlink].d = -1; } + tr_partialcopy(ISA, SA, first, a, b, last, ISAd - ISA); + } + STACK_POP5(ISAd, first, last, limit, trlink); + } else { + /* sorted partition */ + if(0 <= *first) { + a = first; + do { ISA[*a] = a - SA; } while((++a < last) && (0 <= *a)); + first = a; + } + if(first < last) { + a = first; do { *a = ~*a; } while(*++a < 0); + next = (ISA[*a] != ISAd[*a]) ? tr_ilg(a - first + 1) : -1; + if(++a < last) { for(b = first, v = a - SA - 1; b < a; ++b) { ISA[*b] = v; } } + + /* push */ + if(trbudget_check(budget, a - first)) { + if((a - first) <= (last - a)) { + STACK_PUSH5(ISAd, a, last, -3, trlink); + ISAd += incr, last = a, limit = next; + } else { + if(1 < (last - a)) { + STACK_PUSH5(ISAd + incr, first, a, next, trlink); + first = a, limit = -3; + } else { + ISAd += incr, last = a, limit = next; + } + } + } else { + if(0 <= trlink) { stack[trlink].d = -1; } + if(1 < (last - a)) { + first = a, limit = -3; + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + continue; + } + + if((last - first) <= TR_INSERTIONSORT_THRESHOLD) { + tr_insertionsort(ISAd, first, last); + limit = -3; + continue; + } + + if(limit-- == 0) { + tr_heapsort(ISAd, first, last - first); + for(a = last - 1; first < a; a = b) { + for(x = ISAd[*a], b = a - 1; (first <= b) && (ISAd[*b] == x); --b) { *b = ~*b; } + } + limit = -3; + continue; + } + + /* choose pivot */ + a = tr_pivot(ISAd, first, last); + SWAP(*first, *a); + v = ISAd[*first]; + + /* partition */ + tr_partition(ISAd, first, first + 1, last, &a, &b, v); + if((last - first) != (b - a)) { + next = (ISA[*a] != v) ? tr_ilg(b - a) : -1; + + /* update ranks */ + for(c = first, v = a - SA - 1; c < a; ++c) { ISA[*c] = v; } + if(b < last) { for(c = a, v = b - SA - 1; c < b; ++c) { ISA[*c] = v; } } + + /* push */ + if((1 < (b - a)) && (trbudget_check(budget, b - a))) { + if((a - first) <= (last - b)) { + if((last - b) <= (b - a)) { + if(1 < (a - first)) { + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + STACK_PUSH5(ISAd, b, last, limit, trlink); + last = a; + } else if(1 < (last - b)) { + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + first = b; + } else { + ISAd += incr, first = a, last = b, limit = next; + } + } else if((a - first) <= (b - a)) { + if(1 < (a - first)) { + STACK_PUSH5(ISAd, b, last, limit, trlink); + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + last = a; + } else { + STACK_PUSH5(ISAd, b, last, limit, trlink); + ISAd += incr, first = a, last = b, limit = next; + } + } else { + STACK_PUSH5(ISAd, b, last, limit, trlink); + STACK_PUSH5(ISAd, first, a, limit, trlink); + ISAd += incr, first = a, last = b, limit = next; + } + } else { + if((a - first) <= (b - a)) { + if(1 < (last - b)) { + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + STACK_PUSH5(ISAd, first, a, limit, trlink); + first = b; + } else if(1 < (a - first)) { + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + last = a; + } else { + ISAd += incr, first = a, last = b, limit = next; + } + } else if((last - b) <= (b - a)) { + if(1 < (last - b)) { + STACK_PUSH5(ISAd, first, a, limit, trlink); + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + first = b; + } else { + STACK_PUSH5(ISAd, first, a, limit, trlink); + ISAd += incr, first = a, last = b, limit = next; + } + } else { + STACK_PUSH5(ISAd, first, a, limit, trlink); + STACK_PUSH5(ISAd, b, last, limit, trlink); + ISAd += incr, first = a, last = b, limit = next; + } + } + } else { + if((1 < (b - a)) && (0 <= trlink)) { stack[trlink].d = -1; } + if((a - first) <= (last - b)) { + if(1 < (a - first)) { + STACK_PUSH5(ISAd, b, last, limit, trlink); + last = a; + } else if(1 < (last - b)) { + first = b; + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } else { + if(1 < (last - b)) { + STACK_PUSH5(ISAd, first, a, limit, trlink); + first = b; + } else if(1 < (a - first)) { + last = a; + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + } + } else { + if(trbudget_check(budget, last - first)) { + limit = tr_ilg(last - first), ISAd += incr; + } else { + if(0 <= trlink) { stack[trlink].d = -1; } + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + } +#undef STACK_SIZE +} + + + +/*---------------------------------------------------------------------------*/ + +/*- Function -*/ + +/* Tandem repeat sort */ +void +trsort(saidx_t *ISA, saidx_t *SA, saidx_t n, saidx_t depth) { + saidx_t *ISAd; + saidx_t *first, *last; + trbudget_t budget; + saidx_t t, skip, unsorted; + + trbudget_init(&budget, tr_ilg(n) * 2 / 3, n); +/* trbudget_init(&budget, tr_ilg(n) * 3 / 4, n); */ + for(ISAd = ISA + depth; -n < *SA; ISAd += ISAd - ISA) { + first = SA; + skip = 0; + unsorted = 0; + do { + if((t = *first) < 0) { first -= t; skip += t; } + else { + if(skip != 0) { *(first + skip) = skip; skip = 0; } + last = SA + ISA[t] + 1; + if(1 < (last - first)) { + budget.count = 0; + tr_introsort(ISA, ISAd, SA, first, last, &budget); + if(budget.count != 0) { unsorted += budget.count; } + else { skip = first - last; } + } else if((last - first) == 1) { + skip = -1; + } + first = last; + } + } while(first < (SA + n)); + if(skip != 0) { *(first + skip) = skip; } + if(unsorted == 0) { break; } + } +} diff --git a/tools/Flips/libdivsufsort-2.0.1/lib/utils.c b/tools/Flips/libdivsufsort-2.0.1/lib/utils.c new file mode 100644 index 000000000..90fb23efa --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/lib/utils.c @@ -0,0 +1,381 @@ +/* + * utils.c for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "divsufsort_private.h" + + +/*- Private Function -*/ + +/* Binary search for inverse bwt. */ +static +saidx_t +binarysearch_lower(const saidx_t *A, saidx_t size, saidx_t value) { + saidx_t half, i; + for(i = 0, half = size >> 1; + 0 < size; + size = half, half >>= 1) { + if(A[i + half] < value) { + i += half + 1; + half -= (size & 1) ^ 1; + } + } + return i; +} + + +/*- Functions -*/ + +/* Burrows-Wheeler transform. */ +saint_t +bw_transform(const sauchar_t *T, sauchar_t *U, saidx_t *SA, + saidx_t n, saidx_t *idx) { + saidx_t *A, i, j, p, t; + saint_t c; + + /* Check arguments. */ + if((T == NULL) || (U == NULL) || (n < 0) || (idx == NULL)) { return -1; } + if(n <= 1) { + if(n == 1) { U[0] = T[0]; } + *idx = n; + return 0; + } + + if((A = SA) == NULL) { + i = divbwt(T, U, NULL, n); + if(0 <= i) { *idx = i; i = 0; } + return (saint_t)i; + } + + /* BW transform. */ + if(T == U) { + t = n; + for(i = 0, j = 0; i < n; ++i) { + p = t - 1; + t = A[i]; + if(0 <= p) { + c = T[j]; + U[j] = (j <= p) ? T[p] : (sauchar_t)A[p]; + A[j] = c; + j++; + } else { + *idx = i; + } + } + p = t - 1; + if(0 <= p) { + c = T[j]; + U[j] = (j <= p) ? T[p] : (sauchar_t)A[p]; + A[j] = c; + } else { + *idx = i; + } + } else { + U[0] = T[n - 1]; + for(i = 0; A[i] != 0; ++i) { U[i + 1] = T[A[i] - 1]; } + *idx = i + 1; + for(++i; i < n; ++i) { U[i] = T[A[i] - 1]; } + } + + if(SA == NULL) { + /* Deallocate memory. */ + free(A); + } + + return 0; +} + +/* Inverse Burrows-Wheeler transform. */ +saint_t +inverse_bw_transform(const sauchar_t *T, sauchar_t *U, saidx_t *A, + saidx_t n, saidx_t idx) { + saidx_t C[ALPHABET_SIZE]; + sauchar_t D[ALPHABET_SIZE]; + saidx_t *B; + saidx_t i, p; + saint_t c, d; + + /* Check arguments. */ + if((T == NULL) || (U == NULL) || (n < 0) || (idx < 0) || + (n < idx) || ((0 < n) && (idx == 0))) { + return -1; + } + if(n <= 1) { return 0; } + + if((B = A) == NULL) { + /* Allocate n*sizeof(saidx_t) bytes of memory. */ + if((B = (saidx_t *)malloc((size_t)n * sizeof(saidx_t))) == NULL) { return -2; } + } + + /* Inverse BW transform. */ + for(c = 0; c < ALPHABET_SIZE; ++c) { C[c] = 0; } + for(i = 0; i < n; ++i) { ++C[T[i]]; } + for(c = 0, d = 0, i = 0; c < ALPHABET_SIZE; ++c) { + p = C[c]; + if(0 < p) { + C[c] = i; + D[d++] = (sauchar_t)c; + i += p; + } + } + for(i = 0; i < idx; ++i) { B[C[T[i]]++] = i; } + for( ; i < n; ++i) { B[C[T[i]]++] = i + 1; } + for(c = 0; c < d; ++c) { C[c] = C[D[c]]; } + for(i = 0, p = idx; i < n; ++i) { + U[i] = D[binarysearch_lower(C, d, p)]; + p = B[p - 1]; + } + + if(A == NULL) { + /* Deallocate memory. */ + free(B); + } + + return 0; +} + +/* Checks the suffix array SA of the string T. */ +saint_t +sufcheck(const sauchar_t *T, const saidx_t *SA, + saidx_t n, saint_t verbose) { + saidx_t C[ALPHABET_SIZE]; + saidx_t i, p, q, t; + saint_t c; + + if(verbose) { fprintf(stderr, "sufcheck: "); } + + /* Check arguments. */ + if((T == NULL) || (SA == NULL) || (n < 0)) { + if(verbose) { fprintf(stderr, "Invalid arguments.\n"); } + return -1; + } + if(n == 0) { + if(verbose) { fprintf(stderr, "Done.\n"); } + return 0; + } + + /* check range: [0..n-1] */ + for(i = 0; i < n; ++i) { + if((SA[i] < 0) || (n <= SA[i])) { + if(verbose) { + fprintf(stderr, "Out of the range [0,%" PRIdSAIDX_T "].\n" + " SA[%" PRIdSAIDX_T "]=%" PRIdSAIDX_T "\n", + n - 1, i, SA[i]); + } + return -2; + } + } + + /* check first characters. */ + for(i = 1; i < n; ++i) { + if(T[SA[i - 1]] > T[SA[i]]) { + if(verbose) { + fprintf(stderr, "Suffixes in wrong order.\n" + " T[SA[%" PRIdSAIDX_T "]=%" PRIdSAIDX_T "]=%d" + " > T[SA[%" PRIdSAIDX_T "]=%" PRIdSAIDX_T "]=%d\n", + i - 1, SA[i - 1], T[SA[i - 1]], i, SA[i], T[SA[i]]); + } + return -3; + } + } + + /* check suffixes. */ + for(i = 0; i < ALPHABET_SIZE; ++i) { C[i] = 0; } + for(i = 0; i < n; ++i) { ++C[T[i]]; } + for(i = 0, p = 0; i < ALPHABET_SIZE; ++i) { + t = C[i]; + C[i] = p; + p += t; + } + + q = C[T[n - 1]]; + C[T[n - 1]] += 1; + for(i = 0; i < n; ++i) { + p = SA[i]; + if(0 < p) { + c = T[--p]; + t = C[c]; + } else { + c = T[p = n - 1]; + t = q; + } + if((t < 0) || (p != SA[t])) { + if(verbose) { + fprintf(stderr, "Suffix in wrong position.\n" + " SA[%" PRIdSAIDX_T "]=%" PRIdSAIDX_T " or\n" + " SA[%" PRIdSAIDX_T "]=%" PRIdSAIDX_T "\n", + t, (0 <= t) ? SA[t] : -1, i, SA[i]); + } + return -4; + } + if(t != q) { + ++C[c]; + if((n <= C[c]) || (T[SA[C[c]]] != c)) { C[c] = -1; } + } + } + + if(1 <= verbose) { fprintf(stderr, "Done.\n"); } + return 0; +} + + +static +int +_compare(const sauchar_t *T, saidx_t Tsize, + const sauchar_t *P, saidx_t Psize, + saidx_t suf, saidx_t *match) { + saidx_t i, j; + saint_t r; + for(i = suf + *match, j = *match, r = 0; + (i < Tsize) && (j < Psize) && ((r = T[i] - P[j]) == 0); ++i, ++j) { } + *match = j; + return (r == 0) ? -(j != Psize) : r; +} + +/* Search for the pattern P in the string T. */ +saidx_t +sa_search(const sauchar_t *T, saidx_t Tsize, + const sauchar_t *P, saidx_t Psize, + const saidx_t *SA, saidx_t SAsize, + saidx_t *idx) { + saidx_t size, lsize, rsize, half; + saidx_t match, lmatch, rmatch; + saidx_t llmatch, lrmatch, rlmatch, rrmatch; + saidx_t i, j, k; + saint_t r; + + if(idx != NULL) { *idx = -1; } + if((T == NULL) || (P == NULL) || (SA == NULL) || + (Tsize < 0) || (Psize < 0) || (SAsize < 0)) { return -1; } + if((Tsize == 0) || (SAsize == 0)) { return 0; } + if(Psize == 0) { if(idx != NULL) { *idx = 0; } return SAsize; } + + for(i = j = k = 0, lmatch = rmatch = 0, size = SAsize, half = size >> 1; + 0 < size; + size = half, half >>= 1) { + match = MIN(lmatch, rmatch); + r = _compare(T, Tsize, P, Psize, SA[i + half], &match); + if(r < 0) { + i += half + 1; + half -= (size & 1) ^ 1; + lmatch = match; + } else if(r > 0) { + rmatch = match; + } else { + lsize = half, j = i, rsize = size - half - 1, k = i + half + 1; + + /* left part */ + for(llmatch = lmatch, lrmatch = match, half = lsize >> 1; + 0 < lsize; + lsize = half, half >>= 1) { + lmatch = MIN(llmatch, lrmatch); + r = _compare(T, Tsize, P, Psize, SA[j + half], &lmatch); + if(r < 0) { + j += half + 1; + half -= (lsize & 1) ^ 1; + llmatch = lmatch; + } else { + lrmatch = lmatch; + } + } + + /* right part */ + for(rlmatch = match, rrmatch = rmatch, half = rsize >> 1; + 0 < rsize; + rsize = half, half >>= 1) { + rmatch = MIN(rlmatch, rrmatch); + r = _compare(T, Tsize, P, Psize, SA[k + half], &rmatch); + if(r <= 0) { + k += half + 1; + half -= (rsize & 1) ^ 1; + rlmatch = rmatch; + } else { + rrmatch = rmatch; + } + } + + break; + } + } + + if(idx != NULL) { *idx = (0 < (k - j)) ? j : i; } + return k - j; +} + +/* Search for the character c in the string T. */ +saidx_t +sa_simplesearch(const sauchar_t *T, saidx_t Tsize, + const saidx_t *SA, saidx_t SAsize, + saint_t c, saidx_t *idx) { + saidx_t size, lsize, rsize, half; + saidx_t i, j, k, p; + saint_t r; + + if(idx != NULL) { *idx = -1; } + if((T == NULL) || (SA == NULL) || (Tsize < 0) || (SAsize < 0)) { return -1; } + if((Tsize == 0) || (SAsize == 0)) { return 0; } + + for(i = j = k = 0, size = SAsize, half = size >> 1; + 0 < size; + size = half, half >>= 1) { + p = SA[i + half]; + r = (p < Tsize) ? T[p] - c : -1; + if(r < 0) { + i += half + 1; + half -= (size & 1) ^ 1; + } else if(r == 0) { + lsize = half, j = i, rsize = size - half - 1, k = i + half + 1; + + /* left part */ + for(half = lsize >> 1; + 0 < lsize; + lsize = half, half >>= 1) { + p = SA[j + half]; + r = (p < Tsize) ? T[p] - c : -1; + if(r < 0) { + j += half + 1; + half -= (lsize & 1) ^ 1; + } + } + + /* right part */ + for(half = rsize >> 1; + 0 < rsize; + rsize = half, half >>= 1) { + p = SA[k + half]; + r = (p < Tsize) ? T[p] - c : -1; + if(r <= 0) { + k += half + 1; + half -= (rsize & 1) ^ 1; + } + } + + break; + } + } + + if(idx != NULL) { *idx = (0 < (k - j)) ? j : i; } + return k - j; +} diff --git a/tools/Flips/libdivsufsort-2.0.1/m4/libtool.m4 b/tools/Flips/libdivsufsort-2.0.1/m4/libtool.m4 new file mode 100644 index 000000000..a3fee5360 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/m4/libtool.m4 @@ -0,0 +1,7377 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +]) + +# serial 56 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +m4_defun([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl +_LT_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from `configure', and `config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# `config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain="$ac_aux_dir/ltmain.sh" +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the `libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to `config.status' so that its +# declaration there will have the same value as in `configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags="_LT_TAGS"dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into `config.status', and then the shell code to quote escape them in +# for loops in `config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Fix-up fallback echo if it was mangled by the above quoting rules. +case \$lt_ECHO in +*'\\\[$]0 --fallback-echo"')dnl " + lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` + ;; +esac + +_LT_OUTPUT_LIBTOOL_INIT +]) + + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +cat >"$CONFIG_LT" <<_LTEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate a libtool stub with the current configuration. + +lt_cl_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AS_SHELL_SANITIZE +_AS_PREPARE + +exec AS_MESSAGE_FD>&1 +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +\`$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2008 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test $[#] != 0 +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try \`$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try \`$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +if test "$no_create" != yes; then + lt_cl_success=: + test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" + exec AS_MESSAGE_LOG_FD>/dev/null + $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false + exec AS_MESSAGE_LOG_FD>>config.log + $lt_cl_success || AS_EXIT(1) +fi +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +_LT_COPYING +_LT_LIBTOOL_TAGS + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_XSI_SHELLFNS + + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES +# -------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=echo + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + m4_if([$1], [CXX], +[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX +# ----------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\(.*\)$/\1/ + p + } + }' +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` +fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_SHELL_INIT + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[_LT_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$lt_ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +ECHO=${lt_ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then + # Yippee, $ECHO works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<_LT_EOF +[$]* +_LT_EOF + exit 0 +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test -z "$lt_ECHO"; then + if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if { echo_test_string=`eval $cmd`; } 2>/dev/null && + { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null + then + break + fi + done + fi + + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : + else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$ECHO" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + ECHO='print -r' + elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + ECHO='printf %s\n' + if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && + echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + ECHO="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + ECHO="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + ECHO=echo + fi + fi + fi + fi + fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +lt_ECHO=$ECHO +if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(lt_ECHO) +]) +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], + [An echo program that does not interpret backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" +])# _LT_ENABLE_LOCK + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[AC_CHECK_TOOL(AR, ar, false) +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1]) + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test x"[$]$2" = xyes; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ + = "XX$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line __oline__ "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links="nottested" +if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", + [Define to the sub-directory in which libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || + test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` + else + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[123]]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +interix[[3-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # Some binutils ld are patched to set DT_RUNPATH + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], + [Run-time system search path for libraries]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program which can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program which can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method == "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi]) +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) + AC_SUBST([DUMPBIN]) + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC*) + # IBM XL 8.0 on PPC + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + pgcc* | pgf77* | pgf90* | pgf95*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Sun\ F*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac +AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + ;; + linux* | k*bsd*-gnu) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag= + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + _LT_TAGVAR(link_all_deplibs, $1)=no + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE(int foo(void) {}, + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + ) + LDFLAGS="$save_LDFLAGS" + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], + [[If ld is used when linking, flag to hardcode $libdir into a binary + during linking. This must work even if $libdir does not exist]]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting ${shlibpath_var} if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [fix_srcfile_path], [1], + [Fix the shell variable $srcfile for the compiler]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report which library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC="$lt_save_CC" +])# _LT_LANG_C_CONFIG + + +# _LT_PROG_CXX +# ------------ +# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ +# compiler, we have our own version here. +m4_defun([_LT_PROG_CXX], +[ +pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) +AC_PROG_CXX +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_CXX + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_CXX], []) + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[AC_REQUIRE([_LT_PROG_CXX])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd[[12]]*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + gnu*) + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + *) + if test "$GXX" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 will use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + xl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=echo + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='echo' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + + _LT_TAGVAR(GCC, $1)="$GXX" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +]) +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)="$p" + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)="$p" + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_PROG_F77 +# ------------ +# Since AC_PROG_F77 is broken, in that it returns the empty string +# if there is no fortran compiler, we have our own version here. +m4_defun([_LT_PROG_F77], +[ +pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) +AC_PROG_F77 +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_F77 + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_F77], []) + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_REQUIRE([_LT_PROG_F77])dnl +AC_LANG_PUSH(Fortran 77) + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_F77" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + CC=${F77-"f77"} + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$G77" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" +fi # test "$_lt_disable_F77" != yes + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_PROG_FC +# ----------- +# Since AC_PROG_FC is broken, in that it returns the empty string +# if there is no fortran compiler, we have our own version here. +m4_defun([_LT_PROG_FC], +[ +pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) +AC_PROG_FC +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi +popdef([AC_MSG_ERROR]) +])# _LT_PROG_FC + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([_LT_PROG_FC], []) + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_REQUIRE([_LT_PROG_FC])dnl +AC_LANG_PUSH(Fortran) + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_FC" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + CC=${FC-"f95"} + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" +fi # test "$_lt_disable_FC" != yes + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC="$lt_save_CC" +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC="$lt_save_CC" +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +AC_MSG_RESULT([$xsi_shell]) +_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) + +AC_MSG_CHECKING([whether the shell understands "+="]) +lt_shell_append=no +( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +AC_MSG_RESULT([$lt_shell_append]) +_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PROG_XSI_SHELLFNS +# --------------------- +# Bourne and XSI compatible variants of some useful shell functions. +m4_defun([_LT_PROG_XSI_SHELLFNS], +[case $xsi_shell in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac +} + +# func_basename file +func_basename () +{ + func_basename_result="${1##*/}" +} + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}" +} + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +func_stripname () +{ + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"} +} + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=${1%%=*} + func_opt_split_arg=${1#*=} +} + +# func_lo2o object +func_lo2o () +{ + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=${1%.*}.lo +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=$(( $[*] )) +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=${#1} +} + +_LT_EOF + ;; + *) # Bourne compatible functions. + cat << \_LT_EOF >> "$cfgfile" + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` +} + +dnl func_dirname_and_basename +dnl A portable version of this function is already defined in general.m4sh +dnl so there is no need for it here. + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "X${3}" \ + | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; + esac +} + +# sed scripts: +my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' +my_sed_long_arg='1s/^-[[^=]]*=//' + +# func_opt_split +func_opt_split () +{ + func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` + func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` +} + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` +} + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` +} + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "$[@]"` +} + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` +} + +_LT_EOF +esac + +case $lt_shell_append in + yes) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$[1]+=\$[2]" +} +_LT_EOF + ;; + *) + cat << \_LT_EOF >> "$cfgfile" + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "$[1]=\$$[1]\$[2]" +} + +_LT_EOF + ;; + esac +]) diff --git a/tools/Flips/libdivsufsort-2.0.1/m4/ltoptions.m4 b/tools/Flips/libdivsufsort-2.0.1/m4/ltoptions.m4 new file mode 100644 index 000000000..34151a3ba --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/m4/ltoptions.m4 @@ -0,0 +1,368 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option `$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl `shared' nor `disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [0], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the `shared' and +# `disable-shared' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the `static' and +# `disable-static' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the `fast-install' +# and `disable-fast-install' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the `pic-only' and `no-pic' +# LT_INIT options. +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) + +test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/tools/Flips/libdivsufsort-2.0.1/m4/ltsugar.m4 b/tools/Flips/libdivsufsort-2.0.1/m4/ltsugar.m4 new file mode 100644 index 000000000..9000a057d --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/m4/ltsugar.m4 @@ -0,0 +1,123 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59 which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff --git a/tools/Flips/libdivsufsort-2.0.1/m4/ltversion.m4 b/tools/Flips/libdivsufsort-2.0.1/m4/ltversion.m4 new file mode 100644 index 000000000..f3c530980 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/m4/ltversion.m4 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# Generated from ltversion.in. + +# serial 3017 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.2.6b]) +m4_define([LT_PACKAGE_REVISION], [1.3017]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.2.6b' +macro_revision='1.3017' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff --git a/tools/Flips/libdivsufsort-2.0.1/m4/lt~obsolete.m4 b/tools/Flips/libdivsufsort-2.0.1/m4/lt~obsolete.m4 new file mode 100644 index 000000000..637bb2066 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/m4/lt~obsolete.m4 @@ -0,0 +1,92 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 4 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) diff --git a/tools/Flips/libdivsufsort-2.0.1/pkgconfig/libdivsufsort.pc.cmake b/tools/Flips/libdivsufsort-2.0.1/pkgconfig/libdivsufsort.pc.cmake new file mode 100644 index 000000000..84f2272a4 --- /dev/null +++ b/tools/Flips/libdivsufsort-2.0.1/pkgconfig/libdivsufsort.pc.cmake @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: @PROJECT_NAME@@W64BIT@ +Description: @PROJECT_DESCRIPTION@ +Version: @PROJECT_VERSION_FULL@ +URL: @PROJECT_URL@ +Libs: -L${libdir} -ldivsufsort@W64BIT@ +Cflags: -I${includedir} diff --git a/tools/Flips/libips.cpp b/tools/Flips/libips.cpp new file mode 100644 index 000000000..56e7e9067 --- /dev/null +++ b/tools/Flips/libips.cpp @@ -0,0 +1,424 @@ +//Module name: libips +//Author: Alcaro +//Date: July 11, 2013 +//Licence: GPL v3.0 or higher + +#ifndef __cplusplus +#include //bool; if this does not exist, remove it and uncomment the following three lines. +//#define bool int +//#define true 1 +//#define false 0 +#endif +#include //malloc, realloc, free +#include //memcpy, memset + +#include "libips.h" + +typedef unsigned char byte; + +#define min(a, b) ((a)<(b) ? (a) : (b)) +#define max(a, b) ((a)>(b) ? (a) : (b)) +#define clamp(a, b, c) max(a, min(b, c)) + +struct ipsstudy { + enum ipserror error; + unsigned int outlen_min; + unsigned int outlen_max; + unsigned int outlen_min_mem; +}; + +enum ipserror ips_study(struct mem patch, struct ipsstudy * study) +{ + study->error = ips_invalid; + if (patch.len < 8) return ips_invalid; + const unsigned char * patchat = patch.ptr; + const unsigned char * patchend = patchat + patch.len; +#define read8() ((patchat < patchend) ? (*patchat++) : 0) +#define read16() ((patchat+1 < patchend) ? (patchat += 2,( (patchat[-2] << 8) | patchat[-1])) : 0) +#define read24() ((patchat+2 < patchend) ? (patchat += 3,((patchat[-3] << 16) | (patchat[-2] << 8) | patchat[-1])) : 0) + if (read8() != 'P' || + read8() != 'A' || + read8() != 'T' || + read8() != 'C' || + read8() != 'H') + { + return ips_invalid; + } + + unsigned int offset = read24(); + unsigned int outlen = 0; + unsigned int thisout = 0; + //unsigned int lastoffset = 0; + bool w_scrambled = false; + while (offset != 0x454F46) // 454F46=EOF + { + unsigned int size = read16(); + if (size == 0) + { + size = read16(); + if (!size) return ips_invalid; // don't know what this means (65536 bytes? something else?), + thisout = offset + size; // better reject it until I find out + read8(); + } + else + { + thisout = offset + size; + patchat += size; + } + //turns out this messes up manually created patches. https://github.com/Alcaro/Flips/issues/13 + //if (offset < lastoffset) w_scrambled = true; + //lastoffset = offset; + if (thisout > outlen) outlen = thisout; + if (patchat >= patchend) return ips_invalid; + offset = read24(); + } + study->outlen_min_mem = outlen; + study->outlen_max = 0xFFFFFFFF; + if (patchat+3 == patchend) + { + unsigned int truncate = read24(); + study->outlen_max = truncate; + if (outlen > truncate) + { + outlen = truncate; + w_scrambled = true; + } + } + if (patchat != patchend) return ips_invalid; + study->outlen_min = outlen; +#undef read8 +#undef read16 +#undef read24 + study->error = ips_ok; + if (w_scrambled) study->error = ips_scrambled; + return study->error; +} + +enum ipserror ips_apply_study(struct mem patch, struct ipsstudy * study, struct mem in, struct mem * out) +{ + out->ptr = NULL; + out->len = 0; + if (study->error == ips_invalid) return study->error; +#define read8() (*patchat++)//guaranteed to not overflow at this point, we already checked the patch +#define read16() (patchat += 2,( (patchat[-2] << 8) | patchat[-1])) +#define read24() (patchat += 3,((patchat[-3] << 16) | (patchat[-2] << 8) | patchat[-1])) + unsigned int outlen = clamp(study->outlen_min, in.len, study->outlen_max); + out->ptr = (byte*)malloc(max(outlen, study->outlen_min_mem)); + out->len = outlen; + + bool anychanges = false; + if (outlen != in.len) anychanges = true; + + if (out->len > in.len) + { + memcpy(out->ptr, in.ptr, in.len); + memset(out->ptr + in.len, 0, out->len - in.len); + } + else memcpy(out->ptr, in.ptr, outlen); + + const unsigned char * patchat = patch.ptr+5; + unsigned int offset = read24(); + while (offset != 0x454F46) + { + unsigned int size = read16(); + if (size == 0) + { + size = read16(); + //if (!size) return ips_invalid; // rejected in ips_study + unsigned char b = read8(); + + if (!anychanges && size && (out->ptr[offset] != b || memcmp(out->ptr + offset, out->ptr + offset, size - 1))) + anychanges = true; + + memset(out->ptr + offset, b, size); + } + else + { + if (!anychanges && memcmp(out->ptr + offset, patchat, size)) + anychanges = true; + + memcpy(out->ptr + offset, patchat, size); + patchat += size; + } + offset = read24(); + } +#undef read8 +#undef read16 +#undef read24 + + //truncate data without this being needed is a poor idea + if (study->outlen_max != 0xFFFFFFFF && in.len <= study->outlen_max) + study->error = ips_notthis; + + if (!anychanges) + study->error = ips_thisout; + return study->error; +} + +enum ipserror ips_apply(struct mem patch, struct mem in, struct mem * out) +{ + struct ipsstudy study; + ips_study(patch, &study); + return ips_apply_study(patch, &study, in, out); +} + +//Known situations where this function does not generate an optimal patch: +//In: 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 +//Out: FF FF FF FF FF FF FF FF 00 01 02 03 04 05 06 07 FF FF FF FF FF FF FF FF +//IPS: [ RLE ] [ Copy ] [ RLE ] +//Possible improvement: RLE across the entire file, copy on top of that. +//Rationale: It would be a huge pain to create such a multi-pass tool if it should support writing a byte +// more than twice, and I don't like half-assing stuff. It's also unlikely to apply to anything. + + +//Known improvements over LIPS: +//In: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F +//Out: FF 01 02 03 04 05 FF FF FF FF FF FF FF FF FF FF +//LIPS:[ Copy ] [ RLE ] +//Mine:[] [ Unchanged ] [ RLE ] +//Rationale: While LIPS can break early if it finds something RLEable in the middle of a block, it's not +// smart enough to back off if there's something unchanged between the changed area and the RLEable spot. + +//In: FF FF FF FF FF FF FF +//Out: 00 00 00 00 01 02 03 +//LIPS:[ RLE ] [ Copy ] +//Mine:[ Copy ] +//Rationale: Mistuned heuristics in LIPS. + +//It is also known that I win in some other situations. I didn't bother checking which, though. + +//There are no known cases where LIPS wins over libips. + +enum ipserror ips_create(struct mem sourcemem, struct mem targetmem, struct mem * patchmem) +{ + unsigned int sourcelen = sourcemem.len; + unsigned int targetlen = targetmem.len; + const unsigned char * source = sourcemem.ptr; + const unsigned char * target = targetmem.ptr; + + patchmem->ptr = NULL; + patchmem->len = 0; + + if (targetlen > 16777216) return ips_16MB; + if (targetlen >= 16777216 && sourcelen > targetlen) return ips_16MB; // can't truncate to exactly 16MB + + unsigned int offset = 0; + unsigned int outbuflen = 4096; + unsigned char * out = (byte*)malloc(outbuflen); + unsigned int outlen = 0; +#define write8(val) do { \ + out[outlen++] = (val); \ + if (outlen == outbuflen) { outbuflen *= 2; out = (byte*)realloc(out, outbuflen); } \ + } while(0) +#define write16(val) do { write8((val) >> 8); write8((val)); } while(0) +#define write24(val) do { write8((val) >> 16); write8((val) >> 8); write8((val)); } while(0) + write8('P'); + write8('A'); + write8('T'); + write8('C'); + write8('H'); + int lastknownchange = 0; + //int forcewrite = (targetlen > sourcelen ? 1 : 0); + while (offset < targetlen) + { + while (offset < sourcelen && (offset < sourcelen ? source[offset] : 0) == target[offset]) + offset++; + //check how much we need to edit until it starts getting similar + int thislen = 0; + int consecutiveunchanged = 0; + thislen = lastknownchange - offset; + if (thislen < 0) thislen = 0; + while (true) + { + unsigned int thisbyte = offset + thislen + consecutiveunchanged; + if (thisbyte < sourcelen && (thisbyte < sourcelen ? source[thisbyte] : 0) == target[thisbyte]) + { + consecutiveunchanged++; + } + else + { + thislen += consecutiveunchanged + 1; + consecutiveunchanged = 0; + } + if (consecutiveunchanged >= 6 || thislen >= 65536) break; + } + + //avoid premature EOF + if (offset == 0x454F46) + { + offset--; + thislen++; + } + + lastknownchange = offset + thislen; + if (thislen > 65535) thislen = 65535; + if (offset + thislen > targetlen) thislen = targetlen - offset; + if (offset == targetlen) continue; + + //check if RLE here is worthwhile + int byteshere; + for (byteshere=0; byteshere= targetlen || target[pos] != thisbyte || byteshere + i > 65535) + break; + if (pos >= sourcelen || (pos < sourcelen ? source[pos] : 0) != thisbyte) + { + byteshere += i; + thislen += i; + i = 0; + } + i++; + } + } + if ((byteshere > 8-5 && byteshere == thislen) || byteshere > 8) + { + write24(offset); + write16(0); + write16(byteshere); + write8(target[offset]); + offset += byteshere; + } + else + { + //check if we'd gain anything from ending the block early and switching to RLE + int byteshere = 0; + int stopat = 0; + while (stopat + byteshere < thislen) + { + if (target[offset + stopat] == target[offset + stopat + byteshere]) + { + byteshere++; + } + else + { + stopat += byteshere; + byteshere = 0; + } + if (byteshere > 8+5 || //rle-worthy despite two ips headers + (byteshere > 8 && stopat + byteshere == thislen) || //rle-worthy at end of data + (byteshere > 8 && !memcmp(&target[offset +stopat + byteshere], //rle-worthy before another rle-worthy + &target[offset +stopat + byteshere + 1], + 9-1))) + { + if (stopat) thislen = stopat; + break; //we don't scan the entire block if we know we'll want to RLE, that'd gain nothing. + } + } + //don't write unchanged bytes at the end of a block if we want to RLE the next couple of bytes + if (offset + thislen != targetlen) + { + while (offset + thislen - 1 < sourcelen && + target[offset + thislen - 1] == (offset + thislen - 1 < sourcelen ? source[offset + thislen - 1] : 0)) + { + thislen--; + } + } + + if (thislen > 3 && !memcmp(&target[offset], &target[offset + 1], thislen - 1)) //still worth it? + { + write24(offset); + write16(0); + write16(thislen); + write8(target[offset]); + } + else + { + write24(offset); + write16(thislen); + int i; + for (i=0; i targetlen) write24(targetlen); +#undef write + patchmem->ptr = out; + patchmem->len = outlen; + if (outlen == 8) + return ips_identical; + return ips_ok; +} + +void ips_free(struct mem mem) +{ + free(mem.ptr); +} + +#if 0 +#warning Disable this in release versions. +#include + +//Congratulations, you found the undocumented feature! I don't think it's useful for anything except debugging libips, though. +void ips_dump(struct mem patch) +{ + if (patch.len < 8) + { + puts("Invalid"); + return; + } + const unsigned char * patchat = patch.ptr; + const unsigned char * patchend = patchat + patch.len; +#define read8() ((patchat < patchend) ? (*patchat++) : 0) +#define read16() ((patchat+1 < patchend) ? (patchat += 2, ( (patchat[-2] << 8) | patchat[-1])) : 0) +#define read24() ((patchat+2 < patchend) ? (patchat += 3, ((patchat[-3] << 16) | (patchat[-2] << 8) | patchat[-1])) : 0) + if (read8() != 'P' || + read8() != 'A' || + read8() != 'T' || + read8() != 'C' || + read8() != 'H') + { + puts("Invalid"); + return; + } + int blockstart = patchat - patch.ptr; + int offset = read24(); + int outlen = 0; + int thisout = 0; + while (offset != 0x454F46) + { + int size = read16(); + if (size == 0) + { + int rlelen = read16(); + thisout = offset + rlelen; + printf("[%X] %X: %i (RLE)\n", blockstart, offset, rlelen); + read8(); + } + else + { + thisout = offset + size; + printf("[%X] %X: %i\n", blockstart, offset, size); + patchat += size; + } + if (thisout > outlen) outlen = thisout; + if (patchat >= patchend) + { + puts("Invalid"); + return; + } + blockstart = patchat - patch.ptr; + offset = read24(); + } + printf("Expand to 0x%X\n", outlen); + if (patchat + 3 == patchend) + { + int truncate = read24(); + printf("Truncate to 0x%X\n", truncate); + } + if (patchat != patchend) puts("Invalid"); +#undef read8 +#undef read16 +#undef read24 +} +#endif diff --git a/tools/Flips/libips.h b/tools/Flips/libips.h new file mode 100644 index 000000000..d6720d59d --- /dev/null +++ b/tools/Flips/libips.h @@ -0,0 +1,49 @@ +//Module name: libips +//Author: Alcaro +//Date: March 8, 2013 +//Licence: GPL v3.0 or higher + +#include "global.h" + +#ifdef __cplusplus +extern "C" { +#endif + +enum ipserror { + ips_ok,//Patch applied or created successfully. + + ips_notthis,//The patch is most likely not intended for this ROM. + ips_thisout,//You most likely applied the patch on the output ROM. + ips_scrambled,//The patch is technically valid, but seems scrambled or malformed. + ips_invalid,//The patch is invalid. + + ips_16MB,//One or both files is bigger than 16MB. The IPS format doesn't support that. The created + //patch contains only the differences to that point. + ips_identical,//The input buffers are identical. + + ips_shut_up_gcc//This one isn't used, it's just to kill a stray comma warning. +}; + +//Applies the IPS patch in [patch, patchlen] to [in, inlen] and stores it to [out, outlen]. Send the +// return value in out to ips_free when you're done with it. +enum ipserror ips_apply(struct mem patch, struct mem in, struct mem * out); + +//Creates an IPS patch that converts source to target and stores it to patch. +enum ipserror ips_create(struct mem source, struct mem target, struct mem * patch); + +//Frees the memory returned in the output parameters of the above. Do not call it twice on the same +// input, nor on anything you got from anywhere else. ips_free is guaranteed to be equivalent to +// calling stdlib.h's free() on mem.ptr. +void ips_free(struct mem mem); + +//ips_study allows you to detect most patching errors without applying it to a ROM, or even a ROM to +// apply it to. ips_apply calls ips_study and ips_apply_study, so if you call ips_study yourself, +// it's recommended to call ips_apply_study to not redo the calculation. ips_free is still +// required. +struct ipsstudy; +enum ipserror ips_study(struct mem patch, struct ipsstudy * study); +enum ipserror ips_apply_study(struct mem patch, struct ipsstudy * study, struct mem in, struct mem * out); + +#ifdef __cplusplus +} +#endif diff --git a/tools/Flips/libups.cpp b/tools/Flips/libups.cpp new file mode 100644 index 000000000..d63a908df --- /dev/null +++ b/tools/Flips/libups.cpp @@ -0,0 +1,182 @@ +//Module name: libups +//Author: Alcaro +//Date: April 4, 2013 +//Licence: GPL v3.0 or higher + +#include "libups.h" + +#ifndef __cplusplus +#include //bool; if this file does not exist (hi msvc), remove it and uncomment the following three lines. +//#define bool int +//#define true 1 +//#define false 0 +#endif +#include //uint8_t, uint32_t +#include //malloc, realloc, free +#include //memcpy, memset +#include "crc32.h" + +static uint32_t read32(uint8_t * ptr) +{ + uint32_t out; + out =ptr[0]; + out|=ptr[1]<<8; + out|=ptr[2]<<16; + out|=ptr[3]<<24; + return out; +} + +#define error(which) do { error=which; goto exit; } while(0) +#define assert_sum(a,b) do { if (SIZE_MAX-(a)<(b)) error(ups_too_big); } while(0) +#define assert_shift(a,b) do { if (SIZE_MAX>>(b)<(a)) error(ups_too_big); } while(0) +enum upserror ups_apply(struct mem patch, struct mem in, struct mem * out) +{ + enum upserror error; + out->len=0; + out->ptr=NULL; + if (patch.len<4+2+12) return ups_broken; + + if (true) + { +#define readpatch8() (*(patchat++)) +#define readin8() (*(inat++)) +#define writeout8(byte) (*(outat++)=byte) + +#define decodeto(var) \ + do { \ + var=0; \ + unsigned int shift=0; \ + while (true) \ + { \ + uint8_t next=readpatch8(); \ + assert_shift(next&0x7F, shift); \ + size_t addthis=(next&0x7F)<len=outlen; + out->ptr=(uint8_t*)malloc(outlen); + memset(out->ptr, 0, outlen); + + //uint8_t * instart=in.ptr; + uint8_t * inat=in.ptr; + uint8_t * inend=in.ptr+in.len; + + //uint8_t * outstart=out->ptr; + uint8_t * outat=out->ptr; + uint8_t * outend=out->ptr+out->len; + + while (patchat0) + { + uint8_t out; + if (inat>=inend) out=0; + else out=readin8(); + if (outat=inend) out=0; + else out=readin8(); + if (outatptr, out->len); + uint32_t crc_patch=crc32(patch.ptr, patch.len-4); + + if (inlen==outlen) + { + if ((crc_in!=crc_in_expected || crc_out!=crc_out_expected) && (crc_in!=crc_out_expected || crc_out!=crc_in_expected)) error(ups_not_this); + } + else + { + if (!backwards) + { + if (crc_in!=crc_in_expected) error(ups_not_this); + if (crc_out!=crc_out_expected) error(ups_not_this); + } + else + { + if (crc_in!=crc_out_expected) error(ups_not_this); + if (crc_out!=crc_in_expected) error(ups_not_this); + } + } + if (crc_patch!=crc_patch_expected) error(ups_broken); + return ups_ok; +#undef read8 +#undef decodeto +#undef write8 + } + +exit: + free(out->ptr); + out->len=0; + out->ptr=NULL; + return error; +} + +enum upserror ups_create(struct mem sourcemem, struct mem targetmem, struct mem * patchmem) +{ + patchmem->ptr=NULL; + patchmem->len=0; + return ups_broken;//unimplemented, just pick a random error +} + +void ups_free(struct mem mem) +{ + free(mem.ptr); +} + +#if 0 +//Sorry, no undocumented features here. The only thing that can change an UPS patch is swapping the two sizes and checksums, and I don't create anyways. +#endif diff --git a/tools/Flips/libups.h b/tools/Flips/libups.h new file mode 100644 index 000000000..0f749ef60 --- /dev/null +++ b/tools/Flips/libups.h @@ -0,0 +1,43 @@ +//Module name: libups +//Author: Alcaro +//Date: April 4, 2013 +//Licence: GPL v3.0 or higher + +#include "global.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//Several of those are unused, but remain there so the remaining ones match bpserror. +enum upserror { + ups_ok,//Patch applied or created successfully. + + ups_unused1, //bps_to_output + ups_not_this,//This is not the intended input file for this patch. + ups_broken, //This is not a UPS patch, or it's malformed somehow. + ups_unused2, //bps_io + + ups_identical,//The input files are identical. + ups_too_big, //Somehow, you're asking for something a size_t can't represent. + ups_unused3, //bps_out_of_mem + ups_unused4, //bps_canceled + + ups_shut_up_gcc//This one isn't used, it's just to kill a stray comma warning. +}; + +//Applies the UPS patch in [patch, patchlen] to [in, inlen] and stores it to [out, outlen]. Send the +// return value in out to ups_free when you're done with it. +enum upserror ups_apply(struct mem patch, struct mem in, struct mem * out); + +//Creates an UPS patch that converts source to target and stores it to patch. (Not implemented.) +enum upserror ups_create(struct mem source, struct mem target, struct mem * patch); + +//Frees the memory returned in the output parameters of the above. Do not call it twice on the same +// input, nor on anything you got from anywhere else. ups_free is guaranteed to be equivalent to +// calling stdlib.h's free() on mem.ptr. +void ups_free(struct mem mem); + +#ifdef __cplusplus +} +#endif diff --git a/tools/Flips/make-maintainer.sh b/tools/Flips/make-maintainer.sh new file mode 100755 index 000000000..eb40febc6 --- /dev/null +++ b/tools/Flips/make-maintainer.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +if [ "$HOME" != "/home/walrus" ]; then + #This script is for making official releases, including a Windows build. + #If you're intending to fork Floating IPS, or take over maintenance, you're welcome to edit this script. + #If not, you don't want it. make.sh enables all optimizations for a local build. + echo "Use ./make.sh instead." + exit 1 +fi + +rm floating.zip + +# . rather than ./make.sh, so $FLAGS remains set +. ./make.sh +mv flips flips-linux +7z a floating.zip flips-linux +mv ./flips-linux ~/bin/flips + +#wmake64 is +# #!/bin/sh +# export WINEPATH=$(winepath -w ~/tools/mingw64-11.2.0/bin/) +# exec wine mingw32-make "$@" + +#if trying to make a 32bit Flips, add -Wl,--large-address-aware + +echo 'Windows (1/3)' +rm -r obj/* flips.exe; wmake64 TARGET=windows CFLAGS="$FLAGS -fprofile-generate -lgcov" +[ -e flips.exe ] || exit +echo 'Windows (2/3)' +/usr/bin/time --verbose wine flips.exe --create --bps-delta profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null +/usr/bin/time --verbose wine flips.exe --create --bps-delta-moremem profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null +echo 'Windows (3/3)' +rm flips.exe; wmake64 TARGET=windows CFLAGS="$FLAGS -fprofile-use -s" + +#verify that there are no unexpected dependencies +objdump -p flips.exe | grep 'DLL Name' | \ + grep -Pvi '(msvcrt|advapi32|comctl32|comdlg32|gdi32|kernel32|shell32|user32)' && \ + echo "Invalid dependency" && exit + +#test cli binaries +echo "CLI" +make TARGET=cli +[ -e flips ] || exit +rm flips + +echo Finishing +7z a floating.zip flips.exe +zipcrush floating.zip +#The random numbers are the size of Lunar IPS v1.02, which I wish to stay below. +#(Or wished a while ago, but my feature set is so much bigger than Lunar that I'll accept being bigger.) +echo Size: $(stat -c%s flips.exe)/155648 +echo \(Linux: $(stat -c%s ~/bin/flips)\) +echo \(Zipped: $(stat -c%s floating.zip)/59881\) + +/usr/bin/time --format='time: %E' flips --create --bps-delta sm64.z64 star.z64 /dev/null > /dev/null +echo 'expected: 0:04.56' + +#./special.sh diff --git a/tools/Flips/make.sh b/tools/Flips/make.sh new file mode 100755 index 000000000..e5a9671cf --- /dev/null +++ b/tools/Flips/make.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +#This script creates a heavily optimized Linux binary. For debugging or Windows, you're better off using the Makefile directly. + +FLAGS='-Wall -O3 -flto -fuse-linker-plugin -fomit-frame-pointer -fmerge-all-constants -fvisibility=hidden' +FLAGS=$FLAGS' -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables' +FLAGS=$FLAGS' -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj/' +#Linux flags, they don't make sense on Windows +#make-maintainer.sh uses this +LINFLAGS=' -Wl,-z,relro,-z,now,--as-needed,--hash-style=gnu,--relax' + +# not a good solution, but imposing Werror on others is rude, and I'm not aware of a better way to detect if it's me +if [ "$HOME" = "/home/alcaro" ]; then + FLAGS=$FLAGS" -Werror" +fi + +PROFILE=yes + +for i in "$@"; do +case "$i" in + --harden=yes) + FLAGS=$FLAGS' -fstack-protector-strong -pie -fPIE -D_FORTIFY_SOURCE=2' + true | gcc -E - -mmitigate-rop > /dev/null 2>&1 && + FLAGS=$FLAGS' -mmitigate-rop' + ;; + --profile=no|--profile=no-once) + # With PGO, compilation takes about 75 seconds for me, with a peak memory use of 814MB. + # Without PGO, it takes 2.5 seconds and 75MB RAM. However, the resulting binary is about 2% slower. + PROFILE=no + ;; + --cflags=*|--lflags=*) + FLAGS=$FLAGS" ${i#*=}" + ;; + --harden=no|--profile=yes) + ;; + *) + echo "Unknown argument $1; valid arguments are:" + echo "--harden=yes --profile=no --cflags=(...) --lflags=(...) --install=yes" + exit 1 + ;; +esac +done + +if [ $PROFILE = yes ]; then + +echo 'GTK+ (1/3)' +rm obj/* flips; TARGET=gtk make CFLAGS="$FLAGS$LINFLAGS -fprofile-generate -lgcov" || exit $? +[ -e flips ] || exit 1 + +echo 'GTK+ (2/3)' +# These files are downloaded and extracted from +# https://ftp.mozilla.org/pub/firefox/releases/10.0esr/linux-x86_64/en-US/firefox-10.0esr.tar.bz2 +# https://ftp.mozilla.org/pub/firefox/releases/17.0esr/linux-x86_64/en-US/firefox-17.0esr.tar.bz2 +if [ -x /usr/bin/time ]; then +TIME='/usr/bin/time --verbose' +else +TIME='' +fi +export OMP_NUM_THREADS=1 # -fprofile-generate isn't thread safe +$TIME ./flips --create --bps-delta profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null +$TIME ./flips --create --bps-delta-moremem profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null + +echo 'GTK+ (3/3)' +rm flips; TARGET=gtk make CFLAGS="$FLAGS$LINFLAGS -fprofile-use" || exit $? +else +rm flips; TARGET=gtk make CFLAGS="$FLAGS$LINFLAGS" || exit $? +fi diff --git a/tools/Flips/profile/firefox-10.0esr.tar b/tools/Flips/profile/firefox-10.0esr.tar new file mode 100644 index 000000000..de98af27a Binary files /dev/null and b/tools/Flips/profile/firefox-10.0esr.tar differ diff --git a/tools/Flips/profile/firefox-17.0esr.tar b/tools/Flips/profile/firefox-17.0esr.tar new file mode 100644 index 000000000..15d7e7af2 Binary files /dev/null and b/tools/Flips/profile/firefox-17.0esr.tar differ diff --git a/tools/Flips/special.sh b/tools/Flips/special.sh new file mode 100755 index 000000000..736f5ed56 --- /dev/null +++ b/tools/Flips/special.sh @@ -0,0 +1,7 @@ +cp flips.exe special.exe +positions=`strings -td flips.exe | grep 'Flips v' | awk '{ print $1 }'` +for pos in $positions; do + echo 'IPS FLIPPER' | dd if=/dev/stdin of=special.exe bs=1 count=11 conv=notrunc seek=$pos +done +flips --create --bps-delta flips.exe special.exe special.bps +rm special.exe diff --git a/tools/Makefile b/tools/Makefile index 4d342e248..9ce7278e1 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,5 +1,5 @@ CFLAGS := -Wall -Wextra -pedantic -std=c99 -g -O2 -PROGRAMS := elf2rom makeromfs mkdmadata mkldscript reloc_prereq vtxdis yaz0 +PROGRAMS := elf2rom makeromfs mkdmadata mkldscript reloc_prereq ifeq ($(shell command -v clang >/dev/null 2>&1; echo $$?),0) CC := clang @@ -20,11 +20,23 @@ endif all: $(PROGRAMS) $(MAKE) -C ZAPD $(MAKE) -C fado +ifeq ($(wildcard ./gzinject/Makefile),) + cd ./gzinject && ./configure +endif + $(MAKE) -C gzinject + $(MAKE) -C z64compress + $(MAKE) -C Flips TARGET=cli clean: $(RM) $(PROGRAMS) $(addsuffix .exe,$(PROGRAMS)) $(MAKE) -C ZAPD clean $(MAKE) -C fado clean +ifneq ($(wildcard ./gzinject/Makefile),) + $(MAKE) -C gzinject clean +endif + $(MAKE) -C z64compress clean + $(MAKE) -C Flips clean + rm Flips/flips distclean: clean @@ -35,8 +47,6 @@ makeromfs_SOURCES := makeromfs.c n64chksum.c util.c mkdmadata_SOURCES := mkdmadata.c spec.c util.c mkldscript_SOURCES := mkldscript.c spec.c util.c reloc_prereq_SOURCES := reloc_prereq.c spec.c util.c -vtxdis_SOURCES := vtxdis.c -yaz0_SOURCES := yaz0tool.c yaz0.c util.c define COMPILE = diff --git a/tools/ZAPD/.github/workflows/main.yml b/tools/ZAPD/.github/workflows/main.yml new file mode 100644 index 000000000..604c18c96 --- /dev/null +++ b/tools/ZAPD/.github/workflows/main.yml @@ -0,0 +1,98 @@ +name: Build ZAPD + +on: + push: + pull_request: + branches: + - master + +jobs: + build: + runs-on: self-hosted-runner + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Build ZAPD + run: make -j WERROR=1 + + - name: Checkout Repos + run: echo "Checkout Repos" + + - name: Checkout oot + run: | + cd ../ + rm -rf oot/ + git clone https://github.com/zeldaret/oot.git + cd oot + echo $(pwd) + git submodule update --init --recursive + + - name: Checkout mm + run: | + cd ../ + rm -rf mm/ + git clone https://github.com/zeldaret/mm.git + cd mm + echo $(pwd) + + - name: Set up repos + run: echo "Set up repos" + + - name: Setup OOT + run: | + cd ../ + cd oot + echo $(pwd) + mkdir -p baseroms/gc-eu-mq-dbg/segments + cp ~/baserom_original.z64 ./baseroms/gc-eu-mq-dbg/baserom.z64 + cd tools + rm -rf ZAPD/ + ln -s ../../ZAPD + cd ../ + make -j $(nproc) setup + + - name: Setup MM + run: | + cd ../ + cd mm + echo $(pwd) + python3 -m venv .mm-env + source .mm-env/bin/activate + python3 -m pip install -r requirements.txt + cp ~/baserom.mm.us.rev1.z64 ./baserom.mm.us.rev1.z64 + cd tools + rm -rf ZAPD/ + ln -s ../../ZAPD + cd ../ + make -C tools -j + python3 tools/fixbaserom.py + python3 tools/extract_baserom.py + python3 tools/decompress_yars.py + python3 extract_assets.py -j $(nproc) + + - name: Build Repos + run: echo "Build Repos" + + - name: Build oot + run: | + cd ../ + cd oot + echo $(pwd) + make venv + make -j + + - name: Build mm + run: | + cd ../ + cd mm + echo $(pwd) + python3 -m venv .mm-env + source .mm-env/bin/activate + python3 -m pip install -r requirements.txt + make -j disasm + make -j + + - name: Clean workspace + run: git clean -fdX diff --git a/tools/ZAPD/.gitrepo b/tools/ZAPD/.gitrepo index 9010e72f7..9b6f9bb9b 100644 --- a/tools/ZAPD/.gitrepo +++ b/tools/ZAPD/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/zeldaret/ZAPD.git branch = master - commit = 2b6f459b9523603168b6869cf03057a0d68d5f89 - parent = 2ab90bc51788c6baac0a94c3acb256be5f39ca12 + commit = 1300a4f36584627aa784cbc252d1c8ecd7b40e68 + parent = 4522ee2cae12b2d23b7ef0134f24f7c3e26935f0 method = merge cmdver = 0.4.6 diff --git a/tools/ZAPD/README.md b/tools/ZAPD/README.md index 76dfbd1e9..d51dd0558 100644 --- a/tools/ZAPD/README.md +++ b/tools/ZAPD/README.md @@ -117,6 +117,11 @@ ZAPD also accepts the following list of extra parameters: - `-us` / `--unaccounted-static` : Mark unaccounted data as `static` - `-s` / `--static` : Mark every asset as `static`. - This behaviour can be overridden per asset using `Static=` in the respective XML node. +- `--cs-float` : How cutscene floats should be extracted. +- Valid values: + - `hex` + - `float` + - `both` - `-W...`: warning flags, see below Additionally, you can pass the flag `--version` to see the current ZAPD version. If that flag is passed, ZAPD will ignore any other parameter passed. diff --git a/tools/ZAPD/ZAPD/GameConfig.cpp b/tools/ZAPD/ZAPD/GameConfig.cpp index 7990a6086..2140464ec 100644 --- a/tools/ZAPD/ZAPD/GameConfig.cpp +++ b/tools/ZAPD/ZAPD/GameConfig.cpp @@ -167,7 +167,7 @@ void GameConfig::ConfigFunc_ExternalFile(const tinyxml2::XMLElement& element) void GameConfig::ConfigFunc_EnumData(const tinyxml2::XMLElement& element) { - std::string path = Path::GetDirectoryName(configFilePath); + std::string path = Path::GetDirectoryName(configFilePath).string(); path = path.append("/").append(element.Attribute("File")); tinyxml2::XMLDocument doc; tinyxml2::XMLError eResult = doc.LoadFile(path.c_str()); @@ -247,6 +247,12 @@ void GameConfig::ConfigFunc_EnumData(const tinyxml2::XMLElement& element) else if (enumKey == "endSfx") enumData.endSfx[itemIndex] = itemID; + + else if (enumKey == "csSplineInterpType") + enumData.interpType[itemIndex] = itemID; + + else if (enumKey == "csSplineRelTo") + enumData.relTo[itemIndex] = itemID; } } } diff --git a/tools/ZAPD/ZAPD/GameConfig.h b/tools/ZAPD/ZAPD/GameConfig.h index 838d2da6d..4f3b91f8c 100644 --- a/tools/ZAPD/ZAPD/GameConfig.h +++ b/tools/ZAPD/ZAPD/GameConfig.h @@ -48,6 +48,8 @@ public: std::map rumbleType; std::map spawnFlag; std::map endSfx; + std::map interpType; + std::map relTo; }; class ZFile; diff --git a/tools/ZAPD/ZAPD/Globals.h b/tools/ZAPD/ZAPD/Globals.h index 0bfcaeec7..14bd06584 100644 --- a/tools/ZAPD/ZAPD/Globals.h +++ b/tools/ZAPD/ZAPD/Globals.h @@ -16,6 +16,13 @@ enum class VerbosityLevel VERBOSITY_DEBUG }; +enum class CsFloatType +{ + HexOnly, + FloatOnly, + HexAndFloat, +}; + class Globals { public: @@ -31,6 +38,7 @@ public: ZFileMode fileMode; fs::path baseRomPath, inputPath, outputPath, sourceOutputPath, cfgPath; TextureType texType; + CsFloatType floatType = CsFloatType::FloatOnly; ZGame game; GameConfig cfg; bool verboseUnaccounted = false; diff --git a/tools/ZAPD/ZAPD/Main.cpp b/tools/ZAPD/ZAPD/Main.cpp index 40a38bc60..eb1737d64 100644 --- a/tools/ZAPD/ZAPD/Main.cpp +++ b/tools/ZAPD/ZAPD/Main.cpp @@ -36,6 +36,7 @@ void Arg_SetExporter(int& i, char* argv[]); void Arg_EnableGCCCompat(int& i, char* argv[]); void Arg_ForceStatic(int& i, char* argv[]); void Arg_ForceUnaccountedStatic(int& i, char* argv[]); +void Arg_CsFloatMode(int& i, char* argv[]); int main(int argc, char* argv[]); @@ -252,6 +253,7 @@ void ParseArgs(int& argc, char* argv[]) {"--static", &Arg_ForceStatic}, {"-us", &Arg_ForceUnaccountedStatic}, {"--unaccounted-static", &Arg_ForceUnaccountedStatic}, + {"--cs-float", &Arg_CsFloatMode}, }; for (int32_t i = 2; i < argc; i++) @@ -392,6 +394,32 @@ void Arg_ForceUnaccountedStatic([[maybe_unused]] int& i, [[maybe_unused]] char* Globals::Instance->forceUnaccountedStatic = true; } +void Arg_CsFloatMode([[maybe_unused]] int& i, [[maybe_unused]] char* argv[]) +{ + i++; + if (std::strcmp(argv[i], "hex") == 0) + { + Globals::Instance->floatType = CsFloatType::HexOnly; + } + else if (std::strcmp(argv[i], "float") == 0) + { + Globals::Instance->floatType = CsFloatType::FloatOnly; + } + else if (std::strcmp(argv[i], "both") == 0) + { + Globals::Instance->floatType = CsFloatType::HexAndFloat; + } + else + { + Globals::Instance->floatType = CsFloatType::FloatOnly; + HANDLE_WARNING( + WarningType::Always, "Invalid CS Float Type", + StringHelper::Sprintf("Invalid CS float type entered. Expected \"hex\", \"float\", or " + "\"both\". Got %s.\n Defaulting to \"float\".", + argv[i])); + } +} + int HandleExtract(ZFileMode fileMode, ExporterSet* exporterSet) { bool procFileModeSuccess = false; diff --git a/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.cpp b/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.cpp index f18e31308..960404e59 100644 --- a/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.cpp +++ b/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.cpp @@ -4,6 +4,9 @@ #include "Globals.h" #include "Utils/BitConverter.h" #include "Utils/StringHelper.h" +#include "WarningHandler.h" + +#include "ZCutscene.h" /**** GENERIC ****/ @@ -126,42 +129,163 @@ std::string CutsceneMMCommand_GenericCmd::GetCommandMacro() const /**** CAMERA ****/ -CutsceneSubCommandEntry_Camera::CutsceneSubCommandEntry_Camera(const std::vector& rawData, - offset_t rawDataIndex) +CutsceneSubCommandEntry_SplineCamPoint::CutsceneSubCommandEntry_SplineCamPoint( + const std::vector& rawData, offset_t rawDataIndex) : CutsceneSubCommandEntry(rawData, rawDataIndex) { + interpType = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0); + weight = BitConverter::ToUInt8BE(rawData, rawDataIndex + 1); + duration = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); + posX = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4); + posY = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); + posZ = BitConverter::ToUInt16BE(rawData, rawDataIndex + 8); + relTo = BitConverter::ToUInt16BE(rawData, rawDataIndex + 10); } -std::string CutsceneSubCommandEntry_Camera::GetBodySourceCode() const +std::string CutsceneSubCommandEntry_SplineCamPoint::GetBodySourceCode() const { - return StringHelper::Sprintf("CMD_HH(0x%04X, 0x%04X)", base, startFrame); + const auto interpTypeMap = &Globals::Instance->cfg.enumData.interpType; + const auto relToMap = &Globals::Instance->cfg.enumData.relTo; + + return StringHelper::Sprintf("CS_CAM_POINT(%s, 0x%02X, 0x%04X, 0x%04X, 0x%04X, 0x%04X, %s)", + interpTypeMap->at(interpType).c_str(), weight, duration, posX, + posY, posZ, relToMap->at(relTo).c_str()); } -size_t CutsceneSubCommandEntry_Camera::GetRawSize() const +size_t CutsceneSubCommandEntry_SplineCamPoint::GetRawSize() const +{ + return 0x0C; +} + +CutsceneSubCommandEntry_SplineMiscPoint::CutsceneSubCommandEntry_SplineMiscPoint( + const std::vector& rawData, offset_t rawDataIndex) + : CutsceneSubCommandEntry(rawData, rawDataIndex) +{ + unused0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0); + roll = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); + fov = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4); + unused1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); +} + +std::string CutsceneSubCommandEntry_SplineMiscPoint::GetBodySourceCode() const +{ + return StringHelper::Sprintf("CS_CAM_MISC(0x%04X, 0x%04X, 0x%04X, 0x%04X)", unused0, roll, fov, + unused1); +} + +size_t CutsceneSubCommandEntry_SplineMiscPoint::GetRawSize() const +{ + return 0x08; +} + +CutsceneSubCommandEntry_SplineHeader::CutsceneSubCommandEntry_SplineHeader( + const std::vector& rawData, offset_t rawDataIndex) + : CutsceneSubCommandEntry(rawData, rawDataIndex) +{ + numEntries = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0); + unused0 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); + unused1 = BitConverter::ToUInt16BE(rawData, rawDataIndex + 4); + duration = BitConverter::ToUInt16BE(rawData, rawDataIndex + 6); +} + +std::string CutsceneSubCommandEntry_SplineHeader::GetBodySourceCode() const +{ + return StringHelper::Sprintf("CS_CAM_SPLINE(0x%04X, 0x%04X, 0x%04X, 0x%04X)", numEntries, + unused0, unused1, duration); +} + +size_t CutsceneSubCommandEntry_SplineHeader::GetRawSize() const +{ + return 0x08; +} + +CutsceneSubCommandEntry_SplineFooter::CutsceneSubCommandEntry_SplineFooter( + const std::vector& rawData, offset_t rawDataIndex) + : CutsceneSubCommandEntry(rawData, rawDataIndex) +{ + uint16_t firstHalfWord = BitConverter::ToUInt16BE(rawData, rawDataIndex); + uint16_t secondHalfWord = BitConverter::ToUInt16BE(rawData, rawDataIndex + 2); + + if (firstHalfWord != 0xFFFF || secondHalfWord != 4) + { + HANDLE_ERROR(WarningType::InvalidExtractedData, "Invalid Spline Footer", + StringHelper::Sprintf( + "Invalid Spline footer. Was expecting 0xFFFF, 0x0004. Got 0x%04X, 0x%04X", + firstHalfWord, secondHalfWord)); + } +} + +std::string CutsceneSubCommandEntry_SplineFooter::GetBodySourceCode() const +{ + return "CS_CAM_END()"; +} + +size_t CutsceneSubCommandEntry_SplineFooter::GetRawSize() const { return 0x04; } -CutsceneMMCommand_Camera::CutsceneMMCommand_Camera(const std::vector& rawData, +CutsceneMMCommand_Spline::CutsceneMMCommand_Spline(const std::vector& rawData, offset_t rawDataIndex) : CutsceneCommand(rawData, rawDataIndex) { + numHeaders = 0; + totalCommands = 0; rawDataIndex += 4; - entries.reserve(numEntries); - for (size_t i = 0; i < numEntries / 4; i++) + while (1) { - auto* entry = new CutsceneSubCommandEntry_Camera(rawData, rawDataIndex); - entries.push_back(entry); - rawDataIndex += entry->GetRawSize(); + if (BitConverter::ToUInt16BE(rawData, rawDataIndex) == 0xFFFF) + { + break; + } + numHeaders++; + + auto* header = new CutsceneSubCommandEntry_SplineHeader(rawData, rawDataIndex); + rawDataIndex += header->GetRawSize(); + entries.push_back(header); + + totalCommands += header->numEntries; + + for (uint32_t i = 0; i < header->numEntries; i++) + { + auto* entry = new CutsceneSubCommandEntry_SplineCamPoint(rawData, rawDataIndex); + entries.push_back(entry); + rawDataIndex += entry->GetRawSize(); + } + + for (uint32_t i = 0; i < header->numEntries; i++) + { + auto* entry = new CutsceneSubCommandEntry_SplineCamPoint(rawData, rawDataIndex); + entries.push_back(entry); + rawDataIndex += entry->GetRawSize(); + } + + for (uint32_t i = 0; i < header->numEntries; i++) + { + auto* entry = new CutsceneSubCommandEntry_SplineMiscPoint(rawData, rawDataIndex); + entries.push_back(entry); + rawDataIndex += entry->GetRawSize(); + } } + + auto* footer = new CutsceneSubCommandEntry_SplineFooter(rawData, rawDataIndex); + entries.push_back(footer); + rawDataIndex += footer->GetRawSize(); } -std::string CutsceneMMCommand_Camera::GetCommandMacro() const +std::string CutsceneMMCommand_Spline::GetCommandMacro() const { return StringHelper::Sprintf("CS_CAM_SPLINE_LIST(%i)", numEntries); } +size_t CutsceneMMCommand_Spline::GetCommandSize() const +{ + // 8 Bytes once for the spline command, 8 Bytes per spline the header, two groups of size 12, 1 + // group of size 8, 4 bytes for the footer. + return 8 + (8 * numHeaders) + ((totalCommands * 2) * 0xC) + (totalCommands * 8) + 4; +} + /**** TRANSITION GENERAL ****/ CutsceneSubCommandEntry_TransitionGeneral::CutsceneSubCommandEntry_TransitionGeneral( @@ -434,22 +558,29 @@ CutsceneMMSubCommandEntry_ActorCue::CutsceneMMSubCommandEntry_ActorCue( std::string CutsceneMMSubCommandEntry_ActorCue::GetBodySourceCode() const { EnumData* enumData = &Globals::Instance->cfg.enumData; + std::string normalXStr = + ZCutscene::GetCsEncodedFloat(normalX, Globals::Instance->floatType, true); + std::string normalYStr = + ZCutscene::GetCsEncodedFloat(normalY, Globals::Instance->floatType, true); + std::string normalZStr = + ZCutscene::GetCsEncodedFloat(normalZ, Globals::Instance->floatType, true); if (static_cast(commandID) == CutsceneMM_CommandType::CS_CMD_PLAYER_CUE) { return StringHelper::Sprintf("CS_PLAYER_CUE(%s, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " - "%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)", + "%i, %i, %i, %i, %s, %s, %s)", enumData->playerCueId[base].c_str(), startFrame, endFrame, rotX, rotY, rotZ, startPosX, startPosY, startPosZ, endPosX, - endPosY, endPosZ, normalX, normalY, normalZ); + endPosY, endPosZ, normalXStr.c_str(), normalYStr.c_str(), + normalZStr.c_str()); } else { return StringHelper::Sprintf("CS_ACTOR_CUE(%i, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " - "%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)", + "%i, %i, %i, %i, %s, %s, %s)", base, startFrame, endFrame, rotX, rotY, rotZ, startPosX, - startPosY, startPosZ, endPosX, endPosY, endPosZ, normalX, - normalY, normalZ); + startPosY, startPosZ, endPosX, endPosY, endPosZ, + normalXStr.c_str(), normalYStr.c_str(), normalZStr.c_str()); } } diff --git a/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.h b/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.h index fb2f77275..597f6788b 100644 --- a/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.h +++ b/tools/ZAPD/ZAPD/OtherStructs/CutsceneMM_Commands.h @@ -268,24 +268,79 @@ public: // TODO: MM cutscene camera command is implemented as a placeholder until we better understand how // it works -class CutsceneSubCommandEntry_Camera : public CutsceneSubCommandEntry + +class CutsceneSubCommandEntry_SplineCamPoint : public CutsceneSubCommandEntry { public: - uint32_t unk_08; + uint8_t interpType; + uint8_t weight; + uint16_t duration; - CutsceneSubCommandEntry_Camera(const std::vector& rawData, offset_t rawDataIndex); + uint16_t posX; + uint16_t posY; + + uint16_t posZ; + uint16_t relTo; + + CutsceneSubCommandEntry_SplineCamPoint(const std::vector& rawData, + offset_t rawDataIndex); std::string GetBodySourceCode() const override; size_t GetRawSize() const override; }; -class CutsceneMMCommand_Camera : public CutsceneCommand +class CutsceneSubCommandEntry_SplineMiscPoint : public CutsceneSubCommandEntry { public: - CutsceneMMCommand_Camera(const std::vector& rawData, offset_t rawDataIndex); + uint16_t unused0; + uint16_t roll; + uint16_t fov; + uint16_t unused1; + + CutsceneSubCommandEntry_SplineMiscPoint(const std::vector& rawData, + offset_t rawDataIndex); + + std::string GetBodySourceCode() const override; + + size_t GetRawSize() const override; +}; + +class CutsceneSubCommandEntry_SplineFooter : public CutsceneSubCommandEntry +{ +public: + CutsceneSubCommandEntry_SplineFooter(const std::vector& rawData, + offset_t rawDataIndex); + + std::string GetBodySourceCode() const override; + + size_t GetRawSize() const override; +}; + +class CutsceneSubCommandEntry_SplineHeader : public CutsceneSubCommandEntry +{ +public: + uint16_t numEntries; + uint16_t unused0; + uint16_t unused1; + uint16_t duration; + CutsceneSubCommandEntry_SplineHeader(const std::vector& rawData, + offset_t rawDataIndex); + + std::string GetBodySourceCode() const override; + + size_t GetRawSize() const override; +}; + +class CutsceneMMCommand_Spline : public CutsceneCommand +{ +public: + uint32_t numHeaders; + uint32_t totalCommands; + CutsceneMMCommand_Spline(const std::vector& rawData, offset_t rawDataIndex); std::string GetCommandMacro() const override; + size_t GetCommandSize() const override; }; /**** TRANSITION GENERAL ****/ diff --git a/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp b/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp index 8c530f796..668657e7a 100644 --- a/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp +++ b/tools/ZAPD/ZAPD/OtherStructs/CutsceneOoT_Commands.cpp @@ -6,6 +6,8 @@ #include "Utils/BitConverter.h" #include "Utils/StringHelper.h" +#include "ZCutscene.h" + /**** GENERIC ****/ // Specific for command lists where each entry has size 0x30 bytes @@ -13,7 +15,7 @@ const std::unordered_map csCom {CutsceneOoT_CommandType::CS_CMD_MISC, {"CS_MISC", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, {CutsceneOoT_CommandType::CS_CMD_LIGHT_SETTING, - {"CS_LIGHT_SETTING", "(0x%02X, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, + {"CS_LIGHT_SETTING", "(0x%02X, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, {CutsceneOoT_CommandType::CS_CMD_START_SEQ, {"CS_START_SEQ", "(%s, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"}}, {CutsceneOoT_CommandType::CS_CMD_STOP_SEQ, @@ -139,9 +141,11 @@ std::string CutsceneOoTCommand_CameraPoint::GetBodySourceCode() const if (continueFlag != 0) continueMacro = "CS_CAM_STOP"; - return StringHelper::Sprintf("CS_CAM_POINT(%s, 0x%02X, %i, %ff, %i, %i, %i, 0x%04X)", - continueMacro.c_str(), cameraRoll, nextPointFrame, viewAngle, posX, - posY, posZ, unused); + return StringHelper::Sprintf( + "CS_CAM_POINT(%s, 0x%02X, %i, %s, %i, %i, %i, 0x%04X)", continueMacro.c_str(), cameraRoll, + nextPointFrame, + ZCutscene::GetCsEncodedFloat(viewAngle, Globals::Instance->floatType, false).c_str(), posX, + posY, posZ, unused); } size_t CutsceneOoTCommand_CameraPoint::GetRawSize() const @@ -334,27 +338,34 @@ CutsceneOoTSubCommandEntry_ActorCue::CutsceneOoTSubCommandEntry_ActorCue( normalY = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x28); normalZ = BitConverter::ToFloatBE(rawData, rawDataIndex + 0x2C); } - std::string CutsceneOoTSubCommandEntry_ActorCue::GetBodySourceCode() const { EnumData* enumData = &Globals::Instance->cfg.enumData; + std::string normalXStr = + ZCutscene::GetCsEncodedFloat(normalX, Globals::Instance->floatType, true); + std::string normalYStr = + ZCutscene::GetCsEncodedFloat(normalY, Globals::Instance->floatType, true); + std::string normalZStr = + ZCutscene::GetCsEncodedFloat(normalZ, Globals::Instance->floatType, true); + if (static_cast(commandID) == CutsceneOoT_CommandType::CS_CMD_PLAYER_CUE) { return StringHelper::Sprintf("CS_PLAYER_CUE(%s, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " - "%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)", + "%i, %i, %i, %i, %s, %s, %s)", enumData->playerCueId[base].c_str(), startFrame, endFrame, rotX, rotY, rotZ, startPosX, startPosY, startPosZ, endPosX, - endPosY, endPosZ, normalX, normalY, normalZ); + endPosY, endPosZ, normalXStr.c_str(), normalYStr.c_str(), + normalZStr.c_str()); } else { return StringHelper::Sprintf("CS_ACTOR_CUE(%i, %i, %i, 0x%04X, 0x%04X, 0x%04X, %i, %i, " - "%i, %i, %i, %i, %.8ef, %.8ef, %.8ef)", + "%i, %i, %i, %i, %s, %s, %s)", base, startFrame, endFrame, rotX, rotY, rotZ, startPosX, - startPosY, startPosZ, endPosX, endPosY, endPosZ, normalX, - normalY, normalZ); + startPosY, startPosZ, endPosX, endPosY, endPosZ, + normalXStr.c_str(), normalYStr.c_str(), normalZStr.c_str()); } } diff --git a/tools/ZAPD/ZAPD/ZAPD.vcxproj b/tools/ZAPD/ZAPD/ZAPD.vcxproj index 77d0bd16e..26a0b7036 100644 --- a/tools/ZAPD/ZAPD/ZAPD.vcxproj +++ b/tools/ZAPD/ZAPD/ZAPD.vcxproj @@ -45,6 +45,7 @@ true v142 MultiByte + false Application @@ -52,6 +53,7 @@ v142 true MultiByte + false @@ -186,21 +188,24 @@ mkdir build\ZAPD - + + + + - + @@ -278,7 +283,8 @@ mkdir build\ZAPD - + + @@ -287,6 +293,8 @@ mkdir build\ZAPD + + @@ -296,9 +304,9 @@ mkdir build\ZAPD - + diff --git a/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters b/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters index eac471961..51723306b 100644 --- a/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters +++ b/tools/ZAPD/ZAPD/ZAPD.vcxproj.filters @@ -228,9 +228,6 @@ Source Files\Z64\ZRoom\Commands - - Source Files\Z64\ZRoom\Commands - Source Files\Z64\ZRoom\Commands @@ -279,9 +276,6 @@ Source Files\Z64 - - Source Files\Z64 - Source Files\Z64 @@ -297,6 +291,21 @@ Source Files\Z64 + + Source Files\Z64 + + + Source Files\Z64 + + + Source Files\Z64\ZRoom\Commands + + + Source Files\Z64 + + + Source Files\Z64 + @@ -497,9 +506,6 @@ Header Files\Z64\ZRoom\Commands - - Header Files\Z64\ZRoom\Commands - Header Files\Z64\ZRoom\Commands @@ -548,9 +554,6 @@ Header Files\Z64 - - Header Files\Z64 - Header Files\Z64 @@ -569,6 +572,21 @@ Header Files + + Header Files\Z64 + + + Header Files\Z64 + + + Header Files\Z64\ZRoom\Commands + + + Header Files\Z64 + + + Header Files\Z64 + diff --git a/tools/ZAPD/ZAPD/ZCKeyFrame.cpp b/tools/ZAPD/ZAPD/ZCKeyFrame.cpp new file mode 100644 index 000000000..387f8ad2f --- /dev/null +++ b/tools/ZAPD/ZAPD/ZCKeyFrame.cpp @@ -0,0 +1,302 @@ +#include "ZCKeyFrame.h" + +#include "Globals.h" +#include "Utils/BitConverter.h" +#include "Utils/StringHelper.h" +#include "WarningHandler.h" + +REGISTER_ZFILENODE(KeyFrameSkel, ZKeyFrameSkel); +REGISTER_ZFILENODE(KeyFrameLimbList, ZKeyFrameLimbList); + +ZKeyFrameSkel::ZKeyFrameSkel(ZFile* nParent) : ZResource(nParent) +{ + RegisterRequiredAttribute("LimbType"); +} + +ZKeyFrameSkel::~ZKeyFrameSkel() +{ +} + +ZKeyFrameLimb::ZKeyFrameLimb(ZFile* nParent) : ZResource(nParent) +{ +} + +ZKeyFrameStandardLimb::ZKeyFrameStandardLimb(ZFile* nParent) : ZKeyFrameLimb(nParent) +{ +} + +ZKeyFrameFlexLimb::ZKeyFrameFlexLimb(ZFile* nParent) : ZKeyFrameLimb(nParent) +{ +} + +ZKeyFrameLimbList::ZKeyFrameLimbList(ZFile* nParent) : ZResource(nParent) +{ + RegisterRequiredAttribute("LimbType"); + RegisterRequiredAttribute("LimbCount"); +} + +ZKeyFrameLimbList::ZKeyFrameLimbList(ZFile* nParent, uint32_t limbCount, ZKeyframeSkelType type) + : ZResource(nParent) +{ + numLimbs = limbCount; + limbType = type; +} + +ZKeyFrameLimbList::~ZKeyFrameLimbList() +{ + for (const auto l : limbs) + delete l; +} + +void ZKeyFrameSkel::ParseXML(tinyxml2::XMLElement* reader) +{ + ZResource::ParseXML(reader); + + std::string limbTypeStr = registeredAttributes.at("LimbType").value; + + limbType = ZKeyFrameLimbList::ParseLimbTypeStr(limbTypeStr); + if (limbType == ZKeyframeSkelType::Error) + HANDLE_ERROR_RESOURCE( + WarningType::InvalidXML, parent, this, rawDataIndex, "Invalid limb type", + StringHelper::Sprintf("Invalid limb type. Was expecting 'Flex' or 'Normal'. Got %s.", + limbTypeStr.c_str())); +} +void ZKeyFrameLimbList::ParseXML(tinyxml2::XMLElement* reader) +{ + ZResource::ParseXML(reader); + + std::string limbTypeStr = registeredAttributes.at("LimbType").value; + std::string numLimbStr = registeredAttributes.at("LimbCount").value; + + limbType = ParseLimbTypeStr(limbTypeStr); + + if (limbType == ZKeyframeSkelType::Error) + HANDLE_ERROR_RESOURCE( + WarningType::InvalidXML, parent, this, rawDataIndex, "Invalid limb type", + StringHelper::Sprintf("Invalid limb type. Was expecting 'Flex' or 'Normal'. Got %s.", + limbTypeStr.c_str())); + + numLimbs = (uint8_t)StringHelper::StrToL(numLimbStr); +} + +void ZKeyFrameSkel::ParseRawData() +{ + ZResource::ParseRawData(); + + const auto& rawData = parent->GetRawData(); + limbCount = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0); + dListCount = BitConverter::ToUInt8BE(rawData, rawDataIndex + 1); + limbsPtr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 4); + + limbList = std::make_unique(parent, limbCount, limbType); + limbList->SetRawDataIndex(GETSEGOFFSET(limbsPtr)); + limbList->ParseRawData(); +} + +void ZKeyFrameSkel::DeclareReferences(const std::string& prefix) +{ + std::string defaultPrefix = name; + std::string declaration; + + if (defaultPrefix == "") + defaultPrefix = prefix; + + ZResource::DeclareReferences(defaultPrefix); + declaration += limbList->GetBodySourceCode(); + parent->AddDeclarationArray( + GETSEGOFFSET(limbsPtr), DeclarationAlignment::Align4, limbList->GetRawDataSize(), + limbList->GetSourceTypeName(), + StringHelper::Sprintf("%s_KeyFrameLimbs_%06X", prefix.c_str(), rawDataIndex), + limbList->limbs.size(), declaration); +} + +std::string ZKeyFrameSkel::GetBodySourceCode() const +{ + std::string limbStr; + + if (limbType == ZKeyframeSkelType::Normal) + Globals::Instance->GetSegmentedPtrName(limbsPtr, parent, "KeyFrameStandardLimb", limbStr); + else + Globals::Instance->GetSegmentedPtrName(limbsPtr, parent, "KeyFrameFlexLimb", limbStr); + + return StringHelper::Sprintf("\n\t0x%02X, 0x%02X, %s\n", limbCount, dListCount, + limbStr.c_str()); +} + +size_t ZKeyFrameSkel::GetRawDataSize() const +{ + return 0x8; +} + +std::string ZKeyFrameSkel::GetSourceTypeName() const +{ + return "KeyFrameSkeleton"; +} + +ZResourceType ZKeyFrameSkel::GetResourceType() const +{ + return ZResourceType::KeyFrameSkel; +} + +size_t ZKeyFrameStandardLimb::GetRawDataSize() const +{ + return 0xC; +} + +size_t ZKeyFrameFlexLimb::GetRawDataSize() const +{ + return 0x8; +} + +size_t ZKeyFrameLimbList::GetRawDataSize() const +{ + size_t limbSize; + if (limbType == ZKeyframeSkelType::Flex) + limbSize = 0x8; + else + limbSize = 0xC; + + return limbSize * numLimbs; +} + +ZKeyframeSkelType ZKeyFrameLimbList::ParseLimbTypeStr(const std::string& typeStr) +{ + if (typeStr == "Flex") + return ZKeyframeSkelType::Flex; + else if (typeStr == "Normal") + return ZKeyframeSkelType::Normal; + else + return ZKeyframeSkelType::Error; +} + +void ZKeyFrameLimb::ParseRawData() +{ + const auto& rawData = parent->GetRawData(); + + dlist = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0); + numChildren = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x4); + flags = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x5); +} + +void ZKeyFrameStandardLimb::ParseRawData() +{ + const auto& rawData = parent->GetRawData(); + + ZKeyFrameLimb::ParseRawData(); + translation.x = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x6); + translation.y = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0x8); + translation.z = BitConverter::ToUInt16BE(rawData, rawDataIndex + 0xA); +} + +void ZKeyFrameFlexLimb::ParseRawData() +{ + const auto& rawData = parent->GetRawData(); + + ZKeyFrameLimb::ParseRawData(); + callbackIndex = BitConverter::ToUInt8BE(rawData, rawDataIndex + 0x6); +} + +void ZKeyFrameLimbList::ParseRawData() +{ + limbs.reserve(numLimbs); + rawDataIndex = GetRawDataIndex(); + + for (uint32_t i = 0; i < numLimbs; i++) + { + ZKeyFrameLimb* limb; + if (limbType == ZKeyframeSkelType::Flex) + limb = new ZKeyFrameFlexLimb(parent); + else + limb = new ZKeyFrameStandardLimb(parent); + + limb->SetRawDataIndex(rawDataIndex + (offset_t)(i * limb->GetRawDataSize())); + limb->ParseRawData(); + limbs.push_back(limb); + } +} + +std::string ZKeyFrameLimbList::GetBodySourceCode() const +{ + std::string declaration; + + for (const auto l : limbs) + declaration += StringHelper::Sprintf("\t{ %s },\n", l->GetBodySourceCode().c_str()); + // Remove last newline + return declaration.substr(0, declaration.length() - 1); +} + +std::string ZKeyFrameStandardLimb::GetBodySourceCode() const +{ + std::string declaration; + std::string dlString; + + Globals::Instance->GetSegmentedArrayIndexedName(dlist, 8, parent, "Gfx", dlString); + + declaration += + StringHelper::Sprintf("%s, 0x%02X, 0x%02X, { 0x%04X, 0x%04X, 0x%04X},", dlString.c_str(), + numChildren, flags, translation.x, translation.y, translation.z); + return declaration; +} + +std::string ZKeyFrameFlexLimb::GetBodySourceCode() const +{ + std::string declaration; + + std::string dlString; + + Globals::Instance->GetSegmentedArrayIndexedName(dlist, 8, parent, "Gfx", dlString); + + declaration += StringHelper::Sprintf("%s, 0x%02X, 0x%02X, 0x%02X", dlString.c_str(), + numChildren, flags, callbackIndex); + return declaration; +} + +std::string ZKeyFrameStandardLimb::GetSourceTypeName() const +{ + return "KeyFrameStandardLimb"; +} + +std::string ZKeyFrameFlexLimb::GetSourceTypeName() const +{ + return "KeyFrameFlexLimb"; +} + +std::string ZKeyFrameLimbList::GetSourceTypeName() const +{ + switch (limbType) + { + case ZKeyframeSkelType::Flex: + return "KeyFrameFlexLimb"; + case ZKeyframeSkelType::Normal: + return "KeyFrameStandardLimb"; + default: + HANDLE_ERROR_RESOURCE(WarningType::InvalidXML, parent, this, rawDataIndex, + "Invalid limb type", ""); + break; + } +} + +ZResourceType ZKeyFrameStandardLimb::GetResourceType() const +{ + return ZResourceType::KeyFrameStandardLimb; +} + +ZResourceType ZKeyFrameFlexLimb::GetResourceType() const +{ + return ZResourceType::KeyFrameFlexLimb; +} + +ZResourceType ZKeyFrameLimbList::GetResourceType() const +{ + switch (limbType) + { + case ZKeyframeSkelType::Flex: + return ZResourceType::KeyFrameFlexLimb; + case ZKeyframeSkelType::Normal: + return ZResourceType::KeyFrameStandardLimb; + default: + HANDLE_ERROR_RESOURCE(WarningType::InvalidXML, parent, this, rawDataIndex, + "Invalid limb type", ""); + break; + } +} diff --git a/tools/ZAPD/ZAPD/ZCKeyFrame.h b/tools/ZAPD/ZAPD/ZCKeyFrame.h new file mode 100644 index 000000000..417d7cc68 --- /dev/null +++ b/tools/ZAPD/ZAPD/ZCKeyFrame.h @@ -0,0 +1,121 @@ +#pragma once + +#include +#include +#include +#include + +#include "ZFile.h" + +class ZKeyFrameLimb; + +struct Vec3s +{ + int16_t x; + int16_t y; + int16_t z; +}; + +enum class ZKeyframeSkelType +{ + Normal, + Flex, + Error, +}; + +class ZKeyFrameLimbList : public ZResource +{ +public: + ZKeyFrameLimbList(); + ZKeyFrameLimbList(ZFile* nParent); + ZKeyFrameLimbList(ZFile* nParent, uint32_t limbCount, ZKeyframeSkelType type); + + ~ZKeyFrameLimbList(); + + void ParseRawData() override; + + std::string GetBodySourceCode() const override; + void ParseXML(tinyxml2::XMLElement* reader) override; + + std::string GetSourceTypeName() const override; + ZResourceType GetResourceType() const override; + + size_t GetRawDataSize() const override; + + static ZKeyframeSkelType ParseLimbTypeStr(const std::string& typeStr); + + std::vector limbs; + ZKeyframeSkelType limbType; + uint8_t numLimbs; +}; + +class ZKeyFrameLimb : public ZResource +{ +public: + segptr_t dlist; + uint8_t numChildren; + uint8_t flags; + + ZKeyFrameLimb(ZFile* nParent); + void ParseRawData() override; +}; + +class ZKeyFrameStandardLimb : public ZKeyFrameLimb +{ +public: + Vec3s translation; + + ZKeyFrameStandardLimb(ZFile* nParent); + void ParseRawData() override; + + std::string GetBodySourceCode() const override; + + + std::string GetSourceTypeName() const override; + ZResourceType GetResourceType() const override; + + size_t GetRawDataSize() const override; +}; + +class ZKeyFrameFlexLimb : public ZKeyFrameLimb +{ +public: + uint8_t callbackIndex; + + ZKeyFrameFlexLimb(ZFile* nParent); + // void ParseXML(tinyxml2::XMLElement* reader) override; + void ParseRawData() override; + + std::string GetBodySourceCode() const override; + + // std::string GetSourceOutputHeader(const std::string& prefix) override; + + std::string GetSourceTypeName() const override; + ZResourceType GetResourceType() const override; + + size_t GetRawDataSize() const override; +}; + +class ZKeyFrameSkel : public ZResource +{ +public: + std::unique_ptr limbList; + segptr_t limbsPtr; + ZKeyframeSkelType limbType; + uint8_t limbCount; + uint8_t dListCount; + + ZKeyFrameSkel(ZFile* nParent); + ~ZKeyFrameSkel(); + + void ParseXML(tinyxml2::XMLElement* reader) override; + void ParseRawData() override; + void DeclareReferences(const std::string& prefix) override; + + std::string GetBodySourceCode() const override; + + std::string GetSourceTypeName() const override; + ZResourceType GetResourceType() const override; + + size_t GetRawDataSize() const override; +}; diff --git a/tools/ZAPD/ZAPD/ZCKeyFrameAnim.cpp b/tools/ZAPD/ZAPD/ZCKeyFrameAnim.cpp new file mode 100644 index 000000000..0b0747133 --- /dev/null +++ b/tools/ZAPD/ZAPD/ZCKeyFrameAnim.cpp @@ -0,0 +1,219 @@ +#include "ZCkeyFrameAnim.h" +#include "ZCKeyFrame.h" +#include "Globals.h" + +#include "Utils/BitConverter.h" + +REGISTER_ZFILENODE(KeyFrameAnimation, ZKeyFrameAnim); + +ZKeyFrameAnim::ZKeyFrameAnim(ZFile* nParent) : ZResource(nParent) +{ + RegisterRequiredAttribute("Skel"); +} + +ZKeyFrameAnim::~ZKeyFrameAnim() +{ +} + +void ZKeyFrameAnim::ParseXML(tinyxml2::XMLElement* reader) +{ + ZResource::ParseXML(reader); + + std::string skelAddrStr = registeredAttributes.at("Skel").value; + skelOffset = (offset_t)StringHelper::StrToL(skelAddrStr, 16); +} + +void ZKeyFrameAnim::DeclareReferencesLate(const std::string& prefix) +{ + std::string defaultPrefix = name; + std::string declaration; + + if (defaultPrefix == "") + defaultPrefix = prefix; + + ZResource::DeclareReferences(defaultPrefix); + + declaration += "\t"; + + if (skel->limbType == ZKeyframeSkelType::Normal) + { + for (const auto b : bitFlags) + { + declaration += StringHelper::Sprintf("0x%02X, ", b); + parent->AddDeclarationArray( + GETSEGOFFSET(bitFlagsAddr), DeclarationAlignment::Align4, bitFlags.size(), "u8", + StringHelper::Sprintf("%s_bitFlags_%06X", prefix.c_str(), rawDataIndex), + bitFlags.size(), declaration); + } + } + else + { + for (const auto b : bitFlagsFlex) + { + declaration += StringHelper::Sprintf("0x%04X, ", b); + parent->AddDeclarationArray( + GETSEGOFFSET(bitFlagsAddr), DeclarationAlignment::Align4, bitFlagsFlex.size() * 2, + "u16", StringHelper::Sprintf("%s_flexBitFlags_%06X", prefix.c_str(), rawDataIndex), + bitFlagsFlex.size(), declaration); + } + } + declaration.clear(); + + for (const auto kf : keyFrames) + { + declaration += + StringHelper::Sprintf(" \t { %i, %i, %i, },\n", kf.frame, kf.value, kf.velocity); + } + // Remove last new line to prevent an extra line after the last element + declaration = declaration.substr(0, declaration.length() - 1); + parent->AddDeclarationArray( + GETSEGOFFSET(keyFramesAddr), DeclarationAlignment::Align4, keyFrames.size() * 6, "KeyFrame", + StringHelper::Sprintf("%s_KeyFrame_%06X", prefix.c_str(), rawDataIndex), keyFrames.size(), + declaration); + + declaration.clear(); + + declaration += "\t"; + + for (const auto kfNum : kfNums) + { + declaration += StringHelper::Sprintf("0x%04X, ", kfNum); + } + + parent->AddDeclarationArray( + GETSEGOFFSET(kfNumsAddr), DeclarationAlignment::Align4, kfNums.size() * 2, "s16", + StringHelper::Sprintf("%s_kfNums_%06X", prefix.c_str(), rawDataIndex), kfNums.size(), + declaration); + declaration += "\n"; + + declaration.clear(); + + declaration += "\t"; + + for (const auto pv : presetValues) + { + declaration += StringHelper::Sprintf("0x%04X, ", pv); + } + declaration += "\n"; + parent->AddDeclarationArray( + GETSEGOFFSET(presentValuesAddr), DeclarationAlignment::Align4, presetValues.size() * 2, + "s16", StringHelper::Sprintf("%s_presetValues_%06X", prefix.c_str(), rawDataIndex), + presetValues.size(), declaration); + +} + +// ParseRawDataLate is used because we need to make sure the flex skel has been processed first. +void ZKeyFrameAnim::ParseRawDataLate() +{ + const auto& rawData = parent->GetRawData(); + + skel = static_cast(parent->FindResource(skelOffset)); + size_t numLimbs = skel->limbCount; + + bitFlagsAddr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x0); + keyFramesAddr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x4); + kfNumsAddr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0x8); + presentValuesAddr = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0xC); + + uint32_t kfNumsSize = 0; + uint32_t presetValuesSize = 0; + uint32_t keyFramesCount = 0; + if (skel->limbType == ZKeyframeSkelType::Normal) + { + bitFlags.reserve(numLimbs); + for (size_t i = 0; i < numLimbs; i++) + { + uint8_t e = BitConverter::ToUInt8BE(rawData, GETSEGOFFSET(bitFlagsAddr) + i); + bitFlags.push_back(e); + kfNumsSize += GetSetBits((uint8_t)(e & 0b111111)); + presetValuesSize += GetSetBits((uint8_t)((e ^ 0xFF) & 0b111111)); + } + } + else + { + bitFlagsFlex.reserve(numLimbs); + for (size_t i = 0; i < numLimbs; i++) + { + uint16_t e = BitConverter::ToUInt16BE(rawData, GETSEGOFFSET(bitFlagsAddr) + (i * 2)); + bitFlagsFlex.push_back(e); + kfNumsSize += GetSetBits((uint16_t)(e & 0b111111111)); + presetValuesSize += GetSetBits((uint16_t)((e ^ 0xFFFF) & 0b111111111)); + } + } + + kfNums.reserve(kfNumsSize); + for (uint32_t i = 0; i < kfNumsSize; i++) + { + int16_t kfNum = BitConverter::ToUInt16BE(rawData, GETSEGOFFSET(kfNumsAddr) + (i * 2)); + keyFramesCount += kfNum; + kfNums.push_back(kfNum); + } + + keyFrames.reserve(keyFramesCount); + for (uint32_t i = 0; i < keyFramesCount; i++) + { + KeyFrame kf; + kf.frame = BitConverter::ToInt16BE(rawData, (GETSEGOFFSET(keyFramesAddr) + 0) + (i * 6)); + kf.value = BitConverter::ToInt16BE(rawData, (GETSEGOFFSET(keyFramesAddr) + 2) + (i * 6)); + kf.velocity = BitConverter::ToInt16BE(rawData, (GETSEGOFFSET(keyFramesAddr) + 4) + (i * 6)); + keyFrames.push_back(kf); + } + + presetValues.reserve(presetValuesSize); + for (uint32_t i = 0; i < presetValuesSize; i++) + { + presetValues.push_back( + BitConverter::ToInt16BE(rawData, GETSEGOFFSET(presentValuesAddr) + (i * 2))); + } + + unk_10 = BitConverter::ToInt16BE(rawData, GETSEGOFFSET(rawDataIndex) + 0x10); + duration = BitConverter::ToInt16BE(rawData, GETSEGOFFSET(rawDataIndex) + 0x12); +} + +std::string ZKeyFrameAnim::GetBodySourceCode() const +{ + std::string declaration; + + std::string bitFlagsStr; + std::string keyFrameStr; + std::string kfNumsStr; + std::string presetValuesStr; + + Globals::Instance->GetSegmentedPtrName(bitFlagsAddr, parent, "", bitFlagsStr); + Globals::Instance->GetSegmentedPtrName(keyFramesAddr, parent, "", keyFrameStr); + Globals::Instance->GetSegmentedPtrName(kfNumsAddr, parent, "", kfNumsStr); + Globals::Instance->GetSegmentedPtrName(presentValuesAddr, parent, "", presetValuesStr); + + return StringHelper::Sprintf("\n\t%s, %s, %s, %s, 0x%04X, 0x%04X\n", bitFlagsStr.c_str(), + keyFrameStr.c_str(), kfNumsStr.c_str(), presetValuesStr.c_str(), + unk_10, duration); +} + +std::string ZKeyFrameAnim::GetSourceTypeName() const +{ + return "KeyFrameAnimation"; +} + +ZResourceType ZKeyFrameAnim::GetResourceType() const +{ + return ZResourceType::KeyFrameAnimation; +} + +size_t ZKeyFrameAnim::GetRawDataSize() const +{ + return 0x14; +} + +template +uint32_t ZKeyFrameAnim::GetSetBits(T data) const +{ + uint32_t num = 0; + + for (size_t i = 0; i < sizeof(T) * 8; i++) + { + if ((data >> i) & 1) + num++; + } + + return num; +} \ No newline at end of file diff --git a/tools/ZAPD/ZAPD/ZCkeyFrameAnim.h b/tools/ZAPD/ZAPD/ZCkeyFrameAnim.h new file mode 100644 index 000000000..64f95b13a --- /dev/null +++ b/tools/ZAPD/ZAPD/ZCkeyFrameAnim.h @@ -0,0 +1,52 @@ +#pragma once +#include +#include +#include +#include + +#include "ZFile.h" + +class ZKeyFrameSkel; + +typedef struct +{ + int16_t frame; + int16_t value; + int16_t velocity; +} KeyFrame; + +class ZKeyFrameAnim : public ZResource +{ +public: + ZKeyFrameSkel* skel; + std::vector bitFlags; // Standard only + std::vector bitFlagsFlex; // Flex only + + std::vector keyFrames; + std::vector kfNums; + std::vector presetValues; + + uint16_t unk_10; + int16_t duration; + + ZKeyFrameAnim(ZFile* nParent); + ~ZKeyFrameAnim(); + void ParseXML(tinyxml2::XMLElement* reader) override; + void DeclareReferencesLate(const std::string& prefix) override; + void ParseRawDataLate() override; + std::string GetBodySourceCode() const override; + + std::string GetSourceTypeName() const override; + ZResourceType GetResourceType() const override; + + size_t GetRawDataSize() const override; + +private: + offset_t skelOffset; + segptr_t bitFlagsAddr; + segptr_t keyFramesAddr; + segptr_t kfNumsAddr; + segptr_t presentValuesAddr; + template + uint32_t GetSetBits(T data) const; +}; diff --git a/tools/ZAPD/ZAPD/ZCutscene.cpp b/tools/ZAPD/ZAPD/ZCutscene.cpp index ea723b295..0bf0363df 100644 --- a/tools/ZAPD/ZAPD/ZCutscene.cpp +++ b/tools/ZAPD/ZAPD/ZCutscene.cpp @@ -24,7 +24,7 @@ std::string ZCutscene::GetBodySourceCode() const { std::string output = ""; - output += StringHelper::Sprintf(" CS_BEGIN_CUTSCENE(%i, %i),\n", commands.size(), endFrame); + output += StringHelper::Sprintf(" CS_BEGIN_CUTSCENE(%i, %i),\n", numCommands, endFrame); for (size_t i = 0; i < commands.size(); i++) { @@ -32,7 +32,7 @@ std::string ZCutscene::GetBodySourceCode() const output += " " + cmd->GenerateSourceCode(); } - output += StringHelper::Sprintf(" CS_END(),", commands.size(), endFrame); + output += StringHelper::Sprintf(" CS_END(),"); return output; } @@ -323,7 +323,7 @@ CutsceneCommand* ZCutscene::GetCommandMM(uint32_t id, offset_t currentPtr) const return new CutsceneMMCommand_Text(rawData, currentPtr); case CutsceneMM_CommandType::CS_CMD_CAMERA_SPLINE: - return new CutsceneMMCommand_Camera(rawData, currentPtr); + return new CutsceneMMCommand_Spline(rawData, currentPtr); case CutsceneMM_CommandType::CS_CMD_TRANSITION_GENERAL: return new CutsceneMMCommand_TransitionGeneral(rawData, currentPtr); @@ -372,3 +372,36 @@ ZResourceType ZCutscene::GetResourceType() const { return ZResourceType::Cutscene; } + +std::string ZCutscene::GetCsEncodedFloat(float f, CsFloatType type, bool useSciNotation) +{ + switch (type) + { + default: + // This default case will NEVER be reached, but GCC still gives a warning. + case CsFloatType::HexOnly: + { + uint32_t i; + std::memcpy(&i, &f, sizeof(i)); + return StringHelper::Sprintf("0x%08X", i); + } + case CsFloatType::FloatOnly: + { + if (useSciNotation) + { + return StringHelper::Sprintf("%.8ef", f); + } + return StringHelper::Sprintf("%ff", f); + } + case CsFloatType::HexAndFloat: + { + uint32_t i; + std::memcpy(&i, &f, sizeof(i)); + if (useSciNotation) + { + return StringHelper::Sprintf("CS_FLOAT(0x%08X, %.8ef)", i, f); + } + return StringHelper::Sprintf("CS_FLOAT(0x%08X, %ff)", i, f); + } + } +} diff --git a/tools/ZAPD/ZAPD/ZCutscene.h b/tools/ZAPD/ZAPD/ZCutscene.h index 5b54426ce..5dbf475c3 100644 --- a/tools/ZAPD/ZAPD/ZCutscene.h +++ b/tools/ZAPD/ZAPD/ZCutscene.h @@ -10,6 +10,8 @@ #include "ZFile.h" #include "ZResource.h" +enum class CsFloatType; + class ZCutscene : public ZResource { public: @@ -27,6 +29,8 @@ public: std::string GetSourceTypeName() const override; ZResourceType GetResourceType() const override; + static std::string GetCsEncodedFloat(float f, CsFloatType type, bool useSciNotation); + int32_t numCommands; int32_t endFrame; std::vector commands; diff --git a/tools/ZAPD/ZAPD/ZResource.h b/tools/ZAPD/ZAPD/ZResource.h index 975401398..768b78544 100644 --- a/tools/ZAPD/ZAPD/ZResource.h +++ b/tools/ZAPD/ZAPD/ZResource.h @@ -55,6 +55,10 @@ enum class ZResourceType Vector, Vertex, Waterbox, + KeyFrameFlexLimb, + KeyFrameStandardLimb, + KeyFrameSkel, + KeyFrameAnimation, }; class ResourceAttribute diff --git a/tools/asm-differ/.github/workflows/black.yml b/tools/asm-differ/.github/workflows/black.yml deleted file mode 100644 index 889e89dc8..000000000 --- a/tools/asm-differ/.github/workflows/black.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: black - -on: - pull_request: - push: - -permissions: read-all - -jobs: - black: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: python3 -m pip install --user colorama watchdog levenshtein cxxfilt black==23.12.1 - - run: python3 -m black . diff --git a/tools/asm-differ/.github/workflows/check-poetry-lock.yml b/tools/asm-differ/.github/workflows/check-poetry-lock.yml deleted file mode 100644 index 6104770e9..000000000 --- a/tools/asm-differ/.github/workflows/check-poetry-lock.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: flake check - -on: - pull_request: - push: - -permissions: read-all - -jobs: - tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - # Install `nix` which is just a dead-simple way to get a stable `poetry` - # in scope. - - uses: cachix/install-nix-action@v20 - with: - github_access_token: ${{ secrets.GITHUB_TOKEN }} - # Check that poetry.lock is in sync with pyproject.toml - - run: nix run github:NixOS/nixpkgs/22.11#poetry -- lock --check diff --git a/tools/asm-differ/.github/workflows/unit-tests.yml b/tools/asm-differ/.github/workflows/unit-tests.yml deleted file mode 100644 index a77498adf..000000000 --- a/tools/asm-differ/.github/workflows/unit-tests.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: unit tests - -on: - pull_request: - push: - -permissions: read-all - -jobs: - tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - run: python3 -m pip install --user colorama watchdog levenshtein cxxfilt - - run: python3 test.py diff --git a/tools/asm-differ/.gitignore b/tools/asm-differ/.gitignore deleted file mode 100644 index 90df93b18..000000000 --- a/tools/asm-differ/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.mypy_cache/ -__pycache__/ -.vscode/ diff --git a/tools/asm-differ/.gitrepo b/tools/asm-differ/.gitrepo deleted file mode 100644 index b5dd9852e..000000000 --- a/tools/asm-differ/.gitrepo +++ /dev/null @@ -1,12 +0,0 @@ -; DO NOT EDIT (unless you know what you are doing) -; -; This subdirectory is a git "subrepo", and this file is maintained by the -; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme -; -[subrepo] - remote = git@github.com:simonlindholm/asm-differ.git - branch = main - commit = 11eee5916e4c7ee0cf1100c15034c3644de802ca - parent = 6d09437c2162a156a843f3f10b1f864437eee6ed - method = merge - cmdver = 0.4.6 diff --git a/tools/asm-differ/.pre-commit-config.yaml b/tools/asm-differ/.pre-commit-config.yaml deleted file mode 100644 index c926878c9..000000000 --- a/tools/asm-differ/.pre-commit-config.yaml +++ /dev/null @@ -1,5 +0,0 @@ -repos: -- repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.12.1 - hooks: - - id: black diff --git a/tools/asm-differ/LICENSE b/tools/asm-differ/LICENSE deleted file mode 100644 index cf1ab25da..000000000 --- a/tools/asm-differ/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to diff --git a/tools/asm-differ/README.md b/tools/asm-differ/README.md deleted file mode 100644 index 4e62b15b4..000000000 --- a/tools/asm-differ/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# asm-differ - -Nice differ for assembly code. Currently supports MIPS, PPC, AArch64, ARM32, SH2, SH4, and m68k; should be easy to hack to support other instruction sets. - -![](screenshot.png) - -## Dependencies - -- Python >= 3.6 -- `python3 -m pip install --user colorama watchdog levenshtein cxxfilt` (also `dataclasses` if on 3.6) - -## Usage - -Create a file `diff_settings.py` in some directory (see the one in this repo for an example). Then from that directory, run - -```bash -/path/to/diff.py [flags] (function|rom addr) -``` - -Recommended flags are `-mwo` (automatically run `make` on source file changes, and include symbols in diff). See `--help` for more details. - -### Tab completion - -[argcomplete](https://kislyuk.github.io/argcomplete/) can be optionally installed (with `python3 -m pip install argcomplete`) to enable tab completion in a bash shell, completing options and symbol names using the linker map. It also requires a bit more setup: - -If invoking the script **exactly** as `./diff.py`, the following should be added to the `.bashrc` according to argcomplete's instructions: - -```bash -eval "$(register-python-argcomplete ./diff.py)" -``` - -If that doesn't work, run `register-python-argcomplete ./diff.py` in your terminal and copy the output to `.bashrc`. - -If setup correctly (don't forget to restart the shell), `complete | grep ./diff.py` should output: - -```bash -complete -o bashdefault -o default -o nospace -F _python_argcomplete ./diff.py -``` - -Note for developers or for general troubleshooting: run `export _ARC_DEBUG=` to enable debug output during tab-completion, it may show otherwise silenced errors. Use `unset _ARC_DEBUG` or restart the terminal to disable. - -### Contributing - -Contributions are very welcome! Some notes on workflow: - -`black` is used for code formatting. You can either run `black diff.py` manually, or set up a pre-commit hook: -```bash -pip install pre-commit black -pre-commit install -``` - -Type annotations are used for all Python code. `mypy` should pass without any errors. - -PRs that skip the above are still welcome, however. - -The targeted Python version is 3.6. There are currently no tests. diff --git a/tools/asm-differ/diff-stylesheet.css b/tools/asm-differ/diff-stylesheet.css deleted file mode 100644 index 79da120da..000000000 --- a/tools/asm-differ/diff-stylesheet.css +++ /dev/null @@ -1,67 +0,0 @@ -table.diff { - border: none; - font-family: Monospace; - white-space: pre; -} -tr.data-ref { - background-color: gray; -} -.immediate { - color: lightblue; -} -.stack { - color: yellow; -} -.register { - color: yellow; -} -.delay-slot { - font-weight: bold; - color: gray; -} -.diff-change { - color: lightblue; -} -.diff-add { - color: green; -} -.diff-remove { - color: red; -} -.source-filename { - font-weight: bold; -} -.source-function { - font-weight: bold; - text-decoration: underline; -} -.source-other { - font-style: italic; -} -.rotation-0 { - color: magenta; -} -.rotation-1 { - color: cyan; -} -.rotation-2 { - color: green; -} -.rotation-3 { - color: red; -} -.rotation-4 { - color: yellow; -} -.rotation-5 { - color: pink; -} -.rotation-6 { - color: blue; -} -.rotation-7 { - color: lime; -} -.rotation-8 { - color: gray; -} diff --git a/tools/asm-differ/diff.py b/tools/asm-differ/diff.py deleted file mode 100755 index dcc219b74..000000000 --- a/tools/asm-differ/diff.py +++ /dev/null @@ -1,3763 +0,0 @@ -#!/usr/bin/env python3 -# PYTHON_ARGCOMPLETE_OK -import argparse -import enum -import sys -from typing import ( - Any, - Callable, - Dict, - Iterator, - List, - Match, - NoReturn, - Optional, - Pattern, - Set, - Tuple, - Type, - Union, -) - - -def fail(msg: str) -> NoReturn: - print(msg, file=sys.stderr) - sys.exit(1) - - -def static_assert_unreachable(x: NoReturn) -> NoReturn: - raise Exception("Unreachable! " + repr(x)) - - -class DiffMode(enum.Enum): - SINGLE = "single" - SINGLE_BASE = "single_base" - NORMAL = "normal" - THREEWAY_PREV = "3prev" - THREEWAY_BASE = "3base" - - -# ==== COMMAND-LINE ==== - -if __name__ == "__main__": - # Prefer to use diff_settings.py from the current working directory - sys.path.insert(0, ".") - try: - import diff_settings - except ModuleNotFoundError: - fail("Unable to find diff_settings.py in the same directory.") - sys.path.pop(0) - - try: - import argcomplete - except ModuleNotFoundError: - argcomplete = None - - parser = argparse.ArgumentParser( - description="Diff MIPS, PPC, AArch64, ARM32, SH2, SH4, or m68k assembly." - ) - - start_argument = parser.add_argument( - "start", - help="Function name or address to start diffing from.", - ) - - if argcomplete: - - def complete_symbol( - prefix: str, parsed_args: argparse.Namespace, **kwargs: object - ) -> List[str]: - if not prefix or prefix.startswith("-"): - # skip reading the map file, which would - # result in a lot of useless completions - return [] - config: Dict[str, Any] = {} - diff_settings.apply(config, parsed_args) # type: ignore - mapfile = config.get("mapfile") - if not mapfile: - return [] - completes = [] - with open(mapfile) as f: - data = f.read() - # assume symbols are prefixed by a space character - search = f" {prefix}" - pos = data.find(search) - while pos != -1: - # skip the space character in the search string - pos += 1 - # assume symbols are suffixed by either a space - # character or a (unix-style) line return - spacePos = data.find(" ", pos) - lineReturnPos = data.find("\n", pos) - if lineReturnPos == -1: - endPos = spacePos - elif spacePos == -1: - endPos = lineReturnPos - else: - endPos = min(spacePos, lineReturnPos) - if endPos == -1: - match = data[pos:] - pos = -1 - else: - match = data[pos:endPos] - pos = data.find(search, endPos) - completes.append(match) - return completes - - setattr(start_argument, "completer", complete_symbol) - - parser.add_argument( - "end", - nargs="?", - help="Address to end diff at.", - ) - parser.add_argument( - "-o", - dest="diff_obj", - action="store_true", - help="""Diff .o files rather than a whole binary. This makes it possible to - see symbol names. (Recommended)""", - ) - parser.add_argument( - "-f", - "--file", - dest="file", - type=str, - help="""File path for a file being diffed. When used the map - file isn't searched for the function given. Useful for dynamically - linked libraries.""", - ) - parser.add_argument( - "-e", - "--elf", - dest="diff_elf_symbol", - metavar="SYMBOL", - help="""Diff a given function in two ELFs, one being stripped and the other - one non-stripped. Requires objdump from binutils 2.33+.""", - ) - parser.add_argument( - "-c", - "--source", - dest="show_source", - action="store_true", - help="Show source code (if possible). Only works with -o or -e.", - ) - parser.add_argument( - "-C", - "--source-old-binutils", - dest="source_old_binutils", - action="store_true", - help="""Tweak --source handling to make it work with binutils < 2.33. - Implies --source.""", - ) - parser.add_argument( - "-j", - "--section", - dest="diff_section", - default=".text", - metavar="SECTION", - help="Diff restricted to a given output section.", - ) - parser.add_argument( - "-L", - "--line-numbers", - dest="show_line_numbers", - action="store_const", - const=True, - help="""Show source line numbers in output, when available. May be enabled by - default depending on diff_settings.py.""", - ) - parser.add_argument( - "--no-line-numbers", - dest="show_line_numbers", - action="store_const", - const=False, - help="Hide source line numbers in output.", - ) - parser.add_argument( - "--inlines", - dest="inlines", - action="store_true", - help="Show inline function calls (if possible). Only works with -o or -e.", - ) - parser.add_argument( - "--base-asm", - dest="base_asm", - metavar="FILE", - help="Read assembly from given file instead of configured base img.", - ) - parser.add_argument( - "--write-asm", - dest="write_asm", - metavar="FILE", - help="Write the current assembly output to file, e.g. for use with --base-asm.", - ) - parser.add_argument( - "-m", - "--make", - dest="make", - action="store_true", - help="Automatically run 'make' on the .o file or binary before diffing.", - ) - parser.add_argument( - "-l", - "--skip-lines", - dest="skip_lines", - metavar="LINES", - type=int, - default=0, - help="Skip the first LINES lines of output.", - ) - parser.add_argument( - "-s", - "--stop-at-ret", - dest="stop_at_ret", - action="count", - help="""Stop disassembling at the first return instruction. - You can also pass -ss to stop at the second return instruction, and so on.""", - ) - parser.add_argument( - "-i", - "--ignore-large-imms", - dest="ignore_large_imms", - action="store_true", - help="Pretend all large enough immediates are the same.", - ) - parser.add_argument( - "-I", - "--ignore-addr-diffs", - dest="ignore_addr_diffs", - action="store_true", - help="Ignore address differences. Currently only affects AArch64 and ARM32.", - ) - parser.add_argument( - "-B", - "--no-show-branches", - dest="show_branches", - action="store_false", - help="Don't visualize branches/branch targets.", - ) - parser.add_argument( - "-R", - "--no-show-rodata-refs", - dest="show_rodata_refs", - action="store_false", - help="Don't show .rodata -> .text references (typically from jump tables).", - ) - parser.add_argument( - "-S", - "--base-shift", - dest="base_shift", - metavar="N", - type=str, - default="0", - help="""Diff position N in our img against position N + shift in the base img. - Arithmetic is allowed, so e.g. |-S "0x1234 - 0x4321"| is a reasonable - flag to pass if it is known that position 0x1234 in the base img syncs - up with position 0x4321 in our img. Not supported together with -o.""", - ) - parser.add_argument( - "-w", - "--watch", - dest="watch", - action="store_true", - help="""Automatically update when source/object files change. - Recommended in combination with -m.""", - ) - parser.add_argument( - "-y", - "--yes", - dest="agree", - action="store_true", - help="""Automatically agree to any yes/no questions asked. - Useful if you really want to use the -w option without -m.""", - ) - parser.add_argument( - "-0", - "--diff_mode=single_base", - dest="diff_mode", - action="store_const", - const=DiffMode.SINGLE_BASE, - help="""View the base asm only (not a diff).""", - ) - parser.add_argument( - "-1", - "--diff_mode=single", - dest="diff_mode", - action="store_const", - const=DiffMode.SINGLE, - help="""View the current asm only (not a diff).""", - ) - parser.add_argument( - "-3", - "--threeway=prev", - dest="diff_mode", - action="store_const", - const=DiffMode.THREEWAY_PREV, - help="""Show a three-way diff between target asm, current asm, and asm - prior to -w rebuild. Requires -w.""", - ) - parser.add_argument( - "-b", - "--threeway=base", - dest="diff_mode", - action="store_const", - const=DiffMode.THREEWAY_BASE, - help="""Show a three-way diff between target asm, current asm, and asm - when diff.py was started. Requires -w.""", - ) - parser.add_argument( - "--width", - dest="column_width", - metavar="COLS", - type=int, - default=50, - help="Sets the width of the left and right view column.", - ) - parser.add_argument( - "--algorithm", - dest="algorithm", - default="levenshtein", - choices=["levenshtein", "difflib"], - help="""Diff algorithm to use. Levenshtein gives the minimum diff, while difflib - aims for long sections of equal opcodes. Defaults to %(default)s.""", - ) - parser.add_argument( - "--max-size", - "--max-lines", - metavar="LINES", - dest="max_lines", - type=int, - default=1024, - help="The maximum length of the diff, in lines.", - ) - parser.add_argument( - "--no-pager", - dest="no_pager", - action="store_true", - help="""Disable the pager; write output directly to stdout, then exit. - Incompatible with --watch.""", - ) - parser.add_argument( - "--format", - choices=("color", "plain", "html", "json"), - default="color", - help="Output format, default is color. --format=html or json implies --no-pager.", - ) - parser.add_argument( - "-U", - "--compress-matching", - metavar="N", - dest="compress_matching", - type=int, - help="""Compress streaks of matching lines, leaving N lines of context - around non-matching parts.""", - ) - parser.add_argument( - "-V", - "--compress-sameinstr", - metavar="N", - dest="compress_sameinstr", - type=int, - help="""Compress streaks of lines with same instructions (but possibly - different regalloc), leaving N lines of context around other parts.""", - ) - - # Project-specific flags, e.g. different versions/make arguments. - add_custom_arguments_fn = getattr(diff_settings, "add_custom_arguments", None) - if add_custom_arguments_fn: - add_custom_arguments_fn(parser) - - if argcomplete: - argcomplete.autocomplete(parser) - -# ==== IMPORTS ==== - -# (We do imports late to optimize auto-complete performance.) - -import abc -from collections import Counter, defaultdict -from dataclasses import asdict, dataclass, field, replace -import difflib -import html -import itertools -import json -import os -import queue -import re -import string -import struct -import subprocess -import threading -import time -import traceback - - -MISSING_PREREQUISITES = ( - "Missing prerequisite python module {}. " - "Run `python3 -m pip install --user colorama watchdog levenshtein cxxfilt` to install prerequisites (cxxfilt only needed with --source)." -) - -try: - from colorama import Back, Fore, Style - import watchdog -except ModuleNotFoundError as e: - fail(MISSING_PREREQUISITES.format(e.name)) - -# ==== CONFIG ==== - - -@dataclass -class ProjectSettings: - arch_str: str - objdump_executable: str - objdump_flags: List[str] - build_command: List[str] - map_format: str - build_dir: str - map_address_offset: int - baseimg: Optional[str] - myimg: Optional[str] - mapfile: Optional[str] - source_directories: Optional[List[str]] - source_extensions: List[str] - show_line_numbers_default: bool - disassemble_all: bool - reg_categories: Dict[str, int] - expected_dir: str - - -@dataclass -class Compress: - context: int - same_instr: bool - - -@dataclass -class Config: - arch: "ArchSettings" - - # Build/objdump options - diff_obj: bool - file: Optional[str] - make: bool - source_old_binutils: bool - diff_section: str - inlines: bool - max_function_size_lines: int - max_function_size_bytes: int - - # Display options - formatter: "Formatter" - diff_mode: DiffMode - base_shift: int - skip_lines: int - compress: Optional[Compress] - show_rodata_refs: bool - show_branches: bool - show_line_numbers: bool - show_source: bool - stop_at_ret: Optional[int] - ignore_large_imms: bool - ignore_addr_diffs: bool - algorithm: str - reg_categories: Dict[str, int] - - # Score options - score_stack_differences = True - penalty_stackdiff = 1 - penalty_regalloc = 5 - penalty_reordering = 60 - penalty_insertion = 100 - penalty_deletion = 100 - - -def create_project_settings(settings: Dict[str, Any]) -> ProjectSettings: - return ProjectSettings( - arch_str=settings.get("arch", "mips"), - baseimg=settings.get("baseimg"), - myimg=settings.get("myimg"), - mapfile=settings.get("mapfile"), - build_command=settings.get( - "make_command", ["make", *settings.get("makeflags", [])] - ), - source_directories=settings.get("source_directories"), - source_extensions=settings.get( - "source_extensions", [".c", ".h", ".cpp", ".hpp", ".s"] - ), - objdump_executable=get_objdump_executable(settings.get("objdump_executable")), - objdump_flags=settings.get("objdump_flags", []), - expected_dir=settings.get("expected_dir", "expected/"), - map_format=settings.get("map_format", "gnu"), - map_address_offset=settings.get( - "map_address_offset", settings.get("ms_map_address_offset", 0) - ), - build_dir=settings.get("build_dir", settings.get("mw_build_dir", "build/")), - show_line_numbers_default=settings.get("show_line_numbers_default", True), - disassemble_all=settings.get("disassemble_all", False), - reg_categories=settings.get("reg_categories", {}), - ) - - -def create_config(args: argparse.Namespace, project: ProjectSettings) -> Config: - arch = get_arch(project.arch_str) - - formatter: Formatter - if args.format == "plain": - formatter = PlainFormatter(column_width=args.column_width) - elif args.format == "color": - formatter = AnsiFormatter(column_width=args.column_width) - elif args.format == "html": - formatter = HtmlFormatter() - elif args.format == "json": - formatter = JsonFormatter(arch_str=arch.name) - else: - raise ValueError(f"Unsupported --format: {args.format}") - - compress = None - if args.compress_matching is not None: - compress = Compress(args.compress_matching, False) - if args.compress_sameinstr is not None: - if compress is not None: - raise ValueError( - "Cannot pass both --compress-matching and --compress-sameinstr" - ) - compress = Compress(args.compress_sameinstr, True) - - show_line_numbers = args.show_line_numbers - if show_line_numbers is None: - show_line_numbers = project.show_line_numbers_default - - return Config( - arch=arch, - # Build/objdump options - diff_obj=args.diff_obj, - file=args.file, - make=args.make, - source_old_binutils=args.source_old_binutils, - diff_section=args.diff_section, - inlines=args.inlines, - max_function_size_lines=args.max_lines, - max_function_size_bytes=args.max_lines * 4, - # Display options - formatter=formatter, - diff_mode=args.diff_mode or DiffMode.NORMAL, - base_shift=eval_int( - args.base_shift, "Failed to parse --base-shift (-S) argument as an integer." - ), - skip_lines=args.skip_lines, - compress=compress, - show_rodata_refs=args.show_rodata_refs, - show_branches=args.show_branches, - show_line_numbers=show_line_numbers, - show_source=args.show_source or args.source_old_binutils, - stop_at_ret=args.stop_at_ret, - ignore_large_imms=args.ignore_large_imms, - ignore_addr_diffs=args.ignore_addr_diffs, - algorithm=args.algorithm, - reg_categories=project.reg_categories, - ) - - -def get_objdump_executable(objdump_executable: Optional[str]) -> str: - if objdump_executable is not None: - return objdump_executable - - objdump_candidates = [ - "mips-linux-gnu-objdump", - "mips64-elf-objdump", - "mips-elf-objdump", - "sh-elf-objdump", - "sh4-linux-gnu-objdump", - "m68k-elf-objdump", - ] - for objdump_cand in objdump_candidates: - try: - subprocess.check_call( - [objdump_cand, "--version"], - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, - ) - return objdump_cand - except subprocess.CalledProcessError: - pass - except FileNotFoundError: - pass - - return fail( - f"Missing binutils; please ensure {' or '.join(objdump_candidates)} exists, or configure objdump_executable." - ) - - -def get_arch(arch_str: str) -> "ArchSettings": - for settings in ARCH_SETTINGS: - if arch_str == settings.name: - return settings - raise ValueError(f"Unknown architecture: {arch_str}") - - -BUFFER_CMD: List[str] = ["tail", "-c", str(10**9)] - -# -S truncates long lines instead of wrapping them -# -R interprets color escape sequences -# -i ignores case when searching -# -c something about how the screen gets redrawn; I don't remember the purpose -# -#6 makes left/right arrow keys scroll by 6 characters -LESS_CMD: List[str] = ["less", "-SRic", "-+F", "-+X", "-#6"] - -DEBOUNCE_DELAY: float = 0.1 - -# ==== FORMATTING ==== - - -@enum.unique -class BasicFormat(enum.Enum): - NONE = enum.auto() - IMMEDIATE = enum.auto() - STACK = enum.auto() - REGISTER = enum.auto() - REGISTER_CATEGORY = enum.auto() - DELAY_SLOT = enum.auto() - DIFF_CHANGE = enum.auto() - DIFF_ADD = enum.auto() - DIFF_REMOVE = enum.auto() - SOURCE_FILENAME = enum.auto() - SOURCE_FUNCTION = enum.auto() - SOURCE_LINE_NUM = enum.auto() - SOURCE_OTHER = enum.auto() - - -@dataclass(frozen=True) -class RotationFormat: - group: str - index: int - key: str - - -Format = Union[BasicFormat, RotationFormat] -FormatFunction = Callable[[str], Format] - - -class Text: - segments: List[Tuple[str, Format]] - - def __init__(self, line: str = "", f: Format = BasicFormat.NONE) -> None: - self.segments = [(line, f)] if line else [] - - def reformat(self, f: Format) -> "Text": - return Text(self.plain(), f) - - def plain(self) -> str: - return "".join(s for s, f in self.segments) - - def __repr__(self) -> str: - return f"" - - def __bool__(self) -> bool: - return any(s for s, f in self.segments) - - def __str__(self) -> str: - # Use Formatter.apply(...) instead - return NotImplemented - - def __eq__(self, other: object) -> bool: - return NotImplemented - - def __add__(self, other: Union["Text", str]) -> "Text": - if isinstance(other, str): - other = Text(other) - result = Text() - # If two adjacent segments have the same format, merge their lines - if ( - self.segments - and other.segments - and self.segments[-1][1] == other.segments[0][1] - ): - result.segments = ( - self.segments[:-1] - + [(self.segments[-1][0] + other.segments[0][0], self.segments[-1][1])] - + other.segments[1:] - ) - else: - result.segments = self.segments + other.segments - return result - - def __radd__(self, other: Union["Text", str]) -> "Text": - if isinstance(other, str): - other = Text(other) - return other + self - - def finditer(self, pat: Pattern[str]) -> Iterator[Match[str]]: - """Replacement for `pat.finditer(text)` that operates on the inner text, - and returns the exact same matches as `Text.sub(pat, ...)`.""" - for chunk, f in self.segments: - for match in pat.finditer(chunk): - yield match - - def sub(self, pat: Pattern[str], sub_fn: Callable[[Match[str]], "Text"]) -> "Text": - result = Text() - for chunk, f in self.segments: - i = 0 - for match in pat.finditer(chunk): - start, end = match.start(), match.end() - assert i <= start <= end <= len(chunk) - sub = sub_fn(match) - if i != start: - result.segments.append((chunk[i:start], f)) - result.segments.extend(sub.segments) - i = end - if chunk[i:]: - result.segments.append((chunk[i:], f)) - return result - - def ljust(self, column_width: int) -> "Text": - length = sum(len(x) for x, _ in self.segments) - return self + " " * max(column_width - length, 0) - - -@dataclass -class TableLine: - key: Optional[str] - is_data_ref: bool - cells: Tuple[Tuple[Text, Optional["Line"]], ...] - - -@dataclass -class TableData: - headers: Tuple[Text, ...] - current_score: int - max_score: int - previous_score: Optional[int] - lines: List[TableLine] - - -class Formatter(abc.ABC): - @abc.abstractmethod - def apply_format(self, chunk: str, f: Format) -> str: - """Apply the formatting `f` to `chunk` and escape the contents.""" - ... - - @abc.abstractmethod - def table(self, data: TableData) -> str: - """Format a multi-column table with metadata""" - ... - - def apply(self, text: Text) -> str: - return "".join(self.apply_format(chunk, f) for chunk, f in text.segments) - - @staticmethod - def outputline_texts(line: TableLine) -> Tuple[Text, ...]: - return tuple(cell[0] for cell in line.cells) - - -@dataclass -class PlainFormatter(Formatter): - column_width: int - - def apply_format(self, chunk: str, f: Format) -> str: - return chunk - - def table(self, data: TableData) -> str: - rows = [data.headers] + [self.outputline_texts(line) for line in data.lines] - return "\n".join( - "".join(self.apply(x.ljust(self.column_width)) for x in row) for row in rows - ) - - -@dataclass -class AnsiFormatter(Formatter): - # Additional ansi escape codes not in colorama. See: - # https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters - STYLE_UNDERLINE = "\x1b[4m" - STYLE_NO_UNDERLINE = "\x1b[24m" - STYLE_INVERT = "\x1b[7m" - STYLE_RESET = "\x1b[0m" - - BASIC_ANSI_CODES = { - BasicFormat.NONE: "", - BasicFormat.IMMEDIATE: Fore.LIGHTBLUE_EX, - BasicFormat.STACK: Fore.YELLOW, - BasicFormat.REGISTER: Fore.YELLOW, - BasicFormat.REGISTER_CATEGORY: Fore.LIGHTYELLOW_EX, - BasicFormat.DIFF_CHANGE: Fore.LIGHTBLUE_EX, - BasicFormat.DIFF_ADD: Fore.GREEN, - BasicFormat.DIFF_REMOVE: Fore.RED, - BasicFormat.SOURCE_FILENAME: Style.DIM + Style.BRIGHT, - BasicFormat.SOURCE_FUNCTION: Style.DIM + Style.BRIGHT + STYLE_UNDERLINE, - BasicFormat.SOURCE_LINE_NUM: Fore.LIGHTBLACK_EX, - BasicFormat.SOURCE_OTHER: Style.DIM, - } - - BASIC_ANSI_CODES_UNDO = { - BasicFormat.NONE: "", - BasicFormat.SOURCE_FILENAME: Style.NORMAL, - BasicFormat.SOURCE_FUNCTION: Style.NORMAL + STYLE_NO_UNDERLINE, - BasicFormat.SOURCE_OTHER: Style.NORMAL, - } - - ROTATION_ANSI_COLORS = [ - Fore.MAGENTA, - Fore.CYAN, - Fore.GREEN, - Fore.RED, - Fore.LIGHTYELLOW_EX, - Fore.LIGHTMAGENTA_EX, - Fore.LIGHTCYAN_EX, - Fore.LIGHTGREEN_EX, - Fore.LIGHTBLACK_EX, - ] - - column_width: int - - def apply_format(self, chunk: str, f: Format) -> str: - if f == BasicFormat.NONE: - return chunk - undo_ansi_code = Fore.RESET - if isinstance(f, BasicFormat): - ansi_code = self.BASIC_ANSI_CODES[f] - undo_ansi_code = self.BASIC_ANSI_CODES_UNDO.get(f, undo_ansi_code) - elif isinstance(f, RotationFormat): - ansi_code = self.ROTATION_ANSI_COLORS[ - f.index % len(self.ROTATION_ANSI_COLORS) - ] - else: - static_assert_unreachable(f) - return f"{ansi_code}{chunk}{undo_ansi_code}" - - def table(self, data: TableData) -> str: - rows = [(data.headers, False)] + [ - ( - self.outputline_texts(line), - line.is_data_ref, - ) - for line in data.lines - ] - return "\n".join( - "".join( - (self.STYLE_INVERT if is_data_ref else "") - + self.apply(x.ljust(self.column_width)) - + (self.STYLE_RESET if is_data_ref else "") - for x in row - ) - for (row, is_data_ref) in rows - ) - - -@dataclass -class HtmlFormatter(Formatter): - rotation_formats: int = 9 - - def apply_format(self, chunk: str, f: Format) -> str: - chunk = html.escape(chunk) - if f == BasicFormat.NONE: - return chunk - if isinstance(f, BasicFormat): - class_name = f.name.lower().replace("_", "-") - data_attr = "" - elif isinstance(f, RotationFormat): - class_name = f"rotation-{f.index % self.rotation_formats}" - rotation_key = html.escape(f"{f.group};{f.key}", quote=True) - data_attr = f'data-rotation="{rotation_key}"' - else: - static_assert_unreachable(f) - return f"{chunk}" - - def table(self, data: TableData) -> str: - def table_row(line: Tuple[Text, ...], is_data_ref: bool, cell_el: str) -> str: - tr_attrs = " class='data-ref'" if is_data_ref else "" - output_row = f" " - for cell in line: - cell_html = self.apply(cell) - output_row += f"<{cell_el}>{cell_html}" - output_row += "\n" - return output_row - - output = "\n" - output += " \n" - output += table_row(data.headers, False, "th") - output += " \n" - output += " \n" - output += "".join( - table_row(self.outputline_texts(line), line.is_data_ref, "td") - for line in data.lines - ) - output += " \n" - output += "
\n" - return output - - -@dataclass -class JsonFormatter(Formatter): - arch_str: str - - def apply_format(self, chunk: str, f: Format) -> str: - # This method is unused by this formatter - return NotImplemented - - def table(self, data: TableData) -> str: - def serialize_format(s: str, f: Format) -> Dict[str, Any]: - if f == BasicFormat.NONE: - return {"text": s} - elif isinstance(f, BasicFormat): - return {"text": s, "format": f.name.lower()} - elif isinstance(f, RotationFormat): - attrs = asdict(f) - attrs.update({"text": s, "format": "rotation"}) - return attrs - else: - static_assert_unreachable(f) - - def serialize(text: Optional[Text]) -> List[Dict[str, Any]]: - if text is None: - return [] - return [serialize_format(s, f) for s, f in text.segments] - - output: Dict[str, Any] = {} - output["arch_str"] = self.arch_str - output["header"] = { - name: serialize(h) - for h, name in zip(data.headers, ("base", "current", "previous")) - } - output["current_score"] = data.current_score - output["max_score"] = data.max_score - if data.previous_score is not None: - output["previous_score"] = data.previous_score - output_rows: List[Dict[str, Any]] = [] - for row in data.lines: - output_row: Dict[str, Any] = {} - output_row["key"] = row.key - output_row["is_data_ref"] = row.is_data_ref - iters: List[Tuple[str, Text, Optional[Line]]] = [ - (label, *cell) - for label, cell in zip(("base", "current", "previous"), row.cells) - ] - if all(line is None for _, _, line in iters): - # Skip rows that were only for displaying source code - continue - for column_name, text, line in iters: - column: Dict[str, Any] = {} - column["text"] = serialize(text) - if line: - if line.line_num is not None: - column["line"] = line.line_num - if line.branch_target is not None: - column["branch"] = line.branch_target - if line.source_lines: - column["src"] = line.source_lines - if line.comment is not None: - column["src_comment"] = line.comment - if line.source_line_num is not None: - column["src_line"] = line.source_line_num - if line or column["text"]: - output_row[column_name] = column - output_rows.append(output_row) - output["rows"] = output_rows - return json.dumps(output) - - -def format_fields( - pat: Pattern[str], - out1: Text, - out2: Text, - color1: FormatFunction, - color2: Optional[FormatFunction] = None, -) -> Tuple[Text, Text]: - diffs = [ - of.group() != nf.group() - for (of, nf) in zip(out1.finditer(pat), out2.finditer(pat)) - ] - - it = iter(diffs) - - def maybe_color(color: FormatFunction, s: str) -> Text: - return Text(s, color(s)) if next(it, False) else Text(s) - - out1 = out1.sub(pat, lambda m: maybe_color(color1, m.group())) - it = iter(diffs) - out2 = out2.sub(pat, lambda m: maybe_color(color2 or color1, m.group())) - - return out1, out2 - - -def symbol_formatter(group: str, base_index: int) -> FormatFunction: - symbol_formats: Dict[str, Format] = {} - - def symbol_format(s: str) -> Format: - # TODO: it would be nice to use a unique Format for each symbol, so we could - # add extra UI elements in the HTML version - f = symbol_formats.get(s) - if f is None: - index = len(symbol_formats) + base_index - f = RotationFormat(key=s, index=index, group=group) - symbol_formats[s] = f - return f - - return symbol_format - - -# ==== LOGIC ==== - -ObjdumpCommand = Tuple[List[str], str, Optional[str]] - -# eval_expr adapted from https://stackoverflow.com/a/9558001 - -import ast -import operator as op - -operators: Dict[Type[Union[ast.operator, ast.unaryop]], Any] = { - ast.Add: op.add, - ast.Sub: op.sub, - ast.Mult: op.mul, - ast.Div: op.floordiv, - ast.USub: op.neg, - ast.Pow: op.pow, - ast.BitXor: op.xor, - ast.BitOr: op.or_, - ast.BitAnd: op.and_, - ast.Invert: op.inv, -} - - -def eval_expr(expr: str) -> Any: - return eval_(ast.parse(expr, mode="eval").body) - - -def eval_(node: ast.AST) -> Any: - if ( - hasattr(ast, "Constant") - and isinstance(node, ast.Constant) - and isinstance(node.value, int) - ): # Python 3.8+ - return node.value - elif isinstance(node, ast.BinOp): - return operators[type(node.op)](eval_(node.left), eval_(node.right)) - elif isinstance(node, ast.UnaryOp): - return operators[type(node.op)](eval_(node.operand)) - elif sys.version_info < (3, 8) and isinstance(node, ast.Num): - return node.n - else: - raise TypeError(node) - - -def maybe_eval_int(expr: str) -> Optional[int]: - try: - ret = eval_expr(expr) - if not isinstance(ret, int): - raise Exception("not an integer") - return ret - except Exception: - return None - - -def eval_int(expr: str, emsg: str) -> int: - ret = maybe_eval_int(expr) - if ret is None: - fail(emsg) - return ret - - -def eval_line_num(expr: str) -> Optional[int]: - expr = expr.strip().replace(":", "") - if expr == "": - return None - return int(expr, 16) - - -def run_make(target: str, project: ProjectSettings) -> None: - subprocess.check_call(project.build_command + [target]) - - -def run_make_capture_output( - target: str, project: ProjectSettings -) -> "subprocess.CompletedProcess[bytes]": - return subprocess.run( - project.build_command + [target], - stderr=subprocess.PIPE, - stdout=subprocess.PIPE, - ) - - -def restrict_to_function(dump: str, fn_name: str) -> str: - try: - ind = dump.index("\n", dump.index(f"<{fn_name}>:")) - return dump[ind + 1 :] - except ValueError: - return "" - - -def serialize_rodata_references(references: List[Tuple[int, int, str]]) -> str: - return "".join( - f"DATAREF {text_offset} {from_offset} {from_section}\n" - for (text_offset, from_offset, from_section) in references - ) - - -def maybe_get_objdump_source_flags(config: Config) -> List[str]: - flags = [] - - if config.show_line_numbers or config.show_source: - flags.append("--line-numbers") - - if config.show_source: - flags.append("--source") - - if not config.source_old_binutils: - flags.append("--source-comment=│ ") - - if config.inlines: - flags.append("--inlines") - - return flags - - -def run_objdump(cmd: ObjdumpCommand, config: Config, project: ProjectSettings) -> str: - flags, target, restrict = cmd - try: - out = subprocess.run( - [project.objdump_executable] - + config.arch.arch_flags - + project.objdump_flags - + flags - + [target], - check=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - universal_newlines=True, - ).stdout - except subprocess.CalledProcessError as e: - print(e.stdout) - print(e.stderr) - if "unrecognized option '--source-comment" in e.stderr: - fail("** Try using --source-old-binutils instead of --source **") - raise e - - obj_data: Optional[bytes] = None - if config.diff_obj: - with open(target, "rb") as f: - obj_data = f.read() - - return preprocess_objdump_out(restrict, obj_data, out, config) - - -def preprocess_objdump_out( - restrict: Optional[str], obj_data: Optional[bytes], objdump_out: str, config: Config -) -> str: - """ - Preprocess the output of objdump into a format that `process()` expects. - This format is suitable for saving to disk with `--write-asm`. - - - Optionally filter the output to a single function (`restrict`) - - Otherwise, strip objdump header (7 lines) - - Prepend .data references ("DATAREF" lines) when working with object files - """ - out = objdump_out - - if restrict is not None: - out = restrict_to_function(out, restrict) - else: - for i in range(7): - out = out[out.find("\n") + 1 :] - out = out.rstrip("\n") - - if obj_data and config.show_rodata_refs: - out = ( - serialize_rodata_references(parse_elf_rodata_references(obj_data, config)) - + out - ) - - return out - - -def search_build_objects(objname: str, project: ProjectSettings) -> Optional[str]: - objfiles = [ - os.path.join(dirpath, f) - for dirpath, _, filenames in os.walk(project.build_dir) - for f in filenames - if f == objname - ] - if len(objfiles) > 1: - all_objects = "\n".join(objfiles) - fail( - f"Found multiple objects of the same name {objname} in {project.build_dir}, " - f"cannot determine which to diff against: \n{all_objects}" - ) - if len(objfiles) == 1: - return objfiles[0] - - return None - - -def search_map_file( - fn_name: str, project: ProjectSettings, config: Config, *, for_binary: bool -) -> Tuple[Optional[str], Optional[int]]: - if not project.mapfile: - fail(f"No map file configured; cannot find function {fn_name}.") - - try: - with open(project.mapfile) as f: - contents = f.read() - except Exception: - fail(f"Failed to open map file {project.mapfile} for reading.") - - if project.map_format == "gnu": - if for_binary and "load address" not in contents: - fail( - 'Failed to find "load address" in map file. Maybe you need to add\n' - '"export LANG := C" to your Makefile to avoid localized output?' - ) - - lines = contents.split("\n") - - try: - cur_objfile = None - ram_to_rom = None - cands = [] - last_line = "" - for line in lines: - if line.startswith(" " + config.diff_section): - cur_objfile = line.split()[3] - if "load address" in line: - tokens = last_line.split() + line.split() - ram = int(tokens[1], 0) - rom = int(tokens[5], 0) - ram_to_rom = rom - ram - if line.endswith(" " + fn_name) or f" {fn_name} = 0x" in line: - ram = int(line.split()[0], 0) - if (for_binary and ram_to_rom is not None) or ( - not for_binary and cur_objfile is not None - ): - cands.append((cur_objfile, ram + (ram_to_rom or 0))) - last_line = line - except Exception as e: - traceback.print_exc() - fail(f"Internal error while parsing map file") - - if len(cands) > 1: - fail(f"Found multiple occurrences of function {fn_name} in map file.") - if len(cands) == 1: - return cands[0] - elif project.map_format == "mw": - find = re.findall( - # ram elf rom alignment - r" \S+ \S+ (\S+) (\S+) +\S+ " - + re.escape(fn_name) - + r"(?: \(entry of " - + re.escape(config.diff_section) - + r"\))? \t" - # object name - + r"(\S+)", - contents, - ) - if len(find) > 1: - fail(f"Found multiple occurrences of function {fn_name} in map file.") - if len(find) == 1: - rom = int(find[0][1], 16) - objname = find[0][2] - objfile = search_build_objects(objname, project) - - # TODO Currently the ram-rom conversion only works for diffing ELF - # executables, but it would likely be more convenient to diff DOLs. - # At this time it is recommended to always use -o when running the diff - # script as this mode does not make use of the ram-rom conversion. - if objfile is not None: - return objfile, rom - elif project.map_format == "ms": - load_address_find = re.search( - r"Preferred load address is ([0-9a-f]+)", - contents, - ) - if not load_address_find: - fail(f"Couldn't find module load address in map file.") - load_address = int(load_address_find.group(1), 16) - - diff_segment_find = re.search( - r"([0-9a-f]+):[0-9a-f]+ [0-9a-f]+H " + re.escape(config.diff_section), - contents, - ) - if not diff_segment_find: - fail(f"Couldn't find segment for section in map file.") - diff_segment = diff_segment_find.group(1) - - find = re.findall( - r" (?:" - + re.escape(diff_segment) - + r")\S+\s+(?:" - + re.escape(fn_name) - + r")\s+\S+ ... \S+", - contents, - ) - if len(find) > 1: - fail(f"Found multiple occurrences of function {fn_name} in map file.") - if len(find) == 1: - names_find = re.search(r"(\S+) ... (\S+)", find[0]) - assert names_find is not None - fileofs = int(names_find.group(1), 16) - load_address - if for_binary: - return None, fileofs - - objname = names_find.group(2) - objfile = search_build_objects(objname, project) - if objfile is not None: - return objfile, fileofs - else: - fail(f"Linker map format {project.map_format} unrecognised.") - return None, None - - -def parse_elf_rodata_references( - data: bytes, config: Config -) -> List[Tuple[int, int, str]]: - e_ident = data[:16] - if e_ident[:4] != b"\x7FELF": - return [] - - SHT_SYMTAB = 2 - SHT_REL = 9 - SHT_RELA = 4 - R_MIPS_32 = 2 - R_MIPS_GPREL32 = 12 - - is_32bit = e_ident[4] == 1 - is_little_endian = e_ident[5] == 1 - str_end = "<" if is_little_endian else ">" - str_off = "I" if is_32bit else "Q" - - def read(spec: str, offset: int) -> Tuple[int, ...]: - spec = spec.replace("P", str_off) - size = struct.calcsize(spec) - return struct.unpack(str_end + spec, data[offset : offset + size]) - - ( - e_type, - e_machine, - e_version, - e_entry, - e_phoff, - e_shoff, - e_flags, - e_ehsize, - e_phentsize, - e_phnum, - e_shentsize, - e_shnum, - e_shstrndx, - ) = read("HHIPPPIHHHHHH", 16) - if e_type != 1: # relocatable - return [] - assert e_shoff != 0 - assert e_shnum != 0 # don't support > 0xFF00 sections - assert e_shstrndx != 0 - - @dataclass - class Section: - sh_name: int - sh_type: int - sh_flags: int - sh_addr: int - sh_offset: int - sh_size: int - sh_link: int - sh_info: int - sh_addralign: int - sh_entsize: int - - sections = [ - Section(*read("IIPPPPIIPP", e_shoff + i * e_shentsize)) for i in range(e_shnum) - ] - shstr = sections[e_shstrndx] - sec_name_offs = [shstr.sh_offset + s.sh_name for s in sections] - sec_names = [data[offset : data.index(b"\0", offset)] for offset in sec_name_offs] - - symtab_sections = [i for i in range(e_shnum) if sections[i].sh_type == SHT_SYMTAB] - assert len(symtab_sections) == 1 - symtab = sections[symtab_sections[0]] - - section_name = config.diff_section.encode("utf-8") - text_sections = [ - i - for i in range(e_shnum) - if sec_names[i] == section_name and sections[i].sh_size != 0 - ] - if len(text_sections) != 1: - return [] - text_section = text_sections[0] - - ret: List[Tuple[int, int, str]] = [] - for s in sections: - if s.sh_type == SHT_REL or s.sh_type == SHT_RELA: - if s.sh_info == text_section: - # Skip section_name -> section_name references - continue - sec_name = sec_names[s.sh_info].decode("latin1") - if sec_name not in (".rodata", ".late_rodata"): - continue - sec_base = sections[s.sh_info].sh_offset - for i in range(0, s.sh_size, s.sh_entsize): - if s.sh_type == SHT_REL: - r_offset, r_info = read("PP", s.sh_offset + i) - else: - r_offset, r_info, r_addend = read("PPP", s.sh_offset + i) - - if is_32bit: - r_sym = r_info >> 8 - r_type = r_info & 0xFF - sym_offset = symtab.sh_offset + symtab.sh_entsize * r_sym - st_name, st_value, st_size, st_info, st_other, st_shndx = read( - "IIIBBH", sym_offset - ) - else: - r_sym = r_info >> 32 - r_type = r_info & 0xFFFFFFFF - sym_offset = symtab.sh_offset + symtab.sh_entsize * r_sym - st_name, st_info, st_other, st_shndx, st_value, st_size = read( - "IBBHQQ", sym_offset - ) - if st_shndx == text_section: - if s.sh_type == SHT_REL: - if e_machine == 8 and r_type in (R_MIPS_32, R_MIPS_GPREL32): - (r_addend,) = read("I", sec_base + r_offset) - else: - continue - text_offset = (st_value + r_addend) & 0xFFFFFFFF - ret.append((text_offset, r_offset, sec_name)) - return ret - - -def dump_elf( - start: str, - end: Optional[str], - diff_elf_symbol: str, - config: Config, - project: ProjectSettings, -) -> Tuple[str, ObjdumpCommand, ObjdumpCommand]: - if not project.baseimg or not project.myimg: - fail("Missing myimg/baseimg in config.") - if config.base_shift: - fail("--base-shift not compatible with -e") - - start_addr = eval_int(start, "Start address must be an integer expression.") - - if end is not None: - end_addr = eval_int(end, "End address must be an integer expression.") - else: - end_addr = start_addr + config.max_function_size_bytes - - flags1 = [ - f"--start-address={start_addr}", - f"--stop-address={end_addr}", - ] - - if project.disassemble_all: - disassemble_flag = "-D" - else: - disassemble_flag = "-d" - - flags2 = [ - f"--disassemble={diff_elf_symbol}", - ] - - objdump_flags = [disassemble_flag, "-rz", "-j", config.diff_section] - return ( - project.myimg, - (objdump_flags + flags1, project.baseimg, None), - ( - objdump_flags + flags2 + maybe_get_objdump_source_flags(config), - project.myimg, - None, - ), - ) - - -def dump_objfile( - start: str, end: Optional[str], config: Config, project: ProjectSettings -) -> Tuple[str, ObjdumpCommand, ObjdumpCommand]: - if config.base_shift: - fail("--base-shift not compatible with -o") - if end is not None: - fail("end address not supported together with -o") - if start.startswith("0"): - fail("numerical start address not supported with -o; pass a function name") - - objfile = config.file - if not objfile: - objfile, _ = search_map_file(start, project, config, for_binary=False) - - if not objfile: - fail("Not able to find .o file for function.") - - if config.make: - run_make(objfile, project) - - if not os.path.isfile(objfile): - fail(f"Not able to find .o file for function: {objfile} is not a file.") - - refobjfile = os.path.join(project.expected_dir, objfile) - if config.diff_mode != DiffMode.SINGLE and not os.path.isfile(refobjfile): - fail(f'Please ensure an OK .o file exists at "{refobjfile}".') - - if project.disassemble_all: - disassemble_flag = "-D" - else: - disassemble_flag = "-d" - - objdump_flags = [disassemble_flag, "-rz", "-j", config.diff_section] - return ( - objfile, - (objdump_flags, refobjfile, start), - (objdump_flags + maybe_get_objdump_source_flags(config), objfile, start), - ) - - -def dump_binary( - start: str, end: Optional[str], config: Config, project: ProjectSettings -) -> Tuple[str, ObjdumpCommand, ObjdumpCommand]: - binfile = config.file or project.myimg - if not project.baseimg or not binfile: - fail("Missing myimg/baseimg in config.") - if config.make: - run_make(binfile, project) - if not os.path.isfile(binfile): - fail(f"Not able to find binary file: {binfile}") - start_addr = maybe_eval_int(start) - if start_addr is None and config.file is None: - _, start_addr = search_map_file(start, project, config, for_binary=True) - if start_addr is None: - fail("Not able to find function in map file.") - start_addr += project.map_address_offset - elif start_addr is None: - fail("Start address must be an integer expression when using binary -f") - if end is not None: - end_addr = eval_int(end, "End address must be an integer expression.") - else: - end_addr = start_addr + config.max_function_size_bytes - objdump_flags = ["-Dz", "-bbinary"] + ["-EB" if config.arch.big_endian else "-EL"] - flags1 = [ - f"--start-address={start_addr + config.base_shift}", - f"--stop-address={end_addr + config.base_shift}", - ] - flags2 = [f"--start-address={start_addr}", f"--stop-address={end_addr}"] - return ( - binfile, - (objdump_flags + flags1, project.baseimg, None), - (objdump_flags + flags2, binfile, None), - ) - - -# Example: "ldr r4, [pc, #56] ; (4c )" -ARM32_LOAD_POOL_PATTERN = r"(ldr\s+r([0-9]|1[0-3]),\s+\[pc,.*;\s*)(\([a-fA-F0-9]+.*\))" - - -# The base class is a no-op. -class AsmProcessor: - def __init__(self, config: Config) -> None: - self.config = config - - def pre_process( - self, mnemonic: str, args: str, next_row: Optional[str] - ) -> Tuple[str, str]: - return mnemonic, args - - def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: - return prev, None - - def normalize(self, mnemonic: str, row: str) -> str: - """This should be called exactly once for each line.""" - arch = self.config.arch - row = self._normalize_arch_specific(mnemonic, row) - if self.config.ignore_large_imms and mnemonic not in arch.branch_instructions: - row = re.sub(self.config.arch.re_large_imm, "", row) - return row - - def _normalize_arch_specific(self, mnemonic: str, row: str) -> str: - return row - - def post_process(self, lines: List["Line"]) -> None: - return - - def is_end_of_function(self, mnemonic: str, args: str) -> bool: - return False - - -class AsmProcessorMIPS(AsmProcessor): - def __init__(self, config: Config) -> None: - super().__init__(config) - self.seen_jr_ra = False - - def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: - arch = self.config.arch - if "R_MIPS_NONE" in row or "R_MIPS_JALR" in row: - # GNU as emits no-op relocations immediately after real ones when - # assembling with -mabi=64. Return without trying to parse 'imm' as an - # integer. - return prev, None - before, imm, after = parse_relocated_line(prev) - addend = reloc_addend_from_imm(imm, before, self.config.arch) - repl = row.split()[-1] + addend - if "R_MIPS_LO16" in row: - repl = f"%lo({repl})" - elif "R_MIPS_HI16" in row: - # Ideally we'd pair up R_MIPS_LO16 and R_MIPS_HI16 to generate a - # correct addend for each, but objdump doesn't give us the order of - # the relocations, so we can't find the right LO16. :( - repl = f"%hi({repl})" - elif "R_MIPS_26" in row: - # Function calls - pass - elif "R_MIPS_PC16" in row: - # Branch to glabel. This gives confusing output, but there's not much - # we can do here. - pass - elif "R_MIPS_GPREL16" in row: - repl = f"%gp_rel({repl})" - elif "R_MIPS_GOT16" in row: - repl = f"%got({repl})" - elif "R_MIPS_CALL16" in row: - repl = f"%call16({repl})" - elif "R_MIPS_LITERAL" in row: - repl = repl[: -len(addend)] - else: - assert False, f"unknown relocation type '{row}' for line '{prev}'" - return before + repl + after, repl - - def is_end_of_function(self, mnemonic: str, args: str) -> bool: - if self.seen_jr_ra: - return True - if mnemonic == "jr" and args == "ra": - self.seen_jr_ra = True - return False - - -class AsmProcessorPPC(AsmProcessor): - def pre_process( - self, mnemonic: str, args: str, next_row: Optional[str] - ) -> Tuple[str, str]: - if next_row and "R_PPC_EMB_SDA21" in next_row: - # With sda21 relocs, the linker transforms `r0` into `r2`/`r13`, and - # we may encounter this in either pre-transformed or post-transformed - # versions depending on if the .o file comes from compiler output or - # from disassembly. Normalize, to make sure both forms are treated as - # equivalent. - - args = args.replace("(r2)", "(0)") - args = args.replace("(r13)", "(0)") - args = args.replace(",r2,", ",0,") - args = args.replace(",r13,", ",0,") - - # We want to convert li and lis with an sda21 reloc, - # because the r0 to r2/r13 transformation results in - # turning an li/lis into an addi/addis with r2/r13 arg - # our preprocessing normalizes all versions to addi with a 0 arg - if mnemonic in {"li", "lis"}: - mnemonic = mnemonic.replace("li", "addi") - args_parts = args.split(",") - args = args_parts[0] + ",0," + args_parts[1] - if ( - next_row - and ("R_PPC_REL24" in next_row or "R_PPC_REL14" in next_row) - and ".text+0x" in next_row - and mnemonic in PPC_BRANCH_INSTRUCTIONS - ): - # GCC emits a relocation of "R_PPC_REL14" or "R_PPC_REL24" with a .text offset - # fixup the args to use the offset from the relocation - - # Split args by ',' which will result in either [cr, offset] or [offset] - # Replace the current offset with the next line's ".text+0x" offset - splitArgs = args.split(",") - splitArgs[-1] = next_row.split(".text+0x")[-1] - args = ",".join(splitArgs) - - return mnemonic, args - - def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: - # row is the line with the relocations - # prev is the line to apply relocations to - - arch = self.config.arch - assert any( - r in row - for r in ["R_PPC_REL24", "R_PPC_ADDR16", "R_PPC_EMB_SDA21", "R_PPC_REL14"] - ), f"unknown relocation type '{row}' for line '{prev}'" - before, imm, after = parse_relocated_line(prev) - repl = row.split()[-1] - mnemonic, args = prev.split(maxsplit=1) - - if "R_PPC_REL24" in row: - # function calls - # or unconditional branches generated by GCC "b offset" - if mnemonic in PPC_BRANCH_INSTRUCTIONS and ".text+0x" in row: - # this has been handled in pre_process - return prev, None - elif "R_PPC_REL14" in row: - if mnemonic in PPC_BRANCH_INSTRUCTIONS and ".text+0x" in row: - # this has been handled in pre_process - return prev, None - elif "R_PPC_ADDR16_HI" in row: - # absolute hi of addr - repl = f"{repl}@h" - elif "R_PPC_ADDR16_HA" in row: - # adjusted hi of addr - repl = f"{repl}@ha" - elif "R_PPC_ADDR16_LO" in row: - # lo of addr - repl = f"{repl}@l" - elif "R_PPC_ADDR16" in row: - # 16-bit absolute addr - if "+0x7" in repl: - # remove the very large addends as they are an artifact of (label-_SDA(2)_BASE_) - # computations and are unimportant in a diff setting. - if int(repl.split("+")[1], 16) > 0x70000000: - repl = repl.split("+")[0] - elif "R_PPC_EMB_SDA21" in row: - # sda21 relocations; r2/r13 --> 0 swaps are performed in pre_process - repl = f"{repl}@sda21" - - return before + repl + after, repl - - def is_end_of_function(self, mnemonic: str, args: str) -> bool: - return mnemonic == "blr" - - -class AsmProcessorARM32(AsmProcessor): - def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: - arch = self.config.arch - if "R_ARM_V4BX" in row: - # R_ARM_V4BX converts "bx " to "mov pc," for some targets. - # Ignore for now. - return prev, None - if "R_ARM_ABS32" in row and not prev.startswith(".word"): - # Don't crash on R_ARM_ABS32 relocations incorrectly applied to code. - # (We may want to do something more fancy here that actually shows the - # related symbol, but this serves as a stop-gap.) - return prev, None - before, imm, after = parse_relocated_line(prev) - repl = row.split()[-1] + reloc_addend_from_imm(imm, before, self.config.arch) - return before + repl + after, repl - - def _normalize_arch_specific(self, mnemonic: str, row: str) -> str: - if self.config.ignore_addr_diffs: - row = self._normalize_bl(mnemonic, row) - row = self._normalize_data_pool(row) - return row - - def _normalize_bl(self, mnemonic: str, row: str) -> str: - if mnemonic != "bl": - return row - - row, _ = split_off_address(row) - return row + "" - - def _normalize_data_pool(self, row: str) -> str: - pool_match = re.search(ARM32_LOAD_POOL_PATTERN, row) - return pool_match.group(1) if pool_match else row - - def post_process(self, lines: List["Line"]) -> None: - lines_by_line_number = {} - for line in lines: - lines_by_line_number[line.line_num] = line - for line in lines: - if line.data_pool_addr is None: - continue - - # Add data symbol and its address to the line. - line_original = lines_by_line_number[line.data_pool_addr].original - value = line_original.split()[1] - addr = "{:x}".format(line.data_pool_addr) - line.original = line.normalized_original + f"={value} ({addr})" - - -class AsmProcessorAArch64(AsmProcessor): - def __init__(self, config: Config) -> None: - super().__init__(config) - self._adrp_pair_registers: Set[str] = set() - - def _normalize_arch_specific(self, mnemonic: str, row: str) -> str: - if self.config.ignore_addr_diffs: - row = self._normalize_adrp_differences(mnemonic, row) - row = self._normalize_bl(mnemonic, row) - return row - - def _normalize_bl(self, mnemonic: str, row: str) -> str: - if mnemonic != "bl": - return row - - row, _ = split_off_address(row) - return row + "" - - def _normalize_adrp_differences(self, mnemonic: str, row: str) -> str: - """Identifies ADRP + LDR/ADD pairs that are used to access the GOT and - suppresses any immediate differences. - - Whenever an ADRP is seen, the destination register is added to the set of registers - that are part of an ADRP + LDR/ADD pair. Registers are removed from the set as soon - as they are used for an LDR or ADD instruction which completes the pair. - - This method is somewhat crude but should manage to detect most such pairs. - """ - row_parts = row.split("\t", 1) - if mnemonic == "adrp": - self._adrp_pair_registers.add(row_parts[1].strip().split(",")[0]) - row, _ = split_off_address(row) - return row + "" - elif mnemonic == "ldr": - for reg in self._adrp_pair_registers: - # ldr xxx, [reg] - # ldr xxx, [reg, ] - if f", [{reg}" in row_parts[1]: - self._adrp_pair_registers.remove(reg) - return normalize_imms(row, AARCH64_SETTINGS) - elif mnemonic == "add": - for reg in self._adrp_pair_registers: - # add reg, reg, - if row_parts[1].startswith(f"{reg}, {reg}, "): - self._adrp_pair_registers.remove(reg) - return normalize_imms(row, AARCH64_SETTINGS) - - return row - - -class AsmProcessorI686(AsmProcessor): - def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: - if "WRTSEG" in row: # ignore WRTSEG (watcom) - return prev, None - repl = row.split()[-1] - mnemonic, args = prev.split(maxsplit=1) - offset = False - - # Calls - # Example call a2f - # Example call *0 - if mnemonic == "call": - addr_imm = re.search(r"(^|(?<=\*)|(?<=\*\%cs\:))[0-9a-f]+", args) - - # Direct use of reloc - # Example 0x0,0x8(%edi) - # Example 0x0,%edi - # Example *0x0(,%edx,4) - # Example %edi,0 - # Example movb $0x0,0x0 - # Example $0x0,0x4(%edi) - # Match 0x0 part to replace - else: - addr_imm = re.search(r"(?:0x)?0+$", args) - - if not addr_imm: - addr_imm = re.search(r"(^\$?|(?<=\*))0x0", args) - - # Offset value - # Example 0x4,%eax - # Example $0x4,%eax - if not addr_imm: - addr_imm = re.search(r"(^|(?<=\*)|(?<=\$))0x[0-9a-f]+", args) - offset = True - - if not addr_imm: - assert False, f"failed to find address immediate for line '{prev}'" - - start, end = addr_imm.span() - - if "R_386_NONE" in row: - pass - elif "R_386_32" in row: - pass - elif "R_386_PC32" in row: - pass - elif "R_386_16" in row: - pass - elif "R_386_PC16" in row: - pass - elif "R_386_8" in row: - pass - elif "R_386_PC8" in row: - pass - elif "dir32" in row: - if "+" in repl: - repl = repl.split("+")[0] - elif "DISP32" in row: - pass - elif "OFF32" in row: - pass - elif "OFFPC32" in row: - if "+" in repl: - repl = repl.split("+")[0] - elif "R_386_GOT32" in row: - repl = f"%got({repl})" - elif "R_386_PLT32" in row: - repl = f"%plt({repl})" - elif "R_386_RELATIVE" in row: - repl = f"%rel({repl})" - elif "R_386_GOTOFF" in row: - repl = f"%got({repl})" - elif "R_386_GOTPC" in row: - repl = f"%got({repl})" - elif "R_386_32PLT" in row: - repl = f"%plt({repl})" - else: - assert False, f"unknown relocation type '{row}' for line '{prev}'" - - if offset: - repl = f"{repl}+{addr_imm.group()}" - - return f"{mnemonic}\t{args[:start]+repl+args[end:]}", repl - - def is_end_of_function(self, mnemonic: str, args: str) -> bool: - return mnemonic == "ret" - - -class AsmProcessorSH2(AsmProcessor): - def __init__(self, config: Config) -> None: - super().__init__(config) - - def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: - return prev, None - - def is_end_of_function(self, mnemonic: str, args: str) -> bool: - return mnemonic == "rts" - - -class AsmProcessorM68k(AsmProcessor): - def pre_process( - self, mnemonic: str, args: str, next_row: Optional[str] - ) -> Tuple[str, str]: - # replace objdump's syntax of pointer accesses with the equivilant in AT&T syntax for readability - return mnemonic, re.sub( - r"%(sp|a[0-7]|fp|pc)@(?:(?:\((-?(?:0x[0-9a-f]+|[0-9]+)) *(,%d[0-7]:[wl])?\))|(\+)|(-))?", - r"\5\2(%\1\3)\4", - args, - ) - - def process_reloc(self, row: str, prev: str) -> Tuple[str, Optional[str]]: - repl = row.split()[-1] - mnemonic, args = prev.split(maxsplit=1) - - addr_imm = re.search(r"(? bool: - return mnemonic == "rts" or mnemonic == "rte" or mnemonic == "rtr" - - -@dataclass -class ArchSettings: - name: str - re_int: Pattern[str] - re_comment: Pattern[str] - re_reg: Pattern[str] - re_sprel: Pattern[str] - re_large_imm: Pattern[str] - re_imm: Pattern[str] - re_reloc: Pattern[str] - branch_instructions: Set[str] - instructions_with_address_immediates: Set[str] - forbidden: Set[str] = field(default_factory=lambda: set(string.ascii_letters + "_")) - arch_flags: List[str] = field(default_factory=list) - branch_likely_instructions: Set[str] = field(default_factory=set) - proc: Type[AsmProcessor] = AsmProcessor - big_endian: Optional[bool] = True - delay_slot_instructions: Set[str] = field(default_factory=set) - - -MIPS_BRANCH_LIKELY_INSTRUCTIONS = { - "beql", - "bnel", - "beqzl", - "bnezl", - "bgezl", - "bgtzl", - "blezl", - "bltzl", - "bc1tl", - "bc1fl", -} -MIPS_BRANCH_INSTRUCTIONS = MIPS_BRANCH_LIKELY_INSTRUCTIONS.union( - { - "b", - "beq", - "bne", - "beqz", - "bnez", - "bgez", - "bgtz", - "blez", - "bltz", - "bc1t", - "bc1f", - } -) - -ARM32_PREFIXES = {"b", "bl"} -ARM32_CONDS = { - "", - "eq", - "ne", - "cs", - "cc", - "mi", - "pl", - "vs", - "vc", - "hi", - "ls", - "ge", - "lt", - "gt", - "le", - "al", -} -ARM32_SUFFIXES = {"", ".n", ".w"} -ARM32_BRANCH_INSTRUCTIONS = { - f"{prefix}{cond}{suffix}" - for prefix in ARM32_PREFIXES - for cond in ARM32_CONDS - for suffix in ARM32_SUFFIXES -} - -AARCH64_BRANCH_INSTRUCTIONS = { - "b", - "b.eq", - "b.ne", - "b.cs", - "b.hs", - "b.cc", - "b.lo", - "b.mi", - "b.pl", - "b.vs", - "b.vc", - "b.hi", - "b.ls", - "b.ge", - "b.lt", - "b.gt", - "b.le", - "cbz", - "cbnz", - "tbz", - "tbnz", -} - -PPC_BRANCH_INSTRUCTIONS = { - "b", - "beq", - "beq+", - "beq-", - "bne", - "bne+", - "bne-", - "blt", - "blt+", - "blt-", - "ble", - "ble+", - "ble-", - "bdnz", - "bdnz+", - "bdnz-", - "bge", - "bge+", - "bge-", - "bgt", - "bgt+", - "bgt-", - "bso", - "bso+", - "bso-", - "bns", - "bns+", - "bns-", -} - -I686_BRANCH_INSTRUCTIONS = { - "call", - "jmp", - "ljmp", - "ja", - "jae", - "jb", - "jbe", - "jc", - "jcxz", - "jecxz", - "jrcxz", - "je", - "jg", - "jge", - "jl", - "jle", - "jna", - "jnae", - "jnb", - "jnbe", - "jnc", - "jne", - "jng", - "jnge", - "jnl", - "jnle", - "jno", - "jnp", - "jns", - "jnz", - "jo", - "jp", - "jpe", - "jpo", - "js", - "jz", - "ja", - "jae", - "jb", - "jbe", - "jc", - "je", - "jz", - "jg", - "jge", - "jl", - "jle", - "jna", - "jnae", - "jnb", - "jnbe", - "jnc", - "jne", - "jng", - "jnge", - "jnl", - "jnle", - "jno", - "jnp", - "jns", - "jnz", - "jo", - "jp", - "jpe", - "jpo", - "js", - "jz", -} - -SH2_BRANCH_INSTRUCTIONS = { - "bf", - "bf.s", - "bt", - "bt.s", - "bra", - "bsr", -} - -M68K_CONDS = { - "ra", - "cc", - "cs", - "eq", - "ge", - "gt", - "hi", - "le", - "ls", - "lt", - "mi", - "ne", - "pl", - "vc", - "vs", -} - -M68K_BRANCH_INSTRUCTIONS = { - f"{prefix}{cond}{suffix}" - for prefix in {"b", "db"} - for cond in M68K_CONDS - for suffix in {"s", "w"} -}.union( - { - "dbt", - "dbf", - "bsrw", - "bsrs", - } -) - - -MIPS_SETTINGS = ArchSettings( - name="mips", - re_int=re.compile(r"[0-9]+"), - re_comment=re.compile(r"<.*>"), - # Includes: - # - General purpose registers v0..1, a0..7, t0..9, s0..8, zero, at, fp, k0..1/kt0..1 - # - Float registers f0..31, or fv0..1, fa0..7, ft0..15, fs0..8 plus odd complements - # (actually used number depends on ABI) - # sp, gp should not be in this list - re_reg=re.compile(r"\$?\b([astv][0-9]|at|f[astv]?[0-9]+f?|kt?[01]|fp|ra|zero)\b"), - re_sprel=re.compile(r"(?<=,)([0-9]+|0x[0-9a-f]+)\(sp\)"), - re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"), - re_imm=re.compile( - r"(\b|-)([0-9]+|0x[0-9a-fA-F]+)\b(?!\(sp)|%(lo|hi|got|gp_rel|call16)\([^)]*\)" - ), - re_reloc=re.compile(r"R_MIPS_"), - arch_flags=["-m", "mips:4300"], - branch_likely_instructions=MIPS_BRANCH_LIKELY_INSTRUCTIONS, - branch_instructions=MIPS_BRANCH_INSTRUCTIONS, - instructions_with_address_immediates=MIPS_BRANCH_INSTRUCTIONS.union({"j", "jal"}), - delay_slot_instructions=MIPS_BRANCH_INSTRUCTIONS.union({"j", "jal", "jr", "jalr"}), - proc=AsmProcessorMIPS, -) - -MIPSEL_SETTINGS = replace( - MIPS_SETTINGS, name="mipsel", big_endian=False, arch_flags=["-m", "mips:3000"] -) - -MIPSEE_SETTINGS = replace( - MIPSEL_SETTINGS, name="mipsee", arch_flags=["-m", "mips:5900"] -) - -MIPS_ARCH_NAMES = {"mips", "mipsel", "mipsee"} - -ARM32_SETTINGS = ArchSettings( - name="arm32", - re_int=re.compile(r"[0-9]+"), - re_comment=re.compile(r"(<.*>|//.*$)"), - # Includes: - # - General purpose registers: r0..13 - # - Frame pointer registers: lr (r14), pc (r15) - # - VFP/NEON registers: s0..31, d0..31, q0..15, fpscr, fpexc, fpsid - # SP should not be in this list. - re_reg=re.compile( - r"\$?\b([rq][0-9]|[rq]1[0-5]|pc|lr|[ds][12]?[0-9]|[ds]3[01]|fp(scr|exc|sid))\b" - ), - re_sprel=re.compile(r"sp, #-?(0x[0-9a-fA-F]+|[0-9]+)\b"), - re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"), - re_imm=re.compile(r"(?|//.*$)"), - # GPRs and FP registers: X0-X30, W0-W30, [BHSDVQ]0..31 - # (FP registers may be followed by data width and number of elements, e.g. V0.4S) - # The zero registers and SP should not be in this list. - re_reg=re.compile( - r"\$?\b([bhsdvq]([12]?[0-9]|3[01])(\.\d\d?[bhsdvq])?|[xw][12]?[0-9]|[xw]30)\b" - ), - re_sprel=re.compile(r"sp, #-?(0x[0-9a-fA-F]+|[0-9]+)\b"), - re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"), - re_imm=re.compile(r"(?|//.*$)"), - # r1 not included - re_reg=re.compile(r"\$?\b([rf](?:[02-9]|[1-9][0-9]+)|f1)\b"), - re_sprel=re.compile(r"(?<=,)(-?[0-9]+|-?0x[0-9a-f]+)\(r1\)"), - re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"), - re_imm=re.compile( - r"(\b|-)([0-9]+|0x[0-9a-fA-F]+)\b(?!\(r1\))|[^ \t,]+@(l|ha|h|sda21)" - ), - re_reloc=re.compile(r"R_PPC_"), - arch_flags=["-m", "powerpc", "-M", "broadway"], - branch_instructions=PPC_BRANCH_INSTRUCTIONS, - instructions_with_address_immediates=PPC_BRANCH_INSTRUCTIONS.union({"bl"}), - proc=AsmProcessorPPC, -) - -I686_SETTINGS = ArchSettings( - name="i686", - re_int=re.compile(r"[0-9]+"), - re_comment=re.compile(r"<.*>"), - # Includes: - # - (e)a-d(x,l,h) - # - (e)s,d,b(i,p)(l) - # - cr0-7 - # - x87 st - # - MMX, SSE vector registers - # - cursed registers: eal ebl ebh edl edh... - re_reg=re.compile( - r"\%?\b(e?(([sd]i|[sb]p)l?|[abcd][xhl])|[cdesfg]s|cr[0-7]|x?mm[0-7]|st)\b" - ), - re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"), - re_sprel=re.compile(r"-?(0x[0-9a-f]+|[0-9]+)(?=\((%ebp|%esi)\))"), - re_imm=re.compile(r"-?(0x[0-9a-f]+|[0-9]+)"), - re_reloc=re.compile(r"R_386_|dir32|DISP32|WRTSEG|OFF32|OFFPC32"), - # The x86 architecture has a variable instruction length. The raw bytes of - # an instruction as displayed by objdump can line wrap if it's long enough. - # This destroys the objdump output processor logic, so we avoid this. - arch_flags=["-m", "i386", "--no-show-raw-insn"], - branch_instructions=I686_BRANCH_INSTRUCTIONS, - instructions_with_address_immediates=I686_BRANCH_INSTRUCTIONS.union({"mov"}), - proc=AsmProcessorI686, -) - -SH2_SETTINGS = ArchSettings( - name="sh2", - # match -128-127 preceded by a '#' with a ',' after (8 bit immediates) - re_int=re.compile(r"(?<=#)(-?(?:1[01][0-9]|12[0-8]|[1-9][0-9]?|0))(?=,)"), - # match , match ! and after - re_comment=re.compile(r"<.*?>|!.*"), - # - r0-r15 general purpose registers, r15 is stack pointer during exceptions - # - sr, gbr, vbr - control registers - # - mach, macl, pr, pc - system registers - re_reg=re.compile(r"r1[0-5]|r[0-9]"), - # sh2 has pc-relative and gbr-relative but not stack-pointer-relative - re_sprel=re.compile(r"(?<=,)([0-9]+|0x[0-9a-f]+)\(sp\)"), - # max immediate size is 8-bit - re_large_imm=re.compile(r"-?[1-9][0-9]{2,}|-?0x[0-9a-f]{3,}"), - re_imm=re.compile(r"\b0[xX][0-9a-fA-F]+\b"), - # https://github.com/bminor/binutils-gdb/blob/master/bfd/elf32-sh-relocs.h#L21 - re_reloc=re.compile(r"R_SH_"), - arch_flags=["-m", "sh2"], - branch_instructions=SH2_BRANCH_INSTRUCTIONS, - instructions_with_address_immediates=SH2_BRANCH_INSTRUCTIONS.union( - {"bf", "bf.s", "bt", "bt.s", "bra", "bsr"} - ), - delay_slot_instructions=SH2_BRANCH_INSTRUCTIONS.union( - {"bf.s", "bt.s", "bra", "braf", "bsr", "bsrf", "jmp", "jsr", "rts"} - ), - proc=AsmProcessorSH2, -) - -SH4_SETTINGS = replace( - SH2_SETTINGS, - name="sh4", - # - fr0-fr15, dr0-dr14, xd0-xd14, fv0-fv12 FP registers - # dr/xd registers can only be even-numbered, and fv registers can only be a multiple of 4 - re_reg=re.compile( - r"r1[0-5]|r[0-9]|fr1[0-5]|fr[0-9]|dr[02468]|dr1[024]|xd[02468]|xd1[024]|fv[048]|fv12" - ), - arch_flags=["-m", "sh4"], -) - -SH4EL_SETTINGS = replace(SH4_SETTINGS, name="sh4el", big_endian=False) - -M68K_SETTINGS = ArchSettings( - name="m68k", - re_int=re.compile(r"[0-9]+"), - # '|' is used by assemblers, but is not used by objdump - re_comment=re.compile(r"<.*>"), - # Includes: - # - d0-d7 data registers - # - a0-a6 address registers - # - fp0-fp7 floating-point registers - # - usp (user sp) - # - fp, sr, ccr - # - fpcr, fpsr, fpiar - re_reg=re.compile(r"%\b(d[0-7]|a[0-6]|usp|fp([0-7]|cr|sr|iar)?|sr|ccr)(:[wl])?\b"), - # This matches all stack accesses that do not use an index register - re_sprel=re.compile(r"-?(0x[0-9a-f]+|[0-9]+)(?=\((%sp|%a7)\))"), - re_imm=re.compile(r"#?-?\b(0x[0-9a-f]+|[0-9]+)(?!\()"), - re_large_imm=re.compile(r"#?-?([1-9][0-9]{2,}|0x[0-9a-f]{3,})"), - re_reloc=re.compile(r"R_68K_"), - arch_flags=["-m", "m68k"], - branch_instructions=M68K_BRANCH_INSTRUCTIONS, - # Pretty much every instruction can take an address immediate - instructions_with_address_immediates=M68K_BRANCH_INSTRUCTIONS.union("jmp", "jsr"), - proc=AsmProcessorM68k, -) - -ARCH_SETTINGS = [ - MIPS_SETTINGS, - MIPSEL_SETTINGS, - MIPSEE_SETTINGS, - ARM32_SETTINGS, - ARMEL_SETTINGS, - AARCH64_SETTINGS, - PPC_SETTINGS, - I686_SETTINGS, - SH2_SETTINGS, - SH4_SETTINGS, - SH4EL_SETTINGS, - M68K_SETTINGS, -] - - -def hexify_int(row: str, pat: Match[str], arch: ArchSettings) -> str: - full = pat.group(0) - - # sh2/sh4 only has 8-bit immediates, just convert them uniformly without - # any -hex stuff - if arch.name == "sh2" or arch.name == "sh4" or arch.name == "sh4el": - return hex(int(full) & 0xFF) - - if len(full) <= 1: - # leave one-digit ints alone - return full - start, end = pat.span() - if start and row[start - 1] in arch.forbidden: - return full - if end < len(row) and row[end] in arch.forbidden: - return full - return hex(int(full)) - - -def parse_relocated_line(line: str) -> Tuple[str, str, str]: - # Pick out the last argument - for c in ",\t ": - if c in line: - ind2 = line.rindex(c) - break - else: - raise Exception(f"failed to parse relocated line: {line}") - before = line[: ind2 + 1] - after = line[ind2 + 1 :] - # Move an optional ($reg) part of it to 'after' - ind2 = after.find("(") - if ind2 == -1: - imm, after = after, "" - else: - imm, after = after[:ind2], after[ind2:] - return before, imm, after - - -def reloc_addend_from_imm(imm: str, before: str, arch: ArchSettings) -> str: - """For architectures like MIPS where relocations have addends embedded in - the code as immediates, convert such an immediate into an addition/ - subtraction that can occur just after the symbol.""" - # TODO this is incorrect for MIPS %lo/%hi which need to be paired up - # and combined. In practice, this means we only get symbol offsets within - # %lo, while %hi just shows the symbol. Unfortunately, objdump's output - # loses relocation order, so we cannot do this without parsing ELF relocs - # ourselves... - mnemonic = before.split()[0] - if mnemonic in arch.instructions_with_address_immediates: - addend = int(imm, 16) - else: - addend = int(imm, 0) - if addend == 0: - return "" - elif addend < 0: - return hex(addend) - else: - return "+" + hex(addend) - - -def pad_mnemonic(line: str) -> str: - if "\t" not in line: - return line - mn, args = line.split("\t", 1) - return f"{mn:<7s} {args}" - - -@dataclass -class Line: - mnemonic: str - diff_row: str - original: str - normalized_original: str - scorable_line: str - symbol: Optional[str] = None - line_num: Optional[int] = None - branch_target: Optional[int] = None - data_pool_addr: Optional[int] = None - source_filename: Optional[str] = None - source_line_num: Optional[int] = None - source_lines: List[str] = field(default_factory=list) - comment: Optional[str] = None - - -def process(dump: str, config: Config) -> List[Line]: - arch = config.arch - processor = arch.proc(config) - source_lines = [] - source_filename = None - source_line_num = None - rets_remaining = config.stop_at_ret - - i = 0 - num_instr = 0 - data_refs: Dict[int, Dict[str, List[int]]] = defaultdict(lambda: defaultdict(list)) - output: List[Line] = [] - lines = dump.split("\n") - while i < len(lines): - row = lines[i] - i += 1 - - if not row: - continue - - if re.match(r"^[0-9a-f]+ <.*>:$", row): - continue - - if row.startswith("DATAREF"): - parts = row.split(" ", 3) - text_offset = int(parts[1]) - from_offset = int(parts[2]) - from_section = parts[3] - data_refs[text_offset][from_section].append(from_offset) - continue - - if config.diff_obj and num_instr >= config.max_function_size_lines: - output.append( - Line( - mnemonic="...", - diff_row="...", - original="...", - normalized_original="...", - scorable_line="...", - ) - ) - break - - if not re.match(r"^\s+[0-9a-f]+:\s+", row): - # This regex is conservative, and assumes the file path does not contain "weird" - # characters like tabs or angle brackets. - if re.match(r"^[^ \t<>][^\t<>]*:[0-9]+( \(discriminator [0-9]+\))?$", row): - source_filename, _, tail = row.rpartition(":") - source_line_num = int(tail.partition(" ")[0]) - source_lines.append(row) - continue - - # If the instructions loads a data pool symbol, extract the address of - # the symbol. - data_pool_addr = None - pool_match = re.search(ARM32_LOAD_POOL_PATTERN, row) - if pool_match: - offset = pool_match.group(3).split(" ")[0][1:] - data_pool_addr = int(offset, 16) - - m_comment = re.search(arch.re_comment, row) - comment = m_comment[0] if m_comment else None - row = re.sub(arch.re_comment, "", row) - line_num_str = row.split(":")[0] - row = row.rstrip() - tabs = row.split("\t") - line_num = eval_line_num(line_num_str.strip()) - - # TODO: use --no-show-raw-insn for all arches - if arch.name == "i686": - row = "\t".join(tabs[1:]) - else: - row = "\t".join(tabs[2:]) - - if line_num in data_refs: - refs = data_refs[line_num] - ref_str = "; ".join( - section_name + "+" + ",".join(hex(off) for off in offs) - for section_name, offs in refs.items() - ) - output.append( - Line( - mnemonic="", - diff_row="", - original=ref_str, - normalized_original=ref_str, - scorable_line="", - ) - ) - - if "\t" in row: - row_parts = row.split("\t", 1) - else: - # powerpc-eabi-objdump doesn't use tabs - row_parts = [part.lstrip() for part in row.split(" ", 1)] - - mnemonic = row_parts[0].strip() - args = row_parts[1].strip() if len(row_parts) >= 2 else "" - - next_line = lines[i] if i < len(lines) else None - mnemonic, args = processor.pre_process(mnemonic, args, next_line) - row = mnemonic + "\t" + args.replace("\t", " ") - - addr = "" - if mnemonic in arch.instructions_with_address_immediates: - row, addr = split_off_address(row) - # objdump prefixes addresses with 0x/-0x if they don't resolve to some - # symbol + offset. Strip that. - addr = addr.replace("0x", "") - - row = re.sub(arch.re_int, lambda m: hexify_int(row, m, arch), row) - row += addr - - # Let 'original' be 'row' with relocations applied, while we continue - # transforming 'row' into a coarser version that ignores registers and - # immediates. - original = row - - symbol = None - while i < len(lines): - reloc_row = lines[i] - if re.search(arch.re_reloc, reloc_row): - original, reloc_symbol = processor.process_reloc(reloc_row, original) - if reloc_symbol is not None: - symbol = reloc_symbol - else: - break - i += 1 - - is_text_relative_j = False - if ( - arch.name in MIPS_ARCH_NAMES - and mnemonic == "j" - and symbol is not None - and symbol.startswith(".text") - ): - symbol = None - original = row - is_text_relative_j = True - - normalized_original = processor.normalize(mnemonic, original) - - scorable_line = normalized_original - if not config.score_stack_differences: - scorable_line = re.sub(arch.re_sprel, "addr(sp)", scorable_line) - - row = re.sub(arch.re_reg, "", row) - row = re.sub(arch.re_sprel, "addr(sp)", row) - if mnemonic in arch.instructions_with_address_immediates: - row = row.strip() - row, _ = split_off_address(row) - row += "" - else: - row = normalize_imms(row, arch) - - branch_target = None - if ( - mnemonic in arch.branch_instructions or is_text_relative_j - ) and symbol is None: - # Here, we try to match a wide variety of addressing mode: - # - Global deref with offset: *0x1234(%eax) - # - Global deref: *0x1234 - # - Register deref: *(%eax) - # - # We first have a single regex to match register deref and global - # deref with offset - x86_longjmp = re.search(r"\*(.*)\(", args) - if x86_longjmp: - capture = x86_longjmp.group(1) - if capture != "" and capture.isnumeric(): - branch_target = int(capture, 16) - else: - # Then, we try to match the global deref in a separate regex. - x86_longjmp = re.search(r"\*(.*)", args) - if x86_longjmp: - capture = x86_longjmp.group(1) - if capture != "" and capture.isnumeric(): - branch_target = int(capture, 16) - else: - branch_target = int(args.split(",")[-1], 16) - - output.append( - Line( - mnemonic=mnemonic, - diff_row=row, - original=original, - normalized_original=normalized_original, - scorable_line=scorable_line, - symbol=symbol, - line_num=line_num, - branch_target=branch_target, - data_pool_addr=data_pool_addr, - source_filename=source_filename, - source_line_num=source_line_num, - source_lines=source_lines, - comment=comment, - ) - ) - num_instr += 1 - source_lines = [] - - if rets_remaining and processor.is_end_of_function(mnemonic, args): - rets_remaining -= 1 - if rets_remaining == 0: - break - - processor.post_process(output) - return output - - -def normalize_imms(row: str, arch: ArchSettings) -> str: - return re.sub(arch.re_imm, "", row) - - -def normalize_stack(row: str, arch: ArchSettings) -> str: - return re.sub(arch.re_sprel, "addr(sp)", row) - - -def check_for_symbol_mismatch( - old_line: Line, new_line: Line, symbol_map: Dict[str, str] -) -> bool: - assert old_line.symbol is not None - assert new_line.symbol is not None - - if new_line.symbol.startswith("%hi"): - return False - - if old_line.symbol not in symbol_map: - symbol_map[old_line.symbol] = new_line.symbol - return False - elif symbol_map[old_line.symbol] == new_line.symbol: - return False - - return True - - -def field_matches_any_symbol(field: str, arch: ArchSettings) -> bool: - if arch.name == "ppc": - if "..." in field: - return True - - parts = field.rsplit("@", 1) - if len(parts) == 2 and parts[1] in {"l", "h", "ha", "sda21"}: - field = parts[0] - - return re.fullmatch((r"^@\d+$"), field) is not None - - if arch.name in MIPS_ARCH_NAMES: - return "." in field - - # Example: ".text+0x34" - if arch.name == "arm32": - return "." in field - - return False - - -def split_off_address(line: str) -> Tuple[str, str]: - """Split e.g. 'beqz $r0,1f0' into 'beqz $r0,' and '1f0'.""" - parts = line.split(",") - if len(parts) < 2: - parts = line.split(None, 1) - if len(parts) < 2: - parts.append("") - off = len(line) - len(parts[-1].strip()) - return line[:off], line[off:] - - -def diff_sequences_difflib( - seq1: List[str], seq2: List[str] -) -> List[Tuple[str, int, int, int, int]]: - differ = difflib.SequenceMatcher(a=seq1, b=seq2, autojunk=False) - return differ.get_opcodes() - - -def diff_sequences( - seq1: List[str], seq2: List[str], algorithm: str -) -> List[Tuple[str, int, int, int, int]]: - if algorithm != "levenshtein": - return diff_sequences_difflib(seq1, seq2) - - # The Levenshtein library assumes that we compare strings, not lists. Convert. - remapping: Dict[str, str] = {} - - def remap(seq: List[str]) -> str: - seq = seq[:] - for i in range(len(seq)): - val = remapping.get(seq[i]) - if val is None: - val = chr(len(remapping)) - remapping[seq[i]] = val - seq[i] = val - return "".join(seq) - - try: - rem1 = remap(seq1) - rem2 = remap(seq2) - except ValueError: - if len(seq1) + len(seq2) < 0x110000: - raise - # If there are too many unique elements, chr() doesn't work. - # Assume this is the case and fall back to difflib. - return diff_sequences_difflib(seq1, seq2) - - import Levenshtein - - ret: List[Tuple[str, int, int, int, int]] = Levenshtein.opcodes(rem1, rem2) - return ret - - -def diff_lines( - lines1: List[Line], - lines2: List[Line], - algorithm: str, -) -> List[Tuple[Optional[Line], Optional[Line]]]: - ret = [] - for tag, i1, i2, j1, j2 in diff_sequences( - [line.mnemonic for line in lines1], - [line.mnemonic for line in lines2], - algorithm, - ): - for line1, line2 in itertools.zip_longest(lines1[i1:i2], lines2[j1:j2]): - if tag == "replace": - if line1 is None: - tag = "insert" - elif line2 is None: - tag = "delete" - elif tag == "insert": - assert line1 is None - elif tag == "delete": - assert line2 is None - ret.append((line1, line2)) - - return ret - - -def diff_sameline( - old_line: Line, new_line: Line, config: Config, symbol_map: Dict[str, str] -) -> Tuple[int, int, bool]: - old = old_line.scorable_line - new = new_line.scorable_line - if old == new: - return (0, 0, False) - - num_stack_penalties = 0 - num_regalloc_penalties = 0 - has_symbol_mismatch = False - - ignore_last_field = False - if config.score_stack_differences: - oldsp = re.search(config.arch.re_sprel, old) - newsp = re.search(config.arch.re_sprel, new) - if oldsp and newsp: - oldrel = int(oldsp.group(1) or "0", 0) - newrel = int(newsp.group(1) or "0", 0) - num_stack_penalties += abs(oldrel - newrel) - ignore_last_field = True - - # Probably regalloc difference, or signed vs unsigned - - # Compare each field in order - new_parts, old_parts = new.split(None, 1), old.split(None, 1) - newfields = new_parts[1].split(",") if len(new_parts) > 1 else [] - oldfields = old_parts[1].split(",") if len(old_parts) > 1 else [] - if ignore_last_field: - newfields = newfields[:-1] - oldfields = oldfields[:-1] - else: - # If the last field has a parenthesis suffix, e.g. "0x38(r7)" - # we split that part out to make it a separate field - # however, we don't split if it has a proceeding % macro, e.g. "%lo(.data)" - re_paren = re.compile(r"(? 0 else [] - ) - newfields = newfields[:-1] + ( - re_paren.split(newfields[-1]) if len(newfields) > 0 else [] - ) - - for nf, of in zip(newfields, oldfields): - if nf != of: - # If the new field is a match to any symbol case - # and the old field had a relocation, then ignore this mismatch - if ( - new_line.symbol - and old_line.symbol - and field_matches_any_symbol(nf, config.arch) - ): - if check_for_symbol_mismatch(old_line, new_line, symbol_map): - has_symbol_mismatch = True - continue - num_regalloc_penalties += 1 - - # Penalize any extra fields - num_regalloc_penalties += abs(len(newfields) - len(oldfields)) - - return (num_stack_penalties, num_regalloc_penalties, has_symbol_mismatch) - - -def score_diff_lines( - lines: List[Tuple[Optional[Line], Optional[Line]]], - config: Config, - symbol_map: Dict[str, str], -) -> int: - # This logic is copied from `scorer.py` from the decomp permuter project - # https://github.com/simonlindholm/decomp-permuter/blob/main/src/scorer.py - num_stack_penalties = 0 - num_regalloc_penalties = 0 - num_reordering_penalties = 0 - num_insertion_penalties = 0 - num_deletion_penalties = 0 - deletions = [] - insertions = [] - - def diff_insert(line: str) -> None: - # Reordering or totally different codegen. - # Defer this until later when we can tell. - insertions.append(line) - - def diff_delete(line: str) -> None: - deletions.append(line) - - # Find the end of the last long streak of matching mnemonics, if it looks - # like the objdump output was truncated. This is used to skip scoring - # misaligned lines at the end of the diff. - last_mismatch = -1 - max_index = None - lines_were_truncated = False - for index, (line1, line2) in enumerate(lines): - if (line1 and line1.original == "...") or (line2 and line2.original == "..."): - lines_were_truncated = True - if line1 and line2 and line1.mnemonic == line2.mnemonic: - if index - last_mismatch >= 50: - max_index = index - else: - last_mismatch = index - if not lines_were_truncated: - max_index = None - - for index, (line1, line2) in enumerate(lines): - if max_index is not None and index > max_index: - break - if line1 and line2 and line1.mnemonic == line2.mnemonic: - sp, rp, _ = diff_sameline(line1, line2, config, symbol_map) - num_stack_penalties += sp - num_regalloc_penalties += rp - else: - if line1: - diff_delete(line1.scorable_line) - if line2: - diff_insert(line2.scorable_line) - - insertions_co = Counter(insertions) - deletions_co = Counter(deletions) - for item in insertions_co + deletions_co: - ins = insertions_co[item] - dels = deletions_co[item] - common = min(ins, dels) - num_insertion_penalties += ins - common - num_deletion_penalties += dels - common - num_reordering_penalties += common - - return ( - num_stack_penalties * config.penalty_stackdiff - + num_regalloc_penalties * config.penalty_regalloc - + num_reordering_penalties * config.penalty_reordering - + num_insertion_penalties * config.penalty_insertion - + num_deletion_penalties * config.penalty_deletion - ) - - -@dataclass(frozen=True) -class OutputLine: - base: Optional[Text] = field(compare=False) - fmt2: Text = field(compare=False) - key2: Optional[str] - boring: bool = field(compare=False) - is_data_ref: bool = field(compare=False) - line1: Optional[Line] = field(compare=False) - line2: Optional[Line] = field(compare=False) - - -@dataclass(frozen=True) -class Diff: - lines: List[OutputLine] - score: int - max_score: int - - -def trim_nops(lines: List[Line], arch: ArchSettings) -> List[Line]: - lines = lines[:] - while ( - lines - and lines[-1].mnemonic == "nop" - and (len(lines) == 1 or lines[-2].mnemonic not in arch.delay_slot_instructions) - ): - lines.pop() - return lines - - -def do_diff(lines1: List[Line], lines2: List[Line], config: Config) -> Diff: - if config.show_source: - import cxxfilt - arch = config.arch - fmt = config.formatter - output: List[OutputLine] = [] - symbol_map: Dict[str, str] = {} - - sc1 = symbol_formatter("base-reg", 0) - sc2 = symbol_formatter("my-reg", 0) - sc3 = symbol_formatter("base-stack", 4) - sc4 = symbol_formatter("my-stack", 4) - sc5 = symbol_formatter("base-branch", 0) - sc6 = symbol_formatter("my-branch", 0) - bts1: Set[int] = set() - bts2: Set[int] = set() - - if config.show_branches: - for lines, btset, sc in [ - (lines1, bts1, sc5), - (lines2, bts2, sc6), - ]: - for line in lines: - bt = line.branch_target - if bt is not None: - btset.add(bt) - sc(str(bt)) - - lines1 = trim_nops(lines1, arch) - lines2 = trim_nops(lines2, arch) - - diffed_lines = diff_lines(lines1, lines2, config.algorithm) - - line_num_base = -1 - line_num_offset = 0 - line_num_2to1 = {} - for line1, line2 in diffed_lines: - if line1 is not None and line1.line_num is not None: - line_num_base = line1.line_num - line_num_offset = 0 - else: - line_num_offset += 1 - if line2 is not None and line2.line_num is not None: - line_num_2to1[line2.line_num] = (line_num_base, line_num_offset) - - for line1, line2 in diffed_lines: - line_color1 = line_color2 = sym_color = BasicFormat.NONE - line_prefix = " " - is_data_ref = False - out1 = Text() if not line1 else Text(pad_mnemonic(line1.original)) - out2 = Text() if not line2 else Text(pad_mnemonic(line2.original)) - if line1 and line2 and line1.diff_row == line2.diff_row: - if line1.diff_row == "": - if line1.normalized_original != line2.normalized_original: - line_prefix = "i" - sym_color = BasicFormat.DIFF_CHANGE - out1 = out1.reformat(sym_color) - out2 = out2.reformat(sym_color) - is_data_ref = True - elif ( - line1.normalized_original == line2.normalized_original - and line2.branch_target is None - ): - # Fast path: no coloring needed. We don't include branch instructions - # in this case because we need to check that their targets line up in - # the diff, and don't just happen to have the are the same address - # by accident. - pass - else: - mnemonic = line1.original.split()[0] - branchless1, address1 = out1.plain(), "" - branchless2, address2 = out2.plain(), "" - if mnemonic in arch.instructions_with_address_immediates: - branchless1, address1 = split_off_address(branchless1) - branchless2, address2 = split_off_address(branchless2) - - out1 = Text(branchless1) - out2 = Text(branchless2) - out1, out2 = format_fields( - arch.re_imm, out1, out2, lambda _: BasicFormat.IMMEDIATE - ) - - if line2.branch_target is not None: - target = line2.branch_target - line2_target = line_num_2to1.get(line2.branch_target) - if line2_target is None: - # If the target is outside the disassembly, extrapolate. - # This only matters near the bottom. - assert line2.line_num is not None - line2_line = line_num_2to1[line2.line_num] - line2_target = (line2_line[0] + (target - line2.line_num), 0) - - # Adjust the branch target for scoring and three-way diffing. - norm2, norm_branch2 = split_off_address(line2.normalized_original) - if norm_branch2 != "": - retargetted = hex(line2_target[0]).replace("0x", "") - if line2_target[1] != 0: - retargetted += f"+{line2_target[1]}" - line2.normalized_original = norm2 + retargetted - sc_base, _ = split_off_address(line2.scorable_line) - line2.scorable_line = sc_base + retargetted - same_target = line2_target == (line1.branch_target, 0) - else: - # Do a naive comparison for non-branches (e.g. function calls). - same_target = address1 == address2 - - if normalize_imms(branchless1, arch) == normalize_imms( - branchless2, arch - ): - ( - stack_penalties, - regalloc_penalties, - has_symbol_mismatch, - ) = diff_sameline(line1, line2, config, symbol_map) - - if ( - regalloc_penalties == 0 - and stack_penalties == 0 - and not has_symbol_mismatch - ): - # ignore differences due to %lo(.rodata + ...) vs symbol - out1 = out1.reformat(BasicFormat.NONE) - out2 = out2.reformat(BasicFormat.NONE) - elif line2.branch_target is not None and same_target: - # same-target branch, don't color - pass - else: - # must have an imm difference (or else we would have hit the - # fast path) - sym_color = BasicFormat.IMMEDIATE - line_prefix = "i" - else: - out1, out2 = format_fields(arch.re_sprel, out1, out2, sc3, sc4) - if normalize_stack(branchless1, arch) == normalize_stack( - branchless2, arch - ): - # only stack differences (luckily stack and imm - # differences can't be combined in MIPS, so we - # don't have to think about that case) - sym_color = BasicFormat.STACK - line_prefix = "s" - else: - # reg differences and maybe imm as well - out1, out2 = format_fields(arch.re_reg, out1, out2, sc1, sc2) - cats = config.reg_categories - if cats and any( - cats.get(of.group()) != cats.get(nf.group()) - for (of, nf) in zip( - out1.finditer(arch.re_reg), out2.finditer(arch.re_reg) - ) - ): - sym_color = BasicFormat.REGISTER_CATEGORY - line_prefix = "R" - else: - sym_color = BasicFormat.REGISTER - line_prefix = "r" - line_color1 = line_color2 = sym_color - - if same_target: - address_imm_fmt = BasicFormat.NONE - else: - address_imm_fmt = BasicFormat.IMMEDIATE - out1 += Text(address1, address_imm_fmt) - out2 += Text(address2, address_imm_fmt) - elif line1 and line2: - line_prefix = "|" - line_color1 = line_color2 = sym_color = BasicFormat.DIFF_CHANGE - out1 = out1.reformat(line_color1) - out2 = out2.reformat(line_color2) - elif line1: - line_prefix = "<" - line_color1 = sym_color = BasicFormat.DIFF_REMOVE - out1 = out1.reformat(line_color1) - out2 = Text() - elif line2: - line_prefix = ">" - line_color2 = sym_color = BasicFormat.DIFF_ADD - out1 = Text() - out2 = out2.reformat(line_color2) - - if config.show_source and line2 and line2.comment: - out2 += f" {line2.comment}" - - def format_part( - out: Text, - line: Optional[Line], - line_color: Format, - btset: Set[int], - sc: FormatFunction, - ) -> Optional[Text]: - if line is None: - return None - if line.line_num is None: - return out - in_arrow = Text(" ") - out_arrow = Text() - if config.show_branches: - if line.line_num in btset: - in_arrow = Text("~>", sc(str(line.line_num))) - if line.branch_target is not None: - out_arrow = " " + Text("~>", sc(str(line.branch_target))) - formatted_line_num = Text(hex(line.line_num)[2:] + ":", line_color) - return formatted_line_num + " " + in_arrow + " " + out + out_arrow - - part1 = format_part(out1, line1, line_color1, bts1, sc5) - part2 = format_part(out2, line2, line_color2, bts2, sc6) - - if config.show_source and line2: - for source_line in line2.source_lines: - line_format = BasicFormat.SOURCE_OTHER - if config.source_old_binutils: - if source_line and re.fullmatch(r".*\.c(?:pp)?:\d+", source_line): - line_format = BasicFormat.SOURCE_FILENAME - elif source_line and source_line.endswith("():"): - line_format = BasicFormat.SOURCE_FUNCTION - try: - source_line = cxxfilt.demangle( - source_line[:-3], external_only=False - ) - except: - pass - else: - # File names and function names - if source_line and source_line[0] != "│": - line_format = BasicFormat.SOURCE_FILENAME - # Function names - if source_line.endswith("():"): - line_format = BasicFormat.SOURCE_FUNCTION - try: - source_line = cxxfilt.demangle( - source_line[:-3], external_only=False - ) - except: - pass - padding = " " * 7 if config.show_line_numbers else " " * 2 - output.append( - OutputLine( - base=None, - fmt2=padding + Text(source_line, line_format), - key2=source_line, - boring=True, - is_data_ref=False, - line1=None, - line2=None, - ) - ) - - key2 = line2.normalized_original if line2 else None - boring = False - if line_prefix == " ": - boring = True - elif config.compress and config.compress.same_instr and line_prefix in "irs": - boring = True - - if config.show_line_numbers: - if line2 and line2.source_line_num is not None: - num_color = ( - BasicFormat.SOURCE_LINE_NUM - if sym_color == BasicFormat.NONE - else sym_color - ) - num2 = Text(f"{line2.source_line_num:5}", num_color) - else: - num2 = Text(" " * 5) - else: - num2 = Text() - - fmt2 = Text(line_prefix, sym_color) + num2 + " " + (part2 or Text()) - - output.append( - OutputLine( - base=part1, - fmt2=fmt2, - key2=key2, - boring=boring, - is_data_ref=is_data_ref, - line1=line1, - line2=line2, - ) - ) - - output = output[config.skip_lines :] - - score = score_diff_lines(diffed_lines, config, symbol_map) - max_score = len(lines1) * config.penalty_deletion - return Diff(lines=output, score=score, max_score=max_score) - - -def chunk_diff_lines( - diff: List[OutputLine], -) -> List[Union[List[OutputLine], OutputLine]]: - """Chunk a diff into an alternating list like A B A B ... A, where: - * A is a List[OutputLine] of insertions, - * B is a single non-insertion OutputLine, with .base != None.""" - cur_right: List[OutputLine] = [] - chunks: List[Union[List[OutputLine], OutputLine]] = [] - for output_line in diff: - if output_line.base is not None: - chunks.append(cur_right) - chunks.append(output_line) - cur_right = [] - else: - cur_right.append(output_line) - chunks.append(cur_right) - return chunks - - -def compress_matching( - li: List[Tuple[OutputLine, ...]], context: int -) -> List[Tuple[OutputLine, ...]]: - ret: List[Tuple[OutputLine, ...]] = [] - matching_streak: List[Tuple[OutputLine, ...]] = [] - context = max(context, 0) - - def flush_matching() -> None: - if len(matching_streak) <= 2 * context + 1: - ret.extend(matching_streak) - else: - ret.extend(matching_streak[:context]) - skipped = len(matching_streak) - 2 * context - filler = OutputLine( - base=Text(f"<{skipped} lines>", BasicFormat.SOURCE_OTHER), - fmt2=Text(), - key2=None, - boring=False, - is_data_ref=False, - line1=None, - line2=None, - ) - columns = len(matching_streak[0]) - ret.append(tuple([filler] * columns)) - if context > 0: - ret.extend(matching_streak[-context:]) - matching_streak.clear() - - for line in li: - if line[0].boring: - matching_streak.append(line) - else: - flush_matching() - ret.append(line) - - flush_matching() - return ret - - -def align_diffs(old_diff: Diff, new_diff: Diff, config: Config) -> TableData: - headers: Tuple[Text, ...] - diff_lines: List[Tuple[OutputLine, ...]] - padding = " " * 7 if config.show_line_numbers else " " * 2 - - if config.diff_mode in (DiffMode.THREEWAY_PREV, DiffMode.THREEWAY_BASE): - old_chunks = chunk_diff_lines(old_diff.lines) - new_chunks = chunk_diff_lines(new_diff.lines) - diff_lines = [] - empty = OutputLine(Text(), Text(), None, True, False, None, None) - assert len(old_chunks) == len(new_chunks), "same target" - for old_chunk, new_chunk in zip(old_chunks, new_chunks): - if isinstance(old_chunk, list): - assert isinstance(new_chunk, list) - if not old_chunk and not new_chunk: - # Most of the time lines sync up without insertions/deletions, - # and there's no interdiffing to be done. - continue - differ = difflib.SequenceMatcher( - a=old_chunk, b=new_chunk, autojunk=False - ) - for tag, i1, i2, j1, j2 in differ.get_opcodes(): - if tag in ["equal", "replace"]: - for i, j in zip(range(i1, i2), range(j1, j2)): - diff_lines.append((empty, new_chunk[j], old_chunk[i])) - if tag in ["insert", "replace"]: - for j in range(j1 + i2 - i1, j2): - diff_lines.append((empty, new_chunk[j], empty)) - if tag in ["delete", "replace"]: - for i in range(i1 + j2 - j1, i2): - diff_lines.append((empty, empty, old_chunk[i])) - else: - assert isinstance(new_chunk, OutputLine) - # old_chunk.base and new_chunk.base have the same text since - # both diffs are based on the same target, but they might - # differ in color. Use the new version. - diff_lines.append((new_chunk, new_chunk, old_chunk)) - diff_lines = [ - (base, new, old if old != new else empty) for base, new, old in diff_lines - ] - headers = ( - Text("TARGET"), - Text(f"{padding}CURRENT ({new_diff.score})"), - Text(f"{padding}PREVIOUS ({old_diff.score})"), - ) - current_score = new_diff.score - max_score = new_diff.max_score - previous_score = old_diff.score - elif config.diff_mode in (DiffMode.SINGLE, DiffMode.SINGLE_BASE): - header = Text("BASE" if config.diff_mode == DiffMode.SINGLE_BASE else "CURRENT") - diff_lines = [(line,) for line in new_diff.lines] - headers = (header,) - # Scoring is disabled for view mode - current_score = 0 - max_score = 0 - previous_score = None - else: - diff_lines = [(line, line) for line in new_diff.lines] - headers = ( - Text("TARGET"), - Text(f"{padding}CURRENT ({new_diff.score})"), - ) - current_score = new_diff.score - max_score = new_diff.max_score - previous_score = None - if config.compress: - diff_lines = compress_matching(diff_lines, config.compress.context) - - def diff_line_to_table_line(line: Tuple[OutputLine, ...]) -> TableLine: - cells = [ - (line[0].base or Text(), line[0].line1), - ] - for ol in line[1:]: - cells.append((ol.fmt2, ol.line2)) - - return TableLine( - key=line[0].key2, - is_data_ref=line[0].is_data_ref, - cells=tuple(cells), - ) - - return TableData( - headers=headers, - current_score=current_score, - max_score=max_score, - previous_score=previous_score, - lines=[diff_line_to_table_line(line) for line in diff_lines], - ) - - -def debounced_fs_watch( - targets: List[str], - outq: "queue.Queue[Optional[float]]", - config: Config, - project: ProjectSettings, -) -> None: - import watchdog.events - import watchdog.observers - - class WatchEventHandler(watchdog.events.FileSystemEventHandler): - def __init__( - self, queue: "queue.Queue[float]", file_targets: List[str] - ) -> None: - self.queue = queue - self.file_targets = file_targets - - def on_modified(self, ev: object) -> None: - if isinstance(ev, watchdog.events.FileModifiedEvent): - self.changed(ev.src_path) - - def on_moved(self, ev: object) -> None: - if isinstance(ev, watchdog.events.FileMovedEvent): - self.changed(ev.dest_path) - - def should_notify(self, path: str) -> bool: - for target in self.file_targets: - if os.path.normpath(path) == target: - return True - if config.make and any( - path.endswith(suffix) for suffix in project.source_extensions - ): - return True - return False - - def changed(self, path: str) -> None: - if self.should_notify(path): - self.queue.put(time.time()) - - def debounce_thread() -> NoReturn: - listenq: "queue.Queue[float]" = queue.Queue() - file_targets: List[str] = [] - event_handler = WatchEventHandler(listenq, file_targets) - observer = watchdog.observers.Observer() - observed = set() - for target in targets: - if os.path.isdir(target): - observer.schedule(event_handler, target, recursive=True) # type: ignore - else: - file_targets.append(os.path.normpath(target)) - target = os.path.dirname(target) or "." - if target not in observed: - observed.add(target) - observer.schedule(event_handler, target) # type: ignore - observer.start() # type: ignore - while True: - t = listenq.get() - more = True - while more: - delay = t + DEBOUNCE_DELAY - time.time() - if delay > 0: - time.sleep(delay) - # consume entire queue - more = False - try: - while True: - t = listenq.get(block=False) - more = True - except queue.Empty: - pass - outq.put(t) - - th = threading.Thread(target=debounce_thread, daemon=True) - th.start() - - -class Display: - basedump: str - mydump: str - last_refresh_key: object - config: Config - emsg: Optional[str] - last_diff_output: Optional[Diff] - pending_update: Optional[str] - ready_queue: "queue.Queue[None]" - watch_queue: "queue.Queue[Optional[float]]" - less_proc: "Optional[subprocess.Popen[bytes]]" - - def __init__(self, basedump: str, mydump: str, config: Config) -> None: - self.config = config - self.base_lines = process(basedump, config) - self.mydump = mydump - self.emsg = None - self.last_refresh_key = None - self.last_diff_output = None - - def run_diff(self) -> Tuple[str, object]: - if self.emsg is not None: - return (self.emsg, self.emsg) - - my_lines = process(self.mydump, self.config) - - if self.config.diff_mode == DiffMode.SINGLE_BASE: - diff_output = do_diff(self.base_lines, self.base_lines, self.config) - elif self.config.diff_mode == DiffMode.SINGLE: - diff_output = do_diff(my_lines, my_lines, self.config) - else: - diff_output = do_diff(self.base_lines, my_lines, self.config) - - last_diff_output = self.last_diff_output or diff_output - if self.config.diff_mode != DiffMode.THREEWAY_BASE or not self.last_diff_output: - self.last_diff_output = diff_output - - data = align_diffs(last_diff_output, diff_output, self.config) - output = self.config.formatter.table(data) - - refresh_key = ( - [line.key2 for line in diff_output.lines], - diff_output.score, - ) - - return (output, refresh_key) - - def run_less( - self, output: str - ) -> "Tuple[subprocess.Popen[bytes], subprocess.Popen[bytes]]": - # Pipe the output through 'tail' and only then to less, to ensure the - # write call doesn't block. ('tail' has to buffer all its input before - # it starts writing.) This also means we don't have to deal with pipe - # closure errors. - buffer_proc = subprocess.Popen( - BUFFER_CMD, stdin=subprocess.PIPE, stdout=subprocess.PIPE - ) - less_proc = subprocess.Popen(LESS_CMD, stdin=buffer_proc.stdout) - assert buffer_proc.stdin - assert buffer_proc.stdout - buffer_proc.stdin.write(output.encode()) - buffer_proc.stdin.close() - buffer_proc.stdout.close() - return (buffer_proc, less_proc) - - def run_sync(self) -> None: - output, _ = self.run_diff() - proca, procb = self.run_less(output) - procb.wait() - proca.wait() - - def run_async(self, watch_queue: "queue.Queue[Optional[float]]") -> None: - self.watch_queue = watch_queue - self.ready_queue = queue.Queue() - self.pending_update = None - output, refresh_key = self.run_diff() - self.last_refresh_key = refresh_key - dthread = threading.Thread(target=self.display_thread, args=(output,)) - dthread.start() - self.ready_queue.get() - - def display_thread(self, initial_output: str) -> None: - proca, procb = self.run_less(initial_output) - self.less_proc = procb - self.ready_queue.put(None) - while True: - ret = procb.wait() - proca.wait() - self.less_proc = None - if ret != 0: - # fix the terminal - os.system("tput reset") - if ret != 0 and self.pending_update is not None: - # killed by program with the intent to refresh - output = self.pending_update - self.pending_update = None - proca, procb = self.run_less(output) - self.less_proc = procb - self.ready_queue.put(None) - else: - # terminated by user, or killed - self.watch_queue.put(None) - self.ready_queue.put(None) - break - - def progress(self, msg: str) -> None: - # Write message to top-left corner - sys.stdout.write("\x1b7\x1b[1;1f{}\x1b8".format(msg + " ")) - sys.stdout.flush() - - def update(self, text: str, error: bool) -> None: - if not error and not self.emsg and text == self.mydump: - self.progress("Unchanged. ") - return - if not error: - self.mydump = text - self.emsg = None - else: - self.emsg = text - output, refresh_key = self.run_diff() - if refresh_key == self.last_refresh_key: - self.progress("Unchanged. ") - return - self.last_refresh_key = refresh_key - self.pending_update = output - if not self.less_proc: - return - self.less_proc.kill() - self.ready_queue.get() - - def terminate(self) -> None: - if not self.less_proc: - return - self.less_proc.kill() - self.ready_queue.get() - - -def main() -> None: - args = parser.parse_args() - - # Apply project-specific configuration. - settings: Dict[str, Any] = {} - diff_settings.apply(settings, args) # type: ignore - project = create_project_settings(settings) - - try: - config = create_config(args, project) - except ValueError as e: - fail(str(e)) - - if config.algorithm == "levenshtein": - try: - import Levenshtein - except ModuleNotFoundError as e: - fail(MISSING_PREREQUISITES.format(e.name)) - - if config.show_source: - try: - import cxxfilt - except ModuleNotFoundError as e: - fail(MISSING_PREREQUISITES.format(e.name)) - - if ( - config.diff_mode in (DiffMode.THREEWAY_BASE, DiffMode.THREEWAY_PREV) - and not args.watch - ): - fail("Threeway diffing requires -w.") - - if args.diff_elf_symbol: - make_target, basecmd, mycmd = dump_elf( - args.start, args.end, args.diff_elf_symbol, config, project - ) - elif config.diff_obj: - make_target, basecmd, mycmd = dump_objfile( - args.start, args.end, config, project - ) - else: - make_target, basecmd, mycmd = dump_binary(args.start, args.end, config, project) - - map_build_target_fn = getattr(diff_settings, "map_build_target", None) - if map_build_target_fn: - make_target = map_build_target_fn(make_target=make_target) - - if args.write_asm is not None: - mydump = run_objdump(mycmd, config, project) - with open(args.write_asm, "w") as f: - f.write(mydump) - print(f"Wrote assembly to {args.write_asm}.") - sys.exit(0) - - if args.base_asm is not None: - with open(args.base_asm) as f: - basedump = f.read() - elif config.diff_mode != DiffMode.SINGLE: - basedump = run_objdump(basecmd, config, project) - else: - basedump = "" - - mydump = run_objdump(mycmd, config, project) - - display = Display(basedump, mydump, config) - - if args.no_pager or args.format in ("html", "json"): - print(display.run_diff()[0]) - elif not args.watch: - display.run_sync() - else: - if not args.make and not args.agree: - yn = input( - "Warning: watch-mode (-w) enabled without auto-make (-m) or agree-all (-y). " - "You will have to run make manually. Ok? (Y/n) " - ) - if yn.lower() == "n": - return - if args.make: - watch_sources = None - watch_sources_for_target_fn = getattr( - diff_settings, "watch_sources_for_target", None - ) - if watch_sources_for_target_fn: - watch_sources = watch_sources_for_target_fn(make_target) - watch_sources = watch_sources or project.source_directories - if not watch_sources: - fail("Missing source_directories config, don't know what to watch.") - else: - watch_sources = [make_target] - q: "queue.Queue[Optional[float]]" = queue.Queue() - debounced_fs_watch(watch_sources, q, config, project) - display.run_async(q) - last_build = 0.0 - try: - while True: - t = q.get() - if t is None: - break - if t < last_build: - continue - last_build = time.time() - if args.make: - display.progress("Building...") - ret = run_make_capture_output(make_target, project) - if ret.returncode != 0: - display.update( - ret.stderr.decode("utf-8-sig", "replace") - or ret.stdout.decode("utf-8-sig", "replace"), - error=True, - ) - continue - mydump = run_objdump(mycmd, config, project) - display.update(mydump, error=False) - except KeyboardInterrupt: - display.terminate() - - -if __name__ == "__main__": - main() diff --git a/tools/asm-differ/diff_settings.py b/tools/asm-differ/diff_settings.py deleted file mode 100644 index 19d67d548..000000000 --- a/tools/asm-differ/diff_settings.py +++ /dev/null @@ -1,12 +0,0 @@ -def apply(config, args): - config["baseimg"] = "target.bin" - config["myimg"] = "source.bin" - config["mapfile"] = "build.map" - config["source_directories"] = ["."] - # config["show_line_numbers_default"] = True - # config["arch"] = "mips" - # config["map_format"] = "gnu" # gnu, mw, ms - # config["build_dir"] = "build/" # only needed for mw and ms map format - # config["expected_dir"] = "expected/" # needed for -o - # config["makeflags"] = [] - # config["objdump_executable"] = "" diff --git a/tools/asm-differ/mypy.ini b/tools/asm-differ/mypy.ini deleted file mode 100644 index 8f68a4a7e..000000000 --- a/tools/asm-differ/mypy.ini +++ /dev/null @@ -1,17 +0,0 @@ -[mypy] -check_untyped_defs = True -disallow_any_generics = True -disallow_incomplete_defs = True -disallow_untyped_calls = True -disallow_untyped_decorators = True -disallow_untyped_defs = True -no_implicit_optional = True -warn_redundant_casts = True -warn_return_any = True -warn_unused_ignores = True -ignore_missing_imports = True -python_version = 3.7 -files = diff.py, test.py - -[mypy-diff_settings] -ignore_errors = True diff --git a/tools/asm-differ/poetry.lock b/tools/asm-differ/poetry.lock deleted file mode 100644 index 2826d784b..000000000 --- a/tools/asm-differ/poetry.lock +++ /dev/null @@ -1,321 +0,0 @@ -# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. - -[[package]] -name = "ansiwrap" -version = "0.8.4" -description = "textwrap, but savvy to ANSI colors and styles" -category = "main" -optional = false -python-versions = "*" -files = [ - {file = "ansiwrap-0.8.4-py2.py3-none-any.whl", hash = "sha256:7b053567c88e1ad9eed030d3ac41b722125e4c1271c8a99ade797faff1f49fb1"}, - {file = "ansiwrap-0.8.4.zip", hash = "sha256:ca0c740734cde59bf919f8ff2c386f74f9a369818cdc60efe94893d01ea8d9b7"}, -] - -[package.dependencies] -textwrap3 = ">=0.9.2" - -[[package]] -name = "colorama" -version = "0.4.6" -description = "Cross-platform colored terminal text." -category = "main" -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -files = [ - {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, - {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, -] - -[[package]] -name = "cxxfilt" -version = "0.3.0" -description = "Python interface to c++filt / abi::__cxa_demangle" -category = "main" -optional = false -python-versions = "*" -files = [ - {file = "cxxfilt-0.3.0-py2.py3-none-any.whl", hash = "sha256:774e85a8d0157775ed43276d89397d924b104135762d86b3a95f81f203094e07"}, - {file = "cxxfilt-0.3.0.tar.gz", hash = "sha256:7df6464ba5e8efbf0d8974c0b2c78b32546676f06059a83515dbdfa559b34214"}, -] - -[package.extras] -test = ["pytest (>=3.0.0)"] - -[[package]] -name = "levenshtein" -version = "0.20.9" -description = "Python extension for computing string edit distances and similarities." -category = "main" -optional = false -python-versions = ">=3.6" -files = [ - {file = "Levenshtein-0.20.9-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:105c239ec786750cd5136991c58196b440cc39b6acf3ec8227f6562c9a94e4b9"}, - {file = "Levenshtein-0.20.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2f7728bea7fe6dc55ceecde0dcda4287e74fe3b6733ad42530f46aaa8d2f81d0"}, - {file = "Levenshtein-0.20.9-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cc7eca755c13c92814c8cce8175524cf764ce38f39228b602f59eac58cfdc51a"}, - {file = "Levenshtein-0.20.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8a552e79d053dc1324fb90d342447fd4e15736f4cbc5363b6fbd5577f53dce9"}, - {file = "Levenshtein-0.20.9-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5474b2681ee0b7944fb1e7fe281cd44e2dfe75b03ba4558dca49c96fa0861b62"}, - {file = "Levenshtein-0.20.9-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:56e132c203b0dd8fc72a33e791c39ad0d5a25bcf24b130a1e202abbf489a3e75"}, - {file = "Levenshtein-0.20.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3badc94708ac05b405e795fde58a53272b90a9ee6099ecd54a345658b7b812e1"}, - {file = "Levenshtein-0.20.9-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:48b9b3ae095b14dad7bc4bd219c7cd9113a7aa123a033337c85b00fe2ed565d3"}, - {file = "Levenshtein-0.20.9-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:0d3a1f7328c91caeb1f857ddd2787e3f19d60cc2c688339d249ca8841da61454"}, - {file = "Levenshtein-0.20.9-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:ef67c50428c99caf67d31bd209da21d9378da5f0cc3ad4f7bafb6caa78aee6f2"}, - {file = "Levenshtein-0.20.9-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:47f6d1592c0891f7355e38a302becd233336ca2f55f9a8be3a8635f946a6784f"}, - {file = "Levenshtein-0.20.9-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:2891019740e874f05e0349e9f27b6af8ad837b1612f42e9c90c296d54d1404fd"}, - {file = "Levenshtein-0.20.9-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c554704eec4f4ba742febdcc79a85491f8f9a1d493cb103bb2af18536d6cf122"}, - {file = "Levenshtein-0.20.9-cp310-cp310-win32.whl", hash = "sha256:7628e356b3f9c78ad7272c3b9137f0641a1368849e749ff6f2c8fe372795806b"}, - {file = "Levenshtein-0.20.9-cp310-cp310-win_amd64.whl", hash = "sha256:ba2bafe3511194a37044cae4e7d328cca70657933052691c37eba2ca428a379d"}, - {file = "Levenshtein-0.20.9-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:7605a94145198d19fdaaa7e29c0f8a56ad719b12386f3ae8cd8ed4cb9fa6c2e4"}, - {file = "Levenshtein-0.20.9-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:29db4dabfad2ddf33c7986eb6fd525c7587cca4c4d9e187365cff0a5281f5a35"}, - {file = "Levenshtein-0.20.9-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:965336c1772a4fc5fb2686a2a0bfaf3455dced96f19f50f278da8bc139076d31"}, - {file = "Levenshtein-0.20.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:67235753035ac898d6475c0b29540521018db2e0027a3c1deb9aa0af0a84fd74"}, - {file = "Levenshtein-0.20.9-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:120dca58136aee3d8c7b190e30db7b6a6eb9579ea5712df84ad076a389801743"}, - {file = "Levenshtein-0.20.9-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6496ea66a6f755e48c0d82f1eee396d16edcd5592d4b3677d26fa789a636a728"}, - {file = "Levenshtein-0.20.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0af20327acc2c904d11611cb3a0d8d17f80c279a12e0b84189eafc35297186d"}, - {file = "Levenshtein-0.20.9-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:34d2f891ef53afbab6cf2eeb92ff13151884d17dc80a2d6d3c7ae74d7738b772"}, - {file = "Levenshtein-0.20.9-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:2ab9c72380582bf4745d1c5b055b1df0c85f7a980a04bd7603a855dd91478c0f"}, - {file = "Levenshtein-0.20.9-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:6de13be3eb5ac48053fb1635a7b4daa936b9114ad4b264942e9eb709fcaa41dd"}, - {file = "Levenshtein-0.20.9-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:a9fc296860588251d8d72b4f4637cca4eef7351e042a7a23d44e6385aef1e160"}, - {file = "Levenshtein-0.20.9-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:35777b20fe35858248c22da37984469e6dd1278f55d17c53378312853d5d683d"}, - {file = "Levenshtein-0.20.9-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:6b9e0642ddb4c431f77c38cec9edbd0317e26c3f37d072ccf281ab58926dce69"}, - {file = "Levenshtein-0.20.9-cp311-cp311-win32.whl", hash = "sha256:f88ec322d86d3cc9d3936dbf6b421ad813950c2658599d48ac4ede59f2a6047e"}, - {file = "Levenshtein-0.20.9-cp311-cp311-win_amd64.whl", hash = "sha256:2907a6888455f9915d5b656f5d058f63eaf6063b2c7f0f1ff6bc05706ae5bc39"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:6bcebc79760be08488cb921732af34ade6abc7476a94866881c68b45ec4b6c82"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:47d8d4f3825d1d8f3b19382537a8536e689cf57aaa224d2cb4f44cf844811885"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9d40e18a5817ee7f0675401613a26c492fd4ea68d2103c1480fb5a6ab1b8763d"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4d258f3d44f6bac17f33002fea34570049507d3476c3716b5267170c666b20b4"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c621e0c389546147ed43c33ca4168de0f91c920508ab8a94a400835fa084f486"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:57a31527dc7994353091626e62b7d82d53290cb00df48d3e5d29cb291fb4c03c"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:129c8f192e656b7c2c543bf0d704d677720771b8bc2f30c50db02fbc2001bac2"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:5a01fca58255be6bf724a40af2575d7cf644c099c28a00d1f5f6a81675e60e7d"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-musllinux_1_1_ppc64le.whl", hash = "sha256:4c13749ea39a228f05d5bd9d473e76f726fc2dcd493cafc322f740921a6eeffb"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-musllinux_1_1_s390x.whl", hash = "sha256:69daa0f8eefa5b947255a81346741ed86fe7030e0909741dbd978e38b30da3fd"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:fcc78a73ed423bbb09ac902dd2e1ff1094d159d1c6766e5e52da5f376a4cba18"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-win32.whl", hash = "sha256:d82ae57982a9f33c55778f1f0f63d5e51e291aee236abed3b90497578b944202"}, - {file = "Levenshtein-0.20.9-cp36-cp36m-win_amd64.whl", hash = "sha256:4082379b406752fc1173ed1f8c3a122c5d5491e10e564ed721602e4e049e3d4c"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:cb499783b7126e6fc45c39ab34c8114148425c5d975b1ce35e6c47c0eda58a94"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ce747b296aad3bd8a563cccf2119cf37bf72f668076bfdad6ec55f0a0596dd9"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1347c3ebbe8f42f7a487e8d23a95bde6529379b4939ad51d32246d001565c499"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2a2f1c1e8360603a6da29416da61d1907a27656843e269413091c8c3a3e6286e"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:73c1caaedbee3617fd29139aac8dab7743776b59c3c1fed2790308ecb43c7b25"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a1f24133df69f8b618fc508d6023695130ad3c3c8968ef43aaeca21835eb337a"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:cf7260722f8170c09af5cfa714bb45626a4dfc85d71d1c1c9c52c2a6901cc501"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:01668178fd9244df290db0340293982fe7641162a12a35ad9ffb3fe145ce6377"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:1e46f9d3483dc4991ac60ff3711b0d40f93e352cc8edc16b68df57ccc472bd6c"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:680cd250dc1875eb80cf2a0cca742bd13f6f9ab11c48317244fcc483eba1dd67"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:2346e2f7dfbbc2936bd81e19f7734984e72486ffc086760c897b39b9f674b2fa"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-win32.whl", hash = "sha256:7f31bcf257fec9719d0d97185c419d315f6f20a194f0b442919e352d19418b2e"}, - {file = "Levenshtein-0.20.9-cp37-cp37m-win_amd64.whl", hash = "sha256:48262bc9830ad60de96411fcb2e96a522c7206e7069169e04d89dd79364a7722"}, - {file = "Levenshtein-0.20.9-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:eba5696e1f8e8da225498fd1d743886d639400cafd0e5be3c553978cbb54c345"}, - {file = "Levenshtein-0.20.9-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:679333188f9791c85109d2981e97e8721a99b2b975b5c52d16aca50ac9c70757"}, - {file = "Levenshtein-0.20.9-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:06c9cfc61cf66833692d1ed258ec5a0871221b0779f1281c32a10348c492e2c5"}, - {file = "Levenshtein-0.20.9-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b5d80d949168df406f2ac9ade1a5d0419cef0a8df611c8c2efe88f0248c9d0c0"}, - {file = "Levenshtein-0.20.9-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9275c6e601ff7f659116e2235e8585950c9c39d72504006077be85bf27950b35"}, - {file = "Levenshtein-0.20.9-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6414eea342d9632045e12b66bef043dbc6557189a283dc4dcc5966f63fa48998"}, - {file = "Levenshtein-0.20.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:56571c58700600a382ecdf3f9efcb132ed16a0476cbb4e23a9478ab0ae788fd9"}, - {file = "Levenshtein-0.20.9-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e7ccb76ffd9b851384f9cf1595b90b17cae46f0ab895e234de11ea48f9d9f73a"}, - {file = "Levenshtein-0.20.9-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:109172943cff7fb10f28a9eb819eb3eaf9c88fe38661fb1d0f230a8ae68a615c"}, - {file = "Levenshtein-0.20.9-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:534c8bbdfd033fa20575d57332d9ac0447b5afbeca7db975ba169762ece2051f"}, - {file = "Levenshtein-0.20.9-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:381a725963c392585135654caa3c7fc32cb1755ed977fb9db72e8838fee261be"}, - {file = "Levenshtein-0.20.9-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:7e4a44b1223980a9880e6f2bbf19121a125928580df9e4e81207199190343e11"}, - {file = "Levenshtein-0.20.9-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:fc0ced58ee6d07351cde140a7ec88e5f2ceb053c805af1f90514d21914d21cad"}, - {file = "Levenshtein-0.20.9-cp38-cp38-win32.whl", hash = "sha256:5eec0868ffcd825564dd5e3399305eaa159220554d1aedbff13af0de1fe01f6c"}, - {file = "Levenshtein-0.20.9-cp38-cp38-win_amd64.whl", hash = "sha256:e9db476e40a3aa184631d102b716a019f70837eb0fcdd5b5d1504f099f91359c"}, - {file = "Levenshtein-0.20.9-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:d5a20ecc20a09a32c72128c43d7df23877a2469b3c17780ae83f9a9d55873c08"}, - {file = "Levenshtein-0.20.9-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8b7b772f2f62a19a15ccb1b09c6c7754ca7430bb7e19d4ca4ff232958786873b"}, - {file = "Levenshtein-0.20.9-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:af92326b90ea6fe4521cf6a5dfe450e21150393c573ef3ad9ee446f1009fbfbd"}, - {file = "Levenshtein-0.20.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b48554dad328e198a636f937e2f4c057aac8e4bfcb8467b10e0f5daa94307b17"}, - {file = "Levenshtein-0.20.9-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:82304821e128d5453d1755d1c2f3d9cdf75e9def3517cf913b09df174e20283b"}, - {file = "Levenshtein-0.20.9-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2052357c5da195ede7dbc81a4e3408ebd6374a1ff1b86a0a9d8b8ce9562b32c3"}, - {file = "Levenshtein-0.20.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:44d60c6b47ccd6841c990418f7f4f58c28f7da9b07b81eaafc99b836cf351df1"}, - {file = "Levenshtein-0.20.9-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8dc2194c917e4466cb604580b16e42286f04e3fe0424489459e68f0834f5c527"}, - {file = "Levenshtein-0.20.9-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:bb1e20965d759d89318cac7ff7eb045eb1fafcb5c3fa3047a23f6ae20c810ad7"}, - {file = "Levenshtein-0.20.9-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:74e959035da10a54e7a2eee28408eff672297ce96cdadd6f4a2f269a06e395c4"}, - {file = "Levenshtein-0.20.9-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:4a441b23d9704f57eb34af6a300ae5c335b9e77e6a065ada36ca69d6fc582af9"}, - {file = "Levenshtein-0.20.9-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:f59470c49114a5da064712a427317f2b1fa5bb89aa2dfd0e300f8289e26aec28"}, - {file = "Levenshtein-0.20.9-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:06191f5d0527e3224107aea260b5cffc8a78722e0efb4e793f0e45c449b813a2"}, - {file = "Levenshtein-0.20.9-cp39-cp39-win32.whl", hash = "sha256:3235c461904fe94b4f62fee78a1658c1316344411c81b02400c27d692a893f8f"}, - {file = "Levenshtein-0.20.9-cp39-cp39-win_amd64.whl", hash = "sha256:8b852def43d165c2f2b468239d66b847d9e6f52a775fc657773ced04d26062bd"}, - {file = "Levenshtein-0.20.9-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:f674cc75f127692525563155e500a3fa16aaf24dafd33a9bcda46e2979f793a1"}, - {file = "Levenshtein-0.20.9-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a34e3fd21acb31fcd29a0c8353dca74dfbb59957210a6f142505907a9dff3d59"}, - {file = "Levenshtein-0.20.9-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e0ddddf2beafd1a2e17a87f80be562a7f7478e6098ccfc15de4c879972dfa2f9"}, - {file = "Levenshtein-0.20.9-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9649af1a896a4a7fc7f6f1fd093e8a92f463297f56c7bd0f8d7d16dfabeb236d"}, - {file = "Levenshtein-0.20.9-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:d7bd7f25336849027fbe5ed32b6ffd404436727d78a014e348dcd17347c73fd8"}, - {file = "Levenshtein-0.20.9-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:0371d996ae81089296f42b6e886c7bf138d1cb0f002b0c724a9e5d689b29b5a0"}, - {file = "Levenshtein-0.20.9-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7e00e2fda9f225b5f4537647f6195cf220d468532739d3390eaf082b1d76c87"}, - {file = "Levenshtein-0.20.9-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1600f5ebe2f2aebf13e88cf488ec2e5ce25f7a42b5846335018693baf4ea63bd"}, - {file = "Levenshtein-0.20.9-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9bcd59fcf06aaedda98da185ec289dc2c2c9922ce789f6a9c101709d4a22cac9"}, - {file = "Levenshtein-0.20.9-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:1549e307028fa5c3a8cf28ae8bcb1f6072df2abf7f36b9d7adf7fd60690fe372"}, - {file = "Levenshtein-0.20.9-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:795f2e95d09a33c66c73cd49be3ee632fb4b8c41be72c0cb8df29a329ce7d111"}, - {file = "Levenshtein-0.20.9-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:726bfb361d3b6786bea31392752f0ffcca568db7dc3f1e274f1b529489b8ad05"}, - {file = "Levenshtein-0.20.9-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e0fd315132786375de532355fa06b2f11c4b4af5784b7e064dc54b6ee0c3281"}, - {file = "Levenshtein-0.20.9-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0674bc0549d5ea9edb934b3b03a160a116cc410feb5739a51f9c4f618ee674e3"}, - {file = "Levenshtein-0.20.9-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:1ef8f3ecdfca5d6f0538226338d58617270439a1cc9b6cacb30a388984bb1608"}, - {file = "Levenshtein-0.20.9.tar.gz", hash = "sha256:70a8ad5e28bb76d87da1eb3f31de940836596547d6d01317c2289f5b7cd0b0ea"}, -] - -[package.dependencies] -rapidfuzz = ">=2.3.0,<3.0.0" - -[[package]] -name = "rapidfuzz" -version = "2.15.1" -description = "rapid fuzzy string matching" -category = "main" -optional = false -python-versions = ">=3.7" -files = [ - {file = "rapidfuzz-2.15.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:fc0bc259ebe3b93e7ce9df50b3d00e7345335d35acbd735163b7c4b1957074d3"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d59fb3a410d253f50099d7063855c2b95df1ef20ad93ea3a6b84115590899f25"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c525a3da17b6d79d61613096c8683da86e3573e807dfaecf422eea09e82b5ba6"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d4deae6a918ecc260d0c4612257be8ba321d8e913ccb43155403842758c46fbe"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2577463d10811386e704a3ab58b903eb4e2a31b24dfd9886d789b0084d614b01"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f67d5f56aa48c0da9de4ab81bffb310683cf7815f05ea38e5aa64f3ba4368339"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d7927722ff43690e52b3145b5bd3089151d841d350c6f8378c3cfac91f67573a"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6534afc787e32c4104f65cdeb55f6abe4d803a2d0553221d00ef9ce12788dcde"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d0ae6ec79a1931929bb9dd57bc173eb5ba4c7197461bf69e3a34b6dd314feed2"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:be7ccc45c4d1a7dfb595f260e8022a90c6cb380c2a346ee5aae93f85c96d362b"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:8ba013500a2b68c64b2aecc5fb56a2dad6c2872cf545a0308fd044827b6e5f6a"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:4d9f7d10065f657f960b48699e7dddfce14ab91af4bab37a215f0722daf0d716"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7e24a1b802cea04160b3fccd75d2d0905065783ebc9de157d83c14fb9e1c6ce2"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-win32.whl", hash = "sha256:dffdf03499e0a5b3442951bb82b556333b069e0661e80568752786c79c5b32de"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-win_amd64.whl", hash = "sha256:7d150d90a7c6caae7962f29f857a4e61d42038cfd82c9df38508daf30c648ae7"}, - {file = "rapidfuzz-2.15.1-cp310-cp310-win_arm64.whl", hash = "sha256:87c30e9184998ff6eb0fa9221f94282ce7c908fd0da96a1ef66ecadfaaa4cdb7"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6986413cb37035eb796e32f049cbc8c13d8630a4ac1e0484e3e268bb3662bd1b"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a72f26e010d4774b676f36e43c0fc8a2c26659efef4b3be3fd7714d3491e9957"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b5cd54c98a387cca111b3b784fc97a4f141244bbc28a92d4bde53f164464112e"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:da7fac7c3da39f93e6b2ebe386ed0ffe1cefec91509b91857f6e1204509e931f"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f976e76ac72f650790b3a5402431612175b2ac0363179446285cb3c901136ca9"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:abde47e1595902a490ed14d4338d21c3509156abb2042a99e6da51f928e0c117"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ca8f1747007a3ce919739a60fa95c5325f7667cccf6f1c1ef18ae799af119f5e"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c35da09ab9797b020d0d4f07a66871dfc70ea6566363811090353ea971748b5a"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:a3a769ca7580686a66046b77df33851b3c2d796dc1eb60c269b68f690f3e1b65"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:d50622efefdb03a640a51a6123748cd151d305c1f0431af762e833d6ffef71f0"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:b7461b0a7651d68bc23f0896bffceea40f62887e5ab8397bf7caa883592ef5cb"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:074ee9e17912e025c72a5780ee4c7c413ea35cd26449719cc399b852d4e42533"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:7025fb105a11f503943f17718cdb8241ea3bb4d812c710c609e69bead40e2ff0"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-win32.whl", hash = "sha256:2084d36b95139413cef25e9487257a1cc892b93bd1481acd2a9656f7a1d9930c"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-win_amd64.whl", hash = "sha256:5a738fcd24e34bce4b19126b92fdae15482d6d3a90bd687fd3d24ce9d28ce82d"}, - {file = "rapidfuzz-2.15.1-cp311-cp311-win_arm64.whl", hash = "sha256:dc3cafa68cfa54638632bdcadf9aab89a3d182b4a3f04d2cad7585ed58ea8731"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:3c53d57ba7a88f7bf304d4ea5a14a0ca112db0e0178fff745d9005acf2879f7d"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a6ee758eec4cf2215dc8d8eafafcea0d1f48ad4b0135767db1b0f7c5c40a17dd"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2d93ba3ae59275e7a3a116dac4ffdb05e9598bf3ee0861fecc5b60fb042d539e"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7c3ff75e647908ddbe9aa917fbe39a112d5631171f3fcea5809e2363e525a59d"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6d89c421702474c6361245b6b199e6e9783febacdbfb6b002669e6cb3ef17a09"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f69e6199fec0f58f9a89afbbaea78d637c7ce77f656a03a1d6ea6abdc1d44f8"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:41dfea282844d0628279b4db2929da0dacb8ac317ddc5dcccc30093cf16357c1"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:2dd03477feefeccda07b7659dd614f6738cfc4f9b6779dd61b262a73b0a9a178"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:5efe035aa76ff37d1b5fa661de3c4b4944de9ff227a6c0b2e390a95c101814c0"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:ed2cf7c69102c7a0a06926d747ed855bc836f52e8d59a5d1e3adfd980d1bd165"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:a0e441d4c2025110ec3eba5d54f11f78183269a10152b3a757a739ffd1bb12bf"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-win32.whl", hash = "sha256:a4a54efe17cc9f53589c748b53f28776dfdfb9bc83619685740cb7c37985ac2f"}, - {file = "rapidfuzz-2.15.1-cp37-cp37m-win_amd64.whl", hash = "sha256:bb8318116ecac4dfb84841d8b9b461f9bb0c3be5b616418387d104f72d2a16d1"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e9296c530e544f68858c3416ad1d982a1854f71e9d2d3dcedb5b216e6d54f067"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:49c4bcdb9238f11f8c4eba1b898937f09b92280d6f900023a8216008f299b41a"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ebb40a279e134bb3fef099a8b58ed5beefb201033d29bdac005bddcdb004ef71"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a7381c11cb590bbd4e6f2d8779a0b34fdd2234dfa13d0211f6aee8ca166d9d05"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cfdcdedfd12a0077193f2cf3626ff6722c5a184adf0d2d51f1ec984bf21c23c3"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f85bece1ec59bda8b982bd719507d468d4df746dfb1988df11d916b5e9fe19e8"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b1b393f4a1eaa6867ffac6aef58cfb04bab2b3d7d8e40b9fe2cf40dd1d384601"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53de456ef020a77bf9d7c6c54860a48e2e902584d55d3001766140ac45c54bc7"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:2492330bc38b76ed967eab7bdaea63a89b6ceb254489e2c65c3824efcbf72993"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:099e4c6befaa8957a816bdb67ce664871f10aaec9bebf2f61368cf7e0869a7a1"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:46599b2ad4045dd3f794a24a6db1e753d23304699d4984462cf1ead02a51ddf3"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:591f19d16758a3c55c9d7a0b786b40d95599a5b244d6eaef79c7a74fcf5104d8"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:ed17359061840eb249f8d833cb213942e8299ffc4f67251a6ed61833a9f2ea20"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-win32.whl", hash = "sha256:aa1e5aad325168e29bf8e17006479b97024aa9d2fdbe12062bd2f8f09080acf8"}, - {file = "rapidfuzz-2.15.1-cp38-cp38-win_amd64.whl", hash = "sha256:c2bb68832b140c551dbed691290bef4ee6719d4e8ce1b7226a3736f61a9d1a83"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:3fac40972cf7b6c14dded88ae2331eb50dfbc278aa9195473ef6fc6bfe49f686"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f0e456cbdc0abf39352800309dab82fd3251179fa0ff6573fa117f51f4e84be8"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:22b9d22022b9d09fd4ece15102270ab9b6a5cfea8b6f6d1965c1df7e3783f5ff"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:46754fe404a9a6f5cbf7abe02d74af390038d94c9b8c923b3f362467606bfa28"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:91abb8bf7610efe326394adc1d45e1baca8f360e74187f3fa0ef3df80cdd3ba6"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e40a2f60024f9d3c15401e668f732800114a023f3f8d8c40f1521a62081ff054"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a48ee83916401ac73938526d7bd804e01d2a8fe61809df7f1577b0b3b31049a3"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c71580052f9dbac443c02f60484e5a2e5f72ad4351b84b2009fbe345b1f38422"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:82b86d5b8c1b9bcbc65236d75f81023c78d06a721c3e0229889ff4ed5c858169"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:fc4528b7736e5c30bc954022c2cf410889abc19504a023abadbc59cdf9f37cae"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:e1e0e569108a5760d8f01d0f2148dd08cc9a39ead79fbefefca9e7c7723c7e88"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:94e1c97f0ad45b05003806f8a13efc1fc78983e52fa2ddb00629003acf4676ef"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:47e81767a962e41477a85ad7ac937e34d19a7d2a80be65614f008a5ead671c56"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-win32.whl", hash = "sha256:79fc574aaf2d7c27ec1022e29c9c18f83cdaf790c71c05779528901e0caad89b"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-win_amd64.whl", hash = "sha256:f3dd4bcef2d600e0aa121e19e6e62f6f06f22a89f82ef62755e205ce14727874"}, - {file = "rapidfuzz-2.15.1-cp39-cp39-win_arm64.whl", hash = "sha256:cac095cbdf44bc286339a77214bbca6d4d228c9ebae3da5ff6a80aaeb7c35634"}, - {file = "rapidfuzz-2.15.1-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:b89d1126be65c85763d56e3b47d75f1a9b7c5529857b4d572079b9a636eaa8a7"}, - {file = "rapidfuzz-2.15.1-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:19b7460e91168229768be882ea365ba0ac7da43e57f9416e2cfadc396a7df3c2"}, - {file = "rapidfuzz-2.15.1-pp37-pypy37_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:93c33c03e7092642c38f8a15ca2d8fc38da366f2526ec3b46adf19d5c7aa48ba"}, - {file = "rapidfuzz-2.15.1-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:040faca2e26d9dab5541b45ce72b3f6c0e36786234703fc2ac8c6f53bb576743"}, - {file = "rapidfuzz-2.15.1-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:6e2a3b23e1e9aa13474b3c710bba770d0dcc34d517d3dd6f97435a32873e3f28"}, - {file = "rapidfuzz-2.15.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:2e597b9dfd6dd180982684840975c458c50d447e46928efe3e0120e4ec6f6686"}, - {file = "rapidfuzz-2.15.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d14752c9dd2036c5f36ebe8db5f027275fa7d6b3ec6484158f83efb674bab84e"}, - {file = "rapidfuzz-2.15.1-pp38-pypy38_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:558224b6fc6124d13fa32d57876f626a7d6188ba2a97cbaea33a6ee38a867e31"}, - {file = "rapidfuzz-2.15.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c89cfa88dc16fd8c9bcc0c7f0b0073f7ef1e27cceb246c9f5a3f7004fa97c4d"}, - {file = "rapidfuzz-2.15.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:509c5b631cd64df69f0f011893983eb15b8be087a55bad72f3d616b6ae6a0f96"}, - {file = "rapidfuzz-2.15.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:0f73a04135a03a6e40393ecd5d46a7a1049d353fc5c24b82849830d09817991f"}, - {file = "rapidfuzz-2.15.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8c99d53138a2dfe8ada67cb2855719f934af2733d726fbf73247844ce4dd6dd5"}, - {file = "rapidfuzz-2.15.1-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f01fa757f0fb332a1f045168d29b0d005de6c39ee5ce5d6c51f2563bb53c601b"}, - {file = "rapidfuzz-2.15.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:60368e1add6e550faae65614844c43f8a96e37bf99404643b648bf2dba92c0fb"}, - {file = "rapidfuzz-2.15.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:785744f1270828cc632c5a3660409dee9bcaac6931a081bae57542c93e4d46c4"}, - {file = "rapidfuzz-2.15.1.tar.gz", hash = "sha256:d62137c2ca37aea90a11003ad7dc109c8f1739bfbe5a9a217f3cdb07d7ac00f6"}, -] - -[package.extras] -full = ["numpy"] - -[[package]] -name = "textwrap3" -version = "0.9.2" -description = "textwrap from Python 3.6 backport (plus a few tweaks)" -category = "main" -optional = false -python-versions = "*" -files = [ - {file = "textwrap3-0.9.2-py2.py3-none-any.whl", hash = "sha256:bf5f4c40faf2a9ff00a9e0791fed5da7415481054cef45bb4a3cfb1f69044ae0"}, - {file = "textwrap3-0.9.2.zip", hash = "sha256:5008eeebdb236f6303dcd68f18b856d355f6197511d952ba74bc75e40e0c3414"}, -] - -[[package]] -name = "watchdog" -version = "2.3.1" -description = "Filesystem events monitoring" -category = "main" -optional = false -python-versions = ">=3.6" -files = [ - {file = "watchdog-2.3.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d1f1200d4ec53b88bf04ab636f9133cb703eb19768a39351cee649de21a33697"}, - {file = "watchdog-2.3.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:564e7739abd4bd348aeafbf71cc006b6c0ccda3160c7053c4a53b67d14091d42"}, - {file = "watchdog-2.3.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:95ad708a9454050a46f741ba5e2f3468655ea22da1114e4c40b8cbdaca572565"}, - {file = "watchdog-2.3.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:a073c91a6ef0dda488087669586768195c3080c66866144880f03445ca23ef16"}, - {file = "watchdog-2.3.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:aa8b028750b43e80eea9946d01925168eeadb488dfdef1d82be4b1e28067f375"}, - {file = "watchdog-2.3.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:964fd236cd443933268ae49b59706569c8b741073dbfd7ca705492bae9d39aab"}, - {file = "watchdog-2.3.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:91fd146d723392b3e6eb1ac21f122fcce149a194a2ba0a82c5e4d0ee29cd954c"}, - {file = "watchdog-2.3.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:efe3252137392a471a2174d721e1037a0e6a5da7beb72a021e662b7000a9903f"}, - {file = "watchdog-2.3.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:85bf2263290591b7c5fa01140601b64c831be88084de41efbcba6ea289874f44"}, - {file = "watchdog-2.3.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8f2df370cd8e4e18499dd0bfdef476431bcc396108b97195d9448d90924e3131"}, - {file = "watchdog-2.3.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ea5d86d1bcf4a9d24610aa2f6f25492f441960cf04aed2bd9a97db439b643a7b"}, - {file = "watchdog-2.3.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:6f5d0f7eac86807275eba40b577c671b306f6f335ba63a5c5a348da151aba0fc"}, - {file = "watchdog-2.3.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5b848c71ef2b15d0ef02f69da8cc120d335cec0ed82a3fa7779e27a5a8527225"}, - {file = "watchdog-2.3.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0d9878be36d2b9271e3abaa6f4f051b363ff54dbbe7e7df1af3c920e4311ee43"}, - {file = "watchdog-2.3.1-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:4cd61f98cb37143206818cb1786d2438626aa78d682a8f2ecee239055a9771d5"}, - {file = "watchdog-2.3.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:3d2dbcf1acd96e7a9c9aefed201c47c8e311075105d94ce5e899f118155709fd"}, - {file = "watchdog-2.3.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:03f342a9432fe08107defbe8e405a2cb922c5d00c4c6c168c68b633c64ce6190"}, - {file = "watchdog-2.3.1-py3-none-manylinux2014_aarch64.whl", hash = "sha256:7a596f9415a378d0339681efc08d2249e48975daae391d58f2e22a3673b977cf"}, - {file = "watchdog-2.3.1-py3-none-manylinux2014_armv7l.whl", hash = "sha256:0e1dd6d449267cc7d6935d7fe27ee0426af6ee16578eed93bacb1be9ff824d2d"}, - {file = "watchdog-2.3.1-py3-none-manylinux2014_i686.whl", hash = "sha256:7a1876f660e32027a1a46f8a0fa5747ad4fcf86cb451860eae61a26e102c8c79"}, - {file = "watchdog-2.3.1-py3-none-manylinux2014_ppc64.whl", hash = "sha256:2caf77ae137935c1466f8cefd4a3aec7017b6969f425d086e6a528241cba7256"}, - {file = "watchdog-2.3.1-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:53f3e95081280898d9e4fc51c5c69017715929e4eea1ab45801d5e903dd518ad"}, - {file = "watchdog-2.3.1-py3-none-manylinux2014_s390x.whl", hash = "sha256:9da7acb9af7e4a272089bd2af0171d23e0d6271385c51d4d9bde91fe918c53ed"}, - {file = "watchdog-2.3.1-py3-none-manylinux2014_x86_64.whl", hash = "sha256:8a4d484e846dcd75e96b96d80d80445302621be40e293bfdf34a631cab3b33dc"}, - {file = "watchdog-2.3.1-py3-none-win32.whl", hash = "sha256:a74155398434937ac2780fd257c045954de5b11b5c52fc844e2199ce3eecf4cf"}, - {file = "watchdog-2.3.1-py3-none-win_amd64.whl", hash = "sha256:5defe4f0918a2a1a4afbe4dbb967f743ac3a93d546ea4674567806375b024adb"}, - {file = "watchdog-2.3.1-py3-none-win_ia64.whl", hash = "sha256:4109cccf214b7e3462e8403ab1e5b17b302ecce6c103eb2fc3afa534a7f27b96"}, - {file = "watchdog-2.3.1.tar.gz", hash = "sha256:d9f9ed26ed22a9d331820a8432c3680707ea8b54121ddcc9dc7d9f2ceeb36906"}, -] - -[package.extras] -watchmedo = ["PyYAML (>=3.10)"] - -[metadata] -lock-version = "2.0" -python-versions = "^3.7" -content-hash = "f48df5c526c5e9e9b6c8dd83bb06b628c347f616a66670800e3032a83ba50c08" diff --git a/tools/asm-differ/pyproject.toml b/tools/asm-differ/pyproject.toml deleted file mode 100644 index 7a112aee5..000000000 --- a/tools/asm-differ/pyproject.toml +++ /dev/null @@ -1,21 +0,0 @@ -[tool.poetry] -name = "asm-differ" -version = "0.1.0" -description = "" -authors = ["Simon Lindholm "] -license = "UNLICENSE" -readme = "README.md" -packages = [{ include = "diff.py" }] - -[tool.poetry.dependencies] -python = "^3.7" -colorama = "^0.4.6" -ansiwrap = "^0.8.4" -watchdog = "^2.2.0" -levenshtein = "^0.20.9" -cxxfilt = "^0.3.0" - - -[build-system] -requires = ["poetry-core"] -build-backend = "poetry.core.masonry.api" diff --git a/tools/asm-differ/screenshot.png b/tools/asm-differ/screenshot.png deleted file mode 100644 index 323055532..000000000 Binary files a/tools/asm-differ/screenshot.png and /dev/null differ diff --git a/tools/asm-differ/test.py b/tools/asm-differ/test.py deleted file mode 100644 index d36ea8db7..000000000 --- a/tools/asm-differ/test.py +++ /dev/null @@ -1,189 +0,0 @@ -import unittest -import diff -import json - - -class TestSh2(unittest.TestCase): - def get_config(self) -> diff.Config: - arch = diff.get_arch("sh2") - formatter = diff.JsonFormatter(arch_str="sh2") - config = diff.Config( - arch=arch, - diff_obj=True, - file="", - make=False, - source_old_binutils=True, - diff_section=".text", - inlines=False, - max_function_size_lines=25000, - max_function_size_bytes=100000, - formatter=formatter, - diff_mode=diff.DiffMode.NORMAL, - base_shift=0, - skip_lines=0, - compress=None, - show_rodata_refs=True, - show_branches=True, - show_line_numbers=False, - show_source=False, - stop_at_ret=None, - ignore_large_imms=False, - ignore_addr_diffs=True, - algorithm="levenshtein", - reg_categories={}, - ) - return config - - # check that comment <> regex has ? to avoid ",r1 ! 60e87d0" - # all being a comment for: - # mov.l 44 ,r1 ! 60e87d0 - def test_sh2_comment(self) -> None: - # parser specifically looks for tabs so make sure they are represented - - # 16: d1 0b mov.l 44 ,r1 ! 60e87d0 - sh2_theirs = ( - " 16:\td1 0b \tmov.l\t44 ,r1\t! 60e87d0\n" - ) - - # 16: d1 0b mov.l 44 <_func_060E8780+0x44>,r1 ! 0 <_func_060E8780> - sh2_ours = " 16:\td1 0b \tmov.l\t44 <_func_060E8780+0x44>,r1\t! 0 <_func_060E8780>\n" - - config = self.get_config() - display = diff.Display(sh2_theirs, sh2_ours, config) - loaded = json.loads(display.run_diff()[0]) - - curr = loaded["rows"][0]["current"]["src_comment"] - - assert curr != "<_func_060E8780+0x44>,r1 ! 0 <_func_060E8780>" - assert curr == "<_func_060E8780+0x44>" - - def test_sh2_immediates(self) -> None: - # test parsing these immediates - # func_0606B760(): - # 0: ec 01 mov #1,r12 - # 2: 71 01 add #1,r1 - # 4: ec ff mov #-1,r12 - # 6: 71 ff add #-1,r1 - # 8: ec 7f mov #127,r12 - # a: 71 7f add #127,r1 - # c: ec 80 mov #-128,r12 - # e: 71 80 add #-128,r1 - sh2_theirs = "func_0606B760():\n 0:\tec 01 \tmov\t#1,r12\n 2:\t71 01 \tadd\t#1,r1\n 4:\tec ff \tmov\t#-1,r12\n 6:\t71 ff \tadd\t#-1,r1\n 8:\tec 7f \tmov\t#127,r12\n a:\t71 7f \tadd\t#127,r1\n c:\tec 80 \tmov\t#-128,r12\n e:\t71 80 \tadd\t#-128,r1" - - # just diff with self - sh2_ours = sh2_theirs - - config = self.get_config() - display = diff.Display(sh2_theirs, sh2_ours, config) - loaded = json.loads(display.run_diff()[0]) - - expected = [ - "0: mov #0x1,r12", - "2: add #0x1,r1", - "4: mov #0xff,r12", - "6: add #0xff,r1", - "8: mov #0x7f,r12", - "a: add #0x7f,r1", - "c: mov #0x80,r12", - "e: add #0x80,r1", - ] - - i = 0 - for text in loaded["rows"]: - assert text["base"]["text"][0]["text"] == expected[i] - i += 1 - - def test_more_sh2_immediates(self) -> None: - # test that the re_int regex is able to catch all these "boundary" numbers - # since we have to match 0-9 one digit at a time - # 0: 71 00 add #0,r1 - # 2: 71 01 add #1,r1 - # 4: 71 09 add #9,r1 - # 6: 71 0a add #10,r1 - # 8: 71 0b add #11,r1 - # a: 71 13 add #19,r1 - # c: 71 64 add #100,r1 - # e: 71 65 add #101,r1 - # 10: 71 6d add #109,r1 - # 12: 71 6f add #111,r1 - # 14: 71 77 add #119,r1 - # 16: 71 f7 add #-9,r1 - # 18: 71 f6 add #-10,r1 - # 1a: 71 f5 add #-11,r1 - # 1c: 71 ed add #-19,r1 - # 1e: 71 9c add #-100,r1 - # 20: 71 9b add #-101,r1 - # 22: 71 93 add #-109,r1 - # 24: 71 91 add #-111,r1 - # 26: 71 89 add #-119,r1 - sh2_theirs = "func_0606B760():\n 0:\t71 00 \tadd\t#0,r1\n 2:\t71 01 \tadd\t#1,r1\n 4:\t71 09 \tadd\t#9,r1\n 6:\t71 0a \tadd\t#10,r1\n 8:\t71 0b \tadd\t#11,r1\n a:\t71 13 \tadd\t#19,r1\n c:\t71 64 \tadd\t#100,r1\n e:\t71 65 \tadd\t#101,r1\n 10:\t71 6d \tadd\t#109,r1\n 12:\t71 6f \tadd\t#111,r1\n 14:\t71 77 \tadd\t#119,r1\n 16:\t71 f7 \tadd\t#-9,r1\n 18:\t71 f6 \tadd\t#-10,r1\n 1a:\t71 f5 \tadd\t#-11,r1\n 1c:\t71 ed \tadd\t#-19,r1\n 1e:\t71 9c \tadd\t#-100,r1\n 20:\t71 9b \tadd\t#-101,r1\n 22:\t71 93 \tadd\t#-109,r1\n 24:\t71 91 \tadd\t#-111,r1\n 26:\t71 89 \tadd\t#-119,r1" - - # just diff with self - sh2_ours = sh2_theirs - - config = self.get_config() - display = diff.Display(sh2_theirs, sh2_ours, config) - loaded = json.loads(display.run_diff()[0]) - - expected = [ - "0: add #0x0,r1", - "2: add #0x1,r1", - "4: add #0x9,r1", - "6: add #0xa,r1", - "8: add #0xb,r1", - "a: add #0x13,r1", - "c: add #0x64,r1", - "e: add #0x65,r1", - "10: add #0x6d,r1", - "12: add #0x6f,r1", - "14: add #0x77,r1", - "16: add #0xf7,r1", - "18: add #0xf6,r1", - "1a: add #0xf5,r1", - "1c: add #0xed,r1", - "1e: add #0x9c,r1", - "20: add #0x9b,r1", - "22: add #0x93,r1", - "24: add #0x91,r1", - "26: add #0x89,r1", - ] - - i = 0 - for text in loaded["rows"]: - assert text["base"]["text"][0]["text"] == expected[i] - i += 1 - - def test_branch(self) -> None: - # test that bt.s and bra get ~> - # func(): - # 0: 8d 02 bt.s 8 - # 2: 6e f3 mov r15,r14 - # 4: a0 01 bra a - # 6: 00 09 nop - - # 00000008 : - # lab_0606B780(): - # 8: db 32 mov.l d4 ,r11 - - # 0000000a : - # lab_0606B8E0(): - # a: 00 0b rts - # c: 00 09 nop - sh2_theirs = "func():\n 0:\t8d 02 \tbt.s\t8 \n 2:\t6e f3 \tmov\tr15,r14\n 4:\ta0 01 \tbra\ta \n 6:\t00 09 \tnop\t\n\n00000008 :\nlab_0606B780():\n 8:\tdb 32 \tmov.l\td4 ,r11\n\n0000000a :\nlab_0606B8E0():\n a:\t00 0b \trts\t\n c:\t00 09 \tnop\t" - sh2_ours = sh2_theirs - - config = self.get_config() - display = diff.Display(sh2_theirs, sh2_ours, config) - loaded = json.loads(display.run_diff()[0]) - - # bt.s 8 - print(loaded["rows"][0]["base"]["text"][1]["text"] == "~>") - print(loaded["rows"][0]["base"]["text"][1]["key"] == "8") - - # bra a - print(loaded["rows"][2]["base"]["text"][1]["text"] == "~>") - print(loaded["rows"][2]["base"]["text"][1]["key"] == "10") - - -if __name__ == "__main__": - unittest.main() diff --git a/tools/assist.py b/tools/assist.py deleted file mode 100755 index 6afecbdea..000000000 --- a/tools/assist.py +++ /dev/null @@ -1,177 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import os -import sys -from collections import OrderedDict - -gAddressWidth = 18 # if your ld >= 2.40 change this to 10 - -script_dir = os.path.dirname(os.path.realpath(__file__)) -root_dir = script_dir + "/../" -asm_dir = root_dir + "asm/non_matchings/overlays/actors" -build_dir = root_dir + "build/gc-eu-mq-dbg/" - -def read_rom(): - with open("baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", "rb") as f: - return f.read() - - -def find_dir(query): - for root, dirs, files in os.walk(asm_dir): - for d in dirs: - if d == query: - return os.path.join(root, d) - return None - - -def get_all_s_files(): - ret = set() - for root, dirs, files in os.walk(asm_dir): - for f in files: - if f.endswith(".s"): - ret.add(f[:-2]) - return ret - - -def get_symbol_bytes(offsets, func): - if func not in offsets or "start" not in offsets[func] or "end" not in offsets[func]: - return None - start = offsets[func]["start"] - end = offsets[func]["end"] - return list(rom_bytes[start:end]) - - -def parse_map(fname): - ram_offset = None - cur_file = "" - syms = {} - prev_sym = None - prev_line = "" - with open(fname) as f: - for line in f: - if "load address" in line: - if "noload" in line or "noload" in prev_line: - ram_offset = None - continue - ram = int(line[16 : 16 + gAddressWidth], 0) - rom = int(line[16 + gAddressWidth + 25 : 16 + gAddressWidth + 25 + gAddressWidth], 0) - ram_offset = ram - rom - continue - prev_line = line - - if ( - ram_offset is None - or "=" in line - or "*fill*" in line - or " 0x" not in line - ): - continue - ram = int(line[16 : 16 + gAddressWidth], 0) - rom = ram - ram_offset - fn = line.split()[-1] - if "0x" in fn: - ram_offset = None - elif "/" in fn: - cur_file = fn - else: - syms[fn] = (rom, cur_file, prev_sym, ram) - prev_sym = fn - return syms - - -def get_map_offsets(syms): - offsets = {} - for sym in syms: - prev_sym = syms[sym][2] - if sym not in offsets: - offsets[sym] = {} - if prev_sym not in offsets: - offsets[prev_sym] = {} - offsets[sym]["start"] = syms[sym][0] - offsets[prev_sym]["end"] = syms[sym][0] - return offsets - - -def diff_syms(qb, tb): - if len(tb) < 8: - return 0 - - if len(qb) > len(tb): - larger = qb - smaller = tb - else: - larger = tb - smaller = qb - - len_ratio = len(smaller) / len(larger) - - n_bytes = len(smaller) - matches = 0 - for i in range(0, n_bytes, 4): - if smaller[i] == larger[i]: - matches += 4 - return (matches / n_bytes) * len_ratio - - -def get_matches(query): - query_bytes = get_symbol_bytes(map_offsets, query) - if query_bytes is None: - sys.exit("Symbol '" + query + "' not found") - - ret = {} - for symbol in map_offsets: - if symbol is not None and query != symbol: - target_bytes = get_symbol_bytes(map_offsets, symbol) - if target_bytes is not None: - score = diff_syms(query_bytes, target_bytes) - if score >= args.threshold: - ret[symbol] = score - return OrderedDict(sorted(ret.items(), key=lambda kv: kv[1], reverse=True)) - - -def do_query(query): - matches = get_matches(query) - num_matches = len(matches) - - if num_matches == 0: - print(query + " - found no matches") - return - - i = 0 - more_str = ":" - if args.num_out < num_matches: - more_str = " (showing only " + str(args.num_out) + "):" - - print(query + " - found " + str(num_matches) + " matches total" + more_str) - for match in matches: - if i == args.num_out: - break - match_str = "{:.2f} - {}".format(matches[match], match) - if match not in s_files: - match_str += " (decompiled)" - print(match_str) - i += 1 - print() - -parser = argparse.ArgumentParser(description="Tools to assist with decomp") -parser.add_argument("query", help="function or file") -parser.add_argument("--threshold", help="score threshold between 0 and 1 (higher is more restrictive)", type=float, default=0.95, required=False) -parser.add_argument("--num-out", help="number of functions to display", type=int, default=10, required=False) - -args = parser.parse_args() - -rom_bytes = read_rom() -map_syms = parse_map(build_dir + "oot-gc-eu-mq-dbg.map") -map_offsets = get_map_offsets(map_syms) - -s_files = get_all_s_files() - -query_dir = find_dir(args.query) - -if query_dir is not None: - files = os.listdir(query_dir) - for f_name in files: - do_query(f_name[:-2]) -else: - do_query(args.query) diff --git a/tools/check_ordering.py b/tools/check_ordering.py new file mode 100755 index 000000000..cfd291378 --- /dev/null +++ b/tools/check_ordering.py @@ -0,0 +1,211 @@ +#!/usr/bin/env python3 + +# SPDX-FileCopyrightText: 2024 zeldaret +# SPDX-License-Identifier: CC0-1.0 + + +from __future__ import annotations + +import argparse +import dataclasses +import enum +from pathlib import Path +import sys +from typing import BinaryIO + +import elftools.elf.elffile +import mapfile_parser.mapfile + + +@dataclasses.dataclass +class Reloc: + name: str + offset_32: int | None + offset_hi16: int | None + offset_lo16: int | None + addend: int + + +@dataclasses.dataclass +class Pointer: + name: str + addend: int + base_value: int + build_value: int + + +def read_relocs(object_path: Path, section_name: str) -> list[Reloc]: + with open(object_path, "rb") as f: + elffile = elftools.elf.elffile.ELFFile(f) + symtab = elffile.get_section_by_name(".symtab") + data = elffile.get_section_by_name(section_name).data() + + reloc_section = elffile.get_section_by_name(f".rel{section_name}") + if reloc_section is None: + return [] + + relocs = [] + offset_hi16 = 0 + for reloc in reloc_section.iter_relocations(): + reloc_offset = reloc.entry["r_offset"] + reloc_type = reloc.entry["r_info_type"] + reloc_name = symtab.get_symbol(reloc.entry["r_info_sym"]).name + + if reloc_type == 2: # R_MIPS_32 + offset_32 = reloc_offset + addend = int.from_bytes( + data[reloc_offset : reloc_offset + 4], "big", signed=True + ) + relocs.append(Reloc(reloc_name, offset_32, None, None, addend)) + elif reloc_type == 4: # R_MIPS_26 + pass + elif reloc_type == 5: # R_MIPS_HI16 + offset_hi16 = reloc_offset + elif reloc_type == 6: # R_MIPS_LO16 + offset_lo16 = reloc_offset + addend_hi16 = int.from_bytes( + data[offset_hi16 + 2 : offset_hi16 + 4], "big", signed=False + ) + addend_lo16 = int.from_bytes( + data[offset_lo16 + 2 : offset_lo16 + 4], "big", signed=True + ) + addend = (addend_hi16 << 16) + addend_lo16 + relocs.append(Reloc(reloc_name, None, offset_hi16, offset_lo16, addend)) + else: + raise NotImplementedError(f"Unsupported relocation type: {reloc_type}") + + return relocs + + +def read_u32(f: BinaryIO, offset: int) -> int: + f.seek(offset) + return int.from_bytes(f.read(4), "big") + + +def read_u16(f: BinaryIO, offset: int) -> int: + f.seek(offset) + return int.from_bytes(f.read(2), "big") + + +def read_s16(f: BinaryIO, offset: int) -> int: + f.seek(offset) + return int.from_bytes(f.read(2), "big", signed=True) + + +def main(): + parser = argparse.ArgumentParser( + description="Report data/bss reorderings between the baserom and the current build " + "by parsing relocations from the built object files and comparing their final values " + "between the baserom and the current build. " + "Assumes that the only differences are due to ordering and that the text sections of the " + "ROMS are not shifted." + ) + parser.add_argument( + "--oot-version", + "-v", + type=str, + default="gc-eu-mq-dbg", + help="OOT version (default: gc-eu-mq-dbg)", + ) + parser.add_argument( + "--segment", + type=str, + help="ROM segment to check, e.g. 'boot', 'code', or 'ovl_player_actor' (default: all)", + ) + + args = parser.parse_args() + version = args.oot_version + + mapfile = mapfile_parser.mapfile.MapFile() + mapfile.readMapFile(f"build/{version}/oot-{version}.map") + + # Segments built from source code (filtering out assets) + source_code_segments = [] + for mapfile_segment in mapfile: + if ( + args.segment + and mapfile_segment.name != f"..{args.segment}" + and mapfile_segment.name != f"..{args.segment}.bss" + ): + continue + if not ( + mapfile_segment.name.startswith("..boot") + or mapfile_segment.name.startswith("..code") + or mapfile_segment.name.startswith("..ovl_") + ): + continue + source_code_segments.append(mapfile_segment) + + base = open(f"baseroms/{version}/baserom-decompressed.z64", "rb") + build = open(f"build/{version}/oot-{version}.z64", "rb") + + # Find all pointers with different values + pointers = [] + for mapfile_segment in source_code_segments: + for file in mapfile_segment: + if not str(file.filepath).endswith(".o"): + continue + if file.sectionType == ".bss": + continue + for reloc in read_relocs(file.filepath, file.sectionType): + if reloc.offset_32 is not None: + base_value = read_u32(base, file.vrom + reloc.offset_32) + build_value = read_u32(build, file.vrom + reloc.offset_32) + elif reloc.offset_hi16 is not None and reloc.offset_lo16 is not None: + if read_u16(base, file.vrom + reloc.offset_hi16) != read_u16( + build, file.vrom + reloc.offset_hi16 + ) or read_u16(base, file.vrom + reloc.offset_hi16) != read_u16( + build, file.vrom + reloc.offset_hi16 + ): + print( + f"Error: Reference to {reloc.name} in {file.filepath} is in a shifted portion of the ROM.\n" + "Please ensure that the only differences between the baserom and the current build are due to data ordering.", + file=sys.stderr, + ) + sys.exit(1) + + base_value = ( + read_u16(base, file.vrom + reloc.offset_hi16 + 2) << 16 + ) + read_s16(base, file.vrom + reloc.offset_lo16 + 2) + build_value = ( + read_u16(build, file.vrom + reloc.offset_hi16 + 2) << 16 + ) + read_s16(build, file.vrom + reloc.offset_lo16 + 2) + else: + assert False, "Invalid relocation" + + if base_value != build_value: + pointers.append( + Pointer(reloc.name, reloc.addend, base_value, build_value) + ) + + # Remove duplicates and sort by baserom address + pointers = list({p.base_value: p for p in pointers}.values()) + pointers.sort(key=lambda p: p.base_value) + + # Go through sections and report differences + for mapfile_segment in source_code_segments: + for file in mapfile_segment: + pointers_in_section = [ + p for p in pointers if file.vram <= p.build_value < file.vram + file.size + ] + if not pointers_in_section: + continue + + print(f"{file.filepath} {file.sectionType} is reordered:") + for i, p in enumerate(pointers_in_section): + if p.addend > 0: + addend_str = f"+0x{p.addend:X}" + elif p.addend < 0: + addend_str = f"-0x{-p.addend:X}" + else: + addend_str = "" + + if i > 0 and p.build_value < pointers_in_section[i - 1].build_value: + print(" --------------------") # BSS wraps around + print( + f" {p.base_value:08X} -> {p.build_value:08X} {p.name}{addend_str}" + ) + + +if __name__ == "__main__": + main() diff --git a/tools/compare_actors_sizes.py b/tools/compare_actors_sizes.py deleted file mode 100644 index 6d214fbf4..000000000 --- a/tools/compare_actors_sizes.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/python3 - -import argparse - -def read_csv(csv_file): - - f_lines = "" - with open(csv_file) as f: - f_lines = f.readlines()[1:] - - overlays = {} - - for line in f_lines: - row = line.split(",") - overlays[row[0]] = int(row[3]) - - return overlays - -def main(): - parser = argparse.ArgumentParser(description="Compares two csv produced by `get_actor_sizes.py`.") - parser.add_argument("firstcsv", help="") - parser.add_argument("secondcsv", help="") - args = parser.parse_args() - - first = read_csv(args.firstcsv) - second = read_csv(args.secondcsv) - - print(f"overlay,{args.firstcsv},{args.secondcsv},diff") - - common_actors = set(first.keys()) & set(second.keys()) - for actor_name in common_actors: - total_1 = first[actor_name] - total_2 = second[actor_name] - if total_1 != total_2: - print(f"{actor_name},{total_1},{total_2},{total_1-total_2}") - - -main() diff --git a/tools/compress.py b/tools/compress.py old mode 100644 new mode 100755 index d72b5f2cc..8abb8b09c --- a/tools/compress.py +++ b/tools/compress.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + # SPDX-FileCopyrightText: 2024 zeldaret # SPDX-License-Identifier: CC0-1.0 @@ -6,64 +8,13 @@ from __future__ import annotations import argparse from pathlib import Path import dataclasses -import struct import time import multiprocessing import multiprocessing.pool import crunch64 - -STRUCT_IIII = struct.Struct(">IIII") - - -@dataclasses.dataclass -class DmaEntry: - """ - A Python counterpart to the dmadata entry struct: - ```c - typedef struct { - /* 0x00 */ uintptr_t vromStart; - /* 0x04 */ uintptr_t vromEnd; - /* 0x08 */ uintptr_t romStart; - /* 0x0C */ uintptr_t romEnd; - } DmaEntry; - ``` - """ - - vromStart: int - vromEnd: int - romStart: int - romEnd: int - - def __repr__(self): - return ( - "DmaEntry(" - f"vromStart=0x{self.vromStart:08X}, " - f"vromEnd=0x{self.vromEnd:08X}, " - f"romStart=0x{self.romStart:08X}, " - f"romEnd=0x{self.romEnd:08X}" - ")" - ) - - SIZE_BYTES = STRUCT_IIII.size - - def to_bin(self, data: memoryview): - STRUCT_IIII.pack_into( - data, - 0, - self.vromStart, - self.vromEnd, - self.romStart, - self.romEnd, - ) - - @staticmethod - def from_bin(data: memoryview): - return DmaEntry(*STRUCT_IIII.unpack_from(data)) - - -DMA_ENTRY_ZERO = DmaEntry(0, 0, 0, 0) +import dmadata def align(v: int): @@ -73,15 +24,16 @@ def align(v: int): @dataclasses.dataclass class RomSegment: - vromStart: int - vromEnd: int + vrom_start: int + vrom_end: int is_compressed: bool + is_syms: bool data: memoryview | None data_async: multiprocessing.pool.AsyncResult | None @property def uncompressed_size(self): - return self.vromEnd - self.vromStart + return self.vrom_end - self.vrom_start # Make interrupting the compression with ^C less jank @@ -94,15 +46,13 @@ def set_sigint_ignored(): def compress_rom( rom_data: memoryview, - dmadata_offset_start: int, - dmadata_offset_end: int, + dmadata_start: int, compress_entries_indices: set[int], n_threads: int = None, ): """ rom_data: the uncompressed rom data - dmadata_offset_start: the offset in the rom where the dmadata starts (inclusive) - dmadata_offset_end: the offset in the rom where the dmadata ends (exclusive) + dmadata_start: the offset in the rom where the dmadata starts compress_entries_indices: the indices in the dmadata of the segments that should be compressed n_threads: how many cores to use for compression """ @@ -110,18 +60,18 @@ def compress_rom( # Segments of the compressed rom (not all are compressed) compressed_rom_segments: list[RomSegment] = [] + dma_entries = dmadata.read_dmadata(rom_data, dmadata_start) + # We sort the DMA entries by ROM start because `compress_entries_indices` + # refers to indices in ROM order, but the uncompressed dmadata might not be + # in ROM order. + dma_entries.sort(key=lambda dma_entry: dma_entry.vrom_start) + with multiprocessing.Pool(n_threads, initializer=set_sigint_ignored) as p: # Extract each segment from the input rom - for entry_index, dmadata_offset in enumerate( - range(dmadata_offset_start, dmadata_offset_end, DmaEntry.SIZE_BYTES) - ): - dma_entry = DmaEntry.from_bin(rom_data[dmadata_offset:]) - if dma_entry == DMA_ENTRY_ZERO: - continue - - segment_rom_start = dma_entry.romStart - segment_rom_end = dma_entry.romStart + ( - dma_entry.vromEnd - dma_entry.vromStart + for entry_index, dma_entry in enumerate(dma_entries): + segment_rom_start = dma_entry.rom_start + segment_rom_end = dma_entry.rom_start + ( + dma_entry.vrom_end - dma_entry.vrom_start ) segment_data_uncompressed = rom_data[segment_rom_start:segment_rom_end] @@ -139,17 +89,15 @@ def compress_rom( compressed_rom_segments.append( RomSegment( - dma_entry.vromStart, - dma_entry.vromEnd, + dma_entry.vrom_start, + dma_entry.vrom_end, is_compressed, + dma_entry.is_syms(), segment_data, segment_data_async, ) ) - # Technically optional but required for matching. - compressed_rom_segments.sort(key=lambda segment: segment.vromStart) - # Wait on compression of all compressed segments waiting_on_segments = [ segment for segment in compressed_rom_segments if segment.is_compressed @@ -208,7 +156,7 @@ def compress_rom( * pad_to_multiple_of ) compressed_rom_data = memoryview(bytearray(compressed_rom_size_padded)) - compressed_rom_dma_entries: list[DmaEntry] = [] + compressed_rom_dma_entries: list[dmadata.DmaEntry] = [] rom_offset = 0 for segment in compressed_rom_segments: assert segment.data is not None @@ -220,30 +168,33 @@ def compress_rom( assert i <= len(compressed_rom_data) compressed_rom_data[segment_rom_start:i] = segment.data + rom_offset = segment_rom_end + + if segment.is_syms: + segment_rom_start = 0xFFFFFFFF + segment_rom_end = 0xFFFFFFFF + elif not segment.is_compressed: + segment_rom_end = 0 + compressed_rom_dma_entries.append( - DmaEntry( - segment.vromStart, - segment.vromEnd, + dmadata.DmaEntry( + segment.vrom_start, + segment.vrom_end, segment_rom_start, - segment_rom_end if segment.is_compressed else 0, + segment_rom_end, ) ) - rom_offset = segment_rom_end - assert rom_offset == compressed_rom_size # Pad the compressed rom with the pattern matching the baseroms for i in range(compressed_rom_size, compressed_rom_size_padded): compressed_rom_data[i] = i % 256 # Write the new dmadata - dmadata_offset = dmadata_offset_start + offset = dmadata_start for dma_entry in compressed_rom_dma_entries: - assert dmadata_offset + DmaEntry.SIZE_BYTES <= dmadata_offset_end - - dma_entry.to_bin(compressed_rom_data[dmadata_offset:]) - - dmadata_offset += DmaEntry.SIZE_BYTES + dma_entry.to_bin(compressed_rom_data[offset:]) + offset += dmadata.DmaEntry.SIZE_BYTES return compressed_rom_data @@ -263,13 +214,12 @@ def main(): help="path of the compressed rom to write out", ) parser.add_argument( - "--dma-range", - dest="dma_range", + "--dmadata-start", + dest="dmadata_start", + type=lambda s: int(s, 16), required=True, help=( - "The dmadata location in the rom, in format" - " 'start_inclusive-end_exclusive' and using hexadecimal offsets" - " (e.g. '0x12f70-0x19030')." + "The dmadata location in the rom, as a hexadecimal offset (e.g. 0x12f70)." ), ) parser.add_argument( @@ -298,13 +248,7 @@ def main(): out_rom_p = Path(args.out_rom) - dma_range_str: str = args.dma_range - dma_range_ends_str = dma_range_str.split("-") - assert len(dma_range_ends_str) == 2, dma_range_str - dmadata_offset_start, dmadata_offset_end = ( - int(v_str, 16) for v_str in dma_range_ends_str - ) - assert dmadata_offset_start < dmadata_offset_end, dma_range_str + dmadata_start = args.dmadata_start compress_ranges_str: str = args.compress_ranges compress_entries_indices = set() @@ -330,8 +274,7 @@ def main(): in_rom_data = in_rom_p.read_bytes() out_rom_data = compress_rom( memoryview(in_rom_data), - dmadata_offset_start, - dmadata_offset_end, + dmadata_start, compress_entries_indices, n_threads, ) diff --git a/tools/convert_chars.py b/tools/convert_chars.py deleted file mode 100644 index 261ed9239..000000000 --- a/tools/convert_chars.py +++ /dev/null @@ -1,61 +0,0 @@ -#! /usr/bin/python3 - -import os -import re - -script_dir = os.path.dirname(os.path.realpath(__file__)) -root_dir = script_dir + "/../" - - -def handle_match(match): - original_text = match.group() - - match_text = original_text.replace("\\x", "") - - if match_text.lower() == "1b": - return original_text - - end = "" - if original_text.lower().endswith("\\x1b"): - end = original_text[-4:] - match_text = match_text[:-2] - - try: - text = bytes.fromhex(match_text).decode("EUC-JP") - except UnicodeDecodeError: - return original_text - - if text[2:].lower() == match_text.lower(): - return original_text - - return text + end - - -def process_file(file_path): - with open(file_path) as f: - file_text = f.read() - - new_file_text = re.sub("(\\\\x[0-9a-zA-Z]{2})+", handle_match, file_text) - - if new_file_text != file_text: - with open(file_path, "w") as f: - f.write(new_file_text) - return True - return False - - -def main(): - i = 0 - skip_list = ["z_file_choose.rodata.s", "z_kaleido_scope.rodata.s"] - for root, dirs, files in os.walk(root_dir): - for file in files: - if i == 100: - return - if file.endswith(".s") and file not in skip_list: - path = os.path.join(root, file) - if process_file(path): - print("Processed " + path) - i += 1 - - -main() diff --git a/tools/csdis.py b/tools/csdis.py deleted file mode 100755 index 2ecbf3231..000000000 --- a/tools/csdis.py +++ /dev/null @@ -1,506 +0,0 @@ -#!/usr/bin/env python3 - -from overlayhelpers import filemap - -import argparse, os, struct - -""" -Enumerations -""" - -command_continue_stop = { - 0x00: "CS_CMD_CONTINUE", - 0xFF: "CS_CMD_STOP", -} - -cutscene_destinations = { - 0x00: "CS_DEST_UNIMPLEMENTED_0", - 0x01: "CS_DEST_CUTSCENE_MAP_GANON_HORSE", - 0x02: "CS_DEST_CUTSCENE_MAP_THREE_GODDESSES", - 0x03: "CS_DEST_GERUDO_VALLEY_DIN_PART_1", - 0x04: "CS_DEST_DEATH_MOUNTAIN_TRAIL_NAYRU", - 0x05: "CS_DEST_KOKIRI_FOREST_FARORE", - 0x06: "CS_DEST_CUTSCENE_MAP_TRIFORCE_CREATION", - 0x07: "CS_DEST_KOKIRI_FOREST_RECEIVE_KOKIRI_EMERALD", - 0x08: "CS_DEST_TEMPLE_OF_TIME_FROM_MASTER_SWORD", - 0x09: "CS_DEST_GERUDO_VALLEY_DIN_PART_2", - 0x0A: "CS_DEST_LINKS_HOUSE_INTRO", - 0x0B: "CS_DEST_KOKIRI_FOREST_INTRO", - 0x0C: "CS_DEST_DEATH_MOUNTAIN_TRAIL_FROM_GORON_RUBY", - 0x0D: "CS_DEST_ZORAS_FOUNTAIN_FROM_ZORAS_SAPPHIRE", - 0x0E: "CS_DEST_KOKIRI_FOREST_FROM_KOKIRI_EMERALD", - 0x0F: "CS_DEST_TEMPLE_OF_TIME_KOKIRI_EMERALD_RESTORED", - 0x10: "CS_DEST_TEMPLE_OF_TIME_GORON_RUBY_RESTORED", - 0x11: "CS_DEST_TEMPLE_OF_TIME_ZORAS_SAPPHIRE_RESTORED", - 0x12: "CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION", - 0x13: "CS_DEST_DEATH_MOUNTAIN_TRAIL", - 0x14: "CS_DEST_UNIMPLEMENTED_14", - 0x15: "CS_DEST_LAKE_HYLIA_WATER_RESTORED", - 0x16: "CS_DEST_DESERT_COLOSSUS_REQUIEM", - 0x17: "CS_DEST_CUTSCENE_MAP_GANONDORF_DEFEATED_CREDITS", - 0x18: "CS_DEST_JABU_JABU", - 0x19: "CS_DEST_CHAMBER_OF_SAGES_LIGHT_MEDALLION", - 0x1A: "CS_DEST_TEMPLE_OF_TIME_KOKIRI_EMERALD_RESTORED_2", - 0x1B: "CS_DEST_TEMPLE_OF_TIME_GORON_RUBY_RESTORED_2", - 0x1C: "CS_DEST_TEMPLE_OF_TIME_ZORAS_SAPPHIRE_RESTORED_2", - 0x1D: "CS_DEST_CHAMBER_OF_SAGES_FOREST_MEDALLION", - 0x1E: "CS_DEST_CHAMBER_OF_SAGES_FIRE_MEDALLION", - 0x1F: "CS_DEST_CHAMBER_OF_SAGES_WATER_MEDALLION", - 0x20: "CS_DEST_HYRULE_FIELD_FLASHBACK", - 0x21: "CS_DEST_HYRULE_FIELD_FROM_ZELDA_ESCAPE", - 0x22: "CS_DEST_CUTSCENE_MAP_GANONDORF_FROM_MASTER_SWORD", - 0x23: "CS_DEST_HYRULE_FIELD_INTRO_DREAM", - 0x24: "CS_DEST_UNIMPLEMENTED_24", - 0x25: "CS_DEST_UNIMPLEMENTED_25", - 0x26: "CS_DEST_CUTSCENE_MAP_SHEIKAH_LEGEND", - 0x27: "CS_DEST_TEMPLE_OF_TIME_ZELDA_REVEAL", - 0x28: "CS_DEST_TEMPLE_OF_TIME_GET_LIGHT_ARROWS", - 0x29: "CS_DEST_LAKE_HYLIA_FROM_LAKE_RESTORED", - 0x2A: "CS_DEST_KAKARIKO_VILLAGE_DRAIN_WELL", - 0x2B: "CS_DEST_WINDMILL_FROM_WELL_DRAINED", - 0x2C: "CS_DEST_TEMPLE_OF_TIME_FROM_ALL_STONES_RESTORED", - 0x2D: "CS_DEST_UNIMPLEMENTED_2D", - 0x2E: "CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION_ALT", - 0x2F: "CS_DEST_KAKARIKO_VILLAGE_NOCTURNE_PART_2", - 0x30: "CS_DEST_DESERT_COLOSSUS_FROM_REQUIEM", - 0x31: "CS_DEST_TEMPLE_OF_TIME_FROM_LIGHT_ARROWS", - 0x32: "CS_DEST_KAKARIKO_VILLAGE_FROM_NOCTURNE", - 0x33: "CS_DEST_HYRULE_FIELD_FROM_ZELDAS_COURTYARD", - 0x34: "CS_DEST_TEMPLE_OF_TIME_SONG_OF_TIME", - 0x35: "CS_DEST_HYRULE_FIELD_FROM_SONG_OF_TIME", - 0x36: "CS_DEST_GERUDO_VALLEY_CREDITS", - 0x37: "CS_DEST_GERUDO_FORTRESS_CREDITS", - 0x38: "CS_DEST_KAKARIKO_VILLAGE_CREDITS", - 0x39: "CS_DEST_DEATH_MOUNTAIN_TRAIL_CREDITS_PART_1", - 0x3A: "CS_DEST_GORON_CITY_CREDITS", - 0x3B: "CS_DEST_LAKE_HYLIA_CREDITS", - 0x3C: "CS_DEST_ZORAS_FOUNTAIN_CREDITS", - 0x3D: "CS_DEST_ZORAS_DOMAIN_CREDITS", - 0x3E: "CS_DEST_KOKIRI_FOREST_CREDITS_PART_1", - 0x3F: "CS_DEST_KOKIRI_FOREST_CREDITS_PART_2", - 0x40: "CS_DEST_HYRULE_FIELD_CREDITS", - 0x41: "CS_DEST_LON_LON_RANCH_CREDITS_PART_1_ALT", - 0x42: "CS_DEST_KAKARIKO_VILLAGE_FROM_TRAIL_OWL", - 0x43: "CS_DEST_HYRULE_FIELD_FROM_LAKE_HYLIA_OWL", - 0x44: "CS_DEST_CUTSCENE_MAP_DEKU_SPROUT_PART_2", - 0x45: "CS_DEST_KOKIRI_FOREST_DEKU_SPROUT_PART_3", - 0x46: "CS_DEST_DEATH_MOUNTAIN_TRAIL_CREDITS_PART_2", - 0x47: "CS_DEST_TEMPLE_OF_TIME_CREDITS", - 0x48: "CS_DEST_ZELDAS_COURTYARD_CREDITS", - 0x49: "CS_DEST_LON_LON_RANCH_CREDITS_PART_1", - 0x4A: "CS_DEST_LON_LON_RANCH_CREDITS_PART_2", - 0x4B: "CS_DEST_LON_LON_RANCH_CREDITS_PART_3", - 0x4C: "CS_DEST_LON_LON_RANCH_CREDITS_PART_4", - 0x4D: "CS_DEST_LON_LON_RANCH_CREDITS_PART_5", - 0x4E: "CS_DEST_LON_LON_RANCH_CREDITS_PART_6", - 0x4F: "CS_DEST_LON_LON_RANCH_1", - 0x50: "CS_DEST_LON_LON_RANCH_2", - 0x51: "CS_DEST_LON_LON_RANCH_3", - 0x52: "CS_DEST_LON_LON_RANCH_4", - 0x53: "CS_DEST_LON_LON_RANCH_5", - 0x54: "CS_DEST_LON_LON_RANCH_6", - 0x55: "CS_DEST_LON_LON_RANCH_7", - 0x56: "CS_DEST_LON_LON_RANCH_8", - 0x57: "CS_DEST_LON_LON_RANCH_9", - 0x58: "CS_DEST_LON_LON_RANCH_10", - 0x59: "CS_DEST_LON_LON_RANCH_11", - 0x5A: "CS_DEST_LON_LON_RANCH_12", - 0x5B: "CS_DEST_LON_LON_RANCH_13", - 0x5C: "CS_DEST_LON_LON_RANCH_14", - 0x5D: "CS_DEST_LON_LON_RANCH_15", - 0x5E: "CS_DEST_LON_LON_RANCH_FROM_EPONAS_SONG", - 0x5F: "CS_DEST_STONES_RESTORED_CONDITIONAL", - 0x60: "CS_DEST_DESERT_COLOSSUS_FROM_CHAMBER_OF_SAGES", - 0x61: "CS_DEST_GRAVEYARD_FROM_CHAMBER_OF_SAGES", - 0x62: "CS_DEST_DEATH_MOUNTAIN_CRATER_FROM_CHAMBER_OF_SAGES", - 0x63: "CS_DEST_SACRED_FOREST_MEADOW_WARP_PAD", - 0x64: "CS_DEST_KOKIRI_FOREST_FROM_CHAMBER_OF_SAGES", - 0x65: "CS_DEST_DESERT_COLOSSUS_FROM_NABOORU_CAPTURE", - 0x66: "CS_DEST_TEMPLE_OF_TIME_FRONT_OF_PEDESTAL", - 0x67: "CS_DEST_HYRULE_FIELD_TITLE_SCREEN", - 0x68: "CS_DEST_TITLE_SCREEN_DEMO", - 0x69: "CS_DEST_GRAVEYARD_SUNS_SONG_PART_2", - 0x6A: "CS_DEST_ROYAL_FAMILYS_TOMB_SUNS_SONG_PART_3", - 0x6B: "CS_DEST_GANONS_CASTLE_DISPEL_FOREST_BEAM", - 0x6C: "CS_DEST_GANONS_CASTLE_DISPEL_WATER_BEAM", - 0x6D: "CS_DEST_GANONS_CASTLE_DISPEL_SHADOW_BEAM", - 0x6E: "CS_DEST_GANONS_CASTLE_DISPEL_FIRE_BEAM", - 0x6F: "CS_DEST_GANONS_CASTLE_DISPEL_LIGHT_BEAM", - 0x70: "CS_DEST_GANONS_CASTLE_DISPEL_SPIRIT_BEAM", - 0x71: "CS_DEST_GANONS_CASTLE_DISPEL_BARRIER_CONDITONAL", - 0x72: "CS_DEST_HYRULE_FIELD_FROM_FAIRY_OCARINA", - 0x73: "CS_DEST_HYRULE_FIELD_FROM_IMPA_ESCORT", - 0x74: "CS_DEST_FROM_RAURU_FINAL_MESSAGE_CONDITIONAL", - 0x75: "CS_DEST_HYRULE_FIELD_CREDITS_SKY", - 0x76: "CS_DEST_GANON_BATTLE_TOWER_COLLAPSE", - 0x77: "CS_DEST_ZELDAS_COURTYARD_RECEIVE_LETTER", -} - -ocarina_action_ids = { - 0x00: "OCARINA_ACTION_UNK_0", - 0x01: "OCARINA_ACTION_FREE_PLAY", - 0x02: "OCARINA_ACTION_TEACH_MINUET", - 0x03: "OCARINA_ACTION_TEACH_BOLERO", - 0x04: "OCARINA_ACTION_TEACH_SERENADE", - 0x05: "OCARINA_ACTION_TEACH_REQUIEM", - 0x06: "OCARINA_ACTION_TEACH_NOCTURNE", - 0x07: "OCARINA_ACTION_TEACH_PRELUDE", - 0x08: "OCARINA_ACTION_TEACH_SARIA", - 0x09: "OCARINA_ACTION_TEACH_EPONA", - 0x0A: "OCARINA_ACTION_TEACH_LULLABY", - 0x0B: "OCARINA_ACTION_TEACH_SUNS", - 0x0C: "OCARINA_ACTION_TEACH_TIME", - 0x0D: "OCARINA_ACTION_TEACH_STORMS", - 0x0E: "OCARINA_ACTION_UNK_E", - 0x0F: "OCARINA_ACTION_PLAYBACK_MINUET", - 0x10: "OCARINA_ACTION_PLAYBACK_BOLERO", - 0x11: "OCARINA_ACTION_PLAYBACK_SERENADE", - 0x12: "OCARINA_ACTION_PLAYBACK_REQUIEM", - 0x13: "OCARINA_ACTION_PLAYBACK_NOCTURNE", - 0x14: "OCARINA_ACTION_PLAYBACK_PRELUDE", - 0x15: "OCARINA_ACTION_PLAYBACK_SARIA", - 0x16: "OCARINA_ACTION_PLAYBACK_EPONA", - 0x17: "OCARINA_ACTION_PLAYBACK_LULLABY", - 0x18: "OCARINA_ACTION_PLAYBACK_SUNS", - 0x19: "OCARINA_ACTION_PLAYBACK_TIME", - 0x1A: "OCARINA_ACTION_PLAYBACK_STORMS", - 0x1B: "OCARINA_ACTION_UNK_1B", - 0x1C: "OCARINA_ACTION_CHECK_MINUET", - 0x1D: "OCARINA_ACTION_CHECK_BOLERO", - 0x1E: "OCARINA_ACTION_CHECK_SERENADE", - 0x1F: "OCARINA_ACTION_CHECK_REQUIEM", - 0x20: "OCARINA_ACTION_CHECK_NOCTURNE", - 0x21: "OCARINA_ACTION_CHECK_PRELUDE", - 0x22: "OCARINA_ACTION_CHECK_SARIA", - 0x23: "OCARINA_ACTION_CHECK_EPONA", - 0x24: "OCARINA_ACTION_CHECK_LULLABY", - 0x25: "OCARINA_ACTION_CHECK_SUNS", - 0x26: "OCARINA_ACTION_CHECK_TIME", - 0x27: "OCARINA_ACTION_CHECK_STORMS", - 0x28: "OCARINA_ACTION_CHECK_SCARECROW_SPAWN", - 0x29: "OCARINA_ACTION_FREE_PLAY_DONE", - 0x2A: "OCARINA_ACTION_SCARECROW_LONG_RECORDING", - 0x2B: "OCARINA_ACTION_SCARECROW_LONG_PLAYBACK", - 0x2C: "OCARINA_ACTION_SCARECROW_SPAWN_RECORDING", - 0x2D: "OCARINA_ACTION_SCARECROW_SPAWN_PLAYBACK", - 0x2E: "OCARINA_ACTION_MEMORY_GAME", - 0x2F: "OCARINA_ACTION_FROGS", - 0x30: "OCARINA_ACTION_CHECK_NOWARP", - 0x31: "OCARINA_ACTION_CHECK_NOWARP_DONE", -} - -""" -Entry format: - - (n1, n2, n3, ...) : (cmd, nwords, continuestopbyte, cmdentrieswd, listitem, nwordslist) - - n1, n2, n3, ... : command types - cmd : command macro - nwords : number of words this command is encoded in - continuestopbyte : the location of the continue/stop flag byte, if this command type has one, counted as number of bytes into the command - cmdentrieswd : the word index (from 0) containing the number of list items, a negative value specifies a hardcoded number of entries that are always guaranteed to follow - listitem : the list item macro if this macro is a list type, the name __SPECIAL is reserved for conditional output that needs custom handling - nwordslist : number of words this list item is encoded in - -Argument format: - - %[bn|hn|wn]:[N]:[s|x|en] - - b : byte - h : halfword - w : word - n: nth byte/halfword/word in the Nth word - - N : word number to search in, 0 is command type - - s : decimal - u : decimal unsigned - x : hex - f : float - e : enumeration - n : unique identifier of which enum to use -""" -cutscene_command_macros = { - -1: - ("CS_END()", 1, None, None, - None, None), - 3: - ("CS_MISC_LIST(%w1:1:s)", 2, None, 0, - "CS_MISC(%h2:1:x, %h1:1:s, %h2:2:s, %h1:2:x, %w1:3:x, %w1:4:x, %w1:5:x, %w1:6:x, %w1:7:x, %w1:8:x, %w1:9:x, %w1:10:x, %w1:11:x, %w1:12:x)", 12), - 4: - ("CS_LIGHT_SETTING_LIST(%w1:1:s)", 2, None, 0, - "CS_LIGHT_SETTING(%h2:1:x, %h1:1:s, %h2:2:s, %h1:2:x, %w1:3:x, %w1:4:x, %w1:5:x, %w1:6:x, %w1:7:x, %w1:8:x, %w1:9:x)", 12), - 86: - ("CS_START_SEQ_LIST(%w1:1:s)", 2, None, 0, - "CS_START_SEQ(%h2:1:x, %h1:1:s, %h2:2:s, %h1:2:x, %w1:3:x, %w1:4:x, %w1:5:x, %w1:6:x, %w1:7:x, %w1:8:x, %w1:9:x)", 12), - 87: - ("CS_STOP_SEQ_LIST(%w1:1:s)", 2, None, 0, - "CS_STOP_SEQ(%h2:1:x, %h1:1:s, %h2:2:s, %h1:2:x, %w1:3:x, %w1:4:x, %w1:5:x, %w1:6:x, %w1:7:x, %w1:8:x, %w1:9:x)", 12), - 124: - ("CS_FADE_OUT_SEQ_LIST(%w1:1:s)", 2, None, 0, - "CS_FADE_OUT_SEQ(%h2:1:x, %h1:1:s, %h2:2:s, %h1:2:x, %w1:3:x, %w1:4:x, %w1:5:x, %w1:6:x, %w1:7:x, %w1:8:x, %w1:9:x)", 12), - 9: - ("CS_RUMBLE_CONTROLLER_LIST(%w1:1:s)", 2, None, 0, - "CS_RUMBLE_CONTROLLER(%h2:1:x, %h1:1:s, %h2:2:s, %b2:2:x, %b1:2:x, %b4:3:x, %b3:3:x, %h1:3:x)", 3), - 140: - ("CS_TIME_LIST(%w1:1:s)", 2, None, 0, - "CS_TIME(%h2:1:x, %h1:1:s, %h2:2:s, %b2:2:x, %b1:2:x, %w1:3:x)", 3), - 10: - ("CS_PLAYER_CUE_LIST(%w1:1:s)", 2, None, 0, - "CS_PLAYER_CUE(%h2:1:x, %h1:1:s, %h2:2:s, %h1:2:x, %h2:3:x, %h1:3:x, %w1:4:s, %w1:5:s, %w1:6:s, %w1:7:s, %w1:8:s, %w1:9:s, %w1:10:f, %w1:11:f, %w1:12:f)", 12), - (15,17,18,23,34,39,46,76,85,93,105,107,110,119,123,138,139,144, # npc action 1 - 14,16,24,35,40,48,64,68,70,78,80,94,116,118,120,125,131,141, # npc action 2 - 25,36,41,50,67,69,72,74,81,106,117,121,126,132, # npc action 3 - 29,37,42,51,53,63,65,66,75,82,108,127,133, # npc action 4 - 30,38,43,47,54,79,83,128,135, # npc action 5 - 44,55,77,84,90,129,136, # npc action 6 - 31,52,57,58,88,115,130,137, # npc action 7 - 49,60,89,111,114,134,142, # npc action 8 - 62, # npc action 9 - 143): # npc action 10 - ("CS_ACTOR_CUE_LIST(%w1:0:s, %w1:1:s)", 2, None, 0, - "CS_ACTOR_CUE(%h2:1:x, %h1:1:s, %h2:2:s, %h1:2:x, %h2:3:x, %h1:3:x, %w1:4:s, %w1:5:s, %w1:6:s, %w1:7:s, %w1:8:s, %w1:9:s, %w1:10:f, %w1:11:f, %w1:12:f)", 12), - 1: - ("CS_CAM_EYE_SPLINE(%h1:1:s, %h2:2:s)", 3, 0, None, - "CS_CAM_POINT(%b4:1:e0, %b3:1:x, %h1:1:s, %w1:2:f, %h2:3:s, %h1:3:s, %h2:4:s, %h1:4:x)", 4), - 5: - ("CS_CAM_EYE_SPLINE_REL_TO_PLAYER(%h1:1:s, %h2:2:s)", 3, 0, None, - "CS_CAM_POINT(%b4:1:e0, %b3:1:x, %h1:1:s, %w1:2:f, %h2:3:s, %h1:3:s, %h2:4:s, %h1:4:x)", 4), - 2: - ("CS_CAM_AT_SPLINE(%h1:1:s, %h2:2:s)", 3, 0, None, - "CS_CAM_POINT(%b4:1:e0, %b3:1:x, %h1:1:s, %w1:2:f, %h2:3:s, %h1:3:s, %h2:4:s, %h1:4:x)", 4), - 6: - ("CS_CAM_AT_SPLINE_REL_TO_PLAYER(%h1:1:s, %h2:2:s)", 3, 0, None, - "CS_CAM_POINT(%b4:1:e0, %b3:1:x, %h1:1:s, %w1:2:f, %h2:3:s, %h1:3:s, %h2:4:s, %h1:4:x)", 4), - 7: - ("CS_CAM_EYE_LIST(%h2:1:x, %h1:1:s, %h2:2:s, %h1:2:x)", 3, None, -1, - "CS_CAM_POINT(%b4:1:e0, %b3:1:x, %h1:1:s, %w1:2:f, %h2:3:s, %h1:3:s, %h2:4:s, %h1:4:x)", 4), - 8: - ("CS_CAM_AT_LIST(%h2:1:x, %h1:1:s, %h2:2:s, %h1:2:x)", 3, None, -1, - "CS_CAM_POINT(%b4:1:e0, %b3:1:x, %h1:1:s, %w1:2:f, %h2:3:s, %h1:3:s, %h2:4:s, %h1:4:x)", 4), - 1000: - ("CS_DESTINATION(%h2:2:e1, %h1:2:s, %h2:3:s)", 4, None, None, - None, None), - 19: - ("CS_TEXT_LIST(%w1:1:s)", 2, None, 0, - "__SPECIAL(CS_TEXT_LIST)", 3), - 45: - ("CS_TRANSITION(%h2:2:x, %h1:2:s, %h2:3:s)", 4, None, None, - None, None), -} - -begin_cutscene_entry = ("CS_BEGIN_CUTSCENE(%w1:0:s, %w1:1:s)", 2, None, None, - None, None) - -unk_data_entry = ("CS_UNK_DATA_LIST(%w1:0:x, %w1:1:s)", 2, None, 0, - "CS_UNK_DATA(%w1:1:x, %w1:2:x, %w1:3:x, %w1:4:x, %w1:5:x, %w1:6:x, %w1:7:x, %w1:8:x, %w1:9:x, %w1:10:x, %w1:11:x, %w1:12:x)", 12) - -linesep = "\n" -indent = " " -line_end = "," + linesep - -""" -Since multiple command ids can map to the same command macro, to shorten the dictionary -we introduce a function to allow these command ids to be grouped into tuples. -""" -def multi_key(key): - for k in cutscene_command_macros.keys(): - if type(k) is int: - if k == key: - return cutscene_command_macros[k] - elif key in k: - return cutscene_command_macros[k] - -""" -Args -""" - -def arg_count(cmd_def): - return len([x for x in cmd_def.split("(")[1].split(")")[0].split(",")]) if "()" not in cmd_def else 0 - -def arg_part(arg, num): - return arg.replace("%","").split(":")[num] - -def args_list(cmd_def): - return [x.strip() for x in cmd_def.split("(")[1].split(")")[0].split(",")] - -""" -Type conversion -""" - -def get_byte(word, num): - return struct.unpack(">bbbb", struct.pack(">I", word))[num] - -def get_byte_unsigned(word, num): - return struct.unpack(">BBBB", struct.pack(">I", word))[num] - -def get_short(word, num): - return struct.unpack(">hh", struct.pack(">I", word))[num] - -def get_short_unsigned(word, num): - return struct.unpack(">HH", struct.pack(">I", word))[num] - -def get_word(word): - return struct.unpack(">i", struct.pack(">I", word))[0] - -def get_word_unsigned(word): - return struct.unpack(">I", struct.pack(">I", word))[0] - -def get_float(word): - return struct.unpack(">f", struct.pack(">i", word))[0] - -""" -Formatting -""" - -def pad(string, length): - string = string.replace("0x","") - if len(string) < length: - return pad("0"+string, length) - else: - return string - -def format_arg(arg, words): - word = words[int(arg_part(arg, 1))] # the word to look in - arg_type = arg_part(arg, 0).strip()[0] # the type, b/h/w, tells you what part of the word to look in - arg_type_num = int(arg_part(arg, 0).strip()[1]) # the type num, depends on type - value = 0 - unsigned_value = 0 - pad_len = 0 - if arg_type == "b": - value = get_byte(word, 4 - arg_type_num) - unsigned_value = get_byte_unsigned(word, 4 - arg_type_num) - pad_len = 2 - elif arg_type == "h": - value = get_short(word, 2 - arg_type_num) - unsigned_value = get_short_unsigned(word, 2 - arg_type_num) - pad_len = 4 - elif arg_type == "w": - value = get_word(word) - unsigned_value = get_word_unsigned(word) - pad_len = 8 - else: - print("Something went wrong!") # TODO more debug info - os._exit(1) - format_type = arg_part(arg, 2).strip() # the format type, how to express the final value - result = "" - if "e" in format_type: - enum_no = int(format_type[1]) - if enum_no == 0: - result = command_continue_stop[unsigned_value] - elif enum_no == 1: - result = cutscene_destinations[unsigned_value] - elif enum_no == 2: - result = ocarina_action_ids[unsigned_value] - elif format_type == "u": - result = str(value) - elif format_type == "s": - result = str(value) - elif format_type == "x": - result = "0x" + pad(hex(unsigned_value), pad_len).upper() - elif format_type == "f": - result = str(get_float(value))+"f" - else: - print("Something went wrong!") # TODO more debug info - os._exit(1) - return result - -def format_cmd(cmd, words): - if "__SPECIAL" in cmd: - # special handling for textbox list macros, as there are multiple dependent on particular values - if "CS_TEXT_LIST" in cmd: - if get_short_unsigned(words[1], 0) == 0xFFFF: - cmd = "CS_TEXT_NONE(%h1:1:s, %h2:2:s)" - elif get_short(words[2], 1) == 2: - cmd = "CS_TEXT_OCARINA_ACTION(%h2:1:e2, %h1:1:s, %h2:2:s, %h2:3:x)" - else: - cmd = "CS_TEXT(%h2:1:x, %h1:1:s, %h2:2:s, %h1:2:x, %h2:3:x, %h1:3:x)" - for arg in args_list(cmd): - cmd = cmd.replace(arg, format_arg(arg, words)) - return cmd - -""" -Cutscene parser - -Note that this isn't protected against indexing errors since a cutscene should always -end before the end of the file it's in. -""" - -def disassemble_cutscene(cs_in): - i = 0 - total_entries = cs_in[i] - i+=1 - cutscene_end_frame = cs_in[i] - i+=1 - if (total_entries < 0 or cutscene_end_frame < 0): - print("This cutscene would abort if played in-engine") - if total_entries < 0: - return "Could not disassemble cutscene: Number of commands is negative" - macros = format_cmd(begin_cutscene_entry[0], [total_entries, cutscene_end_frame])+line_end - for k in range(0,total_entries+1): - cmd_type = cs_in[i] - if (cmd_type == 0xFFFFFFFF): - return macros + multi_key(-1)[0]+line_end - entry = multi_key(cmd_type) - if entry is None: - entry = unk_data_entry - cmd_macro = entry[0] - n_words = entry[1] - macros += format_cmd(cmd_macro, [cs_in[i+j] for j in range(0, n_words)])+line_end - list_item = entry[4] - if list_item is not None: # Not all macros have associated list item macros - continue_stop = entry[2] - cmd_entries = entry[3] - n_words_list_item = entry[5] - if continue_stop is not None: # Not all macros have a continue/stop flag - i += n_words - do_continue = True - while do_continue: - # "Integer Divide" by 4 to get the word it's in - # Modulo operator to get the byte relative to the start of the word - do_continue = True if get_byte(cs_in[i+(continue_stop // 4)], continue_stop % 4) == 0x00 else False - macros += indent+format_cmd(list_item, [0, *[cs_in[i+j] for j in range(0, n_words_list_item)]])+line_end - i += n_words_list_item - elif cmd_entries is not None: # Not all macros have a defined number of entries - if cmd_entries < 0: # Some have a fixed number of entries - num_entries = -cmd_entries - else: # Some specify their number of entries - num_entries = cs_in[i+cmd_entries+1] - i += n_words - for n in range(0,num_entries): - macros += indent+format_cmd(list_item, [0, *[cs_in[i+j] for j in range(0, n_words_list_item)]])+line_end - i += n_words_list_item - else: - i += n_words - print("Warning: cutscene reached maximum entries without encountering a CS_END command") - return macros - -def hex_parse(s): - return int(s, 16) - -def main(): - parser = argparse.ArgumentParser(description="Disassembles cutscenes for OoT") - parser.add_argument('address', help="VRAM or ROM address to disassemble at", type=hex_parse) - args = parser.parse_args() - - file_result = None - if args.address >= 0x80000000: - file_result = filemap.GetFromVRam(args.address) - else: - file_result = filemap.GetFromRom(args.address) - if file_result is None: - print("Invalid address") - os._exit(1) - print(file_result) - print() - - script_dir = os.path.dirname(os.path.realpath(__file__)) - cs_data = None - with open(script_dir + "/../baseroms/gc-eu-mq-dbg/segments/" + file_result.name, "rb") as ovl_file: - ovl_file.seek(file_result.offset) - cs_data = [i[0] for i in struct.iter_unpack(">I", bytearray(ovl_file.read()))] - if cs_data is not None: - print("static CutsceneData D_" + hex(args.address).replace("0x","").upper() + "[] = {\n" + indent+disassemble_cutscene(cs_data).replace(linesep,linesep+indent).rstrip()+"\n};") - -if __name__ == "__main__": - main() diff --git a/tools/csdis_re.py b/tools/csdis_re.py new file mode 100644 index 000000000..7bb284c45 --- /dev/null +++ b/tools/csdis_re.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python3 + +# SPDX-FileCopyrightText: 2024 zeldaret +# SPDX-License-Identifier: CC0-1.0 + +# Re-disassemble cutscene scripts part of the source tree, +# using csdis.py and modifying files in-place + + +import re +from pathlib import Path +import struct + +import mapfile_parser + +import csdis +from overlayhelpers import filemap + + +SRC_ENCODING = "UTF-8" + +MAPFILE_P = Path("build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.map") +BASEROM_SEGMENTS_P = Path("extracted/gc-eu-mq-dbg/baserom/") + +HARDCODED_SYM_ROM = { + "D_8096C1A4": 0xD25834, + "D_80AF0880": 0xEA6860, + "D_80AF10A4": 0xEA7084, + "D_80AF1728": 0xEA7708, + "D_808BCE20": 0xC8BB20, + "D_808BD2A0": 0xC8BFA0, + "D_808BD520": 0xC8C220, + "D_808BD790": 0xC8C490, + "D_80AB431C": 0xE6A38C, + "D_8098786C": 0xD40EFC, + "D_80B4C5D0": 0xF022D0, + "D_80ABF9D0": 0xE75A40, + "D_80ABFB40": 0xE75BB0, + "D_80AF411C": 0xEAA0FC, + "D_80A88164": 0xE3ED34, + "D_808BB2F0": 0xC89FF0, + "D_808BB7A0": 0xC8A4A0, + "D_808BBD90": 0xC8AA90, + "gChildWarpInCS": 0xD45460, + "gAdultWarpOutToTCS": 0xD45340, + "gChildWarpOutToTCS": 0xD45840, + "gChildWarpInToTCS": 0xD45710, + "gAdultWarpInToTCS": 0xD45230, + "gAdultWarpInCS": 0xD44FA0, + "gChildWarpOutCS": 0xD45590, + "gAdultWarpOutCS": 0xD450B0, + "D_8099010C": 0xD4974C, +} + +mapfile = mapfile_parser.MapFile() +mapfile.readMapFile(MAPFILE_P) + +pat_CutsceneData = re.compile( + r""" + CutsceneData + \s+ + ( [^\s]* ) # symbol name + \s* + \[ \s* \] + \s* = \s* + \{ + (?: [^}]* | \n )* + \} ; + """, + re.VERBOSE, +) + + +def get_sym_rom(sym_name: str): + rom = HARDCODED_SYM_ROM.get(sym_name) + if rom: + return rom + print(f"Trying to find {sym_name} from the map (assuming OK build)") + sym = mapfile.findSymbolByName(sym_name) + print(f'"{sym_name}": 0x{sym.symbol.vrom:X}') + return sym.symbol.vrom + + +def repl(m: re.Match): + sym_name = m.group(1) + sym_rom = get_sym_rom(sym_name) + file_result = filemap.GetFromRom(sym_rom) + assert file_result is not None, (sym_name, sym_rom) + data = (BASEROM_SEGMENTS_P / file_result.name).read_bytes() + cs_data_bytes = data[file_result.offset :] + cs_data = [i[0] for i in struct.iter_unpack(">I", cs_data_bytes)] + return ( + f"CutsceneData {sym_name}[] = " + + "{\n" + + ( + "\n".join( + f" {line}" + for line in csdis.disassemble_cutscene(cs_data).splitlines() + ).rstrip() + ) + + "\n};" + ) + + +def main(): + for file_c in Path("src").glob("**/*.c"): + src = file_c.read_text(encoding=SRC_ENCODING) + src_new = pat_CutsceneData.sub(repl, src) + if src_new != src: + file_c.write_text(src_new, encoding=SRC_ENCODING) + print(file_c) + + +if __name__ == "__main__": + main() diff --git a/tools/data_extractor.py b/tools/data_extractor.py new file mode 100644 index 000000000..997ad52a6 --- /dev/null +++ b/tools/data_extractor.py @@ -0,0 +1,61 @@ +#!/usr/bin/python3 + +import argparse + + +def extract(start: int, size: int, input: str, output: str): + """Extracts ``size`` bytes from ``input``, at offset ``start``, and writes it to ``output`` + + Parameters: + - ``start``: int, defines where to start reading the file + - ``size``: int, how many bytes to read from the file + - ``input``: str, path to the file to read + - ``output``: str, path to the file to write + """ + + with open(input, "rb") as file: + file.seek(start) + data = file.read(size) + + with open(output, "wb") as file: + file.write(data) + + +def main(): + parser = argparse.ArgumentParser(description="Extracts data from a file for HackerOoT.") + + parser.add_argument( + "--start", + dest="start", + help="Offset to the data (uses hex)", + required=True, + ) + + parser.add_argument( + "--size", + dest="size", + help="How much to read (uses hex)", + required=True, + ) + + parser.add_argument( + "--input", + dest="input", + help="Input file", + required=True, + ) + + parser.add_argument( + "--output", + dest="output", + help="Output file", + required=True, + ) + + args = parser.parse_args() + extract(int(args.start, 16), int(args.size, 16), args.input, args.output) + print("Data extracted successfully!") + + +if __name__ == "__main__": + main() diff --git a/tools/decompile_data.py b/tools/decompile_data.py deleted file mode 100755 index 9805cb888..000000000 --- a/tools/decompile_data.py +++ /dev/null @@ -1,116 +0,0 @@ -#! /usr/bin/python3 - -import os -import re -import struct - -script_dir = os.path.dirname(os.path.realpath(__file__)) -root_dir = script_dir + "/../" -data_dir = root_dir + "data/" -asm_dir = root_dir + "asm/" - -def try_text(text_bytes): - bad_bytes = 0 - for byte in text_bytes: - if byte < 32: - bad_bytes += 1 - - # Arbitrary string detection heuristic - #if bad_bytes / len(text_bytes) >= 0.3: - # return None - - try: - text = text_bytes.decode("EUC-JP") - except UnicodeDecodeError: - return None - - text = text.strip(" \0") - if len(text) > 0 and bool(re.search('[a-zA-Z]', text)): - text = text.replace("\\x00", "") - text = text.replace("\n", "\\n") - text = text.replace("\"", "\\\"") - return text - - -def is_zeros(stuff): - for piece in stuff: - if piece.strip() != "0x00000000": - return False - return True - - -def try_float(word): - if (word[:3] == "0x3") or (word[:3] == "0x4") or \ - (word[:3] == "0xB") or (word[:3] == "0xC"): - return struct.unpack('!f', bytes.fromhex(word[2:10]))[0] - - -def quick_convert(words_string): - words = words_string.split(",") - byte_array = b"" - for word in words: - data = word.strip()[2:] - byte_array += bytearray.fromhex(data) - return byte_array.decode("EUC-JP") - -def word_convert(byte_string): - try: - words = byte_string.split(",") - byte_array = b"" - for word in words: - data = word.strip()[2:] - byte_array += bytearray.fromhex(data) - except ValueError: - return byte_string - - if byte_array[0] == 63 and byte_array[-1] == 45: - return byte_string - if data == '0A0A0000': - return "\\n\\n" - if len(words) > 1 and not is_zeros(words[1:]): - res = try_text(byte_array) - if res is not None: - return " .asciz \"" + res + "\"\n .balign 4\n" - if len(words) == 1 or is_zeros(words[1:]): - res = str(try_float(words[0].strip())) - if res is not None: - return " .float " + res + "\n" - - return byte_string - - -def handle_match(match): - in_str = match.group()[6:] - ret = word_convert(in_str) - if ret == in_str: - return match.group() - return ret - - -def process_data_file(file_path): - with open(file_path) as f: - file_text = f.read() - - new_file_text = re.sub(" \\.word 0x.*", handle_match, file_text) - - if new_file_text != file_text: - with open(file_path, "w") as f: - f.write(new_file_text) - return True - return False - - -def main(): - i = 0 - for root, dirs, files in os.walk(asm_dir): - for file in files: - #if i == 10: - # return - if file.endswith(".s"): - path = os.path.join(root, file) - if process_data_file(path): - print("Processed " + path) - i += 1 - - -main() diff --git a/tools/decompress_baserom.py b/tools/decompress_baserom.py index 551133e0e..13b57265f 100755 --- a/tools/decompress_baserom.py +++ b/tools/decompress_baserom.py @@ -5,16 +5,18 @@ from __future__ import annotations +import argparse import hashlib import io -import struct from pathlib import Path -import argparse +import struct import crunch64 import ipl3checksum import zlib +import dmadata + def decompress_zlib(data: bytes) -> bytes: decomp = zlib.decompressobj(-zlib.MAX_WBITS) @@ -32,43 +34,11 @@ def decompress(data: bytes, is_zlib_compressed: bool) -> bytes: return crunch64.yaz0.decompress(data) -FILE_TABLE_OFFSET = { - "gc-eu-mq": 0x07170, - "gc-eu-mq-dbg": 0x12F70, -} - -VERSIONS_MD5S = { - "gc-eu-mq": "1a438f4235f8038856971c14a798122a", - "gc-eu-mq-dbg": "f0b7f35375f9cc8ca1b2d59d78e35405", -} - - def round_up(n, shift): mod = 1 << shift return (n + mod - 1) >> shift << shift -def as_word_list(b) -> list[int]: - return [i[0] for i in struct.iter_unpack(">I", b)] - - -def read_dmadata_entry(file_content: bytearray, addr: int) -> list[int]: - return as_word_list(file_content[addr : addr + 0x10]) - - -def read_dmadata(file_content: bytearray, start) -> list[list[int]]: - dmadata = [] - addr = start - entry = read_dmadata_entry(file_content, addr) - i = 0 - while any([e != 0 for e in entry]): - dmadata.append(entry) - addr += 0x10 - i += 1 - entry = read_dmadata_entry(file_content, addr) - return dmadata - - def update_crc(decompressed: io.BytesIO) -> io.BytesIO: print("Recalculating crc...") calculated_checksum = ipl3checksum.CICKind.CIC_X105.calculateChecksum( @@ -82,42 +52,46 @@ def update_crc(decompressed: io.BytesIO) -> io.BytesIO: def decompress_rom( - file_content: bytearray, dmadata_addr: int, dmadata: list[list[int]], version: str + file_content: bytearray, + dmadata_start: int, + dma_entries: list[dmadata.DmaEntry], + is_zlib_compressed: bool, ) -> bytearray: rom_segments = {} # vrom start : data s.t. len(data) == vrom_end - vrom_start - new_dmadata = bytearray() # new dmadata: {vrom start , vrom end , vrom start , 0} + new_dmadata = [] # new dmadata: list[dmadata.Entry] decompressed = io.BytesIO(b"") - for v_start, v_end, p_start, p_end in dmadata: - if p_start == 0xFFFFFFFF and p_end == 0xFFFFFFFF: - new_dmadata.extend(struct.pack(">IIII", v_start, v_end, p_start, p_end)) + for dma_entry in dma_entries: + v_start = dma_entry.vrom_start + v_end = dma_entry.vrom_end + p_start = dma_entry.rom_start + p_end = dma_entry.rom_end + if dma_entry.is_syms(): + new_dmadata.append(dma_entry) continue - if p_end == 0: # uncompressed - rom_segments.update( - {v_start: file_content[p_start : p_start + v_end - v_start]} - ) - else: # compressed - rom_segments.update( - { - v_start: decompress( - file_content[p_start:p_end], version in {"ique-cn", "ique-zh"} - ) - } - ) - new_dmadata.extend(struct.pack(">IIII", v_start, v_end, v_start, 0)) + if dma_entry.is_compressed(): + new_contents = decompress(file_content[p_start:p_end], is_zlib_compressed) + rom_segments[v_start] = new_contents + else: + rom_segments[v_start] = file_content[p_start : p_start + v_end - v_start] + new_dmadata.append(dmadata.DmaEntry(v_start, v_end, v_start, 0)) # write rom segments to vaddrs for vrom_st, data in rom_segments.items(): decompressed.seek(vrom_st) decompressed.write(data) # write new dmadata - decompressed.seek(dmadata_addr) - decompressed.write(new_dmadata) + decompressed.seek(dmadata_start) + for dma_entry in new_dmadata: + entry_data = bytearray(dmadata.DmaEntry.SIZE_BYTES) + dma_entry.to_bin(entry_data) + decompressed.write(entry_data) # pad to size - padding_end = round_up(dmadata[-1][1], 14) - decompressed.seek(padding_end - 1) - decompressed.write(bytearray([0])) + padding_start = dma_entries[-1].vrom_end + padding_end = round_up(padding_start, 12) + decompressed.seek(padding_start) + decompressed.write(b"\x00" * (padding_end - padding_start)) # re-calculate crc return bytearray(update_crc(decompressed).getbuffer()) @@ -154,9 +128,10 @@ def byte_swap(file_content: bytearray) -> bytearray: def per_version_fixes(file_content: bytearray, version: str) -> bytearray: if version == "gc-eu-mq-dbg": - # Strip the overdump + # Strip the overdump, which consists of an area of 0xFF bytes (which may + # be erased flash memory) and ROM data from an unrelated game print("Stripping overdump...") - file_content = file_content[0:0x3600000] + file_content = file_content[0:0x035CF000] # Patch the header print("Patching header...") @@ -164,40 +139,41 @@ def per_version_fixes(file_content: bytearray, version: str) -> bytearray: return file_content -def pad_rom(file_content: bytearray, dmadata: list[list[int]]) -> bytearray: - padding_start = round_up(dmadata[-1][1], 12) - padding_end = round_up(dmadata[-1][1], 14) - print(f"Padding from {padding_start:X} to {padding_end:X}...") - for i in range(padding_start, padding_end): - file_content[i] = 0xFF - return file_content - # Determine if we have a ROM file ROM_FILE_EXTENSIONS = ["z64", "n64", "v64"] + def find_baserom(version: str) -> Path | None: for rom_file_ext_lower in ROM_FILE_EXTENSIONS: for rom_file_ext in (rom_file_ext_lower, rom_file_ext_lower.upper()): - rom_file_name_candidate = Path(f"baseroms/{version}/baserom.{rom_file_ext}") + rom_file_name_candidate = Path(f"baseroms/{version}/baserom.{rom_file_ext}") if rom_file_name_candidate.exists(): return rom_file_name_candidate return None def main(): - description = "Convert a rom that uses dmadata to an uncompressed one." - - parser = argparse.ArgumentParser(description=description) - parser.add_argument("version", help="Version of the game to decompress.", choices=list(VERSIONS_MD5S.keys())) + parser = argparse.ArgumentParser( + description="Convert a rom that uses dmadata to an uncompressed one." + ) + parser.add_argument( + "version", + help="Version of the game to decompress.", + ) args = parser.parse_args() version = args.version - uncompressed_path = Path(f"baseroms/{version}/baserom-decompressed.z64") + baserom_dir = Path(f"baseroms/{version}") + if not baserom_dir.exists(): + print(f"Error: Unknown version '{version}'.") + exit(1) - file_table_offset = FILE_TABLE_OFFSET[version] - correct_str_hash = VERSIONS_MD5S[version] + uncompressed_path = baserom_dir / "baserom-decompressed.z64" + + dmadata_start = int((baserom_dir / "dmadata_start.txt").read_text(), 16) + correct_str_hash = (baserom_dir / "checksum.md5").read_text().split()[0] if check_existing_rom(uncompressed_path, correct_str_hash): print("Found valid baserom - exiting early") @@ -207,7 +183,8 @@ def main(): if rom_file_name is None: path_list = [ - f"baseroms/{version}/baserom.{rom_file_ext}" for rom_file_ext in ROM_FILE_EXTENSIONS + f"baseroms/{version}/baserom.{rom_file_ext}" + for rom_file_ext in ROM_FILE_EXTENSIONS ] print(f"Error: Could not find {','.join(path_list)}.") exit(1) @@ -234,20 +211,14 @@ def main(): file_content = per_version_fixes(file_content, version) - dmadata = read_dmadata(file_content, file_table_offset) + dma_entries = dmadata.read_dmadata(file_content, dmadata_start) # Decompress - if any( - [ - b != 0 - for b in file_content[ - file_table_offset + 0xAC : file_table_offset + 0xAC + 0x4 - ] - ] - ): + if any(dma_entry.is_compressed() for dma_entry in dma_entries): print("Decompressing rom...") - file_content = decompress_rom(file_content, file_table_offset, dmadata, version) - - file_content = pad_rom(file_content, dmadata) + is_zlib_compressed = version in {"ique-cn", "ique-zh"} + file_content = decompress_rom( + file_content, dmadata_start, dma_entries, is_zlib_compressed + ) # Check to see if the ROM is a "vanilla" ROM str_hash = get_str_hash(file_content) @@ -257,7 +228,7 @@ def main(): ) if version == "gc-eu-mq-dbg": - if str_hash == "32fe2770c0f9b1a9cd2a4d449348c1cb": + if str_hash == "9fede30e3239558cf3993f12b7ed7458": print( "The provided baserom is a rom which has been edited with ZeldaEdit and is not suitable for use with decomp. Find a new one." ) @@ -265,7 +236,7 @@ def main(): exit(1) # Write out our new ROM - print(f"Writing new ROM {uncompressed_path}.") + print(f"Writing new ROM {uncompressed_path}...") uncompressed_path.write_bytes(file_content) print("Done!") diff --git a/tools/disasm/disasm.py b/tools/disasm/disasm.py deleted file mode 100755 index 1471a7e13..000000000 --- a/tools/disasm/disasm.py +++ /dev/null @@ -1,156 +0,0 @@ -#!/usr/bin/env python3 - -# SPDX-FileCopyrightText: © 2024 ZeldaRET -# SPDX-License-Identifier: CC0-1.0 - -import argparse -import collections -from pathlib import Path -from typing import BinaryIO - -import spimdisasm -from spimdisasm import frontendCommon as fec - -from file_addresses import DmaFile, parse_file_addresses, get_z_name_for_overlay - - -def load_file_splits( - context: spimdisasm.common.Context, - config_dir: Path, - dma_file: DmaFile, - f: BinaryIO, -) -> spimdisasm.mips.FileSplits: - # Assume that we're reading from a decompressed ROM where the DMA file is - # now located at the same ROM offset as the VROM start - f.seek(dma_file.vrom_start) - data = bytearray(f.read(dma_file.vrom_end - dma_file.vrom_start)) - - file_splits_path = config_dir / f"files_{dma_file.name}.csv" - if file_splits_path.exists(): - default_filename = "" - splits_data = spimdisasm.common.FileSplitFormat() - splits_data.readCsvFile(file_splits_path) - reloc_section = None - elif dma_file.overlay_dir is not None: - z_name = get_z_name_for_overlay(dma_file.name) - default_filename = ( - f"src/overlays/{dma_file.overlay_dir}/{dma_file.name}/{z_name}.s" - ) - splits_data = None - reloc_section = spimdisasm.mips.sections.SectionRelocZ64( - context, - vromStart=0, - vromEnd=len(data), - vram=dma_file.vram_start, - filename=default_filename, - array_of_bytes=data, - segmentVromStart=0, - overlayCategory=None, - ) - else: - raise Exception( - f"DMA file {dma_file.name} is not an overlay but has no file splits" - ) - - return spimdisasm.mips.FileSplits( - context, - vromStart=0, - vromEnd=len(data), - vram=dma_file.vram_start, - filename=default_filename, - array_of_bytes=data, - segmentVromStart=0, - overlayCategory=None, - splitsData=splits_data, - relocSection=reloc_section, - ) - - -def main(): - parser = argparse.ArgumentParser(description="Disassemble a ROM.") - parser.add_argument("rom", type=Path, help="Input ROM") - parser.add_argument( - "-o", "--output-dir", help="Output directory", type=Path, required=True - ) - parser.add_argument( - "--config-dir", help="Config directory", type=Path, required=True - ) - parser.add_argument( - "--split-functions", help="Write functions into separate files", type=Path - ) - - spimdisasm.common.Context.addParametersToArgParse(parser) - spimdisasm.common.GlobalConfig.addParametersToArgParse(parser) - spimdisasm.mips.InstructionConfig.addParametersToArgParse(parser) - - args = parser.parse_args() - - context = spimdisasm.common.Context() - context.parseArgs(args) - context.changeGlobalSegmentRanges(0x00000000, 0x01000000, 0x8000000, 0x81000000) - context.addBannedSymbolRange(0x10000000, 0x80000300) - context.addBannedSymbolRange(0xA0000000, 0xFFFFFFFF) - - spimdisasm.mips.InstructionConfig.parseArgs(args) - spimdisasm.common.GlobalConfig.parseArgs(args) - - spimdisasm.common.GlobalConfig.ASM_USE_PRELUDE = False - spimdisasm.common.GlobalConfig.PRODUCE_SYMBOLS_PLUS_OFFSET = True - spimdisasm.common.GlobalConfig.TRUST_USER_FUNCTIONS = True - - dma_files = parse_file_addresses(args.config_dir / "file_addresses.csv") - - output_files = collections.defaultdict(list) - with open(args.rom, "rb") as f: - for dma_file in dma_files: - file_splits = load_file_splits(context, args.config_dir, dma_file, f) - - for section_type, files in file_splits.sectionsDict.items(): - # TODO: disassemble overlay reloc sections? - if section_type == spimdisasm.common.FileSectionType.Reloc: - continue - - for path, section in files.items(): - output_files[path].append(section) - - for path, sections in sorted(output_files.items()): - spimdisasm.common.Utils.printQuietless(f"Analyzing {path} ...") - for section in sections: - section.analyze() - - for path, sections in sorted(output_files.items()): - spimdisasm.common.Utils.printQuietless(f"Writing {path} ...") - output_path = args.output_dir / path - output_path.parent.mkdir(parents=True, exist_ok=True) - with open(output_path, "w") as f: - f.write('.include "macro.inc"\n') - f.write("\n") - f.write(".set noat\n") - f.write(".set noreorder\n") - f.write(".set gp=64\n") - for section in sections: - f.write("\n") - f.write(f".section {section.sectionType.toStr()}\n") - f.write("\n") - f.write(f".align 4\n") - f.write("\n") - section.disassembleToFile(f) - - if args.split_functions is not None: - rodata_list = [] - for section in sections: - if section.sectionType == spimdisasm.common.FileSectionType.Rodata: - rodata_list.append(section) - - for section in sections: - if section.sectionType != spimdisasm.common.FileSectionType.Text: - continue - output_dir = (args.split_functions / section.name).with_suffix("") - for func in section.symbolList: - spimdisasm.mips.FilesHandlers.writeSplitedFunction( - output_dir, func, rodata_list - ) - - -if __name__ == "__main__": - main() diff --git a/tools/disasm/do_disasm.sh b/tools/disasm/do_disasm.sh new file mode 100755 index 000000000..0c7c5e9cc --- /dev/null +++ b/tools/disasm/do_disasm.sh @@ -0,0 +1,55 @@ +#!/bin/bash +set -eu -o pipefail + +if [ "${VERBOSE-}" ] +then +echo "$VERSION" +echo "$DISASM_DIR" +echo "$DISASM_BASEROM" +echo "$PYTHON" +echo "$AS_CMD" +echo "$LD" +set -x +fi + +DISASM_DATA_DIR="tools/disasm/$VERSION" +DISASM_FLAGS="--custom-suffix _unknown --sequential-label-names --no-use-fpccsr --no-cop0-named-registers" +DISASM_FLAGS="$DISASM_FLAGS --config-dir $DISASM_DATA_DIR --symbol-addrs $DISASM_DATA_DIR/functions.txt --symbol-addrs $DISASM_DATA_DIR/variables.txt" + +echo Disassembling... +cmd="$PYTHON tools/disasm/disasm.py $DISASM_FLAGS $DISASM_BASEROM -o $DISASM_DIR --split-functions $DISASM_DIR/functions" +echo "$cmd" +$cmd || ( + echo + echo Error on disassembling. + false +) +echo Disassembling done. + +echo Assembling text,data,rodata,bss sections together for each file... +for filebase in `find $DISASM_DIR -name '*.s' | sed -E -n 's/\.(text|data|rodata|bss)\.s$//p' | sort | uniq` +do + printf '%s \r' "$filebase" + files= + for section in text data rodata bss + do + file="$filebase.$section.s" + if [ -e $file ] + then + files="$files $file" + fi + done + iconv_cmd="iconv -f UTF-8 -t EUC-JP $files" + asfile_cmd="$AS_CMD -o $filebase.o --" + ( $iconv_cmd | $asfile_cmd ) || ( + echo + echo Error on assembling: + echo "$filebase" + echo Command line: + echo "$iconv_cmd | $asfile_cmd" + false + ) +done +echo + +echo All done! diff --git a/tools/disasm/file_addresses.py b/tools/disasm/file_addresses.py deleted file mode 100644 index 57c11f894..000000000 --- a/tools/disasm/file_addresses.py +++ /dev/null @@ -1,47 +0,0 @@ -# SPDX-FileCopyrightText: © 2024 ZeldaRET -# SPDX-License-Identifier: CC0-1.0 - -import csv -from dataclasses import dataclass -from pathlib import Path -from typing import List, Optional - - -@dataclass -class DmaFile: - name: str - vrom_start: int - vrom_end: int - rom_start: int - rom_end: int - vram_start: int - overlay_dir: Optional[str] - - -def parse_file_addresses(path: Path) -> List[DmaFile]: - result = [] - with open(path) as f: - reader = csv.DictReader(f) - for row in reader: - name = row["name"] - result.append( - DmaFile( - name=row["name"], - vrom_start=int(row["vrom_start"], 16), - vrom_end=int(row["vrom_end"], 16), - rom_start=int(row["rom_start"], 16), - rom_end=int(row["rom_end"], 16), - vram_start=int(row["vram_start"], 16), - overlay_dir=row["overlay_dir"] if row["overlay_dir"] else None, - ) - ) - return result - - -def get_z_name_for_overlay(filename: str) -> str: - if filename == "ovl_player_actor": - return "z_player" - elif filename.startswith("ovl_Effect_"): - return "z_eff_" + filename[len("ovl_Effect_") :].lower() - else: - return "z_" + filename[len("ovl_") :].lower() diff --git a/tools/disasm/gc-eu-mq/file_addresses.csv b/tools/disasm/gc-eu-mq/file_addresses.csv deleted file mode 100644 index d8d095609..000000000 --- a/tools/disasm/gc-eu-mq/file_addresses.csv +++ /dev/null @@ -1,472 +0,0 @@ -name,vrom_start,vrom_end,rom_start,rom_end,vram_start,overlay_dir -boot,1060,7170,1060,0,80000460, -code,A88000,B8A230,A580D0,AF27E0,80010F00, -ovl_title,B8A230,B8AA80,AF27E0,AF2E20,80800000,gamestates -ovl_select,B8AA80,B8D700,AF2E20,AF4900,80800850,gamestates -ovl_opening,B8D700,B8D860,AF4900,AF4A30,808034D0,gamestates -ovl_file_choose,B8D860,B9C470,AF4A30,AFCFD0,80803630,gamestates -ovl_kaleido_scope,B9C470,BB8E30,AFCFD0,B0BEC0,80812260,misc -ovl_player_actor,BB8E30,BDF540,B0BEC0,B25210,8082EC90,actors -ovl_map_mark_data,BDF540,BE6020,B25210,B255C0,80855470,misc -ovl_En_Test,BE6020,BEB8D0,B255C0,B28A90,8085BF50,actors -ovl_Arms_Hook,BEB8D0,BEC640,B28A90,B29520,80861800,actors -ovl_Arrow_Fire,BEC640,BEE520,B29520,B2AFE0,80862570,actors -ovl_Arrow_Ice,BEE520,BF0420,B2AFE0,B2C850,80864450,actors -ovl_Arrow_Light,BF0420,BF2330,B2C850,B2E150,80866350,actors -ovl_Bg_Bdan_Objects,BF2330,BF3600,B2E150,B2EE80,80868260,actors -ovl_Bg_Bdan_Switch,BF3600,BF4A30,B2EE80,B2FA30,80869530,actors -ovl_Bg_Bom_Guard,BF4A30,BF4C50,B2FA30,B2FC20,8086A960,actors -ovl_Bg_Bombwall,BF4C50,BF5510,B2FC20,B30300,8086AB80,actors -ovl_Bg_Bowl_Wall,BF5510,BF5E90,B30300,B30B20,8086B440,actors -ovl_Bg_Breakwall,BF5E90,BF6D00,B30B20,B31680,8086BDC0,actors -ovl_Bg_Ddan_Jd,BF6D00,BF7350,B31680,B31B80,8086CC30,actors -ovl_Bg_Ddan_Kd,BF7350,BF7C40,B31B80,B32260,8086D280,actors -ovl_Bg_Dodoago,BF7C40,BF8980,B32260,B32CC0,8086DB70,actors -ovl_Bg_Dy_Yoseizo,BF8980,BFB770,B32CC0,B34C00,8086E920,actors -ovl_Bg_Ganon_Otyuka,BFB770,BFDDB0,B34C00,B36920,80871710,actors -ovl_Bg_Gate_Shutter,BFDDB0,BFE240,B36920,B36CA0,80873D50,actors -ovl_Bg_Gjyo_Bridge,BFE240,BFE730,B36CA0,B370D0,808741E0,actors -ovl_Bg_Gnd_Darkmeiro,BFE730,BFEEF0,B370D0,B37690,808746D0,actors -ovl_Bg_Gnd_Firemeiro,BFEEF0,BFF440,B37690,B37AF0,80874E90,actors -ovl_Bg_Gnd_Iceblock,BFF440,C00530,B37AF0,B38630,808753E0,actors -ovl_Bg_Gnd_Nisekabe,C00530,C006A0,B38630,B38780,808764E0,actors -ovl_Bg_Gnd_Soulmeiro,C006A0,C00F00,B38780,B38E80,80876650,actors -ovl_Bg_Haka,C00F00,C015C0,B38E80,B39430,80876EB0,actors -ovl_Bg_Haka_Gate,C015C0,C02650,B39430,B3A110,80877570,actors -ovl_Bg_Haka_Huta,C02650,C030F0,B3A110,B3A970,80878610,actors -ovl_Bg_Haka_Megane,C030F0,C034F0,B3A970,B3ACC0,808790B0,actors -ovl_Bg_Haka_MeganeBG,C034F0,C03BB0,B3ACC0,B3B210,808794B0,actors -ovl_Bg_Haka_Sgami,C03BB0,C047D0,B3B210,B3BB90,80879B70,actors -ovl_Bg_Haka_Ship,C047D0,C05220,B3BB90,B3C3C0,8087A790,actors -ovl_Bg_Haka_Trap,C05220,C067F0,B3C3C0,B3D3D0,8087B1E0,actors -ovl_Bg_Haka_Tubo,C067F0,C07210,B3D3D0,B3DC10,8087C7B0,actors -ovl_Bg_Haka_Water,C07210,C07A10,B3DC10,B3E1D0,8087D1D0,actors -ovl_Bg_Haka_Zou,C07A10,C08C00,B3E1D0,B3EF50,8087D9D0,actors -ovl_Bg_Heavy_Block,C08C00,C0A4F0,B3EF50,B40190,8087EBC0,actors -ovl_Bg_Hidan_Curtain,C0A4F0,C0AF90,B40190,B409C0,808804B0,actors -ovl_Bg_Hidan_Dalm,C0AF90,C0B7E0,B409C0,B41020,80880F50,actors -ovl_Bg_Hidan_Firewall,C0B7E0,C0BF40,B41020,B41660,808817A0,actors -ovl_Bg_Hidan_Fslift,C0BF40,C0C410,B41660,B41A10,80881F00,actors -ovl_Bg_Hidan_Fwbig,C0C410,C0D0F0,B41A10,B42470,808823D0,actors -ovl_Bg_Hidan_Hamstep,C0D0F0,C0DFA0,B42470,B42FA0,808830B0,actors -ovl_Bg_Hidan_Hrock,C0DFA0,C0E7D0,B42FA0,B43610,80883F60,actors -ovl_Bg_Hidan_Kousi,C0E7D0,C0ED60,B43610,B43A50,80884790,actors -ovl_Bg_Hidan_Kowarerukabe,C0ED60,C0FC40,B43A50,B44420,80884D20,actors -ovl_Bg_Hidan_Rock,C0FC40,C10D40,B44420,B45100,80885C00,actors -ovl_Bg_Hidan_Rsekizou,C10D40,C11920,B45100,B459E0,80886D00,actors -ovl_Bg_Hidan_Sekizou,C11920,C12D70,B459E0,B46950,808878E0,actors -ovl_Bg_Hidan_Sima,C12D70,C13C70,B46950,B47520,80888D30,actors -ovl_Bg_Hidan_Syoku,C13C70,C140D0,B47520,B47830,80889C30,actors -ovl_Bg_Ice_Objects,C140D0,C15010,B47830,B48270,8088A090,actors -ovl_Bg_Ice_Shelter,C15010,C16250,B48270,B49060,8088AFD0,actors -ovl_Bg_Ice_Shutter,C16250,C166C0,B49060,B493C0,8088C210,actors -ovl_Bg_Ice_Turara,C166C0,C16EF0,B493C0,B49A80,8088C680,actors -ovl_Bg_Ingate,C16EF0,C17280,B49A80,B49DA0,8088CEB0,actors -ovl_Bg_Jya_1flift,C17280,C17910,B49DA0,B4A2A0,8088D240,actors -ovl_Bg_Jya_Amishutter,C17910,C17CA0,B4A2A0,B4A4F0,8088D8D0,actors -ovl_Bg_Jya_Bigmirror,C17CA0,C184F0,B4A4F0,B4AC00,8088DC60,actors -ovl_Bg_Jya_Block,C184F0,C18760,B4AC00,B4AE60,8088E4B0,actors -ovl_Bg_Jya_Bombchuiwa,C18760,C192A0,B4AE60,B4B710,8088E720,actors -ovl_Bg_Jya_Bombiwa,C192A0,C19860,B4B710,B4BBF0,8088F260,actors -ovl_Bg_Jya_Cobra,C19860,C1B5A0,B4BBF0,B4D170,8088F820,actors -ovl_Bg_Jya_Goroiwa,C1B5A0,C1BD20,B4D170,B4D7D0,80891560,actors -ovl_Bg_Jya_Haheniron,C1BD20,C1C510,B4D7D0,B4DE50,80891CE0,actors -ovl_Bg_Jya_Ironobj,C1C510,C1D2C0,B4DE50,B4E7B0,808924D0,actors -ovl_Bg_Jya_Kanaami,C1D2C0,C1D670,B4E7B0,B4EAA0,80893280,actors -ovl_Bg_Jya_Lift,C1D670,C1DBC0,B4EAA0,B4EEF0,80893630,actors -ovl_Bg_Jya_Megami,C1DBC0,C1EDB0,B4EEF0,B4FDD0,80893B80,actors -ovl_Bg_Jya_Zurerukabe,C1EDB0,C1F460,B4FDD0,B50320,80894D70,actors -ovl_Bg_Menkuri_Eye,C1F460,C1F8F0,B50320,B50710,80895420,actors -ovl_Bg_Menkuri_Kaiten,C1F8F0,C1FA80,B50710,B50870,808958C0,actors -ovl_Bg_Menkuri_Nisekabe,C1FA80,C1FBD0,B50870,B50990,80895A50,actors -ovl_Bg_Mizu_Bwall,C1FBD0,C210A0,B50990,B51760,80895BA0,actors -ovl_Bg_Mizu_Movebg,C210A0,C22220,B51760,B52440,80897070,actors -ovl_Bg_Mizu_Shutter,C22220,C22A20,B52440,B52A80,80898200,actors -ovl_Bg_Mizu_Uzu,C22A20,C22BF0,B52A80,B52C00,80898A00,actors -ovl_Bg_Mizu_Water,C22BF0,C238C0,B52C00,B53500,80898BD0,actors -ovl_Bg_Mjin,C238C0,C23CB0,B53500,B53860,808998A0,actors -ovl_Bg_Mori_Bigst,C23CB0,C245E0,B53860,B53ED0,80899C90,actors -ovl_Bg_Mori_Elevator,C245E0,C250D0,B53ED0,B54620,8089A5C0,actors -ovl_Bg_Mori_Hashigo,C250D0,C25990,B54620,B54CA0,8089B0B0,actors -ovl_Bg_Mori_Hashira4,C25990,C25F10,B54CA0,B550F0,8089B970,actors -ovl_Bg_Mori_Hineri,C25F10,C26C60,B550F0,B55AD0,8089BF00,actors -ovl_Bg_Mori_Idomizu,C26C60,C272A0,B55AD0,B55FC0,8089CC50,actors -ovl_Bg_Mori_Kaitenkabe,C272A0,C27910,B55FC0,B56510,8089D290,actors -ovl_Bg_Mori_Rakkatenjo,C27910,C28290,B56510,B56BD0,8089D900,actors -ovl_Bg_Po_Event,C28290,C2A0C0,B56BD0,B58220,8089E280,actors -ovl_Bg_Po_Syokudai,C2A0C0,C2AA30,B58220,B589D0,808A00C0,actors -ovl_Bg_Pushbox,C2AA30,C2AD30,B589D0,B58C60,808A0A30,actors -ovl_Bg_Relay_Objects,C2AD30,C2B4E0,B58C60,B59280,808A0D30,actors -ovl_Bg_Spot00_Break,C2B4E0,C2B680,B59280,B593F0,808A14E0,actors -ovl_Bg_Spot00_Hanebasi,C2B680,C2C790,B593F0,B5A1B0,808A1680,actors -ovl_Bg_Spot01_Fusya,C2C790,C2CA30,B5A1B0,B5A400,808A2790,actors -ovl_Bg_Spot01_Idohashira,C2CA30,C2D630,B5A400,B5AD30,808A2A30,actors -ovl_Bg_Spot01_Idomizu,C2D630,C2D950,B5AD30,B5B000,808A3630,actors -ovl_Bg_Spot01_Idosoko,C2D950,C2DB60,B5B000,B5B1C0,808A3950,actors -ovl_Bg_Spot01_Objects2,C2DB60,C2E020,B5B1C0,B5B5D0,808A3B60,actors -ovl_Bg_Spot02_Objects,C2E020,C2F380,B5B5D0,B5C3B0,808A4020,actors -ovl_Bg_Spot03_Taki,C2F380,C2FCA0,B5C3B0,B5CA90,808A5380,actors -ovl_Bg_Spot05_Soko,C2FCA0,C2FFC0,B5CA90,B5CD20,808A5CA0,actors -ovl_Bg_Spot06_Objects,C2FFC0,C313C0,B5CD20,B5DC30,808A5FC0,actors -ovl_Bg_Spot07_Taki,C313C0,C319B0,B5DC30,B5E0A0,808A73C0,actors -ovl_Bg_Spot08_Bakudankabe,C319B0,C32050,B5E0A0,B5E650,808A79B0,actors -ovl_Bg_Spot08_Iceblock,C32050,C33090,B5E650,B5F1F0,808A8050,actors -ovl_Bg_Spot09_Obj,C33090,C335B0,B5F1F0,B5F5C0,808A9090,actors -ovl_Bg_Spot11_Bakudankabe,C335B0,C33BF0,B5F5C0,B5FB20,808A95B0,actors -ovl_Bg_Spot11_Oasis,C33BF0,C34320,B5FB20,B60150,808A9BF0,actors -ovl_Bg_Spot12_Gate,C34320,C34730,B60150,B60460,808AA320,actors -ovl_Bg_Spot12_Saku,C34730,C34BF0,B60460,B60820,808AA730,actors -ovl_Bg_Spot15_Rrbox,C34BF0,C359D0,B60820,B61230,808AABF0,actors -ovl_Bg_Spot15_Saku,C359D0,C35D10,B61230,B61500,808AB9D0,actors -ovl_Bg_Spot16_Bombstone,C35D10,C37260,B61500,B625E0,808ABD10,actors -ovl_Bg_Spot16_Doughnut,C37260,C37820,B625E0,B62AB0,808AD260,actors -ovl_Bg_Spot17_Bakudankabe,C37820,C37F10,B62AB0,B63090,808AD820,actors -ovl_Bg_Spot17_Funen,C37F10,C38160,B63090,B632A0,808ADF10,actors -ovl_Bg_Spot18_Basket,C38160,C39150,B632A0,B63EB0,808AE160,actors -ovl_Bg_Spot18_Futa,C39150,C392F0,B63EB0,B64010,808AF150,actors -ovl_Bg_Spot18_Obj,C392F0,C39BC0,B64010,B64660,808AF2F0,actors -ovl_Bg_Spot18_Shutter,C39BC0,C3A110,B64660,B64A80,808AFBC0,actors -ovl_Bg_Sst_Floor,C3A110,C3A670,B64A80,B64F70,808B0110,actors -ovl_Bg_Toki_Hikari,C3A670,C3B410,B64F70,B657A0,808B0670,actors -ovl_Bg_Toki_Swd,C3B410,C3CA60,B657A0,B661E0,808B1410,actors -ovl_Bg_Treemouth,C3CA60,C3E0C0,B661E0,B66DE0,808B2A60,actors -ovl_Bg_Umajump,C3E0C0,C3E250,B66DE0,B66F50,808B40C0,actors -ovl_Bg_Vb_Sima,C3E250,C3E970,B66F50,B675A0,808B4250,actors -ovl_Bg_Ydan_Hasi,C3E970,C3F120,B675A0,B67BC0,808B4970,actors -ovl_Bg_Ydan_Maruta,C3F120,C3F800,B67BC0,B68140,808B5120,actors -ovl_Bg_Ydan_Sp,C3F800,C40F20,B68140,B69220,808B5800,actors -ovl_Bg_Zg,C40F20,C41370,B69220,B695A0,808B6F20,actors -ovl_Boss_Dodongo,C41370,C4AE70,B695A0,B6F870,808B7370,actors -ovl_Boss_Fd,C4AE70,C521D0,B6F870,B74570,808C0E70,actors -ovl_Boss_Fd2,C521D0,C55F00,B74570,B770D0,808C81D0,actors -ovl_Boss_Ganon,C55F00,C781B0,B770D0,B8C800,808CBF00,actors -ovl_Boss_Ganon2,C781B0,C89500,B8C800,B96DB0,808F1D30,actors -ovl_Boss_Ganondrof,C89500,C8E290,B96DB0,B9A120,80904BA0,actors -ovl_Boss_Goma,C8E290,C94230,B9A120,B9DB30,80909930,actors -ovl_Boss_Mo,C94230,C9FD00,B9DB30,BA5D50,8090F8D0,actors -ovl_Boss_Sst,C9FD00,CAC290,BA5D50,BAD8B0,8091FEB0,actors -ovl_Boss_Tw,CAC290,CBF3E0,BAD8B0,BB9EA0,8092C480,actors -ovl_Boss_Va,CBF3E0,CCDC70,BB9EA0,BC34D0,80942050,actors -ovl_Demo_6K,CCDC70,CD09D0,BC34D0,BC5620,809592E0,actors -ovl_Demo_Du,CD09D0,CD41B0,BC5620,BC71C0,8095C040,actors -ovl_Demo_Ec,CD41B0,CD7A10,BC71C0,BC88E0,8095F820,actors -ovl_Demo_Effect,CD7A10,CDD5B0,BC88E0,BCC450,80963080,actors -ovl_Demo_Ext,CDD5B0,CDDF00,BCC450,BCCB80,80968C20,actors -ovl_Demo_Geff,CDDF00,CDE720,BCCB80,BCD170,80969570,actors -ovl_Demo_Gj,CDE720,CE23D0,BCD170,BCEDE0,80969D90,actors -ovl_Demo_Go,CE23D0,CE3120,BCEDE0,BCF720,8096DA40,actors -ovl_Demo_Gt,CE3120,CE8730,BCF720,BD22A0,8096E790,actors -ovl_Demo_Ik,CE8730,CE9C40,BD22A0,BD2FB0,80973DA0,actors -ovl_Demo_Im,CE9C40,CEDBB0,BD2FB0,BD4F50,809752B0,actors -ovl_Demo_Kankyo,CEDBB0,CF1850,BD4F50,BD7360,80979220,actors -ovl_Demo_Kekkai,CF1850,CF2B40,BD7360,BD81F0,8097CF10,actors -ovl_Demo_Sa,CF2B40,CF5660,BD81F0,BD9750,8097E200,actors -ovl_Demo_Shd,CF5660,CF7A70,BD9750,BDAF70,80980D20,actors -ovl_Demo_Tre_Lgt,CF7A70,CF8180,BDAF70,BDB560,80983130,actors -ovl_Door_Ana,CF8180,CF87F0,BDB560,BDBAC0,80983840,actors -ovl_Door_Gerudo,CF87F0,CF8DE0,BDBAC0,BDBFC0,80983EB0,actors -ovl_Door_Killer,CF8DE0,CFA350,BDBFC0,BDD040,809844A0,actors -ovl_Door_Shutter,CFA350,CFC610,BDD040,BDE930,80985A10,actors -ovl_Door_Toki,CFC610,CFC770,BDE930,BDEA50,80987CD0,actors -ovl_Door_Warp1,CFC770,D00A70,BDEA50,BE10D0,80987E30,actors -ovl_Efc_Erupc,D00A70,D01560,BE10D0,BE19C0,8098C140,actors -ovl_Eff_Dust,D01560,D02930,BE19C0,BE25B0,8098CC30,actors -ovl_Effect_Ss_Blast,D02930,D02CC0,BE25B0,BE2920,8098E000,effects -ovl_Effect_Ss_Bomb,D02CC0,D030F0,BE2920,BE2D00,8098E390,effects -ovl_Effect_Ss_Bomb2,D030F0,D039F0,BE2D00,BE33B0,8098E7C0,effects -ovl_Effect_Ss_Bubble,D039F0,D03E70,BE33B0,BE37B0,8098F0C0,effects -ovl_Effect_Ss_D_Fire,D03E70,D04360,BE37B0,BE3C50,8098F540,effects -ovl_Effect_Ss_Dead_Db,D04360,D04840,BE3C50,BE4100,8098FA30,effects -ovl_Effect_Ss_Dead_Dd,D04840,D04DD0,BE4100,BE4620,8098FF10,effects -ovl_Effect_Ss_Dead_Ds,D04DD0,D05250,BE4620,BE4A50,809904A0,effects -ovl_Effect_Ss_Dead_Sound,D05250,D05390,BE4A50,BE4B90,80990920,effects -ovl_Effect_Ss_Dt_Bubble,D05390,D05920,BE4B90,BE5070,80990A60,effects -ovl_Effect_Ss_Dust,D05920,D06160,BE5070,BE5720,80990FF0,effects -ovl_Effect_Ss_En_Fire,D06160,D068B0,BE5720,BE5DB0,80991830,effects -ovl_Effect_Ss_En_Ice,D068B0,D07170,BE5DB0,BE6560,80991F80,effects -ovl_Effect_Ss_Extra,D07170,D07530,BE6560,BE6900,80992840,effects -ovl_Effect_Ss_Fcircle,D07530,D079E0,BE6900,BE6D70,80992C00,effects -ovl_Effect_Ss_Fhg_Flash,D079E0,D08960,BE6D70,BE7780,809930B0,effects -ovl_Effect_Ss_Fire_Tail,D08960,D09060,BE7780,BE7DD0,80994030,effects -ovl_Effect_Ss_G_Fire,D09060,D092F0,BE7DD0,BE8030,80994730,effects -ovl_Effect_Ss_G_Magma,D092F0,D09550,BE8030,BE8270,809949C0,effects -ovl_Effect_Ss_G_Magma2,D09550,D09A60,BE8270,BE8730,80994C20,effects -ovl_Effect_Ss_G_Ripple,D09A60,D09FC0,BE8730,BE8C10,80995130,effects -ovl_Effect_Ss_G_Spk,D09FC0,D0A570,BE8C10,BE9130,80995690,effects -ovl_Effect_Ss_G_Splash,D0A570,D0AA20,BE9130,BE94F0,80995C40,effects -ovl_Effect_Ss_Hahen,D0AA20,D0B060,BE94F0,BE99E0,809960F0,effects -ovl_Effect_Ss_HitMark,D0B060,D0B5B0,BE99E0,BE9E90,80996730,effects -ovl_Effect_Ss_Ice_Piece,D0B5B0,D0B9F0,BE9E90,BEA290,80996C80,effects -ovl_Effect_Ss_Ice_Smoke,D0B9F0,D0BED0,BEA290,BEA6D0,809970C0,effects -ovl_Effect_Ss_K_Fire,D0BED0,D0C310,BEA6D0,BEAAD0,809975A0,effects -ovl_Effect_Ss_Kakera,D0C310,D0D3A0,BEAAD0,BEB710,809979E0,effects -ovl_Effect_Ss_KiraKira,D0D3A0,D0DA10,BEB710,BEBCB0,80998A70,effects -ovl_Effect_Ss_Lightning,D0DA10,D0E0E0,BEBCB0,BEC300,809990E0,effects -ovl_Effect_Ss_Sibuki,D0E0E0,D0E7B0,BEC300,BEC900,809997B0,effects -ovl_Effect_Ss_Sibuki2,D0E7B0,D0EAE0,BEC900,BECC00,80999E80,effects -ovl_Effect_Ss_Solder_Srch_Ball,D0EAE0,D0EC90,BECC00,BECDA0,8099A1B0,effects -ovl_Effect_Ss_Stick,D0EC90,D0F030,BECDA0,BED0F0,8099A360,effects -ovl_Effect_Ss_Stone1,D0F030,D0F3B0,BED0F0,BED440,8099A700,effects -ovl_Elf_Msg,D0F3B0,D0F9A0,BED440,BED8A0,8099AA80,actors -ovl_Elf_Msg2,D0F9A0,D0FE10,BED8A0,BEDBA0,8099B070,actors -ovl_En_Am,D0FE10,D12210,BEDBA0,BEF3E0,8099B4E0,actors -ovl_En_Ani,D12210,D12F80,BEF3E0,BEFD70,8099D8E0,actors -ovl_En_Anubice,D12F80,D14230,BEFD70,BF0B40,8099E650,actors -ovl_En_Anubice_Fire,D14230,D14FF0,BF0B40,BF16A0,8099F900,actors -ovl_En_Anubice_Tag,D14FF0,D152C0,BF16A0,BF1910,809A06C0,actors -ovl_En_Arow_Trap,D152C0,D15410,BF1910,BF1A50,809A0990,actors -ovl_En_Arrow,D15410,D16B10,BF1A50,BF2AC0,809A0AE0,actors -ovl_En_Attack_Niw,D16B10,D17D70,BF2AC0,BF3820,809A21E0,actors -ovl_En_Ba,D17D70,D19C40,BF3820,BF4C50,809A3440,actors -ovl_En_Bb,D19C40,D1D920,BF4C50,BF7810,809A5310,actors -ovl_En_Bdfire,D1D920,D1E4C0,BF7810,BF8120,809A8FF0,actors -ovl_En_Bigokuta,D1E4C0,D20FC0,BF8120,BF9E50,809A9B90,actors -ovl_En_Bili,D20FC0,D23290,BF9E50,BFB680,809AC690,actors -ovl_En_Bird,D23290,D23750,BFB680,BFBA60,809AE960,actors -ovl_En_Blkobj,D23750,D23CB0,BFBA60,BFBEE0,809AEE20,actors -ovl_En_Bom,D23CB0,D24B80,BFBEE0,BFCA90,809AF380,actors -ovl_En_Bom_Bowl_Man,D24B80,D260C0,BFCA90,BFDA30,809B0250,actors -ovl_En_Bom_Bowl_Pit,D260C0,D26A30,BFDA30,BFE190,809B1790,actors -ovl_En_Bom_Chu,D26A30,D280D0,BFE190,BFF380,809B2100,actors -ovl_En_Bombf,D280D0,D29560,BFF380,C00370,809B37A0,actors -ovl_En_Boom,D29560,D29E30,C00370,C00AB0,809B4C30,actors -ovl_En_Box,D29E30,D2B980,C00AB0,C01DA0,809B5500,actors -ovl_En_Brob,D2B980,D2CA70,C01DA0,C029E0,809B7060,actors -ovl_En_Bubble,D2CA70,D2DE90,C029E0,C03940,809B8150,actors -ovl_En_Butte,D2DE90,D2F460,C03940,C04910,809B9570,actors -ovl_En_Bw,D2F460,D327F0,C04910,C06BC0,809BAB40,actors -ovl_En_Bx,D327F0,D332F0,C06BC0,C07560,809BDED0,actors -ovl_En_Changer,D332F0,D33CD0,C07560,C07CB0,809BE9D0,actors -ovl_En_Clear_Tag,D33CD0,D3C840,C07CB0,C0C090,809BF3B0,actors -ovl_En_Cow,D3C840,D3DCA0,C0C090,C0CDB0,809CA950,actors -ovl_En_Crow,D3DCA0,D3F340,C0CDB0,C0DE80,809CBDB0,actors -ovl_En_Cs,D3F340,D40570,C0DE80,C0EC70,809CD450,actors -ovl_En_Daiku,D40570,D41CB0,C0EC70,C0FE50,809CE680,actors -ovl_En_Daiku_Kakariko,D41CB0,D43070,C0FE50,C10D30,809CFDC0,actors -ovl_En_Dekubaba,D43070,D46B20,C10D30,C132F0,809D1180,actors -ovl_En_Dekunuts,D46B20,D48320,C132F0,C142A0,809D4C30,actors -ovl_En_Dh,D48320,D49E00,C142A0,C15620,809D6430,actors -ovl_En_Dha,D49E00,D4AE00,C15620,C16200,809D7F10,actors -ovl_En_Diving_Game,D4AE00,D4C7B0,C16200,C17400,809D8F10,actors -ovl_En_Dns,D4C7B0,D4DB40,C17400,C180D0,809DA8C0,actors -ovl_En_Dnt_Demo,D4DB40,D4E860,C180D0,C18B20,809DBC50,actors -ovl_En_Dnt_Jiji,D4E860,D4FD80,C18B20,C197E0,809DC970,actors -ovl_En_Dnt_Nomal,D4FD80,D52B80,C197E0,C1B390,809DDE90,actors -ovl_En_Dodojr,D52B80,D54A20,C1B390,C1C8E0,809E0C90,actors -ovl_En_Dodongo,D54A20,D577C0,C1C8E0,C1E820,809E2B30,actors -ovl_En_Dog,D577C0,D58970,C1E820,C1F4A0,809E58D0,actors -ovl_En_Door,D58970,D597B0,C1F4A0,C20070,809E6A80,actors -ovl_En_Ds,D597B0,D5A3D0,C20070,C208E0,809E78C0,actors -ovl_En_Du,D5A3D0,D5BE60,C208E0,C21B30,809E84E0,actors -ovl_En_Dy_Extra,D5BE60,D5C400,C21B30,C22020,809E9F70,actors -ovl_En_Eg,D5C400,D5C5B0,C22020,C22180,809EA510,actors -ovl_En_Eiyer,D5C5B0,D5E210,C22180,C235B0,809EA6C0,actors -ovl_En_Elf,D5E210,D62BD0,C235B0,C265B0,809EC320,actors -ovl_En_Encount1,D62BD0,D63730,C265B0,C26F10,809F0CE0,actors -ovl_En_Encount2,D63730,D64960,C26F10,C27D20,809F1840,actors -ovl_En_Ex_Item,D64960,D65AE0,C27D20,C289E0,809F2A70,actors -ovl_En_Ex_Ruppy,D65AE0,D66BA0,C289E0,C296B0,809F3BF0,actors -ovl_En_Fd,D66BA0,D69840,C296B0,C2B7A0,809F4CB0,actors -ovl_En_Fd_Fire,D69840,D6A550,C2B7A0,C2C2A0,809F7950,actors -ovl_En_Fhg_Fire,D6A550,D6CBF0,C2C2A0,C2DE40,809F8660,actors -ovl_En_Fire_Rock,D6CBF0,D6DD00,C2DE40,C2EAB0,809FAD00,actors -ovl_En_Firefly,D6DD00,D6FE70,C2EAB0,C30130,809FBE10,actors -ovl_En_Fish,D6FE70,D71F80,C30130,C315F0,809FDF80,actors -ovl_En_Floormas,D71F80,D75360,C315F0,C335E0,80A00090,actors -ovl_En_Fr,D75360,D77DF0,C335E0,C35420,80A03470,actors -ovl_En_Fu,D77DF0,D78B30,C35420,C35E90,80A05F00,actors -ovl_En_Fw,D78B30,D7A2F0,C35E90,C371C0,80A06C50,actors -ovl_En_Fz,D7A2F0,D7C300,C371C0,C38870,80A08410,actors -ovl_En_G_Switch,D7C300,D7DB20,C38870,C39B00,80A0A420,actors -ovl_En_Ganon_Mant,D7DB20,D81D50,C39B00,C3B850,80A0BC40,actors -ovl_En_Ganon_Organ,D81D50,D88D90,C3B850,C3EEE0,80A0FE70,actors -ovl_En_Gb,D88D90,D8A4C0,C3EEE0,C40010,80A16EB0,actors -ovl_En_Ge1,D8A4C0,D8C4F0,C40010,C41440,80A185E0,actors -ovl_En_Ge2,D8C4F0,D8DE90,C41440,C425D0,80A1A610,actors -ovl_En_Ge3,D8DE90,D8EAD0,C425D0,C42EF0,80A1BFB0,actors -ovl_En_GeldB,D8EAD0,D93E80,C42EF0,C462C0,80A1CBF0,actors -ovl_En_GirlA,D93E80,D967A0,C462C0,C47730,80A21FA0,actors -ovl_En_Gm,D967A0,D974D0,C47730,C48140,80A248C0,actors -ovl_En_Go,D974D0,D9BB10,C48140,C4AEC0,80A255F0,actors -ovl_En_Go2,D9BB10,DA1B50,C4AEC0,C4ECE0,80A29C30,actors -ovl_En_Goma,DA1B50,DA4800,C4ECE0,C50A80,80A2FC70,actors -ovl_En_Goroiwa,DA4800,DA6BC0,C50A80,C523A0,80A32920,actors -ovl_En_Gs,DA6BC0,DA8A30,C523A0,C53A00,80A34CE0,actors -ovl_En_Guest,DA8A30,DA93D0,C53A00,C54210,80A36B50,actors -ovl_En_Hata,DA93D0,DA9960,C54210,C54710,80A374F0,actors -ovl_En_Heishi1,DA9960,DAAE70,C54710,C55570,80A37A80,actors -ovl_En_Heishi2,DAAE70,DAD070,C55570,C56A20,80A38F90,actors -ovl_En_Heishi3,DAD070,DADA40,C56A20,C57150,80A3B190,actors -ovl_En_Heishi4,DADA40,DAE940,C57150,C57BE0,80A3BB60,actors -ovl_En_Hintnuts,DAE940,DB0370,C57BE0,C58D90,80A3CA60,actors -ovl_En_Holl,DB0370,DB1340,C58D90,C59930,80A3E490,actors -ovl_En_Honotrap,DB1340,DB28A0,C59930,C5A900,80A3F460,actors -ovl_En_Horse,DB28A0,DBEB00,C5A900,C62100,80A409C0,actors -ovl_En_Horse_Game_Check,DBEB00,DBFBD0,C62100,C62D20,80A4CC20,actors -ovl_En_Horse_Ganon,DBFBD0,DC0950,C62D20,C63790,80A4DCF0,actors -ovl_En_Horse_Link_Child,DC0950,DC2750,C63790,C64990,80A4EA70,actors -ovl_En_Horse_Normal,DC2750,DC4D70,C64990,C661E0,80A50870,actors -ovl_En_Horse_Zelda,DC4D70,DC5860,C661E0,C66AB0,80A52E90,actors -ovl_En_Hs,DC5860,DC6400,C66AB0,C672F0,80A53980,actors -ovl_En_Hs2,DC6400,DC69E0,C672F0,C677D0,80A54520,actors -ovl_En_Hy,DC69E0,DCA320,C677D0,C69C00,80A54B00,actors -ovl_En_Ice_Hono,DCA320,DCB510,C69C00,C6A8D0,80A58440,actors -ovl_En_Ik,DCB510,DCFB60,C6A8D0,C6D1C0,80A59630,actors -ovl_En_In,DCFB60,DD2900,C6D1C0,C6F290,80A5DC90,actors -ovl_En_Insect,DD2900,DD4E20,C6F290,C70B30,80A60A30,actors -ovl_En_Ishi,DD4E20,DDDF70,C70B30,C71E90,80A62F50,actors -ovl_En_It,DDDF70,DDE100,C71E90,C71FC0,80A6C0A0,actors -ovl_En_Jj,DDE100,DDF6D0,C71FC0,C72C10,80A6C230,actors -ovl_En_Js,DDF6D0,DE00A0,C72C10,C73330,80A6D800,actors -ovl_En_Jsjutan,DE00A0,DE4E70,C73330,C750A0,80A6E1D0,actors -ovl_En_Kakasi,DE4E70,DE5BB0,C750A0,C75AC0,80A73B00,actors -ovl_En_Kakasi2,DE5BB0,DE62D0,C75AC0,C76060,80A74840,actors -ovl_En_Kakasi3,DE62D0,DE73B0,C76060,C76CA0,80A74F60,actors -ovl_En_Kanban,DE73B0,DEA500,C76CA0,C78AB0,80A76040,actors -ovl_En_Karebaba,DEA500,DEBDF0,C78AB0,C79C30,80A79190,actors -ovl_En_Ko,DEBDF0,DEFF30,C79C30,C7C1D0,80A7AA80,actors -ovl_En_Kusa,DEFF30,DF1410,C7C1D0,C7D120,80A7EBC0,actors -ovl_En_Kz,DF1410,DF29B0,C7D120,C7E120,80A800A0,actors -ovl_En_Light,DF29B0,DF37B0,C7E120,C7EB00,80A81640,actors -ovl_En_Lightbox,DF37B0,DF3C30,C7EB00,C7EED0,80A82440,actors -ovl_En_M_Fire1,DF3C30,DF3DD0,C7EED0,C7F020,80A828C0,actors -ovl_En_M_Thunder,DF3DD0,DF53D0,C7F020,C80020,80A82A60,actors -ovl_En_Ma1,DF53D0,DF66B0,C80020,C80E30,80A84060,actors -ovl_En_Ma2,DF66B0,DF7710,C80E30,C81AB0,80A85340,actors -ovl_En_Ma3,DF7710,DF86C0,C81AB0,C826D0,80A863A0,actors -ovl_En_Mag,DF86C0,DFABE0,C826D0,C84120,80A87350,actors -ovl_En_Mb,DFABE0,DFEE10,C84120,C86C10,80A89870,actors -ovl_En_Md,DFEE10,E01480,C86C10,C88310,80A8DAA0,actors -ovl_En_Mk,E01480,E02310,C88310,C88CF0,80A90110,actors -ovl_En_Mm,E02310,E03970,C88CF0,C89DF0,80A90FA0,actors -ovl_En_Mm2,E03970,E04730,C89DF0,C8A860,80A92600,actors -ovl_En_Ms,E04730,E04E20,C8A860,C8AE10,80A933C0,actors -ovl_En_Mu,E04E20,E05740,C8AE10,C8B5D0,80A93AB0,actors -ovl_En_Nb,E05740,E09D10,C8B5D0,C8DA50,80A943D0,actors -ovl_En_Niw,E09D10,E0D040,C8DA50,C8FF30,80A989A0,actors -ovl_En_Niw_Girl,E0D040,E0DB10,C8FF30,C90880,80A9BCD0,actors -ovl_En_Niw_Lady,E0DB10,E0F410,C90880,C91A70,80A9C7A0,actors -ovl_En_Nutsball,E0F410,E0FA30,C91A70,C91FF0,80A9E0A0,actors -ovl_En_Nwc,E0FA30,E10450,C91FF0,C92880,80A9E6C0,actors -ovl_En_Ny,E10450,E11D90,C92880,C93B00,80A9F0E0,actors -ovl_En_OE2,E11D90,E11E70,C93B00,C93B90,80AA0A20,actors -ovl_En_Okarina_Effect,E11E70,E12230,C93B90,C93E80,80AA0B00,actors -ovl_En_Okarina_Tag,E12230,E13730,C93E80,C94A80,80AA0EC0,actors -ovl_En_Okuta,E13730,E15D10,C94A80,C964C0,80AA23C0,actors -ovl_En_Ossan,E15D10,E1C2F0,C964C0,C99CA0,80AA49A0,actors -ovl_En_Owl,E1C2F0,E1FE90,C99CA0,C9BF20,80AAAF80,actors -ovl_En_Part,E1FE90,E214F0,C9BF20,C9CF90,80AAEB20,actors -ovl_En_Peehat,E214F0,E24BF0,C9CF90,C9F260,80AB0180,actors -ovl_En_Po_Desert,E24BF0,E259B0,C9F260,C9FDB0,80AB3880,actors -ovl_En_Po_Field,E259B0,E293B0,C9FDB0,CA2620,80AB4640,actors -ovl_En_Po_Relay,E293B0,E2AAC0,CA2620,CA37A0,80AB80D0,actors -ovl_En_Po_Sisters,E2AAC0,E2F7B0,CA37A0,CA69E0,80AB97E0,actors -ovl_En_Poh,E2F7B0,E339A0,CA69E0,CA9420,80ABE4D0,actors -ovl_En_Pu_box,E339A0,E33CE0,CA9420,CA9700,80AC26C0,actors -ovl_En_Rd,E33CE0,E365A0,CA9700,CAB110,80AC2A00,actors -ovl_En_Reeba,E365A0,E38010,CAB110,CAC410,80AC52C0,actors -ovl_En_River_Sound,E38010,E389A0,CAC410,CACBE0,80AC6D30,actors -ovl_En_Rl,E389A0,E39880,CACBE0,CAD500,80AC76C0,actors -ovl_En_Rr,E39880,E3BDB0,CAD500,CAF010,80AC85A0,actors -ovl_En_Ru1,E3BDB0,E43450,CAF010,CB2E60,80ACAAD0,actors -ovl_En_Ru2,E43450,E461D0,CB2E60,CB44A0,80AD2170,actors -ovl_En_Sa,E461D0,E48440,CB44A0,CB5B00,80AD4EF0,actors -ovl_En_Sb,E48440,E49880,CB5B00,CB6880,80AD7160,actors -ovl_En_Scene_Change,E49880,E499B0,CB6880,CB6970,80AD85A0,actors -ovl_En_Sda,E499B0,E4AFE0,CB6970,CB7840,80AD86D0,actors -ovl_En_Shopnuts,E4AFE0,E4BEF0,CB7840,CB82A0,80AD9DC0,actors -ovl_En_Si,E4BEF0,E4C3F0,CB82A0,CB86C0,80ADACD0,actors -ovl_En_Siofuki,E4C3F0,E4D1A0,CB86C0,CB9100,80ADB1D0,actors -ovl_En_Skb,E4D1A0,E4EA90,CB9100,CBA320,80ADBF80,actors -ovl_En_Skj,E4EA90,E523D0,CBA320,CBC6E0,80ADD870,actors -ovl_En_Skjneedle,E523D0,E526E0,CBC6E0,CBC990,80AE11C0,actors -ovl_En_Ssh,E526E0,E54CD0,CBC990,CBE3E0,80AE14D0,actors -ovl_En_St,E54CD0,E57940,CBE3E0,CC02C0,80AE3AC0,actors -ovl_En_Sth,E57940,E5BA00,CC02C0,CC2E90,80AE6730,actors -ovl_En_Stream,E5BA00,E5BF90,CC2E90,CC3360,80AEA7F0,actors -ovl_En_Sw,E5BF90,E5F700,CC3360,CC5BA0,80AEAD80,actors -ovl_En_Syateki_Itm,E5F700,E604A0,CC5BA0,CC6610,80AEE570,actors -ovl_En_Syateki_Man,E604A0,E61260,CC6610,CC7040,80AEF310,actors -ovl_En_Syateki_Niw,E61260,E632F0,CC7040,CC8810,80AF00D0,actors -ovl_En_Ta,E632F0,E66CB0,CC8810,CCAB60,80AF2160,actors -ovl_En_Takara_Man,E66CB0,E67570,CCAB60,CCB2E0,80AF5B20,actors -ovl_En_Tana,E67570,E67820,CCB2E0,CCB520,80AF63E0,actors -ovl_En_Tg,E67820,E67F00,CCB520,CCBAF0,80AF6690,actors -ovl_En_Tite,E67F00,E6ACA0,CCBAF0,CCD6A0,80AF6D70,actors -ovl_En_Tk,E6ACA0,E6CAD0,CCD6A0,CCECD0,80AF9B10,actors -ovl_En_Torch,E6CAD0,E6CBC0,CCECD0,CCEDB0,80AFB940,actors -ovl_En_Torch2,E6CBC0,E6F320,CCEDB0,CD0A50,80AFBA30,actors -ovl_En_Toryo,E6F320,E6FFB0,CD0A50,CD1380,80AFE1D0,actors -ovl_En_Tp,E6FFB0,E71E20,CD1380,CD29B0,80AFEE60,actors -ovl_En_Tr,E71E20,E73720,CD29B0,CD3BB0,80B00CD0,actors -ovl_En_Trap,E73720,E749C0,CD3BB0,CD47F0,80B025D0,actors -ovl_En_Tubo_Trap,E749C0,E75660,CD47F0,CD5100,80B03870,actors -ovl_En_Vali,E75660,E77D20,CD5100,CD6BB0,80B04510,actors -ovl_En_Vase,E77D20,E77E20,CD6BB0,CD6C90,80B06BD0,actors -ovl_En_Vb_Ball,E77E20,E78FD0,CD6C90,CD79E0,80B06CD0,actors -ovl_En_Viewer,E78FD0,E7BE70,CD79E0,CD9950,80B07E80,actors -ovl_En_Vm,E7BE70,E7D730,CD9950,CDAAF0,80B0AD40,actors -ovl_En_Wall_Tubo,E7D730,E7DC20,CDAAF0,CDAF10,80B0C600,actors -ovl_En_Wallmas,E7DC20,E7F630,CDAF10,CDC0B0,80B0CAF0,actors -ovl_En_Weather_Tag,E7F630,E80520,CDC0B0,CDC7F0,80B0E500,actors -ovl_En_Weiyer,E80520,E81F20,CDC7F0,CDD910,80B0F3F0,actors -ovl_En_Wf,E81F20,E86230,CDD910,CE0460,80B10DF0,actors -ovl_En_Wonder_Item,E86230,E86E80,CE0460,CE0D20,80B15100,actors -ovl_En_Wonder_Talk,E86E80,E87510,CE0D20,CE1270,80B15E30,actors -ovl_En_Wonder_Talk2,E87510,E87BB0,CE1270,CE1810,80B164C0,actors -ovl_En_Wood02,E87BB0,E88D80,CE1810,CE2650,80B16B60,actors -ovl_En_Xc,E88D80,E8F4E0,CE2650,CE5B10,80B17D40,actors -ovl_En_Yabusame_Mark,E8F4E0,E8FBB0,CE5B10,CE6070,80B1E4D0,actors -ovl_En_Yukabyun,E8FBB0,E901C0,CE6070,CE65C0,80B1EBA0,actors -ovl_En_Zf,E901C0,E96CA0,CE65C0,CEAA50,80B1F1B0,actors -ovl_En_Zl1,E96CA0,E9AAB0,CEAA50,CEC9C0,80B25CA0,actors -ovl_En_Zl2,E9AAB0,E9F1B0,CEC9C0,CEEDB0,80B29AB0,actors -ovl_En_Zl3,E9F1B0,EA7000,CEEDB0,CF2E70,80B2E1B0,actors -ovl_En_Zl4,EA7000,EABA30,CF2E70,CF5440,80B36000,actors -ovl_En_Zo,EABA30,EADFF0,CF5440,CF6E60,80B3AA30,actors -ovl_En_fHG,EADFF0,EB0920,CF6E60,CF89A0,80B3CFF0,actors -ovl_End_Title,EB0920,EB4A40,CF89A0,CFA410,80B3F920,actors -ovl_Fishing,EB4A40,EC84E0,CFA410,D078E0,80B43A40,actors -ovl_Item_B_Heart,EC84E0,EC88F0,D078E0,D07C50,80B5E5B0,actors -ovl_Item_Etcetera,EC88F0,EC91C0,D07C50,D082F0,80B5E9C0,actors -ovl_Item_Inbox,EC91C0,EC9320,D082F0,D08400,80B5F290,actors -ovl_Item_Ocarina,EC9320,EC9AF0,D08400,D089C0,80B5F3F0,actors -ovl_Item_Shield,EC9AF0,ECA500,D089C0,D091C0,80B5FBC0,actors -ovl_Magic_Dark,ECA500,ECBD50,D091C0,D0A500,80B605D0,actors -ovl_Magic_Fire,ECBD50,ECE050,D0A500,D0C440,80B61E20,actors -ovl_Magic_Wind,ECE050,ECFD50,D0C440,D0DDD0,80B64120,actors -ovl_Mir_Ray,ECFD50,ED1600,D0DDD0,D0F1C0,80B65E20,actors -ovl_Obj_Bean,ED1600,ED3D90,D0F1C0,D10A90,80B676D0,actors -ovl_Obj_Blockstop,ED3D90,ED3F30,D10A90,D10C10,80B69E60,actors -ovl_Obj_Bombiwa,ED3F30,ED44A0,D10C10,D110D0,80B6A000,actors -ovl_Obj_Comb,ED44A0,ED4D00,D110D0,D11810,80B6A570,actors -ovl_Obj_Dekujr,ED4D00,ED5340,D11810,D11D50,80B6ADD0,actors -ovl_Obj_Elevator,ED5340,ED5700,D11D50,D12040,80B6B410,actors -ovl_Obj_Hamishi,ED5700,ED5F50,D12040,D12750,80B6B7D0,actors -ovl_Obj_Hana,ED5F50,ED6260,D12750,D129C0,80B6C020,actors -ovl_Obj_Hsblock,ED6260,ED6830,D129C0,D12E70,80B6C330,actors -ovl_Obj_Ice_Poly,ED6830,ED71E0,D12E70,D13660,80B6C900,actors -ovl_Obj_Kibako,ED71E0,ED7EE0,D13660,D13F40,80B6D2B0,actors -ovl_Obj_Kibako2,ED7EE0,ED85A0,D13F40,D14500,80B6DFB0,actors -ovl_Obj_Lift,ED85A0,ED8FC0,D14500,D14D40,80B6E670,actors -ovl_Obj_Lightswitch,ED8FC0,EDA3F0,D14D40,D15B10,80B6F090,actors -ovl_Obj_Makekinsuta,EDA3F0,EDA540,D15B10,D15C50,80B704C0,actors -ovl_Obj_Makeoshihiki,EDA540,EDA9D0,D15C50,D16030,80B70610,actors -ovl_Obj_Mure,EDA9D0,EDB9E0,D16030,D16B60,80B70AA0,actors -ovl_Obj_Mure2,EDB9E0,EDC400,D16B60,D172E0,80B71AB0,actors -ovl_Obj_Mure3,EDC400,EDCBD0,D172E0,D17910,80B724D0,actors -ovl_Obj_Oshihiki,EDCBD0,EDE680,D17910,D18BB0,80B72CA0,actors -ovl_Obj_Roomtimer,EDE680,EDE8D0,D18BB0,D18DB0,80B74750,actors -ovl_Obj_Switch,EDE8D0,EE06B0,D18DB0,D1A080,80B749A0,actors -ovl_Obj_Syokudai,EE06B0,EE12F0,D1A080,D1AAB0,80B76780,actors -ovl_Obj_Timeblock,EE12F0,EE1F40,D1AAB0,D1B3B0,80B773D0,actors -ovl_Obj_Tsubo,EE1F40,EE2F30,D1B3B0,D1BF10,80B78020,actors -ovl_Obj_Warp2block,EE2F30,EE3A60,D1BF10,D1C7E0,80B79010,actors -ovl_Object_Kankyo,EE3A60,EE6CE0,D1C7E0,D1EB40,80B79B40,actors -ovl_Oceff_Spot,EE6CE0,EE7C10,D1EB40,D1F830,80B7CDC0,actors -ovl_Oceff_Storm,EE7C10,EE97C0,D1F830,D212B0,80B7DCF0,actors -ovl_Oceff_Wipe,EE97C0,EEA540,D212B0,D21E70,80B7F8A0,actors -ovl_Oceff_Wipe2,EEA540,EEBCB0,D21E70,D22CB0,80B80620,actors -ovl_Oceff_Wipe3,EEBCB0,EED400,D22CB0,D23F30,80B81D90,actors -ovl_Oceff_Wipe4,EED400,EEE3E0,D23F30,D24B10,80B834E0,actors -ovl_Shot_Sun,EEE3E0,EEEAA0,D24B10,D250B0,80B844C0,actors diff --git a/tools/disasm/gc-eu-mq/files_boot.csv b/tools/disasm/gc-eu-mq/files_boot.csv deleted file mode 100644 index fb7cd3cbd..000000000 --- a/tools/disasm/gc-eu-mq/files_boot.csv +++ /dev/null @@ -1,135 +0,0 @@ -offset,vram,.text -0,80000460,src/boot/boot_main.s -140,800005A0,src/boot/idle.s -3D0,80000830,src/boot/viconfig.s -520,80000980,src/boot/z_std_dma.s -B60,80000FC0,src/boot/yaz0.s -EA0,80001300,src/boot/z_locale.s -F60,800013C0,src/boot/is_debug.s -FC0,80001420,src/libultra/io/driverominit.s -11A0,80001600,src/boot/mio0.s -1250,800016B0,src/boot/stackcheck.s -14A0,80001900,src/boot/logutils.s -1500,80001960,src/libultra/io/piacs.s -15C0,80001A20,src/libultra/os/sendmesg.s -1710,80001B70,src/libultra/os/stopthread.s -17D0,80001C30,src/libultra/io/viextendvstart.s -17E0,80001C40,src/libultra/os/recvmesg.s -1920,80001D80,src/libultra/os/initialize.s -1C70,800020D0,src/libultra/libc/ll.s -1F30,80002390,src/libultra/os/exceptasm.s -2860,80002CC0,src/libultra/os/thread.s -28A0,80002D00,src/libultra/os/destroythread.s -29B0,80002E10,src/libultra/libc/bzero.s -2A50,80002EB0,src/libultra/os/parameters.s -2AB0,80002F10,src/libultra/os/createthread.s -2C00,80003060,src/libultra/os/setsr.s -2C10,80003070,src/libultra/os/getsr.s -2C20,80003080,src/libultra/os/writebackdcache.s -2CA0,80003100,src/libultra/io/vigetnextframebuf.s -2CE0,80003140,src/libultra/io/pimgr.s -2E60,800032C0,src/libultra/io/devmgr.s -3270,800036D0,src/libultra/io/pirawdma.s -3340,800037A0,src/libultra/os/virtualtophysical.s -33C0,80003820,src/libultra/io/viblack.s -3430,80003890,src/libultra/io/sirawread.s -3480,800038E0,src/libultra/os/getthreadid.s -34A0,80003900,src/libultra/os/setintmask.s -3540,800039A0,src/libultra/io/visetmode.s -35A0,80003A00,src/libultra/os/probetlb.s -3660,80003AC0,src/libultra/os/getmemsize.s -3780,80003BE0,src/libultra/os/seteventmesg.s -3840,80003CA0,src/libultra/os/unmaptlball.s -3890,80003CF0,src/libultra/io/epidma.s -3930,80003D90,src/libultra/os/invalicache.s -39B0,80003E10,src/libultra/os/createmesgqueue.s -39E0,80003E40,src/libultra/os/invaldcache.s -3A90,80003EF0,src/libultra/io/si.s -3AC0,80003F20,src/libultra/os/jammesg.s -3C10,80004070,src/libultra/os/setthreadpri.s -3CF0,80004150,src/libultra/os/getthreadpri.s -3D10,80004170,src/libultra/io/epirawread.s -3E70,800042D0,src/libultra/io/viswapbuf.s -3EC0,80004320,src/libultra/io/epirawdma.s -40A0,80004500,src/libultra/libc/bcmp.s -41C0,80004620,src/libultra/os/gettime.s -4250,800046B0,src/libultra/os/timerintr.s -4680,80004AE0,src/libultra/os/getcount.s -4690,80004AF0,src/libultra/os/setglobalintmask.s -46E0,80004B40,src/libultra/os/setcompare.s -46F0,80004B50,src/libultra/libc/bcopy.s -4A00,80004E60,src/libultra/os/resetglobalintmask.s -4A60,80004EC0,src/libultra/os/interrupt.s -4AF0,80004F50,src/libultra/io/vi.s -4C10,80005070,src/libultra/io/viswapcontext.s -4F10,80005370,src/libultra/io/pigetcmdq.s -4F40,800053A0,src/libultra/io/epiread.s -4F90,800053F0,src/libultra/io/visetspecial.s -50F0,80005550,src/libultra/io/cartrominit.s -5250,800056B0,src/libultra/os/setfpccsr.s -5260,800056C0,src/libultra/os/getfpccsr.s -5270,800056D0,src/libultra/os/maptlbrdb.s -52D0,80005730,src/libultra/os/yieldthread.s -5320,80005780,src/libultra/os/getcause.s -5330,80005790,src/libultra/io/epirawwrite.s -5490,800058F0,src/libultra/io/sirawwrite.s -54E0,80005940,src/libultra/io/vimgr.s -57F0,80005C50,src/libultra/io/vigetcurrcontext.s -5800,80005C60,src/libultra/os/startthread.s -5950,80005DB0,src/libultra/io/visetyscale.s -59A0,80005E00,src/libultra/io/visetxscale.s -5AB0,80005F10,src/libultra/os/sethwintrroutine.s -5B20,80005F80,src/libultra/os/gethwintrroutine.s -5B50,80005FB0,src/libultra/os/setwatchlo.s -5B60,80005FC0,data/rsp_boot.text.s - -offset,vram,.data -5C30,80006090,data/unk_800093F0.data.s -5C50,800060B0,data/unk_80009410.data.s -5C70,800060D0,src/boot/idle.s -5C90,800060F0,src/boot/viconfig.s -5CA0,80006100,src/boot/z_std_dma.s -5CB0,80006110,src/boot/z_locale.s -5CC0,80006120,src/libultra/io/driverominit.s -5CD0,80006130,src/boot/stackcheck.s -5CE0,80006140,src/libultra/io/piacs.s -5CF0,80006150,src/libultra/io/vimodepallan1.s -5D40,800061A0,src/libultra/os/initialize.s -5D60,800061C0,src/libultra/os/exceptasm.s -5D90,800061F0,src/libultra/os/thread.s -5DB0,80006210,src/libultra/io/pimgr.s -5DE0,80006240,src/libultra/os/seteventmesg.s -5DF0,80006250,src/libultra/os/timerintr.s -5E00,80006260,src/libultra/io/vimodentsclan1.s -5E50,800062B0,src/libultra/io/vimodempallan1.s -5EA0,80006300,src/libultra/io/vi.s -5F10,80006370,src/libultra/io/cartrominit.s -5F20,80006380,src/libultra/io/vimgr.s - -offset,vram,.rodata -5F40,800063A0,src/boot/boot_main.s -5F50,800063B0,src/boot/idle.s -5F60,800063C0,src/boot/z_std_dma.s -5FC0,80006420,src/boot/z_locale.s -5FD0,80006430,src/boot/stackcheck.s -5FE0,80006440,src/boot/logutils.s -5FF0,80006450,src/libultra/os/exceptasm.s -6040,800064A0,src/libultra/io/devmgr.s -6060,800064C0,src/libultra/os/setintmask.s -60E0,80006540,src/boot/build.s - -offset,vram,.bss -6110,80006570,src/boot/boot_main.s -6B00,80006F60,src/boot/idle.s -7710,80007B70,src/boot/z_std_dma.s -7E80,800082E0,src/boot/yaz0.s -8290,800086F0,src/boot/z_locale.s -82B0,80008710,src/libultra/io/driverominit.s -8330,80008790,src/libultra/io/piacs.s -8350,800087B0,src/libultra/os/initialize.s -8360,800087C0,src/libultra/io/pimgr.s -97D0,80009C30,src/libultra/os/seteventmesg.s -9850,80009CB0,src/libultra/os/timerintr.s -9890,80009CF0,src/libultra/io/cartrominit.s -9910,80009D70,src/libultra/io/vimgr.s -AB30,8000AF90,.end diff --git a/tools/disasm/gc-eu-mq/files_code.csv b/tools/disasm/gc-eu-mq/files_code.csv deleted file mode 100644 index b62bd5694..000000000 --- a/tools/disasm/gc-eu-mq/files_code.csv +++ /dev/null @@ -1,464 +0,0 @@ -offset,vram,.text -0,80010F00,src/code/z_en_a_keep.s -AA0,800119A0,src/code/z_en_item00.s -2EA0,80013DA0,src/code/z_eff_blure.s -62D0,800171D0,src/code/z_eff_shield_particle.s -7930,80018830,src/code/z_eff_spark.s -8FE0,80019EE0,src/code/z_eff_ss_dead.s -9790,8001A690,src/code/z_effect.s -9F10,8001AE10,src/code/z_effect_soft_sprite.s -A9B0,8001B8B0,src/code/z_effect_soft_sprite_old_init.s -D4D0,8001E3D0,src/code/flg_set.s -D8F0,8001E7F0,src/code/z_DLF.s -DB40,8001EA40,src/code/z_actor.s -1A0C0,8002AFC0,src/code/z_actor_dlftbls.s -1A210,8002B110,src/code/z_bgcheck.s -23DF0,80034CF0,src/code/code_800430A0.s -24110,80035010,src/code/code_80043480.s -244A0,800353A0,src/code/z_camera.s -38AD0,800499D0,src/code/z_collision_btltbls.s -38B30,80049A30,src/code/z_collision_check.s -407B0,800516B0,src/code/z_common_data.s -40830,80051730,src/code/z_debug.s -40B40,80051A40,src/code/z_debug_display.s -41000,80051F00,src/code/z_demo.s -45CE0,80056BE0,src/code/code_80069420.s -45D70,80056C70,src/code/z_draw.s -47C70,80058B70,src/code/z_sfx_source.s -47E30,80058D30,src/code/z_elf_message.s -48510,80059410,src/code/z_face_reaction.s -48560,80059460,src/code/code_8006C3A0.s -486E0,800595E0,src/code/z_fcurve_data.s -48920,80059820,src/code/z_fcurve_data_skelanime.s -49130,8005A030,src/code/z_horse.s -49E10,8005AD10,src/code/z_jpeg.s -4A5D0,8005B4D0,src/code/z_kaleido_setup.s -4A9A0,8005B8A0,src/code/z_kanfont.s -4AB70,8005BA70,src/code/z_kankyo.s -52380,80063280,src/code/z_lib.s -53520,80064420,src/code/z_lifemeter.s -548C0,800657C0,src/code/z_lights.s -55960,80066860,src/code/z_malloc.s -55B40,80066A40,src/code/z_map_mark.s -56140,80067040,src/code/z_prenmi_buff.s -56200,80067100,src/code/z_nulltask.s -56280,80067180,src/code/z_olib.s -56970,80067870,src/code/z_onepointdemo.s -5A910,8006B810,src/code/z_map_exp.s -5C4B0,8006D3B0,src/code/z_parameter.s -67BA0,80078AA0,src/code/z_path.s -67D70,80078C70,src/code/z_frame_advance.s -67E20,80078D20,src/code/z_player_lib.s -6B890,8007C790,src/code/z_prenmi.s -6BA30,8007C930,src/code/z_quake.s -6C8A0,8007D7A0,src/code/z_rcp.s -6E160,8007F060,src/code/z_room.s -6F950,80080850,src/code/z_sample.s -6FD50,80080C50,src/code/code_80097A00.s -6FF10,80080E10,src/code/z_scene.s -713C0,800822C0,src/code/z_scene_table.s -77BA0,80088AA0,src/code/z_skelanime.s -7C590,8008D490,src/code/z_skin.s -7D130,8008E030,src/code/z_skin_awb.s -7DA40,8008E940,src/code/z_skin_matrix.s -7EDE0,8008FCE0,src/code/z_sram.s -80220,80091120,src/code/z_ss_sram.s -803F0,800912F0,src/code/z_rumble.s -80670,80091570,src/code/z_view.s -81D70,80092C70,src/code/z_vimode.s -828E0,800937E0,src/code/z_viscvg.s -82A80,80093980,src/code/z_vismono.s -832A0,800941A0,src/code/z_viszbuf.s -83530,80094430,src/code/z_vr_box.s -85E00,80096D00,src/code/z_vr_box_draw.s -864E0,800973E0,src/code/z_player_call.s -86650,80097550,src/code/z_fbdemo.s -87070,80097F70,src/code/z_fbdemo_triforce.s -87630,80098530,src/code/z_fbdemo_wipe1.s -87AA0,800989A0,src/code/z_fbdemo_circle.s -88160,80099060,src/code/z_fbdemo_fade.s -884C0,800993C0,src/code/shrink_window.s -88630,80099530,src/code/code_800BB0A0.s -88B00,80099A00,src/code/z_kaleido_manager.s -88D30,80099C30,src/code/z_kaleido_scope_call.s -89010,80099F10,src/code/z_play.s -8CA70,8009D970,src/code/PreRender.s -8EB60,8009FA60,src/code/TwoHeadGfxArena.s -8ED70,8009FC70,src/code/TwoHeadArena.s -8EF30,8009FE30,src/code/audio_stop_all_sfx.s -8EF80,8009FE80,src/code/audio_thread_manager.s -8F390,800A0290,src/code/title_setup.s -8F400,800A0300,src/code/game.s -8FB80,800A0A80,src/code/gamealloc.s -8FCC0,800A0BC0,src/code/graph.s -90660,800A1560,src/code/gfxalloc.s -906C0,800A15C0,src/code/listalloc.s -90810,800A1710,src/code/main.s -90B70,800A1A70,src/code/padmgr.s -91680,800A2580,src/code/sched.s -92300,800A3200,src/code/speed_meter.s -92D40,800A3C40,src/code/sys_cfb.s -92E60,800A3D60,src/code/sys_math.s -93100,800A4000,src/code/sys_math3d.s -98ED0,800A9DD0,src/code/sys_math_atan.s -99100,800AA000,src/code/sys_matrix.s -9B500,800AC400,src/code/sys_ucode.s -9B550,800AC450,src/code/sys_rumble.s -9B8B0,800AC7B0,src/code/code_800D31A0.s -9B8E0,800AC7E0,src/code/irqmgr.s -9BF00,800ACE00,src/code/fault.s -9E750,800AF650,src/code/fault_drawer.s -9F1D0,800B00D0,src/code/kanread.s -9FCC0,800B0BC0,src/audio/lib/synthesis.s -A2E20,800B3D20,src/audio/lib/heap.s -A61F0,800B70F0,src/audio/lib/load.s -A9FE0,800BAEE0,src/audio/lib/thread.s -AB840,800BC740,src/audio/lib/dcache.s -AB8C0,800BC7C0,src/audio/lib/aisetnextbuf.s -AB940,800BC840,src/audio/lib/playback.s -AD8C0,800BE7C0,src/audio/lib/effects.s -AE340,800BF240,src/audio/lib/seqplayer.s -B1960,800C2860,src/audio/general.s -B7AF0,800C89F0,src/audio/sfx.s -B9950,800CA850,src/audio/sequence.s -BB570,800CC470,src/code/gfxprint.s -BC2E0,800CD1E0,src/code/rcp_utils.s -BC340,800CD240,src/code/loadfragment2.s -BC3A0,800CD2A0,src/code/relocation.s -BC5E0,800CD4E0,src/code/load.s -BC6B0,800CD5B0,src/code/code_800FC620.s -BC9F0,800CD8F0,src/code/padutils.s -BCBE0,800CDAE0,src/code/padsetup.s -BCD20,800CDC20,src/code/code_800FCE80.s -BD230,800CE130,src/code/fp.s -BD390,800CE290,src/code/system_malloc.s -BD560,800CE460,src/code/code_800FD970.s -BD720,800CE620,src/code/__osMalloc.s -BE4D0,800CF3D0,src/libultra/libc/sprintf.s -BE5A0,800CF4A0,src/code/printutils.s -BE600,800CF500,src/code/sleep.s -BE7A0,800CF6A0,src/code/jpegutils.s -BECB0,800CFBB0,src/code/jpegdecoder.s -BF2A0,800D01A0,src/libultra/mgu/scale.s -BF350,800D0250,src/libultra/gu/sinf.s -BF510,800D0410,src/libultra/gu/sins.s -BF580,800D0480,src/libultra/io/sptask.s -BF840,800D0740,src/libultra/io/motor.s -BFC10,800D0B10,src/libultra/io/siacs.s -BFCD0,800D0BD0,src/libultra/io/controller.s -BFFB0,800D0EB0,src/libultra/io/contreaddata.s -C0190,800D1090,src/libultra/gu/perspective.s -C0420,800D1320,src/libultra/io/sprawdma.s -C04B0,800D13B0,src/libultra/io/sirawdma.s -C0560,800D1460,src/libultra/io/sptaskyield.s -C0580,800D1480,src/libultra/mgu/mtxidentf.s -C05D0,800D14D0,src/libultra/gu/lookat.s -C08F0,800D17F0,src/libultra/os/stoptimer.s -C09E0,800D18E0,src/libultra/gu/sqrtf.s -C09F0,800D18F0,src/libultra/os/afterprenmi.s -C0A10,800D1910,src/libultra/io/contquery.s -C0AB0,800D19B0,src/libultra/gu/lookathil.s -C1330,800D2230,src/libultra/libc/xprintf.s -C2010,800D2F10,src/libultra/libc/string.s -C20B0,800D2FB0,src/libultra/io/sp.s -C20E0,800D2FE0,src/libultra/mgu/mtxident.s -C2130,800D3030,src/libultra/gu/position.s -C2340,800D3240,src/libultra/io/sptaskyielded.s -C23A0,800D32A0,src/libultra/gu/rotate.s -C2570,800D3470,src/libultra/io/aisetfreq.s -C26C0,800D35C0,src/libultra/os/getactivequeue.s -C26E0,800D35E0,src/libultra/mgu/normalize.s -C2740,800D3640,src/libultra/io/dpgetstat.s -C2750,800D3650,src/libultra/io/dpsetstat.s -C2760,800D3660,src/libultra/gu/ortho.s -C2920,800D3820,src/libultra/gu/cosf.s -C2A90,800D3990,src/libultra/gu/coss.s -C2AC0,800D39C0,src/libultra/io/visetevent.s -C2B20,800D3A20,src/libultra/gu/us2dex.s -C2CA0,800D3BA0,src/libultra/io/pfsselectbank.s -C2D20,800D3C20,src/libultra/io/contsetch.s -C2D80,800D3C80,src/libultra/io/aigetlen.s -C2DA0,800D3CA0,src/libultra/mgu/translate.s -C2E70,800D3D70,src/libultra/io/contramwrite.s -C30C0,800D3FC0,src/libultra/io/pfsgetstatus.s -C32F0,800D41F0,src/libultra/io/contpfs.s -C3E70,800D4D70,src/libultra/io/contramread.s -C40A0,800D4FA0,src/libultra/io/crc.s -C4210,800D5110,src/libultra/io/pfsisplug.s -C4500,800D5400,src/libultra/os/settimer.s -C4690,800D5590,src/libultra/libc/xldtob.s -C51A0,800D60A0,src/libultra/libc/ldiv.s -C5330,800D6230,src/libultra/libc/xlitob.s -C55D0,800D64D0,src/libultra/io/spgetstat.s -C55E0,800D64E0,src/libultra/io/spsetstat.s -C55F0,800D64F0,src/libultra/os/writebackdcacheall.s -C5620,800D6520,src/libultra/os/getcurrfaultedthread.s -C5640,800D6540,src/libultra/mgu/mtxf2l.s -C56B0,800D65B0,src/libultra/libc/llcvt.s -C58C0,800D67C0,src/libultra/io/vigetcurrframebuf.s -C5900,800D6800,src/libultra/io/spsetpc.s -C5930,800D6830,src/libultra/libc/sqrt.s -C5940,800D6840,src/libultra/libc/absf.s -C5950,800D6850,src/code/fmodf.s -C59A0,800D68A0,src/code/__osMemset.s -C59D0,800D68D0,src/code/__osMemmove.s -C5A60,800D6960,src/code/z_message_PAL.s -CE820,800DF720,src/code/z_game_over.s -CED60,800DFC60,src/code/z_construct.s -D02A0,800E11A0,data/rsp.text.s - -offset,vram,.data -D3600,800E4500,src/code/z_en_a_keep.s -D36A0,800E45A0,src/code/z_en_item00.s -D3940,800E4840,src/code/z_eff_blure.s -D39F0,800E48F0,src/code/z_eff_shield_particle.s -D3A40,800E4940,src/code/z_effect.s -D3A90,800E4990,src/code/z_effect_soft_sprite.s -D3AA0,800E49A0,src/code/z_effect_soft_sprite_old_init.s -D3B90,800E4A90,src/code/z_effect_soft_sprite_dlftbls.s -D3FA0,800E4EA0,src/code/flg_set.s -D4160,800E5060,src/code/z_actor.s -D4480,800E5380,src/code/z_actor_dlftbls.s -D7F70,800E8E70,src/code/z_bgcheck.s -D80C0,800E8FC0,src/code/z_camera.s -DB610,800EC510,src/code/z_collision_btltbls.s -DB8F0,800EC7F0,src/code/z_collision_check.s -DBBA0,800ECAA0,src/code/z_debug.s -DBBD0,800ECAD0,src/code/z_debug_display.s -DBC20,800ECB20,src/code/z_demo.s -DBD80,800ECC80,src/code/z_draw.s -DCE00,800EDD00,src/code/z_elf_message.s -DCE50,800EDD50,src/code/z_face_reaction.s -DD290,800EE190,src/code/z_game_dlftbls.s -DD3B0,800EE2B0,src/code/z_horse.s -DD4C0,800EE3C0,src/code/z_jpeg.s -DD500,800EE400,src/code/z_kaleido_setup.s -DD550,800EE450,src/code/z_kankyo.s -DD940,800EE840,src/code/z_lib.s -DD970,800EE870,src/code/z_lifemeter.s -DDA90,800EE990,src/code/z_lights.s -DDAA0,800EE9A0,src/code/z_map_mark.s -DDB60,800EEA60,src/code/z_onepointdemo.s -E1480,800F2380,src/code/z_map_exp.s -E14A0,800F23A0,src/code/z_map_data.s -E32A0,800F41A0,src/code/z_parameter.s -E35A0,800F44A0,src/code/z_player_lib.s -E3C80,800F4B80,src/code/z_quake.s -E3CB0,800F4BB0,src/code/z_rcp.s -E4AD0,800F59D0,src/code/z_room.s -E4B50,800F5A50,src/code/code_80097A00.s -E4ED0,800F5DD0,src/code/z_scene.s -E4F50,800F5E50,src/code/object_table.s -E5BF0,800F6AF0,src/code/z_scene_table.s -E7E00,800F8D00,src/code/z_skelanime.s -E7E20,800F8D20,src/code/z_skin_matrix.s -E7E60,800F8D60,src/code/z_sram.s -E8010,800F8F10,src/code/z_ss_sram.s -E80C0,800F8FC0,data/unk_8012ABC0.data.s -E80F0,800F8FF0,src/code/z_view.s -E8100,800F9000,src/code/z_viscvg.s -E8190,800F9090,src/code/z_vr_box.s -E8490,800F9390,src/code/z_player_call.s -E84B0,800F93B0,src/code/z_fbdemo.s -E8530,800F9430,src/code/z_fbdemo_triforce.s -E8600,800F9500,src/code/z_fbdemo_wipe1.s -E90A0,800F9FA0,src/code/z_fbdemo_circle.s -EA3A0,800FB2A0,src/code/z_fbdemo_fade.s -EA3D0,800FB2D0,src/code/shrink_window.s -EA3E0,800FB2E0,src/code/z_kaleido_manager.s -EA430,800FB330,src/code/z_play.s -EA440,800FB340,src/code/audio_stop_all_sfx.s -EA450,800FB350,src/code/graph.s -EA460,800FB360,src/code/main.s -EA470,800FB370,src/code/padmgr.s -EA480,800FB380,src/code/speed_meter.s -EA4B0,800FB3B0,src/code/sys_math.s -EA4F0,800FB3F0,src/code/sys_math_atan.s -EAD00,800FBC00,src/code/sys_matrix.s -EAD80,800FBC80,src/code/sys_ucode.s -EAD90,800FBC90,src/code/sys_rumble.s -EADA0,800FBCA0,src/code/irqmgr.s -EADC0,800FBCC0,src/code/fault.s -EAE20,800FBD20,src/code/fault_drawer.s -EAE60,800FBD60,src/audio/lib/data.s -ED270,800FE170,src/audio/lib/synthesis.s -ED2A0,800FE1A0,src/audio/lib/load.s -ED2B0,800FE1B0,src/audio/lib/thread.s -ED2D0,800FE1D0,src/audio/lib/aisetnextbuf.s -ED2E0,800FE1E0,src/audio/lib/effects.s -ED2F0,800FE1F0,src/audio/lib/seqplayer.s -ED340,800FE240,src/audio/general.s -EEA60,800FF960,src/audio/sfx_params.s -EFE30,80100D30,src/audio/data.s -EFEA0,80100DA0,src/audio/session_config.s -F0640,80101540,src/code/logseverity.s -F0650,80101550,src/code/gfxprint.s -F0F00,80101E00,src/code/code_800FC620.s -F0F20,80101E20,src/code/fp.s -F0F30,80101E30,src/code/code_800FD970.s -F0F40,80101E40,src/code/__osMalloc.s -F0F50,80101E50,src/libultra/gu/sins.s -F1750,80102650,src/libultra/io/siacs.s -F1760,80102660,src/libultra/io/controller.s -F1770,80102670,src/libultra/libc/xprintf.s -F17C0,801026C0,src/libultra/gu/position.s -F17D0,801026D0,src/libultra/gu/rotate.s -F17E0,801026E0,src/libultra/io/vimodefpallan1.s -F1830,80102730,src/libultra/io/contpfs.s -F1840,80102740,src/libultra/io/contramread.s -F1850,80102750,src/libultra/libc/xlitob.s - -offset,vram,.rodata -F1880,80102780,src/code/z_en_a_keep.s -F18D0,801027D0,src/code/z_en_item00.s -F1B40,80102A40,src/code/z_eff_blure.s -F1B70,80102A70,src/code/z_eff_shield_particle.s -F1B80,80102A80,src/code/z_eff_spark.s -F1B90,80102A90,src/code/z_eff_ss_dead.s -F1BA0,80102AA0,src/code/z_effect_soft_sprite_old_init.s -F1BC0,80102AC0,src/code/flg_set.s -F1F50,80102E50,src/code/z_actor.s -F2500,80103400,src/code/z_actor_dlftbls.s -F2550,80103450,src/code/z_bgcheck.s -F25F0,801034F0,src/code/code_80043480.s -F2600,80103500,src/code/z_camera.s -F2D80,80103C80,src/code/z_collision_check.s -F2DD0,80103CD0,src/code/z_debug.s -F2DE0,80103CE0,src/code/z_demo.s -F32C0,801041C0,src/code/z_draw.s -F32D0,801041D0,src/code/z_elf_message.s -F33F0,801042F0,src/code/z_fcurve_data.s -F3400,80104300,src/code/z_fcurve_data_skelanime.s -F3410,80104310,src/code/z_horse.s -F3420,80104320,src/code/z_jpeg.s -F34B0,801043B0,src/code/z_kankyo.s -F3560,80104460,src/code/z_lib.s -F3570,80104470,src/code/z_lifemeter.s -F3590,80104490,src/code/z_lights.s -F35A0,801044A0,src/code/z_map_mark.s -F3600,80104500,src/code/z_olib.s -F3620,80104520,src/code/z_onepointdemo.s -F3EE0,80104DE0,src/code/z_map_exp.s -F4200,80105100,src/code/z_parameter.s -F4410,80105310,src/code/z_path.s -F4420,80105320,src/code/z_player_lib.s -F4480,80105380,src/code/z_quake.s -F4510,80105410,src/code/z_room.s -F4550,80105450,src/code/z_sample.s -F4560,80105460,src/code/z_scene_table.s -F45A0,801054A0,src/code/z_skelanime.s -F45C0,801054C0,src/code/z_skin.s -F45D0,801054D0,src/code/z_skin_matrix.s -F45E0,801054E0,src/code/z_sram.s -F4650,80105550,src/code/z_rumble.s -F4660,80105560,src/code/z_view.s -F4670,80105570,src/code/z_vr_box.s -F4760,80105660,src/code/z_fbdemo_triforce.s -F4770,80105670,src/code/z_fbdemo_wipe1.s -F4780,80105680,src/code/z_fbdemo_circle.s -F4790,80105690,src/code/code_800BB0A0.s -F47A0,801056A0,src/code/z_kaleido_manager.s -F47C0,801056C0,src/code/z_play.s -F4880,80105780,src/code/game.s -F48A0,801057A0,src/code/graph.s -F48F0,801057F0,src/code/main.s -F4920,80105820,src/code/padmgr.s -F4930,80105830,src/code/sys_cfb.s -F4940,80105840,src/code/sys_math.s -F4950,80105850,src/code/sys_math3d.s -F49E0,801058E0,src/code/sys_math_atan.s -F49F0,801058F0,src/code/sys_matrix.s -F4A20,80105920,src/code/irqmgr.s -F4A40,80105940,src/code/fault.s -F5450,80106350,src/code/fault_drawer.s -F5880,80106780,src/audio/lib/synthesis.s -F58A0,801067A0,src/audio/lib/heap.s -F58D0,801067D0,src/audio/lib/load.s -F5940,80106840,src/audio/lib/thread.s -F5A70,80106970,src/audio/lib/playback.s -F5AA0,801069A0,src/audio/lib/effects.s -F5AD0,801069D0,src/audio/lib/seqplayer.s -F6110,80107010,src/audio/general.s -F62A0,801071A0,src/audio/sfx.s -F62C0,801071C0,src/audio/sequence.s -F6340,80107240,src/audio/session_config.s -F6350,80107250,src/code/gfxprint.s -F6370,80107270,src/code/code_800FCE80.s -F63C0,801072C0,src/code/__osMalloc.s -F6680,80107580,src/libultra/gu/sinf.s -F66D0,801075D0,src/libultra/gu/perspective.s -F66E0,801075E0,src/libultra/gu/lookathil.s -F66F0,801075F0,src/libultra/libc/xprintf.s -F67F0,801076F0,src/libultra/gu/cosf.s -F6840,80107740,src/libultra/gu/libm_vals.s -F6850,80107750,src/libultra/libc/xldtob.s -F68B0,801077B0,src/libultra/libc/llcvt.s - -offset,vram,.data -F68C0,801077C0,src/code/z_message_PAL.s - -offset,vram,.rodata -FF350,80110250,src/code/z_message_PAL.s -FF510,80110410,src/code/z_game_over.s -FF570,80110470,data/audio_tables.rodata.s -100110,80111010,data/rsp.rodata.s - -offset,vram,.bss -102230,80113130,src/code/z_en_item00.s -102240,80113140,src/code/z_effect.s -106030,80116F30,src/code/flg_set.s -106040,80116F40,src/code/z_actor.s -1060C0,80116FC0,src/code/z_actor_dlftbls.s -1060D0,80116FD0,src/code/z_bgcheck.s -1061F0,801170F0,src/code/z_camera.s -1062D0,801171D0,src/code/z_collision_check.s -107A30,80118930,src/code/z_common_data.s -108E60,80119D60,src/code/z_debug.s -109080,80119F80,src/code/z_debug_display.s -109090,80119F90,src/code/z_demo.s -1090C0,80119FC0,src/code/z_kankyo.s -109190,8011A090,src/code/z_lifemeter.s -1091C0,8011A0C0,src/code/z_lights.s -109350,8011A250,src/code/z_malloc.s -109380,8011A280,src/code/z_map_mark.s -109390,8011A290,src/code/z_map_exp.s -1093A0,8011A2A0,src/code/z_parameter.s -1093C0,8011A2C0,src/code/z_player_lib.s -1093E0,8011A2E0,src/code/z_quake.s -109470,8011A370,src/code/z_skelanime.s -109480,8011A380,src/code/z_skin.s -10A390,8011B290,src/code/z_rumble.s -10A4A0,8011B3A0,src/code/z_vr_box_draw.s -10A4B0,8011B3B0,src/code/z_player_call.s -10A4C0,8011B3C0,src/code/z_kaleido_scope_call.s -10A4E0,8011B3E0,src/code/z_play.s -10A5F0,8011B4F0,src/code/game.s -10A6D0,8011B5D0,src/code/graph.s -10A740,8011B640,src/code/main.s -10E5D0,8011F4D0,src/code/padmgr.s -10E5E0,8011F4E0,src/code/sched.s -10E600,8011F500,src/code/speed_meter.s -10E670,8011F570,src/code/sys_cfb.s -10E680,8011F580,src/code/sys_math3d.s -10E8A0,8011F7A0,src/code/sys_matrix.s -10E8B0,8011F7B0,src/code/fault.s -10F730,80120630,src/code/fault_drawer.s -10F790,80120690,src/audio/lib/load.s -10F850,80120750,src/audio/general.s -10FA50,80120950,src/audio/sfx.s -112260,80123160,src/audio/sequence.s -113020,80123F20,src/audio/session_config.s -119530,8012A430,src/code/gfxprint.s -119540,8012A440,src/code/code_800FCE80.s -119550,8012A450,src/code/system_malloc.s -119580,8012A480,src/code/code_800FD970.s -119590,8012A490,src/code/__osMalloc.s -1195A0,8012A4A0,src/code/jpegdecoder.s -1195B0,8012A4B0,src/libultra/io/sptask.s -1195F0,8012A4F0,src/libultra/io/motor.s -1196F0,8012A5F0,src/libultra/io/siacs.s -119710,8012A610,src/libultra/io/controller.s -1197A0,8012A6A0,src/libultra/io/contpfs.s -1198A0,8012A7A0,src/libultra/io/pfsisplug.s -1198E0,8012A7E0,src/code/z_message_PAL.s -119900,8012A800,.end diff --git a/tools/disasm/gc-eu-mq/files_ovl_file_choose.csv b/tools/disasm/gc-eu-mq/files_ovl_file_choose.csv deleted file mode 100644 index 1a0310d1c..000000000 --- a/tools/disasm/gc-eu-mq/files_ovl_file_choose.csv +++ /dev/null @@ -1,22 +0,0 @@ -offset,vram,.text -0,80803630,src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.s -3040,80806670,src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.s -6F60,8080A590,src/overlays/gamestates/ovl_file_choose/z_file_choose.s - -offset,vram,.data -D740,80810D70,src/overlays/gamestates/ovl_file_choose/z_file_nameset_data.s -E010,80811640,src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.s -E050,80811680,src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.s -E2B0,808118E0,src/overlays/gamestates/ovl_file_choose/z_file_choose.s - -offset,vram,.rodata -E5F0,80811C20,src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.s -E600,80811C30,src/overlays/gamestates/ovl_file_choose/z_file_choose.s - -offset,vram,.ovl -E620,80811C50,src/overlays/gamestates/ovl_file_choose/ovl_file_choose_reloc.s - -offset,vram,.bss -EC10,80812240,src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.s -EC20,80812250,src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.s -EC30,80812260,.end diff --git a/tools/disasm/gc-eu-mq/files_ovl_kaleido_scope.csv b/tools/disasm/gc-eu-mq/files_ovl_kaleido_scope.csv deleted file mode 100644 index c03d91625..000000000 --- a/tools/disasm/gc-eu-mq/files_ovl_kaleido_scope.csv +++ /dev/null @@ -1,34 +0,0 @@ -offset,vram,.text -0,80812260,src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.s -2400,80814660,src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.s -43B0,80816610,src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.s -5E30,80818090,src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.s -7E20,8081A080,src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.s -B100,8081D360,src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.s -B300,8081D560,src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.s -15350,808275B0,src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.s - -offset,vram,.data -15A10,80827C70,src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.s -15BC0,80827E20,src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.s -15D90,80827FF0,src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.s -15DC0,80828020,src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.s -15E30,80828090,src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.s -16080,808282E0,src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.s -16090,808282F0,src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.s -16C10,80828E70,src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.s -16C60,80828EC0,src/overlays/misc/ovl_kaleido_scope/z_lmap_mark_data.s - -offset,vram,.rodata -1ADC0,8082D020,src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.s -1AEA0,8082D100,src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.s -1AEB0,8082D110,src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.s -1B190,8082D3F0,src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.s -1B240,8082D4A0,src/overlays/misc/ovl_kaleido_scope/z_lmap_mark_data.s - -offset,vram,.ovl -1B2C0,8082D560,src/overlays/misc/ovl_kaleido_scope/ovl_kaleido_scope_reloc.s - -offset,vram,.bss -1C9C0,8082EC20,src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.s -1CA30,8082EC90,.end diff --git a/tools/disasm/gc-eu-mq/functions.txt b/tools/disasm/gc-eu-mq/functions.txt deleted file mode 100644 index cd5d63da2..000000000 --- a/tools/disasm/gc-eu-mq/functions.txt +++ /dev/null @@ -1,13146 +0,0 @@ -entrypoint = 0x80000400; // type:func -cleararena = 0x80000460; // type:func -bootproc = 0x80000498; // type:func -Main_ThreadEntry = 0x800005A0; // type:func -Idle_ThreadEntry = 0x8000063C; // type:func -ViConfig_UpdateVi = 0x80000830; // type:func -ViConfig_UpdateBlack = 0x80000930; // type:func -DmaMgr_DmaRomToRam = 0x80000980; // type:func -DmaMgr_AudioDmaHandler = 0x80000B04; // type:func -DmaMgr_DmaFromDriveRom = 0x80000B24; // type:func -DmaMgr_FindFileName = 0x80000BC8; // type:func -DmaMgr_GetFileName = 0x80000BD8; // type:func -DmaMgr_ProcessRequest = 0x80000BEC; // type:func -DmaMgr_ThreadEntry = 0x80000D78; // type:func -DmaMgr_RequestAsync = 0x80000DF8; // type:func -DmaMgr_RequestSync = 0x80000E5C; // type:func -DmaMgr_Init = 0x80000ED8; // type:func -Yaz0_FirstDMA = 0x80000FC0; // type:func -Yaz0_NextDMA = 0x80001060; // type:func -Yaz0_DecompressImpl = 0x8000114C; // type:func -Yaz0_Decompress = 0x800012B4; // type:func -Locale_Init = 0x80001300; // type:func -Locale_ResetRegion = 0x800013AC; // type:func -osSyncPrintfUnused = 0x800013C0; // type:func -osSyncPrintf = 0x800013DC; // type:func -rmonPrintf = 0x800013F8; // type:func -osDriveRomInit = 0x80001420; // type:func -Mio0_Decompress = 0x80001600; // type:func -StackCheck_Init = 0x800016B0; // type:func -StackCheck_Cleanup = 0x80001788; // type:func -StackCheck_GetState = 0x800017F8; // type:func -StackCheck_CheckAll = 0x80001870; // type:func -StackCheck_Check = 0x800018C8; // type:func -LogUtils_HungupThread = 0x80001900; // type:func -LogUtils_ResetHungup = 0x80001934; // type:func -__osPiCreateAccessQueue = 0x80001960; // type:func -__osPiGetAccess = 0x800019B0; // type:func -__osPiRelAccess = 0x800019F4; // type:func -osSendMesg = 0x80001A20; // type:func -osStopThread = 0x80001B70; // type:func -osViExtendVStart = 0x80001C30; // type:func -osRecvMesg = 0x80001C40; // type:func -__createSpeedParam = 0x80001D80; // type:func -__osInitialize_common = 0x80001E1C; // type:func -__osInitialize_autodetect = 0x800020C8; // type:func -__ull_rshift = 0x800020D0; // type:func -__ull_rem = 0x800020FC; // type:func -__ull_div = 0x80002138; // type:func -__ll_lshift = 0x80002174; // type:func -__ll_rem = 0x800021A0; // type:func -__ll_div = 0x800021DC; // type:func -__ll_mul = 0x80002238; // type:func -__ull_divremi = 0x80002268; // type:func -__ll_mod = 0x800022C8; // type:func -__ll_rshift = 0x80002364; // type:func -__osExceptionPreamble = 0x80002390; // type:func -__osException = 0x800023A0; // type:func -__osEnqueueAndYield = 0x800029D4; // type:func -__osEnqueueThread = 0x80002AD4; // type:func -__osPopThread = 0x80002B1C; // type:func -__osNop = 0x80002B2C; // type:func -__osDispatchThread = 0x80002B34; // type:func -__osCleanupThread = 0x80002CB0; // type:func -__osDequeueThread = 0x80002CC0; // type:func -osDestroyThread = 0x80002D00; // type:func -bzero = 0x80002E10; // type:func -osCreateThread = 0x80002F10; // type:func -__osSetSR = 0x80003060; // type:func -__osGetSR = 0x80003070; // type:func -osWritebackDCache = 0x80003080; // type:func -osViGetNextFramebuffer = 0x80003100; // type:func -osCreatePiManager = 0x80003140; // type:func -__osDevMgrMain = 0x800032C0; // type:func -__osPiRawStartDma = 0x800036D0; // type:func -osVirtualToPhysical = 0x800037A0; // type:func -osViBlack = 0x80003820; // type:func -__osSiRawReadIo = 0x80003890; // type:func -osGetThreadId = 0x800038E0; // type:func -osSetIntMask = 0x80003900; // type:func -osViSetMode = 0x800039A0; // type:func -__osProbeTLB = 0x80003A00; // type:func -osGetMemSize = 0x80003AC0; // type:func -osSetEventMesg = 0x80003BE0; // type:func -osUnmapTLBAll = 0x80003CA0; // type:func -osEPiStartDma = 0x80003CF0; // type:func -osInvalICache = 0x80003D90; // type:func -osCreateMesgQueue = 0x80003E10; // type:func -osInvalDCache = 0x80003E40; // type:func -__osSiDeviceBusy = 0x80003EF0; // type:func -osJamMesg = 0x80003F20; // type:func -osSetThreadPri = 0x80004070; // type:func -osGetThreadPri = 0x80004150; // type:func -__osEPiRawReadIo = 0x80004170; // type:func -osViSwapBuffer = 0x800042D0; // type:func -__osEPiRawStartDma = 0x80004320; // type:func -bcmp = 0x80004500; // type:func -osGetTime = 0x80004620; // type:func -__osTimerServicesInit = 0x800046B0; // type:func -__osTimerInterrupt = 0x8000473C; // type:func -__osSetTimerIntr = 0x800048B4; // type:func -__osInsertTimer = 0x80004954; // type:func -osGetCount = 0x80004AE0; // type:func -__osSetGlobalIntMask = 0x80004AF0; // type:func -__osSetCompare = 0x80004B40; // type:func -bcopy = 0x80004B50; // type:func -__osResetGlobalIntMask = 0x80004E60; // type:func -__osDisableInt = 0x80004EC0; // type:func -__osRestoreInt = 0x80004F30; // type:func -__osViInit = 0x80004F50; // type:func -__osViSwapContext = 0x80005070; // type:func -osPiGetCmdQueue = 0x80005370; // type:func -osEPiReadIo = 0x800053A0; // type:func -osViSetSpecialFeatures = 0x800053F0; // type:func -osCartRomInit = 0x80005550; // type:func -__osSetFpcCsr = 0x800056B0; // type:func -__osGetFpcCsr = 0x800056C0; // type:func -osMapTLBRdb = 0x800056D0; // type:func -osYieldThread = 0x80005730; // type:func -__osGetCause = 0x80005780; // type:func -__osEPiRawWriteIo = 0x80005790; // type:func -__osSiRawWriteIo = 0x800058F0; // type:func -osCreateViManager = 0x80005940; // type:func -viMgrMain = 0x80005AC0; // type:func -__osViGetCurrentContext = 0x80005C50; // type:func -osStartThread = 0x80005C60; // type:func -osViSetYScale = 0x80005DB0; // type:func -osViSetXScale = 0x80005E00; // type:func -__osSetHWIntrRoutine = 0x80005F10; // type:func -__osGetHWIntrRoutine = 0x80005F80; // type:func -__osSetWatchLo = 0x80005FB0; // type:func -rspbootTextStart = 0x80005FC0; // type:func -EnAObj_SetupAction = 0x80010F00; // type:func -EnAObj_Init = 0x80010F0C; // type:func -EnAObj_Destroy = 0x8001124C; // type:func -EnAObj_WaitFinishedTalking = 0x800112A8; // type:func -EnAObj_SetupWaitTalk = 0x800112D8; // type:func -EnAObj_WaitTalk = 0x80011300; // type:func -EnAObj_SetupBlockRot = 0x800113B4; // type:func -EnAObj_BlockRot = 0x80011404; // type:func -EnAObj_SetupBoulderFragment = 0x80011524; // type:func -EnAObj_BoulderFragment = 0x8001154C; // type:func -EnAObj_SetupBlock = 0x8001166C; // type:func -EnAObj_Block = 0x800116AC; // type:func -EnAObj_Update = 0x80011794; // type:func -EnAObj_Draw = 0x800118B0; // type:func -EnItem00_SetupAction = 0x800119A0; // type:func -EnItem00_Init = 0x800119AC; // type:func -EnItem00_Destroy = 0x80012014; // type:func -func_8001DFC8 = 0x80012040; // type:func -func_8001E1C8 = 0x80012240; // type:func -func_8001E304 = 0x8001237C; // type:func -EnItem00_Collected = 0x80012640; // type:func -EnItem00_Update = 0x80012798; // type:func -EnItem00_Draw = 0x80012E18; // type:func -EnItem00_DrawRupee = 0x80012FB0; // type:func -EnItem00_DrawCollectible = 0x800130C8; // type:func -EnItem00_DrawHeartContainer = 0x80013208; // type:func -EnItem00_DrawHeartPiece = 0x80013300; // type:func -func_8001F404 = 0x80013398; // type:func -Item_DropCollectible = 0x800134E0; // type:func -Item_DropCollectible2 = 0x80013718; // type:func -Item_DropCollectibleRandom = 0x800138EC; // type:func -EffectBlure_AddVertex = 0x80013DA0; // type:func -EffectBlure_AddSpace = 0x800140C4; // type:func -EffectBlure_InitElements = 0x80014108; // type:func -EffectBlure_Init1 = 0x800141C0; // type:func -EffectBlure_Init2 = 0x800142D0; // type:func -EffectBlure_Destroy = 0x80014404; // type:func -EffectBlure_Update = 0x80014410; // type:func -EffectBlure_UpdateFlags = 0x80014874; // type:func -EffectBlure_GetComputedValues = 0x800149E4; // type:func -EffectBlure_SetupSmooth = 0x80014EF8; // type:func -EffectBlure_DrawElemNoInterpolation = 0x80014F2C; // type:func -EffectBlure_DrawElemHermiteInterpolation = 0x80015400; // type:func -EffectBlure_DrawSmooth = 0x80015D8C; // type:func -EffectBlure_SetupSimple = 0x8001605C; // type:func -EffectBlure_SetupSimpleAlt = 0x80016094; // type:func -EffectBlure_DrawSimpleVertices = 0x800162FC; // type:func -EffectBlure_DrawSimple = 0x800167DC; // type:func -EffectBlure_Draw = 0x80016CE8; // type:func -EffectShieldParticle_Init = 0x800171D0; // type:func -EffectShieldParticle_Destroy = 0x80017408; // type:func -EffectShieldParticle_Update = 0x80017494; // type:func -EffectShieldParticle_GetColors = 0x800175F8; // type:func -EffectShieldParticle_Draw = 0x80018318; // type:func -EffectSpark_Init = 0x80018830; // type:func -EffectSpark_Destroy = 0x80018C0C; // type:func -EffectSpark_Update = 0x80018C18; // type:func -EffectSpark_Draw = 0x80018CDC; // type:func -func_80026230 = 0x80019EE0; // type:func -func_80026400 = 0x8001A088; // type:func -func_80026608 = 0x8001A26C; // type:func -func_80026690 = 0x8001A2B0; // type:func -func_80026860 = 0x8001A458; // type:func -func_80026A6C = 0x8001A644; // type:func -Effect_GetPlayState = 0x8001A690; // type:func -Effect_GetByIndex = 0x8001A6A0; // type:func -Effect_InitStatus = 0x8001A7B0; // type:func -Effect_InitContext = 0x8001A7C4; // type:func -Effect_Add = 0x8001A86C; // type:func -Effect_DrawAll = 0x8001A9EC; // type:func -Effect_UpdateAll = 0x8001AAE8; // type:func -Effect_Delete = 0x8001AC14; // type:func -Effect_DeleteAll = 0x8001AD20; // type:func -EffectSs_InitInfo = 0x8001AE10; // type:func -EffectSs_ClearAll = 0x8001AEF4; // type:func -EffectSs_Delete = 0x8001AFB4; // type:func -EffectSs_Reset = 0x8001B014; // type:func -EffectSs_FindSlot = 0x8001B0A8; // type:func -EffectSs_Insert = 0x8001B1E0; // type:func -EffectSs_Spawn = 0x8001B278; // type:func -EffectSs_Update = 0x8001B420; // type:func -EffectSs_UpdateAll = 0x8001B4C0; // type:func -EffectSs_Draw = 0x8001B57C; // type:func -EffectSs_DrawAll = 0x8001B5C0; // type:func -EffectSs_LerpInv = 0x8001B70C; // type:func -EffectSs_LerpS16 = 0x8001B770; // type:func -EffectSs_LerpU8 = 0x8001B7C4; // type:func -EffectSs_DrawGEffect = 0x8001B8B0; // type:func -EffectSsDust_Spawn = 0x8001BAEC; // type:func -func_8002829C = 0x8001BBA0; // type:func -func_80028304 = 0x8001BC08; // type:func -func_8002836C = 0x8001BC70; // type:func -func_800283D4 = 0x8001BCD8; // type:func -func_8002843C = 0x8001BD40; // type:func -func_800284A4 = 0x8001BDA8; // type:func -func_80028510 = 0x8001BE14; // type:func -func_8002857C = 0x8001BE80; // type:func -func_800285EC = 0x8001BEF0; // type:func -func_8002865C = 0x8001BF60; // type:func -func_800286CC = 0x8001BFD0; // type:func -func_8002873C = 0x8001C040; // type:func -func_800287AC = 0x8001C0B0; // type:func -func_8002881C = 0x8001C120; // type:func -func_80028858 = 0x8001C15C; // type:func -func_80028894 = 0x8001C198; // type:func -func_80028990 = 0x8001C294; // type:func -func_80028A54 = 0x8001C358; // type:func -EffectSsKiraKira_SpawnSmallYellow = 0x8001C41C; // type:func -EffectSsKiraKira_SpawnSmall = 0x8001C478; // type:func -EffectSsKiraKira_SpawnDispersed = 0x8001C4B4; // type:func -EffectSsKiraKira_SpawnFocused = 0x8001C5F0; // type:func -EffectSsBomb_Spawn = 0x8001C6C8; // type:func -EffectSsBomb2_SpawnFade = 0x8001C720; // type:func -EffectSsBomb2_SpawnLayered = 0x8001C788; // type:func -EffectSsBlast_Spawn = 0x8001C7F8; // type:func -EffectSsBlast_SpawnWhiteShockwaveSetScale = 0x8001C888; // type:func -EffectSsBlast_SpawnShockwaveSetColor = 0x8001C8DC; // type:func -EffectSsBlast_SpawnWhiteShockwave = 0x8001C928; // type:func -EffectSsGSpk_SpawnAccel = 0x8001C964; // type:func -EffectSsGSpk_SpawnNoAccel = 0x8001C9F4; // type:func -EffectSsGSpk_SpawnFuse = 0x8001CA88; // type:func -EffectSsGSpk_SpawnRandColor = 0x8001CADC; // type:func -EffectSsGSpk_SpawnSmall = 0x8001CBE0; // type:func -EffectSsDFire_Spawn = 0x8001CC24; // type:func -EffectSsDFire_SpawnFixedScale = 0x8001CCA4; // type:func -EffectSsBubble_Spawn = 0x8001CCE8; // type:func -EffectSsGRipple_Spawn = 0x8001CD48; // type:func -EffectSsGSplash_Spawn = 0x8001CDA0; // type:func -EffectSsGMagma_Spawn = 0x8001CE34; // type:func -EffectSsGFire_Spawn = 0x8001CE6C; // type:func -EffectSsLightning_Spawn = 0x8001CEA4; // type:func -EffectSsDtBubble_SpawnColorProfile = 0x8001CF1C; // type:func -EffectSsDtBubble_SpawnCustomColor = 0x8001CF98; // type:func -EffectSsHahen_Spawn = 0x8001D028; // type:func -EffectSsHahen_SpawnBurst = 0x8001D0A8; // type:func -EffectSsStick_Spawn = 0x8001D1F0; // type:func -EffectSsSibuki_Spawn = 0x8001D244; // type:func -EffectSsSibuki_SpawnBurst = 0x8001D2B4; // type:func -EffectSsSibuki2_Spawn = 0x8001D438; // type:func -EffectSsGMagma2_Spawn = 0x8001D498; // type:func -EffectSsStone1_Spawn = 0x8001D508; // type:func -EffectSsHitMark_Spawn = 0x8001D55C; // type:func -EffectSsHitMark_SpawnFixedScale = 0x8001D5B4; // type:func -EffectSsHitMark_SpawnCustomScale = 0x8001D5D8; // type:func -EffectSsFhgFlash_SpawnLightBall = 0x8001D604; // type:func -EffectSsFhgFlash_SpawnShock = 0x8001D670; // type:func -EffectSsKFire_Spawn = 0x8001D6D4; // type:func -EffectSsSolderSrchBall_Spawn = 0x8001D73C; // type:func -EffectSsKakera_Spawn = 0x8001D7A4; // type:func -EffectSsIcePiece_Spawn = 0x8001D85C; // type:func -EffectSsIcePiece_SpawnBurst = 0x8001D8C4; // type:func -EffectSsEnIce_SpawnFlyingVec3f = 0x8001DA58; // type:func -EffectSsEnIce_SpawnFlyingVec3s = 0x8001DAF8; // type:func -EffectSsEnIce_Spawn = 0x8001DBC4; // type:func -EffectSsFireTail_Spawn = 0x8001DC4C; // type:func -EffectSsFireTail_SpawnFlame = 0x8001DCE4; // type:func -EffectSsFireTail_SpawnFlameOnPlayer = 0x8001DDA8; // type:func -EffectSsEnFire_SpawnVec3f = 0x8001DDF8; // type:func -EffectSsEnFire_SpawnVec3s = 0x8001DE70; // type:func -EffectSsExtra_Spawn = 0x8001DF1C; // type:func -EffectSsFCircle_Spawn = 0x8001DF84; // type:func -EffectSsDeadDb_Spawn = 0x8001DFE0; // type:func -EffectSsDeadDd_Spawn = 0x8001E098; // type:func -EffectSsDeadDd_SpawnRandYellow = 0x8001E14C; // type:func -EffectSsDeadDs_Spawn = 0x8001E1BC; // type:func -EffectSsDeadDs_SpawnStationary = 0x8001E234; // type:func -EffectSsDeadSound_Spawn = 0x8001E284; // type:func -EffectSsDeadSound_SpawnStationary = 0x8001E31C; // type:func -EffectSsIceSmoke_Spawn = 0x8001E36C; // type:func -FlagSet_Update = 0x8001E3D0; // type:func -Overlay_LoadGameState = 0x8001E7F0; // type:func -Overlay_FreeGameState = 0x8001E918; // type:func -ActorShape_Init = 0x8001EA40; // type:func -ActorShadow_Draw = 0x8001EA64; // type:func -ActorShadow_DrawCircle = 0x8001EE44; // type:func -ActorShadow_DrawWhiteCircle = 0x8001EE6C; // type:func -ActorShadow_DrawHorse = 0x8001EE9C; // type:func -ActorShadow_DrawFoot = 0x8001EEC4; // type:func -ActorShadow_DrawFeet = 0x8001F0D0; // type:func -Actor_SetFeetPos = 0x8001F59C; // type:func -Actor_ProjectPos = 0x8001F5F0; // type:func -func_8002BE64 = 0x8001F654; // type:func -func_8002BE98 = 0x8001F68C; // type:func -Actor_SetNaviToActor = 0x8001F754; // type:func -func_8002C0C0 = 0x8001F8B8; // type:func -func_8002C124 = 0x8001F91C; // type:func -func_8002C7BC = 0x8001FF54; // type:func -Flags_GetSwitch = 0x800202E8; // type:func -Flags_SetSwitch = 0x8002031C; // type:func -Flags_UnsetSwitch = 0x8002035C; // type:func -Flags_GetUnknown = 0x800203A0; // type:func -Flags_SetUnknown = 0x800203D4; // type:func -Flags_UnsetUnknown = 0x80020414; // type:func -Flags_GetTreasure = 0x80020458; // type:func -Flags_SetTreasure = 0x80020470; // type:func -Flags_GetClear = 0x8002048C; // type:func -Flags_SetClear = 0x800204A4; // type:func -Flags_UnsetClear = 0x800204C0; // type:func -Flags_GetTempClear = 0x800204E0; // type:func -Flags_SetTempClear = 0x800204F8; // type:func -Flags_UnsetTempClear = 0x80020514; // type:func -Flags_GetCollectible = 0x80020534; // type:func -Flags_SetCollectible = 0x80020568; // type:func -TitleCard_Init = 0x800205AC; // type:func -TitleCard_InitBossName = 0x800205CC; // type:func -TitleCard_InitPlaceName = 0x80020610; // type:func -TitleCard_Update = 0x800206AC; // type:func -TitleCard_Draw = 0x80020768; // type:func -TitleCard_Clear = 0x80020CA0; // type:func -Actor_Kill = 0x80020CD4; // type:func -Actor_SetWorldToHome = 0x80020CF4; // type:func -Actor_SetFocus = 0x80020D24; // type:func -Actor_SetWorldRotToShape = 0x80020D68; // type:func -Actor_SetShapeRotToWorld = 0x80020D88; // type:func -Actor_SetScale = 0x80020DA8; // type:func -Actor_SetObjectDependency = 0x80020DC4; // type:func -Actor_Init = 0x80020DFC; // type:func -Actor_Destroy = 0x80020F10; // type:func -Actor_UpdatePos = 0x80020F44; // type:func -Actor_UpdateVelocityXZGravity = 0x80020FC4; // type:func -Actor_MoveXZGravity = 0x8002103C; // type:func -Actor_UpdateVelocityXYZ = 0x80021068; // type:func -Actor_MoveXYZ = 0x800210D8; // type:func -Actor_SetProjectileSpeed = 0x80021104; // type:func -Actor_UpdatePosByAnimation = 0x80021158; // type:func -Actor_WorldYawTowardActor = 0x800211D4; // type:func -Actor_FocusYawTowardActor = 0x80021200; // type:func -Actor_WorldYawTowardPoint = 0x8002122C; // type:func -Actor_WorldPitchTowardActor = 0x80021250; // type:func -Actor_FocusPitchTowardActor = 0x8002127C; // type:func -Actor_WorldPitchTowardPoint = 0x800212A8; // type:func -Actor_WorldDistXYZToActor = 0x800212CC; // type:func -Actor_WorldDistXYZToPoint = 0x800212F8; // type:func -Actor_WorldDistXZToActor = 0x8002131C; // type:func -Actor_WorldDistXZToPoint = 0x80021348; // type:func -func_8002DBD0 = 0x8002136C; // type:func -Actor_HeightDiff = 0x8002140C; // type:func -Player_GetHeight = 0x80021420; // type:func -func_8002DCE4 = 0x80021480; // type:func -func_8002DD6C = 0x80021508; // type:func -func_8002DD78 = 0x80021518; // type:func -func_8002DDA8 = 0x8002154C; // type:func -func_8002DDE4 = 0x80021588; // type:func -func_8002DDF4 = 0x8002159C; // type:func -func_8002DE04 = 0x800215B0; // type:func -func_8002DE74 = 0x80021620; // type:func -Actor_MountHorse = 0x80021678; // type:func -func_8002DEEC = 0x8002169C; // type:func -func_8002DF18 = 0x800216C8; // type:func -Player_SetCsAction = 0x800216E8; // type:func -Player_SetCsActionWithHaltedActors = 0x8002170C; // type:func -func_8002DF90 = 0x80021748; // type:func -func_8002DFA4 = 0x80021760; // type:func -Player_IsFacingActor = 0x80021788; // type:func -Actor_ActorBIsFacingActorA = 0x800217E0; // type:func -Actor_IsFacingPlayer = 0x80021848; // type:func -Actor_ActorAIsFacingActorB = 0x80021894; // type:func -Actor_IsFacingAndNearPlayer = 0x800218F4; // type:func -Actor_ActorAIsFacingAndNearActorB = 0x80021974; // type:func -func_8002E234 = 0x80021A08; // type:func -func_8002E2AC = 0x80021A80; // type:func -Actor_UpdateBgCheckInfo = 0x80021C8C; // type:func -func_8002E830 = 0x8002200C; // type:func -func_8002EABC = 0x800221E8; // type:func -func_8002EB44 = 0x80022220; // type:func -func_8002EBCC = 0x80022258; // type:func -func_8002ED80 = 0x80022378; // type:func -Actor_GetFocus = 0x80022498; // type:func -Actor_GetWorld = 0x800224CC; // type:func -Actor_GetWorldPosShapeRot = 0x80022500; // type:func -func_8002EFC0 = 0x8002257C; // type:func -func_8002F090 = 0x8002264C; // type:func -func_8002F0C8 = 0x80022688; // type:func -Actor_TalkOfferAccepted = 0x80022758; // type:func -Actor_OfferTalkExchange = 0x80022788; // type:func -Actor_OfferTalkExchangeEquiCylinder = 0x8002285C; // type:func -Actor_OfferTalk = 0x80022890; // type:func -Actor_OfferTalkNearColChkInfoCylinder = 0x800228B8; // type:func -Actor_TextboxIsClosing = 0x800228F8; // type:func -func_8002F368 = 0x8002292C; // type:func -Actor_GetScreenPos = 0x8002293C; // type:func -Actor_HasParent = 0x800229D8; // type:func -Actor_OfferGetItem = 0x800229FC; // type:func -Actor_OfferGetItemNearby = 0x80022B1C; // type:func -Actor_OfferCarry = 0x80022B48; // type:func -Actor_HasNoParent = 0x80022B68; // type:func -func_8002F5C4 = 0x80022B8C; // type:func -Actor_SetClosestSecretDistance = 0x80022BBC; // type:func -Actor_IsMounted = 0x80022BE4; // type:func -Actor_SetRideActor = 0x80022C08; // type:func -Actor_NotMounted = 0x80022C40; // type:func -func_8002F698 = 0x80022C64; // type:func -func_8002F6D4 = 0x80022CA4; // type:func -func_8002F71C = 0x80022CEC; // type:func -func_8002F758 = 0x80022D28; // type:func -func_8002F7A0 = 0x80022D70; // type:func -Player_PlaySfx = 0x80022DAC; // type:func -Actor_PlaySfx = 0x80022DF8; // type:func -func_8002F850 = 0x80022E24; // type:func -func_8002F8F0 = 0x80022EC8; // type:func -func_8002F91C = 0x80022EFC; // type:func -func_8002F948 = 0x80022F30; // type:func -func_8002F974 = 0x80022F64; // type:func -func_8002F994 = 0x80022F8C; // type:func -func_8002F9EC = 0x80022FE4; // type:func -func_8002FA60 = 0x8002305C; // type:func -Actor_DrawFaroresWindPointer = 0x800231AC; // type:func -func_80030488 = 0x80023A24; // type:func -Actor_DisableLens = 0x80023A4C; // type:func -Actor_InitContext = 0x80023A78; // type:func -Actor_UpdateAll = 0x80023BCC; // type:func -Actor_FaultPrint = 0x80024068; // type:func -Actor_Draw = 0x800240DC; // type:func -func_80030ED8 = 0x8002439C; // type:func -Actor_DrawLensOverlay = 0x8002446C; // type:func -Actor_DrawLensActors = 0x800245DC; // type:func -func_800314B0 = 0x80024810; // type:func -func_800314D4 = 0x80024834; // type:func -func_800315AC = 0x8002490C; // type:func -Actor_KillAllWithMissingObject = 0x80024B24; // type:func -Actor_FreezeAllEnemies = 0x80024BC0; // type:func -func_80031B14 = 0x80024C10; // type:func -func_80031C3C = 0x80024D38; // type:func -Actor_AddToCategory = 0x80024DF0; // type:func -Actor_RemoveFromCategory = 0x80024E38; // type:func -Actor_FreeOverlay = 0x80024F04; // type:func -Actor_Spawn = 0x80024F68; // type:func -Actor_SpawnAsChild = 0x80025248; // type:func -Actor_SpawnTransitionActors = 0x800252E0; // type:func -Actor_SpawnEntry = 0x8002541C; // type:func -Actor_Delete = 0x800254A0; // type:func -func_80032880 = 0x800255A4; // type:func -func_800328D4 = 0x800255F8; // type:func -func_80032AF0 = 0x80025814; // type:func -Actor_Find = 0x80025964; // type:func -Enemy_StartFinishingBlow = 0x800259A4; // type:func -func_80032CB4 = 0x800259DC; // type:func -func_80032D60 = 0x80025A90; // type:func -BodyBreak_Alloc = 0x80025B5C; // type:func -BodyBreak_SetInfo = 0x80025C54; // type:func -BodyBreak_SpawnParts = 0x80025D5C; // type:func -Actor_SpawnFloorDustRing = 0x80025F40; // type:func -func_80033480 = 0x80026160; // type:func -Actor_GetCollidedExplosive = 0x80026320; // type:func -func_80033684 = 0x80026364; // type:func -Actor_ChangeCategory = 0x8002642C; // type:func -Actor_GetProjectileActor = 0x8002646C; // type:func -Actor_SetTextWithPrefix = 0x8002662C; // type:func -Actor_TestFloorInDirection = 0x800266A8; // type:func -Actor_IsTargeted = 0x80026774; // type:func -Actor_OtherIsTargeted = 0x800267A8; // type:func -func_80033AEC = 0x800267DC; // type:func -func_80033C30 = 0x80026928; // type:func -Actor_RequestQuake = 0x80026A78; // type:func -Actor_RequestQuakeWithSpeed = 0x80026AE0; // type:func -Actor_RequestQuakeAndRumble = 0x80026B50; // type:func -Rand_ZeroFloat = 0x80026BC0; // type:func -Rand_CenteredFloat = 0x80026BEC; // type:func -Actor_DrawDoorLock = 0x80026C24; // type:func -func_8003424C = 0x80026EC8; // type:func -Actor_SetColorFilter = 0x80026EE8; // type:func -func_800342EC = 0x80026F6C; // type:func -func_8003435C = 0x80026FE0; // type:func -Npc_UpdateTalking = 0x80027054; // type:func -Npc_TrackPointWithLimits = 0x80027144; // type:func -Npc_GetTrackingPresetMaxPlayerYaw = 0x80027478; // type:func -Npc_UpdateAutoTurn = 0x800274A4; // type:func -Npc_TrackPoint = 0x800276AC; // type:func -func_80034B28 = 0x800277C4; // type:func -func_80034B54 = 0x800277E8; // type:func -func_80034BA0 = 0x80027828; // type:func -func_80034CC4 = 0x80027920; // type:func -func_80034DD4 = 0x80027A04; // type:func -Animation_ChangeByInfo = 0x80027AF4; // type:func -func_80034F54 = 0x80027B8C; // type:func -Actor_Noop = 0x80027D50; // type:func -func_80035124 = 0x80027D60; // type:func -Gfx_DrawDListOpa = 0x80027EA4; // type:func -Gfx_DrawDListXlu = 0x80027F28; // type:func -func_800353E8 = 0x80027FAC; // type:func -Actor_FindNearby = 0x80027FBC; // type:func -func_800354B4 = 0x80028080; // type:func -func_8003555C = 0x80028128; // type:func -func_800355B8 = 0x80028184; // type:func -func_800355E4 = 0x800281B0; // type:func -Actor_ApplyDamage = 0x800281F4; // type:func -Actor_SetDropFlag = 0x80028220; // type:func -Actor_SetDropFlagJntSph = 0x8002830C; // type:func -func_80035844 = 0x80028414; // type:func -func_800358DC = 0x800284A8; // type:func -func_800359B8 = 0x80028584; // type:func -func_80035B18 = 0x800286E8; // type:func -Flags_GetEventChkInf = 0x80028718; // type:func -Flags_SetEventChkInf = 0x80028744; // type:func -Flags_GetInfTable = 0x80028778; // type:func -Flags_SetInfTable = 0x800287A4; // type:func -func_80035BFC = 0x800287D8; // type:func -func_80036E50 = 0x80029A2C; // type:func -func_800374E0 = 0x8002A0BC; // type:func -func_80037C30 = 0x8002A810; // type:func -func_80037C5C = 0x8002A840; // type:func -func_80037C94 = 0x8002A87C; // type:func -func_80037CB8 = 0x8002A8A0; // type:func -func_80037D98 = 0x8002A984; // type:func -Actor_TrackNone = 0x8002AB1C; // type:func -Actor_TrackPoint = 0x8002ABB8; // type:func -Actor_TrackPlayerSetFocusHeight = 0x8002AD4C; // type:func -Actor_TrackPlayer = 0x8002AE88; // type:func -ActorOverlayTable_LogPrint = 0x8002AFC0; // type:func -ActorOverlayTable_FaultPrint = 0x8002AFC8; // type:func -ActorOverlayTable_Init = 0x8002B0A0; // type:func -ActorOverlayTable_Cleanup = 0x8002B0E0; // type:func -SSNode_SetValue = 0x8002B110; // type:func -SSList_SetNull = 0x8002B12C; // type:func -SSNodeList_SetSSListHead = 0x8002B13C; // type:func -DynaSSNodeList_SetSSListHead = 0x8002B194; // type:func -DynaSSNodeList_Initialize = 0x8002B1EC; // type:func -DynaSSNodeList_Alloc = 0x8002B200; // type:func -DynaSSNodeList_ResetCount = 0x8002B250; // type:func -DynaSSNodeList_GetNextNodeIdx = 0x8002B25C; // type:func -BgCheck_Vec3sToVec3f = 0x8002B28C; // type:func -BgCheck_Vec3fToVec3s = 0x8002B2D0; // type:func -CollisionPoly_GetMinY = 0x8002B314; // type:func -CollisionPoly_GetNormalF = 0x8002B3C0; // type:func -func_80038A28 = 0x8002B418; // type:func -CollisionPoly_GetPointDistanceFromPlane = 0x8002B56C; // type:func -CollisionPoly_GetVertices = 0x8002B5D4; // type:func -CollisionPoly_GetVerticesByBgId = 0x8002B674; // type:func -CollisionPoly_CheckYIntersectApprox1 = 0x8002B6F4; // type:func -CollisionPoly_CheckYIntersect = 0x8002B828; // type:func -CollisionPoly_CheckYIntersectApprox2 = 0x8002B8D4; // type:func -CollisionPoly_CheckXIntersectApprox = 0x8002B914; // type:func -CollisionPoly_CheckZIntersectApprox = 0x8002B9B8; // type:func -CollisionPoly_LineVsPoly = 0x8002BA5C; // type:func -CollisionPoly_SphVsPoly = 0x8002BD3C; // type:func -StaticLookup_AddPolyToSSList = 0x8002BE0C; // type:func -StaticLookup_AddPoly = 0x8002C02C; // type:func -BgCheck_RaycastDownStaticList = 0x8002C0C0; // type:func -BgCheck_RaycastDownStatic = 0x8002C2FC; // type:func -BgCheck_ComputeWallDisplacement = 0x8002C414; // type:func -BgCheck_SphVsStaticWall = 0x8002C4C4; // type:func -BgCheck_CheckStaticCeiling = 0x8002CD58; // type:func -BgCheck_CheckLineAgainstSSList = 0x8002CF30; // type:func -BgCheck_CheckLineInSubdivision = 0x8002D154; // type:func -BgCheck_SphVsFirstStaticPolyList = 0x8002D2E0; // type:func -BgCheck_SphVsFirstStaticPoly = 0x8002D4B0; // type:func -BgCheck_GetNearestStaticLookup = 0x8002D5E8; // type:func -BgCheck_GetStaticLookup = 0x8002D69C; // type:func -BgCheck_GetStaticLookupIndicesFromPos = 0x8002D768; // type:func -BgCheck_GetSubdivisionMinBounds = 0x8002D848; // type:func -BgCheck_GetSubdivisionMaxBounds = 0x8002D9EC; // type:func -BgCheck_GetPolySubdivisionBounds = 0x8002DBB8; // type:func -BgCheck_PolyIntersectsSubdivision = 0x8002DD68; // type:func -BgCheck_InitializeStaticLookup = 0x8002E4BC; // type:func -BgCheck_IsSpotScene = 0x8002E8BC; // type:func -BgCheck_TryGetCustomMemsize = 0x8002E900; // type:func -BgCheck_SetSubdivisionDimension = 0x8002E998; // type:func -BgCheck_Allocate = 0x8002EA20; // type:func -BgCheck_GetCollisionHeader = 0x8002EE04; // type:func -BgCheck_PosInStaticBoundingBox = 0x8002EE6C; // type:func -BgCheck_RaycastDownImpl = 0x8002EF28; // type:func -BgCheck_CameraRaycastDown1 = 0x8002F0F8; // type:func -BgCheck_EntityRaycastDown1 = 0x8002F154; // type:func -BgCheck_EntityRaycastDown2 = 0x8002F1B0; // type:func -BgCheck_EntityRaycastDown3 = 0x8002F204; // type:func -BgCheck_EntityRaycastDown4 = 0x8002F268; // type:func -BgCheck_EntityRaycastDown5 = 0x8002F2D0; // type:func -BgCheck_EntityRaycastDown6 = 0x8002F328; // type:func -BgCheck_EntityRaycastDown7 = 0x8002F38C; // type:func -BgCheck_AnyRaycastDown1 = 0x8002F3F4; // type:func -BgCheck_AnyRaycastDown2 = 0x8002F4A8; // type:func -BgCheck_CameraRaycastDown2 = 0x8002F560; // type:func -BgCheck_EntityRaycastDownWalls = 0x8002F5C4; // type:func -BgCheck_EntityRaycastDown9 = 0x8002F62C; // type:func -BgCheck_CheckWallImpl = 0x8002F690; // type:func -BgCheck_EntitySphVsWall1 = 0x8002FCCC; // type:func -BgCheck_EntitySphVsWall2 = 0x8002FD30; // type:func -BgCheck_EntitySphVsWall3 = 0x8002FD94; // type:func -BgCheck_EntitySphVsWall4 = 0x8002FDFC; // type:func -BgCheck_CheckCeilingImpl = 0x8002FE68; // type:func -BgCheck_AnyCheckCeiling = 0x8002FF88; // type:func -BgCheck_EntityCheckCeiling = 0x8002FFD4; // type:func -BgCheck_CheckLineImpl = 0x80030024; // type:func -BgCheck_GetBccFlags = 0x80030504; // type:func -BgCheck_CameraLineTest1 = 0x8003054C; // type:func -BgCheck_CameraLineTest2 = 0x800305D8; // type:func -BgCheck_EntityLineTest1 = 0x80030664; // type:func -BgCheck_EntityLineTest2 = 0x800306F0; // type:func -BgCheck_EntityLineTest3 = 0x80030780; // type:func -BgCheck_ProjectileLineTest = 0x8003080C; // type:func -BgCheck_AnyLineTest1 = 0x80030898; // type:func -BgCheck_AnyLineTest2 = 0x800308DC; // type:func -BgCheck_AnyLineTest3 = 0x80030968; // type:func -BgCheck_SphVsFirstPolyImpl = 0x800309F4; // type:func -BgCheck_SphVsFirstPoly = 0x80030AB8; // type:func -BgCheck_SphVsFirstWall = 0x80030AFC; // type:func -SSNodeList_Initialize = 0x80030B44; // type:func -SSNodeList_Alloc = 0x80030B5C; // type:func -SSNodeList_GetNextNode = 0x80030BCC; // type:func -SSNodeList_GetNextNodeIdx = 0x80030C08; // type:func -ScaleRotPos_Initialize = 0x80030C1C; // type:func -ScaleRotPos_SetValue = 0x80030C5C; // type:func -ScaleRotPos_Equals = 0x80030CAC; // type:func -DynaLookup_ResetLists = 0x80030D80; // type:func -DynaLookup_Reset = 0x80030DC0; // type:func -DynaLookup_ResetVtxStartIndex = 0x80030DE0; // type:func -BgActor_Initialize = 0x80030DEC; // type:func -BgActor_SetActor = 0x80030E4C; // type:func -BgActor_IsTransformUnchanged = 0x80030F04; // type:func -DynaPoly_NullPolyList = 0x80030F2C; // type:func -DynaPoly_AllocPolyList = 0x80030F38; // type:func -DynaPoly_NullVtxList = 0x80030F74; // type:func -DynaPoly_AllocVtxList = 0x80030F80; // type:func -DynaPoly_SetBgActorPrevTransform = 0x80030FC8; // type:func -DynaPoly_IsBgIdBgActor = 0x80031014; // type:func -DynaPoly_Init = 0x80031034; // type:func -DynaPoly_Alloc = 0x80031080; // type:func -DynaPoly_SetBgActor = 0x80031154; // type:func -DynaPoly_GetActor = 0x80031214; // type:func -DynaPoly_DisableCollision = 0x80031288; // type:func -DynaPoly_EnableCollision = 0x800312E0; // type:func -DynaPoly_DisableCeilingCollision = 0x80031338; // type:func -DynaPoly_EnableCeilingCollision = 0x80031390; // type:func -DynaPoly_DeleteBgActor = 0x800313E8; // type:func -DynaPoly_InvalidateLookup = 0x80031470; // type:func -DynaPoly_AddBgActorToLookup = 0x80031488; // type:func -DynaPoly_UnsetAllInteractFlags = 0x80031DD4; // type:func -DynaPoly_UpdateContext = 0x80031E6C; // type:func -DynaPoly_UpdateBgActorTransforms = 0x80031FD8; // type:func -BgCheck_RaycastDownDynaList = 0x80032068; // type:func -BgCheck_RaycastDownDyna = 0x80032250; // type:func -BgCheck_SphVsDynaWallInBgActor = 0x800326F8; // type:func -BgCheck_SphVsDynaWall = 0x80032DBC; // type:func -BgCheck_CheckDynaCeilingList = 0x80032FF8; // type:func -BgCheck_CheckDynaCeiling = 0x80033254; // type:func -BgCheck_CheckLineAgainstBgActorSSList = 0x800333B8; // type:func -BgCheck_CheckLineAgainstBgActor = 0x8003353C; // type:func -BgCheck_CheckLineAgainstDyna = 0x80033658; // type:func -BgCheck_SphVsFirstDynaPolyList = 0x80033810; // type:func -BgCheck_SphVsFirstDynaPolyInBgActor = 0x80033928; // type:func -BgCheck_SphVsFirstDynaPoly = 0x80033A68; // type:func -CollisionHeader_SegmentedToVirtual = 0x80033BC0; // type:func -CollisionHeader_GetVirtual = 0x80033CA4; // type:func -func_800418D0 = 0x80033CF8; // type:func -BgCheck_ResetPolyCheckTbl = 0x80033DA0; // type:func -SurfaceType_GetData = 0x80033DD8; // type:func -SurfaceType_GetBgCamIndex = 0x80033E50; // type:func -BgCheck_GetBgCamSettingImpl = 0x80033E74; // type:func -BgCheck_GetBgCamSetting = 0x80033EBC; // type:func -BgCheck_GetBgCamCountImpl = 0x80033F50; // type:func -BgCheck_GetBgCamCount = 0x80033FAC; // type:func -BgCheck_GetBgCamFuncDataImpl = 0x80034040; // type:func -BgCheck_GetBgCamFuncData = 0x800340C8; // type:func -SurfaceType_GetExitIndex = 0x8003415C; // type:func -SurfaceType_GetFloorType = 0x80034184; // type:func -func_80041D70 = 0x800341AC; // type:func -SurfaceType_GetWallType = 0x800341D4; // type:func -SurfaceType_GetWallFlags = 0x800341FC; // type:func -SurfaceType_CheckWallFlag0 = 0x8003422C; // type:func -SurfaceType_CheckWallFlag1 = 0x80034260; // type:func -SurfaceType_CheckWallFlag2 = 0x80034294; // type:func -SurfaceType_GetFloorProperty2 = 0x800342C8; // type:func -SurfaceType_GetFloorProperty = 0x800342F0; // type:func -SurfaceType_IsSoft = 0x80034318; // type:func -SurfaceType_IsHorseBlocked = 0x80034340; // type:func -SurfaceType_GetMaterial = 0x80034368; // type:func -SurfaceType_GetSfxOffset = 0x8003438C; // type:func -SurfaceType_GetFloorEffect = 0x800343D4; // type:func -SurfaceType_GetLightSetting = 0x800343FC; // type:func -SurfaceType_GetEcho = 0x80034424; // type:func -SurfaceType_CanHookshot = 0x8003444C; // type:func -SurfaceType_IsIgnoredByEntities = 0x80034474; // type:func -SurfaceType_IsIgnoredByProjectiles = 0x800344B0; // type:func -SurfaceType_IsFloorConveyor = 0x800344EC; // type:func -SurfaceType_GetConveyorSpeed = 0x80034528; // type:func -SurfaceType_GetConveyorDirection = 0x80034550; // type:func -func_80042108 = 0x80034578; // type:func -WaterBox_GetSurface1 = 0x800345AC; // type:func -WaterBox_GetSurfaceImpl = 0x800346B8; // type:func -WaterBox_GetSurface2 = 0x80034810; // type:func -WaterBox_GetBgCamIndex = 0x800349AC; // type:func -WaterBox_GetBgCamSetting = 0x800349C0; // type:func -WaterBox_GetLightIndex = 0x80034A18; // type:func -func_800425B0 = 0x80034A30; // type:func -func_80042708 = 0x80034B88; // type:func -func_800427B4 = 0x80034C38; // type:func -DynaPolyActor_UpdateCarriedActorPos = 0x80034CF0; // type:func -DynaPolyActor_UpdateCarriedActorRotY = 0x80034E2C; // type:func -func_80043334 = 0x80034EC0; // type:func -DynaPolyActor_TransformCarriedActor = 0x80034F30; // type:func -DynaPolyActor_Init = 0x80035010; // type:func -DynaPolyActor_UnsetAllInteractFlags = 0x80035034; // type:func -DynaPolyActor_SetActorOnTop = 0x80035040; // type:func -DynaPolyActor_SetPlayerOnTop = 0x80035054; // type:func -DynaPoly_SetPlayerOnTop = 0x80035068; // type:func -DynaPolyActor_SetPlayerAbove = 0x80035098; // type:func -DynaPoly_SetPlayerAbove = 0x800350AC; // type:func -func_80043538 = 0x800350DC; // type:func -DynaPolyActor_IsActorOnTop = 0x800350F0; // type:func -DynaPolyActor_IsPlayerOnTop = 0x80035114; // type:func -DynaPolyActor_IsPlayerAbove = 0x80035138; // type:func -func_800435B4 = 0x8003515C; // type:func -func_800435D8 = 0x80035180; // type:func -Camera_InterpolateCurve = 0x800353A0; // type:func -Camera_LERPCeilF = 0x8003544C; // type:func -Camera_LERPFloorF = 0x80035490; // type:func -Camera_LERPCeilS = 0x800354D4; // type:func -Camera_LERPFloorS = 0x80035568; // type:func -Camera_LERPCeilVec3f = 0x800355FC; // type:func -func_80043ABC = 0x80035680; // type:func -func_80043B60 = 0x800356C0; // type:func -Camera_Vec3sToVec3f = 0x800356F0; // type:func -Camera_AddVecGeoToVec3f = 0x80035758; // type:func -Camera_Vec3fTranslateByUnitVector = 0x800357D8; // type:func -Camera_BGCheckInfo = 0x80035844; // type:func -Camera_BGCheck = 0x80035A6C; // type:func -func_80043F94 = 0x80035AC8; // type:func -func_80044340 = 0x80035E80; // type:func -Camera_CheckOOB = 0x80035EDC; // type:func -Camera_GetFloorYNorm = 0x80035F78; // type:func -Camera_GetFloorY = 0x8003605C; // type:func -Camera_GetFloorYLayer = 0x800360B8; // type:func -Camera_GetBgCamSetting = 0x8003627C; // type:func -Camera_GetBgCamFuncData = 0x800362B0; // type:func -Camera_GetBgCamIndex = 0x800362E0; // type:func -Camera_GetBgCamFuncDataUnderPlayer = 0x80036360; // type:func -Camera_GetWaterBoxBgCamIndex = 0x80036410; // type:func -Camera_GetWaterSurface = 0x800364F0; // type:func -Camera_XZAngle = 0x800365B8; // type:func -Camera_GetPitchAdjFromFloorHeightDiffs = 0x80036620; // type:func -Camera_CalcUpFromPitchYawRoll = 0x8003694C; // type:func -Camera_ClampLERPScale = 0x80036B88; // type:func -Camera_CopyDataToRegs = 0x80036BE0; // type:func -Camera_UpdateInterface = 0x80036BF0; // type:func -Camera_BGCheckCorner = 0x80036CFC; // type:func -func_80045508 = 0x80036D64; // type:func -Camera_CalcSlopeYAdj = 0x80036F74; // type:func -Camera_CalcAtDefault = 0x80037008; // type:func -func_800458D4 = 0x80037120; // type:func -func_80045B08 = 0x800372D8; // type:func -Camera_CalcAtForParallel = 0x80037438; // type:func -Camera_CalcAtForLockOn = 0x8003779C; // type:func -Camera_CalcAtForHorse = 0x80037C54; // type:func -Camera_LERPClampDist = 0x80037E10; // type:func -Camera_ClampDist = 0x80037EC8; // type:func -Camera_CalcDefaultPitch = 0x80037FDC; // type:func -Camera_CalcDefaultYaw = 0x8003813C; // type:func -func_80046E20 = 0x80038290; // type:func -Camera_Noop = 0x800387B4; // type:func -Camera_Normal1 = 0x800387C4; // type:func -Camera_Normal2 = 0x8003921C; // type:func -Camera_Normal3 = 0x800399AC; // type:func -Camera_Normal4 = 0x8003A054; // type:func -Camera_Normal0 = 0x8003A074; // type:func -Camera_Parallel1 = 0x8003A094; // type:func -Camera_Parallel2 = 0x8003A920; // type:func -Camera_Parallel3 = 0x8003A940; // type:func -Camera_Parallel4 = 0x8003A9A4; // type:func -Camera_Parallel0 = 0x8003A9C4; // type:func -Camera_Jump1 = 0x8003A9E4; // type:func -Camera_Jump2 = 0x8003B024; // type:func -Camera_Jump3 = 0x8003B910; // type:func -Camera_Jump4 = 0x8003C07C; // type:func -Camera_Jump0 = 0x8003C09C; // type:func -Camera_Battle1 = 0x8003C0BC; // type:func -Camera_Battle2 = 0x8003CDF8; // type:func -Camera_Battle3 = 0x8003CE18; // type:func -Camera_Battle4 = 0x8003CE38; // type:func -Camera_Battle0 = 0x8003D190; // type:func -Camera_KeepOn1 = 0x8003D1B0; // type:func -Camera_KeepOn2 = 0x8003DF00; // type:func -Camera_KeepOn3 = 0x8003DF20; // type:func -Camera_KeepOn4 = 0x8003E918; // type:func -Camera_KeepOn0 = 0x8003F730; // type:func -Camera_Fixed1 = 0x8003F9D0; // type:func -Camera_Fixed2 = 0x8003FCBC; // type:func -Camera_Fixed3 = 0x80040070; // type:func -Camera_Fixed4 = 0x80040270; // type:func -Camera_Fixed0 = 0x800405FC; // type:func -Camera_Subj1 = 0x8004061C; // type:func -Camera_Subj2 = 0x8004063C; // type:func -Camera_Subj3 = 0x8004065C; // type:func -Camera_Subj4 = 0x80040C60; // type:func -Camera_Subj0 = 0x80041294; // type:func -Camera_Data0 = 0x800412B4; // type:func -Camera_Data1 = 0x800412D4; // type:func -Camera_Data2 = 0x800412F4; // type:func -Camera_Data3 = 0x80041314; // type:func -Camera_Data4 = 0x80041334; // type:func -Camera_Unique1 = 0x80041620; // type:func -Camera_Unique2 = 0x80041AA4; // type:func -Camera_Unique3 = 0x80041E5C; // type:func -Camera_Unique0 = 0x8004230C; // type:func -Camera_Unique4 = 0x80042828; // type:func -Camera_Unique5 = 0x80042848; // type:func -Camera_Unique6 = 0x80042868; // type:func -Camera_Unique7 = 0x80042998; // type:func -Camera_Unique8 = 0x80042B9C; // type:func -Camera_Unique9 = 0x80042BBC; // type:func -Camera_Vec3fCopy = 0x80044018; // type:func -Camera_RotateAroundPoint = 0x80044038; // type:func -Camera_Demo1 = 0x80044094; // type:func -Camera_Demo2 = 0x8004426C; // type:func -Camera_Demo3 = 0x8004428C; // type:func -Camera_Demo4 = 0x80044D28; // type:func -Camera_Demo5 = 0x80044D48; // type:func -Camera_Demo6 = 0x80045720; // type:func -Camera_Demo7 = 0x800459C4; // type:func -Camera_Demo8 = 0x800459F8; // type:func -Camera_Demo9 = 0x80045A18; // type:func -Camera_Demo0 = 0x80045E38; // type:func -Camera_Special0 = 0x80045E58; // type:func -Camera_Special1 = 0x80045FA0; // type:func -Camera_Special2 = 0x80045FC0; // type:func -Camera_Special3 = 0x80045FE0; // type:func -Camera_Special4 = 0x80046000; // type:func -Camera_Special5 = 0x800461A4; // type:func -Camera_Special7 = 0x80046548; // type:func -Camera_Special6 = 0x80046894; // type:func -Camera_Special8 = 0x80046D04; // type:func -Camera_Special9 = 0x80046D24; // type:func -Camera_Create = 0x8004740C; // type:func -Camera_Destroy = 0x8004745C; // type:func -Camera_Init = 0x80047484; // type:func -func_80057FC4 = 0x800476A4; // type:func -Camera_Stub80058140 = 0x800477F8; // type:func -Camera_InitDataUsingPlayer = 0x80047804; // type:func -Camera_ChangeStatus = 0x80047A00; // type:func -Camera_UpdateWater = 0x80047A1C; // type:func -Camera_UpdateHotRoom = 0x80047E38; // type:func -Camera_UpdateDistortion = 0x80047E78; // type:func -Camera_Update = 0x800481D8; // type:func -Camera_Finish = 0x80048A08; // type:func -Camera_SetNewModeStateFlags = 0x80048B74; // type:func -Camera_RequestModeImpl = 0x80048B98; // type:func -Camera_RequestMode = 0x80048EFC; // type:func -Camera_CheckValidMode = 0x80048F28; // type:func -Camera_RequestSettingImpl = 0x80048F94; // type:func -Camera_RequestSetting = 0x80049188; // type:func -Camera_RequestBgCam = 0x800491B4; // type:func -Camera_GetInputDir = 0x80049288; // type:func -Camera_GetInputDirPitch = 0x800492AC; // type:func -Camera_GetInputDirYaw = 0x800492D4; // type:func -Camera_GetCamDir = 0x800492FC; // type:func -Camera_GetCamDirPitch = 0x80049320; // type:func -Camera_GetCamDirYaw = 0x80049348; // type:func -Camera_RequestQuake = 0x80049370; // type:func -Camera_SetViewParam = 0x800493E4; // type:func -Camera_UnsetViewFlag = 0x80049578; // type:func -Camera_OverwriteStateFlags = 0x800495A0; // type:func -Camera_ResetAnim = 0x800495BC; // type:func -Camera_SetCSParams = 0x800495CC; // type:func -Camera_SetStateFlag = 0x80049660; // type:func -Camera_UnsetStateFlag = 0x80049684; // type:func -Camera_ChangeDoorCam = 0x800496AC; // type:func -Camera_Copy = 0x800497AC; // type:func -Camera_IsDebugCamEnabled = 0x800498F4; // type:func -Camera_GetQuakeOffset = 0x80049900; // type:func -Camera_SetCameraData = 0x80049924; // type:func -func_8005B198 = 0x80049970; // type:func -Camera_SetFinishedFlag = 0x80049980; // type:func -DamageTable_Get = 0x800499D0; // type:func -DamageTable_Clear = 0x800499FC; // type:func -Collider_InitBase = 0x80049A30; // type:func -Collider_DestroyBase = 0x80049A78; // type:func -Collider_SetBaseToActor = 0x80049A8C; // type:func -Collider_SetBaseType1 = 0x80049ACC; // type:func -Collider_SetBase = 0x80049B10; // type:func -Collider_ResetATBase = 0x80049B54; // type:func -Collider_ResetACBase = 0x80049B70; // type:func -Collider_ResetOCBase = 0x80049B8C; // type:func -Collider_InitElementTouch = 0x80049BB4; // type:func -Collider_DestroyElementTouch = 0x80049BDC; // type:func -Collider_SetElementTouch = 0x80049BF0; // type:func -Collider_ResetATElement_Unk = 0x80049C18; // type:func -Collider_InitElementBump = 0x80049C28; // type:func -Collider_DestroyElementBump = 0x80049C58; // type:func -Collider_SetElementBump = 0x80049C6C; // type:func -Collider_InitElement = 0x80049C94; // type:func -Collider_DestroyElement = 0x80049D14; // type:func -Collider_SetElement = 0x80049D54; // type:func -Collider_ResetATElement = 0x80049DCC; // type:func -Collider_ResetACElement = 0x80049E04; // type:func -Collider_ResetOCElement = 0x80049E3C; // type:func -Collider_InitJntSphElementDim = 0x80049E54; // type:func -Collider_DestroyJntSphElementDim = 0x80049E9C; // type:func -Collider_SetJntSphElementDim = 0x80049EB0; // type:func -Collider_InitJntSphElement = 0x80049F08; // type:func -Collider_DestroyJntSphElement = 0x80049F48; // type:func -Collider_SetJntSphElement = 0x80049F88; // type:func -Collider_ResetJntSphElementAT = 0x80049FD8; // type:func -Collider_ResetJntSphElementAC = 0x80049FFC; // type:func -Collider_ResetJntSphElementOC = 0x8004A020; // type:func -Collider_InitJntSph = 0x8004A044; // type:func -Collider_FreeJntSph = 0x8004A070; // type:func -Collider_DestroyJntSph = 0x8004A110; // type:func -Collider_SetJntSphToActor = 0x8004A1A0; // type:func -Collider_SetJntSphAllocType1 = 0x8004A27C; // type:func -Collider_SetJntSphAlloc = 0x8004A358; // type:func -Collider_SetJntSph = 0x8004A434; // type:func -Collider_ResetJntSphAT = 0x8004A4E8; // type:func -Collider_ResetJntSphAC = 0x8004A574; // type:func -Collider_ResetJntSphOC = 0x8004A600; // type:func -Collider_InitCylinderDim = 0x8004A68C; // type:func -Collider_DestroyCylinderDim = 0x8004A6E8; // type:func -Collider_SetCylinderDim = 0x8004A6FC; // type:func -Collider_InitCylinder = 0x8004A73C; // type:func -Collider_DestroyCylinder = 0x8004A78C; // type:func -Collider_SetCylinderToActor = 0x8004A7DC; // type:func -Collider_SetCylinderType1 = 0x8004A844; // type:func -Collider_SetCylinder = 0x8004A8AC; // type:func -Collider_ResetCylinderAT = 0x8004A914; // type:func -Collider_ResetCylinderAC = 0x8004A954; // type:func -Collider_ResetCylinderOC = 0x8004A994; // type:func -Collider_InitTrisElementDim = 0x8004A9D4; // type:func -Collider_DestroyTrisElementDim = 0x8004AA20; // type:func -Collider_SetTrisElementDim = 0x8004AA34; // type:func -Collider_InitTrisElement = 0x8004AAE8; // type:func -Collider_DestroyTrisElement = 0x8004AB28; // type:func -Collider_SetTrisElement = 0x8004AB68; // type:func -Collider_ResetTrisElementAT = 0x8004ABB8; // type:func -Collider_ResetTrisElementAC = 0x8004ABDC; // type:func -Collider_ResetTrisElementOC = 0x8004AC00; // type:func -Collider_InitTris = 0x8004AC24; // type:func -Collider_FreeTris = 0x8004AC50; // type:func -Collider_DestroyTris = 0x8004AD08; // type:func -Collider_SetTrisAllocType1 = 0x8004ADAC; // type:func -Collider_SetTrisAlloc = 0x8004AEAC; // type:func -Collider_SetTris = 0x8004AFAC; // type:func -Collider_ResetTrisAT = 0x8004B078; // type:func -Collider_ResetTrisAC = 0x8004B118; // type:func -Collider_ResetTrisOC = 0x8004B1B8; // type:func -Collider_InitQuadDim = 0x8004B258; // type:func -Collider_DestroyQuadDim = 0x8004B2A4; // type:func -Collider_ResetQuadACDist = 0x8004B2B8; // type:func -Collider_SetQuadMidpoints = 0x8004B2D4; // type:func -Collider_SetQuadDim = 0x8004B390; // type:func -Collider_InitQuad = 0x8004B418; // type:func -Collider_DestroyQuad = 0x8004B468; // type:func -Collider_SetQuadType1 = 0x8004B4B8; // type:func -Collider_SetQuad = 0x8004B520; // type:func -Collider_ResetQuadAT = 0x8004B588; // type:func -Collider_ResetQuadAC = 0x8004B5D8; // type:func -Collider_ResetQuadOC = 0x8004B618; // type:func -Collider_QuadSetNearestAC = 0x8004B658; // type:func -Collider_InitLine = 0x8004B708; // type:func -Collider_DestroyLine = 0x8004B768; // type:func -Collider_SetLinePoints = 0x8004B77C; // type:func -Collider_SetLine = 0x8004B7C0; // type:func -Collider_ResetLineOC = 0x8004B7EC; // type:func -CollisionCheck_InitContext = 0x8004B808; // type:func -CollisionCheck_DestroyContext = 0x8004B828; // type:func -CollisionCheck_ClearContext = 0x8004B838; // type:func -CollisionCheck_EnableSAC = 0x8004B8E0; // type:func -CollisionCheck_DisableSAC = 0x8004B8F8; // type:func -CollisionCheck_SetAT = 0x8004B910; // type:func -CollisionCheck_SetAT_SAC = 0x8004B9F0; // type:func -CollisionCheck_SetAC = 0x8004BB00; // type:func -CollisionCheck_SetAC_SAC = 0x8004BBE0; // type:func -CollisionCheck_SetOC = 0x8004BCF0; // type:func -CollisionCheck_SetOC_SAC = 0x8004BDD0; // type:func -CollisionCheck_SetOCLine = 0x8004BEE0; // type:func -CollisionCheck_SkipElementTouch = 0x8004BF6C; // type:func -CollisionCheck_SkipElementBump = 0x8004BF90; // type:func -CollisionCheck_NoSharedFlags = 0x8004BFB4; // type:func -CollisionCheck_NoBlood = 0x8004BFDC; // type:func -CollisionCheck_BlueBlood = 0x8004BFF0; // type:func -CollisionCheck_GreenBlood = 0x8004C15C; // type:func -CollisionCheck_WaterBurst = 0x8004C2C8; // type:func -CollisionCheck_RedBlood = 0x8004C304; // type:func -CollisionCheck_RedBloodUnused = 0x8004C328; // type:func -CollisionCheck_HitSolid = 0x8004C34C; // type:func -CollisionCheck_SwordHitAudio = 0x8004C55C; // type:func -CollisionCheck_HitEffects = 0x8004C668; // type:func -CollisionCheck_SetBounce = 0x8004C868; // type:func -CollisionCheck_SetATvsAC = 0x8004C888; // type:func -CollisionCheck_ATJntSphVsACJntSph = 0x8004CA30; // type:func -CollisionCheck_ATJntSphVsACCyl = 0x8004CCDC; // type:func -CollisionCheck_ATCylVsACJntSph = 0x8004CF50; // type:func -CollisionCheck_ATJntSphVsACTris = 0x8004D1F0; // type:func -CollisionCheck_ATTrisVsACJntSph = 0x8004D410; // type:func -CollisionCheck_ATJntSphVsACQuad = 0x8004D624; // type:func -CollisionCheck_ATQuadVsACJntSph = 0x8004D844; // type:func -CollisionCheck_ATCylVsACCyl = 0x8004DAA8; // type:func -CollisionCheck_ATCylVsACTris = 0x8004DC7C; // type:func -CollisionCheck_ATTrisVsACCyl = 0x8004DE40; // type:func -CollisionCheck_ATCylVsACQuad = 0x8004E000; // type:func -CollisionCheck_ATQuadVsACCyl = 0x8004E274; // type:func -CollisionCheck_ATTrisVsACTris = 0x8004E520; // type:func -CollisionCheck_ATTrisVsACQuad = 0x8004E774; // type:func -CollisionCheck_ATQuadVsACTris = 0x8004EA04; // type:func -CollisionCheck_ATQuadVsACQuad = 0x8004EC9C; // type:func -CollisionCheck_SetJntSphHitFX = 0x8004EF2C; // type:func -CollisionCheck_SetCylHitFX = 0x8004F00C; // type:func -CollisionCheck_SetTrisHitFX = 0x8004F0A4; // type:func -CollisionCheck_SetQuadHitFX = 0x8004F18C; // type:func -CollisionCheck_SetHitEffects = 0x8004F224; // type:func -CollisionCheck_AC = 0x8004F2F8; // type:func -CollisionCheck_AT = 0x8004F420; // type:func -CollisionCheck_GetMassType = 0x8004F4F0; // type:func -CollisionCheck_SetOCvsOC = 0x8004F52C; // type:func -CollisionCheck_OC_JntSphVsJntSph = 0x8004F85C; // type:func -CollisionCheck_OC_JntSphVsCyl = 0x8004FA2C; // type:func -CollisionCheck_OC_CylVsJntSph = 0x8004FB8C; // type:func -CollisionCheck_OC_CylVsCyl = 0x8004FBB8; // type:func -CollisionCheck_SkipOC = 0x8004FC88; // type:func -CollisionCheck_Incompatible = 0x8004FCAC; // type:func -CollisionCheck_OC = 0x8004FD2C; // type:func -CollisionCheck_InitInfo = 0x8004FEBC; // type:func -CollisionCheck_ResetDamage = 0x8004FF04; // type:func -CollisionCheck_SetInfoNoDamageTable = 0x8004FF30; // type:func -CollisionCheck_SetInfo = 0x8004FF58; // type:func -CollisionCheck_SetInfo2 = 0x8004FF84; // type:func -CollisionCheck_SetInfoGetDamageTable = 0x8004FFB8; // type:func -CollisionCheck_ApplyDamage = 0x8004FFF0; // type:func -CollisionCheck_ApplyDamageJntSph = 0x800501B0; // type:func -CollisionCheck_ApplyDamageCyl = 0x80050258; // type:func -CollisionCheck_ApplyDamageTris = 0x80050278; // type:func -CollisionCheck_ApplyDamageQuad = 0x8005030C; // type:func -CollisionCheck_Damage = 0x8005032C; // type:func -CollisionCheck_LineOC_JntSph = 0x800503EC; // type:func -CollisionCheck_LineOC_Cyl = 0x80050504; // type:func -CollisionCheck_LineOC = 0x8005057C; // type:func -CollisionCheck_LineOCCheckAll = 0x800506C4; // type:func -CollisionCheck_LineOCCheck = 0x800506E8; // type:func -Collider_UpdateCylinder = 0x80050714; // type:func -Collider_SetCylinderPosition = 0x80050758; // type:func -Collider_SetQuadVertices = 0x80050778; // type:func -Collider_SetTrisVertices = 0x800507E8; // type:func -Collider_SetTrisDim = 0x800508A8; // type:func -Collider_UpdateSpheres = 0x800508F8; // type:func -CollisionCheck_SpawnRedBlood = 0x80050A7C; // type:func -CollisionCheck_SpawnWaterDroplets = 0x80050BDC; // type:func -CollisionCheck_SpawnShieldParticles = 0x80050D38; // type:func -CollisionCheck_SpawnShieldParticlesMetal = 0x80050DCC; // type:func -CollisionCheck_SpawnShieldParticlesMetalSfx = 0x80050E18; // type:func -CollisionCheck_SpawnShieldParticlesMetal2 = 0x80050E64; // type:func -CollisionCheck_SpawnShieldParticlesWood = 0x80050E84; // type:func -CollisionCheck_CylSideVsLineSeg = 0x80050F44; // type:func -CollisionCheck_GetSwordDamage = 0x80051648; // type:func -SaveContext_Init = 0x800516B0; // type:func -Regs_Init = 0x80051730; // type:func -DebugCamera_ScreenText = 0x800517C0; // type:func -DebugCamera_ScreenTextColored = 0x800517D4; // type:func -DebugCamera_DrawScreenText = 0x80051890; // type:func -Debug_DrawText = 0x80051974; // type:func -DebugDisplay_Init = 0x80051A40; // type:func -DebugDisplay_AddObject = 0x80051A50; // type:func -DebugDisplay_DrawObjects = 0x80051B2C; // type:func -DebugDisplay_DrawSpriteI8 = 0x80051BBC; // type:func -DebugDisplay_DrawPolygon = 0x80051DA0; // type:func -Cutscene_InitContext = 0x80051F00; // type:func -Cutscene_StartManual = 0x80051F18; // type:func -Cutscene_StopManual = 0x80051F30; // type:func -Cutscene_UpdateManual = 0x80051F54; // type:func -Cutscene_UpdateScripted = 0x80051FA0; // type:func -CutsceneHandler_DoNothing = 0x80052054; // type:func -Cutscene_StepTimer = 0x80052064; // type:func -CutsceneHandler_StartManual = 0x8005209C; // type:func -CutsceneHandler_StartScript = 0x800520FC; // type:func -CutsceneCmd_Misc = 0x80052168; // type:func -CutsceneCmd_SetLightSetting = 0x80052904; // type:func -CutsceneCmd_StartSequence = 0x80052944; // type:func -CutsceneCmd_StopSequence = 0x80052980; // type:func -CutsceneCmd_FadeOutSequence = 0x800529BC; // type:func -CutsceneCmd_RumbleController = 0x80052A3C; // type:func -CutsceneCmd_SetTime = 0x80052A80; // type:func -CutsceneCmd_Destination = 0x80052B24; // type:func -CutsceneCmd_Transition = 0x80054844; // type:func -CutsceneCmd_UpdateCamEyeSpline = 0x80055224; // type:func -CutsceneCmd_UpdateCamAtSpline = 0x80055378; // type:func -CutsceneCmd_SetCamEye = 0x800554D4; // type:func -CutsceneCmd_SetCamAt = 0x800556B0; // type:func -CutsceneCmd_Text = 0x80055858; // type:func -Cutscene_ProcessScript = 0x80055B2C; // type:func -CutsceneHandler_RunScript = 0x800564FC; // type:func -CutsceneHandler_StopManual = 0x80056540; // type:func -CutsceneHandler_StopScript = 0x80056580; // type:func -Cutscene_SetupScripted = 0x80056688; // type:func -func_80069048 = 0x80056808; // type:func -func_8006907C = 0x80056840; // type:func -Cutscene_HandleEntranceTriggers = 0x80056864; // type:func -Cutscene_HandleConditionalTriggers = 0x80056984; // type:func -Cutscene_SetScript = 0x80056B8C; // type:func -MemCpy = 0x80056BE0; // type:func -MemSet = 0x80056C10; // type:func -GetItem_Draw = 0x80056C70; // type:func -GetItem_DrawMaskOrBombchu = 0x80056CB4; // type:func -GetItem_DrawSoldOut = 0x80056D50; // type:func -GetItem_DrawBlueFire = 0x80056DF8; // type:func -GetItem_DrawPoes = 0x80056F9C; // type:func -GetItem_DrawFairy = 0x80057198; // type:func -GetItem_DrawMirrorShield = 0x80057374; // type:func -GetItem_DrawSkullToken = 0x800574EC; // type:func -GetItem_DrawEggOrMedallion = 0x80057654; // type:func -GetItem_DrawCompass = 0x8005770C; // type:func -GetItem_DrawPotion = 0x80057814; // type:func -GetItem_DrawGoronSword = 0x800579E8; // type:func -GetItem_DrawDekuNuts = 0x80057AF0; // type:func -GetItem_DrawRecoveryHeart = 0x80057C04; // type:func -GetItem_DrawFish = 0x80057D1C; // type:func -GetItem_DrawOpa0 = 0x80057E24; // type:func -GetItem_DrawOpa0Xlu1 = 0x80057EC0; // type:func -GetItem_DrawXlu01 = 0x80057FC4; // type:func -GetItem_DrawOpa10Xlu2 = 0x8005807C; // type:func -GetItem_DrawMagicArrow = 0x80058198; // type:func -GetItem_DrawMagicSpell = 0x800582B4; // type:func -GetItem_DrawOpa1023 = 0x80058404; // type:func -GetItem_DrawOpa10Xlu32 = 0x800584EC; // type:func -GetItem_DrawSmallRupee = 0x80058620; // type:func -GetItem_DrawScale = 0x80058770; // type:func -GetItem_DrawBulletBag = 0x800588D0; // type:func -GetItem_DrawWallet = 0x80058A1C; // type:func -SfxSource_InitAll = 0x80058B70; // type:func -SfxSource_UpdateAll = 0x80058BA0; // type:func -SfxSource_PlaySfxAtFixedWorldPos = 0x80058C48; // type:func -QuestHint_CheckCondition = 0x80058D30; // type:func -QuestHint_CheckConditionChain = 0x80058FAC; // type:func -QuestHint_CheckRandomCondition = 0x80059040; // type:func -QuestHint_GetTextIdFromScript = 0x80059220; // type:func -QuestHint_GetSariaTextId = 0x80059364; // type:func -QuestHint_GetNaviTextId = 0x800593CC; // type:func -MaskReaction_GetTextId = 0x80059410; // type:func -CutsceneFlags_UnsetAll = 0x80059460; // type:func -CutsceneFlags_Set = 0x80059490; // type:func -CutsceneFlags_Unset = 0x800594FC; // type:func -CutsceneFlags_Get = 0x8005956C; // type:func -Curve_CubicHermiteSpline = 0x800595E0; // type:func -Curve_Interpolate = 0x80059678; // type:func -SkelCurve_Clear = 0x80059820; // type:func -SkelCurve_Init = 0x80059850; // type:func -SkelCurve_Destroy = 0x80059900; // type:func -SkelCurve_SetAnim = 0x80059930; // type:func -SkelCurve_Update = 0x80059968; // type:func -SkelCurve_DrawLimb = 0x80059C58; // type:func -SkelCurve_Draw = 0x80059FE4; // type:func -func_8006CFC0 = 0x8005A030; // type:func -func_8006D074 = 0x8005A0E4; // type:func -func_8006D0AC = 0x8005A120; // type:func -func_8006D0EC = 0x8005A160; // type:func -func_8006D684 = 0x8005A5F8; // type:func -func_8006DC68 = 0x8005AB6C; // type:func -func_8006DD9C = 0x8005AC7C; // type:func -Jpeg_ScheduleDecoderTask = 0x8005AD10; // type:func -Jpeg_CopyToZbuffer = 0x8005AE4C; // type:func -Jpeg_GetUnalignedU16 = 0x8005AF84; // type:func -Jpeg_ParseMarkers = 0x8005AFD0; // type:func -Jpeg_Decode = 0x8005B19C; // type:func -KaleidoSetup_Update = 0x8005B4D0; // type:func -KaleidoSetup_Init = 0x8005B73C; // type:func -KaleidoSetup_Destroy = 0x8005B890; // type:func -func_8006EE50 = 0x8005B8A0; // type:func -Font_LoadChar = 0x8005B8B4; // type:func -Font_LoadMessageBoxIcon = 0x8005B904; // type:func -Font_LoadOrderedFont = 0x8005B948; // type:func -Environment_ZBufValToFixedPoint = 0x8005BA70; // type:func -Environment_GetPixelDepth = 0x8005BAA8; // type:func -Environment_GraphCallback = 0x8005BAD4; // type:func -Environment_Init = 0x8005BB18; // type:func -Environment_SmoothStepToU8 = 0x8005BFE8; // type:func -Environment_SmoothStepToS8 = 0x8005C120; // type:func -Environment_LerpWeight = 0x8005C260; // type:func -Environment_LerpWeightAccelDecel = 0x8005C2E4; // type:func -Environment_UpdateStorm = 0x8005C4A4; // type:func -Environment_UpdateSkybox = 0x8005C598; // type:func -Environment_EnableUnderwaterLights = 0x8005CE84; // type:func -Environment_DisableUnderwaterLights = 0x8005CEFC; // type:func -Environment_Update = 0x8005CF74; // type:func -Environment_DrawSunAndMoon = 0x8005EDD0; // type:func -Environment_DrawSunLensFlare = 0x8005F62C; // type:func -Environment_DrawLensFlare = 0x8005F700; // type:func -Environment_RandCentered = 0x80060358; // type:func -Environment_DrawRain = 0x80060380; // type:func -Environment_ChangeLightSetting = 0x80060928; // type:func -Environment_DrawSkyboxFilters = 0x800609AC; // type:func -Environment_DrawLightningFlash = 0x80060BCC; // type:func -Environment_UpdateLightningStrike = 0x80060C64; // type:func -Environment_AddLightningBolts = 0x80060F6C; // type:func -Environment_DrawLightning = 0x80060FD4; // type:func -Environment_PlaySceneSequence = 0x80061418; // type:func -Environment_PlayTimeBasedSequence = 0x80061608; // type:func -Environment_DrawCustomLensFlare = 0x80061920; // type:func -Environment_InitGameOverLights = 0x800619CC; // type:func -Environment_FadeInGameOverLights = 0x80061BB4; // type:func -Environment_FadeOutGameOverLights = 0x80061E68; // type:func -Environment_UpdateRain = 0x80062184; // type:func -Environment_FillScreen = 0x800621EC; // type:func -Environment_DrawSandstorm = 0x800623E4; // type:func -Environment_AdjustLights = 0x80062E30; // type:func -Environment_GetBgsDayCount = 0x8006305C; // type:func -Environment_ClearBgsDayCount = 0x8006306C; // type:func -Environment_GetTotalDays = 0x8006307C; // type:func -Environment_ForcePlaySequence = 0x8006308C; // type:func -Environment_IsForcedSequenceDisabled = 0x800630A4; // type:func -Environment_PlayStormNatureAmbience = 0x800630CC; // type:func -Environment_StopStormNatureAmbience = 0x8006312C; // type:func -Environment_WarpSongLeave = 0x8006318C; // type:func -Lib_MemSet = 0x80063280; // type:func -Math_CosS = 0x800632D4; // type:func -Math_SinS = 0x80063314; // type:func -Math_ScaledStepToS = 0x80063354; // type:func -Math_StepToS = 0x80063424; // type:func -Math_StepToF = 0x800634AC; // type:func -Math_StepUntilAngleS = 0x80063540; // type:func -Math_StepUntilS = 0x800635A8; // type:func -Math_StepToAngleS = 0x80063608; // type:func -Math_StepUntilF = 0x800636CC; // type:func -Math_AsymStepToF = 0x8006371C; // type:func -Lib_GetControlStickData = 0x800637C4; // type:func -Rand_S16Offset = 0x80063840; // type:func -Rand_S16OffsetStride = 0x80063894; // type:func -Math_Vec3f_Copy = 0x800638FC; // type:func -Math_Vec3s_ToVec3f = 0x8006391C; // type:func -Math_Vec3f_Sum = 0x80063960; // type:func -Math_Vec3f_Diff = 0x80063998; // type:func -Math_Vec3s_DiffToVec3f = 0x800639D0; // type:func -Math_Vec3f_Scale = 0x80063A2C; // type:func -Math_Vec3f_DistXYZ = 0x80063A68; // type:func -Math_Vec3f_DistXYZAndStoreDiff = 0x80063AAC; // type:func -Math_Vec3f_DistXZ = 0x80063B08; // type:func -Math_Vec3f_DiffY = 0x80063B3C; // type:func -Math_Vec3f_Yaw = 0x80063B50; // type:func -Math_Vec3f_Pitch = 0x80063B84; // type:func -Actor_ProcessInitChain = 0x80063BCC; // type:func -IChain_Apply_u8 = 0x80063C44; // type:func -IChain_Apply_s8 = 0x80063C60; // type:func -IChain_Apply_u16 = 0x80063C7C; // type:func -IChain_Apply_s16 = 0x80063C98; // type:func -IChain_Apply_u32 = 0x80063CB4; // type:func -IChain_Apply_s32 = 0x80063CD0; // type:func -IChain_Apply_f32 = 0x80063CEC; // type:func -IChain_Apply_f32div1000 = 0x80063D10; // type:func -IChain_Apply_Vec3f = 0x80063D40; // type:func -IChain_Apply_Vec3fdiv1000 = 0x80063D6C; // type:func -IChain_Apply_Vec3s = 0x80063DA4; // type:func -Math_SmoothStepToF = 0x80063DC8; // type:func -Math_ApproachF = 0x80063ED0; // type:func -Math_ApproachZeroF = 0x80063F40; // type:func -Math_SmoothStepToDegF = 0x80063F94; // type:func -Math_SmoothStepToS = 0x80064158; // type:func -Math_ApproachS = 0x80064274; // type:func -Color_RGBA8_Copy = 0x80064318; // type:func -Sfx_PlaySfxCentered = 0x80064340; // type:func -Sfx_PlaySfxCentered2 = 0x80064388; // type:func -Sfx_PlaySfxAtPos = 0x800643D0; // type:func -Health_InitMeter = 0x80064420; // type:func -Health_UpdateMeter = 0x800644FC; // type:func -func_80078E18 = 0x800648E0; // type:func -func_80078E34 = 0x80064900; // type:func -func_80078E84 = 0x80064950; // type:func -Health_DrawMeter = 0x800649E8; // type:func -Health_UpdateBeatingHeart = 0x80065660; // type:func -Health_IsCritical = 0x8006574C; // type:func -Lights_PointSetInfo = 0x800657C0; // type:func -Lights_PointNoGlowSetInfo = 0x8006581C; // type:func -Lights_PointGlowSetInfo = 0x80065880; // type:func -Lights_PointSetColorAndRadius = 0x800658E8; // type:func -Lights_DirectionalSetInfo = 0x8006591C; // type:func -Lights_Reset = 0x80065974; // type:func -Lights_Draw = 0x800659B0; // type:func -Lights_FindSlot = 0x80065AF4; // type:func -Lights_BindPoint = 0x80065B24; // type:func -Lights_BindDirectional = 0x80065E80; // type:func -Lights_BindAll = 0x80065EE8; // type:func -Lights_FindBufSlot = 0x80065F84; // type:func -Lights_FreeNode = 0x80066010; // type:func -LightContext_Init = 0x80066088; // type:func -LightContext_SetAmbientColor = 0x800660F4; // type:func -LightContext_SetFog = 0x80066120; // type:func -LightContext_NewLights = 0x8006615C; // type:func -LightContext_InitList = 0x80066194; // type:func -LightContext_DestroyList = 0x800661A4; // type:func -LightContext_InsertLight = 0x80066200; // type:func -LightContext_RemoveLight = 0x80066260; // type:func -Lights_NewAndDraw = 0x800662C4; // type:func -Lights_New = 0x8006640C; // type:func -Lights_GlowCheck = 0x80066454; // type:func -Lights_DrawGlow = 0x80066658; // type:func -ZeldaArena_Malloc = 0x80066860; // type:func -ZeldaArena_MallocR = 0x80066888; // type:func -ZeldaArena_Realloc = 0x800668B0; // type:func -ZeldaArena_Free = 0x800668E0; // type:func -ZeldaArena_Calloc = 0x80066908; // type:func -ZeldaArena_GetSizes = 0x80066960; // type:func -ZeldaArena_Check = 0x80066998; // type:func -ZeldaArena_Init = 0x800669BC; // type:func -ZeldaArena_Cleanup = 0x800669EC; // type:func -ZeldaArena_IsInitialized = 0x80066A10; // type:func -MapMark_Init = 0x80066A40; // type:func -MapMark_ClearPointers = 0x80066AEC; // type:func -MapMark_DrawForDungeon = 0x80066B08; // type:func -MapMark_Draw = 0x80066FF8; // type:func -PreNmiBuff_Init = 0x80067040; // type:func -PreNmiBuff_SetReset = 0x800670B8; // type:func -PreNmiBuff_IsResetting = 0x800670EC; // type:func -Sched_FlushTaskQueue = 0x80067100; // type:func -OLib_Vec3fDist = 0x80067180; // type:func -OLib_Vec3fDistOutDiff = 0x800671C4; // type:func -OLib_Vec3fDistXZ = 0x80067220; // type:func -OLib_ClampMinDist = 0x80067254; // type:func -OLib_ClampMaxDist = 0x800672A4; // type:func -OLib_Vec3fDistNormalize = 0x800672F4; // type:func -OLib_VecSphToVec3f = 0x800673A4; // type:func -OLib_VecGeoToVec3f = 0x80067450; // type:func -OLib_Vec3fToVecSph = 0x80067494; // type:func -OLib_Vec3fToVecGeo = 0x800675E8; // type:func -OLib_Vec3fDiffToVecSph = 0x80067630; // type:func -OLib_Vec3fDiffToVecGeo = 0x80067684; // type:func -OLib_Vec3fDiffRad = 0x800676D8; // type:func -OLib_Vec3fDiffDegF = 0x80067768; // type:func -OLib_Vec3fDiffBinAng = 0x800677D0; // type:func -OnePointCutscene_AddVecGeoToVec3f = 0x80067870; // type:func -OnePointCutscene_Vec3fYaw = 0x800678F0; // type:func -OnePointCutscene_Vec3sToVec3f = 0x80067958; // type:func -OnePointCutscene_BgCheckLineTest = 0x8006799C; // type:func -OnePointCutscene_RaycastDown = 0x800679EC; // type:func -OnePointCutscene_SetCsCamPoints = 0x80067A14; // type:func -OnePointCutscene_SetInfo = 0x80067A48; // type:func -OnePointCutscene_SetAsChild = 0x8006B184; // type:func -OnePointCutscene_RemoveCamera = 0x8006B1CC; // type:func -OnePointCutscene_Init = 0x8006B2A0; // type:func -OnePointCutscene_EndCutscene = 0x8006B558; // type:func -OnePointCutscene_Attention = 0x8006B5B4; // type:func -OnePointCutscene_AttentionSetSfx = 0x8006B720; // type:func -OnePointCutscene_EnableAttention = 0x8006B774; // type:func -OnePointCutscene_DisableAttention = 0x8006B784; // type:func -OnePointCutscene_CheckForCategory = 0x8006B798; // type:func -OnePointCutscene_Noop = 0x8006B7F8; // type:func -Map_SavePlayerInitialInfo = 0x8006B810; // type:func -Map_SetPaletteData = 0x8006B870; // type:func -Map_SetFloorPalettesData = 0x8006B8EC; // type:func -Map_InitData = 0x8006BAA4; // type:func -Map_InitRoomData = 0x8006BD60; // type:func -Map_Destroy = 0x8006BE3C; // type:func -Map_Init = 0x8006BE64; // type:func -Minimap_DrawCompassIcons = 0x8006C0EC; // type:func -Minimap_Draw = 0x8006C540; // type:func -Map_GetFloorTextIndexOffset = 0x8006D05C; // type:func -Map_Update = 0x8006D084; // type:func -Interface_ChangeHudVisibilityMode = 0x8006D3B0; // type:func -Interface_RaiseButtonAlphas = 0x8006D3E4; // type:func -Interface_DimButtonAlphas = 0x8006D51C; // type:func -Interface_UpdateHudAlphas = 0x8006D5F0; // type:func -func_80083108 = 0x8006DE10; // type:func -Interface_SetSceneRestrictions = 0x8006ED2C; // type:func -Gfx_TextureIA8 = 0x8006EE74; // type:func -Gfx_TextureI8 = 0x8006F098; // type:func -Inventory_SwapAgeEquipment = 0x8006F2BC; // type:func -Interface_InitHorsebackArchery = 0x8006F540; // type:func -func_800849EC = 0x8006F588; // type:func -Interface_LoadItemIcon1 = 0x8006F608; // type:func -Interface_LoadItemIcon2 = 0x8006F6B8; // type:func -func_80084BF4 = 0x8006F768; // type:func -Item_Give = 0x8006F884; // type:func -Item_CheckObtainability = 0x80070F00; // type:func -Inventory_DeleteItem = 0x80071440; // type:func -Inventory_ReplaceItem = 0x800714C0; // type:func -Inventory_HasEmptyBottle = 0x80071574; // type:func -Inventory_HasSpecificBottle = 0x800715E4; // type:func -Inventory_UpdateBottleItem = 0x8007165C; // type:func -Inventory_ConsumeFairy = 0x800716F4; // type:func -func_80086D5C = 0x800717CC; // type:func -Interface_LoadActionLabel = 0x80071804; // type:func -Interface_SetDoAction = 0x80071968; // type:func -Interface_SetNaviCall = 0x800719F0; // type:func -Interface_LoadActionLabelB = 0x80071AF4; // type:func -Health_ChangeBy = 0x80071BCC; // type:func -Health_GiveHearts = 0x80071CB0; // type:func -Rupees_ChangeBy = 0x80071CDC; // type:func -Inventory_ChangeAmmo = 0x80071D04; // type:func -Magic_Fill = 0x80072010; // type:func -Magic_Reset = 0x80072058; // type:func -Magic_RequestChange = 0x80072098; // type:func -Magic_Update = 0x80072350; // type:func -Magic_DrawMeter = 0x80072BFC; // type:func -Interface_SetSubTimer = 0x800733E8; // type:func -Interface_SetSubTimerToFinalSecond = 0x80073438; // type:func -Interface_SetTimer = 0x8007347C; // type:func -Interface_DrawActionLabel = 0x800734CC; // type:func -Interface_DrawItemButtons = 0x800735B4; // type:func -Interface_DrawItemIconTexture = 0x800743C0; // type:func -Interface_DrawAmmoCount = 0x80074568; // type:func -Interface_DrawActionButton = 0x80074A08; // type:func -Interface_InitVertices = 0x80074BF4; // type:func -func_8008A8B8 = 0x800750B4; // type:func -func_8008A994 = 0x80075194; // type:func -Interface_Draw = 0x800751DC; // type:func -Interface_Update = 0x80077D94; // type:func -Path_GetByIndex = 0x80078AA0; // type:func -Path_OrientAndGetDistSq = 0x80078AE4; // type:func -Path_CopyLastPoint = 0x80078BD0; // type:func -FrameAdvance_Init = 0x80078C70; // type:func -FrameAdvance_Update = 0x80078C80; // type:func -Player_SetBootData = 0x80078D20; // type:func -Player_InBlockingCsMode = 0x80078EAC; // type:func -Player_InCsMode = 0x80078F5C; // type:func -func_8008E9C4 = 0x80078F98; // type:func -Player_IsChildWithHylianShield = 0x80078FA8; // type:func -Player_ActionToModelGroup = 0x80078FD0; // type:func -Player_SetModelsForHoldingShield = 0x8007901C; // type:func -Player_SetModels = 0x80079108; // type:func -Player_SetModelGroup = 0x800791E0; // type:func -func_8008EC70 = 0x8007924C; // type:func -Player_SetEquipmentData = 0x80079284; // type:func -Player_UpdateBottleHeld = 0x80079374; // type:func -func_8008EDF0 = 0x800793C8; // type:func -func_8008EE08 = 0x800793E4; // type:func -func_8008EEAC = 0x80079488; // type:func -func_8008EF30 = 0x8007950C; // type:func -func_8008EF44 = 0x80079524; // type:func -Player_IsBurningStickInRange = 0x80079540; // type:func -Player_GetStrength = 0x80079618; // type:func -Player_GetMask = 0x80079664; // type:func -Player_UnsetMask = 0x80079674; // type:func -Player_HasMirrorShieldEquipped = 0x80079684; // type:func -Player_HasMirrorShieldSetToDraw = 0x8007969C; // type:func -Player_ActionToMagicSpell = 0x800796C8; // type:func -Player_HoldsHookshot = 0x800796F4; // type:func -func_8008F128 = 0x80079718; // type:func -Player_ActionToMeleeWeapon = 0x8007974C; // type:func -Player_GetMeleeWeaponHeld = 0x80079774; // type:func -Player_HoldsTwoHandedWeapon = 0x80079798; // type:func -Player_HoldsBrokenKnife = 0x800797C4; // type:func -Player_ActionToBottle = 0x8007981C; // type:func -Player_GetBottleHeld = 0x80079848; // type:func -Player_ActionToExplosive = 0x80079868; // type:func -Player_GetExplosiveHeld = 0x80079894; // type:func -func_8008F2BC = 0x800798B4; // type:func -Player_GetEnvironmentalHazard = 0x800798F0; // type:func -Player_DrawImpl = 0x80079A68; // type:func -func_8008F87C = 0x80079E2C; // type:func -Player_OverrideLimbDrawGameplayCommon = 0x8007A278; // type:func -Player_OverrideLimbDrawGameplayDefault = 0x8007A5CC; // type:func -Player_OverrideLimbDrawGameplayFirstPerson = 0x8007A8B8; // type:func -Player_OverrideLimbDrawGameplayCrawling = 0x8007AA08; // type:func -func_80090480 = 0x8007AA4C; // type:func -Player_UpdateShieldCollider = 0x8007ABD4; // type:func -func_800906D4 = 0x8007ACA8; // type:func -Player_DrawGetItemImpl = 0x8007ADB8; // type:func -Player_DrawGetItem = 0x8007AF4C; // type:func -func_80090A28 = 0x8007AFC4; // type:func -Player_DrawHookshotReticle = 0x8007B098; // type:func -Player_PostLimbDrawGameplay = 0x8007B27C; // type:func -Player_InitPauseDrawData = 0x8007BBE4; // type:func -Player_OverrideLimbDrawPause = 0x8007BD10; // type:func -Player_DrawPauseImpl = 0x8007BEB4; // type:func -Player_DrawPause = 0x8007C5B8; // type:func -func_80092320 = 0x8007C790; // type:func -PreNMI_Update = 0x8007C7A4; // type:func -PreNMI_Draw = 0x8007C7EC; // type:func -PreNMI_Main = 0x8007C8A8; // type:func -PreNMI_Destroy = 0x8007C8DC; // type:func -PreNMI_Init = 0x8007C8E8; // type:func -Quake_AddVecGeoToVec3f = 0x8007C930; // type:func -Quake_UpdateShakeInfo = 0x8007C9B0; // type:func -Quake_CallbackType1 = 0x8007CBD8; // type:func -Quake_CallbackType5 = 0x8007CC60; // type:func -Quake_CallbackType6 = 0x8007CCD4; // type:func -Quake_CallbackType3 = 0x8007CD58; // type:func -Quake_CallbackType2 = 0x8007CDF0; // type:func -Quake_CallbackType4 = 0x8007CE60; // type:func -Quake_GetFreeIndex = 0x8007CEF8; // type:func -Quake_RequestImpl = 0x8007CF5C; // type:func -Quake_Remove = 0x8007D014; // type:func -Quake_GetRequest = 0x8007D03C; // type:func -Quake_SetValue = 0x8007D098; // type:func -Quake_SetSpeed = 0x8007D1C8; // type:func -Quake_SetDuration = 0x8007D210; // type:func -Quake_GetTimeLeft = 0x8007D260; // type:func -Quake_SetPerturbations = 0x8007D298; // type:func -Quake_SetOrientation = 0x8007D300; // type:func -Quake_Init = 0x8007D368; // type:func -Quake_Request = 0x8007D3BC; // type:func -Quake_RemoveRequest = 0x8007D3E0; // type:func -Quake_Update = 0x8007D428; // type:func -Gfx_SetFog = 0x8007D7A0; // type:func -Gfx_SetFogWithSync = 0x8007D91C; // type:func -Gfx_SetFog2 = 0x8007DAAC; // type:func -Gfx_SetupDLImpl = 0x8007DAE0; // type:func -Gfx_SetupDL = 0x8007DB1C; // type:func -Gfx_SetupDLAtPtr = 0x8007DB3C; // type:func -Gfx_SetupDL_57 = 0x8007DB68; // type:func -Gfx_SetupDL_57b = 0x8007DB90; // type:func -Gfx_SetupDL_52NoCD = 0x8007DBB8; // type:func -Gfx_SetupDL_58Opa = 0x8007DBFC; // type:func -Gfx_SetupDL_57Opa = 0x8007DC24; // type:func -Gfx_SetupDL_50Opa = 0x8007DC4C; // type:func -Gfx_SetupDL_51Opa = 0x8007DC74; // type:func -Gfx_SetupDL_52Xlu = 0x8007DC9C; // type:func -Gfx_SetupDL_53Opa = 0x8007DCC4; // type:func -Gfx_SetupDL_54Opa = 0x8007DCEC; // type:func -Gfx_SetupDL_55Xlu = 0x8007DD14; // type:func -Gfx_SetupDL_26Opa = 0x8007DD3C; // type:func -Gfx_SetupDL_25Xlu2 = 0x8007DD64; // type:func -func_80093C80 = 0x8007DD8C; // type:func -Gfx_SetupDL_25Opa = 0x8007DDF8; // type:func -Gfx_SetupDL_25Xlu = 0x8007DE20; // type:func -Gfx_SetupDL_31Opa = 0x8007DE48; // type:func -Gfx_SetupDL_32Opa = 0x8007DE70; // type:func -Gfx_SetupDL_33Opa = 0x8007DE98; // type:func -Gfx_SetupDL_64 = 0x8007DEC0; // type:func -Gfx_SetupDL_34 = 0x8007DEE8; // type:func -Gfx_SetupDL_34Opa = 0x8007DF10; // type:func -Gfx_SetupDL_35Opa = 0x8007DF3C; // type:func -Gfx_SetupDL_44Xlu = 0x8007DF64; // type:func -Gfx_SetupDL_36Opa = 0x8007DF8C; // type:func -Gfx_SetupDL_28 = 0x8007DFB4; // type:func -Gfx_SetupDL_28Opa = 0x8007DFDC; // type:func -Gfx_SetupDL_43Opa = 0x8007E004; // type:func -Gfx_SetupDL_45Opa = 0x8007E02C; // type:func -Gfx_SetupDL_46Overlay = 0x8007E054; // type:func -Gfx_SetupDL_38Xlu = 0x8007E07C; // type:func -Gfx_SetupDL_4Xlu = 0x8007E0A4; // type:func -Gfx_SetupDL_37Opa = 0x8007E0CC; // type:func -Gfx_SetupDL_2Opa = 0x8007E0F4; // type:func -Gfx_SetupDL_39 = 0x8007E11C; // type:func -Gfx_SetupDL_39Opa = 0x8007E144; // type:func -Gfx_SetupDL_39Overlay = 0x8007E170; // type:func -Gfx_SetupDL_39Ptr = 0x8007E19C; // type:func -Gfx_SetupDL_40Opa = 0x8007E1C8; // type:func -Gfx_SetupDL_41Opa = 0x8007E1F0; // type:func -Gfx_SetupDL_47Xlu = 0x8007E218; // type:func -Gfx_SetupDL_66 = 0x8007E240; // type:func -Gfx_SetupDL_67 = 0x8007E268; // type:func -Gfx_SetupDL_68NoCD = 0x8007E290; // type:func -Gfx_SetupDL_69NoCD = 0x8007E2D4; // type:func -func_800947AC = 0x8007E318; // type:func -Gfx_SetupDL_70 = 0x8007E35C; // type:func -Gfx_SetupDL_20NoCD = 0x8007E384; // type:func -Gfx_SetupDL_42Opa = 0x8007E3C8; // type:func -Gfx_SetupDL_42Overlay = 0x8007E3F0; // type:func -Gfx_SetupDL_48Opa = 0x8007E418; // type:func -Gfx_SetupDL_49Xlu = 0x8007E440; // type:func -Gfx_SetupDL_27Xlu = 0x8007E468; // type:func -Gfx_SetupDL_60NoCDXlu = 0x8007E490; // type:func -Gfx_SetupDL_61Xlu = 0x8007E4D8; // type:func -Gfx_SetupDL_56Opa = 0x8007E500; // type:func -Gfx_SetupDL_56Ptr = 0x8007E528; // type:func -Gfx_SetupDL_59Opa = 0x8007E554; // type:func -Gfx_BranchTexScroll = 0x8007E57C; // type:func -func_80094E54 = 0x8007E620; // type:func -func_80094E78 = 0x8007E644; // type:func -Gfx_TexScroll = 0x8007E668; // type:func -Gfx_TwoTexScroll = 0x8007E6EC; // type:func -Gfx_TwoTexScrollEnvColor = 0x8007E80C; // type:func -Gfx_EnvColor = 0x8007E96C; // type:func -Gfx_SetupFrame = 0x8007E9C4; // type:func -func_80095974 = 0x8007EF7C; // type:func -func_80095AA0 = 0x8007F060; // type:func -Room_DrawNormal = 0x8007F078; // type:func -Room_DrawCullable = 0x8007F294; // type:func -Room_DecodeJpeg = 0x8007F75C; // type:func -Room_DrawBackground2D = 0x8007F7E4; // type:func -Room_DrawImageSingle = 0x8007FAE0; // type:func -Room_GetImageMultiBgEntry = 0x8007FEB0; // type:func -Room_DrawImageMulti = 0x8007FF9C; // type:func -Room_DrawImage = 0x8008036C; // type:func -func_80096FD4 = 0x800803D4; // type:func -func_80096FE8 = 0x800803EC; // type:func -func_8009728C = 0x80080588; // type:func -func_800973FC = 0x800806C0; // type:func -Room_Draw = 0x80080764; // type:func -func_80097534 = 0x800807B4; // type:func -Sample_HandleStateChange = 0x80080850; // type:func -Sample_Draw = 0x80080884; // type:func -Sample_Main = 0x80080A70; // type:func -Sample_Destroy = 0x80080A9C; // type:func -Sample_SetupView = 0x80080AA8; // type:func -Sample_LoadTitleStatic = 0x80080B60; // type:func -Sample_Init = 0x80080BC0; // type:func -Inventory_ChangeEquipment = 0x80080C50; // type:func -Inventory_DeleteEquipment = 0x80080CA8; // type:func -Inventory_ChangeUpgrade = 0x80080DB4; // type:func -Object_SpawnPersistent = 0x80080E10; // type:func -Object_InitContext = 0x80080EF4; // type:func -Object_UpdateEntries = 0x80081050; // type:func -Object_GetSlot = 0x80081148; // type:func -Object_IsLoaded = 0x800811A8; // type:func -func_800981B8 = 0x800811D8; // type:func -func_800982FC = 0x80081260; // type:func -Scene_ExecuteCommands = 0x800812C0; // type:func -Scene_CommandPlayerEntryList = 0x80081344; // type:func -Scene_CommandActorEntryList = 0x80081420; // type:func -Scene_CommandUnused2 = 0x80081478; // type:func -Scene_CommandCollisionHeader = 0x800814C0; // type:func -Scene_CommandRoomList = 0x800815F0; // type:func -Scene_CommandSpawnList = 0x80081648; // type:func -Scene_CommandSpecialFiles = 0x80081690; // type:func -Scene_CommandRoomBehavior = 0x80081758; // type:func -Scene_CommandRoomShape = 0x800817B0; // type:func -Scene_CommandObjectList = 0x800817F8; // type:func -Scene_CommandLightList = 0x800819AC; // type:func -Scene_CommandPathList = 0x80081A5C; // type:func -Scene_CommandTransitionActorEntryList = 0x80081AA4; // type:func -TransitionActor_InitContext = 0x80081AFC; // type:func -Scene_CommandLightSettingsList = 0x80081B0C; // type:func -Scene_CommandSkyboxSettings = 0x80081B64; // type:func -Scene_CommandSkyboxDisables = 0x80081BA8; // type:func -Scene_CommandTimeSettings = 0x80081BD0; // type:func -Scene_CommandWindSettings = 0x80081EE4; // type:func -Scene_CommandExitList = 0x80081F48; // type:func -Scene_CommandUndefined9 = 0x80081F90; // type:func -Scene_CommandSoundSettings = 0x80081FA0; // type:func -Scene_CommandEchoSettings = 0x80081FEC; // type:func -Scene_CommandAlternateHeaderList = 0x80082004; // type:func -Scene_CommandCutsceneData = 0x80082100; // type:func -Scene_CommandMiscSettings = 0x80082140; // type:func -Scene_SetTransitionForNextEntrance = 0x80082204; // type:func -Scene_DrawConfigDefault = 0x800822C0; // type:func -Scene_DrawConfigDekuTree = 0x80082300; // type:func -Scene_DrawConfigDekuTreeBoss = 0x80082448; // type:func -Scene_DrawConfigDodongosCavern = 0x8008252C; // type:func -Scene_DrawConfigTempleOfTime = 0x80082854; // type:func -Scene_DrawConfigGrottos = 0x8008306C; // type:func -Scene_DrawConfigChamberOfTheSages = 0x8008337C; // type:func -Scene_DrawConfigGreatFairyFountain = 0x800835A0; // type:func -Scene_DrawConfigGraveExitLightShining = 0x80083738; // type:func -Scene_DrawConfigFairysFountain = 0x80083810; // type:func -Scene_DrawConfigShadowTempleAndWell = 0x80083974; // type:func -Scene_DrawConfigThievesHideout = 0x80083B00; // type:func -Scene_DrawConfigWaterTemple = 0x80083BE8; // type:func -Scene_DrawConfigWaterTempleBoss = 0x80084340; // type:func -Scene_DrawConfigShootingGallery = 0x80084460; // type:func -Scene_DrawConfigCastleCourtyardGuards = 0x80084514; // type:func -Scene_DrawConfigOutsideGanonsCastle = 0x8008468C; // type:func -func_8009BEEC = 0x80084928; // type:func -Scene_DrawConfigGanonsTowerCollapseExterior = 0x80084AE8; // type:func -Scene_DrawConfigIceCavern = 0x80084DF4; // type:func -Scene_DrawConfigRoyalFamilysTomb = 0x80084FE4; // type:func -Scene_DrawConfigLakesideLaboratory = 0x80085268; // type:func -Scene_DrawConfigCalmWater = 0x80085448; // type:func -Scene_DrawConfigGerudoTrainingGround = 0x80085550; // type:func -Gfx_TwoTexScrollPrimColor = 0x80085740; // type:func -Scene_DrawConfigFishingPond = 0x800858A0; // type:func -Scene_DrawConfigBombchuBowlingAlley = 0x800859CC; // type:func -Scene_DrawConfigLonLonBuildings = 0x80085BD0; // type:func -Scene_DrawConfigMarketGuardHouse = 0x80085CA0; // type:func -Scene_DrawConfigPotionShopGranny = 0x80085DD0; // type:func -Scene_DrawConfigForestTemple = 0x80085F48; // type:func -Scene_DrawConfigSpiritTemple = 0x80086138; // type:func -Scene_DrawConfigHyruleField = 0x800861A8; // type:func -Scene_DrawConfigKakarikoVillage = 0x800864A4; // type:func -Scene_DrawConfigZorasRiver = 0x80086574; // type:func -Scene_DrawConfigKokiriForest = 0x8008678C; // type:func -Scene_DrawConfigLakeHylia = 0x80086BF0; // type:func -Scene_DrawConfigZorasDomain = 0x80086DB0; // type:func -Scene_DrawConfigZorasFountain = 0x80086F0C; // type:func -Scene_DrawConfigGerudoValley = 0x800870FC; // type:func -Scene_DrawConfigLostWoods = 0x80087438; // type:func -Scene_DrawConfigDesertColossus = 0x80087634; // type:func -Scene_DrawConfigGerudosFortress = 0x80087740; // type:func -Scene_DrawConfigHauntedWasteland = 0x800877B0; // type:func -Scene_DrawConfigHyruleCastle = 0x80087928; // type:func -Scene_DrawConfigDeathMountainTrail = 0x80087ACC; // type:func -Scene_DrawConfigDeathMountainCrater = 0x80087C90; // type:func -Scene_DrawConfigGoronCity = 0x80087E5C; // type:func -Scene_DrawConfigLonLonRanch = 0x80087FCC; // type:func -Scene_DrawConfigFireTemple = 0x8008809C; // type:func -Scene_DrawConfigJabuJabu = 0x80088240; // type:func -Scene_DrawConfigInsideGanonsCastle = 0x800886EC; // type:func -Scene_DrawConfigInsideGanonsCastleCollapse = 0x800888F0; // type:func -Scene_DrawConfigGanonsTowerCollapseInterior = 0x80088910; // type:func -Scene_DrawConfigBesitu = 0x80088930; // type:func -Scene_Draw = 0x80088A68; // type:func -SkelAnime_DrawLimbLod = 0x80088AA0; // type:func -SkelAnime_DrawLod = 0x80088D08; // type:func -SkelAnime_DrawFlexLimbLod = 0x80088EF8; // type:func -SkelAnime_DrawFlexLod = 0x80089188; // type:func -SkelAnime_DrawLimbOpa = 0x80089400; // type:func -SkelAnime_DrawOpa = 0x8008964C; // type:func -SkelAnime_DrawFlexLimbOpa = 0x8008982C; // type:func -SkelAnime_DrawFlexOpa = 0x80089AA4; // type:func -SkelAnime_GetFrameData = 0x80089D08; // type:func -Animation_GetLength = 0x80089E70; // type:func -Animation_GetLastFrame = 0x80089EAC; // type:func -SkelAnime_DrawLimb = 0x80089EF4; // type:func -SkelAnime_Draw = 0x8008A134; // type:func -SkelAnime_DrawFlexLimb = 0x8008A324; // type:func -SkelAnime_DrawFlex = 0x8008A5B4; // type:func -SkelAnime_GetFrameDataLegacy = 0x8008A81C; // type:func -Animation_GetLimbCountLegacy = 0x8008AC20; // type:func -Animation_GetLengthLegacy = 0x8008AC5C; // type:func -Animation_GetLastFrameLegacy = 0x8008AC98; // type:func -SkelAnime_InterpFrameTable = 0x8008ACE0; // type:func -AnimationContext_Reset = 0x8008B160; // type:func -AnimationContext_SetNextQueue = 0x8008B16C; // type:func -AnimationContext_DisableQueue = 0x8008B18C; // type:func -AnimationContext_AddEntry = 0x8008B1B4; // type:func -AnimationContext_SetLoadFrame = 0x8008B1EC; // type:func -AnimationContext_SetCopyAll = 0x8008B2E8; // type:func -AnimationContext_SetInterp = 0x8008B350; // type:func -AnimationContext_SetCopyTrue = 0x8008B3C0; // type:func -AnimationContext_SetCopyFalse = 0x8008B430; // type:func -AnimationContext_SetMoveActor = 0x8008B4A0; // type:func -AnimationContext_LoadFrame = 0x8008B4FC; // type:func -AnimationContext_CopyAll = 0x8008B52C; // type:func -AnimationContext_Interp = 0x8008B59C; // type:func -AnimationContext_CopyTrue = 0x8008B5F8; // type:func -AnimationContext_CopyFalse = 0x8008B678; // type:func -AnimationContext_MoveActor = 0x8008B6FC; // type:func -AnimationContext_Update = 0x8008B790; // type:func -SkelAnime_InitLink = 0x8008B830; // type:func -LinkAnimation_SetUpdateFunction = 0x8008B994; // type:func -LinkAnimation_Update = 0x8008B9CC; // type:func -LinkAnimation_Morph = 0x8008B9F0; // type:func -LinkAnimation_AnimateFrame = 0x8008BAAC; // type:func -LinkAnimation_Loop = 0x8008BB88; // type:func -LinkAnimation_Once = 0x8008BC28; // type:func -Animation_SetMorph = 0x8008BD04; // type:func -LinkAnimation_Change = 0x8008BD28; // type:func -LinkAnimation_PlayOnce = 0x8008BEA0; // type:func -LinkAnimation_PlayOnceSetSpeed = 0x8008BF00; // type:func -LinkAnimation_PlayLoop = 0x8008BF64; // type:func -LinkAnimation_PlayLoopSetSpeed = 0x8008BFC0; // type:func -LinkAnimation_CopyJointToMorph = 0x8008C020; // type:func -LinkAnimation_CopyMorphToJoint = 0x8008C050; // type:func -LinkAnimation_LoadToMorph = 0x8008C080; // type:func -LinkAnimation_LoadToJoint = 0x8008C0C4; // type:func -LinkAnimation_InterpJointMorph = 0x8008C108; // type:func -LinkAnimation_BlendToJoint = 0x8008C140; // type:func -LinkAnimation_BlendToMorph = 0x8008C1E0; // type:func -LinkAnimation_EndLoop = 0x8008C280; // type:func -Animation_OnFrameImpl = 0x8008C2A4; // type:func -LinkAnimation_OnFrame = 0x8008C35C; // type:func -SkelAnime_Init = 0x8008C3AC; // type:func -SkelAnime_InitFlex = 0x8008C4B0; // type:func -SkelAnime_InitSkin = 0x8008C5BC; // type:func -SkelAnime_SetUpdate = 0x8008C69C; // type:func -SkelAnime_Update = 0x8008C6E8; // type:func -SkelAnime_Morph = 0x8008C70C; // type:func -SkelAnime_MorphTaper = 0x8008C7CC; // type:func -SkelAnime_AnimateFrame = 0x8008C954; // type:func -SkelAnime_LoopFull = 0x8008CA9C; // type:func -SkelAnime_LoopPartial = 0x8008CB3C; // type:func -SkelAnime_Once = 0x8008CBE4; // type:func -Animation_ChangeImpl = 0x8008CCE8; // type:func -Animation_Change = 0x8008CEA4; // type:func -Animation_PlayOnce = 0x8008CEEC; // type:func -Animation_MorphToPlayOnce = 0x8008CF44; // type:func -Animation_PlayOnceSetSpeed = 0x8008CFA0; // type:func -Animation_PlayLoop = 0x8008CFFC; // type:func -Animation_MorphToLoop = 0x8008D050; // type:func -Animation_PlayLoopSetSpeed = 0x8008D088; // type:func -Animation_EndLoop = 0x8008D0E0; // type:func -Animation_Reverse = 0x8008D10C; // type:func -SkelAnime_CopyFrameTableTrue = 0x8008D130; // type:func -SkelAnime_CopyFrameTableFalse = 0x8008D198; // type:func -SkelAnime_UpdateTranslation = 0x8008D204; // type:func -Animation_OnFrame = 0x8008D3D0; // type:func -SkelAnime_Free = 0x8008D3F8; // type:func -SkelAnime_CopyFrameTable = 0x8008D444; // type:func -Skin_UpdateVertices = 0x8008D490; // type:func -Skin_ApplyLimbModifications = 0x8008D65C; // type:func -Skin_DrawAnimatedLimb = 0x8008DAC8; // type:func -Skin_DrawLimb = 0x8008DBA4; // type:func -Skin_DrawImpl = 0x8008DCCC; // type:func -func_800A6330 = 0x8008DEF8; // type:func -func_800A6360 = 0x8008DF28; // type:func -func_800A6394 = 0x8008DF5C; // type:func -func_800A63CC = 0x8008DF94; // type:func -Skin_GetLimbPos = 0x8008DFD0; // type:func -Skin_InitAnimatedLimb = 0x8008E030; // type:func -Skin_Init = 0x8008E20C; // type:func -Skin_Free = 0x8008E3DC; // type:func -func_800A698C = 0x8008E4B0; // type:func -Skin_ApplyAnimTransformations = 0x8008E5EC; // type:func -SkinMatrix_Vec3fMtxFMultXYZW = 0x8008E940; // type:func -SkinMatrix_Vec3fMtxFMultXYZ = 0x8008EA28; // type:func -SkinMatrix_MtxFMtxFMult = 0x8008EAD8; // type:func -SkinMatrix_GetClear = 0x8008EE34; // type:func -SkinMatrix_Clear = 0x8008EE48; // type:func -SkinMatrix_MtxFCopy = 0x8008EEA0; // type:func -SkinMatrix_Invert = 0x8008EF28; // type:func -SkinMatrix_SetScale = 0x8008F1C8; // type:func -SkinMatrix_SetRotateZYX = 0x8008F22C; // type:func -SkinMatrix_SetRotateYXZ = 0x8008F3BC; // type:func -SkinMatrix_SetTranslate = 0x8008F54C; // type:func -SkinMatrix_SetTranslateRotateZYXScale = 0x8008F5B0; // type:func -SkinMatrix_SetTranslateRotateYXZScale = 0x8008F634; // type:func -SkinMatrix_SetTranslateRotateZYX = 0x8008F6B8; // type:func -SkinMatrix_Vec3fToVec3s = 0x8008F718; // type:func -SkinMatrix_Vec3sToVec3f = 0x8008F75C; // type:func -SkinMatrix_MtxFToMtx = 0x8008F7A0; // type:func -SkinMatrix_MtxFToNewMtx = 0x8008F9B8; // type:func -SkinMatrix_SetRotateAxis = 0x8008FA00; // type:func -func_800A8030 = 0x8008FB70; // type:func -Sram_InitNewSave = 0x8008FCE0; // type:func -Sram_InitDebugSave = 0x8008FE0C; // type:func -Sram_OpenSave = 0x8008FFCC; // type:func -Sram_WriteSave = 0x80090310; // type:func -Sram_VerifyAndLoadAllSaves = 0x8009045C; // type:func -Sram_InitSave = 0x80090988; // type:func -Sram_EraseSave = 0x80090C54; // type:func -Sram_CopySave = 0x80090D6C; // type:func -Sram_WriteSramHeader = 0x80090F88; // type:func -Sram_InitSram = 0x80090FBC; // type:func -Sram_Alloc = 0x800910D4; // type:func -Sram_Init = 0x80091104; // type:func -SsSram_Init = 0x80091120; // type:func -SsSram_Dma = 0x800911F8; // type:func -SsSram_ReadWrite = 0x80091284; // type:func -Rumble_Update = 0x800912F0; // type:func -Rumble_Override = 0x8009132C; // type:func -Rumble_Request = 0x800913C8; // type:func -Rumble_Init = 0x80091484; // type:func -Rumble_Destroy = 0x800914C0; // type:func -Rumble_Controller1HasRumblePak = 0x80091518; // type:func -Rumble_Reset = 0x80091530; // type:func -Rumble_ClearRequests = 0x80091544; // type:func -Rumble_SetUpdateEnabled = 0x80091554; // type:func -View_ViewportToVp = 0x80091570; // type:func -View_New = 0x800915DC; // type:func -View_Free = 0x80091628; // type:func -View_Init = 0x80091648; // type:func -View_LookAt = 0x80091708; // type:func -View_LookAtUnsafe = 0x800917A4; // type:func -View_SetScale = 0x800917F4; // type:func -View_GetScale = 0x80091814; // type:func -View_SetPerspective = 0x80091824; // type:func -View_GetPerspective = 0x80091854; // type:func -View_SetOrtho = 0x80091874; // type:func -View_GetOrtho = 0x800918B0; // type:func -View_SetViewport = 0x800918D0; // type:func -View_GetViewport = 0x80091904; // type:func -View_ApplyLetterbox = 0x8009192C; // type:func -View_SetDistortionOrientation = 0x80091A6C; // type:func -View_SetDistortionScale = 0x80091A90; // type:func -View_SetDistortionSpeed = 0x80091AB4; // type:func -View_InitDistortion = 0x80091AC8; // type:func -View_ClearDistortion = 0x80091B2C; // type:func -View_SetDistortion = 0x80091B60; // type:func -View_StepDistortion = 0x80091BB4; // type:func -View_Apply = 0x80091D6C; // type:func -View_ApplyPerspective = 0x80091DB8; // type:func -View_ApplyOrtho = 0x800920AC; // type:func -View_ApplyOrthoToOverlay = 0x80092258; // type:func -View_ApplyPerspectiveToOverlay = 0x8009248C; // type:func -View_UpdateViewingMatrix = 0x800927DC; // type:func -View_ApplyTo = 0x80092848; // type:func -ViMode_LogPrint = 0x80092C70; // type:func -ViMode_Configure = 0x80092C7C; // type:func -ViMode_Save = 0x80093224; // type:func -ViMode_Load = 0x80093304; // type:func -ViMode_Init = 0x8009338C; // type:func -ViMode_Destroy = 0x800933F4; // type:func -ViMode_ConfigureFeatures = 0x80093400; // type:func -ViMode_Update = 0x80093464; // type:func -VisCvg_Init = 0x800937E0; // type:func -VisCvg_Destroy = 0x80093804; // type:func -VisCvg_Draw = 0x80093810; // type:func -VisMono_Init = 0x80093980; // type:func -VisMono_Destroy = 0x800939D0; // type:func -VisMono_DesaturateTLUT = 0x800939F4; // type:func -VisMono_DesaturateDList = 0x80093D08; // type:func -VisMono_Draw = 0x80093F38; // type:func -VisMono_DrawOld = 0x8009412C; // type:func -VisZBuf_Init = 0x800941A0; // type:func -VisZBuf_Destroy = 0x800941D4; // type:func -VisZBuf_Draw = 0x800941E0; // type:func -Skybox_CalculateFace256 = 0x80094430; // type:func -Skybox_CalculateFace128 = 0x80094B40; // type:func -Skybox_Calculate256 = 0x80095848; // type:func -Skybox_Calculate128 = 0x800959F8; // type:func -Skybox_Setup = 0x80095A98; // type:func -Skybox_Init = 0x80096BEC; // type:func -Skybox_UpdateMatrix = 0x80096D00; // type:func -Skybox_Draw = 0x80096D88; // type:func -Skybox_Update = 0x800973D0; // type:func -PlayerCall_InitFuncPtrs = 0x800973E0; // type:func -PlayerCall_Init = 0x80097448; // type:func -PlayerCall_Destroy = 0x80097490; // type:func -PlayerCall_Update = 0x800974D0; // type:func -PlayerCall_Draw = 0x80097510; // type:func -TransitionTile_InitGraphics = 0x80097550; // type:func -TransitionTile_InitVtxData = 0x8009791C; // type:func -TransitionTile_Destroy = 0x800979DC; // type:func -TransitionTile_Init = 0x80097A68; // type:func -TransitionTile_SetVtx = 0x80097BE0; // type:func -TransitionTile_Draw = 0x80097CF4; // type:func -TransitionTile_Suck = 0x80097E20; // type:func -TransitionTile_Update = 0x80097F54; // type:func -func_800B23F0 = 0x80097F60; // type:func -TransitionTriforce_Start = 0x80097F70; // type:func -TransitionTriforce_Init = 0x80097FA8; // type:func -TransitionTriforce_Destroy = 0x80098048; // type:func -TransitionTriforce_Update = 0x80098054; // type:func -TransitionTriforce_SetColor = 0x80098168; // type:func -TransitionTriforce_SetType = 0x80098174; // type:func -TransitionTriforce_SetState = 0x80098180; // type:func -TransitionTriforce_Draw = 0x8009818C; // type:func -TransitionTriforce_IsDone = 0x8009849C; // type:func -TransitionWipe_Start = 0x80098530; // type:func -TransitionWipe_Init = 0x800985E8; // type:func -TransitionWipe_Destroy = 0x80098614; // type:func -TransitionWipe_Update = 0x80098620; // type:func -TransitionWipe_Draw = 0x80098700; // type:func -TransitionWipe_IsDone = 0x8009893C; // type:func -TransitionWipe_SetType = 0x80098948; // type:func -TransitionWipe_SetColor = 0x80098988; // type:func -TransitionWipe_SetUnkColor = 0x80098994; // type:func -TransitionCircle_Start = 0x800989A0; // type:func -TransitionCircle_Init = 0x80098B8C; // type:func -TransitionCircle_Destroy = 0x80098BB8; // type:func -TransitionCircle_Update = 0x80098BC4; // type:func -TransitionCircle_Draw = 0x80098D48; // type:func -TransitionCircle_IsDone = 0x80098FE4; // type:func -TransitionCircle_SetType = 0x80098FF0; // type:func -TransitionCircle_SetColor = 0x80099048; // type:func -TransitionCircle_SetUnkColor = 0x80099054; // type:func -TransitionFade_Start = 0x80099060; // type:func -TransitionFade_Init = 0x800990BC; // type:func -TransitionFade_Destroy = 0x800990E8; // type:func -TransitionFade_Update = 0x800990F4; // type:func -TransitionFade_Draw = 0x80099284; // type:func -TransitionFade_IsDone = 0x80099350; // type:func -TransitionFade_SetColor = 0x8009935C; // type:func -TransitionFade_SetType = 0x80099368; // type:func -Letterbox_SetSizeTarget = 0x800993C0; // type:func -Letterbox_GetSizeTarget = 0x800993D0; // type:func -Letterbox_SetSize = 0x800993E0; // type:func -Letterbox_GetSize = 0x800993F0; // type:func -Letterbox_Init = 0x80099400; // type:func -Letterbox_Destroy = 0x80099420; // type:func -Letterbox_Update = 0x80099430; // type:func -func_800BB0A0 = 0x80099530; // type:func -func_800BB2B4 = 0x80099744; // type:func -KaleidoManager_LoadOvl = 0x80099A00; // type:func -KaleidoManager_ClearOvl = 0x80099A5C; // type:func -KaleidoManager_Init = 0x80099AAC; // type:func -KaleidoManager_Destroy = 0x80099B1C; // type:func -KaleidoManager_GetRamAddr = 0x80099B5C; // type:func -KaleidoScopeCall_LoadPlayer = 0x80099C30; // type:func -KaleidoScopeCall_Init = 0x80099C7C; // type:func -KaleidoScopeCall_Destroy = 0x80099CC8; // type:func -KaleidoScopeCall_Update = 0x80099CE8; // type:func -KaleidoScopeCall_Draw = 0x80099E88; // type:func -Play_RequestViewpointBgCam = 0x80099F10; // type:func -Play_SetViewpoint = 0x80099F50; // type:func -Play_CheckViewpoint = 0x80099FFC; // type:func -Play_SetShopBrowsingViewpoint = 0x8009A024; // type:func -Play_SetupTransition = 0x8009A050; // type:func -func_800BC88C = 0x8009A2FC; // type:func -Play_SetFog = 0x8009A314; // type:func -Play_Destroy = 0x8009A360; // type:func -Play_Init = 0x8009A4CC; // type:func -Play_Update = 0x8009AC84; // type:func -Play_DrawOverlayElements = 0x8009BD78; // type:func -Play_Draw = 0x8009BE10; // type:func -Play_Main = 0x8009C854; // type:func -Play_InCsMode = 0x8009C894; // type:func -func_800BFCB8 = 0x8009C8C8; // type:func -Play_LoadFile = 0x8009CA74; // type:func -Play_InitEnvironment = 0x8009CAD0; // type:func -Play_InitScene = 0x8009CB18; // type:func -Play_SpawnScene = 0x8009CC1C; // type:func -Play_GetScreenPos = 0x8009CCC4; // type:func -Play_CreateSubCamera = 0x8009CD88; // type:func -Play_GetActiveCamId = 0x8009CE38; // type:func -Play_ChangeCameraStatus = 0x8009CE44; // type:func -Play_ClearCamera = 0x8009CEB4; // type:func -Play_ClearAllSubCameras = 0x8009CF1C; // type:func -Play_GetCamera = 0x8009CF88; // type:func -Play_SetCameraAtEye = 0x8009CFC0; // type:func -Play_SetCameraAtEyeUp = 0x8009D0D0; // type:func -Play_SetCameraFov = 0x8009D1F4; // type:func -Play_SetCameraRoll = 0x8009D23C; // type:func -Play_CopyCamera = 0x8009D288; // type:func -Play_InitCameraDataUsingPlayer = 0x8009D304; // type:func -Play_RequestCameraSetting = 0x8009D374; // type:func -Play_ReturnToMainCam = 0x8009D3B0; // type:func -Play_GetCameraUID = 0x8009D48C; // type:func -func_800C09D8 = 0x8009D4C0; // type:func -Play_SaveSceneFlags = 0x8009D52C; // type:func -Play_SetRespawnData = 0x8009D574; // type:func -Play_SetupRespawnPoint = 0x8009D5E4; // type:func -Play_TriggerVoidOut = 0x8009D650; // type:func -Play_LoadToLastEntrance = 0x8009D6A8; // type:func -Play_TriggerRespawn = 0x8009D77C; // type:func -Play_CamIsNotFixed = 0x8009D7B0; // type:func -FrameAdvance_IsEnabled = 0x8009D820; // type:func -func_800C0D34 = 0x8009D830; // type:func -func_800C0DB4 = 0x8009D8B0; // type:func -PreRender_SetValuesSave = 0x8009D970; // type:func -PreRender_Init = 0x8009D9AC; // type:func -PreRender_SetValues = 0x8009D9E0; // type:func -PreRender_Destroy = 0x8009DA14; // type:func -PreRender_CopyImage = 0x8009DA38; // type:func -PreRender_CopyImageRegionImpl = 0x8009DD00; // type:func -func_800C170C = 0x8009E148; // type:func -func_800C1AE8 = 0x8009E4C4; // type:func -PreRender_CoverageRgba16ToI8 = 0x8009E500; // type:func -PreRender_SaveZBuffer = 0x8009E818; // type:func -PreRender_SaveFramebuffer = 0x8009E850; // type:func -PreRender_FetchFbufCoverage = 0x8009E888; // type:func -PreRender_DrawCoverage = 0x8009E9A0; // type:func -PreRender_RestoreZBuffer = 0x8009E9E4; // type:func -func_800C213C = 0x8009EA08; // type:func -PreRender_RestoreFramebuffer = 0x8009ED38; // type:func -PreRender_CopyImageRegion = 0x8009ED5C; // type:func -PreRender_AntiAliasFilter = 0x8009ED7C; // type:func -PreRender_DivotFilter = 0x8009F83C; // type:func -PreRender_ApplyFilters = 0x8009F990; // type:func -THGA_Init = 0x8009FA60; // type:func -THGA_Destroy = 0x8009FA80; // type:func -THGA_IsCrash = 0x8009FAA0; // type:func -THGA_Reset = 0x8009FAC0; // type:func -THGA_GetRemaining = 0x8009FAE0; // type:func -THGA_GetHead = 0x8009FB00; // type:func -THGA_SetHead = 0x8009FB20; // type:func -THGA_GetTail = 0x8009FB40; // type:func -THGA_AllocDisplayList = 0x8009FB60; // type:func -THGA_AllocGfx = 0x8009FB84; // type:func -THGA_AllocGfx2 = 0x8009FBA4; // type:func -THGA_AllocTail = 0x8009FBC4; // type:func -THGA_AllocMtxArray = 0x8009FBE4; // type:func -THGA_AllocMtx = 0x8009FC08; // type:func -THGA_AllocVtxArray = 0x8009FC28; // type:func -THGA_AllocVtx = 0x8009FC4C; // type:func -THA_GetHead = 0x8009FC70; // type:func -THA_SetHead = 0x8009FC7C; // type:func -THA_GetTail = 0x8009FC88; // type:func -THA_AllocHead = 0x8009FC94; // type:func -THA_AllocHeadByte = 0x8009FCA8; // type:func -THA_AllocTail = 0x8009FCC8; // type:func -THA_AllocTailAlign16 = 0x8009FD58; // type:func -THA_AllocTailAlign = 0x8009FD78; // type:func -THA_GetRemaining = 0x8009FD94; // type:func -THA_IsCrash = 0x8009FDA8; // type:func -THA_Reset = 0x8009FDCC; // type:func -THA_Init = 0x8009FDE8; // type:func -THA_Destroy = 0x8009FE0C; // type:func -AudioMgr_StopAllSfx = 0x8009FE30; // type:func -AudioMgr_NotifyTaskDone = 0x8009FE80; // type:func -AudioMgr_HandleRetrace = 0x8009FEB8; // type:func -AudioMgr_HandlePreNMI = 0x800A0040; // type:func -AudioMgr_ThreadEntry = 0x800A0064; // type:func -AudioMgr_WaitForInit = 0x800A0194; // type:func -AudioMgr_Init = 0x800A01C0; // type:func -Setup_InitImpl = 0x800A0290; // type:func -Setup_Destroy = 0x800A02CC; // type:func -Setup_Init = 0x800A02D8; // type:func -GameState_SetFBFilter = 0x800A0300; // type:func -func_800C4344 = 0x800A0454; // type:func -GameState_Draw = 0x800A0460; // type:func -GameState_SetFrameBuffer = 0x800A0558; // type:func -func_800C49F4 = 0x800A063C; // type:func -GameState_ReqPadData = 0x800A06B4; // type:func -GameState_Update = 0x800A06E4; // type:func -GameState_InitArena = 0x800A0760; // type:func -GameState_Realloc = 0x800A07D0; // type:func -GameState_Init = 0x800A0890; // type:func -GameState_Destroy = 0x800A0988; // type:func -GameState_GetInit = 0x800A0A38; // type:func -GameState_GetSize = 0x800A0A44; // type:func -GameState_IsRunning = 0x800A0A50; // type:func -GameState_GetArenaSize = 0x800A0A5C; // type:func -GameAlloc_Log = 0x800A0A80; // type:func -GameAlloc_Malloc = 0x800A0AA0; // type:func -GameAlloc_Free = 0x800A0B0C; // type:func -GameAlloc_Cleanup = 0x800A0B58; // type:func -GameAlloc_Init = 0x800A0BA8; // type:func -Graph_InitTHGA = 0x800A0BC0; // type:func -Graph_GetNextGameState = 0x800A0CD8; // type:func -Graph_Init = 0x800A0D88; // type:func -Graph_Destroy = 0x800A0DF8; // type:func -Graph_TaskSet00 = 0x800A0E04; // type:func -Graph_Update = 0x800A1148; // type:func -Graph_ThreadEntry = 0x800A13FC; // type:func -Graph_Alloc = 0x800A14F4; // type:func -Graph_Alloc2 = 0x800A1528; // type:func -Gfx_Open = 0x800A1560; // type:func -Gfx_Close = 0x800A156C; // type:func -Gfx_Alloc = 0x800A1584; // type:func -ListAlloc_Init = 0x800A15C0; // type:func -ListAlloc_Alloc = 0x800A15D4; // type:func -ListAlloc_Free = 0x800A1640; // type:func -ListAlloc_FreeAll = 0x800A16C0; // type:func -Main = 0x800A1710; // type:func -PadMgr_AcquireSerialEventQueue = 0x800A1A70; // type:func -PadMgr_ReleaseSerialEventQueue = 0x800A1AA0; // type:func -PadMgr_LockPadData = 0x800A1AC8; // type:func -PadMgr_UnlockPadData = 0x800A1AF4; // type:func -PadMgr_UpdateRumble = 0x800A1B20; // type:func -PadMgr_RumbleStop = 0x800A1D70; // type:func -PadMgr_RumbleReset = 0x800A1E08; // type:func -PadMgr_RumbleSetSingle = 0x800A1E18; // type:func -PadMgr_RumbleSet = 0x800A1E30; // type:func -PadMgr_UpdateInputs = 0x800A1E60; // type:func -PadMgr_HandleRetrace = 0x800A2040; // type:func -PadMgr_HandlePreNMI = 0x800A21D8; // type:func -PadMgr_RequestPadData = 0x800A21FC; // type:func -PadMgr_ThreadEntry = 0x800A2378; // type:func -PadMgr_Init = 0x800A2474; // type:func -Sched_SwapFrameBufferImpl = 0x800A2580; // type:func -Sched_SwapFrameBuffer = 0x800A25F0; // type:func -Sched_HandlePreNMI = 0x800A2640; // type:func -Sched_HandleNMI = 0x800A264C; // type:func -Sched_QueueTask = 0x800A2670; // type:func -Sched_Yield = 0x800A26DC; // type:func -Sched_GfxTaskFramebufferValid = 0x800A2710; // type:func -Sched_Schedule = 0x800A27D4; // type:func -Sched_SetNextFramebufferFromTask = 0x800A2908; // type:func -Sched_TaskComplete = 0x800A2954; // type:func -Sched_RunTask = 0x800A29CC; // type:func -Sched_HandleNotification = 0x800A2B30; // type:func -Sched_HandleRetrace = 0x800A2C20; // type:func -Sched_HandleRSPDone = 0x800A2CF8; // type:func -Sched_HandleRDPDone = 0x800A2F0C; // type:func -Sched_Notify = 0x800A2FD4; // type:func -Sched_ThreadEntry = 0x800A2FF8; // type:func -Sched_Init = 0x800A312C; // type:func -SpeedMeter_InitImpl = 0x800A3200; // type:func -SpeedMeter_Init = 0x800A3210; // type:func -SpeedMeter_Destroy = 0x800A3234; // type:func -SpeedMeter_DrawTimeEntries = 0x800A3240; // type:func -SpeedMeter_InitAllocEntry = 0x800A3704; // type:func -SpeedMeter_DrawAllocEntry = 0x800A3748; // type:func -SpeedMeter_DrawAllocEntries = 0x800A399C; // type:func -SysCfb_Init = 0x800A3C40; // type:func -SysCfb_Reset = 0x800A3D08; // type:func -SysCfb_GetFbPtr = 0x800A3D28; // type:func -SysCfb_GetFbEnd = 0x800A3D50; // type:func -Math_FactorialF = 0x800A3D60; // type:func -Math_Factorial = 0x800A3E60; // type:func -Math_PowF = 0x800A3F24; // type:func -Math_SinF = 0x800A3F4C; // type:func -Math_CosF = 0x800A3FA0; // type:func -Math3D_PlaneVsLineSegClosestPoint = 0x800A4000; // type:func -Math3D_LineVsLineClosestTwoPoints = 0x800A4120; // type:func -Math3D_LineClosestToPoint = 0x800A43CC; // type:func -Math3D_FindPointOnPlaneIntersect = 0x800A44B8; // type:func -Math3D_PlaneVsPlaneNewLine = 0x800A4518; // type:func -Math3D_PlaneVsPlaneVsLineClosestPoint = 0x800A46F8; // type:func -Math3D_PointOnInfiniteLine = 0x800A4774; // type:func -Math3D_LineSplitRatio = 0x800A47C0; // type:func -Math3D_Cos = 0x800A480C; // type:func -Math3D_CosOut = 0x800A4830; // type:func -Math3D_Vec3fReflect = 0x800A48E8; // type:func -Math3D_PointInSquare2D = 0x800A49BC; // type:func -Math3D_CirSquareVsTriSquare = 0x800A4A20; // type:func -Math3D_SphCubeVsTriCube = 0x800A4B60; // type:func -Math3D_Dist1DSq = 0x800A4D84; // type:func -Math3D_Dist1D = 0x800A4D9C; // type:func -Math3D_Dist2DSq = 0x800A4DC0; // type:func -Math3D_Dist2D = 0x800A4E04; // type:func -Math3D_Vec3fMagnitudeSq = 0x800A4E34; // type:func -Math3D_Vec3fMagnitude = 0x800A4E60; // type:func -Math3D_Vec3fDistSq = 0x800A4E88; // type:func -Math3D_Vec3f_DistXYZ = 0x800A4EB0; // type:func -Math3D_DistXYZ16toF = 0x800A4ED0; // type:func -Math3D_Vec3fDiff_CrossZ = 0x800A4F48; // type:func -Math3D_Vec3fDiff_CrossX = 0x800A4F88; // type:func -Math3D_Vec3fDiff_CrossY = 0x800A4FC8; // type:func -Math3D_Vec3f_Cross = 0x800A5008; // type:func -Math3D_SurfaceNorm = 0x800A507C; // type:func -Math3D_PointRelativeToCubeFaces = 0x800A50E4; // type:func -Math3D_PointRelativeToCubeEdges = 0x800A5190; // type:func -Math3D_PointRelativeToCubeVertices = 0x800A5340; // type:func -Math3D_LineVsCube = 0x800A54BC; // type:func -Math3D_LineVsCubeShort = 0x800A5F34; // type:func -Math3D_RotateXZPlane = 0x800A60A0; // type:func -Math3D_DefPlane = 0x800A612C; // type:func -Math3D_Planef = 0x800A6240; // type:func -Math3D_Plane = 0x800A6280; // type:func -Math3D_UDistPlaneToPos = 0x800A62BC; // type:func -Math3D_DistPlaneToPos = 0x800A62F4; // type:func -Math3D_TriChkPointParaYImpl = 0x800A6378; // type:func -Math3D_TriChkPointParaYDeterminate = 0x800A6694; // type:func -Math3D_TriChkPointParaYSlopedY = 0x800A66DC; // type:func -Math3D_TriChkPointParaYIntersectDist = 0x800A672C; // type:func -Math3D_TriChkPointParaYIntersectInsideTri = 0x800A67DC; // type:func -Math3D_TriChkPointParaY = 0x800A6888; // type:func -Math3D_TriChkLineSegParaYIntersect = 0x800A6904; // type:func -Math3D_TriChkPointParaYDist = 0x800A6A78; // type:func -Math3D_TriChkPointParaXImpl = 0x800A6AEC; // type:func -Math3D_TriChkPointParaXDeterminate = 0x800A6E08; // type:func -Math3D_TriChkPointParaXIntersect = 0x800A6E50; // type:func -Math3D_TriChkPointParaX = 0x800A6F04; // type:func -Math3D_TriChkLineSegParaXIntersect = 0x800A6F80; // type:func -Math3D_TriChkPointParaXDist = 0x800A7108; // type:func -Math3D_TriChkPointParaZImpl = 0x800A717C; // type:func -Math3D_TriChkPointParaZDeterminate = 0x800A74C4; // type:func -Math3D_TriChkPointParaZIntersect = 0x800A750C; // type:func -Math3D_TriChkPointParaZ = 0x800A75C0; // type:func -Math3D_TriChkLineSegParaZIntersect = 0x800A763C; // type:func -Math3D_TriChkLineSegParaZDist = 0x800A77C8; // type:func -Math3D_LineSegFindPlaneIntersect = 0x800A783C; // type:func -Math3D_LineSegVsPlane = 0x800A7918; // type:func -Math3D_TriLineIntersect = 0x800A7A20; // type:func -Math3D_TriNorm = 0x800A7B84; // type:func -Math3D_PointInSph = 0x800A7C34; // type:func -Math3D_PointDistSqToLine2D = 0x800A7C84; // type:func -Math3D_LineVsSph = 0x800A7DCC; // type:func -Math3D_GetSphVsTriIntersectPoint = 0x800A7FD4; // type:func -Math3D_TriVsSphIntersect = 0x800A8114; // type:func -Math3D_PointInCyl = 0x800A8534; // type:func -Math3D_CylVsLineSeg = 0x800A85F0; // type:func -Math3D_CylTriVsIntersect = 0x800A8FB8; // type:func -Math3D_CylVsTri = 0x800A9438; // type:func -Math3D_SphVsSph = 0x800A9458; // type:func -Math3D_SphVsSphOverlap = 0x800A9478; // type:func -Math3D_SphVsSphOverlapCenterDist = 0x800A9498; // type:func -Math3D_SphVsCylOverlap = 0x800A9570; // type:func -Math3D_SphVsCylOverlapCenterDist = 0x800A9590; // type:func -Math3D_CylVsCylOverlap = 0x800A9700; // type:func -Math3D_CylVsCylOverlapCenterDist = 0x800A9720; // type:func -Math3D_TriVsTriIntersect = 0x800A98F0; // type:func -Math3D_XZInSphere = 0x800A9C70; // type:func -Math3D_XYInSphere = 0x800A9CE4; // type:func -Math3D_YZInSphere = 0x800A9D58; // type:func -Math_GetAtan2Tbl = 0x800A9DD0; // type:func -Math_Atan2S = 0x800A9E48; // type:func -Math_Atan2F = 0x800A9FC0; // type:func -Matrix_Init = 0x800AA000; // type:func -Matrix_Push = 0x800AA03C; // type:func -Matrix_Pop = 0x800AA074; // type:func -Matrix_Get = 0x800AA090; // type:func -Matrix_Put = 0x800AA0B4; // type:func -Matrix_GetCurrent = 0x800AA0DC; // type:func -Matrix_Mult = 0x800AA0EC; // type:func -Matrix_Translate = 0x800AA144; // type:func -Matrix_Scale = 0x800AA24C; // type:func -Matrix_RotateX = 0x800AA330; // type:func -Matrix_RotateY = 0x800AA4E4; // type:func -Matrix_RotateZ = 0x800AA69C; // type:func -Matrix_RotateZYX = 0x800AA850; // type:func -Matrix_TranslateRotateZYX = 0x800AAB0C; // type:func -Matrix_SetTranslateRotateYXZ = 0x800AAE60; // type:func -Matrix_MtxFToMtx = 0x800AB00C; // type:func -Matrix_ToMtx = 0x800AB228; // type:func -Matrix_NewMtx = 0x800AB250; // type:func -Matrix_MtxFToNewMtx = 0x800AB27C; // type:func -Matrix_MultVec3f = 0x800AB2A8; // type:func -Matrix_MtxFCopy = 0x800AB360; // type:func -Matrix_MtxToMtxF = 0x800AB468; // type:func -Matrix_MultVec3fExt = 0x800AB6BC; // type:func -Matrix_Transpose = 0x800AB76C; // type:func -Matrix_ReplaceRotation = 0x800AB7A4; // type:func -Matrix_MtxFToYXZRotS = 0x800AB8A0; // type:func -Matrix_MtxFToZYXRotS = 0x800ABA38; // type:func -Matrix_RotateAxis = 0x800ABBD0; // type:func -Matrix_SetTranslateUniformScaleMtxF = 0x800AC038; // type:func -Matrix_SetTranslateUniformScaleMtx = 0x800AC0A0; // type:func -Matrix_SetTranslateUniformScaleMtx2 = 0x800AC0F0; // type:func -Matrix_SetTranslateScaleMtx1 = 0x800AC1E0; // type:func -Matrix_SetTranslateScaleMtx2 = 0x800AC300; // type:func -SysUcode_GetUCodeBoot = 0x800AC400; // type:func -SysUcode_GetUCodeBootSize = 0x800AC410; // type:func -SysUcode_GetUCode = 0x800AC42C; // type:func -SysUcode_GetUCodeData = 0x800AC43C; // type:func -RumbleMgr_Update = 0x800AC450; // type:func -RumbleMgr_Init = 0x800AC760; // type:func -RumbleMgr_Destroy = 0x800AC798; // type:func -func_800D31A0 = 0x800AC7B0; // type:func -IrqMgr_AddClient = 0x800AC7E0; // type:func -IrqMgr_RemoveClient = 0x800AC86C; // type:func -IrqMgr_SendMesgToClients = 0x800AC8F8; // type:func -IrqMgr_JamMesgToClients = 0x800AC95C; // type:func -IrqMgr_HandlePreNMI = 0x800AC9C0; // type:func -IrqMgr_CheckStacks = 0x800ACA58; // type:func -IrqMgr_HandlePreNMI450 = 0x800ACA78; // type:func -IrqMgr_HandlePreNMI480 = 0x800ACAF4; // type:func -IrqMgr_HandlePreNMI500 = 0x800ACB88; // type:func -IrqMgr_HandleRetrace = 0x800ACBAC; // type:func -IrqMgr_ThreadEntry = 0x800ACC64; // type:func -IrqMgr_Init = 0x800ACD38; // type:func -Fault_SleepImpl = 0x800ACE00; // type:func -Fault_ClientProcessThread = 0x800ACE70; // type:func -Fault_ClientRunTask = 0x800ACEE4; // type:func -Fault_ProcessClient = 0x800AD068; // type:func -Fault_AddClient = 0x800AD0BC; // type:func -Fault_RemoveClient = 0x800AD1A0; // type:func -Fault_AddAddrConvClient = 0x800AD298; // type:func -Fault_RemoveAddrConvClient = 0x800AD370; // type:func -Fault_ConvertAddress = 0x800AD468; // type:func -Fault_Sleep = 0x800AD51C; // type:func -Fault_PadCallback = 0x800AD558; // type:func -Fault_UpdatePadImpl = 0x800AD594; // type:func -Fault_WaitForInputImpl = 0x800AD5E0; // type:func -Fault_WaitForInput = 0x800AD72C; // type:func -Fault_DrawRec = 0x800AD778; // type:func -Fault_FillScreenBlack = 0x800AD7D8; // type:func -Fault_FillScreenRed = 0x800AD82C; // type:func -Fault_DrawCornerRec = 0x800AD880; // type:func -Fault_PrintFReg = 0x800AD8D4; // type:func -Fault_LogFReg = 0x800AD980; // type:func -Fault_PrintFPCSR = 0x800ADA30; // type:func -Fault_LogFPCSR = 0x800ADAD4; // type:func -Fault_PrintThreadContext = 0x800ADB6C; // type:func -Fault_LogThreadContext = 0x800ADE88; // type:func -Fault_FindFaultedThread = 0x800AE184; // type:func -Fault_Wait5Seconds = 0x800AE20C; // type:func -Fault_WaitForButtonCombo = 0x800AE29C; // type:func -Fault_DrawMemDumpContents = 0x800AE568; // type:func -Fault_DrawMemDump = 0x800AE6D4; // type:func -Fault_WalkStack = 0x800AE8D8; // type:func -Fault_DrawStackTrace = 0x800AEA68; // type:func -Fault_LogStackTrace = 0x800AEBE8; // type:func -Fault_ResumeThread = 0x800AED58; // type:func -Fault_DisplayFrameBuffer = 0x800AEDD4; // type:func -Fault_ProcessClients = 0x800AEE94; // type:func -Fault_UpdatePad = 0x800AEF74; // type:func -Fault_ThreadEntry = 0x800AEFB0; // type:func -Fault_SetFrameBuffer = 0x800AF310; // type:func -Fault_Init = 0x800AF364; // type:func -Fault_HungupFaultClient = 0x800AF498; // type:func -Fault_AddHungupAndCrashImpl = 0x800AF594; // type:func -Fault_AddHungupAndCrash = 0x800AF5EC; // type:func -FaultDrawer_SetOsSyncPrintfEnabled = 0x800AF650; // type:func -FaultDrawer_DrawRecImpl = 0x800AF660; // type:func -FaultDrawer_DrawChar = 0x800AF77C; // type:func -FaultDrawer_ColorToPrintColor = 0x800AF8EC; // type:func -FaultDrawer_UpdatePrintColor = 0x800AF99C; // type:func -FaultDrawer_SetForeColor = 0x800AFA3C; // type:func -FaultDrawer_SetBackColor = 0x800AFA84; // type:func -FaultDrawer_SetFontColor = 0x800AFACC; // type:func -FaultDrawer_SetCharPad = 0x800AFB14; // type:func -FaultDrawer_SetCursor = 0x800AFB44; // type:func -FaultDrawer_FillScreen = 0x800AFC3C; // type:func -FaultDrawer_PrintCallback = 0x800AFCCC; // type:func -FaultDrawer_VPrintf = 0x800AFED8; // type:func -FaultDrawer_Printf = 0x800AFF28; // type:func -FaultDrawer_DrawText = 0x800AFF78; // type:func -FaultDrawer_SetDrawerFB = 0x800AFFC8; // type:func -FaultDrawer_SetInputCallback = 0x800AFFF4; // type:func -FaultDrawer_WritebackFBDCache = 0x800B0004; // type:func -FaultDrawer_Init = 0x800B0060; // type:func -Kanji_OffsetFromShiftJIS = 0x800B00D0; // type:func -sNonKanjiIndices = 0x800B0168; // type:func -AudioSynth_InitNextRingBuf = 0x800B0BC0; // type:func -func_800DB03C = 0x800B0F3C; // type:func -AudioSynth_Update = 0x800B0FC4; // type:func -func_800DB2C0 = 0x800B11C0; // type:func -AudioSynth_LoadRingBuffer1AtTemp = 0x800B1230; // type:func -AudioSynth_SaveRingBuffer1AtTemp = 0x800B12D8; // type:func -AudioSynth_LeakReverb = 0x800B1380; // type:func -func_800DB4E4 = 0x800B13E4; // type:func -func_800DB680 = 0x800B1580; // type:func -func_800DB828 = 0x800B1728; // type:func -AudioSynth_FilterReverb = 0x800B1940; // type:func -AudioSynth_MaybeMixRingBuffer1 = 0x800B19E8; // type:func -func_800DBB94 = 0x800B1A94; // type:func -AudioSynth_ClearBuffer = 0x800B1A9C; // type:func -func_800DBBBC = 0x800B1ABC; // type:func -func_800DBBC4 = 0x800B1AC4; // type:func -func_800DBBCC = 0x800B1ACC; // type:func -AudioSynth_Mix = 0x800B1AD4; // type:func -func_800DBC08 = 0x800B1B08; // type:func -func_800DBC10 = 0x800B1B10; // type:func -func_800DBC18 = 0x800B1B18; // type:func -AudioSynth_SetBuffer = 0x800B1B20; // type:func -func_800DBC54 = 0x800B1B54; // type:func -func_800DBC5C = 0x800B1B5C; // type:func -AudioSynth_DMemMove = 0x800B1B64; // type:func -func_800DBC90 = 0x800B1B90; // type:func -func_800DBC98 = 0x800B1B98; // type:func -func_800DBCA0 = 0x800B1BA0; // type:func -func_800DBCA8 = 0x800B1BA8; // type:func -AudioSynth_InterL = 0x800B1BB0; // type:func -AudioSynth_EnvSetup1 = 0x800B1BD4; // type:func -func_800DBD08 = 0x800B1C08; // type:func -AudioSynth_LoadBuffer = 0x800B1C10; // type:func -AudioSynth_SaveBuffer = 0x800B1C38; // type:func -AudioSynth_EnvSetup2 = 0x800B1C60; // type:func -func_800DBD7C = 0x800B1C7C; // type:func -func_800DBD84 = 0x800B1C84; // type:func -func_800DBD8C = 0x800B1C8C; // type:func -AudioSynth_S8Dec = 0x800B1C94; // type:func -AudioSynth_HiLoGain = 0x800B1CB0; // type:func -AudioSynth_UnkCmd19 = 0x800B1CE4; // type:func -func_800DBE18 = 0x800B1D18; // type:func -func_800DBE20 = 0x800B1D20; // type:func -func_800DBE28 = 0x800B1D28; // type:func -func_800DBE30 = 0x800B1D30; // type:func -AudioSynth_UnkCmd3 = 0x800B1D38; // type:func -func_800DBE5C = 0x800B1D5C; // type:func -func_800DBE64 = 0x800B1D64; // type:func -func_800DBE6C = 0x800B1D6C; // type:func -AudioSynth_LoadFilterBuffer = 0x800B1D74; // type:func -AudioSynth_LoadFilterSize = 0x800B1D98; // type:func -AudioSynth_LoadRingBuffer1 = 0x800B1DB0; // type:func -AudioSynth_LoadRingBuffer2 = 0x800B1E5C; // type:func -AudioSynth_LoadRingBufferPart = 0x800B1F08; // type:func -AudioSynth_SaveRingBufferPart = 0x800B1F74; // type:func -AudioSynth_SaveBufferOffset = 0x800B1FE0; // type:func -AudioSynth_MaybeLoadRingBuffer2 = 0x800B2024; // type:func -AudioSynth_LoadReverbSamples = 0x800B2064; // type:func -AudioSynth_SaveReverbSamples = 0x800B20D8; // type:func -AudioSynth_SaveRingBuffer2 = 0x800B21DC; // type:func -AudioSynth_DoOneAudioUpdate = 0x800B2284; // type:func -AudioSynth_ProcessNote = 0x800B2810; // type:func -AudioSynth_FinalResample = 0x800B352C; // type:func -AudioSynth_ProcessEnvelope = 0x800B35CC; // type:func -AudioSynth_LoadWaveSamples = 0x800B38F4; // type:func -AudioSynth_ApplyHaasEffect = 0x800B3A64; // type:func -AudioHeap_CalculateAdsrDecay = 0x800B3D20; // type:func -AudioHeap_InitAdsrDecayTable = 0x800B3D3C; // type:func -AudioHeap_ResetLoadStatus = 0x800B3E80; // type:func -AudioHeap_DiscardFont = 0x800B3F48; // type:func -AudioHeap_ReleaseNotesForFont = 0x800B402C; // type:func -AudioHeap_DiscardSequence = 0x800B40B4; // type:func -AudioHeap_WritebackDCache = 0x800B4138; // type:func -AudioHeap_AllocZeroedAttemptExternal = 0x800B4158; // type:func -AudioHeap_AllocAttemptExternal = 0x800B41B0; // type:func -AudioHeap_AllocDmaMemory = 0x800B4208; // type:func -AudioHeap_AllocDmaMemoryZeroed = 0x800B4244; // type:func -AudioHeap_AllocZeroed = 0x800B4280; // type:func -AudioHeap_Alloc = 0x800B42DC; // type:func -AudioHeap_InitPool = 0x800B4334; // type:func -AudioHeap_InitPersistentCache = 0x800B435C; // type:func -AudioHeap_InitTemporaryCache = 0x800B4370; // type:func -AudioHeap_ResetPool = 0x800B43A0; // type:func -AudioHeap_PopPersistentCache = 0x800B43B0; // type:func -AudioHeap_InitMainPools = 0x800B44F0; // type:func -AudioHeap_InitSessionPools = 0x800B4550; // type:func -AudioHeap_InitCachePools = 0x800B45D4; // type:func -AudioHeap_InitPersistentPoolsAndCaches = 0x800B4658; // type:func -AudioHeap_InitTemporaryPoolsAndCaches = 0x800B471C; // type:func -AudioHeap_AllocCached = 0x800B47E0; // type:func -AudioHeap_SearchCaches = 0x800B4F74; // type:func -AudioHeap_SearchRegularCaches = 0x800B4FCC; // type:func -func_800DF1D8 = 0x800B50D8; // type:func -AudioHeap_ClearFilter = 0x800B54AC; // type:func -AudioHeap_LoadLowPassFilter = 0x800B54DC; // type:func -AudioHeap_LoadHighPassFilter = 0x800B5530; // type:func -AudioHeap_LoadFilter = 0x800B5588; // type:func -AudioHeap_UpdateReverb = 0x800B56BC; // type:func -AudioHeap_UpdateReverbs = 0x800B56C4; // type:func -AudioHeap_ClearCurrentAiBuffer = 0x800B5788; // type:func -AudioHeap_ResetStep = 0x800B57F4; // type:func -AudioHeap_Init = 0x800B5AF8; // type:func -AudioHeap_SearchPermanentCache = 0x800B63E8; // type:func -AudioHeap_AllocPermanent = 0x800B6440; // type:func -AudioHeap_AllocSampleCache = 0x800B64C4; // type:func -AudioHeap_InitSampleCaches = 0x800B6534; // type:func -AudioHeap_AllocTemporarySampleCacheEntry = 0x800B65CC; // type:func -AudioHeap_UnapplySampleCacheForFont = 0x800B6864; // type:func -AudioHeap_DiscardSampleCacheEntry = 0x800B69D8; // type:func -AudioHeap_UnapplySampleCache = 0x800B6AB4; // type:func -AudioHeap_AllocPersistentSampleCacheEntry = 0x800B6AF8; // type:func -AudioHeap_DiscardSampleCacheForFont = 0x800B6B80; // type:func -AudioHeap_DiscardSampleCaches = 0x800B6BBC; // type:func -AudioHeap_ChangeStorage = 0x800B6D0C; // type:func -AudioHeap_DiscardSampleBank = 0x800B6D6C; // type:func -AudioHeap_ApplySampleBankCache = 0x800B6D90; // type:func -AudioHeap_ApplySampleBankCacheInternal = 0x800B6DB4; // type:func -AudioHeap_DiscardSampleBanks = 0x800B7048; // type:func -AudioLoad_DecreaseSampleDmaTtls = 0x800B70F0; // type:func -AudioLoad_DmaSampleData = 0x800B71DC; // type:func -AudioLoad_InitSampleDmaBuffers = 0x800B7518; // type:func -AudioLoad_IsFontLoadComplete = 0x800B77B0; // type:func -AudioLoad_IsSeqLoadComplete = 0x800B7828; // type:func -AudioLoad_IsSampleLoadComplete = 0x800B78A0; // type:func -AudioLoad_SetFontLoadStatus = 0x800B7918; // type:func -AudioLoad_SetSeqLoadStatus = 0x800B7948; // type:func -AudioLoad_SetSampleFontLoadStatusAndApplyCaches = 0x800B7978; // type:func -AudioLoad_SetSampleFontLoadStatus = 0x800B79D8; // type:func -AudioLoad_InitTable = 0x800B7A08; // type:func -AudioLoad_SyncLoadSeqFonts = 0x800B7A68; // type:func -AudioLoad_SyncLoadSeqParts = 0x800B7B18; // type:func -AudioLoad_SyncLoadSample = 0x800B7B78; // type:func -AudioLoad_SyncLoadInstrument = 0x800B7C64; // type:func -AudioLoad_AsyncLoad = 0x800B7D34; // type:func -AudioLoad_AsyncLoadSeq = 0x800B7D6C; // type:func -AudioLoad_AsyncLoadSampleBank = 0x800B7DB0; // type:func -AudioLoad_AsyncLoadFont = 0x800B7DF4; // type:func -AudioLoad_GetFontsForSequence = 0x800B7E38; // type:func -AudioLoad_DiscardSeqFonts = 0x800B7E7C; // type:func -AudioLoad_DiscardFont = 0x800B7F2C; // type:func -AudioLoad_SyncInitSeqPlayer = 0x800B7FD4; // type:func -AudioLoad_SyncInitSeqPlayerSkipTicks = 0x800B8024; // type:func -AudioLoad_SyncInitSeqPlayerInternal = 0x800B807C; // type:func -AudioLoad_SyncLoadSeq = 0x800B81C4; // type:func -AudioLoad_GetSampleBank = 0x800B8218; // type:func -AudioLoad_TrySyncLoadSampleBank = 0x800B8238; // type:func -AudioLoad_SyncLoadFont = 0x800B8354; // type:func -AudioLoad_SyncLoad = 0x800B8458; // type:func -AudioLoad_GetRealTableIndex = 0x800B8668; // type:func -AudioLoad_SearchCaches = 0x800B86A4; // type:func -AudioLoad_GetLoadTable = 0x800B86F8; // type:func -AudioLoad_RelocateFont = 0x800B873C; // type:func -AudioLoad_SyncDma = 0x800B89A8; // type:func -AudioLoad_SyncDmaUnkMedium = 0x800B8ACC; // type:func -AudioLoad_Dma = 0x800B8AE0; // type:func -AudioLoad_Unused1 = 0x800B8BB8; // type:func -AudioLoad_SyncLoadSimple = 0x800B8BC0; // type:func -AudioLoad_AsyncLoadInner = 0x800B8BE0; // type:func -AudioLoad_ProcessLoads = 0x800B8EEC; // type:func -AudioLoad_SetDmaHandler = 0x800B8F1C; // type:func -AudioLoad_SetUnusedHandler = 0x800B8F28; // type:func -AudioLoad_InitSoundFont = 0x800B8F34; // type:func -AudioLoad_Init = 0x800B8F94; // type:func -AudioLoad_InitSlowLoads = 0x800B9300; // type:func -AudioLoad_SlowLoadSample = 0x800B9314; // type:func -AudioLoad_GetFontSample = 0x800B94E0; // type:func -AudioLoad_Unused2 = 0x800B9570; // type:func -AudioLoad_FinishSlowLoad = 0x800B9578; // type:func -AudioLoad_ProcessSlowLoads = 0x800B95EC; // type:func -AudioLoad_DmaSlowCopy = 0x800B9774; // type:func -AudioLoad_DmaSlowCopyUnkMedium = 0x800B97F8; // type:func -AudioLoad_SlowLoadSeq = 0x800B980C; // type:func -AudioLoad_InitAsyncLoads = 0x800B9914; // type:func -AudioLoad_StartAsyncLoadUnkMedium = 0x800B9944; // type:func -AudioLoad_StartAsyncLoad = 0x800B99C8; // type:func -AudioLoad_ProcessAsyncLoads = 0x800B9AEC; // type:func -AudioLoad_ProcessAsyncLoadUnkMedium = 0x800B9C10; // type:func -AudioLoad_FinishAsyncLoad = 0x800B9C1C; // type:func -AudioLoad_ProcessAsyncLoad = 0x800B9D58; // type:func -AudioLoad_AsyncDma = 0x800B9EB4; // type:func -AudioLoad_AsyncDmaUnkMedium = 0x800B9F44; // type:func -AudioLoad_RelocateSample = 0x800B9F58; // type:func -AudioLoad_RelocateFontAndPreloadSamples = 0x800BA098; // type:func -AudioLoad_ProcessSamplePreloads = 0x800BA490; // type:func -AudioLoad_AddToSampleSet = 0x800BA644; // type:func -AudioLoad_GetSamplesForFont = 0x800BA68C; // type:func -AudioLoad_AddUsedSample = 0x800BA7C0; // type:func -AudioLoad_PreloadSamplesForFont = 0x800BA818; // type:func -AudioLoad_LoadPermanentSamples = 0x800BAC94; // type:func -AudioLoad_Unused3 = 0x800BADD4; // type:func -AudioLoad_Unused4 = 0x800BADDC; // type:func -AudioLoad_Unused5 = 0x800BADE4; // type:func -AudioLoad_ScriptLoad = 0x800BADEC; // type:func -AudioLoad_ProcessScriptLoads = 0x800BAE58; // type:func -AudioLoad_InitScriptLoads = 0x800BAEB0; // type:func -AudioThread_Update = 0x800BAEE0; // type:func -AudioThread_UpdateImpl = 0x800BAF00; // type:func -AudioThread_ProcessGlobalCmd = 0x800BB484; // type:func -AudioThread_SetFadeOutTimer = 0x800BB858; // type:func -AudioThread_SetFadeInTimer = 0x800BB8AC; // type:func -AudioThread_InitMesgQueuesImpl = 0x800BB8F4; // type:func -AudioThread_QueueCmd = 0x800BB98C; // type:func -AudioThread_QueueCmdF32 = 0x800BB9D8; // type:func -AudioThread_QueueCmdS32 = 0x800BB9FC; // type:func -AudioThread_QueueCmdS8 = 0x800BBA20; // type:func -AudioThread_QueueCmdU16 = 0x800BBA50; // type:func -AudioThread_ScheduleProcessCmds = 0x800BBA80; // type:func -AudioThread_ResetCmdQueue = 0x800BBB10; // type:func -AudioThread_ProcessCmd = 0x800BBB28; // type:func -AudioThread_ProcessCmds = 0x800BBC6C; // type:func -func_800E5E20 = 0x800BBD20; // type:func -AudioThread_GetFontsForSequence = 0x800BBD84; // type:func -Audio_GetSampleBankIdsOfFont = 0x800BBDA4; // type:func -func_800E5EDC = 0x800BBDDC; // type:func -func_800E5F34 = 0x800BBE34; // type:func -AudioThread_ResetAudioHeap = 0x800BBE88; // type:func -AudioThread_PreNMIInternal = 0x800BBF24; // type:func -AudioThread_GetChannelIO = 0x800BBF70; // type:func -AudioThread_GetSeqPlayerIO = 0x800BBFC4; // type:func -AudioThread_InitExternalPool = 0x800BBFEC; // type:func -AudioThread_ResetExternalPool = 0x800BC01C; // type:func -AudioThread_ProcessSeqPlayerCmd = 0x800BC028; // type:func -AudioThread_ProcessChannelCmd = 0x800BC200; // type:func -AudioThread_Noop1Cmd = 0x800BC3B0; // type:func -AudioThread_Noop1CmdZeroed = 0x800BC3F8; // type:func -AudioThread_Noop2Cmd = 0x800BC41C; // type:func -AudioThread_WaitForAudioTask = 0x800BC450; // type:func -func_800E6590 = 0x800BC490; // type:func -func_800E6680 = 0x800BC580; // type:func -func_800E66A0 = 0x800BC5A0; // type:func -func_800E66C0 = 0x800BC5C0; // type:func -AudioThread_NextRandom = 0x800BC6C0; // type:func -AudioThread_InitMesgQueues = 0x800BC718; // type:func -Audio_InvalDCache = 0x800BC740; // type:func -Audio_WritebackDCache = 0x800BC780; // type:func -osAiSetNextBuffer = 0x800BC7C0; // type:func -Audio_InitNoteSub = 0x800BC840; // type:func -Audio_NoteSetResamplingRate = 0x800BCCB8; // type:func -Audio_NoteInit = 0x800BCD68; // type:func -Audio_NoteDisable = 0x800BCE28; // type:func -Audio_ProcessNotes = 0x800BCE8C; // type:func -Audio_GetInstrumentTunedSample = 0x800BD35C; // type:func -Audio_GetInstrumentInner = 0x800BD398; // type:func -Audio_GetDrum = 0x800BD46C; // type:func -Audio_GetSoundEffect = 0x800BD550; // type:func -Audio_SetFontInstrument = 0x800BD644; // type:func -Audio_SeqLayerDecayRelease = 0x800BD788; // type:func -Audio_SeqLayerNoteDecay = 0x800BDA60; // type:func -Audio_SeqLayerNoteRelease = 0x800BDA80; // type:func -Audio_BuildSyntheticWave = 0x800BDAA0; // type:func -Audio_InitSyntheticWave = 0x800BDBA4; // type:func -Audio_InitNoteList = 0x800BDBFC; // type:func -Audio_InitNoteLists = 0x800BDC0C; // type:func -Audio_InitNoteFreeList = 0x800BDC5C; // type:func -Audio_NotePoolClear = 0x800BDD00; // type:func -Audio_NotePoolFill = 0x800BDE60; // type:func -Audio_AudioListPushFront = 0x800BDF9C; // type:func -Audio_AudioListRemove = 0x800BDFDC; // type:func -Audio_FindNodeWithPrioLessThan = 0x800BE008; // type:func -Audio_NoteInitForLayer = 0x800BE088; // type:func -func_800E82C0 = 0x800BE1C0; // type:func -Audio_NoteReleaseAndTakeOwnership = 0x800BE1F4; // type:func -Audio_AllocNoteFromDisabled = 0x800BE220; // type:func -Audio_AllocNoteFromDecaying = 0x800BE26C; // type:func -Audio_AllocNoteFromActive = 0x800BE2BC; // type:func -Audio_AllocNote = 0x800BE3B4; // type:func -Audio_NoteInitAll = 0x800BE688; // type:func -Audio_SequenceChannelProcessSound = 0x800BE7C0; // type:func -Audio_SequencePlayerProcessSound = 0x800BE988; // type:func -Audio_GetPortamentoFreqScale = 0x800BEAD4; // type:func -Audio_GetVibratoPitchChange = 0x800BEB30; // type:func -Audio_GetVibratoFreqScale = 0x800BEB68; // type:func -Audio_NoteVibratoUpdate = 0x800BEDA4; // type:func -Audio_NoteVibratoInit = 0x800BEE00; // type:func -Audio_NotePortamentoInit = 0x800BEEB8; // type:func -Audio_AdsrInit = 0x800BEEE4; // type:func -Audio_AdsrUpdate = 0x800BEF04; // type:func -AudioSeq_GetScriptControlFlowArgument = 0x800BF240; // type:func -AudioSeq_HandleScriptFlowControl = 0x800BF2A8; // type:func -AudioSeq_InitSequenceChannel = 0x800BF484; // type:func -AudioSeq_SeqChannelSetLayer = 0x800BF5D8; // type:func -AudioSeq_SeqLayerDisable = 0x800BF6FC; // type:func -AudioSeq_SeqLayerFree = 0x800BF778; // type:func -AudioSeq_SequenceChannelDisable = 0x800BF7C8; // type:func -AudioSeq_SequencePlayerSetupChannels = 0x800BF834; // type:func -AudioSeq_SequencePlayerDisableChannels = 0x800BF92C; // type:func -AudioSeq_SequenceChannelEnable = 0x800BF9AC; // type:func -AudioSeq_SequencePlayerDisableAsFinished = 0x800BFA44; // type:func -AudioSeq_SequencePlayerDisable = 0x800BFA6C; // type:func -AudioSeq_AudioListPushBack = 0x800BFB28; // type:func -AudioSeq_AudioListPopBack = 0x800BFB68; // type:func -AudioSeq_InitLayerFreelist = 0x800BFBA8; // type:func -AudioSeq_ScriptReadU8 = 0x800BFC48; // type:func -AudioSeq_ScriptReadS16 = 0x800BFC5C; // type:func -AudioSeq_ScriptReadCompressedU16 = 0x800BFC94; // type:func -AudioSeq_SeqLayerProcessScript = 0x800BFCD4; // type:func -AudioSeq_SeqLayerProcessScriptStep1 = 0x800BFDD8; // type:func -AudioSeq_SeqLayerProcessScriptStep5 = 0x800BFE64; // type:func -AudioSeq_SeqLayerProcessScriptStep2 = 0x800BFFC0; // type:func -AudioSeq_SeqLayerProcessScriptStep4 = 0x800C0340; // type:func -AudioSeq_SeqLayerProcessScriptStep3 = 0x800C09E0; // type:func -AudioSeq_SetChannelPriorities = 0x800C0DF4; // type:func -AudioSeq_GetInstrument = 0x800C0E24; // type:func -AudioSeq_SetInstrument = 0x800C0E98; // type:func -AudioSeq_SequenceChannelSetVolume = 0x800C0F44; // type:func -AudioSeq_SequenceChannelProcessScript = 0x800C0F68; // type:func -AudioSeq_SequencePlayerProcessSequence = 0x800C1C58; // type:func -AudioSeq_ProcessSequences = 0x800C2464; // type:func -AudioSeq_SkipForwardSequence = 0x800C2518; // type:func -AudioSeq_ResetSequencePlayer = 0x800C2568; // type:func -AudioSeq_InitSequencePlayerChannels = 0x800C2634; // type:func -AudioSeq_InitSequencePlayer = 0x800C270C; // type:func -AudioSeq_InitSequencePlayers = 0x800C27DC; // type:func -AudioOcarina_SetCustomButtonMapping = 0x800C2860; // type:func -AudioOcarina_ReadControllerInput = 0x800C2900; // type:func -AudioOcarina_BendPitchTwoSemitones = 0x800C2960; // type:func -AudioOcarina_GetPlayingState = 0x800C29F0; // type:func -AudioOcarina_MapNoteToButton = 0x800C2A34; // type:func -AudioOcarina_MapNotesToScarecrowButtons = 0x800C2A7C; // type:func -AudioOcarina_Start = 0x800C2B04; // type:func -AudioOcarina_CheckIfStartedSong = 0x800C2CBC; // type:func -AudioOcarina_CheckSongsWithMusicStaff = 0x800C2CF8; // type:func -AudioOcarina_CheckSongsWithoutMusicStaff = 0x800C3100; // type:func -AudioOcarina_PlayControllerInput = 0x800C3358; // type:func -AudioOcarina_EnableInput = 0x800C3748; // type:func -AudioOcarina_SetInstrument = 0x800C3758; // type:func -AudioOcarina_SetPlaybackSong = 0x800C383C; // type:func -AudioOcarina_PlaybackSong = 0x800C393C; // type:func -AudioOcarina_SetRecordingSong = 0x800C3C68; // type:func -AudioOcarina_SetRecordingState = 0x800C4070; // type:func -AudioOcarina_UpdateRecordingStaff = 0x800C419C; // type:func -AudioOcarina_UpdatePlayingStaff = 0x800C41D4; // type:func -AudioOcarina_UpdatePlaybackStaff = 0x800C4218; // type:func -AudioOcarina_GetRecordingStaff = 0x800C42C8; // type:func -AudioOcarina_GetPlayingStaff = 0x800C42D4; // type:func -AudioOcarina_GetPlaybackStaff = 0x800C42F8; // type:func -AudioOcarina_RecordSong = 0x800C4304; // type:func -AudioOcarina_MemoryGameInit = 0x800C447C; // type:func -AudioOcarina_MemoryGameNextNote = 0x800C44EC; // type:func -AudioOcarina_Update = 0x800C45F4; // type:func -AudioOcarina_PlayLongScarecrowSong = 0x800C4724; // type:func -AudioOcarina_ResetStaffs = 0x800C4830; // type:func -AudioDebug_Draw = 0x800C487C; // type:func -AudioDebug_ScrPrt = 0x800C4884; // type:func -Audio_Update = 0x800C4890; // type:func -func_800F3138 = 0x800C4934; // type:func -func_800F3140 = 0x800C493C; // type:func -func_800F314C = 0x800C4948; // type:func -Audio_ComputeSfxVolume = 0x800C4984; // type:func -Audio_ComputeSfxReverb = 0x800C4AEC; // type:func -Audio_ComputeSfxPanSigned = 0x800C4C64; // type:func -Audio_ComputeSfxFreqScale = 0x800C4DE8; // type:func -func_800F37B8 = 0x800C4FB4; // type:func -func_800F3990 = 0x800C518C; // type:func -Audio_SetSfxProperties = 0x800C5204; // type:func -Audio_ResetSfxChannelState = 0x800C56DC; // type:func -Audio_PlayCutsceneEffectsSequence = 0x800C5744; // type:func -func_800F3F84 = 0x800C578C; // type:func -func_800F4010 = 0x800C5818; // type:func -func_800F4138 = 0x800C5938; // type:func -func_800F4190 = 0x800C5990; // type:func -Audio_PlaySfxRandom = 0x800C59E0; // type:func -func_800F4254 = 0x800C5A54; // type:func -func_800F436C = 0x800C5B6C; // type:func -func_800F4414 = 0x800C5C14; // type:func -func_800F44EC = 0x800C5CEC; // type:func -func_800F4524 = 0x800C5D24; // type:func -func_800F4578 = 0x800C5D78; // type:func -func_800F45D0 = 0x800C5DD0; // type:func -Audio_PlaySfxRiver = 0x800C5E34; // type:func -Audio_PlaySfxWaterfall = 0x800C5EE0; // type:func -Audio_StepFreqLerp = 0x800C5F84; // type:func -Audio_SetBgmVolumeOffDuringFanfare = 0x800C5FBC; // type:func -Audio_SetBgmVolumeOnDuringFanfare = 0x800C5FFC; // type:func -Audio_SetMainBgmVolume = 0x800C603C; // type:func -Audio_SetGanonsTowerBgmVolumeLevel = 0x800C6070; // type:func -Audio_SetGanonsTowerBgmVolume = 0x800C611C; // type:func -Audio_LowerMainBgmVolume = 0x800C6254; // type:func -Audio_UpdateRiverSoundVolumes = 0x800C6270; // type:func -Audio_PlaySfxIncreasinglyTransposed = 0x800C6358; // type:func -Audio_ResetIncreasingTranspose = 0x800C63E8; // type:func -Audio_PlaySfxTransposed = 0x800C63F4; // type:func -func_800F4C58 = 0x800C6458; // type:func -func_800F4E30 = 0x800C6630; // type:func -Audio_ClearSariaBgm = 0x800C68CC; // type:func -Audio_ClearSariaBgmAtPos = 0x800C68EC; // type:func -Audio_SplitBgmChannels = 0x800C690C; // type:func -Audio_PlaySariaBgm = 0x800C6AA0; // type:func -Audio_ClearSariaBgm2 = 0x800C6D04; // type:func -Audio_PlayMorningSceneSequence = 0x800C6D10; // type:func -Audio_PlaySceneSequence = 0x800C6D50; // type:func -Audio_UpdateSceneSequenceResumePoint = 0x800C6EA8; // type:func -Audio_PlayWindmillBgm = 0x800C6F18; // type:func -Audio_SetMainBgmTempoFreqAfterFanfare = 0x800C6F4C; // type:func -Audio_SetFastTempoForTimedMinigame = 0x800C7118; // type:func -Audio_PlaySequenceInCutscene = 0x800C715C; // type:func -Audio_StopSequenceInCutscene = 0x800C71E8; // type:func -Audio_IsSequencePlaying = 0x800C7258; // type:func -func_800F5ACC = 0x800C72CC; // type:func -func_800F5B58 = 0x800C7340; // type:func -func_800F5BF0 = 0x800C73D8; // type:func -func_800F5C2C = 0x800C7414; // type:func -Audio_PlayFanfare = 0x800C744C; // type:func -Audio_UpdateFanfare = 0x800C74E0; // type:func -Audio_PlaySequenceWithSeqPlayerIO = 0x800C7600; // type:func -Audio_SetSequenceMode = 0x800C7678; // type:func -Audio_SetBgmEnemyVolume = 0x800C78F4; // type:func -Audio_UpdateMalonSinging = 0x800C7A48; // type:func -func_800F64E0 = 0x800C7CAC; // type:func -Audio_ToggleMalonSinging = 0x800C7D50; // type:func -Audio_SetEnvReverb = 0x800C7E8C; // type:func -Audio_SetCodeReverb = 0x800C7EA8; // type:func -func_800F6700 = 0x800C7ECC; // type:func -Audio_SetBaseFilter = 0x800C7F6C; // type:func -Audio_SetExtraFilter = 0x800C7FF4; // type:func -Audio_SetCutsceneFlag = 0x800C8088; // type:func -Audio_PlaySfxGeneralIfNotInCutscene = 0x800C80A0; // type:func -Audio_PlaySfxIfNotInCutscene = 0x800C80E8; // type:func -func_800F6964 = 0x800C8130; // type:func -Audio_StopBgmAndFanfare = 0x800C827C; // type:func -func_800F6B3C = 0x800C8308; // type:func -Audio_DisableAllSeq = 0x800C8334; // type:func -func_800F6BB8 = 0x800C8384; // type:func -func_800F6BDC = 0x800C83A8; // type:func -Audio_PreNMI = 0x800C83E0; // type:func -func_800F6C34 = 0x800C8400; // type:func -Audio_SetNatureAmbienceChannelIO = 0x800C8524; // type:func -Audio_StartNatureAmbienceSequence = 0x800C8638; // type:func -Audio_PlayNatureAmbienceSequence = 0x800C873C; // type:func -Audio_Init = 0x800C8880; // type:func -Audio_InitSound = 0x800C88A4; // type:func -func_800F7170 = 0x800C88F8; // type:func -func_800F71BC = 0x800C8944; // type:func -func_800F7208 = 0x800C8990; // type:func -Audio_SetSfxBanksMute = 0x800C89F0; // type:func -Audio_QueueSeqCmdMute = 0x800C8A48; // type:func -Audio_ClearBGMMute = 0x800C8AAC; // type:func -Audio_PlaySfxGeneral = 0x800C8B1C; // type:func -Audio_RemoveMatchingSfxRequests = 0x800C8B9C; // type:func -Audio_ProcessSfxRequest = 0x800C8D3C; // type:func -Audio_RemoveSfxBankEntry = 0x800C91D8; // type:func -Audio_ChooseActiveSfx = 0x800C9370; // type:func -Audio_PlayActiveSfx = 0x800C9AB0; // type:func -Audio_StopSfxByBank = 0x800C9DD0; // type:func -func_800F8884 = 0x800C9EB4; // type:func -Audio_StopSfxByPosAndBank = 0x800C9FD0; // type:func -Audio_StopSfxByPos = 0x800CA018; // type:func -Audio_StopSfxByPosAndId = 0x800CA074; // type:func -Audio_StopSfxByTokenAndId = 0x800CA1D0; // type:func -Audio_StopSfxById = 0x800CA334; // type:func -Audio_ProcessSfxRequests = 0x800CA46C; // type:func -Audio_SetUnusedBankLerp = 0x800CA4D0; // type:func -Audio_StepUnusedBankLerp = 0x800CA564; // type:func -func_800F8F88 = 0x800CA5B8; // type:func -Audio_IsSfxPlaying = 0x800CA624; // type:func -Audio_ResetSfx = 0x800CA68C; // type:func -Audio_StartSequence = 0x800CA850; // type:func -Audio_StopSequence = 0x800CA9D4; // type:func -Audio_ProcessSeqCmd = 0x800CAA5C; // type:func -Audio_QueueSeqCmd = 0x800CB520; // type:func -Audio_ProcessSeqCmds = 0x800CB548; // type:func -Audio_GetActiveSeqId = 0x800CB5C8; // type:func -Audio_IsSeqCmdNotQueued = 0x800CB630; // type:func -Audio_ResetSequenceRequests = 0x800CB688; // type:func -Audio_ReplaceSeqCmdSetupOpVolRestore = 0x800CB6A0; // type:func -Audio_SetVolumeScale = 0x800CB754; // type:func -Audio_UpdateActiveSequences = 0x800CB8F0; // type:func -func_800FAD34 = 0x800CC248; // type:func -Audio_ResetActiveSequences = 0x800CC30C; // type:func -Audio_ResetActiveSequencesAndVolume = 0x800CC3C8; // type:func -GfxPrint_Setup = 0x800CC470; // type:func -GfxPrint_SetColor = 0x800CC8BC; // type:func -GfxPrint_SetPosPx = 0x800CC908; // type:func -GfxPrint_SetPos = 0x800CC92C; // type:func -GfxPrint_SetBasePosPx = 0x800CC954; // type:func -GfxPrint_PrintCharImpl = 0x800CC968; // type:func -GfxPrint_PrintChar = 0x800CCDFC; // type:func -GfxPrint_PrintStringWithSize = 0x800CCFBC; // type:func -GfxPrint_PrintString = 0x800CD018; // type:func -GfxPrint_Callback = 0x800CD070; // type:func -GfxPrint_Init = 0x800CD09C; // type:func -GfxPrint_Destroy = 0x800CD124; // type:func -GfxPrint_Open = 0x800CD12C; // type:func -GfxPrint_Close = 0x800CD160; // type:func -GfxPrint_VPrintf = 0x800CD190; // type:func -GfxPrint_Printf = 0x800CD1B0; // type:func -RcpUtils_PrintRegisterStatus = 0x800CD1E0; // type:func -RcpUtils_Reset = 0x800CD208; // type:func -Overlay_AllocateAndLoad = 0x800CD240; // type:func -Overlay_Relocate = 0x800CD2A0; // type:func -Overlay_Load = 0x800CD4E0; // type:func -func_800FC800 = 0x800CD5B0; // type:func -func_800FC83C = 0x800CD5E0; // type:func -func_800FC868 = 0x800CD60C; // type:func -func_800FC8D8 = 0x800CD67C; // type:func -func_800FC948 = 0x800CD6EC; // type:func -func_800FCA18 = 0x800CD7BC; // type:func -func_800FCB34 = 0x800CD858; // type:func -SystemHeap_Init = 0x800CD8C8; // type:func -PadUtils_Init = 0x800CD8F0; // type:func -func_800FCB70 = 0x800CD910; // type:func -PadUtils_ResetPressRel = 0x800CD918; // type:func -PadUtils_CheckCurExact = 0x800CD924; // type:func -PadUtils_CheckCur = 0x800CD93C; // type:func -PadUtils_CheckPressed = 0x800CD958; // type:func -PadUtils_CheckReleased = 0x800CD974; // type:func -PadUtils_GetCurButton = 0x800CD990; // type:func -PadUtils_GetPressButton = 0x800CD998; // type:func -PadUtils_GetCurX = 0x800CD9A0; // type:func -PadUtils_GetCurY = 0x800CD9A8; // type:func -PadUtils_SetRelXY = 0x800CD9B0; // type:func -PadUtils_GetRelXImpl = 0x800CD9BC; // type:func -PadUtils_GetRelYImpl = 0x800CD9C4; // type:func -PadUtils_GetRelX = 0x800CD9CC; // type:func -PadUtils_GetRelY = 0x800CD9EC; // type:func -PadUtils_UpdateRelXY = 0x800CDA0C; // type:func -PadSetup_Init = 0x800CDAE0; // type:func -Math_FTanF = 0x800CDC20; // type:func -Math_FFloorF = 0x800CDC54; // type:func -Math_FCeilF = 0x800CDC74; // type:func -Math_FRoundF = 0x800CDC94; // type:func -Math_FTruncF = 0x800CDCB4; // type:func -Math_FNearbyIntF = 0x800CDCD4; // type:func -Math_FAtanTaylorQF = 0x800CDCF4; // type:func -Math_FAtanTaylorF = 0x800CDD40; // type:func -Math_FAtanContFracF = 0x800CDE64; // type:func -Math_FAtanF = 0x800CDFB0; // type:func -Math_FAtan2F = 0x800CDFF0; // type:func -Math_FAsinF = 0x800CE0D8; // type:func -Math_FAcosF = 0x800CE108; // type:func -floorf = 0x800CE130; // type:func -floor = 0x800CE13C; // type:func -lfloorf = 0x800CE148; // type:func -lfloor = 0x800CE158; // type:func -ceilf = 0x800CE168; // type:func -ceil = 0x800CE174; // type:func -lceilf = 0x800CE180; // type:func -lceil = 0x800CE190; // type:func -truncf = 0x800CE1A0; // type:func -trunc = 0x800CE1AC; // type:func -ltruncf = 0x800CE1B8; // type:func -ltrunc = 0x800CE1C8; // type:func -nearbyintf = 0x800CE1D8; // type:func -nearbyint = 0x800CE1E4; // type:func -lnearbyintf = 0x800CE1F0; // type:func -lnearbyint = 0x800CE200; // type:func -roundf = 0x800CE210; // type:func -round = 0x800CE22C; // type:func -lroundf = 0x800CE24C; // type:func -lround = 0x800CE26C; // type:func -SystemArena_Malloc = 0x800CE290; // type:func -SystemArena_MallocR = 0x800CE2B8; // type:func -SystemArena_Realloc = 0x800CE2E0; // type:func -SystemArena_Free = 0x800CE310; // type:func -SystemArena_Calloc = 0x800CE338; // type:func -SystemArena_GetSizes = 0x800CE38C; // type:func -SystemArena_Check = 0x800CE3C4; // type:func -SystemArena_Init = 0x800CE3E8; // type:func -SystemArena_Cleanup = 0x800CE418; // type:func -SystemArena_IsInitialized = 0x800CE43C; // type:func -Rand_Next = 0x800CE460; // type:func -Rand_Seed = 0x800CE490; // type:func -Rand_ZeroOne = 0x800CE49C; // type:func -Rand_Centered = 0x800CE4F0; // type:func -Rand_Seed_Variable = 0x800CE548; // type:func -Rand_Next_Variable = 0x800CE550; // type:func -Rand_ZeroOne_Variable = 0x800CE578; // type:func -Rand_Centered_Variable = 0x800CE5C4; // type:func -ArenaImpl_LockInit = 0x800CE620; // type:func -ArenaImpl_Lock = 0x800CE64C; // type:func -ArenaImpl_Unlock = 0x800CE674; // type:func -ArenaImpl_GetLastBlock = 0x800CE69C; // type:func -__osMallocInit = 0x800CE700; // type:func -__osMallocAddBlock = 0x800CE750; // type:func -__osMallocCleanup = 0x800CE7F0; // type:func -__osMallocIsInitialized = 0x800CE810; // type:func -__osMalloc_NoLock = 0x800CE818; // type:func -__osMalloc = 0x800CE944; // type:func -__osMallocR = 0x800CE984; // type:func -__osFree_NoLock = 0x800CEAF8; // type:func -__osFree = 0x800CEC38; // type:func -__osRealloc = 0x800CEC70; // type:func -ArenaImpl_GetSizes = 0x800CF068; // type:func -ArenaImpl_FaultClient = 0x800CF13C; // type:func -__osCheckArena = 0x800CF310; // type:func -proutSprintf = 0x800CF3D0; // type:func -vsprintf = 0x800CF3F4; // type:func -sprintf = 0x800CF444; // type:func -PrintUtils_VPrintf = 0x800CF4A0; // type:func -PrintUtils_Printf = 0x800CF4D4; // type:func -Sleep_Cycles = 0x800CF500; // type:func -Sleep_Nsec = 0x800CF56C; // type:func -Sleep_Usec = 0x800CF5BC; // type:func -Sleep_Msec = 0x800CF60C; // type:func -Sleep_Sec = 0x800CF660; // type:func -JpegUtils_ProcessQuantizationTable = 0x800CF6A0; // type:func -JpegUtils_ParseHuffmanCodesLengths = 0x800CF708; // type:func -JpegUtils_GetHuffmanCodes = 0x800CF78C; // type:func -JpegUtils_SetHuffmanTable = 0x800CF7F8; // type:func -JpegUtils_ProcessHuffmanTableImpl = 0x800CF8A0; // type:func -JpegUtils_ProcessHuffmanTable = 0x800CF95C; // type:func -JpegUtils_SetHuffmanTableOld = 0x800CFA34; // type:func -JpegUtils_ProcessHuffmanTableImplOld = 0x800CFADC; // type:func -JpegDecoder_Decode = 0x800CFBB0; // type:func -JpegDecoder_ProcessMcu = 0x800CFDD8; // type:func -JpegDecoder_ParseNextSymbol = 0x800CFF74; // type:func -JpegDecoder_ReadBits = 0x800D00B0; // type:func -guScale = 0x800D01A0; // type:func -sinf = 0x800D0250; // type:func -sins = 0x800D0410; // type:func -_VirtualToPhysicalTask = 0x800D0480; // type:func -osSpTaskLoad = 0x800D058C; // type:func -osSpTaskStartGo = 0x800D06F4; // type:func -__osMotorAccess = 0x800D0740; // type:func -_MakeMotorData = 0x800D08A8; // type:func -osMotorInit = 0x800D09B4; // type:func -__osSiCreateAccessQueue = 0x800D0B10; // type:func -__osSiGetAccess = 0x800D0B60; // type:func -__osSiRelAccess = 0x800D0BA4; // type:func -osContInit = 0x800D0BD0; // type:func -__osContGetInitData = 0x800D0D2C; // type:func -__osPackRequestData = 0x800D0DD8; // type:func -osContStartReadData = 0x800D0EB0; // type:func -osContGetReadData = 0x800D0F34; // type:func -__osPackReadData = 0x800D0FC0; // type:func -guPerspectiveF = 0x800D1090; // type:func -guPerspective = 0x800D12C0; // type:func -__osSpRawStartDma = 0x800D1320; // type:func -__osSiRawStartDma = 0x800D13B0; // type:func -osSpTaskYield = 0x800D1460; // type:func -guMtxIdentF = 0x800D1480; // type:func -guLookAtF = 0x800D14D0; // type:func -guLookAt = 0x800D1774; // type:func -osStopTimer = 0x800D17F0; // type:func -sqrtf = 0x800D18E0; // type:func -osAfterPreNMI = 0x800D18F0; // type:func -osContStartQuery = 0x800D1910; // type:func -osContGetQuery = 0x800D198C; // type:func -guLookAtHiliteF = 0x800D19B0; // type:func -guLookAtHilite = 0x800D2170; // type:func -_Printf = 0x800D2230; // type:func -_Putfld = 0x800D2878; // type:func -strchr = 0x800D2F10; // type:func -strlen = 0x800D2F50; // type:func -memcpy = 0x800D2F78; // type:func -__osSpDeviceBusy = 0x800D2FB0; // type:func -guMtxIdent = 0x800D2FE0; // type:func -guPositionF = 0x800D3030; // type:func -guPosition = 0x800D31D8; // type:func -osSpTaskYielded = 0x800D3240; // type:func -guRotateF = 0x800D32A0; // type:func -guRotate = 0x800D3424; // type:func -osAiSetFrequency = 0x800D3470; // type:func -__osGetActiveQueue = 0x800D35C0; // type:func -guNormalize = 0x800D35E0; // type:func -osDpGetStatus = 0x800D3640; // type:func -osDpSetStatus = 0x800D3650; // type:func -guOrthoF = 0x800D3660; // type:func -guOrtho = 0x800D37B4; // type:func -cosf = 0x800D3820; // type:func -coss = 0x800D3990; // type:func -osViSetEvent = 0x800D39C0; // type:func -guS2DInitBg = 0x800D3A20; // type:func -__osPfsSelectBank = 0x800D3BA0; // type:func -osContSetCh = 0x800D3C20; // type:func -osAiGetLength = 0x800D3C80; // type:func -guTranslate = 0x800D3CA0; // type:func -__osContRamWrite = 0x800D3D70; // type:func -__osPfsGetStatus = 0x800D3FC0; // type:func -__osPfsRequestOneChannel = 0x800D4090; // type:func -__osPfsGetOneChannelData = 0x800D4154; // type:func -__osSumcalc = 0x800D41F0; // type:func -__osIdCheckSum = 0x800D4264; // type:func -__osRepairPackId = 0x800D4360; // type:func -__osCheckPackId = 0x800D46B0; // type:func -__osGetId = 0x800D4814; // type:func -__osCheckId = 0x800D49C0; // type:func -__osPfsRWInode = 0x800D4A94; // type:func -__osContRamRead = 0x800D4D70; // type:func -__osContAddressCrc = 0x800D4FA0; // type:func -__osContDataCrc = 0x800D5070; // type:func -osPfsIsPlug = 0x800D5110; // type:func -__osPfsRequestData = 0x800D529C; // type:func -__osPfsGetInitData = 0x800D5350; // type:func -osSetTimer = 0x800D5400; // type:func -_Ldtob = 0x800D5590; // type:func -_Ldunscale = 0x800D5A20; // type:func -_Genld = 0x800D5AD8; // type:func -ldiv = 0x800D60A0; // type:func -lldiv = 0x800D6124; // type:func -_Litob = 0x800D6230; // type:func -__osSpGetStatus = 0x800D64D0; // type:func -__osSpSetStatus = 0x800D64E0; // type:func -osWritebackDCacheAll = 0x800D64F0; // type:func -__osGetCurrFaultedThread = 0x800D6520; // type:func -guMtxF2L = 0x800D6540; // type:func -__d_to_ll = 0x800D65B0; // type:func -__f_to_ll = 0x800D65CC; // type:func -__d_to_ull = 0x800D65E8; // type:func -__f_to_ull = 0x800D6688; // type:func -__ll_to_d = 0x800D6724; // type:func -__ll_to_f = 0x800D673C; // type:func -__ull_to_d = 0x800D6754; // type:func -__ull_to_f = 0x800D6788; // type:func -osViGetCurrentFramebuffer = 0x800D67C0; // type:func -__osSpSetPc = 0x800D6800; // type:func -sqrt = 0x800D6830; // type:func -absf = 0x800D6840; // type:func -fmodf = 0x800D6850; // type:func -__osMemset = 0x800D68A0; // type:func -__osMemmove = 0x800D68D0; // type:func -Message_ResetOcarinaNoteState = 0x800D6960; // type:func -Message_UpdateOcarinaMemoryGame = 0x800D6A5C; // type:func -Message_ShouldAdvance = 0x800D6B80; // type:func -Message_ShouldAdvanceSilent = 0x800D6C44; // type:func -Message_CloseTextbox = 0x800D6C8C; // type:func -Message_HandleChoiceSelection = 0x800D6D04; // type:func -Message_DrawTextChar = 0x800D6EE4; // type:func -Message_GrowTextbox = 0x800D7214; // type:func -Message_FindMessage = 0x800D7418; // type:func -Message_FindCreditsMessage = 0x800D757C; // type:func -Message_SetTextColor = 0x800D75F0; // type:func -Message_DrawTextboxIcon = 0x800D78A4; // type:func -Message_DrawItemIcon = 0x800D7FE8; // type:func -Message_HandleOcarina = 0x800D8334; // type:func -Message_DrawText = 0x800D8544; // type:func -Message_LoadItemIcon = 0x800D97BC; // type:func -Message_Decode = 0x800D995C; // type:func -Message_OpenText = 0x800DACDC; // type:func -Message_StartTextbox = 0x800DB248; // type:func -Message_ContinueTextbox = 0x800DB2B4; // type:func -Message_StartOcarinaImpl = 0x800DB384; // type:func -Message_StartOcarina = 0x800DB834; // type:func -Message_StartOcarinaSunsSongDisabled = 0x800DB864; // type:func -Message_GetState = 0x800DB898; // type:func -Message_DrawTextBox = 0x800DB9B8; // type:func -Message_SetView = 0x800DBE44; // type:func -Message_DrawMain = 0x800DBE8C; // type:func -Message_Draw = 0x800DEB5C; // type:func -Message_Update = 0x800DEBF8; // type:func -Message_SetTables = 0x800DF6D8; // type:func -GameOver_Init = 0x800DF720; // type:func -GameOver_FadeInLights = 0x800DF734; // type:func -GameOver_Update = 0x800DF79C; // type:func -Interface_Destroy = 0x800DFC60; // type:func -Interface_Init = 0x800DFC80; // type:func -Message_Init = 0x800E00A4; // type:func -Regs_InitDataImpl = 0x800E0148; // type:func -Regs_InitData = 0x800E1170; // type:func -aspMainTextStart = 0x800E11A0; // type:func -ConsoleLogo_Calc = 0x80800000; // type:func -ConsoleLogo_SetupView = 0x80800010; // type:func -ConsoleLogo_Draw = 0x808000A8; // type:func -ConsoleLogo_Main = 0x808005E0; // type:func -ConsoleLogo_Destroy = 0x808006A0; // type:func -ConsoleLogo_Init = 0x808006C0; // type:func -MapSelect_LoadTitle = 0x80800850; // type:func -MapSelect_LoadGame = 0x80800870; // type:func -MapSelect_UpdateMenu = 0x80800960; // type:func -MapSelect_PrintMenu = 0x808012C0; // type:func -MapSelect_PrintLoadingMessage = 0x8080149C; // type:func -MapSelect_PrintAgeSetting = 0x80801528; // type:func -MapSelect_PrintCutsceneSetting = 0x8080159C; // type:func -MapSelect_DrawMenu = 0x80801758; // type:func -MapSelect_DrawLoadingScreen = 0x8080186C; // type:func -MapSelect_Draw = 0x80801954; // type:func -MapSelect_Main = 0x80801A08; // type:func -MapSelect_Destroy = 0x80801A34; // type:func -MapSelect_Init = 0x80801A40; // type:func -TitleSetup_SetupTitleScreen = 0x808034D0; // type:func -func_80803C5C = 0x8080353C; // type:func -TitleSetup_Main = 0x80803548; // type:func -TitleSetup_Destroy = 0x8080358C; // type:func -TitleSetup_Init = 0x80803598; // type:func -FileSelect_SetupCopySource = 0x80803630; // type:func -FileSelect_SelectCopySource = 0x808037C8; // type:func -FileSelect_SetupCopyDest1 = 0x80803B38; // type:func -FileSelect_SetupCopyDest2 = 0x80803CC8; // type:func -FileSelect_SelectCopyDest = 0x80803D90; // type:func -FileSelect_ExitToCopySource1 = 0x80804148; // type:func -FileSelect_ExitToCopySource2 = 0x80804214; // type:func -FileSelect_SetupCopyConfirm1 = 0x80804340; // type:func -FileSelect_SetupCopyConfirm2 = 0x80804564; // type:func -FileSelect_CopyConfirm = 0x808045C0; // type:func -FileSelect_ReturnToCopyDest = 0x808047C8; // type:func -FileSelect_CopyAnim1 = 0x808049FC; // type:func -FileSelect_CopyAnim2 = 0x80804A78; // type:func -FileSelect_CopyAnim3 = 0x80804BC8; // type:func -FileSelect_CopyAnim4 = 0x80804CE4; // type:func -FileSelect_CopyAnim5 = 0x80804DD4; // type:func -FileSelect_ExitCopyToMain = 0x808050D4; // type:func -FileSelect_SetupEraseSelect = 0x80805210; // type:func -FileSelect_EraseSelect = 0x808053E0; // type:func -FileSelect_SetupEraseConfirm1 = 0x8080576C; // type:func -FileSelect_SetupEraseConfirm2 = 0x80805A34; // type:func -FileSelect_EraseConfirm = 0x80805B10; // type:func -FileSelect_ExitToEraseSelect1 = 0x80805CF8; // type:func -FileSelect_ExitToEraseSelect2 = 0x80805DA8; // type:func -FileSelect_EraseAnim1 = 0x80805FC4; // type:func -FileSelect_EraseAnim2 = 0x808061A4; // type:func -FileSelect_EraseAnim3 = 0x80806268; // type:func -FileSelect_ExitEraseToMain = 0x808064D4; // type:func -FileSelect_DrawCharacter = 0x80806670; // type:func -FileSelect_SetKeyboardVtx = 0x808067A8; // type:func -FileSelect_SetNameEntryVtx = 0x80806AA8; // type:func -FileSelect_DrawKeyboard = 0x808075F0; // type:func -FileSelect_DrawNameEntry = 0x808077F4; // type:func -FileSelect_StartNameEntry = 0x808086BC; // type:func -FileSelect_UpdateKeyboardCursor = 0x80808770; // type:func -FileSelect_StartOptions = 0x80808D44; // type:func -FileSelect_UpdateOptionsMenu = 0x80808DD4; // type:func -FileSelect_DrawOptionsImpl = 0x80809050; // type:func -FileSelect_DrawOptions = 0x8080A564; // type:func -FileSelect_SetView = 0x8080A590; // type:func -FileSelect_QuadTextureIA8 = 0x8080A614; // type:func -FileSelect_InitModeUpdate = 0x8080A7F4; // type:func -FileSelect_InitModeDraw = 0x8080A84C; // type:func -FileSelect_FadeInMenuElements = 0x8080A858; // type:func -FileSelect_SplitNumber = 0x8080A9C0; // type:func -FileSelect_StartFadeIn = 0x8080AA34; // type:func -FileSelect_FinishFadeIn = 0x8080AABC; // type:func -FileSelect_UpdateMainMenu = 0x8080AB54; // type:func -FileSelect_UnusedCM31 = 0x8080B3E0; // type:func -FileSelect_UnusedCMDelay = 0x8080B3EC; // type:func -FileSelect_RotateToNameEntry = 0x8080B440; // type:func -FileSelect_RotateToOptions = 0x8080B4B4; // type:func -FileSelect_RotateToMain = 0x8080B528; // type:func -FileSelect_PulsateCursor = 0x8080B5A0; // type:func -FileSelect_ConfigModeUpdate = 0x8080B69C; // type:func -FileSelect_SetWindowVtx = 0x8080B6D8; // type:func -FileSelect_SetWindowContentVtx = 0x8080B9AC; // type:func -FileSelect_DrawFileInfo = 0x8080CC70; // type:func -FileSelect_DrawWindowContents = 0x8080D3EC; // type:func -FileSelect_ConfigModeDraw = 0x8080E8A0; // type:func -FileSelect_FadeMainToSelect = 0x8080F180; // type:func -FileSelect_MoveSelectedFileToTop = 0x8080F2EC; // type:func -FileSelect_FadeInFileInfo = 0x8080F3F0; // type:func -FileSelect_ConfirmFile = 0x8080F4D4; // type:func -FileSelect_FadeOutFileInfo = 0x8080F6AC; // type:func -FileSelect_MoveSelectedFileToSlot = 0x8080F79C; // type:func -FileSelect_FadeOut = 0x8080F9F4; // type:func -FileSelect_LoadGame = 0x8080FA50; // type:func -FileSelect_SelectModeUpdate = 0x8080FC18; // type:func -FileSelect_SelectModeDraw = 0x8080FC54; // type:func -FileSelect_Main = 0x8081000C; // type:func -FileSelect_InitContext = 0x808105D4; // type:func -FileSelect_Destroy = 0x80810C48; // type:func -FileSelect_Init = 0x80810C54; // type:func -KaleidoScope_DrawQuestStatus = 0x80812260; // type:func -KaleidoScope_UpdateQuestStatusPoint = 0x8081464C; // type:func -KaleidoScope_DrawDebugEditorText = 0x80814660; // type:func -KaleidoScope_DrawDigit = 0x80814954; // type:func -KaleidoScope_DrawDebugEditor = 0x80814AC8; // type:func -KaleidoScope_DrawEquipmentImage = 0x80816610; // type:func -KaleidoScope_DrawPlayerWork = 0x80816A10; // type:func -KaleidoScope_DrawEquipment = 0x80816BB4; // type:func -KaleidoScope_DrawAmmoCount = 0x80818090; // type:func -KaleidoScope_SetCursorVtx = 0x808185CC; // type:func -KaleidoScope_SetItemCursorVtx = 0x808185FC; // type:func -KaleidoScope_DrawItemSelect = 0x80818628; // type:func -KaleidoScope_UpdateItemEquip = 0x80819484; // type:func -KaleidoScope_DrawDungeonMap = 0x8081A080; // type:func -KaleidoScope_DrawWorldMap = 0x8081B890; // type:func -KaleidoScope_UpdatePrompt = 0x8081D360; // type:func -KaleidoScope_SetupPlayerPreRender = 0x8081D560; // type:func -KaleidoScope_ProcessPlayerPreRender = 0x8081D638; // type:func -KaleidoScope_QuadTextureIA4 = 0x8081D670; // type:func -KaleidoScope_QuadTextureIA8 = 0x8081D850; // type:func -KaleidoScope_OverridePalIndexCI4 = 0x8081DA30; // type:func -KaleidoScope_MoveCursorToSpecialPos = 0x8081DB68; // type:func -KaleidoScope_DrawQuadTextureRGBA32 = 0x8081DBCC; // type:func -KaleidoScope_SetDefaultCursor = 0x8081DDBC; // type:func -KaleidoScope_SwitchPage = 0x8081DE7C; // type:func -KaleidoScope_HandlePageToggles = 0x8081DFD8; // type:func -KaleidoScope_DrawCursor = 0x8081E108; // type:func -KaleidoScope_DrawPageSections = 0x8081E454; // type:func -KaleidoScope_DrawPages = 0x8081E700; // type:func -KaleidoScope_DrawInfoPanel = 0x8081FE78; // type:func -KaleidoScope_UpdateNamePanel = 0x8082165C; // type:func -func_808237B4 = 0x80821878; // type:func -KaleidoScope_SetView = 0x80821A58; // type:func -func_80823A0C = 0x80821AD4; // type:func -KaleidoScope_InitVertices = 0x80822164; // type:func -KaleidoScope_DrawGameOver = 0x80823CA4; // type:func -KaleidoScope_Draw = 0x8082431C; // type:func -KaleidoScope_GrayOutTextureRGBA32 = 0x80824544; // type:func -KaleidoScope_UpdateOpening = 0x808245F8; // type:func -KaleidoScope_UpdateCursorSize = 0x808247E8; // type:func -KaleidoScope_LoadDungeonMap = 0x80824B2C; // type:func -KaleidoScope_UpdateDungeonMap = 0x80824BC8; // type:func -KaleidoScope_Update = 0x80824CBC; // type:func -PauseMapMark_Init = 0x808275B0; // type:func -PauseMapMark_Clear = 0x808275E4; // type:func -PauseMapMark_DrawForDungeon = 0x808275F8; // type:func -PauseMapMark_Draw = 0x80827C0C; // type:func -Player_ZeroSpeedXZ = 0x8082EC90; // type:func -func_80832224 = 0x8082ECA8; // type:func -func_8083224C = 0x8082ECD0; // type:func -Player_AnimPlayOnce = 0x8082ECEC; // type:func -Player_AnimPlayLoop = 0x8082ED10; // type:func -Player_AnimPlayLoopAdjusted = 0x8082ED34; // type:func -Player_AnimPlayOnceAdjusted = 0x8082ED64; // type:func -func_808322FC = 0x8082ED94; // type:func -func_80832318 = 0x8082EDB4; // type:func -func_80832340 = 0x8082EDE0; // type:func -Player_DetachHeldActor = 0x8082EE50; // type:func -func_80832440 = 0x8082EEDC; // type:func -func_80832528 = 0x8082EFC4; // type:func -func_80832564 = 0x8082F000; // type:func -func_80832594 = 0x8082F038; // type:func -func_80832630 = 0x8082F0D8; // type:func -Player_RequestRumble = 0x8082F0F4; // type:func -func_80832698 = 0x8082F140; // type:func -func_808326F0 = 0x8082F1A0; // type:func -func_8083275C = 0x8082F20C; // type:func -func_80832770 = 0x8082F228; // type:func -func_808327A4 = 0x8082F260; // type:func -func_808327C4 = 0x8082F288; // type:func -func_808327F8 = 0x8082F2C0; // type:func -func_80832854 = 0x8082F31C; // type:func -func_808328A0 = 0x8082F368; // type:func -func_808328EC = 0x8082F3B4; // type:func -Player_ProcessAnimSfxList = 0x8082F3E8; // type:func -Player_AnimChangeOnceMorph = 0x8082F5D0; // type:func -Player_AnimChangeOnceMorphAdjusted = 0x8082F63C; // type:func -Player_AnimChangeLoopMorph = 0x8082F6AC; // type:func -Player_AnimChangeFreeze = 0x8082F6F4; // type:func -Player_AnimChangeLoopSlowMorph = 0x8082F738; // type:func -func_80832CB0 = 0x8082F780; // type:func -Player_SkelAnimeResetPrevTranslRot = 0x8082F7D4; // type:func -Player_SkelAnimeResetPrevTranslRotAgeScale = 0x8082F7FC; // type:func -Player_ZeroRootLimbYaw = 0x8082F888; // type:func -func_80832DBC = 0x8082F898; // type:func -func_80832E48 = 0x8082F924; // type:func -Player_AnimReplaceApplyFlags = 0x8082FA34; // type:func -Player_AnimReplacePlayOnceSetSpeed = 0x8082FADC; // type:func -Player_AnimReplacePlayOnce = 0x8082FB24; // type:func -Player_AnimReplacePlayOnceAdjusted = 0x8082FB4C; // type:func -Player_AnimReplaceNormalPlayOnceAdjusted = 0x8082FB74; // type:func -Player_AnimReplacePlayLoopSetSpeed = 0x8082FB94; // type:func -Player_AnimReplacePlayLoop = 0x8082FBDC; // type:func -Player_AnimReplacePlayLoopAdjusted = 0x8082FC04; // type:func -Player_AnimReplaceNormalPlayLoopAdjusted = 0x8082FC2C; // type:func -Player_ProcessControlStick = 0x8082FC4C; // type:func -func_8083328C = 0x8082FD78; // type:func -func_808332B8 = 0x8082FDA8; // type:func -func_808332E4 = 0x8082FDD4; // type:func -func_808332F4 = 0x8082FDE8; // type:func -func_80833338 = 0x8082FE2C; // type:func -func_80833350 = 0x8082FE48; // type:func -func_808333FC = 0x8082FEFC; // type:func -func_80833438 = 0x8082FF38; // type:func -func_808334B4 = 0x8082FFB4; // type:func -func_808334E4 = 0x8082FFE8; // type:func -func_80833528 = 0x80830030; // type:func -func_8083356C = 0x80830078; // type:func -func_808335B0 = 0x808300C0; // type:func -func_808335F4 = 0x80830108; // type:func -Player_SetUpperActionFunc = 0x80830150; // type:func -Player_InitItemActionWithAnim = 0x8083017C; // type:func -Player_ItemToItemAction = 0x8083023C; // type:func -Player_InitDefaultIA = 0x80830288; // type:func -Player_InitDekuStickIA = 0x80830298; // type:func -Player_InitHammerIA = 0x808302B4; // type:func -Player_InitBowOrSlingshotIA = 0x808302C4; // type:func -Player_InitExplosiveIA = 0x808302FC; // type:func -Player_InitHookshotIA = 0x8083043C; // type:func -Player_InitBoomerangIA = 0x808304AC; // type:func -Player_InitItemAction = 0x808304C8; // type:func -func_80833A20 = 0x80830554; // type:func -func_80833B2C = 0x8083065C; // type:func -func_80833B54 = 0x80830684; // type:func -func_80833BCC = 0x808306FC; // type:func -func_80833C04 = 0x80830738; // type:func -func_80833C3C = 0x80830774; // type:func -Player_ItemIsInUse = 0x8083078C; // type:func -Player_ItemIsItemAction = 0x808307D8; // type:func -Player_GetItemOnButton = 0x80830820; // type:func -Player_ProcessItemButtons = 0x8083093C; // type:func -Player_StartChangingHeldItem = 0x80830C24; // type:func -Player_UpdateItems = 0x80830DDC; // type:func -func_80834380 = 0x80830EC4; // type:func -func_8083442C = 0x80830F70; // type:func -Player_FinishItemChange = 0x808310D8; // type:func -func_80834644 = 0x80831188; // type:func -func_808346C4 = 0x80831208; // type:func -func_80834758 = 0x8083129C; // type:func -func_8083485C = 0x808313A4; // type:func -func_80834894 = 0x808313DC; // type:func -Player_WaitToFinishItemChange = 0x80831438; // type:func -func_8083499C = 0x808314E8; // type:func -Player_UpperAction_Sword = 0x80831528; // type:func -Player_UpperAction_ChangeHeldItem = 0x80831578; // type:func -func_80834B5C = 0x808316A8; // type:func -func_80834BD4 = 0x80831724; // type:func -func_80834C74 = 0x808317C8; // type:func -func_80834D2C = 0x80831880; // type:func -func_80834E44 = 0x80831998; // type:func -func_80834E7C = 0x808319D0; // type:func -func_80834EB8 = 0x80831A0C; // type:func -func_80834F2C = 0x80831A80; // type:func -func_80834FBC = 0x80831B10; // type:func -func_8083501C = 0x80831B70; // type:func -func_808350A4 = 0x80831BF8; // type:func -func_808351D4 = 0x80831D2C; // type:func -func_808353D8 = 0x80831F38; // type:func -func_80835588 = 0x808320E8; // type:func -func_808355DC = 0x80832144; // type:func -func_80835644 = 0x808321B0; // type:func -func_80835688 = 0x808321F8; // type:func -Player_UpperAction_CarryActor = 0x80832258; // type:func -func_808357E8 = 0x80832358; // type:func -func_80835800 = 0x80832374; // type:func -func_80835884 = 0x808323F8; // type:func -func_808358F0 = 0x80832464; // type:func -func_808359FC = 0x80832578; // type:func -func_80835B60 = 0x808326E0; // type:func -func_80835C08 = 0x80832788; // type:func -Player_SetupAction = 0x808327E0; // type:func -func_80835DAC = 0x8083293C; // type:func -func_80835DE4 = 0x80832970; // type:func -func_80835E44 = 0x808329D4; // type:func -func_80835EA4 = 0x80832A38; // type:func -Player_DestroyHookshot = 0x80832A94; // type:func -Player_UseItem = 0x80832AE4; // type:func -func_80836448 = 0x80832FEC; // type:func -Player_CanUpdateItems = 0x8083316C; // type:func -Player_UpdateUpperBody = 0x80833218; // type:func -func_80836898 = 0x80833440; // type:func -func_808368EC = 0x80833498; // type:func -func_808369C8 = 0x80833574; // type:func -func_80836AB8 = 0x80833660; // type:func -func_80836BEC = 0x80833794; // type:func -Player_CalcSpeedAndYawFromControlStick = 0x80833B58; // type:func -func_8083721C = 0x80833DC8; // type:func -Player_GetMovementSpeedAndYaw = 0x80833E1C; // type:func -Player_TryActionChangeList = 0x80833EFC; // type:func -func_808374A0 = 0x80834058; // type:func -func_80837530 = 0x808340F0; // type:func -func_808375D8 = 0x808341A0; // type:func -func_80837704 = 0x808342D0; // type:func -func_808377DC = 0x808343A8; // type:func -func_80837818 = 0x808343EC; // type:func -func_80837918 = 0x808344EC; // type:func -func_80837948 = 0x8083451C; // type:func -func_80837AE0 = 0x808346BC; // type:func -func_80837AFC = 0x808346D8; // type:func -func_80837B18 = 0x808346F8; // type:func -func_80837B60 = 0x80834740; // type:func -func_80837B9C = 0x8083477C; // type:func -func_80837C0C = 0x808347EC; // type:func -func_80838144 = 0x80834D24; // type:func -func_8083816C = 0x80834D4C; // type:func -func_8083819C = 0x80834D7C; // type:func -func_8083821C = 0x80834E00; // type:func -func_80838280 = 0x80834E64; // type:func -func_808382BC = 0x80834EA0; // type:func -func_808382DC = 0x80834EC0; // type:func -func_80838940 = 0x80835524; // type:func -func_808389E8 = 0x808355C8; // type:func -Player_ActionChange_12 = 0x808355F4; // type:func -func_80838E70 = 0x80835A50; // type:func -func_80838F18 = 0x80835B00; // type:func -func_80838F5C = 0x80835B4C; // type:func -func_80838FB8 = 0x80835BB0; // type:func -Player_HandleExitsAndVoids = 0x80835C2C; // type:func -Player_GetRelativePosition = 0x808361D0; // type:func -Player_SpawnFairy = 0x80836274; // type:func -func_808396F4 = 0x808362E8; // type:func -func_8083973C = 0x80836334; // type:func -Player_PosVsWallLineTest = 0x80836360; // type:func -Player_ActionChange_1 = 0x808363FC; // type:func -func_80839E88 = 0x80836A94; // type:func -func_80839F30 = 0x80836B38; // type:func -func_80839F90 = 0x80836B94; // type:func -func_80839FFC = 0x80836C00; // type:func -func_8083A060 = 0x80836C68; // type:func -func_8083A098 = 0x80836CA4; // type:func -func_8083A0D4 = 0x80836CE4; // type:func -func_8083A0F4 = 0x80836D04; // type:func -func_8083A2F8 = 0x80836F08; // type:func -func_8083A360 = 0x80836F78; // type:func -func_8083A388 = 0x80836FA0; // type:func -func_8083A3B0 = 0x80836FC8; // type:func -func_8083A40C = 0x80837020; // type:func -func_8083A434 = 0x80837048; // type:func -func_8083A4A8 = 0x808370BC; // type:func -func_8083A5C4 = 0x808371D8; // type:func -func_8083A6AC = 0x808372CC; // type:func -func_8083A9B8 = 0x808375D4; // type:func -func_8083AA10 = 0x8083762C; // type:func -func_8083AD4C = 0x80837968; // type:func -Player_StartCsAction = 0x808379F0; // type:func -func_8083AE40 = 0x80837A5C; // type:func -func_8083AF44 = 0x80837AE4; // type:func -func_8083B010 = 0x80837BB8; // type:func -Player_ActionChange_13 = 0x80837BEC; // type:func -Player_ActionChange_4 = 0x808381F0; // type:func -func_8083B8F4 = 0x808384A0; // type:func -Player_ActionChange_0 = 0x80838548; // type:func -func_8083BA90 = 0x80838640; // type:func -func_8083BB20 = 0x808386D8; // type:func -func_8083BBA0 = 0x80838758; // type:func -func_8083BC04 = 0x808387C0; // type:func -func_8083BC7C = 0x80838838; // type:func -func_8083BCD0 = 0x8083888C; // type:func -Player_ActionChange_10 = 0x80838978; // type:func -func_8083BF50 = 0x80838B10; // type:func -func_8083C0B8 = 0x80838C74; // type:func -func_8083C0E8 = 0x80838CAC; // type:func -func_8083C148 = 0x80838D08; // type:func -Player_ActionChange_6 = 0x80838DA4; // type:func -Player_ActionChange_11 = 0x80838E80; // type:func -func_8083C484 = 0x80839058; // type:func -func_8083C50C = 0x808390E0; // type:func -Player_ActionChange_8 = 0x80839118; // type:func -func_8083C61C = 0x808391F4; // type:func -func_8083C6B8 = 0x80839290; // type:func -func_8083C858 = 0x80839434; // type:func -func_8083C8DC = 0x808394B8; // type:func -func_8083C910 = 0x808394EC; // type:func -func_8083CA20 = 0x80839600; // type:func -func_8083CA54 = 0x80839638; // type:func -func_8083CA9C = 0x80839680; // type:func -func_8083CB2C = 0x80839714; // type:func -func_8083CB94 = 0x80839778; // type:func -func_8083CBF0 = 0x808397D4; // type:func -func_8083CC9C = 0x8083987C; // type:func -func_8083CD00 = 0x808398DC; // type:func -func_8083CD54 = 0x80839930; // type:func -func_8083CE0C = 0x808399EC; // type:func -func_8083CEAC = 0x80839A88; // type:func -func_8083CF10 = 0x80839AE8; // type:func -func_8083CF5C = 0x80839B30; // type:func -func_8083CFA8 = 0x80839B78; // type:func -func_8083D0A8 = 0x80839C80; // type:func -func_8083D12C = 0x80839D08; // type:func -func_8083D330 = 0x80839F10; // type:func -func_8083D36C = 0x80839F4C; // type:func -func_8083D53C = 0x8083A120; // type:func -func_8083D6EC = 0x8083A2D0; // type:func -func_8083DB98 = 0x8083A780; // type:func -func_8083DC54 = 0x8083A83C; // type:func -func_8083DDC8 = 0x8083A9B0; // type:func -func_8083DF68 = 0x8083AB58; // type:func -func_8083DFE0 = 0x8083ABD4; // type:func -Player_ActionChange_3 = 0x8083ACF4; // type:func -Player_GetSlopeDirection = 0x8083AE94; // type:func -Player_HandleSlopes = 0x8083AF10; // type:func -func_8083E4C4 = 0x8083B0C4; // type:func -Player_ActionChange_2 = 0x8083B1AC; // type:func -func_8083EA94 = 0x8083B644; // type:func -func_8083EAF0 = 0x8083B6A0; // type:func -Player_ActionChange_9 = 0x8083B6F4; // type:func -func_8083EC18 = 0x8083B7C8; // type:func -func_8083F070 = 0x8083BC24; // type:func -Player_TryEnteringCrawlspace = 0x8083BC7C; // type:func -func_8083F360 = 0x8083BF18; // type:func -func_8083F524 = 0x8083C0DC; // type:func -Player_TryLeavingCrawlspace = 0x8083C128; // type:func -func_8083F72C = 0x8083C2E4; // type:func -Player_ActionChange_5 = 0x8083C370; // type:func -func_8083F9D0 = 0x8083C588; // type:func -func_8083FAB8 = 0x8083C670; // type:func -func_8083FB14 = 0x8083C6CC; // type:func -func_8083FB7C = 0x8083C734; // type:func -func_8083FBC0 = 0x8083C774; // type:func -func_8083FC68 = 0x8083C824; // type:func -func_8083FD78 = 0x8083C934; // type:func -func_8083FFB8 = 0x8083CB78; // type:func -func_80840058 = 0x8083CC18; // type:func -func_80840138 = 0x8083CD00; // type:func -func_808401B0 = 0x8083CD78; // type:func -func_8084021C = 0x8083CDE4; // type:func -func_8084029C = 0x8083CE64; // type:func -Player_Action_80840450 = 0x8083D01C; // type:func -Player_Action_808407CC = 0x8083D398; // type:func -func_808409CC = 0x8083D598; // type:func -Player_Action_80840BC8 = 0x8083D794; // type:func -Player_Action_80840DE4 = 0x8083D9B4; // type:func -func_80841138 = 0x8083DD08; // type:func -func_8084140C = 0x8083DFE4; // type:func -func_80841458 = 0x8083E030; // type:func -Player_Action_808414F8 = 0x8083E0D0; // type:func -func_808416C0 = 0x8083E2A4; // type:func -Player_Action_8084170C = 0x8083E2F0; // type:func -Player_Action_808417FC = 0x8083E3E0; // type:func -func_80841860 = 0x8083E444; // type:func -Player_Action_8084193C = 0x8083E520; // type:func -Player_Action_80841BA8 = 0x8083E784; // type:func -func_80841CC4 = 0x8083E8A0; // type:func -func_80841EE4 = 0x8083EAC4; // type:func -Player_Action_80842180 = 0x8083ED68; // type:func -Player_Action_8084227C = 0x8083EE6C; // type:func -Player_Action_808423EC = 0x8083EFE0; // type:func -Player_Action_8084251C = 0x8083F110; // type:func -func_8084260C = 0x8083F200; // type:func -func_8084269C = 0x8083F290; // type:func -Player_Action_8084279C = 0x8083F390; // type:func -func_8084285C = 0x8083F450; // type:func -func_808428D8 = 0x8083F4CC; // type:func -func_80842964 = 0x8083F55C; // type:func -Player_RequestQuake = 0x8083F5B4; // type:func -func_80842A28 = 0x8083F628; // type:func -func_80842A88 = 0x8083F68C; // type:func -func_80842AC4 = 0x8083F6C8; // type:func -func_80842B7C = 0x8083F784; // type:func -func_80842CF0 = 0x8083F8FC; // type:func -func_80842D20 = 0x8083F934; // type:func -func_80842DF4 = 0x8083FA0C; // type:func -Player_Action_80843188 = 0x8083FDA0; // type:func -Player_Action_808435C4 = 0x808401DC; // type:func -Player_Action_8084370C = 0x80840328; // type:func -Player_Action_8084377C = 0x8084039C; // type:func -Player_Action_80843954 = 0x80840578; // type:func -Player_Action_80843A38 = 0x80840660; // type:func -func_80843AE8 = 0x80840714; // type:func -Player_Action_80843CEC = 0x80840918; // type:func -func_80843E14 = 0x80840A44; // type:func -func_80843E64 = 0x80840A98; // type:func -func_8084409C = 0x80840CD0; // type:func -Player_Action_8084411C = 0x80840D58; // type:func -Player_Action_80844708 = 0x8084134C; // type:func -Player_Action_80844A44 = 0x80841688; // type:func -Player_Action_80844AF4 = 0x80841738; // type:func -func_80844BE4 = 0x80841828; // type:func -func_80844CF8 = 0x80841940; // type:func -func_80844D30 = 0x80841978; // type:func -func_80844D68 = 0x808419B0; // type:func -func_80844DC8 = 0x80841A14; // type:func -func_80844E3C = 0x80841A88; // type:func -Player_Action_80844E68 = 0x80841AB8; // type:func -Player_Action_80845000 = 0x80841C50; // type:func -Player_Action_80845308 = 0x80841F58; // type:func -Player_Action_80845668 = 0x808422B8; // type:func -Player_Action_808458D0 = 0x80842524; // type:func -func_80845964 = 0x808425B8; // type:func -func_80845BA0 = 0x808427FC; // type:func -func_80845C68 = 0x808428C8; // type:func -Player_Action_80845CA4 = 0x80842908; // type:func -Player_Action_80845EF8 = 0x80842B68; // type:func -Player_Action_80846050 = 0x80842CC0; // type:func -Player_Action_80846120 = 0x80842D98; // type:func -Player_Action_80846260 = 0x80842ED8; // type:func -Player_Action_80846358 = 0x80842FD8; // type:func -Player_Action_80846408 = 0x80843088; // type:func -Player_Action_808464B0 = 0x80843130; // type:func -Player_Action_80846578 = 0x808431FC; // type:func -func_8084663C = 0x808432C4; // type:func -func_80846648 = 0x808432D4; // type:func -func_80846660 = 0x808432F0; // type:func -func_80846720 = 0x808433B0; // type:func -func_808467D4 = 0x80843464; // type:func -func_808468A8 = 0x80843540; // type:func -func_808468E8 = 0x80843588; // type:func -func_80846978 = 0x80843618; // type:func -func_808469BC = 0x8084365C; // type:func -func_80846A00 = 0x8084369C; // type:func -func_80846A68 = 0x80843708; // type:func -Player_InitCommon = 0x80843748; // type:func -Player_Init = 0x80843978; // type:func -func_808471F4 = 0x80843E88; // type:func -func_80847298 = 0x80843F2C; // type:func -func_808473D4 = 0x80844068; // type:func -Player_UpdateHoverBoots = 0x80844718; // type:func -Player_ProcessSceneCollision = 0x80844840; // type:func -Player_UpdateCamAndSeqModes = 0x80845348; // type:func -func_80848A04 = 0x808456A8; // type:func -Player_UpdateBodyShock = 0x808457F0; // type:func -Player_UpdateBodyBurn = 0x80845920; // type:func -func_80848EF8 = 0x80845BA4; // type:func -Player_UpdateCommon = 0x80845C4C; // type:func -Player_Update = 0x80846B58; // type:func -Player_DrawGameplay = 0x80846D90; // type:func -Player_Draw = 0x80847234; // type:func -Player_Destroy = 0x80847794; // type:func -func_8084ABD8 = 0x80847818; // type:func -func_8084AEEC = 0x80847B2C; // type:func -func_8084B000 = 0x80847C48; // type:func -func_8084B158 = 0x80847DA8; // type:func -Player_Action_8084B1D8 = 0x80847E28; // type:func -func_8084B3CC = 0x80848018; // type:func -func_8084B498 = 0x808480EC; // type:func -func_8084B4D4 = 0x80848128; // type:func -Player_Action_8084B530 = 0x80848188; // type:func -Player_Action_8084B78C = 0x808483F0; // type:func -func_8084B840 = 0x808484A4; // type:func -Player_Action_8084B898 = 0x80848500; // type:func -Player_Action_8084B9E4 = 0x8084864C; // type:func -Player_Action_8084BBE4 = 0x80848850; // type:func -Player_Action_8084BDFC = 0x80848A68; // type:func -func_8084BEE4 = 0x80848B50; // type:func -Player_Action_8084BF1C = 0x80848B88; // type:func -Player_Action_8084C5F8 = 0x80849268; // type:func -Player_Action_8084C760 = 0x808493D0; // type:func -Player_Action_8084C81C = 0x8084948C; // type:func -func_8084C89C = 0x8084950C; // type:func -func_8084C9BC = 0x80849638; // type:func -func_8084CBF4 = 0x80849874; // type:func -Player_Action_8084CC98 = 0x8084991C; // type:func -Player_Action_8084D3E4 = 0x8084A06C; // type:func -func_8084D530 = 0x8084A1C0; // type:func -func_8084D574 = 0x8084A208; // type:func -func_8084D5CC = 0x8084A264; // type:func -Player_Action_8084D610 = 0x8084A2B0; // type:func -Player_Action_8084D7C4 = 0x8084A460; // type:func -Player_Action_8084D84C = 0x8084A4F0; // type:func -func_8084D980 = 0x8084A624; // type:func -Player_Action_8084DAB4 = 0x8084A75C; // type:func -func_8084DBC4 = 0x8084A86C; // type:func -Player_Action_8084DC48 = 0x8084A8F0; // type:func -func_8084DF6C = 0x8084AC1C; // type:func -func_8084DFAC = 0x8084AC60; // type:func -func_8084DFF4 = 0x8084ACAC; // type:func -Player_Action_8084E1EC = 0x8084AEA4; // type:func -Player_Action_8084E30C = 0x8084AFC4; // type:func -Player_Action_8084E368 = 0x8084B024; // type:func -Player_Action_8084E3C4 = 0x8084B084; // type:func -Player_Action_8084E604 = 0x8084B2C4; // type:func -Player_Action_8084E6D4 = 0x8084B394; // type:func -func_8084E988 = 0x8084B648; // type:func -Player_Action_8084E9AC = 0x8084B66C; // type:func -Player_Action_8084EAC0 = 0x8084B780; // type:func -Player_Action_8084ECA4 = 0x8084B96C; // type:func -Player_Action_8084EED8 = 0x8084BBA4; // type:func -Player_Action_8084EFC0 = 0x8084BC8C; // type:func -Player_Action_8084F104 = 0x8084BDD4; // type:func -Player_Action_8084F308 = 0x8084BFDC; // type:func -Player_Action_8084F390 = 0x8084C064; // type:func -Player_Action_8084F608 = 0x8084C2DC; // type:func -Player_Action_8084F698 = 0x8084C36C; // type:func -Player_Action_8084F710 = 0x8084C3E4; // type:func -Player_Action_8084F88C = 0x8084C560; // type:func -Player_Action_8084F9A0 = 0x8084C674; // type:func -Player_Action_8084F9C0 = 0x8084C694; // type:func -Player_Action_8084FA54 = 0x8084C728; // type:func -Player_Action_8084FB10 = 0x8084C7E4; // type:func -Player_Action_8084FBF4 = 0x8084C8C8; // type:func -func_8084FF7C = 0x8084C980; // type:func -Player_UpdateBunnyEars = 0x8084CA34; // type:func -Player_ActionChange_7 = 0x8084CC2C; // type:func -Player_Action_808502D0 = 0x8084CCD8; // type:func -Player_Action_808505DC = 0x8084CFE8; // type:func -Player_Action_8085063C = 0x8084D048; // type:func -Player_Action_8085076C = 0x8084D178; // type:func -Player_Action_808507F4 = 0x8084D200; // type:func -Player_Action_80850AEC = 0x8084D4FC; // type:func -Player_Action_80850C68 = 0x8084D67C; // type:func -Player_Action_80850E84 = 0x8084D898; // type:func -Player_AnimChangeOnceMorphZeroRootYawSpeed = 0x8084D8EC; // type:func -Player_AnimChangeOnceMorphAdjustedZeroRootYawSpeed = 0x8084D930; // type:func -Player_AnimChangeLoopMorphAdjustedZeroRootYawSpeed = 0x8084D9B0; // type:func -func_80851008 = 0x8084DA1C; // type:func -func_80851030 = 0x8084DA44; // type:func -func_80851050 = 0x8084DA64; // type:func -func_80851094 = 0x8084DAA8; // type:func -func_808510B4 = 0x8084DAC8; // type:func -func_808510D4 = 0x8084DAE8; // type:func -func_808510F4 = 0x8084DB08; // type:func -func_80851114 = 0x8084DB28; // type:func -func_80851134 = 0x8084DB48; // type:func -func_80851154 = 0x8084DB68; // type:func -func_80851174 = 0x8084DB88; // type:func -func_80851194 = 0x8084DBA8; // type:func -func_808511B4 = 0x8084DBC8; // type:func -func_808511D4 = 0x8084DBE8; // type:func -func_808511FC = 0x8084DC14; // type:func -func_80851248 = 0x8084DC68; // type:func -func_80851294 = 0x8084DCBC; // type:func -func_808512E0 = 0x8084DD10; // type:func -func_80851314 = 0x8084DD48; // type:func -func_80851368 = 0x8084DD9C; // type:func -func_808513BC = 0x8084DDF0; // type:func -func_808514C0 = 0x8084DEF8; // type:func -func_8085157C = 0x8084DFB4; // type:func -func_808515A4 = 0x8084DFE0; // type:func -func_80851688 = 0x8084E0C4; // type:func -func_80851750 = 0x8084E194; // type:func -func_80851788 = 0x8084E1D0; // type:func -func_80851828 = 0x8084E270; // type:func -func_808518DC = 0x8084E328; // type:func -func_8085190C = 0x8084E35C; // type:func -func_80851998 = 0x8084E3E8; // type:func -func_808519C0 = 0x8084E410; // type:func -func_808519EC = 0x8084E43C; // type:func -func_80851A50 = 0x8084E4A0; // type:func -func_80851B90 = 0x8084E5E0; // type:func -func_80851BE8 = 0x8084E63C; // type:func -func_80851CA4 = 0x8084E6FC; // type:func -func_80851D2C = 0x8084E788; // type:func -func_80851D80 = 0x8084E7E0; // type:func -func_80851DEC = 0x8084E854; // type:func -func_80851E28 = 0x8084E894; // type:func -func_80851E64 = 0x8084E8D4; // type:func -func_80851E90 = 0x8084E900; // type:func -func_80851ECC = 0x8084E940; // type:func -func_80851F14 = 0x8084E990; // type:func -func_80851F84 = 0x8084EA04; // type:func -func_80851FB0 = 0x8084EA30; // type:func -func_80852048 = 0x8084EACC; // type:func -func_80852080 = 0x8084EB08; // type:func -func_808520BC = 0x8084EB48; // type:func -func_80852174 = 0x8084EC00; // type:func -func_808521B8 = 0x8084EC4C; // type:func -func_808521F4 = 0x8084EC8C; // type:func -func_80852234 = 0x8084ECCC; // type:func -func_8085225C = 0x8084ECF8; // type:func -func_80852280 = 0x8084ED1C; // type:func -func_80852298 = 0x8084ED38; // type:func -func_80852328 = 0x8084EDCC; // type:func -func_80852358 = 0x8084EDFC; // type:func -func_80852388 = 0x8084EE2C; // type:func -func_80852414 = 0x8084EEBC; // type:func -func_80852450 = 0x8084EEFC; // type:func -func_80852480 = 0x8084EF2C; // type:func -func_808524B0 = 0x8084EF5C; // type:func -func_808524D0 = 0x8084EF80; // type:func -func_80852514 = 0x8084EFC8; // type:func -func_80852544 = 0x8084EFFC; // type:func -func_80852554 = 0x8084F010; // type:func -func_80852564 = 0x8084F024; // type:func -func_808525C0 = 0x8084F088; // type:func -func_80852608 = 0x8084F0D4; // type:func -func_80852648 = 0x8084F11C; // type:func -func_808526EC = 0x8084F1C4; // type:func -func_8085283C = 0x8084F31C; // type:func -func_808528C8 = 0x8084F3AC; // type:func -func_80852944 = 0x8084F42C; // type:func -func_808529D0 = 0x8084F4B8; // type:func -func_80852A54 = 0x8084F540; // type:func -func_80852B4C = 0x8084F638; // type:func -func_80852C0C = 0x8084F6F8; // type:func -func_80852C50 = 0x8084F73C; // type:func -Player_Action_CsAction = 0x8084F8F8; // type:func -Player_IsDroppingFish = 0x8084F9A0; // type:func -Player_StartFishing = 0x8084F9D4; // type:func -func_80852F38 = 0x8084FA10; // type:func -Player_TryCsAction = 0x8084FADC; // type:func -func_80853080 = 0x8084FB60; // type:func -Player_InflictDamage = 0x8084FBBC; // type:func -func_80853148 = 0x8084FC24; // type:func -EnTest_SetupAction = 0x8085BF50; // type:func -EnTest_Init = 0x8085BF5C; // type:func -EnTest_Destroy = 0x8085C1A8; // type:func -EnTest_ChooseRandomAction = 0x8085C240; // type:func -EnTest_ChooseAction = 0x8085C3BC; // type:func -EnTest_SetupWaitGround = 0x8085C6DC; // type:func -EnTest_WaitGround = 0x8085C754; // type:func -EnTest_SetupWaitAbove = 0x8085C834; // type:func -EnTest_WaitAbove = 0x8085C8A8; // type:func -EnTest_SetupIdle = 0x8085C974; // type:func -EnTest_Idle = 0x8085C9F8; // type:func -EnTest_Fall = 0x8085CC28; // type:func -EnTest_Land = 0x8085CCDC; // type:func -EnTest_SetupWalkAndBlock = 0x8085CD4C; // type:func -EnTest_WalkAndBlock = 0x8085CE10; // type:func -func_80860BDC = 0x8085D4F4; // type:func -func_80860C24 = 0x8085D53C; // type:func -func_80860EC0 = 0x8085D7D8; // type:func -func_80860F84 = 0x8085D89C; // type:func -EnTest_SetupSlashDown = 0x8085DD30; // type:func -EnTest_SlashDown = 0x8085DDB4; // type:func -EnTest_SetupSlashDownEnd = 0x8085DEC0; // type:func -EnTest_SlashDownEnd = 0x8085DF10; // type:func -EnTest_SetupSlashUp = 0x8085E13C; // type:func -EnTest_SlashUp = 0x8085E1B8; // type:func -EnTest_SetupJumpBack = 0x8085E270; // type:func -EnTest_JumpBack = 0x8085E310; // type:func -EnTest_SetupJumpslash = 0x8085E4B8; // type:func -EnTest_Jumpslash = 0x8085E564; // type:func -EnTest_SetupJumpUp = 0x8085E674; // type:func -EnTest_JumpUp = 0x8085E6EC; // type:func -EnTest_SetupStopAndBlock = 0x8085E7E4; // type:func -EnTest_StopAndBlock = 0x8085E8A4; // type:func -EnTest_SetupIdleFromBlock = 0x8085E974; // type:func -EnTest_IdleFromBlock = 0x8085E9C0; // type:func -func_80862154 = 0x8085EA78; // type:func -func_808621D4 = 0x8085EAF8; // type:func -func_80862398 = 0x8085ECC0; // type:func -func_80862418 = 0x8085ED40; // type:func -EnTest_SetupStunned = 0x8085EEA4; // type:func -EnTest_Stunned = 0x8085EF80; // type:func -func_808627C4 = 0x8085F0F8; // type:func -func_808628C8 = 0x8085F1FC; // type:func -func_80862DBC = 0x8085F6F4; // type:func -func_80862E6C = 0x8085F7A8; // type:func -func_80862FA8 = 0x8085F8E4; // type:func -func_80863044 = 0x8085F980; // type:func -func_808630F0 = 0x8085FA2C; // type:func -func_8086318C = 0x8085FAC8; // type:func -EnTest_SetupRecoil = 0x8085FB7C; // type:func -EnTest_Recoil = 0x8085FBD0; // type:func -EnTest_Rise = 0x8085FC9C; // type:func -func_808633E8 = 0x8085FD24; // type:func -EnTest_UpdateHeadRot = 0x8085FDA0; // type:func -EnTest_UpdateDamage = 0x8085FE38; // type:func -EnTest_Update = 0x8085FFD8; // type:func -EnTest_OverrideLimbDraw = 0x80860404; // type:func -EnTest_PostLimbDraw = 0x808605D8; // type:func -EnTest_Draw = 0x80860960; // type:func -func_80864158 = 0x80860A74; // type:func -EnTest_ReactToProjectile = 0x80860B04; // type:func -ArmsHook_SetupAction = 0x80861800; // type:func -ArmsHook_Init = 0x8086180C; // type:func -ArmsHook_Destroy = 0x80861880; // type:func -ArmsHook_Wait = 0x808618C8; // type:func -func_80865044 = 0x80861948; // type:func -ArmsHook_AttachToPlayer = 0x8086195C; // type:func -ArmsHook_DetachHookFromActor = 0x8086198C; // type:func -ArmsHook_CheckForCancel = 0x808619B4; // type:func -ArmsHook_AttachHookToActor = 0x80861A50; // type:func -ArmsHook_Shoot = 0x80861A98; // type:func -ArmsHook_Update = 0x80862104; // type:func -ArmsHook_Draw = 0x80862144; // type:func -ArrowFire_SetupAction = 0x80862570; // type:func -ArrowFire_Init = 0x8086257C; // type:func -ArrowFire_Destroy = 0x808625F8; // type:func -ArrowFire_Charge = 0x8086261C; // type:func -func_80865ECC = 0x80862710; // type:func -ArrowFire_Hit = 0x80862768; // type:func -ArrowFire_Fly = 0x80862934; // type:func -ArrowFire_Update = 0x80862A88; // type:func -ArrowFire_Draw = 0x80862ADC; // type:func -ArrowIce_SetupAction = 0x80864450; // type:func -ArrowIce_Init = 0x8086445C; // type:func -ArrowIce_Destroy = 0x808644D8; // type:func -ArrowIce_Charge = 0x808644FC; // type:func -func_80867E8C = 0x808645F0; // type:func -ArrowIce_Hit = 0x80864648; // type:func -ArrowIce_Fly = 0x80864814; // type:func -ArrowIce_Update = 0x80864968; // type:func -ArrowIce_Draw = 0x808649BC; // type:func -ArrowLight_SetupAction = 0x80866350; // type:func -ArrowLight_Init = 0x8086635C; // type:func -ArrowLight_Destroy = 0x808663D8; // type:func -ArrowLight_Charge = 0x808663FC; // type:func -func_80869E6C = 0x808664F0; // type:func -ArrowLight_Hit = 0x80866548; // type:func -ArrowLight_Fly = 0x80866714; // type:func -ArrowLight_Update = 0x80866868; // type:func -ArrowLight_Draw = 0x808668BC; // type:func -BgBdanObjects_GetProperty = 0x80868260; // type:func -BgBdanObjects_SetProperty = 0x808682B4; // type:func -BgBdanObjects_Init = 0x80868308; // type:func -BgBdanObjects_Destroy = 0x8086858C; // type:func -BgBdanObjects_OctoPlatform_WaitForRutoToStartCutscene = 0x808685DC; // type:func -BgBdanObjects_OctoPlatform_RaiseToUpperPosition = 0x80868730; // type:func -BgBdanObjects_OctoPlatform_WaitForRutoToAdvanceCutscene = 0x8086882C; // type:func -BgBdanObjects_OctoPlatform_DescendWithBigOcto = 0x80868968; // type:func -BgBdanObjects_OctoPlatform_PauseBeforeDescending = 0x80868AEC; // type:func -BgBdanObjects_OctoPlatform_WaitForBigOctoToStartBattle = 0x80868B50; // type:func -BgBdanObjects_OctoPlatform_BattleInProgress = 0x80868BAC; // type:func -BgBdanObjects_SinkToFloorHeight = 0x80868C84; // type:func -BgBdanObjects_WaitForPlayerInRange = 0x80868D04; // type:func -BgBdanObjects_RaiseToUpperPosition = 0x80868D70; // type:func -BgBdanObjects_DoNothing = 0x80868E08; // type:func -BgBdanObjects_ElevatorOscillate = 0x80868E18; // type:func -BgBdanObjects_WaitForSwitch = 0x80868F4C; // type:func -BgBdanObjects_ChangeWaterBoxLevel = 0x80868F98; // type:func -BgBdanObjects_WaitForTimerExpired = 0x80869060; // type:func -BgBdanObjects_WaitForPlayerOnTop = 0x808690B4; // type:func -BgBdanObjects_FallToLowerPos = 0x80869138; // type:func -BgBdanObjects_Update = 0x808691F4; // type:func -BgBdanObjects_Draw = 0x80869230; // type:func -BgBdanSwitch_InitDynaPoly = 0x80869530; // type:func -BgBdanSwitch_InitCollision = 0x80869588; // type:func -func_8086D0EC = 0x808695DC; // type:func -BgBdanSwitch_Init = 0x80869748; // type:func -BgBdanSwitch_Destroy = 0x80869904; // type:func -func_8086D4B4 = 0x80869970; // type:func -func_8086D548 = 0x80869A04; // type:func -func_8086D5C4 = 0x80869A80; // type:func -func_8086D5E0 = 0x80869AA0; // type:func -func_8086D67C = 0x80869B3C; // type:func -func_8086D694 = 0x80869B58; // type:func -func_8086D730 = 0x80869BF8; // type:func -func_8086D754 = 0x80869C20; // type:func -func_8086D7FC = 0x80869CC8; // type:func -func_8086D80C = 0x80869CDC; // type:func -func_8086D86C = 0x80869D3C; // type:func -func_8086D888 = 0x80869D5C; // type:func -func_8086D8BC = 0x80869D94; // type:func -func_8086D8CC = 0x80869DA8; // type:func -func_8086D944 = 0x80869E20; // type:func -func_8086D95C = 0x80869E3C; // type:func -func_8086D9F8 = 0x80869EDC; // type:func -func_8086DA1C = 0x80869F04; // type:func -func_8086DAB4 = 0x80869FA0; // type:func -func_8086DAC4 = 0x80869FB4; // type:func -func_8086DB24 = 0x8086A014; // type:func -func_8086DB40 = 0x8086A034; // type:func -func_8086DB4C = 0x8086A044; // type:func -func_8086DB68 = 0x8086A064; // type:func -func_8086DC30 = 0x8086A12C; // type:func -func_8086DC48 = 0x8086A148; // type:func -func_8086DCCC = 0x8086A1CC; // type:func -func_8086DCE8 = 0x8086A1EC; // type:func -func_8086DDA8 = 0x8086A2AC; // type:func -func_8086DDC0 = 0x8086A2C8; // type:func -BgBdanSwitch_Update = 0x8086A35C; // type:func -func_8086DF58 = 0x8086A460; // type:func -BgBdanSwitch_Draw = 0x8086A4D0; // type:func -BgBomGuard_SetupAction = 0x8086A960; // type:func -BgBomGuard_Init = 0x8086A96C; // type:func -BgBomGuard_Destroy = 0x8086AA08; // type:func -func_8086E638 = 0x8086AA3C; // type:func -BgBomGuard_Update = 0x8086AB08; // type:func -BgBombwall_InitDynapoly = 0x8086AB80; // type:func -BgBombwall_RotateVec = 0x8086ABD8; // type:func -BgBombwall_Init = 0x8086AC2C; // type:func -BgBombwall_DestroyCollision = 0x8086AE3C; // type:func -BgBombwall_Destroy = 0x8086AEB8; // type:func -func_8086EB5C = 0x8086AED8; // type:func -func_8086ED50 = 0x8086B0CC; // type:func -func_8086ED70 = 0x8086B0F0; // type:func -func_8086EDFC = 0x8086B180; // type:func -func_8086EE40 = 0x8086B1C4; // type:func -func_8086EE94 = 0x8086B218; // type:func -BgBombwall_Update = 0x8086B248; // type:func -BgBombwall_Draw = 0x8086B274; // type:func -BgBowlWall_Init = 0x8086B440; // type:func -BgBowlWall_Destroy = 0x8086B4F8; // type:func -BgBowlWall_SpawnBullseyes = 0x8086B52C; // type:func -BgBowlWall_WaitForHit = 0x8086B6FC; // type:func -BgBowlWall_FallDoEffects = 0x8086B720; // type:func -BgBowlWall_FinishFall = 0x8086B9D4; // type:func -BgBowlWall_Reset = 0x8086BAB4; // type:func -BgBowlWall_Update = 0x8086BB4C; // type:func -BgBowlWall_Draw = 0x8086BB80; // type:func -BgBreakwall_SetupAction = 0x8086BDC0; // type:func -BgBreakwall_Init = 0x8086BDCC; // type:func -BgBreakwall_Destroy = 0x8086BF78; // type:func -BgBreakwall_SpawnFragments = 0x8086BFAC; // type:func -BgBreakwall_WaitForObject = 0x8086C47C; // type:func -BgBreakwall_Wait = 0x8086C584; // type:func -BgBreakwall_LavaCoverMove = 0x8086C754; // type:func -BgBreakwall_Update = 0x8086C7A8; // type:func -BgBreakwall_Draw = 0x8086C7CC; // type:func -BgDdanJd_Init = 0x8086CC30; // type:func -BgDdanJd_Destroy = 0x8086CCDC; // type:func -BgDdanJd_Idle = 0x8086CD10; // type:func -BgDdanJd_MoveEffects = 0x8086CEB4; // type:func -BgDdanJd_Move = 0x8086D08C; // type:func -BgDdanJd_Update = 0x8086D190; // type:func -BgDdanJd_Draw = 0x8086D1B4; // type:func -BgDdanKd_SetupAction = 0x8086D280; // type:func -BgDdanKd_Init = 0x8086D28C; // type:func -BgDdanKd_Destroy = 0x8086D384; // type:func -BgDdanKd_CheckForExplosions = 0x8086D3CC; // type:func -BgDdanKd_LowerStairs = 0x8086D4E4; // type:func -BgDdanKd_DoNothing = 0x8086D9B8; // type:func -BgDdanKd_Update = 0x8086D9C8; // type:func -BgDdanKd_Draw = 0x8086D9EC; // type:func -BgDodoago_SetupAction = 0x8086DB70; // type:func -BgDodoago_SpawnSparkles = 0x8086DB7C; // type:func -BgDodoago_Init = 0x8086DC9C; // type:func -BgDodoago_Destroy = 0x8086DE00; // type:func -BgDodoago_WaitExplosives = 0x8086DE6C; // type:func -BgDodoago_OpenJaw = 0x8086E130; // type:func -BgDodoago_DoNothing = 0x8086E3F4; // type:func -BgDodoago_LightOneEye = 0x8086E404; // type:func -BgDodoago_Update = 0x8086E468; // type:func -BgDodoago_Draw = 0x8086E5C0; // type:func -BgDyYoseizo_Init = 0x8086E920; // type:func -BgDyYoseizo_Destroy = 0x8086EA24; // type:func -BgDyYoseizo_SpawnEffects = 0x8086EA34; // type:func -BgDyYoseizo_Bob = 0x8086ED30; // type:func -BgDyYoseizo_CheckMagicAcquired = 0x8086EDF8; // type:func -BgDyYoseizo_ChooseType = 0x8086EEBC; // type:func -BgDyYoseizo_SetupSpinGrow_NoReward = 0x8086F2B8; // type:func -BgDyYoseizo_SpinGrow_NoReward = 0x8086F3B4; // type:func -BgDyYoseizo_CompleteSpinGrow_NoReward = 0x8086F510; // type:func -BgDyYoseizo_SetupGreetPlayer_NoReward = 0x8086F5C0; // type:func -BgDyYoseizo_GreetPlayer_NoReward = 0x8086F6D8; // type:func -BgDyYoseizo_SetupHealPlayer_NoReward = 0x8086F7B4; // type:func -BgDyYoseizo_HealPlayer_NoReward = 0x8086F8A0; // type:func -BgDyYoseizo_SayFarewell_NoReward = 0x8086FB78; // type:func -BgDyYoseizo_SetupSpinShrink = 0x8086FC54; // type:func -BgDyYoseizo_SpinShrink = 0x8086FD58; // type:func -BgDyYoseizo_Vanish = 0x8086FE48; // type:func -BgDyYoseizo_SetupSpinGrow_Reward = 0x8086FEEC; // type:func -BgDyYoseizo_SpinGrowSetupGive_Reward = 0x80870020; // type:func -BgDyYoseizo_Give_Reward = 0x8087034C; // type:func -BgDyYoseizo_Update = 0x8087099C; // type:func -BgDyYoseizo_OverrideLimbDraw = 0x80870BC8; // type:func -BgDyYoseizo_Draw = 0x80870C30; // type:func -BgDyYoseizo_SpawnEffect = 0x80870DB8; // type:func -BgDyYoseizo_UpdateEffects = 0x80870EC8; // type:func -BgDyYoseizo_DrawEffects = 0x808711BC; // type:func -BgGanonOtyuka_Init = 0x80871710; // type:func -BgGanonOtyuka_Destroy = 0x808717AC; // type:func -BgGanonOtyuka_WaitToFall = 0x808717E0; // type:func -BgGanonOtyuka_Fall = 0x80871A30; // type:func -BgGanonOtyuka_DoNothing = 0x80871E70; // type:func -BgGanonOtyuka_Update = 0x80871E80; // type:func -BgGanonOtyuka_Draw = 0x80871EC8; // type:func -BgGateShutter_Init = 0x80873D50; // type:func -BgGateShutter_Destroy = 0x80873E38; // type:func -func_8087828C = 0x80873E6C; // type:func -func_80878300 = 0x80873EE0; // type:func -func_808783AC = 0x80873F90; // type:func -func_808783D4 = 0x80873FB8; // type:func -BgGateShutter_Update = 0x80874074; // type:func -BgGateShutter_Draw = 0x808740A8; // type:func -BgGjyoBridge_Init = 0x808741E0; // type:func -BgGjyoBridge_Destroy = 0x80874298; // type:func -func_808787A4 = 0x808742CC; // type:func -BgGjyoBridge_TriggerCutscene = 0x808742DC; // type:func -BgGjyoBridge_SpawnBridge = 0x80874434; // type:func -BgGjyoBridge_Update = 0x808744B0; // type:func -BgGjyoBridge_Draw = 0x808744D4; // type:func -BgGndDarkmeiro_ToggleBlock = 0x808746D0; // type:func -BgGndDarkmeiro_Init = 0x8087475C; // type:func -BgGndDarkmeiro_Destroy = 0x80874988; // type:func -BgGndDarkmeiro_Noop = 0x808749D0; // type:func -BgGndDarkmeiro_UpdateBlockTimer = 0x808749E0; // type:func -BgGndDarkmeiro_UpdateStaticBlock = 0x80874BD4; // type:func -BgGndDarkmeiro_UpdateSwitchBlock = 0x80874BE4; // type:func -BgGndDarkmeiro_Update = 0x80874C48; // type:func -BgGndDarkmeiro_DrawInvisiblePath = 0x80874C6C; // type:func -BgGndDarkmeiro_DrawSwitchBlock = 0x80874C9C; // type:func -BgGndDarkmeiro_DrawStaticBlock = 0x80874DB4; // type:func -BgGndFiremeiro_Init = 0x80874E90; // type:func -BgGndFiremeiro_Destroy = 0x80874F44; // type:func -BgGndFiremeiro_Sink = 0x80874F84; // type:func -BgGndFiremeiro_Shake = 0x80875040; // type:func -BgGndFiremeiro_Rise = 0x808751E4; // type:func -BgGndFiremeiro_Update = 0x808752A4; // type:func -BgGndFiremeiro_Draw = 0x808752C8; // type:func -BgGndIceblock_Init = 0x808753E0; // type:func -BgGndIceblock_Destroy = 0x808754CC; // type:func -BgGndIceblock_SetPosition = 0x80875500; // type:func -BgGndIceblock_CheckForBlock = 0x8087560C; // type:func -BgGndIceblock_NextAction = 0x80875648; // type:func -BgGndIceblock_SetNextPosition = 0x80875694; // type:func -BgGndIceblock_Idle = 0x808759C4; // type:func -BgGndIceblock_Reset = 0x80875A80; // type:func -BgGndIceblock_Fall = 0x80875B44; // type:func -BgGndIceblock_Hole = 0x80875BFC; // type:func -BgGndIceblock_Slide = 0x80875C98; // type:func -BgGndIceblock_Update = 0x80875FC8; // type:func -BgGndIceblock_Draw = 0x80875FEC; // type:func -BgGndNisekabe_Init = 0x808764E0; // type:func -BgGndNisekabe_Destroy = 0x8087651C; // type:func -BgGndNisekabe_Update = 0x8087652C; // type:func -BgGndNisekabe_Draw = 0x80876560; // type:func -BgGndSoulmeiro_Init = 0x80876650; // type:func -BgGndSoulmeiro_Destroy = 0x80876794; // type:func -func_8087AF38 = 0x808767D0; // type:func -func_8087B284 = 0x80876B1C; // type:func -func_8087B350 = 0x80876BE8; // type:func -BgGndSoulmeiro_Update = 0x80876C3C; // type:func -BgGndSoulmeiro_Draw = 0x80876C68; // type:func -BgHaka_Init = 0x80876EB0; // type:func -BgHaka_Destroy = 0x80876F2C; // type:func -func_8087B758 = 0x80876F60; // type:func -func_8087B7E8 = 0x80876FF0; // type:func -func_8087B938 = 0x80877144; // type:func -func_8087BAAC = 0x808772BC; // type:func -func_8087BAE4 = 0x808772F8; // type:func -BgHaka_Update = 0x80877370; // type:func -BgHaka_Draw = 0x80877394; // type:func -BgHakaGate_Init = 0x80877570; // type:func -BgHakaGate_Destroy = 0x80877840; // type:func -BgHakaGate_DoNothing = 0x8087789C; // type:func -BgHakaGate_StatueInactive = 0x808778AC; // type:func -BgHakaGate_StatueIdle = 0x808778E8; // type:func -BgHakaGate_StatueTurn = 0x80877A00; // type:func -BgHakaGate_FloorClosed = 0x80877BE4; // type:func -BgHakaGate_FloorOpen = 0x80877D6C; // type:func -BgHakaGate_GateWait = 0x80877DF8; // type:func -BgHakaGate_GateOpen = 0x80877E48; // type:func -BgHakaGate_SkullOfTruth = 0x80877ED8; // type:func -BgHakaGate_FalseSkull = 0x80877F34; // type:func -BgHakaGate_Update = 0x80877FB4; // type:func -BgHakaGate_DrawFlame = 0x80877FFC; // type:func -BgHakaGate_Draw = 0x808781D4; // type:func -BgHakaHuta_Init = 0x80878610; // type:func -BgHakaHuta_Destroy = 0x808786D0; // type:func -BgHakaHuta_SpawnDust = 0x80878704; // type:func -BgHakaHuta_PlaySfx = 0x808788C0; // type:func -BgHakaHuta_SpawnEnemies = 0x8087894C; // type:func -BgHakaHuta_Open = 0x80878C14; // type:func -BgHakaHuta_SlideOpen = 0x80878CC8; // type:func -func_8087D720 = 0x80878D7C; // type:func -BgHakaHuta_DoNothing = 0x80878F20; // type:func -BgHakaHuta_Update = 0x80878F30; // type:func -BgHakaHuta_Draw = 0x80878F54; // type:func -BgHakaMegane_Init = 0x808790B0; // type:func -BgHakaMegane_Destroy = 0x80879168; // type:func -func_8087DB24 = 0x8087919C; // type:func -func_8087DBF0 = 0x8087926C; // type:func -BgHakaMegane_DoNothing = 0x808792E0; // type:func -BgHakaMegane_Update = 0x808792F0; // type:func -BgHakaMegane_Draw = 0x80879314; // type:func -BgHakaMeganeBG_Init = 0x808794B0; // type:func -BgHakaMeganeBG_Destroy = 0x8087964C; // type:func -func_8087DFF8 = 0x80879680; // type:func -func_8087E040 = 0x808796C8; // type:func -func_8087E10C = 0x80879794; // type:func -func_8087E1E0 = 0x80879868; // type:func -func_8087E258 = 0x808798E0; // type:func -func_8087E288 = 0x80879910; // type:func -func_8087E2D8 = 0x80879960; // type:func -func_8087E34C = 0x808799D4; // type:func -BgHakaMeganeBG_Update = 0x808799E4; // type:func -BgHakaMeganeBG_Draw = 0x80879A08; // type:func -BgHakaSgami_Init = 0x80879B70; // type:func -BgHakaSgami_Destroy = 0x80879E18; // type:func -BgHakaSgami_SetupSpin = 0x80879E78; // type:func -BgHakaSgami_Spin = 0x80879EF0; // type:func -BgHakaSgami_Update = 0x8087A404; // type:func -BgHakaSgami_Draw = 0x8087A458; // type:func -BgHakaShip_Init = 0x8087A790; // type:func -BgHakaShip_Destroy = 0x8087A8D4; // type:func -BgHakaShip_ChildUpdatePosition = 0x8087A914; // type:func -BgHakaShip_WaitForSong = 0x8087A970; // type:func -BgHakaShip_CutsceneStationary = 0x8087A9E8; // type:func -BgHakaShip_Move = 0x8087AA84; // type:func -BgHakaShip_SetupCrash = 0x8087AC48; // type:func -BgHakaShip_CrashShake = 0x8087ACA4; // type:func -BgHakaShip_CrashFall = 0x8087AD34; // type:func -BgHakaShip_Update = 0x8087ADF4; // type:func -BgHakaShip_Draw = 0x8087AE34; // type:func -BgHakaTrap_Init = 0x8087B1E0; // type:func -BgHakaTrap_Destroy = 0x8087B480; // type:func -func_8087FFC0 = 0x8087B504; // type:func -func_808801B8 = 0x8087B704; // type:func -func_808802D8 = 0x8087B828; // type:func -func_80880484 = 0x8087B9D4; // type:func -func_808805C0 = 0x8087BB10; // type:func -func_808806BC = 0x8087BC0C; // type:func -func_808808F4 = 0x8087BE44; // type:func -func_808809B0 = 0x8087BF04; // type:func -func_808809E4 = 0x8087BF38; // type:func -func_80880AE8 = 0x8087C044; // type:func -func_80880C0C = 0x8087C168; // type:func -BgHakaTrap_Update = 0x8087C1DC; // type:func -func_80880D68 = 0x8087C2CC; // type:func -BgHakaTrap_Draw = 0x8087C368; // type:func -BgHakaTubo_Init = 0x8087C7B0; // type:func -BgHakaTubo_Destroy = 0x8087C8AC; // type:func -BgHakaTubo_Idle = 0x8087C904; // type:func -BgHakaTubo_DropCollectible = 0x8087CB70; // type:func -BgHakaTubo_Update = 0x8087CE34; // type:func -BgHakaTubo_DrawFlameCircle = 0x8087CE68; // type:func -BgHakaTubo_Draw = 0x8087D014; // type:func -BgHakaWater_Init = 0x8087D1D0; // type:func -BgHakaWater_Destroy = 0x8087D25C; // type:func -BgHakaWater_LowerWater = 0x8087D26C; // type:func -BgHakaWater_Wait = 0x8087D3B4; // type:func -BgHakaWater_ChangeWaterLevel = 0x8087D470; // type:func -BgHakaWater_Update = 0x8087D578; // type:func -BgHakaWater_Draw = 0x8087D59C; // type:func -BgHakaZou_Init = 0x8087D9D0; // type:func -BgHakaZou_Destroy = 0x8087DCB8; // type:func -func_808828F4 = 0x8087DD08; // type:func -BgHakaZou_Wait = 0x8087DE84; // type:func -func_80882BDC = 0x8087DFF4; // type:func -func_80882CC4 = 0x8087E0DC; // type:func -func_80882E54 = 0x8087E26C; // type:func -func_80883000 = 0x8087E41C; // type:func -func_80883104 = 0x8087E520; // type:func -func_80883144 = 0x8087E560; // type:func -func_80883254 = 0x8087E670; // type:func -func_80883328 = 0x8087E748; // type:func -func_808834D8 = 0x8087E8F8; // type:func -BgHakaZou_DoNothing = 0x8087E988; // type:func -BgHakaZou_Update = 0x8087E998; // type:func -BgHakaZou_Draw = 0x8087E9DC; // type:func -BgHeavyBlock_SetPieceRandRot = 0x8087EBC0; // type:func -BgHeavyBlock_InitPiece = 0x8087EC50; // type:func -BgHeavyBlock_SetupDynapoly = 0x8087EDCC; // type:func -BgHeavyBlock_Init = 0x8087EE40; // type:func -BgHeavyBlock_Destroy = 0x8087F084; // type:func -BgHeavyBlock_MovePiece = 0x8087F0CC; // type:func -BgHeavyBlock_SpawnDust = 0x8087F290; // type:func -BgHeavyBlock_SpawnPieces = 0x8087F5F4; // type:func -BgHeavyBlock_Wait = 0x8087F7EC; // type:func -BgHeavyBlock_LiftedUp = 0x8087F914; // type:func -BgHeavyBlock_Fly = 0x8087FA7C; // type:func -BgHeavyBlock_DoNothing = 0x8087FD94; // type:func -BgHeavyBlock_Land = 0x8087FDA4; // type:func -BgHeavyBlock_Update = 0x80880014; // type:func -BgHeavyBlock_Draw = 0x80880038; // type:func -BgHeavyBlock_DrawPiece = 0x808801A0; // type:func -BgHidanCurtain_Init = 0x808804B0; // type:func -BgHidanCurtain_Destroy = 0x808806C4; // type:func -BgHidanCurtain_WaitForSwitchOn = 0x808806F0; // type:func -BgHidanCurtain_WaitForCutscene = 0x808807A4; // type:func -BgHidanCurtain_WaitForClear = 0x808807D0; // type:func -BgHidanCurtain_WaitForSwitchOff = 0x80880814; // type:func -BgHidanCurtain_TurnOn = 0x80880858; // type:func -BgHidanCurtain_TurnOff = 0x808808CC; // type:func -BgHidanCurtain_WaitForTimer = 0x808809BC; // type:func -BgHidanCurtain_Update = 0x80880A20; // type:func -BgHidanCurtain_Draw = 0x80880CB4; // type:func -BgHidanDalm_Init = 0x80880F50; // type:func -BgHidanDalm_Destroy = 0x80881038; // type:func -BgHidanDalm_Wait = 0x80881080; // type:func -BgHidanDalm_Shrink = 0x80881204; // type:func -BgHidanDalm_Update = 0x808813B4; // type:func -BgHidanDalm_UpdateCollider = 0x80881414; // type:func -BgHidanDalm_Draw = 0x80881540; // type:func -BgHidanFirewall_Init = 0x808817A0; // type:func -BgHidanFirewall_Destroy = 0x80881840; // type:func -BgHidanFirewall_CheckProximity = 0x8088186C; // type:func -BgHidanFirewall_Wait = 0x808818DC; // type:func -BgHidanFirewall_Countdown = 0x80881924; // type:func -BgHidanFirewall_Erupt = 0x80881958; // type:func -BgHidanFirewall_Collide = 0x808819E8; // type:func -BgHidanFirewall_ColliderFollowPlayer = 0x80881A50; // type:func -BgHidanFirewall_Update = 0x80881BB4; // type:func -BgHidanFirewall_Draw = 0x80881C8C; // type:func -BgHidanFslift_Init = 0x80881F00; // type:func -BgHidanFslift_SetHookshotTargetPos = 0x80881FE8; // type:func -BgHidanFslift_Destroy = 0x80882048; // type:func -BgHidanFslift_SetupIdle = 0x8088207C; // type:func -BgHidanFslift_Idle = 0x80882098; // type:func -BgHidanFslift_Descend = 0x80882138; // type:func -BgHidanFslift_Ascend = 0x808821A4; // type:func -BgHidanFslift_Update = 0x80882240; // type:func -BgHidanFslift_Draw = 0x808822E8; // type:func -BgHidanFwbig_Init = 0x808823D0; // type:func -BgHidanFwbig_Destroy = 0x80882570; // type:func -BgHidanFwbig_UpdatePosition = 0x8088259C; // type:func -BgHidanFwbig_WaitForSwitch = 0x8088261C; // type:func -BgHidanFwbig_WaitForCs = 0x80882680; // type:func -BgHidanFwbig_Rise = 0x808826AC; // type:func -BgHidanFwbig_Lower = 0x80882720; // type:func -BgHidanFwbig_WaitForTimer = 0x80882800; // type:func -BgHidanFwbig_WaitForPlayer = 0x80882850; // type:func -BgHidanFwbig_Move = 0x808828B4; // type:func -BgHidanFwbig_MoveCollider = 0x80882954; // type:func -BgHidanFwbig_Update = 0x80882B54; // type:func -BgHidanFwbig_Draw = 0x80882CCC; // type:func -BgHidanHamstep_SetupAction = 0x808830B0; // type:func -BgHidanHamstep_SpawnChildren = 0x808830D0; // type:func -BgHidanHamstep_Init = 0x8088324C; // type:func -BgHidanHamstep_Destroy = 0x808834BC; // type:func -func_808884C8 = 0x80883510; // type:func -func_80888638 = 0x80883680; // type:func -func_80888694 = 0x808836DC; // type:func -func_80888734 = 0x8088377C; // type:func -func_808887C4 = 0x80883810; // type:func -func_80888860 = 0x808838AC; // type:func -func_808889B8 = 0x808839F8; // type:func -func_80888A58 = 0x80883A98; // type:func -BgHidanHamstep_DoNothing = 0x80883C30; // type:func -BgHidanHamstep_Update = 0x80883C40; // type:func -BgHidanHamstep_Draw = 0x80883C64; // type:func -BgHidanHrock_Init = 0x80883F60; // type:func -BgHidanHrock_Destroy = 0x80884290; // type:func -func_808894A4 = 0x808842D8; // type:func -func_808894B0 = 0x808842E8; // type:func -func_8088960C = 0x80884444; // type:func -func_808896B8 = 0x808844F0; // type:func -BgHidanHrock_Update = 0x808845D0; // type:func -BgHidanHrock_Draw = 0x808845F4; // type:func -BgHidanKousi_SetupAction = 0x80884790; // type:func -BgHidanKousi_Init = 0x8088479C; // type:func -BgHidanKousi_Destroy = 0x80884894; // type:func -func_80889ACC = 0x808848C8; // type:func -func_80889B5C = 0x80884954; // type:func -func_80889BC0 = 0x808849B8; // type:func -func_80889C18 = 0x80884A10; // type:func -func_80889C90 = 0x80884A88; // type:func -func_80889D28 = 0x80884B24; // type:func -BgHidanKousi_Update = 0x80884B34; // type:func -BgHidanKousi_Draw = 0x80884B58; // type:func -BgHidanKowarerukabe_InitDynaPoly = 0x80884D20; // type:func -BgHidanKowarerukabe_InitColliderSphere = 0x80884DBC; // type:func -BgHidanKowarerukabe_OffsetActorYPos = 0x80884E50; // type:func -BgHidanKowarerukabe_Init = 0x80884E7C; // type:func -BgHidanKowarerukabe_Destroy = 0x80884F2C; // type:func -BgHidanKowarerukabe_SpawnDust = 0x80884F74; // type:func -BgHidanKowarerukabe_FloorBreak = 0x80885098; // type:func -func_8088A67C = 0x80885364; // type:func -BgHidanKowarerukabe_LargeWallBreak = 0x808855FC; // type:func -BgHidanKowarerukabe_Break = 0x80885888; // type:func -BgHidanKowarerukabe_Update = 0x80885918; // type:func -BgHidanKowarerukabe_Draw = 0x808859E8; // type:func -BgHidanRock_Init = 0x80885C00; // type:func -BgHidanRock_Destroy = 0x80885D7C; // type:func -func_8088B24C = 0x80885DD0; // type:func -func_8088B268 = 0x80885DF0; // type:func -func_8088B5F4 = 0x80886180; // type:func -func_8088B634 = 0x808861C0; // type:func -func_8088B69C = 0x8088622C; // type:func -func_8088B79C = 0x8088632C; // type:func -func_8088B90C = 0x8088649C; // type:func -func_8088B954 = 0x808864E4; // type:func -func_8088B990 = 0x80886520; // type:func -BgHidanRock_Update = 0x8088670C; // type:func -func_8088BC40 = 0x808867DC; // type:func -BgHidanRock_Draw = 0x808869EC; // type:func -BgHidanRsekizou_Init = 0x80886D00; // type:func -BgHidanRsekizou_Destroy = 0x80886E04; // type:func -BgHidanRsekizou_Update = 0x80886E4C; // type:func -BgHidanRsekizou_DrawFireball = 0x80887210; // type:func -BgHidanRsekizou_Draw = 0x80887528; // type:func -func_8088CEC0 = 0x808878E0; // type:func -BgHidanSekizou_Init = 0x80887C9C; // type:func -BgHidanSekizou_Destroy = 0x80887E10; // type:func -func_8088D434 = 0x80887E58; // type:func -func_8088D720 = 0x80888144; // type:func -func_8088D750 = 0x80888174; // type:func -BgHidanSekizou_Update = 0x808882E0; // type:func -func_8088D9F4 = 0x8088841C; // type:func -func_8088DC50 = 0x80888664; // type:func -func_8088DE08 = 0x8088881C; // type:func -BgHidanSekizou_Draw = 0x808888FC; // type:func -BgHidanSima_Init = 0x80888D30; // type:func -BgHidanSima_Destroy = 0x80888E34; // type:func -func_8088E518 = 0x80888E7C; // type:func -func_8088E5D0 = 0x80888F38; // type:func -func_8088E6D0 = 0x8088903C; // type:func -func_8088E760 = 0x808890D4; // type:func -func_8088E7A8 = 0x8088911C; // type:func -func_8088E90C = 0x80889280; // type:func -BgHidanSima_Update = 0x808893E0; // type:func -func_8088EB54 = 0x808894D0; // type:func -BgHidanSima_Draw = 0x80889948; // type:func -BgHidanSyoku_Init = 0x80889C30; // type:func -BgHidanSyoku_Destroy = 0x80889CBC; // type:func -func_8088F47C = 0x80889CF0; // type:func -func_8088F4B8 = 0x80889D2C; // type:func -func_8088F514 = 0x80889D8C; // type:func -func_8088F5A0 = 0x80889E18; // type:func -func_8088F62C = 0x80889EA4; // type:func -BgHidanSyoku_Update = 0x80889F00; // type:func -BgHidanSyoku_Draw = 0x80889FA8; // type:func -BgIceObjects_Init = 0x8088A090; // type:func -BgIceObjects_Destroy = 0x8088A11C; // type:func -BgIceObjects_SetNextTarget = 0x8088A150; // type:func -BgIceObjects_CheckPits = 0x8088A5D0; // type:func -BgIceObjects_Idle = 0x8088A758; // type:func -BgIceObjects_Slide = 0x8088A85C; // type:func -BgIceObjects_Reset = 0x8088ABEC; // type:func -BgIceObjects_Stuck = 0x8088AC88; // type:func -BgIceObjects_Update = 0x8088ACC4; // type:func -BgIceObjects_Draw = 0x8088ACE8; // type:func -BgIceShelter_InitColliders = 0x8088AFD0; // type:func -BgIceShelter_InitDynaPoly = 0x8088B104; // type:func -BgIceShelter_RotateY = 0x8088B15C; // type:func -BgIceShelter_Init = 0x8088B1DC; // type:func -BgIceShelter_Destroy = 0x8088B358; // type:func -BgIceShelter_SpawnSteamAround = 0x8088B3E4; // type:func -BgIceShelter_SpawnSteamAlong = 0x8088B658; // type:func -BgIceShelter_SetupIdle = 0x8088B8BC; // type:func -BgIceShelter_Idle = 0x8088B8D8; // type:func -BgIceShelter_SetupMelt = 0x8088BA18; // type:func -BgIceShelter_Melt = 0x8088BA34; // type:func -BgIceShelter_Update = 0x8088BBF8; // type:func -BgIceShelter_Draw = 0x8088BC1C; // type:func -func_80891AC0 = 0x8088C210; // type:func -BgIceShutter_Init = 0x8088C298; // type:func -BgIceShutter_Destroy = 0x8088C418; // type:func -func_80891CF4 = 0x8088C44C; // type:func -func_80891D6C = 0x8088C4C4; // type:func -func_80891DD4 = 0x8088C52C; // type:func -BgIceShutter_Update = 0x8088C594; // type:func -BgIceShutter_Draw = 0x8088C5B8; // type:func -BgIceTurara_Init = 0x8088C680; // type:func -BgIceTurara_Destroy = 0x8088C75C; // type:func -BgIceTurara_Break = 0x8088C7A4; // type:func -BgIceTurara_Stalagmite = 0x8088C984; // type:func -BgIceTurara_Wait = 0x8088C9EC; // type:func -BgIceTurara_Shiver = 0x8088CA24; // type:func -BgIceTurara_Fall = 0x8088CB90; // type:func -BgIceTurara_Regrow = 0x8088CCE8; // type:func -BgIceTurara_Update = 0x8088CD38; // type:func -BgIceTurara_Draw = 0x8088CD5C; // type:func -BgInGate_SetupAction = 0x8088CEB0; // type:func -BgInGate_Init = 0x8088CEBC; // type:func -BgInGate_Destroy = 0x8088CFD8; // type:func -func_80892890 = 0x8088D00C; // type:func -BgInGate_DoNothing = 0x8088D10C; // type:func -BgInGate_Update = 0x8088D11C; // type:func -BgInGate_Draw = 0x8088D140; // type:func -BgJya1flift_InitDynapoly = 0x8088D240; // type:func -BgJya1flift_InitCollision = 0x8088D298; // type:func -BgJya1flift_Init = 0x8088D2EC; // type:func -BgJya1flift_Destroy = 0x8088D3E4; // type:func -BgJya1flift_SetupWaitForSwitch = 0x8088D43C; // type:func -BgJya1flift_WaitForSwitch = 0x8088D45C; // type:func -BgJya1flift_SetupDoNothing = 0x8088D4A0; // type:func -BgJya1flift_DoNothing = 0x8088D4C0; // type:func -BgJya1flift_ChangeDirection = 0x8088D4D0; // type:func -BgJya1flift_Move = 0x8088D4F8; // type:func -BgJya1flift_ResetMoveDelay = 0x8088D5DC; // type:func -BgJya1flift_DelayMove = 0x8088D5F4; // type:func -BgJya1flift_Update = 0x8088D634; // type:func -BgJya1flift_Draw = 0x8088D750; // type:func -BgJyaAmishutter_InitDynaPoly = 0x8088D8D0; // type:func -BgJyaAmishutter_Init = 0x8088D928; // type:func -BgJyaAmishutter_Destroy = 0x8088D970; // type:func -BgJyaAmishutter_SetupWaitForPlayer = 0x8088D9A4; // type:func -BgJyaAmishutter_WaitForPlayer = 0x8088D9B8; // type:func -func_80893428 = 0x8088DA14; // type:func -func_80893438 = 0x8088DA28; // type:func -func_808934B0 = 0x8088DAA0; // type:func -func_808934C0 = 0x8088DAB4; // type:func -func_808934FC = 0x8088DAF0; // type:func -func_8089350C = 0x8088DB04; // type:func -BgJyaAmishutter_Update = 0x8088DB68; // type:func -BgJyaAmishutter_Draw = 0x8088DB90; // type:func -BgJyaBigmirror_SetRoomFlag = 0x8088DC60; // type:func -BgJyaBigmirror_HandleCobra = 0x8088DCD0; // type:func -BgJyaBigmirror_SetBombiwaFlag = 0x8088DE68; // type:func -BgJyaBigmirror_HandleMirRay = 0x8088DEBC; // type:func -BgJyaBigmirror_Init = 0x8088E064; // type:func -BgJyaBigmirror_Destroy = 0x8088E0E8; // type:func -BgJyaBigmirror_Update = 0x8088E108; // type:func -BgJyaBigmirror_DrawLightBeam = 0x8088E158; // type:func -BgJyaBigmirror_Draw = 0x8088E2E4; // type:func -BgJyaBlock_Init = 0x8088E4B0; // type:func -BgJyaBlock_Destroy = 0x8088E568; // type:func -BgJyaBlock_Update = 0x8088E59C; // type:func -BgJyaBlock_Draw = 0x8088E5C0; // type:func -BgJyaBombchuiwa_SetupCollider = 0x8088E720; // type:func -BgJyaBombchuiwa_SetDrawFlags = 0x8088E774; // type:func -BgJyaBombchuiwa_Init = 0x8088E798; // type:func -BgJyaBombchuiwa_Destroy = 0x8088E818; // type:func -BgJyaBombchuiwa_Break = 0x8088E844; // type:func -BgJyaBombchuiwa_SetupWaitForExplosion = 0x8088EAD0; // type:func -BgJyaBombchuiwa_WaitForExplosion = 0x8088EB08; // type:func -BgJyaBombchuiwa_CleanUpAfterExplosion = 0x8088EBEC; // type:func -func_808949B8 = 0x8088EC44; // type:func -BgJyaBombchuiwa_SpawnLightRay = 0x8088ECD0; // type:func -BgJyaBombchuiwa_Update = 0x8088ED48; // type:func -BgJyaBombchuiwa_DrawRock = 0x8088ED74; // type:func -BgJyaBombchuiwa_DrawLight = 0x8088EDFC; // type:func -BgJyaBombchuiwa_Draw = 0x8088F058; // type:func -BgJyaBombiwa_SetupDynaPoly = 0x8088F260; // type:func -BgJyaBombiwa_InitCollider = 0x8088F2B8; // type:func -BgJyaBombiwa_Init = 0x8088F30C; // type:func -BgJyaBombiwa_Destroy = 0x8088F38C; // type:func -BgJyaBombiwa_Break = 0x8088F3D4; // type:func -BgJyaBombiwa_Update = 0x8088F668; // type:func -BgJyaBombiwa_Draw = 0x8088F6F8; // type:func -func_808958F0 = 0x8088F820; // type:func -BgJyaCobra_InitDynapoly = 0x8088F874; // type:func -BgJyaCobra_SpawnRay = 0x8088F8CC; // type:func -func_80895A70 = 0x8088F934; // type:func -func_80895BEC = 0x8088FAB4; // type:func -func_80895C74 = 0x8088FB38; // type:func -BgJyaCobra_UpdateShadowFromSide = 0x8088FDB8; // type:func -BgJyaCobra_UpdateShadowFromTop = 0x808903E0; // type:func -BgJyaCobra_Init = 0x8089069C; // type:func -BgJyaCobra_Destroy = 0x80890788; // type:func -func_80896918 = 0x808907BC; // type:func -func_80896950 = 0x808907F8; // type:func -func_808969F8 = 0x808908A0; // type:func -func_80896ABC = 0x80890968; // type:func -BgJyaCobra_Update = 0x80890AFC; // type:func -func_80896CB4 = 0x80890B70; // type:func -func_80896D78 = 0x80890BF8; // type:func -BgJyaCobra_DrawShadow = 0x80890D24; // type:func -BgJyaCobra_Draw = 0x80890FA8; // type:func -BgJyaGoroiwa_UpdateCollider = 0x80891560; // type:func -BgJyaGoroiwa_InitCollider = 0x808915B8; // type:func -BgJyaGoroiwa_UpdateRotation = 0x80891620; // type:func -BgJyaGoroiwa_Init = 0x80891660; // type:func -BgJyaGoroiwa_Destroy = 0x808916F4; // type:func -BgJyaGoroiwa_SetupMove = 0x80891720; // type:func -BgJyaGoroiwa_Move = 0x80891750; // type:func -BgJyaGoroiwa_SetupWait = 0x808919E4; // type:func -BgJyaGoroiwa_Wait = 0x808919FC; // type:func -BgJyaGoroiwa_Update = 0x80891A4C; // type:func -BgJyaGoroiwa_Draw = 0x80891B38; // type:func -BgJyaHaheniron_ColliderInit = 0x80891CE0; // type:func -BgJyaHaheniron_SpawnFragments = 0x80891D34; // type:func -BgJyaHaheniron_Init = 0x80891F60; // type:func -BgJyaHaheniron_Destroy = 0x8089202C; // type:func -BgJyaHaheniron_SetupChairCrumble = 0x80892064; // type:func -BgJyaHaheniron_ChairCrumble = 0x80892078; // type:func -BgJyaHaheniron_SetupPillarCrumble = 0x808921B4; // type:func -BgJyaHaheniron_PillarCrumble = 0x808921C8; // type:func -BgJyaHaheniron_SetupRubbleCollide = 0x80892248; // type:func -BgJyaHaheniron_RubbleCollide = 0x8089225C; // type:func -BgJyaHaheniron_Update = 0x808922C0; // type:func -BgJyaHaheniron_Draw = 0x808922EC; // type:func -BgJyaIronobj_InitCylinder = 0x808924D0; // type:func -BgJyaIronobj_SpawnPillarParticles = 0x80892550; // type:func -BgJyaIronobj_SpawnThroneParticles = 0x808929CC; // type:func -BgJyaIronobj_Init = 0x80892DF8; // type:func -BgJyaIronobj_Destroy = 0x80892E8C; // type:func -func_808992D8 = 0x80892ED4; // type:func -func_808992E8 = 0x80892EE8; // type:func -BgJyaIronobj_Update = 0x80893028; // type:func -BgJyaIronobj_Draw = 0x8089304C; // type:func -BgJyaKanaami_InitDynaPoly = 0x80893280; // type:func -BgJyaKanaami_Init = 0x808932D8; // type:func -BgJyaKanaami_Destroy = 0x80893358; // type:func -func_80899880 = 0x8089338C; // type:func -func_80899894 = 0x808933A4; // type:func -func_8089993C = 0x8089344C; // type:func -func_80899950 = 0x80893464; // type:func -func_80899A08 = 0x8089351C; // type:func -BgJyaKanaami_Update = 0x80893530; // type:func -BgJyaKanaami_Draw = 0x80893564; // type:func -BgJyaLift_InitDynapoly = 0x80893630; // type:func -BgJyaLift_Init = 0x80893688; // type:func -BgJyaLift_Destroy = 0x80893744; // type:func -BgJyaLift_SetInitPosY = 0x80893788; // type:func -BgJyaLift_DelayMove = 0x808937AC; // type:func -BgJyaLift_SetupMove = 0x80893830; // type:func -BgJyaLift_Move = 0x80893844; // type:func -BgJyaLift_SetFinalPosY = 0x80893968; // type:func -BgJyaLift_Update = 0x80893980; // type:func -BgJyaLift_Draw = 0x80893A70; // type:func -BgJyaMegami_InitDynaPoly = 0x80893B80; // type:func -BgJyaMegami_InitCollider = 0x80893BD8; // type:func -BgJyaMegami_SpawnEffect = 0x80893C2C; // type:func -BgJyaMegami_SetupSpawnEffect = 0x80893E70; // type:func -BgJyaMegami_Init = 0x80893F6C; // type:func -BgJyaMegami_Destroy = 0x80894000; // type:func -BgJyaMegami_SetupDetectLight = 0x80894048; // type:func -BgJyaMegami_DetectLight = 0x80894064; // type:func -BgJyaMegami_SetupExplode = 0x808941F0; // type:func -BgJyaMegami_Explode = 0x80894288; // type:func -BgJyaMegami_Update = 0x80894610; // type:func -BgJyaMegami_DrawFace = 0x80894634; // type:func -BgJyaMegami_DrawExplode = 0x80894778; // type:func -BgJyaMegami_Draw = 0x80894944; // type:func -BgJyaZurerukabe_InitDynaPoly = 0x80894D70; // type:func -func_8089B4C8 = 0x80894DC8; // type:func -BgJyaZurerukabe_Init = 0x80894F64; // type:func -BgJyaZurerukabe_Destroy = 0x80895024; // type:func -func_8089B7B4 = 0x80895070; // type:func -func_8089B7C4 = 0x80895084; // type:func -func_8089B80C = 0x808950D0; // type:func -func_8089B870 = 0x80895138; // type:func -BgJyaZurerukabe_Update = 0x80895200; // type:func -BgJyaZurerukabe_Draw = 0x80895258; // type:func -BgMenkuriEye_Init = 0x80895420; // type:func -BgMenkuriEye_Destroy = 0x808954FC; // type:func -BgMenkuriEye_Update = 0x80895528; // type:func -BgMenkuriEye_Draw = 0x80895698; // type:func -BgMenkuriKaiten_Init = 0x808958C0; // type:func -BgMenkuriKaiten_Destroy = 0x80895928; // type:func -BgMenkuriKaiten_Update = 0x8089595C; // type:func -BgMenkuriKaiten_Draw = 0x808959BC; // type:func -BgMenkuriNisekabe_Init = 0x80895A50; // type:func -BgMenkuriNisekabe_Destroy = 0x80895A78; // type:func -BgMenkuriNisekabe_Update = 0x80895A88; // type:func -BgMenkuriNisekabe_Draw = 0x80895ABC; // type:func -BgMizuBwall_RotateVec3f = 0x80895BA0; // type:func -BgMizuBwall_Init = 0x80895BF4; // type:func -BgMizuBwall_Destroy = 0x80896470; // type:func -BgMizuBwall_SetAlpha = 0x808964B8; // type:func -BgMizuBwall_SpawnDebris = 0x8089663C; // type:func -BgMizuBwall_Idle = 0x80896910; // type:func -BgMizuBwall_Break = 0x80896A10; // type:func -BgMizuBwall_DoNothing = 0x80896A3C; // type:func -BgMizuBwall_Update = 0x80896A4C; // type:func -BgMizuBwall_Draw = 0x80896A70; // type:func -BgMizuMovebg_GetDragonStatueBossRoomOffsetIndex = 0x80897070; // type:func -BgMizuMovebg_Init = 0x808970DC; // type:func -BgMizuMovebg_Destroy = 0x808974A4; // type:func -BgMizuMovebg_SetPosFromPath = 0x80897558; // type:func -BgMizuMovebg_SetScrollAlphas = 0x808975EC; // type:func -BgMizuMovebg_UpdateMain = 0x80897770; // type:func -BgMizuMovebg_UpdateHookshotPlatform = 0x80897AAC; // type:func -BgMizuMovebg_Update = 0x80897C68; // type:func -BgMizuMovebg_Draw = 0x80897C8C; // type:func -BgMizuShutter_Init = 0x80898200; // type:func -BgMizuShutter_Destroy = 0x80898460; // type:func -BgMizuShutter_WaitForSwitch = 0x80898494; // type:func -BgMizuShutter_WaitForCutscene = 0x80898528; // type:func -BgMizuShutter_Move = 0x80898574; // type:func -BgMizuShutter_WaitForTimer = 0x80898760; // type:func -BgMizuShutter_Update = 0x808987E0; // type:func -BgMizuShutter_Draw = 0x80898804; // type:func -BgMizuUzu_Init = 0x80898A00; // type:func -BgMizuUzu_Destroy = 0x80898A7C; // type:func -func_8089F788 = 0x80898AB0; // type:func -BgMizuUzu_Update = 0x80898B28; // type:func -BgMizuUzu_Draw = 0x80898B4C; // type:func -BgMizuWater_GetWaterLevelActionIndex = 0x80898BD0; // type:func -BgMizuWater_SetWaterBoxesHeight = 0x80898C70; // type:func -BgMizuWater_Init = 0x80898CDC; // type:func -BgMizuWater_Destroy = 0x80898F38; // type:func -BgMizuWater_WaitForAction = 0x80898F48; // type:func -BgMizuWater_ChangeWaterLevel = 0x80899114; // type:func -BgMizuWater_Update = 0x80899424; // type:func -BgMizuWater_Draw = 0x8089957C; // type:func -BgMjin_SetupAction = 0x808998A0; // type:func -BgMjin_Init = 0x808998AC; // type:func -BgMjin_Destroy = 0x8089994C; // type:func -func_808A0850 = 0x80899980; // type:func -BgMjin_DoNothing = 0x80899A54; // type:func -BgMjin_Update = 0x80899A64; // type:func -BgMjin_Draw = 0x80899A88; // type:func -BgMoriBigst_SetupAction = 0x80899C90; // type:func -BgMoriBigst_InitDynapoly = 0x80899C9C; // type:func -BgMoriBigst_Init = 0x80899CF4; // type:func -BgMoriBigst_Destroy = 0x80899DCC; // type:func -BgMoriBigst_SetupWaitForMoriTex = 0x80899E00; // type:func -BgMoriBigst_WaitForMoriTex = 0x80899E28; // type:func -BgMoriBigst_SetupNoop = 0x80899EF4; // type:func -BgMoriBigst_SetupStalfosFight = 0x80899F18; // type:func -BgMoriBigst_StalfosFight = 0x80899FCC; // type:func -BgMoriBigst_SetupFall = 0x8089A044; // type:func -BgMoriBigst_Fall = 0x8089A06C; // type:func -BgMoriBigst_SetupLanding = 0x8089A0F8; // type:func -BgMoriBigst_Landing = 0x8089A18C; // type:func -BgMoriBigst_SetupStalfosPairFight = 0x8089A1B8; // type:func -BgMoriBigst_StalfosPairFight = 0x8089A2D0; // type:func -BgMoriBigst_SetupDone = 0x8089A330; // type:func -BgMoriBigst_Update = 0x8089A354; // type:func -BgMoriBigst_Draw = 0x8089A3C8; // type:func -func_808A1800 = 0x8089A5C0; // type:func -func_808A18FC = 0x8089A6B8; // type:func -BgMoriElevator_Init = 0x8089A740; // type:func -BgMoriElevator_Destroy = 0x8089A824; // type:func -BgMoriElevator_IsPlayerRiding = 0x8089A864; // type:func -BgMoriElevator_SetupWaitAfterInit = 0x8089A8C4; // type:func -BgMoriElevator_WaitAfterInit = 0x8089A8D8; // type:func -func_808A1C30 = 0x8089A97C; // type:func -BgMoriElevator_MoveIntoGround = 0x8089A990; // type:func -func_808A1CF4 = 0x8089AA44; // type:func -BgMoriElevator_MoveAboveGround = 0x8089AAA0; // type:func -BgMoriElevator_SetupSetPosition = 0x8089AB54; // type:func -BgMoriElevator_SetPosition = 0x8089AB68; // type:func -BgMoriElevator_StopMovement = 0x8089AD30; // type:func -func_808A2008 = 0x8089AD4C; // type:func -BgMoriElevator_Update = 0x8089AE00; // type:func -BgMoriElevator_Draw = 0x8089AE58; // type:func -BgMoriHashigo_InitDynapoly = 0x8089B0B0; // type:func -BgMoriHashigo_InitCollider = 0x8089B108; // type:func -BgMoriHashigo_SpawnLadder = 0x8089B1B4; // type:func -BgMoriHashigo_InitClasp = 0x8089B26C; // type:func -BgMoriHashigo_InitLadder = 0x8089B2F8; // type:func -BgMoriHashigo_Init = 0x8089B33C; // type:func -BgMoriHashigo_Destroy = 0x8089B400; // type:func -BgMoriHashigo_SetupWaitForMoriTex = 0x8089B458; // type:func -BgMoriHashigo_WaitForMoriTex = 0x8089B46C; // type:func -BgMoriHashigo_SetupClasp = 0x8089B4EC; // type:func -BgMoriHashigo_Clasp = 0x8089B500; // type:func -BgMoriHashigo_SetupLadderWait = 0x8089B564; // type:func -BgMoriHashigo_LadderWait = 0x8089B578; // type:func -BgMoriHashigo_SetupLadderFall = 0x8089B5AC; // type:func -BgMoriHashigo_LadderFall = 0x8089B5E8; // type:func -BgMoriHashigo_SetupLadderRest = 0x8089B6C8; // type:func -BgMoriHashigo_Update = 0x8089B6EC; // type:func -BgMoriHashigo_Draw = 0x8089B728; // type:func -BgMoriHashira4_SetupAction = 0x8089B970; // type:func -BgMoriHashira4_InitDynaPoly = 0x8089B97C; // type:func -BgMoriHashira4_Init = 0x8089B9D4; // type:func -BgMoriHashira4_Destroy = 0x8089BAE8; // type:func -BgMoriHashira4_SetupWaitForMoriTex = 0x8089BB1C; // type:func -BgMoriHashira4_WaitForMoriTex = 0x8089BB40; // type:func -BgMoriHashira4_SetupPillarsRotate = 0x8089BBBC; // type:func -BgMoriHashira4_PillarsRotate = 0x8089BBE0; // type:func -BgMoriHashira4_GateWait = 0x8089BC18; // type:func -BgMoriHashira4_GateOpen = 0x8089BCC4; // type:func -BgMoriHashira4_Update = 0x8089BD1C; // type:func -BgMoriHashira4_Draw = 0x8089BD48; // type:func -BgMoriHineri_Init = 0x8089BF00; // type:func -BgMoriHineri_Destroy = 0x8089C100; // type:func -func_808A39FC = 0x8089C134; // type:func -BgMoriHineri_DoNothing = 0x8089C32C; // type:func -BgMoriHineri_SpawnBossKeyChest = 0x8089C33C; // type:func -func_808A3C8C = 0x8089C3CC; // type:func -func_808A3D58 = 0x8089C498; // type:func -func_808A3E54 = 0x8089C594; // type:func -BgMoriHineri_Update = 0x8089C674; // type:func -BgMoriHineri_DrawHallAndRoom = 0x8089C698; // type:func -BgMoriIdomizu_SetupAction = 0x8089CC50; // type:func -BgMoriIdomizu_SetWaterLevel = 0x8089CC5C; // type:func -BgMoriIdomizu_Init = 0x8089CC84; // type:func -BgMoriIdomizu_Destroy = 0x8089CDA8; // type:func -BgMoriIdomizu_SetupWaitForMoriTex = 0x8089CDC8; // type:func -BgMoriIdomizu_WaitForMoriTex = 0x8089CDEC; // type:func -BgMoriIdomizu_SetupMain = 0x8089CE44; // type:func -BgMoriIdomizu_Main = 0x8089CE68; // type:func -BgMoriIdomizu_Update = 0x8089D02C; // type:func -BgMoriIdomizu_Draw = 0x8089D058; // type:func -BgMoriKaitenkabe_CrossProduct = 0x8089D290; // type:func -BgMoriKaitenkabe_Init = 0x8089D304; // type:func -BgMoriKaitenkabe_Destroy = 0x8089D3B8; // type:func -BgMoriKaitenkabe_WaitForMoriTex = 0x8089D3EC; // type:func -BgMoriKaitenkabe_SetupWait = 0x8089D444; // type:func -BgMoriKaitenkabe_Wait = 0x8089D45C; // type:func -BgMoriKaitenkabe_SetupRotate = 0x8089D5BC; // type:func -BgMoriKaitenkabe_Rotate = 0x8089D5DC; // type:func -BgMoriKaitenkabe_Update = 0x8089D748; // type:func -BgMoriKaitenkabe_Draw = 0x8089D76C; // type:func -BgMoriRakkatenjo_Init = 0x8089D900; // type:func -BgMoriRakkatenjo_Destroy = 0x8089D9B8; // type:func -BgMoriRakkatenjo_IsLinkUnder = 0x8089D9EC; // type:func -BgMoriRakkatenjo_IsLinkClose = 0x8089DA9C; // type:func -BgMoriRakkatenjo_SetupWaitForMoriTex = 0x8089DB4C; // type:func -BgMoriRakkatenjo_WaitForMoriTex = 0x8089DB60; // type:func -BgMoriRakkatenjo_SetupWait = 0x8089DBB8; // type:func -BgMoriRakkatenjo_Wait = 0x8089DBF4; // type:func -BgMoriRakkatenjo_SetupFall = 0x8089DCC4; // type:func -BgMoriRakkatenjo_Fall = 0x8089DCE4; // type:func -BgMoriRakkatenjo_SetupRest = 0x8089DE5C; // type:func -BgMoriRakkatenjo_Rest = 0x8089DE84; // type:func -BgMoriRakkatenjo_SetupRise = 0x8089DEB4; // type:func -BgMoriRakkatenjo_Rise = 0x8089DED4; // type:func -BgMoriRakkatenjo_Update = 0x8089DF54; // type:func -BgMoriRakkatenjo_Draw = 0x8089E02C; // type:func -BgPoEvent_InitPaintings = 0x8089E280; // type:func -BgPoEvent_InitBlocks = 0x8089E5FC; // type:func -BgPoEvent_Init = 0x8089E7AC; // type:func -BgPoEvent_Destroy = 0x8089E8BC; // type:func -BgPoEvent_BlockWait = 0x8089E940; // type:func -BgPoEvent_BlockShake = 0x8089EA4C; // type:func -BgPoEvent_CheckBlock = 0x8089EB04; // type:func -BgPoEvent_BlockFall = 0x8089EC3C; // type:func -BgPoEvent_BlockIdle = 0x8089ED40; // type:func -BgPoEvent_BlockPush = 0x8089EFF4; // type:func -BgPoEvent_BlockReset = 0x8089F1B4; // type:func -BgPoEvent_BlockSolved = 0x8089F2B4; // type:func -BgPoEvent_AmyWait = 0x8089F32C; // type:func -BgPoEvent_AmyPuzzle = 0x8089F3A8; // type:func -BgPoEvent_NextPainting = 0x8089F4C4; // type:func -BgPoEvent_PaintingEmpty = 0x8089F580; // type:func -BgPoEvent_PaintingAppear = 0x8089F5B0; // type:func -BgPoEvent_PaintingVanish = 0x8089F5E8; // type:func -BgPoEvent_PaintingPresent = 0x8089F638; // type:func -BgPoEvent_PaintingBurn = 0x8089F894; // type:func -BgPoEvent_Update = 0x8089FA40; // type:func -BgPoEvent_Draw = 0x8089FAB0; // type:func -BgPoSyokudai_Init = 0x808A00C0; // type:func -BgPoSyokudai_Destroy = 0x808A0360; // type:func -BgPoSyokudai_Update = 0x808A03D0; // type:func -BgPoSyokudai_Draw = 0x808A0450; // type:func -BgPushbox_SetupAction = 0x808A0A30; // type:func -BgPushbox_Init = 0x808A0A3C; // type:func -BgPushbox_Destroy = 0x808A0AD4; // type:func -BgPushbox_UpdateImpl = 0x808A0B08; // type:func -BgPushbox_Update = 0x808A0BE4; // type:func -BgPushbox_Draw = 0x808A0C14; // type:func -BgRelayObjects_Init = 0x808A0D30; // type:func -BgRelayObjects_Destroy = 0x808A0F70; // type:func -func_808A90F4 = 0x808A0FDC; // type:func -func_808A91AC = 0x808A1098; // type:func -func_808A9234 = 0x808A1120; // type:func -BgRelayObjects_DoNothing = 0x808A120C; // type:func -func_808A932C = 0x808A121C; // type:func -func_808A939C = 0x808A128C; // type:func -BgRelayObjects_Update = 0x808A1360; // type:func -BgRelayObjects_Draw = 0x808A1384; // type:func -BgSpot00Break_Init = 0x808A14E0; // type:func -BgSpot00Break_Destroy = 0x808A158C; // type:func -BgSpot00Break_Update = 0x808A15C0; // type:func -BgSpot00Break_Draw = 0x808A15D0; // type:func -BgSpot00Hanebasi_Init = 0x808A1680; // type:func -BgSpot00Hanebasi_Destroy = 0x808A1A90; // type:func -BgSpot00Hanebasi_DrawbridgeWait = 0x808A1AEC; // type:func -BgSpot00Hanebasi_DoNothing = 0x808A1C1C; // type:func -BgSpot00Hanebasi_DrawbridgeRiseAndFall = 0x808A1C2C; // type:func -BgSpot00Hanebasi_SetTorchLightInfo = 0x808A1D60; // type:func -BgSpot00Hanebasi_Update = 0x808A1EB8; // type:func -BgSpot00Hanebasi_DrawTorches = 0x808A21C8; // type:func -BgSpot00Hanebasi_Draw = 0x808A2468; // type:func -BgSpot01Fusya_SetupAction = 0x808A2790; // type:func -BgSpot01Fusya_Init = 0x808A279C; // type:func -BgSpot01Fusya_Destroy = 0x808A2818; // type:func -func_808AAA50 = 0x808A2828; // type:func -BgSpot01Fusya_Update = 0x808A28E8; // type:func -BgSpot01Fusya_Draw = 0x808A290C; // type:func -BgSpot01Idohashira_PlayBreakSfx1 = 0x808A2A30; // type:func -BgSpot01Idohashira_PlayBreakSfx2 = 0x808A2A58; // type:func -func_808AAD3C = 0x808A2A90; // type:func -func_808AAE6C = 0x808A2BC8; // type:func -func_808AAF34 = 0x808A2C94; // type:func -BgSpot01Idohashira_Destroy = 0x808A2E58; // type:func -BgSpot01Idohashira_NotInCsMode = 0x808A2E8C; // type:func -BgSpot01Idohashira_GetCue = 0x808A2EAC; // type:func -func_808AB18C = 0x808A2EF8; // type:func -func_808AB1DC = 0x808A2F4C; // type:func -func_808AB29C = 0x808A2FF0; // type:func -func_808AB3E8 = 0x808A313C; // type:func -func_808AB3F8 = 0x808A3150; // type:func -func_808AB414 = 0x808A3170; // type:func -func_808AB444 = 0x808A319C; // type:func -func_808AB504 = 0x808A3248; // type:func -func_808AB510 = 0x808A3258; // type:func -func_808AB530 = 0x808A3278; // type:func -func_808AB570 = 0x808A32BC; // type:func -BgSpot01Idohashira_Update = 0x808A32DC; // type:func -BgSpot01Idohashira_Init = 0x808A3324; // type:func -func_808AB700 = 0x808A343C; // type:func -BgSpot01Idohashira_Draw = 0x808A34CC; // type:func -BgSpot01Idomizu_Init = 0x808A3630; // type:func -BgSpot01Idomizu_Destroy = 0x808A36C8; // type:func -func_808ABB84 = 0x808A36D8; // type:func -BgSpot01Idomizu_Update = 0x808A378C; // type:func -BgSpot01Idomizu_Draw = 0x808A37B0; // type:func -BgSpot01Idosoko_SetupAction = 0x808A3950; // type:func -BgSpot01Idosoko_Init = 0x808A395C; // type:func -BgSpot01Idosoko_Destroy = 0x808A39FC; // type:func -func_808ABF54 = 0x808A3A30; // type:func -BgSpot01Idosoko_Update = 0x808A3A40; // type:func -BgSpot01Idosoko_Draw = 0x808A3A64; // type:func -BgSpot01Objects2_Init = 0x808A3B60; // type:func -BgSpot01Objects2_Destroy = 0x808A3C3C; // type:func -func_808AC22C = 0x808A3C4C; // type:func -func_808AC2BC = 0x808A3CE0; // type:func -func_808AC474 = 0x808A3E90; // type:func -BgSpot01Objects2_Update = 0x808A3EA0; // type:func -func_808AC4A4 = 0x808A3EC4; // type:func -BgSpot02Objects_Init = 0x808A4020; // type:func -BgSpot02Objects_Destroy = 0x808A4290; // type:func -func_808AC8FC = 0x808A42C4; // type:func -func_808AC908 = 0x808A42D4; // type:func -func_808ACA08 = 0x808A43D4; // type:func -func_808ACAFC = 0x808A44CC; // type:func -func_808ACB58 = 0x808A4528; // type:func -BgSpot02Objects_Update = 0x808A45A8; // type:func -BgSpot02Objects_Draw = 0x808A45CC; // type:func -func_808ACC34 = 0x808A4608; // type:func -func_808ACCB8 = 0x808A468C; // type:func -func_808AD3D4 = 0x808A4D78; // type:func -func_808AD450 = 0x808A4DF4; // type:func -BgSpot03Taki_ApplyOpeningAlpha = 0x808A5380; // type:func -BgSpot03Taki_Init = 0x808A56BC; // type:func -BgSpot03Taki_Destroy = 0x808A576C; // type:func -func_808ADEF0 = 0x808A57A0; // type:func -BgSpot03Taki_Update = 0x808A5974; // type:func -BgSpot03Taki_Draw = 0x808A5998; // type:func -BgSpot05Soko_Init = 0x808A5CA0; // type:func -BgSpot05Soko_Destroy = 0x808A5DAC; // type:func -func_808AE5A8 = 0x808A5DE0; // type:func -func_808AE5B4 = 0x808A5DF0; // type:func -func_808AE630 = 0x808A5E6C; // type:func -BgSpot05Soko_Update = 0x808A5ED4; // type:func -BgSpot05Soko_Draw = 0x808A5EF8; // type:func -BgSpot06Objects_Init = 0x808A5FC0; // type:func -BgSpot06Objects_Destroy = 0x808A638C; // type:func -BgSpot06Objects_GateSpawnBubbles = 0x808A63F4; // type:func -BgSpot06Objects_GateWaitForSwitch = 0x808A64EC; // type:func -BgSpot06Objects_GateWaitToOpen = 0x808A6580; // type:func -BgSpot06Objects_GateOpen = 0x808A65B4; // type:func -BgSpot06Objects_DoNothing = 0x808A6640; // type:func -BgSpot06Objects_LockSpawnWaterRipples = 0x808A6650; // type:func -BgSpot06Objects_LockSpawnBubbles = 0x808A66B4; // type:func -BgSpot06Objects_LockWait = 0x808A6748; // type:func -BgSpot06Objects_LockPullOutward = 0x808A696C; // type:func -BgSpot06Objects_LockSwimToSurface = 0x808A6A24; // type:func -BgSpot06Objects_LockFloat = 0x808A6C9C; // type:func -BgSpot06Objects_Update = 0x808A6D1C; // type:func -BgSpot06Objects_DrawLakeHyliaWater = 0x808A6D7C; // type:func -BgSpot06Objects_Draw = 0x808A6F64; // type:func -BgSpot06Objects_WaterPlaneCutsceneWait = 0x808A7028; // type:func -BgSpot06Objects_WaterPlaneCutsceneRise = 0x808A7054; // type:func -BgSpot07Taki_Init = 0x808A73C0; // type:func -BgSpot07Taki_Destroy = 0x808A746C; // type:func -BgSpot07Taki_DoNothing = 0x808A74A0; // type:func -BgSpot07Taki_Update = 0x808A74B0; // type:func -BgSpot07Taki_Draw = 0x808A74D4; // type:func -func_808B02D0 = 0x808A79B0; // type:func -func_808B0324 = 0x808A7A04; // type:func -BgSpot08Bakudankabe_Init = 0x808A7CFC; // type:func -BgSpot08Bakudankabe_Destroy = 0x808A7D9C; // type:func -BgSpot08Bakudankabe_Update = 0x808A7DE4; // type:func -BgSpot08Bakudankabe_Draw = 0x808A7E98; // type:func -BgSpot08Iceblock_SetupAction = 0x808A8050; // type:func -BgSpot08Iceblock_InitDynaPoly = 0x808A805C; // type:func -BgSpot08Iceblock_CheckParams = 0x808A80B4; // type:func -BgSpot08Iceblock_Bobbing = 0x808A8114; // type:func -BgSpot08Iceblock_SinkUnderPlayer = 0x808A8170; // type:func -BgSpot08Iceblock_SetWaterline = 0x808A8220; // type:func -BgSpot08Iceblock_MultVectorScalar = 0x808A8240; // type:func -BgSpot08Iceblock_CrossProduct = 0x808A8274; // type:func -BgSpot08Iceblock_NormalizeVector = 0x808A82E8; // type:func -BgSpot08Iceblock_Roll = 0x808A8384; // type:func -BgSpot08Iceblock_SpawnTwinFloe = 0x808A86F8; // type:func -BgSpot08Iceblock_Init = 0x808A87F8; // type:func -BgSpot08Iceblock_Destroy = 0x808A89EC; // type:func -BgSpot08Iceblock_SetupFloatNonrotating = 0x808A8A20; // type:func -BgSpot08Iceblock_FloatNonrotating = 0x808A8A44; // type:func -BgSpot08Iceblock_SetupFloatRotating = 0x808A8A98; // type:func -BgSpot08Iceblock_FloatRotating = 0x808A8ABC; // type:func -BgSpot08Iceblock_SetupFloatOrbitingTwins = 0x808A8B1C; // type:func -BgSpot08Iceblock_FloatOrbitingTwins = 0x808A8B40; // type:func -BgSpot08Iceblock_SetupNoAction = 0x808A8C18; // type:func -BgSpot08Iceblock_Update = 0x808A8C38; // type:func -BgSpot08Iceblock_Draw = 0x808A8CD4; // type:func -func_808B1AE0 = 0x808A9090; // type:func -func_808B1BA0 = 0x808A9150; // type:func -func_808B1BEC = 0x808A919C; // type:func -func_808B1C70 = 0x808A9228; // type:func -func_808B1CEC = 0x808A92A4; // type:func -func_808B1D18 = 0x808A92D0; // type:func -func_808B1D44 = 0x808A92FC; // type:func -BgSpot09Obj_Init = 0x808A933C; // type:func -BgSpot09Obj_Destroy = 0x808A93A4; // type:func -BgSpot09Obj_Update = 0x808A93E4; // type:func -BgSpot09Obj_Draw = 0x808A93F4; // type:func -func_808B2180 = 0x808A95B0; // type:func -func_808B2218 = 0x808A9644; // type:func -BgSpot11Bakudankabe_Init = 0x808A995C; // type:func -BgSpot11Bakudankabe_Destroy = 0x808A99F8; // type:func -BgSpot11Bakudankabe_Update = 0x808A9A40; // type:func -BgSpot11Bakudankabe_Draw = 0x808A9ADC; // type:func -func_808B27F0 = 0x808A9BF0; // type:func -func_808B280C = 0x808A9C10; // type:func -BgSpot11Oasis_Init = 0x808A9D24; // type:func -func_808B2970 = 0x808A9D78; // type:func -func_808B2980 = 0x808A9D8C; // type:func -func_808B29E0 = 0x808A9DEC; // type:func -func_808B29F0 = 0x808A9E00; // type:func -func_808B2AA8 = 0x808A9EB8; // type:func -func_808B2AB8 = 0x808A9ECC; // type:func -BgSpot11Oasis_Update = 0x808A9EDC; // type:func -BgSpot11Oasis_Draw = 0x808AA0D0; // type:func -BgSpot12Gate_InitDynaPoly = 0x808AA320; // type:func -BgSpot12Gate_Init = 0x808AA378; // type:func -BgSpot12Gate_Destroy = 0x808AA3F8; // type:func -func_808B30C0 = 0x808AA42C; // type:func -func_808B30D8 = 0x808AA448; // type:func -func_808B3134 = 0x808AA4A4; // type:func -func_808B314C = 0x808AA4C0; // type:func -func_808B317C = 0x808AA4F0; // type:func -func_808B318C = 0x808AA504; // type:func -func_808B3274 = 0x808AA5EC; // type:func -func_808B3298 = 0x808AA614; // type:func -BgSpot12Gate_Update = 0x808AA624; // type:func -BgSpot12Gate_Draw = 0x808AA658; // type:func -func_808B3420 = 0x808AA730; // type:func -BgSpot12Saku_Init = 0x808AA788; // type:func -BgSpot12Saku_Destroy = 0x808AA808; // type:func -func_808B3550 = 0x808AA83C; // type:func -func_808B357C = 0x808AA86C; // type:func -func_808B35E4 = 0x808AA8D4; // type:func -func_808B3604 = 0x808AA8F4; // type:func -func_808B3714 = 0x808AAA04; // type:func -func_808B37AC = 0x808AAA98; // type:func -BgSpot12Saku_Update = 0x808AAAA8; // type:func -BgSpot12Saku_Draw = 0x808AAADC; // type:func -func_808B3960 = 0x808AABF0; // type:func -BgSpot15Rrbox_RotatePoint = 0x808AAC48; // type:func -func_808B3A34 = 0x808AAC9C; // type:func -func_808B3A40 = 0x808AACAC; // type:func -func_808B3AAC = 0x808AAD1C; // type:func -BgSpot15Rrbox_Init = 0x808AAE04; // type:func -BgSpot15Rrbox_Destroy = 0x808AAED4; // type:func -BgSpot15Rrbox_TrySnapToCheckedPoint = 0x808AAF10; // type:func -BgSpot15Rrbox_GetFloorHeight = 0x808AB050; // type:func -BgSpot15Rrbox_TrySnapToFloor = 0x808AB1D0; // type:func -func_808B4010 = 0x808AB290; // type:func -func_808B4084 = 0x808AB304; // type:func -func_808B40AC = 0x808AB330; // type:func -func_808B4178 = 0x808AB3FC; // type:func -func_808B4194 = 0x808AB41C; // type:func -func_808B4380 = 0x808AB608; // type:func -func_808B43D0 = 0x808AB658; // type:func -func_808B44B8 = 0x808AB724; // type:func -func_808B44CC = 0x808AB73C; // type:func -BgSpot15Rrbox_Update = 0x808AB760; // type:func -BgSpot15Rrbox_Draw = 0x808AB7CC; // type:func -BgSpot15Saku_Init = 0x808AB9D0; // type:func -BgSpot15Saku_Destroy = 0x808ABA84; // type:func -func_808B4930 = 0x808ABAB8; // type:func -func_808B4978 = 0x808ABB00; // type:func -func_808B4A04 = 0x808ABB8C; // type:func -BgSpot15Saku_Update = 0x808ABBBC; // type:func -BgSpot15Saku_Draw = 0x808ABBF0; // type:func -func_808B4C30 = 0x808ABD10; // type:func -func_808B4C4C = 0x808ABD30; // type:func -func_808B4D04 = 0x808ABDE4; // type:func -func_808B4D9C = 0x808ABE78; // type:func -func_808B4E58 = 0x808ABF28; // type:func -BgSpot16Bombstone_Init = 0x808AC124; // type:func -BgSpot16Bombstone_Destroy = 0x808AC1D8; // type:func -BgSpot16Bombstone_SpawnDust = 0x808AC224; // type:func -func_808B5240 = 0x808AC2C0; // type:func -BgSpot16Bombstone_SpawnFragments = 0x808AC428; // type:func -func_808B561C = 0x808AC6A0; // type:func -func_808B56BC = 0x808AC740; // type:func -func_808B57E0 = 0x808AC83C; // type:func -func_808B5934 = 0x808AC994; // type:func -func_808B5950 = 0x808AC9B4; // type:func -func_808B5A78 = 0x808ACAA0; // type:func -func_808B5A94 = 0x808ACAC0; // type:func -func_808B5AF0 = 0x808ACB24; // type:func -func_808B5B04 = 0x808ACB3C; // type:func -func_808B5B58 = 0x808ACB94; // type:func -func_808B5B6C = 0x808ACBAC; // type:func -BgSpot16Bombstone_Update = 0x808ACCA8; // type:func -BgSpot16Bombstone_Draw = 0x808ACCDC; // type:func -BgSpot16Doughnut_Init = 0x808AD260; // type:func -BgSpot16Doughnut_Destroy = 0x808AD3D4; // type:func -BgSpot16Doughnut_Update = 0x808AD3E4; // type:func -BgSpot16Doughnut_UpdateExpanding = 0x808AD478; // type:func -BgSpot16Doughnut_Draw = 0x808AD4E0; // type:func -BgSpot16Doughnut_DrawExpanding = 0x808AD698; // type:func -func_808B6BC0 = 0x808AD820; // type:func -BgSpot17Bakudankabe_Init = 0x808ADB50; // type:func -BgSpot17Bakudankabe_Destroy = 0x808ADBE4; // type:func -BgSpot17Bakudankabe_Update = 0x808ADC18; // type:func -BgSpot17Bakudankabe_Draw = 0x808ADCAC; // type:func -BgSpot17Funen_Init = 0x808ADF10; // type:func -BgSpot17Funen_Destroy = 0x808ADF38; // type:func -BgSpot17Funen_Update = 0x808ADF48; // type:func -func_808B746C = 0x808ADF6C; // type:func -func_808B7478 = 0x808ADF7C; // type:func -func_808B7710 = 0x808AE160; // type:func -func_808B7770 = 0x808AE1BC; // type:func -BgSpot18Basket_Init = 0x808AE378; // type:func -BgSpot18Basket_Destroy = 0x808AE4C4; // type:func -func_808B7AEC = 0x808AE50C; // type:func -func_808B7AFC = 0x808AE520; // type:func -func_808B7B58 = 0x808AE57C; // type:func -func_808B7B6C = 0x808AE594; // type:func -func_808B7BB0 = 0x808AE5D8; // type:func -func_808B7BCC = 0x808AE5F8; // type:func -func_808B7D38 = 0x808AE764; // type:func -func_808B7D50 = 0x808AE780; // type:func -func_808B7F74 = 0x808AE9A4; // type:func -func_808B7FC0 = 0x808AE9F4; // type:func -func_808B818C = 0x808AEBC0; // type:func -func_808B81A0 = 0x808AEBD8; // type:func -BgSpot18Basket_Update = 0x808AEE70; // type:func -BgSpot18Basket_Draw = 0x808AEF34; // type:func -BgSpot18Futa_Init = 0x808AF150; // type:func -BgSpot18Futa_Destroy = 0x808AF1BC; // type:func -BgSpot18Futa_Update = 0x808AF1F0; // type:func -BgSpot18Futa_Draw = 0x808AF254; // type:func -func_808B8910 = 0x808AF2F0; // type:func -func_808B8A5C = 0x808AF3A8; // type:func -func_808B8A98 = 0x808AF3E4; // type:func -func_808B8B08 = 0x808AF454; // type:func -func_808B8B38 = 0x808AF488; // type:func -func_808B8BB4 = 0x808AF504; // type:func -func_808B8C90 = 0x808AF5E8; // type:func -func_808B8CC8 = 0x808AF624; // type:func -BgSpot18Obj_Init = 0x808AF678; // type:func -BgSpot18Obj_Destroy = 0x808AF6D4; // type:func -func_808B8DC0 = 0x808AF708; // type:func -func_808B8DD0 = 0x808AF71C; // type:func -func_808B8DDC = 0x808AF72C; // type:func -func_808B8E20 = 0x808AF770; // type:func -func_808B8E64 = 0x808AF7B4; // type:func -func_808B8E7C = 0x808AF7D0; // type:func -func_808B8EE0 = 0x808AF834; // type:func -func_808B8F08 = 0x808AF860; // type:func -func_808B9030 = 0x808AF98C; // type:func -func_808B9040 = 0x808AF9A0; // type:func -BgSpot18Obj_Update = 0x808AF9C0; // type:func -BgSpot18Obj_Draw = 0x808AF9F4; // type:func -BgSpot18Shutter_Init = 0x808AFBC0; // type:func -BgSpot18Shutter_Destroy = 0x808AFD70; // type:func -func_808B95AC = 0x808AFDA4; // type:func -func_808B95B8 = 0x808AFDB4; // type:func -func_808B9618 = 0x808AFE14; // type:func -func_808B9698 = 0x808AFE9C; // type:func -func_808B971C = 0x808AFF20; // type:func -BgSpot18Shutter_Update = 0x808AFFFC; // type:func -BgSpot18Shutter_Draw = 0x808B0020; // type:func -BgSstFloor_Init = 0x808B0110; // type:func -BgSstFloor_Destroy = 0x808B0178; // type:func -BgSstFloor_Update = 0x808B01AC; // type:func -BgSstFloor_Draw = 0x808B0520; // type:func -BgTokiHikari_Init = 0x808B0670; // type:func -BgTokiHikari_Destroy = 0x808B06FC; // type:func -BgTokiHikari_DoNothing = 0x808B070C; // type:func -BgTokiHikari_Update = 0x808B071C; // type:func -BgTokiHikari_Draw = 0x808B0740; // type:func -func_808BA018 = 0x808B0790; // type:func -func_808BA204 = 0x808B0938; // type:func -func_808BA22C = 0x808B0960; // type:func -func_808BA274 = 0x808B09A8; // type:func -func_808BA2CC = 0x808B0A00; // type:func -BgTokiSwd_SetupAction = 0x808B1410; // type:func -BgTokiSwd_Init = 0x808B141C; // type:func -BgTokiSwd_Destroy = 0x808B14F0; // type:func -func_808BAF40 = 0x808B151C; // type:func -func_808BB0AC = 0x808B1690; // type:func -func_808BB128 = 0x808B1710; // type:func -BgTokiSwd_Update = 0x808B1764; // type:func -BgTokiSwd_Draw = 0x808B17B8; // type:func -BgTreemouth_SetupAction = 0x808B2A60; // type:func -BgTreemouth_Init = 0x808B2A6C; // type:func -BgTreemouth_Destroy = 0x808B2B94; // type:func -func_808BC65C = 0x808B2BC8; // type:func -func_808BC6F8 = 0x808B2C64; // type:func -func_808BC80C = 0x808B2D78; // type:func -func_808BC864 = 0x808B2DD0; // type:func -func_808BC8B8 = 0x808B2E24; // type:func -func_808BC9EC = 0x808B2F58; // type:func -func_808BCAF0 = 0x808B3060; // type:func -BgTreemouth_DoNothing = 0x808B30FC; // type:func -BgTreemouth_Update = 0x808B310C; // type:func -BgTreemouth_Draw = 0x808B318C; // type:func -BgUmaJump_Init = 0x808B40C0; // type:func -BgUmaJump_Destroy = 0x808B417C; // type:func -BgUmaJump_Update = 0x808B41B0; // type:func -BgUmaJump_Draw = 0x808B41C0; // type:func -BgVbSima_Init = 0x808B4250; // type:func -BgVbSima_Destroy = 0x808B42B8; // type:func -BgVbSima_SpawnEmber = 0x808B42EC; // type:func -BgVbSima_Update = 0x808B43B8; // type:func -BgVbSima_Draw = 0x808B4818; // type:func -BgYdanHasi_Init = 0x808B4970; // type:func -BgYdanHasi_Destroy = 0x808B4AD4; // type:func -BgYdanHasi_UpdateFloatingBlock = 0x808B4B08; // type:func -BgYdanHasi_InitWater = 0x808B4C40; // type:func -BgYdanHasi_MoveWater = 0x808B4C8C; // type:func -BgYdanHasi_DecWaterTimer = 0x808B4D5C; // type:func -BgYdanHasi_SetupThreeBlocks = 0x808B4DB0; // type:func -BgYdanHasi_UpdateThreeBlocks = 0x808B4E1C; // type:func -BgYdanHasi_Update = 0x808B4EEC; // type:func -BgYdanHasi_Draw = 0x808B4F10; // type:func -BgYdanMaruta_Init = 0x808B5120; // type:func -BgYdanMaruta_Destroy = 0x808B5384; // type:func -func_808BEFF4 = 0x808B53D8; // type:func -func_808BF078 = 0x808B545C; // type:func -func_808BF108 = 0x808B54EC; // type:func -func_808BF1EC = 0x808B55D0; // type:func -BgYdanMaruta_DoNothing = 0x808B5640; // type:func -BgYdanMaruta_Update = 0x808B5650; // type:func -BgYdanMaruta_Draw = 0x808B5674; // type:func -BgYdanSp_Init = 0x808B5800; // type:func -BgYdanSp_Destroy = 0x808B5BE8; // type:func -BgYdanSp_UpdateFloorWebCollision = 0x808B5C30; // type:func -BgYdanSp_BurnWeb = 0x808B5D04; // type:func -BgYdanSp_BurnFloorWeb = 0x808B5D74; // type:func -BgYdanSp_FloorWebBroken = 0x808B6048; // type:func -BgYdanSp_FloorWebBreaking = 0x808B6088; // type:func -BgYdanSp_FloorWebIdle = 0x808B6248; // type:func -BgYdanSp_BurnWallWeb = 0x808B6524; // type:func -BgYdanSp_WallWebIdle = 0x808B685C; // type:func -BgYdanSp_Update = 0x808B699C; // type:func -BgYdanSp_Draw = 0x808B69C0; // type:func -BgZg_Destroy = 0x808B6F20; // type:func -func_808C0C50 = 0x808B6F54; // type:func -func_808C0C98 = 0x808B6F9C; // type:func -func_808C0CC8 = 0x808B6FD0; // type:func -func_808C0CD4 = 0x808B6FE0; // type:func -func_808C0D08 = 0x808B7014; // type:func -BgZg_Update = 0x808B70B8; // type:func -BgZg_Init = 0x808B7100; // type:func -func_808C0EEC = 0x808B71EC; // type:func -BgZg_Draw = 0x808B7268; // type:func -func_808C1190 = 0x808B7370; // type:func -func_808C11D0 = 0x808B73B0; // type:func -func_808C1200 = 0x808B73E0; // type:func -func_808C1230 = 0x808B7410; // type:func -func_808C1278 = 0x808B7458; // type:func -func_808C12C4 = 0x808B74A4; // type:func -func_808C1554 = 0x808B7734; // type:func -func_808C17C8 = 0x808B79B4; // type:func -BossDodongo_AteExplosive = 0x808B7A9C; // type:func -BossDodongo_Init = 0x808B7B5C; // type:func -BossDodongo_Destroy = 0x808B7E38; // type:func -BossDodongo_SetupIntroCutscene = 0x808B7E78; // type:func -BossDodongo_IntroCutscene = 0x808B7EF8; // type:func -BossDodongo_SetupDamaged = 0x808B8A74; // type:func -BossDodongo_SetupExplode = 0x808B8B08; // type:func -BossDodongo_SetupWalk = 0x808B8BAC; // type:func -BossDodongo_SetupRoll = 0x808B8C3C; // type:func -BossDodongo_SetupBlowFire = 0x808B8CB0; // type:func -BossDodongo_SetupInhale = 0x808B8D38; // type:func -BossDodongo_Damaged = 0x808B8DC8; // type:func -BossDodongo_Explode = 0x808B8E7C; // type:func -BossDodongo_LayDown = 0x808B90D0; // type:func -BossDodongo_Vulnerable = 0x808B91B0; // type:func -BossDodongo_GetUp = 0x808B929C; // type:func -BossDodongo_BlowFire = 0x808B9300; // type:func -BossDodongo_Inhale = 0x808B9430; // type:func -BossDodongo_Walk = 0x808B9504; // type:func -BossDodongo_Roll = 0x808B9914; // type:func -BossDodongo_Update = 0x808B9D10; // type:func -BossDodongo_OverrideLimbDraw = 0x808BAB50; // type:func -BossDodongo_PostLimbDraw = 0x808BAD74; // type:func -BossDodongo_Draw = 0x808BAE58; // type:func -func_808C4F6C = 0x808BB120; // type:func -func_808C50A8 = 0x808BB25C; // type:func -BossDodongo_PlayerYawCheck = 0x808BB3A8; // type:func -BossDodongo_PlayerPosCheck = 0x808BB404; // type:func -BossDodongo_SpawnFire = 0x808BB498; // type:func -BossDodongo_UpdateDamage = 0x808BB50C; // type:func -BossDodongo_SetupDeathCutscene = 0x808BB678; // type:func -BossDodongo_DeathCutscene = 0x808BB730; // type:func -BossDodongo_UpdateEffects = 0x808BCE70; // type:func -BossDodongo_DrawEffects = 0x808BCFA4; // type:func -BossFd_SpawnEmber = 0x808C0E70; // type:func -BossFd_SpawnDebris = 0x808C0F3C; // type:func -BossFd_SpawnDust = 0x808C100C; // type:func -BossFd_SpawnFireBreath = 0x808C10A4; // type:func -BossFd_SetCameraSpeed = 0x808C11B0; // type:func -BossFd_UpdateCamera = 0x808C1250; // type:func -BossFd_Init = 0x808C13BC; // type:func -BossFd_Destroy = 0x808C16DC; // type:func -BossFd_IsFacingLink = 0x808C173C; // type:func -BossFd_SetupFly = 0x808C176C; // type:func -BossFd_Fly = 0x808C17DC; // type:func -BossFd_Wait = 0x808C3E64; // type:func -BossFd_Effects = 0x808C4054; // type:func -BossFd_CollisionCheck = 0x808C4C74; // type:func -BossFd_Update = 0x808C4D28; // type:func -BossFd_UpdateEffects = 0x808C5468; // type:func -BossFd_DrawEffects = 0x808C58C0; // type:func -BossFd_Draw = 0x808C5F60; // type:func -BossFd_OverrideRightArmDraw = 0x808C6018; // type:func -BossFd_OverrideLeftArmDraw = 0x808C6138; // type:func -BossFd_DrawMane = 0x808C6258; // type:func -BossFd_OverrideHeadDraw = 0x808C66DC; // type:func -BossFd_PostHeadDraw = 0x808C67D4; // type:func -BossFd_DrawBody = 0x808C6828; // type:func -BossFd2_SpawnDebris = 0x808C81D0; // type:func -BossFd2_SpawnFireBreath = 0x808C82A8; // type:func -BossFd2_SpawnEmber = 0x808C83BC; // type:func -BossFd2_SpawnSkullPiece = 0x808C8490; // type:func -BossFd2_SpawnDust = 0x808C8568; // type:func -BossFd2_Init = 0x808C8600; // type:func -BossFd2_Destroy = 0x808C86FC; // type:func -BossFd2_SetupEmerge = 0x808C873C; // type:func -BossFd2_Emerge = 0x808C8834; // type:func -BossFd2_SetupIdle = 0x808C8B74; // type:func -BossFd2_Idle = 0x808C8C1C; // type:func -BossFd2_SetupBurrow = 0x808C8D70; // type:func -BossFd2_Burrow = 0x808C8DE8; // type:func -BossFd2_SetupBreatheFire = 0x808C8EB8; // type:func -BossFd2_BreatheFire = 0x808C8F1C; // type:func -BossFd2_SetupClawSwipe = 0x808C9460; // type:func -BossFd2_ClawSwipe = 0x808C94C0; // type:func -BossFd2_SetupVulnerable = 0x808C9538; // type:func -BossFd2_Vulnerable = 0x808C9594; // type:func -BossFd2_SetupDamaged = 0x808C97EC; // type:func -BossFd2_Damaged = 0x808C9848; // type:func -BossFd2_SetupDeath = 0x808C9978; // type:func -BossFd2_UpdateCamera = 0x808C9A08; // type:func -BossFd2_Death = 0x808C9B78; // type:func -BossFd2_Wait = 0x808CA1FC; // type:func -BossFd2_CollisionCheck = 0x808CA244; // type:func -BossFd2_UpdateFace = 0x808CA6E4; // type:func -BossFd2_Update = 0x808CA850; // type:func -BossFd2_OverrideLimbDraw = 0x808CAA04; // type:func -BossFd2_PostLimbDraw = 0x808CABF8; // type:func -BossFd2_UpdateMane = 0x808CACA0; // type:func -BossFd2_DrawMane = 0x808CB274; // type:func -BossFd2_Draw = 0x808CB6B8; // type:func -BossGanonEff_SpawnWindowShard = 0x808CBF00; // type:func -BossGanonEff_SpawnSparkle = 0x808CC040; // type:func -BossGanonEff_SpawnLightRay = 0x808CC13C; // type:func -BossGanonEff_SpawnShock = 0x808CC280; // type:func -BossGanonEff_SpawnLightning = 0x808CC34C; // type:func -BossGanonEff_SpawnDustDark = 0x808CC3F0; // type:func -BossGanonEff_SpawnDustLight = 0x808CC4E4; // type:func -BossGanonEff_SpawnShockwave = 0x808CC5C8; // type:func -BossGanonEff_SpawnBlackDot = 0x808CC6C0; // type:func -BossGanon_SetColliderPos = 0x808CC77C; // type:func -BossGanon_SetAnimationObject = 0x808CC7C0; // type:func -BossGanon_Init = 0x808CC830; // type:func -BossGanon_Destroy = 0x808CCDD4; // type:func -BossGanon_SetupIntroCutscene = 0x808CCE38; // type:func -BossGanon_SetIntroCsCamera = 0x808CCF1C; // type:func -BossGanon_IntroCutscene = 0x808CCFBC; // type:func -BossGanon_SetupDeathCutscene = 0x808CE6BC; // type:func -BossGanon_SetupTowerCutscene = 0x808CE7A0; // type:func -BossGanon_ShatterWindows = 0x808CE8A4; // type:func -BossGanon_DeathAndTowerCutscene = 0x808CE9E8; // type:func -BossGanon_SetupPoundFloor = 0x808D0390; // type:func -BossGanon_PoundFloor = 0x808D03CC; // type:func -BossGanon_SetupChargeBigMagic = 0x808D0920; // type:func -BossGanon_ChargeBigMagic = 0x808D0990; // type:func -BossGanon_SetupWait = 0x808D1198; // type:func -BossGanon_Wait = 0x808D1220; // type:func -BossGanon_SetupChargeLightBall = 0x808D156C; // type:func -BossGanon_ChargeLightBall = 0x808D15DC; // type:func -BossGanon_SetupPlayTennis = 0x808D1790; // type:func -BossGanon_PlayTennis = 0x808D17F8; // type:func -BossGanon_SetupBlock = 0x808D1AC8; // type:func -BossGanon_Block = 0x808D1B80; // type:func -BossGanon_SetupHitByLightBall = 0x808D1D10; // type:func -BossGanon_HitByLightBall = 0x808D1E04; // type:func -BossGanon_SetupVulnerable = 0x808D205C; // type:func -BossGanon_Vulnerable = 0x808D222C; // type:func -BossGanon_SetupDamaged = 0x808D2798; // type:func -BossGanon_Damaged = 0x808D2800; // type:func -BossGanon_UpdateDamage = 0x808D28C0; // type:func -BossGanon_Update = 0x808D2C88; // type:func -BossGanon_OverrideLimbDraw = 0x808D3DF0; // type:func -BossGanon_PostLimbDraw = 0x808D4030; // type:func -BossGanon_InitRand = 0x808D438C; // type:func -BossGanon_RandZeroOne = 0x808D43AC; // type:func -BossGanon_DrawShock = 0x808D44D4; // type:func -BossGanon_DrawHandLightBall = 0x808D4880; // type:func -BossGanon_DrawBigMagicCharge = 0x808D4AD4; // type:func -BossGanon_DrawTriforce = 0x808D5164; // type:func -BossGanon_DrawDarkVortex = 0x808D5528; // type:func -func_808E0254 = 0x808D5780; // type:func -BossGanon_GenShadowTexture = 0x808D5C28; // type:func -BossGanon_DrawShadowTexture = 0x808D5F68; // type:func -BossGanon_Draw = 0x808D61E4; // type:func -BossGanon_CheckFallingPlatforms = 0x808D642C; // type:func -BossGanon_LightBall_Update = 0x808D6514; // type:func -BossGanon_LightBall_Draw = 0x808D7034; // type:func -func_808E1EB4 = 0x808D7348; // type:func -func_808E229C = 0x808D7738; // type:func -func_808E2544 = 0x808D79A8; // type:func -func_808E324C = 0x808D86BC; // type:func -BossGanon_UpdateEffects = 0x808D8990; // type:func -BossGanon_DrawEffects = 0x808D91B8; // type:func -BossGanon2_InitRand = 0x808F1D30; // type:func -BossGanon2_RandZeroOne = 0x808F1D50; // type:func -func_808FD080 = 0x808F1E78; // type:func -BossGanon2_SetObjectSegment = 0x808F1F08; // type:func -func_808FD210 = 0x808F1FBC; // type:func -func_808FD27C = 0x808F202C; // type:func -BossGanon2_Init = 0x808F210C; // type:func -BossGanon2_Destroy = 0x808F223C; // type:func -func_808FD4D4 = 0x808F228C; // type:func -func_808FD5C4 = 0x808F237C; // type:func -func_808FD5F4 = 0x808F23B0; // type:func -func_808FF898 = 0x808F4660; // type:func -func_808FFA24 = 0x808F47EC; // type:func -func_808FFAC8 = 0x808F4890; // type:func -func_808FFBBC = 0x808F4988; // type:func -func_808FFC84 = 0x808F4A54; // type:func -func_808FFCFC = 0x808F4ACC; // type:func -func_808FFDB0 = 0x808F4B80; // type:func -func_808FFEBC = 0x808F4C90; // type:func -func_808FFF90 = 0x808F4D64; // type:func -func_808FFFE0 = 0x808F4DB4; // type:func -func_809000A0 = 0x808F4E74; // type:func -func_80900104 = 0x808F4ED4; // type:func -func_80900210 = 0x808F4FE0; // type:func -func_8090026C = 0x808F503C; // type:func -func_809002CC = 0x808F50A0; // type:func -func_80900344 = 0x808F5114; // type:func -func_80900580 = 0x808F5350; // type:func -func_80900650 = 0x808F5420; // type:func -func_80900818 = 0x808F55E8; // type:func -func_80900890 = 0x808F5660; // type:func -func_80901020 = 0x808F5DF4; // type:func -func_8090109C = 0x808F5E70; // type:func -func_8090120C = 0x808F5FE0; // type:func -func_80902348 = 0x808F7124; // type:func -BossGanon2_CollisionCheck = 0x808F7304; // type:func -BossGanon2_Update = 0x808F75F8; // type:func -func_809034E4 = 0x808F82C4; // type:func -func_80903F38 = 0x808F8D18; // type:func -func_80904108 = 0x808F8EA4; // type:func -func_80904340 = 0x808F90A8; // type:func -func_8090464C = 0x808F9398; // type:func -BossGanon2_OverrideLimbDraw = 0x808F952C; // type:func -BossGanon2_PostLimbDraw = 0x808F9664; // type:func -func_80904D88 = 0x808F9A28; // type:func -func_80904FC8 = 0x808F9C2C; // type:func -func_8090523C = 0x808F9E50; // type:func -BossGanon2_PostLimbDraw2 = 0x808FA0E0; // type:func -func_80905674 = 0x808FA20C; // type:func -BossGanon2_Draw = 0x808FA454; // type:func -BossGanon2_UpdateEffects = 0x808FA8D4; // type:func -BossGanon2_DrawEffects = 0x808FAC18; // type:func -func_80906538 = 0x808FB010; // type:func -BossGanon2_GenShadowTexture = 0x808FB4D0; // type:func -BossGanon2_DrawShadowTexture = 0x808FB588; // type:func -BossGanondrof_ClearPixels8x8 = 0x80904BA0; // type:func -BossGanondrof_ClearPixels16x8 = 0x80904BE0; // type:func -BossGanondrof_ClearPixels16x16 = 0x80904C20; // type:func -BossGanondrof_ClearPixels32x16 = 0x80904C50; // type:func -BossGanondrof_ClearPixels16x32 = 0x80904C98; // type:func -BossGanondrof_ClearPixels = 0x80904CE4; // type:func -BossGanondrof_SetColliderPos = 0x80904F94; // type:func -BossGanondrof_Init = 0x80904FD8; // type:func -BossGanondrof_Destroy = 0x80905268; // type:func -BossGanondrof_SetupIntro = 0x809052D4; // type:func -BossGanondrof_Intro = 0x80905320; // type:func -BossGanondrof_SetupPaintings = 0x809057D8; // type:func -BossGanondrof_Paintings = 0x8090581C; // type:func -BossGanondrof_SetupNeutral = 0x809059F0; // type:func -BossGanondrof_Neutral = 0x80905A70; // type:func -BossGanondrof_SetupThrow = 0x809061B8; // type:func -BossGanondrof_Throw = 0x809062E0; // type:func -BossGanondrof_SetupReturn = 0x809064EC; // type:func -BossGanondrof_Return = 0x8090658C; // type:func -BossGanondrof_SetupStunned = 0x80906698; // type:func -BossGanondrof_Stunned = 0x8090675C; // type:func -BossGanondrof_SetupBlock = 0x80906870; // type:func -BossGanondrof_Block = 0x809068E4; // type:func -BossGanondrof_SetupCharge = 0x809069C0; // type:func -BossGanondrof_Charge = 0x80906A30; // type:func -BossGanondrof_SetupDeath = 0x80907114; // type:func -BossGanondrof_Death = 0x809071AC; // type:func -BossGanondrof_CollisionCheck = 0x8090809C; // type:func -BossGanondrof_Update = 0x809082C8; // type:func -BossGanondrof_OverrideLimbDraw = 0x809086D0; // type:func -BossGanondrof_PostLimbDraw = 0x80908AAC; // type:func -BossGanondrof_GetClearPixelDList = 0x80908B70; // type:func -BossGanondrof_EmptyDList = 0x80908BDC; // type:func -BossGanondrof_Draw = 0x80908C00; // type:func -BossGoma_ClearPixels16x16Rgba16 = 0x80909930; // type:func -BossGoma_ClearPixels32x32Rgba16 = 0x80909960; // type:func -BossGoma_ClearPixels = 0x809099B4; // type:func -BossGoma_Init = 0x80909B64; // type:func -BossGoma_PlayEffectsAndSfx = 0x80909D1C; // type:func -BossGoma_Destroy = 0x80909E24; // type:func -BossGoma_SetupDefeated = 0x80909E64; // type:func -BossGoma_SetupEncounter = 0x80909F2C; // type:func -BossGoma_SetupFloorIdle = 0x80909FD0; // type:func -BossGoma_SetupCeilingIdle = 0x8090A058; // type:func -BossGoma_SetupFallJump = 0x8090A0DC; // type:func -BossGoma_SetupFallStruckDown = 0x8090A158; // type:func -BossGoma_SetupCeilingSpawnGohmas = 0x8090A1D4; // type:func -BossGoma_SetupCeilingPrepareSpawnGohmas = 0x8090A248; // type:func -BossGoma_SetupWallClimb = 0x8090A2C0; // type:func -BossGoma_SetupCeilingMoveToCenter = 0x8090A344; // type:func -BossGoma_SetupFloorMain = 0x8090A3D8; // type:func -BossGoma_SetupFloorLand = 0x8090A458; // type:func -BossGoma_SetupFloorLandStruckDown = 0x8090A4E4; // type:func -BossGoma_SetupFloorStunned = 0x8090A588; // type:func -BossGoma_SetupFloorAttackPosture = 0x8090A5F8; // type:func -BossGoma_SetupFloorPrepareAttack = 0x8090A66C; // type:func -BossGoma_SetupFloorAttack = 0x8090A6E0; // type:func -BossGoma_SetupFloorDamaged = 0x8090A75C; // type:func -BossGoma_UpdateCeilingMovement = 0x8090A7D0; // type:func -BossGoma_SetupEncounterState4 = 0x8090AA0C; // type:func -BossGoma_Encounter = 0x8090ABBC; // type:func -BossGoma_Defeated = 0x8090BCB4; // type:func -BossGoma_FloorAttackPosture = 0x8090CB24; // type:func -BossGoma_FloorPrepareAttack = 0x8090CC2C; // type:func -BossGoma_FloorAttack = 0x8090CC88; // type:func -BossGoma_FloorDamaged = 0x8090CED8; // type:func -BossGoma_FloorLandStruckDown = 0x8090CF70; // type:func -BossGoma_FloorLand = 0x8090D014; // type:func -BossGoma_FloorStunned = 0x8090D070; // type:func -BossGoma_FallJump = 0x8090D19C; // type:func -BossGoma_FallStruckDown = 0x8090D250; // type:func -BossGoma_CeilingSpawnGohmas = 0x8090D310; // type:func -BossGoma_CeilingPrepareSpawnGohmas = 0x8090D46C; // type:func -BossGoma_FloorIdle = 0x8090D4C8; // type:func -BossGoma_CeilingIdle = 0x8090D530; // type:func -BossGoma_FloorMain = 0x8090D628; // type:func -BossGoma_WallClimb = 0x8090D898; // type:func -BossGoma_CeilingMoveToCenter = 0x8090D964; // type:func -BossGoma_UpdateEye = 0x8090DB60; // type:func -BossGoma_UpdateTailLimbsScale = 0x8090DDA8; // type:func -BossGoma_UpdateHit = 0x8090DEB4; // type:func -BossGoma_UpdateMainEnvColor = 0x8090E094; // type:func -BossGoma_UpdateEyeEnvColor = 0x8090E210; // type:func -BossGoma_Update = 0x8090E2B8; // type:func -BossGoma_OverrideLimbDraw = 0x8090E488; // type:func -BossGoma_PostLimbDraw = 0x8090E8D4; // type:func -BossGoma_EmptyDlist = 0x8090EAD8; // type:func -BossGoma_NoBackfaceCullingDlist = 0x8090EAFC; // type:func -BossGoma_Draw = 0x8090EB68; // type:func -BossGoma_SpawnChildGohma = 0x8090EC58; // type:func -BossMo_InitRand = 0x8090F8D0; // type:func -BossMo_RandZeroOne = 0x8090F8F0; // type:func -BossMo_NearLand = 0x8090FA18; // type:func -BossMo_SpawnRipple = 0x8090FB10; // type:func -BossMo_SpawnDroplet = 0x8090FC30; // type:func -BossMo_SpawnStillDroplet = 0x8090FD0C; // type:func -BossMo_SpawnBubble = 0x8090FDD0; // type:func -BossMo_Init = 0x8090FE84; // type:func -BossMo_Destroy = 0x8091026C; // type:func -BossMo_SetupTentacle = 0x809102BC; // type:func -BossMo_Tentacle = 0x80910310; // type:func -BossMo_TentCollisionCheck = 0x809130D0; // type:func -BossMo_IntroCs = 0x8091337C; // type:func -BossMo_DeathCs = 0x80914494; // type:func -BossMo_CoreCollisionCheck = 0x80915050; // type:func -BossMo_Core = 0x80915458; // type:func -BossMo_UpdateCore = 0x80916ABC; // type:func -BossMo_UpdateTent = 0x80916CEC; // type:func -BossMo_UpdateTentColliders = 0x80917524; // type:func -BossMo_DrawTentacle = 0x809175D0; // type:func -BossMo_DrawWater = 0x80917D00; // type:func -BossMo_DrawCore = 0x80917F10; // type:func -BossMo_DrawTent = 0x80918798; // type:func -BossMo_UpdateEffects = 0x809189CC; // type:func -BossMo_DrawEffects = 0x809190DC; // type:func -BossMo_Unknown = 0x80919808; // type:func -BossSst_Init = 0x8091FEB0; // type:func -BossSst_Destroy = 0x80920338; // type:func -BossSst_HeadSetupLurk = 0x80920384; // type:func -BossSst_HeadLurk = 0x809203B8; // type:func -BossSst_HeadSetupIntro = 0x809203F4; // type:func -BossSst_HeadIntro = 0x80920540; // type:func -BossSst_HeadSetupWait = 0x80921358; // type:func -BossSst_HeadWait = 0x809213A8; // type:func -BossSst_HeadSetupNeutral = 0x80921424; // type:func -BossSst_HeadNeutral = 0x80921444; // type:func -BossSst_HeadSetupDamagedHand = 0x809215E8; // type:func -BossSst_HeadDamagedHand = 0x80921650; // type:func -BossSst_HeadSetupReadyCharge = 0x80921748; // type:func -BossSst_HeadReadyCharge = 0x809217A0; // type:func -BossSst_HeadSetupCharge = 0x80921844; // type:func -BossSst_HeadCharge = 0x80921900; // type:func -BossSst_HeadSetupEndCharge = 0x80921B60; // type:func -BossSst_HeadEndCharge = 0x80921BE4; // type:func -BossSst_HeadSetupFrozenHand = 0x80921C54; // type:func -BossSst_HeadFrozenHand = 0x80921CA8; // type:func -BossSst_HeadSetupUnfreezeHand = 0x80921CF0; // type:func -BossSst_HeadUnfreezeHand = 0x80921D3C; // type:func -BossSst_HeadSetupStunned = 0x80921D78; // type:func -BossSst_HeadStunned = 0x80921E18; // type:func -BossSst_HeadSetupVulnerable = 0x8092209C; // type:func -BossSst_HeadVulnerable = 0x8092213C; // type:func -BossSst_HeadSetupDamage = 0x8092223C; // type:func -BossSst_HeadDamage = 0x8092230C; // type:func -BossSst_HeadSetupRecover = 0x8092235C; // type:func -BossSst_HeadRecover = 0x809223E8; // type:func -BossSst_SetCameraTargets = 0x8092257C; // type:func -BossSst_UpdateDeathCamera = 0x809226A8; // type:func -BossSst_HeadSetupDeath = 0x80922834; // type:func -BossSst_HeadDeath = 0x809229C8; // type:func -BossSst_HeadSetupThrash = 0x80922C18; // type:func -BossSst_HeadThrash = 0x80922C80; // type:func -BossSst_HeadSetupDarken = 0x80922CFC; // type:func -BossSst_HeadDarken = 0x80922D44; // type:func -BossSst_HeadSetupFall = 0x80922F6C; // type:func -BossSst_HeadFall = 0x80923004; // type:func -BossSst_HeadSetupMelt = 0x809230A0; // type:func -BossSst_HeadMelt = 0x809230F0; // type:func -BossSst_HeadSetupFinish = 0x809231A8; // type:func -BossSst_HeadFinish = 0x80923204; // type:func -BossSst_HandSetupWait = 0x809234FC; // type:func -BossSst_HandWait = 0x80923578; // type:func -BossSst_HandSetupDownbeat = 0x809236E8; // type:func -BossSst_HandDownbeat = 0x8092375C; // type:func -BossSst_HandSetupDownbeatEnd = 0x809238AC; // type:func -BossSst_HandDownbeatEnd = 0x80923908; // type:func -BossSst_HandSetupOffbeat = 0x809239FC; // type:func -BossSst_HandOffbeat = 0x80923A70; // type:func -BossSst_HandSetupOffbeatEnd = 0x80923B50; // type:func -BossSst_HandOffbeatEnd = 0x80923B9C; // type:func -BossSst_HandSetupEndSlam = 0x80923CE0; // type:func -BossSst_HandEndSlam = 0x80923D54; // type:func -BossSst_HandSetupRetreat = 0x80923D90; // type:func -BossSst_HandRetreat = 0x80923E38; // type:func -BossSst_HandSetupReadySlam = 0x80924064; // type:func -BossSst_HandReadySlam = 0x809240D0; // type:func -BossSst_HandSetupSlam = 0x809241C0; // type:func -BossSst_HandSlam = 0x80924250; // type:func -BossSst_HandSetupReadySweep = 0x80924434; // type:func -BossSst_HandReadySweep = 0x809244DC; // type:func -BossSst_HandSetupSweep = 0x80924600; // type:func -BossSst_HandSweep = 0x8092468C; // type:func -BossSst_HandSetupReadyPunch = 0x8092489C; // type:func -BossSst_HandReadyPunch = 0x80924904; // type:func -BossSst_HandSetupPunch = 0x80924960; // type:func -BossSst_HandPunch = 0x809249E8; // type:func -BossSst_HandSetupReadyClap = 0x80924B2C; // type:func -BossSst_HandReadyClap = 0x80924C1C; // type:func -BossSst_HandSetupClap = 0x80924E0C; // type:func -BossSst_HandClap = 0x80924E7C; // type:func -BossSst_HandSetupEndClap = 0x809250A8; // type:func -BossSst_HandEndClap = 0x80925114; // type:func -BossSst_HandSetupReadyGrab = 0x809251B8; // type:func -BossSst_HandReadyGrab = 0x8092523C; // type:func -BossSst_HandSetupGrab = 0x809252E4; // type:func -BossSst_HandGrab = 0x80925370; // type:func -BossSst_HandSetupCrush = 0x8092561C; // type:func -BossSst_HandCrush = 0x80925674; // type:func -BossSst_HandSetupEndCrush = 0x8092578C; // type:func -BossSst_HandEndCrush = 0x809257DC; // type:func -BossSst_HandSetupSwing = 0x80925818; // type:func -BossSst_HandSwing = 0x809258A0; // type:func -BossSst_HandSetupReel = 0x80925BD4; // type:func -BossSst_HandReel = 0x80925C6C; // type:func -BossSst_HandSetupReadyShake = 0x80925DC4; // type:func -BossSst_HandReadyShake = 0x80925E14; // type:func -BossSst_HandSetupShake = 0x80925F7C; // type:func -BossSst_HandShake = 0x80925F98; // type:func -BossSst_HandSetupReadyCharge = 0x8092612C; // type:func -BossSst_HandReadyCharge = 0x80926180; // type:func -BossSst_HandSetupStunned = 0x809262F8; // type:func -BossSst_HandStunned = 0x809263A4; // type:func -BossSst_HandSetupDamage = 0x80926500; // type:func -BossSst_HandDamage = 0x8092655C; // type:func -BossSst_HandSetupThrash = 0x80926634; // type:func -BossSst_HandThrash = 0x809266D0; // type:func -BossSst_HandSetupDarken = 0x809268C4; // type:func -BossSst_HandDarken = 0x80926914; // type:func -BossSst_HandSetupFall = 0x80926988; // type:func -BossSst_HandFall = 0x809269D8; // type:func -BossSst_HandSetupMelt = 0x80926A5C; // type:func -BossSst_HandMelt = 0x80926A98; // type:func -BossSst_HandSetupFinish = 0x80926B10; // type:func -BossSst_HandFinish = 0x80926B3C; // type:func -BossSst_HandSetupRecover = 0x80926B68; // type:func -BossSst_HandRecover = 0x80926BBC; // type:func -BossSst_HandSetupFrozen = 0x80926C54; // type:func -BossSst_HandFrozen = 0x80926D20; // type:func -BossSst_HandSetupReadyBreakIce = 0x80926E80; // type:func -BossSst_HandReadyBreakIce = 0x80926F34; // type:func -BossSst_HandSetupBreakIce = 0x80927050; // type:func -BossSst_HandBreakIce = 0x80927078; // type:func -BossSst_HandGrabPlayer = 0x8092720C; // type:func -BossSst_HandReleasePlayer = 0x809272AC; // type:func -BossSst_MoveAround = 0x80927330; // type:func -BossSst_HandSelectAttack = 0x809274BC; // type:func -BossSst_HandSetDamage = 0x809275B8; // type:func -BossSst_HandSetInvulnerable = 0x80927624; // type:func -BossSst_HeadSfx = 0x80927664; // type:func -BossSst_HandCollisionCheck = 0x80927690; // type:func -BossSst_HeadCollisionCheck = 0x8092781C; // type:func -BossSst_UpdateHand = 0x80927968; // type:func -BossSst_UpdateHead = 0x80927C78; // type:func -BossSst_OverrideHandDraw = 0x80927EE8; // type:func -BossSst_PostHandDraw = 0x80927F38; // type:func -BossSst_OverrideHandTrailDraw = 0x80927F74; // type:func -BossSst_DrawHand = 0x80927FB8; // type:func -BossSst_OverrideHeadDraw = 0x80928364; // type:func -BossSst_PostHeadDraw = 0x80928B68; // type:func -BossSst_DrawHead = 0x80928C10; // type:func -BossSst_SpawnHeadShadow = 0x80929060; // type:func -BossSst_SpawnHandShadow = 0x8092918C; // type:func -BossSst_SpawnShockwave = 0x80929240; // type:func -BossSst_SpawnIceCrystal = 0x8092931C; // type:func -BossSst_SpawnIceShard = 0x809295D8; // type:func -BossSst_IceShatter = 0x8092982C; // type:func -BossSst_UpdateEffects = 0x809299F8; // type:func -BossSst_DrawEffects = 0x80929C9C; // type:func -BossTw_AddDotEffect = 0x8092C480; // type:func -BossTw_AddDmgCloud = 0x8092C574; // type:func -BossTw_AddRingEffect = 0x8092C670; // type:func -BossTw_AddPlayerFreezeEffect = 0x8092C774; // type:func -BossTw_AddFlameEffect = 0x8092C820; // type:func -BossTw_AddMergeFlameEffect = 0x8092C8F8; // type:func -BossTw_AddShieldBlastEffect = 0x8092CA00; // type:func -BossTw_AddShieldDeflectEffect = 0x8092CAE8; // type:func -BossTw_AddShieldHitEffect = 0x8092CCB0; // type:func -BossTw_Init = 0x8092CE78; // type:func -BossTw_Destroy = 0x8092D694; // type:func -BossTw_SetupTurnToPlayer = 0x8092D6FC; // type:func -BossTw_TurnToPlayer = 0x8092D74C; // type:func -BossTw_SetupFlyTo = 0x8092D86C; // type:func -BossTw_FlyTo = 0x8092DA70; // type:func -BossTw_SetupShootBeam = 0x8092DCA4; // type:func -BossTw_SpawnGroundBlast = 0x8092DD8C; // type:func -BossTw_BeamHitPlayerCheck = 0x8092E108; // type:func -BossTw_CheckBeamReflection = 0x8092E300; // type:func -BossTw_BeamReflHitCheck = 0x8092E588; // type:func -BossTw_GetFloorY = 0x8092E6B0; // type:func -BossTw_ShootBeam = 0x8092E984; // type:func -BossTw_SetupFinishBeamShoot = 0x8092F93C; // type:func -BossTw_FinishBeamShoot = 0x8092F998; // type:func -BossTw_SetupHitByBeam = 0x8092FA30; // type:func -BossTw_HitByBeam = 0x8092FA98; // type:func -BossTw_SetupLaugh = 0x8092FD60; // type:func -BossTw_Laugh = 0x8092FDC4; // type:func -BossTw_SetupSpin = 0x8092FE54; // type:func -BossTw_Spin = 0x8092FED0; // type:func -BossTw_SetupMergeCS = 0x8092FF70; // type:func -BossTw_MergeCS = 0x8092FFBC; // type:func -BossTw_SetupWait = 0x80930000; // type:func -BossTw_Wait = 0x80930038; // type:func -BossTw_TwinrovaSetupMergeCS = 0x809300DC; // type:func -BossTw_TwinrovaMergeCS = 0x809300FC; // type:func -BossTw_SetupDeathCS = 0x80930BC8; // type:func -BossTw_DeathCS = 0x80930C30; // type:func -BossTw_SetupCSWait = 0x80930D38; // type:func -BossTw_CSWait = 0x80930D70; // type:func -BossTw_TwinrovaSetupIntroCS = 0x80930D80; // type:func -BossTw_TwinrovaIntroCS = 0x80930DB8; // type:func -BossTw_DeathBall = 0x8093260C; // type:func -BossTw_TwinrovaSetupDeathCS = 0x80932908; // type:func -BossTw_DeathCSMsgSfx = 0x809329C4; // type:func -BossTw_TwinrovaDeathCS = 0x809331E4; // type:func -BossTw_Update = 0x80933ED8; // type:func -BossTw_TwinrovaUpdate = 0x8093454C; // type:func -BossTw_OverrideLimbDraw = 0x80934EC8; // type:func -BossTw_PostLimbDraw = 0x80934F7C; // type:func -func_80941BC0 = 0x80935394; // type:func -func_80942180 = 0x8093590C; // type:func -func_809426F0 = 0x80935E28; // type:func -func_80942C70 = 0x80936370; // type:func -func_80943028 = 0x809366E0; // type:func -BossTw_Draw = 0x809368E4; // type:func -BossTw_TwinrovaOverrideLimbDraw = 0x80936FA0; // type:func -BossTw_TwinrovaPostLimbDraw = 0x809373CC; // type:func -BossTw_ShieldChargeDraw = 0x80937508; // type:func -BossTw_SpawnPortalDraw = 0x80937D70; // type:func -func_80944C50 = 0x809381A8; // type:func -BossTw_TwinrovaDraw = 0x8093858C; // type:func -BossTw_BlastFire = 0x809388C4; // type:func -BossTw_BlastIce = 0x809391FC; // type:func -BossTw_BlastShieldCheck = 0x80939D70; // type:func -BossTw_BlastUpdate = 0x8093A000; // type:func -BossTw_BlastDraw = 0x8093A17C; // type:func -BossTw_DrawDeathBall = 0x8093A700; // type:func -BossTw_UpdateEffects = 0x8093AC60; // type:func -BossTw_InitRand = 0x8093B9B8; // type:func -BossTw_RandZeroOne = 0x8093B9D8; // type:func -BossTw_DrawEffects = 0x8093BB00; // type:func -BossTw_TwinrovaSetupArriveAtTarget = 0x8093C934; // type:func -BossTw_TwinrovaArriveAtTarget = 0x8093C9A8; // type:func -BossTw_TwinrovaSetupChargeBlast = 0x8093CAD4; // type:func -BossTw_TwinrovaChargeBlast = 0x8093CB34; // type:func -BossTw_TwinrovaSetupShootBlast = 0x8093CD20; // type:func -BossTw_TwinrovaShootBlast = 0x8093CDA8; // type:func -BossTw_TwinrovaSetupDoneBlastShoot = 0x8093CFF8; // type:func -BossTw_TwinrovaDoneBlastShoot = 0x8093D044; // type:func -BossTw_TwinrovaDamage = 0x8093D0DC; // type:func -BossTw_TwinrovaStun = 0x8093D208; // type:func -BossTw_TwinrovaSetupGetUp = 0x8093D4BC; // type:func -BossTw_TwinrovaGetUp = 0x8093D520; // type:func -BossTw_TwinrovaSetupFly = 0x8093D5B4; // type:func -BossTw_TwinrovaFly = 0x8093D78C; // type:func -BossTw_TwinrovaSetupSpin = 0x8093DA00; // type:func -BossTw_TwinrovaSpin = 0x8093DA58; // type:func -BossTw_TwinrovaSetupLaugh = 0x8093DAD0; // type:func -BossTw_TwinrovaLaugh = 0x8093DB34; // type:func -BossVa_SetupAction = 0x80942050; // type:func -BossVa_AttachToBody = 0x8094205C; // type:func -BossVa_BloodDroplets = 0x809422A0; // type:func -BossVa_BloodSplatter = 0x809423A0; // type:func -BossVa_Gore = 0x809424CC; // type:func -BossVa_Spark = 0x809425FC; // type:func -BossVa_Tumor = 0x80942780; // type:func -BossVa_SetSparkEnv = 0x80942904; // type:func -BossVa_SetDeathEnv = 0x80942950; // type:func -BossVa_FindBoomerang = 0x809429D0; // type:func -BossVa_KillBari = 0x80942A10; // type:func -BossVa_Init = 0x80942BFC; // type:func -BossVa_Destroy = 0x8094344C; // type:func -BossVa_SetupIntro = 0x8094349C; // type:func -BossVa_BodyIntro = 0x8094352C; // type:func -BossVa_SetupBodyPhase1 = 0x8094454C; // type:func -BossVa_BodyPhase1 = 0x809445F0; // type:func -BossVa_SetupBodyPhase2 = 0x80944888; // type:func -BossVa_BodyPhase2 = 0x809449B4; // type:func -BossVa_SetupBodyPhase3 = 0x80944EB8; // type:func -BossVa_BodyPhase3 = 0x80944EF4; // type:func -BossVa_SetupBodyPhase4 = 0x8094555C; // type:func -BossVa_BodyPhase4 = 0x80945610; // type:func -BossVa_SetupBodyDeath = 0x80946118; // type:func -BossVa_BodyDeath = 0x809461B0; // type:func -BossVa_SetupSupportIntro = 0x80946D08; // type:func -BossVa_SupportIntro = 0x80946D80; // type:func -BossVa_SetupSupportAttached = 0x80946EA4; // type:func -BossVa_SupportAttached = 0x80946F28; // type:func -BossVa_SetupSupportCut = 0x80947150; // type:func -BossVa_SupportCut = 0x80947218; // type:func -BossVa_SetupStump = 0x809476EC; // type:func -BossVa_Stump = 0x80947770; // type:func -BossVa_SetupZapperIntro = 0x80947808; // type:func -BossVa_ZapperIntro = 0x8094789C; // type:func -BossVa_SetupZapperAttack = 0x8094795C; // type:func -BossVa_ZapperAttack = 0x809479F0; // type:func -BossVa_SetupZapperDamaged = 0x80948424; // type:func -BossVa_ZapperDamaged = 0x8094852C; // type:func -BossVa_SetupZapperDeath = 0x80948640; // type:func -BossVa_ZapperDeath = 0x80948714; // type:func -BossVa_SetupZapperEnraged = 0x80948C3C; // type:func -BossVa_ZapperEnraged = 0x80948CC4; // type:func -BossVa_SetupZapperHold = 0x8094941C; // type:func -BossVa_ZapperHold = 0x8094949C; // type:func -BossVa_SetupBariIntro = 0x809495A8; // type:func -BossVa_BariIntro = 0x809496B8; // type:func -BossVa_SetupBariPhase3Attack = 0x80949C10; // type:func -BossVa_BariPhase3Attack = 0x80949CB8; // type:func -BossVa_SetupBariPhase2Attack = 0x8094A0B8; // type:func -BossVa_BariPhase2Attack = 0x8094A160; // type:func -BossVa_SetupBariPhase3Stunned = 0x8094A778; // type:func -BossVa_BariPhase3Stunned = 0x8094A7D4; // type:func -BossVa_SetupBariDeath = 0x8094A9F0; // type:func -BossVa_BariDeath = 0x8094AA48; // type:func -BossVa_SetupDoor = 0x8094AA7C; // type:func -BossVa_Door = 0x8094AACC; // type:func -BossVa_Update = 0x8094AB40; // type:func -BossVa_BodyOverrideLimbDraw = 0x8094AD4C; // type:func -BossVa_BodyPostLimbDraw = 0x8094AEF0; // type:func -BossVa_SupportOverrideLimbDraw = 0x8094B3F4; // type:func -BossVa_SupportPostLimbDraw = 0x8094B438; // type:func -BossVa_ZapperOverrideLimbDraw = 0x8094B688; // type:func -BossVa_ZapperPostLimbDraw = 0x8094B864; // type:func -BossVa_BariOverrideLimbDraw = 0x8094BCC4; // type:func -BossVa_BariPostLimbDraw = 0x8094BD54; // type:func -BossVa_Draw = 0x8094BEE0; // type:func -BossVa_UpdateEffects = 0x8094C4D8; // type:func -BossVa_DrawEffects = 0x8094CE78; // type:func -BossVa_SpawnSpark = 0x8094DC80; // type:func -BossVa_SpawnSparkBall = 0x8094DF70; // type:func -BossVa_SpawnBloodDroplets = 0x8094E0FC; // type:func -BossVa_SpawnBloodSplatter = 0x8094E2C8; // type:func -BossVa_SpawnTumor = 0x8094E464; // type:func -BossVa_SpawnGore = 0x8094E608; // type:func -BossVa_SpawnZapperCharge = 0x8094E828; // type:func -BossVa_DrawDoor = 0x8094E97C; // type:func -Demo6K_SetupAction = 0x809592E0; // type:func -Demo6K_Init = 0x809592EC; // type:func -Demo6K_Destroy = 0x809596D4; // type:func -Demo6K_WaitForObject = 0x80959708; // type:func -func_80966E04 = 0x80959760; // type:func -func_80966E98 = 0x809597F8; // type:func -func_80966F84 = 0x809598EC; // type:func -func_809670AC = 0x80959A14; // type:func -func_8096712C = 0x80959A94; // type:func -func_80967244 = 0x80959BAC; // type:func -func_80967410 = 0x80959D78; // type:func -func_809674E0 = 0x80959E48; // type:func -func_809676A4 = 0x8095A00C; // type:func -func_8096784C = 0x8095A1B4; // type:func -func_80967A04 = 0x8095A370; // type:func -func_80967AD0 = 0x8095A43C; // type:func -func_80967BF8 = 0x8095A568; // type:func -func_80967DBC = 0x8095A72C; // type:func -func_80967F10 = 0x8095A878; // type:func -Demo6K_Update = 0x8095A944; // type:func -func_80967FFC = 0x8095A968; // type:func -func_80968298 = 0x8095ABC4; // type:func -func_8096865C = 0x8095AF48; // type:func -func_809688C4 = 0x8095B168; // type:func -func_80968B70 = 0x8095B3E4; // type:func -func_80968FB0 = 0x8095B7E4; // type:func -func_809691BC = 0x8095B9A8; // type:func -DemoDu_Destroy = 0x8095C040; // type:func -DemoDu_UpdateEyes = 0x8095C064; // type:func -DemoDu_SetEyeTexIndex = 0x8095C0EC; // type:func -DemoDu_SetMouthTexIndex = 0x8095C104; // type:func -DemoDu_UpdateSkelAnime = 0x8095C11C; // type:func -DemoDu_UpdateBgCheckInfo = 0x8095C140; // type:func -DemoDu_GetCue = 0x8095C188; // type:func -DemoDu_CheckForCue = 0x8095C1B0; // type:func -DemoDu_CheckForNoCue = 0x8095C1FC; // type:func -DemoDu_SetStartPosRotFromCue = 0x8095C248; // type:func -func_80969DDC = 0x8095C2C8; // type:func -DemoDu_InitCs_FireMedallion = 0x8095C358; // type:func -DemoDu_CsFireMedallion_SpawnDoorWarp = 0x8095C3C8; // type:func -func_80969F38 = 0x8095C424; // type:func -func_80969FB4 = 0x8095C4A0; // type:func -DemoDu_CsFireMedallion_AdvanceTo01 = 0x8095C4C0; // type:func -DemoDu_CsFireMedallion_AdvanceTo02 = 0x8095C558; // type:func -DemoDu_CsFireMedallion_AdvanceTo03 = 0x8095C5A8; // type:func -DemoDu_CsFireMedallion_AdvanceTo04 = 0x8095C5D4; // type:func -DemoDu_CsFireMedallion_AdvanceTo05 = 0x8095C668; // type:func -DemoDu_CsFireMedallion_AdvanceTo06 = 0x8095C6D4; // type:func -DemoDu_UpdateCs_FM_00 = 0x8095C720; // type:func -DemoDu_UpdateCs_FM_01 = 0x8095C740; // type:func -DemoDu_UpdateCs_FM_02 = 0x8095C760; // type:func -DemoDu_UpdateCs_FM_03 = 0x8095C794; // type:func -DemoDu_UpdateCs_FM_04 = 0x8095C7D4; // type:func -DemoDu_UpdateCs_FM_05 = 0x8095C80C; // type:func -DemoDu_UpdateCs_FM_06 = 0x8095C84C; // type:func -DemoDu_InitCs_GoronsRuby = 0x8095C878; // type:func -DemoDu_CsPlaySfx_GoronLanding = 0x8095C8C8; // type:func -DemoDu_CsPlaySfx_DaruniaFalling = 0x8095C8F0; // type:func -DemoDu_CsPlaySfx_DaruniaHitsLink = 0x8095C920; // type:func -DemoDu_CsPlaySfx_HitBreast = 0x8095C978; // type:func -DemoDu_CsPlaySfx_LinkEscapeFromGorons = 0x8095C9A0; // type:func -DemoDu_CsPlaySfx_LinkSurprised = 0x8095C9F8; // type:func -DemoDu_CsGoronsRuby_UpdateFaceTextures = 0x8095CA50; // type:func -func_8096A630 = 0x8095CB58; // type:func -DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink = 0x8095CC0C; // type:func -DemoDu_CsGoronsRuby_DaruniaFalling = 0x8095CEA0; // type:func -DemoDu_CsGoronsRuby_AdvanceTo01 = 0x8095CF7C; // type:func -DemoDu_CsGoronsRuby_AdvanceTo02 = 0x8095CF90; // type:func -DemoDu_CsGoronsRuby_AdvanceTo03 = 0x8095D034; // type:func -DemoDu_CsGoronsRuby_AdvanceTo04 = 0x8095D088; // type:func -DemoDu_CsGoronsRuby_AdvanceTo05 = 0x8095D0C0; // type:func -DemoDu_CsGoronsRuby_AdvanceTo06 = 0x8095D12C; // type:func -DemoDu_CsGoronsRuby_AdvanceTo07 = 0x8095D1C4; // type:func -DemoDu_CsGoronsRuby_AdvanceTo08 = 0x8095D230; // type:func -DemoDu_CsGoronsRuby_AdvanceTo09 = 0x8095D2C4; // type:func -DemoDu_CsGoronsRuby_AdvanceTo10 = 0x8095D334; // type:func -DemoDu_CsGoronsRuby_AdvanceTo11 = 0x8095D3A0; // type:func -DemoDu_CsGoronsRuby_AdvanceTo12 = 0x8095D434; // type:func -DemoDu_CsGoronsRuby_AdvanceTo13 = 0x8095D4A0; // type:func -DemoDu_UpdateCs_GR_00 = 0x8095D530; // type:func -DemoDu_UpdateCs_GR_01 = 0x8095D564; // type:func -DemoDu_UpdateCs_GR_02 = 0x8095D5A0; // type:func -DemoDu_UpdateCs_GR_03 = 0x8095D5FC; // type:func -DemoDu_UpdateCs_GR_04 = 0x8095D63C; // type:func -DemoDu_UpdateCs_GR_05 = 0x8095D68C; // type:func -DemoDu_UpdateCs_GR_06 = 0x8095D6D8; // type:func -DemoDu_UpdateCs_GR_07 = 0x8095D738; // type:func -DemoDu_UpdateCs_GR_08 = 0x8095D784; // type:func -DemoDu_UpdateCs_GR_09 = 0x8095D7E8; // type:func -DemoDu_UpdateCs_GR_10 = 0x8095D848; // type:func -DemoDu_UpdateCs_GR_11 = 0x8095D894; // type:func -DemoDu_UpdateCs_GR_12 = 0x8095D8E4; // type:func -DemoDu_UpdateCs_GR_13 = 0x8095D930; // type:func -DemoDu_InitCs_AfterGanon = 0x8095D978; // type:func -DemoDu_CsPlaySfx_WhiteOut = 0x8095DA18; // type:func -DemoDu_CsAfterGanon_SpawnDemo6K = 0x8095DA38; // type:func -DemoDu_CsAfterGanon_AdvanceTo01 = 0x8095DAB8; // type:func -DemoDu_CsAfterGanon_AdvanceTo02 = 0x8095DB0C; // type:func -DemoDu_CsAfterGanon_BackTo01 = 0x8095DC60; // type:func -DemoDu_UpdateCs_AG_00 = 0x8095DCFC; // type:func -DemoDu_UpdateCs_AG_01 = 0x8095DD1C; // type:func -DemoDu_UpdateCs_AG_02 = 0x8095DD64; // type:func -DemoDu_Draw_02 = 0x8095DDAC; // type:func -DemoDu_InitCs_Credits = 0x8095DF68; // type:func -DemoDu_CsCredits_UpdateShadowAlpha = 0x8095DFD4; // type:func -DemoDu_CsCredits_AdvanceTo01 = 0x8095E060; // type:func -DemoDu_CsCredits_AdvanceTo02 = 0x8095E098; // type:func -DemoDu_CsCredits_AdvanceTo03 = 0x8095E0E4; // type:func -DemoDu_CsCredits_AdvanceTo04 = 0x8095E124; // type:func -DemoDu_CsCredits_BackTo02 = 0x8095E164; // type:func -DemoDu_CsCredits_HandleCues = 0x8095E1AC; // type:func -DemoDu_UpdateCs_CR_00 = 0x8095E258; // type:func -DemoDu_UpdateCs_CR_01 = 0x8095E278; // type:func -DemoDu_UpdateCs_CR_02 = 0x8095E2C4; // type:func -DemoDu_UpdateCs_CR_03 = 0x8095E30C; // type:func -DemoDu_UpdateCs_CR_04 = 0x8095E354; // type:func -DemoDu_Update = 0x8095E398; // type:func -DemoDu_Init = 0x8095E3E0; // type:func -DemoDu_Draw_NoDraw = 0x8095E484; // type:func -DemoDu_Draw_01 = 0x8095E494; // type:func -DemoDu_Draw = 0x8095E63C; // type:func -DemoEc_Destroy = 0x8095F820; // type:func -DemoEc_Init = 0x8095F844; // type:func -DemoEc_UpdateSkelAnime = 0x8095F88C; // type:func -DemoEc_UpdateBgFlags = 0x8095F8B0; // type:func -func_8096D594 = 0x8095F8F8; // type:func -func_8096D5D4 = 0x8095F938; // type:func -func_8096D64C = 0x8095F9B0; // type:func -DemoEc_UpdateEyes = 0x8095F9F0; // type:func -DemoEc_SetEyeTexIndex = 0x8095FA78; // type:func -DemoEc_InitSkelAnime = 0x8095FA90; // type:func -DemoEc_ChangeAnimation = 0x8095FB08; // type:func -DemoEc_AllocColorDList = 0x8095FBC4; // type:func -DemoEc_DrawSkeleton = 0x8095FC1C; // type:func -DemoEc_DrawSkeletonCustomColor = 0x8095FDAC; // type:func -DemoEc_UseDrawObject = 0x8096000C; // type:func -DemoEc_UseAnimationObject = 0x80960068; // type:func -DemoEc_GetCue = 0x809600A0; // type:func -DemoEc_SetStartPosRotFromCue = 0x809600C8; // type:func -DemoEc_InitIngo = 0x80960148; // type:func -DemoEc_UpdateIngo = 0x809601E8; // type:func -DemoEc_DrawIngo = 0x80960228; // type:func -DemoEc_InitTalon = 0x8096025C; // type:func -DemoEc_UpdateTalon = 0x809602FC; // type:func -DemoEc_DrawTalon = 0x8096033C; // type:func -DemoEc_InitWindmillMan = 0x80960370; // type:func -DemoEc_UpdateWindmillMan = 0x80960410; // type:func -DemoEc_DrawWindmillMan = 0x80960450; // type:func -DemoEc_InitKokiriBoy = 0x80960484; // type:func -DemoEc_InitDancingKokiriBoy = 0x80960524; // type:func -DemoEc_UpdateKokiriBoy = 0x809605C8; // type:func -DemoEc_UpdateDancingKokiriBoy = 0x80960608; // type:func -DemoEc_DrawKokiriBoy = 0x80960628; // type:func -DemoEc_InitKokiriGirl = 0x8096066C; // type:func -DemoEc_InitDancingKokiriGirl = 0x8096070C; // type:func -DemoEc_UpdateKokiriGirl = 0x809607B0; // type:func -DemoEc_UpdateDancingKokiriGirl = 0x809607F8; // type:func -DemoEc_DrawKokiriGirl = 0x80960818; // type:func -DemoEc_InitOldMan = 0x8096086C; // type:func -DemoEc_UpdateOldMan = 0x8096090C; // type:func -DemoEc_DrawOldMan = 0x80960954; // type:func -DemoEc_InitBeardedMan = 0x809609A8; // type:func -DemoEc_UpdateBeardedMan = 0x80960A48; // type:func -DemoEc_DrawBeardedMan = 0x80960A90; // type:func -DemoEc_InitWoman = 0x80960AE4; // type:func -DemoEc_UpdateWoman = 0x80960B84; // type:func -DemoEc_DrawWoman = 0x80960BCC; // type:func -DemoEc_InitOldWoman = 0x80960C08; // type:func -DemoEc_UpdateOldWoman = 0x80960CA8; // type:func -DemoEc_DrawOldWoman = 0x80960CE8; // type:func -DemoEc_InitBossCarpenter = 0x80960D18; // type:func -DemoEc_UpdateBossCarpenter = 0x80960DB8; // type:func -DemoEc_DrawBossCarpenter = 0x80960DF8; // type:func -DemoEc_InitCarpenter = 0x80960E24; // type:func -DemoEc_UpdateCarpenter = 0x80960EC4; // type:func -DemoEc_CarpenterOverrideLimbDraw = 0x80960F04; // type:func -DemoEc_GetCarpenterPostLimbDList = 0x80961008; // type:func -DemoEc_CarpenterPostLimbDraw = 0x80961070; // type:func -DemoEc_DrawCarpenter = 0x809610F4; // type:func -DemoEc_InitGerudo = 0x80961130; // type:func -DemoEc_UpdateGerudo = 0x809611D4; // type:func -DemoEc_GetGerudoPostLimbDList = 0x8096121C; // type:func -DemoEc_GerudoPostLimbDraw = 0x80961270; // type:func -DemoEc_DrawGerudo = 0x809612F4; // type:func -DemoEc_InitDancingZora = 0x80961338; // type:func -DemoEc_UpdateDancingZora = 0x809613DC; // type:func -DemoEc_DrawDancingZora = 0x80961424; // type:func -DemoEc_InitKingZora = 0x80961460; // type:func -func_8096F1D4 = 0x80961510; // type:func -func_8096F224 = 0x80961560; // type:func -func_8096F26C = 0x809615A8; // type:func -func_8096F2B0 = 0x809615F0; // type:func -DemoEc_UpdateKingZora = 0x80961654; // type:func -func_8096F378 = 0x809616BC; // type:func -func_8096F3D4 = 0x8096171C; // type:func -DemoEc_DrawKingZora = 0x80961764; // type:func -DemoEc_InitMido = 0x809617A0; // type:func -func_8096F4FC = 0x80961850; // type:func -func_8096F544 = 0x80961898; // type:func -func_8096F578 = 0x809618CC; // type:func -DemoEc_UpdateMido = 0x80961930; // type:func -func_8096F640 = 0x80961998; // type:func -DemoEc_DrawMido = 0x809619F8; // type:func -DemoEc_InitCucco = 0x80961A34; // type:func -DemoEc_UpdateCucco = 0x80961B04; // type:func -DemoEc_DrawCucco = 0x80961B44; // type:func -DemoEc_InitCuccoLady = 0x80961B70; // type:func -DemoEc_UpdateCuccoLady = 0x80961C14; // type:func -DemoEc_DrawCuccoLady = 0x80961C5C; // type:func -DemoEc_InitPotionShopOwner = 0x80961C98; // type:func -DemoEc_UpdatePotionShopOwner = 0x80961D3C; // type:func -DemoEc_DrawPotionShopOwner = 0x80961D84; // type:func -DemoEc_InitMaskShopOwner = 0x80961DC0; // type:func -DemoEc_UpdateMaskShopOwner = 0x80961E64; // type:func -DemoEc_DrawMaskShopOwner = 0x80961EA4; // type:func -DemoEc_InitFishingOwner = 0x80961ED4; // type:func -DemoEc_UpdateFishingOwner = 0x80961F78; // type:func -DemoEc_FishingOwnerPostLimbDraw = 0x80961FC0; // type:func -DemoEc_DrawFishingOwner = 0x80962040; // type:func -DemoEc_InitBombchuShopOwner = 0x80962084; // type:func -DempEc_UpdateBombchuShopOwner = 0x80962128; // type:func -DemoEc_DrawBombchuShopOwner = 0x80962170; // type:func -DemoEc_InitGorons = 0x809621AC; // type:func -DemoEc_UpdateGorons = 0x809622E4; // type:func -DemoEc_DrawGorons = 0x8096232C; // type:func -DemoEc_InitMalon = 0x8096236C; // type:func -DemoEc_UpdateMalon = 0x80962410; // type:func -DemoEc_DrawMalon = 0x80962458; // type:func -DemoEc_InitNpc = 0x80962498; // type:func -DemoEc_InitCommon = 0x809624E4; // type:func -DemoEc_Update = 0x809625B8; // type:func -DemoEc_DrawCommon = 0x80962630; // type:func -DemoEc_Draw = 0x80962640; // type:func -DemoEffect_SetupUpdate = 0x80963080; // type:func -DemoEffect_InterpolateCsFrames = 0x8096308C; // type:func -DemoEffect_InitJewel = 0x809630EC; // type:func -DemoEffect_InitGetItem = 0x809631AC; // type:func -DemoEffect_Init = 0x809631F8; // type:func -DemoEffect_Destroy = 0x809639F8; // type:func -DemoEffect_WaitForObject = 0x80963A48; // type:func -DemoEffect_UpdatePositionToParent = 0x80963AA0; // type:func -DemoEffect_UpdateCrystalLight = 0x80963AD0; // type:func -DemoEffect_MedalSparkle = 0x80963B04; // type:func -DemoEffect_UpdateGetItem = 0x80963C9C; // type:func -DemoEffect_InitTimeWarp = 0x80963EDC; // type:func -DemoEffect_UpdateTimeWarpPullMasterSword = 0x80964098; // type:func -DemoEffect_TimewarpShrink = 0x8096413C; // type:func -DemoEffect_UpdateTimeWarpReturnFromChamberOfSages = 0x80964260; // type:func -DemoEffect_UpdateTimeWarpTimeblock = 0x80964318; // type:func -DemoEffect_InitTimeWarpTimeblock = 0x809643D4; // type:func -DemoEffect_UpdateTriforceSpot = 0x80964458; // type:func -DemoEffect_UpdateLightRingShrinking = 0x80964740; // type:func -DemoEffect_UpdateLightRingExpanding = 0x809647D0; // type:func -DemoEffect_UpdateLightRingTriforce = 0x80964844; // type:func -DemoEffect_UpdateCreationFireball = 0x80964900; // type:func -DemoEffect_InitCreationFireball = 0x80964A54; // type:func -DemoEffect_UpdateBlueOrbShrink = 0x80964AA4; // type:func -DemoEffect_UpdateBlueOrbGrow = 0x80964B0C; // type:func -DemoEffect_UpdateLightEffect = 0x80964BEC; // type:func -DemoEffect_UpdateLgtShower = 0x80964EE4; // type:func -DemoEffect_UpdateGodLgtDin = 0x80964F50; // type:func -DemoEffect_UpdateGodLgtNayru = 0x809650EC; // type:func -DemoEffect_UpdateGodLgtFarore = 0x809652E4; // type:func -DemoEffect_MoveTowardTarget = 0x80965488; // type:func -DemoEffect_InitJewelColor = 0x809654E8; // type:func -DemoEffect_SetJewelColor = 0x809655E8; // type:func -DemoEffect_MoveJewelSplit = 0x80965D5C; // type:func -DemoEffect_MoveJewelSpherical = 0x80965DB8; // type:func -DemoEffect_MoveJewelActivateDoorOfTime = 0x80965F9C; // type:func -DemoEffect_JewelSparkle = 0x80966208; // type:func -DemoEffect_PlayJewelSfx = 0x8096636C; // type:func -DemoEffect_UpdateJewelAdult = 0x809663D0; // type:func -DemoEffect_UpdateJewelChild = 0x80966414; // type:func -DemoEffect_UpdateDust = 0x80966628; // type:func -DemoEffect_Update = 0x8096674C; // type:func -DemoEffect_CheckForCue = 0x80966770; // type:func -DemoEffect_DrawJewel = 0x809667B4; // type:func -DemoEffect_DrawCrystalLight = 0x80966BF4; // type:func -DemoEffect_DrawFireBall = 0x80966ECC; // type:func -DemoEffect_DrawGodLgt = 0x80967058; // type:func -DemoEffect_DrawLightEffect = 0x80967428; // type:func -DemoEffect_DrawBlueOrb = 0x80967660; // type:func -DemoEffect_DrawLgtShower = 0x80967788; // type:func -DemoEffect_DrawLightRing = 0x8096790C; // type:func -DemoEffect_DrawTriforceSpot = 0x80967A74; // type:func -DemoEffect_DrawGetItem = 0x80967FF8; // type:func -DemoEffect_OverrideLimbDrawTimeWarp = 0x80968090; // type:func -DemoEffect_DrawTimeWarp = 0x80968210; // type:func -DemoEffect_FaceTowardPoint = 0x809682E8; // type:func -DemoEffect_SetPosRotFromCue = 0x80968398; // type:func -DemoEffect_MoveTowardCuePos = 0x809684F8; // type:func -DemoEffect_SetStartPosFromCue = 0x809685A4; // type:func -DemoExt_Destroy = 0x80968C20; // type:func -DemoExt_Init = 0x80968C30; // type:func -DemoExt_PlayVortexSFX = 0x80968CE8; // type:func -DemoExt_GetCue = 0x80968D70; // type:func -DemoExt_SetupWait = 0x80968D98; // type:func -DemoExt_SetupMaintainVortex = 0x80968DA8; // type:func -DemoExt_SetupDispellVortex = 0x80968E34; // type:func -DemoExt_FinishClosing = 0x80968E4C; // type:func -DemoExt_HandleCues = 0x80968EB8; // type:func -DemoExt_SetScrollAndRotation = 0x80968F64; // type:func -DemoExt_SetColorsAndScales = 0x80968FB4; // type:func -DemoExt_Wait = 0x809690F0; // type:func -DemoExt_MaintainVortex = 0x80969110; // type:func -DemoExt_DispellVortex = 0x8096914C; // type:func -DemoExt_Update = 0x8096918C; // type:func -DemoExt_DrawNothing = 0x809691D4; // type:func -DemoExt_DrawVortex = 0x809691E4; // type:func -DemoExt_Draw = 0x80969464; // type:func -DemoGeff_Destroy = 0x80969570; // type:func -DemoGeff_Init = 0x80969580; // type:func -func_80977EA8 = 0x809695C8; // type:func -func_80977F80 = 0x80969664; // type:func -func_80978030 = 0x809696C0; // type:func -func_809781FC = 0x8096988C; // type:func -func_809782A0 = 0x80969930; // type:func -func_80978308 = 0x80969998; // type:func -func_80978344 = 0x809699D0; // type:func -func_80978370 = 0x80969A00; // type:func -func_809783D4 = 0x80969A4C; // type:func -DemoGeff_Update = 0x80969AE8; // type:func -func_809784D4 = 0x80969B30; // type:func -DemoGeff_Draw = 0x80969B40; // type:func -DemoGj_GetCollectibleType = 0x80969D90; // type:func -DemoGj_GetCollectibleAmount = 0x80969DA4; // type:func -DemoGj_GetType = 0x80969DB8; // type:func -DemoGj_InitCylinder = 0x80969DC8; // type:func -DemoGj_HitByExplosion = 0x80969E10; // type:func -DemoGj_DestroyCylinder = 0x80969E48; // type:func -DemoGj_Destroy = 0x80969F00; // type:func -DemoGj_PlayExplosionSfx = 0x80969F44; // type:func -DemoGj_SpawnSmoke = 0x80969F7C; // type:func -DemoGj_DropCollectible = 0x8096A010; // type:func -DemoGj_Explode = 0x8096A0A4; // type:func -DemoGj_IsCutsceneLayer = 0x8096A340; // type:func -DemoGj_FindGanon = 0x8096A368; // type:func -DemoGj_InitCommon = 0x8096A3B4; // type:func -DemoGj_InitSetIndices = 0x8096A42C; // type:func -DemoGj_DrawCommon = 0x8096A490; // type:func -DemoGj_DrawRotated = 0x8096A52C; // type:func -DemoGj_SetupRotation = 0x8096A608; // type:func -func_809797E4 = 0x8096ABA0; // type:func -DemoGj_IsGanondorfRisingFromRubble = 0x8096ABD4; // type:func -DemoGj_IsGanondorfFloatingInAir = 0x8096ABF8; // type:func -DemoGj_SetupMovement = 0x8096AC1C; // type:func -DemoGj_CheckIfTransformedIntoGanon = 0x8096B340; // type:func -DemoGj_InitRubblePile1 = 0x8096B378; // type:func -func_8097A000 = 0x8096B3A8; // type:func -DemoGj_SpawnSmokePreBattle1 = 0x8096B424; // type:func -func_8097A0E4 = 0x8096B490; // type:func -func_8097A130 = 0x8096B4E4; // type:func -DemoGj_Update01 = 0x8096B518; // type:func -DemoGj_Update08 = 0x8096B550; // type:func -DemoGj_DrawRubble2 = 0x8096B588; // type:func -DemoGj_DrawRotatedRubble2 = 0x8096B5AC; // type:func -DemoGj_InitRubblePile2 = 0x8096B5D0; // type:func -func_8097A238 = 0x8096B600; // type:func -DemoGj_SpawnSmokePreBattle2 = 0x8096B67C; // type:func -func_8097A320 = 0x8096B6EC; // type:func -func_8097A36C = 0x8096B740; // type:func -DemoGj_Update02 = 0x8096B774; // type:func -DemoGj_Update09 = 0x8096B7AC; // type:func -DemoGj_DrawRubble3 = 0x8096B7E4; // type:func -DemoGj_DrawRotatedRubble3 = 0x8096B808; // type:func -DemoGj_InitRubblePile3 = 0x8096B82C; // type:func -func_8097A474 = 0x8096B85C; // type:func -func_8097A4F0 = 0x8096B8D8; // type:func -func_8097A53C = 0x8096B92C; // type:func -DemoGj_Update03 = 0x8096B960; // type:func -DemoGj_Update10 = 0x8096B998; // type:func -DemoGj_DrawRubble4 = 0x8096B9D0; // type:func -DemoGj_DrawRotatedRubble4 = 0x8096B9F4; // type:func -DemoGj_InitRubblePile4 = 0x8096BA18; // type:func -func_8097A644 = 0x8096BA48; // type:func -func_8097A6C0 = 0x8096BAC4; // type:func -func_8097A70C = 0x8096BB18; // type:func -DemoGj_Update04 = 0x8096BB4C; // type:func -DemoGj_Update11 = 0x8096BB84; // type:func -DemoGj_DrawRubble5 = 0x8096BBBC; // type:func -DemoGj_DrawRotatedRubble5 = 0x8096BBE0; // type:func -DemoGj_InitRubblePile5 = 0x8096BC04; // type:func -func_8097A814 = 0x8096BC34; // type:func -func_8097A890 = 0x8096BCB0; // type:func -func_8097A8DC = 0x8096BD04; // type:func -DemoGj_Update05 = 0x8096BD38; // type:func -DemoGj_Update12 = 0x8096BD70; // type:func -DemoGj_DrawRubble6 = 0x8096BDA8; // type:func -DemoGj_DrawRotatedRubble6 = 0x8096BDCC; // type:func -DemoGj_InitRubblePile6 = 0x8096BDF0; // type:func -func_8097A9E4 = 0x8096BE20; // type:func -func_8097AA60 = 0x8096BE9C; // type:func -func_8097AAAC = 0x8096BEF0; // type:func -DemoGj_Update06 = 0x8096BF24; // type:func -DemoGj_Update13 = 0x8096BF5C; // type:func -DemoGj_DrawRubble7 = 0x8096BF94; // type:func -DemoGj_DrawRotatedRubble7 = 0x8096BFB8; // type:func -DemoGj_InitRubblePile7 = 0x8096BFDC; // type:func -func_8097ABB4 = 0x8096C00C; // type:func -DemoGj_SpawnSmokePreBattle3 = 0x8096C088; // type:func -func_8097AC9C = 0x8096C0F8; // type:func -func_8097ACE8 = 0x8096C14C; // type:func -DemoGj_Update07 = 0x8096C180; // type:func -DemoGj_Update14 = 0x8096C1B8; // type:func -DemoGj_DrawRubbleTall = 0x8096C1F0; // type:func -DemoGj_DrawRotatedRubbleTall = 0x8096C214; // type:func -DemoGj_InitRubbleAroundArena = 0x8096C238; // type:func -DemoGj_UpdateRubbleAroundArena = 0x8096C268; // type:func -DemoGj_DrawRubbleAroundArena = 0x8096C2B8; // type:func -DemoGj_InitDestructableRubble1 = 0x8096C2DC; // type:func -func_8097AEE8 = 0x8096C364; // type:func -DemoGj_SetCylindersAsAC = 0x8096C4F8; // type:func -DemoGj_DirectedExplosion = 0x8096C564; // type:func -func_8097B128 = 0x8096C5A0; // type:func -DemoGj_HasCylinderAnyExploded = 0x8096C630; // type:func -func_8097B22C = 0x8096C6AC; // type:func -DemoGj_Update15 = 0x8096C7C4; // type:func -DemoGj_Update18 = 0x8096C7FC; // type:func -DemoGj_DrawDestructableRubble1 = 0x8096C81C; // type:func -DemoGj_InitDestructableRubble2 = 0x8096C840; // type:func -func_8097B450 = 0x8096C8C8; // type:func -DemoGj_SetCylindersAsAC2 = 0x8096CA18; // type:func -DemoGj_HasCylinderAnyExploded2 = 0x8096CA84; // type:func -DemoGj_DirectedExplosion2 = 0x8096CB00; // type:func -func_8097B6C4 = 0x8096CB3C; // type:func -func_8097B750 = 0x8096CBCC; // type:func -DemoGj_Update16 = 0x8096CCE4; // type:func -DemoGj_Update19 = 0x8096CD1C; // type:func -DemoGj_DemoGj_InitDestructableRubble2 = 0x8096CD3C; // type:func -DemoGj_InitDestructableRubbleTall = 0x8096CD60; // type:func -DemoGj_DirectedDoubleExplosion = 0x8096CDAC; // type:func -func_8097B9BC = 0x8096CE30; // type:func -func_8097BA48 = 0x8096CEC0; // type:func -DemoGj_Update17 = 0x8096CFF4; // type:func -DemoGj_Update20 = 0x8096D02C; // type:func -DemoGj_DemoGj_InitDestructableRubbleTall = 0x8096D04C; // type:func -DemoGj_Update = 0x8096D070; // type:func -DemoGj_Init = 0x8096D0B8; // type:func -DemoGj_DrawNothing = 0x8096D1C0; // type:func -DemoGj_Draw = 0x8096D1D0; // type:func -DemoGo_GetCueChannel = 0x8096DA40; // type:func -func_8097C8A8 = 0x8096DA7C; // type:func -DemoGo_Destroy = 0x8096DAE8; // type:func -func_8097C930 = 0x8096DB0C; // type:func -func_8097C9B8 = 0x8096DB94; // type:func -func_8097C9DC = 0x8096DBBC; // type:func -func_8097CA30 = 0x8096DC14; // type:func -func_8097CA78 = 0x8096DC5C; // type:func -func_8097CB0C = 0x8096DCF4; // type:func -func_8097CC08 = 0x8096DDF4; // type:func -func_8097CCC0 = 0x8096DEAC; // type:func -func_8097CCE0 = 0x8096DECC; // type:func -DemoGo_UpdateSkelAnime = 0x8096DF84; // type:func -func_8097CDB0 = 0x8096DFA8; // type:func -func_8097CE10 = 0x8096E014; // type:func -func_8097CE20 = 0x8096E028; // type:func -func_8097CE78 = 0x8096E084; // type:func -func_8097CEEC = 0x8096E0FC; // type:func -func_8097CF20 = 0x8096E134; // type:func -func_8097CF9C = 0x8096E1B0; // type:func -func_8097CFDC = 0x8096E1F0; // type:func -func_8097CFFC = 0x8096E210; // type:func -func_8097D01C = 0x8096E230; // type:func -func_8097D058 = 0x8096E274; // type:func -func_8097D088 = 0x8096E2AC; // type:func -func_8097D0D0 = 0x8096E2FC; // type:func -func_8097D130 = 0x8096E364; // type:func -DemoGo_Update = 0x8096E3C4; // type:func -DemoGo_Init = 0x8096E40C; // type:func -func_8097D290 = 0x8096E4B8; // type:func -func_8097D29C = 0x8096E4C8; // type:func -DemoGo_Draw = 0x8096E5D8; // type:func -DemoGt_Destroy = 0x8096E790; // type:func -DemoGt_PlayEarthquakeSfx = 0x8096E7D8; // type:func -DemoGt_PlayExplosion1Sfx = 0x8096E7F8; // type:func -DemoGt_PlayExplosion2Sfx = 0x8096E81C; // type:func -DemoGt_Rumble = 0x8096E840; // type:func -DemoGt_SpawnDust = 0x8096E870; // type:func -func_8097D7D8 = 0x8096E900; // type:func -DemoGt_SpawnCloudRing = 0x8096EA88; // type:func -DemoGt_SpawnExplosionWithSound = 0x8096EAE8; // type:func -DemoGt_SpawnExplosionNoSound = 0x8096EB9C; // type:func -func_8097DAC8 = 0x8096EBF0; // type:func -func_8097DD28 = 0x8096EE50; // type:func -func_8097DF70 = 0x8096F098; // type:func -func_8097E1D4 = 0x8096F2FC; // type:func -func_8097E454 = 0x8096F57C; // type:func -DemoGt_IsCutsceneIdle = 0x8096F7CC; // type:func -DemoGt_GetCue = 0x8096F7EC; // type:func -func_8097E704 = 0x8096F838; // type:func -func_8097E744 = 0x8096F878; // type:func -func_8097E824 = 0x8096F958; // type:func -func_8097ED64 = 0x8096FE94; // type:func -DemoGt_IsCutsceneLayer = 0x8096FECC; // type:func -func_8097EDD8 = 0x8096FEF4; // type:func -func_8097EE44 = 0x8096FF6C; // type:func -func_8097EEA8_Init0 = 0x8096FFD0; // type:func -func_8097EF00 = 0x80970028; // type:func -func_8097EF34 = 0x8097005C; // type:func -func_8097EF40 = 0x8097006C; // type:func -func_8097F0AC = 0x809701C4; // type:func -func_8097F19C = 0x809702A8; // type:func -func_8097F1D8 = 0x809702EC; // type:func -func_8097F280 = 0x80970394; // type:func -func_8097F3EC = 0x80970508; // type:func -DemoGt_Update0 = 0x80970548; // type:func -DemoGt_Update8 = 0x809705C0; // type:func -DemoGt_Draw1 = 0x80970638; // type:func -func_8097F904_Init1 = 0x809709FC; // type:func -func_8097F960 = 0x80970A58; // type:func -func_8097F96C = 0x80970A68; // type:func -func_8097FA1C = 0x80970AFC; // type:func -func_8097FAFC = 0x80970BC4; // type:func -func_8097FC1C = 0x80970CCC; // type:func -func_8097FCE4 = 0x80970D80; // type:func -func_8097FD70 = 0x80970DFC; // type:func -func_8097FDDC = 0x80970E70; // type:func -func_8097FED8 = 0x80970F70; // type:func -DemoGt_Update1 = 0x80970FB0; // type:func -DemoGt_Update9 = 0x80971000; // type:func -DemoGt_Draw2 = 0x80971048; // type:func -func_80980110_Init2 = 0x8097117C; // type:func -func_8098016C = 0x809711D8; // type:func -func_80980178 = 0x809711E8; // type:func -func_80980184 = 0x809711F8; // type:func -func_80980218 = 0x8097128C; // type:func -func_809802AC = 0x80971320; // type:func -func_8098036C = 0x809713E4; // type:func -func_80980430 = 0x809714AC; // type:func -func_80980504 = 0x8097156C; // type:func -func_809805D8 = 0x8097162C; // type:func -func_809806B8 = 0x809716F4; // type:func -func_8098078C = 0x809717B4; // type:func -func_8098085C = 0x80971870; // type:func -func_809809C0 = 0x809719BC; // type:func -func_80980AD4 = 0x80971AC0; // type:func -func_80980B68 = 0x80971B40; // type:func -func_80980BFC = 0x80971BC0; // type:func -func_80980C90 = 0x80971C40; // type:func -func_80980D74 = 0x80971D2C; // type:func -DemoGt_Update2 = 0x80971D6C; // type:func -DemoGt_Update10 = 0x80971DB0; // type:func -DemoGt_Draw3 = 0x80971DEC; // type:func -func_80980F00_Init5 = 0x80971E88; // type:func -func_80980F58 = 0x80971EE0; // type:func -func_80980F8C = 0x80971F18; // type:func -func_8098103C = 0x80971FCC; // type:func -DemoGt_Update3 = 0x80972030; // type:func -DemoGt_Update11 = 0x80972074; // type:func -DemoGt_Update16 = 0x809720B0; // type:func -DemoGt_Draw4 = 0x80972148; // type:func -func_809813CC_Init6 = 0x80972330; // type:func -func_80981424 = 0x80972388; // type:func -func_80981458 = 0x809723C0; // type:func -func_80981524 = 0x80972478; // type:func -DemoGt_Update4 = 0x809724DC; // type:func -DemoGt_Update12 = 0x80972520; // type:func -DemoGt_Update17 = 0x8097255C; // type:func -DemoGt_Draw5 = 0x809725F4; // type:func -func_809818A4_Init7 = 0x809727D0; // type:func -func_809818FC = 0x80972828; // type:func -func_80981930 = 0x80972860; // type:func -DemoGt_Update5 = 0x809728C4; // type:func -DemoGt_Update13 = 0x80972908; // type:func -DemoGt_Update18 = 0x80972944; // type:func -DemoGt_Draw6 = 0x809729DC; // type:func -func_80981C94_Init23 = 0x80972B94; // type:func -func_80981CEC = 0x80972BEC; // type:func -func_80981D20 = 0x80972C24; // type:func -func_80981DC8 = 0x80972CCC; // type:func -DemoGt_Update6 = 0x80972D0C; // type:func -DemoGt_Update14 = 0x80972D50; // type:func -DemoGt_Draw7 = 0x80972D94; // type:func -func_80982054_Init24 = 0x80972F2C; // type:func -func_809820AC = 0x80972F84; // type:func -func_809820E0 = 0x80972FBC; // type:func -func_80982188 = 0x80973064; // type:func -DemoGt_Update7 = 0x809730A4; // type:func -DemoGt_Update15 = 0x809730E8; // type:func -DemoGt_Draw8 = 0x8097312C; // type:func -DemoGt_Update = 0x809732C8; // type:func -DemoGt_Init = 0x80973310; // type:func -DemoGt_Draw0 = 0x809733D4; // type:func -DemoGt_Draw = 0x809733E4; // type:func -DemoIk_Destroy = 0x80973DA0; // type:func -DemoIk_BgCheck = 0x80973DB0; // type:func -DemoIk_UpdateSkelAnime = 0x80973DF8; // type:func -DemoIk_GetCue = 0x80973E1C; // type:func -DemoIk_CheckForCue = 0x80973E44; // type:func -DemoIk_SetMove = 0x80973E84; // type:func -DemoIk_EndMove = 0x80973EC4; // type:func -DemoIk_GetCurFrame = 0x80973ED8; // type:func -DemoIk_SetColors = 0x80973EE4; // type:func -DemoIk_GetCueChannel = 0x80973F88; // type:func -DemoIk_Type1PlaySfx = 0x80973FB4; // type:func -DemoIk_SpawnDeadDb = 0x809740B4; // type:func -DemoIk_MoveToStartPos = 0x80974258; // type:func -DemoIk_Type1Init = 0x809742D8; // type:func -func_8098393C = 0x809743F4; // type:func -func_8098394C = 0x80974408; // type:func -func_809839AC = 0x8097446C; // type:func -func_809839D0 = 0x80974494; // type:func -DemoIk_Type1Action0 = 0x80974554; // type:func -DemoIk_Type1Action1 = 0x80974574; // type:func -DemoIk_Type1Action2 = 0x809745AC; // type:func -DemoIk_Type1PostLimbDraw = 0x80974614; // type:func -DemoIk_Type1Draw = 0x80974710; // type:func -DemoIk_Type2Init = 0x80974868; // type:func -DemoIk_Type2PlaySfxOnFrame = 0x80974970; // type:func -DemoIk_Type2PlaySfx = 0x809749D0; // type:func -func_80983FDC = 0x80974A20; // type:func -func_80983FEC = 0x80974A34; // type:func -func_8098402C = 0x80974A74; // type:func -func_80984048 = 0x80974A94; // type:func -DemoIk_Type2Action0 = 0x80974B5C; // type:func -DemoIk_Type2Action1 = 0x80974B7C; // type:func -DemoIk_Type2Action2 = 0x80974B9C; // type:func -DemoIk_Type2OverrideLimbDraw = 0x80974BD8; // type:func -DemoIk_Type2PostLimbDraw = 0x80974C34; // type:func -DemoIk_Type2Draw = 0x80974E04; // type:func -DemoIk_Update = 0x80974F68; // type:func -DemoIk_DrawNothing = 0x80974FB0; // type:func -DemoIk_Draw = 0x80974FC0; // type:func -DemoIk_Init = 0x80975008; // type:func -func_80984BE0 = 0x809752B0; // type:func -DemoIm_InitCollider = 0x80975338; // type:func -DemoIm_DestroyCollider = 0x80975384; // type:func -DemoIm_UpdateCollider = 0x809753B0; // type:func -func_80984DB8 = 0x809753F4; // type:func -func_80984E58 = 0x80975498; // type:func -func_80984F10 = 0x80975550; // type:func -func_80984F94 = 0x809755D8; // type:func -DemoIm_UpdateBgCheckInfo = 0x80975660; // type:func -DemoIm_UpdateSkelAnime = 0x809756A8; // type:func -DemoIm_IsCutsceneIdle = 0x809756CC; // type:func -DemoIm_GetCue = 0x809756EC; // type:func -func_809850E8 = 0x80975738; // type:func -func_80985134 = 0x80975784; // type:func -func_80985180 = 0x809757D0; // type:func -func_80985200 = 0x80975850; // type:func -DemoIm_ChangeAnim = 0x809758D0; // type:func -func_80985310 = 0x80975960; // type:func -func_80985358 = 0x809759A8; // type:func -func_809853B4 = 0x80975A04; // type:func -func_80985430 = 0x80975A80; // type:func -func_8098544C = 0x80975AA0; // type:func -func_809854DC = 0x80975B3C; // type:func -func_8098557C = 0x80975BDC; // type:func -func_809855A8 = 0x80975C08; // type:func -func_80985640 = 0x80975CA0; // type:func -func_809856AC = 0x80975D0C; // type:func -func_809856F8 = 0x80975D58; // type:func -func_80985718 = 0x80975D78; // type:func -func_80985738 = 0x80975D98; // type:func -func_80985770 = 0x80975DD4; // type:func -func_809857B0 = 0x80975E1C; // type:func -func_809857F0 = 0x80975E60; // type:func -func_80985830 = 0x80975EA8; // type:func -func_80985860 = 0x80975EDC; // type:func -func_809858A8 = 0x80975F20; // type:func -DemoIm_SpawnLightBall = 0x80975F40; // type:func -func_80985948 = 0x80975FC0; // type:func -func_809859E0 = 0x8097605C; // type:func -func_80985B34 = 0x809761B0; // type:func -func_80985C10 = 0x80976294; // type:func -func_80985C40 = 0x809762B4; // type:func -func_80985C94 = 0x809762FC; // type:func -DemoIm_DrawTranslucent = 0x80976344; // type:func -func_80985E60 = 0x8097648C; // type:func -func_80985EAC = 0x809764D8; // type:func -func_80985EF4 = 0x80976520; // type:func -func_80985F54 = 0x80976580; // type:func -func_80985F64 = 0x80976594; // type:func -func_80985FE8 = 0x80976618; // type:func -func_8098604C = 0x8097667C; // type:func -func_809860C8 = 0x809766F8; // type:func -func_809860DC = 0x80976710; // type:func -func_80986148 = 0x8097677C; // type:func -func_809861C4 = 0x809767F8; // type:func -func_8098629C = 0x809768BC; // type:func -func_809862E0 = 0x80976900; // type:func -func_809863BC = 0x809769C8; // type:func -func_809863DC = 0x809769E8; // type:func -func_80986430 = 0x80976A44; // type:func -func_80986494 = 0x80976AB0; // type:func -func_809864D4 = 0x80976AF8; // type:func -func_8098652C = 0x80976B58; // type:func -func_80986570 = 0x80976B9C; // type:func -func_809865F8 = 0x80976C24; // type:func -func_80986700 = 0x80976D34; // type:func -func_80986710 = 0x80976D48; // type:func -func_80986794 = 0x80976DCC; // type:func -func_8098680C = 0x80976E44; // type:func -func_809868E8 = 0x80976F0C; // type:func -func_80986908 = 0x80976F2C; // type:func -func_80986948 = 0x80976F74; // type:func -func_809869B0 = 0x80976FE4; // type:func -func_809869F8 = 0x80977028; // type:func -func_80986A5C = 0x8097708C; // type:func -func_80986AD0 = 0x80977100; // type:func -func_80986B2C = 0x8097715C; // type:func -func_80986BA0 = 0x809771D0; // type:func -func_80986BE4 = 0x80977214; // type:func -func_80986BF8 = 0x80977228; // type:func -func_80986C30 = 0x80977260; // type:func -func_80986CC8 = 0x80977304; // type:func -func_80986CFC = 0x80977338; // type:func -func_80986D40 = 0x80977380; // type:func -func_80986DC8 = 0x809773E8; // type:func -func_80986E20 = 0x80977444; // type:func -func_80986E40 = 0x80977464; // type:func -func_80986EAC = 0x809774D8; // type:func -func_80986F08 = 0x8097753C; // type:func -func_80986F28 = 0x8097755C; // type:func -func_80986F88 = 0x809775C4; // type:func -func_80986FA8 = 0x809775E8; // type:func -func_80987018 = 0x80977660; // type:func -func_80987064 = 0x809776A8; // type:func -func_809870F0 = 0x80977734; // type:func -func_80987128 = 0x8097776C; // type:func -func_80987174 = 0x809777B8; // type:func -func_809871B4 = 0x809777F8; // type:func -func_809871E8 = 0x8097782C; // type:func -func_80987288 = 0x809778B8; // type:func -func_809872A8 = 0x809778D8; // type:func -func_809872F0 = 0x80977924; // type:func -func_80987330 = 0x8097796C; // type:func -DemoIm_Update = 0x809779B0; // type:func -DemoIm_Init = 0x809779F8; // type:func -DemoIm_Destroy = 0x80977B20; // type:func -DemoIm_OverrideLimbDraw = 0x80977B40; // type:func -DemoIm_PostLimbDraw = 0x80977BF0; // type:func -DemoIm_DrawNothing = 0x80977C7C; // type:func -DemoIm_DrawSolid = 0x80977C8C; // type:func -DemoIm_Draw = 0x80977DD0; // type:func -DemoKankyo_SetupAction = 0x80979220; // type:func -DemoKankyo_Init = 0x8097922C; // type:func -DemoKankyo_Destroy = 0x80979610; // type:func -DemoKankyo_SetupType = 0x8097961C; // type:func -DemoKankyo_DoNothing = 0x80979A54; // type:func -DemoKankyo_DoNothing2 = 0x80979A64; // type:func -DemoKankyo_SetPosFromCue = 0x80979A8C; // type:func -DemoKankyo_UpdateRock = 0x80979B7C; // type:func -DemoKankyo_UpdateClouds = 0x80979BF4; // type:func -DemoKankyo_UpdateDoorOfTime = 0x80979C40; // type:func -DemoKankyo_KillDoorOfTimeCollision = 0x80979CDC; // type:func -DemoKankyo_Update = 0x80979D08; // type:func -DemoKankyo_Draw = 0x80979D2C; // type:func -func_80989B54 = 0x80979ED4; // type:func -DemoKankyo_DrawRain = 0x8097A0A4; // type:func -DemoKankyo_DrawRock = 0x8097A6B0; // type:func -DemoKankyo_DrawClouds = 0x8097A7F4; // type:func -DemoKankyo_DrawDoorOfTime = 0x8097AB20; // type:func -DemoKankyo_DrawLightPlane = 0x8097AC30; // type:func -DemoKankyo_Vec3fCopy = 0x8097AD18; // type:func -DemoKankyo_AddVecGeoToVec3f = 0x8097AD38; // type:func -DemoKankyo_Vec3fAddPosRot = 0x8097ADB8; // type:func -DemoKankyo_DrawWarpSparkles = 0x8097AE14; // type:func -DemoKankyo_DrawSparkles = 0x8097B570; // type:func -DemoKekkai_CheckEventFlag = 0x8097CF10; // type:func -DemoKekkai_Init = 0x8097CF54; // type:func -DemoKekkai_Destroy = 0x8097D184; // type:func -DemoKekkai_SpawnParticles = 0x8097D1C4; // type:func -DemoKekkai_TowerBarrier = 0x8097D418; // type:func -DemoKekkai_Update = 0x8097D534; // type:func -DemoKekkai_TrialBarrierDispel = 0x8097D660; // type:func -DemoKekkai_TrialBarrierIdle = 0x8097D7C0; // type:func -DemoKekkai_DrawTrialBarrier = 0x8097D8E4; // type:func -DemoKekkai_DrawTowerBarrier = 0x8097DDF8; // type:func -DemoSa_Destroy = 0x8097E200; // type:func -func_8098E480 = 0x8097E224; // type:func -DemoSa_SetEyeIndex = 0x8097E2AC; // type:func -DemoSa_SetMouthIndex = 0x8097E2C4; // type:func -func_8098E5C8 = 0x8097E2DC; // type:func -DemoSa_UpdateSkelAnime = 0x8097E324; // type:func -DemoSa_GetCue = 0x8097E348; // type:func -func_8098E654 = 0x8097E370; // type:func -func_8098E6A0 = 0x8097E3BC; // type:func -func_8098E6EC = 0x8097E408; // type:func -func_8098E76C = 0x8097E488; // type:func -func_8098E7FC = 0x8097E518; // type:func -func_8098E86C = 0x8097E588; // type:func -func_8098E8C8 = 0x8097E5E4; // type:func -func_8098E944 = 0x8097E660; // type:func -func_8098E960 = 0x8097E680; // type:func -func_8098E9EC = 0x8097E718; // type:func -func_8098EA3C = 0x8097E768; // type:func -func_8098EA68 = 0x8097E794; // type:func -func_8098EB00 = 0x8097E82C; // type:func -func_8098EB6C = 0x8097E898; // type:func -func_8098EBB8 = 0x8097E8E4; // type:func -func_8098EBD8 = 0x8097E904; // type:func -func_8098EBF8 = 0x8097E924; // type:func -func_8098EC28 = 0x8097E958; // type:func -func_8098EC60 = 0x8097E998; // type:func -func_8098EC94 = 0x8097E9D0; // type:func -func_8098ECCC = 0x8097EA10; // type:func -func_8098ECF4 = 0x8097EA3C; // type:func -func_8098EDB0 = 0x8097EAF8; // type:func -func_8098EE08 = 0x8097EB50; // type:func -func_8098EE28 = 0x8097EB70; // type:func -func_8098EEA8 = 0x8097EBF0; // type:func -func_8098EEFC = 0x8097EC44; // type:func -func_8098F050 = 0x8097ED98; // type:func -func_8098F0E8 = 0x8097EE34; // type:func -func_8098F118 = 0x8097EE54; // type:func -func_8098F16C = 0x8097EE9C; // type:func -DemoSa_DrawXlu = 0x8097EEE4; // type:func -func_8098F390 = 0x8097F084; // type:func -func_8098F3F0 = 0x8097F0E4; // type:func -func_8098F420 = 0x8097F118; // type:func -func_8098F480 = 0x8097F174; // type:func -func_8098F50C = 0x8097F200; // type:func -func_8098F544 = 0x8097F238; // type:func -func_8098F590 = 0x8097F284; // type:func -func_8098F5D0 = 0x8097F2C4; // type:func -func_8098F610 = 0x8097F304; // type:func -func_8098F654 = 0x8097F34C; // type:func -func_8098F714 = 0x8097F3F8; // type:func -func_8098F734 = 0x8097F418; // type:func -func_8098F77C = 0x8097F464; // type:func -func_8098F7BC = 0x8097F4AC; // type:func -func_8098F7FC = 0x8097F4F4; // type:func -func_8098F83C = 0x8097F538; // type:func -func_8098F8F8 = 0x8097F5F4; // type:func -func_8098F984 = 0x8097F680; // type:func -func_8098F998 = 0x8097F698; // type:func -func_8098FA2C = 0x8097F72C; // type:func -func_8098FA84 = 0x8097F784; // type:func -func_8098FAE0 = 0x8097F7E0; // type:func -func_8098FB34 = 0x8097F834; // type:func -func_8098FB68 = 0x8097F868; // type:func -func_8098FC44 = 0x8097F930; // type:func -func_8098FC64 = 0x8097F950; // type:func -func_8098FC9C = 0x8097F98C; // type:func -func_8098FCD4 = 0x8097F9CC; // type:func -func_8098FD0C = 0x8097FA0C; // type:func -DemoSa_Update = 0x8097FA58; // type:func -DemoSa_Init = 0x8097FAA0; // type:func -DemoSa_OverrideLimbDraw = 0x8097FB68; // type:func -DemoSa_DrawNothing = 0x8097FBA0; // type:func -DemoSa_DrawOpa = 0x8097FBB0; // type:func -DemoSa_Draw = 0x8097FD44; // type:func -DemoShd_SetupAction = 0x80980D20; // type:func -DemoShd_Init = 0x80980D2C; // type:func -DemoShd_Destroy = 0x80980D7C; // type:func -func_80991298 = 0x80980D8C; // type:func -DemoShd_Update = 0x80980EE4; // type:func -DemoShd_Draw = 0x80980F08; // type:func -DemoTreLgt_Init = 0x80983130; // type:func -DemoTreLgt_Destroy = 0x8098318C; // type:func -func_80993754 = 0x809831B8; // type:func -func_8099375C = 0x809831C4; // type:func -func_809937B4 = 0x8098321C; // type:func -func_80993848 = 0x809832B4; // type:func -DemoTreLgt_Update = 0x80983568; // type:func -DemoTreLgt_OverrideLimbDraw = 0x8098359C; // type:func -DemoTreLgt_Draw = 0x809836F0; // type:func -DoorAna_SetupAction = 0x80983840; // type:func -DoorAna_Init = 0x8098384C; // type:func -DoorAna_Destroy = 0x80983908; // type:func -DoorAna_WaitClosed = 0x80983944; // type:func -DoorAna_WaitOpen = 0x80983A7C; // type:func -DoorAna_GrabPlayer = 0x80983C30; // type:func -DoorAna_Update = 0x80983CDC; // type:func -DoorAna_Draw = 0x80983D30; // type:func -DoorGerudo_Init = 0x80983EB0; // type:func -DoorGerudo_Destroy = 0x80983F60; // type:func -func_809946BC = 0x80983F94; // type:func -func_80994750 = 0x8098402C; // type:func -func_8099485C = 0x80984138; // type:func -func_8099496C = 0x80984248; // type:func -func_809949C8 = 0x809842A4; // type:func -DoorGerudo_Update = 0x80984300; // type:func -DoorGerudo_Draw = 0x80984324; // type:func -DoorKiller_Init = 0x809844A0; // type:func -DoorKiller_Destroy = 0x809847F8; // type:func -DoorKiller_SpawnRubble = 0x80984848; // type:func -DoorKiller_FallAsRubble = 0x809849F0; // type:func -DoorKiller_IsHit = 0x80984AB0; // type:func -DoorKiller_SetAC = 0x80984AE4; // type:func -DoorKiller_Die = 0x80984B44; // type:func -DoorKiller_RiseBackUp = 0x80984B94; // type:func -DoorKiller_FallOver = 0x80984D44; // type:func -DoorKiller_Wobble = 0x80985110; // type:func -DoorKiller_WaitBeforeWobble = 0x80985280; // type:func -DoorKiller_Wait = 0x809852B4; // type:func -DoorKiller_UpdateTexture = 0x80985514; // type:func -DoorKiller_WaitForObject = 0x809855A8; // type:func -DoorKiller_Update = 0x8098565C; // type:func -DoorKiller_SetTexture = 0x80985680; // type:func -DoorKiller_DrawDoor = 0x809856AC; // type:func -DoorKiller_DrawRubble = 0x80985708; // type:func -DoorShutter_SetupAction = 0x80985A10; // type:func -DoorShutter_SetupDoor = 0x80985A20; // type:func -DoorShutter_Init = 0x80985C08; // type:func -DoorShutter_Destroy = 0x80985E20; // type:func -DoorShutter_WaitForObject = 0x80985E90; // type:func -DoorShutter_GetPlayerDistance = 0x80985FCC; // type:func -DoorShutter_GetPlayerSide = 0x80986064; // type:func -DoorShutter_WaitClear = 0x809861E4; // type:func -DoorShutter_Unopenable = 0x80986290; // type:func -DoorShutter_Idle = 0x809862A0; // type:func -DoorShutter_InitOpeningDoorCam = 0x809863F4; // type:func -DoorShutter_UpdateOpening = 0x809864AC; // type:func -DoorShutter_UpdateBarsClosed = 0x809865A4; // type:func -DoorShutter_BarAndWaitSwitchFlag = 0x80986688; // type:func -DoorShutter_UnbarredCheckSwitchFlag = 0x80986740; // type:func -DoorShutter_Open = 0x809867AC; // type:func -DoorShutter_Unbar = 0x809868FC; // type:func -DoorShutter_SetupClosed = 0x809869CC; // type:func -DoorShutter_Close = 0x80986B98; // type:func -DoorShutter_JabuDoorClose = 0x80986CDC; // type:func -DoorShutter_WaitPlayerSurprised = 0x80986D20; // type:func -DoorShutter_GohmaBlockFall = 0x80986D78; // type:func -DoorShutter_GohmaBlockBounce = 0x80986E74; // type:func -DoorShutter_PhantomGanonBarsRaise = 0x80986F00; // type:func -DoorShutter_Update = 0x80986F90; // type:func -DoorShutter_DrawJabuJabuDoor = 0x80986FE4; // type:func -DoorShutter_ShouldDraw = 0x809871D4; // type:func -DoorShutter_Draw = 0x80987280; // type:func -DoorShutter_RequestQuakeAndRumble = 0x809877D4; // type:func -DoorToki_Init = 0x80987CD0; // type:func -DoorToki_Destroy = 0x80987D38; // type:func -DoorToki_Update = 0x80987D6C; // type:func -DoorWarp1_SetupAction = 0x80987E30; // type:func -DoorWarp1_Init = 0x80987E3C; // type:func -DoorWarp1_Destroy = 0x80987FAC; // type:func -DoorWarp1_SetupWarp = 0x80988034; // type:func -DoorWarp1_SetupAdultDungeonWarp = 0x8098833C; // type:func -DoorWarp1_SetupBlueCrystal = 0x80988508; // type:func -DoorWarp1_SetupPurpleCrystal = 0x809886A0; // type:func -DoorWarp1_SetPlayerPos = 0x80988840; // type:func -DoorWarp1_BlueCrystal = 0x80988878; // type:func -func_80999214 = 0x809888C4; // type:func -func_80999348 = 0x809889F8; // type:func -DoorWarp1_FloatPlayer = 0x80988AC0; // type:func -DoorWarp1_PurpleCrystal = 0x80988ADC; // type:func -DoorWarp1_ChooseInitialAction = 0x80988BBC; // type:func -DoorWarp1_AwaitClearFlag = 0x80988C34; // type:func -func_809995D4 = 0x80988C8C; // type:func -DoorWarp1_WarpAppear = 0x80988DDC; // type:func -func_809998A4 = 0x80988F60; // type:func -DoorWarp1_PlayerInRange = 0x80988FF8; // type:func -DoorWarp1_ChildWarpIdle = 0x80989064; // type:func -DoorWarp1_ChildWarpOut = 0x80989130; // type:func -DoorWarp1_RutoWarpIdle = 0x80989524; // type:func -func_80999EE0 = 0x809895A4; // type:func -func_80999FE4 = 0x809896AC; // type:func -DoorWarp1_RutoWarpOut = 0x80989764; // type:func -func_8099A3A4 = 0x80989A70; // type:func -DoorWarp1_AdultWarpIdle = 0x80989B3C; // type:func -func_8099A508 = 0x80989BDC; // type:func -DoorWarp1_AdultWarpOut = 0x80989CC0; // type:func -DoorWarp1_Destination = 0x8098A5A4; // type:func -DoorWarp1_DoNothing = 0x8098A6D4; // type:func -func_8099B020 = 0x8098A6E4; // type:func -DoorWarp1_Update = 0x8098A7A0; // type:func -DoorWarp1_DrawBlueCrystal = 0x8098A804; // type:func -DoorWarp1_DrawPurpleCrystal = 0x8098A9D4; // type:func -DoorWarp1_DrawWarp = 0x8098AC58; // type:func -DoorWarp1_Draw = 0x8098BB04; // type:func -EfcErupc_SetupAction = 0x8098C140; // type:func -EfcErupc_Init = 0x8098C14C; // type:func -EfcErupc_Destroy = 0x8098C1B8; // type:func -EfcErupc_UpdateAction = 0x8098C1C8; // type:func -EfcErupc_Update = 0x8098C414; // type:func -EfcErupc_Draw = 0x8098C450; // type:func -EfcErupc_DrawEffects = 0x8098C790; // type:func -EfcErupc_UpdateEffects = 0x8098C94C; // type:func -EfcErupc_SpawnEffect = 0x8098CA70; // type:func -EfcErupc_InitEffects = 0x8098CB3C; // type:func -EffDust_SetupAction = 0x8098CC30; // type:func -EffDust_SetupDraw = 0x8098CC3C; // type:func -EffDust_InitPosAndDistance = 0x8098CC48; // type:func -EffDust_Init = 0x8098CCC0; // type:func -EffDust_Destroy = 0x8098CE80; // type:func -EffDust_UpdateFunc_8099DB28 = 0x8098CE90; // type:func -EffDust_UpdateFunc_8099DD74 = 0x8098D0DC; // type:func -EffDust_UpdateFunc_8099DFC0 = 0x8098D328; // type:func -EffDust_Update = 0x8098D83C; // type:func -EffDust_DrawFunc_8099E4F4 = 0x8098D860; // type:func -EffDust_DrawFunc_8099E784 = 0x8098DAB4; // type:func -EffDust_Draw = 0x8098DE18; // type:func -EffectSsBlast_Init = 0x8098E000; // type:func -EffectSsBlast_Draw = 0x8098E15C; // type:func -EffectSsBlast_Update = 0x8098E2C8; // type:func -EffectSsBomb_Init = 0x8098E390; // type:func -EffectSsBomb_Draw = 0x8098E458; // type:func -EffectSsBomb_Update = 0x8098E690; // type:func -EffectSsBomb2_Init = 0x8098E7C0; // type:func -EffectSsBomb2_DrawFade = 0x8098E8B8; // type:func -EffectSsBomb2_DrawLayered = 0x8098EAA8; // type:func -EffectSsBomb2_Update = 0x8098EDDC; // type:func -EffectSsBubble_Init = 0x8098F0C0; // type:func -EffectSsBubble_Draw = 0x8098F250; // type:func -EffectSsBubble_Update = 0x8098F3A4; // type:func -EffectSsDFire_Init = 0x8098F540; // type:func -EffectSsDFire_Draw = 0x8098F68C; // type:func -EffectSsDFire_Update = 0x8098F8D4; // type:func -EffectSsDeadDb_Init = 0x8098FA30; // type:func -EffectSsDeadDb_Draw = 0x8098FB4C; // type:func -EffectSsDeadDb_Update = 0x8098FD20; // type:func -EffectSsDeadDd_Init = 0x8098FF10; // type:func -EffectSsDeadDd_Draw = 0x809901D8; // type:func -EffectSsDeadDd_Update = 0x809903A8; // type:func -EffectSsDeadDs_Init = 0x809904A0; // type:func -EffectSsDeadDs_Draw = 0x80990588; // type:func -EffectSsDeadDs_Update = 0x8099085C; // type:func -EffectSsDeadSound_Init = 0x80990920; // type:func -EffectSsDeadSound_Update = 0x809909AC; // type:func -EffectSsDtBubble_Init = 0x80990A60; // type:func -EffectSsDtBubble_Draw = 0x80990CB4; // type:func -EffectSsDtBubble_Update = 0x80990EF4; // type:func -EffectSsDust_Init = 0x80990FF0; // type:func -EffectSsDust_Draw = 0x809911A4; // type:func -EffectSsDust_Update = 0x809914EC; // type:func -EffectSsDust_UpdateFire = 0x809915E4; // type:func -EffectSsEnFire_Init = 0x80991830; // type:func -EffectSsEnFire_Draw = 0x809919F8; // type:func -EffectSsEnFire_Update = 0x80991D00; // type:func -EffectSsEnIce_Init = 0x80991F80; // type:func -EffectSsEnIce_Draw = 0x80992228; // type:func -EffectSsEnIce_UpdateFlying = 0x80992598; // type:func -EffectSsEnIce_Update = 0x80992770; // type:func -EffectSsExtra_Init = 0x80992840; // type:func -EffectSsExtra_Draw = 0x80992984; // type:func -EffectSsExtra_Update = 0x80992B38; // type:func -EffectSsFcircle_Init = 0x80992C00; // type:func -EffectSsFcircle_Draw = 0x80992CC0; // type:func -EffectSsFcircle_Update = 0x80992F8C; // type:func -EffectSsFhgFlash_Init = 0x809930B0; // type:func -EffectSsFhgFlash_DrawLightBall = 0x809933FC; // type:func -EffectSsFhgFlash_DrawShock = 0x809935F0; // type:func -EffectSsFhgFlash_UpdateLightBall = 0x809937FC; // type:func -EffectSsFhgFlash_UpdateShock = 0x80993894; // type:func -EffectSsFireTail_Init = 0x80994030; // type:func -EffectSsFireTail_Draw = 0x8099414C; // type:func -EffectSsFireTail_Update = 0x80994654; // type:func -EffectSsGFire_Init = 0x80994730; // type:func -EffectSsGFire_Draw = 0x80994870; // type:func -EffectSsGFire_Update = 0x80994918; // type:func -EffectSsGMagma_Init = 0x809949C0; // type:func -EffectSsGMagma_Draw = 0x80994B18; // type:func -EffectSsGMagma_Update = 0x80994B74; // type:func -EffectSsGMagma2_Init = 0x80994C20; // type:func -EffectSsGMagma2_Draw = 0x80994DEC; // type:func -EffectSsGMagma2_Update = 0x80995004; // type:func -EffectSsGRipple_Init = 0x80995130; // type:func -EffectSsGRipple_DrawRipple = 0x809952AC; // type:func -EffectSsGRipple_Draw = 0x809954A8; // type:func -EffectSsGRipple_Update = 0x809954E0; // type:func -EffectSsGSpk_Init = 0x80995690; // type:func -EffectSsGSpk_Draw = 0x80995800; // type:func -EffectSsGSpk_Update = 0x809959F4; // type:func -EffectSsGSpk_UpdateNoAccel = 0x80995AFC; // type:func -EffectSsGSplash_Init = 0x80995C40; // type:func -EffectSsGSplash_Draw = 0x80995E60; // type:func -EffectSsGSplash_Update = 0x80995F68; // type:func -EffectSsHahen_CheckForObject = 0x809960F0; // type:func -EffectSsHahen_Init = 0x80996164; // type:func -EffectSsHahen_Draw = 0x80996300; // type:func -EffectSsHahen_DrawGray = 0x80996460; // type:func -EffectSsHahen_Update = 0x80996608; // type:func -EffectSsHitMark_Init = 0x80996730; // type:func -EffectSsHitMark_Draw = 0x80996830; // type:func -EffectSsHitMark_Update = 0x80996A3C; // type:func -EffectSsIcePiece_Init = 0x80996C80; // type:func -EffectSsIcePiece_Draw = 0x80996DCC; // type:func -EffectSsIcePiece_Update = 0x80997000; // type:func -EffectSsIceSmoke_Init = 0x809970C0; // type:func -EffectSsIceSmoke_Draw = 0x809971E0; // type:func -EffectSsIceSmoke_Update = 0x809974C0; // type:func -EffectSsKFire_Init = 0x809975A0; // type:func -EffectSsKFire_Draw = 0x80997670; // type:func -EffectSsKFire_Update = 0x809978D8; // type:func -EffectSsKakera_Init = 0x809979E0; // type:func -func_809A9818 = 0x80997B6C; // type:func -EffectSsKakera_Draw = 0x80997BA8; // type:func -func_809A9BA8 = 0x80997E94; // type:func -func_809A9C10 = 0x80997F00; // type:func -func_809A9DC0 = 0x809980B0; // type:func -func_809A9DD8 = 0x809980CC; // type:func -func_809A9DEC = 0x809980E8; // type:func -func_809A9E28 = 0x80998124; // type:func -func_809A9E68 = 0x80998164; // type:func -func_809A9E88 = 0x80998184; // type:func -func_809A9F10 = 0x80998214; // type:func -func_809A9F4C = 0x80998254; // type:func -func_809A9FD8 = 0x809982E8; // type:func -func_809AA0B8 = 0x809983C4; // type:func -func_809AA0EC = 0x809983FC; // type:func -func_809AA230 = 0x80998544; // type:func -EffectSsKakera_Update = 0x80998744; // type:func -EffectSsKiraKira_Init = 0x80998A70; // type:func -EffectSsKiraKira_Draw = 0x80998C10; // type:func -func_809AABF0 = 0x80998E2C; // type:func -func_809AACAC = 0x80998EE4; // type:func -func_809AAD6C = 0x80998FA0; // type:func -EffectSsLightning_Init = 0x809990E0; // type:func -EffectSsLightning_NewLightning = 0x809991C8; // type:func -EffectSsLightning_Draw = 0x8099926C; // type:func -EffectSsLightning_Update = 0x80999504; // type:func -EffectSsSibuki_Init = 0x809997B0; // type:func -EffectSsSibuki_Draw = 0x80999968; // type:func -EffectSsSibuki_Update = 0x80999B18; // type:func -EffectSsSibuki2_Init = 0x80999E80; // type:func -EffectSsSibuki2_Draw = 0x80999F30; // type:func -EffectSsSibuki2_Update = 0x8099A114; // type:func -EffectSsSolderSrchBall_Init = 0x8099A1B0; // type:func -EffectSsSolderSrchBall_Update = 0x8099A230; // type:func -EffectSsStick_Init = 0x8099A360; // type:func -EffectSsStick_Draw = 0x8099A4C0; // type:func -EffectSsStick_Update = 0x8099A660; // type:func -EffectSsStone1_Init = 0x8099A700; // type:func -EffectSsStone1_Draw = 0x8099A78C; // type:func -EffectSsStone1_Update = 0x8099A988; // type:func -ElfMsg_SetupAction = 0x8099AA80; // type:func -ElfMsg_KillCheck = 0x8099AA8C; // type:func -ElfMsg_Init = 0x8099ABC4; // type:func -ElfMsg_Destroy = 0x8099ACB8; // type:func -ElfMsg_GetMessageId = 0x8099ACC8; // type:func -ElfMsg_CallNaviCuboid = 0x8099ACF4; // type:func -ElfMsg_WithinXZDistance = 0x8099ADC4; // type:func -ElfMsg_CallNaviCylinder = 0x8099AE18; // type:func -ElfMsg_Update = 0x8099AEE0; // type:func -ElfMsg2_SetupAction = 0x8099B070; // type:func -ElfMsg2_KillCheck = 0x8099B07C; // type:func -ElfMsg2_Init = 0x8099B1B4; // type:func -ElfMsg2_Destroy = 0x8099B274; // type:func -ElfMsg2_GetMessageId = 0x8099B284; // type:func -ElfMsg2_WaitForTextClose = 0x8099B298; // type:func -ElfMsg2_WaitForTextRead = 0x8099B318; // type:func -ElfMsg2_WaitUntilActivated = 0x8099B350; // type:func -ElfMsg2_Update = 0x8099B3CC; // type:func -EnAm_SetupAction = 0x8099B4E0; // type:func -EnAm_CanMove = 0x8099B4EC; // type:func -EnAm_Init = 0x8099B618; // type:func -EnAm_Destroy = 0x8099B7E4; // type:func -EnAm_SpawnEffects = 0x8099B83C; // type:func -EnAm_SetupSleep = 0x8099B9D8; // type:func -EnAm_SetupStatue = 0x8099BA74; // type:func -EnAm_SetupLunge = 0x8099BB04; // type:func -EnAm_SetupCooldown = 0x8099BB68; // type:func -EnAm_SetupMoveToHome = 0x8099BBD4; // type:func -EnAm_SetupRotateToInit = 0x8099BC30; // type:func -EnAm_SetupRotateToHome = 0x8099BC8C; // type:func -EnAm_SetupRecoilFromDamage = 0x8099BCE8; // type:func -EnAm_SetupRicochet = 0x8099BDC0; // type:func -EnAm_Sleep = 0x8099BE74; // type:func -EnAm_RotateToHome = 0x8099C0E0; // type:func -EnAm_RotateToInit = 0x8099C1E4; // type:func -EnAm_MoveToHome = 0x8099C350; // type:func -EnAm_RecoilFromDamage = 0x8099C4C0; // type:func -EnAm_Cooldown = 0x8099C564; // type:func -EnAm_Lunge = 0x8099C69C; // type:func -EnAm_Statue = 0x8099C8D0; // type:func -EnAm_SetupStunned = 0x8099CB20; // type:func -EnAm_Stunned = 0x8099CC0C; // type:func -EnAm_Ricochet = 0x8099CCE0; // type:func -EnAm_TransformSwordHitbox = 0x8099CD94; // type:func -EnAm_UpdateDamage = 0x8099CE2C; // type:func -EnAm_Update = 0x8099CFC4; // type:func -EnAm_PostLimbDraw = 0x8099D368; // type:func -EnAm_Draw = 0x8099D3B0; // type:func -EnAni_SetupAction = 0x8099D8E0; // type:func -EnAni_Init = 0x8099D8EC; // type:func -EnAni_Destroy = 0x8099DA04; // type:func -EnAni_SetText = 0x8099DA30; // type:func -func_809B04F0 = 0x8099DA6C; // type:func -func_809B0524 = 0x8099DAA4; // type:func -func_809B0558 = 0x8099DADC; // type:func -func_809B05F0 = 0x8099DB78; // type:func -func_809B064C = 0x8099DBDC; // type:func -func_809B07F8 = 0x8099DD88; // type:func -func_809B0988 = 0x8099DF18; // type:func -func_809B0994 = 0x8099DF28; // type:func -func_809B0A28 = 0x8099DFBC; // type:func -func_809B0A6C = 0x8099E000; // type:func -EnAni_Update = 0x8099E0AC; // type:func -EnAni_OverrideLimbDraw = 0x8099E328; // type:func -EnAni_PostLimbDraw = 0x8099E370; // type:func -EnAni_Draw = 0x8099E3B0; // type:func -EnAnubice_Hover = 0x8099E650; // type:func -EnAnubice_AimFireball = 0x8099E6F4; // type:func -EnAnubice_Init = 0x8099E7D4; // type:func -EnAnubice_Destroy = 0x8099E8EC; // type:func -EnAnubice_FindFlameCircles = 0x8099E948; // type:func -EnAnubice_SetupIdle = 0x8099E9D0; // type:func -EnAnubice_Idle = 0x8099EA78; // type:func -EnAnubice_GoToHome = 0x8099EB58; // type:func -EnAnubice_SetupShootFireball = 0x8099ECA8; // type:func -EnAnubice_ShootFireball = 0x8099ED30; // type:func -EnAnubice_SetupDie = 0x8099EE30; // type:func -EnAnubice_Die = 0x8099EF00; // type:func -EnAnubice_Update = 0x8099F1B4; // type:func -EnAnubice_OverrideLimbDraw = 0x8099F5B8; // type:func -EnAnubice_PostLimbDraw = 0x8099F604; // type:func -EnAnubice_Draw = 0x8099F6C0; // type:func -EnAnubiceFire_Init = 0x8099F900; // type:func -EnAnubiceFire_Destroy = 0x8099FA20; // type:func -func_809B26EC = 0x8099FA4C; // type:func -func_809B27D8 = 0x8099FB38; // type:func -func_809B2B48 = 0x8099FEA8; // type:func -EnAnubiceFire_Update = 0x809A0054; // type:func -EnAnubiceFire_Draw = 0x809A0250; // type:func -EnAnubiceTag_Init = 0x809A06C0; // type:func -EnAnubiceTag_Destroy = 0x809A0710; // type:func -EnAnubiceTag_SpawnAnubis = 0x809A0720; // type:func -EnAnubiceTag_ManageAnubis = 0x809A0798; // type:func -EnAnubiceTag_Update = 0x809A08FC; // type:func -EnAnubiceTag_Draw = 0x809A0920; // type:func -EnArowTrap_Init = 0x809A0990; // type:func -EnArowTrap_Destroy = 0x809A09E0; // type:func -EnArowTrap_Update = 0x809A09F0; // type:func -EnArrow_SetupAction = 0x809A0AE0; // type:func -EnArrow_Init = 0x809A0AEC; // type:func -EnArrow_Destroy = 0x809A0CF4; // type:func -EnArrow_Shoot = 0x809A0D7C; // type:func -func_809B3CEC = 0x809A0E94; // type:func -EnArrow_CarryActor = 0x809A0F7C; // type:func -EnArrow_Fly = 0x809A1180; // type:func -func_809B45E0 = 0x809A1788; // type:func -func_809B4640 = 0x809A17E8; // type:func -EnArrow_Update = 0x809A1850; // type:func -func_809B4800 = 0x809A19AC; // type:func -EnArrow_Draw = 0x809A1B14; // type:func -EnAttackNiw_Init = 0x809A21E0; // type:func -EnAttackNiw_Destroy = 0x809A2314; // type:func -func_809B5268 = 0x809A2348; // type:func -func_809B55EC = 0x809A26D0; // type:func -func_809B5670 = 0x809A2754; // type:func -func_809B59B0 = 0x809A2A94; // type:func -func_809B5C18 = 0x809A2D04; // type:func -EnAttackNiw_Update = 0x809A2DC8; // type:func -func_809B5F98 = 0x809A308C; // type:func -EnAttackNiw_Draw = 0x809A31E4; // type:func -EnBa_SetupAction = 0x809A3440; // type:func -EnBa_Init = 0x809A344C; // type:func -EnBa_Destroy = 0x809A3638; // type:func -EnBa_SetupIdle = 0x809A3664; // type:func -EnBa_Idle = 0x809A36A4; // type:func -EnBa_SetupFallAsBlob = 0x809A3AD0; // type:func -EnBa_FallAsBlob = 0x809A3B40; // type:func -EnBa_SetupSwingAtPlayer = 0x809A3C00; // type:func -EnBa_SwingAtPlayer = 0x809A3C54; // type:func -func_809B7174 = 0x809A4274; // type:func -EnBa_RecoilFromDamage = 0x809A42F0; // type:func -func_809B75A0 = 0x809A46A4; // type:func -EnBa_Die = 0x809A4920; // type:func -EnBa_Update = 0x809A4C50; // type:func -EnBa_Draw = 0x809A4D30; // type:func -EnBb_SetupAction = 0x809A5310; // type:func -EnBb_FindExplosive = 0x809A531C; // type:func -EnBb_SpawnFlameTrail = 0x809A53B0; // type:func -EnBb_KillFlameTrail = 0x809A554C; // type:func -EnBb_Init = 0x809A5598; // type:func -EnBb_Destroy = 0x809A5940; // type:func -EnBb_SetupFlameTrail = 0x809A596C; // type:func -EnBb_FlameTrail = 0x809A59C0; // type:func -EnBb_SetupDeath = 0x809A5B3C; // type:func -EnBb_Death = 0x809A5BD0; // type:func -EnBb_SetupDamage = 0x809A5D4C; // type:func -EnBb_Damage = 0x809A5E0C; // type:func -EnBb_SetupBlue = 0x809A5E78; // type:func -EnBb_Blue = 0x809A5F38; // type:func -EnBb_SetupDown = 0x809A672C; // type:func -EnBb_Down = 0x809A67BC; // type:func -EnBb_SetupRed = 0x809A6A90; // type:func -EnBb_Red = 0x809A6BA0; // type:func -EnBb_FaceWaypoint = 0x809A6F68; // type:func -EnBb_SetWaypoint = 0x809A6F9C; // type:func -EnBb_SetupWhite = 0x809A7068; // type:func -EnBb_White = 0x809A7118; // type:func -EnBb_InitGreen = 0x809A749C; // type:func -EnBb_SetupGreen = 0x809A75D4; // type:func -EnBb_Green = 0x809A766C; // type:func -EnBb_SetupStunned = 0x809A7CDC; // type:func -EnBb_Stunned = 0x809A7DF0; // type:func -EnBb_CollisionCheck = 0x809A7F94; // type:func -EnBb_Update = 0x809A82C8; // type:func -EnBb_PostLimbDraw = 0x809A8548; // type:func -EnBb_Draw = 0x809A8598; // type:func -EnBdfire_SetupAction = 0x809A8FF0; // type:func -EnbdFire_SetupDraw = 0x809A8FFC; // type:func -EnBdfire_Init = 0x809A9008; // type:func -EnBdfire_Destroy = 0x809A9238; // type:func -func_809BC2A4 = 0x809A9270; // type:func -func_809BC598 = 0x809A9564; // type:func -EnBdfire_Update = 0x809A9854; // type:func -EnBdfire_DrawFire = 0x809A9890; // type:func -EnBdfire_Draw = 0x809A9A50; // type:func -EnBigokuta_Init = 0x809A9B90; // type:func -EnBigokuta_Destroy = 0x809A9CFC; // type:func -func_809BCE3C = 0x809A9D70; // type:func -func_809BCEBC = 0x809A9DEC; // type:func -func_809BCF68 = 0x809A9E9C; // type:func -func_809BD1C8 = 0x809AA104; // type:func -func_809BD2E4 = 0x809AA220; // type:func -func_809BD318 = 0x809AA254; // type:func -func_809BD370 = 0x809AA2AC; // type:func -func_809BD3AC = 0x809AA2E8; // type:func -func_809BD3E0 = 0x809AA320; // type:func -func_809BD3F8 = 0x809AA33C; // type:func -func_809BD47C = 0x809AA3C0; // type:func -func_809BD4A4 = 0x809AA3EC; // type:func -func_809BD524 = 0x809AA46C; // type:func -func_809BD5E0 = 0x809AA528; // type:func -func_809BD658 = 0x809AA5A0; // type:func -func_809BD6B8 = 0x809AA600; // type:func -func_809BD768 = 0x809AA6B0; // type:func -func_809BD7F0 = 0x809AA738; // type:func -func_809BD84C = 0x809AA798; // type:func -func_809BD8DC = 0x809AA828; // type:func -func_809BDAE8 = 0x809AAA34; // type:func -func_809BDB90 = 0x809AAADC; // type:func -func_809BDC08 = 0x809AAB54; // type:func -func_809BDF34 = 0x809AAE84; // type:func -func_809BDFC8 = 0x809AAF18; // type:func -func_809BE058 = 0x809AAFA8; // type:func -func_809BE180 = 0x809AB0D0; // type:func -func_809BE26C = 0x809AB1BC; // type:func -func_809BE3E4 = 0x809AB334; // type:func -func_809BE4A4 = 0x809AB3F4; // type:func -func_809BE518 = 0x809AB468; // type:func -func_809BE568 = 0x809AB4B8; // type:func -func_809BE798 = 0x809AB6E8; // type:func -EnBigokuta_UpdateDamage = 0x809AB82C; // type:func -EnBigokuta_Update = 0x809AB91C; // type:func -EnBigokuta_OverrideLimbDraw = 0x809ABB14; // type:func -EnBigokuta_Draw = 0x809ABF8C; // type:func -EnBili_Init = 0x809AC690; // type:func -EnBili_Destroy = 0x809AC788; // type:func -EnBili_SetupFloatIdle = 0x809AC7B4; // type:func -EnBili_SetupSpawnedFlyApart = 0x809AC810; // type:func -EnBili_SetupDischargeLightning = 0x809AC888; // type:func -EnBili_SetupClimb = 0x809AC8E4; // type:func -EnBili_SetupApproachPlayer = 0x809AC93C; // type:func -EnBili_SetupSetNewHomeHeight = 0x809AC95C; // type:func -EnBili_SetupRecoil = 0x809AC9C4; // type:func -EnBili_SetupBurnt = 0x809ACA4C; // type:func -EnBili_SetupDie = 0x809ACAEC; // type:func -EnBili_SetupStunned = 0x809ACB20; // type:func -EnBili_SetupFrozen = 0x809ACB98; // type:func -EnBili_UpdateTentaclesIndex = 0x809ACD70; // type:func -EnBili_UpdateFloating = 0x809ACE90; // type:func -EnBili_FloatIdle = 0x809ACF78; // type:func -EnBili_SpawnedFlyApart = 0x809AD064; // type:func -EnBili_DischargeLightning = 0x809AD0BC; // type:func -EnBili_Climb = 0x809AD2B8; // type:func -EnBili_ApproachPlayer = 0x809AD374; // type:func -EnBili_SetNewHomeHeight = 0x809AD404; // type:func -EnBili_Recoil = 0x809AD480; // type:func -EnBili_Burnt = 0x809AD4E4; // type:func -EnBili_Die = 0x809AD558; // type:func -EnBili_Stunned = 0x809AD780; // type:func -EnBili_Frozen = 0x809AD7E0; // type:func -EnBili_UpdateDamage = 0x809AD870; // type:func -EnBili_Update = 0x809ADA3C; // type:func -EnBili_PulseLimb3 = 0x809ADC10; // type:func -EnBili_PulseLimb2 = 0x809ADE28; // type:func -EnBili_PulseLimb4 = 0x809AE048; // type:func -EnBili_OverrideLimbDraw = 0x809AE1B0; // type:func -EnBili_Draw = 0x809AE2A0; // type:func -EnBird_SetupAction = 0x809AE960; // type:func -EnBird_Init = 0x809AE96C; // type:func -EnBird_Destroy = 0x809AEA58; // type:func -EnBird_SetupIdle = 0x809AEA68; // type:func -EnBird_Idle = 0x809AEB1C; // type:func -EnBird_SetupMove = 0x809AEBBC; // type:func -EnBird_Move = 0x809AEBFC; // type:func -EnBird_Update = 0x809AED18; // type:func -EnBird_Draw = 0x809AED48; // type:func -EnBlkobj_SetupAction = 0x809AEE20; // type:func -EnBlkobj_Init = 0x809AEE30; // type:func -EnBlkobj_Destroy = 0x809AEEE0; // type:func -EnBlkobj_Wait = 0x809AEF14; // type:func -EnBlkobj_SpawnDarkLink = 0x809AEF68; // type:func -EnBlkobj_DarkLinkFight = 0x809AEFE0; // type:func -EnBlkobj_DoNothing = 0x809AF0BC; // type:func -EnBlkobj_Update = 0x809AF0CC; // type:func -EnBlkobj_DrawAlpha = 0x809AF0F0; // type:func -EnBlkobj_Draw = 0x809AF16C; // type:func -EnBom_SetupAction = 0x809AF380; // type:func -EnBom_Init = 0x809AF38C; // type:func -EnBom_Destroy = 0x809AF4A4; // type:func -EnBom_Move = 0x809AF4E4; // type:func -EnBom_WaitForRelease = 0x809AF6B4; // type:func -EnBom_Explode = 0x809AF700; // type:func -EnBom_Update = 0x809AF850; // type:func -EnBom_Draw = 0x809AFEE0; // type:func -EnBomBowlMan_Init = 0x809B0250; // type:func -EnBomBowlMan_Destroy = 0x809B0410; // type:func -EnBomBowlMan_SetupWaitAsleep = 0x809B0420; // type:func -EnBomBowlMan_WaitAsleep = 0x809B04A8; // type:func -EnBomBowlMan_TalkAsleep = 0x809B055C; // type:func -EnBomBowlMan_WakeUp = 0x809B05D4; // type:func -EnBomBowlMan_BlinkAwake = 0x809B0658; // type:func -EnBomBowlMan_CheckBeatenDC = 0x809B0754; // type:func -EnBomBowlMan_WaitNotBeatenDC = 0x809B0880; // type:func -EnBomBowlMan_TalkNotBeatenDC = 0x809B08DC; // type:func -EnBomBowlMan_SetupRunGame = 0x809B094C; // type:func -EnBomBowlMan_RunGame = 0x809B09D0; // type:func -EnBomBowlMan_HandlePlayChoice = 0x809B0BE0; // type:func -func_809C41FC = 0x809B0D9C; // type:func -EnBomBowlMan_SetupChooseShowPrize = 0x809B0EB8; // type:func -EnBomBowlMan_ChooseShowPrize = 0x809B0FBC; // type:func -EnBomBowlMan_BeginPlayGame = 0x809B1204; // type:func -EnBomBowlMan_Update = 0x809B12C0; // type:func -EnBomBowlMan_OverrideLimbDraw = 0x809B1438; // type:func -EnBomBowlMan_Draw = 0x809B1480; // type:func -EnBomBowlPit_Init = 0x809B1790; // type:func -EnBomBowlPit_Destroy = 0x809B17A8; // type:func -EnBomBowlPit_SetupDetectHit = 0x809B17B8; // type:func -EnBomBowlPit_DetectHit = 0x809B17E4; // type:func -EnBomBowlPit_CameraDollyIn = 0x809B1ADC; // type:func -EnBomBowlPit_SpawnPrize = 0x809B1CB8; // type:func -EnBomBowlPit_SetupGivePrize = 0x809B1D48; // type:func -EnBomBowlPit_GivePrize = 0x809B1E00; // type:func -EnBomBowlPit_WaitTillPrizeGiven = 0x809B1F04; // type:func -EnBomBowlPit_Reset = 0x809B1F60; // type:func -EnBomBowlPit_Update = 0x809B1FE0; // type:func -EnBomChu_Init = 0x809B2100; // type:func -EnBomChu_Destroy = 0x809B22A0; // type:func -EnBomChu_Explode = 0x809B22F0; // type:func -EnBomChu_CrossProduct = 0x809B2410; // type:func -EnBomChu_UpdateFloorPoly = 0x809B2484; // type:func -EnBomChu_WaitForRelease = 0x809B26B8; // type:func -EnBomChu_Move = 0x809B2828; // type:func -EnBomChu_WaitForKill = 0x809B2D40; // type:func -EnBomChu_ModelToWorld = 0x809B2D80; // type:func -EnBomChu_SpawnRipples = 0x809B2E30; // type:func -EnBomChu_Update = 0x809B2EBC; // type:func -EnBomChu_Draw = 0x809B3280; // type:func -EnBombf_SetupAction = 0x809B37A0; // type:func -EnBombf_Init = 0x809B37AC; // type:func -EnBombf_Destroy = 0x809B3988; // type:func -EnBombf_SetupGrowBomb = 0x809B39C8; // type:func -EnBombf_GrowBomb = 0x809B39F0; // type:func -EnBombf_Move = 0x809B3D00; // type:func -EnBombf_WaitForRelease = 0x809B3E24; // type:func -EnBombf_Explode = 0x809B3E88; // type:func -EnBombf_Update = 0x809B3FDC; // type:func -EnBombf_NewMtxDList = 0x809B4788; // type:func -EnBombf_Draw = 0x809B4814; // type:func -EnBoom_SetupAction = 0x809B4C30; // type:func -EnBoom_Init = 0x809B4C3C; // type:func -EnBoom_Destroy = 0x809B4D58; // type:func -EnBoom_Fly = 0x809B4D98; // type:func -EnBoom_Update = 0x809B51D8; // type:func -EnBoom_Draw = 0x809B5230; // type:func -EnBox_SetupAction = 0x809B5500; // type:func -EnBox_ClipToGround = 0x809B550C; // type:func -EnBox_Init = 0x809B5598; // type:func -EnBox_Destroy = 0x809B5A08; // type:func -EnBox_RandomDustKinematic = 0x809B5A3C; // type:func -EnBox_SpawnDust = 0x809B5B40; // type:func -EnBox_Fall = 0x809B5BF4; // type:func -EnBox_FallOnSwitchFlag = 0x809B5D78; // type:func -func_809C9700 = 0x809B5E48; // type:func -EnBox_AppearOnSwitchFlag = 0x809B5FD8; // type:func -EnBox_AppearOnRoomClear = 0x809B6058; // type:func -EnBox_AppearInit = 0x809B6110; // type:func -EnBox_AppearAnimation = 0x809B61CC; // type:func -EnBox_WaitOpen = 0x809B6278; // type:func -EnBox_Open = 0x809B64AC; // type:func -EnBox_SpawnIceSmoke = 0x809B6634; // type:func -EnBox_Update = 0x809B68E0; // type:func -EnBox_PostLimbDraw = 0x809B6A1C; // type:func -EnBox_EmptyDList = 0x809B6B84; // type:func -func_809CA4A0 = 0x809B6BA8; // type:func -func_809CA518 = 0x809B6BE8; // type:func -EnBox_Draw = 0x809B6C28; // type:func -EnBrob_Init = 0x809B7060; // type:func -EnBrob_Destroy = 0x809B72D4; // type:func -EnBrob_SetupIdle = 0x809B732C; // type:func -EnBrob_SetupMoveUp = 0x809B7394; // type:func -EnBrob_SetupWobble = 0x809B73F4; // type:func -EnBrob_SetupStunned = 0x809B7448; // type:func -EnBrob_SetupMoveDown = 0x809B74DC; // type:func -EnBrob_SetupShock = 0x809B755C; // type:func -EnBrob_Idle = 0x809B75A8; // type:func -EnBrob_MoveUp = 0x809B7668; // type:func -EnBrob_Wobble = 0x809B776C; // type:func -EnBrob_Stunned = 0x809B780C; // type:func -EnBrob_MoveDown = 0x809B78A8; // type:func -EnBrob_Shock = 0x809B79AC; // type:func -EnBrob_Update = 0x809B7BC4; // type:func -EnBrob_PostLimbDraw = 0x809B7E60; // type:func -EnBrob_Draw = 0x809B7F34; // type:func -EnBubble_SetDimensions = 0x809B8150; // type:func -func_809CBCBC = 0x809B820C; // type:func -func_809CBCEC = 0x809B8240; // type:func -EnBubble_DamagePlayer = 0x809B8264; // type:func -EnBubble_Explosion = 0x809B82D0; // type:func -func_809CBFD4 = 0x809B852C; // type:func -func_809CC020 = 0x809B8578; // type:func -EnBubble_Vec3fNormalizedReflect = 0x809B85CC; // type:func -EnBubble_Vec3fNormalize = 0x809B8654; // type:func -EnBubble_Fly = 0x809B86CC; // type:func -func_809CC648 = 0x809B8BA8; // type:func -EnBubble_DetectPop = 0x809B8C44; // type:func -func_809CC774 = 0x809B8CD4; // type:func -EnBubble_Init = 0x809B8DE8; // type:func -EnBubble_Destroy = 0x809B8EE8; // type:func -EnBubble_Wait = 0x809B8F14; // type:func -EnBubble_Pop = 0x809B8FC8; // type:func -EnBubble_Disappear = 0x809B9018; // type:func -EnBubble_Regrow = 0x809B9060; // type:func -EnBubble_Update = 0x809B90D0; // type:func -EnBubble_Draw = 0x809B914C; // type:func -EnButte_SelectFlightParams = 0x809B9570; // type:func -EnButte_ResetTransformationEffect = 0x809B95F4; // type:func -EnButte_UpdateTransformationEffect = 0x809B9610; // type:func -EnButte_DrawTransformationEffect = 0x809B9648; // type:func -EnButte_Init = 0x809B9884; // type:func -EnButte_Destroy = 0x809B99F8; // type:func -func_809CD56C = 0x809B9A24; // type:func -func_809CD634 = 0x809B9AEC; // type:func -EnButte_Turn = 0x809B9BB4; // type:func -EnButte_SetupFlyAround = 0x809B9C50; // type:func -EnButte_FlyAround = 0x809B9C9C; // type:func -EnButte_SetupFollowLink = 0x809BA080; // type:func -EnButte_FollowLink = 0x809BA0CC; // type:func -EnButte_SetupTransformIntoFairy = 0x809BA480; // type:func -EnButte_TransformIntoFairy = 0x809BA4D0; // type:func -EnButte_SetupWaitToDie = 0x809BA58C; // type:func -EnButte_WaitToDie = 0x809BA5AC; // type:func -EnButte_Update = 0x809BA5DC; // type:func -EnButte_Draw = 0x809BA71C; // type:func -EnBw_SetupAction = 0x809BAB40; // type:func -EnBw_Init = 0x809BAB4C; // type:func -EnBw_Destroy = 0x809BACAC; // type:func -func_809CE884 = 0x809BACEC; // type:func -func_809CE9A8 = 0x809BAE10; // type:func -func_809CEA24 = 0x809BAE8C; // type:func -func_809CF72C = 0x809BBB94; // type:func -func_809CF7AC = 0x809BBC14; // type:func -func_809CF8F0 = 0x809BBD58; // type:func -func_809CF984 = 0x809BBDEC; // type:func -func_809CFBA8 = 0x809BC014; // type:func -func_809CFC4C = 0x809BC0B8; // type:func -func_809CFF10 = 0x809BC37C; // type:func -func_809CFF98 = 0x809BC404; // type:func -func_809D00F4 = 0x809BC560; // type:func -func_809D014C = 0x809BC5B8; // type:func -func_809D01CC = 0x809BC638; // type:func -func_809D0268 = 0x809BC6D4; // type:func -func_809D03CC = 0x809BC838; // type:func -func_809D0424 = 0x809BC890; // type:func -func_809D0584 = 0x809BC9F0; // type:func -EnBw_Update = 0x809BCCFC; // type:func -EnBw_OverrideLimbDraw = 0x809BD18C; // type:func -EnBw_Draw = 0x809BD3A4; // type:func -EnBx_Init = 0x809BDED0; // type:func -EnBx_Destroy = 0x809BE0D8; // type:func -func_809D1D0C = 0x809BE104; // type:func -EnBx_Update = 0x809BE1D4; // type:func -EnBx_Draw = 0x809BE4F8; // type:func -EnChanger_Destroy = 0x809BE9D0; // type:func -EnChanger_Init = 0x809BE9E0; // type:func -EnChanger_Wait = 0x809BEEFC; // type:func -EnChanger_OpenChests = 0x809BEFA0; // type:func -EnChanger_SetHeartPieceFlag = 0x809BF150; // type:func -EnChanger_Update = 0x809BF1A0; // type:func -EnClearTag_CreateDebrisEffect = 0x809BF3B0; // type:func -EnClearTag_CreateFireEffect = 0x809BF4A8; // type:func -EnClearTag_CreateSmokeEffect = 0x809BF598; // type:func -EnClearTag_CreateFlashEffect = 0x809BF6BC; // type:func -EnClearTag_Destroy = 0x809BF794; // type:func -EnClearTag_Init = 0x809BF7C0; // type:func -EnClearTag_CalculateFloorTangent = 0x809BF984; // type:func -EnClearTag_Update = 0x809BFA40; // type:func -EnClearTag_Draw = 0x809C07F4; // type:func -EnClearTag_UpdateEffects = 0x809C0D88; // type:func -EnClearTag_DrawEffects = 0x809C1150; // type:func -EnCow_RotateY = 0x809CA950; // type:func -EnCow_SetColliderPos = 0x809CA9E8; // type:func -EnCow_SetTailPos = 0x809CAADC; // type:func -EnCow_Init = 0x809CAB58; // type:func -EnCow_Destroy = 0x809CAF90; // type:func -EnCow_UpdateAnimation = 0x809CAFDC; // type:func -EnCow_TalkEnd = 0x809CB204; // type:func -EnCow_GiveMilkEnd = 0x809CB27C; // type:func -EnCow_GiveMilkWait = 0x809CB2C4; // type:func -EnCow_GiveMilk = 0x809CB328; // type:func -EnCow_CheckForEmptyBottle = 0x809CB3C4; // type:func -EnCow_Talk = 0x809CB454; // type:func -EnCow_Idle = 0x809CB4C8; // type:func -EnCow_IdleTail = 0x809CB5E4; // type:func -EnCow_Update = 0x809CB77C; // type:func -EnCow_UpdateTail = 0x809CB9F8; // type:func -EnCow_OverrideLimbDraw = 0x809CBAE4; // type:func -EnCow_PostLimbDraw = 0x809CBB34; // type:func -EnCow_Draw = 0x809CBB74; // type:func -EnCow_DrawTail = 0x809CBBD4; // type:func -EnCrow_Init = 0x809CBDB0; // type:func -EnCrow_Destroy = 0x809CBEA0; // type:func -EnCrow_SetupFlyIdle = 0x809CBECC; // type:func -EnCrow_SetupDiveAttack = 0x809CBF00; // type:func -EnCrow_SetupDamaged = 0x809CBF34; // type:func -EnCrow_SetupDie = 0x809CC254; // type:func -EnCrow_SetupTurnAway = 0x809CC26C; // type:func -EnCrow_SetupRespawn = 0x809CC2F4; // type:func -EnCrow_FlyIdle = 0x809CC3E8; // type:func -EnCrow_DiveAttack = 0x809CC814; // type:func -EnCrow_Damaged = 0x809CC9B8; // type:func -EnCrow_Die = 0x809CCAE0; // type:func -EnCrow_TurnAway = 0x809CCB90; // type:func -EnCrow_Respawn = 0x809CCC34; // type:func -EnCrow_UpdateDamage = 0x809CCD00; // type:func -EnCrow_Update = 0x809CCDB0; // type:func -EnCrow_OverrideLimbDraw = 0x809CCFCC; // type:func -EnCrow_PostLimbDraw = 0x809CD0B8; // type:func -EnCrow_Draw = 0x809CD178; // type:func -EnCs_ChangeAnim = 0x809CD450; // type:func -EnCs_Init = 0x809CD574; // type:func -EnCs_Destroy = 0x809CD708; // type:func -EnCs_GetTalkState = 0x809CD734; // type:func -EnCs_GetTextID = 0x809CD868; // type:func -EnCs_HandleTalking = 0x809CD8EC; // type:func -EnCs_GetwaypointCount = 0x809CDA38; // type:func -EnCs_GetPathPoint = 0x809CDA4C; // type:func -EnCs_HandleWalking = 0x809CDAE0; // type:func -EnCs_Walk = 0x809CDCF8; // type:func -EnCs_Wait = 0x809CDE98; // type:func -EnCs_Talk = 0x809CDF24; // type:func -EnCs_Update = 0x809CDFE8; // type:func -EnCs_Draw = 0x809CE158; // type:func -EnCs_OverrideLimbDraw = 0x809CE30C; // type:func -EnCs_PostLimbDraw = 0x809CE39C; // type:func -EnDaiku_ChangeAnim = 0x809CE680; // type:func -EnDaiku_Init = 0x809CE734; // type:func -EnDaiku_Destroy = 0x809CEA7C; // type:func -EnDaiku_UpdateTalking = 0x809CEAA8; // type:func -EnDaiku_UpdateText = 0x809CEBC4; // type:func -EnDaiku_TentIdle = 0x809CEE94; // type:func -EnDaiku_Jailed = 0x809CEECC; // type:func -EnDaiku_WaitFreedom = 0x809CEF9C; // type:func -EnDaiku_InitEscape = 0x809CF000; // type:func -EnDaiku_EscapeRotate = 0x809CF208; // type:func -EnDaiku_InitSubCamera = 0x809CF274; // type:func -EnDaiku_UpdateSubCamera = 0x809CF400; // type:func -EnDaiku_EscapeSuccess = 0x809CF4B8; // type:func -EnDaiku_EscapeRun = 0x809CF5F4; // type:func -EnDaiku_Update = 0x809CF800; // type:func -EnDaiku_Draw = 0x809CF918; // type:func -EnDaiku_OverrideLimbDraw = 0x809CFA40; // type:func -EnDaiku_PostLimbDraw = 0x809CFAC4; // type:func -EnDaikuKakariko_ChangeAnim = 0x809CFDC0; // type:func -EnDaikuKakariko_Init = 0x809CFE74; // type:func -EnDaikuKakariko_Destroy = 0x809D01CC; // type:func -EnDaikuKakariko_GetTalkState = 0x809D01F8; // type:func -EnDaikuKakariko_HandleTalking = 0x809D029C; // type:func -EnDaikuKakariko_Talk = 0x809D0458; // type:func -EnDaikuKakariko_Wait = 0x809D052C; // type:func -EnDaikuKakariko_StopRunning = 0x809D05C8; // type:func -EnDaikuKakariko_Run = 0x809D0678; // type:func -EnDaikuKakariko_Update = 0x809D09F8; // type:func -EnDaikuKakariko_OverrideLimbDraw = 0x809D0B70; // type:func -EnDaikuKakariko_PostLimbDraw = 0x809D0D30; // type:func -EnDaikuKakariko_Draw = 0x809D0DAC; // type:func -EnDekubaba_Init = 0x809D1180; // type:func -EnDekubaba_Destroy = 0x809D13C4; // type:func -EnDekubaba_DisableHitboxes = 0x809D13F0; // type:func -EnDekubaba_SetupWait = 0x809D1478; // type:func -EnDekubaba_SetupGrow = 0x809D16E0; // type:func -EnDekubaba_SetupRetract = 0x809D1810; // type:func -EnDekubaba_SetupDecideLunge = 0x809D18F8; // type:func -EnDekubaba_SetupPrepareLunge = 0x809D1950; // type:func -EnDekubaba_SetupLunge = 0x809D1974; // type:func -EnDekubaba_SetupPullBack = 0x809D19B8; // type:func -EnDekubaba_SetupRecover = 0x809D1A30; // type:func -EnDekubaba_SetupHit = 0x809D1A64; // type:func -EnDekubaba_SetupPrunedSomersault = 0x809D1B2C; // type:func -EnDekubaba_SetupShrinkDie = 0x809D1BA0; // type:func -EnDekubaba_SetupStunnedVertical = 0x809D1C20; // type:func -EnDekubaba_SetupSway = 0x809D1DA4; // type:func -EnDekubaba_SetupDeadStickDrop = 0x809D1E10; // type:func -EnDekubaba_Wait = 0x809D1EB0; // type:func -EnDekubaba_Grow = 0x809D1F5C; // type:func -EnDekubaba_Retract = 0x809D23C4; // type:func -EnDekubaba_UpdateHeadPosition = 0x809D278C; // type:func -EnDekubaba_DecideLunge = 0x809D2890; // type:func -EnDekubaba_Lunge = 0x809D2AC0; // type:func -EnDekubaba_PrepareLunge = 0x809D2D48; // type:func -EnDekubaba_PullBack = 0x809D2E14; // type:func -EnDekubaba_Recover = 0x809D31A0; // type:func -EnDekubaba_Hit = 0x809D3298; // type:func -EnDekubaba_StunnedVertical = 0x809D33A8; // type:func -EnDekubaba_Sway = 0x809D3444; // type:func -EnDekubaba_PrunedSomersault = 0x809D356C; // type:func -EnDekubaba_ShrinkDie = 0x809D38D0; // type:func -EnDekubaba_DeadStickDrop = 0x809D3A94; // type:func -EnDekubaba_UpdateDamage = 0x809D3AFC; // type:func -EnDekubaba_Update = 0x809D3DB0; // type:func -EnDekubaba_DrawStemRetracted = 0x809D3F50; // type:func -EnDekubaba_DrawStemExtended = 0x809D4040; // type:func -EnDekubaba_DrawStemBasePruned = 0x809D4330; // type:func -EnDekubaba_DrawBaseShadow = 0x809D43F0; // type:func -EnDekubaba_PostLimbDraw = 0x809D44E4; // type:func -EnDekubaba_Draw = 0x809D4520; // type:func -EnDekunuts_Init = 0x809D4C30; // type:func -EnDekunuts_Destroy = 0x809D4D9C; // type:func -EnDekunuts_SetupWait = 0x809D4DD8; // type:func -EnDekunuts_SetupLookAround = 0x809D4E4C; // type:func -EnDekunuts_SetupThrowNut = 0x809D4E94; // type:func -EnDekunuts_SetupStand = 0x809D4ED8; // type:func -EnDekunuts_SetupBurrow = 0x809D4F40; // type:func -EnDekunuts_SetupBeginRun = 0x809D4F90; // type:func -EnDekunuts_SetupRun = 0x809D4FF8; // type:func -EnDekunuts_SetupGasp = 0x809D5050; // type:func -EnDekunuts_SetupBeDamaged = 0x809D50B0; // type:func -EnDekunuts_SetupBeStunned = 0x809D518C; // type:func -EnDekunuts_SetupDie = 0x809D5220; // type:func -EnDekunuts_Wait = 0x809D5270; // type:func -EnDekunuts_LookAround = 0x809D54D4; // type:func -EnDekunuts_Stand = 0x809D5558; // type:func -EnDekunuts_ThrowNut = 0x809D5644; // type:func -EnDekunuts_Burrow = 0x809D579C; // type:func -EnDekunuts_BeginRun = 0x809D58B0; // type:func -EnDekunuts_Run = 0x809D5918; // type:func -EnDekunuts_Gasp = 0x809D5B58; // type:func -EnDekunuts_BeDamaged = 0x809D5BC0; // type:func -EnDekunuts_BeStunned = 0x809D5C10; // type:func -EnDekunuts_Die = 0x809D5C8C; // type:func -EnDekunuts_ColliderCheck = 0x809D5DE8; // type:func -EnDekunuts_Update = 0x809D5F0C; // type:func -EnDekunuts_OverrideLimbDraw = 0x809D6074; // type:func -EnDekunuts_Draw = 0x809D61A8; // type:func -EnDh_SetupAction = 0x809D6430; // type:func -EnDh_Init = 0x809D643C; // type:func -EnDh_Destroy = 0x809D6578; // type:func -EnDh_SpawnDebris = 0x809D65C0; // type:func -EnDh_SetupWait = 0x809D6758; // type:func -EnDh_Wait = 0x809D680C; // type:func -EnDh_SetupWalk = 0x809D6A30; // type:func -EnDh_Walk = 0x809D6ACC; // type:func -EnDh_SetupRetreat = 0x809D6BD4; // type:func -EnDh_Retreat = 0x809D6C38; // type:func -EnDh_SetupAttack = 0x809D6CC4; // type:func -EnDh_Attack = 0x809D6D24; // type:func -EnDh_SetupBurrow = 0x809D7034; // type:func -EnDh_Burrow = 0x809D70B8; // type:func -EnDh_SetupDamage = 0x809D7248; // type:func -EnDh_Damage = 0x809D72C8; // type:func -EnDh_SetupDeath = 0x809D73F0; // type:func -EnDh_Death = 0x809D7478; // type:func -EnDh_CollisionCheck = 0x809D75A8; // type:func -EnDh_Update = 0x809D76F8; // type:func -EnDh_PostLimbDraw = 0x809D78A8; // type:func -EnDh_Draw = 0x809D7938; // type:func -EnDha_SetupAction = 0x809D7F10; // type:func -EnDha_Init = 0x809D7F1C; // type:func -EnDha_Destroy = 0x809D8038; // type:func -EnDha_SetupWait = 0x809D8064; // type:func -EnDha_Wait = 0x809D80EC; // type:func -EnDha_SetupTakeDamage = 0x809D85FC; // type:func -EnDha_TakeDamage = 0x809D8628; // type:func -EnDha_SetupDeath = 0x809D86F0; // type:func -EnDha_Die = 0x809D8760; // type:func -EnDha_UpdateHealth = 0x809D891C; // type:func -EnDha_Update = 0x809D8A10; // type:func -EnDha_OverrideLimbDraw = 0x809D8AB8; // type:func -EnDha_PostLimbDraw = 0x809D8B58; // type:func -EnDha_Draw = 0x809D8C70; // type:func -EnDivingGame_Init = 0x809D8F10; // type:func -EnDivingGame_Destroy = 0x809D902C; // type:func -EnDivingGame_SpawnRuppy = 0x809D906C; // type:func -EnDivingGame_HasMinigameFinished = 0x809D9198; // type:func -func_809EDCB0 = 0x809D9344; // type:func -EnDivingGame_Talk = 0x809D93E0; // type:func -EnDivingGame_HandlePlayChoice = 0x809D9570; // type:func -func_809EE048 = 0x809D96DC; // type:func -func_809EE0FC = 0x809D9790; // type:func -func_809EE194 = 0x809D9828; // type:func -EnDivingGame_SetupRupeeThrow = 0x809D9888; // type:func -EnDivingGame_RupeeThrow = 0x809D9A9C; // type:func -EnDivingGame_SetupUnderwaterViewCs = 0x809D9D5C; // type:func -func_809EE780 = 0x809D9E14; // type:func -func_809EE800 = 0x809D9E94; // type:func -func_809EE8F0 = 0x809D9F84; // type:func -func_809EE96C = 0x809DA004; // type:func -func_809EEA00 = 0x809DA098; // type:func -func_809EEA90 = 0x809DA128; // type:func -func_809EEAF8 = 0x809DA194; // type:func -EnDivingGame_Update = 0x809DA224; // type:func -EnDivingGame_EmptyDList = 0x809DA450; // type:func -EnDivingGame_OverrideLimbDraw = 0x809DA474; // type:func -EnDivingGame_Draw = 0x809DA5D4; // type:func -EnDns_Init = 0x809DA8C0; // type:func -EnDns_Destroy = 0x809DAA34; // type:func -EnDns_ChangeAnim = 0x809DAA60; // type:func -EnDns_CanBuyDekuNuts = 0x809DAAE8; // type:func -EnDns_CanBuyDekuSticks = 0x809DABA0; // type:func -EnDns_CanBuyPrice = 0x809DAC58; // type:func -EnDns_CanBuyDekuSeeds = 0x809DAC88; // type:func -EnDns_CanBuyDekuShield = 0x809DAD50; // type:func -EnDns_CanBuyBombs = 0x809DADA4; // type:func -EnDns_CanBuyArrows = 0x809DAE44; // type:func -EnDns_CanBuyBottle = 0x809DAEF4; // type:func -EnDns_PayPrice = 0x809DAF4C; // type:func -EnDns_PayForDekuNuts = 0x809DAF80; // type:func -EnDns_PayForHeartPiece = 0x809DAFB4; // type:func -EnDns_PayForBombs = 0x809DAFFC; // type:func -EnDns_PayForArrows = 0x809DB030; // type:func -EnDns_PayForDekuStickUpgrade = 0x809DB064; // type:func -EnDns_PayForDekuNutUpgrade = 0x809DB0AC; // type:func -EnDns_SetupIdle = 0x809DB0F4; // type:func -EnDns_Idle = 0x809DB138; // type:func -EnDns_Talk = 0x809DB20C; // type:func -EnDns_OfferSaleItem = 0x809DB344; // type:func -EnDns_SetupSale = 0x809DB45C; // type:func -EnDns_Sale = 0x809DB4C8; // type:func -EnDns_SetupBurrow = 0x809DB514; // type:func -EnDns_SetupNoSaleBurrow = 0x809DB608; // type:func -EnDns_Burrow = 0x809DB680; // type:func -EnDns_PostBurrow = 0x809DB6FC; // type:func -EnDns_Update = 0x809DB800; // type:func -EnDns_Draw = 0x809DB8F0; // type:func -EnDntDemo_Destroy = 0x809DBC50; // type:func -EnDntDemo_Init = 0x809DBC60; // type:func -EnDntDemo_Judge = 0x809DBDD0; // type:func -EnDntDemo_Results = 0x809DC3F0; // type:func -EnDntDemo_Prize = 0x809DC664; // type:func -EnDntDemo_Update = 0x809DC740; // type:func -EnDntJiji_Init = 0x809DC970; // type:func -EnDntJiji_Destroy = 0x809DCA50; // type:func -EnDntJiji_SetFlower = 0x809DCA7C; // type:func -EnDntJiji_SetupWait = 0x809DCABC; // type:func -EnDntJiji_Wait = 0x809DCB6C; // type:func -EnDntJiji_SetupUp = 0x809DCC24; // type:func -EnDntJiji_Up = 0x809DCD08; // type:func -EnDntJiji_SetupUnburrow = 0x809DCD78; // type:func -EnDntJiji_Unburrow = 0x809DCE5C; // type:func -EnDntJiji_SetupWalk = 0x809DCEE4; // type:func -EnDntJiji_Walk = 0x809DCF94; // type:func -EnDntJiji_SetupBurrow = 0x809DD0D0; // type:func -EnDntJiji_Burrow = 0x809DD1C0; // type:func -EnDntJiji_SetupCower = 0x809DD1EC; // type:func -EnDntJiji_Cower = 0x809DD32C; // type:func -EnDntJiji_SetupTalk = 0x809DD3D0; // type:func -EnDntJiji_Talk = 0x809DD464; // type:func -EnDntJiji_SetupGivePrize = 0x809DD530; // type:func -EnDntJiji_GivePrize = 0x809DD5A0; // type:func -EnDntJiji_SetupHide = 0x809DD6B0; // type:func -EnDntJiji_Hide = 0x809DD748; // type:func -EnDntJiji_SetupReturn = 0x809DD7B4; // type:func -EnDntJiji_Return = 0x809DD864; // type:func -EnDntJiji_Update = 0x809DD9DC; // type:func -EnDntJiji_Draw = 0x809DDBB4; // type:func -EnDntNomal_Init = 0x809DDE90; // type:func -EnDntNomal_Destroy = 0x809DDFB8; // type:func -EnDntNomal_WaitForObject = 0x809DE004; // type:func -EnDntNomal_SetFlower = 0x809DE154; // type:func -EnDntNomal_SetupTargetWait = 0x809DE1AC; // type:func -EnDntNomal_TargetWait = 0x809DE254; // type:func -EnDntNomal_SetupTargetUnburrow = 0x809DE530; // type:func -EnDntNomal_TargetUnburrow = 0x809DE64C; // type:func -EnDntNomal_SetupTargetWalk = 0x809DE6B8; // type:func -EnDntNomal_TargetWalk = 0x809DE75C; // type:func -EnDntNomal_TargetFacePlayer = 0x809DE848; // type:func -EnDntNomal_SetupTargetTalk = 0x809DE8FC; // type:func -EnDntNomal_TargetTalk = 0x809DE9A8; // type:func -EnDntNomal_SetupTargetGivePrize = 0x809DEA50; // type:func -EnDntNomal_TargetGivePrize = 0x809DEAE8; // type:func -EnDntNomal_TargetReturn = 0x809DEC50; // type:func -EnDntNomal_TargetBurrow = 0x809DEE20; // type:func -EnDntNomal_SetupStageWait = 0x809DEE8C; // type:func -EnDntNomal_StageWait = 0x809DEF44; // type:func -EnDntNomal_SetupStageUp = 0x809DEF70; // type:func -EnDntNomal_StageUp = 0x809DF07C; // type:func -EnDntNomal_SetupStageUnburrow = 0x809DF2B0; // type:func -EnDntNomal_StageUnburrow = 0x809DF3A4; // type:func -EnDntNomal_SetupStageCelebrate = 0x809DF47C; // type:func -EnDntNomal_StageCelebrate = 0x809DF524; // type:func -EnDntNomal_SetupStageDance = 0x809DF72C; // type:func -EnDntNomal_StageDance = 0x809DF83C; // type:func -EnDntNomal_SetupStageHide = 0x809DF9A0; // type:func -EnDntNomal_StageHide = 0x809DFA7C; // type:func -EnDntNomal_StageAttackHide = 0x809DFC40; // type:func -EnDntNomal_SetupStageAttack = 0x809DFC74; // type:func -EnDntNomal_StageAttack = 0x809DFD40; // type:func -EnDntNomal_StageSetupReturn = 0x809E0004; // type:func -EnDntNomal_StageReturn = 0x809E00A8; // type:func -EnDntNomal_Update = 0x809E01AC; // type:func -EnDntNomal_OverrideLimbDraw = 0x809E0470; // type:func -EnDntNomal_PostLimbDraw = 0x809E0520; // type:func -EnDntNomal_DrawStageScrub = 0x809E05A8; // type:func -EnDntNomal_DrawTargetScrub = 0x809E0798; // type:func -EnDodojr_Init = 0x809E0C90; // type:func -EnDodojr_Destroy = 0x809E0D78; // type:func -EnDodojr_DoSwallowedBombEffects = 0x809E0DA4; // type:func -EnDodojr_SpawnLargeDust = 0x809E0DE8; // type:func -EnDodojr_SpawnSmallDust = 0x809E1008; // type:func -EnDodojr_UpdateBounces = 0x809E1188; // type:func -EnDodojr_SetupCrawlTowardsTarget = 0x809E126C; // type:func -EnDodojr_SetupFlipBounce = 0x809E12F4; // type:func -EnDodojr_SetupSwallowedBombDeathSequence = 0x809E1398; // type:func -EnDodojr_SetupJumpAttackBounce = 0x809E1408; // type:func -EnDodojr_SetupDespawn = 0x809E148C; // type:func -EnDodojr_SetupEatBomb = 0x809E14F8; // type:func -EnDodojr_CheckNearbyBombs = 0x809E1574; // type:func -EnDodojr_TryEatBomb = 0x809E16A0; // type:func -EnDodojr_UpdateCrawl = 0x809E1724; // type:func -EnDodojr_IsPlayerWithinAttackRange = 0x809E1938; // type:func -EnDodojr_SetupStandardDeathBounce = 0x809E1968; // type:func -EnDodojr_CheckDamaged = 0x809E19B4; // type:func -EnDodojr_UpdateCollider = 0x809E1B70; // type:func -EnDodojr_WaitUnderground = 0x809E1C80; // type:func -EnDodojr_EmergeFromGround = 0x809E1D98; // type:func -EnDodojr_CrawlTowardsTarget = 0x809E1E60; // type:func -EnDodojr_EatBomb = 0x809E1F64; // type:func -EnDodojr_SwallowBomb = 0x809E2014; // type:func -EnDodojr_SwallowedBombDeathBounce = 0x809E2084; // type:func -EnDodojr_SwallowedBombDeathSequence = 0x809E2124; // type:func -EnDodojr_StunnedBounce = 0x809E2144; // type:func -EnDodojr_Stunned = 0x809E21C4; // type:func -EnDodojr_JumpAttackBounce = 0x809E2274; // type:func -EnDodojr_Despawn = 0x809E22DC; // type:func -EnDodojr_StandardDeathBounce = 0x809E2394; // type:func -EnDodojr_DeathSequence = 0x809E241C; // type:func -EnDodojr_DropItem = 0x809E24C8; // type:func -EnDodojr_WaitFreezeFrames = 0x809E252C; // type:func -EnDodojr_Update = 0x809E2574; // type:func -EnDodojr_OverrideLimbDraw = 0x809E2634; // type:func -EnDodojr_PostLimbDraw = 0x809E26E0; // type:func -EnDodojr_Draw = 0x809E26F8; // type:func -EnDodongo_SetupAction = 0x809E2B30; // type:func -EnDodongo_SpawnBombSmoke = 0x809E2B3C; // type:func -EnDodongo_Init = 0x809E302C; // type:func -EnDodongo_Destroy = 0x809E3254; // type:func -EnDodongo_SetupIdle = 0x809E32B4; // type:func -EnDodongo_SetupWalk = 0x809E331C; // type:func -EnDodongo_SetupBreatheFire = 0x809E33C0; // type:func -EnDodongo_SetupEndBreatheFire = 0x809E3414; // type:func -EnDodongo_SetupSwallowBomb = 0x809E3464; // type:func -EnDodongo_SetupStunned = 0x809E34E4; // type:func -EnDodongo_Idle = 0x809E357C; // type:func -EnDodongo_EndBreatheFire = 0x809E35F4; // type:func -EnDodongo_BreatheFire = 0x809E3644; // type:func -EnDodongo_SwallowBomb = 0x809E381C; // type:func -EnDodongo_Walk = 0x809E3D14; // type:func -EnDodongo_SetupSweepTail = 0x809E4054; // type:func -EnDodongo_SweepTail = 0x809E40B4; // type:func -EnDodongo_SetupDeath = 0x809E4378; // type:func -EnDodongo_Death = 0x809E43F0; // type:func -EnDodongo_Stunned = 0x809E453C; // type:func -EnDodongo_CollisionCheck = 0x809E45A0; // type:func -EnDodongo_UpdateQuad = 0x809E46C8; // type:func -EnDodongo_Update = 0x809E4834; // type:func -EnDodongo_OverrideLimbDraw = 0x809E4A00; // type:func -EnDodongo_PostLimbDraw = 0x809E4A54; // type:func -EnDodongo_Draw = 0x809E4E90; // type:func -EnDodongo_ShiftVecRadial = 0x809E4F80; // type:func -EnDodongo_AteBomb = 0x809E4FE0; // type:func -EnDog_PlayWalkSFX = 0x809E58D0; // type:func -EnDog_PlayRunSFX = 0x809E5938; // type:func -EnDog_PlayBarkSFX = 0x809E59A0; // type:func -EnDog_PlayAnimAndSFX = 0x809E5A08; // type:func -EnDog_CanFollow = 0x809E5BA0; // type:func -EnDog_UpdateWaypoint = 0x809E5C24; // type:func -EnDog_Orient = 0x809E5CB0; // type:func -EnDog_Init = 0x809E5D54; // type:func -EnDog_Destroy = 0x809E5FA4; // type:func -EnDog_FollowPath = 0x809E5FD0; // type:func -EnDog_ChooseMovement = 0x809E6168; // type:func -EnDog_FollowPlayer = 0x809E6258; // type:func -EnDog_RunAway = 0x809E63D8; // type:func -EnDog_FaceLink = 0x809E647C; // type:func -EnDog_Wait = 0x809E6584; // type:func -EnDog_Update = 0x809E65DC; // type:func -EnDog_OverrideLimbDraw = 0x809E66A8; // type:func -EnDog_PostLimbDraw = 0x809E66C4; // type:func -EnDog_Draw = 0x809E66DC; // type:func -EnDoor_Init = 0x809E6A80; // type:func -EnDoor_Destroy = 0x809E6C9C; // type:func -EnDoor_SetupType = 0x809E6CD0; // type:func -EnDoor_Idle = 0x809E6E88; // type:func -EnDoor_WaitForCheck = 0x809E7140; // type:func -EnDoor_Check = 0x809E718C; // type:func -EnDoor_AjarWait = 0x809E71C4; // type:func -EnDoor_AjarOpen = 0x809E71F8; // type:func -EnDoor_AjarClose = 0x809E7268; // type:func -EnDoor_Open = 0x809E72B0; // type:func -EnDoor_Update = 0x809E7504; // type:func -EnDoor_OverrideLimbDraw = 0x809E7528; // type:func -EnDoor_Draw = 0x809E765C; // type:func -EnDs_Init = 0x809E78C0; // type:func -EnDs_Destroy = 0x809E7990; // type:func -EnDs_Talk = 0x809E79A0; // type:func -EnDs_TalkNoEmptyBottle = 0x809E79F0; // type:func -EnDs_TalkAfterGiveOddPotion = 0x809E7A5C; // type:func -EnDs_DisplayOddPotionText = 0x809E7AB8; // type:func -EnDs_GiveOddPotion = 0x809E7B18; // type:func -EnDs_TalkAfterBrewOddPotion = 0x809E7B84; // type:func -EnDs_BrewOddPotion3 = 0x809E7C04; // type:func -EnDs_BrewOddPotion2 = 0x809E7CA8; // type:func -EnDs_BrewOddPotion1 = 0x809E7CFC; // type:func -EnDs_OfferOddPotion = 0x809E7D9C; // type:func -EnDs_CheckRupeesAndBottle = 0x809E7E68; // type:func -EnDs_GiveBluePotion = 0x809E7EB8; // type:func -EnDs_OfferBluePotion = 0x809E7F1C; // type:func -EnDs_Wait = 0x809E8054; // type:func -EnDs_Update = 0x809E81D8; // type:func -EnDs_OverrideLimbDraw = 0x809E82E0; // type:func -EnDs_PostLimbDraw = 0x809E8328; // type:func -EnDs_Draw = 0x809E8368; // type:func -EnDu_SetupAction = 0x809E84E0; // type:func -EnDu_GetTextId = 0x809E84EC; // type:func -EnDu_UpdateTalkState = 0x809E8590; // type:func -func_809FDDB4 = 0x809E866C; // type:func -func_809FDE24 = 0x809E86DC; // type:func -func_809FDE9C = 0x809E8754; // type:func -func_809FDFC0 = 0x809E8878; // type:func -func_809FE000 = 0x809E88BC; // type:func -func_809FE040 = 0x809E8900; // type:func -func_809FE104 = 0x809E89C4; // type:func -EnDu_Init = 0x809E8A6C; // type:func -EnDu_Destroy = 0x809E8C3C; // type:func -func_809FE3B4 = 0x809E8C7C; // type:func -func_809FE3C0 = 0x809E8C8C; // type:func -func_809FE4A4 = 0x809E8D74; // type:func -func_809FE638 = 0x809E8F0C; // type:func -func_809FE6CC = 0x809E8FA4; // type:func -func_809FE740 = 0x809E9018; // type:func -func_809FE798 = 0x809E9070; // type:func -func_809FE890 = 0x809E9168; // type:func -func_809FEB08 = 0x809E93E4; // type:func -func_809FEC14 = 0x809E94F0; // type:func -func_809FEC70 = 0x809E954C; // type:func -func_809FECE4 = 0x809E95C4; // type:func -EnDu_Update = 0x809E95FC; // type:func -EnDu_OverrideLimbDraw = 0x809E9788; // type:func -EnDu_PostLimbDraw = 0x809E9904; // type:func -EnDu_Draw = 0x809E9960; // type:func -EnDyExtra_Destroy = 0x809E9F70; // type:func -EnDyExtra_Init = 0x809E9F80; // type:func -EnDyExtra_WaitForTrigger = 0x809E9FF4; // type:func -EnDyExtra_FallAndKill = 0x809EA088; // type:func -EnDyExtra_Update = 0x809EA140; // type:func -EnDyExtra_Draw = 0x809EA1AC; // type:func -EnEg_PlayVoidOutSFX = 0x809EA510; // type:func -EnEg_Destroy = 0x809EA530; // type:func -EnEg_Init = 0x809EA540; // type:func -func_809FFDC8 = 0x809EA550; // type:func -EnEg_Update = 0x809EA5E8; // type:func -EnEg_Draw = 0x809EA630; // type:func -EnEiyer_Init = 0x809EA6C0; // type:func -EnEiyer_Destroy = 0x809EA8A0; // type:func -EnEiyer_RotateAroundHome = 0x809EA8CC; // type:func -EnEiyer_SetupAppearFromGround = 0x809EA93C; // type:func -EnEiyer_SetupUnderground = 0x809EAA7C; // type:func -EnEiyer_SetupInactive = 0x809EAADC; // type:func -EnEiyer_SetupAmbush = 0x809EAB08; // type:func -EnEiyer_SetupGlide = 0x809EABE8; // type:func -EnEiyer_SetupStartAttack = 0x809EAC64; // type:func -EnEiyer_SetupDiveAttack = 0x809EAC78; // type:func -EnEiyer_SetupLand = 0x809EACC0; // type:func -EnEiyer_SetupHurt = 0x809EAD38; // type:func -EnEiyer_SetupDie = 0x809EADE8; // type:func -EnEiyer_SetupDead = 0x809EAEA8; // type:func -EnEiyer_SetupStunned = 0x809EAED4; // type:func -EnEiyer_AppearFromGround = 0x809EAF98; // type:func -EnEiyer_CheckPlayerCollision = 0x809EAFE8; // type:func -EnEiyer_CircleUnderground = 0x809EB018; // type:func -EnEiyer_WanderUnderground = 0x809EB094; // type:func -EnEiyer_Inactive = 0x809EB1C8; // type:func -EnEiyer_Ambush = 0x809EB25C; // type:func -EnEiyer_Glide = 0x809EB3B4; // type:func -EnEiyer_StartAttack = 0x809EB5D0; // type:func -EnEiyer_DiveAttack = 0x809EB6CC; // type:func -EnEiyer_Land = 0x809EB758; // type:func -EnEiyer_Hurt = 0x809EB84C; // type:func -EnEiyer_Die = 0x809EB984; // type:func -EnEiyer_Dead = 0x809EBA38; // type:func -EnEiyer_Stunned = 0x809EBAB8; // type:func -EnEiyer_UpdateDamage = 0x809EBB70; // type:func -EnEiyer_Update = 0x809EBCB8; // type:func -EnEiyer_OverrideLimbDraw = 0x809EBEDC; // type:func -EnEiyer_Draw = 0x809EBF30; // type:func -EnElf_SetupAction = 0x809EC320; // type:func -func_80A01C38 = 0x809EC32C; // type:func -func_80A01F90 = 0x809EC684; // type:func -func_80A01FE0 = 0x809EC6D8; // type:func -func_80A020A4 = 0x809EC7A0; // type:func -func_80A0214C = 0x809EC84C; // type:func -func_80A0232C = 0x809ECA2C; // type:func -EnElf_GetColorValue = 0x809ECAA4; // type:func -EnElf_Init = 0x809ECB14; // type:func -func_80A0299C = 0x809ED080; // type:func -func_80A029A8 = 0x809ED090; // type:func -EnElf_Destroy = 0x809ED0B8; // type:func -func_80A02A20 = 0x809ED108; // type:func -func_80A02AA4 = 0x809ED18C; // type:func -func_80A02B38 = 0x809ED220; // type:func -func_80A02BD8 = 0x809ED2BC; // type:func -func_80A02C98 = 0x809ED37C; // type:func -func_80A02E30 = 0x809ED514; // type:func -func_80A02EC0 = 0x809ED5A0; // type:func -func_80A02F2C = 0x809ED60C; // type:func -func_80A03018 = 0x809ED6F8; // type:func -func_80A03148 = 0x809ED82C; // type:func -func_80A0329C = 0x809ED984; // type:func -func_80A0353C = 0x809EDC28; // type:func -func_80A03604 = 0x809EDCF0; // type:func -func_80A03610 = 0x809EDD00; // type:func -func_80A03814 = 0x809EDF08; // type:func -func_80A03990 = 0x809EE088; // type:func -func_80A03AB0 = 0x809EE1AC; // type:func -EnElf_UpdateLights = 0x809EE210; // type:func -func_80A03CF8 = 0x809EE3E4; // type:func -EnElf_ChangeColor = 0x809EEA7C; // type:func -func_80A04414 = 0x809EEB08; // type:func -func_80A0461C = 0x809EED14; // type:func -EnElf_SpawnSparkles = 0x809EF0B0; // type:func -func_80A04D90 = 0x809EF490; // type:func -func_80A04DE4 = 0x809EF4E4; // type:func -func_80A04F94 = 0x809EF698; // type:func -func_80A05040 = 0x809EF748; // type:func -func_80A05114 = 0x809EF824; // type:func -func_80A05188 = 0x809EF8A0; // type:func -func_80A05208 = 0x809EF928; // type:func -func_80A052F4 = 0x809EFA1C; // type:func -func_80A053F0 = 0x809EFB20; // type:func -EnElf_Update = 0x809EFD9C; // type:func -EnElf_OverrideLimbDraw = 0x809EFDF8; // type:func -EnElf_Draw = 0x809EFF1C; // type:func -EnElf_GetCuePos = 0x809F0594; // type:func -EnEncount1_Init = 0x809F0CE0; // type:func -EnEncount1_SpawnLeevers = 0x809F0E14; // type:func -EnEncount1_SpawnTektites = 0x809F1170; // type:func -EnEncount1_SpawnStalchildOrWolfos = 0x809F1308; // type:func -EnEncount1_Update = 0x809F175C; // type:func -EnEncount2_Init = 0x809F1840; // type:func -EnEncount2_Wait = 0x809F18B4; // type:func -EnEncount2_SpawnRocks = 0x809F1B0C; // type:func -EnEncount2_Update = 0x809F20D4; // type:func -EnEncount2_Draw = 0x809F24A0; // type:func -EnEncount2_SpawnEffect = 0x809F24C0; // type:func -EnEncount2_UpdateEffects = 0x809F2574; // type:func -EnEncount2_DrawEffects = 0x809F2748; // type:func -EnExItem_Destroy = 0x809F2A70; // type:func -EnExItem_Init = 0x809F2A80; // type:func -EnExItem_WaitForObject = 0x809F2BDC; // type:func -EnExItem_BowlPrize = 0x809F2F58; // type:func -EnExItem_SetupBowlCounter = 0x809F3144; // type:func -EnExItem_BowlCounter = 0x809F316C; // type:func -EnExItem_ExitChest = 0x809F31A4; // type:func -EnExItem_FairyMagic = 0x809F320C; // type:func -EnExItem_TargetPrizeApproach = 0x809F3224; // type:func -EnExItem_TargetPrizeGive = 0x809F3478; // type:func -EnExItem_TargetPrizeFinish = 0x809F3504; // type:func -EnExItem_Update = 0x809F3564; // type:func -EnExItem_Draw = 0x809F35B8; // type:func -EnExItem_DrawItems = 0x809F3668; // type:func -EnExItem_DrawHeartPiece = 0x809F36CC; // type:func -EnExItem_DrawMagic = 0x809F3700; // type:func -EnExItem_DrawKey = 0x809F3748; // type:func -EnExItem_DrawRupee = 0x809F3838; // type:func -EnExRuppy_Init = 0x809F3BF0; // type:func -EnExRuppy_Destroy = 0x809F3FC8; // type:func -EnExRuppy_SpawnSparkles = 0x809F3FD8; // type:func -EnExRuppy_DropIntoWater = 0x809F41F4; // type:func -EnExRuppy_EnterWater = 0x809F42D4; // type:func -EnExRuppy_Sink = 0x809F4440; // type:func -EnExRuppy_WaitInGame = 0x809F4540; // type:func -EnExRuppy_Kill = 0x809F4698; // type:func -EnExRuppy_WaitToBlowUp = 0x809F46DC; // type:func -EnExRuppy_WaitAsCollectible = 0x809F4808; // type:func -EnExRuppy_GalleryTarget = 0x809F488C; // type:func -EnExRuppy_Update = 0x809F48EC; // type:func -EnExRuppy_Draw = 0x809F4978; // type:func -EnFd_SpawnCore = 0x809F4CB0; // type:func -EnFd_SpawnChildFire = 0x809F4DA8; // type:func -EnFd_SpawnDot = 0x809F4EC8; // type:func -EnFd_CheckHammer = 0x809F5034; // type:func -EnFd_ColliderCheck = 0x809F50D0; // type:func -EnFd_CanSeeActor = 0x809F5268; // type:func -EnFd_FindBomb = 0x809F5378; // type:func -EnFd_FindPotentialTheat = 0x809F5438; // type:func -EnFd_GetPosAdjAroundCircle = 0x809F54AC; // type:func -EnFd_ShouldStopRunning = 0x809F5574; // type:func -EnFd_Fade = 0x809F56A8; // type:func -EnFd_Init = 0x809F57B8; // type:func -EnFd_Destroy = 0x809F58F4; // type:func -EnFd_Reappear = 0x809F5920; // type:func -EnFd_SpinAndGrow = 0x809F59B0; // type:func -EnFd_JumpToGround = 0x809F5A84; // type:func -EnFd_Land = 0x809F5B00; // type:func -EnFd_SpinAndSpawnFire = 0x809F5BE0; // type:func -EnFd_Run = 0x809F5E00; // type:func -EnFd_WaitForCore = 0x809F6060; // type:func -EnFd_Update = 0x809F60D8; // type:func -EnFd_OverrideLimbDraw = 0x809F62D4; // type:func -EnFd_PostLimbDraw = 0x809F6310; // type:func -EnFd_Draw = 0x809F663C; // type:func -EnFd_SpawnEffect = 0x809F69E8; // type:func -EnFd_UpdateEffectsFlames = 0x809F6AD8; // type:func -EnFd_UpdateEffectsDots = 0x809F6BF0; // type:func -EnFd_DrawEffectsFlames = 0x809F6D0C; // type:func -EnFd_DrawEffectsDots = 0x809F70E0; // type:func -EnFdFire_UpdatePos = 0x809F7950; // type:func -EnFdFire_CheckCollider = 0x809F7A18; // type:func -EnFdFire_Init = 0x809F7A7C; // type:func -EnFdFire_Destroy = 0x809F7B84; // type:func -func_80A0E70C = 0x809F7BB0; // type:func -EnFdFire_WaitToDie = 0x809F7CEC; // type:func -EnFdFire_DanceTowardsPlayer = 0x809F7D28; // type:func -EnFdFire_Disappear = 0x809F7ED8; // type:func -EnFdFire_Update = 0x809F7F8C; // type:func -EnFdFire_Draw = 0x809F8088; // type:func -EnFhgFire_SetUpdate = 0x809F8660; // type:func -EnFhgFire_Init = 0x809F866C; // type:func -EnFhgFire_Destroy = 0x809F8A7C; // type:func -EnFhgFire_LightningStrike = 0x809F8AEC; // type:func -EnFhgFire_LightningTrail = 0x809F8E84; // type:func -EnFhgFire_LightningShock = 0x809F9024; // type:func -EnFhgFire_LightningBurst = 0x809F9168; // type:func -EnFhgFire_SpearLight = 0x809F93E4; // type:func -EnFhgFire_EnergyBall = 0x809F95D8; // type:func -EnFhgFire_PhantomWarp = 0x809FA284; // type:func -EnFhgFire_Update = 0x809FA440; // type:func -EnFhgFire_Draw = 0x809FA490; // type:func -EnFireRock_Init = 0x809FAD00; // type:func -EnFireRock_Destroy = 0x809FB0F0; // type:func -EnFireRock_Fall = 0x809FB154; // type:func -EnFireRock_SpawnMoreBrokenPieces = 0x809FB4A8; // type:func -FireRock_WaitSpawnRocksFromCeiling = 0x809FB628; // type:func -FireRock_WaitOnFloor = 0x809FB718; // type:func -EnFireRock_Update = 0x809FB7FC; // type:func -EnFireRock_Draw = 0x809FBAA8; // type:func -EnFirefly_Extinguish = 0x809FBE10; // type:func -EnFirefly_Ignite = 0x809FBE3C; // type:func -EnFirefly_Init = 0x809FBE7C; // type:func -EnFirefly_Destroy = 0x809FC074; // type:func -EnFirefly_SetupFlyIdle = 0x809FC0A0; // type:func -EnFirefly_SetupFall = 0x809FC14C; // type:func -EnFirefly_SetupDie = 0x809FC1F0; // type:func -EnFirefly_SetupRebound = 0x809FC214; // type:func -EnFirefly_SetupDiveAttack = 0x809FC250; // type:func -EnFirefly_SetupFlyAway = 0x809FC2C0; // type:func -EnFirefly_SetupStunned = 0x809FC2F0; // type:func -EnFirefly_SetupFrozenFall = 0x809FC360; // type:func -EnFirefly_SetupPerch = 0x809FC500; // type:func -EnFirefly_SetupDisturbDiveAttack = 0x809FC524; // type:func -EnFirefly_ReturnToPerch = 0x809FC560; // type:func -EnFirefly_SeekTorch = 0x809FC67C; // type:func -EnFirefly_FlyIdle = 0x809FC7CC; // type:func -EnFirefly_Fall = 0x809FCA5C; // type:func -EnFirefly_Die = 0x809FCB2C; // type:func -EnFirefly_DiveAttack = 0x809FCBA8; // type:func -EnFirefly_Rebound = 0x809FCDBC; // type:func -EnFirefly_FlyAway = 0x809FCE50; // type:func -EnFirefly_Stunned = 0x809FCFB8; // type:func -EnFirefly_FrozenFall = 0x809FD05C; // type:func -EnFirefly_Perch = 0x809FD0BC; // type:func -EnFirefly_DisturbDiveAttack = 0x809FD17C; // type:func -EnFirefly_Combust = 0x809FD254; // type:func -EnFirefly_UpdateDamage = 0x809FD2D4; // type:func -EnFirefly_Update = 0x809FD484; // type:func -EnFirefly_OverrideLimbDraw = 0x809FD72C; // type:func -EnFirefly_PostLimbDraw = 0x809FD780; // type:func -EnFirefly_Draw = 0x809FDB10; // type:func -EnFirefly_DrawInvisible = 0x809FDBC4; // type:func -EnFish_XZDistanceSquared = 0x809FDF80; // type:func -EnFish_SetInWaterAnimation = 0x809FDFB0; // type:func -EnFish_SetOutOfWaterAnimation = 0x809FE014; // type:func -EnFish_BeginRespawn = 0x809FE078; // type:func -EnFish_SetCutsceneData = 0x809FE0AC; // type:func -EnFish_ClearCutsceneData = 0x809FE144; // type:func -EnFish_Init = 0x809FE16C; // type:func -EnFish_Destroy = 0x809FE2B0; // type:func -EnFish_SetYOffset = 0x809FE2DC; // type:func -EnFish_InBottleRange = 0x809FE394; // type:func -EnFish_CheckXZDistanceToPlayer = 0x809FE484; // type:func -EnFish_Respawning_SetupSlowDown = 0x809FE4B4; // type:func -EnFish_Respawning_SlowDown = 0x809FE50C; // type:func -EnFish_Respawning_SetupFollowChild = 0x809FE600; // type:func -EnFish_Respawning_FollowChild = 0x809FE658; // type:func -EnFish_Respawning_SetupFleePlayer = 0x809FE7EC; // type:func -EnFish_Respawning_FleePlayer = 0x809FE844; // type:func -EnFish_Respawning_SetupApproachPlayer = 0x809FEA34; // type:func -EnFish_Respawning_ApproachPlayer = 0x809FEA8C; // type:func -EnFish_Dropped_SetupFall = 0x809FEC50; // type:func -EnFish_Dropped_Fall = 0x809FECB0; // type:func -EnFish_Dropped_SetupFlopOnGround = 0x809FEDB8; // type:func -EnFish_Dropped_FlopOnGround = 0x809FEEFC; // type:func -EnFish_Dropped_SetupSwimAway = 0x809FF0D8; // type:func -EnFish_Dropped_SwimAway = 0x809FF14C; // type:func -EnFish_Unique_SetupSwimIdle = 0x809FF314; // type:func -EnFish_Unique_SwimIdle = 0x809FF36C; // type:func -EnFish_Cutscene_FlopOnGround = 0x809FF594; // type:func -EnFish_Cutscene_WiggleFlyingThroughAir = 0x809FF6C4; // type:func -EnFish_UpdateCutscene = 0x809FF760; // type:func -EnFish_OrdinaryUpdate = 0x809FF920; // type:func -EnFish_RespawningUpdate = 0x809FFAA4; // type:func -EnFish_Update = 0x809FFBB8; // type:func -EnFish_Draw = 0x809FFC64; // type:func -EnFloormas_Init = 0x80A00090; // type:func -EnFloormas_Destroy = 0x80A002A4; // type:func -EnFloormas_MakeInvulnerable = 0x80A002D0; // type:func -EnFloormas_MakeVulnerable = 0x80A002F4; // type:func -EnFloormas_SetupBigDecideAction = 0x80A00310; // type:func -EnFloormas_SetupStand = 0x80A00358; // type:func -EnFloormas_SetupBigWalk = 0x80A0039C; // type:func -EnFloormas_SetupBigStopWalk = 0x80A00428; // type:func -EnFloormas_SetupRun = 0x80A00470; // type:func -EnFloormas_SetupTurn = 0x80A004A0; // type:func -EnFloormas_SetupHover = 0x80A005D0; // type:func -EnFloormas_SetupCharge = 0x80A006A8; // type:func -EnFloormas_SetupLand = 0x80A006DC; // type:func -EnFloormas_SetupSplit = 0x80A00788; // type:func -EnFloormas_SetupSmallWalk = 0x80A008E8; // type:func -EnFloormas_SetupSmallDecideAction = 0x80A00938; // type:func -EnFloormas_SetupSmallShrink = 0x80A00998; // type:func -EnFloormas_SetupSmallFollowerJumpAtLeader = 0x80A00A70; // type:func -EnFloormas_SetupJumpAtLink = 0x80A00ADC; // type:func -EnFloormas_SetupGrabLink = 0x80A00B48; // type:func -EnFloormas_SetupMerge = 0x80A00D1C; // type:func -EnFloormas_SetupSmallWait = 0x80A00D74; // type:func -EnFloormas_SetupTakeDamage = 0x80A00DF8; // type:func -EnFloormas_SetupRecover = 0x80A00EB4; // type:func -EnFloormas_SetupFreeze = 0x80A00F08; // type:func -EnFloormas_Die = 0x80A01008; // type:func -EnFloormas_BigDecideAction = 0x80A010A4; // type:func -EnFloormas_Stand = 0x80A01168; // type:func -EnFloormas_BigWalk = 0x80A011F4; // type:func -EnFloormas_BigStopWalk = 0x80A01350; // type:func -EnFloormas_Run = 0x80A0138C; // type:func -EnFloormas_Turn = 0x80A01498; // type:func -EnFloormas_Hover = 0x80A0165C; // type:func -EnFloormas_Slide = 0x80A016E0; // type:func -EnFloormas_Charge = 0x80A01820; // type:func -EnFloormas_Land = 0x80A01910; // type:func -EnFloormas_Split = 0x80A01AF8; // type:func -EnFloormas_SmallWalk = 0x80A01B80; // type:func -EnFloormas_SmallDecideAction = 0x80A01C70; // type:func -EnFloormas_SmallShrink = 0x80A01DD8; // type:func -EnFloormas_JumpAtLink = 0x80A01E30; // type:func -EnFloormas_GrabLink = 0x80A01F6C; // type:func -EnFloormas_SmallFollowerJumpAtLeader = 0x80A02288; // type:func -EnFloormas_Merge = 0x80A02498; // type:func -EnFloormas_SmallWait = 0x80A02748; // type:func -EnFloormas_TakeDamage = 0x80A02758; // type:func -EnFloormas_Recover = 0x80A0281C; // type:func -EnFloormas_Freeze = 0x80A02858; // type:func -EnFloormas_ColliderCheck = 0x80A028CC; // type:func -EnFloormas_Update = 0x80A02A7C; // type:func -EnFloormas_OverrideLimbDraw = 0x80A02CE4; // type:func -EnFloormas_PostLimbDraw = 0x80A02D20; // type:func -EnFloormas_Draw = 0x80A02E10; // type:func -EnFloormas_DrawHighlighted = 0x80A02EDC; // type:func -EnFr_OrientUnderwater = 0x80A03470; // type:func -EnFr_Init = 0x80A03584; // type:func -EnFr_DrawIdle = 0x80A0363C; // type:func -EnFr_DrawActive = 0x80A03664; // type:func -EnFr_Update = 0x80A03678; // type:func -EnFr_Destroy = 0x80A03970; // type:func -EnFr_IsDivingIntoWater = 0x80A039A4; // type:func -EnFr_DivingIntoWater = 0x80A03A28; // type:func -EnFr_IsBelowLogSpot = 0x80A03AD4; // type:func -EnFr_IsAboveAndWithin30DistXZ = 0x80A03B30; // type:func -EnFr_DecrementBlinkTimer = 0x80A03BAC; // type:func -EnFr_DecrementBlinkTimerUpdate = 0x80A03BD4; // type:func -EnFr_SetupJumpingOutOfWater = 0x80A03C64; // type:func -EnFr_JumpingOutOfWater = 0x80A03D04; // type:func -EnFr_OrientOnLogSpot = 0x80A03EA4; // type:func -EnFr_ChooseJumpFromLogSpot = 0x80A03F64; // type:func -EnFr_JumpingUp = 0x80A04078; // type:func -EnFr_JumpingBackIntoWater = 0x80A041B8; // type:func -EnFr_SetScaleActive = 0x80A04310; // type:func -EnFr_ButterflyPath = 0x80A04418; // type:func -EnFr_UpdateActive = 0x80A04574; // type:func -EnFr_SetupJumpingUp = 0x80A04658; // type:func -EnFr_Idle = 0x80A046F8; // type:func -EnFr_Activate = 0x80A047D8; // type:func -EnFr_ActivateCheckFrogSong = 0x80A04840; // type:func -func_80A1BE98 = 0x80A048E4; // type:func -EnFr_ListeningToOcarinaNotes = 0x80A0495C; // type:func -EnFr_ChildSong = 0x80A04AA8; // type:func -EnFr_ChildSongFirstTime = 0x80A04BE0; // type:func -EnFr_TalkBeforeFrogSong = 0x80A04C38; // type:func -EnFr_CheckOcarinaInputFrogSong = 0x80A04CA0; // type:func -EnFr_DeactivateButterfly = 0x80A04D9C; // type:func -EnFr_GetNextNoteFrogSong = 0x80A04DE4; // type:func -EnFr_SetupFrogSong = 0x80A04E60; // type:func -EnFr_IsFrogSongComplete = 0x80A04ED4; // type:func -EnFr_OcarinaMistake = 0x80A04F84; // type:func -EnFr_ContinueFrogSong = 0x80A04FE0; // type:func -EnFr_SetupReward = 0x80A05184; // type:func -EnFr_PrintTextBox = 0x80A05200; // type:func -EnFr_TalkBeforeReward = 0x80A05240; // type:func -EnFr_SetReward = 0x80A052A8; // type:func -EnFr_Deactivate = 0x80A053BC; // type:func -EnFr_GiveReward = 0x80A054BC; // type:func -EnFr_SetIdle = 0x80A0551C; // type:func -EnFr_UpdateIdle = 0x80A05570; // type:func -EnFr_OverrideLimbDraw = 0x80A0559C; // type:func -EnFr_PostLimbDraw = 0x80A055C8; // type:func -EnFr_Draw = 0x80A05680; // type:func -EnFu_Init = 0x80A05F00; // type:func -EnFu_Destroy = 0x80A06014; // type:func -func_80A1D94C = 0x80A06040; // type:func -func_80A1DA04 = 0x80A060FC; // type:func -EnFu_WaitChild = 0x80A06198; // type:func -func_80A1DB60 = 0x80A0625C; // type:func -func_80A1DBA0 = 0x80A0629C; // type:func -func_80A1DBD4 = 0x80A062D4; // type:func -EnFu_WaitForPlayback = 0x80A06444; // type:func -EnFu_TeachSong = 0x80A064AC; // type:func -EnFu_WaitAdult = 0x80A06528; // type:func -EnFu_Update = 0x80A06678; // type:func -EnFu_OverrideLimbDraw = 0x80A06820; // type:func -EnFu_PostLimbDraw = 0x80A0697C; // type:func -EnFu_Draw = 0x80A069BC; // type:func -EnFw_DoBounce = 0x80A06C50; // type:func -EnFw_PlayerInRange = 0x80A06D18; // type:func -EnFw_GetPosAdjAroundCircle = 0x80A06E14; // type:func -EnFw_CheckCollider = 0x80A06EE8; // type:func -EnFw_SpawnDust = 0x80A06FA8; // type:func -EnFw_Init = 0x80A071F0; // type:func -EnFw_Destroy = 0x80A072F8; // type:func -EnFw_Bounce = 0x80A07324; // type:func -EnFw_Run = 0x80A07390; // type:func -EnFw_TurnToParentInitPos = 0x80A07964; // type:func -EnFw_JumpToParentInitPos = 0x80A07A58; // type:func -EnFw_Update = 0x80A07B0C; // type:func -EnFw_OverrideLimbDraw = 0x80A07BEC; // type:func -EnFw_PostLimbDraw = 0x80A07C08; // type:func -EnFw_Draw = 0x80A07CA4; // type:func -EnFw_SpawnEffectDust = 0x80A07D2C; // type:func -EnFw_UpdateEffects = 0x80A07DD0; // type:func -EnFw_DrawEffects = 0x80A07EDC; // type:func -EnFz_Init = 0x80A08410; // type:func -EnFz_Destroy = 0x80A08590; // type:func -EnFz_UpdateTargetPos = 0x80A085E0; // type:func -EnFz_ReachedTarget = 0x80A08700; // type:func -EnFz_Damaged = 0x80A08750; // type:func -EnFz_SpawnIceSmokeHiddenState = 0x80A08944; // type:func -EnFz_SpawnIceSmokeGrowingState = 0x80A08950; // type:func -EnFz_SpawnIceSmokeActiveState = 0x80A08A30; // type:func -EnFz_ApplyDamage = 0x80A08AF4; // type:func -EnFz_SetYawTowardsPlayer = 0x80A08D5C; // type:func -EnFz_SetupDisappear = 0x80A08D9C; // type:func -EnFz_Disappear = 0x80A08DCC; // type:func -EnFz_SetupWait = 0x80A08E4C; // type:func -EnFz_Wait = 0x80A08E8C; // type:func -EnFz_SetupAppear = 0x80A08EDC; // type:func -EnFz_Appear = 0x80A08F08; // type:func -EnFz_SetupAimForMove = 0x80A08F98; // type:func -EnFz_AimForMove = 0x80A08FDC; // type:func -EnFz_SetupMoveTowardsPlayer = 0x80A09018; // type:func -EnFz_MoveTowardsPlayer = 0x80A0904C; // type:func -EnFz_SetupAimForFreeze = 0x80A09088; // type:func -EnFz_AimForFreeze = 0x80A090B8; // type:func -EnFz_SetupBlowSmoke = 0x80A090F4; // type:func -EnFz_BlowSmoke = 0x80A0912C; // type:func -EnFz_SetupDespawn = 0x80A09318; // type:func -EnFz_Despawn = 0x80A093B8; // type:func -EnFz_SetupMelt = 0x80A093E8; // type:func -EnFz_Melt = 0x80A0942C; // type:func -EnFz_SetupBlowSmokeStationary = 0x80A094F4; // type:func -EnFz_BlowSmokeStationary = 0x80A09538; // type:func -EnFz_Update = 0x80A09730; // type:func -EnFz_Draw = 0x80A098C0; // type:func -EnFz_SpawnIceSmokeNoFreeze = 0x80A09A7C; // type:func -EnFz_SpawnIceSmokeFreeze = 0x80A09B20; // type:func -EnFz_UpdateIceSmoke = 0x80A09BDC; // type:func -EnFz_DrawEffects = 0x80A09EC8; // type:func -EnGSwitch_Init = 0x80A0A420; // type:func -EnGSwitch_Destroy = 0x80A0A6B8; // type:func -EnGSwitch_Break = 0x80A0A6E4; // type:func -EnGSwitch_WaitForObject = 0x80A0A88C; // type:func -EnGSwitch_SilverRupeeTracker = 0x80A0A924; // type:func -EnGSwitch_SilverRupeeIdle = 0x80A0AA08; // type:func -EnGSwitch_SilverRupeeCollected = 0x80A0AAF0; // type:func -EnGSwitch_GalleryRupee = 0x80A0ABD4; // type:func -EnGSwitch_ArcheryPot = 0x80A0AF74; // type:func -EnGSwitch_Kill = 0x80A0B25C; // type:func -EnGSwitch_Update = 0x80A0B28C; // type:func -EnGSwitch_DrawPot = 0x80A0B3C0; // type:func -EnGSwitch_DrawRupee = 0x80A0B454; // type:func -EnGSwitch_SpawnEffects = 0x80A0B584; // type:func -EnGSwitch_UpdateEffects = 0x80A0B698; // type:func -EnGSwitch_DrawEffects = 0x80A0B858; // type:func -EnGanonMant_Init = 0x80A0BC40; // type:func -EnGanonMant_Destroy = 0x80A0BC5C; // type:func -EnGanonMant_Tear = 0x80A0BC6C; // type:func -EnGanonMant_UpdateStrand = 0x80A0BEC8; // type:func -EnGanonMant_UpdateVertices = 0x80A0C48C; // type:func -EnGanonMant_Update = 0x80A0C6B0; // type:func -EnGanonMant_DrawCloak = 0x80A0C76C; // type:func -EnGanonMant_Draw = 0x80A0C888; // type:func -EnGanonOrgan_Init = 0x80A0FE70; // type:func -EnGanonOrgan_Destroy = 0x80A0FE8C; // type:func -EnGanonOrgan_Update = 0x80A0FE9C; // type:func -EnGanonOrgan_EmptyDList = 0x80A0FEE0; // type:func -func_80A280BC = 0x80A0FF04; // type:func -func_80A28148 = 0x80A0FF7C; // type:func -EnGanonOrgan_Draw = 0x80A0FFEC; // type:func -func_80A2F180 = 0x80A16EB0; // type:func -EnGb_Init = 0x80A16EE0; // type:func -EnGb_Destroy = 0x80A172E0; // type:func -func_80A2F608 = 0x80A1733C; // type:func -func_80A2F760 = 0x80A17494; // type:func -func_80A2F7C0 = 0x80A174F4; // type:func -func_80A2F83C = 0x80A17570; // type:func -func_80A2F94C = 0x80A1768C; // type:func -func_80A2F9C0 = 0x80A17704; // type:func -func_80A2FA50 = 0x80A17798; // type:func -func_80A2FB40 = 0x80A17888; // type:func -func_80A2FBB0 = 0x80A178FC; // type:func -func_80A2FC0C = 0x80A1795C; // type:func -func_80A2FC70 = 0x80A179C4; // type:func -EnGb_Update = 0x80A17AC8; // type:func -EnGb_Draw = 0x80A17C00; // type:func -EnGb_UpdateCagedSouls = 0x80A17D20; // type:func -EnGb_DrawCagedSouls = 0x80A18078; // type:func -EnGe1_Init = 0x80A185E0; // type:func -EnGe1_Destroy = 0x80A188A4; // type:func -EnGe1_SetTalkAction = 0x80A188D0; // type:func -EnGe1_SetAnimationIdle = 0x80A189B0; // type:func -EnGe1_CheckCarpentersFreed = 0x80A18A34; // type:func -EnGe1_KickPlayer = 0x80A18A70; // type:func -EnGe1_SpotPlayer = 0x80A18B50; // type:func -EnGe1_WatchForPlayerFrontOnly = 0x80A18BB0; // type:func -EnGe1_ChooseActionFromTextId = 0x80A18C68; // type:func -EnGe1_SetNormalText = 0x80A18CFC; // type:func -EnGe1_WatchForAndSensePlayer = 0x80A18D2C; // type:func -EnGe1_GetReaction_ValleyFloor = 0x80A18DF8; // type:func -EnGe1_WaitTillOpened_GTGGuard = 0x80A18E4C; // type:func -EnGe1_Open_GTGGuard = 0x80A18E9C; // type:func -EnGe1_SetupOpen_GTGGuard = 0x80A18F4C; // type:func -EnGe1_RefuseEntryTooPoor_GTGGuard = 0x80A1900C; // type:func -EnGe1_OfferOpen_GTGGuard = 0x80A1904C; // type:func -EnGe1_RefuseOpenNoCard_GTGGuard = 0x80A1913C; // type:func -EnGe1_CheckForCard_GTGGuard = 0x80A19180; // type:func -EnGe1_WaitGateOpen_GateOp = 0x80A191E8; // type:func -EnGe1_WaitUntilGateOpened_GateOp = 0x80A1925C; // type:func -EnGe1_OpenGate_GateOp = 0x80A192AC; // type:func -EnGe1_SetupOpenGate_GateOp = 0x80A1935C; // type:func -EnGe1_CheckGate_GateOp = 0x80A19428; // type:func -EnGe1_Talk_GateGuard = 0x80A194A4; // type:func -EnGe1_GetReaction_GateGuard = 0x80A194E8; // type:func -EnGe1_SetupWait_Archery = 0x80A1959C; // type:func -EnGe1_WaitTillItemGiven_Archery = 0x80A195D4; // type:func -EnGe1_BeginGiveItem_Archery = 0x80A196C8; // type:func -EnGe1_TalkWinPrize_Archery = 0x80A19790; // type:func -EnGe1_TalkTooPoor_Archery = 0x80A197F0; // type:func -EnGe1_WaitDoNothing = 0x80A19854; // type:func -EnGe1_BeginGame_Archery = 0x80A19864; // type:func -EnGe1_TalkOfferPlay_Archery = 0x80A19A04; // type:func -EnGe1_TalkNoPrize_Archery = 0x80A19A64; // type:func -EnGe1_TalkAfterGame_Archery = 0x80A19AB0; // type:func -EnGe1_TalkNoHorse_Archery = 0x80A19BB4; // type:func -EnGe1_Wait_Archery = 0x80A19BF8; // type:func -EnGe1_TurnToFacePlayer = 0x80A19C90; // type:func -EnGe1_LookAtPlayer = 0x80A19DA8; // type:func -EnGe1_Update = 0x80A19E84; // type:func -EnGe1_CueUpAnimation = 0x80A19FCC; // type:func -EnGe1_StopFidget = 0x80A1A00C; // type:func -EnGe1_OverrideLimbDraw = 0x80A1A064; // type:func -EnGe1_PostLimbDraw = 0x80A1A1B8; // type:func -EnGe1_Draw = 0x80A1A224; // type:func -EnGe2_ChangeAction = 0x80A1A610; // type:func -EnGe2_Init = 0x80A1A6B8; // type:func -EnGe2_Destroy = 0x80A1A8D0; // type:func -Ge2_DetectPlayerInAction = 0x80A1A8FC; // type:func -Ge2_DetectPlayerInUpdate = 0x80A1A9A8; // type:func -EnGe2_CheckCarpentersFreed = 0x80A1AAD8; // type:func -EnGe2_CaptureClose = 0x80A1AB04; // type:func -EnGe2_CaptureCharge = 0x80A1ABD8; // type:func -EnGe2_CaptureTurn = 0x80A1AD0C; // type:func -EnGe2_KnockedOut = 0x80A1AD84; // type:func -EnGe2_TurnPlayerSpotted = 0x80A1AE7C; // type:func -EnGe2_AboutTurn = 0x80A1AF84; // type:func -EnGe2_Walk = 0x80A1B03C; // type:func -EnGe2_Stand = 0x80A1B104; // type:func -EnGe2_TurnToFacePlayer = 0x80A1B144; // type:func -EnGe2_LookAtPlayer = 0x80A1B25C; // type:func -EnGe2_SetActionAfterTalk = 0x80A1B370; // type:func -EnGe2_WaitLookAtPlayer = 0x80A1B434; // type:func -EnGe2_WaitTillCardGiven = 0x80A1B454; // type:func -EnGe2_GiveCard = 0x80A1B4B8; // type:func -EnGe2_ForceTalk = 0x80A1B54C; // type:func -EnGe2_SetupCapturePlayer = 0x80A1B5D0; // type:func -EnGe2_MaintainColliderAndSetAnimState = 0x80A1B640; // type:func -EnGe2_MoveAndBlink = 0x80A1B6E8; // type:func -EnGe2_UpdateFriendly = 0x80A1B774; // type:func -EnGe2_UpdateAfterTalk = 0x80A1B84C; // type:func -EnGe2_Update = 0x80A1B8A0; // type:func -EnGe2_UpdateStunned = 0x80A1BA88; // type:func -EnGe2_OverrideLimbDraw = 0x80A1BBBC; // type:func -EnGe2_PostLimbDraw = 0x80A1BC04; // type:func -EnGe2_Draw = 0x80A1BC44; // type:func -EnGe3_ChangeAction = 0x80A1BFB0; // type:func -EnGe3_Init = 0x80A1C058; // type:func -EnGe3_Destroy = 0x80A1C160; // type:func -EnGe3_TurnToFacePlayer = 0x80A1C18C; // type:func -EnGe3_LookAtPlayer = 0x80A1C2A4; // type:func -EnGe3_Wait = 0x80A1C3B8; // type:func -EnGe3_WaitLookAtPlayer = 0x80A1C41C; // type:func -EnGe3_WaitTillCardGiven = 0x80A1C43C; // type:func -EnGe3_GiveCard = 0x80A1C4A0; // type:func -EnGe3_ForceTalk = 0x80A1C534; // type:func -EnGe3_UpdateCollision = 0x80A1C5EC; // type:func -EnGe3_MoveAndBlink = 0x80A1C694; // type:func -EnGe3_UpdateWhenNotTalking = 0x80A1C720; // type:func -EnGe3_Update = 0x80A1C7D4; // type:func -EnGe3_OverrideLimbDraw = 0x80A1C820; // type:func -EnGe3_PostLimbDraw = 0x80A1C974; // type:func -EnGe3_Draw = 0x80A1C9D0; // type:func -EnGeldB_SetupAction = 0x80A1CBF0; // type:func -EnGeldB_Init = 0x80A1CBFC; // type:func -EnGeldB_Destroy = 0x80A1CE20; // type:func -EnGeldB_ReactToPlayer = 0x80A1CE88; // type:func -EnGeldB_SetupWait = 0x80A1D260; // type:func -EnGeldB_Wait = 0x80A1D2F4; // type:func -EnGeldB_SetupFlee = 0x80A1D478; // type:func -EnGeldB_Flee = 0x80A1D510; // type:func -EnGeldB_SetupReady = 0x80A1D638; // type:func -EnGeldB_Ready = 0x80A1D6C0; // type:func -EnGeldB_SetupAdvance = 0x80A1D9A4; // type:func -EnGeldB_Advance = 0x80A1DA24; // type:func -EnGeldB_SetupRollForward = 0x80A1DED0; // type:func -EnGeldB_RollForward = 0x80A1DF84; // type:func -EnGeldB_SetupPivot = 0x80A1E0DC; // type:func -EnGeldB_Pivot = 0x80A1E128; // type:func -EnGeldB_SetupCircle = 0x80A1E308; // type:func -EnGeldB_Circle = 0x80A1E3DC; // type:func -EnGeldB_SetupSpinDodge = 0x80A1E9B8; // type:func -EnGeldB_SpinDodge = 0x80A1EB20; // type:func -EnGeldB_SetupSlash = 0x80A1EF70; // type:func -EnGeldB_Slash = 0x80A1EFE0; // type:func -EnGeldB_SetupSpinAttack = 0x80A1F230; // type:func -EnGeldB_SpinAttack = 0x80A1F2C4; // type:func -EnGeldB_SetupRollBack = 0x80A1F678; // type:func -EnGeldB_RollBack = 0x80A1F6F4; // type:func -EnGeldB_SetupStunned = 0x80A1F7F8; // type:func -EnGeldB_Stunned = 0x80A1F8A4; // type:func -EnGeldB_SetupDamaged = 0x80A1F960; // type:func -EnGeldB_Damaged = 0x80A1F9F8; // type:func -EnGeldB_SetupJump = 0x80A1FBA0; // type:func -EnGeldB_Jump = 0x80A1FC58; // type:func -EnGeldB_SetupBlock = 0x80A1FD40; // type:func -EnGeldB_Block = 0x80A1FDF8; // type:func -EnGeldB_SetupSidestep = 0x80A200E4; // type:func -EnGeldB_Sidestep = 0x80A20274; // type:func -EnGeldB_SetupDefeated = 0x80A20994; // type:func -EnGeldB_Defeated = 0x80A20A38; // type:func -EnGeldB_TurnHead = 0x80A20AF4; // type:func -EnGeldB_CollisionCheck = 0x80A20BF4; // type:func -EnGeldB_Update = 0x80A20DC0; // type:func -EnGeldB_OverrideLimbDraw = 0x80A20FAC; // type:func -EnGeldB_PostLimbDraw = 0x80A210F4; // type:func -EnGeldB_Draw = 0x80A2136C; // type:func -EnGeldB_DodgeRanged = 0x80A216DC; // type:func -EnGirlA_SetupAction = 0x80A21FA0; // type:func -EnGirlA_TryChangeShopItem = 0x80A21FAC; // type:func -EnGirlA_InitItem = 0x80A22124; // type:func -EnGirlA_Init = 0x80A221C8; // type:func -EnGirlA_Destroy = 0x80A221FC; // type:func -EnGirlA_CanBuy_Arrows = 0x80A2222C; // type:func -EnGirlA_CanBuy_Bombs = 0x80A222DC; // type:func -EnGirlA_CanBuy_DekuNuts = 0x80A2237C; // type:func -EnGirlA_CanBuy_DekuSticks = 0x80A22434; // type:func -EnGirlA_CanBuy_Fish = 0x80A224EC; // type:func -EnGirlA_CanBuy_RedPotion = 0x80A22564; // type:func -EnGirlA_CanBuy_GreenPotion = 0x80A225DC; // type:func -EnGirlA_CanBuy_BluePotion = 0x80A22654; // type:func -EnGirlA_CanBuy_Longsword = 0x80A226CC; // type:func -EnGirlA_CanBuy_HylianShield = 0x80A22760; // type:func -EnGirlA_CanBuy_DekuShield = 0x80A227E0; // type:func -EnGirlA_CanBuy_GoronTunic = 0x80A22860; // type:func -EnGirlA_CanBuy_ZoraTunic = 0x80A22908; // type:func -EnGirlA_CanBuy_RecoveryHeart = 0x80A229B0; // type:func -EnGirlA_CanBuy_MilkBottle = 0x80A229FC; // type:func -EnGirlA_CanBuy_WeirdEgg = 0x80A22A58; // type:func -EnGirlA_CanBuy_Unk19 = 0x80A22AB4; // type:func -EnGirlA_CanBuy_Unk20 = 0x80A22AC8; // type:func -EnGirlA_CanBuy_Bombchus = 0x80A22ADC; // type:func -EnGirlA_CanBuy_DekuSeeds = 0x80A22B60; // type:func -EnGirlA_CanBuy_SoldOut = 0x80A22C10; // type:func -EnGirlA_CanBuy_BlueFire = 0x80A22C24; // type:func -EnGirlA_CanBuy_Bugs = 0x80A22C9C; // type:func -EnGirlA_CanBuy_Poe = 0x80A22D14; // type:func -EnGirlA_CanBuy_Fairy = 0x80A22D8C; // type:func -EnGirlA_ItemGive_Arrows = 0x80A22E04; // type:func -EnGirlA_ItemGive_Bombs = 0x80A22E4C; // type:func -EnGirlA_ItemGive_DekuNuts = 0x80A22EEC; // type:func -EnGirlA_ItemGive_DekuSticks = 0x80A22F5C; // type:func -EnGirlA_ItemGive_Longsword = 0x80A22F98; // type:func -EnGirlA_ItemGive_HylianShield = 0x80A22FE0; // type:func -EnGirlA_ItemGive_DekuShield = 0x80A2301C; // type:func -EnGirlA_ItemGive_GoronTunic = 0x80A23058; // type:func -EnGirlA_ItemGive_ZoraTunic = 0x80A23094; // type:func -EnGirlA_ItemGive_Health = 0x80A230D0; // type:func -EnGirlA_ItemGive_MilkBottle = 0x80A23110; // type:func -EnGirlA_ItemGive_WeirdEgg = 0x80A2314C; // type:func -EnGirlA_ItemGive_Unk19 = 0x80A23188; // type:func -EnGirlA_ItemGive_Unk20 = 0x80A231B8; // type:func -EnGirlA_ItemGive_DekuSeeds = 0x80A231E8; // type:func -EnGirlA_ItemGive_BottledItem = 0x80A23224; // type:func -EnGirlA_BuyEvent_ShieldDiscount = 0x80A23354; // type:func -EnGirlA_BuyEvent_GoronTunic = 0x80A233F4; // type:func -EnGirlA_BuyEvent_ZoraTunic = 0x80A23424; // type:func -EnGirlA_BuyEvent_ObtainBombchuPack = 0x80A23454; // type:func -EnGirlA_Noop = 0x80A23568; // type:func -EnGirlA_SetItemDescription = 0x80A23578; // type:func -EnGirlA_SetItemOutOfStock = 0x80A236A0; // type:func -EnGirlA_UpdateStockedItem = 0x80A236D4; // type:func -EnGirlA_TrySetMaskItemDescription = 0x80A2374C; // type:func -EnGirlA_WaitForObject = 0x80A237DC; // type:func -EnGirlA_Update2 = 0x80A23B8C; // type:func -EnGirlA_Update = 0x80A23C48; // type:func -func_80A3C498 = 0x80A23C6C; // type:func -EnGirlA_Draw = 0x80A23CB0; // type:func -EnGm_Init = 0x80A248C0; // type:func -EnGm_Destroy = 0x80A24920; // type:func -func_80A3D7C8 = 0x80A2494C; // type:func -func_80A3D838 = 0x80A249BC; // type:func -EnGm_UpdateEye = 0x80A24B5C; // type:func -EnGm_SetTextID = 0x80A24BD4; // type:func -func_80A3DB04 = 0x80A24C88; // type:func -func_80A3DBF4 = 0x80A24D78; // type:func -func_80A3DC44 = 0x80A24DCC; // type:func -func_80A3DD7C = 0x80A24F08; // type:func -EnGm_ProcessChoiceIndex = 0x80A24FA0; // type:func -func_80A3DF00 = 0x80A25090; // type:func -func_80A3DF60 = 0x80A250F4; // type:func -func_80A3DFBC = 0x80A25154; // type:func -EnGm_Update = 0x80A25208; // type:func -func_80A3E090 = 0x80A2522C; // type:func -EnGm_Draw = 0x80A2538C; // type:func -EnGo_SetupAction = 0x80A255F0; // type:func -EnGo_GetTextID = 0x80A255FC; // type:func -EnGo_UpdateTalkState = 0x80A2598C; // type:func -EnGo_UpdateTalking = 0x80A25DAC; // type:func -EnGo_ChangeAnim = 0x80A25E6C; // type:func -EnGo_IsActorSpawned = 0x80A25F1C; // type:func -EnGo_GetPlayerTrackingYOffset = 0x80A2607C; // type:func -func_80A3F060 = 0x80A260F4; // type:func -func_80A3F0E4 = 0x80A26178; // type:func -EnGo_IsCameraModified = 0x80A261F0; // type:func -EnGo_ReverseAnimation = 0x80A262F4; // type:func -EnGo_UpdateShadow = 0x80A2630C; // type:func -EnGo_FollowPath = 0x80A26398; // type:func -EnGo_SetMovedPos = 0x80A26554; // type:func -EnGo_SpawnDust = 0x80A2662C; // type:func -EnGo_IsRollingOnGround = 0x80A26858; // type:func -func_80A3F908 = 0x80A269A4; // type:func -EnGo_Init = 0x80A26BD4; // type:func -EnGo_Destroy = 0x80A26F24; // type:func -func_80A3FEB4 = 0x80A26F64; // type:func -EnGo_StopRolling = 0x80A26FA8; // type:func -func_80A4008C = 0x80A2713C; // type:func -EnGo_GoronLinkRolling = 0x80A271CC; // type:func -EnGo_FireGenericActionFunc = 0x80A272C4; // type:func -EnGo_CurledUp = 0x80A272D4; // type:func -EnGo_WakeUp = 0x80A273D4; // type:func -func_80A40494 = 0x80A27550; // type:func -func_80A405CC = 0x80A27688; // type:func -EnGo_BiggoronActionFunc = 0x80A2779C; // type:func -func_80A408D8 = 0x80A27994; // type:func -func_80A40A54 = 0x80A27B10; // type:func -func_80A40B1C = 0x80A27BD8; // type:func -EnGo_GetItem = 0x80A27C30; // type:func -func_80A40C78 = 0x80A27D38; // type:func -EnGo_Eyedrops = 0x80A27E20; // type:func -func_80A40DCC = 0x80A27E90; // type:func -EnGo_Update = 0x80A27F14; // type:func -EnGo_DrawCurledUp = 0x80A28024; // type:func -EnGo_DrawRolling = 0x80A280F0; // type:func -EnGo_OverrideLimbDraw = 0x80A2821C; // type:func -EnGo_PostLimbDraw = 0x80A28438; // type:func -EnGo_Draw = 0x80A28494; // type:func -EnGo_SpawnEffectDust = 0x80A28634; // type:func -EnGo_UpdateEffects = 0x80A286D8; // type:func -EnGo_DrawEffects = 0x80A287E4; // type:func -EnGo2_SpawnEffectDust = 0x80A29C30; // type:func -EnGo2_UpdateEffects = 0x80A29CD4; // type:func -EnGo2_DrawEffects = 0x80A29DE0; // type:func -EnGo2_SpawnDust = 0x80A2A0D8; // type:func -EnGo2_GetItem = 0x80A2A2F0; // type:func -EnGo2_GetDialogState = 0x80A2A334; // type:func -EnGo2_GoronFireGenericGetTextId = 0x80A2A3B4; // type:func -EnGo2_GetTextIdGoronCityRollingBig = 0x80A2A430; // type:func -EnGo2_UpdateTalkStateGoronCityRollingBig = 0x80A2A4B8; // type:func -EnGo2_GetTextIdGoronDmtBombFlower = 0x80A2A5B0; // type:func -EnGo2_UpdateTalkStateGoronDmtBombFlower = 0x80A2A5EC; // type:func -EnGo2_GetTextIdGoronDmtRollingSmall = 0x80A2A704; // type:func -EnGo2_UpdateTalkStateGoronDmtRollingSmall = 0x80A2A75C; // type:func -EnGo2_GetTextIdGoronDmtDcEntrance = 0x80A2A798; // type:func -EnGo2_UpdateTalkStateGoronDmtDcEntrance = 0x80A2A834; // type:func -EnGo2_GetTextIdGoronCityEntrance = 0x80A2A894; // type:func -EnGo2_UpdateTalkStateGoronCityEntrance = 0x80A2A914; // type:func -EnGo2_GetTextIdGoronCityIsland = 0x80A2A974; // type:func -EnGo2_UpdateTalkStateGoronCityIsland = 0x80A2A9F4; // type:func -EnGo2_GetTextIdGoronCityLowestFloor = 0x80A2AA54; // type:func -EnGo2_UpdateTalkStateGoronCityLowestFloor = 0x80A2AB30; // type:func -EnGo2_GetTextIdGoronCityLink = 0x80A2AB90; // type:func -EnGo2_UpdateTalkStateGoronCityLink = 0x80A2AC6C; // type:func -EnGo2_GetTextIdGoronDmtBiggoron = 0x80A2AE84; // type:func -EnGo2_UpdateTalkStateGoronDmtBiggoron = 0x80A2AF04; // type:func -EnGo2_GetTextIdGoronFireGeneric = 0x80A2B118; // type:func -EnGo2_UpdateTalkStateGoronFireGeneric = 0x80A2B150; // type:func -EnGo2_GetTextIdGoronCityStairwell = 0x80A2B1EC; // type:func -EnGo2_UpdateTalkStateGoronCityStairwell = 0x80A2B23C; // type:func -EnGo2_GetTextIdGoronMarketBazaar = 0x80A2B29C; // type:func -EnGo2_UpdateTalkStateGoronMarketBazaar = 0x80A2B2B0; // type:func -EnGo2_GetTextIdGoronCityLostWoods = 0x80A2B2EC; // type:func -EnGo2_UpdateTalkStateGoronCityLostWoods = 0x80A2B35C; // type:func -EnGo2_GetTextIdGoronDmtFairyHint = 0x80A2B3BC; // type:func -EnGo2_UpdateTalkStateGoronDmtFairyHint = 0x80A2B414; // type:func -EnGo2_GetTextId = 0x80A2B450; // type:func -EnGo2_UpdateTalkState = 0x80A2B594; // type:func -func_80A44790 = 0x80A2B6AC; // type:func -EnGo2_SetColliderDim = 0x80A2B7A8; // type:func -EnGo2_SetShape = 0x80A2B7E4; // type:func -EnGo2_CheckCollision = 0x80A2B85C; // type:func -EnGo2_SwapInitialFrameAnimFrameCount = 0x80A2B9B8; // type:func -func_80A44AB0 = 0x80A2B9D0; // type:func -EnGo2_UpdateWaypoint = 0x80A2BB8C; // type:func -EnGo2_Orient = 0x80A2BC08; // type:func -func_80A44D84 = 0x80A2BCAC; // type:func -EnGo2_IsWakingUp = 0x80A2BCE4; // type:func -EnGo2_IsRollingOnGround = 0x80A2BE14; // type:func -EnGo2_BiggoronSetTextId = 0x80A2BFB0; // type:func -func_80A45288 = 0x80A2C1B0; // type:func -func_80A45360 = 0x80A2C28C; // type:func -EnGo2_RollForward = 0x80A2C398; // type:func -func_80A454CC = 0x80A2C3F8; // type:func -EnGo2_GetTargetXZSpeed = 0x80A2C4A4; // type:func -EnGo2_IsCameraModified = 0x80A2C548; // type:func -EnGo2_DefaultWakingUp = 0x80A2C664; // type:func -EnGo2_WakingUp = 0x80A2C6BC; // type:func -EnGo2_BiggoronWakingUp = 0x80A2C72C; // type:func -EnGo2_SelectGoronWakingUp = 0x80A2C77C; // type:func -EnGo2_EyeMouthTexState = 0x80A2C860; // type:func -EnGo2_SitDownAnimation = 0x80A2C934; // type:func -EnGo2_GetDustData = 0x80A2CA4C; // type:func -EnGo2_RollingAnimation = 0x80A2CAD4; // type:func -EnGo2_WakeUp = 0x80A2CB88; // type:func -EnGo2_GetItemAnimation = 0x80A2CC7C; // type:func -EnGo2_SetupRolling = 0x80A2CCE0; // type:func -EnGo2_StopRolling = 0x80A2CD88; // type:func -EnGo2_IsFreeingGoronInFire = 0x80A2CE48; // type:func -EnGo2_IsGoronDmtBombFlower = 0x80A2CEE0; // type:func -EnGo2_IsGoronRollingBig = 0x80A2CF60; // type:func -EnGo2_IsGoronFireGeneric = 0x80A2CFC0; // type:func -EnGo2_IsGoronLinkReversing = 0x80A2CFFC; // type:func -EnGo2_IsRolling = 0x80A2D058; // type:func -EnGo2_GoronLinkAnimation = 0x80A2D0EC; // type:func -EnGo2_GoronFireCamera = 0x80A2D220; // type:func -EnGo2_GoronFireClearCamera = 0x80A2D320; // type:func -EnGo2_BiggoronAnimation = 0x80A2D360; // type:func -EnGo2_Init = 0x80A2D414; // type:func -EnGo2_Destroy = 0x80A2D8A8; // type:func -EnGo2_CurledUp = 0x80A2D8B8; // type:func -func_80A46B40 = 0x80A2DA8C; // type:func -EnGo2_GoronDmtBombFlowerAnimation = 0x80A2DC24; // type:func -EnGo2_GoronRollingBigContinueRolling = 0x80A2DCA8; // type:func -EnGo2_ContinueRolling = 0x80A2DD08; // type:func -EnGo2_SlowRolling = 0x80A2DDA0; // type:func -EnGo2_GroundRolling = 0x80A2DED8; // type:func -EnGo2_ReverseRolling = 0x80A2DF74; // type:func -EnGo2_SetupGetItem = 0x80A2E03C; // type:func -EnGo2_SetGetItem = 0x80A2E0B0; // type:func -EnGo2_BiggoronEyedrops = 0x80A2E1B8; // type:func -EnGo2_GoronLinkStopRolling = 0x80A2E3EC; // type:func -EnGo2_GoronFireGenericAction = 0x80A2E4DC; // type:func -EnGo2_Update = 0x80A2E808; // type:func -EnGo2_DrawCurledUp = 0x80A2E91C; // type:func -EnGo2_DrawRolling = 0x80A2E9E0; // type:func -EnGo2_OverrideLimbDraw = 0x80A2EB1C; // type:func -EnGo2_PostLimbDraw = 0x80A2ED38; // type:func -EnGo2_Draw = 0x80A2ED94; // type:func -EnGoma_Init = 0x80A2FC70; // type:func -EnGoma_Destroy = 0x80A2FFFC; // type:func -EnGoma_SetupFlee = 0x80A3004C; // type:func -EnGoma_Flee = 0x80A300F0; // type:func -EnGoma_EggFallToGround = 0x80A30190; // type:func -EnGoma_Egg = 0x80A3041C; // type:func -EnGoma_SetupHatch = 0x80A3065C; // type:func -EnGoma_Hatch = 0x80A30724; // type:func -EnGoma_SetupHurt = 0x80A3076C; // type:func -EnGoma_Hurt = 0x80A30858; // type:func -EnGoma_SetupDie = 0x80A308E0; // type:func -EnGoma_Die = 0x80A309A0; // type:func -EnGoma_SetupDead = 0x80A30A44; // type:func -EnGoma_Dead = 0x80A30ABC; // type:func -EnGoma_SetupStand = 0x80A30C2C; // type:func -EnGoma_SetupChasePlayer = 0x80A30CB8; // type:func -EnGoma_SetupPrepareJump = 0x80A30D38; // type:func -EnGoma_PrepareJump = 0x80A30DB4; // type:func -EnGoma_SetupLand = 0x80A30E4C; // type:func -EnGoma_Land = 0x80A30EC4; // type:func -EnGoma_SetupJump = 0x80A30F30; // type:func -EnGoma_Jump = 0x80A30FD8; // type:func -EnGoma_Stand = 0x80A31090; // type:func -EnGoma_ChasePlayer = 0x80A3110C; // type:func -EnGoma_SetupStunned = 0x80A31214; // type:func -EnGoma_Stunned = 0x80A312B0; // type:func -EnGoma_LookAtPlayer = 0x80A313B0; // type:func -EnGoma_UpdateHit = 0x80A3145C; // type:func -EnGoma_UpdateEyeEnvColor = 0x80A3168C; // type:func -EnGoma_SetFloorRot = 0x80A3171C; // type:func -EnGoma_Update = 0x80A31830; // type:func -EnGoma_OverrideLimbDraw = 0x80A31A7C; // type:func -EnGoma_NoBackfaceCullingDlist = 0x80A31BD8; // type:func -EnGoma_Draw = 0x80A31C44; // type:func -EnGoma_Debris = 0x80A320D0; // type:func -EnGoma_SpawnHatchDebris = 0x80A32114; // type:func -EnGoma_BossLimb = 0x80A32278; // type:func -EnGoroiwa_UpdateCollider = 0x80A32920; // type:func -EnGoroiwa_InitCollider = 0x80A3298C; // type:func -EnGoroiwa_UpdateFlags = 0x80A329F4; // type:func -EnGoroiwa_Vec3fNormalize = 0x80A32A18; // type:func -EnGoroiwa_SetSpeed = 0x80A32A9C; // type:func -EnGoroiwa_FaceNextWaypoint = 0x80A32AC4; // type:func -EnGoroiwa_GetPrevWaypointDiff = 0x80A32B9C; // type:func -EnGoroiw_CheckEndOfPath = 0x80A32CF8; // type:func -EnGoroiwa_SetNextWaypoint = 0x80A32DAC; // type:func -EnGoroiwa_ReverseDirection = 0x80A32DDC; // type:func -EnGoroiwa_InitPath = 0x80A32E04; // type:func -EnGoroiwa_TeleportToWaypoint = 0x80A32E44; // type:func -EnGoroiwa_InitRotation = 0x80A32EE8; // type:func -EnGoroiwa_GetAscendDirection = 0x80A32F04; // type:func -EnGoroiwa_SpawnDust = 0x80A32FC8; // type:func -EnGoroiwa_SpawnWaterEffects = 0x80A331B8; // type:func -EnGoroiwa_MoveAndFall = 0x80A332EC; // type:func -EnGoroiwa_Move = 0x80A33420; // type:func -EnGoroiwa_MoveUpToNextWaypoint = 0x80A3364C; // type:func -EnGoroiwa_MoveDownToNextWaypoint = 0x80A3376C; // type:func -EnGoroiwa_UpdateRotation = 0x80A33ACC; // type:func -EnGoroiwa_NextWaypoint = 0x80A33C6C; // type:func -EnGoroiwa_SpawnFragments = 0x80A33CF4; // type:func -EnGoroiwa_Init = 0x80A34010; // type:func -EnGoroiwa_Destroy = 0x80A34140; // type:func -EnGoroiwa_SetupRoll = 0x80A3416C; // type:func -EnGoroiwa_Roll = 0x80A341AC; // type:func -EnGoroiwa_SetupMoveAndFallToGround = 0x80A34430; // type:func -EnGoroiwa_MoveAndFallToGround = 0x80A344A4; // type:func -EnGoroiwa_SetupWait = 0x80A34544; // type:func -EnGoroiwa_Wait = 0x80A345A0; // type:func -EnGoroiwa_SetupMoveUp = 0x80A345E0; // type:func -EnGoroiwa_MoveUp = 0x80A34630; // type:func -EnGoroiwa_SetupMoveDown = 0x80A346F0; // type:func -EnGoroiwa_MoveDown = 0x80A3475C; // type:func -EnGoroiwa_Update = 0x80A34824; // type:func -EnGoroiwa_Draw = 0x80A34984; // type:func -EnGs_Init = 0x80A34CE0; // type:func -EnGs_Destroy = 0x80A34DA4; // type:func -func_80A4E3EC = 0x80A34DB4; // type:func -func_80A4E470 = 0x80A34E3C; // type:func -func_80A4E648 = 0x80A34FFC; // type:func -func_80A4E754 = 0x80A3510C; // type:func -func_80A4E910 = 0x80A352CC; // type:func -func_80A4EA08 = 0x80A353C8; // type:func -func_80A4EB3C = 0x80A354FC; // type:func -func_80A4ED34 = 0x80A356F4; // type:func -func_80A4F13C = 0x80A35B00; // type:func -func_80A4F700 = 0x80A360C4; // type:func -func_80A4F734 = 0x80A360F8; // type:func -func_80A4F77C = 0x80A36140; // type:func -EnGs_Update = 0x80A361BC; // type:func -EnGs_Draw = 0x80A36354; // type:func -EnGuest_Init = 0x80A36B50; // type:func -EnGuest_Destroy = 0x80A36BB0; // type:func -EnGuest_Update = 0x80A36BDC; // type:func -func_80A5046C = 0x80A36D4C; // type:func -func_80A50518 = 0x80A36DF8; // type:func -func_80A5057C = 0x80A36E60; // type:func -func_80A505CC = 0x80A36EB4; // type:func -func_80A50708 = 0x80A36FF4; // type:func -EnGuest_OverrideLimbDraw = 0x80A37060; // type:func -EnGuest_Draw = 0x80A37288; // type:func -EnHata_Init = 0x80A374F0; // type:func -EnHata_Destroy = 0x80A37628; // type:func -EnHata_Update = 0x80A37670; // type:func -EnHata_OverrideLimbDraw = 0x80A3788C; // type:func -EnHata_PostLimbDraw = 0x80A37910; // type:func -EnHata_Draw = 0x80A37928; // type:func -EnHeishi1_Init = 0x80A37A80; // type:func -EnHeishi1_Destroy = 0x80A37C98; // type:func -EnHeishi1_SetupWalk = 0x80A37CA8; // type:func -EnHeishi1_Walk = 0x80A37D5C; // type:func -EnHeishi1_SetupMoveToLink = 0x80A3807C; // type:func -EnHeishi1_MoveToLink = 0x80A38138; // type:func -EnHeishi1_SetupWait = 0x80A38230; // type:func -EnHeishi1_Wait = 0x80A382F8; // type:func -EnHeishi1_SetupTurnTowardLink = 0x80A384B4; // type:func -EnHeishi1_TurnTowardLink = 0x80A38550; // type:func -EnHeishi1_SetupKick = 0x80A385FC; // type:func -EnHeishi1_Kick = 0x80A38690; // type:func -EnHeishi1_SetupWaitNight = 0x80A38764; // type:func -EnHeishi1_WaitNight = 0x80A387F8; // type:func -EnHeishi1_Update = 0x80A38878; // type:func -EnHeishi1_OverrideLimbDraw = 0x80A38B8C; // type:func -EnHeishi1_Draw = 0x80A38BD0; // type:func -EnHeishi2_Init = 0x80A38F90; // type:func -EnHeishi2_Destroy = 0x80A39210; // type:func -EnHeishi2_DoNothing1 = 0x80A39254; // type:func -EnHeishi_DoNothing2 = 0x80A39264; // type:func -func_80A531E4 = 0x80A39274; // type:func -func_80A53278 = 0x80A39308; // type:func -func_80A5344C = 0x80A39488; // type:func -func_80A53538 = 0x80A39574; // type:func -func_80A535BC = 0x80A395FC; // type:func -func_80A53638 = 0x80A39678; // type:func -func_80A5372C = 0x80A39764; // type:func -func_80A53850 = 0x80A39888; // type:func -func_80A53908 = 0x80A39940; // type:func -func_80A5399C = 0x80A399D4; // type:func -func_80A53AD4 = 0x80A39AF8; // type:func -func_80A53C0C = 0x80A39C34; // type:func -func_80A53C90 = 0x80A39CBC; // type:func -func_80A53D0C = 0x80A39D38; // type:func -func_80A53DF8 = 0x80A39E1C; // type:func -func_80A53F30 = 0x80A39F54; // type:func -func_80A54038 = 0x80A3A05C; // type:func -func_80A540C0 = 0x80A3A0E8; // type:func -func_80A541FC = 0x80A3A224; // type:func -func_80A5427C = 0x80A3A2A8; // type:func -func_80A54320 = 0x80A3A34C; // type:func -func_80A543A0 = 0x80A3A3CC; // type:func -func_80A544AC = 0x80A3A4D8; // type:func -func_80A5455C = 0x80A3A588; // type:func -func_80A546DC = 0x80A3A6FC; // type:func -func_80A5475C = 0x80A3A77C; // type:func -func_80A54954 = 0x80A3A974; // type:func -func_80A549E8 = 0x80A3AA08; // type:func -EnHeishi2_Update = 0x80A3AA98; // type:func -EnHeishi2_OverrideLimbDraw = 0x80A3ABE4; // type:func -EnHeishi2_PostLimbDraw = 0x80A3AC5C; // type:func -EnHeishi2_DrawKingGuard = 0x80A3AC94; // type:func -EnHeishi2_Draw = 0x80A3AD08; // type:func -EnHeishi3_Init = 0x80A3B190; // type:func -EnHeishi3_Destroy = 0x80A3B2BC; // type:func -EnHeishi3_SetupGuardType = 0x80A3B2E8; // type:func -EnHeishi3_StandSentinelInGrounds = 0x80A3B398; // type:func -EnHeishi3_StandSentinelInCastle = 0x80A3B4F4; // type:func -EnHeishi3_CatchStart = 0x80A3B664; // type:func -func_80A55BD4 = 0x80A3B70C; // type:func -EnHeishi3_ResetAnimationToIdle = 0x80A3B7A4; // type:func -func_80A55D00 = 0x80A3B838; // type:func -EnHeishi3_Update = 0x80A3B8E8; // type:func -EnHeishi3_OverrideLimbDraw = 0x80A3B9C8; // type:func -EnHeishi3_Draw = 0x80A3BA30; // type:func -EnHeishi4_Init = 0x80A3BB60; // type:func -EnHeishi4_Destroy = 0x80A3BD40; // type:func -func_80A56328 = 0x80A3BD6C; // type:func -func_80A563BC = 0x80A3BE00; // type:func -func_80A56544 = 0x80A3BF88; // type:func -func_80A56614 = 0x80A3C04C; // type:func -func_80A5673C = 0x80A3C174; // type:func -func_80A56874 = 0x80A3C288; // type:func -func_80A56900 = 0x80A3C314; // type:func -func_80A56994 = 0x80A3C3A8; // type:func -func_80A56A50 = 0x80A3C464; // type:func -func_80A56ACC = 0x80A3C4E0; // type:func -func_80A56B40 = 0x80A3C554; // type:func -EnHeishi4_Update = 0x80A3C6C8; // type:func -EnHeishi_OverrideLimbDraw = 0x80A3C82C; // type:func -EnHeishi4_Draw = 0x80A3C894; // type:func -EnHintnuts_Init = 0x80A3CA60; // type:func -EnHintnuts_Destroy = 0x80A3CC00; // type:func -EnHintnuts_HitByScrubProjectile1 = 0x80A3CC3C; // type:func -EnHintnuts_SetupWait = 0x80A3CCC0; // type:func -EnHintnuts_SetupLookAround = 0x80A3CD40; // type:func -EnHintnuts_SetupThrowScrubProjectile = 0x80A3CD88; // type:func -EnHintnuts_SetupStand = 0x80A3CDC8; // type:func -EnHintnuts_SetupBurrow = 0x80A3CE30; // type:func -EnHintnuts_HitByScrubProjectile2 = 0x80A3CE80; // type:func -EnHintnuts_SetupRun = 0x80A3CF70; // type:func -EnHintnuts_SetupTalk = 0x80A3CFB8; // type:func -EnHintnuts_SetupLeave = 0x80A3D004; // type:func -EnHintnuts_SetupFreeze = 0x80A3D0C4; // type:func -EnHintnuts_Wait = 0x80A3D170; // type:func -EnHintnuts_LookAround = 0x80A3D3D4; // type:func -EnHintnuts_Stand = 0x80A3D458; // type:func -EnHintnuts_ThrowNut = 0x80A3D51C; // type:func -EnHintnuts_Burrow = 0x80A3D658; // type:func -EnHintnuts_BeginRun = 0x80A3D76C; // type:func -EnHintnuts_BeginFreeze = 0x80A3D7D0; // type:func -EnHintnuts_CheckProximity = 0x80A3D80C; // type:func -EnHintnuts_Run = 0x80A3D8A0; // type:func -EnHintnuts_Talk = 0x80A3DB30; // type:func -EnHintnuts_Leave = 0x80A3DB9C; // type:func -EnHintnuts_Freeze = 0x80A3DD58; // type:func -EnHintnuts_ColliderCheck = 0x80A3DE84; // type:func -EnHintnuts_Update = 0x80A3DF38; // type:func -EnHintnuts_OverrideLimbDraw = 0x80A3E0C0; // type:func -EnHintnuts_Draw = 0x80A3E1F4; // type:func -EnHoll_SetupAction = 0x80A3E490; // type:func -EnHoll_IsKokiriLayer8 = 0x80A3E49C; // type:func -EnHoll_ChooseAction = 0x80A3E4CC; // type:func -EnHoll_Init = 0x80A3E534; // type:func -EnHoll_Destroy = 0x80A3E570; // type:func -EnHoll_SwapRooms = 0x80A3E5A0; // type:func -EnHoll_HorizontalVisibleNarrow = 0x80A3E65C; // type:func -EnHoll_HorizontalInvisible = 0x80A3E89C; // type:func -EnHoll_VerticalDownBgCoverLarge = 0x80A3EA4C; // type:func -EnHoll_VerticalBgCover = 0x80A3EC38; // type:func -EnHoll_VerticalInvisible = 0x80A3EDB8; // type:func -EnHoll_HorizontalBgCoverSwitchFlag = 0x80A3EEB0; // type:func -EnHoll_WaitRoomLoaded = 0x80A3F0C0; // type:func -EnHoll_Update = 0x80A3F138; // type:func -EnHoll_Draw = 0x80A3F15C; // type:func -EnHonotrap_FlameCollisionCheck = 0x80A3F460; // type:func -EnHonotrap_GetNormal = 0x80A3F4F4; // type:func -EnHonotrap_InitEye = 0x80A3F588; // type:func -EnHonotrap_InitFlame = 0x80A3F724; // type:func -EnHonotrap_Init = 0x80A3F864; // type:func -EnHonotrap_Destroy = 0x80A3F8BC; // type:func -EnHonotrap_SetupEyeIdle = 0x80A3F908; // type:func -EnHonotrap_EyeIdle = 0x80A3F924; // type:func -EnHonotrap_SetupEyeOpen = 0x80A3F9DC; // type:func -EnHonotrap_EyeOpen = 0x80A3FA30; // type:func -EnHonotrap_SetupEyeAttack = 0x80A3FB00; // type:func -EnHonotrap_EyeAttack = 0x80A3FB18; // type:func -EnHonotrap_SetupEyeClose = 0x80A3FB48; // type:func -EnHonotrap_EyeClose = 0x80A3FB5C; // type:func -EnHonotrap_SetupFlameGrow = 0x80A3FBA8; // type:func -EnHonotrap_FlameGrow = 0x80A3FBBC; // type:func -EnHonotrap_SetupFlameDrop = 0x80A3FC50; // type:func -EnHonotrap_FlameDrop = 0x80A3FCB8; // type:func -EnHonotrap_SetupFlameMove = 0x80A3FDFC; // type:func -EnHonotrap_FlameMove = 0x80A3FE88; // type:func -EnHonotrap_SetupFlameChase = 0x80A40054; // type:func -EnHonotrap_FlameChase = 0x80A40094; // type:func -EnHonotrap_SetupFlameVanish = 0x80A40248; // type:func -EnHonotrap_FlameVanish = 0x80A4025C; // type:func -EnHonotrap_Update = 0x80A402EC; // type:func -EnHonotrap_DrawEye = 0x80A40434; // type:func -EnHonotrap_DrawFlame = 0x80A40524; // type:func -EnHonotrap_Draw = 0x80A406BC; // type:func -EnHorse_BgCheckBridgeJumpPoint = 0x80A409C0; // type:func -EnHorse_CheckBridgeJumps = 0x80A40B20; // type:func -EnHorse_RaceWaypointPos = 0x80A40C60; // type:func -EnHorse_RotateToPoint = 0x80A40CB4; // type:func -EnHorse_UpdateIngoRaceInfo = 0x80A40CF0; // type:func -EnHorse_PlayWalkingSfx = 0x80A410A4; // type:func -EnHorse_PlayTrottingSfx = 0x80A41160; // type:func -EnHorse_PlayGallopingSfx = 0x80A411A8; // type:func -EnHorse_SlopeSpeedMultiplier = 0x80A411F0; // type:func -func_80A5BB90 = 0x80A41270; // type:func -func_80A5BBBC = 0x80A412A0; // type:func -EnHorse_IdleAnimSounds = 0x80A41350; // type:func -EnHorse_Spawn = 0x80A4147C; // type:func -EnHorse_ResetCutscene = 0x80A416C0; // type:func -EnHorse_ResetRace = 0x80A416D8; // type:func -EnHorse_PlayerCanMove = 0x80A416E8; // type:func -EnHorse_ResetHorsebackArchery = 0x80A417A4; // type:func -EnHorse_ClearDustFlags = 0x80A417BC; // type:func -EnHorse_Init = 0x80A417C8; // type:func -EnHorse_Destroy = 0x80A41EF8; // type:func -EnHorse_RotateToPlayer = 0x80A41F68; // type:func -EnHorse_Freeze = 0x80A41FD8; // type:func -EnHorse_Frozen = 0x80A42058; // type:func -EnHorse_UpdateSpeed = 0x80A421C8; // type:func -EnHorse_StartMountedIdleResetAnim = 0x80A4260C; // type:func -EnHorse_StartMountedIdle = 0x80A42648; // type:func -EnHorse_MountedIdle = 0x80A42784; // type:func -EnHorse_MountedIdleAnim = 0x80A42884; // type:func -EnHorse_MountedIdleWhinney = 0x80A428A8; // type:func -EnHorse_MountedIdleWhinneying = 0x80A429A4; // type:func -EnHorse_StartTurning = 0x80A42AA4; // type:func -EnHorse_MountedTurn = 0x80A42B4C; // type:func -EnHorse_StartWalkingFromIdle = 0x80A42D10; // type:func -EnHorse_StartWalkingInterruptable = 0x80A42D60; // type:func -EnHorse_StartWalking = 0x80A42D84; // type:func -EnHorse_MountedWalkingReset = 0x80A42E30; // type:func -EnHorse_MountedWalk = 0x80A42E84; // type:func -EnHorse_StartTrotting = 0x80A43154; // type:func -EnHorse_MountedTrotReset = 0x80A431F8; // type:func -EnHorse_MountedTrot = 0x80A43244; // type:func -EnHorse_StartGallopingInterruptable = 0x80A4337C; // type:func -EnHorse_StartGalloping = 0x80A433A0; // type:func -EnHorse_MountedGallopReset = 0x80A43448; // type:func -EnHorse_JumpLanding = 0x80A434A0; // type:func -EnHorse_MountedGallop = 0x80A43524; // type:func -EnHorse_StartRearing = 0x80A436F8; // type:func -EnHorse_MountedRearing = 0x80A4381C; // type:func -EnHorse_StartBraking = 0x80A43998; // type:func -EnHorse_Stopping = 0x80A43A88; // type:func -EnHorse_StartReversingInterruptable = 0x80A43C74; // type:func -EnHorse_StartReversing = 0x80A43C98; // type:func -EnHorse_Reverse = 0x80A43D3C; // type:func -EnHorse_LowJumpInit = 0x80A440EC; // type:func -EnHorse_StartLowJump = 0x80A44110; // type:func -EnHorse_Stub1 = 0x80A44240; // type:func -EnHorse_LowJump = 0x80A4424C; // type:func -EnHorse_HighJumpInit = 0x80A44410; // type:func -EnHorse_StartHighJump = 0x80A44434; // type:func -EnHorse_Stub2 = 0x80A44570; // type:func -EnHorse_HighJump = 0x80A4457C; // type:func -EnHorse_InitInactive = 0x80A44740; // type:func -EnHorse_Inactive = 0x80A44790; // type:func -EnHorse_PlayIdleAnimation = 0x80A448BC; // type:func -EnHorse_ChangeIdleAnimation = 0x80A44A8C; // type:func -EnHorse_ResetIdleAnimation = 0x80A44AB4; // type:func -EnHorse_StartIdleRidable = 0x80A44AE8; // type:func -EnHorse_Idle = 0x80A44B1C; // type:func -EnHorse_StartMovingAnimation = 0x80A44D04; // type:func -EnHorse_SetFollowAnimation = 0x80A44E6C; // type:func -EnHorse_FollowPlayer = 0x80A44FA0; // type:func -EnHorse_InitIngoHorse = 0x80A453C4; // type:func -EnHorse_SetIngoAnimation = 0x80A45448; // type:func -EnHorse_UpdateIngoHorseAnim = 0x80A454EC; // type:func -EnHorse_UpdateIngoRace = 0x80A45800; // type:func -EnHorse_CsMoveInit = 0x80A459B0; // type:func -EnHorse_CsMoveToPoint = 0x80A45A1C; // type:func -EnHorse_CsSetAnimHighJump = 0x80A45B6C; // type:func -EnHorse_CsPlayHighJumpAnim = 0x80A45B90; // type:func -EnHorse_CsJumpInit = 0x80A45CC4; // type:func -EnHorse_CsJump = 0x80A45CFC; // type:func -EnHorse_CsRearingInit = 0x80A45F54; // type:func -EnHorse_CsRearing = 0x80A46074; // type:func -EnHorse_WarpMoveInit = 0x80A4621C; // type:func -EnHorse_CsWarpMoveToPoint = 0x80A46304; // type:func -EnHorse_CsWarpRearingInit = 0x80A46454; // type:func -EnHorse_CsWarpRearing = 0x80A465DC; // type:func -EnHorse_InitCutscene = 0x80A46784; // type:func -EnHorse_GetCutsceneFunctionIndex = 0x80A467A8; // type:func -EnHorse_CutsceneUpdate = 0x80A467F8; // type:func -EnHorse_UpdateHbaRaceInfo = 0x80A46950; // type:func -EnHorse_InitHorsebackArchery = 0x80A46B40; // type:func -EnHorse_UpdateHbaAnim = 0x80A46B74; // type:func -EnHorse_UpdateHorsebackArchery = 0x80A46EAC; // type:func -EnHorse_InitFleePlayer = 0x80A47138; // type:func -EnHorse_FleePlayer = 0x80A47160; // type:func -EnHorse_BridgeJumpInit = 0x80A479B4; // type:func -EnHorse_StartBridgeJump = 0x80A47BEC; // type:func -EnHorse_BridgeJumpMove = 0x80A47C9C; // type:func -EnHorse_CheckBridgeJumpLanding = 0x80A47DF8; // type:func -EnHorse_BridgeJump = 0x80A47EE4; // type:func -EnHorse_Vec3fOffset = 0x80A47F28; // type:func -EnHorse_CalcFloorHeight = 0x80A47FA4; // type:func -EnHorse_ObstructMovement = 0x80A480E4; // type:func -EnHorse_CheckFloors = 0x80A4820C; // type:func -EnHorse_MountDismount = 0x80A4878C; // type:func -EnHorse_StickDirection = 0x80A48890; // type:func -EnHorse_UpdateStick = 0x80A4891C; // type:func -EnHorse_ResolveCollision = 0x80A4895C; // type:func -EnHorse_BgCheckSlowMoving = 0x80A48AB4; // type:func -EnHorse_UpdateBgCheckInfo = 0x80A48BF4; // type:func -EnHorse_CheckBoost = 0x80A49700; // type:func -EnHorse_RegenBoost = 0x80A498AC; // type:func -EnHorse_UpdatePlayerDir = 0x80A49AD8; // type:func -EnHorse_TiltBody = 0x80A49BE4; // type:func -EnHorse_UpdateConveyors = 0x80A49CE0; // type:func -EnHorse_RandInt = 0x80A49DE8; // type:func -EnHorse_Update = 0x80A49E1C; // type:func -EnHorse_PlayerDirToMountSide = 0x80A4A648; // type:func -EnHorse_MountSideCheck = 0x80A4A688; // type:func -EnHorse_GetMountSide = 0x80A4A78C; // type:func -EnHorse_RandomOffset = 0x80A4A7E4; // type:func -EnHorse_PostDraw = 0x80A4A880; // type:func -EnHorse_OverrideLimbDraw = 0x80A4B378; // type:func -EnHorse_Draw = 0x80A4B478; // type:func -EnHorseGameCheck_InitIngoRace = 0x80A4CC20; // type:func -EnHorseGameCheck_DestroyIngoRace = 0x80A4CCDC; // type:func -EnHorseGameCheck_FinishIngoRace = 0x80A4CCF0; // type:func -EnHorseGameCheck_UpdateIngoRace = 0x80A4CE3C; // type:func -EnHorseGameCheck_InitGerudoArchery = 0x80A4D2B4; // type:func -EnHorseGameCheck_DestroyGerudoArchery = 0x80A4D2D4; // type:func -EnHorseGameCheck_UpdateGerudoArchery = 0x80A4D2E8; // type:func -EnHorseGameCheck_InitType3 = 0x80A4D330; // type:func -EnHorseGameCheck_DestroyType3 = 0x80A4D34C; // type:func -EnHorseGameCheck_UpdateType3 = 0x80A4D360; // type:func -EnHorseGameCheck_InitMalonRace = 0x80A4D374; // type:func -EnHorseGameCheck_DestroyMalonRace = 0x80A4D3C4; // type:func -EnHorseGameCheck_FinishMalonRace = 0x80A4D3D8; // type:func -EnHorseGameCheck_UpdateMalonRace = 0x80A4D4CC; // type:func -EnHorseGameCheck_Init = 0x80A4D9E4; // type:func -EnHorseGameCheck_Destroy = 0x80A4DA68; // type:func -EnHorseGameCheck_Update = 0x80A4DAA4; // type:func -EnHorseGameCheck_Draw = 0x80A4DAE0; // type:func -func_80A68660 = 0x80A4DCF0; // type:func -func_80A686A8 = 0x80A4DD3C; // type:func -func_80A68870 = 0x80A4DF04; // type:func -EnHorseGanon_Init = 0x80A4DFC0; // type:func -EnHorseGanon_Destroy = 0x80A4E10C; // type:func -func_80A68AC4 = 0x80A4E15C; // type:func -func_80A68AF0 = 0x80A4E18C; // type:func -func_80A68B20 = 0x80A4E1C0; // type:func -func_80A68DB0 = 0x80A4E450; // type:func -func_80A68E14 = 0x80A4E4B4; // type:func -EnHorseGanon_Update = 0x80A4E578; // type:func -EnHorseGanon_PostDraw = 0x80A4E64C; // type:func -EnHorseGanon_Draw = 0x80A4E7D8; // type:func -func_80A693D0 = 0x80A4EA70; // type:func -func_80A6948C = 0x80A4EB2C; // type:func -func_80A695A4 = 0x80A4EC44; // type:func -EnHorseLinkChild_Init = 0x80A4ED0C; // type:func -EnHorseLinkChild_Destroy = 0x80A4EEE4; // type:func -func_80A6988C = 0x80A4EF34; // type:func -func_80A698F4 = 0x80A4EF98; // type:func -func_80A6993C = 0x80A4EFE0; // type:func -func_80A699FC = 0x80A4F0A0; // type:func -func_80A69B7C = 0x80A4F228; // type:func -func_80A69C18 = 0x80A4F2C8; // type:func -func_80A69EC0 = 0x80A4F570; // type:func -func_80A69F5C = 0x80A4F610; // type:func -func_80A6A068 = 0x80A4F71C; // type:func -func_80A6A4DC = 0x80A4FB98; // type:func -func_80A6A5A4 = 0x80A4FC60; // type:func -func_80A6A724 = 0x80A4FDE0; // type:func -func_80A6A7D0 = 0x80A4FE90; // type:func -EnHorseLinkChild_Update = 0x80A5016C; // type:func -EnHorseLinkChild_PostDraw = 0x80A502C4; // type:func -EnHorseLinkChild_OverrideLimbDraw = 0x80A50450; // type:func -EnHorseLinkChild_Draw = 0x80A504D8; // type:func -func_80A6B250 = 0x80A50870; // type:func -func_80A6B30C = 0x80A5092C; // type:func -EnHorseNormal_Init = 0x80A509F4; // type:func -EnHorseNormal_Destroy = 0x80A50EE4; // type:func -func_80A6B91C = 0x80A50F44; // type:func -EnHorseNormal_FollowPath = 0x80A50FFC; // type:func -EnHorseNormal_NextAnimation = 0x80A511D8; // type:func -EnHorseNormal_CycleAnimations = 0x80A5122C; // type:func -func_80A6BC48 = 0x80A51274; // type:func -func_80A6BCEC = 0x80A5131C; // type:func -func_80A6BD7C = 0x80A513AC; // type:func -EnHorseNormal_Wander = 0x80A514A0; // type:func -func_80A6C4CC = 0x80A51B04; // type:func -EnHorseNormal_Wait = 0x80A51BAC; // type:func -func_80A6C6B0 = 0x80A51CEC; // type:func -EnHorseNormal_WaitClone = 0x80A51DA0; // type:func -func_80A6C8E0 = 0x80A51F24; // type:func -EnHorseNormal_Update = 0x80A51FE8; // type:func -EnHorseNormal_PostDraw = 0x80A52144; // type:func -func_80A6CC88 = 0x80A522D0; // type:func -EnHorseNormal_Draw = 0x80A524B8; // type:func -EnHorseZelda_GetFieldPosition = 0x80A52E90; // type:func -EnHorseZelda_Move = 0x80A52EDC; // type:func -EnHorseZelda_Init = 0x80A530A4; // type:func -EnHorseZelda_Destroy = 0x80A531F4; // type:func -EnHorseZelda_SetupStop = 0x80A53244; // type:func -EnHorseZelda_Stop = 0x80A53294; // type:func -EnHorseZelda_Spur = 0x80A532DC; // type:func -EnHorseZelda_Gallop = 0x80A533C4; // type:func -EnHorseZelda_SetRotate = 0x80A53404; // type:func -EnHorseZelda_Update = 0x80A534C8; // type:func -EnHorseZelda_PostDraw = 0x80A535A4; // type:func -EnHorseZelda_Draw = 0x80A53730; // type:func -func_80A6E3A0 = 0x80A53980; // type:func -EnHs_Init = 0x80A5398C; // type:func -EnHs_Destroy = 0x80A53AD0; // type:func -func_80A6E53C = 0x80A53AFC; // type:func -func_80A6E5EC = 0x80A53BB0; // type:func -func_80A6E630 = 0x80A53BF4; // type:func -func_80A6E6B0 = 0x80A53C74; // type:func -func_80A6E6D8 = 0x80A53C9C; // type:func -func_80A6E70C = 0x80A53CD4; // type:func -func_80A6E740 = 0x80A53D0C; // type:func -func_80A6E7BC = 0x80A53D8C; // type:func -func_80A6E8CC = 0x80A53E9C; // type:func -func_80A6E9AC = 0x80A53F78; // type:func -EnHs_Update = 0x80A540C0; // type:func -EnHs_OverrideLimbDraw = 0x80A5422C; // type:func -EnHs_PostLimbDraw = 0x80A542E8; // type:func -EnHs_Draw = 0x80A54328; // type:func -EnHs2_Init = 0x80A54520; // type:func -EnHs2_Destroy = 0x80A54600; // type:func -func_80A6F0B4 = 0x80A5462C; // type:func -func_80A6F164 = 0x80A546E0; // type:func -func_80A6F1A4 = 0x80A5471C; // type:func -EnHs2_Update = 0x80A54768; // type:func -EnHs2_OverrideLimbDraw = 0x80A548D4; // type:func -EnHs2_PostLimbDraw = 0x80A5495C; // type:func -EnHs2_Draw = 0x80A5499C; // type:func -EnHy_FindSkelAndHeadObjects = 0x80A54B00; // type:func -EnHy_AreSkelAndHeadObjectsLoaded = 0x80A54C14; // type:func -EnHy_FindOsAnimeObject = 0x80A54C9C; // type:func -EnHy_IsOsAnimeObjectLoaded = 0x80A54CEC; // type:func -func_80A6F7CC = 0x80A54D2C; // type:func -EnHy_GetTextId = 0x80A54D70; // type:func -EnHy_UpdateTalkState = 0x80A555B8; // type:func -EnHy_UpdateEyes = 0x80A55B04; // type:func -EnHy_InitCollider = 0x80A55BC0; // type:func -EnHy_InitSetProperties = 0x80A55BFC; // type:func -EnHy_UpdateCollider = 0x80A55C94; // type:func -func_80A70834 = 0x80A55D98; // type:func -func_80A70978 = 0x80A55EE0; // type:func -EnHy_ShouldSpawn = 0x80A56050; // type:func -EnHy_Init = 0x80A562EC; // type:func -EnHy_Destroy = 0x80A5637C; // type:func -EnHy_InitImpl = 0x80A563A8; // type:func -func_80A710F8 = 0x80A56674; // type:func -func_80A711B4 = 0x80A56730; // type:func -func_80A7127C = 0x80A567FC; // type:func -EnHy_DoNothing = 0x80A56834; // type:func -func_80A712C0 = 0x80A56844; // type:func -func_80A7134C = 0x80A568D0; // type:func -func_80A714C4 = 0x80A56A4C; // type:func -func_80A71530 = 0x80A56ABC; // type:func -EnHy_Update = 0x80A56B6C; // type:func -EnHy_OverrideLimbDraw = 0x80A56C4C; // type:func -EnHy_PostLimbDraw = 0x80A56FB8; // type:func -EnHy_SetEnvColor = 0x80A570C4; // type:func -EnHy_Draw = 0x80A57130; // type:func -EnIceHono_XZDistanceSquared = 0x80A58440; // type:func -EnIceHono_InitCapturableFlame = 0x80A58470; // type:func -EnIceHono_InitDroppedFlame = 0x80A58514; // type:func -EnIceHono_InitSmallFlame = 0x80A5861C; // type:func -EnIceHono_Init = 0x80A58684; // type:func -EnIceHono_Destroy = 0x80A587E4; // type:func -EnIceHono_InBottleRange = 0x80A5883C; // type:func -EnIceHono_SetupActionCapturableFlame = 0x80A5892C; // type:func -EnIceHono_CapturableFlame = 0x80A58954; // type:func -EnIceHono_SetupActionDroppedFlame = 0x80A58A04; // type:func -EnIceHono_DropFlame = 0x80A58A28; // type:func -EnIceHono_SetupActionSpreadFlames = 0x80A58BE8; // type:func -EnIceHono_SpreadFlames = 0x80A58C0C; // type:func -EnIceHono_SetupActionSmallFlame = 0x80A58E68; // type:func -EnIceHono_SmallFlameMove = 0x80A58F3C; // type:func -EnIceHono_Update = 0x80A59094; // type:func -EnIceHono_Draw = 0x80A59228; // type:func -EnIk_Destroy = 0x80A59630; // type:func -EnIk_SetupAction = 0x80A596B0; // type:func -EnIk_InitImpl = 0x80A596BC; // type:func -EnIk_HandleBlocking = 0x80A59908; // type:func -EnIk_FindBreakableProp = 0x80A59998; // type:func -EnIk_SetupStandUp = 0x80A59A38; // type:func -EnIk_StandUp = 0x80A59AE4; // type:func -EnIk_SetupIdle = 0x80A59BC4; // type:func -EnIk_Idle = 0x80A59C54; // type:func -EnIk_SetupWalkOrRun = 0x80A59DD4; // type:func -EnIk_WalkOrRun = 0x80A59ECC; // type:func -EnIk_SetupVerticalAttack = 0x80A5A154; // type:func -EnIk_VerticalAttack = 0x80A5A1E4; // type:func -EnIk_SetupPullOutAxe = 0x80A5A398; // type:func -EnIk_PullOutAxe = 0x80A5A438; // type:func -EnIk_SetupDoubleHorizontalAttack = 0x80A5A4F4; // type:func -EnIk_DoubleHorizontalAttack = 0x80A5A58C; // type:func -EnIk_SetupRecoverFromHorizontalAttack = 0x80A5A6FC; // type:func -EnIk_RecoverFromHorizontalAttack = 0x80A5A788; // type:func -EnIk_SetupSingleHorizontalAttack = 0x80A5A7D0; // type:func -EnIk_SingleHorizontalAttack = 0x80A5A860; // type:func -EnIk_SetupStopAndBlock = 0x80A5A920; // type:func -EnIk_StopAndBlock = 0x80A5A9AC; // type:func -EnIk_SetupReactToAttack = 0x80A5AAC0; // type:func -EnIk_ReactToAttack = 0x80A5ABE0; // type:func -EnIk_SetupDie = 0x80A5ACBC; // type:func -EnIk_Die = 0x80A5AD68; // type:func -EnIk_UpdateDamage = 0x80A5AF64; // type:func -EnIk_UpdateEnemy = 0x80A5B2D0; // type:func -EnIk_SetPrimEnvColors = 0x80A5B4E8; // type:func -EnIk_OverrideLimbDrawEnemy = 0x80A5B5A0; // type:func -EnIk_PostLimbDrawEnemy = 0x80A5B660; // type:func -EnIk_DrawEnemy = 0x80A5BA74; // type:func -EnIk_StartMinibossBgm = 0x80A5BEAC; // type:func -EnIk_UpdateAction2Sfx = 0x80A5BECC; // type:func -EnIk_PlayAxeSpawnSfx = 0x80A5C098; // type:func -EnIk_SpawnAxeSmoke = 0x80A5C0E8; // type:func -EnIk_UpdateBgCheckInfo = 0x80A5C2F4; // type:func -EnIk_UpdateSkelAnime = 0x80A5C33C; // type:func -EnIk_GetCue = 0x80A5C360; // type:func -EnIk_SetStartPosRotFromCue = 0x80A5C388; // type:func -EnIk_GetAnimCurFrame = 0x80A5C408; // type:func -EnIk_SetupCsAction0 = 0x80A5C414; // type:func -EnIk_SetupCsAction1 = 0x80A5C428; // type:func -EnIk_SetupCsAction2 = 0x80A5C4B4; // type:func -EnIk_HandleEnemyChange = 0x80A5C534; // type:func -EnIk_PlayArmorFallSfx = 0x80A5C574; // type:func -EnIk_PlayDeathSfx = 0x80A5C5BC; // type:func -EnIk_SetupCsAction3 = 0x80A5C630; // type:func -EnIk_SetupCsAction4 = 0x80A5C708; // type:func -EnIk_SetupCsAction5 = 0x80A5C744; // type:func -EnIk_CsAction3 = 0x80A5C760; // type:func -EnIk_CsAction4 = 0x80A5C798; // type:func -EnIk_CsAction5 = 0x80A5C7D8; // type:func -EnIk_OverrideLimbDrawDefeat = 0x80A5C814; // type:func -EnIk_PostLimbDrawDefeat = 0x80A5C880; // type:func -EnIk_CsDrawDefeat = 0x80A5CACC; // type:func -EnIk_HandleCsCues = 0x80A5CC30; // type:func -EnIk_CsAction0 = 0x80A5CD2C; // type:func -EnIk_CsAction1 = 0x80A5CD4C; // type:func -EnIk_CsAction2 = 0x80A5CD84; // type:func -EnIk_UpdateCutscene = 0x80A5CDE8; // type:func -EnIk_OverrideLimbDrawIntro = 0x80A5CE30; // type:func -EnIk_PostLimbDrawIntro = 0x80A5CEB4; // type:func -EnIk_CsDrawNothing = 0x80A5D0A0; // type:func -EnIk_CsDrawIntro = 0x80A5D0B0; // type:func -EnIk_DrawCutscene = 0x80A5D214; // type:func -EnIk_CsInit = 0x80A5D25C; // type:func -EnIk_ChangeToEnemy = 0x80A5D2CC; // type:func -EnIk_StartDefeatCutscene = 0x80A5D338; // type:func -EnIk_Init = 0x80A5D3CC; // type:func -EnIn_GetTextIdChild = 0x80A5DC90; // type:func -EnIn_GetTextIdAdult = 0x80A5DCF0; // type:func -EnIn_GetTextId = 0x80A5DE48; // type:func -EnIn_UpdateTalkStateOnClosing = 0x80A5DEAC; // type:func -EnIn_UpdateTalkStateOnChoice = 0x80A5DF20; // type:func -EnIn_UpdateTalkStateOnEvent = 0x80A5E170; // type:func -EnIn_UpdateTalkState = 0x80A5E1DC; // type:func -func_80A795C8 = 0x80A5E2A4; // type:func -func_80A79690 = 0x80A5E36C; // type:func -EnIn_ChangeAnim = 0x80A5E3C8; // type:func -func_80A7975C = 0x80A5E438; // type:func -func_80A79830 = 0x80A5E50C; // type:func -EnIn_UpdateEyes = 0x80A5E708; // type:func -func_80A79AB4 = 0x80A5E790; // type:func -func_80A79BAC = 0x80A5E888; // type:func -func_80A79C78 = 0x80A5E954; // type:func -EnIn_Init = 0x80A5EB48; // type:func -EnIn_Destroy = 0x80A5EC54; // type:func -EnIn_WaitForObject = 0x80A5EC98; // type:func -func_80A7A304 = 0x80A5EFF0; // type:func -func_80A7A4BC = 0x80A5F1A8; // type:func -func_80A7A4C8 = 0x80A5F1B8; // type:func -func_80A7A568 = 0x80A5F25C; // type:func -func_80A7A770 = 0x80A5F464; // type:func -func_80A7A848 = 0x80A5F53C; // type:func -func_80A7A940 = 0x80A5F634; // type:func -func_80A7AA40 = 0x80A5F734; // type:func -func_80A7ABD4 = 0x80A5F8C8; // type:func -func_80A7AE84 = 0x80A5FB7C; // type:func -func_80A7AEF0 = 0x80A5FBE8; // type:func -func_80A7B018 = 0x80A5FD14; // type:func -func_80A7B024 = 0x80A5FD24; // type:func -EnIn_Update = 0x80A5FE10; // type:func -EnIn_OverrideLimbDraw = 0x80A60024; // type:func -EnIn_PostLimbDraw = 0x80A60278; // type:func -EnIn_Draw = 0x80A60388; // type:func -EnInsect_InitFlags = 0x80A60A30; // type:func -EnInsect_XZDistanceSquared = 0x80A60A54; // type:func -EnInsect_InBottleRange = 0x80A60A84; // type:func -EnInsect_SetCrawlAnim = 0x80A60B74; // type:func -EnInsect_TryFindNearbySoil = 0x80A60BC0; // type:func -EnInsect_UpdateCrawlSfx = 0x80A60C78; // type:func -EnInsect_Init = 0x80A60D0C; // type:func -EnInsect_Destroy = 0x80A60F58; // type:func -EnInsect_SetupSlowDown = 0x80A60FC8; // type:func -EnInsect_SlowDown = 0x80A61018; // type:func -EnInsect_SetupCrawl = 0x80A611BC; // type:func -EnInsect_Crawl = 0x80A6120C; // type:func -EnInsect_SetupRunFromPlayer = 0x80A61438; // type:func -EnInsect_RunFromPlayer = 0x80A61488; // type:func -EnInsect_SetupCaught = 0x80A61680; // type:func -EnInsect_Caught = 0x80A616EC; // type:func -EnInsect_SetupDig = 0x80A617E4; // type:func -EnInsect_Dig = 0x80A6185C; // type:func -EnInsect_SetupWalkOnWater = 0x80A61A80; // type:func -EnInsect_WalkOnWater = 0x80A61AE0; // type:func -EnInsect_SetupDrown = 0x80A61E14; // type:func -EnInsect_Drown = 0x80A61E8C; // type:func -EnInsect_SetupDropped = 0x80A61FBC; // type:func -EnInsect_Dropped = 0x80A62084; // type:func -EnInsect_Update = 0x80A627B4; // type:func -EnInsect_Draw = 0x80A629FC; // type:func -EnIshi_InitCollider = 0x80A62F50; // type:func -EnIshi_SnapToFloor = 0x80A62FC8; // type:func -EnIshi_SpawnFragmentsSmall = 0x80A6306C; // type:func -EnIshi_SpawnFragmentsLarge = 0x80A632E8; // type:func -EnIshi_SpawnDustSmall = 0x80A635D4; // type:func -EnIshi_SpawnDustLarge = 0x80A636C8; // type:func -EnIshi_DropCollectible = 0x80A637BC; // type:func -EnIshi_Fall = 0x80A6382C; // type:func -func_80A7ED94 = 0x80A63860; // type:func -EnIshi_SpawnBugs = 0x80A638E4; // type:func -EnIshi_Init = 0x80A639A0; // type:func -EnIshi_Destroy = 0x80A63B3C; // type:func -EnIshi_SetupWait = 0x80A63B68; // type:func -EnIshi_Wait = 0x80A63B7C; // type:func -EnIshi_SetupLiftedUp = 0x80A63DD4; // type:func -EnIshi_LiftedUp = 0x80A63DFC; // type:func -EnIshi_SetupFly = 0x80A63ED0; // type:func -EnIshi_Fly = 0x80A63FFC; // type:func -EnIshi_Update = 0x80A64368; // type:func -EnIshi_DrawSmall = 0x80A6438C; // type:func -EnIshi_DrawLarge = 0x80A643BC; // type:func -EnIshi_Draw = 0x80A64464; // type:func -EnIt_Init = 0x80A6C0A0; // type:func -EnIt_Destroy = 0x80A6C10C; // type:func -EnIt_Update = 0x80A6C138; // type:func -EnJj_SetupAction = 0x80A6C230; // type:func -EnJj_Init = 0x80A6C23C; // type:func -EnJj_Destroy = 0x80A6C4CC; // type:func -EnJj_Blink = 0x80A6C55C; // type:func -EnJj_OpenMouth = 0x80A6C5DC; // type:func -EnJj_WaitToOpenMouth = 0x80A6C630; // type:func -EnJj_WaitForFish = 0x80A6C674; // type:func -EnJj_BeginCutscene = 0x80A6C730; // type:func -EnJj_CutsceneUpdate = 0x80A6C7D8; // type:func -EnJj_RemoveDust = 0x80A6C934; // type:func -EnJj_UpdateStaticCollision = 0x80A6C98C; // type:func -EnJj_Update = 0x80A6C99C; // type:func -EnJj_Draw = 0x80A6CA48; // type:func -En_Js_SetupAction = 0x80A6D800; // type:func -EnJs_Init = 0x80A6D80C; // type:func -EnJs_Destroy = 0x80A6D930; // type:func -func_80A88F64 = 0x80A6D95C; // type:func -func_80A89008 = 0x80A6DA04; // type:func -func_80A89078 = 0x80A6DA78; // type:func -func_80A890C0 = 0x80A6DAC4; // type:func -func_80A8910C = 0x80A6DB14; // type:func -func_80A89160 = 0x80A6DB68; // type:func -func_80A891C4 = 0x80A6DBD0; // type:func -func_80A89294 = 0x80A6DCA4; // type:func -func_80A89304 = 0x80A6DD18; // type:func -EnJs_Update = 0x80A6DD50; // type:func -EnJs_OverrideLimbDraw = 0x80A6DFDC; // type:func -EnJs_PostLimbDraw = 0x80A6E014; // type:func -EnJs_Draw = 0x80A6E054; // type:func -EnJsjutan_Init = 0x80A6E1D0; // type:func -EnJsjutan_Destroy = 0x80A6E264; // type:func -func_80A89860 = 0x80A6E298; // type:func -func_80A89A6C = 0x80A6E4A4; // type:func -EnJsjutan_Update = 0x80A6EF84; // type:func -EnJsjutan_Draw = 0x80A6F05C; // type:func -EnKakasi_Destroy = 0x80A73B00; // type:func -EnKakasi_Init = 0x80A73B2C; // type:func -func_80A8F28C = 0x80A73BF4; // type:func -func_80A8F320 = 0x80A73C88; // type:func -func_80A8F660 = 0x80A73FC8; // type:func -func_80A8F75C = 0x80A740C4; // type:func -func_80A8F8D0 = 0x80A74240; // type:func -func_80A8F9C8 = 0x80A7432C; // type:func -func_80A8FAA4 = 0x80A7440C; // type:func -func_80A8FBB8 = 0x80A74510; // type:func -EnKakasi_Update = 0x80A745A8; // type:func -EnKakasi_Draw = 0x80A746AC; // type:func -EnKakasi2_Init = 0x80A74840; // type:func -EnKakasi2_Destroy = 0x80A7499C; // type:func -func_80A90264 = 0x80A749C8; // type:func -func_80A904D8 = 0x80A74B20; // type:func -func_80A90578 = 0x80A74BC0; // type:func -func_80A9062C = 0x80A74C74; // type:func -func_80A906C4 = 0x80A74D0C; // type:func -EnKakasi2_Update = 0x80A74D7C; // type:func -func_80A90948 = 0x80A74E3C; // type:func -EnKakasi3_Destroy = 0x80A74F60; // type:func -EnKakasi3_Init = 0x80A74F8C; // type:func -func_80A90E28 = 0x80A75054; // type:func -func_80A90EBC = 0x80A750E8; // type:func -func_80A911F0 = 0x80A7541C; // type:func -func_80A91284 = 0x80A754B0; // type:func -func_80A91348 = 0x80A75574; // type:func -func_80A915B8 = 0x80A757EC; // type:func -func_80A91620 = 0x80A75858; // type:func -func_80A91760 = 0x80A75998; // type:func -func_80A917FC = 0x80A75A38; // type:func -func_80A9187C = 0x80A75AC0; // type:func -func_80A918E4 = 0x80A75B2C; // type:func -func_80A91A90 = 0x80A75C70; // type:func -EnKakasi3_Update = 0x80A75D70; // type:func -EnKakasi3_Draw = 0x80A75E68; // type:func -EnKanban_SetFloorRot = 0x80A76040; // type:func -EnKanban_Init = 0x80A760FC; // type:func -EnKanban_Destroy = 0x80A76224; // type:func -EnKanban_Message = 0x80A7625C; // type:func -EnKanban_Update = 0x80A76314; // type:func -EnKanban_Draw = 0x80A77B90; // type:func -EnKarebaba_Init = 0x80A79190; // type:func -EnKarebaba_Destroy = 0x80A792C4; // type:func -EnKarebaba_ResetCollider = 0x80A79304; // type:func -EnKarebaba_SetupGrow = 0x80A79340; // type:func -EnKarebaba_SetupIdle = 0x80A79390; // type:func -EnKarebaba_SetupAwaken = 0x80A793E4; // type:func -EnKarebaba_SetupUpright = 0x80A79460; // type:func -EnKarebaba_SetupSpin = 0x80A79500; // type:func -EnKarebaba_SetupDying = 0x80A7951C; // type:func -EnKarebaba_SetupDeadItemDrop = 0x80A79590; // type:func -EnKarebaba_SetupRetract = 0x80A79630; // type:func -EnKarebaba_SetupDead = 0x80A796B0; // type:func -EnKarebaba_SetupRegrow = 0x80A7973C; // type:func -EnKarebaba_Grow = 0x80A79790; // type:func -EnKarebaba_Idle = 0x80A79828; // type:func -EnKarebaba_Awaken = 0x80A79888; // type:func -EnKarebaba_Upright = 0x80A7995C; // type:func -EnKarebaba_Spin = 0x80A79A50; // type:func -EnKarebaba_Dying = 0x80A79BE4; // type:func -EnKarebaba_DeadItemDrop = 0x80A79E9C; // type:func -EnKarebaba_Retract = 0x80A79F04; // type:func -EnKarebaba_Dead = 0x80A79FD8; // type:func -EnKarebaba_Regrow = 0x80A7A030; // type:func -EnKarebaba_Update = 0x80A7A0FC; // type:func -EnKarebaba_DrawBaseShadow = 0x80A7A2B0; // type:func -EnKarebaba_Draw = 0x80A7A39C; // type:func -EnKo_AreObjectsAvailable = 0x80A7AA80; // type:func -EnKo_AreObjectsLoaded = 0x80A7AB98; // type:func -EnKo_IsOsAnimeAvailable = 0x80A7AC20; // type:func -EnKo_IsOsAnimeLoaded = 0x80A7AC70; // type:func -EnKo_GetTextIdChild = 0x80A7ACB0; // type:func -EnKo_GetTextIdAdult = 0x80A7B018; // type:func -EnKo_GetTextId = 0x80A7B2F0; // type:func -EnKo_UpdateTalkState = 0x80A7B41C; // type:func -EnKo_GetForestQuestState = 0x80A7B81C; // type:func -func_80A97BC0 = 0x80A7B8A4; // type:func -func_80A97C7C = 0x80A7B960; // type:func -EnKo_IsWithinTalkAngle = 0x80A7B9E4; // type:func -func_80A97D68 = 0x80A7BA50; // type:func -func_80A97E18 = 0x80A7BB00; // type:func -func_80A97EB0 = 0x80A7BB9C; // type:func -func_80A97F20 = 0x80A7BC10; // type:func -func_80A97F70 = 0x80A7BC60; // type:func -func_80A98034 = 0x80A7BD24; // type:func -func_80A98124 = 0x80A7BE18; // type:func -func_80A98174 = 0x80A7BE68; // type:func -EnKo_ChildStart = 0x80A7BF4C; // type:func -EnKo_ChildStone = 0x80A7C054; // type:func -EnKo_ChildSaria = 0x80A7C15C; // type:func -EnKo_AdultEnemy = 0x80A7C264; // type:func -EnKo_AdultSaved = 0x80A7C36C; // type:func -func_80A9877C = 0x80A7C474; // type:func -EnKo_CanSpawn = 0x80A7C630; // type:func -EnKo_Blink = 0x80A7C914; // type:func -func_80A98CD8 = 0x80A7C9D4; // type:func -EnKo_GetForestQuestState2 = 0x80A7CA2C; // type:func -func_80A98DB4 = 0x80A7CAB8; // type:func -func_80A98ECC = 0x80A7CBD0; // type:func -EnKo_Init = 0x80A7CC98; // type:func -EnKo_Destroy = 0x80A7CD28; // type:func -func_80A99048 = 0x80A7CD54; // type:func -func_80A99384 = 0x80A7D084; // type:func -func_80A99438 = 0x80A7D138; // type:func -func_80A99504 = 0x80A7D204; // type:func -func_80A99560 = 0x80A7D264; // type:func -func_80A995CC = 0x80A7D2D4; // type:func -EnKo_Update = 0x80A7D410; // type:func -EnKo_OverrideLimbDraw = 0x80A7D574; // type:func -EnKo_PostLimbDraw = 0x80A7D8D4; // type:func -EnKo_SetEnvColor = 0x80A7D9A4; // type:func -EnKo_Draw = 0x80A7DA10; // type:func -EnKusa_SetupAction = 0x80A7EBC0; // type:func -EnKusa_SnapToFloor = 0x80A7EBD0; // type:func -EnKusa_DropCollectible = 0x80A7EC74; // type:func -EnKusa_UpdateVelY = 0x80A7ED40; // type:func -EnKusa_RandScaleVecToZero = 0x80A7ED74; // type:func -EnKusa_SetScaleSmall = 0x80A7EDF8; // type:func -EnKusa_SpawnFragments = 0x80A7EE1C; // type:func -EnKusa_SpawnBugs = 0x80A7F174; // type:func -EnKusa_InitCollider = 0x80A7F230; // type:func -EnKusa_Init = 0x80A7F288; // type:func -EnKusa_Destroy = 0x80A7F3B0; // type:func -EnKusa_SetupWaitForObject = 0x80A7F3DC; // type:func -EnKusa_WaitForObject = 0x80A7F400; // type:func -EnKusa_SetupMain = 0x80A7F490; // type:func -EnKusa_Main = 0x80A7F4C8; // type:func -EnKusa_SetupLiftedUp = 0x80A7F690; // type:func -EnKusa_LiftedUp = 0x80A7F6CC; // type:func -EnKusa_SetupFall = 0x80A7F7AC; // type:func -EnKusa_Fall = 0x80A7F818; // type:func -EnKusa_SetupCut = 0x80A7FAA8; // type:func -EnKusa_CutWaitRegrow = 0x80A7FAF8; // type:func -EnKusa_DoNothing = 0x80A7FB2C; // type:func -EnKusa_SetupUprootedWaitRegrow = 0x80A7FB3C; // type:func -EnKusa_UprootedWaitRegrow = 0x80A7FBA8; // type:func -EnKusa_SetupRegrow = 0x80A7FC0C; // type:func -EnKusa_Regrow = 0x80A7FC64; // type:func -EnKusa_Update = 0x80A7FCFC; // type:func -EnKusa_Draw = 0x80A7FD60; // type:func -EnKz_GetTextIdChild = 0x80A800A0; // type:func -EnKz_GetTextIdAdult = 0x80A800FC; // type:func -EnKz_GetTextId = 0x80A801AC; // type:func -EnKz_UpdateTalkState = 0x80A80214; // type:func -EnKz_UpdateEyes = 0x80A80438; // type:func -EnKz_UpdateTalking = 0x80A804B0; // type:func -func_80A9CB18 = 0x80A8066C; // type:func -EnKz_FollowPath = 0x80A8082C; // type:func -EnKz_SetMovedPos = 0x80A80998; // type:func -EnKz_Init = 0x80A80A60; // type:func -EnKz_Destroy = 0x80A80BEC; // type:func -EnKz_PreMweepWait = 0x80A80C18; // type:func -EnKz_SetupMweep = 0x80A80C88; // type:func -EnKz_Mweep = 0x80A80DB4; // type:func -EnKz_StopMweep = 0x80A80F20; // type:func -EnKz_Wait = 0x80A80F84; // type:func -EnKz_SetupGetItem = 0x80A80FEC; // type:func -EnKz_StartTimer = 0x80A81080; // type:func -EnKz_Update = 0x80A81118; // type:func -EnKz_OverrideLimbDraw = 0x80A811D4; // type:func -EnKz_PostLimbDraw = 0x80A812A4; // type:func -EnKz_Draw = 0x80A81300; // type:func -EnLight_Init = 0x80A81640; // type:func -EnLight_Destroy = 0x80A81820; // type:func -EnLight_UpdatePosRot = 0x80A81854; // type:func -EnLight_Update = 0x80A818D0; // type:func -EnLight_UpdateSwitch = 0x80A81B74; // type:func -EnLight_Draw = 0x80A81FAC; // type:func -EnLightbox_Init = 0x80A82440; // type:func -EnLightbox_Destroy = 0x80A8256C; // type:func -EnLightbox_Update = 0x80A825A0; // type:func -EnLightbox_Draw = 0x80A82828; // type:func -EnMFire1_Init = 0x80A828C0; // type:func -EnMFire1_Destroy = 0x80A8292C; // type:func -EnMFire1_Update = 0x80A82958; // type:func -func_80A9EFE0 = 0x80A82A60; // type:func -EnMThunder_Init = 0x80A82A6C; // type:func -EnMThunder_Destroy = 0x80A82D2C; // type:func -func_80A9F314 = 0x80A82D9C; // type:func -func_80A9F350 = 0x80A82DD8; // type:func -func_80A9F408 = 0x80A82E90; // type:func -func_80A9F938 = 0x80A833C4; // type:func -func_80A9F9B4 = 0x80A83440; // type:func -EnMThunder_Update = 0x80A835AC; // type:func -EnMThunder_Draw = 0x80A83780; // type:func -EnMa1_GetTextId = 0x80A84060; // type:func -EnMa1_UpdateTalkState = 0x80A84148; // type:func -EnMa1_ShouldSpawn = 0x80A84294; // type:func -EnMa1_UpdateEyes = 0x80A843E0; // type:func -EnMa1_ChangeAnim = 0x80A84458; // type:func -EnMa1_UpdateTracking = 0x80A844C8; // type:func -EnMa1_UpdateSinging = 0x80A84548; // type:func -EnMa1_Init = 0x80A845C0; // type:func -EnMa1_Destroy = 0x80A84728; // type:func -EnMa1_Idle = 0x80A84768; // type:func -EnMa1_GiveWeirdEgg = 0x80A84880; // type:func -EnMa1_FinishGivingWeirdEgg = 0x80A848E0; // type:func -EnMa1_IdleTeachSong = 0x80A84928; // type:func -EnMa1_StartTeachSong = 0x80A84A54; // type:func -EnMa1_TeachSong = 0x80A84AD8; // type:func -EnMa1_WaitForPlayback = 0x80A84B40; // type:func -EnMa1_DoNothing = 0x80A84BB8; // type:func -EnMa1_Update = 0x80A84BC8; // type:func -EnMa1_OverrideLimbDraw = 0x80A84CB4; // type:func -EnMa1_PostLimbDraw = 0x80A84E44; // type:func -EnMa1_Draw = 0x80A84EA0; // type:func -EnMa2_GetTextId = 0x80A85340; // type:func -EnMa2_UpdateTalkState = 0x80A853D8; // type:func -func_80AA1AE4 = 0x80A85488; // type:func -func_80AA1B58 = 0x80A854FC; // type:func -func_80AA1C68 = 0x80A8560C; // type:func -EnMa2_UpdateEyes = 0x80A85664; // type:func -EnMa2_ChangeAnim = 0x80A856F0; // type:func -func_80AA1DB4 = 0x80A85760; // type:func -EnMa2_Init = 0x80A857EC; // type:func -EnMa2_Destroy = 0x80A85990; // type:func -func_80AA2018 = 0x80A859D0; // type:func -func_80AA204C = 0x80A85A04; // type:func -func_80AA20E4 = 0x80A85AA0; // type:func -func_80AA21C8 = 0x80A85B8C; // type:func -EnMa2_Update = 0x80A85C2C; // type:func -EnMa2_OverrideLimbDraw = 0x80A85D1C; // type:func -EnMa2_PostLimbDraw = 0x80A85F5C; // type:func -EnMa2_Draw = 0x80A86010; // type:func -EnMa3_GetTextId = 0x80A863A0; // type:func -EnMa3_UpdateTalkState = 0x80A864D8; // type:func -func_80AA2E54 = 0x80A86758; // type:func -func_80AA2EC8 = 0x80A867CC; // type:func -func_80AA2F28 = 0x80A86830; // type:func -EnMa3_UpdateEyes = 0x80A86888; // type:func -EnMa3_ChangeAnim = 0x80A86914; // type:func -EnMa3_Init = 0x80A86984; // type:func -EnMa3_Destroy = 0x80A86AD8; // type:func -func_80AA3200 = 0x80A86B18; // type:func -EnMa3_Update = 0x80A86B4C; // type:func -EnMa3_OverrideLimbDraw = 0x80A86C60; // type:func -EnMa3_PostLimbDraw = 0x80A86EA0; // type:func -EnMa3_Draw = 0x80A86F54; // type:func -EnMag_Init = 0x80A87350; // type:func -EnMag_Destroy = 0x80A875E0; // type:func -EnMag_Update = 0x80A875F0; // type:func -EnMag_DrawTextureI8 = 0x80A87CD0; // type:func -EnMag_DrawEffectTextures = 0x80A87EF8; // type:func -EnMag_DrawImageRGBA32 = 0x80A88330; // type:func -EnMag_DrawCharTexture = 0x80A88710; // type:func -EnMag_DrawInner = 0x80A888DC; // type:func -EnMag_Draw = 0x80A89644; // type:func -EnMb_SetupAction = 0x80A89870; // type:func -EnMb_Init = 0x80A8987C; // type:func -EnMb_Destroy = 0x80A89BE0; // type:func -EnMb_FaceWaypoint = 0x80A89C30; // type:func -EnMb_NextWaypoint = 0x80A89C68; // type:func -EnMb_IsPlayerInCorridor = 0x80A89D54; // type:func -EnMb_FindWaypointTowardsPlayer = 0x80A89EC8; // type:func -EnMb_SetupSpearGuardLookAround = 0x80A8A058; // type:func -EnMb_SetupClubWaitPlayerNear = 0x80A8A0C0; // type:func -EnMb_SetupSpearPatrolTurnTowardsWaypoint = 0x80A8A124; // type:func -EnMb_SetupSpearGuardWalk = 0x80A8A19C; // type:func -EnMb_SetupSpearPatrolWalkTowardsWaypoint = 0x80A8A240; // type:func -EnMb_SetupSpearPrepareAndCharge = 0x80A8A2F0; // type:func -EnMb_SetupSpearPatrolImmediateCharge = 0x80A8A3A8; // type:func -EnMb_SetupClubAttack = 0x80A8A418; // type:func -EnMb_SetupSpearEndChargeQuick = 0x80A8A4E8; // type:func -EnMb_SetupSpearPatrolEndCharge = 0x80A8A548; // type:func -EnMb_SetupClubWaitAfterAttack = 0x80A8A5CC; // type:func -EnMb_SetupClubDamaged = 0x80A8A644; // type:func -EnMb_SetupClubDamagedWhileKneeling = 0x80A8A6A4; // type:func -EnMb_SetupClubDead = 0x80A8A72C; // type:func -EnMb_SetupStunned = 0x80A8A7B4; // type:func -EnMb_Stunned = 0x80A8A858; // type:func -EnMb_SpearGuardLookAround = 0x80A8A964; // type:func -EnMb_SpearPatrolTurnTowardsWaypoint = 0x80A8A9DC; // type:func -EnMb_SpearEndChargeQuick = 0x80A8AB40; // type:func -EnMb_ClubWaitAfterAttack = 0x80A8ACA8; // type:func -EnMb_SpearPatrolEndCharge = 0x80A8ACEC; // type:func -EnMb_SpearGuardPrepareAndCharge = 0x80A8B004; // type:func -EnMb_ClubAttack = 0x80A8B16C; // type:func -EnMb_SpearPatrolPrepareAndCharge = 0x80A8B4E4; // type:func -EnMb_SpearPatrolImmediateCharge = 0x80A8B848; // type:func -EnMb_ClubDamaged = 0x80A8BBB8; // type:func -EnMb_ClubDamagedWhileKneeling = 0x80A8BC4C; // type:func -EnMb_ClubDead = 0x80A8BD58; // type:func -EnMb_SpearGuardWalk = 0x80A8C01C; // type:func -EnMb_SpearPatrolWalkTowardsWaypoint = 0x80A8C32C; // type:func -EnMb_ClubWaitPlayerNear = 0x80A8C618; // type:func -EnMb_SetupSpearDamaged = 0x80A8C6C8; // type:func -EnMb_SpearDamaged = 0x80A8C790; // type:func -EnMb_SetupSpearDead = 0x80A8C808; // type:func -EnMb_SpearDead = 0x80A8C8E0; // type:func -EnMb_SpearUpdateAttackCollider = 0x80A8CAF8; // type:func -EnMb_ClubUpdateAttackCollider = 0x80A8CC84; // type:func -EnMb_CheckColliding = 0x80A8CD1C; // type:func -EnMb_Update = 0x80A8CEE8; // type:func -EnMb_PostLimbDraw = 0x80A8D0BC; // type:func -EnMb_Draw = 0x80A8D258; // type:func -func_80AAA250 = 0x80A8DAA0; // type:func -func_80AAA274 = 0x80A8DAC8; // type:func -func_80AAA308 = 0x80A8DB5C; // type:func -func_80AAA39C = 0x80A8DBF0; // type:func -func_80AAA474 = 0x80A8DCC8; // type:func -func_80AAA508 = 0x80A8DD5C; // type:func -func_80AAA5A4 = 0x80A8DDF8; // type:func -func_80AAA638 = 0x80A8DE8C; // type:func -func_80AAA6D4 = 0x80A8DF28; // type:func -func_80AAA768 = 0x80A8DFBC; // type:func -func_80AAA7FC = 0x80A8E050; // type:func -func_80AAA890 = 0x80A8E0E4; // type:func -func_80AAA92C = 0x80A8E180; // type:func -func_80AAA93C = 0x80A8E198; // type:func -func_80AAAA24 = 0x80A8E280; // type:func -func_80AAAC78 = 0x80A8E4D4; // type:func -EnMd_GetTextIdKokiriForest = 0x80A8E554; // type:func -EnMd_GetTextIdMidosHouse = 0x80A8E63C; // type:func -EnMd_GetTextIdLostWoods = 0x80A8E670; // type:func -EnMd_GetTextId = 0x80A8E6F0; // type:func -EnMd_UpdateTalkState = 0x80A8E760; // type:func -EnMd_ShouldSpawn = 0x80A8E898; // type:func -EnMd_UpdateEyes = 0x80A8E93C; // type:func -func_80AAB158 = 0x80A8E9B4; // type:func -EnMd_FollowPath = 0x80A8EBD0; // type:func -EnMd_SetMovedPos = 0x80A8ED3C; // type:func -func_80AAB5A4 = 0x80A8EE04; // type:func -EnMd_Init = 0x80A8EEB0; // type:func -EnMd_Destroy = 0x80A8F0AC; // type:func -func_80AAB874 = 0x80A8F0D8; // type:func -func_80AAB8F8 = 0x80A8F15C; // type:func -func_80AAB948 = 0x80A8F1AC; // type:func -func_80AABC10 = 0x80A8F47C; // type:func -func_80AABD0C = 0x80A8F578; // type:func -EnMd_Update = 0x80A8F6A0; // type:func -EnMd_OverrideLimbDraw = 0x80A8F760; // type:func -EnMd_PostLimbDraw = 0x80A8F97C; // type:func -EnMd_Draw = 0x80A8F9D8; // type:func -EnMk_Init = 0x80A90110; // type:func -EnMk_Destroy = 0x80A90228; // type:func -func_80AACA40 = 0x80A90254; // type:func -func_80AACA94 = 0x80A902A4; // type:func -func_80AACB14 = 0x80A9032C; // type:func -func_80AACB6C = 0x80A90388; // type:func -func_80AACBAC = 0x80A903C4; // type:func -func_80AACC04 = 0x80A9041C; // type:func -func_80AACCA0 = 0x80A904B8; // type:func -func_80AACD48 = 0x80A90560; // type:func -func_80AACE2C = 0x80A90644; // type:func -func_80AACEE8 = 0x80A90700; // type:func -func_80AACFA0 = 0x80A907B8; // type:func -func_80AAD014 = 0x80A90830; // type:func -EnMk_Wait = 0x80A9089C; // type:func -EnMk_Update = 0x80A90AF0; // type:func -EnMk_OverrideLimbDraw = 0x80A90D3C; // type:func -EnMk_PostLimbDraw = 0x80A90D84; // type:func -EnMk_Draw = 0x80A90DC4; // type:func -EnMm_ChangeAnim = 0x80A90FA0; // type:func -EnMm_Init = 0x80A910C4; // type:func -EnMm_Destroy = 0x80A91280; // type:func -func_80AADA70 = 0x80A912AC; // type:func -func_80AADAA0 = 0x80A912E0; // type:func -EnMm_GetTextId = 0x80A91474; // type:func -func_80AADCD0 = 0x80A91514; // type:func -EnMm_GetPointCount = 0x80A91694; // type:func -func_80AADE60 = 0x80A916A8; // type:func -func_80AADEF0 = 0x80A9173C; // type:func -func_80AAE224 = 0x80A91A74; // type:func -func_80AAE294 = 0x80A91AE4; // type:func -func_80AAE50C = 0x80A91D5C; // type:func -func_80AAE598 = 0x80A91DE8; // type:func -EnMm_Update = 0x80A91E90; // type:func -EnMm_Draw = 0x80A91F04; // type:func -EnMm_OverrideLimbDraw = 0x80A92198; // type:func -EnMm_PostLimbDraw = 0x80A9222C; // type:func -EnMm2_ChangeAnim = 0x80A92600; // type:func -func_80AAEF70 = 0x80A92724; // type:func -EnMm2_Init = 0x80A927F4; // type:func -EnMm2_Destroy = 0x80A929AC; // type:func -func_80AAF224 = 0x80A929D8; // type:func -func_80AAF2BC = 0x80A92A74; // type:func -func_80AAF330 = 0x80A92AE8; // type:func -func_80AAF3C0 = 0x80A92B78; // type:func -func_80AAF57C = 0x80A92D34; // type:func -func_80AAF5EC = 0x80A92DA8; // type:func -func_80AAF668 = 0x80A92E24; // type:func -EnMm2_Update = 0x80A92F18; // type:func -EnMm2_Draw = 0x80A93060; // type:func -EnMm2_OverrideLimbDraw = 0x80A9312C; // type:func -EnMm2_PostLimbDraw = 0x80A931B4; // type:func -EnMs_SetOfferText = 0x80A933C0; // type:func -EnMs_Init = 0x80A9343C; // type:func -EnMs_Destroy = 0x80A93560; // type:func -EnMs_Wait = 0x80A9358C; // type:func -EnMs_Talk = 0x80A93638; // type:func -EnMs_Sell = 0x80A93754; // type:func -EnMs_TalkAfterPurchase = 0x80A937F0; // type:func -EnMs_Update = 0x80A93850; // type:func -EnMs_Draw = 0x80A93948; // type:func -EnMu_SetupAction = 0x80A93AB0; // type:func -EnMu_Interact = 0x80A93ABC; // type:func -EnMu_GetTextId = 0x80A93C1C; // type:func -EnMu_UpdateTalkState = 0x80A93C60; // type:func -EnMu_Init = 0x80A93CCC; // type:func -EnMu_Destroy = 0x80A93DA4; // type:func -EnMu_Pose = 0x80A93DC8; // type:func -EnMu_Update = 0x80A93E00; // type:func -EnMu_OverrideLimbDraw = 0x80A93F48; // type:func -EnMu_PostLimbDraw = 0x80A94034; // type:func -EnMu_DisplayListSetColor = 0x80A9404C; // type:func -EnMu_Draw = 0x80A940B8; // type:func -EnNb_GetPath = 0x80A943D0; // type:func -EnNb_GetType = 0x80A943E4; // type:func -EnNb_UpdatePath = 0x80A943F4; // type:func -EnNb_SetupCollider = 0x80A94520; // type:func -EnNb_UpdateCollider = 0x80A9456C; // type:func -EnNb_Destroy = 0x80A945B0; // type:func -func_80AB0FBC = 0x80A945DC; // type:func -func_80AB1040 = 0x80A94664; // type:func -func_80AB10C4 = 0x80A946EC; // type:func -EnNb_UpdateEyes = 0x80A94790; // type:func -func_80AB1284 = 0x80A94818; // type:func -EnNb_UpdateSkelAnime = 0x80A94860; // type:func -EnNb_GetCue = 0x80A94884; // type:func -EnNb_SetStartPosRotFromCue1 = 0x80A948AC; // type:func -func_80AB1390 = 0x80A9492C; // type:func -func_80AB13D8 = 0x80A94978; // type:func -EnNb_SetStartPosRotFromCue2 = 0x80A949C4; // type:func -EnNb_SetCurrentAnim = 0x80A94A44; // type:func -EnNb_SetChamberAnim = 0x80A94AD4; // type:func -EnNb_SpawnBlueWarp = 0x80A94B1C; // type:func -EnNb_GiveMedallion = 0x80A94B78; // type:func -EnNb_ComeUpImpl = 0x80A94BF4; // type:func -EnNb_SetupChamberCsImpl = 0x80A94C14; // type:func -EnNb_SetupChamberWarpImpl = 0x80A94CB0; // type:func -EnNb_SetupDefaultChamberIdle = 0x80A94D00; // type:func -EnNb_SetupArmRaise = 0x80A94D2C; // type:func -EnNb_SetupRaisedArmTransition = 0x80A94DC0; // type:func -EnNb_SetupMedallion = 0x80A94E2C; // type:func -EnNb_SetupChamberCs = 0x80A94E78; // type:func -EnNb_SetupChamberWarp = 0x80A94E98; // type:func -EnNb_ComeUp = 0x80A94EB8; // type:func -func_80AB193C = 0x80A94EF4; // type:func -EnNb_RaiseArm = 0x80A94F3C; // type:func -func_80AB19BC = 0x80A94F80; // type:func -func_80AB19FC = 0x80A94FC8; // type:func -EnNb_SetupLightArrowOrSealingCs = 0x80A94FFC; // type:func -EnNb_PlaySealingSfx = 0x80A95040; // type:func -EnNb_InitializeDemo6K = 0x80A95060; // type:func -EnNb_SetupHide = 0x80A950E0; // type:func -EnNb_CheckToFade = 0x80A95134; // type:func -EnNb_SetupLightOrb = 0x80A95288; // type:func -EnNb_Hide = 0x80A95324; // type:func -EnNb_Fade = 0x80A95344; // type:func -EnNb_CreateLightOrb = 0x80A9538C; // type:func -EnNb_DrawTransparency = 0x80A953D4; // type:func -EnNb_InitKidnap = 0x80A9551C; // type:func -EnNb_PlayCrySFX = 0x80A95574; // type:func -EnNb_PlayAgonySFX = 0x80A955AC; // type:func -EnNb_SetPosInPortal = 0x80A955E4; // type:func -EnNb_SetupCaptureCutsceneState = 0x80A956C8; // type:func -EnNb_SetRaisedArmCaptureAnim = 0x80A956FC; // type:func -EnNb_SetupLookAroundInKidnap = 0x80A9575C; // type:func -EnNb_SetupKidnap = 0x80A957D0; // type:func -EnNb_CheckKidnapCsMode = 0x80A95848; // type:func -func_80AB23A8 = 0x80A95910; // type:func -EnNb_MovingInPortal = 0x80A95948; // type:func -EnNb_SuckedInByPortal = 0x80A959A4; // type:func -EnNb_SetupConfrontation = 0x80A95A00; // type:func -EnNb_PlayKnuckleDefeatSFX = 0x80A95A44; // type:func -EnNb_PlayKneelingOnGroundSFX = 0x80A95A88; // type:func -EnNb_PlayLookRightSFX = 0x80A95AEC; // type:func -EnNb_PlayLookLeftSFX = 0x80A95B38; // type:func -EnNb_InitDemo6KInConfrontation = 0x80A95B90; // type:func -func_80AB2688 = 0x80A95C08; // type:func -func_80AB26C8 = 0x80A95C48; // type:func -func_80AB26DC = 0x80A95C60; // type:func -EnNb_SetupKneel = 0x80A95CF8; // type:func -EnNb_CheckIfKneeling = 0x80A95D74; // type:func -EnNb_SetupLookRight = 0x80A95DE0; // type:func -EnNb_CheckIfLookingRight = 0x80A95E60; // type:func -EnNb_SetupLookLeft = 0x80A95ECC; // type:func -EnNb_CheckIfLookLeft = 0x80A95F4C; // type:func -EnNb_SetupDemo6KInConfrontation = 0x80A95FAC; // type:func -EnNb_SetupRun = 0x80A95FEC; // type:func -EnNb_SetupConfrontationDestroy = 0x80A9606C; // type:func -EnNb_CheckConfrontationCsMode = 0x80A96084; // type:func -EnNb_CheckConfrontationCsModeWrapper = 0x80A9616C; // type:func -func_80AB2C18 = 0x80A9618C; // type:func -EnNb_Kneel = 0x80A961D8; // type:func -EnNb_LookRight = 0x80A96248; // type:func -EnNb_LookLeft = 0x80A962B8; // type:func -EnNb_Run = 0x80A96320; // type:func -EnNb_ConfrontationDestroy = 0x80A963A8; // type:func -func_80AB2E70 = 0x80A963FC; // type:func -func_80AB2FC0 = 0x80A96518; // type:func -func_80AB2FE4 = 0x80A96540; // type:func -EnNb_SetupCreditsSpawn = 0x80A9667C; // type:func -EnNb_SetAlphaInCredits = 0x80A966C4; // type:func -EnNb_SetupCreditsFadeIn = 0x80A96750; // type:func -EnNb_SetupCreditsSit = 0x80A96788; // type:func -EnNb_SetupCreditsHeadTurn = 0x80A967D4; // type:func -EnNb_CheckIfLookingUp = 0x80A96814; // type:func -EnNb_CheckCreditsCsModeImpl = 0x80A96848; // type:func -EnNb_CheckCreditsCsMode = 0x80A968D4; // type:func -EnNb_CreditsFade = 0x80A968F4; // type:func -func_80AB3428 = 0x80A96940; // type:func -EnNb_LookUp = 0x80A96988; // type:func -EnNb_CrawlspaceSpawnCheck = 0x80A969CC; // type:func -func_80AB359C = 0x80A96AC8; // type:func -EnNb_SetNoticeSFX = 0x80A96B8C; // type:func -EnNb_GetNoticedStatus = 0x80A96BB4; // type:func -func_80AB36DC = 0x80A96C0C; // type:func -EnNb_CheckNoticed = 0x80A96CBC; // type:func -EnNb_SetupIdleCrawlspace = 0x80A96D14; // type:func -func_80AB3838 = 0x80A96D6C; // type:func -EnNb_SetupPathMovement = 0x80A96DE8; // type:func -EnNb_SetTextIdAsChild = 0x80A96E50; // type:func -func_80AB3A7C = 0x80A96FBC; // type:func -func_80AB3B04 = 0x80A97048; // type:func -func_80AB3B7C = 0x80A970D0; // type:func -EnNb_WaitForNotice = 0x80A9711C; // type:func -EnNb_StandUpAfterNotice = 0x80A97178; // type:func -EnNb_BlockCrawlspace = 0x80A971D8; // type:func -EnNb_InitCrawlspaceDialogue = 0x80A97240; // type:func -EnNb_FollowPath = 0x80A972A8; // type:func -func_80AB3DB0 = 0x80A97328; // type:func -func_80AB3E10 = 0x80A97390; // type:func -EnNb_Update = 0x80A973F8; // type:func -EnNb_Init = 0x80A97440; // type:func -EnNb_OverrideLimbDraw = 0x80A9755C; // type:func -EnNb_PostLimbDraw = 0x80A975EC; // type:func -EnNb_DrawNothing = 0x80A97678; // type:func -EnNb_DrawDefault = 0x80A97688; // type:func -EnNb_Draw = 0x80A977CC; // type:func -EnNiw_Init = 0x80A989A0; // type:func -EnNiw_Destroy = 0x80A98EA4; // type:func -func_80AB5BF8 = 0x80A98ED0; // type:func -EnNiw_SpawnAttackCucco = 0x80A99278; // type:func -func_80AB6100 = 0x80A993C0; // type:func -EnNiw_ResetAction = 0x80A9953C; // type:func -func_80AB6324 = 0x80A995E4; // type:func -func_80AB63A8 = 0x80A99668; // type:func -func_80AB6450 = 0x80A99710; // type:func -func_80AB6570 = 0x80A99830; // type:func -func_80AB6A38 = 0x80A99CFC; // type:func -func_80AB6BF8 = 0x80A99EBC; // type:func -func_80AB6D08 = 0x80A99FCC; // type:func -func_80AB6EB4 = 0x80A9A178; // type:func -func_80AB6F04 = 0x80A9A1C8; // type:func -func_80AB70A0 = 0x80A9A368; // type:func -func_80AB70F8 = 0x80A9A3C0; // type:func -func_80AB714C = 0x80A9A414; // type:func -func_80AB7204 = 0x80A9A4CC; // type:func -func_80AB7290 = 0x80A9A55C; // type:func -func_80AB7328 = 0x80A9A5F4; // type:func -func_80AB7420 = 0x80A9A6F0; // type:func -func_80AB747C = 0x80A9A74C; // type:func -EnNiw_Update = 0x80A9A804; // type:func -EnNiw_OverrideLimbDraw = 0x80A9B0B0; // type:func -EnNiw_Draw = 0x80A9B208; // type:func -EnNiw_SpawnFeather = 0x80A9B2B8; // type:func -EnNiw_UpdateEffects = 0x80A9B3A8; // type:func -EnNiw_DrawEffects = 0x80A9B55C; // type:func -EnNiwGirl_Init = 0x80A9BCD0; // type:func -EnNiwGirl_Destroy = 0x80A9BE70; // type:func -EnNiwGirl_Jump = 0x80A9BE80; // type:func -func_80AB9210 = 0x80A9BF04; // type:func -EnNiwGirl_Talk = 0x80A9C0B8; // type:func -func_80AB94D0 = 0x80A9C1C8; // type:func -EnNiwGirl_Update = 0x80A9C2BC; // type:func -EnNiwGirlOverrideLimbDraw = 0x80A9C4E4; // type:func -EnNiwGirl_Draw = 0x80A9C54C; // type:func -EnNiwLady_Init = 0x80A9C7A0; // type:func -EnNiwLady_Destroy = 0x80A9C888; // type:func -EnNiwLady_ChoseAnimation = 0x80A9C8B4; // type:func -func_80AB9F24 = 0x80A9CA7C; // type:func -func_80ABA21C = 0x80A9CD78; // type:func -func_80ABA244 = 0x80A9CDA4; // type:func -func_80ABA654 = 0x80A9D124; // type:func -func_80ABA778 = 0x80A9D21C; // type:func -func_80ABA878 = 0x80A9D2F0; // type:func -func_80ABA9B8 = 0x80A9D434; // type:func -func_80ABAA9C = 0x80A9D518; // type:func -func_80ABAB08 = 0x80A9D588; // type:func -func_80ABAC00 = 0x80A9D680; // type:func -func_80ABAC84 = 0x80A9D708; // type:func -func_80ABAD38 = 0x80A9D7B0; // type:func -func_80ABAD7C = 0x80A9D7D0; // type:func -EnNiwLady_Update = 0x80A9D894; // type:func -EnNiwLady_EmptyDList = 0x80A9DAFC; // type:func -EnNiwLady_OverrideLimbDraw = 0x80A9DB20; // type:func -EnNiwLady_Draw = 0x80A9DC7C; // type:func -EnNutsball_Init = 0x80A9E0A0; // type:func -EnNutsball_Destroy = 0x80A9E15C; // type:func -func_80ABBB34 = 0x80A9E188; // type:func -func_80ABBBA8 = 0x80A9E200; // type:func -EnNutsball_Update = 0x80A9E3D0; // type:func -EnNutsball_Draw = 0x80A9E4EC; // type:func -EnNwc_SetUpdate = 0x80A9E6C0; // type:func -EnNwc_ChickNoop = 0x80A9E6CC; // type:func -EnNwc_ChickBgCheck = 0x80A9E6E0; // type:func -EnNwc_ChickFall = 0x80A9E7DC; // type:func -EnNwc_UpdateChicks = 0x80A9E848; // type:func -EnNwc_DrawChicks = 0x80A9EA48; // type:func -EnNwc_Init = 0x80A9EDA4; // type:func -EnNwc_Destroy = 0x80A9EF30; // type:func -EnNwc_Idle = 0x80A9EF5C; // type:func -EnNwc_Update = 0x80A9EF7C; // type:func -EnNwc_Draw = 0x80A9EFD0; // type:func -EnNy_Init = 0x80A9F0E0; // type:func -EnNy_Destroy = 0x80A9F21C; // type:func -func_80ABCD40 = 0x80A9F248; // type:func -func_80ABCD84 = 0x80A9F290; // type:func -func_80ABCD94 = 0x80A9F2A4; // type:func -func_80ABCDAC = 0x80A9F2C0; // type:func -func_80ABCDBC = 0x80A9F2D4; // type:func -EnNy_SetupTurnToStone = 0x80A9F318; // type:func -func_80ABCE38 = 0x80A9F354; // type:func -func_80ABCE50 = 0x80A9F370; // type:func -func_80ABCE90 = 0x80A9F3B0; // type:func -func_80ABCEEC = 0x80A9F40C; // type:func -EnNy_Move = 0x80A9F46C; // type:func -EnNy_TurnToStone = 0x80A9F580; // type:func -func_80ABD11C = 0x80A9F640; // type:func -EnNy_CollisionCheck = 0x80A9F6B4; // type:func -func_80ABD3B8 = 0x80A9F8DC; // type:func -EnNy_Update = 0x80A9F9C4; // type:func -EnNy_SetupDie = 0x80A9FC50; // type:func -EnNy_Die = 0x80A9FED4; // type:func -EnNy_UpdateDeath = 0x80AA00E0; // type:func -EnNy_UpdateUnused = 0x80AA0120; // type:func -EnNy_Draw = 0x80AA0250; // type:func -EnNy_DrawDeathEffect = 0x80AA0524; // type:func -EnOE2_SetupAction = 0x80AA0A20; // type:func -EnOE2_Init = 0x80AA0A2C; // type:func -EnOE2_Destroy = 0x80AA0A54; // type:func -EnOE2_DoNothing = 0x80AA0A64; // type:func -EnOE2_Update = 0x80AA0A74; // type:func -EnOE2_Draw = 0x80AA0A84; // type:func -EnOkarinaEffect_SetupAction = 0x80AA0B00; // type:func -EnOkarinaEffect_Destroy = 0x80AA0B0C; // type:func -EnOkarinaEffect_Init = 0x80AA0B8C; // type:func -EnOkarinaEffect_TriggerStorm = 0x80AA0BD4; // type:func -EnOkarinaEffect_ManageStorm = 0x80AA0C60; // type:func -EnOkarinaEffect_Update = 0x80AA0E30; // type:func -EnOkarinaTag_Destroy = 0x80AA0EC0; // type:func -EnOkarinaTag_Init = 0x80AA0ED0; // type:func -func_80ABEF2C = 0x80AA1038; // type:func -func_80ABF0CC = 0x80AA119C; // type:func -func_80ABF28C = 0x80AA135C; // type:func -func_80ABF4C8 = 0x80AA15A4; // type:func -func_80ABF708 = 0x80AA17E4; // type:func -func_80ABF7CC = 0x80AA18AC; // type:func -EnOkarinaTag_Update = 0x80AA1970; // type:func -EnOkuta_Init = 0x80AA23C0; // type:func -EnOkuta_Destroy = 0x80AA25CC; // type:func -EnOkuta_SpawnBubbles = 0x80AA25F8; // type:func -EnOkuta_SpawnDust = 0x80AA26A4; // type:func -EnOkuta_SpawnSplash = 0x80AA270C; // type:func -EnOkuta_SpawnRipple = 0x80AA2750; // type:func -EnOkuta_SetupWaitToAppear = 0x80AA27F4; // type:func -EnOkuta_SetupAppear = 0x80AA2824; // type:func -EnOkuta_SetupHide = 0x80AA2894; // type:func -EnOkuta_SetupWaitToShoot = 0x80AA28D4; // type:func -EnOkuta_SetupShoot = 0x80AA2934; // type:func -EnOkuta_SetupWaitToDie = 0x80AA2A20; // type:func -EnOkuta_SetupDie = 0x80AA2AA8; // type:func -EnOkuta_SetupFreeze = 0x80AA2AF0; // type:func -EnOkuta_SpawnProjectile = 0x80AA2B3C; // type:func -EnOkuta_WaitToAppear = 0x80AA2C7C; // type:func -EnOkuta_Appear = 0x80AA2CD8; // type:func -EnOkuta_Hide = 0x80AA2E1C; // type:func -EnOkuta_WaitToShoot = 0x80AA2F1C; // type:func -EnOkuta_Shoot = 0x80AA304C; // type:func -EnOkuta_WaitToDie = 0x80AA31CC; // type:func -EnOkuta_Die = 0x80AA3220; // type:func -EnOkuta_Freeze = 0x80AA3534; // type:func -EnOkuta_ProjectileFly = 0x80AA36B0; // type:func -EnOkuta_UpdateHeadScale = 0x80AA38FC; // type:func -EnOkuta_ColliderCheck = 0x80AA3CA4; // type:func -EnOkuta_Update = 0x80AA3D54; // type:func -EnOkuta_GetSnoutScale = 0x80AA40D4; // type:func -EnOkuta_OverrideLimbDraw = 0x80AA435C; // type:func -EnOkuta_Draw = 0x80AA4458; // type:func -EnOssan_SetupAction = 0x80AA49A0; // type:func -ShopItemDisp_Default = 0x80AA49AC; // type:func -ShopItemDisp_SpookyMask = 0x80AA49C4; // type:func -ShopItemDisp_SkullMask = 0x80AA49F8; // type:func -ShopItemDisp_BunnyHood = 0x80AA4A2C; // type:func -ShopItemDisp_ZoraMask = 0x80AA4A60; // type:func -ShopItemDisp_GoronMask = 0x80AA4A94; // type:func -ShopItemDisp_GerudoMask = 0x80AA4AC8; // type:func -EnOssan_SpawnItemsOnShelves = 0x80AA4AFC; // type:func -EnOssan_UpdateShopOfferings = 0x80AA4C50; // type:func -EnOssan_TalkDefaultShopkeeper = 0x80AA4DBC; // type:func -EnOssan_TalkKakarikoPotionShopkeeper = 0x80AA4DDC; // type:func -EnOssan_TalkMarketPotionShopkeeper = 0x80AA4E20; // type:func -EnOssan_TalkKokiriShopkeeper = 0x80AA4E40; // type:func -EnOssan_TalkBazaarShopkeeper = 0x80AA4E60; // type:func -EnOssan_TalkBombchuShopkeeper = 0x80AA4EA4; // type:func -EnOssan_TalkZoraShopkeeper = 0x80AA4EC4; // type:func -EnOssan_TalkGoronShopkeeper = 0x80AA4F1C; // type:func -EnOssan_TalkHappyMaskShopkeeper = 0x80AA4FF0; // type:func -EnOssan_UpdateCameraDirection = 0x80AA507C; // type:func -EnOssan_TryGetObjBankIndices = 0x80AA50E0; // type:func -EnOssan_Init = 0x80AA51A4; // type:func -EnOssan_Destroy = 0x80AA5370; // type:func -EnOssan_UpdateCursorPos = 0x80AA53B0; // type:func -EnOssan_EndInteraction = 0x80AA5414; // type:func -EnOssan_TestEndInteraction = 0x80AA54D8; // type:func -EnOssan_TestCancelOption = 0x80AA5520; // type:func -EnOssan_SetStateStartShopping = 0x80AA5584; // type:func -EnOssan_StartShopping = 0x80AA5608; // type:func -EnOssan_ChooseTalkToOwner = 0x80AA56E0; // type:func -EnOssan_SetLookToShopkeeperFromShelf = 0x80AA5740; // type:func -EnOssan_State_Idle = 0x80AA5774; // type:func -EnOssan_UpdateJoystickInputState = 0x80AA5824; // type:func -EnOssan_SetCursorIndexFromNeutral = 0x80AA5970; // type:func -EnOssan_CursorRight = 0x80AA5AA8; // type:func -EnOssan_CursorLeft = 0x80AA5B34; // type:func -EnOssan_TryPaybackMask = 0x80AA5B9C; // type:func -EnOssan_State_StartConversation = 0x80AA5CD8; // type:func -EnOssan_FacingShopkeeperDialogResult = 0x80AA5E80; // type:func -EnOssan_State_FacingShopkeeper = 0x80AA5EEC; // type:func -EnOssan_State_TalkingToShopkeeper = 0x80AA6004; // type:func -EnOssan_State_LookToLeftShelf = 0x80AA6058; // type:func -EnOssan_State_LookToRightShelf = 0x80AA6144; // type:func -EnOssan_CursorUpDown = 0x80AA6230; // type:func -EnOssan_HasPlayerSelectedItem = 0x80AA6444; // type:func -EnOssan_State_BrowseLeftShelf = 0x80AA65E0; // type:func -EnOssan_State_BrowseRightShelf = 0x80AA67A0; // type:func -EnOssan_State_LookFromShelfToShopkeeper = 0x80AA6960; // type:func -EnOssan_State_DisplayOnlyBombDialog = 0x80AA6A1C; // type:func -EnOssan_GiveItemWithFanfare = 0x80AA6AEC; // type:func -EnOssan_SetStateCantGetItem = 0x80AA6BB8; // type:func -EnOssan_SetStateQuickBuyDialog = 0x80AA6BEC; // type:func -EnOssan_HandleCanBuyItem = 0x80AA6C20; // type:func -EnOssan_HandleCanBuyLonLonMilk = 0x80AA6DC8; // type:func -EnOssan_HandleCanBuyWeirdEgg = 0x80AA6ED4; // type:func -EnOssan_HandleCanBuyBombs = 0x80AA700C; // type:func -EnOssan_BuyGoronCityBombs = 0x80AA7110; // type:func -EnOssan_State_ItemSelected = 0x80AA71B4; // type:func -EnOssan_State_SelectMilkBottle = 0x80AA7288; // type:func -EnOssan_State_SelectWeirdEgg = 0x80AA735C; // type:func -EnOssan_State_SelectUnimplementedItem = 0x80AA7430; // type:func -EnOssan_State_SelectBombs = 0x80AA74C0; // type:func -EnOssan_State_SelectMaskItem = 0x80AA75B8; // type:func -EnOssan_State_CantGetItem = 0x80AA7794; // type:func -EnOssan_State_QuickBuyDialog = 0x80AA7810; // type:func -EnOssan_State_GiveItemWithFanfare = 0x80AA78B8; // type:func -EnOssan_State_ItemPurchased = 0x80AA7928; // type:func -EnOssan_State_ContinueShoppingPrompt = 0x80AA7A6C; // type:func -EnOssan_State_WaitForDisplayOnlyBombDialog = 0x80AA7C4C; // type:func -EnOssan_State_21 = 0x80AA7CB4; // type:func -EnOssan_State_22 = 0x80AA7D28; // type:func -EnOssan_State_GiveLonLonMilk = 0x80AA7D7C; // type:func -EnOssan_State_LendMaskOfTruth = 0x80AA7DD0; // type:func -EnOssan_SetStateGiveDiscountDialog = 0x80AA7E40; // type:func -EnOssan_State_GiveDiscountDialog = 0x80AA7E6C; // type:func -EnOssan_PositionSelectedItem = 0x80AA7F00; // type:func -EnOssan_ResetItemPosition = 0x80AA7FE8; // type:func -EnOssan_TakeItemOffShelf = 0x80AA800C; // type:func -EnOssan_ReturnItemToShelf = 0x80AA80A8; // type:func -EnOssan_UpdateItemSelectedProperty = 0x80AA8134; // type:func -EnOssan_UpdateCursorAnim = 0x80AA8270; // type:func -EnOssan_UpdateStickDirectionPromptAnim = 0x80AA8344; // type:func -EnOssan_WaitForBlink = 0x80AA84F4; // type:func -EnOssan_Blink = 0x80AA8528; // type:func -EnOssan_AreShopkeeperObjectsLoaded = 0x80AA85C8; // type:func -EnOssan_InitBazaarShopkeeper = 0x80AA8664; // type:func -EnOssan_InitKokiriShopkeeper = 0x80AA86C4; // type:func -EnOssan_InitGoronShopkeeper = 0x80AA87DC; // type:func -EnOssan_InitZoraShopkeeper = 0x80AA88B8; // type:func -EnOssan_InitPotionShopkeeper = 0x80AA8994; // type:func -EnOssan_InitHappyMaskShopkeeper = 0x80AA89F4; // type:func -EnOssan_InitBombchuShopkeeper = 0x80AA8A54; // type:func -EnOssan_SetupHelloDialog = 0x80AA8AB4; // type:func -EnOssan_InitActionFunc = 0x80AA8C1C; // type:func -EnOssan_Obj3ToSeg6 = 0x80AA8ED4; // type:func -EnOssan_MainActionFunc = 0x80AA8F0C; // type:func -EnOssan_Update = 0x80AA9028; // type:func -EnOssan_OverrideLimbDrawDefaultShopkeeper = 0x80AA9054; // type:func -EnOssan_DrawCursor = 0x80AA908C; // type:func -EnOssan_DrawTextRec = 0x80AA92EC; // type:func -EnOssan_DrawStickDirectionPrompts = 0x80AA9488; // type:func -EnOssan_DrawBazaarShopkeeper = 0x80AA9830; // type:func -EnOssan_OverrideLimbDrawKokiriShopkeeper = 0x80AA9924; // type:func -EnOssan_EmptyDList = 0x80AA9A1C; // type:func -EnOssan_SetEnvColor = 0x80AA9A40; // type:func -EnOssan_DrawKokiriShopkeeper = 0x80AA9AAC; // type:func -EnOssan_DrawGoronShopkeeper = 0x80AA9C0C; // type:func -EnOssan_OverrideLimbDrawZoraShopkeeper = 0x80AA9D40; // type:func -EnOssan_DrawZoraShopkeeper = 0x80AA9D78; // type:func -EnOssan_DrawPotionShopkeeper = 0x80AA9EBC; // type:func -EnOssan_DrawHappyMaskShopkeeper = 0x80AA9FA8; // type:func -EnOssan_DrawBombchuShopkeeper = 0x80AAA094; // type:func -EnOwl_Init = 0x80AAAF80; // type:func -EnOwl_Destroy = 0x80AAB364; // type:func -EnOwl_LookAtLink = 0x80AAB390; // type:func -EnOwl_CheckInitTalk = 0x80AAB3CC; // type:func -func_80ACA558 = 0x80AAB538; // type:func -func_80ACA5C8 = 0x80AAB5AC; // type:func -func_80ACA62C = 0x80AAB60C; // type:func -func_80ACA690 = 0x80AAB658; // type:func -func_80ACA6C0 = 0x80AAB688; // type:func -func_80ACA71C = 0x80AAB6E4; // type:func -func_80ACA76C = 0x80AAB730; // type:func -func_80ACA7E0 = 0x80AAB7A4; // type:func -EnOwl_ConfirmKokiriMessage = 0x80AAB850; // type:func -EnOwl_WaitOutsideKokiri = 0x80AAB8F0; // type:func -func_80ACA998 = 0x80AAB968; // type:func -func_80ACAA54 = 0x80AABA28; // type:func -func_80ACAAC0 = 0x80AABA98; // type:func -EnOwl_WaitHyruleCastle = 0x80AABB08; // type:func -func_80ACAB88 = 0x80AABB6C; // type:func -func_80ACAC6C = 0x80AABC54; // type:func -EnOwl_WaitKakariko = 0x80AABCC4; // type:func -func_80ACAD34 = 0x80AABD28; // type:func -func_80ACADF0 = 0x80AABDE8; // type:func -EnOwl_WaitGerudo = 0x80AABE58; // type:func -func_80ACAEB8 = 0x80AABEBC; // type:func -func_80ACAF74 = 0x80AABF7C; // type:func -EnOwl_WaitLakeHylia = 0x80AABFEC; // type:func -func_80ACB03C = 0x80AAC050; // type:func -EnOwl_WaitZoraRiver = 0x80AAC0C4; // type:func -func_80ACB148 = 0x80AAC164; // type:func -EnOwl_WaitHyliaShortcut = 0x80AAC1C4; // type:func -func_80ACB22C = 0x80AAC250; // type:func -func_80ACB274 = 0x80AAC29C; // type:func -EnOwl_WaitDeathMountainShortcut = 0x80AAC2E0; // type:func -func_80ACB344 = 0x80AAC374; // type:func -func_80ACB3E0 = 0x80AAC414; // type:func -func_80ACB440 = 0x80AAC47C; // type:func -func_80ACB4FC = 0x80AAC53C; // type:func -EnOwl_WaitLWPreSaria = 0x80AAC5AC; // type:func -func_80ACB5C4 = 0x80AAC610; // type:func -func_80ACB680 = 0x80AAC6D0; // type:func -EnOwl_WaitLWPostSaria = 0x80AAC740; // type:func -func_80ACB748 = 0x80AAC7A4; // type:func -func_80ACB904 = 0x80AAC960; // type:func -func_80ACB994 = 0x80AAC9F8; // type:func -EnOwl_WaitDefault = 0x80AACA90; // type:func -func_80ACBAB8 = 0x80AACB24; // type:func -func_80ACBC0C = 0x80AACC78; // type:func -func_80ACBD4C = 0x80AACDB4; // type:func -func_80ACBEA0 = 0x80AACF08; // type:func -func_80ACBF50 = 0x80AACFB8; // type:func -func_80ACC00C = 0x80AAD074; // type:func -func_80ACC23C = 0x80AAD238; // type:func -func_80ACC30C = 0x80AAD304; // type:func -func_80ACC390 = 0x80AAD388; // type:func -func_80ACC460 = 0x80AAD458; // type:func -func_80ACC540 = 0x80AAD538; // type:func -func_80ACC5CC = 0x80AAD5C4; // type:func -func_80ACC624 = 0x80AAD61C; // type:func -EnOwl_Update = 0x80AAD698; // type:func -EnOwl_OverrideLimbDraw = 0x80AADDE8; // type:func -EnOwl_PostLimbUpdate = 0x80AADF14; // type:func -EnOwl_Draw = 0x80AADF98; // type:func -EnOwl_ChangeMode = 0x80AAE064; // type:func -func_80ACD130 = 0x80AAE0DC; // type:func -func_80ACD1C4 = 0x80AAE170; // type:func -func_80ACD220 = 0x80AAE1D0; // type:func -func_80ACD2CC = 0x80AAE27C; // type:func -func_80ACD4D4 = 0x80AAE484; // type:func -EnPart_Init = 0x80AAEB20; // type:func -EnPart_Destroy = 0x80AAEB30; // type:func -func_80ACDDE8 = 0x80AAEB40; // type:func -func_80ACE13C = 0x80AAEE94; // type:func -func_80ACE5B8 = 0x80AAF310; // type:func -func_80ACE5C8 = 0x80AAF324; // type:func -func_80ACE7E8 = 0x80AAF548; // type:func -EnPart_Update = 0x80AAF744; // type:func -func_80ACEAC0 = 0x80AAF824; // type:func -EnPart_Draw = 0x80AAF8DC; // type:func -EnPeehat_SetupAction = 0x80AB0180; // type:func -EnPeehat_Init = 0x80AB018C; // type:func -EnPeehat_Destroy = 0x80AB03FC; // type:func -EnPeehat_SpawnDust = 0x80AB0470; // type:func -EnPeehat_HitWhenGrounded = 0x80AB0608; // type:func -EnPeehat_Ground_SetStateGround = 0x80AB0824; // type:func -EnPeehat_Ground_StateGround = 0x80AB08BC; // type:func -EnPeehat_Flying_SetStateGround = 0x80AB0A10; // type:func -EnPeehat_Flying_StateGrounded = 0x80AB0A9C; // type:func -EnPeehat_Flying_SetStateFly = 0x80AB0BA0; // type:func -EnPeehat_Flying_StateFly = 0x80AB0BE8; // type:func -EnPeehat_Ground_SetStateRise = 0x80AB0D60; // type:func -EnPeehat_Ground_StateRise = 0x80AB0E08; // type:func -EnPeehat_Flying_SetStateRise = 0x80AB0FD0; // type:func -EnPeehat_Flying_StateRise = 0x80AB1078; // type:func -EnPeehat_Ground_SetStateSeekPlayer = 0x80AB1240; // type:func -EnPeehat_Ground_StateSeekPlayer = 0x80AB1290; // type:func -EnPeehat_Larva_SetStateSeekPlayer = 0x80AB140C; // type:func -EnPeehat_Larva_StateSeekPlayer = 0x80AB1458; // type:func -EnPeehat_Ground_SetStateLanding = 0x80AB1830; // type:func -EnPeehat_Ground_StateLanding = 0x80AB1878; // type:func -EnPeehat_Flying_SetStateLanding = 0x80AB1A2C; // type:func -EnPeehat_Flying_StateLanding = 0x80AB1A74; // type:func -EnPeehat_Ground_SetStateHover = 0x80AB1C24; // type:func -EnPeehat_Ground_StateHover = 0x80AB1CB4; // type:func -EnPeehat_Ground_SetStateReturnHome = 0x80AB1F10; // type:func -EnPeehat_Ground_StateReturnHome = 0x80AB1F48; // type:func -EnPeehat_SetStateAttackRecoil = 0x80AB2134; // type:func -EnPeehat_StateAttackRecoil = 0x80AB2194; // type:func -EnPeehat_SetStateBoomerangStunned = 0x80AB2370; // type:func -EnPeehat_StateBoomerangStunned = 0x80AB23F4; // type:func -EnPeehat_Adult_SetStateDie = 0x80AB2470; // type:func -EnPeehat_Adult_StateDie = 0x80AB24DC; // type:func -EnPeehat_SetStateExplode = 0x80AB279C; // type:func -EnPeehat_StateExplode = 0x80AB27F4; // type:func -EnPeehat_Adult_CollisionCheck = 0x80AB28CC; // type:func -EnPeehat_Update = 0x80AB2AB8; // type:func -EnPeehat_OverrideLimbDraw = 0x80AB2F1C; // type:func -EnPeehat_PostLimbDraw = 0x80AB30F4; // type:func -EnPeehat_Draw = 0x80AB32A8; // type:func -EnPoDesert_Init = 0x80AB3880; // type:func -EnPoDesert_Destroy = 0x80AB39F0; // type:func -EnPoDesert_SetNextPathPoint = 0x80AB3A38; // type:func -EnPoDesert_SetupMoveToNextPoint = 0x80AB3B94; // type:func -EnPoDesert_SetupDisappear = 0x80AB3BD8; // type:func -EnPoDesert_UpdateSpeedModifier = 0x80AB3C38; // type:func -EnPoDesert_WaitForPlayer = 0x80AB3CA8; // type:func -EnPoDesert_MoveToNextPoint = 0x80AB3D74; // type:func -EnPoDesert_Disappear = 0x80AB3F08; // type:func -EnPoDesert_Update = 0x80AB3FF0; // type:func -EnPoDesert_OverrideLimbDraw = 0x80AB40E4; // type:func -EnPoDesert_PostLimbDraw = 0x80AB4170; // type:func -EnPoDesert_Draw = 0x80AB43C4; // type:func -EnPoField_Init = 0x80AB4640; // type:func -EnPoField_Destroy = 0x80AB4848; // type:func -EnPoField_SetupWaitForSpawn = 0x80AB48A8; // type:func -EnPoField_SetupAppear = 0x80AB496C; // type:func -EnPoField_SetupCirclePlayer = 0x80AB4A8C; // type:func -EnPoField_SetupFlee = 0x80AB4B34; // type:func -EnPoField_SetupDamage = 0x80AB4BC8; // type:func -EnPoField_SetupDeath = 0x80AB4C84; // type:func -EnPoField_SetupDisappear = 0x80AB4CD8; // type:func -EnPoField_SetupSoulIdle = 0x80AB4D50; // type:func -func_80AD42B0 = 0x80AB4E00; // type:func -func_80AD4384 = 0x80AB4ED4; // type:func -EnPoField_SetupSoulDisappear = 0x80AB4F8C; // type:func -EnPoField_SetupInteractWithSoul = 0x80AB4FA0; // type:func -EnPoField_CorrectYPos = 0x80AB4FC8; // type:func -EnPoField_SetFleeSpeed = 0x80AB50AC; // type:func -EnPoField_WaitForSpawn = 0x80AB51BC; // type:func -EnPoField_Appear = 0x80AB5424; // type:func -EnPoField_CirclePlayer = 0x80AB55C0; // type:func -EnPoField_Flee = 0x80AB5800; // type:func -EnPoField_Damage = 0x80AB59A4; // type:func -EnPoField_Death = 0x80AB5A34; // type:func -EnPoField_Disappear = 0x80AB5E4C; // type:func -EnPoField_SoulIdle = 0x80AB5F4C; // type:func -EnPoField_SoulUpdateProperties = 0x80AB6030; // type:func -func_80AD587C = 0x80AB63D8; // type:func -func_80AD58D4 = 0x80AB6430; // type:func -EnPoField_SoulDisappear = 0x80AB6634; // type:func -EnPoField_SoulInteract = 0x80AB6674; // type:func -EnPoField_TestForDamage = 0x80AB67D4; // type:func -EnPoField_SpawnFlame = 0x80AB686C; // type:func -EnPoField_UpdateFlame = 0x80AB68C0; // type:func -EnPoField_DrawFlame = 0x80AB69EC; // type:func -func_80AD619C = 0x80AB6CC4; // type:func -func_80AD6330 = 0x80AB6E58; // type:func -EnPoField_Update = 0x80AB6FCC; // type:func -EnPoField_OverrideLimbDraw2 = 0x80AB70F8; // type:func -EnPoField_PostLimDraw2 = 0x80AB7200; // type:func -EnPoField_Draw = 0x80AB7410; // type:func -EnPoField_UpdateDead = 0x80AB76F4; // type:func -EnPoField_DrawSoul = 0x80AB7750; // type:func -EnPoRelay_Init = 0x80AB80D0; // type:func -EnPoRelay_Destroy = 0x80AB8258; // type:func -EnPoRelay_SetupIdle = 0x80AB82A0; // type:func -EnPoRelay_Vec3sToVec3f = 0x80AB82DC; // type:func -EnPoRelay_SetupRace = 0x80AB8320; // type:func -EnPoRelay_SetupEndRace = 0x80AB83E8; // type:func -EnPoRelay_CorrectY = 0x80AB8428; // type:func -EnPoRelay_Idle = 0x80AB84D0; // type:func -EnPoRelay_Talk = 0x80AB858C; // type:func -EnPoRelay_Race = 0x80AB8600; // type:func -EnPoRelay_EndRace = 0x80AB8B14; // type:func -EnPoRelay_Talk2 = 0x80AB8BD4; // type:func -EnPoRelay_DisappearAndReward = 0x80AB8CAC; // type:func -EnPoRelay_Update = 0x80AB9178; // type:func -EnPoRelay_PostLimbDraw = 0x80AB926C; // type:func -EnPoRelay_Draw = 0x80AB9460; // type:func -EnPoSisters_Init = 0x80AB97E0; // type:func -EnPoSisters_Destroy = 0x80AB9A2C; // type:func -func_80AD9240 = 0x80AB9A94; // type:func -func_80AD9368 = 0x80AB9BC0; // type:func -func_80AD93C4 = 0x80AB9C1C; // type:func -func_80AD943C = 0x80AB9C94; // type:func -func_80AD944C = 0x80AB9CA8; // type:func -func_80AD94E0 = 0x80AB9D3C; // type:func -func_80AD9568 = 0x80AB9DC4; // type:func -func_80AD95D8 = 0x80AB9E34; // type:func -func_80AD96A4 = 0x80AB9F00; // type:func -func_80AD9718 = 0x80AB9F74; // type:func -func_80AD97C8 = 0x80ABA024; // type:func -func_80AD98F4 = 0x80ABA150; // type:func -func_80AD99D4 = 0x80ABA230; // type:func -func_80AD9A54 = 0x80ABA2B0; // type:func -func_80AD9AA8 = 0x80ABA304; // type:func -func_80AD9C24 = 0x80ABA480; // type:func -func_80AD9D44 = 0x80ABA5A0; // type:func -func_80AD9DF0 = 0x80ABA64C; // type:func -func_80AD9E60 = 0x80ABA6BC; // type:func -func_80AD9F1C = 0x80ABA778; // type:func -func_80AD9F90 = 0x80ABA7EC; // type:func -func_80ADA028 = 0x80ABA884; // type:func -func_80ADA094 = 0x80ABA8F0; // type:func -func_80ADA10C = 0x80ABA968; // type:func -func_80ADA1B8 = 0x80ABAA18; // type:func -func_80ADA25C = 0x80ABAABC; // type:func -func_80ADA2BC = 0x80ABAB1C; // type:func -func_80ADA35C = 0x80ABABBC; // type:func -func_80ADA4A8 = 0x80ABAD08; // type:func -func_80ADA530 = 0x80ABAD90; // type:func -func_80ADA6A0 = 0x80ABAF00; // type:func -func_80ADA7F0 = 0x80ABB050; // type:func -func_80ADA8C0 = 0x80ABB120; // type:func -func_80ADA9E8 = 0x80ABB248; // type:func -func_80ADAAA4 = 0x80ABB304; // type:func -func_80ADAC70 = 0x80ABB4D0; // type:func -func_80ADAD54 = 0x80ABB5B4; // type:func -func_80ADAE6C = 0x80ABB6CC; // type:func -func_80ADAFC0 = 0x80ABB820; // type:func -func_80ADB17C = 0x80ABB9DC; // type:func -func_80ADB2B8 = 0x80ABBB18; // type:func -func_80ADB338 = 0x80ABBB94; // type:func -func_80ADB4B0 = 0x80ABBD10; // type:func -func_80ADB51C = 0x80ABBD7C; // type:func -func_80ADB770 = 0x80ABBFD0; // type:func -func_80ADB9F0 = 0x80ABC250; // type:func -func_80ADBB6C = 0x80ABC3CC; // type:func -func_80ADBBF4 = 0x80ABC454; // type:func -func_80ADBC88 = 0x80ABC4E8; // type:func -func_80ADBD38 = 0x80ABC59C; // type:func -func_80ADBD8C = 0x80ABC5F0; // type:func -func_80ADBEE8 = 0x80ABC750; // type:func -func_80ADBF58 = 0x80ABC7C0; // type:func -func_80ADC034 = 0x80ABC89C; // type:func -func_80ADC10C = 0x80ABC974; // type:func -EnPoSisters_Update = 0x80ABCB38; // type:func -func_80ADC55C = 0x80ABCDCC; // type:func -EnPoSisters_OverrideLimbDraw = 0x80ABCFEC; // type:func -EnPoSisters_PostLimbDraw = 0x80ABD1DC; // type:func -EnPoSisters_Draw = 0x80ABD8AC; // type:func -EnPoh_Init = 0x80ABE4D0; // type:func -EnPoh_Destroy = 0x80ABE818; // type:func -func_80ADE114 = 0x80ABE898; // type:func -EnPoh_SetupIdle = 0x80ABE8F0; // type:func -func_80ADE1BC = 0x80ABE940; // type:func -EnPoh_SetupAttack = 0x80ABE990; // type:func -func_80ADE28C = 0x80ABEA10; // type:func -func_80ADE368 = 0x80ABEAEC; // type:func -EnPoh_SetupInitialAction = 0x80ABEB60; // type:func -func_80ADE48C = 0x80ABEC10; // type:func -func_80ADE4C8 = 0x80ABEC50; // type:func -func_80ADE514 = 0x80ABEC9C; // type:func -EnPoh_SetupDisappear = 0x80ABECF4; // type:func -EnPoh_SetupAppear = 0x80ABED4C; // type:func -EnPoh_SetupDeath = 0x80ABED98; // type:func -func_80ADE6D4 = 0x80ABEE64; // type:func -EnPoh_Talk = 0x80ABEF50; // type:func -func_80ADE950 = 0x80ABF0E8; // type:func -func_80ADE998 = 0x80ABF134; // type:func -func_80ADE9BC = 0x80ABF15C; // type:func -EnPoh_MoveTowardsPlayerHeight = 0x80ABF170; // type:func -func_80ADEA5C = 0x80ABF204; // type:func -func_80ADEAC4 = 0x80ABF274; // type:func -EnPoh_Idle = 0x80ABF330; // type:func -func_80ADEC9C = 0x80ABF44C; // type:func -EnPoh_Attack = 0x80ABF5B0; // type:func -func_80ADEECC = 0x80ABF680; // type:func -func_80ADEF38 = 0x80ABF6EC; // type:func -EnPoh_ComposerAppear = 0x80ABF86C; // type:func -func_80ADF15C = 0x80ABF910; // type:func -func_80ADF574 = 0x80ABFD28; // type:func -func_80ADF5E0 = 0x80ABFD94; // type:func -EnPoh_Disappear = 0x80ABFE14; // type:func -EnPoh_Appear = 0x80ABFF30; // type:func -func_80ADF894 = 0x80AC0050; // type:func -EnPoh_Death = 0x80AC0150; // type:func -func_80ADFA90 = 0x80AC0250; // type:func -func_80ADFE28 = 0x80AC05E8; // type:func -func_80ADFE80 = 0x80AC0640; // type:func -func_80AE009C = 0x80AC085C; // type:func -EnPoh_TalkRegular = 0x80AC089C; // type:func -EnPoh_TalkComposer = 0x80AC09C8; // type:func -func_80AE032C = 0x80AC0AF4; // type:func -EnPoh_UpdateVisibility = 0x80AC0B8C; // type:func -EnPoh_Update = 0x80AC0CFC; // type:func -func_80AE067C = 0x80AC0E48; // type:func -func_80AE089C = 0x80AC1068; // type:func -EnPoh_UpdateLiving = 0x80AC11E8; // type:func -EnPoh_OverrideLimbDraw = 0x80AC13C8; // type:func -EnPoh_PostLimbDraw = 0x80AC14BC; // type:func -EnPoh_DrawRegular = 0x80AC16AC; // type:func -EnPoh_DrawComposer = 0x80AC18D4; // type:func -EnPoh_UpdateDead = 0x80AC1D50; // type:func -EnPoh_DrawSoul = 0x80AC1DA4; // type:func -EnPubox_Init = 0x80AC26C0; // type:func -EnPubox_Destroy = 0x80AC27F8; // type:func -EnPubox_Update = 0x80AC282C; // type:func -EnPubox_Draw = 0x80AC297C; // type:func -EnRd_SetupAction = 0x80AC2A00; // type:func -EnRd_Init = 0x80AC2A0C; // type:func -EnRd_Destroy = 0x80AC2BF8; // type:func -EnRd_UpdateMourningTarget = 0x80AC2C3C; // type:func -EnRd_SetupIdle = 0x80AC2CA8; // type:func -EnRd_Idle = 0x80AC2D50; // type:func -EnRd_SetupRiseFromCoffin = 0x80AC2F7C; // type:func -EnRd_RiseFromCoffin = 0x80AC301C; // type:func -EnRd_SetupWalkToPlayer = 0x80AC319C; // type:func -EnRd_WalkToPlayer = 0x80AC3228; // type:func -EnRd_SetupWalkToHome = 0x80AC355C; // type:func -EnRd_WalkToHome = 0x80AC35DC; // type:func -EnRd_SetupWalkToParent = 0x80AC37F0; // type:func -EnRd_WalkToParent = 0x80AC3874; // type:func -EnRd_SetupGrab = 0x80AC3A08; // type:func -EnRd_Grab = 0x80AC3A6C; // type:func -EnRd_SetupAttemptPlayerFreeze = 0x80AC3DD8; // type:func -EnRd_AttemptPlayerFreeze = 0x80AC3E50; // type:func -EnRd_SetupStandUp = 0x80AC3F48; // type:func -EnRd_StandUp = 0x80AC3F94; // type:func -EnRd_SetupCrouch = 0x80AC3FF0; // type:func -EnRd_Crouch = 0x80AC4070; // type:func -EnRd_SetupDamaged = 0x80AC40AC; // type:func -EnRd_Damaged = 0x80AC4138; // type:func -EnRd_SetupDead = 0x80AC4248; // type:func -EnRd_Dead = 0x80AC42C0; // type:func -EnRd_SetupStunned = 0x80AC440C; // type:func -EnRd_Stunned = 0x80AC44F8; // type:func -EnRd_TurnTowardsPlayer = 0x80AC45CC; // type:func -EnRd_UpdateDamage = 0x80AC4744; // type:func -EnRd_Update = 0x80AC4910; // type:func -EnRd_OverrideLimbDraw = 0x80AC4AFC; // type:func -EnRd_PostLimbDraw = 0x80AC4B58; // type:func -EnRd_Draw = 0x80AC4CA0; // type:func -EnReeba_Init = 0x80AC52C0; // type:func -EnReeba_Destroy = 0x80AC549C; // type:func -EnReeba_SetupSurface = 0x80AC5514; // type:func -EnReeba_Surface = 0x80AC5628; // type:func -EnReeba_Move = 0x80AC5848; // type:func -EnReeba_SetupMoveBig = 0x80AC5964; // type:func -EnReeba_MoveBig = 0x80AC5988; // type:func -EnReeba_Bumped = 0x80AC5BF8; // type:func -EnReeba_SetupSink = 0x80AC5C64; // type:func -EnReeba_Sink = 0x80AC5CBC; // type:func -EnReeba_SetupDamaged = 0x80AC5DCC; // type:func -EnReeba_Damaged = 0x80AC5E30; // type:func -EnReeba_SetupStunned = 0x80AC5EC8; // type:func -EnReeba_Stunned = 0x80AC5F18; // type:func -EnReeba_StunDie = 0x80AC607C; // type:func -EnReeba_SetupDie = 0x80AC61A4; // type:func -EnReeba_Die = 0x80AC6218; // type:func -EnReeba_StunRecover = 0x80AC63F8; // type:func -EnReeba_CheckDamage = 0x80AC648C; // type:func -EnReeba_Update = 0x80AC66C8; // type:func -EnReeba_Draw = 0x80AC6978; // type:func -EnRiverSound_Init = 0x80AC6D30; // type:func -EnRiverSound_Destroy = 0x80AC6E00; // type:func -EnRiverSound_FindClosestPointOnLineSegment = 0x80AC6E58; // type:func -EnRiverSound_GetSfxPos = 0x80AC6FC4; // type:func -EnRiverSound_Update = 0x80AC72C0; // type:func -EnRiverSound_Draw = 0x80AC7490; // type:func -EnRl_Destroy = 0x80AC76C0; // type:func -func_80AE72D0 = 0x80AC76E4; // type:func -func_80AE744C = 0x80AC776C; // type:func -func_80AE7494 = 0x80AC77B4; // type:func -func_80AE74B4 = 0x80AC77D8; // type:func -func_80AE74FC = 0x80AC7824; // type:func -func_80AE7544 = 0x80AC7870; // type:func -func_80AE7590 = 0x80AC78BC; // type:func -func_80AE7668 = 0x80AC799C; // type:func -func_80AE7698 = 0x80AC79D0; // type:func -func_80AE772C = 0x80AC7A64; // type:func -func_80AE7798 = 0x80AC7AD0; // type:func -func_80AE77B8 = 0x80AC7AF0; // type:func -func_80AE77F8 = 0x80AC7B38; // type:func -func_80AE7838 = 0x80AC7B7C; // type:func -func_80AE7878 = 0x80AC7BC4; // type:func -func_80AE78D4 = 0x80AC7C1C; // type:func -func_80AE7954 = 0x80AC7C9C; // type:func -func_80AE79A4 = 0x80AC7CEC; // type:func -func_80AE7AF8 = 0x80AC7E40; // type:func -func_80AE7BF8 = 0x80AC7F4C; // type:func -func_80AE7C64 = 0x80AC7FB8; // type:func -func_80AE7C94 = 0x80AC7FD8; // type:func -func_80AE7CE8 = 0x80AC8020; // type:func -func_80AE7D40 = 0x80AC8064; // type:func -func_80AE7D94 = 0x80AC80AC; // type:func -EnRl_Update = 0x80AC81F4; // type:func -EnRl_Init = 0x80AC823C; // type:func -func_80AE7FD0 = 0x80AC82A8; // type:func -func_80AE7FDC = 0x80AC82B8; // type:func -EnRl_Draw = 0x80AC83EC; // type:func -EnRr_Init = 0x80AC85A0; // type:func -EnRr_Destroy = 0x80AC8740; // type:func -EnRr_Move = 0x80AC8780; // type:func -EnRr_SetupReach = 0x80AC87A8; // type:func -EnRr_SetupNeutral = 0x80AC88A8; // type:func -EnRr_SetupGrabPlayer = 0x80AC8974; // type:func -EnRr_GetMessage = 0x80AC8A7C; // type:func -EnRr_SetupReleasePlayer = 0x80AC8AD0; // type:func -EnRr_SetupDamage = 0x80AC8CCC; // type:func -EnRr_SetupApproach = 0x80AC8D98; // type:func -EnRr_SetupDeath = 0x80AC8E50; // type:func -EnRr_SetupStunned = 0x80AC8EF0; // type:func -EnRr_CollisionCheck = 0x80AC8FFC; // type:func -EnRr_InitBodySegments = 0x80AC938C; // type:func -EnRr_UpdateBodySegments = 0x80AC954C; // type:func -EnRr_Approach = 0x80AC96D0; // type:func -EnRr_Reach = 0x80AC9790; // type:func -EnRr_GrabPlayer = 0x80AC98AC; // type:func -EnRr_Damage = 0x80AC99A4; // type:func -EnRr_Death = 0x80AC9A1C; // type:func -EnRr_Retreat = 0x80AC9D90; // type:func -EnRr_Stunned = 0x80AC9E24; // type:func -EnRr_Update = 0x80AC9E8C; // type:func -EnRr_Draw = 0x80ACA2B8; // type:func -func_80AEAC10 = 0x80ACAAD0; // type:func -func_80AEAC54 = 0x80ACAB14; // type:func -func_80AEACDC = 0x80ACAB9C; // type:func -func_80AEAD20 = 0x80ACABE0; // type:func -EnRu1_DestroyColliders = 0x80ACAC58; // type:func -func_80AEADD8 = 0x80ACAC98; // type:func -func_80AEADE0 = 0x80ACACA4; // type:func -func_80AEADF0 = 0x80ACACB8; // type:func -EnRu1_Destroy = 0x80ACACC8; // type:func -EnRu1_UpdateEyes = 0x80ACACE8; // type:func -EnRu1_SetEyeIndex = 0x80ACAD70; // type:func -EnRu1_SetMouthIndex = 0x80ACAD88; // type:func -func_80AEAECC = 0x80ACADA0; // type:func -EnRu1_IsCsStateIdle = 0x80ACAE08; // type:func -EnRu1_GetCue = 0x80ACAE28; // type:func -func_80AEAFA0 = 0x80ACAE74; // type:func -func_80AEAFE0 = 0x80ACAEB4; // type:func -func_80AEB020 = 0x80ACAEF4; // type:func -EnRu1_FindSwitch = 0x80ACAF5C; // type:func -func_80AEB0EC = 0x80ACAFA4; // type:func -func_80AEB104 = 0x80ACAFBC; // type:func -func_80AEB124 = 0x80ACAFDC; // type:func -func_80AEB174 = 0x80ACB02C; // type:func -func_80AEB1B4 = 0x80ACB070; // type:func -func_80AEB264 = 0x80ACB09C; // type:func -EnRu1_UpdateSkelAnime = 0x80ACB158; // type:func -func_80AEB364 = 0x80ACB19C; // type:func -func_80AEB3A4 = 0x80ACB1DC; // type:func -func_80AEB3CC = 0x80ACB204; // type:func -func_80AEB3DC = 0x80ACB218; // type:func -EnRu1_GetCueChannel3 = 0x80ACB274; // type:func -func_80AEB458 = 0x80ACB294; // type:func -func_80AEB480 = 0x80ACB2BC; // type:func -EnRu1_SpawnRipple = 0x80ACB2E4; // type:func -func_80AEB50C = 0x80ACB34C; // type:func -func_80AEB59C = 0x80ACB3DC; // type:func -EnRu1_SpawnSplash = 0x80ACB4C8; // type:func -func_80AEB6E0 = 0x80ACB52C; // type:func -func_80AEB738 = 0x80ACB588; // type:func -func_80AEB7D0 = 0x80ACB620; // type:func -func_80AEB7E0 = 0x80ACB634; // type:func -func_80AEB87C = 0x80ACB6D0; // type:func -func_80AEB89C = 0x80ACB6F4; // type:func -func_80AEB914 = 0x80ACB76C; // type:func -func_80AEB934 = 0x80ACB78C; // type:func -func_80AEB954 = 0x80ACB7AC; // type:func -func_80AEB974 = 0x80ACB7CC; // type:func -func_80AEBA0C = 0x80ACB864; // type:func -func_80AEBA2C = 0x80ACB884; // type:func -func_80AEBAFC = 0x80ACB954; // type:func -func_80AEBB3C = 0x80ACB998; // type:func -func_80AEBB78 = 0x80ACB9D8; // type:func -func_80AEBBF4 = 0x80ACBA58; // type:func -func_80AEBC30 = 0x80ACBA98; // type:func -func_80AEBC84 = 0x80ACBAF0; // type:func -func_80AEBCB8 = 0x80ACBB28; // type:func -func_80AEBD1C = 0x80ACBB8C; // type:func -func_80AEBD94 = 0x80ACBC04; // type:func -func_80AEBE3C = 0x80ACBCAC; // type:func -func_80AEBEC8 = 0x80ACBD3C; // type:func -func_80AEBF60 = 0x80ACBDD4; // type:func -func_80AEBFD8 = 0x80ACBE50; // type:func -func_80AEC070 = 0x80ACBEE8; // type:func -func_80AEC0B4 = 0x80ACBF30; // type:func -func_80AEC100 = 0x80ACBF84; // type:func -func_80AEC130 = 0x80ACBFB8; // type:func -func_80AEC17C = 0x80ACC008; // type:func -func_80AEC1D4 = 0x80ACC068; // type:func -func_80AEC244 = 0x80ACC0DC; // type:func -func_80AEC2C0 = 0x80ACC15C; // type:func -func_80AEC320 = 0x80ACC1C0; // type:func -func_80AEC40C = 0x80ACC2B4; // type:func -func_80AEC4CC = 0x80ACC374; // type:func -func_80AEC4F4 = 0x80ACC39C; // type:func -func_80AEC5FC = 0x80ACC4A4; // type:func -func_80AEC650 = 0x80ACC4F8; // type:func -func_80AEC6B0 = 0x80ACC55C; // type:func -func_80AEC6E4 = 0x80ACC594; // type:func -func_80AEC780 = 0x80ACC634; // type:func -func_80AEC81C = 0x80ACC6D4; // type:func -func_80AEC8B8 = 0x80ACC770; // type:func -func_80AEC93C = 0x80ACC7F8; // type:func -func_80AEC9C4 = 0x80ACC880; // type:func -func_80AECA18 = 0x80ACC8D4; // type:func -func_80AECA44 = 0x80ACC904; // type:func -func_80AECA94 = 0x80ACC958; // type:func -func_80AECAB4 = 0x80ACC978; // type:func -func_80AECAD4 = 0x80ACC998; // type:func -func_80AECB18 = 0x80ACC9E0; // type:func -func_80AECB60 = 0x80ACCA2C; // type:func -func_80AECBB8 = 0x80ACCA88; // type:func -func_80AECC1C = 0x80ACCAF0; // type:func -func_80AECC84 = 0x80ACCB5C; // type:func -func_80AECCB0 = 0x80ACCB88; // type:func -func_80AECDA0 = 0x80ACCC78; // type:func -func_80AECE04 = 0x80ACCCDC; // type:func -func_80AECE20 = 0x80ACCCFC; // type:func -func_80AECEB4 = 0x80ACCD8C; // type:func -func_80AECF6C = 0x80ACCE44; // type:func -func_80AED084 = 0x80ACCF5C; // type:func -func_80AED0B0 = 0x80ACCF88; // type:func -func_80AED0C8 = 0x80ACCFA0; // type:func -func_80AED0D8 = 0x80ACCFB4; // type:func -func_80AED110 = 0x80ACCFEC; // type:func -func_80AED154 = 0x80ACD030; // type:func -func_80AED19C = 0x80ACD078; // type:func -func_80AED218 = 0x80ACD0F4; // type:func -func_80AED304 = 0x80ACD1E4; // type:func -func_80AED324 = 0x80ACD204; // type:func -func_80AED344 = 0x80ACD224; // type:func -func_80AED374 = 0x80ACD258; // type:func -func_80AED3A4 = 0x80ACD28C; // type:func -func_80AED3E0 = 0x80ACD2CC; // type:func -func_80AED414 = 0x80ACD304; // type:func -func_80AED44C = 0x80ACD344; // type:func -func_80AED4FC = 0x80ACD3F8; // type:func -func_80AED520 = 0x80ACD420; // type:func -func_80AED57C = 0x80ACD480; // type:func -func_80AED5B8 = 0x80ACD4C0; // type:func -func_80AED5DC = 0x80ACD4E8; // type:func -func_80AED600 = 0x80ACD510; // type:func -func_80AED624 = 0x80ACD538; // type:func -func_80AED6DC = 0x80ACD5F0; // type:func -func_80AED6F8 = 0x80ACD610; // type:func -func_80AED738 = 0x80ACD650; // type:func -func_80AED83C = 0x80ACD758; // type:func -func_80AED8DC = 0x80ACD7FC; // type:func -func_80AEDAE0 = 0x80ACDA00; // type:func -func_80AEDB30 = 0x80ACDA54; // type:func -func_80AEDEF4 = 0x80ACDE14; // type:func -func_80AEDFF4 = 0x80ACDF18; // type:func -func_80AEE02C = 0x80ACDF58; // type:func -func_80AEE050 = 0x80ACDF80; // type:func -func_80AEE264 = 0x80ACE19C; // type:func -func_80AEE2F8 = 0x80ACE230; // type:func -func_80AEE394 = 0x80ACE2CC; // type:func -func_80AEE488 = 0x80ACE3C0; // type:func -func_80AEE568 = 0x80ACE4A0; // type:func -func_80AEE628 = 0x80ACE564; // type:func -func_80AEE6D0 = 0x80ACE608; // type:func -func_80AEE7C4 = 0x80ACE6FC; // type:func -func_80AEEAC8 = 0x80ACEA1C; // type:func -func_80AEEB24 = 0x80ACEA78; // type:func -func_80AEEBB4 = 0x80ACEB08; // type:func -func_80AEEBD4 = 0x80ACEB28; // type:func -func_80AEEC5C = 0x80ACEBB4; // type:func -func_80AEECF0 = 0x80ACEC4C; // type:func -func_80AEED58 = 0x80ACECB8; // type:func -func_80AEEDCC = 0x80ACED30; // type:func -func_80AEEE34 = 0x80ACED9C; // type:func -func_80AEEE9C = 0x80ACEE08; // type:func -func_80AEEF08 = 0x80ACEE78; // type:func -func_80AEEF5C = 0x80ACEED0; // type:func -func_80AEEF68 = 0x80ACEEE0; // type:func -func_80AEEFEC = 0x80ACEF68; // type:func -func_80AEF080 = 0x80ACEFFC; // type:func -func_80AEF0BC = 0x80ACF03C; // type:func -func_80AEF170 = 0x80ACF0F4; // type:func -func_80AEF188 = 0x80ACF10C; // type:func -func_80AEF1F0 = 0x80ACF174; // type:func -func_80AEF29C = 0x80ACF220; // type:func -func_80AEF2AC = 0x80ACF234; // type:func -func_80AEF2D0 = 0x80ACF25C; // type:func -func_80AEF354 = 0x80ACF2E8; // type:func -func_80AEF3A8 = 0x80ACF344; // type:func -func_80AEF40C = 0x80ACF3AC; // type:func -func_80AEF4A8 = 0x80ACF44C; // type:func -func_80AEF4E0 = 0x80ACF484; // type:func -func_80AEF51C = 0x80ACF4C4; // type:func -func_80AEF540 = 0x80ACF4EC; // type:func -func_80AEF5B8 = 0x80ACF568; // type:func -func_80AEF624 = 0x80ACF5D8; // type:func -func_80AEF728 = 0x80ACF6DC; // type:func -func_80AEF79C = 0x80ACF750; // type:func -func_80AEF820 = 0x80ACF7D8; // type:func -func_80AEF890 = 0x80ACF848; // type:func -func_80AEF930 = 0x80ACF8D4; // type:func -func_80AEF99C = 0x80ACF944; // type:func -func_80AEF9D8 = 0x80ACF980; // type:func -func_80AEFA2C = 0x80ACF9C4; // type:func -func_80AEFAAC = 0x80ACFA3C; // type:func -func_80AEFB04 = 0x80ACFA84; // type:func -func_80AEFB68 = 0x80ACFAE0; // type:func -func_80AEFBC8 = 0x80ACFB38; // type:func -func_80AEFC24 = 0x80ACFB98; // type:func -func_80AEFC54 = 0x80ACFBCC; // type:func -func_80AEFCE8 = 0x80ACFC68; // type:func -func_80AEFD38 = 0x80ACFCB8; // type:func -func_80AEFDC0 = 0x80ACFD44; // type:func -func_80AEFE38 = 0x80ACFDC8; // type:func -func_80AEFE84 = 0x80ACFE14; // type:func -func_80AEFE9C = 0x80ACFE2C; // type:func -func_80AEFECC = 0x80ACFE60; // type:func -func_80AEFF40 = 0x80ACFEDC; // type:func -func_80AEFF94 = 0x80ACFF38; // type:func -EnRu1_Update = 0x80ACFFD4; // type:func -EnRu1_Init = 0x80AD001C; // type:func -func_80AF0278 = 0x80AD0158; // type:func -EnRu1_OverrideLimbDraw = 0x80AD01C8; // type:func -EnRu1_PostLimbDraw = 0x80AD0234; // type:func -EnRu1_DrawNothing = 0x80AD02C0; // type:func -EnRu1_DrawOpa = 0x80AD02D0; // type:func -EnRu1_DrawXlu = 0x80AD0474; // type:func -EnRu1_Draw = 0x80AD0614; // type:func -func_80AF2550 = 0x80AD2170; // type:func -func_80AF259C = 0x80AD21BC; // type:func -EnRu2_Destroy = 0x80AD2200; // type:func -func_80AF2608 = 0x80AD222C; // type:func -func_80AF2690 = 0x80AD22B4; // type:func -func_80AF26A0 = 0x80AD22C8; // type:func -func_80AF2744 = 0x80AD22D8; // type:func -EnRu2_UpdateSkelAnime = 0x80AD2320; // type:func -EnRu2_GetCue = 0x80AD2344; // type:func -func_80AF27D0 = 0x80AD236C; // type:func -func_80AF281C = 0x80AD23B8; // type:func -func_80AF2868 = 0x80AD2404; // type:func -func_80AF28E8 = 0x80AD2484; // type:func -func_80AF2978 = 0x80AD2514; // type:func -func_80AF2994 = 0x80AD2534; // type:func -func_80AF29DC = 0x80AD257C; // type:func -func_80AF2A38 = 0x80AD25D8; // type:func -func_80AF2AB4 = 0x80AD2654; // type:func -func_80AF2B44 = 0x80AD26F0; // type:func -func_80AF2B94 = 0x80AD2740; // type:func -func_80AF2BC0 = 0x80AD276C; // type:func -func_80AF2C54 = 0x80AD2800; // type:func -func_80AF2C68 = 0x80AD2814; // type:func -func_80AF2CB4 = 0x80AD2860; // type:func -func_80AF2CD4 = 0x80AD2880; // type:func -func_80AF2CF4 = 0x80AD28A0; // type:func -func_80AF2D2C = 0x80AD28DC; // type:func -func_80AF2D6C = 0x80AD2924; // type:func -func_80AF2DAC = 0x80AD2968; // type:func -func_80AF2DEC = 0x80AD29B0; // type:func -func_80AF2E1C = 0x80AD29E4; // type:func -func_80AF2E64 = 0x80AD2A28; // type:func -func_80AF2E84 = 0x80AD2A48; // type:func -func_80AF2F04 = 0x80AD2AC8; // type:func -func_80AF2F58 = 0x80AD2B1C; // type:func -func_80AF30AC = 0x80AD2C70; // type:func -func_80AF3144 = 0x80AD2D0C; // type:func -func_80AF3174 = 0x80AD2D2C; // type:func -func_80AF31C8 = 0x80AD2D74; // type:func -func_80AF321C = 0x80AD2DBC; // type:func -func_80AF3394 = 0x80AD2F04; // type:func -func_80AF33E0 = 0x80AD2F4C; // type:func -func_80AF346C = 0x80AD2FD8; // type:func -func_80AF34A4 = 0x80AD3010; // type:func -func_80AF34F0 = 0x80AD305C; // type:func -func_80AF3530 = 0x80AD309C; // type:func -func_80AF3564 = 0x80AD30D0; // type:func -func_80AF3604 = 0x80AD315C; // type:func -func_80AF3624 = 0x80AD317C; // type:func -func_80AF366C = 0x80AD31C8; // type:func -func_80AF36AC = 0x80AD3210; // type:func -func_80AF36EC = 0x80AD3254; // type:func -func_80AF3718 = 0x80AD3284; // type:func -func_80AF3744 = 0x80AD32B4; // type:func -func_80AF37AC = 0x80AD331C; // type:func -func_80AF37CC = 0x80AD333C; // type:func -func_80AF383C = 0x80AD33A8; // type:func -func_80AF3878 = 0x80AD33E4; // type:func -func_80AF38D0 = 0x80AD3444; // type:func -func_80AF390C = 0x80AD3480; // type:func -func_80AF39DC = 0x80AD3550; // type:func -func_80AF3ADC = 0x80AD363C; // type:func -func_80AF3B74 = 0x80AD36D4; // type:func -func_80AF3BC8 = 0x80AD3728; // type:func -func_80AF3C04 = 0x80AD376C; // type:func -func_80AF3C64 = 0x80AD37D4; // type:func -func_80AF3CB8 = 0x80AD3830; // type:func -func_80AF3D0C = 0x80AD388C; // type:func -func_80AF3D60 = 0x80AD38E8; // type:func -EnRu2_Update = 0x80AD394C; // type:func -EnRu2_Init = 0x80AD3994; // type:func -func_80AF3F14 = 0x80AD3A8C; // type:func -func_80AF3F20 = 0x80AD3A9C; // type:func -EnRu2_Draw = 0x80AD3BD0; // type:func -func_80AF5560 = 0x80AD4EF0; // type:func -EnSa_GetTextId = 0x80AD4F70; // type:func -EnSa_UpdateTalkState = 0x80AD5084; // type:func -func_80AF57D8 = 0x80AD5168; // type:func -func_80AF5894 = 0x80AD5228; // type:func -func_80AF58B8 = 0x80AD5250; // type:func -func_80AF594C = 0x80AD52E4; // type:func -func_80AF59E0 = 0x80AD5378; // type:func -func_80AF5A74 = 0x80AD540C; // type:func -func_80AF5B10 = 0x80AD54A8; // type:func -func_80AF5BA4 = 0x80AD553C; // type:func -func_80AF5C40 = 0x80AD55D8; // type:func -func_80AF5CD4 = 0x80AD566C; // type:func -func_80AF5CE4 = 0x80AD5684; // type:func -EnSa_ChangeAnim = 0x80AD572C; // type:func -func_80AF5DFC = 0x80AD579C; // type:func -func_80AF5F34 = 0x80AD58D4; // type:func -func_80AF603C = 0x80AD59DC; // type:func -func_80AF609C = 0x80AD5A3C; // type:func -func_80AF6130 = 0x80AD5AD8; // type:func -func_80AF6170 = 0x80AD5B1C; // type:func -EnSa_Init = 0x80AD5B60; // type:func -EnSa_Destroy = 0x80AD5DD0; // type:func -func_80AF6448 = 0x80AD5DFC; // type:func -func_80AF67D0 = 0x80AD6188; // type:func -func_80AF683C = 0x80AD61FC; // type:func -func_80AF68E4 = 0x80AD62A4; // type:func -func_80AF6B20 = 0x80AD64E4; // type:func -EnSa_Update = 0x80AD65A4; // type:func -EnSa_OverrideLimbDraw = 0x80AD6734; // type:func -EnSa_PostLimbDraw = 0x80AD68DC; // type:func -EnSa_Draw = 0x80AD6938; // type:func -EnSb_Init = 0x80AD7160; // type:func -EnSb_Destroy = 0x80AD7248; // type:func -EnSb_SpawnBubbles = 0x80AD7288; // type:func -EnSb_SetupWaitClosed = 0x80AD7338; // type:func -EnSb_SetupOpen = 0x80AD73B0; // type:func -EnSb_SetupWaitOpen = 0x80AD742C; // type:func -EnSb_SetupLunge = 0x80AD74A0; // type:func -EnSb_SetupBounce = 0x80AD7548; // type:func -EnSb_SetupCooldown = 0x80AD75C0; // type:func -EnSb_WaitClosed = 0x80AD76C4; // type:func -EnSb_Open = 0x80AD7744; // type:func -EnSb_WaitOpen = 0x80AD780C; // type:func -EnSb_TurnAround = 0x80AD78C0; // type:func -EnSb_Lunge = 0x80AD79AC; // type:func -EnSb_Bounce = 0x80AD7A54; // type:func -EnSb_Cooldown = 0x80AD7B88; // type:func -EnSb_IsVulnerable = 0x80AD7BF0; // type:func -EnSb_UpdateDamage = 0x80AD7D38; // type:func -EnSb_Update = 0x80AD8014; // type:func -EnSb_PostLimbDraw = 0x80AD8194; // type:func -EnSb_Draw = 0x80AD81E4; // type:func -EnSceneChange_SetupAction = 0x80AD85A0; // type:func -EnSceneChange_Init = 0x80AD85AC; // type:func -EnSceneChange_Destroy = 0x80AD85D4; // type:func -EnSceneChange_DoNothing = 0x80AD85E4; // type:func -EnSceneChange_Update = 0x80AD85F4; // type:func -EnSceneChange_Draw = 0x80AD8618; // type:func -EnSda_Init = 0x80AD86D0; // type:func -EnSda_Destroy = 0x80AD86E0; // type:func -EnSda_Update = 0x80AD86F0; // type:func -EnSda_Draw = 0x80AD872C; // type:func -func_80AF8F60 = 0x80AD87C0; // type:func -func_80AF95C4 = 0x80AD8E24; // type:func -func_80AF9C70 = 0x80AD94A0; // type:func -EnShopnuts_Init = 0x80AD9DC0; // type:func -EnShopnuts_Destroy = 0x80AD9EFC; // type:func -EnShopnuts_SetupIdle = 0x80AD9F28; // type:func -EnShopnuts_SetupLookAround = 0x80AD9F90; // type:func -EnShopnuts_SetupThrowNut = 0x80AD9FD8; // type:func -EnShopnuts_SetupPeek = 0x80ADA018; // type:func -EnShopnuts_SetupBurrow = 0x80ADA080; // type:func -EnShopnuts_SetupSpawnSalesman = 0x80ADA0D0; // type:func -EnShopnuts_Idle = 0x80ADA128; // type:func -EnShopnuts_LookAround = 0x80ADA38C; // type:func -EnShopnuts_Peek = 0x80ADA410; // type:func -EnShopnuts_ThrowNut = 0x80ADA4D4; // type:func -EnShopnuts_Burrow = 0x80ADA610; // type:func -EnShopnuts_SpawnSalesman = 0x80ADA6D4; // type:func -EnShopnuts_ColliderCheck = 0x80ADA770; // type:func -EnShopnuts_Update = 0x80ADA7D0; // type:func -EnShopnuts_OverrideLimbDraw = 0x80ADA910; // type:func -EnShopnuts_PostLimbDraw = 0x80ADA948; // type:func -EnShopnuts_Draw = 0x80ADAAE8; // type:func -EnSi_Init = 0x80ADACD0; // type:func -EnSi_Destroy = 0x80ADAD60; // type:func -func_80AFB748 = 0x80ADAD8C; // type:func -func_80AFB768 = 0x80ADADB0; // type:func -func_80AFB89C = 0x80ADAEE4; // type:func -func_80AFB950 = 0x80ADAF9C; // type:func -EnSi_Update = 0x80ADB030; // type:func -EnSi_Draw = 0x80ADB0A4; // type:func -EnSiofuki_Init = 0x80ADB1D0; // type:func -EnSiofuki_Destroy = 0x80ADB3EC; // type:func -func_80AFBDC8 = 0x80ADB420; // type:func -func_80AFBE8C = 0x80ADB4E0; // type:func -func_80AFC1D0 = 0x80ADB82C; // type:func -func_80AFC218 = 0x80ADB874; // type:func -func_80AFC34C = 0x80ADB9B0; // type:func -func_80AFC3C8 = 0x80ADBA34; // type:func -func_80AFC478 = 0x80ADBAEC; // type:func -func_80AFC544 = 0x80ADBBC0; // type:func -EnSiofuki_Update = 0x80ADBBF8; // type:func -EnSiofuki_Draw = 0x80ADBC1C; // type:func -EnSkb_SetupAction = 0x80ADBF80; // type:func -EnSkb_SpawnDebris = 0x80ADBF8C; // type:func -EnSkb_Init = 0x80ADC13C; // type:func -EnSkb_Destroy = 0x80ADC2F4; // type:func -EnSkb_DecideNextAction = 0x80ADC34C; // type:func -EnSkb_SetupRiseFromGround = 0x80ADC3E8; // type:func -EnSkb_RiseFromGround = 0x80ADC44C; // type:func -EnSkb_SetupDespawn = 0x80ADC538; // type:func -EnSkb_Despawn = 0x80ADC5E0; // type:func -EnSkb_SetupWalkForward = 0x80ADC694; // type:func -EnSkb_WalkForward = 0x80ADC72C; // type:func -EnSkb_SetupAttack = 0x80ADC92C; // type:func -EnSkb_Attack = 0x80ADC9C4; // type:func -EnSkb_SetupRecoil = 0x80ADCA70; // type:func -EnSkb_Recoil = 0x80ADCAFC; // type:func -EnSkb_SetupStunned = 0x80ADCB38; // type:func -EnSkb_Stunned = 0x80ADCB94; // type:func -EnSkb_SetupTakeDamage = 0x80ADCC3C; // type:func -EnSkb_TakeDamage = 0x80ADCCC4; // type:func -EnSkb_SetupDeath = 0x80ADCDB0; // type:func -EnSkb_Death = 0x80ADCE7C; // type:func -EnSkb_CheckDamage = 0x80ADCF68; // type:func -EnSkb_Update = 0x80ADD218; // type:func -EnSkb_OverrideLimbDraw = 0x80ADD340; // type:func -EnSkb_PostLimbDraw = 0x80ADD510; // type:func -EnSkb_Draw = 0x80ADD5B8; // type:func -EnSkj_ChangeAnim = 0x80ADD870; // type:func -EnSkj_SetupAction = 0x80ADD8F8; // type:func -EnSkj_CalculateCenter = 0x80ADD950; // type:func -EnSkj_SetNaviId = 0x80ADD9E8; // type:func -EnSkj_Init = 0x80ADDA6C; // type:func -EnSkj_Destroy = 0x80ADDDB8; // type:func -EnSkj_RangeCheck = 0x80ADDDE4; // type:func -EnSkj_GetItemXzRange = 0x80ADDE60; // type:func -EnSkj_GetItemYRange = 0x80ADDEA8; // type:func -EnSkj_ShootNeedle = 0x80ADDED4; // type:func -EnSkj_SpawnBlood = 0x80ADDFEC; // type:func -EnSkj_CollisionCheck = 0x80ADE144; // type:func -func_80AFEDF8 = 0x80ADE300; // type:func -EnSkj_Backflip = 0x80ADE38C; // type:func -EnSkj_Fade = 0x80ADE3D4; // type:func -EnSkj_SetupWaitToShootNeedle = 0x80ADE464; // type:func -EnSkj_WaitToShootNeedle = 0x80ADE4A0; // type:func -EnSkj_SetupResetFight = 0x80ADE540; // type:func -EnSkj_SariasSongKidIdle = 0x80ADE584; // type:func -EnSkj_SetupDie = 0x80ADE67C; // type:func -EnSkj_WaitForDeathAnim = 0x80ADE6B0; // type:func -func_80AFF1F0 = 0x80ADE704; // type:func -EnSkj_PickNextFightAction = 0x80ADE738; // type:func -func_80AFF2A0 = 0x80ADE7B8; // type:func -EnSkj_WaitForLandAnim = 0x80ADE7FC; // type:func -func_80AFF334 = 0x80ADE850; // type:func -EnSkj_ResetFight = 0x80ADE89C; // type:func -EnSkj_SetupStand = 0x80ADE8EC; // type:func -EnSkj_Fight = 0x80ADE940; // type:func -EnSkj_SetupNeedleRecover = 0x80ADEB0C; // type:func -EnSkj_NeedleRecover = 0x80ADEB40; // type:func -EnSkj_SetupSpawnDeathEffect = 0x80ADEB7C; // type:func -EnSkj_SpawnDeathEffect = 0x80ADEBA4; // type:func -EnSkj_SetupWaitInRange = 0x80ADECBC; // type:func -EnSkj_WaitInRange = 0x80ADECF4; // type:func -EnSkj_SetupWaitForSong = 0x80ADEF08; // type:func -EnSkj_WaitForSong = 0x80ADEF2C; // type:func -EnSkj_SetupAfterSong = 0x80ADF200; // type:func -EnSkj_AfterSong = 0x80ADF234; // type:func -EnSkj_SetupTalk = 0x80ADF288; // type:func -EnSkj_SariaSongTalk = 0x80ADF2A8; // type:func -func_80AFFE24 = 0x80ADF34C; // type:func -func_80AFFE44 = 0x80ADF36C; // type:func -EnSkj_SetupPostSariasSong = 0x80ADF3E4; // type:func -EnSkj_ChangeModeAfterSong = 0x80ADF404; // type:func -EnSkj_SetupMaskTrade = 0x80ADF46C; // type:func -EnSkj_StartMaskTrade = 0x80ADF48C; // type:func -EnSkj_JumpFromStump = 0x80ADF4F4; // type:func -EnSkj_WaitForLanding = 0x80ADF558; // type:func -EnSkj_SetupWaitForLandAnimFinish = 0x80ADF5A8; // type:func -EnSkj_WaitForLandAnimFinish = 0x80ADF5DC; // type:func -EnSkj_SetupWalkToPlayer = 0x80ADF630; // type:func -EnSkj_WalkToPlayer = 0x80ADF674; // type:func -EnSkj_SetupAskForMask = 0x80ADF710; // type:func -EnSkj_AskForMask = 0x80ADF758; // type:func -EnSkj_SetupTakeMask = 0x80ADF7F0; // type:func -EnSkj_TakeMask = 0x80ADF828; // type:func -EnSkj_SetupWaitForMaskTextClear = 0x80ADF8C0; // type:func -EnSkj_WaitForMaskTextClear = 0x80ADF8E0; // type:func -EnSkj_SetupWrongSong = 0x80ADF948; // type:func -EnSkj_WrongSong = 0x80ADF980; // type:func -EnSkj_SetupWaitForTextClear = 0x80ADF9D4; // type:func -EnSkj_SariasSongWaitForTextClear = 0x80ADF9F4; // type:func -EnSkj_OcarinaGameSetupWaitForPlayer = 0x80ADFA6C; // type:func -EnSkj_OcarinaGameWaitForPlayer = 0x80ADFAAC; // type:func -EnSkj_IsLeavingGame = 0x80ADFAE8; // type:func -EnSkj_SetupIdle = 0x80ADFB38; // type:func -EnSkj_Appear = 0x80ADFB6C; // type:func -EnSkj_OcarinaGameIdle = 0x80ADFB94; // type:func -EnSkj_SetupPlayOcarinaGame = 0x80ADFBE0; // type:func -EnSkj_PlayOcarinaGame = 0x80ADFC14; // type:func -EnSkj_SetupLeaveOcarinaGame = 0x80ADFC60; // type:func -EnSkj_LeaveOcarinaGame = 0x80ADFCA8; // type:func -EnSkj_Update = 0x80ADFCF0; // type:func -EnSkj_SariasSongShortStumpUpdate = 0x80ADFED4; // type:func -EnSkj_TurnPlayer = 0x80ADFEFC; // type:func -EnSkj_SetupWaitForOcarina = 0x80ADFF48; // type:func -EnSkj_WaitForOcarina = 0x80AE0004; // type:func -EnSkj_StartOcarinaMinigame = 0x80AE00AC; // type:func -EnSkj_WaitForPlayback = 0x80AE0138; // type:func -EnSkj_FailedMiniGame = 0x80AE03A8; // type:func -EnSkj_WaitForNextRound = 0x80AE03E8; // type:func -EnSkj_OfferNextRound = 0x80AE0438; // type:func -EnSkj_WaitForOfferResponse = 0x80AE0474; // type:func -EnSkj_WonOcarinaMiniGame = 0x80AE051C; // type:func -EnSkj_WaitToGiveReward = 0x80AE055C; // type:func -EnSkj_GiveOcarinaGameReward = 0x80AE05E4; // type:func -EnSkj_FinishOcarinaGameRound = 0x80AE0658; // type:func -EnSkj_CleanupOcarinaGame = 0x80AE06F4; // type:func -EnSkj_OcarinaMinigameShortStumpUpdate = 0x80AE0770; // type:func -EnSkj_OverrideLimbDraw = 0x80AE07F4; // type:func -EnSkj_PostLimbDraw = 0x80AE0810; // type:func -EnSkj_TranslucentDL = 0x80AE08E0; // type:func -EnSkj_OpaqueDL = 0x80AE0938; // type:func -EnSkj_Draw = 0x80AE0970; // type:func -EnSkjneedle_Init = 0x80AE11C0; // type:func -EnSkjneedle_Destroy = 0x80AE1258; // type:func -EnSkjNeedle_CollisionCheck = 0x80AE1284; // type:func -EnSkjneedle_Update = 0x80AE12B4; // type:func -EnSkjneedle_Draw = 0x80AE13A4; // type:func -EnSsh_SetupAction = 0x80AE14D0; // type:func -EnSsh_SpawnShockwave = 0x80AE14DC; // type:func -EnSsh_CreateBlureEffect = 0x80AE1564; // type:func -EnSsh_CheckCeilingPos = 0x80AE1660; // type:func -EnSsh_AddBlureVertex = 0x80AE16F8; // type:func -EnSsh_AddBlureSpace = 0x80AE1800; // type:func -EnSsh_InitColliders = 0x80AE182C; // type:func -EnSsh_SetAnimation = 0x80AE196C; // type:func -EnSsh_SetWaitAnimation = 0x80AE1AA0; // type:func -EnSsh_SetReturnAnimation = 0x80AE1AC0; // type:func -EnSsh_SetLandAnimation = 0x80AE1AF4; // type:func -EnSsh_SetDropAnimation = 0x80AE1B38; // type:func -EnSsh_SetStunned = 0x80AE1B88; // type:func -EnSsh_SetColliderScale = 0x80AE1BB4; // type:func -EnSsh_Damaged = 0x80AE1D28; // type:func -EnSsh_Turn = 0x80AE1E04; // type:func -EnSsh_Stunned = 0x80AE1ED8; // type:func -EnSsh_UpdateYaw = 0x80AE1F78; // type:func -EnSsh_Bob = 0x80AE1FB4; // type:func -EnSsh_IsCloseToLink = 0x80AE2020; // type:func -EnSsh_IsCloseToHome = 0x80AE2108; // type:func -EnSsh_IsCloseToGround = 0x80AE2140; // type:func -EnSsh_Sway = 0x80AE2180; // type:func -EnSsh_CheckBodyStickHit = 0x80AE22C4; // type:func -EnSsh_CheckHitPlayer = 0x80AE2338; // type:func -EnSsh_CheckHitFront = 0x80AE2440; // type:func -EnSsh_CheckHitBack = 0x80AE249C; // type:func -EnSsh_CollisionCheck = 0x80AE2574; // type:func -EnSsh_SetBodyCylinderAC = 0x80AE2628; // type:func -EnSsh_SetLegsCylinderAC = 0x80AE266C; // type:func -EnSsh_SetCylinderOC = 0x80AE2724; // type:func -EnSsh_SetColliders = 0x80AE28FC; // type:func -EnSsh_Init = 0x80AE29C4; // type:func -EnSsh_Destroy = 0x80AE2B58; // type:func -EnSsh_Wait = 0x80AE2BD8; // type:func -EnSsh_Talk = 0x80AE2C34; // type:func -EnSsh_Idle = 0x80AE2C80; // type:func -EnSsh_Land = 0x80AE2F18; // type:func -EnSsh_Drop = 0x80AE3000; // type:func -EnSsh_Return = 0x80AE3100; // type:func -EnSsh_UpdateColliderScale = 0x80AE31D4; // type:func -EnSsh_Start = 0x80AE327C; // type:func -EnSsh_Update = 0x80AE3304; // type:func -EnSsh_OverrideLimbDraw = 0x80AE3424; // type:func -EnSsh_PostLimbDraw = 0x80AE3514; // type:func -EnSsh_Draw = 0x80AE3550; // type:func -EnSt_SetupAction = 0x80AE3AC0; // type:func -EnSt_SpawnDust = 0x80AE3ACC; // type:func -EnSt_SpawnBlastEffect = 0x80AE3CEC; // type:func -EnSt_SpawnDeadEffect = 0x80AE3D74; // type:func -EnSt_CreateBlureEffect = 0x80AE3EB0; // type:func -EnSt_CheckCeilingPos = 0x80AE3FAC; // type:func -EnSt_AddBlurVertex = 0x80AE407C; // type:func -EnSt_AddBlurSpace = 0x80AE4184; // type:func -EnSt_SetWaitingAnimation = 0x80AE41B0; // type:func -EnSt_SetReturnToCeilingAnimation = 0x80AE41E0; // type:func -EnSt_SetLandAnimation = 0x80AE4220; // type:func -EnSt_SetDropAnimAndVel = 0x80AE427C; // type:func -EnSt_InitColliders = 0x80AE42DC; // type:func -EnSt_CheckBodyStickHit = 0x80AE441C; // type:func -EnSt_SetBodyCylinderAC = 0x80AE4490; // type:func -EnSt_SetLegsCylinderAC = 0x80AE44D4; // type:func -EnSt_SetCylinderOC = 0x80AE458C; // type:func -EnSt_UpdateCylinders = 0x80AE4764; // type:func -EnSt_CheckHitPlayer = 0x80AE4828; // type:func -EnSt_CheckHitFrontside = 0x80AE4914; // type:func -EnSt_CheckHitBackside = 0x80AE4954; // type:func -EnSt_CheckColliders = 0x80AE4B44; // type:func -EnSt_SetColliderScale = 0x80AE4BCC; // type:func -EnSt_SetTeethColor = 0x80AE4D38; // type:func -EnSt_DecrStunTimer = 0x80AE4E68; // type:func -EnSt_UpdateYaw = 0x80AE4E88; // type:func -EnSt_IsDoneBouncing = 0x80AE5128; // type:func -EnSt_Bob = 0x80AE51F0; // type:func -EnSt_IsCloseToPlayer = 0x80AE525C; // type:func -EnSt_IsCloseToInitalPos = 0x80AE5304; // type:func -EnSt_IsCloseToGround = 0x80AE533C; // type:func -EnSt_Sway = 0x80AE537C; // type:func -EnSt_Init = 0x80AE554C; // type:func -EnSt_Destroy = 0x80AE5670; // type:func -EnSt_WaitOnCeiling = 0x80AE56F0; // type:func -EnSt_WaitOnGround = 0x80AE574C; // type:func -EnSt_LandOnGround = 0x80AE5844; // type:func -EnSt_MoveToGround = 0x80AE5948; // type:func -EnSt_ReturnToCeiling = 0x80AE5A40; // type:func -EnSt_BounceAround = 0x80AE5B14; // type:func -EnSt_FinishBouncing = 0x80AE5BE8; // type:func -EnSt_Die = 0x80AE5D5C; // type:func -EnSt_StartOnCeilingOrGround = 0x80AE5DD4; // type:func -EnSt_Update = 0x80AE5E58; // type:func -EnSt_OverrideLimbDraw = 0x80AE5FD8; // type:func -EnSt_PostLimbDraw = 0x80AE60B8; // type:func -EnSt_Draw = 0x80AE60F4; // type:func -EnSth_SetupAction = 0x80AE6730; // type:func -EnSth_Init = 0x80AE673C; // type:func -EnSth_SetupShapeColliderUpdate2AndDraw = 0x80AE6838; // type:func -EnSth_SetupAfterObjectLoaded = 0x80AE68BC; // type:func -EnSth_Destroy = 0x80AE69E0; // type:func -EnSth_WaitForObject = 0x80AE6A0C; // type:func -EnSth_FacePlayer = 0x80AE6A60; // type:func -EnSth_LookAtPlayer = 0x80AE6B78; // type:func -EnSth_RewardObtainedTalk = 0x80AE6C8C; // type:func -EnSth_ParentRewardObtainedWait = 0x80AE6D08; // type:func -EnSth_GivePlayerItem = 0x80AE6D94; // type:func -EnSth_GiveReward = 0x80AE6E30; // type:func -EnSth_RewardUnobtainedTalk = 0x80AE6EB0; // type:func -EnSth_RewardUnobtainedWait = 0x80AE6F2C; // type:func -EnSth_ChildRewardObtainedWait = 0x80AE6FD0; // type:func -EnSth_Update = 0x80AE707C; // type:func -EnSth_Update2 = 0x80AE70A0; // type:func -EnSth_OverrideLimbDraw = 0x80AE71A4; // type:func -EnSth_PostLimbDraw = 0x80AE7300; // type:func -EnSth_AllocColorDList = 0x80AE7378; // type:func -EnSth_Draw = 0x80AE73E4; // type:func -EnStream_SetupAction = 0x80AEA7F0; // type:func -EnStream_Init = 0x80AEA7FC; // type:func -EnStream_Destroy = 0x80AEA864; // type:func -func_80B0B81C = 0x80AEA874; // type:func -EnStream_SuckPlayer = 0x80AEA994; // type:func -EnStream_WaitForPlayer = 0x80AEAB2C; // type:func -EnStream_Update = 0x80AEAB80; // type:func -EnStream_Draw = 0x80AEABB4; // type:func -EnSw_CrossProduct = 0x80AEAD80; // type:func -func_80B0BE20 = 0x80AEADF4; // type:func -func_80B0C020 = 0x80AEAFF4; // type:func -func_80B0C0CC = 0x80AEB0A4; // type:func -EnSw_Init = 0x80AEB4D8; // type:func -EnSw_Destroy = 0x80AEB9A0; // type:func -func_80B0C9F0 = 0x80AEB9CC; // type:func -func_80B0CBE8 = 0x80AEBBC8; // type:func -func_80B0CCF4 = 0x80AEBCD4; // type:func -func_80B0CEA8 = 0x80AEBE88; // type:func -func_80B0CF44 = 0x80AEBF28; // type:func -func_80B0D14C = 0x80AEC130; // type:func -func_80B0D364 = 0x80AEC348; // type:func -func_80B0D3AC = 0x80AEC390; // type:func -func_80B0D590 = 0x80AEC578; // type:func -func_80B0D878 = 0x80AEC860; // type:func -func_80B0DB00 = 0x80AECAE8; // type:func -func_80B0DC7C = 0x80AECC68; // type:func -func_80B0DE34 = 0x80AECE24; // type:func -func_80B0DEA8 = 0x80AECEA0; // type:func -func_80B0DFFC = 0x80AECFF4; // type:func -func_80B0E314 = 0x80AED30C; // type:func -func_80B0E430 = 0x80AED424; // type:func -func_80B0E5E0 = 0x80AED5D4; // type:func -func_80B0E728 = 0x80AED720; // type:func -func_80B0E90C = 0x80AED904; // type:func -func_80B0E9BC = 0x80AED9B4; // type:func -EnSw_Update = 0x80AEDA64; // type:func -EnSw_OverrideLimbDraw = 0x80AEDAC0; // type:func -EnSw_PostLimbDraw = 0x80AEDD64; // type:func -func_80B0EDB8 = 0x80AEDD7C; // type:func -func_80B0EEA4 = 0x80AEDE34; // type:func -EnSw_Draw = 0x80AEDE60; // type:func -EnSyatekiItm_Init = 0x80AEE570; // type:func -EnSyatekiItm_Destroy = 0x80AEE6D4; // type:func -EnSyatekiItm_Idle = 0x80AEE6E4; // type:func -EnSyatekiItm_StartRound = 0x80AEE7F4; // type:func -EnSyatekiItm_SpawnTargets = 0x80AEE970; // type:func -EnSyatekiItm_CheckTargets = 0x80AEEDF0; // type:func -EnSyatekiItm_CleanupGame = 0x80AEEE94; // type:func -EnSyatekiItm_EndGame = 0x80AEEF1C; // type:func -EnSyatekiItm_Update = 0x80AEEF68; // type:func -EnSyatekiMan_Init = 0x80AEF310; // type:func -EnSyatekiMan_Destroy = 0x80AEF3C4; // type:func -EnSyatekiMan_Start = 0x80AEF3D4; // type:func -EnSyatekiMan_SetupIdle = 0x80AEF468; // type:func -EnSyatekiMan_Idle = 0x80AEF4C0; // type:func -EnSyatekiMan_Talk = 0x80AEF51C; // type:func -EnSyatekiMan_StopTalk = 0x80AEF6C4; // type:func -EnSyatekiMan_StartGame = 0x80AEF76C; // type:func -EnSyatekiMan_WaitForGame = 0x80AEF82C; // type:func -EnSyatekiMan_EndGame = 0x80AEF948; // type:func -EnSyatekiMan_GivePrize = 0x80AEFB98; // type:func -EnSyatekiMan_FinishPrize = 0x80AEFC08; // type:func -EnSyatekiMan_RestartGame = 0x80AEFCCC; // type:func -EnSyatekiMan_BlinkWait = 0x80AEFD34; // type:func -EnSyatekiMan_Blink = 0x80AEFD68; // type:func -EnSyatekiMan_Update = 0x80AEFE08; // type:func -EnSyatekiMan_OverrideLimbDraw = 0x80AEFEA8; // type:func -EnSyatekiMan_Draw = 0x80AEFF38; // type:func -EnSyatekiNiw_Init = 0x80AF00D0; // type:func -EnSyatekiNiw_Destroy = 0x80AF0218; // type:func -EnSyatekiNiw_UpdateRotations = 0x80AF0244; // type:func -EnSyatekiNiw_SetupDefault = 0x80AF05A0; // type:func -EnSyatekiNiw_Default = 0x80AF062C; // type:func -EnSyatekiNiw_SetupArchery = 0x80AF0B5C; // type:func -EnSyatekiNiw_Archery = 0x80AF0C14; // type:func -EnSyatekiNiw_ExitArchery = 0x80AF1090; // type:func -EnSyatekiNiw_SetupRemove = 0x80AF10B0; // type:func -EnSyatekiNiw_Remove = 0x80AF11A8; // type:func -EnSyatekiNiw_CheckHit = 0x80AF1364; // type:func -EnSyatekiNiw_Update = 0x80AF1434; // type:func -SyatekiNiw_OverrideLimbDraw = 0x80AF17A4; // type:func -EnSyatekiNiw_Draw = 0x80AF18D4; // type:func -EnSyatekiNiw_SpawnFeather = 0x80AF1980; // type:func -EnSyatekiNiw_UpdateEffects = 0x80AF1A70; // type:func -EnSyatekiNiw_DrawEffects = 0x80AF1C2C; // type:func -EnTa_SetupAction = 0x80AF2160; // type:func -EnTa_SetTextForTalkInLonLonHouse = 0x80AF2170; // type:func -EnTa_Init = 0x80AF2250; // type:func -EnTa_DecreaseShadowSize = 0x80AF28D4; // type:func -EnTa_Destroy = 0x80AF2908; // type:func -EnTa_RequestTalk = 0x80AF2980; // type:func -EnTa_SleepTalkInKakariko = 0x80AF2A28; // type:func -EnTa_SleepTalkInLonLonHouse = 0x80AF2A68; // type:func -EnTa_SetupAwake = 0x80AF2AA8; // type:func -EnTa_TalkWakingUp2 = 0x80AF2B24; // type:func -EnTa_TalkWakingUp1 = 0x80AF2B70; // type:func -EnTa_WakeUp = 0x80AF2C0C; // type:func -EnTa_SleepTalkInCastle = 0x80AF2C98; // type:func -EnTa_IdleAsleepInCastle = 0x80AF2CD8; // type:func -EnTa_IdleAsleepInLonLonHouse = 0x80AF2DA0; // type:func -EnTa_IdleAsleepInKakariko = 0x80AF2E04; // type:func -EnTa_RunWithAccelerationAndSfx = 0x80AF2ECC; // type:func -EnTa_RunAwayRunOutOfGate = 0x80AF2F4C; // type:func -EnTa_RunAwayTurnTowardsGate = 0x80AF2FC0; // type:func -EnTa_RunAwayRunWest = 0x80AF3020; // type:func -EnTa_RunAwayTurnWest = 0x80AF30A8; // type:func -EnTa_RunAwayRunSouth = 0x80AF3108; // type:func -EnTa_RunAwayStart = 0x80AF31A8; // type:func -EnTa_TalkAwakeInCastle = 0x80AF3220; // type:func -EnTa_IdleAwakeInCastle = 0x80AF32CC; // type:func -EnTa_TalkAwakeInKakariko = 0x80AF3318; // type:func -EnTa_IdleAwakeInKakariko = 0x80AF3364; // type:func -EnTa_TalkAtRanch = 0x80AF340C; // type:func -EnTa_IdleAtRanch = 0x80AF3458; // type:func -EnTa_CheckCanBuyMilk = 0x80AF349C; // type:func -EnTa_CreateFloorCamera = 0x80AF34EC; // type:func -EnTa_RemoveFloorCamera = 0x80AF35A0; // type:func -EnTa_SetupActionWithSleepAnimation = 0x80AF35E4; // type:func -EnTa_SetupActionWithWakeUpAnimation = 0x80AF3674; // type:func -EnTa_TalkNotEnoughRupees = 0x80AF3700; // type:func -EnTa_IsPlayerHoldingSuperCucco = 0x80AF3778; // type:func -EnTa_TalkFoundSuperCucco = 0x80AF37CC; // type:func -EnTa_IdleFoundSuperCucco = 0x80AF392C; // type:func -EnTa_GetSuperCuccosCount = 0x80AF399C; // type:func -EnTa_AnimateHandsUpDown = 0x80AF39D8; // type:func -EnTa_TransitionToPostCuccoGame = 0x80AF3AA4; // type:func -EnTa_TalkCuccoGameEnd = 0x80AF3AF4; // type:func -EnTa_RunCuccoGame = 0x80AF3BD0; // type:func -EnTa_ThrowSuperCuccos = 0x80AF3F30; // type:func -EnTa_StartingCuccoGame3 = 0x80AF41A8; // type:func -EnTa_StartingCuccoGame2 = 0x80AF42CC; // type:func -EnTa_StartingCuccoGame1 = 0x80AF439C; // type:func -EnTa_StartCuccoGame = 0x80AF4464; // type:func -EnTa_TalkGeneralInLonLonHouse = 0x80AF44FC; // type:func -EnTa_GiveItemInLonLonHouse = 0x80AF4558; // type:func -EnTa_TalkAfterCuccoGameFirstWon = 0x80AF462C; // type:func -EnTa_WaitBuyMilkOrPlayCuccoGameResponse = 0x80AF46C4; // type:func -EnTa_WaitForPlayCuccoGameResponse = 0x80AF48A0; // type:func -EnTa_WaitForMarryMalonResponse = 0x80AF49C8; // type:func -EnTa_ContinueTalkInLonLonHouse = 0x80AF4A48; // type:func -EnTa_TalkAfterCuccoGameWon = 0x80AF4B14; // type:func -EnTa_IdleSittingInLonLonHouse = 0x80AF4BEC; // type:func -EnTa_IdleAfterCuccoGameFinished = 0x80AF4CEC; // type:func -EnTa_BlinkWaitUntilNext = 0x80AF4DB0; // type:func -EnTa_BlinkAdvanceState = 0x80AF4DE4; // type:func -EnTa_AnimRepeatCurrent = 0x80AF4EA4; // type:func -EnTa_AnimSleeping = 0x80AF4EE4; // type:func -EnTa_AnimSitSleeping = 0x80AF4F38; // type:func -EnTa_AnimRunToEnd = 0x80AF5018; // type:func -EnTa_Update = 0x80AF5070; // type:func -EnTa_OverrideLimbDraw = 0x80AF5200; // type:func -EnTa_PostLimbDraw = 0x80AF5384; // type:func -EnTa_Draw = 0x80AF53C4; // type:func -EnTakaraMan_Destroy = 0x80AF5B20; // type:func -EnTakaraMan_Init = 0x80AF5B30; // type:func -func_80B176E0 = 0x80AF5C7C; // type:func -func_80B1778C = 0x80AF5D28; // type:func -func_80B17934 = 0x80AF5ED0; // type:func -func_80B17A6C = 0x80AF6008; // type:func -func_80B17AC4 = 0x80AF6064; // type:func -func_80B17B14 = 0x80AF60B8; // type:func -EnTakaraMan_Update = 0x80AF611C; // type:func -EnTakaraMan_OverrideLimbDraw = 0x80AF61F4; // type:func -EnTakaraMan_Draw = 0x80AF625C; // type:func -EnTana_Init = 0x80AF63E0; // type:func -EnTana_Destroy = 0x80AF6430; // type:func -EnTana_Update = 0x80AF6440; // type:func -EnTana_DrawWoodenShelves = 0x80AF6450; // type:func -EnTana_DrawStoneShelves = 0x80AF64E8; // type:func -EnTg_GetTextId = 0x80AF6690; // type:func -EnTg_UpdateTalkState = 0x80AF672C; // type:func -EnTg_Init = 0x80AF67E8; // type:func -EnTg_Destroy = 0x80AF68BC; // type:func -EnTg_SpinIfNotTalking = 0x80AF68FC; // type:func -EnTg_Update = 0x80AF6920; // type:func -EnTg_OverrideLimbDraw = 0x80AF6A40; // type:func -EnTg_PostLimbDraw = 0x80AF6A5C; // type:func -EnTg_SetColor = 0x80AF6AB8; // type:func -EnTg_Draw = 0x80AF6B24; // type:func -EnTite_SetupAction = 0x80AF6D70; // type:func -EnTite_Init = 0x80AF6D7C; // type:func -EnTite_Destroy = 0x80AF6ED4; // type:func -EnTite_SetupIdle = 0x80AF6F1C; // type:func -EnTite_Idle = 0x80AF6F84; // type:func -EnTite_SetupAttack = 0x80AF70C8; // type:func -EnTite_Attack = 0x80AF713C; // type:func -EnTite_SetupTurnTowardPlayer = 0x80AF77E4; // type:func -EnTite_TurnTowardPlayer = 0x80AF7880; // type:func -EnTite_SetupMoveTowardPlayer = 0x80AF7B1C; // type:func -EnTite_MoveTowardPlayer = 0x80AF7BD8; // type:func -EnTite_SetupRecoil = 0x80AF80E8; // type:func -EnTite_Recoil = 0x80AF8154; // type:func -EnTite_SetupStunned = 0x80AF84AC; // type:func -EnTite_Stunned = 0x80AF8560; // type:func -EnTite_SetupDeathCry = 0x80AF88FC; // type:func -EnTite_DeathCry = 0x80AF8930; // type:func -EnTite_FallApart = 0x80AF89A4; // type:func -EnTite_SetupFlipOnBack = 0x80AF8A30; // type:func -EnTite_FlipOnBack = 0x80AF8B4C; // type:func -EnTite_SetupFlipUpright = 0x80AF8D08; // type:func -EnTite_FlipUpright = 0x80AF8D58; // type:func -EnTite_CheckDamage = 0x80AF8E80; // type:func -EnTite_Update = 0x80AF9058; // type:func -EnTite_PostLimbDraw = 0x80AF9444; // type:func -EnTite_Draw = 0x80AF9534; // type:func -EnTkEff_Create = 0x80AF9B10; // type:func -EnTkEff_Update = 0x80AF9BB4; // type:func -EnTkEff_Draw = 0x80AF9CC0; // type:func -EnTkEff_CreateDflt = 0x80AF9FB8; // type:func -EnTk_RestAnim = 0x80AFA070; // type:func -EnTk_WalkAnim = 0x80AFA0EC; // type:func -EnTk_DigAnim = 0x80AFA160; // type:func -EnTk_UpdateEyes = 0x80AFA1E0; // type:func -EnTk_CheckFacingPlayer = 0x80AFA2A4; // type:func -EnTk_CheckNextSpot = 0x80AFA328; // type:func -EnTk_CheckCurrentSpot = 0x80AFA410; // type:func -EnTk_Step = 0x80AFA488; // type:func -EnTk_Orient = 0x80AFA5B0; // type:func -EnTk_GetTextId = 0x80AFA720; // type:func -EnTk_UpdateTalkState = 0x80AFA774; // type:func -EnTk_ChooseReward = 0x80AFA910; // type:func -EnTk_DigEff = 0x80AFAACC; // type:func -EnTk_Init = 0x80AFAC3C; // type:func -EnTk_Destroy = 0x80AFADB8; // type:func -EnTk_Rest = 0x80AFADE4; // type:func -EnTk_Walk = 0x80AFB00C; // type:func -EnTk_Dig = 0x80AFB0DC; // type:func -EnTk_Update = 0x80AFB340; // type:func -func_80B1D200 = 0x80AFB3EC; // type:func -EnTk_OverrideLimbDraw = 0x80AFB418; // type:func -EnTk_PostLimbDraw = 0x80AFB484; // type:func -EnTk_Draw = 0x80AFB538; // type:func -EnTorch_Init = 0x80AFB940; // type:func -EnTorch2_Init = 0x80AFBA30; // type:func -EnTorch2_Destroy = 0x80AFBBD8; // type:func -EnTorch2_GetAttackItem = 0x80AFBC48; // type:func -EnTorch2_SwingSword = 0x80AFBC90; // type:func -EnTorch2_Backflip = 0x80AFBE28; // type:func -EnTorch2_Update = 0x80AFBE80; // type:func -EnTorch2_OverrideLimbDraw = 0x80AFD868; // type:func -EnTorch2_PostLimbDraw = 0x80AFD894; // type:func -EnTorch2_Draw = 0x80AFD8B8; // type:func -EnToryo_Init = 0x80AFE1D0; // type:func -EnToryo_Destroy = 0x80AFE414; // type:func -EnToryo_TalkRespond = 0x80AFE440; // type:func -EnToryo_DoneTalking = 0x80AFE634; // type:func -EnToryo_ReactToExchangeItem = 0x80AFE6A0; // type:func -EnToryo_GetTextId = 0x80AFE70C; // type:func -EnToryo_HandleTalking = 0x80AFE7D8; // type:func -EnToryo_Idle = 0x80AFE988; // type:func -EnToryo_Update = 0x80AFE9EC; // type:func -EnToryo_Draw = 0x80AFEB24; // type:func -EnToryo_OverrideLimbDraw = 0x80AFEB84; // type:func -EnToryo_PostLimbDraw = 0x80AFEC14; // type:func -EnTp_SetupAction = 0x80AFEE60; // type:func -EnTp_Init = 0x80AFEE6C; // type:func -EnTp_Destroy = 0x80AFF0E4; // type:func -EnTp_Tail_SetupFollowHead = 0x80AFF110; // type:func -EnTp_Tail_FollowHead = 0x80AFF13C; // type:func -EnTp_Head_SetupApproachPlayer = 0x80AFF318; // type:func -EnTp_Head_ApproachPlayer = 0x80AFF34C; // type:func -EnTp_SetupDie = 0x80AFF4E8; // type:func -EnTp_Die = 0x80AFF560; // type:func -EnTp_Fragment_SetupFade = 0x80AFF890; // type:func -EnTp_Fragment_Fade = 0x80AFF994; // type:func -EnTp_Head_SetupTakeOff = 0x80AFF9E0; // type:func -EnTp_Head_TakeOff = 0x80AFFA3C; // type:func -EnTp_Head_SetupWait = 0x80AFFC24; // type:func -EnTp_Head_Wait = 0x80AFFC70; // type:func -EnTp_Head_SetupBurrowReturnHome = 0x80AFFF7C; // type:func -EnTp_Head_BurrowReturnHome = 0x80AFFFAC; // type:func -EnTp_UpdateDamage = 0x80B0027C; // type:func -EnTp_Update = 0x80B004D4; // type:func -EnTp_Draw = 0x80B00840; // type:func -EnTr_SetupAction = 0x80B00CD0; // type:func -EnTr_Init = 0x80B00CDC; // type:func -EnTr_Destroy = 0x80B00E2C; // type:func -EnTr_CrySpellcast = 0x80B00E3C; // type:func -EnTr_DoNothing = 0x80B00EEC; // type:func -EnTr_ChooseAction2 = 0x80B00EFC; // type:func -EnTr_FlyKidnapCutscene = 0x80B010AC; // type:func -func_80B23254 = 0x80B01228; // type:func -EnTr_ShrinkVanish = 0x80B014A8; // type:func -EnTr_Reappear = 0x80B01664; // type:func -EnTr_WaitToReappear = 0x80B017FC; // type:func -EnTr_TakeOff = 0x80B018BC; // type:func -EnTr_TurnLookOverShoulder = 0x80B01984; // type:func -EnTr_ChooseAction1 = 0x80B01A64; // type:func -EnTr_Update = 0x80B01B98; // type:func -EnTr_OverrideLimbDraw = 0x80B01D50; // type:func -EnTr_Draw = 0x80B01E80; // type:func -func_80B23FDC = 0x80B01F8C; // type:func -func_80B24038 = 0x80B01FEC; // type:func -EnTr_SetRotFromCue = 0x80B021E8; // type:func -EnTr_SetStartPosRotFromCue = 0x80B02270; // type:func -EnTrap_Init = 0x80B025D0; // type:func -EnTrap_Destroy = 0x80B0298C; // type:func -EnTrap_Update = 0x80B029B8; // type:func -EnTrap_Draw = 0x80B0374C; // type:func -EnTuboTrap_Init = 0x80B03870; // type:func -EnTuboTrap_Destroy = 0x80B038F4; // type:func -EnTuboTrap_DropCollectible = 0x80B03920; // type:func -EnTuboTrap_SpawnEffectsOnLand = 0x80B03980; // type:func -EnTuboTrap_SpawnEffectsInWater = 0x80B03BF4; // type:func -EnTuboTrap_HandleImpact = 0x80B03E74; // type:func -EnTuboTrap_WaitForProximity = 0x80B0409C; // type:func -EnTuboTrap_Levitate = 0x80B041A8; // type:func -EnTuboTrap_Fly = 0x80B04234; // type:func -EnTuboTrap_Update = 0x80B04304; // type:func -EnTuboTrap_Draw = 0x80B043C4; // type:func -EnVali_Init = 0x80B04510; // type:func -EnVali_Destroy = 0x80B0468C; // type:func -EnVali_SetupLurk = 0x80B046DC; // type:func -EnVali_SetupDropAppear = 0x80B0472C; // type:func -EnVali_SetupFloatIdle = 0x80B04764; // type:func -EnVali_SetupAttacked = 0x80B0497C; // type:func -EnVali_SetupRetaliate = 0x80B049B4; // type:func -EnVali_SetupMoveArmsDown = 0x80B04A24; // type:func -EnVali_SetupBurnt = 0x80B04A64; // type:func -EnVali_SetupDivideAndDie = 0x80B04ABC; // type:func -EnVali_SetupStunned = 0x80B04BC0; // type:func -EnVali_SetupFrozen = 0x80B04C4C; // type:func -EnVali_SetupReturnToLurk = 0x80B04CAC; // type:func -EnVali_DischargeLightning = 0x80B04D08; // type:func -EnVali_Lurk = 0x80B04F04; // type:func -EnVali_DropAppear = 0x80B04F44; // type:func -EnVali_FloatIdle = 0x80B04FD8; // type:func -EnVali_Attacked = 0x80B05184; // type:func -EnVali_Retaliate = 0x80B0523C; // type:func -EnVali_MoveArmsDown = 0x80B05298; // type:func -EnVali_Burnt = 0x80B052D4; // type:func -EnVali_DivideAndDie = 0x80B05310; // type:func -EnVali_Stunned = 0x80B054C4; // type:func -EnVali_Frozen = 0x80B05580; // type:func -EnVali_ReturnToLurk = 0x80B05710; // type:func -EnVali_UpdateDamage = 0x80B05780; // type:func -EnVali_Update = 0x80B05938; // type:func -EnVali_PulseOutside = 0x80B05A94; // type:func -EnVali_PulseInsides = 0x80B05CB0; // type:func -EnVali_SetArmLength = 0x80B05ECC; // type:func -EnVali_OverrideLimbDraw = 0x80B0606C; // type:func -EnVali_PostLimbDraw = 0x80B060FC; // type:func -EnVali_DrawBody = 0x80B061C0; // type:func -EnVali_Draw = 0x80B06528; // type:func -EnVase_Init = 0x80B06BD0; // type:func -EnVase_Destroy = 0x80B06C34; // type:func -EnVase_Draw = 0x80B06C44; // type:func -EnVbBall_Init = 0x80B06CD0; // type:func -EnVbBall_Destroy = 0x80B06E50; // type:func -EnVbBall_SpawnDebris = 0x80B06E8C; // type:func -EnVbBall_SpawnDust = 0x80B06F64; // type:func -EnVbBall_UpdateBones = 0x80B07004; // type:func -EnVbBall_Update = 0x80B072E8; // type:func -EnVbBall_Draw = 0x80B07AB4; // type:func -EnViewer_SetupAction = 0x80B07E80; // type:func -EnViewer_Init = 0x80B07E8C; // type:func -EnViewer_Destroy = 0x80B07F60; // type:func -EnViewer_InitAnimGanondorfOrZelda = 0x80B07F8C; // type:func -EnViewer_InitAnimImpa = 0x80B080D8; // type:func -EnViewer_InitAnimHorse = 0x80B08168; // type:func -EnViewer_InitImpl = 0x80B08200; // type:func -EnViewer_UpdateImpl = 0x80B083BC; // type:func -EnViewer_Update = 0x80B08F14; // type:func -EnViewer_Ganondorf3OverrideLimbDraw = 0x80B08F68; // type:func -EnViewer_Ganondorf9PostLimbDraw = 0x80B08FD8; // type:func -EnViewer_GanondorfPostLimbDrawUpdateCapeVec = 0x80B090A0; // type:func -EnViewer_DrawGanondorf = 0x80B090E0; // type:func -EnViewer_DrawHorse = 0x80B0950C; // type:func -EnViewer_ZeldaOverrideLimbDraw = 0x80B09538; // type:func -EnViewer_ZeldaPostLimbDraw = 0x80B095B8; // type:func -EnViewer_DrawZelda = 0x80B09600; // type:func -EnViewer_ImpaOverrideLimbDraw = 0x80B09CA4; // type:func -EnViewer_DrawImpa = 0x80B09CCC; // type:func -EnViewer_Draw = 0x80B09DE0; // type:func -EnViewer_UpdatePosition = 0x80B09ED0; // type:func -EnViewer_InitFireEffect = 0x80B0A2A0; // type:func -EnViewer_DrawFireEffects = 0x80B0A3E8; // type:func -EnViewer_UpdateGanondorfCape = 0x80B0A72C; // type:func -EnVm_SetupAction = 0x80B0AD40; // type:func -EnVm_Init = 0x80B0AD4C; // type:func -EnVm_Destroy = 0x80B0AEBC; // type:func -EnVm_SetupWait = 0x80B0AEE8; // type:func -EnVm_Wait = 0x80B0AF74; // type:func -EnVm_SetupAttack = 0x80B0B2C8; // type:func -EnVm_Attack = 0x80B0B36C; // type:func -EnVm_SetupStun = 0x80B0B5BC; // type:func -EnVm_Stun = 0x80B0B664; // type:func -EnVm_SetupDie = 0x80B0B770; // type:func -EnVm_Die = 0x80B0B878; // type:func -EnVm_CheckHealth = 0x80B0B92C; // type:func -EnVm_Update = 0x80B0BA28; // type:func -EnVm_OverrideLimbDraw = 0x80B0BBBC; // type:func -EnVm_PostLimbDraw = 0x80B0BC24; // type:func -EnVm_Draw = 0x80B0BEFC; // type:func -EnWallTubo_Init = 0x80B0C600; // type:func -EnWallTubo_Destroy = 0x80B0C630; // type:func -EnWallTubo_FindGirl = 0x80B0C640; // type:func -EnWallTubo_DetectChu = 0x80B0C684; // type:func -EnWallTubo_SetWallFall = 0x80B0C8A0; // type:func -EnWallTubo_Update = 0x80B0CA0C; // type:func -EnWallmas_Init = 0x80B0CAF0; // type:func -EnWallmas_Destroy = 0x80B0CC30; // type:func -EnWallmas_TimerInit = 0x80B0CC5C; // type:func -EnWallmas_SetupDrop = 0x80B0CCB8; // type:func -EnWallmas_SetupLand = 0x80B0CD7C; // type:func -EnWallmas_SetupStand = 0x80B0CE40; // type:func -EnWallmas_SetupWalk = 0x80B0CE80; // type:func -EnWallmas_SetupJumpToCeiling = 0x80B0CED0; // type:func -EnWallmas_SetupReturnToCeiling = 0x80B0CF18; // type:func -EnWallmas_SetupTakeDamage = 0x80B0CF9C; // type:func -EnWallmas_SetupCooldown = 0x80B0D058; // type:func -EnWallmas_SetupDie = 0x80B0D0AC; // type:func -EnWallmas_SetupTakePlayer = 0x80B0D174; // type:func -EnWallmas_ProximityOrSwitchInit = 0x80B0D1FC; // type:func -EnWallmas_SetupStun = 0x80B0D244; // type:func -EnWallmas_WaitToDrop = 0x80B0D314; // type:func -EnWallmas_Drop = 0x80B0D420; // type:func -EnWallmas_Land = 0x80B0D4EC; // type:func -EnWallmas_Stand = 0x80B0D528; // type:func -EnWallmas_Walk = 0x80B0D588; // type:func -EnWallmas_JumpToCeiling = 0x80B0D63C; // type:func -EnWallmas_ReturnToCeiling = 0x80B0D678; // type:func -EnWallmas_TakeDamage = 0x80B0D794; // type:func -EnWallmas_Cooldown = 0x80B0D828; // type:func -EnWallmas_Die = 0x80B0D864; // type:func -EnWallmas_TakePlayer = 0x80B0D8D8; // type:func -EnWallmas_WaitForProximity = 0x80B0DAFC; // type:func -EnWallmas_WaitForSwitchFlag = 0x80B0DB58; // type:func -EnWallmas_Stun = 0x80B0DBA4; // type:func -EnWallmas_ColUpdate = 0x80B0DC18; // type:func -EnWallmas_Update = 0x80B0DD34; // type:func -EnWallmas_DrawXlu = 0x80B0DEFC; // type:func -EnWallMas_OverrideLimbDraw = 0x80B0E09C; // type:func -EnWallMas_PostLimbDraw = 0x80B0E110; // type:func -EnWallmas_Draw = 0x80B0E200; // type:func -EnWeatherTag_SetupAction = 0x80B0E500; // type:func -EnWeatherTag_Destroy = 0x80B0E50C; // type:func -EnWeatherTag_Init = 0x80B0E51C; // type:func -WeatherTag_CheckEnableWeatherEffect = 0x80B0E6F0; // type:func -WeatherTag_CheckRestoreWeather = 0x80B0E8C8; // type:func -EnWeatherTag_DisabledCloudyHyruleMarket = 0x80B0EA88; // type:func -EnWeatherTag_EnabledCloudyHyruleMarket = 0x80B0EAE4; // type:func -EnWeatherTag_DisabledCloudyLonLonRanch = 0x80B0EB38; // type:func -EnWeatherTag_EnabledCloudyLonLonRanch = 0x80B0EB94; // type:func -EnWeatherTag_DisabledCloudyDeathMountain = 0x80B0EBE8; // type:func -EnWeatherTag_EnabledCloudyDeathMountain = 0x80B0EC44; // type:func -EnWeatherTag_DisabledCloudySnow = 0x80B0EC98; // type:func -EnWeatherTag_EnabledCloudySnow = 0x80B0ED10; // type:func -EnWeatherTag_DisabledRainLakeHylia = 0x80B0ED7C; // type:func -EnWeatherTag_EnabledRainLakeHylia = 0x80B0EE00; // type:func -EnWeatherTag_DisabledCloudyRainThunderKakariko = 0x80B0EE78; // type:func -EnWeatherTag_EnabledCloudyRainThunderKakariko = 0x80B0EF10; // type:func -EnWeatherTag_SetSandstormIntensity = 0x80B0EF9C; // type:func -EnWeatherTag_DisabledRainThunder = 0x80B0F098; // type:func -EnWeatherTag_EnabledRainThunder = 0x80B0F13C; // type:func -EnWeatherTag_Update = 0x80B0F1F0; // type:func -EnWeiyer_Init = 0x80B0F3F0; // type:func -EnWeiyer_Destroy = 0x80B0F4C0; // type:func -func_80B32384 = 0x80B0F4EC; // type:func -func_80B32434 = 0x80B0F5A0; // type:func -func_80B32494 = 0x80B0F600; // type:func -func_80B32508 = 0x80B0F674; // type:func -func_80B32538 = 0x80B0F6A8; // type:func -func_80B325A0 = 0x80B0F714; // type:func -func_80B32660 = 0x80B0F7D4; // type:func -func_80B32724 = 0x80B0F898; // type:func -func_80B327B0 = 0x80B0F924; // type:func -func_80B327D8 = 0x80B0F950; // type:func -func_80B32804 = 0x80B0F980; // type:func -func_80B328E8 = 0x80B0FA64; // type:func -func_80B32C2C = 0x80B0FDA8; // type:func -func_80B32D30 = 0x80B0FEAC; // type:func -func_80B32DEC = 0x80B0FF68; // type:func -func_80B32E34 = 0x80B0FFB4; // type:func -func_80B33018 = 0x80B1019C; // type:func -func_80B331CC = 0x80B10350; // type:func -func_80B332B4 = 0x80B10438; // type:func -func_80B33338 = 0x80B104BC; // type:func -func_80B333B8 = 0x80B1053C; // type:func -func_80B3349C = 0x80B10620; // type:func -func_80B3368C = 0x80B10814; // type:func -EnWeiyer_Update = 0x80B108F4; // type:func -EnWeiyer_OverrideLimbDraw = 0x80B10A68; // type:func -EnWeiyer_Draw = 0x80B10A98; // type:func -EnWf_SetupAction = 0x80B10DF0; // type:func -EnWf_Init = 0x80B10DFC; // type:func -EnWf_Destroy = 0x80B11030; // type:func -EnWf_ChangeAction = 0x80B110CC; // type:func -EnWf_SetupWaitToAppear = 0x80B1149C; // type:func -EnWf_WaitToAppear = 0x80B11544; // type:func -EnWf_SetupWait = 0x80B11678; // type:func -EnWf_Wait = 0x80B11700; // type:func -EnWf_SetupRunAtPlayer = 0x80B1191C; // type:func -EnWf_RunAtPlayer = 0x80B1199C; // type:func -EnWf_SetupSearchForPlayer = 0x80B11E1C; // type:func -EnWf_SearchForPlayer = 0x80B11E68; // type:func -EnWf_SetupRunAroundPlayer = 0x80B12048; // type:func -EnWf_RunAroundPlayer = 0x80B12144; // type:func -EnWf_SetupSlash = 0x80B12664; // type:func -EnWf_Slash = 0x80B126E0; // type:func -EnWf_SetupRecoilFromBlockedSlash = 0x80B12A34; // type:func -EnWf_RecoilFromBlockedSlash = 0x80B12AD0; // type:func -EnWf_SetupBackflipAway = 0x80B12CC8; // type:func -EnWf_BackflipAway = 0x80B12D44; // type:func -EnWf_SetupStunned = 0x80B12E4C; // type:func -EnWf_Stunned = 0x80B12EC4; // type:func -EnWf_SetupDamaged = 0x80B12F80; // type:func -EnWf_Damaged = 0x80B13018; // type:func -EnWf_SetupSomersaultAndAttack = 0x80B13220; // type:func -EnWf_SomersaultAndAttack = 0x80B132D8; // type:func -EnWf_SetupBlocking = 0x80B133C0; // type:func -EnWf_Blocking = 0x80B13460; // type:func -EnWf_SetupSidestep = 0x80B136E4; // type:func -EnWf_Sidestep = 0x80B1387C; // type:func -EnWf_SetupDie = 0x80B13DCC; // type:func -EnWf_Die = 0x80B13E7C; // type:func -func_80B36F40 = 0x80B14084; // type:func -EnWf_UpdateDamage = 0x80B1417C; // type:func -EnWf_Update = 0x80B1434C; // type:func -EnWf_OverrideLimbDraw = 0x80B145A0; // type:func -EnWf_PostLimbDraw = 0x80B145E4; // type:func -EnWf_Draw = 0x80B1478C; // type:func -EnWf_DodgeRanged = 0x80B14948; // type:func -EnWonderItem_Destroy = 0x80B15100; // type:func -EnWonderItem_DropCollectible = 0x80B15144; // type:func -EnWonderItem_Init = 0x80B152A0; // type:func -EnWonderItem_MultitagFree = 0x80B155EC; // type:func -EnWonderItem_ProximityDrop = 0x80B15734; // type:func -EnWonderItem_InteractSwitch = 0x80B1579C; // type:func -EnWonderItem_ProximitySwitch = 0x80B157D0; // type:func -EnWonderItem_MultitagOrdered = 0x80B1585C; // type:func -EnWonderItem_BombSoldier = 0x80B159B8; // type:func -EnWonderItem_RollDrop = 0x80B15A48; // type:func -EnWonderItem_Update = 0x80B15ABC; // type:func -EnWonderTalk_Destroy = 0x80B15E30; // type:func -EnWonderTalk_Init = 0x80B15E40; // type:func -func_80B391CC = 0x80B15EE8; // type:func -func_80B3943C = 0x80B16078; // type:func -func_80B395F0 = 0x80B161CC; // type:func -EnWonderTalk_Update = 0x80B163BC; // type:func -EnWonderTalk2_Destroy = 0x80B164C0; // type:func -EnWonderTalk2_Init = 0x80B164D0; // type:func -func_80B3A10C = 0x80B16660; // type:func -func_80B3A15C = 0x80B166B0; // type:func -func_80B3A3D4 = 0x80B16830; // type:func -func_80B3A4F8 = 0x80B16918; // type:func -EnWonderTalk2_DoNothing = 0x80B16A68; // type:func -EnWonderTalk2_Update = 0x80B16A78; // type:func -EnWood02_SpawnZoneCheck = 0x80B16B60; // type:func -EnWood02_SpawnOffspring = 0x80B16C88; // type:func -EnWood02_Init = 0x80B16EA0; // type:func -EnWood02_Destroy = 0x80B172DC; // type:func -EnWood02_Update = 0x80B17318; // type:func -EnWood02_Draw = 0x80B17810; // type:func -EnXc_InitCollider = 0x80B17D40; // type:func -EnXc_UpdateCollider = 0x80B17D8C; // type:func -EnXc_Destroy = 0x80B17DD0; // type:func -EnXc_CalculateHeadTurn = 0x80B17DFC; // type:func -EnXc_SetEyePattern = 0x80B17E84; // type:func -EnXc_SpawnNut = 0x80B17F0C; // type:func -EnXc_BgCheck = 0x80B17FD4; // type:func -EnXc_AnimIsFinished = 0x80B1801C; // type:func -EnXc_GetCue = 0x80B18040; // type:func -EnXc_CheckForCue = 0x80B18064; // type:func -EnXc_CheckForNoCue = 0x80B180B0; // type:func -func_80B3C588 = 0x80B180FC; // type:func -func_80B3C620 = 0x80B18194; // type:func -EnXc_ChangeAnimation = 0x80B18274; // type:func -EnXc_CheckAndSetAction = 0x80B18330; // type:func -func_80B3C7D4 = 0x80B18348; // type:func -func_80B3C8CC = 0x80B18374; // type:func -func_80B3C924 = 0x80B183D0; // type:func -func_80B3C964 = 0x80B18410; // type:func -func_80B3C9DC = 0x80B18488; // type:func -func_80B3C9EC = 0x80B1849C; // type:func -func_80B3CA38 = 0x80B184E8; // type:func -EnXc_MinuetCS = 0x80B1853C; // type:func -func_80B3CB58 = 0x80B18614; // type:func -EnXc_BoleroCS = 0x80B18668; // type:func -EnXc_SetupSerenadeAction = 0x80B187C8; // type:func -EnXc_SerenadeCS = 0x80B18820; // type:func -EnXc_DoNothing = 0x80B188E8; // type:func -EnXc_SetWalkingSFX = 0x80B188F8; // type:func -EnXc_SetNutThrowSFX = 0x80B18978; // type:func -EnXc_SetLandingSFX = 0x80B18A04; // type:func -EnXc_SetColossusAppearSFX = 0x80B18A84; // type:func -func_80B3D118 = 0x80B18B90; // type:func -EnXc_SetColossusWindSFX = 0x80B18BD4; // type:func -EnXc_SpawnFlame = 0x80B18CDC; // type:func -EnXc_SetupFlamePos = 0x80B18D80; // type:func -EnXc_DestroyFlame = 0x80B18DFC; // type:func -EnXc_InitFlame = 0x80B18E3C; // type:func -func_80B3D48C = 0x80B18ED8; // type:func -EnXc_GetCurrentHarpAnim = 0x80B18F28; // type:func -EnXc_CalcXZAccel = 0x80B18FBC; // type:func -func_80B3D644 = 0x80B19094; // type:func -EnXc_CalcXZSpeed = 0x80B190B4; // type:func -func_80B3D6F0 = 0x80B19140; // type:func -func_80B3D710 = 0x80B19160; // type:func -func_80B3D730 = 0x80B19180; // type:func -func_80B3D750 = 0x80B191A0; // type:func -EnXc_SetupFallFromSkyAction = 0x80B191EC; // type:func -func_80B3D8A4 = 0x80B192FC; // type:func -EnXc_SetupWalkAction = 0x80B193EC; // type:func -EnXc_SetupHaltAction = 0x80B1945C; // type:func -EnXc_SetupStoppedAction = 0x80B19508; // type:func -func_80B3DAF0 = 0x80B19550; // type:func -EnXc_SetupInitialHarpAction = 0x80B19610; // type:func -EnXc_SetupPlayingHarpAction = 0x80B19688; // type:func -func_80B3DCA8 = 0x80B19710; // type:func -EnXc_SetupHarpPutawayAction = 0x80B197A4; // type:func -func_80B3DE00 = 0x80B19874; // type:func -func_80B3DE78 = 0x80B198EC; // type:func -EnXc_SetupReverseAccel = 0x80B19968; // type:func -EnXc_SetupReverseWalkAction = 0x80B19A18; // type:func -EnXc_SetupReverseHaltAction = 0x80B19A88; // type:func -EnXc_SetupNutThrow = 0x80B19B34; // type:func -func_80B3E164 = 0x80B19BDC; // type:func -EnXc_SetupDisappear = 0x80B19C30; // type:func -EnXc_ActionFunc0 = 0x80B19CA0; // type:func -EnXc_ActionFunc1 = 0x80B19CE0; // type:func -EnXc_GracefulFall = 0x80B19D20; // type:func -EnXc_Accelerate = 0x80B19D9C; // type:func -EnXc_Walk = 0x80B19DFC; // type:func -EnXc_Stopped = 0x80B19E5C; // type:func -EnXc_ActionFunc6 = 0x80B19EBC; // type:func -EnXc_ActionFunc7 = 0x80B19F04; // type:func -EnXc_ActionFunc8 = 0x80B19F50; // type:func -EnXc_ActionFunc9 = 0x80B19FA0; // type:func -EnXc_ActionFunc10 = 0x80B19FE8; // type:func -EnXc_ActionFunc11 = 0x80B1A030; // type:func -EnXc_ActionFunc12 = 0x80B1A07C; // type:func -EnXc_ActionFunc13 = 0x80B1A0C8; // type:func -EnXc_ReverseAccelerate = 0x80B1A124; // type:func -EnXc_ActionFunc15 = 0x80B1A190; // type:func -EnXc_HaltAndWaitToThrowNut = 0x80B1A1FC; // type:func -EnXc_ThrowNut = 0x80B1A268; // type:func -EnXc_Delete = 0x80B1A2D0; // type:func -EnXc_Fade = 0x80B1A32C; // type:func -func_80B3E87C = 0x80B1A34C; // type:func -EnXc_PullingOutHarpOverrideLimbDraw = 0x80B1A37C; // type:func -EnXc_HarpOverrideLimbDraw = 0x80B1A3B8; // type:func -EnXc_DrawPullingOutHarp = 0x80B1A3E0; // type:func -EnXc_DrawHarp = 0x80B1A51C; // type:func -func_80B3EBF0 = 0x80B1A658; // type:func -func_80B3EC00 = 0x80B1A66C; // type:func -func_80B3EC0C = 0x80B1A67C; // type:func -func_80B3EC90 = 0x80B1A700; // type:func -func_80B3ECD8 = 0x80B1A748; // type:func -EnXc_ActionFunc20 = 0x80B1A7B8; // type:func -EnXc_ActionFunc21 = 0x80B1A7DC; // type:func -EnXc_ActionFunc22 = 0x80B1A7FC; // type:func -EnXc_ActionFunc23 = 0x80B1A844; // type:func -EnXc_ActionFunc24 = 0x80B1A8A4; // type:func -EnXc_ActionFunc25 = 0x80B1A8B4; // type:func -EnXc_ActionFunc26 = 0x80B1A8C4; // type:func -EnXc_ActionFunc27 = 0x80B1A8D4; // type:func -EnXc_ActionFunc28 = 0x80B1A8E4; // type:func -func_80B3EE64 = 0x80B1A8F4; // type:func -func_80B3EE74 = 0x80B1A908; // type:func -func_80B3EEA4 = 0x80B1A93C; // type:func -func_80B3EEC8 = 0x80B1A960; // type:func -func_80B3EEEC = 0x80B1A984; // type:func -func_80B3EF10 = 0x80B1A9A8; // type:func -func_80B3EF34 = 0x80B1A9CC; // type:func -func_80B3EF58 = 0x80B1A9F0; // type:func -func_80B3EF80 = 0x80B1AA18; // type:func -func_80B3EFA4 = 0x80B1AA3C; // type:func -func_80B3EFC8 = 0x80B1AA60; // type:func -func_80B3EFEC = 0x80B1AA84; // type:func -func_80B3F010 = 0x80B1AAA8; // type:func -func_80B3F0B8 = 0x80B1AB54; // type:func -func_80B3F0DC = 0x80B1AB78; // type:func -func_80B3F100 = 0x80B1AB9C; // type:func -EnXc_Serenade = 0x80B1ABC0; // type:func -EnXc_ActionFunc30 = 0x80B1ABE0; // type:func -EnXc_ActionFunc31 = 0x80B1AC0C; // type:func -EnXc_ActionFunc32 = 0x80B1AC50; // type:func -EnXc_ActionFunc33 = 0x80B1AC7C; // type:func -EnXc_ActionFunc34 = 0x80B1ACA8; // type:func -EnXc_ActionFunc35 = 0x80B1ACD4; // type:func -EnXc_ActionFunc36 = 0x80B1AD00; // type:func -EnXc_ActionFunc37 = 0x80B1AD2C; // type:func -EnXc_ActionFunc38 = 0x80B1AD58; // type:func -EnXc_ActionFunc39 = 0x80B1AD84; // type:func -EnXc_ActionFunc40 = 0x80B1ADB0; // type:func -EnXc_ActionFunc41 = 0x80B1AE10; // type:func -EnXc_ActionFunc42 = 0x80B1AE3C; // type:func -EnXc_ActionFunc43 = 0x80B1AE68; // type:func -EnXc_ActionFunc44 = 0x80B1AE94; // type:func -func_80B3F3C8 = 0x80B1AEA4; // type:func -func_80B3F3D8 = 0x80B1AEB8; // type:func -EnXc_PlayDiveSFX = 0x80B1AED8; // type:func -EnXc_LakeHyliaDive = 0x80B1AF2C; // type:func -func_80B3F534 = 0x80B1B018; // type:func -func_80B3F59C = 0x80B1B080; // type:func -func_80B3F620 = 0x80B1B104; // type:func -func_80B3F644 = 0x80B1B128; // type:func -func_80B3F668 = 0x80B1B14C; // type:func -func_80B3F6DC = 0x80B1B1C0; // type:func -EnXc_SetupKneelAction = 0x80B1B1E4; // type:func -func_80B3F754 = 0x80B1B23C; // type:func -func_80B3F7BC = 0x80B1B2AC; // type:func -EnXc_ActionFunc45 = 0x80B1B2E8; // type:func -EnXc_ActionFunc46 = 0x80B1B314; // type:func -EnXc_ActionFunc47 = 0x80B1B340; // type:func -EnXc_ActionFunc48 = 0x80B1B398; // type:func -EnXc_ActionFunc49 = 0x80B1B3C4; // type:func -EnXc_Kneel = 0x80B1B428; // type:func -EnXc_ActionFunc51 = 0x80B1B48C; // type:func -EnXc_ActionFunc52 = 0x80B1B4F0; // type:func -func_80B3FA08 = 0x80B1B510; // type:func -func_80B3FA2C = 0x80B1B538; // type:func -EnXc_PlayTriforceSFX = 0x80B1B558; // type:func -func_80B3FAE0 = 0x80B1B5F0; // type:func -EnXc_CalcTriforce = 0x80B1B638; // type:func -func_80B3FF0C = 0x80B1BA30; // type:func -EnXc_SetupShowTriforceAction = 0x80B1BAD8; // type:func -EnXc_SetupShowTriforceIdleAction = 0x80B1BB68; // type:func -func_80B400AC = 0x80B1BBD4; // type:func -EnXc_ActionFunc53 = 0x80B1BC10; // type:func -EnXc_ActionFunc54 = 0x80B1BC30; // type:func -EnXc_ShowTriforce = 0x80B1BC78; // type:func -EnXc_ShowTriforceIdle = 0x80B1BCE0; // type:func -EnXc_TriforceOverrideLimbDraw = 0x80B1BD3C; // type:func -EnXc_TriforcePostLimbDraw = 0x80B1BD64; // type:func -EnXc_DrawTriforce = 0x80B1BDE0; // type:func -func_80B40590 = 0x80B1C074; // type:func -EnXc_SetThrownAroundSFX = 0x80B1C090; // type:func -EnXc_PlayLinkScreamSFX = 0x80B1C154; // type:func -EnXc_SetCrySFX = 0x80B1C188; // type:func -func_80B406F8 = 0x80B1C1E4; // type:func -EnXc_SetupIdleInNocturne = 0x80B1C1FC; // type:func -EnXc_SetupDefenseStance = 0x80B1C298; // type:func -EnXc_SetupContortions = 0x80B1C310; // type:func -EnXc_SetupFallInNocturne = 0x80B1C3AC; // type:func -EnXc_SetupHittingGroundInNocturne = 0x80B1C488; // type:func -func_80B40A78 = 0x80B1C528; // type:func -EnXc_SetupKneelInNocturne = 0x80B1C5C8; // type:func -func_80B40BB4 = 0x80B1C664; // type:func -func_80B40C50 = 0x80B1C700; // type:func -func_80B40C74 = 0x80B1C724; // type:func -func_80B40C98 = 0x80B1C748; // type:func -func_80B40CBC = 0x80B1C76C; // type:func -func_80B40CE0 = 0x80B1C790; // type:func -func_80B40D08 = 0x80B1C7B8; // type:func -func_80B40D2C = 0x80B1C7DC; // type:func -func_80B40D50 = 0x80B1C800; // type:func -func_80B40D74 = 0x80B1C824; // type:func -EnXc_SetupReverseHaltInNocturneCS = 0x80B1C848; // type:func -func_80B40E40 = 0x80B1C8F4; // type:func -func_80B40E64 = 0x80B1C918; // type:func -func_80B40E88 = 0x80B1C93C; // type:func -EnXc_SetupNocturneState = 0x80B1C960; // type:func -EnXc_InitialNocturneAction = 0x80B1CAA0; // type:func -EnXc_IdleInNocturne = 0x80B1CAC0; // type:func -EnXc_DefenseStance = 0x80B1CB10; // type:func -EnXc_Contort = 0x80B1CB58; // type:func -EnXc_FallInNocturne = 0x80B1CBC4; // type:func -EnXc_HitGroundInNocturne = 0x80B1CC2C; // type:func -EnXc_ActionFunc63 = 0x80B1CC6C; // type:func -EnXc_KneelInNocturneCS = 0x80B1CCC8; // type:func -EnXc_ActionFunc65 = 0x80B1CD10; // type:func -EnXc_ActionFunc66 = 0x80B1CD54; // type:func -EnXc_ActionFunc67 = 0x80B1CD80; // type:func -EnXc_ActionFunc68 = 0x80B1CDAC; // type:func -EnXc_ActionFunc69 = 0x80B1CDD8; // type:func -EnXc_ActionFunc70 = 0x80B1CE04; // type:func -EnXc_ActionFunc71 = 0x80B1CE30; // type:func -EnXc_ActionFunc72 = 0x80B1CE5C; // type:func -EnXc_ReverseAccelInNocturneCS = 0x80B1CE88; // type:func -EnXc_ReverseWalkInNocturneCS = 0x80B1CEB4; // type:func -EnXc_ReverseHaltInNocturneCS = 0x80B1CF08; // type:func -EnXc_ThrowNutInNocturneCS = 0x80B1CF34; // type:func -EnXc_DeleteInNocturneCS = 0x80B1CF60; // type:func -EnXc_KillInNocturneCS = 0x80B1CF8C; // type:func -EnXc_DrawSquintingEyes = 0x80B1CFB0; // type:func -EnXc_InitTempleOfTime = 0x80B1D08C; // type:func -EnXc_SetupDialogueAction = 0x80B1D1F8; // type:func -func_80B41798 = 0x80B1D280; // type:func -EnXc_BlockingPedestalAction = 0x80B1D2CC; // type:func -EnXc_ActionFunc80 = 0x80B1D334; // type:func -EnXc_Update = 0x80B1D39C; // type:func -EnXc_Init = 0x80B1D3E4; // type:func -EnXc_OverrideLimbDraw = 0x80B1D550; // type:func -EnXc_PostLimbDraw = 0x80B1D5D8; // type:func -EnXc_DrawNothing = 0x80B1D664; // type:func -EnXc_DrawDefault = 0x80B1D674; // type:func -EnXc_Draw = 0x80B1D77C; // type:func -EnYabusameMark_Destroy = 0x80B1E4D0; // type:func -EnYabusameMark_Init = 0x80B1E4FC; // type:func -func_80B42F74 = 0x80B1E63C; // type:func -EnYabusameMark_Update = 0x80B1E880; // type:func -EnYukabyun_Init = 0x80B1EBA0; // type:func -EnYukabyun_Destroy = 0x80B1EC50; // type:func -func_80B43A94 = 0x80B1EC7C; // type:func -func_80B43AD4 = 0x80B1ECBC; // type:func -func_80B43B6C = 0x80B1ED54; // type:func -EnYukabyun_Break = 0x80B1EDB4; // type:func -EnYukabyun_Update = 0x80B1EE28; // type:func -EnYukabyun_Draw = 0x80B1EFC8; // type:func -EnZf_SetupAction = 0x80B1F1B0; // type:func -EnZf_PrimaryFloorCheck = 0x80B1F1BC; // type:func -EnZf_SecondaryFloorCheck = 0x80B1F32C; // type:func -EnZf_Init = 0x80B1F45C; // type:func -EnZf_Destroy = 0x80B1F794; // type:func -EnZf_FindPlatform = 0x80B1F818; // type:func -EnZf_FindNextPlatformAwayFromPlayer = 0x80B1F9E0; // type:func -EnZf_FindNextPlatformTowardsPlayer = 0x80B1FC84; // type:func -EnZf_CanAttack = 0x80B1FE60; // type:func -func_80B44DC4 = 0x80B1FF34; // type:func -EnZf_ChooseAction = 0x80B20000; // type:func -EnZf_SetupDropIn = 0x80B20220; // type:func -EnZf_DropIn = 0x80B202E8; // type:func -func_80B45384 = 0x80B204F8; // type:func -func_80B4543C = 0x80B205B0; // type:func -EnZf_SetupApproachPlayer = 0x80B2082C; // type:func -EnZf_ApproachPlayer = 0x80B208C0; // type:func -EnZf_SetupJumpForward = 0x80B20FAC; // type:func -EnZf_JumpForward = 0x80B2106C; // type:func -func_80B4604C = 0x80B211C8; // type:func -func_80B46098 = 0x80B21214; // type:func -func_80B462E4 = 0x80B21460; // type:func -func_80B463E4 = 0x80B21568; // type:func -EnZf_SetupSlash = 0x80B21BAC; // type:func -EnZf_Slash = 0x80B21C68; // type:func -EnZf_SetupRecoilFromBlockedSlash = 0x80B21EF4; // type:func -EnZf_RecoilFromBlockedSlash = 0x80B21F68; // type:func -EnZf_SetupJumpBack = 0x80B22020; // type:func -EnZf_JumpBack = 0x80B220C0; // type:func -EnZf_SetupStunned = 0x80B221E4; // type:func -EnZf_Stunned = 0x80B222B4; // type:func -EnZf_SetupSheatheSword = 0x80B224F4; // type:func -EnZf_SheatheSword = 0x80B225D0; // type:func -EnZf_SetupHopAndTaunt = 0x80B2267C; // type:func -EnZf_HopAndTaunt = 0x80B226DC; // type:func -EnZf_SetupHopAway = 0x80B22934; // type:func -EnZf_HopAway = 0x80B229B4; // type:func -EnZf_SetupDrawSword = 0x80B22E00; // type:func -EnZf_DrawSword = 0x80B22E94; // type:func -EnZf_SetupDamaged = 0x80B22F44; // type:func -EnZf_Damaged = 0x80B23050; // type:func -EnZf_SetupJumpUp = 0x80B233B0; // type:func -EnZf_JumpUp = 0x80B23458; // type:func -func_80B483E4 = 0x80B23584; // type:func -EnZf_CircleAroundPlayer = 0x80B23720; // type:func -EnZf_SetupDie = 0x80B23EA0; // type:func -EnZf_Die = 0x80B24004; // type:func -EnZf_UpdateHeadRotation = 0x80B24144; // type:func -EnZf_UpdateDamage = 0x80B24268; // type:func -EnZf_Update = 0x80B24400; // type:func -EnZf_OverrideLimbDraw = 0x80B247B8; // type:func -EnZf_PostLimbDraw = 0x80B24844; // type:func -EnZf_Draw = 0x80B24A98; // type:func -EnZf_SetupCircleAroundPlayer = 0x80B24CE4; // type:func -EnZf_DodgeRangedEngaging = 0x80B24DB0; // type:func -EnZf_DodgeRangedWaiting = 0x80B24FDC; // type:func -func_80B4AB40 = 0x80B25CA0; // type:func -func_80B4AB48 = 0x80B25CA8; // type:func -EnZl1_Init = 0x80B25CB0; // type:func -EnZl1_Destroy = 0x80B25F40; // type:func -func_80B4AE18 = 0x80B25F80; // type:func -func_80B4AF18 = 0x80B26080; // type:func -func_80B4B010 = 0x80B26178; // type:func -func_80B4B240 = 0x80B263B0; // type:func -func_80B4B7F4 = 0x80B26964; // type:func -func_80B4B834 = 0x80B269A8; // type:func -func_80B4B874 = 0x80B269EC; // type:func -func_80B4B8B4 = 0x80B26A2C; // type:func -func_80B4BBC4 = 0x80B26D3C; // type:func -func_80B4BC78 = 0x80B26DF0; // type:func -func_80B4BF2C = 0x80B270A4; // type:func -EnZl1_Update = 0x80B27398; // type:func -EnZl1_OverrideLimbDraw = 0x80B274BC; // type:func -EnZl1_PostLimbDraw = 0x80B2757C; // type:func -EnZl1_Draw = 0x80B275D8; // type:func -EnZl2_Destroy = 0x80B29AB0; // type:func -EnZl2_UpdateEyes = 0x80B29AD4; // type:func -func_80B4EA40 = 0x80B29B64; // type:func -func_80B4EAF4 = 0x80B29C18; // type:func -func_80B4EBB8 = 0x80B29CDC; // type:func -func_80B4EC48 = 0x80B29D6C; // type:func -EnZl2_setEyesIndex = 0x80B29E0C; // type:func -EnZl2_setEyeIndex2 = 0x80B29E2C; // type:func -EnZl2_setMouthIndex = 0x80B29E44; // type:func -func_80B4ED2C = 0x80B29E5C; // type:func -EnZl2_UpdateSkelAnime = 0x80B29EA4; // type:func -EnZl2_GetCue = 0x80B29EC8; // type:func -func_80B4EDB8 = 0x80B29EF0; // type:func -func_80B4EE38 = 0x80B29F70; // type:func -func_80B4EF64 = 0x80B2A0A0; // type:func -func_80B4F230 = 0x80B2A370; // type:func -func_80B4F45C = 0x80B2A5A0; // type:func -EnZl2_PostLimbDraw = 0x80B2AC6C; // type:func -func_80B4FCCC = 0x80B2ADB8; // type:func -func_80B4FD00 = 0x80B2ADF0; // type:func -func_80B4FD90 = 0x80B2AE80; // type:func -func_80B4FDD4 = 0x80B2AEC4; // type:func -func_80B4FE10 = 0x80B2AF04; // type:func -func_80B4FE48 = 0x80B2AF3C; // type:func -func_80B4FE6C = 0x80B2AF64; // type:func -func_80B4FE90 = 0x80B2AF8C; // type:func -func_80B4FEB4 = 0x80B2AFB4; // type:func -func_80B4FED8 = 0x80B2AFDC; // type:func -EnZl2_GiveLightArrows = 0x80B2B004; // type:func -func_80B4FF84 = 0x80B2B094; // type:func -func_80B4FFF0 = 0x80B2B100; // type:func -func_80B5008C = 0x80B2B1A0; // type:func -func_80B500E0 = 0x80B2B1F4; // type:func -func_80B501C4 = 0x80B2B2D8; // type:func -func_80B501E8 = 0x80B2B2FC; // type:func -func_80B50260 = 0x80B2B374; // type:func -func_80B50278 = 0x80B2B390; // type:func -func_80B50304 = 0x80B2B41C; // type:func -func_80B503DC = 0x80B2B4F4; // type:func -func_80B5042C = 0x80B2B544; // type:func -func_80B50488 = 0x80B2B5A0; // type:func -func_80B504D4 = 0x80B2B5EC; // type:func -func_80B5053C = 0x80B2B650; // type:func -func_80B50580 = 0x80B2B698; // type:func -func_80B505D4 = 0x80B2B6EC; // type:func -func_80B50618 = 0x80B2B734; // type:func -func_80B50644 = 0x80B2B760; // type:func -func_80B50670 = 0x80B2B78C; // type:func -func_80B506C4 = 0x80B2B7E0; // type:func -func_80B5073C = 0x80B2B85C; // type:func -func_80B50780 = 0x80B2B8A4; // type:func -func_80B507E8 = 0x80B2B90C; // type:func -func_80B5082C = 0x80B2B954; // type:func -func_80B50880 = 0x80B2B9A8; // type:func -func_80B508C8 = 0x80B2B9F0; // type:func -func_80B50928 = 0x80B2BA4C; // type:func -func_80B50970 = 0x80B2BA94; // type:func -func_80B50980 = 0x80B2BAA8; // type:func -func_80B509A0 = 0x80B2BACC; // type:func -func_80B50A04 = 0x80B2BB30; // type:func -func_80B50BBC = 0x80B2BCD4; // type:func -func_80B50BEC = 0x80B2BD0C; // type:func -func_80B50C40 = 0x80B2BD68; // type:func -func_80B50CA8 = 0x80B2BDD8; // type:func -func_80B50CFC = 0x80B2BE34; // type:func -func_80B50D50 = 0x80B2BE90; // type:func -func_80B50D94 = 0x80B2BEDC; // type:func -func_80B50DE8 = 0x80B2BF38; // type:func -func_80B50E3C = 0x80B2BF94; // type:func -func_80B50E90 = 0x80B2BFF0; // type:func -func_80B50EE4 = 0x80B2C04C; // type:func -func_80B50F38 = 0x80B2C0A8; // type:func -func_80B50F8C = 0x80B2C104; // type:func -func_80B50FE8 = 0x80B2C168; // type:func -func_80B51034 = 0x80B2C1BC; // type:func -func_80B51080 = 0x80B2C210; // type:func -func_80B510CC = 0x80B2C264; // type:func -func_80B51118 = 0x80B2C2B8; // type:func -func_80B51164 = 0x80B2C30C; // type:func -func_80B511B0 = 0x80B2C360; // type:func -func_80B511FC = 0x80B2C3B4; // type:func -func_80B51250 = 0x80B2C410; // type:func -func_80B512B8 = 0x80B2C480; // type:func -func_80B51310 = 0x80B2C4E0; // type:func -func_80B5135C = 0x80B2C530; // type:func -func_80B513A8 = 0x80B2C57C; // type:func -func_80B51418 = 0x80B2C5F0; // type:func -func_80B5146C = 0x80B2C644; // type:func -func_80B5149C = 0x80B2C678; // type:func -func_80B514F8 = 0x80B2C6D8; // type:func -func_80B5154C = 0x80B2C72C; // type:func -func_80B515C4 = 0x80B2C7A4; // type:func -func_80B515D8 = 0x80B2C7BC; // type:func -func_80B51644 = 0x80B2C828; // type:func -func_80B51678 = 0x80B2C85C; // type:func -func_80B516D0 = 0x80B2C8B4; // type:func -func_80B51704 = 0x80B2C8E8; // type:func -func_80B5175C = 0x80B2C940; // type:func -func_80B51790 = 0x80B2C974; // type:func -func_80B517E0 = 0x80B2C9C4; // type:func -func_80B51824 = 0x80B2CA0C; // type:func -func_80B5187C = 0x80B2CA64; // type:func -func_80B518C0 = 0x80B2CAAC; // type:func -func_80B51948 = 0x80B2CB34; // type:func -func_80B51A5C = 0x80B2CC34; // type:func -func_80B51A8C = 0x80B2CC6C; // type:func -func_80B51AE4 = 0x80B2CCCC; // type:func -func_80B51B44 = 0x80B2CD34; // type:func -func_80B51BA8 = 0x80B2CDA0; // type:func -func_80B51C0C = 0x80B2CE0C; // type:func -func_80B51C64 = 0x80B2CE6C; // type:func -func_80B51CA8 = 0x80B2CEB8; // type:func -func_80B51D0C = 0x80B2CF24; // type:func -func_80B51D24 = 0x80B2CF40; // type:func -func_80B51DA4 = 0x80B2CFC0; // type:func -func_80B51EA8 = 0x80B2D0C4; // type:func -func_80B51EBC = 0x80B2D0DC; // type:func -func_80B51F38 = 0x80B2D15C; // type:func -func_80B51FA8 = 0x80B2D1CC; // type:func -func_80B52068 = 0x80B2D278; // type:func -func_80B52098 = 0x80B2D2B0; // type:func -func_80B52108 = 0x80B2D328; // type:func -func_80B52114 = 0x80B2D338; // type:func -func_80B521A0 = 0x80B2D398; // type:func -EnZl2_Update = 0x80B2D424; // type:func -EnZl2_Init = 0x80B2D46C; // type:func -EnZl2_OverrideLimbDraw = 0x80B2D518; // type:func -func_80B523BC = 0x80B2D580; // type:func -func_80B523C8 = 0x80B2D590; // type:func -func_80B525D4 = 0x80B2D76C; // type:func -EnZl2_Draw = 0x80B2D914; // type:func -func_80B533B0 = 0x80B2E1B0; // type:func -func_80B533FC = 0x80B2E1FC; // type:func -EnZl3_Destroy = 0x80B2E240; // type:func -func_80B53468 = 0x80B2E26C; // type:func -func_80B53488 = 0x80B2E28C; // type:func -EnZl3_UpdateEyes = 0x80B2E2D8; // type:func -EnZl3_setEyeIndex = 0x80B2E360; // type:func -EnZl3_setMouthIndex = 0x80B2E378; // type:func -func_80B5357C = 0x80B2E390; // type:func -func_80B53614 = 0x80B2E42C; // type:func -func_80B5366C = 0x80B2E484; // type:func -func_80B536B4 = 0x80B2E4CC; // type:func -func_80B536C4 = 0x80B2E4E0; // type:func -func_80B53764 = 0x80B2E584; // type:func -func_80B537E8 = 0x80B2E60C; // type:func -func_80B538B0 = 0x80B2E6D4; // type:func -EnZl3_UpdateSkelAnime = 0x80B2E770; // type:func -func_80B5396C = 0x80B2E794; // type:func -func_80B53974 = 0x80B2E7A0; // type:func -func_80B53980 = 0x80B2E7B4; // type:func -func_80B53B64 = 0x80B2E99C; // type:func -func_80B54360 = 0x80B2F1AC; // type:func -func_80B5458C = 0x80B2F3DC; // type:func -EnZl3_PostLimbDraw = 0x80B2FAD8; // type:func -func_80B54DB4 = 0x80B2FBA4; // type:func -func_80B54DC4 = 0x80B2FBB8; // type:func -func_80B54DD4 = 0x80B2FBCC; // type:func -func_80B54DE0 = 0x80B2FBDC; // type:func -func_80B54E14 = 0x80B2FC14; // type:func -func_80B54EA4 = 0x80B2FCA4; // type:func -func_80B54EF4 = 0x80B2FCF8; // type:func -func_80B54F18 = 0x80B2FD20; // type:func -func_80B54FB4 = 0x80B2FDC0; // type:func -func_80B55054 = 0x80B2FE44; // type:func -func_80B550F0 = 0x80B2FEE4; // type:func -func_80B55144 = 0x80B2FF38; // type:func -func_80B551E0 = 0x80B2FFD8; // type:func -func_80B55220 = 0x80B30018; // type:func -func_80B55268 = 0x80B30060; // type:func -func_80B552A8 = 0x80B300A0; // type:func -func_80B552DC = 0x80B300D4; // type:func -func_80B55334 = 0x80B30130; // type:func -func_80B55368 = 0x80B30164; // type:func -func_80B553B4 = 0x80B301B0; // type:func -func_80B553E8 = 0x80B301E4; // type:func -func_80B55408 = 0x80B30204; // type:func -func_80B55444 = 0x80B30240; // type:func -func_80B55550 = 0x80B30344; // type:func -func_80B555A4 = 0x80B303A0; // type:func -func_80B55604 = 0x80B30408; // type:func -func_80B5566C = 0x80B30478; // type:func -func_80B556CC = 0x80B304E0; // type:func -func_80B5572C = 0x80B30548; // type:func -func_80B55780 = 0x80B305A4; // type:func -func_80B55808 = 0x80B30608; // type:func -func_80B5582C = 0x80B30630; // type:func -func_80B5585C = 0x80B30660; // type:func -func_80B558A8 = 0x80B306AC; // type:func -func_80B559C4 = 0x80B307CC; // type:func -func_80B55A58 = 0x80B3085C; // type:func -func_80B55A84 = 0x80B30888; // type:func -func_80B55AC4 = 0x80B308C8; // type:func -func_80B55B04 = 0x80B30908; // type:func -func_80B55B38 = 0x80B3093C; // type:func -func_80B55B78 = 0x80B3097C; // type:func -func_80B55BAC = 0x80B309B0; // type:func -func_80B55C0C = 0x80B30A14; // type:func -func_80B55C4C = 0x80B30A54; // type:func -func_80B55C70 = 0x80B30A7C; // type:func -func_80B55CCC = 0x80B30AD4; // type:func -func_80B55D00 = 0x80B30B08; // type:func -func_80B55DB0 = 0x80B30BBC; // type:func -func_80B55E08 = 0x80B30C14; // type:func -func_80B55E48 = 0x80B30C54; // type:func -func_80B55E7C = 0x80B30C88; // type:func -func_80B55EBC = 0x80B30CC8; // type:func -func_80B55EF0 = 0x80B30CFC; // type:func -func_80B55F38 = 0x80B30D44; // type:func -func_80B55F6C = 0x80B30D78; // type:func -func_80B5604C = 0x80B30E5C; // type:func -func_80B56090 = 0x80B30EA0; // type:func -func_80B56108 = 0x80B30F1C; // type:func -func_80B56160 = 0x80B30F74; // type:func -func_80B561A0 = 0x80B30FB4; // type:func -func_80B561E0 = 0x80B30FF4; // type:func -func_80B56214 = 0x80B31028; // type:func -func_80B562F4 = 0x80B3110C; // type:func -func_80B5634C = 0x80B31164; // type:func -func_80B5638C = 0x80B311A4; // type:func -func_80B563C0 = 0x80B311D8; // type:func -func_80B56400 = 0x80B31218; // type:func -func_80B56434 = 0x80B3124C; // type:func -func_80B56474 = 0x80B3128C; // type:func -func_80B564A8 = 0x80B312C0; // type:func -func_80B56658 = 0x80B31460; // type:func -func_80B566AC = 0x80B314BC; // type:func -func_80B5670C = 0x80B31524; // type:func -func_80B5676C = 0x80B3158C; // type:func -func_80B567CC = 0x80B315F4; // type:func -func_80B5682C = 0x80B3165C; // type:func -func_80B568B4 = 0x80B316EC; // type:func -func_80B5691C = 0x80B3175C; // type:func -func_80B5697C = 0x80B317C4; // type:func -func_80B569E4 = 0x80B31834; // type:func -func_80B56A68 = 0x80B318C0; // type:func -func_80B56AE0 = 0x80B31940; // type:func -func_80B56B54 = 0x80B319BC; // type:func -func_80B56BA8 = 0x80B31A18; // type:func -func_80B56C24 = 0x80B31A9C; // type:func -func_80B56C84 = 0x80B31B04; // type:func -func_80B56CE4 = 0x80B31B6C; // type:func -func_80B56D44 = 0x80B31BD4; // type:func -func_80B56DA4 = 0x80B31C3C; // type:func -func_80B56DC8 = 0x80B31C60; // type:func -func_80B56DEC = 0x80B31C88; // type:func -func_80B56E38 = 0x80B31CD4; // type:func -func_80B56EB8 = 0x80B31D54; // type:func -func_80B56EE4 = 0x80B31D84; // type:func -func_80B56F10 = 0x80B31DB4; // type:func -func_80B56F8C = 0x80B31E08; // type:func -func_80B56FAC = 0x80B31E28; // type:func -func_80B57034 = 0x80B31EB4; // type:func -func_80B57104 = 0x80B31F88; // type:func -func_80B571A8 = 0x80B32030; // type:func -func_80B571FC = 0x80B32084; // type:func -func_80B57240 = 0x80B320C8; // type:func -func_80B57298 = 0x80B32120; // type:func -func_80B572F0 = 0x80B32178; // type:func -func_80B57324 = 0x80B321B0; // type:func -func_80B57350 = 0x80B321DC; // type:func -func_80B573C8 = 0x80B32254; // type:func -func_80B573FC = 0x80B32288; // type:func -func_80B57458 = 0x80B322E4; // type:func -func_80B57564 = 0x80B323F4; // type:func -func_80B575B0 = 0x80B32448; // type:func -func_80B575D0 = 0x80B32468; // type:func -func_80B575F0 = 0x80B32488; // type:func -func_80B5764C = 0x80B324E4; // type:func -func_80B576C8 = 0x80B32564; // type:func -func_80B57704 = 0x80B325A8; // type:func -func_80B5772C = 0x80B325D4; // type:func -func_80B57754 = 0x80B32600; // type:func -func_80B577BC = 0x80B3266C; // type:func -func_80B57858 = 0x80B3270C; // type:func -func_80B57890 = 0x80B32748; // type:func -func_80B57A74 = 0x80B32930; // type:func -func_80B57AAC = 0x80B32968; // type:func -func_80B57AE0 = 0x80B3299C; // type:func -func_80B57C54 = 0x80B32B14; // type:func -func_80B57C7C = 0x80B32B3C; // type:func -func_80B57C8C = 0x80B32B50; // type:func -func_80B57CB4 = 0x80B32B78; // type:func -func_80B57D60 = 0x80B32C20; // type:func -func_80B57D80 = 0x80B32C44; // type:func -func_80B57EAC = 0x80B32D7C; // type:func -func_80B57EEC = 0x80B32DC4; // type:func -func_80B57F1C = 0x80B32DF8; // type:func -func_80B57F84 = 0x80B32E64; // type:func -func_80B58014 = 0x80B32EFC; // type:func -func_80B58214 = 0x80B33108; // type:func -func_80B58268 = 0x80B33160; // type:func -func_80B582C8 = 0x80B331C0; // type:func -func_80B584B4 = 0x80B333AC; // type:func -func_80B58624 = 0x80B3351C; // type:func -func_80B5884C = 0x80B3374C; // type:func -func_80B58898 = 0x80B33798; // type:func -func_80B588E8 = 0x80B337E8; // type:func -func_80B58938 = 0x80B33838; // type:func -func_80B5899C = 0x80B338A0; // type:func -func_80B58A1C = 0x80B33920; // type:func -func_80B58A50 = 0x80B3395C; // type:func -func_80B58AAC = 0x80B339BC; // type:func -func_80B58C08 = 0x80B33B18; // type:func -func_80B58D50 = 0x80B33C60; // type:func -func_80B58DB0 = 0x80B33CC8; // type:func -func_80B58E10 = 0x80B33D30; // type:func -func_80B58E7C = 0x80B33DA4; // type:func -func_80B58EF4 = 0x80B33E24; // type:func -func_80B58F6C = 0x80B33EA4; // type:func -func_80B58FDC = 0x80B33F1C; // type:func -func_80B5904C = 0x80B33F94; // type:func -func_80B590BC = 0x80B3400C; // type:func -func_80B5912C = 0x80B34084; // type:func -func_80B591BC = 0x80B3411C; // type:func -func_80B5922C = 0x80B34194; // type:func -func_80B592A8 = 0x80B34218; // type:func -func_80B59340 = 0x80B342B8; // type:func -func_80B593D0 = 0x80B34350; // type:func -func_80B5944C = 0x80B343D4; // type:func -func_80B59698 = 0x80B345D0; // type:func -func_80B59768 = 0x80B346A0; // type:func -func_80B59828 = 0x80B34760; // type:func -func_80B59A80 = 0x80B349C0; // type:func -func_80B59AD0 = 0x80B34A10; // type:func -func_80B59B6C = 0x80B34AAC; // type:func -func_80B59DB8 = 0x80B34CF4; // type:func -EnZl3_Update = 0x80B34D64; // type:func -EnZl3_Init = 0x80B34DAC; // type:func -EnZl3_OverrideLimbDraw = 0x80B34E6C; // type:func -func_80B59FE8 = 0x80B34ED4; // type:func -func_80B59FF4 = 0x80B34EE4; // type:func -func_80B5A1D0 = 0x80B35090; // type:func -EnZl3_Draw = 0x80B35238; // type:func -EnZl4_SetActiveCamDir = 0x80B36000; // type:func -EnZl4_SetActiveCamMove = 0x80B360D8; // type:func -EnZl4_GetTextId = 0x80B3615C; // type:func -EnZl4_UpdateTalkState = 0x80B36200; // type:func -EnZl4_UpdateFace = 0x80B3623C; // type:func -EnZl4_SetMove = 0x80B3638C; // type:func -func_80B5BB78 = 0x80B363CC; // type:func -EnZl4_GetCueStartPos = 0x80B36418; // type:func -EnZl4_SetupFromLegendCs = 0x80B3645C; // type:func -EnZl4_InMovingAnim = 0x80B36534; // type:func -EnZl4_Init = 0x80B36604; // type:func -EnZl4_Destroy = 0x80B367C0; // type:func -EnZl4_SetNextAnim = 0x80B367EC; // type:func -EnZl4_ReverseAnimation = 0x80B36840; // type:func -EnZl4_CsWaitForPlayer = 0x80B36868; // type:func -EnZl4_CsMeetPlayer = 0x80B369C8; // type:func -EnZl4_CsAskStone = 0x80B36CC0; // type:func -EnZl4_CsAskName = 0x80B371EC; // type:func -EnZl4_CsTellLegend = 0x80B377D8; // type:func -EnZl4_CsLookWindow = 0x80B37C34; // type:func -EnZl4_CsWarnAboutGanon = 0x80B37E78; // type:func -EnZl4_CsMakePlan = 0x80B38340; // type:func -EnZl4_Cutscene = 0x80B38684; // type:func -EnZl4_Idle = 0x80B388FC; // type:func -EnZl4_TheEnd = 0x80B38974; // type:func -EnZl4_Update = 0x80B38B24; // type:func -EnZl4_OverrideLimbDraw = 0x80B38BD4; // type:func -EnZl4_PostLimbDraw = 0x80B38D64; // type:func -EnZl4_Draw = 0x80B38DC0; // type:func -EnZo_SpawnRipple = 0x80B3AA30; // type:func -EnZo_SpawnBubble = 0x80B3AAC4; // type:func -EnZo_SpawnSplash = 0x80B3ABF4; // type:func -EnZo_UpdateEffectsRipples = 0x80B3AD60; // type:func -EnZo_UpdateEffectsBubbles = 0x80B3AE1C; // type:func -EnZo_UpdateEffectsSplashes = 0x80B3AF4C; // type:func -EnZo_DrawEffectsRipples = 0x80B3B084; // type:func -EnZo_DrawEffectsBubbles = 0x80B3B234; // type:func -EnZo_DrawEffectsSplashes = 0x80B3B3E0; // type:func -EnZo_TreadWaterRipples = 0x80B3B598; // type:func -EnZo_SpawnSplashes = 0x80B3B614; // type:func -EnZo_GetTextId = 0x80B3B788; // type:func -EnZo_UpdateTalkState = 0x80B3B9FC; // type:func -EnZo_Blink = 0x80B3BB60; // type:func -EnZo_Dialog = 0x80B3BBD8; // type:func -EnZo_PlayerInProximity = 0x80B3BCB8; // type:func -EnZo_SetAnimation = 0x80B3BD58; // type:func -EnZo_Init = 0x80B3BE50; // type:func -EnZo_Destroy = 0x80B3C058; // type:func -EnZo_Standing = 0x80B3C068; // type:func -EnZo_Submerged = 0x80B3C14C; // type:func -EnZo_Surface = 0x80B3C18C; // type:func -EnZo_TreadWater = 0x80B3C270; // type:func -EnZo_Dive = 0x80B3C420; // type:func -EnZo_Update = 0x80B3C568; // type:func -EnZo_OverrideLimbDraw = 0x80B3C748; // type:func -EnZo_PostLimbDraw = 0x80B3C968; // type:func -EnZo_Draw = 0x80B3C9C4; // type:func -EnfHG_Init = 0x80B3CFF0; // type:func -EnfHG_Destroy = 0x80B3D0F0; // type:func -EnfHG_SetupIntro = 0x80B3D11C; // type:func -EnfHG_Intro = 0x80B3D180; // type:func -EnfHG_SetupApproach = 0x80B3E38C; // type:func -EnfHG_Approach = 0x80B3E5D8; // type:func -EnfHG_Attack = 0x80B3E77C; // type:func -EnfHG_Damage = 0x80B3EC00; // type:func -EnfHG_Retreat = 0x80B3EF30; // type:func -EnfHG_Done = 0x80B3F164; // type:func -EnfHG_Update = 0x80B3F174; // type:func -EnfHG_PostDraw = 0x80B3F308; // type:func -EnfHG_Draw = 0x80B3F31C; // type:func -EndTitle_Init = 0x80B3F920; // type:func -EndTitle_Destroy = 0x80B3F950; // type:func -EndTitle_Update = 0x80B3F960; // type:func -EndTitle_DrawFull = 0x80B3F970; // type:func -EndTitle_DrawNintendoLogo = 0x80B3FF3C; // type:func -Fishing_SetColliderElement = 0x80B43A40; // type:func -Fishing_SeedRand = 0x80B43AF0; // type:func -Fishing_RandZeroOne = 0x80B43B10; // type:func -Fishing_SmoothStepToS = 0x80B43C38; // type:func -Fishing_SpawnRipple = 0x80B43CE4; // type:func -Fishing_SpawnDustSplash = 0x80B43E3C; // type:func -Fishing_SpawnWaterDust = 0x80B43F84; // type:func -Fishing_SpawnBubble = 0x80B440BC; // type:func -Fishing_SpawnRainDrop = 0x80B441EC; // type:func -Fishing_InitPondProps = 0x80B442E4; // type:func -Fishing_Init = 0x80B445F8; // type:func -Fishing_Destroy = 0x80B44EC0; // type:func -Fishing_UpdateEffects = 0x80B44F38; // type:func -Fishing_DrawEffects = 0x80B4567C; // type:func -Fishing_DrawStreamSplash = 0x80B460A8; // type:func -Fishing_IsAboveCounter = 0x80B4622C; // type:func -Fishing_UpdateLine = 0x80B46320; // type:func -Fishing_UpdateLinePos = 0x80B468AC; // type:func -Fishing_DrawLureHook = 0x80B46A44; // type:func -Fishing_UpdateSinkingLure = 0x80B46F44; // type:func -Fishing_DrawSinkingLure = 0x80B47248; // type:func -Fishing_DrawLureAndLine = 0x80B47534; // type:func -Fishing_DrawRod = 0x80B47D84; // type:func -Fishing_UpdateLure = 0x80B4880C; // type:func -Fishing_SplashBySize = 0x80B4A7D8; // type:func -Fishing_SplashBySize2 = 0x80B4AAA0; // type:func -func_80B70ED4 = 0x80B4AC84; // type:func -Fishing_FishLeapSfx = 0x80B4B028; // type:func -Fishing_HandleAquariumDialog = 0x80B4B1E8; // type:func -Fishing_UpdateFish = 0x80B4B3A8; // type:func -Fishing_FishOverrideLimbDraw = 0x80B4F7F0; // type:func -Fishing_FishPostLimbDraw = 0x80B4F910; // type:func -Fishing_LoachOverrideLimbDraw = 0x80B4F950; // type:func -Fishing_LoachPostLimbDraw = 0x80B4F9D0; // type:func -Fishing_DrawFish = 0x80B4FA10; // type:func -Fishing_HandleReedContact = 0x80B4FC58; // type:func -Fishing_HandleLilyPadContact = 0x80B4FD04; // type:func -Fishing_UpdatePondProps = 0x80B4FDEC; // type:func -Fishing_DrawPondProps = 0x80B500A8; // type:func -Fishing_UpdateGroupFishes = 0x80B504CC; // type:func -Fishing_DrawGroupFishes = 0x80B50D9C; // type:func -Fishing_HandleOwnerDialog = 0x80B50F90; // type:func -Fishing_UpdateOwner = 0x80B51E14; // type:func -Fishing_OwnerOverrideLimbDraw = 0x80B53AF8; // type:func -Fishing_OwnerPostLimbDraw = 0x80B53B30; // type:func -Fishing_DrawOwner = 0x80B53C40; // type:func -ItemBHeart_Init = 0x80B5E5B0; // type:func -ItemBHeart_Destroy = 0x80B5E61C; // type:func -ItemBHeart_Update = 0x80B5E62C; // type:func -func_80B85264 = 0x80B5E6D4; // type:func -ItemBHeart_Draw = 0x80B5E7C0; // type:func -ItemEtcetera_SetupAction = 0x80B5E9C0; // type:func -ItemEtcetera_Init = 0x80B5E9CC; // type:func -ItemEtcetera_Destroy = 0x80B5EB4C; // type:func -ItemEtcetera_WaitForObject = 0x80B5EB5C; // type:func -func_80B85824 = 0x80B5EBB4; // type:func -func_80B858B4 = 0x80B5EC4C; // type:func -ItemEtcetera_SpawnSparkles = 0x80B5ED2C; // type:func -ItemEtcetera_MoveFireArrowDown = 0x80B5EE3C; // type:func -func_80B85B28 = 0x80B5EECC; // type:func -ItemEtcetera_UpdateFireArrow = 0x80B5EF14; // type:func -ItemEtcetera_Update = 0x80B5EF94; // type:func -ItemEtcetera_DrawThroughLens = 0x80B5EFB8; // type:func -ItemEtcetera_Draw = 0x80B5F010; // type:func -ItemInbox_Init = 0x80B5F290; // type:func -ItemInbox_Destroy = 0x80B5F2C4; // type:func -ItemInbox_Wait = 0x80B5F2D4; // type:func -ItemInbox_Update = 0x80B5F31C; // type:func -ItemInbox_Draw = 0x80B5F340; // type:func -ItemOcarina_SetupAction = 0x80B5F3F0; // type:func -ItemOcarina_Init = 0x80B5F3FC; // type:func -ItemOcarina_Destroy = 0x80B5F584; // type:func -ItemOcarina_Fly = 0x80B5F594; // type:func -ItemOcarina_GetThrown = 0x80B5F740; // type:func -func_80B864EC = 0x80B5F798; // type:func -func_80B865E0 = 0x80B5F88C; // type:func -ItemOcarina_DoNothing = 0x80B5F8EC; // type:func -ItemOcarina_StartSoTCutscene = 0x80B5F8FC; // type:func -ItemOcarina_WaitInWater = 0x80B5F970; // type:func -ItemOcarina_Update = 0x80B5FA44; // type:func -ItemOcarina_Draw = 0x80B5FA68; // type:func -ItemShield_SetupAction = 0x80B5FBC0; // type:func -ItemShield_Init = 0x80B5FBCC; // type:func -ItemShield_Destroy = 0x80B5FD34; // type:func -func_80B86AC8 = 0x80B5FD60; // type:func -func_80B86BC8 = 0x80B5FE64; // type:func -func_80B86CA8 = 0x80B5FF4C; // type:func -func_80B86F68 = 0x80B60210; // type:func -ItemShield_Update = 0x80B6031C; // type:func -ItemShield_Draw = 0x80B60340; // type:func -MagicDark_Init = 0x80B605D0; // type:func -MagicDark_Destroy = 0x80B606B4; // type:func -MagicDark_DiamondUpdate = 0x80B606EC; // type:func -MagicDark_DimLighting = 0x80B60934; // type:func -MagicDark_OrbUpdate = 0x80B60A80; // type:func -MagicDark_DiamondDraw = 0x80B60C28; // type:func -MagicDark_OrbDraw = 0x80B60E90; // type:func -MagicFire_Init = 0x80B61E20; // type:func -MagicFire_Destroy = 0x80B61ECC; // type:func -MagicFire_UpdateBeforeCast = 0x80B61EF0; // type:func -MagicFire_Update = 0x80B61F94; // type:func -MagicFire_Draw = 0x80B62328; // type:func -MagicWind_SetupAction = 0x80B64120; // type:func -MagicWind_Init = 0x80B6412C; // type:func -MagicWind_Destroy = 0x80B64238; // type:func -MagicWind_UpdateAlpha = 0x80B6426C; // type:func -MagicWind_WaitForTimer = 0x80B6438C; // type:func -MagicWind_Grow = 0x80B64408; // type:func -MagicWind_WaitAtFullSize = 0x80B64458; // type:func -MagicWind_FadeOut = 0x80B644A4; // type:func -MagicWind_Shrink = 0x80B64508; // type:func -MagicWind_Update = 0x80B64548; // type:func -MagicWind_OverrideLimbDraw = 0x80B6459C; // type:func -MagicWind_Draw = 0x80B64720; // type:func -MirRay_SetupCollider = 0x80B65E20; // type:func -MirRay_MakeShieldLight = 0x80B65EE8; // type:func -MirRay_Init = 0x80B6608C; // type:func -MirRay_Destroy = 0x80B66324; // type:func -MirRay_Update = 0x80B6639C; // type:func -MirRay_SetIntensity = 0x80B66488; // type:func -MirRay_SetupReflectionPolys = 0x80B6663C; // type:func -MirRay_RemoveSimilarReflections = 0x80B66818; // type:func -MirRay_ReflectedBeam = 0x80B6691C; // type:func -MirRay_Draw = 0x80B66E8C; // type:func -MirRay_CheckInFrustum = 0x80B67168; // type:func -ObjBean_InitCollider = 0x80B676D0; // type:func -ObjBean_InitDynaPoly = 0x80B67728; // type:func -ObjBean_FindFloor = 0x80B67780; // type:func -func_80B8EBC8 = 0x80B677E8; // type:func -ObjBean_UpdatePosition = 0x80B67808; // type:func -func_80B8EDF4 = 0x80B67A18; // type:func -func_80B8EE24 = 0x80B67A48; // type:func -ObjBean_Move = 0x80B67B20; // type:func -ObjBean_SetDrawMode = 0x80B67B50; // type:func -ObjBean_SetupPathCount = 0x80B67B74; // type:func -ObjBean_SetupPath = 0x80B67BB4; // type:func -ObjBean_FollowPath = 0x80B67C30; // type:func -ObjBean_CheckForHorseTrample = 0x80B67ED8; // type:func -ObjBean_Break = 0x80B67F68; // type:func -ObjBean_UpdateLeaves = 0x80B681E0; // type:func -ObjBean_SetupLeavesStill = 0x80B6829C; // type:func -ObjBean_LeavesStill = 0x80B6830C; // type:func -ObjBean_SetupShakeLeaves = 0x80B68350; // type:func -ObjBean_ShakeLeaves = 0x80B683C8; // type:func -ObjBean_SetupShakeLeavesFast = 0x80B6844C; // type:func -ObjBean_ShakeLeavesFast = 0x80B68490; // type:func -ObjBean_SetupGrow = 0x80B68518; // type:func -ObjBean_Grow = 0x80B6852C; // type:func -ObjBean_SetupFlattenLeaves = 0x80B68590; // type:func -ObjBean_FlattenLeaves = 0x80B685AC; // type:func -ObjBean_SetupGrown = 0x80B68628; // type:func -ObjBean_Grown = 0x80B6866C; // type:func -ObjBean_Init = 0x80B686C8; // type:func -ObjBean_Destroy = 0x80B68884; // type:func -ObjBean_SetupWaitForBean = 0x80B68900; // type:func -ObjBean_WaitForBean = 0x80B68938; // type:func -func_80B8FE00 = 0x80B689B4; // type:func -func_80B8FE3C = 0x80B689EC; // type:func -func_80B8FE6C = 0x80B68A1C; // type:func -func_80B8FEAC = 0x80B68A5C; // type:func -func_80B8FF50 = 0x80B68B00; // type:func -func_80B8FF8C = 0x80B68B38; // type:func -func_80B90010 = 0x80B68BBC; // type:func -func_80B90050 = 0x80B68BF8; // type:func -ObjBean_SetupWaitForWater = 0x80B68CB8; // type:func -ObjBean_WaitForWater = 0x80B68D00; // type:func -ObjBean_SetupGrowWaterPhase1 = 0x80B68DF8; // type:func -ObjBean_GrowWaterPhase1 = 0x80B68E38; // type:func -ObjBean_SetupGrowWaterPhase2 = 0x80B68E7C; // type:func -ObjBean_GrowWaterPhase2 = 0x80B68EB8; // type:func -ObjBean_SetupGrowWaterPhase3 = 0x80B68F68; // type:func -ObjBean_GrowWaterPhase3 = 0x80B68FA0; // type:func -ObjBean_SetupGrowWaterPhase4 = 0x80B690B4; // type:func -ObjBean_GrowWaterPhase4 = 0x80B690EC; // type:func -ObjBean_SetupGrowWaterPhase5 = 0x80B69188; // type:func -ObjBean_GrowWaterPhase5 = 0x80B691C0; // type:func -ObjBean_SetupWaitForPlayer = 0x80B69218; // type:func -ObjBean_WaitForPlayer = 0x80B69244; // type:func -ObjBean_SetupFly = 0x80B692B8; // type:func -ObjBean_Fly = 0x80B692FC; // type:func -ObjBean_SetupWaitForStepOff = 0x80B6942C; // type:func -ObjBean_WaitForStepOff = 0x80B69458; // type:func -func_80B908EC = 0x80B69498; // type:func -func_80B90918 = 0x80B694C4; // type:func -func_80B90970 = 0x80B69520; // type:func -func_80B909B0 = 0x80B69560; // type:func -func_80B909F8 = 0x80B695A8; // type:func -func_80B90A34 = 0x80B695E0; // type:func -ObjBean_Update = 0x80B69680; // type:func -ObjBean_DrawSoftSoilSpot = 0x80B69810; // type:func -ObjBean_DrawBeanstalk = 0x80B69898; // type:func -ObjBean_Draw = 0x80B69924; // type:func -ObjBlockstop_Init = 0x80B69E60; // type:func -ObjBlockstop_Destroy = 0x80B69EBC; // type:func -ObjBlockstop_Update = 0x80B69ECC; // type:func -ObjBombiwa_InitCollision = 0x80B6A000; // type:func -ObjBombiwa_Init = 0x80B6A058; // type:func -ObjBombiwa_Destroy = 0x80B6A124; // type:func -ObjBombiwa_Break = 0x80B6A150; // type:func -ObjBombiwa_Update = 0x80B6A350; // type:func -ObjBombiwa_Draw = 0x80B6A460; // type:func -ObjComb_Break = 0x80B6A570; // type:func -ObjComb_ChooseItemDrop = 0x80B6A860; // type:func -ObjComb_Init = 0x80B6A930; // type:func -ObjComb_Destroy = 0x80B6A9A0; // type:func -ObjComb_SetupWait = 0x80B6A9CC; // type:func -ObjComb_Wait = 0x80B6A9E0; // type:func -ObjComb_Update = 0x80B6AACC; // type:func -ObjComb_Draw = 0x80B6AB44; // type:func -ObjDekujr_Init = 0x80B6ADD0; // type:func -ObjDekujr_Destroy = 0x80B6AEDC; // type:func -ObjDekujr_GetCueStartPos = 0x80B6AEEC; // type:func -ObjDekujr_GetCueEndPos = 0x80B6AF30; // type:func -ObjDekujr_ComeUp = 0x80B6AF74; // type:func -ObjDekujr_Update = 0x80B6B124; // type:func -ObjDekujr_Draw = 0x80B6B214; // type:func -ObjElevator_SetupAction = 0x80B6B410; // type:func -func_80B92B08 = 0x80B6B41C; // type:func -ObjElevator_Init = 0x80B6B474; // type:func -ObjElevator_Destroy = 0x80B6B504; // type:func -func_80B92C5C = 0x80B6B538; // type:func -func_80B92C80 = 0x80B6B55C; // type:func -func_80B92D20 = 0x80B6B5FC; // type:func -func_80B92D44 = 0x80B6B620; // type:func -ObjElevator_Update = 0x80B6B6A4; // type:func -ObjElevator_Draw = 0x80B6B6D8; // type:func -ObjHamishi_InitCollision = 0x80B6B7D0; // type:func -ObjHamishi_Shake = 0x80B6B828; // type:func -ObjHamishi_Break = 0x80B6B9A4; // type:func -ObjHamishi_Init = 0x80B6BC50; // type:func -ObjHamishi_Destroy = 0x80B6BD38; // type:func -ObjHamishi_Update = 0x80B6BD64; // type:func -ObjHamishi_Draw = 0x80B6BE94; // type:func -ObjHana_Init = 0x80B6C020; // type:func -ObjHana_Destroy = 0x80B6C11C; // type:func -ObjHana_Update = 0x80B6C168; // type:func -ObjHana_Draw = 0x80B6C1D8; // type:func -ObjHsblock_SetupAction = 0x80B6C330; // type:func -func_80B93B68 = 0x80B6C33C; // type:func -func_80B93BF0 = 0x80B6C394; // type:func -ObjHsblock_Init = 0x80B6C418; // type:func -ObjHsblock_Destroy = 0x80B6C4E8; // type:func -func_80B93D90 = 0x80B6C51C; // type:func -func_80B93DB0 = 0x80B6C53C; // type:func -func_80B93DF4 = 0x80B6C580; // type:func -func_80B93E38 = 0x80B6C5C8; // type:func -func_80B93E5C = 0x80B6C5EC; // type:func -ObjHsblock_Update = 0x80B6C694; // type:func -ObjHsblock_Draw = 0x80B6C6E0; // type:func -ObjIcePoly_Init = 0x80B6C900; // type:func -ObjIcePoly_Destroy = 0x80B6CAC0; // type:func -ObjIcePoly_Idle = 0x80B6CB10; // type:func -ObjIcePoly_Melt = 0x80B6CD40; // type:func -ObjIcePoly_Update = 0x80B6CFF8; // type:func -ObjIcePoly_Draw = 0x80B6D01C; // type:func -ObjKibako_SpawnCollectible = 0x80B6D2B0; // type:func -ObjKibako_ApplyGravity = 0x80B6D310; // type:func -ObjKibako_InitCollider = 0x80B6D344; // type:func -ObjKibako_Init = 0x80B6D39C; // type:func -ObjKibako_Destroy = 0x80B6D414; // type:func -ObjKibako_AirBreak = 0x80B6D440; // type:func -ObjKibako_WaterBreak = 0x80B6D6C0; // type:func -ObjKibako_SetupIdle = 0x80B6D940; // type:func -ObjKibako_Idle = 0x80B6D95C; // type:func -ObjKibako_SetupHeld = 0x80B6DB58; // type:func -ObjKibako_Held = 0x80B6DB8C; // type:func -ObjKibako_SetupThrown = 0x80B6DC58; // type:func -ObjKibako_Thrown = 0x80B6DCB8; // type:func -ObjKibako_Update = 0x80B6DDF4; // type:func -ObjKibako_Draw = 0x80B6DE18; // type:func -ObjKibako2_InitCollider = 0x80B6DFB0; // type:func -ObjKibako2_Break = 0x80B6E008; // type:func -ObjKibako2_SpawnCollectible = 0x80B6E284; // type:func -ObjKibako2_Init = 0x80B6E2D4; // type:func -ObjKibako2_Destroy = 0x80B6E380; // type:func -ObjKibako2_Idle = 0x80B6E3C8; // type:func -ObjKibako2_Kill = 0x80B6E4A0; // type:func -ObjKibako2_Update = 0x80B6E524; // type:func -ObjKibako2_Draw = 0x80B6E548; // type:func -ObjLift_SetupAction = 0x80B6E670; // type:func -ObjLift_InitDynaPoly = 0x80B6E67C; // type:func -ObjLift_SpawnFragments = 0x80B6E6D4; // type:func -ObjLift_Init = 0x80B6E958; // type:func -ObjLift_Destroy = 0x80B6EA58; // type:func -ObjLift_SetupWait = 0x80B6EA8C; // type:func -ObjLift_Wait = 0x80B6EAD0; // type:func -ObjLift_SetupShake = 0x80B6EBC0; // type:func -ObjLift_Shake = 0x80B6EBEC; // type:func -ObjLift_SetupFall = 0x80B6ED34; // type:func -ObjLift_Fall = 0x80B6EDB8; // type:func -ObjLift_Update = 0x80B6EEBC; // type:func -ObjLift_Draw = 0x80B6EEF0; // type:func -ObjLightswitch_InitCollider = 0x80B6F090; // type:func -ObjLightswitch_SetSwitchFlag = 0x80B6F12C; // type:func -ObjLightswitch_ClearSwitchFlag = 0x80B6F1F0; // type:func -ObjLightswitch_SpawnDisappearEffects = 0x80B6F270; // type:func -ObjLightswitch_Init = 0x80B6F498; // type:func -ObjLightswitch_Destroy = 0x80B6F62C; // type:func -ObjLightswitch_SetupOff = 0x80B6F658; // type:func -ObjLightswitch_Off = 0x80B6F68C; // type:func -ObjLightswitch_SetupTurnOn = 0x80B6F76C; // type:func -ObjLightswitch_TurnOn = 0x80B6F790; // type:func -ObjLightswitch_SetupOn = 0x80B6F884; // type:func -ObjLightswitch_On = 0x80B6F8C0; // type:func -ObjLightswitch_SetupTurnOff = 0x80B6F9D4; // type:func -ObjLightswitch_TurnOff = 0x80B6FA00; // type:func -ObjLightswitch_SetupDisappearDelay = 0x80B6FAF0; // type:func -ObjLightswitch_DisappearDelay = 0x80B6FB0C; // type:func -ObjLightswitch_SetupDisappear = 0x80B6FB54; // type:func -ObjLightswitch_Disappear = 0x80B6FB70; // type:func -ObjLightswitch_Update = 0x80B6FBB4; // type:func -ObjLightswitch_DrawOpa = 0x80B6FC98; // type:func -ObjLightswitch_DrawXlu = 0x80B6FFC0; // type:func -ObjLightswitch_Draw = 0x80B70270; // type:func -ObjMakekinsuta_Init = 0x80B704C0; // type:func -func_80B98320 = 0x80B704D8; // type:func -ObjMakekinsuta_DoNothing = 0x80B7058C; // type:func -ObjMakekinsuta_Update = 0x80B7059C; // type:func -ObjMakeoshihiki_Init = 0x80B70610; // type:func -ObjMakeoshihiki_Draw = 0x80B70784; // type:func -ObjMure_SetCullingImpl = 0x80B70AA0; // type:func -ObjMure_SetCulling = 0x80B70AF8; // type:func -ObjMure_Init = 0x80B70B24; // type:func -ObjMure_Destroy = 0x80B70BD4; // type:func -ObjMure_GetMaxChildSpawns = 0x80B70BE4; // type:func -ObjMure_GetSpawnPos = 0x80B70C10; // type:func -ObjMure_SpawnActors0 = 0x80B70C38; // type:func -ObjMure_SpawnActors1 = 0x80B70E00; // type:func -ObjMure_SpawnActors = 0x80B70F4C; // type:func -ObjMure_KillActorsImpl = 0x80B70F9C; // type:func -ObjMure_KillActors = 0x80B71094; // type:func -ObjMure_CheckChildren = 0x80B710B4; // type:func -ObjMure_InitialAction = 0x80B71178; // type:func -ObjMure_CulledState = 0x80B71190; // type:func -ObjMure_SetFollowTargets = 0x80B711F0; // type:func -ObjMure_SetChildToFollowPlayer = 0x80B712C8; // type:func -ObjMure_GroupBehavior0 = 0x80B71448; // type:func -ObjMure_GroupBehavior1 = 0x80B71670; // type:func -ObjMure_ActiveState = 0x80B717F4; // type:func -ObjMure_Update = 0x80B7189C; // type:func -ObjMure2_SetPosShrubCircle = 0x80B71AB0; // type:func -ObjMure2_SetPosShrubScattered = 0x80B71BCC; // type:func -ObjMure2_SetPosRockCircle = 0x80B71CCC; // type:func -ObjMure2_SetActorSpawnParams = 0x80B71DD8; // type:func -ObjMure2_SpawnActors = 0x80B71E2C; // type:func -ObjMure2_CleanupAndDie = 0x80B71F88; // type:func -func_80B9A534 = 0x80B72088; // type:func -ObjMure2_Init = 0x80B7211C; // type:func -ObjMure2_SetupWait = 0x80B7217C; // type:func -ObjMure2_Wait = 0x80B72190; // type:func -func_80B9A658 = 0x80B721B4; // type:func -func_80B9A668 = 0x80B721C8; // type:func -func_80B9A6E8 = 0x80B72248; // type:func -func_80B9A6F8 = 0x80B7225C; // type:func -ObjMure2_Update = 0x80B722EC; // type:func -func_80B9A9D0 = 0x80B724D0; // type:func -func_80B9AA90 = 0x80B72590; // type:func -func_80B9ABA0 = 0x80B726A0; // type:func -func_80B9ACE4 = 0x80B727E4; // type:func -func_80B9ADCC = 0x80B728D0; // type:func -ObjMure3_Init = 0x80B729C4; // type:func -ObjMure3_Destroy = 0x80B72A24; // type:func -func_80B9AF24 = 0x80B72A34; // type:func -func_80B9AF34 = 0x80B72A48; // type:func -func_80B9AF54 = 0x80B72A6C; // type:func -func_80B9AF64 = 0x80B72A80; // type:func -func_80B9AFEC = 0x80B72B08; // type:func -func_80B9AFFC = 0x80B72B1C; // type:func -ObjMure3_Update = 0x80B72B98; // type:func -ObjOshihiki_InitDynapoly = 0x80B72CA0; // type:func -ObjOshihiki_RotateXZ = 0x80B72CF8; // type:func -ObjOshihiki_StrongEnough = 0x80B72D4C; // type:func -ObjOshihiki_ResetFloors = 0x80B72DD0; // type:func -ObjOshihiki_GetBlockUnder = 0x80B72DFC; // type:func -ObjOshihiki_UpdateInitPos = 0x80B72E8C; // type:func -ObjOshihiki_NoSwitchPress = 0x80B72FBC; // type:func -ObjOshihiki_CheckType = 0x80B73088; // type:func -ObjOshihiki_SetScale = 0x80B730D8; // type:func -ObjOshihiki_SetTexture = 0x80B73110; // type:func -ObjOshihiki_SetColor = 0x80B73170; // type:func -ObjOshihiki_Init = 0x80B73218; // type:func -ObjOshihiki_Destroy = 0x80B73340; // type:func -ObjOshihiki_SetFloors = 0x80B73374; // type:func -ObjOshihiki_GetHighestFloor = 0x80B734D4; // type:func -ObjOshihiki_SetGround = 0x80B73620; // type:func -ObjOshihiki_CheckFloor = 0x80B73678; // type:func -ObjOshihiki_CheckGround = 0x80B736D0; // type:func -ObjOshihiki_CheckWall = 0x80B73748; // type:func -ObjOshihiki_MoveWithBlockUnder = 0x80B7399C; // type:func -ObjOshihiki_SetupOnScene = 0x80B73A98; // type:func -ObjOshihiki_OnScene = 0x80B73AD0; // type:func -ObjOshihiki_SetupOnActor = 0x80B73BBC; // type:func -ObjOshihiki_OnActor = 0x80B73BFC; // type:func -ObjOshihiki_SetupPush = 0x80B73DF4; // type:func -ObjOshihiki_Push = 0x80B73E20; // type:func -ObjOshihiki_SetupFall = 0x80B7403C; // type:func -ObjOshihiki_Fall = 0x80B74094; // type:func -ObjOshihiki_Update = 0x80B74198; // type:func -ObjOshihiki_Draw = 0x80B74220; // type:func -ObjRoomtimer_Init = 0x80B74750; // type:func -ObjRoomtimer_Destroy = 0x80B747A4; // type:func -func_80B9D054 = 0x80B747D8; // type:func -func_80B9D0B0 = 0x80B74838; // type:func -ObjRoomtimer_Update = 0x80B74914; // type:func -ObjSwitch_RotateY = 0x80B749A0; // type:func -ObjSwitch_InitDynaPoly = 0x80B74A20; // type:func -ObjSwitch_InitJntSphCollider = 0x80B74A78; // type:func -ObjSwitch_InitTrisCollider = 0x80B74B14; // type:func -ObjSwitch_SpawnIce = 0x80B74C34; // type:func -ObjSwitch_SetOn = 0x80B74CA8; // type:func -ObjSwitch_SetOff = 0x80B74D54; // type:func -ObjSwitch_UpdateTwoTexScrollXY = 0x80B74DDC; // type:func -ObjSwitch_Init = 0x80B74E24; // type:func -ObjSwitch_Destroy = 0x80B750BC; // type:func -ObjSwitch_FloorUpInit = 0x80B75160; // type:func -ObjSwitch_FloorUp = 0x80B75180; // type:func -ObjSwitch_FloorPressInit = 0x80B752F0; // type:func -ObjSwitch_FloorPress = 0x80B7530C; // type:func -ObjSwitch_FloorDownInit = 0x80B753CC; // type:func -ObjSwitch_FloorDown = 0x80B753F4; // type:func -ObjSwitch_FloorReleaseInit = 0x80B75540; // type:func -ObjSwitch_FloorRelease = 0x80B7555C; // type:func -ObjSwitch_EyeIsHit = 0x80B75640; // type:func -ObjSwitch_EyeFrozenInit = 0x80B756B0; // type:func -ObjSwitch_EyeInit = 0x80B756C4; // type:func -ObjSwitch_EyeOpenInit = 0x80B7571C; // type:func -ObjSwitch_EyeOpen = 0x80B75734; // type:func -ObjSwitch_EyeClosingInit = 0x80B757A0; // type:func -ObjSwitch_EyeClosing = 0x80B757BC; // type:func -ObjSwitch_EyeClosedInit = 0x80B75838; // type:func -ObjSwitch_EyeClosed = 0x80B75854; // type:func -ObjSwitch_EyeOpeningInit = 0x80B75914; // type:func -ObjSwitch_EyeOpening = 0x80B75930; // type:func -ObjSwitch_CrystalOffInit = 0x80B759C0; // type:func -ObjSwitch_CrystalOff = 0x80B759EC; // type:func -ObjSwitch_CrystalTurnOnInit = 0x80B75B24; // type:func -ObjSwitch_CrystalTurnOn = 0x80B75B40; // type:func -ObjSwitch_CrystalOnInit = 0x80B75BC8; // type:func -ObjSwitch_CrystalOn = 0x80B75BF8; // type:func -ObjSwitch_CrystalTurnOffInit = 0x80B75CC0; // type:func -ObjSwitch_CrystalTurnOff = 0x80B75CDC; // type:func -ObjSwitch_Update = 0x80B75D64; // type:func -ObjSwitch_DrawFloor = 0x80B75EA0; // type:func -ObjSwitch_DrawFloorRusty = 0x80B75EE4; // type:func -ObjSwitch_DrawEye = 0x80B75F14; // type:func -ObjSwitch_DrawCrystal = 0x80B76028; // type:func -ObjSwitch_Draw = 0x80B76284; // type:func -ObjSyokudai_Init = 0x80B76780; // type:func -ObjSyokudai_Destroy = 0x80B76944; // type:func -ObjSyokudai_Update = 0x80B76998; // type:func -ObjSyokudai_Draw = 0x80B76FB4; // type:func -ObjTimeblock_CalculateIsVisible = 0x80B773D0; // type:func -ObjTimeblock_SpawnDemoEffect = 0x80B77490; // type:func -ObjTimeblock_ToggleSwitchFlag = 0x80B77504; // type:func -ObjTimeblock_Init = 0x80B7754C; // type:func -ObjTimeblock_Destroy = 0x80B77700; // type:func -ObjTimeblock_PlayerIsInRange = 0x80B77734; // type:func -ObjTimeblock_WaitForOcarina = 0x80B77814; // type:func -ObjTimeblock_WaitForSong = 0x80B77894; // type:func -ObjTimeblock_SetupDoNothing = 0x80B7790C; // type:func -ObjTimeblock_DoNothing = 0x80B77920; // type:func -ObjTimeblock_SetupNormal = 0x80B77930; // type:func -ObjTimeblock_Normal = 0x80B77944; // type:func -func_80BA06AC = 0x80B77AC0; // type:func -ObjTimeblock_SetupAltBehaviorVisible = 0x80B77B70; // type:func -ObjTimeblock_AltBehaviorVisible = 0x80B77B84; // type:func -ObjTimeblock_SetupAltBehaviourNotVisible = 0x80B77C50; // type:func -ObjTimeblock_AltBehaviourNotVisible = 0x80B77C64; // type:func -ObjTimeblock_Update = 0x80B77D34; // type:func -ObjTimeblock_Draw = 0x80B77DBC; // type:func -ObjTsubo_SpawnCollectible = 0x80B78020; // type:func -ObjTsubo_ApplyGravity = 0x80B78080; // type:func -ObjTsubo_SnapToFloor = 0x80B780B4; // type:func -ObjTsubo_InitCollider = 0x80B78150; // type:func -ObjTsubo_Init = 0x80B781A8; // type:func -ObjTsubo_Destroy = 0x80B78278; // type:func -ObjTsubo_AirBreak = 0x80B782A4; // type:func -ObjTsubo_WaterBreak = 0x80B7852C; // type:func -ObjTsubo_SetupWaitForObject = 0x80B787C4; // type:func -ObjTsubo_WaitForObject = 0x80B787D8; // type:func -ObjTsubo_SetupIdle = 0x80B7884C; // type:func -ObjTsubo_Idle = 0x80B78860; // type:func -ObjTsubo_SetupLiftedUp = 0x80B78A70; // type:func -ObjTsubo_LiftedUp = 0x80B78AB4; // type:func -ObjTsubo_SetupThrown = 0x80B78B3C; // type:func -ObjTsubo_Thrown = 0x80B78C04; // type:func -ObjTsubo_Update = 0x80B78D98; // type:func -ObjTsubo_Draw = 0x80B78DBC; // type:func -ObjWarp2block_Spawn = 0x80B79010; // type:func -func_80BA1ECC = 0x80B790EC; // type:func -ObjWarp2block_SwapWithChild = 0x80B7926C; // type:func -func_80BA2218 = 0x80B7943C; // type:func -func_80BA228C = 0x80B794BC; // type:func -func_80BA2304 = 0x80B79534; // type:func -ObjWarp2block_Init = 0x80B79578; // type:func -ObjWarp2block_Destroy = 0x80B79698; // type:func -ObjWarp2block_SetInactive = 0x80B796D8; // type:func -ObjWarp2block_DoNothing = 0x80B796F0; // type:func -func_80BA24E8 = 0x80B79700; // type:func -func_80BA24F8 = 0x80B79714; // type:func -func_80BA2600 = 0x80B797F8; // type:func -func_80BA2610 = 0x80B7980C; // type:func -ObjWarp2block_Update = 0x80B798BC; // type:func -ObjWarp2block_Draw = 0x80B798F8; // type:func -ObjectKankyo_SetupAction = 0x80B79B40; // type:func -ObjectKankyo_Init = 0x80B79B4C; // type:func -ObjectKankyo_Destroy = 0x80B79E4C; // type:func -ObjectKankyo_Snow = 0x80B79E70; // type:func -ObjectKankyo_Fairies = 0x80B79E80; // type:func -ObjectKankyo_Update = 0x80B7AC98; // type:func -ObjectKankyo_Draw = 0x80B7ACBC; // type:func -ObjectKankyo_DrawFairies = 0x80B7AD40; // type:func -ObjectKankyo_DrawSnow = 0x80B7B1C8; // type:func -ObjectKankyo_Lightning = 0x80B7B990; // type:func -ObjectKankyo_DrawLightning = 0x80B7BA38; // type:func -ObjectKankyo_SunGraveSparkInit = 0x80B7BC34; // type:func -ObjectKankyo_WaitForSunGraveSparkObject = 0x80B7BC80; // type:func -ObjectKankyo_SunGraveSpark = 0x80B7BCF0; // type:func -ObjectKankyo_DrawSunGraveSpark = 0x80B7BD9C; // type:func -ObjectKankyo_InitBeams = 0x80B7C2E4; // type:func -ObjectKankyo_WaitForBeamObject = 0x80B7C330; // type:func -ObjectKankyo_Beams = 0x80B7C390; // type:func -ObjectKankyo_DrawBeams = 0x80B7C470; // type:func -OceffSpot_SetupAction = 0x80B7CDC0; // type:func -OceffSpot_Init = 0x80B7CDCC; // type:func -OceffSpot_Destroy = 0x80B7CF28; // type:func -OceffSpot_End = 0x80B7CFB8; // type:func -OceffSpot_Wait = 0x80B7D080; // type:func -OceffSpot_GrowCylinder = 0x80B7D0BC; // type:func -OceffSpot_Update = 0x80B7D120; // type:func -OceffSpot_Draw = 0x80B7D3F8; // type:func -OceffStorm_SetupAction = 0x80B7DCF0; // type:func -OceffStorm_Init = 0x80B7DCFC; // type:func -OceffStorm_Destroy = 0x80B7DDCC; // type:func -OceffStorm_DefaultAction = 0x80B7DE18; // type:func -OceffStorm_UnkAction = 0x80B7DFDC; // type:func -OceffStorm_Update = 0x80B7DFFC; // type:func -OceffStorm_Draw2 = 0x80B7E068; // type:func -OceffStorm_Draw = 0x80B7E218; // type:func -OceffWipe_Init = 0x80B7F8A0; // type:func -OceffWipe_Destroy = 0x80B7F8FC; // type:func -OceffWipe_Update = 0x80B7F948; // type:func -OceffWipe_Draw = 0x80B7F9A8; // type:func -OceffWipe2_Init = 0x80B80620; // type:func -OceffWipe2_Destroy = 0x80B8067C; // type:func -OceffWipe2_Update = 0x80B806C8; // type:func -OceffWipe2_Draw = 0x80B80728; // type:func -OceffWipe3_Init = 0x80B81D90; // type:func -OceffWipe3_Destroy = 0x80B81DEC; // type:func -OceffWipe3_Update = 0x80B81E38; // type:func -OceffWipe3_Draw = 0x80B81E98; // type:func -OceffWipe4_Init = 0x80B834E0; // type:func -OceffWipe4_Destroy = 0x80B8353C; // type:func -OceffWipe4_Update = 0x80B83560; // type:func -OceffWipe4_Draw = 0x80B835C0; // type:func -ShotSun_Init = 0x80B844C0; // type:func -ShotSun_Destroy = 0x80B8457C; // type:func -ShotSun_SpawnFairy = 0x80B845C0; // type:func -ShotSun_TriggerFairy = 0x80B84668; // type:func -ShotSun_UpdateFairySpawner = 0x80B84704; // type:func -ShotSun_UpdateHyliaSun = 0x80B84854; // type:func -ShotSun_Update = 0x80B84A8C; // type:func diff --git a/tools/disasm/gc-eu-mq/variables.txt b/tools/disasm/gc-eu-mq/variables.txt deleted file mode 100644 index 14c122068..000000000 --- a/tools/disasm/gc-eu-mq/variables.txt +++ /dev/null @@ -1,785 +0,0 @@ -D_80009430 = 0x800060D0; // size:0x1 -gViConfigBlack = 0x800060D4; // size:0x1 -gViConfigAdditionalScanLines = 0x800060D8; // size:0x1 -gViConfigFeatures = 0x800060DC; // size:0x4 -gViConfigXScale = 0x800060E0; // size:0x4 -gViConfigYScale = 0x800060E4; // size:0x4 -gCartHandle = 0x800060F0; // size:0x4 type:OSPiHandle* -gDmaMgrDmaBuffSize = 0x80006104; // size:0x4 -sDmaMgrIsRomCompressed = 0x80006108; // size:0x4 -gCurrentRegion = 0x80006110; // size:0x4 type:u32 -sStackInfoListStart = 0x80006130; // size:0x4 -sStackInfoListEnd = 0x80006134; // size:0x4 -__osPiAccessQueueEnabled = 0x80006140; // size:0x4 -osViModePalLan1 = 0x80006150; // size:0x50 -osClockRate = 0x800061A0; // size:0x8 -osViClock = 0x800061A8; // size:0x4 -__osShutdown = 0x800061AC; // size:0x4 type:u32 -__OSGlobalIntMask = 0x800061B0; // size:0x4 type:OSHWIntr -__osHwIntTable = 0x800061C0; // size:0x28 type:__osHwInt -__osPiIntTable = 0x800061E8; // size:0x8 type:__osHwInt -__osThreadTail = 0x800061F0; // size:0x8 -__osRunQueue = 0x800061F8; // size:0x4 type:OSThread* -__osActiveQueue = 0x800061FC; // size:0x4 -__osRunningThread = 0x80006200; // size:0x4 type:OSThread* -__osFaultedThread = 0x80006204; // size:0x4 type:OSThread* -__osPiDevMgr = 0x80006210; // size:0x1C -__osPiTable = 0x8000622C; // size:0x4 type:OSPiHandle* -__osCurrentHandle = 0x80006230; // size:0x8 -__osPreNMI = 0x80006240; // size:0x4 -__osTimerList = 0x80006250; // size:0x4 -osViModeNtscLan1 = 0x80006260; // size:0x50 -osViModeMpalLan1 = 0x800062B0; // size:0x50 -vi = 0x80006300; // size:0x60 -__osViCurr = 0x80006360; // size:0x4 -__osViNext = 0x80006364; // size:0x4 -__osViDevMgr = 0x80006380; // size:0x1C -__additional_scanline = 0x8000639C; // size:0x4 -__osRcpImTable = 0x800064C0; // size:0x80 type:u16 -sBootThreadInfo = 0x80006570; // size:0x1C -sIdleThread = 0x80006590; // size:0x1B0 -sIdleThreadStack = 0x80006740; // size:0x400 -sIdleThreadInfo = 0x80006B40; // size:0x1C -sBootThreadStack = 0x80006B60; // size:0x400 -gMainThread = 0x80006F60; // size:0x1B0 -sMainStack = 0x80007110; // size:0x900 -sMainStackInfo = 0x80007A10; // size:0x1C -sPiMgrCmdBuff = 0x80007A30; // size:0xC8 -gPiMgrCmdQueue = 0x80007AF8; // size:0x18 -gViConfigMode = 0x80007B10; // size:0x50 -gViConfigModeType = 0x80007B60; // size:0x1 type:u8 -sDmaMgrStackInfo = 0x80007B70; // size:0x1C -sDmaMgrMsgQueue = 0x80007B90; // size:0x18 -sDmaMgrMsgBuf = 0x80007BA8; // size:0x80 -sDmaMgrThread = 0x80007C28; // size:0x1B0 -sDmaMgrStack = 0x80007DD8; // size:0x500 -sYaz0DataBuffer = 0x800082E0; // size:0x400 -sYaz0DataBufferEnd = 0x800086E0; // size:0x4 -sYaz0CurRomStart = 0x800086E4; // size:0x4 -sYaz0CurSize = 0x800086E8; // size:0x4 -sYaz0MaxPtr = 0x800086EC; // size:0x4 -sCartInfo = 0x800086F0; // size:0x20 -__DriveRomHandle = 0x80008710; // size:0x74 type:OSPiHandle -piAccessBuf = 0x80008790; // size:0x4 -__osPiAccessQueue = 0x80008798; // size:0x18 -__osFinalrom = 0x800087B0; // size:0x4 -__Dom1SpeedParam = 0x800087C0; // size:0x74 -__Dom2SpeedParam = 0x80008838; // size:0x74 -piThread = 0x800088B0; // size:0x1B0 -piStackThread = 0x80008A60; // size:0x1000 -piEventQueue = 0x80009A60; // size:0x18 -piEventBuf = 0x80009A78; // size:0x8 -__osThreadSave = 0x80009A80; // size:0x1B0 type:OSThread -__osEventStateTab = 0x80009C30; // size:0x78 type:__OSEventState -__osCurrentTime = 0x80009CD0; // size:0x8 -__osBaseCounter = 0x80009CD8; // size:0x4 -__osViIntrCount = 0x80009CDC; // size:0x4 -__osTimerCounter = 0x80009CE0; // size:0x4 -__CartRomHandle = 0x80009CF0; // size:0x74 -viThread = 0x80009D70; // size:0x1B0 -viThreadStack = 0x80009F20; // size:0x1000 -viEventQueue = 0x8000AF20; // size:0x18 -viEventBuf = 0x8000AF38; // size:0x14 -viRetraceMsg = 0x8000AF50; // size:0x18 -viCounterMsg = 0x8000AF68; // size:0x18 -gDmaDataTable = 0x8000AF90; // -sSetupHandlers = 0x800E4860; // size:0x8 -D_8011578C = 0x800E486C; // size:0x40 -D_801157CC = 0x800E48AC; // size:0x40 -sEffectInfoTable = 0x800E4940; // size:0x50 -sEffectSsInfo = 0x800E4990; // size:0xC -gEffectSsOverlayTable = 0x800E4A90; // size:0x40C -sNaviColorList = 0x800E5064; // size:0x68 -D_80115FF8 = 0x800E50D8; // size:0x50 -sEnemyActorCategories = 0x800E517C; // size:0x2 -D_801160A0 = 0x800E5180; // size:0xC -D_80116268 = 0x800E5348; // size:0xC -D_80116274 = 0x800E5354; // size:0xC -D_80116280 = 0x800E5360; // size:0x18 -gActorOverlayTable = 0x800E5380; // size:0x3AE0 -gMaxActorId = 0x800E8E60; // size:0x4 -D_80119D90 = 0x800E8E70; // size:0x80 -sSurfaceMaterialToSfxOffset = 0x800E8EF0; // size:0x1C -sZorasDomainWaterBox = 0x800E8F8C; // size:0x10 -sZorasDomainWaterBoxMinX = 0x800E8F9C; // size:0x4 -sZorasDomainWaterBoxMinY = 0x800E8FA0; // size:0x4 -sZorasDomainWaterBoxMinZ = 0x800E8FA4; // size:0x4 -sZorasDomainWaterBoxMaxX = 0x800E8FA8; // size:0x4 -sZorasDomainWaterBoxMaxY = 0x800E8FAC; // size:0x4 -sZorasDomainWaterBoxMaxZ = 0x800E8FB0; // size:0x4 -sCameraSettings = 0x800EBCC0; // size:0x210 -sCameraFunctions = 0x800EBED0; // size:0x11C -sInitRegs = 0x800EBFEC; // size:0x4 -gDebugCamEnabled = 0x800EBFF0; // size:0x4 -sCameraInterfaceField = 0x800EBFF8; // size:0x4 -sCameraHudVisibilityMode = 0x800EBFFC; // size:0x4 -sCameraLetterboxSize = 0x800EC000; // size:0x4 -D_8011D3AC = 0x800EC004; // size:0x4 -D_8011D3B0 = 0x800EC008; // size:0x1C -D_8011D3CC = 0x800EC024; // size:0x1C -sUpdateCameraDirection = 0x800EC040; // size:0x4 -D_8011D3EC = 0x800EC044; // size:0x4 -D_8011D3F0 = 0x800EC048; // size:0x4 -sDemo5PrevAction12Frame = 0x800EC04C; // size:0x4 -D_8011D658 = 0x800EC050; // size:0x20 -D_8011D678 = 0x800EC070; // size:0x30 -sDemo5PrevSfxFrame = 0x800EC0A0; // size:0x4 -D_8011D6AC = 0x800EC0A4; // size:0x78 -D_8011D954 = 0x800EC34C; // size:0xA0 -D_8011D9F4 = 0x800EC3EC; // size:0x78 -sCamElevatorPlatformLowerEyePoints = 0x800EC464; // size:0x30 -sCamElevatorPlatformUpperEyePoints = 0x800EC494; // size:0x30 -sCamElevatorPlatformTogglePosY = 0x800EC4C4; // size:0x10 -sCamElevatorPlatformFovRollParam = 0x800EC4D4; // size:0x10 -sCamElevatorPlatformRolls = 0x800EC4E4; // size:0x8 -sDebugCamTextEntryCount = 0x800ECAA0; // size:0x2 -sDebugCamTextColors = 0x800ECAA4; // size:0x20 -sCurTextId = 0x800ECB20; // size:0x2 -sCurOcarinaAction = 0x800ECB24; // size:0x2 -sManualCutsceneHandlers = 0x800ECB28; // size:0x14 -sScriptedCutsceneHandlers = 0x800ECB3C; // size:0x14 -sTitleDemoDestination = 0x800ECB50; // size:0x1 -sEntranceCutsceneTable = 0x800ECB54; // size:0x110 -sDrawItemTable = 0x800ECC80; // size:0x1074 -sChildSariaQuestHints = 0x800EDD00; // size:0x34 -sAdultSariaQuestHints = 0x800EDD34; // size:0x18 -sReactionTextIds = 0x800EDD50; // size:0x438 -gGameStateOverlayTable = 0x800EE190; // size:0x120 type:GameStateOverlay -sKaleidoSetupKscpPos0 = 0x800EE400; // size:0x8 -sKaleidoSetupEyeX0 = 0x800EE408; // size:0x10 -sKaleidoSetupEyeZ0 = 0x800EE418; // size:0x10 -sKaleidoSetupKscpPos1 = 0x800EE428; // size:0x8 -sKaleidoSetupEyeX1 = 0x800EE430; // size:0x10 -sKaleidoSetupEyeZ1 = 0x800EE440; // size:0x10 -sZBufValConversionTable = 0x800EE450; // size:0x40 -gWeatherMode = 0x800EE490; // size:0x1 -gLightConfigAfterUnderwater = 0x800EE494; // size:0x1 -gInterruptSongOfStorms = 0x800EE498; // size:0x1 -gSkyboxIsChanging = 0x800EE49C; // size:0x1 -gTimeSpeed = 0x800EE4A0; // size:0x2 -sSunScreenDepth = 0x800EE4A4; // size:0x2 -sTimeBasedLightConfigs = 0x800EE4A8; // size:0xD2 -gTimeBasedSkyboxConfigs = 0x800EE57C; // size:0x120 -gNormalSkyFiles = 0x800EE69C; // size:0x90 -sSandstormColorIndex = 0x800EE72C; // size:0x1 -sNextSandstormColorIndex = 0x800EE730; // size:0x1 -sSandstormLerpScale = 0x800EE734; // size:0x4 -sLensFlareScales = 0x800EE738; // size:0x28 -sSandstormPrimColors = 0x800EE824; // size:0xC -sSandstormEnvColors = 0x800EE830; // size:0xC -sInitChainHandlers = 0x800EE840; // size:0x2C -sPlayerInitialPosX = 0x800F2380; // size:0x2 -sPlayerInitialPosZ = 0x800F2384; // size:0x2 -sPlayerInitialDirection = 0x800F2388; // size:0x2 -sEntranceIconMapIndex = 0x800F238C; // size:0x2 -gMapDataTable = 0x800F4128; // size:0x70 -gSpoilingItems = 0x800F4348; // size:0x6 -gSpoilingItemReverts = 0x800F4350; // size:0x6 -gPlayerSkelHeaders = 0x800F44A0; // size:0x8 -sBootData = 0x800F44A8; // size:0xCC -sActionModelGroups = 0x800F4574; // size:0x43 -sEnvHazardTextTriggers = 0x800F45B8; // size:0x10 -gPlayerModelTypes = 0x800F45C8; // size:0x50 -D_80125D28 = 0x800F4658; // size:0x60 -gPlayerLeftHandBgsDLs = 0x800F4718; // size:0x20 -gPlayerLeftHandOpenDLs = 0x800F4738; // size:0x10 -gPlayerLeftHandClosedDLs = 0x800F4748; // size:0x10 -sPlayerRightHandClosedDLs = 0x800F4788; // size:0x10 -gPlayerLeftHandBoomerangDLs = 0x800F4828; // size:0x10 -sFirstPersonLeftForearmDLs = 0x800F4848; // size:0x8 -sFirstPersonLeftHandDLs = 0x800F4850; // size:0x8 -sFirstPersonRightShoulderDLs = 0x800F4858; // size:0x8 -sFirstPersonForearmDLs = 0x800F4860; // size:0x8 -sFirstPersonRightHandHoldingWeaponDLs = 0x800F4868; // size:0x8 -sPlayerDListGroups = 0x800F4870; // size:0x54 -gCullBackDList = 0x800F48C8; // size:0x10 -gCullFrontDList = 0x800F48D8; // size:0x10 -sEyeMouthIndices = 0x800F48E8; // size:0x20 -sEyeTextures = 0x800F4908; // size:0x40 -sMouthTextures = 0x800F4928; // size:0x20 -sTunicColors = 0x800F4938; // size:0x9 -sGauntletColors = 0x800F4944; // size:0x6 -sBootDListGroups = 0x800F494C; // size:0x10 -sZeroVec = 0x800F495C; // size:0xC -D_80126038 = 0x800F4968; // size:0x18 -D_80126050 = 0x800F4980; // size:0x8 -D_80126058 = 0x800F4988; // size:0x8 -D_80126060 = 0x800F4990; // size:0x8 -D_80126068 = 0x800F4998; // size:0x8 -D_80126070 = 0x800F49A0; // size:0xC -D_80126080 = 0x800F49B0; // size:0xC -D_8012608C = 0x800F49BC; // size:0xC -D_80126098 = 0x800F49C8; // size:0xC -D_801260A4 = 0x800F49D4; // size:0x24 -sPlayerFocusHeadLimbModelPos = 0x800F4A04; // size:0xC -sMeleeWeaponLengths = 0x800F4A10; // size:0x18 -sBottleDLists = 0x800F4A28; // size:0x8 -sBottleColors = 0x800F4A30; // size:0x27 -D_80126128 = 0x800F4A58; // size:0xC -sBowSlingshotStringData = 0x800F4A64; // size:0x20 -sRightHandLimbModelShieldQuadVertices = 0x800F4A84; // size:0x30 -D_80126184 = 0x800F4AB4; // size:0xC -D_80126190 = 0x800F4AC0; // size:0xC -sSheathLimbModelShieldQuadVertices = 0x800F4ACC; // size:0x30 -sSheathLimbModelShieldOnBackPos = 0x800F4AFC; // size:0xC -sSheathLimbModelShieldOnBackZyxRot = 0x800F4B08; // size:0x6 -sLeftRightFootLimbModelFootPos = 0x800F4B10; // size:0x18 -sPauseModelGroupBySword = 0x800F4B28; // size:0x3 -sQuakeUnused = 0x800F4B80; // size:0x2 -sQuakeRequestCount = 0x800F4B84; // size:0x2 -sQuakeCallbacks = 0x800F4B88; // size:0x1C -sSetupDL = 0x800F4BB0; // size:0xD50 -sFillSetupDL = 0x800F5900; // size:0x60 -D_801270A0 = 0x800F59D0; // size:0xC -sRoomDrawHandlers = 0x800F5A40; // size:0xC -gBitFlags = 0x800F5A50; // size:0x80 -gEquipMasks = 0x800F5AD0; // size:0x8 -gEquipNegMasks = 0x800F5AD8; // size:0x8 -gUpgradeMasks = 0x800F5AE0; // size:0x20 -gUpgradeNegMasks = 0x800F5B00; // size:0x20 -gEquipShifts = 0x800F5B20; // size:0x4 -gUpgradeShifts = 0x800F5B24; // size:0x8 -gUpgradeCapacities = 0x800F5B2C; // size:0x40 type:u16 -gGsFlagsMasks = 0x800F5B6C; // size:0x10 -gGsFlagsShifts = 0x800F5B7C; // size:0x10 -gItemIcons = 0x800F5B8C; // size:0x208 -gItemSlots = 0x800F5D94; // size:0x38 -sNaviQuestHintFiles = 0x800F5E38; // size:0x10 -gLinkObjectIds = 0x800F5E50; // size:0x4 -gObjectTableSize = 0x800F5E54; // size:0x4 -gObjectTable = 0x800F5E58; // size:0xC90 -gEntranceTable = 0x800F6AF0; // size:0x1850 -gSceneTable = 0x800F8340; // -sDefaultDisplayList = 0x800F8B28; // size:0x50 -D_8012A2F8 = 0x800F8B78; // size:0x8 -gDCEntranceTextures = 0x800F8B80; // size:0x8 -sDCLavaFloorTextures = 0x800F8B88; // size:0x20 -sThievesHideoutEntranceTextures = 0x800F8BA8; // size:0x8 -D_8012A330 = 0x800F8BB0; // size:0x8 -sIceCavernEntranceTextures = 0x800F8BB8; // size:0x8 -sGTGEntranceTextures = 0x800F8BC0; // size:0x8 -sLonLonHouseEntranceTextures = 0x800F8BC8; // size:0x8 -sGuardHouseView2Textures = 0x800F8BD0; // size:0x8 -sGuardHouseView1Textures = 0x800F8BD8; // size:0x8 -sForestTempleEntranceTextures = 0x800F8BE0; // size:0x8 -sSpiritTempleEntranceTextures = 0x800F8BE8; // size:0x8 -sKakarikoWindowTextures = 0x800F8BF0; // size:0x8 -sZorasDomainEntranceTextures = 0x800F8BF8; // size:0x8 -D_8012A380 = 0x800F8C00; // size:0x8 -sGoronCityEntranceTextures = 0x800F8C08; // size:0x8 -sLonLonRanchWindowTextures = 0x800F8C10; // size:0x8 -D_8012A398 = 0x800F8C18; // size:0x4 -sSceneDrawConfigs = 0x800F8C24; // size:0xD4 -sMtxFClear = 0x800F8D20; // size:0x40 -gSramSlotOffsets = 0x800F8D60; // size:0xC type:u16 -sSsSramContext = 0x800F8F10; // size:0xA4 -sLogOnNextViewInit = 0x800F8FF0; // size:0x4 -sCoverageOnlyDL = 0x800F9000; // size:0x28 -sCoverageRGBFogDL = 0x800F9028; // size:0x18 -sCoverageRGBDL = 0x800F9040; // size:0x18 -sCoverageRGBUniformDL = 0x800F9058; // size:0x30 -sSkybox256TexOffsets = 0x800F9090; // size:0x10 -sSkybox256VtxBufIndices = 0x800F90A0; // size:0x80 -sSkybox256TexSCoords = 0x800F9120; // size:0xA -sSkybox256TexTCoords = 0x800F912C; // size:0x12 -sSkybox256VtxIndices = 0x800F9140; // size:0x80 -sSkybox128TexOffsets = 0x800F91C0; // size:0x18 -sSkybox128VtxBufIndices = 0x800F91D8; // size:0x40 -sSkybox128TexSCoords = 0x800F9218; // size:0xA -sSkybox128TexTCoordsXZ = 0x800F9224; // size:0xA -sSkybox128TexTCoords = 0x800F9230; // size:0xA -sSkybox128VtxIndices = 0x800F923C; // size:0x80 -sSkybox256FaceParams = 0x800F92BC; // size:0x50 -sSkybox128FaceParams = 0x800F930C; // size:0x78 -sTransTileSetupDL = 0x800F9400; // size:0x30 -sTransTriforceDL = 0x800F9430; // size:0x30 -sTransWipeDL = 0x800F9E90; // size:0x190 -sTransCircleNormalTex = 0x800F9FA8; // size:0x400 -sTransCircleWaveTex = 0x800FA3A8; // size:0x400 -sTransCircleRippleTex = 0x800FA7A8; // size:0x400 -sTransCircleStarburstTex = 0x800FABA8; // size:0x400 -sTransCircleDL = 0x800FB1C8; // size:0xD0 -sLetterboxState = 0x800FB2D0; // size:0x4 -sLetterboxSizeTarget = 0x800FB2D4; // size:0x4 -sLetterboxSize = 0x800FB2D8; // size:0x4 -gKaleidoMgrOverlayTable = 0x800FB2E0; // size:0x38 type:KaleidoMgrOverlay -sKaleidoAreaPtr = 0x800FB318; // size:0x4 type:void* -gKaleidoMgrCurOvl = 0x800FB31C; // size:0x4 type:KaleidoMgrOverlay* -gBossMarkState = 0x800FB320; // size:0x1 type:u8 -D_8012D1F8 = 0x800FB330; // size:0x4 -sSfxBankIds = 0x800FB340; // size:0x7 -gScreenWidth = 0x800FB360; // size:0x4 type:s32 -gScreenHeight = 0x800FB364; // size:0x4 type:s32 -gSystemHeapSize = 0x800FB368; // size:0x4 type:u32 -gPadMgrLogSeverity = 0x800FB370; // size:0x4 -sSpeedMeterTimeEntryArray = 0x800FB380; // size:0x30 -sFactorialTbl = 0x800FB3B0; // size:0x34 -gMtxClear = 0x800FBC00; // size:0x40 -gMtxFClear = 0x800FBC40; // size:0x40 -sDefaultGSPUCodeText = 0x800FBC80; // size:0x4 -sDefaultGSPUCodeData = 0x800FBC84; // size:0x4 -gIrqMgrResetStatus = 0x800FBCA0; // size:0x4 -sIrqMgrResetTime = 0x800FBCA8; // size:0x8 -gIrqMgrRetraceTime = 0x800FBCB0; // size:0x8 -sIrqMgrRetraceCount = 0x800FBCB8; // size:0x4 -sExceptionNames = 0x800FBCC0; // size:0x48 -sFpExceptionNames = 0x800FBD08; // size:0x18 -sFaultDrawerDefault = 0x800FBD20; // size:0x3C -gWaveSamples = 0x800FCD60; // size:0x24 -gBendPitchOneOctaveFrequencies = 0x800FCD84; // size:0x400 -gBendPitchTwoSemitonesFrequencies = 0x800FD184; // size:0x400 -gPitchFrequencies = 0x800FD584; // size:0x200 -gDefaultShortNoteVelocityTable = 0x800FD784; // size:0x10 -gDefaultShortNoteGateTimeTable = 0x800FD794; // size:0x10 -gDefaultEnvelope = 0x800FD7A4; // size:0x10 -gZeroNoteSub = 0x800FD7B4; // size:0x20 -gDefaultNoteSub = 0x800FD7D4; // size:0x20 -gHaasEffectDelaySizes = 0x800FD7F4; // size:0x80 -D_8012FBA8 = 0x800FD878; // size:0x80 -gHeadsetPanVolume = 0x800FD8F8; // size:0x200 -gStereoPanVolume = 0x800FDAF8; // size:0x200 -gDefaultPanVolume = 0x800FDCF8; // size:0x200 -gLowPassFilterData = 0x800FDEF8; // size:0x100 -gHighPassFilterData = 0x800FDFF8; // size:0xF0 -sEnvMixerOp = 0x800FE170; // size:0x4 -sEnvMixerLeftHaasDmemDests = 0x800FE174; // size:0x4 -sEnvMixerRightHaasDmemDests = 0x800FE178; // size:0x4 -sEnvMixerDefaultDmemDests = 0x800FE17C; // size:0x4 -sNumSamplesPerWavePeriod = 0x800FE190; // size:0x4 -sDmaHandler = 0x800FE1A0; // size:0x4 -sUnusedHandler = 0x800FE1A4; // size:0x4 -gAudioContextInitialized = 0x800FE1A8; // size:0x4 -sSeqInstructionArgsTable = 0x800FE1F0; // size:0x50 -gIsLargeSfxBank = 0x800FE240; // size:0x7 -gChannelsPerBank = 0x800FE248; // size:0x1C -gUsedChannelsPerBank = 0x800FE264; // size:0x1C -D_801305B0 = 0x800FE280; // size:0x4 -D_801305B4 = 0x800FE284; // size:0x1 -D_801305B8 = 0x800FE288; // size:0x1 -D_801305BC = 0x800FE28C; // size:0x1 -D_801305C0 = 0x800FE290; // size:0x1 -sBehindScreenZ = 0x800FE294; // size:0x8 -sAudioIncreasingTranspose = 0x800FE29C; // size:0x1 -gMorphaTransposeTable = 0x800FE2A0; // size:0x10 -sPrevChargeLevel = 0x800FE2B0; // size:0x1 -D_801305E4 = 0x800FE2B4; // size:0x10 -D_801305F4 = 0x800FE2C4; // size:0x4 -sGanonsTowerLevelsVol = 0x800FE2C8; // size:0x8 -sEnterGanonsTowerTimer = 0x800FE2D0; // size:0x1 -sSoundMode = 0x800FE2D4; // size:0x1 -D_80130608 = 0x800FE2D8; // size:0x1 -sAudioCutsceneFlag = 0x800FE2DC; // size:0x1 -sSpecReverb = 0x800FE2E0; // size:0x1 -sAudioEnvReverb = 0x800FE2E4; // size:0x1 -sAudioCodeReverb = 0x800FE2E8; // size:0x1 -sPrevSeqMode = 0x800FE2EC; // size:0x1 -sAudioEnemyDist = 0x800FE2F0; // size:0x4 -sAudioEnemyVol = 0x800FE2F4; // size:0x1 -sPrevMainBgmSeqId = 0x800FE2F8; // size:0x2 -sSeqResumePoint = 0x800FE2FC; // size:0x1 -sPrevSceneSeqId = 0x800FE300; // size:0x1 -sNumFramesStill = 0x800FE304; // size:0x4 -sNumFramesMoving = 0x800FE308; // size:0x4 -sAudioBaseFilter = 0x800FE30C; // size:0x1 -sAudioExtraFilter = 0x800FE310; // size:0x1 -sAudioBaseFilter2 = 0x800FE314; // size:0x1 -sAudioExtraFilter2 = 0x800FE318; // size:0x1 -sSariaBgmPtr = 0x800FE31C; // size:0x4 -D_80130650 = 0x800FE320; // size:0x4 -sSeqFlags = 0x800FE324; // size:0x6E -sSpecReverbs = 0x800FE394; // size:0x14 -sNatureAmbienceDataIO = 0x800FE3A8; // size:0x820 -sOcarinaAllowedButtonMask = 0x800FEBC8; // size:0x4 -sOcarinaAButtonMap = 0x800FEBCC; // size:0x4 -sOcarinaCUpButtonMap = 0x800FEBD0; // size:0x4 -sOcarinaCDownButtonMap = 0x800FEBD4; // size:0x4 -sIsOcarinaInputEnabled = 0x800FEBD8; // size:0x1 -sOcarinaInstrumentId = 0x800FEBDC; // size:0x1 -sCurOcarinaPitch = 0x800FEBE0; // size:0x1 -sPrevOcarinaPitch = 0x800FEBE4; // size:0x1 -sCurOcarinaButtonIndex = 0x800FEBE8; // size:0x1 -sMusicStaffPrevPitch = 0x800FEBEC; // size:0x1 -sCurOcarinaBendFreq = 0x800FEBF0; // size:0x4 -sRelativeOcarinaVolume = 0x800FEBF4; // size:0x4 -sCurOcarinaBendIndex = 0x800FEBF8; // size:0x1 -sCurOcarinaVolume = 0x800FEBFC; // size:0x1 -sCurOcarinaVibrato = 0x800FEC00; // size:0x1 -sPlaybackState = 0x800FEC04; // size:0x1 -sOcarinaFlags = 0x800FEC08; // size:0x4 -sPlaybackNoteTimer = 0x800FEC0C; // size:0x4 -sPlaybackNotePos = 0x800FEC10; // size:0x2 -sPlaybackStaffPos = 0x800FEC14; // size:0x2 -sPrevOcarinaWithMusicStaffFlags = 0x800FEC18; // size:0x2 -sPlaybackPitch = 0x800FEC1C; // size:0x1 -sNotePlaybackVolume = 0x800FEC20; // size:0x1 -sNotePlaybackVibrato = 0x800FEC24; // size:0x1 -sNotePlaybackBend = 0x800FEC28; // size:0x1 -sRelativeNotePlaybackBend = 0x800FEC2C; // size:0x4 -sRelativeNotePlaybackVolume = 0x800FEC30; // size:0x4 -sOcarinaPlaybackTaskStart = 0x800FEC34; // size:0x4 -sButtonToPitchMap = 0x800FEC38; // size:0x5 -sOcaMemoryGameAppendPos = 0x800FEC40; // size:0x1 -sOcaMemoryGameEndPos = 0x800FEC44; // size:0x1 -sOcaMemoryGameNumNotes = 0x800FEC48; // size:0x3 -sOcarinaSongNotes = 0x800FEC4C; // size:0x8C0 -sPlaybackSong = 0x800FF50C; // size:0x4 -sFrogsSongNotes = 0x800FF510; // size:0xE -gFrogsSongPtr = 0x800FF520; // size:0x4 -sRecordingState = 0x800FF524; // size:0x1 -sRecordSongPos = 0x800FF528; // size:0x1 -sOcarinaRecordTaskStart = 0x800FF52C; // size:0x4 -sRecordOcarinaPitch = 0x800FF530; // size:0x1 -sRecordOcarinaVolume = 0x800FF534; // size:0x1 -sRecordOcarinaVibrato = 0x800FF538; // size:0x1 -sRecordOcarinaBendIndex = 0x800FF53C; // size:0x1 -sRecordOcarinaButtonIndex = 0x800FF540; // size:0x1 -sPlayedOcarinaSongIndexPlusOne = 0x800FF544; // size:0x1 -sMusicStaffNumNotesPerTest = 0x800FF548; // size:0x1 -sOcarinaDropInputTimer = 0x800FF54C; // size:0x1 -sScarecrowsLongSongNotes = 0x800FF550; // size:0x360 -gScarecrowLongSongPtr = 0x800FF8B0; // size:0x4 -gScarecrowSpawnSongPtr = 0x800FF8B4; // size:0x4 -sMemoryGameSongPtr = 0x800FF8B8; // size:0x4 -sPitchToButtonMap = 0x800FF8BC; // size:0x10 -gOcarinaSongButtons = 0x800FF8CC; // size:0x7E -gSfxParams = 0x80100D0C; // size:0x1C -gSfxRequestWriteIndex = 0x80100D30; // size:0x1 -gSfxRequestReadIndex = 0x80100D34; // size:0x1 -gSfxBanks = 0x80100D38; // size:0x1C -gSfxBankSizes = 0x80100D54; // size:0x7 -gSfxChannelLayout = 0x80100D5C; // size:0x1 -D_801333D0 = 0x80100D60; // size:0x2 -gSfxDefaultPos = 0x80100D64; // size:0xC -gSfxDefaultFreqAndVolScale = 0x80100D70; // size:0x4 -gSfxDefaultReverb = 0x80100D78; // size:0x1 -gSeqCmdWritePos = 0x80100D80; // size:0x1 -gSeqCmdReadPos = 0x80100D84; // size:0x1 -gStartSeqDisabled = 0x80100D88; // size:0x1 -gSoundModeList = 0x80100D8C; // size:0x4 -gAudioSpecId = 0x80100D90; // size:0x1 -D_80133418 = 0x80100D94; // size:0x1 -gAudioSpecs = 0x80101148; // size:0x3F0 -sGfxPrintFontTLUT = 0x80101550; // size:0x80 -sGfxPrintRainbowTLUT = 0x801015D0; // size:0x20 -sGfxPrintRainbowData = 0x801015F0; // size:0x8 -sGfxPrintFontData = 0x801015F8; // size:0x800 -sInitFuncs = 0x80101E00; // size:0x4 -qNaN0x10000 = 0x80101E24; // size:0x4 -__osSiAccessQueueEnabled = 0x80102650; // size:0x4 -__osContInitialized = 0x80102660; // size:0x4 -spaces = 0x80102670; // size:0x21 -zeroes = 0x80102694; // size:0x21 -__osPfsInodeCacheChannel = 0x80102730; // size:0x4 -__osPfsInodeCacheBank = 0x80102734; // size:0x1 -__osPfsLastChannel = 0x80102740; // size:0x4 -gTempoData = 0x80107240; // size:0x4 -gAudioHeapInitSizes = 0x80107244; // size:0xC -__libm_qnan_f = 0x80107740; // size:0x4 -sTextFade = 0x801077C0; // size:0x2 -D_8014B2F4 = 0x801077C4; // size:0x1 -sOcarinaButtonIndexBufPos = 0x801077C8; // size:0x2 -sOcarinaButtonIndexBufLen = 0x801077CC; // size:0x2 -sTextboxSkipped = 0x801077D0; // size:0x1 -sNextTextId = 0x801077D4; // size:0x2 -sTextIsCredits = 0x801077D8; // size:0x2 -sLastPlayedSong = 0x801077E0; // size:0x2 -sHasSunsSong = 0x801077E4; // size:0x2 -sMessageHasSetSfx = 0x801077E8; // size:0x2 -sOcarinaSongBitFlags = 0x801077EC; // size:0x2 -sNesMessageEntryTable = 0x801077F0; // size:0x4228 -sGerMessageEntryTable = 0x8010BA18; // size:0x2110 -sFraMessageEntryTable = 0x8010DB28; // size:0x2110 -sStaffMessageEntryTable = 0x8010FC38; // size:0x188 -sNesMessageEntryTablePtr = 0x8010FDC0; // size:0x4 -sGerMessageEntryTablePtr = 0x8010FDC4; // size:0x4 -sFraMessageEntryTablePtr = 0x8010FDC8; // size:0x4 -sStaffMessageEntryTablePtr = 0x8010FDCC; // size:0x4 -sTextboxBackgroundForePrimColors = 0x8010FDD0; // size:0x30 -sTextboxBackgroundBackPrimColors = 0x8010FE00; // size:0x18 -sTextboxBackgroundYOffsets = 0x8010FE18; // size:0x4 -sOcarinaButtonIndexBuf = 0x8010FE1C; // size:0xC -sOcarinaButtonAlphaValues = 0x8010FE28; // size:0x12 -gOcarinaSongItemMap = 0x8010FE3C; // size:0x18 -sFontWidths = 0x8010FED0; // size:0x240 -gGameOverTimer = 0x80110240; // size:0x2 type:s16 -gSoundFontTable = 0x80110470; // -gSequenceFontTable = 0x801106E0; // -gSequenceTable = 0x801108A0; // -gSampleBankTable = 0x80110F90; // -aspMainDataStart = 0x80111010; // -sEffectContext = 0x80113140; // size:0x3DF0 -D_8015BC00 = 0x80116F40; // size:0xE -D_8015BC10 = 0x80116F50; // size:0x4 -D_8015BC14 = 0x80116F58; // size:0x4 -D_8015BC18 = 0x80116F60; // size:0x4 -D_8015BBE8 = 0x80116F64; // size:0x4 -D_8015BBEC = 0x80116F68; // size:0x4 -D_8015BBF0 = 0x80116F6C; // size:0x4 -sbgmEnemyDistSq = 0x80116F70; // size:0x4 -D_8015BBF8 = 0x80116F74; // size:0x4 -D_8015BBFC = 0x80116F78; // size:0x2 -D_8015BD7C = 0x80117198; // size:0x4 -playerFloorPoly = 0x8011719C; // size:0x4 -D_8015FA88 = 0x80118930; // size:0x4 -D_8015FA8C = 0x80118934; // size:0x4 -gSaveContext = 0x80118938; // size:0x1428 type:SaveContext -gRegEditor = 0x80119D60; // size:0x4 type:RegEditor* -sDebugCamTextBuffer = 0x80119D68; // size:0x210 -gCamAtSplinePointsAppliedFrame = 0x80119FAE; // size:0x2 -gCamEyePointAppliedFrame = 0x80119FB0; // size:0x2 -gCamAtPointAppliedFrame = 0x80119FB2; // size:0x2 -sReturnToCamId = 0x80119FB4; // size:0x2 -sQuakeIndex = 0x80119FB6; // size:0x2 -sLightningBolts = 0x80119FC8; // size:0x60 -gLightningStrike = 0x8011A028; // size:0xC -sLightningFlashAlpha = 0x8011A034; // size:0x2 -sSunDepthTestX = 0x8011A036; // size:0x2 -sSunDepthTestY = 0x8011A038; // size:0x2 -gCustomLensFlareOn = 0x8011A03A; // size:0x1 -gCustomLensFlarePos = 0x8011A040; // size:0xC -gLensFlareScale = 0x8011A04C; // size:0x2 -gLensFlareColorIntensity = 0x8011A050; // size:0x4 -gLensFlareGlareStrength = 0x8011A054; // size:0x2 -sNGameOverLightNode = 0x8011A058; // size:0x4 -sNGameOverLightInfo = 0x8011A060; // size:0xE -sSGameOverLightNode = 0x8011A070; // size:0x4 -sSGameOverLightInfo = 0x8011A078; // size:0xE -sGameOverLightsIntensity = 0x8011A086; // size:0x1 -sSandstormScroll = 0x8011A088; // size:0x2 -sBeatingHeartsDDPrim = 0x8011A090; // size:0x6 -sBeatingHeartsDDEnv = 0x8011A098; // size:0x6 -sHeartsDDPrim = 0x8011A0A0; // size:0xC -sHeartsDDEnv = 0x8011A0B0; // size:0xC -sLightsBuffer = 0x8011A0C0; // size:0x188 -sZeldaArena = 0x8011A250; // size:0x24 type:Arena -gMapData = 0x8011A290; // size:0x4 -sCurBodyPartPos = 0x8011A2C0; // size:0x4 -sDListsLodOffset = 0x8011A2C4; // size:0x4 -sGetItemRefPos = 0x8011A2C8; // size:0xC -sLeftHandType = 0x8011A2D4; // size:0x4 -sRightHandType = 0x8011A2D8; // size:0x4 -sQuakeRequests = 0x8011A2E0; // size:0x90 -gSkinLimbMatrices = 0x8011A380; // size:0xF00 -sRumbleMgr = 0x8011B290; // size:0x10E -sSkyboxDrawMatrix = 0x8011B3A0; // size:0x4 -sPlayerCallInitFunc = 0x8011B3B0; // size:0x4 -sPlayerCallDestroyFunc = 0x8011B3B4; // size:0x4 -sPlayerCallUpdateFunc = 0x8011B3B8; // size:0x4 -sPlayerCallDrawFunc = 0x8011B3BC; // size:0x4 -sKaleidoScopeUpdateFunc = 0x8011B3C0; // size:0x4 -sKaleidoScopeDrawFunc = 0x8011B3C4; // size:0x4 -gBossMarkScale = 0x8011B3C8; // size:0x4 -gLoadedPauseMarkDataTable = 0x8011B3D0; // size:0x4 -sTransitionTile = 0x8011B3E0; // size:0xE0 -gTransitionTileState = 0x8011B4C0; // size:0x4 -sPlayVisMono = 0x8011B4C8; // size:0x18 -gVisMonoColor = 0x8011B4E0; // size:0x4 -D_801664D0 = 0x8011B4F0; // size:0x20 -sVisCvg = 0x8011B510; // size:0x10 -sVisZBuf = 0x8011B520; // size:0x10 -sVisMono = 0x8011B530; // size:0x18 -sViMode = 0x8011B548; // size:0x88 -sGraphPrevUpdateEndTime = 0x8011B5D0; // size:0x8 -sGraphPrevTaskTimeStart = 0x8011B5D8; // size:0x8 -gSegments = 0x8011B648; // size:0x40 type:uintptr_t[16] -gScheduler = 0x8011B688; // size:0x258 -gPadMgr = 0x8011B8E0; // size:0x468 -gIrqMgr = 0x8011BD48; // size:0x280 -sGraphThread = 0x8011BFC8; // size:0x1B0 -sGraphStack = 0x8011C178; // size:0x1800 -sSchedStack = 0x8011D978; // size:0x600 -sAudioStack = 0x8011DF78; // size:0x800 -sPadMgrStack = 0x8011E778; // size:0x500 -sIrqMgrStack = 0x8011EC78; // size:0x500 -sGraphStackInfo = 0x8011F178; // size:0x1C -sSchedStackInfo = 0x8011F198; // size:0x1C -sAudioStackInfo = 0x8011F1B8; // size:0x1C -sPadMgrStackInfo = 0x8011F1D8; // size:0x1C -sIrqMgrStackInfo = 0x8011F1F8; // size:0x1C -gAudioMgr = 0x8011F218; // size:0x298 -sSerialEventQueue = 0x8011F4B0; // size:0x18 -sSerialMsgBuf = 0x8011F4C8; // size:0x4 -sRSPGfxTimeStart = 0x8011F4E0; // size:0x8 -sRSPAudioTimeStart = 0x8011F4E8; // size:0x8 -sRSPOtherTimeStart = 0x8011F4F0; // size:0x8 -sRDPTimeStart = 0x8011F4F8; // size:0x8 -gAudioThreadUpdateTimeTotalPerGfxTask = 0x8011F500; // size:0x8 -gGfxTaskSentToNextReadyMinusAudioThreadUpdateTime = 0x8011F508; // size:0x8 -gRSPAudioTimeTotal = 0x8011F510; // size:0x8 -gRSPGfxTimeTotal = 0x8011F518; // size:0x8 -gRDPTimeTotal = 0x8011F520; // size:0x8 -gGraphUpdatePeriod = 0x8011F528; // size:0x8 -gAudioThreadUpdateTimeStart = 0x8011F530; // size:0x8 -gAudioThreadUpdateTimeAcc = 0x8011F538; // size:0x8 -gRSPAudioTimeAcc = 0x8011F540; // size:0x8 -gRSPGfxTimeAcc = 0x8011F548; // size:0x8 -gRSPOtherTimeAcc = 0x8011F550; // size:0x8 -gRDPTimeAcc = 0x8011F560; // size:0x8 -sSpeedMeterTimeEntryPtr = 0x8011F568; // size:0x4 -sSysCfbFbPtr = 0x8011F570; // size:0x8 -sSysCfbEnd = 0x8011F578; // size:0x4 -sMatrixStack = 0x8011F7A0; // size:0x4 type:MtxF* -sCurrentMatrix = 0x8011F7A4; // size:0x4 type:MtxF* -sFaultInstance = 0x8011F7B0; // size:0x4 -sFaultAwaitingInput = 0x8011F7B4; // size:0x1 -sFaultStack = 0x8011F7B8; // size:0x600 -sFaultThreadInfo = 0x8011FDB8; // size:0x1C -gFaultMgr = 0x8011FDD8; // size:0x850 -sFaultDrawer = 0x80120630; // size:0x3C type:FaultDrawer -sScriptLoadQueue = 0x80120690; // size:0x18 -sScriptLoadMsgBuf = 0x801206A8; // size:0x40 -sScriptLoadDonePointers = 0x801206E8; // size:0x40 -D_8016B780 = 0x80120730; // size:0x4 -D_8016B7A8 = 0x80120750; // size:0x4 -D_8016B7AC = 0x80120754; // size:0x4 -D_8016B7B0 = 0x80120758; // size:0x4 -sRiverFreqScaleLerp = 0x80120760; // size:0x10 -sWaterfallFreqScaleLerp = 0x80120770; // size:0x10 -D_8016B7D8 = 0x80120780; // size:0x4 -D_8016B7DC = 0x80120784; // size:0x1 -D_8016B7E0 = 0x80120788; // size:0x4 -sRiverSoundMainBgmVol = 0x8012078C; // size:0x1 -sRiverSoundMainBgmCurrentVol = 0x8012078D; // size:0x1 -sRiverSoundMainBgmLower = 0x8012078E; // size:0x1 -sRiverSoundMainBgmRestore = 0x8012078F; // size:0x1 -sGanonsTowerVol = 0x80120790; // size:0x1 -sSfxChannelState = 0x80120798; // size:0x100 -sMalonSingingTimer = 0x80120898; // size:0x1 -sMalonSingingDisabled = 0x80120899; // size:0x1 -D_8016B9F3 = 0x8012089A; // size:0x1 -sFanfareStartTimer = 0x8012089B; // size:0x1 -sFanfareSeqId = 0x8012089C; // size:0x2 -sPlayingStaff = 0x8012089E; // size:0x3 -sPlaybackStaff = 0x801208A2; // size:0x3 -sRecordingStaff = 0x801208A6; // size:0x3 -sOcarinaUpdateTaskStart = 0x801208AC; // size:0x4 -sOcarinaInputStickAdj = 0x801208B0; // size:0x2 -sOcarinaInputButtonCur = 0x801208B4; // size:0x4 -sOcarinaInputButtonStart = 0x801208B8; // size:0x4 -sOcarinaInputButtonPrev = 0x801208BC; // size:0x4 -sOcarinaInputButtonPress = 0x801208C0; // size:0x4 -sCurOcarinaSongWithoutMusicStaff = 0x801208C8; // size:0x8 -sOcarinaWithoutMusicStaffPos = 0x801208D0; // size:0x1 -sOcarinaHasStartedSong = 0x801208D1; // size:0x1 -sFirstOcarinaSongIndex = 0x801208D2; // size:0x1 -sLastOcarinaSongIndex = 0x801208D3; // size:0x1 -sAvailOcarinaSongFlags = 0x801208D4; // size:0x2 -sStaffOcarinaPlayingPos = 0x801208D6; // size:0x1 -sMusicStaffPos = 0x801208D8; // size:0x1C -sMusicStaffCurHeldLength = 0x801208F8; // size:0x1C -sMusicStaffExpectedLength = 0x80120918; // size:0x1C -sMusicStaffExpectedPitch = 0x80120938; // size:0xE -sScarecrowsLongSongSecondNote = 0x80120948; // size:0x8 -sSfxRequests = 0x80121820; // size:0x1800 -sSfxBankListEnd = 0x80123020; // size:0x7 -sSfxBankFreeListStart = 0x80123028; // size:0x7 -sSfxBankUnused = 0x80123030; // size:0x7 -gActiveSfx = 0x80123038; // size:0xA8 -sCurSfxPlayerChannelIndex = 0x801230E0; // size:0x1 -gSfxBankMuted = 0x801230E4; // size:0x7 -sUnusedBankLerp = 0x801230F0; // size:0x70 -sSeqRequests = 0x80123160; // size:0x28 -sNumSeqRequests = 0x80123188; // size:0x4 -sAudioSeqCmds = 0x80123190; // size:0x400 -gActiveSeqs = 0x80123590; // size:0x990 -gAudioCtx = 0x80123FC0; // size:0x6450 -gAudioCustomUpdateFunction = 0x8012A410; // size:0x4 -gUseAtanContFrac = 0x8012A440; // size:0x4 -gSystemArena = 0x8012A450; // size:0x24 type:Arena -sArenaLockMsg = 0x8012A490; // size:0x4 type:OSMesg -sJpegBitStreamPtr = 0x8012A4A0; // size:0x4 -sJpegBitStreamByteIdx = 0x8012A4A4; // size:0x4 -sJpegBitStreamBitIdx = 0x8012A4A8; // size:0x1 -sJpegBitStreamDontSkip = 0x8012A4A9; // size:0x1 -sJpegBitStreamCurWord = 0x8012A4AC; // size:0x4 -__MotorDataBuf = 0x8012A4F0; // size:0x100 -siAccessBuf = 0x8012A5F0; // size:0x4 -__osSiAccessQueue = 0x8012A5F8; // size:0x18 -__osContPifRam = 0x8012A610; // size:0x40 -__osContLastCmd = 0x8012A650; // size:0x1 -__osMaxControllers = 0x8012A651; // size:0x1 -__osEepromTimerMsgQueue = 0x8012A678; // size:0x18 -__osEepromTimerMsg = 0x8012A690; // size:0x4 -__osPfsInodeCache = 0x8012A6A0; // size:0x100 -__osPfsPifRam = 0x8012A7A0; // size:0x40 -sCharTexSize = 0x8012A7E0; // size:0x4 -sCharTexScale = 0x8012A7E4; // size:0x4 -sOcarinaButtonAPrimR = 0x8012A7E8; // size:0x2 -sOcarinaButtonAPrimB = 0x8012A7EA; // size:0x2 -sOcarinaButtonAPrimG = 0x8012A7EC; // size:0x2 -sOcarinaButtonAEnvR = 0x8012A7EE; // size:0x2 -sOcarinaButtonAEnvB = 0x8012A7F0; // size:0x2 -sOcarinaButtonAEnvG = 0x8012A7F2; // size:0x2 -sOcarinaButtonCPrimR = 0x8012A7F4; // size:0x2 -sOcarinaButtonCPrimB = 0x8012A7F6; // size:0x2 -sOcarinaButtonCPrimG = 0x8012A7F8; // size:0x2 -sOcarinaButtonCEnvR = 0x8012A7FA; // size:0x2 -sOcarinaButtonCEnvB = 0x8012A7FC; // size:0x2 -sOcarinaButtonCEnvG = 0x8012A7FE; // size:0x2 -gZBuffer = 0x8012A800; // size:0x25800 type:u16 -gGfxSPTaskOutputBuffer = 0x80150000; // size:0x18000 -gGfxSPTaskYieldBuffer = 0x80168000; // size:0xC00 -gGfxSPTaskStack = 0x80168C00; // size:0x400 -gGfxPools = 0x80169000; // size:0x24820 -gAudioHeap = 0x8018D820; // size:0x38000 -gSystemHeap = 0x801C5820; // -D_80811BB0 = 0x80810D70; // size:0x180 -D_80811D30 = 0x80810EF0; // size:0x100 -D_80811E30 = 0x80810FF0; // size:0x100 -D_80811F30 = 0x808110F0; // size:0x200 -D_80812130 = 0x808112F0; // size:0x200 -gOptionsDividerTopVtx = 0x808114F0; // size:0x40 -gOptionsDividerMiddleVtx = 0x80811530; // size:0x40 -gOptionsDividerBottomVtx = 0x80811570; // size:0x40 -D_808123F0 = 0x808115B0; // size:0x82 -gAmmoItems = 0x80828020; // size:0x10 -D_8082AAEC = 0x808286EC; // size:0x40 -D_8082AB2C = 0x8082872C; // size:0x40 -gSlotAgeReqs = 0x808287FC; // size:0x18 -gEquipAgeReqs = 0x80828814; // size:0x10 -gItemAgeReqs = 0x80828824; // size:0x56 -gAreaGsFlags = 0x8082887C; // size:0x16 -gPauseMapMarkDataTable = 0x80828EC0; // size:0x4158 -sReturnEntranceGroupData = 0x80850FD8; // size:0x1C -sReturnEntranceGroupIndices = 0x80850FF4; // size:0x6 -gMapMarkDataTable = 0x8085BEE8; // size:0x28 -D_808BB2F0 = 0x808B18A0; // size:0x4A8 -D_808BB7A0 = 0x808B1D50; // size:0x5E8 -D_808BBD90 = 0x808B2340; // size:0x628 -D_808BCE20 = 0x808B3350; // size:0x480 -D_808BD2A0 = 0x808B37D0; // size:0x280 -D_808BD520 = 0x808B3A50; // size:0x270 -D_808BD790 = 0x808B3CC0; // size:0x200 -gGanondorfShadowSetupDL = 0x808DA308; // size:0x20 -gGanondorfShadowModelDL = 0x808DA328; // size:0x30 -gGanondorfTriforceDL = 0x808DB398; // size:0x80 -gGanondorfWindowShardMaterialDL = 0x808DB888; // size:0xA8 -gGanondorfWindowShardModelDL = 0x808DB930; // size:0x18 -gGanondorfWindowShatterTemplateTex = 0x808DB948; // size:0x800 -gGanondorfLightBallMaterialDL = 0x808DD188; // size:0x70 -gGanondorfSquareDL = 0x808DD1F8; // size:0x18 -gGanondorfLightningDL = 0x808E6250; // size:0x80 -gGanondorfLightRayTriDL = 0x808E6378; // size:0x48 -gGanondorfLightFlecksDL = 0x808E7DD0; // size:0xF0 -gGanondorfBigMagicBGCircleDL = 0x808E7EC0; // size:0xA8 -gGanondorfDotDL = 0x808E7F68; // size:0xC8 -gGanondorfShockwaveDL = 0x808E89D0; // size:0xF8 -gGanondorfImpactDarkDL = 0x808E9868; // size:0x118 -gGanondorfImpactLightDL = 0x808E9980; // size:0x118 -gGanondorfShockGlowDL = 0x808EAAD8; // size:0xC8 -gGanondorfLightCoreDL = 0x808EBE38; // size:0x88 -gGanondorfShockDL = 0x808EBF00; // size:0x80 -gGanondorfVortexDL = 0x808ECCE0; // size:0x108 -sEffects = 0x808EE1B8; // size:0x3B60 -sTwinrovaEyeTextures = 0x8093DDA0; // size:0xC -gAdultWarpInCS = 0x8097BAF0; // size:0x108 -gAdultWarpOutCS = 0x8097BC00; // size:0x180 -gAdultWarpInToTCS = 0x8097BD80; // size:0x108 -gAdultWarpOutToTCS = 0x8097BE90; // size:0x120 -gChildWarpInCS = 0x8097BFB0; // size:0x128 -gChildWarpOutCS = 0x8097C0E0; // size:0x180 -gChildWarpInToTCS = 0x8097C260; // size:0x128 -gChildWarpOutToTCS = 0x8097C390; // size:0x120 -D_80ABF9D0 = 0x80AA19A0; // size:0x170 -D_80ABFB40 = 0x80AA1B10; // size:0x798 -D_80B4C5D0 = 0x80B27720; // size:0xFF0 diff --git a/tools/disasm/list_generated_files.py b/tools/disasm/list_generated_files.py deleted file mode 100755 index 2f160a961..000000000 --- a/tools/disasm/list_generated_files.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python3 - -# SPDX-FileCopyrightText: © 2024 ZeldaRET -# SPDX-License-Identifier: CC0-1.0 - -import argparse -import csv -from pathlib import Path - -from file_addresses import parse_file_addresses, get_z_name_for_overlay - - -def main(): - parser = argparse.ArgumentParser( - description="List generated files for the Makefile." - ) - parser.add_argument( - "-o", "--output-dir", help="Output directory", type=Path, required=True - ) - parser.add_argument( - "--config-dir", help="Config directory", type=Path, required=True - ) - - args = parser.parse_args() - - if not args.config_dir.exists(): # disassembly is not set up for this version - return - - file_addresses = parse_file_addresses(args.config_dir / "file_addresses.csv") - - generated_files = set() - for dma_file in file_addresses: - file_splits_path = args.config_dir / f"files_{dma_file.name}.csv" - if file_splits_path.exists(): - with open(file_splits_path) as f: - reader = csv.reader(f) - for row in reader: - if ( - not row # blank line - or row[2].startswith(".") # section name or .end - or row[2].endswith( - "_reloc.s" - ) # TODO: disassemble overlay reloc sections? - ): - continue - generated_files.add(row[2]) - elif dma_file.overlay_dir is not None: - z_name = get_z_name_for_overlay(dma_file.name) - generated_files.add( - f"src/overlays/{dma_file.overlay_dir}/{dma_file.name}/{z_name}.s" - ) - else: - raise Exception( - f"DMA file {dma_file.name} is not an overlay but has no file splits" - ) - - for filename in sorted(generated_files): - print(args.output_dir / filename) - - -if __name__ == "__main__": - main() diff --git a/tools/disasm_elf_msg.py b/tools/disasm_elf_msg.py deleted file mode 100644 index d2fe2bb88..000000000 --- a/tools/disasm_elf_msg.py +++ /dev/null @@ -1,256 +0,0 @@ -#!/usr/bin/env python3 - -import struct, sys - -item_ids = { - 0x00 : "ITEM_DEKU_STICK", - 0x01 : "ITEM_DEKU_NUT", - 0x02 : "ITEM_BOMB", - 0x03 : "ITEM_BOW", - 0x04 : "ITEM_ARROW_FIRE", - 0x05 : "ITEM_DINS_FIRE", - 0x06 : "ITEM_SLINGSHOT", - 0x07 : "ITEM_OCARINA_FAIRY", - 0x08 : "ITEM_OCARINA_OF_TIME", - 0x09 : "ITEM_BOMBCHU", - 0x0A : "ITEM_HOOKSHOT", - 0x0B : "ITEM_LONGSHOT", - 0x0C : "ITEM_ARROW_ICE", - 0x0D : "ITEM_FARORES_WIND", - 0x0E : "ITEM_BOOMERANG", - 0x0F : "ITEM_LENS_OF_TRUTH", - 0x10 : "ITEM_MAGIC_BEAN", - 0x11 : "ITEM_HAMMER", - 0x12 : "ITEM_ARROW_LIGHT", - 0x13 : "ITEM_NAYRUS_LOVE", - 0x14 : "ITEM_BOTTLE_EMPTY", - 0x15 : "ITEM_BOTTLE_POTION_RED", - 0x16 : "ITEM_BOTTLE_POTION_GREEN", - 0x17 : "ITEM_BOTTLE_POTION_BLUE", - 0x18 : "ITEM_BOTTLE_FAIRY", - 0x19 : "ITEM_BOTTLE_FISH", - 0x1A : "ITEM_BOTTLE_MILK_FULL", - 0x1B : "ITEM_BOTTLE_RUTOS_LETTER", - 0x1C : "ITEM_BOTTLE_BLUE_FIRE", - 0x1D : "ITEM_BOTTLE_BUG", - 0x1E : "ITEM_BOTTLE_BIG_POE", - 0x1F : "ITEM_BOTTLE_MILK_HALF", - 0x20 : "ITEM_BOTTLE_POE", - 0x21 : "ITEM_WEIRD_EGG", - 0x22 : "ITEM_CHICKEN", - 0x23 : "ITEM_ZELDAS_LETTER", - 0x24 : "ITEM_MASK_KEATON", - 0x25 : "ITEM_MASK_SKULL", - 0x26 : "ITEM_MASK_SPOOKY", - 0x27 : "ITEM_MASK_BUNNY_HOOD", - 0x28 : "ITEM_MASK_GORON", - 0x29 : "ITEM_MASK_ZORA", - 0x2A : "ITEM_MASK_GERUDO", - 0x2B : "ITEM_MASK_TRUTH", - 0x2C : "ITEM_SOLD_OUT", - 0x2D : "ITEM_POCKET_EGG", - 0x2E : "ITEM_POCKET_CUCCO", - 0x2F : "ITEM_COJIRO", - 0x30 : "ITEM_ODD_MUSHROOM", - 0x31 : "ITEM_ODD_POTION", - 0x32 : "ITEM_POACHERS_SAW", - 0x33 : "ITEM_BROKEN_GORONS_SWORD", - 0x34 : "ITEM_PRESCRIPTION", - 0x35 : "ITEM_EYEBALL_FROG", - 0x36 : "ITEM_EYE_DROPS", - 0x37 : "ITEM_CLAIM_CHECK", - 0x38 : "ITEM_BOW_FIRE", - 0x39 : "ITEM_BOW_ICE", - 0x3A : "ITEM_BOW_LIGHT", - 0x3B : "ITEM_SWORD_KOKIRI", - 0x3C : "ITEM_SWORD_MASTER", - 0x3D : "ITEM_SWORD_BIGGORON", - 0x3E : "ITEM_SHIELD_DEKU", - 0x3F : "ITEM_SHIELD_HYLIAN", - 0x40 : "ITEM_SHIELD_MIRROR", - 0x41 : "ITEM_TUNIC_KOKIRI", - 0x42 : "ITEM_TUNIC_GORON", - 0x43 : "ITEM_TUNIC_ZORA", - 0x44 : "ITEM_BOOTS_KOKIRI", - 0x45 : "ITEM_BOOTS_IRON", - 0x46 : "ITEM_BOOTS_HOVER", - 0x47 : "ITEM_BULLET_BAG_30", - 0x48 : "ITEM_BULLET_BAG_40", - 0x49 : "ITEM_BULLET_BAG_50", - 0x4A : "ITEM_QUIVER_30", - 0x4B : "ITEM_QUIVER_40", - 0x4C : "ITEM_QUIVER_50", - 0x4D : "ITEM_BOMB_BAG_20", - 0x4E : "ITEM_BOMB_BAG_30", - 0x4F : "ITEM_BOMB_BAG_40", - 0x50 : "ITEM_STRENGTH_GORONS_BRACELET", - 0x51 : "ITEM_STRENGTH_SILVER_GAUNTLETS", - 0x52 : "ITEM_STRENGTH_GOLD_GAUNTLETS", - 0x53 : "ITEM_SCALE_SILVER", - 0x54 : "ITEM_SCALE_GOLDEN", - 0x55 : "ITEM_GIANTS_KNIFE", - 0x56 : "ITEM_ADULTS_WALLET", - 0x57 : "ITEM_GIANTS_WALLET", - 0x58 : "ITEM_DEKU_SEEDS", - 0x59 : "ITEM_FISHING_POLE", - 0x5A : "ITEM_SONG_MINUET", - 0x5B : "ITEM_SONG_BOLERO", - 0x5C : "ITEM_SONG_SERENADE", - 0x5D : "ITEM_SONG_REQUIEM", - 0x5E : "ITEM_SONG_NOCTURNE", - 0x5F : "ITEM_SONG_PRELUDE", - 0x60 : "ITEM_SONG_LULLABY", - 0x61 : "ITEM_SONG_EPONA", - 0x62 : "ITEM_SONG_SARIA", - 0x63 : "ITEM_SONG_SUN", - 0x64 : "ITEM_SONG_TIME", - 0x65 : "ITEM_SONG_STORMS", - 0x66 : "ITEM_MEDALLION_FOREST", - 0x67 : "ITEM_MEDALLION_FIRE", - 0x68 : "ITEM_MEDALLION_WATER", - 0x69 : "ITEM_MEDALLION_SPIRIT", - 0x6A : "ITEM_MEDALLION_SHADOW", - 0x6B : "ITEM_MEDALLION_LIGHT", - 0x6C : "ITEM_KOKIRI_EMERALD", - 0x6D : "ITEM_GORON_RUBY", - 0x6E : "ITEM_ZORA_SAPPHIRE", - 0x6F : "ITEM_STONE_OF_AGONY", - 0x70 : "ITEM_GERUDOS_CARD", - 0x71 : "ITEM_SKULL_TOKEN", - 0x72 : "ITEM_HEART_CONTAINER", - 0x73 : "ITEM_HEART_PIECE", - 0x74 : "ITEM_DUNGEON_BOSS_KEY", - 0x75 : "ITEM_DUNGEON_COMPASS", - 0x76 : "ITEM_DUNGEON_MAP", - 0x77 : "ITEM_SMALL_KEY", - 0x78 : "ITEM_MAGIC_JAR_SMALL", - 0x79 : "ITEM_MAGIC_JAR_BIG", - 0x7A : "ITEM_HEART_PIECE_2", - 0x7B : "ITEM_INVALID_1", - 0x7C : "ITEM_INVALID_2", - 0x7D : "ITEM_INVALID_3", - 0x7E : "ITEM_INVALID_4", - 0x7F : "ITEM_INVALID_5", - 0x80 : "ITEM_INVALID_6", - 0x81 : "ITEM_INVALID_7", - 0x82 : "ITEM_MILK", - 0x83 : "ITEM_RECOVERY_HEART", - 0x84 : "ITEM_RUPEE_GREEN", - 0x85 : "ITEM_RUPEE_BLUE", - 0x86 : "ITEM_RUPEE_RED", - 0x87 : "ITEM_RUPEE_PURPLE", - 0x88 : "ITEM_RUPEE_GOLD", - 0x89 : "ITEM_INVALID_8", - 0x8A : "ITEM_DEKU_STICKS_5", - 0x8B : "ITEM_DEKU_STICKS_10", - 0x8C : "ITEM_DEKU_NUTS_5", - 0x8D : "ITEM_DEKU_NUTS_10", - 0x8E : "ITEM_BOMBS_5", - 0x8F : "ITEM_BOMBS_10", - 0x90 : "ITEM_BOMBS_20", - 0x91 : "ITEM_BOMBS_30", - 0x92 : "ITEM_ARROWS_5", - 0x93 : "ITEM_ARROWS_10", - 0x94 : "ITEM_ARROWS_30", - 0x95 : "ITEM_DEKU_SEEDS_30", - 0x96 : "ITEM_BOMBCHUS_5", - 0x97 : "ITEM_BOMBCHUS_20", - 0x98 : "ITEM_DEKU_STICK_UPGRADE_20", - 0x99 : "ITEM_DEKU_STICK_UPGRADE_30", - 0x9A : "ITEM_DEKU_NUT_UPGRADE_30", - 0x9B : "ITEM_DEKU_NUT_UPGRADE_40", - 0xFC : "ITEM_SWORD_CS", - 0xFE : "ITEM_NONE_FE", - 0xFF : "ITEM_NONE", -} - -def disas_elfmsgs(start): - baserom = None - with open("baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", "rb") as infile: - baserom = bytearray(infile.read()) - - branches = [] - pos = start - - while (True): - print(f"/* {pos - start:04X} {((pos - start) // 4):3} */ ", end="") - - b0, b1, b2, b3 = struct.unpack(">BBBB", baserom[pos:pos+4]) - - elf_message_types = { - 0x00: "CHECK", - 0x20: "UNK_1", - 0x40: "UNK_2", - 0x60: "SKIP", - 0xE0: "END", - } - - cont = True - branch_to = None - - # Get Type - - elf_message_type = b0 & 0xE0 - ARG_0 = elf_message_types[elf_message_type] - - if elf_message_type in [0, 0x20, 0x40, 0xE0]: - if elf_message_type == 0xE0: - cont = False - ARG_1 = f"0x{(b2 & 0xFF):04X}" - elif elf_message_type == 0x60: - branch_to = 4 * (b2 & 0xFF) - ARG_1 = (b2 & 0xFF) - else: - assert False , "Encountered unknown type" - - ARG_2 = f"{bool(b0 & 1)}".lower() - - # Get condition - condition_type = b0 & 0x1E - - if condition_type == 0: - if elf_message_type == 0xE0 and b1 == 0 and not (b0 & 1): - print(f"QUEST_HINT_END({ARG_1}),") - else: - print(f"QUEST_HINT_FLAG({ARG_0}, {ARG_1}, {ARG_2}, 0x{b1:02X}), /* eventChkInf[{(b1 >> 4) & 0xF}] & 0x{1 << (b1 & 0xF):X} */") - assert b3 == 0 - elif condition_type == 2: - print(f"QUEST_HINT_DUNGEON_ITEM({ARG_0}, {ARG_1}, {ARG_2}, {item_ids[b1]}),") - assert b3 == 0 - elif condition_type == 4: - print(f"QUEST_HINT_ITEM({ARG_0}, {ARG_1}, {ARG_2}, {item_ids[b1]}, {item_ids[b3]}),") - elif condition_type == 6: - condition_other_type = b1 & 0xF0 - - if condition_other_type == 0: - print(f"QUEST_HINT_STRENGTH_UPG({ARG_0}, {ARG_1}, {ARG_2}, {b1 & 0xF}),") - assert b3 == 0 - elif condition_other_type == 0x10: - print(f"QUEST_HINT_BOOTS({ARG_0}, {ARG_1}, {ARG_2}, {item_ids[b3]}),") - assert (b1 & 0xF) == 0 - elif condition_other_type == 0x20: - print(f"QUEST_HINT_SONG({ARG_0}, {ARG_1}, {ARG_2}, {item_ids[b3]}),") - assert (b1 & 0xF) == 0 - elif condition_other_type == 0x30: - print(f"QUEST_HINT_MEDALLION({ARG_0}, {ARG_1}, {ARG_2}, {item_ids[b3]}),") - assert (b1 & 0xF) == 0 - elif condition_other_type == 0x40: - print(f"QUEST_HINT_MAGIC({ARG_0}, {ARG_1}, {ARG_2}),") - assert (b1 & 0xF) == 0 - assert b3 == 0 - else: - assert False , "Encountered unknown condition (other) type" - else: - assert False , "Encountered unknown condition type" - - # Control flow - - if branch_to is not None: - branches.append(branch_to) - pos += 4 - if not cont: - print("") - if not cont and all([dst < pos - start for dst in branches]): - break - -disas_elfmsgs(int(sys.argv[1],16)) diff --git a/tools/dmadata.py b/tools/dmadata.py new file mode 100644 index 000000000..06b9ae755 --- /dev/null +++ b/tools/dmadata.py @@ -0,0 +1,83 @@ +# SPDX-FileCopyrightText: © 2024 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from __future__ import annotations + +import dataclasses +import struct + + +STRUCT_IIII = struct.Struct(">IIII") + + +@dataclasses.dataclass +class DmaEntry: + """ + A Python counterpart to the dmadata entry struct: + ```c + typedef struct { + /* 0x00 */ uintptr_t vromStart; + /* 0x04 */ uintptr_t vromEnd; + /* 0x08 */ uintptr_t romStart; + /* 0x0C */ uintptr_t romEnd; + } DmaEntry; + ``` + """ + + vrom_start: int + vrom_end: int + rom_start: int + rom_end: int + + def __repr__(self): + return ( + "DmaEntry(" + f"vrom_start=0x{self.vrom_start:08X}, " + f"vrom_end=0x{self.vrom_end:08X}, " + f"rom_start=0x{self.rom_start:08X}, " + f"rom_end=0x{self.rom_end:08X}" + ")" + ) + + SIZE_BYTES = STRUCT_IIII.size + + def to_bin(self, data: memoryview): + STRUCT_IIII.pack_into( + data, + 0, + self.vrom_start, + self.vrom_end, + self.rom_start, + self.rom_end, + ) + + @staticmethod + def from_bin(data: memoryview): + return DmaEntry(*STRUCT_IIII.unpack_from(data)) + + def is_compressed(self) -> bool: + return self.rom_end != 0 + + def is_syms(self) -> bool: + """ + "SYMS" DMA entries describe segments that are always filled with 0's in the ROM. + The DMA entry has both rom_start and rom_end set to 0xFFFFFFFF, where the actual rom start and end is given by vrom_start and vrom_end instead. + These zeroed segments are used to record the offsets/sizes of subfiles in compressed yaz0 archive files but are not used by the game directly. + """ + return self.rom_start == 0xFFFFFFFF and self.rom_end == 0xFFFFFFFF + + +DMA_ENTRY_END = DmaEntry(0, 0, 0, 0) + + +def read_dmadata(rom_data: memoryview, start_offset: int) -> list[DmaEntry]: + result = [] + + offset = start_offset + while ( + entry := DmaEntry.from_bin(rom_data[offset : offset + DmaEntry.SIZE_BYTES]) + ) != DMA_ENTRY_END: + result.append(entry) + offset += DmaEntry.SIZE_BYTES + + return result diff --git a/tools/dmadata_range.sh b/tools/dmadata_start.sh similarity index 71% rename from tools/dmadata_range.sh rename to tools/dmadata_start.sh index 905322c9c..920d9fe0b 100755 --- a/tools/dmadata_range.sh +++ b/tools/dmadata_start.sh @@ -11,6 +11,5 @@ ELF=$2 dmadata_syms=`$NM $ELF --no-sort --radix=x --format=bsd | grep dmadata` _dmadataSegmentRomStart=`echo "$dmadata_syms" | grep '\b_dmadataSegmentRomStart\b' | cut -d' ' -f1` -_dmadataSegmentRomEnd=` echo "$dmadata_syms" | grep '\b_dmadataSegmentRomEnd\b' | cut -d' ' -f1` -echo 0x"$_dmadataSegmentRomStart"-0x"$_dmadataSegmentRomEnd" +echo 0x"$_dmadataSegmentRomStart" diff --git a/tools/elf2rom.c b/tools/elf2rom.c index 907e4e32b..21c5337ba 100644 --- a/tools/elf2rom.c +++ b/tools/elf2rom.c @@ -33,12 +33,6 @@ static bool parse_number(const char *str, int *num) return endptr > str; } -static unsigned int round_up(unsigned int num, unsigned int multiple) -{ - num += multiple - 1; - return num / multiple * multiple; -} - static char *sprintf_alloc(const char *fmt, ...) { va_list args; @@ -163,11 +157,10 @@ static void parse_input_file(const char *filename) free(syms); } -// Writes the N64 ROM, padding the file size to a multiple of 1 MiB +// Writes the N64 ROM static void write_rom_file(const char *filename, int cicType) { - size_t fileSize = round_up(g_romSize, 0x100000); - uint8_t *buffer = calloc(fileSize, 1); + uint8_t *buffer = calloc(g_romSize, 1); int i; uint32_t chksum[2]; @@ -179,16 +172,13 @@ static void write_rom_file(const char *filename, int cicType) memcpy(buffer + g_romSegments[i].romStart, g_romSegments[i].data, size); } - // pad the remaining space with 0xFF - memset(buffer + g_romSize, 0xFF, fileSize - g_romSize); - // write checksum if (!n64chksum_calculate(buffer, cicType, chksum)) util_fatal_error("invalid cic type %i", cicType); util_write_uint32_be(buffer + 0x10, chksum[0]); util_write_uint32_be(buffer + 0x14, chksum[1]); - util_write_whole_file(filename, buffer, fileSize); + util_write_whole_file(filename, buffer, g_romSize); free(buffer); } diff --git a/tools/extract_baserom.py b/tools/extract_baserom.py new file mode 100755 index 000000000..1d62f8c06 --- /dev/null +++ b/tools/extract_baserom.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 + +# SPDX-FileCopyrightText: © 2024 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +from __future__ import annotations + +import argparse +from pathlib import Path +import sys + +import dmadata + + +def main(): + parser = argparse.ArgumentParser( + description="Extract segments from an uncompressed ROM, based on its dmadata." + ) + parser.add_argument( + "rom", metavar="ROM", type=Path, help="Path to uncompressed ROM" + ) + parser.add_argument( + "-o", + "--output-dir", + type=Path, + required=True, + help="Output directory for segments", + ) + parser.add_argument( + "--dmadata-start", + type=lambda s: int(s, 16), + required=True, + help=( + "The dmadata location in the rom, as a hexadecimal offset (e.g. 0x12f70)" + ), + ) + parser.add_argument( + "--dmadata-names", + type=Path, + required=True, + help="Path to file containing segment names", + ) + + args = parser.parse_args() + + rom_data = memoryview(args.rom.read_bytes()) + + dma_names = args.dmadata_names.read_text().splitlines() + dma_entries = dmadata.read_dmadata(rom_data, args.dmadata_start) + if len(dma_names) != len(dma_entries): + print( + f"Error: expected {len(dma_names)} DMA entries but found {len(dma_entries)} in ROM", + file=sys.stderr, + ) + exit(1) + + args.output_dir.mkdir(parents=True, exist_ok=True) + for dma_name, dma_entry in zip(dma_names, dma_entries): + if dma_entry.is_syms(): + segment_rom_start = dma_entry.vrom_start + elif not dma_entry.is_compressed(): + segment_rom_start = dma_entry.rom_start + else: # Segment compressed + print(f"Error: segment {dma_name} is compressed", file=sys.stderr) + exit(1) + + segment_rom_end = segment_rom_start + ( + dma_entry.vrom_end - dma_entry.vrom_start + ) + + segment_data = rom_data[segment_rom_start:segment_rom_end] + segment_path = args.output_dir / dma_name + segment_path.write_bytes(segment_data) + + print(f"Extracted {len(dma_entries)} segments to {args.output_dir}") + + +if __name__ == "__main__": + main() diff --git a/tools/fado/.gitrepo b/tools/fado/.gitrepo index 0f548ed09..5fac8601d 100644 --- a/tools/fado/.gitrepo +++ b/tools/fado/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:EllipticEllipsis/fado.git branch = master - commit = 8d896ee97d565508755584803c409fc33bb0c953 - parent = 9f09505d34619883748a7dab05071883281c14fd + commit = 7fad57f834a86b6a752292996f99f08771f29df4 + parent = 17d683780d3878159959a87a9c4a2683d8781ef2 method = merge - cmdver = 0.4.5 + cmdver = 0.4.6 diff --git a/tools/fado/Makefile b/tools/fado/Makefile index 135f51251..8f61a209e 100644 --- a/tools/fado/Makefile +++ b/tools/fado/Makefile @@ -57,7 +57,7 @@ clean: $(RM) -r build $(ELF) format: - clang-format-11 -i $(C_FILES) $(H_FILES) lib/fairy/* + clang-format-14 -i $(C_FILES) $(H_FILES) lib/fairy/* .PHONY: all clean format diff --git a/tools/fado/include/mips_elf.h b/tools/fado/include/mips_elf.h index 122e98d25..f76a69b79 100644 --- a/tools/fado/include/mips_elf.h +++ b/tools/fado/include/mips_elf.h @@ -476,9 +476,9 @@ typedef struct { /* Relocation table entry with addend (in section of type SHT_RELA). */ typedef struct { - Elf32_Addr r_offset; /* Address */ - Elf32_Word r_info; /* Relocation type and symbol index */ - Elf32_Sword r_addend; /* Addend */ + Elf32_Addr r_offset; /* Address */ + Elf32_Word r_info; /* Relocation type and symbol index */ + Elf32_Sword r_addend; /* Addend */ } Elf32_Rela; /* How to extract and insert information held in the r_info field. */ diff --git a/tools/fado/lib/fairy/fairy_print.c b/tools/fado/lib/fairy/fairy_print.c index 80b8fcd9e..0d0480225 100644 --- a/tools/fado/lib/fairy/fairy_print.c +++ b/tools/fado/lib/fairy/fairy_print.c @@ -368,7 +368,7 @@ void Fairy_PrintSectionSizes(FairySecHeader* sectionTable, FILE* inputFile, size } } /* Can use symbols here too */ - puts(".section .ovl"); + puts(".section .ovl, \"a\""); printf("# OverlayInfo\n"); printf(".word 0x%08X # .text size\n", textSize); printf(".word 0x%08X # .data size\n", dataSize); diff --git a/tools/fado/src/fado.c b/tools/fado/src/fado.c index 464f8855b..f6daaaa1c 100644 --- a/tools/fado/src/fado.c +++ b/tools/fado/src/fado.c @@ -17,16 +17,6 @@ /* String-finding-related functions */ -bool Fado_CheckInProgBitsSections(Elf32_Section section, vc_vector* progBitsSections) { - Elf32_Section* i; - VC_FOREACH(i, progBitsSections) { - if (*i == section) { - return true; - } - } - return false; -} - /** * For each input file, construct a vector of pointers to the starts of the strings defined in that file. */ @@ -41,8 +31,7 @@ void Fado_ConstructStringVectors(vc_vector** stringVectors, FairyFileInfo* fileI /* Build a vector of pointers to defined symbols' names */ for (currentSym = 0; currentSym < fileInfo[currentFile].symtabInfo.sectionEntryCount; currentSym++) { - if ((symtab[currentSym].st_shndx != STN_UNDEF) && - Fado_CheckInProgBitsSections(symtab[currentSym].st_shndx, fileInfo[currentFile].progBitsSections)) { + if (symtab[currentSym].st_shndx != STN_UNDEF) { /* Have to pass a double pointer so it copies the pointer instead of the start of the string */ char* stringPtr = &fileInfo[currentFile].strtab[symtab[currentSym].st_name]; assert(vc_vector_push_back(stringVectors[currentFile], &stringPtr)); @@ -251,7 +240,7 @@ void Fado_Relocs(FILE* outputFile, int inputFilesCount, FILE** inputFiles, const { /* Write header */ - fprintf(outputFile, ".section .ovl\n"); + fprintf(outputFile, ".section .ovl, \"a\"\n"); fprintf(outputFile, "# %sOverlayInfo\n", ovlName); fprintf(outputFile, ".word _%sSegmentTextSize\n", ovlName); fprintf(outputFile, ".word _%sSegmentDataSize\n", ovlName); diff --git a/tools/fado/src/version.inc b/tools/fado/src/version.inc index 9bc9fbf30..5e46b03ef 100644 --- a/tools/fado/src/version.inc +++ b/tools/fado/src/version.inc @@ -1,5 +1,5 @@ /* Copyright (C) 2021 Elliptic Ellipsis */ /* SPDX-License-Identifier: AGPL-3.0-only */ -const char versionNumber[] = "1.3.1"; +const char versionNumber[] = "1.3.2"; const char credits[] = "Written by Elliptic Ellipsis\nwith additions from AngheloAlf and Tharo"; const char repo[] = "https://github.com/EllipticEllipsis/fado/"; diff --git a/tools/gdb_load_ovl.py b/tools/gdb_load_ovl.py new file mode 100644 index 000000000..470b9c7f0 --- /dev/null +++ b/tools/gdb_load_ovl.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 + +# Author: Fig +# Work based off of HailToDodongo's original tool: +# https://github.com/HailToDodongo/oot/blob/daea8bacb27425a7dd8923dea6e0467ba68d1047/gdb_script.py +# Written with the help of Thar0 +# License: CC0 (https://creativecommons.org/publicdomain/zero/1.0/) + +import gdb +import re + +TYPE_U32 = gdb.lookup_type('u32') + +# address to object-path map, used to unload entire .o files by an address +obj_address_map = {} + +def get_section_address(ovl_name, section_name): + section_start_name = "_" + ovl_name + "Segment" + section_name + "Start" + # 'section_start_name' is a 'text variable' according to gdb, this can not be resolved via python directly + return int(gdb.execute('printf "%x", &' + section_start_name, False, True), 16) + +def AddOverlaySymbols(overlay_table, index): + alloc_address = int(overlay_table[index]["loadedRamAddr"].cast(TYPE_U32)) + + if alloc_address == 0: + print("ERROR: Requested overlay is not currently loaded") + return + + vram_address = int(overlay_table[index]["vramStart"].cast(TYPE_U32)) + + # get first symbol-name starting from vramStart (usually the first function in the overlay) + target_func_name = gdb.execute(f"info symbol {vram_address}", False, True).partition(' ')[0].rstrip() + + # get section in main ELF (returns: "EnKusa_SetupAction in section ..ovl_En_Kusa of zelda_ocarina_mq_dbg.elf") + ovl_sec_name = gdb.execute("info sym " + target_func_name, False, True) + # extract section name (@TODO: check if there is a direct API for this) + ovl_sec_name = ovl_sec_name.partition('section ..')[2].partition(" ")[0].rstrip() + + ovl_address_text = get_section_address(ovl_sec_name, "Text") + ovl_address_data = get_section_address(ovl_sec_name, "Data") + ovl_address_rodata = get_section_address(ovl_sec_name, "RoData") + ovl_address_bss = get_section_address(ovl_sec_name, "Bss") + + ovl_offset_text = alloc_address + ovl_offset_data = alloc_address + (ovl_address_data - ovl_address_text) + ovl_offset_rodata = alloc_address + (ovl_address_rodata - ovl_address_text) + ovl_offset_bss = alloc_address + (ovl_address_bss - ovl_address_text) + + # get full object-file path that contains the first symbol + target_filename = gdb.lookup_symbol(target_func_name)[0].symtab.filename + obj_name = "build/hackeroot-mq/" + target_filename[:-1] + "o" + + pattern = r'[^/]*$' + matches = re.findall(pattern, obj_name) + ovl_name = matches[0] + + obj_address_map[hex(alloc_address)] = obj_name + print("Reading " + ovl_name[:-2] + "...") + + gdb.execute("add-symbol-file -readnow " + obj_name + + " -o 0xFF000000" + + " -s .text " + hex(ovl_offset_text) + + " -s .data " + hex(ovl_offset_data) + + " -s .rodata " + hex(ovl_offset_rodata) + + " -s .bss " + hex(ovl_offset_bss), + False, True) + + print("Complete.") + +class LoadOvlCmd(gdb.Command): + def __init__(self): + super().__init__("ovl", gdb.COMMAND_DATA, gdb.COMPLETE_EXPRESSION) + print("INFO: gdb_load_ovl: welcome!") + + def invoke(self, arg, from_tty): + arg = arg.upper() + + if arg == "PAUSE" or arg == "KALEIDO" or arg == "KALEIDO_SCOPE": + # Pause menu does not have an enum, special case it. Index is 0 in `gKaleidoMgrOverlayTable` + table = gdb.lookup_global_symbol("gKaleidoMgrOverlayTable").value() + AddOverlaySymbols(table, 0) + elif arg == "ACTOR_PLAYER": + # Player's index does not correspond to his actor ID, Special case it. Index is 1 in `gKaleidoMgrOverlayTable` + table = gdb.lookup_global_symbol("gKaleidoMgrOverlayTable").value() + AddOverlaySymbols(table, 1) + else: + pattern = r'^([^_]+)' + matches = re.findall(pattern, arg) + ovl_type = matches[0] + + if ovl_type == "GAMESTATE": + table = gdb.lookup_global_symbol("gGameStateOverlayTable").value() + elif ovl_type == "ACTOR": + table = gdb.lookup_global_symbol("gActorOverlayTable").value() + elif ovl_type == "EFFECT": + table = gdb.lookup_global_symbol("gEffectSsOverlayTable").value() + else: + print("ERROR: Type of enum provided is not supported") + return + + # try to get the index from the elf via gdb + try: + index = gdb.lookup_symbol(arg)[0].value().cast(TYPE_U32) + except: + print("ERROR: Provided enum value could not be found in the elf") + return + + + AddOverlaySymbols(table, index) + +LoadOvlCmd() diff --git a/tools/gzinject/.gitattributes b/tools/gzinject/.gitattributes new file mode 100644 index 000000000..66cccc58a --- /dev/null +++ b/tools/gzinject/.gitattributes @@ -0,0 +1,65 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain +*.h linguist-language=C +*.c linguist-language=C diff --git a/tools/gzinject/.gitignore b/tools/gzinject/.gitignore new file mode 100644 index 000000000..9ed774981 --- /dev/null +++ b/tools/gzinject/.gitignore @@ -0,0 +1,279 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Testing File +*.Wad +TestExtract/ +*.exe +*.stackdump +/gzinject/Debug +/gzinject.zip +*.bin +Debug/ +CppProperties.json +wadextract/ +*.o +Makefile +config.* +gzinject +*.zip +autom4te.cache/ \ No newline at end of file diff --git a/tools/gzinject/BUILDING.md b/tools/gzinject/BUILDING.md new file mode 100644 index 000000000..7fb64a1c3 --- /dev/null +++ b/tools/gzinject/BUILDING.md @@ -0,0 +1,8 @@ +## Prerequisites + +gcc, make + +## Building +Run `./configure` You can use `--prefx=DIR` to specify the output directory, install will install gzinject to `DIR/bin`, then run `make` to build the executable, and `make install` to install it to `DIR/bin` + +By default gzinject will use the crypto library provided by OpenSSL, to disable this and use builtin (slower) crypto functions remove `-D_USE_LIBCRYPTO` From the make file, and change SRC = gzinject.c to SRC = *.c diff --git a/tools/gzinject/LICENSE b/tools/gzinject/LICENSE new file mode 100644 index 000000000..94a9ed024 --- /dev/null +++ b/tools/gzinject/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/tools/gzinject/Makefile.in b/tools/gzinject/Makefile.in new file mode 100644 index 000000000..92b57f7ca --- /dev/null +++ b/tools/gzinject/Makefile.in @@ -0,0 +1,39 @@ +CC = @CC@ +LD = @CC@ +INSTALL = @INSTALL@ +CFLAGS = -Wall -Wno-unused-result @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +PROGNAME = gzinject +LDFLAGS = -s @LDFLAGS@ +CFILES = *.c +SRCDIR = src +CSRC := $(foreach s,$(CFILES),$(wildcard $(SRCDIR)/$(s))) +COBJ = $(patsubst $(SRCDIR)/%,$(OBJDIR)/%.o,$(CSRC)) +LIBS = +OBJDIR = obj +OUTDIR = $(OBJDIR) + +.PHONY : all install clean distclean + +all : $(PROGNAME) + +clean : + rm -rf $(PROGNAME) obj + +distclean : clean + rm -f Makefile + +install : $(PROGNAME) + $(INSTALL) -p -D --target-directory=$(DESTDIR)$(bindir) $(PROGNAME) + +$(PROGNAME) : $(COBJ) + $(LD) $(LDFLAGS) $^ -o $@ $(LIBS) + +$(OUTDIR) : + mkdir -p $@ + +$(COBJ) : $(OBJDIR)/%.o: $(SRCDIR)/% | $(OBJDIR) + $(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ diff --git a/tools/gzinject/README.md b/tools/gzinject/README.md new file mode 100644 index 000000000..a3893a7d2 --- /dev/null +++ b/tools/gzinject/README.md @@ -0,0 +1,74 @@ +## About + +gzinject is a wad editing utility, primarily used for patching N64 VC Emulators, and replacing the rom inside. gzinject uses patch files to patch content files within the wad. A description of the patch file format can be seen in the [Patch](#Patch) section. + +## Executable + +To build your own, run ./configure, then make, and make install. See BUILDING for more instructions + +Prebuilt Windows executable is contained under releases (https://github.com/krimtonz/gzinject/releases/latest) + +## Usage +``` +Usage: + gzinject -a extract -w SOURCEWAD [options] + gzinject -a pack -w DESTWAD [options] + gzinject -a inject -w SOURCEWAD -m ROM [options] + gzinject -a genkey [options] + gzinject --help + gzinject --version + +Actions: + extract extracts SOURCEWAD to directory + pack packs directory into DESTWAD + inject injects rom into SOURCEWAD + genkey generates wii common-key + +Options: + -i, --channelid=ID New Channel ID For Pack and Inject actions (default: none) + -t, --title=title New Channel name for pack and inject actions (default: none) + -h, --help Prints this help message + -k, --key=keyfile Location of the common-key file (default: common-key.bin) + -r, --region=1-3 Region to use (default: 3) + --verbose Print out verbose program execution information + -d, --directory=directory Directory to extract contents to, or directory to read contents from (default: wadextract) + --cleanup Remove files before performing actions + --version Prints the current version + -m, --rom=rom Rom to inject for inject action (default: none) + -o, --outputwad=outwad The output wad for inject actions (default: SOURCEWAD-inject.wad) + -p, --patch-file=patchfile gzi file to use for applying patches (default: none) + -c, --content=contentfile the primary content file (default: 5) + --dol-inject Binary data to inject into the emulator program, requires --dol-loading + --dol-loading The loading address for the binary specified by --dol-inject + --dol-after After which patch file to inject the dol, default: after all patches +``` + +## Patch +gzi files are text files with a command on each line. A # starting the line indicates a comment. + +line format: +ccss oooooooo dddddddd\ +Where c indicates the command, s indicates the data size, o indicates the offset into the current file, and d indicates the data to replace with. + +``` +Commands: + 00: Begin using content file specified by d, offset and size are not used for this command + 01: lz77 decompress the current content file. offset, size, and data are not used for this command + 02: lz77 compress the current content file. offset, size, and data are not used for this command + 03: apply patch to currently selected file. If offset is higher than the file sizes, or a current file has not been selected, the patch is not applied + +Sizes: + 01: a one byte value. data & 0x000000FF is applied to content + offset + 02: a two byte value. data & 0x0000FFFF is applied to content + offset + 04: a four byte value. data is applied to content + offset +``` + + +## Thanks/Authors + +gzinject was primarily written by me.\n +Thanks to glankk (https://github.com/glankk) for providing memory/controller fixes for OOT as well as debugging, testing, and providing fixes for various errors\ +The general workflow of extracting/packing the wad was taken from showmiiwads (https://github.com/dnasdw/showmiiwads/)\ +AES encryption/decryption was taken from kokke (https://github.com/kokke/tiny-AES-c)\ +SHA1 taken from clibs (https://github.com/clibs/sha1)\ +MD5 taken from Alexander Peslyak http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 diff --git a/tools/gzinject/configure b/tools/gzinject/configure new file mode 100755 index 000000000..b9f5c308f --- /dev/null +++ b/tools/gzinject/configure @@ -0,0 +1,4468 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69. +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= +PACKAGE_URL= + +ac_default_prefix=/usr/local +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +EGREP +GREP +CPP +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +CFLAGS="-O3" + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in wmmintrin.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "wmmintrin.h" "ac_cv_header_wmmintrin_h" "$ac_includes_default" +if test "x$ac_cv_header_wmmintrin_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_WMMINTRIN_H 1 +_ACEOF + + CFLAGS+=" -maes -msse -msse2" + CPPFLAGS="-DFASTAES" + + +fi + +done + +ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/tools/gzinject/configure.ac b/tools/gzinject/configure.ac new file mode 100644 index 000000000..bf8d7008d --- /dev/null +++ b/tools/gzinject/configure.ac @@ -0,0 +1,14 @@ +AC_PREREQ([2.69]) +AC_INIT +AC_PREFIX_DEFAULT([/usr/local]) +AC_PROG_CC +AC_PROG_INSTALL +CFLAGS="-O3" +AC_CHECK_HEADERS([wmmintrin.h], + [ + CFLAGS+=" -maes -msse -msse2" + CPPFLAGS="-DFASTAES" + ] +) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/tools/gzinject/install-sh b/tools/gzinject/install-sh new file mode 100755 index 000000000..0360b79e7 --- /dev/null +++ b/tools/gzinject/install-sh @@ -0,0 +1,501 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2016-01-11.22; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/tools/gzinject/patches/NACE.gzi b/tools/gzinject/patches/NACE.gzi new file mode 100644 index 000000000..30ab26f55 --- /dev/null +++ b/tools/gzinject/patches/NACE.gzi @@ -0,0 +1,6 @@ +# default gz patches for NACE +0000 00000000 00000001 +# use 8MB memory +0304 00002EB0 60000000 +# allocate 32MB for rom +0304 0005BFD4 3C807200 diff --git a/tools/gzinject/patches/NACJ.gzi b/tools/gzinject/patches/NACJ.gzi new file mode 100644 index 000000000..28415cb8f --- /dev/null +++ b/tools/gzinject/patches/NACJ.gzi @@ -0,0 +1,6 @@ +# default gz patches for NACJ +0000 00000000 00000001 +# use 8MB memory +0304 00002EB0 60000000 +# allocate 32MB for rom +0304 0005BF44 3C807200 diff --git a/tools/gzinject/patches/NKZE.gzi b/tools/gzinject/patches/NKZE.gzi new file mode 100644 index 000000000..440cbee08 --- /dev/null +++ b/tools/gzinject/patches/NKZE.gzi @@ -0,0 +1,16 @@ +# NKZE kz-NZSE +0000 00000000 00000001 +# decompress content1 +0100 00000000 00000000 +# apply 12MB fixes +0304 00010B58 3C8000C0 +0304 0004BD20 67E47000 +0304 0004BC80 3CA00100 +# apply controller remappings +0302 00148514 00000800 +0302 00148518 00000400 +0302 0014851C 00000200 +0302 00148520 00000100 +0302 00148528 00000020 +# compress content1 +0200 00000000 00000000 \ No newline at end of file diff --git a/tools/gzinject/patches/NKZJ.gzi b/tools/gzinject/patches/NKZJ.gzi new file mode 100644 index 000000000..d2ee665dd --- /dev/null +++ b/tools/gzinject/patches/NKZJ.gzi @@ -0,0 +1,16 @@ +# NKZJ kz-NZSJ +0000 00000000 00000001 +# decompress content1 +0100 00000000 00000000 +# apply 12MB fixes +0304 00010B58 3C8000C0 +0304 0004BD94 67E47000 +0304 0004BCF4 3CA00100 +# apply controller remappings +0302 0014AA54 00000800 +0302 0014AA58 00000400 +0302 0014AA5C 00000200 +0302 0014AA60 00000100 +0302 0014AA68 00000020 +# compress content1 +0200 00000000 00000000 \ No newline at end of file diff --git a/tools/gzinject/patches/gz_default_remap.gzi b/tools/gzinject/patches/gz_default_remap.gzi new file mode 100644 index 000000000..22b857ac4 --- /dev/null +++ b/tools/gzinject/patches/gz_default_remap.gzi @@ -0,0 +1,9 @@ +# gz standard remapping for NACE and NACJ +0000 00000000 00000001 +# apply d-pad remappings +0302 0016BAF0 00000800 +0302 0016BAF4 00000400 +0302 0016BAF8 00000200 +0302 0016BAFC 00000100 +# apply c-stick remapping +0302 0016BB04 00000020 diff --git a/tools/gzinject/patches/gz_raphnet_remap.gzi b/tools/gzinject/patches/gz_raphnet_remap.gzi new file mode 100644 index 000000000..61e1a968c --- /dev/null +++ b/tools/gzinject/patches/gz_raphnet_remap.gzi @@ -0,0 +1,9 @@ +# gz raphnet remapping for NACE and NACJ +0000 00000000 00000001 +# apply d-pad remappings +0302 0016BAF0 00000800 +0302 0016BAF4 00000400 +0302 0016BAF8 00000200 +0302 0016BAFC 00000100 +# apply z-trigger remapping +0302 0016BAD8 00000020 diff --git a/tools/gzinject/patches/hb_NACE.gzi b/tools/gzinject/patches/hb_NACE.gzi new file mode 100644 index 000000000..dccad2e18 --- /dev/null +++ b/tools/gzinject/patches/hb_NACE.gzi @@ -0,0 +1,15 @@ +# homeboy patches for NACE +0000 00000000 00000001 +# resize MEM2 heap for homeboy +0302 00085732 00009010 +0304 00085738 60000000 +0304 00085744 60000000 +# homeboy hook +0304 00002EA8 3c809000 +0304 00002EAC 38840800 +0304 00002EB0 7c8903a6 +0304 00002EB4 80630018 +0304 00002EB8 4e800421 +# Change iOS to 61 +0000 00000000 00000064 +0301 0000018B 0000003D \ No newline at end of file diff --git a/tools/gzinject/patches/hb_NACJ.gzi b/tools/gzinject/patches/hb_NACJ.gzi new file mode 100644 index 000000000..0e852695d --- /dev/null +++ b/tools/gzinject/patches/hb_NACJ.gzi @@ -0,0 +1,15 @@ +# homeboy patches for NACJ +0000 00000000 00000001 +# resize MEM2 heap for homeboy +0302 00085726 00009010 +0304 0008572C 60000000 +0304 00085738 60000000 +# homeboy hook +0304 00002EA8 3c809000 +0304 00002EAC 38840800 +0304 00002EB0 7c8903a6 +0304 00002EB4 80630018 +0304 00002EB8 4e800421 +# Change iOS to 61 +0000 00000000 00000064 +0301 0000018B 0000003D \ No newline at end of file diff --git a/tools/gzinject/patches/ootr_dpad_remap.gzi b/tools/gzinject/patches/ootr_dpad_remap.gzi new file mode 100644 index 000000000..57fcb9256 --- /dev/null +++ b/tools/gzinject/patches/ootr_dpad_remap.gzi @@ -0,0 +1,6 @@ +# ootr remapping for NACE and NACJ +0000 00000000 00000001 +# apply d-pad remappings +0302 0016BAF4 00000400 +0302 0016BAF8 00000200 +0302 0016BAFC 00000100 diff --git a/tools/gzinject/src/aes.c b/tools/gzinject/src/aes.c new file mode 100644 index 000000000..f7701f0a8 --- /dev/null +++ b/tools/gzinject/src/aes.c @@ -0,0 +1,567 @@ +/* + +This is an implementation of the AES algorithm, specifically ECB, CTR and CBC mode. +Block size can be chosen in aes.h - available choices are AES128, AES192, AES256. + +The implementation is verified against the test vectors in: +National Institute of Standards and Technology Special Publication 800-38A 2001 ED + +ECB-AES128 +---------- + +plain-text: +6bc1bee22e409f96e93d7e117393172a +ae2d8a571e03ac9c9eb76fac45af8e51 +30c81c46a35ce411e5fbc1191a0a52ef +f69f2445df4f9b17ad2b417be66c3710 + +key: +2b7e151628aed2a6abf7158809cf4f3c + +resulting cipher +3ad77bb40d7a3660a89ecaf32466ef97 +f5d3d58503b9699de785895a96fdbaaf +43b1cd7f598ece23881b00e3ed030688 +7b0c785e27e8ad3f8223207104725dd4 + + +NOTE: String length must be evenly divisible by 16byte (str_len % 16 == 0) +You should pad the end of the string with zeros if this is not the case. +For AES192/256 the key size is proportionally larger. + +*/ + + +/*****************************************************************************/ +/* Includes: */ +/*****************************************************************************/ +#include +#include // CBC mode, for memset +#include "aes.h" + +/*****************************************************************************/ +/* Defines: */ +/*****************************************************************************/ +// The number of columns comprising a state in AES. This is a constant in AES. Value=4 +#define Nb 4 + +#if defined(AES256) && (AES256 == 1) +#define Nk 8 +#define Nr 14 +#elif defined(AES192) && (AES192 == 1) +#define Nk 6 +#define Nr 12 +#else +#define Nk 4 // The number of 32 bit words in a key. +#define Nr 10 // The number of rounds in AES Cipher. +#endif + +// jcallan@github points out that declaring Multiply as a function +// reduces code size considerably with the Keil ARM compiler. +// See this link for more information: https://github.com/kokke/tiny-AES-C/pull/3 +#ifndef MULTIPLY_AS_A_FUNCTION +#define MULTIPLY_AS_A_FUNCTION 0 +#endif + + + + +/*****************************************************************************/ +/* Private variables: */ +/*****************************************************************************/ +// state - array holding the intermediate results during decryption. +typedef uint8_t state_t[4][4]; + + + +// The lookup-tables are marked const so they can be placed in read-only storage instead of RAM +// The numbers below can be computed dynamically trading ROM for RAM - +// This can be useful in (embedded) bootloader applications, where ROM is often limited. +static const uint8_t sbox[256] = { + //0 1 2 3 4 5 6 7 8 9 A B C D E F + 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, + 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, + 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, + 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, + 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, + 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, + 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, + 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, + 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, + 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, + 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, + 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, + 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, + 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, + 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, + 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; + +static const uint8_t rsbox[256] = { + 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, + 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, + 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, + 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, + 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, + 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, + 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, + 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, + 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, + 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, + 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, + 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, + 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, + 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, + 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, + 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d }; + +// The round constant word array, Rcon[i], contains the values given by +// x to the power (i-1) being powers of x (x is denoted as {02}) in the field GF(2^8) +static const uint8_t Rcon[11] = { + 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36 }; + +/* +* Jordan Goulder points out in PR #12 (https://github.com/kokke/tiny-AES-C/pull/12), +* that you can remove most of the elements in the Rcon array, because they are unused. +* +* From Wikipedia's article on the Rijndael key schedule @ https://en.wikipedia.org/wiki/Rijndael_key_schedule#Rcon +* +* "Only the first some of these constants are actually used – up to rcon[10] for AES-128 (as 11 round keys are needed), +* up to rcon[8] for AES-192, up to rcon[7] for AES-256. rcon[0] is not used in AES algorithm." +*/ + + +/*****************************************************************************/ +/* Private functions: */ +/*****************************************************************************/ +/* +static uint8_t getSBoxValue(uint8_t num) +{ +return sbox[num]; +} +*/ +#define getSBoxValue(num) (sbox[(num)]) +/* +static uint8_t getSBoxInvert(uint8_t num) +{ +return rsbox[num]; +} +*/ +#define getSBoxInvert(num) (rsbox[(num)]) + +// This function produces Nb(Nr+1) round keys. The round keys are used in each round to decrypt the states. +static void KeyExpansion(uint8_t* RoundKey, const uint8_t* Key) +{ + unsigned i, j, k; + uint8_t tempa[4]; // Used for the column/row operations + + // The first round key is the key itself. + for (i = 0; i < Nk; ++i) + { + RoundKey[(i * 4) + 0] = Key[(i * 4) + 0]; + RoundKey[(i * 4) + 1] = Key[(i * 4) + 1]; + RoundKey[(i * 4) + 2] = Key[(i * 4) + 2]; + RoundKey[(i * 4) + 3] = Key[(i * 4) + 3]; + } + + // All other round keys are found from the previous round keys. + for (i = Nk; i < Nb * (Nr + 1); ++i) + { + { + k = (i - 1) * 4; + tempa[0] = RoundKey[k + 0]; + tempa[1] = RoundKey[k + 1]; + tempa[2] = RoundKey[k + 2]; + tempa[3] = RoundKey[k + 3]; + + } + + if (i % Nk == 0) + { + // This function shifts the 4 bytes in a word to the left once. + // [a0,a1,a2,a3] becomes [a1,a2,a3,a0] + + // Function RotWord() + { + k = tempa[0]; + tempa[0] = tempa[1]; + tempa[1] = tempa[2]; + tempa[2] = tempa[3]; + tempa[3] = k; + } + + // SubWord() is a function that takes a four-byte input word and + // applies the S-box to each of the four bytes to produce an output word. + + // Function Subword() + { + tempa[0] = getSBoxValue(tempa[0]); + tempa[1] = getSBoxValue(tempa[1]); + tempa[2] = getSBoxValue(tempa[2]); + tempa[3] = getSBoxValue(tempa[3]); + } + + tempa[0] = tempa[0] ^ Rcon[i / Nk]; + } +#if defined(AES256) && (AES256 == 1) + if (i % Nk == 4) + { + // Function Subword() + { + tempa[0] = getSBoxValue(tempa[0]); + tempa[1] = getSBoxValue(tempa[1]); + tempa[2] = getSBoxValue(tempa[2]); + tempa[3] = getSBoxValue(tempa[3]); + } + } +#endif + j = i * 4; k = (i - Nk) * 4; + RoundKey[j + 0] = RoundKey[k + 0] ^ tempa[0]; + RoundKey[j + 1] = RoundKey[k + 1] ^ tempa[1]; + RoundKey[j + 2] = RoundKey[k + 2] ^ tempa[2]; + RoundKey[j + 3] = RoundKey[k + 3] ^ tempa[3]; + } +} + +void AES_init_ctx(struct AES_ctx* ctx, const uint8_t* key) +{ + KeyExpansion(ctx->RoundKey, key); +} +#if defined(CBC) && (CBC == 1) +void AES_init_ctx_iv(struct AES_ctx* ctx, const uint8_t* key, const uint8_t* iv) +{ + KeyExpansion(ctx->RoundKey, key); + memcpy(ctx->Iv, iv, AES_BLOCKLEN); +} +void AES_ctx_set_iv(struct AES_ctx* ctx, const uint8_t* iv) +{ + memcpy(ctx->Iv, iv, AES_BLOCKLEN); +} +#endif + +// This function adds the round key to state. +// The round key is added to the state by an XOR function. +static void AddRoundKey(uint8_t round, state_t* state, uint8_t* RoundKey) +{ + uint8_t i, j; + for (i = 0; i < 4; ++i) + { + for (j = 0; j < 4; ++j) + { + (*state)[i][j] ^= RoundKey[(round * Nb * 4) + (i * Nb) + j]; + } + } +} + +// The SubBytes Function Substitutes the values in the +// state matrix with values in an S-box. +static void SubBytes(state_t* state) +{ + uint8_t i, j; + for (i = 0; i < 4; ++i) + { + for (j = 0; j < 4; ++j) + { + (*state)[j][i] = getSBoxValue((*state)[j][i]); + } + } +} + +// The ShiftRows() function shifts the rows in the state to the left. +// Each row is shifted with different offset. +// Offset = Row number. So the first row is not shifted. +static void ShiftRows(state_t* state) +{ + uint8_t temp; + + // Rotate first row 1 columns to left + temp = (*state)[0][1]; + (*state)[0][1] = (*state)[1][1]; + (*state)[1][1] = (*state)[2][1]; + (*state)[2][1] = (*state)[3][1]; + (*state)[3][1] = temp; + + // Rotate second row 2 columns to left + temp = (*state)[0][2]; + (*state)[0][2] = (*state)[2][2]; + (*state)[2][2] = temp; + + temp = (*state)[1][2]; + (*state)[1][2] = (*state)[3][2]; + (*state)[3][2] = temp; + + // Rotate third row 3 columns to left + temp = (*state)[0][3]; + (*state)[0][3] = (*state)[3][3]; + (*state)[3][3] = (*state)[2][3]; + (*state)[2][3] = (*state)[1][3]; + (*state)[1][3] = temp; +} + +static uint8_t xtime(uint8_t x) +{ + return ((x << 1) ^ (((x >> 7) & 1) * 0x1b)); +} + +// MixColumns function mixes the columns of the state matrix +static void MixColumns(state_t* state) +{ + uint8_t i; + uint8_t Tmp, Tm, t; + for (i = 0; i < 4; ++i) + { + t = (*state)[i][0]; + Tmp = (*state)[i][0] ^ (*state)[i][1] ^ (*state)[i][2] ^ (*state)[i][3]; + Tm = (*state)[i][0] ^ (*state)[i][1]; Tm = xtime(Tm); (*state)[i][0] ^= Tm ^ Tmp; + Tm = (*state)[i][1] ^ (*state)[i][2]; Tm = xtime(Tm); (*state)[i][1] ^= Tm ^ Tmp; + Tm = (*state)[i][2] ^ (*state)[i][3]; Tm = xtime(Tm); (*state)[i][2] ^= Tm ^ Tmp; + Tm = (*state)[i][3] ^ t; Tm = xtime(Tm); (*state)[i][3] ^= Tm ^ Tmp; + } +} + +// Multiply is used to multiply numbers in the field GF(2^8) +#if MULTIPLY_AS_A_FUNCTION +static uint8_t Multiply(uint8_t x, uint8_t y) +{ + return (((y & 1) * x) ^ + ((y >> 1 & 1) * xtime(x)) ^ + ((y >> 2 & 1) * xtime(xtime(x))) ^ + ((y >> 3 & 1) * xtime(xtime(xtime(x)))) ^ + ((y >> 4 & 1) * xtime(xtime(xtime(xtime(x)))))); +} +#else +#define Multiply(x, y) \ + ( ((y & 1) * x) ^ \ + ((y>>1 & 1) * xtime(x)) ^ \ + ((y>>2 & 1) * xtime(xtime(x))) ^ \ + ((y>>3 & 1) * xtime(xtime(xtime(x)))) ^ \ + ((y>>4 & 1) * xtime(xtime(xtime(xtime(x)))))) \ + +#endif + +// MixColumns function mixes the columns of the state matrix. +// The method used to multiply may be difficult to understand for the inexperienced. +// Please use the references to gain more information. +static void InvMixColumns(state_t* state) +{ + int i; + uint8_t a, b, c, d; + for (i = 0; i < 4; ++i) + { + a = (*state)[i][0]; + b = (*state)[i][1]; + c = (*state)[i][2]; + d = (*state)[i][3]; + + (*state)[i][0] = Multiply(a, 0x0e) ^ Multiply(b, 0x0b) ^ Multiply(c, 0x0d) ^ Multiply(d, 0x09); + (*state)[i][1] = Multiply(a, 0x09) ^ Multiply(b, 0x0e) ^ Multiply(c, 0x0b) ^ Multiply(d, 0x0d); + (*state)[i][2] = Multiply(a, 0x0d) ^ Multiply(b, 0x09) ^ Multiply(c, 0x0e) ^ Multiply(d, 0x0b); + (*state)[i][3] = Multiply(a, 0x0b) ^ Multiply(b, 0x0d) ^ Multiply(c, 0x09) ^ Multiply(d, 0x0e); + } +} + + +// The SubBytes Function Substitutes the values in the +// state matrix with values in an S-box. +static void InvSubBytes(state_t* state) +{ + uint8_t i, j; + for (i = 0; i < 4; ++i) + { + for (j = 0; j < 4; ++j) + { + (*state)[j][i] = getSBoxInvert((*state)[j][i]); + } + } +} + +static void InvShiftRows(state_t* state) +{ + uint8_t temp; + + // Rotate first row 1 columns to right + temp = (*state)[3][1]; + (*state)[3][1] = (*state)[2][1]; + (*state)[2][1] = (*state)[1][1]; + (*state)[1][1] = (*state)[0][1]; + (*state)[0][1] = temp; + + // Rotate second row 2 columns to right + temp = (*state)[0][2]; + (*state)[0][2] = (*state)[2][2]; + (*state)[2][2] = temp; + + temp = (*state)[1][2]; + (*state)[1][2] = (*state)[3][2]; + (*state)[3][2] = temp; + + // Rotate third row 3 columns to right + temp = (*state)[0][3]; + (*state)[0][3] = (*state)[1][3]; + (*state)[1][3] = (*state)[2][3]; + (*state)[2][3] = (*state)[3][3]; + (*state)[3][3] = temp; +} + + +// Cipher is the main function that encrypts the PlainText. +static void Cipher(state_t* state, uint8_t* RoundKey) +{ + uint8_t round = 0; + + // Add the First round key to the state before starting the rounds. + AddRoundKey(0, state, RoundKey); + + // There will be Nr rounds. + // The first Nr-1 rounds are identical. + // These Nr-1 rounds are executed in the loop below. + for (round = 1; round < Nr; ++round) + { + SubBytes(state); + ShiftRows(state); + MixColumns(state); + AddRoundKey(round, state, RoundKey); + } + + // The last round is given below. + // The MixColumns function is not here in the last round. + SubBytes(state); + ShiftRows(state); + AddRoundKey(Nr, state, RoundKey); +} + +static void InvCipher(state_t* state, uint8_t* RoundKey) +{ + uint8_t round = 0; + + // Add the First round key to the state before starting the rounds. + AddRoundKey(Nr, state, RoundKey); + + // There will be Nr rounds. + // The first Nr-1 rounds are identical. + // These Nr-1 rounds are executed in the loop below. + for (round = (Nr - 1); round > 0; --round) + { + InvShiftRows(state); + InvSubBytes(state); + AddRoundKey(round, state, RoundKey); + InvMixColumns(state); + } + + // The last round is given below. + // The MixColumns function is not here in the last round. + InvShiftRows(state); + InvSubBytes(state); + AddRoundKey(0, state, RoundKey); +} + + +/*****************************************************************************/ +/* Public functions: */ +/*****************************************************************************/ +#if defined(ECB) && (ECB == 1) + + +void AES_ECB_encrypt(struct AES_ctx *ctx, const uint8_t* buf) +{ + // The next function call encrypts the PlainText with the Key using AES algorithm. + Cipher((state_t*)buf, ctx->RoundKey); +} + +void AES_ECB_decrypt(struct AES_ctx* ctx, const uint8_t* buf) +{ + // The next function call decrypts the PlainText with the Key using AES algorithm. + InvCipher((state_t*)buf, ctx->RoundKey); +} + + +#endif // #if defined(ECB) && (ECB == 1) + + + + + +#if defined(CBC) && (CBC == 1) + + +static void XorWithIv(uint8_t* buf, uint8_t* Iv) +{ + uint8_t i; + for (i = 0; i < AES_BLOCKLEN; ++i) // The block in AES is always 128bit no matter the key size + { + buf[i] ^= Iv[i]; + } +} + +void AES_CBC_encrypt_buffer(struct AES_ctx *ctx, uint8_t* buf, uint32_t length) +{ + uintptr_t i; + uint8_t *Iv = ctx->Iv; + for (i = 0; i < length; i += AES_BLOCKLEN) + { + XorWithIv(buf, Iv); + Cipher((state_t*)buf, ctx->RoundKey); + Iv = buf; + buf += AES_BLOCKLEN; + //printf("Step %d - %d", i/16, i); + } + /* store Iv in ctx for next call */ + memcpy(ctx->Iv, Iv, AES_BLOCKLEN); +} + +void AES_CBC_decrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length) +{ + uintptr_t i; + uint8_t storeNextIv[AES_BLOCKLEN]; + for (i = 0; i < length; i += AES_BLOCKLEN) + { + memcpy(storeNextIv, buf, AES_BLOCKLEN); + InvCipher((state_t*)buf, ctx->RoundKey); + XorWithIv(buf, ctx->Iv); + memcpy(ctx->Iv, storeNextIv, AES_BLOCKLEN); + buf += AES_BLOCKLEN; + } + +} + +#endif // #if defined(CBC) && (CBC == 1) + + + +#if defined(CTR) && (CTR == 1) + +/* Symmetrical operation: same function for encrypting as for decrypting. Note any IV/nonce should never be reused with the same key */ +void AES_CTR_xcrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length) +{ + uint8_t buffer[AES_BLOCKLEN]; + + unsigned i; + int bi; + for (i = 0, bi = AES_BLOCKLEN; i < length; ++i, ++bi) + { + if (bi == AES_BLOCKLEN) /* we need to regen xor compliment in buffer */ + { + + memcpy(buffer, ctx->Iv, AES_BLOCKLEN); + Cipher((state_t*)buffer, ctx->RoundKey); + + /* Increment Iv and handle overflow */ + for (bi = (AES_BLOCKLEN - 1); bi >= 0; --bi) + { + /* inc will owerflow */ + if (ctx->Iv[bi] == 255) + { + ctx->Iv[bi] = 0; + continue; + } + ctx->Iv[bi] += 1; + break; + } + bi = 0; + } + + buf[i] = (buf[i] ^ buffer[bi]); + } +} + +#endif // #if defined(CTR) && (CTR == 1) + diff --git a/tools/gzinject/src/aes.h b/tools/gzinject/src/aes.h new file mode 100644 index 000000000..d1a468630 --- /dev/null +++ b/tools/gzinject/src/aes.h @@ -0,0 +1,90 @@ +#ifndef _AES_H_ +#define _AES_H_ + +#include + +// #define the macros below to 1/0 to enable/disable the mode of operation. +// +// CBC enables AES encryption in CBC-mode of operation. +// CTR enables encryption in counter-mode. +// ECB enables the basic ECB 16-byte block algorithm. All can be enabled simultaneously. + +// The #ifndef-guard allows it to be configured before #include'ing or at compile time. +#ifndef CBC +#define CBC 1 +#endif + +#ifndef ECB +#define ECB 1 +#endif + +#ifndef CTR +#define CTR 1 +#endif + + +#define AES128 1 +//#define AES192 1 +//#define AES256 1 + +#define AES_BLOCKLEN 16 //Block length in bytes AES is 128b block only + +#if defined(AES256) && (AES256 == 1) +#define AES_KEYLEN 32 +#define AES_keyExpSize 240 +#elif defined(AES192) && (AES192 == 1) +#define AES_KEYLEN 24 +#define AES_keyExpSize 208 +#else +#define AES_KEYLEN 16 // Key length in bytes +#define AES_keyExpSize 176 +#endif + +struct AES_ctx +{ + uint8_t RoundKey[AES_keyExpSize]; +#if (defined(CBC) && (CBC == 1)) || (defined(CTR) && (CTR == 1)) + uint8_t Iv[AES_BLOCKLEN]; +#endif +}; + +void AES_init_ctx(struct AES_ctx* ctx, const uint8_t* key); +#if defined(CBC) && (CBC == 1) +void AES_init_ctx_iv(struct AES_ctx* ctx, const uint8_t* key, const uint8_t* iv); +void AES_ctx_set_iv(struct AES_ctx* ctx, const uint8_t* iv); +#endif + +#if defined(ECB) && (ECB == 1) +// buffer size is exactly AES_BLOCKLEN bytes; +// you need only AES_init_ctx as IV is not used in ECB +// NB: ECB is considered insecure for most uses +void AES_ECB_encrypt(struct AES_ctx* ctx, const uint8_t* buf); +void AES_ECB_decrypt(struct AES_ctx* ctx, const uint8_t* buf); + +#endif // #if defined(ECB) && (ECB == !) + + +#if defined(CBC) && (CBC == 1) +// buffer size MUST be mutile of AES_BLOCKLEN; +// Suggest https://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7 for padding scheme +// NOTES: you need to set IV in ctx via AES_init_ctx_iv() or AES_ctx_set_iv() +// no IV should ever be reused with the same key +void AES_CBC_encrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length); +void AES_CBC_decrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length); + +#endif // #if defined(CBC) && (CBC == 1) + + +#if defined(CTR) && (CTR == 1) + +// Same function for encrypting as for decrypting. +// IV is incremented for every block, and used after encryption as XOR-compliment for output +// Suggesting https://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7 for padding scheme +// NOTES: you need to set IV in ctx with AES_init_ctx_iv() or AES_ctx_set_iv() +// no IV should ever be reused with the same key +void AES_CTR_xcrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length); + +#endif // #if defined(CTR) && (CTR == 1) + + +#endif //_AES_H_ \ No newline at end of file diff --git a/tools/gzinject/src/doltool.c b/tools/gzinject/src/doltool.c new file mode 100644 index 000000000..dbc48e451 --- /dev/null +++ b/tools/gzinject/src/doltool.c @@ -0,0 +1,99 @@ +#include +#include +#include +#include + +#include "doltool.h" +#include "gzinject.h" + +void dol_load(doltool_ctxt_t *ctxt, uint8_t **file_data, uint32_t *file_size){ + + ctxt->file_data = file_data; + ctxt->file_size = file_size; + + memcpy(&ctxt->hdr,*(ctxt->file_data),sizeof(ctxt->hdr)); + + for(int i=0;i<7;i++){ + ctxt->hdr.text_size[i] = REVERSEENDIAN32(ctxt->hdr.text_size[i]); + ctxt->hdr.text_offset[i] = REVERSEENDIAN32(ctxt->hdr.text_offset[i]); + ctxt->hdr.text_loading[i] = REVERSEENDIAN32(ctxt->hdr.text_loading[i]); + if(ctxt->hdr.text_size[i]>0){ + ctxt->text_sections[i] = *(ctxt->file_data) + ctxt->hdr.text_offset[i]; + } + } + for(int i=0;i<11;i++){ + ctxt->hdr.data_size[i] = REVERSEENDIAN32(ctxt->hdr.data_size[i]); + ctxt->hdr.data_offset[i] = REVERSEENDIAN32(ctxt->hdr.data_offset[i]); + ctxt->hdr.data_loading[i] = REVERSEENDIAN32(ctxt->hdr.data_loading[i]); + if(ctxt->hdr.data_size[i]>0){ + ctxt->data_sections[i] = *(ctxt->file_data) + ctxt->hdr.data_offset[i]; + } + } +} + +void dol_inject(doltool_ctxt_t *ctxt, uint8_t *text, size_t size, uint32_t loading_addr){ + int injection_idx = 0; + size = addpadding(size,16); + for(int i = 0;i<7;i++){ + if(ctxt->text_sections[i]) continue; + injection_idx = i; + ctxt->text_sections[i] = text; + ctxt->hdr.text_loading[i] = loading_addr; + ctxt->hdr.text_offset[i] = ctxt->hdr.data_offset[0]; + ctxt->hdr.text_size[i] = size; + break; + } + for(int i=0;i<11;i++){ + if(ctxt->data_sections[i]){ + ctxt->hdr.data_offset[i] += ctxt->hdr.text_size[injection_idx]; + }else{ + break; + } + } +} + +size_t dol_save(doltool_ctxt_t *ctxt){ + uint32_t text_sizes[7]; + uint32_t data_sizes[11]; + memcpy(text_sizes,ctxt->hdr.text_size,sizeof(ctxt->hdr.text_size)); + memcpy(data_sizes,ctxt->hdr.data_size,sizeof(ctxt->hdr.data_size)); + uint32_t totalsize = 0x100; + for(int i=0;i<7;i++){ + totalsize += ctxt->hdr.text_size[i]; + ctxt->hdr.text_size[i] = REVERSEENDIAN32(ctxt->hdr.text_size[i]); + ctxt->hdr.text_offset[i] = REVERSEENDIAN32(ctxt->hdr.text_offset[i]); + ctxt->hdr.text_loading[i] = REVERSEENDIAN32(ctxt->hdr.text_loading[i]); + } + for(int i=0;i<11;i++){ + totalsize += ctxt->hdr.data_size[i]; + ctxt->hdr.data_size[i] = REVERSEENDIAN32(ctxt->hdr.data_size[i]); + ctxt->hdr.data_offset[i] = REVERSEENDIAN32(ctxt->hdr.data_offset[i]); + ctxt->hdr.data_loading[i] = REVERSEENDIAN32(ctxt->hdr.data_loading[i]); + } + + uint8_t *new_data = malloc(totalsize); + if(!new_data){ + perror("Could not allocate new dol"); + return 0; + } + memcpy(new_data,&ctxt->hdr,sizeof(ctxt->hdr)); + uint8_t *p = new_data + sizeof(ctxt->hdr); + for(int i=0;i<7;i++){ + if(ctxt->text_sections[i]){ + memcpy(p,ctxt->text_sections[i],text_sizes[i]); + p += text_sizes[i]; + } + } + for(int i=0;i<11;i++){ + if(ctxt->data_sections[i]){ + memcpy(p,ctxt->data_sections[i],data_sizes[i]); + p += data_sizes[i]; + } + } + free(*(ctxt->file_data)); + *(ctxt->file_data) = new_data; + if(ctxt->file_size){ + *(ctxt->file_size) = totalsize; + } + return totalsize; +} \ No newline at end of file diff --git a/tools/gzinject/src/doltool.h b/tools/gzinject/src/doltool.h new file mode 100644 index 000000000..3c30194e9 --- /dev/null +++ b/tools/gzinject/src/doltool.h @@ -0,0 +1,31 @@ +#ifndef _DOLTOOL_H +#define _DOLTOOL_H + +#include + +typedef struct { + uint32_t text_offset[7]; /* 0x000 */ + uint32_t data_offset[11]; /* 0x01C */ + uint32_t text_loading[7]; /* 0x048 */ + uint32_t data_loading[11]; /* 0x064 */ + uint32_t text_size[7]; /* 0x090 */ + uint32_t data_size[11]; /* 0x0AC */ + uint32_t bss_loading; /* 0x0D8 */ + uint32_t bss_size; /* 0x0DC */ + uint32_t entry; /* 0x0E0 */ + char padding[0x1C]; /* 0x0E4 */ +} dol_hdr_t; /* 0x100 */ + +typedef struct{ + dol_hdr_t hdr; + uint8_t *text_sections[7]; + uint8_t *data_sections[11]; + uint8_t **file_data; + uint32_t *file_size; +} doltool_ctxt_t; + +void dol_load(doltool_ctxt_t *ctxt, uint8_t **file_data, uint32_t *file_size); +void dol_inject(doltool_ctxt_t *ctxt, uint8_t *text, size_t size, uint32_t loading_addr); +size_t dol_save(doltool_ctxt_t *ctxt); + +#endif \ No newline at end of file diff --git a/tools/gzinject/src/fastaes.c b/tools/gzinject/src/fastaes.c new file mode 100644 index 000000000..ed6e9ae4b --- /dev/null +++ b/tools/gzinject/src/fastaes.c @@ -0,0 +1,115 @@ +#ifdef FASTAES +#include +#include "fastaes.h" + +static __m128i do_key_exp(__m128i a, __m128i b) { + __m128i tmp; + + b = _mm_shuffle_epi32(b, 0xFF); + tmp = _mm_slli_si128(a, 4); + a = _mm_xor_si128(a, tmp); + tmp = _mm_slli_si128(a, 4); + a = _mm_xor_si128(a, tmp); + tmp = _mm_slli_si128(a, 4); + a = _mm_xor_si128(a, tmp); + a = _mm_xor_si128(a, b); + + return a; +} + +static void key_expansion(const uint8_t *key, __m128i *key_sched, __m128i *dkey_sched) { + key_sched[0] = _mm_loadu_si128((const __m128i_u*)key); + key_sched[1] = do_key_exp(key_sched[0], _mm_aeskeygenassist_si128(key_sched[0], 0x01)); + key_sched[2] = do_key_exp(key_sched[1], _mm_aeskeygenassist_si128(key_sched[1], 0x02)); + key_sched[3] = do_key_exp(key_sched[2], _mm_aeskeygenassist_si128(key_sched[2], 0x04)); + key_sched[4] = do_key_exp(key_sched[3], _mm_aeskeygenassist_si128(key_sched[3], 0x08)); + key_sched[5] = do_key_exp(key_sched[4], _mm_aeskeygenassist_si128(key_sched[4], 0x10)); + key_sched[6] = do_key_exp(key_sched[5], _mm_aeskeygenassist_si128(key_sched[5], 0x20)); + key_sched[7] = do_key_exp(key_sched[6], _mm_aeskeygenassist_si128(key_sched[6], 0x40)); + key_sched[8] = do_key_exp(key_sched[7], _mm_aeskeygenassist_si128(key_sched[7], 0x80)); + key_sched[9] = do_key_exp(key_sched[8], _mm_aeskeygenassist_si128(key_sched[8], 0x1B)); + key_sched[10] = do_key_exp(key_sched[9], _mm_aeskeygenassist_si128(key_sched[9], 0x36)); + + dkey_sched[0] = key_sched[0]; + dkey_sched[1] = _mm_aesimc_si128(key_sched[1]); + dkey_sched[2] = _mm_aesimc_si128(key_sched[2]); + dkey_sched[3] = _mm_aesimc_si128(key_sched[3]); + dkey_sched[4] = _mm_aesimc_si128(key_sched[4]); + dkey_sched[5] = _mm_aesimc_si128(key_sched[5]); + dkey_sched[6] = _mm_aesimc_si128(key_sched[6]); + dkey_sched[7] = _mm_aesimc_si128(key_sched[7]); + dkey_sched[8] = _mm_aesimc_si128(key_sched[8]); + dkey_sched[9] = _mm_aesimc_si128(key_sched[9]); + dkey_sched[10] = key_sched[10]; + +} + +void aes_ctx_init(aes_ctxt_t *ctx, const uint8_t *key, const uint8_t *iv) { + memcpy(ctx->iv, iv, sizeof(ctx->iv)); + key_expansion(key, ctx->key_schedule, ctx->dkey_schedule); +} + +static __m128i cipher(__m128i state, __m128i *key_sched) { + state = _mm_xor_si128(state, key_sched[0]); + + for(int i = 1; i < 10; i++) { + state = _mm_aesenc_si128(state, key_sched[i]); + } + + return _mm_aesenclast_si128(state, key_sched[10]); +} + +static __m128i inv_cipher(__m128i state, __m128i *key_sched) { + state = _mm_xor_si128(state, key_sched[10]); + state = _mm_aesdec_si128(state, key_sched[9]); + state = _mm_aesdec_si128(state, key_sched[8]); + state = _mm_aesdec_si128(state, key_sched[7]); + state = _mm_aesdec_si128(state, key_sched[6]); + state = _mm_aesdec_si128(state, key_sched[5]); + state = _mm_aesdec_si128(state, key_sched[4]); + state = _mm_aesdec_si128(state, key_sched[3]); + state = _mm_aesdec_si128(state, key_sched[2]); + state = _mm_aesdec_si128(state, key_sched[1]); + + state = _mm_aesdeclast_si128(state, key_sched[0]); + + return state; +} + +void aes_encrypt_buffer(aes_ctxt_t *ctx, uint8_t *buffer, size_t len) { + __m128i iv = _mm_loadu_si128((const __m128i*)ctx->iv); + __m128i state; + + for(int i = 0; i < len; i += 16) { + state = _mm_loadu_si128((const __m128i*)buffer); + state = _mm_xor_si128(state, iv); + state = cipher(state, ctx->key_schedule); + _mm_storeu_si128((__m128i_u*)buffer, state); + iv = state; + + buffer += 16; + } + + _mm_storeu_si128((__m128i_u*)&ctx->state, state); + _mm_storeu_si128((__m128i_u*)ctx->iv, iv); +} + +void aes_decrypt_buffer(aes_ctxt_t *ctx, uint8_t *buffer, size_t len) { + __m128i state; + __m128i iv = _mm_loadu_si128((const __m128i_u*)ctx->iv); + __m128i next_iv; + + for(int i = 0; i < len; i += 16) { + state = _mm_loadu_si128((const __m128i_u*)buffer); + next_iv = state; + state = inv_cipher(state, ctx->dkey_schedule); + state = _mm_xor_si128(state, iv); + iv = next_iv; + _mm_storeu_si128((__m128i_u*)buffer, state); + buffer += 16; + } + + _mm_storeu_si128((__m128i_u*)&ctx->state, state); + _mm_storeu_si128((__m128i_u*)ctx->iv, iv); +} +#endif diff --git a/tools/gzinject/src/fastaes.h b/tools/gzinject/src/fastaes.h new file mode 100644 index 000000000..3080751fb --- /dev/null +++ b/tools/gzinject/src/fastaes.h @@ -0,0 +1,27 @@ +#ifdef FASTAES +#ifndef _FASTAES_H +#define _FASTAES_H + +#include +#include + +/** + * fast aes for x86/x86-64 processors. + */ + +typedef uint8_t state_t[4][4]; + +typedef struct { + state_t state; + uint8_t iv[16]; + // gzinject only cares about aes128 + __m128i key_schedule[11]; + __m128i dkey_schedule[11]; +} aes_ctxt_t; + +void aes_ctx_init(aes_ctxt_t *ctx, const uint8_t *key, const uint8_t *iv); +void aes_encrypt_buffer(aes_ctxt_t *ctx, uint8_t *buffer, size_t len); +void aes_decrypt_buffer(aes_ctxt_t *ctx, uint8_t *buffer, size_t len); + +#endif +#endif diff --git a/tools/gzinject/src/gzi.c b/tools/gzinject/src/gzi.c new file mode 100644 index 000000000..95768c217 --- /dev/null +++ b/tools/gzinject/src/gzi.c @@ -0,0 +1,218 @@ +#include +#include +#include +#include +#include +#include + +#include "gzi.h" +#include "lz77.h" +#include "gzinject.h" + +typedef int (*gzi_action_t)(gzi_ctxt_t *ctxt, int pos); + +static int gzi_cmd_file(gzi_ctxt_t *ctxt, int pos){ + ctxt->curfile = ctxt->codes[pos].data & 0xFF; + if(verbose){ + printf("Setting current file to %d\n",ctxt->curfile); + } + return 1; +} + +static int gzi_cmd_lz77_decomp(gzi_ctxt_t *ctxt, int pos){ + int32_t curfile = ctxt->curfile; + if(curfile<0){ + printf("Warning: No file Selected, not decompressing.\n"); + return 0; + } + if(verbose){ + printf("LZ77 Decompressing %d\n",curfile); + } + int decompsize = addpadding(lz77_decompressed_size(ctxt->file_ptrs[curfile]),16); + uint8_t *decomp = calloc(decompsize,1); + lz77_decompress(ctxt->file_ptrs[curfile],decomp); + free(ctxt->file_ptrs[curfile]); + ctxt->file_ptrs[curfile] = decomp; + ctxt->file_sizes[curfile] = decompsize; + return 1; +} + +static int gzi_cmd_lz77_comp(gzi_ctxt_t *ctxt, int pos){ + int32_t curfile = ctxt->curfile; + if(curfile<0){ + printf("Warning: No file selected, not compressing.\n"); + return 0; + } + if(verbose){ + printf("LZ77 Compressing %d\n",curfile); + } + uint8_t *comp = NULL; + uint32_t len = ctxt->file_sizes[curfile]; + + // I hate this, but it works for now. + len -= (8 - (len & 0x8)); + int complen = lz77_compress(ctxt->file_ptrs[curfile],&comp,len,&len); + free(ctxt->file_ptrs[curfile]); + ctxt->file_ptrs[curfile] = comp; + ctxt->file_sizes[curfile] = complen; + return 1; +} + +static int gzi_cmd_apply_patch(gzi_ctxt_t *ctxt, int pos){ + int32_t curfile = ctxt->curfile; + if(curfile<0){ + printf("Warning: No file selected, not applying patch.\n"); + } + gzi_code_t code = ctxt->codes[pos]; + uint32_t val = code.data; + if(verbose){ + printf("Apply patch to %d. offset 0x%x = 0x%x\n",curfile,code.offset,code.data); + } + uint8_t *p; + switch(curfile){ + case GZI_FILE_TMD: + p = ctxt->tmd; + break; + case GZI_FILE_TIK: + p = ctxt->tik; + break; + case GZI_FILE_CERT: + p = ctxt->cert; + break; + default: + if(curfile>ctxt->filecnt-1){ + return -1; + } + p = ctxt->file_ptrs[curfile]; + break; + } + switch(code.len){ + case 1: + *((uint8_t*)(p + code.offset)) = (uint8_t)val; + break; + case 2: + *((uint16_t*)(p + code.offset)) = REVERSEENDIAN16((uint16_t)val); + break; + case 4: + default: + *((uint32_t*)(p + code.offset)) = REVERSEENDIAN32(val); + break; + } + return 1; +} + +static gzi_action_t commands[] = { + gzi_cmd_file, + gzi_cmd_lz77_decomp, + gzi_cmd_lz77_comp, + gzi_cmd_apply_patch, +}; + +static char *readline(FILE *fle){ + char *line = NULL; + int buflen=256; + for(int i=0;;++i){ + int c = fgetc(fle); + + if(i%buflen==0){ + char *new = realloc(line,i+buflen); + line = new; + } + if(c==EOF || c=='\n'){ + line[i] = 0; + return line; + }else{ + line[i] = c; + } + } +} + +int ishexstring(const char *string, size_t len){ + const char *s; + for(s = string; *s!=0;s++){ + if(!isxdigit(*s)){ + return 0; + } + } + return s - string == len; +} + +void parseline(gzi_ctxt_t *ctxt, const char *line){ + char command[6]={0}; + char offset[10]={0}; + char data[10]={0}; + sscanf(line,"%5s %9s %9s",command,offset,data); + if(!ishexstring(command,4) || !ishexstring(offset,8) || !ishexstring(offset,8)) + return; + ctxt->codecnt++; + gzi_code_t *new_codes = realloc(ctxt->codes,sizeof(gzi_code_t) * ctxt->codecnt); + if(new_codes){ + ctxt->codes = new_codes; + } + gzi_code_t code; + uint16_t cmd; + sscanf(command,"%"SCNx16,&cmd); + code.command = (cmd & 0xFF00) >> 8; + code.len = cmd & 0xFF; + sscanf(offset,"%"SCNx32,&code.offset); + sscanf(data,"%"SCNx32,&code.data); + memcpy(ctxt->codes + (ctxt->codecnt - 1),&code,sizeof(code)); +} + +int gzi_parse_file(gzi_ctxt_t *ctxt, const char *file){ + FILE *fle = fopen(file,"r"); + if(!fle){ + fprintf(stderr,"Could not open %s, cannot parse file.\n",file); + } + if(verbose){ + printf("Parsing gzi file %s\n",file); + } + while(!feof(fle)){ + char *line = readline(fle); + if(!line){ + fprintf(stderr,"Could not readline from gzi file %s.\n",file); + return 0; + } + if(line[0]=='#' || line[0]==0){ + free(line); + continue; + } + parseline(ctxt,line); + free(line); + } + fclose(fle); + return 1; +} + +int gzi_run(gzi_ctxt_t *ctxt){ + if(verbose){ + printf("Running gzi commands\n"); + } + for(int i=0;icodecnt;i++){ + commands[ctxt->codes[i].command](ctxt,i); + } + return 1; +} + +int gzi_init(gzi_ctxt_t *ctxt, uint8_t **files, uint32_t *filesizes, int filecnt, + uint8_t *tmd, uint8_t *tik, uint8_t *cert, + uint32_t *tmd_size, uint32_t *tik_size, uint32_t *cert_size){ + ctxt->codes = NULL; + ctxt->codecnt=0; + ctxt->curfile=-1; + ctxt->file_ptrs = files; + ctxt->file_sizes = filesizes; + ctxt->filecnt = filecnt; + ctxt->tmd = tmd; + ctxt->tik = tik; + ctxt->cert = cert; + ctxt->tmd_size = tmd_size; + ctxt->tik_size = tik_size; + ctxt->cert_size = cert_size; + return 1; +} + +int gzi_destroy(gzi_ctxt_t *ctxt){ + if(ctxt->codes) free(ctxt->codes); + return 1; +} \ No newline at end of file diff --git a/tools/gzinject/src/gzi.h b/tools/gzinject/src/gzi.h new file mode 100644 index 000000000..1b49fcfa9 --- /dev/null +++ b/tools/gzinject/src/gzi.h @@ -0,0 +1,39 @@ +#ifndef _PATCH_H_ +#define _PATCH_H_ + +#include + +#define GZI_FILE_TMD 100 +#define GZI_FILE_TIK 101 +#define GZI_FILE_CERT 102 + +typedef struct { + uint8_t command; + uint8_t len; + uint32_t offset; + uint32_t data; +} gzi_code_t; + +typedef struct{ + gzi_code_t *codes; + int codecnt; + int8_t curfile; + uint8_t **file_ptrs; + uint32_t *file_sizes; + uint8_t filecnt; + uint8_t *tmd; + uint8_t *tik; + uint8_t *cert; + uint32_t *tmd_size; + uint32_t *tik_size; + uint32_t *cert_size; +} gzi_ctxt_t; + +int gzi_parse_file(gzi_ctxt_t *ctxt, const char *file); +int gzi_run(gzi_ctxt_t *ctxt); +int gzi_init(gzi_ctxt_t *ctxt, uint8_t **files, uint32_t *filesizes, int filecnt, + uint8_t *tmd, uint8_t *tik, uint8_t *cert, + uint32_t *tmd_size, uint32_t *tik_size, uint32_t *cert_size); +int gzi_destroy(gzi_ctxt_t *ctxt); + +#endif \ No newline at end of file diff --git a/tools/gzinject/src/gzinject.c b/tools/gzinject/src/gzinject.c new file mode 100644 index 000000000..1b15397ae --- /dev/null +++ b/tools/gzinject/src/gzinject.c @@ -0,0 +1,1329 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "gzinject.h" +#include "lz77.h" +#include "u8.h" +#include "gzi.h" +#include "aes.h" +#include "sha1.h" +#include "md5.h" +#include "romchu.h" +#include "doltool.h" +#include "fastaes.h" + +static uint8_t key[16] = {0}; +static uint8_t region = 0x03; + +static int cleanup = 0; +static int content_num = 5; + +int verbose = 0; +int dol_after = -1; + +static char *wad = NULL; +static char *directory = NULL; +static char *keyfile = NULL; +static char *workingdirectory = NULL; +static char *rom = NULL; +static char *outwad = NULL; +static patch_list_t *patch = NULL; +static patch_list_t **patch_link = &patch; +static dol_list_t *dol = NULL; +static dol_list_t **dol_link = &dol; +static dol_loading_list_t *dol_loading = NULL; +static dol_loading_list_t **dol_loading_link = &dol_loading; +static char *titleid = NULL; +static char *channelname = NULL; + +uint16_t be16(const uint8_t *p) +{ + return (p[0] << 8) | p[1]; +} + +uint32_t be32(const uint8_t *p) +{ + return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]; +} + +static const struct option cmdoptions[] = { + { "action",required_argument,0,'a' }, + { "wad",required_argument,0,'w' }, + { "channelid",required_argument,0,'i' }, + { "channeltitle",required_argument,0,'t' }, + { "help",no_argument,0,'h' }, + { "key",required_argument,0,'k' }, + { "region",required_argument,0,'r' }, + { "verbose",no_argument,&verbose,1 }, + { "directory",required_argument,0,'d' }, + { "cleanup", no_argument,&cleanup,1}, + { "version",no_argument,0,'v'}, + { "rom",required_argument,0,'m'}, + { "outputwad",required_argument,0,'o'}, + { "patch-file",required_argument,0,'p'}, + { "content-num",required_argument,0,'c'}, + { "dol-inject",required_argument,0,'f'}, + { "dol-loading",required_argument,0,'l'}, + { "dol-after", required_argument,0,'e'}, + { 0,0,0,0} +}; + +const uint8_t newkey[16] = { + 0x47, 0x5a, 0x49, 0x73, 0x4c, 0x69, 0x66, 0x65, 0x41, 0x6e, 0x64, 0x42, 0x65, 0x65, 0x72, 0x21 +}; + +static SHA1_CTX sha1; +static MD5_CTX md5; + +#ifdef FASTAES +static aes_ctxt_t aes; +static void do_encrypt(uint8_t *input, size_t size, const uint8_t *key, const uint8_t *iv) { + aes_ctx_init(&aes, key, iv); + aes_encrypt_buffer(&aes, input, size); +} + +static void do_decrypt(uint8_t *input, size_t size, const uint8_t *key, const uint8_t *iv) { + aes_ctx_init(&aes, key, iv); + aes_decrypt_buffer(&aes, input, size); +} + +#else + +static struct AES_ctx aes; +static void do_encrypt(uint8_t *input, size_t size, const uint8_t *key, const uint8_t *iv) { + AES_init_ctx_iv(&aes, key, iv); + AES_CBC_encrypt_buffer(&aes, input, size); +} + +static void do_decrypt(uint8_t *input, size_t size, const uint8_t *key, const uint8_t *iv) { + AES_init_ctx_iv(&aes, key, iv); + AES_CBC_decrypt_buffer(&aes, input, size); +} +#endif + + static void do_sha1(uint8_t *input, uint8_t *output, size_t size) { + SHA1Init(&sha1); + SHA1Update(&sha1, input, size); + SHA1Final(output, &sha1); +} + + static void do_md5(uint8_t *input, uint8_t *output, size_t size) { + MD5_Init(&md5); + MD5_Update(&md5, input, size); + MD5_Final(output, &md5); +} + +uint32_t addpadding(uint32_t inp, uint32_t padding) { + int ret = inp; + if (inp % padding != 0) { + ret = inp + (padding - (inp % padding)); + } + return ret; +} + +static uint32_t getcontentlength(uint8_t *tmd, uint32_t contentnum) { + uint32_t off = 0x1ec + (36 * contentnum); + return tmd[off + 4] << 24 | + tmd[off + 5] << 16 | + tmd[off + 6] << 8 | + tmd[off + 7]; +} + +static void setcontentlength(uint8_t *tmd, uint32_t contentnum, uint32_t size){ + uint32_t off = 0x1ec + (36 * contentnum) + 4; + *((uint32_t*)(tmd + off)) = REVERSEENDIAN32(size); +} + +static void removedir(const char *file); + +static void removefile(const char* file) { + struct stat sbuffer; + if (stat(file, &sbuffer) == 0) { + if ((sbuffer.st_mode & S_IFMT) == S_IFDIR) { + removedir(file); + } + else if ((sbuffer.st_mode & S_IFMT) == S_IFREG) { + if (verbose) { + printf("Removing %s\n", file); + } + remove(file); + } + + } +} + +static void removedir(const char *file) { + DIR *dir; + struct dirent *ent; + if ((dir = opendir(file)) != NULL) { + while ((ent = readdir(dir)) != NULL) { + if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) + continue; + char *path = malloc(1000); + snprintf(path, 1000, "%s/%s", file, ent->d_name); + removefile(path); + free(path); + } + if (verbose) { + printf("Removing %s\n", file); + } + rmdir(file); + } + +} + +static char *removeext(char* mystr) { + char *retstr; + char *lastdot; + if (mystr == NULL) + return NULL; + if ((retstr = malloc(strlen(mystr) + 1)) == NULL) + return NULL; + strcpy(retstr, mystr); + lastdot = strrchr(retstr, '.'); + if (lastdot != NULL) + *lastdot = '\0'; + return retstr; +} + +static void print_usage() { + puts("Usage:\n" + " gzinject -a extract -w SOURCEWAD [options]\n" + " gzinject -a pack -w DESTWAD [options]\n" + " gzinject -a inject -w SOURCEWAD -m ROM [options]\n" + " gzinject -a romc -m INROM -o OUTROM [options]\n" + " gzinject -a genkey [options]\n" + " gzinject --help\n" + " gzinject --version\n\n" + "Actions:\n" + " extract extracts SOURCEWAD to directory\n" + " pack packs directory into DESTWAD\n" + " inject injects rom into SOURCEWAD\n" + " romc decompresses a romc compressed rom\n" + " genkey generates wii common-key\n\n" + "Options:\n" + " -i, --channelid=ID New Channel ID For Pack and Inject actions (default: none)\n" + " -t, --title=title New Channel name for pack and inject actions (default: none)\n" + " -h, --help Prints this help message\n" + " -k, --key=keyfile Location of the common-key file (default: ./common-key.bin)\n" + " -r, --region=1-3 Region to use (default: 3)\n" + " --verbose Print out verbose program execution information\n" + " -d, --directory=directory Directory to extract contents to, or directory to read contents from (default: ./wadextract)\n" + " --cleanup Remove files before performing actions\n" + " --version Prints the current version\n" + " -m, --rom=rom Rom to inject for inject action (default: none), also rom to romc decompress\n" + " -o, --outputwad=outwad The output wad for inject actions (default: SOURCEWAD-inject.wad), also output for romc decompression\n" + " -p, --patch-file=patchfile gzi file to use for applying patches (default: none)\n" + " -c, --content=contentfile the primary content file (default: 5)\n" + " --dol-inject Binary data to inject into the emulator program, requires --dol-loading\n" + " --dol-loading The loading address for the binary specified by --dol-inject\n" + " --dol-after After which patch file to inject the dol, default: after all patches\n" + ); +} + +static void print_version(const char* prog) { + printf("%s Version ", prog); + printf(GZINJECT_VERSION); + printf("\n"); +} + +static void truchasign(uint8_t *data, uint8_t type, size_t len) { + uint16_t pos = 0x1f2; + if (type == W_TMD) { + pos = 0x1d4; + } + + uint8_t digest[20]; + do_sha1(data + 0x140, digest, len - 0x140); + + uint16_t i; + if (digest[0] != 0x00) { + for (i = 4; i < 260; i++) { + data[i] = 0x00; + } + for (i = 0; i < 0xFFFF; i++) { + uint16_t revi = REVERSEENDIAN16(i); + memcpy(data + pos, &revi, 2); + + do_sha1(data + 0x140, digest, len - 0x140); + + if (digest[0] == 0x00) { + break; + } + } + } +} + +static int do_extract() { + struct stat sbuffer; + + if (stat(wad, &sbuffer) != 0) { + printf("Could not open %s\n", wad); + return 0; + } + + if (verbose) { + printf("Extracting %s to %s\n", wad, directory); + } + + uint8_t *data = (uint8_t*)malloc(sbuffer.st_size); + if(!data){ + fprintf(stderr,"Could not allocate %ld bytes for wad\n",sbuffer.st_size); + return 0; + } + FILE *wadfile = fopen(wad, "rb"); + if(!wadfile){ + fprintf(stderr,"Could not open %s wad file\n",wad); + free(data); + return 0; + } + int bytesread = fread(data, 1, sbuffer.st_size, wadfile); + if(bytesread!=sbuffer.st_size || ferror(wadfile)){ + fprintf(stderr,"Could not read total wad, or file error occured"); + free(data); + fclose(wadfile); + return 0; + } + fclose(wadfile); + if (be32(&data[3]) != 0x20497300) { + fprintf(stderr,"%s is an invalid wad file!\n",wad); + free(data); + return 0; + } + + uint32_t certsize = be32(data + 0x08); + uint32_t tiksize = be32(data + 0x10); + uint32_t tmdsize = be32(data + 0x14); + uint32_t datasize = be32(data + 0x18); + uint32_t footersize = be32(data + 0x1C); + + uint32_t certpos = 0x40; + uint32_t tikpos = 0x40 + addpadding(certsize, 64); + uint32_t tmdpos = tikpos + addpadding(tiksize, 64); + uint32_t datapos = tmdpos + addpadding(tmdsize, 64); + uint32_t footerpos = datapos + addpadding(datasize,64); + + if (cleanup == 1) removedir(directory); + + stat(directory,&sbuffer); + if(S_ISDIR(sbuffer.st_mode)){ + if(verbose){ + printf("%s exists, not creating.\n",directory); + } + }else{ + if(verbose) + printf("Creating %s\n",directory); + if(mkdir(directory, 0755)==-1){ + fprintf(stderr,"Could not mkdir %s\n",directory); + free(data); + return 0; + } + } + + if(chdir(directory)==-1){ + fprintf(stderr,"Could not chdir to %s\n",directory); + free(data); + return 0; + } + + uint16_t contentcount = be16(data + tmdpos + 0x1de); + + if (verbose) { + printf("Writing cert.cert.\n"); + } + FILE* outfile = fopen("cert.cert", "wb"); + if(!outfile){ + perror("Could not open cert.cert for writing\n"); + free(data); + return 0; + } + + fwrite(data + certpos, 1, certsize, outfile); + if(ferror(outfile)){ + perror("Could not write to cert.cert\n"); + free(data); + return 0; + } + fclose(outfile); + + if (verbose) { + printf("Writing ticket.tik.\n"); + } + outfile = fopen("ticket.tik", "wb"); + if(!outfile){ + perror("Could not open ticket.tik for writing.\n"); + free(data); + return 0; + } + fwrite(data + tikpos, 1, tiksize, outfile); + if(ferror(outfile)){ + perror("Could not write to ticket.tik\n"); + free(data); + return 0; + } + fclose(outfile); + + if (verbose) { + printf("Writing metadata.tmd.\n"); + } + outfile = fopen("metadata.tmd", "wb"); + if(!outfile){ + perror("Could not open metadata.tmd for writing\n"); + free(data); + return 0; + } + fwrite(data + tmdpos, 1, tmdsize, outfile); + if(ferror(outfile)){ + perror("Could not write to metadata.tmd\n"); + free(data); + return 0; + } + fclose(outfile); + + if(verbose){ + printf("Writing footer.bin\n"); + } + outfile = fopen("footer.bin","wb"); + if(!outfile){ + perror("Could not open footer.bin for writing.\n"); + free(data); + return 0; + } + fwrite(data + footerpos, 1, footersize, outfile); + if(ferror(outfile)){ + perror("Could not write to footer.bin\n"); + free(data); + return 0; + } + fclose(outfile); + + uint8_t encryptedkey[16], iv[16]; + + uint8_t i, j; + for (i = 0; i < 16; i++) { + encryptedkey[i] = data[tikpos + 0x1bf + i]; + } + for (i = 0; i < 8; i++) { + iv[i] = data[tikpos + 0x1dc + i]; + iv[i + 8] = 0x00; + } + ; + do_decrypt(encryptedkey, 16, key, iv); + + for (j = 2; j < 16; j++) iv[j] = 0x00; + + uint8_t *contentpos = data + datapos; + + for (i = 0; i < contentcount; i++) { + + iv[0] = data[tmdpos + 0x1e8 + (0x24 * i)]; + iv[1] = data[tmdpos + 0x1e9 + (0x24 * i)]; + + uint32_t size = addpadding(getcontentlength(data + tmdpos, i), 16); + + if (verbose) { + printf("Decrypting contents %d.\n", i); + } + + do_decrypt(contentpos, size, encryptedkey, iv); + + // Main rom content file + if (i == content_num) { + if (verbose) { + printf("Extracting content %d uint8_t Archive.\n",content_num); + } + char dbuf[100]; + snprintf(dbuf,100,"content%d",content_num); + if(!extract_u8_archive(contentpos,dbuf)){ + perror("Could not extract u8 archive"); + free(data); + return 0; + } + } + + char contentname[100]; + snprintf(contentname, 100, "content%d.app", i); + if (verbose) { + printf("Writing %s.\n", contentname); + } + outfile = fopen(contentname, "wb"); + if(!outfile){ + fprintf(stderr,"Could not open %s for writing\n",contentname); + free(data); + return 0; + } + fwrite(contentpos, 1, getcontentlength(data + tmdpos, i), outfile); + if(ferror(outfile)){ + fprintf(stderr,"Could not write to %s\n",contentname); + free(data); + return 0; + } + fclose(outfile); + contentpos += addpadding(size, 64); + } + chdir(".."); + free(data); + return 1; +} + +static int apply_dol_patch(const char *dol_file, uint32_t loading_address, uint8_t **data, uint32_t *size){ + if(verbose){ + printf("Injecting dol file %s\n",dol_file); + } + struct stat sbuffer; + chdir(workingdirectory); + doltool_ctxt_t *dolctxt = calloc(1,sizeof(*dolctxt)); + if(!dolctxt){ + perror("Could not create dol ctxt"); + errno = ENOMEM; + return -1; + } + dol_load(dolctxt,data,size); + FILE *inject_file = fopen(dol_file,"rb"); + if(!inject_file){ + free(dolctxt); + perror(dol_file); + errno = ENOENT; + return -1; + } + stat(dol_file,&sbuffer); + uint8_t *inject_data = malloc(sbuffer.st_size); + fread(inject_data,1,sbuffer.st_size,inject_file); + fclose(inject_file); + dol_inject(dolctxt,inject_data,sbuffer.st_size,loading_address); + dol_save(dolctxt); + free(dolctxt); + free(inject_data); + chdir(directory); + return 0; +} + +static int do_pack() { + DIR *testdir = opendir(directory); + if (testdir) { + closedir(testdir); + } + else { + fprintf(stderr,"%s doesn't exist, or is not a directory!\n", directory); + return 0; + } + + if (verbose) { + printf("Packing %s into %s\n", directory, wad); + } + if(chdir(directory)==-1){ + fprintf(stderr,"Could not change directory to %s",directory); + return 0; + } + + if (verbose) { + printf("Gathering WAD Header Information\n"); + } + + struct stat sbuffer; + if(stat("cert.cert", &sbuffer)!=0){ + perror("Could not stat cert.cert\n"); + return 0; + } + uint32_t certsize = sbuffer.st_size; + + if(stat("ticket.tik", &sbuffer)!=0){ + perror("Could not stat ticket.tik\n"); + return 0; + } + uint32_t tiksize = sbuffer.st_size; + + if(stat("metadata.tmd", &sbuffer)!=0){ + perror("Could not stat metadata.tmd\n"); + return 0; + } + uint32_t tmdsize = sbuffer.st_size; + + if (verbose) { + printf("Reading cert.cert\n"); + } + FILE *infile = fopen("cert.cert", "rb"); + if(!infile){ + perror("Could not open cert.cert for reading\n"); + return 0; + } + uint8_t *cert = calloc(addpadding(certsize, 64), sizeof(uint8_t)); + if(!cert){ + fprintf(stderr,"Could not allocate %d bytes for cert\n",certsize); + return 0; + } + int bytesread = fread(cert, 1, certsize, infile); + if(bytesread!=certsize || ferror(infile)){ + perror("Error reading from cert.cert\n"); + free(cert); + return 0; + } + fclose(infile); + + if (verbose) { + printf("Reading ticket.cert\n"); + } + infile = fopen("ticket.tik", "rb"); + if(!infile){ + perror("Could not open ticket.tik for reading\n"); + free(cert); + return 0; + } + uint8_t *tik = calloc(addpadding(tiksize, 64), sizeof(uint8_t)); + if(!tik){ + fprintf(stderr,"Could not allocate %d bytes for ticket\n",tiksize); + free(cert); + return 0; + } + bytesread = fread(tik, 1, tiksize, infile); + if(bytesread!=tiksize || ferror(infile)){ + perror("Error reading from ticket.tik\n"); + free(cert); + free(tik); + return 0; + } + fclose(infile); + + if (verbose) { + printf("Reading metadata.tmd\n"); + } + infile = fopen("metadata.tmd", "rb"); + if(!infile){ + perror("Could not open metadata.tmd for reading\n"); + free(cert); + free(tik); + return 0; + } + uint8_t *tmd = calloc(addpadding(tmdsize, 64), sizeof(uint8_t)); + if(!tmd){ + fprintf(stderr,"Could not allocate %d bytes for tmd\n",tmdsize); + free(cert); + free(tik); + return 0; + } + bytesread = fread(tmd, 1, tmdsize, infile); + if(bytesread!=tmdsize || ferror(infile)){ + perror("Error reading from tmddata.tmd\n"); + free(cert); + free(tik); + free(tmd); + return 0; + } + fclose(infile); + + if (verbose) { + printf("Generating Footer signature\n"); + } + char footer[0x40] = {0}; + sprintf(footer,"gzinject v%s https://github.com/krimtonz/gzinject", GZINJECT_VERSION); + uint32_t footersize = 0x40; + + // Build Content5 into a .app file first + char dbuf[100], nbuf[100] = {0}; + snprintf(dbuf,100,"content%d",content_num); + strcpy(nbuf,dbuf); + strcat(nbuf,".app"); + if(verbose){ + printf("Generating %s u8 archive\n",nbuf); + } + + int content5len = create_u8_archive(dbuf,nbuf); + if(!content5len){ + fprintf(stderr,"Could not create u8 archive from %s into %s\n",dbuf,nbuf); + free(cert); + free(tik); + free(tmd); + return 0; + } + chdir(workingdirectory); + chdir(directory); + if (verbose) { + printf("Modifying content metadata in the TMD\n"); + } + uint16_t contentsc = be16(tmd + 0x1DE); + int i; + + char cfname[100]; + uint8_t **fileptrs = malloc(sizeof(*fileptrs) * contentsc); + if(!fileptrs){ + perror("Could not allocate filepointers.\n"); + free(cert); + free(tik); + free(tmd); + return 0; + } + uint32_t *filesizes = malloc(sizeof(*filesizes) * contentsc); + if(!filesizes){ + perror("Could not allocate filesizes\n"); + free(cert); + free(tik); + free(tmd); + free(fileptrs); + return 0; + } + + for (i = 0; i < contentsc; i++) { + snprintf(cfname, 30, "content%d.app", i); + stat(cfname, &sbuffer); + filesizes[i] = addpadding(sbuffer.st_size,16); + fileptrs[i] = calloc(filesizes[i],1); + if(!fileptrs[i]){ + fprintf(stderr,"Could not allocate %ld bytes for %s\n",sbuffer.st_size,cfname); + goto error; + } + infile = fopen(cfname,"rb"); + if(!infile){ + fprintf(stderr,"Could not open %s for reading\n",cfname); + goto error; + } + bytesread = fread(fileptrs[i],1,sbuffer.st_size,infile); + if(bytesread!=sbuffer.st_size || ferror(infile)){ + fprintf(stderr,"Error reading from %s\n",cfname); + goto error; + } + fclose(infile); + setcontentlength(tmd,i,filesizes[i]); + } + + int patch_idx = 0; + int dol_applied = 0; + if(dol_after>=101) dol_after-=101; + + while(patch){ + if(verbose){ + printf("Applying %s gzi patches\n",patch->filename); + } + + if(chdir(workingdirectory)!=0){ + fprintf(stderr,"Could not change directory to %s",workingdirectory); + } + gzi_ctxt_t gzi; + if(!gzi_init(&gzi,fileptrs,filesizes,contentsc,tmd,tik,cert,&tmdsize,&tiksize,&certsize)){ + perror("Could not initialize patch file"); + goto error; + + } + if(!gzi_parse_file(&gzi,patch->filename)){ + perror("Could not parse gzi patch file"); + goto error; + } + if(!gzi_run(&gzi)){ + perror("Could not run gzi patch file"); + goto error; + } + if(chdir(directory)!=0){ + fprintf(stderr,"Could not change directory to %s",directory); + goto error; + } + + for(int i=0;inext; + free(old_patch); + if(dol_after == patch_idx){ + while(dol && dol_loading){ + if (apply_dol_patch(dol->filename,dol_loading->loading_address,&fileptrs[1],&filesizes[1]) != 0) { + fprintf(stderr, "Could not inject dol patch\n"); + goto error; + } + dol_list_t *old_dol = dol; + dol = dol->next; + free(old_dol); + dol_loading_list_t *old_loading = dol_loading; + dol_loading = dol_loading->next; + free(old_loading); + } + dol_applied = 1; + setcontentlength(tmd,1,filesizes[1]); + } + patch_idx++; + } + + if(!dol_applied && dol && dol_loading){ + while(dol && dol_loading){ + if (apply_dol_patch(dol->filename,dol_loading->loading_address,&fileptrs[1],&filesizes[1]) != 0) { + fprintf(stderr, "Could not inject dol patch\n"); + goto error; + } + dol_list_t *old_dol = dol; + dol = dol->next; + free(old_dol); + dol_loading_list_t *old_loading = dol_loading; + dol_loading = dol_loading->next; + free(old_loading); + } + setcontentlength(tmd,1,filesizes[1]); + } + + // Change Title ID + if (titleid != NULL) { + if (verbose) { + printf("Changing Channel ID\n"); + } + memcpy(tik + 0x1e0, titleid, 4); + memcpy(tmd + 0x190, titleid, 4); + } + + if (verbose) { + printf("Changing region in the TMD\n"); + } + // Change the Region + tmd[0x19d] = region; + + if (verbose) { + printf("Changing encryption key in the ticket\n"); + } + // New key + memcpy(tik + 0x1bf, &newkey, 16); + + //Decrypt the new key + uint8_t newenc[16]; + uint8_t iv[16]; + + for (i = 0; i < 16; i++) { + newenc[i] = *(tik + 0x1bf + i); + } + for (i = 0; i < 8; i++) { + iv[i] = *(tik + 0x1dc + i); + iv[i + 8] = 0x00; + } + + do_decrypt(newenc, 16, key, iv); + + int j; + + for (j = 2; j < 15; j++) { + iv[j] = 0x00; + } + + for (i = 0; i < contentsc; i++) { + uint8_t *contents = fileptrs[i]; + + if (i == 0) { + if (channelname != NULL) { + if (verbose) { + printf("Changing the Channel Name in content0.app\n"); + } + + uint16_t imetpos = -1; + for (j = 0; j < 400; j++) { + if (strcmp((char*)(contents + j),"IMET")==0) { + imetpos = j; + break; + } + } + if(imetpos!=-1){ + uint16_t count = 0; + size_t cnamelen = strlen(channelname); + char namebuf[40] = {0}; + for(j=0,count=0;count0){ + fwrite(&padding,1,padcnt,outwadfile); + if(ferror(outwadfile)){ + perror("Could not write write content padding\n"); + goto error; + } + } + } + if (verbose) { + printf("Writing footer\n"); + } + fwrite(footer, 1, 0x40, outwadfile); + if(ferror(outwadfile)){ + perror("Could not write footer\n"); + goto error; + } + fclose(outwadfile); + + + free(cert); + free(tik); + free(tmd); + for(i=0;ifilename = optarg; + new_patch->next = NULL; + *patch_link = new_patch; + patch_link = &new_patch->next; + break; + } + case 'c': + content_num = optarg[0] - 0x30; + if(content_num<0 || content_num>9) content_num=5; + break; + case 'f': + { + dol_list_t *new_dol = malloc(sizeof(*new_dol)); + if(new_dol == NULL){ + perror("Could not allocate dol list"); + exit(1); + } + new_dol->filename = optarg; + new_dol->next = NULL; + *dol_link = new_dol; + dol_link = &new_dol->next; + break; + } + case 'l':{ + char loading_address[10]; + sscanf(optarg,"%9s",loading_address); + uint32_t addr; + sscanf(loading_address,"%"SCNx32,&addr); + dol_loading_list_t *new_dol_loading = malloc(sizeof(*new_dol_loading)); + if(new_dol_loading == NULL){ + perror("Could not allocate dol loading address."); + exit(1); + } + new_dol_loading->loading_address = addr; + new_dol_loading->next = NULL; + *dol_loading_link = new_dol_loading; + dol_loading_link = &new_dol_loading->next; + break; + } + case 'e': { + char dol_after_str[10]; + sscanf(optarg, "%s", dol_after_str); + sscanf(dol_after_str, "%"SCNu32, &dol_after); + break; + } + default: + break; + } + + } + + if (action == NULL) { + print_usage(); + exit(1); + } + + if(strcmp(action, "romc") == 0){ + romc(); + return 0; + } + + if (strcmp(action, "genkey") == 0){ + genkey(); + return 0; + } + + if (strcmp(action, "extract") != 0 && strcmp(action, "pack") != 0 && strcmp(action, "inject") != 0) { + print_usage(); + exit(1); + } + + if (wad == NULL) { + print_usage(); + exit(1); + } + + if (directory == NULL) directory = "wadextract"; + + struct stat sbuffer; + if (keyfile == NULL) { + if (stat("key.bin", &sbuffer) == 0) { + keyfile = "key.bin"; + } + else if (stat("common-key.bin", &sbuffer) == 0) { + keyfile = "common-key.bin"; + } + else { + printf("Cannot find key.bin or common-key.bin.\n"); + exit(1); + } + } + else { + if (stat(keyfile, &sbuffer) != 0) { + printf("Cannot find keyfile specified.\n"); + exit(1); + } + } + + FILE *fkeyfile = fopen(keyfile, "rb"); + if(!fkeyfile){ + perror("Could not open keyfile"); + exit(1); + } + + fread(&key, 1, 16, fkeyfile); + if(ferror(fkeyfile)){ + perror("Could not read from keyfile."); + exit(1); + } + fclose(fkeyfile); + + workingdirectory = malloc(200); + if(!workingdirectory){ + perror("Could not allocate for working directory"); + exit(1); + } + workingdirectory = getcwd(workingdirectory, 200); + + if (strcmp(action, "extract") == 0) { + if(!do_extract()){ + exit(1); + } + } + else if (strcmp(action, "pack") == 0) { + if(!do_pack()){ + exit(1); + } + } + else if (strcmp(action, "inject") == 0) { + if (rom == NULL) { + printf("-a inject specified, but no rom to inject\n"); + free(workingdirectory); + exit(1); + + } + if(!do_extract()){ + perror("Could not extract wad\n"); + free(workingdirectory); + exit(1); + } + + if (verbose) { + printf("Copying %s to %s/content%d/rom\n", rom, directory,content_num); + } + FILE *from = fopen(rom, "rb"); + fseek(from, 0, SEEK_END); + size_t fromlen = ftell(from); + fseek(from, 0, SEEK_SET); + uint8_t *inrom = malloc(fromlen); + if(!inrom){ + perror("could not allocate input rom\n"); + free(workingdirectory); + exit(1); + } + fread(inrom, 1, fromlen, from); + fclose(from); + + char *orom = malloc(200); + if(!orom){ + perror("Could not allocate output rom name\n"); + free(workingdirectory); + free(inrom); + exit(1); + } + snprintf(orom, 200, "%s/content%d/rom", directory,content_num); + from = fopen(orom, "wb"); + fwrite(inrom, 1, fromlen, from); + fclose(from); + free(inrom); + free(orom); + + + char *wadname = removeext(wad), + *outname = malloc(strlen(wadname) + 12); + if(!outname){ + perror("could not allocate for output wad name\n"); + free(workingdirectory); + exit(1); + } + sprintf(outname, "%s-inject.wad", wadname); + free(wadname); + if (outwad == NULL) { + wad = outname; + } + else { + wad = outwad; + } + + if(!do_pack()){ + perror("Could not pack wad\n"); + free(outname); + free(workingdirectory); + exit(1); + } + free(outname); + } + + free(workingdirectory); + return 0; +} diff --git a/tools/gzinject/src/gzinject.h b/tools/gzinject/src/gzinject.h new file mode 100644 index 000000000..493557caf --- /dev/null +++ b/tools/gzinject/src/gzinject.h @@ -0,0 +1,50 @@ +#ifndef _GZINJECT_H_ +#define _GZINJECT_H_ + +#include +#include + +#define REVERSEENDIAN32(X) (((X) >> 24) & 0xff) | (((X)<<8) & 0xFF0000) | (((X) >> 8) & 0xff00) | (((X)<<24) & 0xff000000) +#define REVERSEENDIAN16(X) (((X)>>8) & 0xff) | (((X)<<8) & 0xFF00) + +#define W_TIK 0x00 +#define W_TMD 0x01 +#define GZINJECT_VERSION "0.3.3" + +#if _WIN32 +#define mkdir(X,Y) mkdir(X) +#define getcwd(X,Y) _getcwd(X,Y) +#endif + +typedef enum{ + FILE_DIRECTORY, + FILE_NORMAL +}filetype_t; + +typedef struct patch_list patch_list_t; +struct patch_list { + const char *filename; + patch_list_t *next; +}; + +typedef struct dol_list dol_list_t; +struct dol_list{ + const char *filename; + dol_list_t *next; +}; + +typedef struct dol_loading_list dol_loading_list_t; +struct dol_loading_list{ + uint32_t loading_address; + dol_loading_list_t *next; +}; + + uint16_t be16(const uint8_t *p); + + uint32_t be32(const uint8_t *p); + +uint32_t addpadding(uint32_t inp, uint32_t padding); + +extern int verbose; + +#endif diff --git a/tools/gzinject/src/lz77.c b/tools/gzinject/src/lz77.c new file mode 100644 index 000000000..5f9063ab3 --- /dev/null +++ b/tools/gzinject/src/lz77.c @@ -0,0 +1,175 @@ +#include +#include +#include +#include "lz77.h" +#include "gzinject.h" + +int lz77_compressed_length(uint8_t *src){ + if(*src!=0x10){ + return -1; + } + uint32_t size = *(uint32_t*)src >> 8; + uint32_t pos = 0; + int idx = 4; +cloop: + while(pos>4 & 0xF) + 3; + if(((src[idx] & 0xF)<<8) + (src[idx + 1] + 1) <= pos){ + pos+=n; + idx+=2; + }else{ + break; + } + }else{ + pos++; + idx++; + } + flags <<= 1; + lab++; + }else{ + goto cloop; + } + + } + return -1; + } + if(idx%4!=0){ + idx+=4-idx%4; + } + return idx; +} + +int lz77_decompressed_size(uint8_t *source){ + return *(uint32_t*)(source + 1); +} + +int lz77_decompress(uint8_t *src, uint8_t *dest){ + if(*src++ != 0x10){ + return -1; + } + int index1 = 0; + int num1 = src[0] + (src[1] << 8) + (src[2]<<16); + src+=3; + while(index1>4); + int num4 = 1 + ((src[0] & 0xF) << 8) + src[1]; + src+=2; + if(num4>num1){ + return -1; + } + for(int index3 = 0;index3=len){ + dest[0] = -1; + dest[1] = 0; + return; + } + if(pos<2 || len-pos<2){ + dest[0] = 0; + dest[1] = 0; + return; + } + + int didx = 0; + for(int index = 1; index<0x1000 && index=0;--index){ + if(source[pos+num]!=source[pos-d[index] + num % d[index]]){ + if(didx>1){ + memmove((void*)d + (sizeof(int) * index),(void*)d + (sizeof(int) * (index+1)),sizeof(int) * (didx - index - 1)); + didx--; + }else{ + flag = 0; + } + } + } + } + dest[0] = num; + dest[1] = d[0]; +} + +int lz77_compress(uint8_t *src, uint8_t **dest, uint32_t len, uint32_t *lenp){ + int pos = 0; + int cpos = 0; + uint8_t *comp = calloc(len,1); + comp[cpos++] = 0x10; + uint8_t *cp = (uint8_t*)lenp; + for(int index=0;index<3;++index){ + comp[cpos++]=*(uint8_t*)cp++; + } + int d[2]; + int dbuf[0x4000]; + while(pos 2){ + uint8_t num2 = ((((d[0] - 3) & 0xF) << 4) + ((d[1] - 1) >> 8 & 0xF)); + comp2[bpos++] = num2; + uint8_t num3 = (d[1] - 1) & 0xFF; + comp2[bpos++] = num3; + pos+=d[0]; + num1 |= 1 << (8 - (index+1)); + }else if(d[0]>=0){ + comp2[bpos++] = src[pos++]; + }else{ + break; + } + } + comp[cpos++] = num1; + for(int i=0;i +#include + +int lz77_compressed_length(uint8_t *source); +int lz77_decompress(uint8_t *source, uint8_t *dest); +int lz77_decompressed_size(uint8_t *source); +int lz77_compress(uint8_t *src, uint8_t **dest, uint32_t len, uint32_t *intp); + +#endif \ No newline at end of file diff --git a/tools/gzinject/src/md5.c b/tools/gzinject/src/md5.c new file mode 100644 index 000000000..e0affaaf0 --- /dev/null +++ b/tools/gzinject/src/md5.c @@ -0,0 +1,291 @@ +/* +* This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. +* MD5 Message-Digest Algorithm (RFC 1321). +* +* Homepage: +* http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 +* +* Author: +* Alexander Peslyak, better known as Solar Designer +* +* This software was written by Alexander Peslyak in 2001. No copyright is +* claimed, and the software is hereby placed in the public domain. +* In case this attempt to disclaim copyright and place the software in the +* public domain is deemed null and void, then the software is +* Copyright (c) 2001 Alexander Peslyak and it is hereby released to the +* general public under the following terms: +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted. +* +* There's ABSOLUTELY NO WARRANTY, express or implied. +* +* (This is a heavily cut-down "BSD license".) +* +* This differs from Colin Plumb's older public domain implementation in that +* no exactly 32-bit integer data type is required (any 32-bit or wider +* unsigned integer data type will do), there's no compile-time endianness +* configuration, and the function prototypes match OpenSSL's. No code from +* Colin Plumb's implementation has been reused; this comment merely compares +* the properties of the two independent implementations. +* +* The primary goals of this implementation are portability and ease of use. +* It is meant to be fast, but not as fast as possible. Some known +* optimizations are not included to reduce source code size and avoid +* compile-time configuration. +*/ + +#ifndef HAVE_OPENSSL + +#include + +#include "md5.h" + +/* +* The basic MD5 functions. +* +* F and G are optimized compared to their RFC 1321 definitions for +* architectures that lack an AND-NOT instruction, just like in Colin Plumb's +* implementation. +*/ +#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y)))) +#define H(x, y, z) (((x) ^ (y)) ^ (z)) +#define H2(x, y, z) ((x) ^ ((y) ^ (z))) +#define I(x, y, z) ((y) ^ ((x) | ~(z))) + +/* +* The MD5 transformation for all four rounds. +*/ +#define STEP(f, a, b, c, d, x, t, s) \ + (a) += f((b), (c), (d)) + (x) + (t); \ + (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \ + (a) += (b); + +/* +* SET reads 4 input bytes in little-endian byte order and stores them in a +* properly aligned word in host byte order. +* +* The check for little-endian architectures that tolerate unaligned memory +* accesses is just an optimization. Nothing will break if it fails to detect +* a suitable architecture. +* +* Unfortunately, this optimization may be a C strict aliasing rules violation +* if the caller's data buffer has effective type that cannot be aliased by +* MD5_u32plus. In practice, this problem may occur if these MD5 routines are +* inlined into a calling function, or with future and dangerously advanced +* link-time optimizations. For the time being, keeping these MD5 routines in +* their own translation unit avoids the problem. +*/ +#if defined(__i386__) || defined(__x86_64__) || defined(__vax__) +#define SET(n) \ + (*(MD5_u32plus *)&ptr[(n) * 4]) +#define GET(n) \ + SET(n) +#else +#define SET(n) \ + (ctx->block[(n)] = \ + (MD5_u32plus)ptr[(n) * 4] | \ + ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \ + ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \ + ((MD5_u32plus)ptr[(n) * 4 + 3] << 24)) +#define GET(n) \ + (ctx->block[(n)]) +#endif + +/* +* This processes one or more 64-byte data blocks, but does NOT update the bit +* counters. There are no alignment requirements. +*/ +static const void *body(MD5_CTX *ctx, const void *data, unsigned long size) +{ + const unsigned char *ptr; + MD5_u32plus a, b, c, d; + MD5_u32plus saved_a, saved_b, saved_c, saved_d; + + ptr = (const unsigned char *)data; + + a = ctx->a; + b = ctx->b; + c = ctx->c; + d = ctx->d; + + do { + saved_a = a; + saved_b = b; + saved_c = c; + saved_d = d; + + /* Round 1 */ + STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7) + STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12) + STEP(F, c, d, a, b, SET(2), 0x242070db, 17) + STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22) + STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7) + STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12) + STEP(F, c, d, a, b, SET(6), 0xa8304613, 17) + STEP(F, b, c, d, a, SET(7), 0xfd469501, 22) + STEP(F, a, b, c, d, SET(8), 0x698098d8, 7) + STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12) + STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17) + STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22) + STEP(F, a, b, c, d, SET(12), 0x6b901122, 7) + STEP(F, d, a, b, c, SET(13), 0xfd987193, 12) + STEP(F, c, d, a, b, SET(14), 0xa679438e, 17) + STEP(F, b, c, d, a, SET(15), 0x49b40821, 22) + + /* Round 2 */ + STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5) + STEP(G, d, a, b, c, GET(6), 0xc040b340, 9) + STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14) + STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20) + STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5) + STEP(G, d, a, b, c, GET(10), 0x02441453, 9) + STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14) + STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20) + STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5) + STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9) + STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14) + STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20) + STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5) + STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9) + STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14) + STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20) + + /* Round 3 */ + STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4) + STEP(H2, d, a, b, c, GET(8), 0x8771f681, 11) + STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16) + STEP(H2, b, c, d, a, GET(14), 0xfde5380c, 23) + STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4) + STEP(H2, d, a, b, c, GET(4), 0x4bdecfa9, 11) + STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16) + STEP(H2, b, c, d, a, GET(10), 0xbebfbc70, 23) + STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4) + STEP(H2, d, a, b, c, GET(0), 0xeaa127fa, 11) + STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16) + STEP(H2, b, c, d, a, GET(6), 0x04881d05, 23) + STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4) + STEP(H2, d, a, b, c, GET(12), 0xe6db99e5, 11) + STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16) + STEP(H2, b, c, d, a, GET(2), 0xc4ac5665, 23) + + /* Round 4 */ + STEP(I, a, b, c, d, GET(0), 0xf4292244, 6) + STEP(I, d, a, b, c, GET(7), 0x432aff97, 10) + STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15) + STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21) + STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6) + STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10) + STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15) + STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21) + STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6) + STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10) + STEP(I, c, d, a, b, GET(6), 0xa3014314, 15) + STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21) + STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6) + STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10) + STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15) + STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21) + + a += saved_a; + b += saved_b; + c += saved_c; + d += saved_d; + + ptr += 64; + } while (size -= 64); + + ctx->a = a; + ctx->b = b; + ctx->c = c; + ctx->d = d; + + return ptr; +} + +void MD5_Init(MD5_CTX *ctx) +{ + ctx->a = 0x67452301; + ctx->b = 0xefcdab89; + ctx->c = 0x98badcfe; + ctx->d = 0x10325476; + + ctx->lo = 0; + ctx->hi = 0; +} + +void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size) +{ + MD5_u32plus saved_lo; + unsigned long used, available; + + saved_lo = ctx->lo; + if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) + ctx->hi++; + ctx->hi += size >> 29; + + used = saved_lo & 0x3f; + + if (used) { + available = 64 - used; + + if (size < available) { + memcpy(&ctx->buffer[used], data, size); + return; + } + + memcpy(&ctx->buffer[used], data, available); + data = (const unsigned char *)data + available; + size -= available; + body(ctx, ctx->buffer, 64); + } + + if (size >= 64) { + data = body(ctx, data, size & ~(unsigned long)0x3f); + size &= 0x3f; + } + + memcpy(ctx->buffer, data, size); +} + +#define OUT(dst, src) \ + (dst)[0] = (unsigned char)(src); \ + (dst)[1] = (unsigned char)((src) >> 8); \ + (dst)[2] = (unsigned char)((src) >> 16); \ + (dst)[3] = (unsigned char)((src) >> 24); + +void MD5_Final(unsigned char *result, MD5_CTX *ctx) +{ + unsigned long used, available; + + used = ctx->lo & 0x3f; + + ctx->buffer[used++] = 0x80; + + available = 64 - used; + + if (available < 8) { + memset(&ctx->buffer[used], 0, available); + body(ctx, ctx->buffer, 64); + used = 0; + available = 64; + } + + memset(&ctx->buffer[used], 0, available - 8); + + ctx->lo <<= 3; + OUT(&ctx->buffer[56], ctx->lo) + OUT(&ctx->buffer[60], ctx->hi) + + body(ctx, ctx->buffer, 64); + + OUT(&result[0], ctx->a) + OUT(&result[4], ctx->b) + OUT(&result[8], ctx->c) + OUT(&result[12], ctx->d) + + memset(ctx, 0, sizeof(*ctx)); +} + +#endif \ No newline at end of file diff --git a/tools/gzinject/src/md5.h b/tools/gzinject/src/md5.h new file mode 100644 index 000000000..f51d33e6d --- /dev/null +++ b/tools/gzinject/src/md5.h @@ -0,0 +1,45 @@ +/* +* This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. +* MD5 Message-Digest Algorithm (RFC 1321). +* +* Homepage: +* http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 +* +* Author: +* Alexander Peslyak, better known as Solar Designer +* +* This software was written by Alexander Peslyak in 2001. No copyright is +* claimed, and the software is hereby placed in the public domain. +* In case this attempt to disclaim copyright and place the software in the +* public domain is deemed null and void, then the software is +* Copyright (c) 2001 Alexander Peslyak and it is hereby released to the +* general public under the following terms: +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted. +* +* There's ABSOLUTELY NO WARRANTY, express or implied. +* +* See md5.c for more information. +*/ + +#ifdef HAVE_OPENSSL +#include +#elif !defined(_MD5_H) +#define _MD5_H + +/* Any 32-bit or wider unsigned integer data type will do */ +typedef unsigned int MD5_u32plus; + +typedef struct { + MD5_u32plus lo, hi; + MD5_u32plus a, b, c, d; + unsigned char buffer[64]; + MD5_u32plus block[16]; +} MD5_CTX; + +extern void MD5_Init(MD5_CTX *ctx); +extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size); +extern void MD5_Final(unsigned char *result, MD5_CTX *ctx); + +#endif \ No newline at end of file diff --git a/tools/gzinject/src/romchu.c b/tools/gzinject/src/romchu.c new file mode 100644 index 000000000..aa37bb9cc --- /dev/null +++ b/tools/gzinject/src/romchu.c @@ -0,0 +1,543 @@ +#include +#include +#include +#include +#include + +/* romchu 0.6 */ +/* a decompressor for type 2 romc */ +/* reversed by hcs from the Wii VC wad for Super Smash Bros EU. */ +/* this code is public domain, have at it */ +/* Taken from https://forum.xentax.com/viewtopic.php?t=5364 */ + +#define VERSION "0.6" + +struct bitstream; + +struct bitstream *init_bitstream(const unsigned char *pool, unsigned long pool_size); +uint32_t get_bits(struct bitstream *bs, int bits); +int bitstream_eof(struct bitstream *bs); +void free_bitstream(struct bitstream *bs); + +struct huftable; + +struct huftable *load_table(struct bitstream *bs, int symbols); +int huf_lookup(struct bitstream *bs, struct huftable *ht); +void free_table(struct huftable *); + +struct { + unsigned int bits; + unsigned int base; +} backref_len[0x1D], backref_disp[0x1E]; + +uint8_t *romchu_decompress(uint8_t *compressed, size_t comp_size, size_t *decomp_size){ + + unsigned char head_buf[4]; + unsigned char payload_buf[0x10000]; + int block_count = 0; + long out_offset = 0; + uint8_t *decompressed; + + uint64_t nominal_size; + int romc_type; + uint8_t *comp = compressed; + // read header + { + memcpy(head_buf,compressed,4); + nominal_size = head_buf[0]; + nominal_size *= 0x100; + nominal_size |= head_buf[1]; + nominal_size *= 0x100; + nominal_size |= head_buf[2]; + nominal_size *= 0x40; + nominal_size |= head_buf[3]>>2; + romc_type = head_buf[3]&0x3; + decompressed = malloc(nominal_size); + if(decomp_size) *decomp_size = nominal_size; + if (!decompressed) + { + perror("malloc big outbuf buffer"); + return NULL; + } + + switch(romc_type) { + case 0: + memcpy(decompressed, compressed + 4, *decomp_size); + return decompressed; + case 2: + break; + default: + fprintf(stderr, "Unsupported romc type. %d\n", romc_type); + return NULL; + + } + } + + // initialize backreference lookup tables + { + for (unsigned int i = 0; i < 8; i++) + { + backref_len[i].bits = 0; + backref_len[i].base = i; + } + + for (unsigned int i = 8, scale = 1; scale < 6; scale++) + { + for (unsigned int k = (1<<(scale+2)); + k < (1<<(scale+3)); + k += (1< 0) + { + read_size ++; + } + + if (read_size > sizeof(payload_buf)) + { + fprintf(stderr, "payload too large\n"); + free(decompressed); + return NULL; + } + memcpy(payload_buf,compressed,read_size); + compressed+=read_size; + + /* attempt to parse... */ + + if (compression_flag) + { + uint16_t tab1_size, tab2_size; + uint32_t body_size; + unsigned long tab1_offset, tab2_offset, body_offset; + struct bitstream *bs; + struct huftable *table1, *table2; + + /* read table 1 size */ + tab1_offset = 0; + bs = init_bitstream(payload_buf + tab1_offset, payload_bytes*8+payload_bits); + tab1_size = get_bits(bs, 16); + free_bitstream(bs); + + /* load table 1 */ + bs = init_bitstream(payload_buf + tab1_offset + 2, tab1_size); + table1 = load_table(bs, 0x11D); + free_bitstream(bs); + + /* read table 2 size */ + tab2_offset = tab1_offset + 2 + (tab1_size+7) / 8; + bs = init_bitstream(payload_buf + tab2_offset, 2*8); + tab2_size = get_bits(bs, 16); + free_bitstream(bs); + + /* load table 2 */ + bs = init_bitstream(payload_buf + tab2_offset + 2, tab2_size); + table2 = load_table(bs, 0x1E); + free_bitstream(bs); + + /* decode body */ + body_offset = tab2_offset + 2 + (tab2_size+7) / 8; + body_size = payload_bytes*8 + payload_bits - body_offset*8; + bs = init_bitstream(payload_buf + body_offset, body_size); + + while (!bitstream_eof(bs)) + { + int symbol = huf_lookup(bs, table1); + + if (symbol < 0x100) + { + /* byte literal */ + unsigned char b = symbol; + if (out_offset >= nominal_size) + { + fprintf(stderr, "generated too many bytes\n"); + free(decompressed); + return NULL; + } + decompressed[out_offset++] = b; + } + else + { + /* backreference */ + unsigned int len_bits = backref_len[symbol-0x100].bits; + unsigned int len = backref_len[symbol-0x100].base; + if (len_bits > 0) + { + len += get_bits(bs, len_bits); + } + len += 3; + + int symbol2 = huf_lookup(bs, table2); + + unsigned int disp_bits = backref_disp[symbol2].bits; + unsigned int disp = backref_disp[symbol2].base; + if (disp_bits > 0) + { + disp += get_bits(bs, disp_bits); + } + disp ++; + + if (disp > out_offset) + { + fprintf(stderr, "backreference too far\n"); + free(decompressed); + return NULL; + } + if (out_offset+len > nominal_size) + { + fprintf(stderr, "generated too many bytes\n"); + free(decompressed); + return NULL; + } + for (unsigned int i = 0; i < len; i++, out_offset++) + { + decompressed[out_offset] = decompressed[out_offset-disp]; + } + } + } + + free_table(table1); + free_table(table2); + free_bitstream(bs); + } + else + { + if (out_offset + payload_bytes > nominal_size) + { + fprintf(stderr, "generated too many bytes\n"); + free(decompressed); + return NULL; + } + memcpy(decompressed+out_offset, payload_buf, payload_bytes); + out_offset += payload_bytes; + } + + block_count ++; + } + return decompressed; +} + +/* bitstream reader */ +struct bitstream +{ + const unsigned char *pool; + long bits_left; + uint8_t first_byte; + int first_byte_bits; +}; + +struct bitstream *init_bitstream(const unsigned char *pool, unsigned long pool_size) +{ + struct bitstream *bs = malloc(sizeof(struct bitstream)); + if (!bs) + { + perror("bitstream malloc"); + exit(EXIT_FAILURE); + } + + bs->pool = pool; + bs->bits_left = pool_size; + bs->first_byte_bits = 0; + + /* check that padding bits are 0 (to ensure we aren't ignoring anything) */ + if (pool_size%8) + { + if (pool[pool_size/8] & ~((1<<(pool_size%8))-1)) + { + fprintf(stderr, "nonzero padding at end of bitstream\n"); + exit(EXIT_FAILURE); + } + } + + return bs; +} + +uint32_t get_bits(struct bitstream *bs, int bits) +{ + uint32_t accum = 0; + + if (bits > 32) + { + fprintf(stderr, "get_bits() supports max 32\n"); + exit(EXIT_FAILURE); + } + if (bits > bs->bits_left + bs->first_byte_bits) + { + fprintf(stderr, "get_bits() underflow\n"); + exit(EXIT_FAILURE); + } + + for (int i = 0; i < bits; i++) + { + if (bs->first_byte_bits == 0) + { + bs->first_byte = *bs->pool; + bs->pool ++; + if (bs->bits_left >= 8) + { + bs->first_byte_bits = 8; + bs->bits_left -= 8; + } + else + { + bs->first_byte_bits = bs->bits_left; + bs->bits_left = 0; + } + } + + accum >>= 1; + accum |= (bs->first_byte & 1)<<31; + bs->first_byte >>= 1; + bs->first_byte_bits --; + } + + return accum>>(32-bits); +} + +int bitstream_eof(struct bitstream *bs) +{ + return (bs->bits_left + bs->first_byte_bits == 0); +} + +void free_bitstream(struct bitstream *bs) +{ + free(bs); +} + +/* Huffman code handling */ +struct hufnode { + int is_leaf; + union { + struct { + int left, right; + } inner; + struct { + int symbol; + } leaf; + } u; +}; +struct huftable { + int symbols; + struct hufnode *t; +}; + +struct huftable *load_table(struct bitstream *bs, int symbols) +{ + int len_count[32] = {0}; + uint32_t codes[32]; + int *length_of = malloc(sizeof(*length_of) * symbols); + struct huftable *ht; + int next_free_node; + + for (int i = 0; i < symbols; ) + { + if (get_bits(bs, 1)) + { + /* run of equal lengths */ + int count = get_bits(bs, 7) + 2; + int length = get_bits(bs, 5); + + len_count[length] += count; + for (int j = 0; j < count; j++, i++) + { + length_of[i] = length; + } + } + else + { + /* set of inequal lengths */ + int count = get_bits(bs, 7) + 1; + + for (int j = 0; j < count; j++, i++) + { + int length = get_bits(bs, 5); + length_of[i] = length; + len_count[length] ++; + } + } + } + + if (!bitstream_eof(bs)) + { + fprintf(stderr, "did not exhaust bitstream reading table\n"); + exit(EXIT_FAILURE); + } + + /* compute the first canonical Huffman code for each length */ + len_count[0] = 0; // not strictly necessary + for (uint32_t i = 1, accum = 0; i < 32; i++) + { + accum = codes[i] = (accum + len_count[i-1]) << 1; + } + + /* allocate space for the tree */ + ht = malloc(sizeof(struct huftable)); + if (!ht) + { + perror("malloc of huftable"); + exit(EXIT_FAILURE); + } + ht->symbols = symbols; + ht->t = malloc(sizeof(struct hufnode) * symbols * 2); + if (!ht->t) + { + perror("malloc of hufnodes"); + exit(EXIT_FAILURE); + } + + /* determine codes and build a tree */ + for (int i = 0; i < symbols*2; i++) + { + ht->t[i].is_leaf = 0; + ht->t[i].u.inner.left = ht->t[i].u.inner.right = 0; + } + next_free_node = 1; + for (int i = 0; i < symbols; i++) + { + int cur = 0; + if (0 == length_of[i]) + { + // 0 length indicates absent symbol + continue; + } + + for (int j = length_of[i]-1; j >= 0; j --) + { + int next; + if (ht->t[cur].is_leaf) + { + fprintf(stderr, "oops, walked onto a leaf\n"); + exit(EXIT_FAILURE); + } + + if (codes[length_of[i]]&(1<t[cur].u.inner.right; + if (0 == next) + { + next = ht->t[cur].u.inner.right = next_free_node ++; + } + } + else + { + // 0 == left + next = ht->t[cur].u.inner.left ; + if (0 == next) + { + next = ht->t[cur].u.inner.left = next_free_node ++; + } + } + + cur = next; + } + + ht->t[cur].is_leaf = 1; + ht->t[cur].u.leaf.symbol = i; + + codes[length_of[i]] ++; + } + free(length_of); + return ht; +} + +int huf_lookup(struct bitstream *bs, struct huftable *ht) +{ + int cur = 0; + while (!ht->t[cur].is_leaf) + { + if (get_bits(bs, 1)) + { + // 1 == right + cur = ht->t[cur].u.inner.right; + } + else + { + // 0 == left + cur = ht->t[cur].u.inner.left; + } + } + + return ht->t[cur].u.leaf.symbol; +} + +void free_table(struct huftable *ht) +{ + if (ht) + { + free(ht->t); + } + free(ht); +} diff --git a/tools/gzinject/src/romchu.h b/tools/gzinject/src/romchu.h new file mode 100644 index 000000000..1c2f8b838 --- /dev/null +++ b/tools/gzinject/src/romchu.h @@ -0,0 +1,8 @@ +#ifndef _ROMCHU_H +#define _ROMCHU_H + +#include + +uint8_t *romchu_decompress(uint8_t *compressed, size_t comp_size, size_t *decomp_size); + +#endif \ No newline at end of file diff --git a/tools/gzinject/src/sha1.c b/tools/gzinject/src/sha1.c new file mode 100644 index 000000000..73794062a --- /dev/null +++ b/tools/gzinject/src/sha1.c @@ -0,0 +1,296 @@ +/* +SHA-1 in C +By Steve Reid +100% Public Domain + +Test Vectors (from FIPS PUB 180-1) +"abc" +A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D +"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" +84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 +A million repetitions of "a" +34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F +*/ + +/* #define LITTLE_ENDIAN * This should be #define'd already, if true. */ +/* #define SHA1HANDSOFF * Copies data before messing with it. */ + +#define SHA1HANDSOFF + +#include +#include + +/* for uint32_t */ +#include + +#include "sha1.h" + + +#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) + +/* blk0() and blk() perform the initial expand. */ +/* I got the idea of expanding during the round function from SSLeay */ +#if BYTE_ORDER == LITTLE_ENDIAN +#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ + |(rol(block->l[i],8)&0x00FF00FF)) +#elif BYTE_ORDER == BIG_ENDIAN +#define blk0(i) block->l[i] +#else +#error "Endianness not defined!" +#endif +#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ + ^block->l[(i+2)&15]^block->l[i&15],1)) + +/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ +#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); +#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); +#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); + + +/* Hash a single 512-bit block. This is the core of the algorithm. */ + +void SHA1Transform( + uint32_t state[5], + const unsigned char buffer[64] +) +{ + uint32_t a, b, c, d, e; + + typedef union + { + unsigned char c[64]; + uint32_t l[16]; + } CHAR64LONG16; + +#ifdef SHA1HANDSOFF + CHAR64LONG16 block[1]; /* use array to appear as a pointer */ + + memcpy(block, buffer, 64); +#else + /* The following had better never be used because it causes the + * pointer-to-const buffer to be cast into a pointer to non-const. + * And the result is written through. I threw a "const" in, hoping + * this will cause a diagnostic. + */ + CHAR64LONG16 *block = (const CHAR64LONG16 *)buffer; +#endif + /* Copy context->state[] to working vars */ + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + /* 4 rounds of 20 operations each. Loop unrolled. */ + R0(a, b, c, d, e, 0); + R0(e, a, b, c, d, 1); + R0(d, e, a, b, c, 2); + R0(c, d, e, a, b, 3); + R0(b, c, d, e, a, 4); + R0(a, b, c, d, e, 5); + R0(e, a, b, c, d, 6); + R0(d, e, a, b, c, 7); + R0(c, d, e, a, b, 8); + R0(b, c, d, e, a, 9); + R0(a, b, c, d, e, 10); + R0(e, a, b, c, d, 11); + R0(d, e, a, b, c, 12); + R0(c, d, e, a, b, 13); + R0(b, c, d, e, a, 14); + R0(a, b, c, d, e, 15); + R1(e, a, b, c, d, 16); + R1(d, e, a, b, c, 17); + R1(c, d, e, a, b, 18); + R1(b, c, d, e, a, 19); + R2(a, b, c, d, e, 20); + R2(e, a, b, c, d, 21); + R2(d, e, a, b, c, 22); + R2(c, d, e, a, b, 23); + R2(b, c, d, e, a, 24); + R2(a, b, c, d, e, 25); + R2(e, a, b, c, d, 26); + R2(d, e, a, b, c, 27); + R2(c, d, e, a, b, 28); + R2(b, c, d, e, a, 29); + R2(a, b, c, d, e, 30); + R2(e, a, b, c, d, 31); + R2(d, e, a, b, c, 32); + R2(c, d, e, a, b, 33); + R2(b, c, d, e, a, 34); + R2(a, b, c, d, e, 35); + R2(e, a, b, c, d, 36); + R2(d, e, a, b, c, 37); + R2(c, d, e, a, b, 38); + R2(b, c, d, e, a, 39); + R3(a, b, c, d, e, 40); + R3(e, a, b, c, d, 41); + R3(d, e, a, b, c, 42); + R3(c, d, e, a, b, 43); + R3(b, c, d, e, a, 44); + R3(a, b, c, d, e, 45); + R3(e, a, b, c, d, 46); + R3(d, e, a, b, c, 47); + R3(c, d, e, a, b, 48); + R3(b, c, d, e, a, 49); + R3(a, b, c, d, e, 50); + R3(e, a, b, c, d, 51); + R3(d, e, a, b, c, 52); + R3(c, d, e, a, b, 53); + R3(b, c, d, e, a, 54); + R3(a, b, c, d, e, 55); + R3(e, a, b, c, d, 56); + R3(d, e, a, b, c, 57); + R3(c, d, e, a, b, 58); + R3(b, c, d, e, a, 59); + R4(a, b, c, d, e, 60); + R4(e, a, b, c, d, 61); + R4(d, e, a, b, c, 62); + R4(c, d, e, a, b, 63); + R4(b, c, d, e, a, 64); + R4(a, b, c, d, e, 65); + R4(e, a, b, c, d, 66); + R4(d, e, a, b, c, 67); + R4(c, d, e, a, b, 68); + R4(b, c, d, e, a, 69); + R4(a, b, c, d, e, 70); + R4(e, a, b, c, d, 71); + R4(d, e, a, b, c, 72); + R4(c, d, e, a, b, 73); + R4(b, c, d, e, a, 74); + R4(a, b, c, d, e, 75); + R4(e, a, b, c, d, 76); + R4(d, e, a, b, c, 77); + R4(c, d, e, a, b, 78); + R4(b, c, d, e, a, 79); + /* Add the working vars back into context.state[] */ + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + /* Wipe variables */ + a = b = c = d = e = 0; +#ifdef SHA1HANDSOFF + memset(block, '\0', sizeof(block)); +#endif +} + + +/* SHA1Init - Initialize new context */ + +void SHA1Init( + SHA1_CTX * context +) +{ + /* SHA1 initialization constants */ + context->state[0] = 0x67452301; + context->state[1] = 0xEFCDAB89; + context->state[2] = 0x98BADCFE; + context->state[3] = 0x10325476; + context->state[4] = 0xC3D2E1F0; + context->count[0] = context->count[1] = 0; +} + + +/* Run your data through this. */ + +void SHA1Update( + SHA1_CTX * context, + const unsigned char *data, + uint32_t len +) +{ + uint32_t i; + + uint32_t j; + + j = context->count[0]; + if ((context->count[0] += len << 3) < j) + context->count[1]++; + context->count[1] += (len >> 29); + j = (j >> 3) & 63; + if ((j + len) > 63) + { + memcpy(&context->buffer[j], data, (i = 64 - j)); + SHA1Transform(context->state, context->buffer); + for (; i + 63 < len; i += 64) + { + SHA1Transform(context->state, &data[i]); + } + j = 0; + } + else + i = 0; + memcpy(&context->buffer[j], &data[i], len - i); +} + + +/* Add padding and return the message digest. */ + +void SHA1Final( + unsigned char digest[20], + SHA1_CTX * context +) +{ + unsigned i; + + unsigned char finalcount[8]; + + unsigned char c; + +#if 0 /* untested "improvement" by DHR */ + /* Convert context->count to a sequence of bytes + * in finalcount. Second element first, but + * big-endian order within element. + * But we do it all backwards. + */ + unsigned char *fcp = &finalcount[8]; + + for (i = 0; i < 2; i++) + { + uint32_t t = context->count[i]; + + int j; + + for (j = 0; j < 4; t >>= 8, j++) + *--fcp = (unsigned char)t + } +#else + for (i = 0; i < 8; i++) + { + finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] >> ((3 - (i & 3)) * 8)) & 255); /* Endian independent */ + } +#endif + c = 0200; + SHA1Update(context, &c, 1); + while ((context->count[0] & 504) != 448) + { + c = 0000; + SHA1Update(context, &c, 1); + } + SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */ + for (i = 0; i < 20; i++) + { + digest[i] = (unsigned char) + ((context->state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255); + } + /* Wipe variables */ + memset(context, '\0', sizeof(*context)); + memset(&finalcount, '\0', sizeof(finalcount)); +} + +void SHA1( + char *hash_out, + const char *str, + int len) +{ + SHA1_CTX ctx; + unsigned int ii; + + SHA1Init(&ctx); + for (ii = 0; ii +100% Public Domain +*/ + +#include "stdint.h" + +typedef struct +{ + uint32_t state[5]; + uint32_t count[2]; + unsigned char buffer[64]; +} SHA1_CTX; + +void SHA1Transform( + uint32_t state[5], + const unsigned char buffer[64] +); + +void SHA1Init( + SHA1_CTX * context +); + +void SHA1Update( + SHA1_CTX * context, + const unsigned char *data, + uint32_t len +); + +void SHA1Final( + unsigned char digest[20], + SHA1_CTX * context +); + +void SHA1( + char *hash_out, + const char *str, + int len); + +#endif /* SHA1_H */ \ No newline at end of file diff --git a/tools/gzinject/src/u8.c b/tools/gzinject/src/u8.c new file mode 100644 index 000000000..fec215538 --- /dev/null +++ b/tools/gzinject/src/u8.c @@ -0,0 +1,248 @@ +#include +#include +#include +#include +#include +#include +#include +#include "u8.h" + +void free_nodes(node_entry_t **nodes, uint8_t nodec){ + for(int i=0;ifilename) free(nodes[i]->filename); + free(nodes[i]); + } + } +} + +void get_dir_contents_recursive(const char *dirname, node_entry_t ***nodes, uint8_t *idx, node_entry_t *directory, int recursion){ + struct stat sbuffer; + node_entry_t **node_array = *nodes; + DIR *dir; + struct dirent *ent; + chdir(dirname); + if ((dir = opendir(".")) != NULL) { + while ((ent = readdir(dir)) != NULL) { + if(ent->d_name[0]=='.') continue; + uint8_t this_idx = *idx; + node_entry_t **new_nodes = realloc(node_array, ((this_idx+1) * sizeof(*node_array))); + node_array = new_nodes; + size_t len = strlen(ent->d_name); + char *name = malloc(strlen(ent->d_name) + 1); + strcpy(name,ent->d_name); + name[len] = 0; + node_entry_t *node = malloc(sizeof(node_entry_t)); + node->filename = name; + node->directory = directory; + stat(name, &sbuffer); + node->node.size = sbuffer.st_size; + (*idx)++; + directory->node.size++; + if ((sbuffer.st_mode & S_IFMT) == S_IFDIR) { + node->node.type = 0x0001; + node->node.data_offset=recursion; + node->node.size = 0; + get_dir_contents_recursive(name,&node_array,idx,node,recursion+1); + + }else{ + node->node.type = 0x0000; + } + node_array[this_idx] = node; + } + closedir(dir); + } + chdir(".."); + *nodes = node_array; +} + +void sort_dir(node_entry_t **src, node_entry_t **dest, node_entry_t *dir, size_t total_cnt,int start, int *pos){ + for(int i=start;idirectory == dir && node->node.type==0x0000){ + dest[(*pos)++] = node; + } + } + for(int i=start;idirectory == dir && node->node.type==0x0001){ + dest[(*pos)++] = node; + sort_dir(src,dest,node,total_cnt,start,pos); + node->node.size = *pos; + } + } +} + +int create_u8_archive(const char *dir, const char *output){ + // Root Directory node. + node_entry_t rootdirnode; + rootdirnode.node.data_offset = 0; + rootdirnode.node.type=0x0001; + rootdirnode.node.name_offset=0; + rootdirnode.node.size=0; + rootdirnode.directory=NULL; + rootdirnode.filename="."; + + uint8_t nodec = 1; + + node_entry_t **dirnodes = malloc(sizeof(*dirnodes)); + dirnodes[0] = &rootdirnode; + get_dir_contents_recursive(dir,&dirnodes,&nodec,dirnodes[0],0); + dirnodes[0]->node.size = nodec+1; + node_entry_t **sorted = malloc(sizeof(*sorted) * nodec); + sorted[0] = dirnodes[0]; + int pos = 1; + + sort_dir(dirnodes,sorted,sorted[0],nodec,pos,&pos); + free(dirnodes); + uint8_t *string_table = malloc(1); + string_table[0] = 0; + + int npos = 1 , dpos = 0, dirdepth = 0; + + uint8_t *data = NULL; + chdir(dir); + + for(int i=0;inode.name_offset = npos; + size_t nlen = strlen(sorted[i]->filename) + 1; + uint8_t *new_table = realloc(string_table,npos + nlen); + if(new_table!=NULL){ + string_table = new_table; + } + + memcpy(string_table + npos,sorted[i]->filename,nlen); + string_table[npos+nlen-1]=0; + npos+=nlen; + if(sorted[i]->node.type==0x0001){ + chdir(sorted[i]->filename); + dirdepth++; + }else{ + uint32_t padlen = addpadding(sorted[i]->node.size,32); + uint8_t *new_data = realloc(data,dpos + padlen); + if(new_data!=NULL){ + data = new_data; + } + memset(data + dpos,0,padlen); + FILE *fle = fopen(sorted[i]->filename, "rb"); + fread(data + dpos, 1, sorted[i]->node.size, fle); + fclose(fle); + sorted[i]->node.data_offset = dpos; + dpos+=padlen; + } + } + + for(int i=0;inode; + if(node.type==0x0000){ + node.data_offset+=dataoffset; + } + node.data_offset = REVERSEENDIAN32(node.data_offset); + node.size = REVERSEENDIAN32(node.size); + node.name_offset = REVERSEENDIAN16(node.name_offset); + fwrite(&node, 1, sizeof(u8_node), foutfile); + } + free_nodes(sorted + 1,nodec - 1); + free(sorted); + fwrite(string_table, 1, npos, foutfile); + free(string_table); + + uint8_t *padding = calloc(padcount, sizeof(uint8_t)); + fwrite(padding, 1, padcount, foutfile); + free(padding); + + fwrite(data, 1, dpos, foutfile); + free(data); + + fclose(foutfile); + + return 1; +} + +int extract_u8_archive(uint8_t *data, const char *outdir){ + mkdir(outdir, 0755); + chdir(outdir); + u8_header header; + uint32_t data_offset; + uint8_t *string_table; + size_t rest_size; + + memcpy(&header, data, sizeof(header)); + + int curpos = sizeof(header); + + u8_node root_node; + memcpy(&root_node, data + curpos, sizeof(u8_node)); + curpos += sizeof(u8_node); + + uint32_t nodec = be32((uint8_t*)&root_node.size) - 1; + u8_node *nodes = malloc(sizeof(u8_node)*nodec); + memcpy(nodes, data + curpos, sizeof(u8_node)*nodec); + curpos += sizeof(u8_node)*nodec; + + data_offset = be32((uint8_t*)&header.data_offset); + rest_size = data_offset - sizeof(header) - (nodec + 1) * sizeof(u8_node); + string_table = malloc(rest_size); + memcpy(string_table, data + curpos, rest_size); + + u8_node *node; + int dir_depth = 0; + FILE *outfile; + for (int j = 0; j < nodec; j++) { + node = &nodes[j]; + uint32_t doffset = be32((uint8_t*)&node->data_offset); + uint32_t dsize = be32((uint8_t*)&node->size); + uint16_t name_offset = be16((uint8_t*)&node->name_offset); + uint16_t type = be16((uint8_t*)&node->type); + char *name = (char*)&string_table[name_offset]; + if (type == 0x0000) { // Regular file + outfile = fopen(name, "wb"); + fwrite(data + doffset, 1, dsize, outfile); + fclose(outfile); + }else if(type==0x0100){ // Directory + while(dir_depth>doffset+1){ + chdir(".."); + dir_depth--; + } + mkdir(name,0755); + chdir(name); + dir_depth++; + } + } + do{ + chdir(".."); + dir_depth--; + }while(dir_depth>0); + free(string_table); + free(nodes); + return 1; +} \ No newline at end of file diff --git a/tools/gzinject/src/u8.h b/tools/gzinject/src/u8.h new file mode 100644 index 000000000..7519c692a --- /dev/null +++ b/tools/gzinject/src/u8.h @@ -0,0 +1,34 @@ +#ifndef U8_H_ +#define U8_H_ + +#include +#include "gzinject.h" + +typedef struct { + uint16_t type; + uint16_t name_offset; + uint32_t data_offset; + uint32_t size; +}u8_node; + +typedef struct +{ + uint32_t tag; + uint32_t rootnode_offset; + uint32_t header_size; + uint32_t data_offset; + uint8_t padding[16]; +} u8_header; + +typedef struct node_entry_s node_entry_t; + +struct node_entry_s { + u8_node node; + char *filename; + node_entry_t *directory; +}; + +int create_u8_archive(const char *dir, const char *output); +int extract_u8_archive(uint8_t *data, const char *outdir); + +#endif \ No newline at end of file diff --git a/tools/ichaindis.py b/tools/ichaindis.py deleted file mode 100755 index f19a15ddf..000000000 --- a/tools/ichaindis.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/python3 - -import os -import sys -import struct -import argparse -import re -from overlayhelpers.filemap import GetFromVRam - -ICHAIN_MACROS = [ - 'ICHAIN_U8', - 'ICHAIN_S8', - 'ICHAIN_U16', - 'ICHAIN_S16', - 'ICHAIN_U32', - 'ICHAIN_S32', - 'ICHAIN_F32', - 'ICHAIN_F32_DIV1000', - 'ICHAIN_VEC3F', - 'ICHAIN_VEC3F_DIV1000', - 'ICHAIN_VEC3S', -] - -Z64_ACTOR_PATH = "../include/z64actor.h" - -def get_rom_address(offset): - - if offset.startswith("D_"): - offset = offset[2:] - - offset = int(offset, 16) - - if offset >= 0x80000000: - result = GetFromVRam(offset) - offset = result.vrom.start + result.offset - - return hex(offset) - -def get_actor_var_names(): - in_actor = False - actor_vars = {} - with open(os.path.dirname(os.path.realpath(__file__)) + "/" + Z64_ACTOR_PATH) as actor_h: - for line in actor_h: - if in_actor: - if "}" in line: - # Reached the end of the actor struct so break out - break - - # Parse out the memory address (from the comment) and the variable name - regex = r'.*\/\* (.*) \*\/\s+(struct)?\s*.+\s+(.+);.*' - actor_var_info = re.match(regex, line) - - if actor_var_info: - # Strip off the 0x0* part and store it - new_var_index = re.sub('0x0*', '', actor_var_info[1]) - actor_vars[new_var_index] = actor_var_info[3] - - elif "typedef struct Actor {" in line: - # Found the Actor struct - in_actor = True - return actor_vars - -def main(): - parser = argparse.ArgumentParser(description='Decompiles an InitChain') - parser.add_argument('filename', help='ROM file path') - parser.add_argument('offset', help='ROM offset or symbol of an InitChain') - parser.add_argument('--names', action="store_true", help='Retrieve variable names from the actor struct') - args = parser.parse_args() - - # Get the ROM address, if the offset is already a ROM address it will just be returned. - args.offset = get_rom_address(args.offset) - - romOff = int(args.offset, 16) - - try: - with open(args.filename, 'rb') as f: - romData = f.read() - except IOError: - print('failed to read file ' + args.filename) - sys.exit(1) - - print ('static InitChainEntry sInitChain[] = {') - - if args.names: - actor_variable_names = get_actor_var_names() - - while True: - entry = struct.unpack('>I', romData[romOff:romOff+4])[0] - romOff += 4 - - cont = entry >> 31 - t = (entry >> 27) & 0xF - offset = ((entry) >> 16) & 0x7FF - value = (entry) & 0xFFFF - if value >= 0x8000 and not ICHAIN_MACROS[t].startswith('ICHAIN_U'): - value -= 0x10000 - - var_name = '{0:X}'.format(offset) - - if args.names and var_name in actor_variable_names: - var_name = actor_variable_names[var_name] - else: - var_name = "unk_" + var_name - - print(' {0}({1}, {2}, {3}),'.format(ICHAIN_MACROS[t], var_name, value, ('ICHAIN_CONTINUE' if cont == 1 else 'ICHAIN_STOP'))) - if cont == 0: - break - print ('};') - -if __name__ == "__main__": - main() diff --git a/tools/ido5.3_compiler/LICENSE.md b/tools/ido5.3_compiler/LICENSE.md deleted file mode 100755 index 015107d41..000000000 --- a/tools/ido5.3_compiler/LICENSE.md +++ /dev/null @@ -1,18 +0,0 @@ -# Silicon Graphics Freeware Legal Notice -## Copyright 1995, Silicon Graphics, Inc. -- ALL RIGHTS RESERVED - -You may copy, modify, use and distribute this software, (i) provided that you include the entirety of this reservation of rights notice in all such copies, and (ii) you comply with any additional or different obligations and/or use restrictions specified by any third party owner or supplier of the software in other notices that may be included with the software. - -**SGI DISCLAIMS ALL WARRANTIES WITH RESPECT TO THIS SOFTWARE, EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ALL WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. SGI SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING, WITHOUT LIMITATION, LOST REVENUES, LOST PROFITS, OR LOSS OF PROSPECTIVE ECONOMIC ADVANTAGE, RESULTING FROM THE USE OR MISUSE OF THIS SOFTWARE.** - -**U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:** - -Use, duplication or disclosure by the Government is subject to restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR, or the DOD or NASA FAR Supplement. Unpublished - rights reserved under the Copyright Laws of United States. Contractor/manufacturer is Silicon Graphics, Inc., 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. - -## Product Support - -Freeware products are not supported by Silicon Graphics or any of its support providers. The software contained in this package is made available through the generous efforts of their authors. Although they are interested in your feedback, they are under no obligation to address bugs, enhancements, or answer questions. - ----- - -**NOTE:** This license was copied verbatim from https://web.archive.org/web/19991008090202/http://toolbox.sgi.com/TasteOfDT/public/freeware1.0/legal_notice.html . diff --git a/tools/ido5.3_compiler/lib/libmalloc.so b/tools/ido5.3_compiler/lib/libmalloc.so deleted file mode 100755 index 2a59e0a49..000000000 Binary files a/tools/ido5.3_compiler/lib/libmalloc.so and /dev/null differ diff --git a/tools/ido5.3_compiler/lib/libmalloc_old.so b/tools/ido5.3_compiler/lib/libmalloc_old.so deleted file mode 100755 index 2a14987d1..000000000 Binary files a/tools/ido5.3_compiler/lib/libmalloc_old.so and /dev/null differ diff --git a/tools/ido5.3_compiler/lib/rld b/tools/ido5.3_compiler/lib/rld deleted file mode 100755 index 727b42699..000000000 Binary files a/tools/ido5.3_compiler/lib/rld and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/bin/cc b/tools/ido5.3_compiler/usr/bin/cc deleted file mode 100755 index 2936fc3fd..000000000 Binary files a/tools/ido5.3_compiler/usr/bin/cc and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/as0 b/tools/ido5.3_compiler/usr/lib/as0 deleted file mode 100755 index badf8c83b..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/as0 and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/as1 b/tools/ido5.3_compiler/usr/lib/as1 deleted file mode 100755 index c246db537..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/as1 and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/cfe b/tools/ido5.3_compiler/usr/lib/cfe deleted file mode 100755 index 305a50be4..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/cfe and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/crt1.o b/tools/ido5.3_compiler/usr/lib/crt1.o deleted file mode 100755 index 3052ae273..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/crt1.o and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/err.english.cc b/tools/ido5.3_compiler/usr/lib/err.english.cc deleted file mode 100755 index 6976e38a9..000000000 --- a/tools/ido5.3_compiler/usr/lib/err.english.cc +++ /dev/null @@ -1,1260 +0,0 @@ -@ - 358 358 358 - 6464 6482 6553 - 6553 6593 6728 - 6728 6746 6803 - 6803 6808 6808 - 6808 6818 6818 - 6818 6826 6826 - 6826 6847 6847 - 6847 6875 6922 - 6922 6930 6930 - 6930 6939 6939 - 6939 6948 6948 - 6948 6974 7120 - 7120 7149 7204 - 7210 7248 7311 - 7317 7350 7442 - 7450 7497 7627 - 7635 7709 7930 - 7938 7975 8063 - 8071 8113 8253 - 8261 8289 8289 - 8298 8338 8445 - 8460 8502 8635 - 8650 8690 8819 - 8834 8857 8965 - 8965 9008 9113 - 9119 9142 9227 - 9235 9282 9451 - 9451 9462 9462 - 9462 9477 9477 - 9477 9497 9497 - 9497 9545 9545 - 9545 9584 9584 - 9584 9604 9662 - 9662 9682 9720 - 9720 9749 9749 - 9749 9788 9788 - 9788 9802 9802 - 9802 9829 9829 - 9829 9861 9861 - 9861 9904 9904 - 9904 9920 9920 - 9920 9962 9962 - 9962 9988 9988 - 9988 10014 10014 -10014 10035 10035 -10035 10054 10097 -10097 10115 10115 -10115 10147 10147 -10147 10183 10183 -10183 10208 10208 -10208 10236 10236 -10236 10269 10269 -10269 10304 10304 -10304 10328 10328 -10328 10351 10351 -10351 10371 10371 -10371 10402 10402 -10402 10447 10447 -10447 10497 10497 -10497 10533 10533 -10533 10598 10598 -10606 10630 10630 -10640 10671 10671 -10690 10719 10719 -10728 10752 10795 -10795 10837 10837 -10837 10876 10876 -10876 10900 10900 -10900 10948 10948 -10960 11021 11103 -11103 11128 11128 -11128 11153 11153 -11153 11216 11216 -11216 11239 11239 -11239 11303 11303 -11303 11347 11347 -11357 11393 11393 -11393 11432 11432 -11442 11494 11494 -11494 11536 11536 -11536 11595 11595 -11595 11622 11622 -11622 11684 11684 -11684 11726 11726 -11738 11778 11778 -11782 11813 11813 -11813 11850 11850 -11850 11900 12087 -12111 12120 12120 -12120 12129 12129 -12129 12158 12158 -12158 12192 12192 -12192 12237 12237 -12237 12273 12273 -12273 12326 12326 -12330 12366 12366 -12366 12423 12423 -12427 12482 12482 -12486 12560 12560 -12568 12631 12631 -12637 12691 12691 -12691 12743 12743 -12743 12785 12785 -12785 12826 12826 -12826 12865 12865 -12865 12883 12883 -12883 12946 12946 -12956 12995 12995 -13005 13066 13066 -13077 13163 13163 -13163 13211 13211 -13211 13270 13270 -13270 13318 13318 -13318 13350 13350 -13350 13387 13387 -13387 13428 13428 -13428 13464 13533 -13533 13580 13737 -13737 13776 13854 -13854 13913 13913 -13913 13950 13950 -13950 14118 14118 -14118 14150 14150 -14150 14163 14194 -14194 14224 14255 -14255 14275 14319 -14319 14353 14458 -14466 14484 14530 -14534 14567 14567 -14567 14635 14682 -14690 14742 14742 -14742 14789 14789 -14801 14875 14875 -14886 14947 14947 -14947 14992 14992 -14992 15035 15085 -15085 15134 15205 -15214 15267 15448 -15454 15496 16810 -16822 16875 16960 -16972 17053 17179 -17191 17236 17332 -17344 17491 17841 -17853 17939 18304 -18316 18471 18774 -18786 18952 19323 -19335 19364 19496 -19500 19527 19598 -19598 19613 19776 -19797 19808 19837 -19837 19862 19862 -19868 19927 20026 -20034 20075 20179 -20187 20223 20223 -20223 20290 20382 -20392 20441 20589 -20601 20656 20656 -20656 20699 20818 -20826 20860 21038 -21046 21094 21191 -21203 21236 21314 -21326 21395 21457 -21469 21502 21502 -21502 21587 21731 -21756 21789 21864 -21875 21901 21976 -22013 22059 22220 -22257 22397 22561 -22561 22595 22595 -22603 22623 22623 -22631 22667 22828 -22865 22919 22994 -23031 23059 23120 -23132 23201 23201 -23212 23274 23274 -23285 23345 23345 -23356 23393 23393 -23399 23431 23532 -23542 23587 23646 -23656 23697 23745 -23755 23796 23844 -23854 23876 23928 -23942 23971 24153 -24160 24243 24243 -24247 24273 24743 -24755 24784 24984 -24996 25034 25034 -25034 25075 25273 -25281 25332 25410 -25420 25467 25544 -25554 25583 25744 -25754 25783 26061 -26071 26111 26185 -26194 26239 26525 -26535 26568 26914 -26924 26951 26998 -27008 27035 27082 -27093 27120 27167 -27178 27206 27251 -27261 27289 27334 -27345 27391 27931 -27938 27959 28007 -28019 28037 28037 -28043 28069 28069 -28077 28147 28199 -28207 28266 28266 -28274 28306 28306 -28314 28339 28339 -28347 28404 28510 -28518 28567 28682 -28690 28728 28728 -28736 28782 29023 -29033 29085 29234 -29246 29303 29383 -29395 29432 29570 -29592 29631 29644 -29644 29693 29758 -29767 29810 29875 -29875 29911 29976 -29984 30014 30014 -30027 30086 30151 -30157 30223 30293 -30301 30369 30445 -30457 30511 30568 -30580 30630 30743 -30755 30812 30874 -30886 30959 31035 -31043 31076 31175 -31183 31243 31243 -31251 31323 31323 -31331 31433 31433 -31445 31544 31686 -31698 31740 31740 -31740 31783 31783 -31783 31824 31824 -31824 31873 31996 -32008 32056 32164 -32176 32210 32210 -32229 32271 32271 -32279 32323 32569 -32581 32642 32718 -32739 32779 32916 -32926 32953 33047 -33057 33116 33315 -33325 33373 33373 -33373 33407 33469 -33494 33527 33527 -33536 33573 33573 -33584 33650 33697 -33705 33763 33763 -33763 33797 33797 -33797 33829 33906 -33915 33976 33976 -33985 34016 34098 -34098 34133 34198 -34198 34261 34261 -34269 34312 34312 -34324 34363 34438 -34444 34530 34530 -34538 34596 34626 -34636 34675 34754 -34764 34821 34821 -34821 34867 34950 -34959 35016 35135 -35145 35198 35198 -35208 35266 35344 -35355 35382 35537 -35547 35576 35629 -35637 35705 35705 -35713 35764 35764 -35764 35784 35876 -35888 35932 35950 -35950 36013 36138 -36150 36191 36280 -36286 36314 36419 -36431 36516 36516 -36516 36554 36642 -36642 36689 36808 -36818 36881 37105 -37113 37183 37204 -37204 37225 37225 -37225 37255 37348 -37348 37388 37388 -37388 37454 37454 -37454 37518 37518 -37518 37584 37584 -37584 37717 37717 -37717 37752 37752 -37752 37783 37889 -37901 37928 38034 -38046 38115 38115 -38115 38140 38187 -38195 38219 38339 -38351 38422 38422 -38422 38486 38486 -38486 38555 38555 -38555 38619 38619 -38619 38641 38641 -38641 38758 38758 -38758 38929 38929 -38929 38975 39043 -39055 39084 39133 -39133 39175 39265 -39275 39310 39494 -39504 39547 39576 -39587 39614 39668 -39674 39697 39797 -39797 39845 40094 -40094 40158 40264 -40264 40369 40523 -40523 40593 40593 -40593 40629 40876 -40876 40911 40971 -40977 41026 41026 -41038 41077 41077 -41077 41116 41116 -41116 41156 41156 -41156 41195 41195 -41195 41237 41237 -41237 41285 41285 -41285 41304 41304 -41304 41371 41371 -41371 41429 41429 -41429 41491 41491 -41491 41519 41519 -41519 41572 41572 -41572 41642 41642 -41642 41676 41676 -41676 41713 41713 -41713 41751 41751 -41751 41792 41792 -41792 41856 41856 -41856 41881 41881 -41881 41936 41936 -41936 41977 41977 -41977 42018 42018 -42018 42090 42090 -42090 42162 42162 -42162 42205 42205 -42205 42267 42267 -42267 42294 42294 -42294 42309 42309 -42309 42338 42386 -42393 42425 42522 -42530 42577 42577 -42577 42623 42623 -42623 42643 42725 -42725 42748 42748 -42748 42829 42897 -42901 42952 42952 -42952 42978 43025 -43025 43116 43116 -43116 43171 43171 -43171 43204 43376 -43386 43453 43471 -43471 43547 43780 -43798 43921 44116 -44120 44120 44120 -Out of memory: %s -There is no more memory left in the system for compiling this program. -Internal Error Unknown Error Message %s -1) An internal error, while attempting to print an unavailable message -2) The error message file is inaccessible or has other problems -Unknown Signal %s -1) An unknown signal has been caught -2) 2 Nested signals -line -Warning: -Fatal: -Source not available -Too many errors... goodbye. -There is a limit of 30 errors before aborting. -Error: -reserved -reserved -Unknown Control Statement -1) The line begins with a '#' and is not of the form: - # "" -2) Please compile this program with the preprocessor enabled. -Unknown character %s ignored -The character is not part of the source character set. -2.2.1 -Unknown control character \%s ignored -The control character is not part of the source character set. -2.2.1 -Illegal character %s in exponent -1) Digits or sign expected after 'e' or 'E'. -2) Digits are expected after sign in exponent. -3.1.3.1 -Constant is out of range and may be truncated. -The constant is too large to be accurately represented and may be -truncated. The limits are in the system include file limits.h. -2.2.4.2 -Constant is out of range for a 32-bit data type, but accepted as written. -The constant is too large to fit in a 32-bit data type, but will be -accurately represented in a wider data type. The value may be truncated, -depending on its context. The limits are in the system include file -limits.h. -2.2.4.2 -Character constant size out of range -1) No characters in a character constant. -2) More than 4 bytes in a character constant. -3.1.3.4 -Wide character constant size out of range -1) No characters in the multibyte sequence (0 assumed). -2) More than 1 byte in the multi-byte sequence (only the first byte was converted). -3.1.3.4 -Invalid multibyte character -4.10.7.2 -Newline in string or character constant -1) Terminate your string or character constant with closing quotes. -2) Put a backslash before the newline. -3.1.3.4, 3.1.4 -Octal character escape too large: %s > %s -1) Terminate end of octal sequence with a non-octal character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Hex character escape too large: %s > %s -1) Terminate end of hex sequence with a non-hex character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Unexpected End-of-file -1) Unterminated string or character constant -2) Missing closing comment marker (*/) -3) File system problems -Unrecognized escape sequence in string \%s -Recognized escape sequences are \a, \b, \f, \n, \r, \t, and \v. -Character will be treated as un-escaped. -3.9.2 -Illegal octal digit %s -Octal constants, beginning with 0, must only have digits between 0 and 7, -inclusive. -3.1.3.2 -Unable to open temporary file for compiling %s -1) TMPDIR environment variable is set to a directory that you have no - permissions for. -2) The file system is full. -3) System errors beyond the scope of the compiler. -%s: Hangup -%s: Interrupt -%s: Quit (ASCII FS) -%s: Illegal instruction (not reset when caught) -%s: Trace trap (not reset when caught) -%s: IOT instruction -Also SIGABRT, used by abort, replace SIGIOT in the future -%s: EMT instruction -Also SIGXCPU, Exceeded CPU time limit -%s: Floating point exception -%s: Kill (cannot be caught or ignored) -%s: Bus error -%s: Segmentation violation -%s: Bad argument to system call -%s: Write on a pipe with no one to read it -%s: Alarm clock -%s: Software termination signal from kill -%s: User defined signal 1 -%s: User defined signal 2 -%s: Death of a child -Power-fail restart -%s: Also SIGXFSZ, exceeded file size limit -%s: Window change -%s: Handset, line status change -%s: Sendablestop signalnot from tty -%s: Stop signal from tty -%s: Pollable event occurred -%s: Input/Output possible signal -%s: Urgent condition on IO channel -%s: Window size changes -%s: Virtual time alarm -%s: Profiling alarm -%s: Continue a stopped process -%s: To readers pgrp upon background tty read -%s: Like TTIN for output if (tp->t_local<OSTOP) -%s: Resource lost (eg, record-lock) -'auto' and 'register' are not allowed in an external declaration -3.7(10) -must have function type -3.7.1(30) -Functions cannot return arrays -3.7.1(33), 3.3.2.2 -Declaration list not allowed -3.7.1(5) -Too many input files %s -The command line may contain only one file -cpp internal error: input stack underflow -cpp internal error: if stack underflow -Cannot open the file %s -No new-line character at the end of the file %s -2.1.1.2(30) -Fatal: Exceeded the limit of nesting level for #include file -Fatal: Exceeded the limit of nesting level for #include file. This limit -is 200. -Fail to read the file %s -Cannot write the file %s -%s: %s: An if directive is not terminated properly in the file -%s: %s: nested comment -%s:%s: Illegal macro name %s; macro name shall be an identifier -%s:%s: Illegal preprocessing token sequence -3.8.3(35) -%s:%s: Illegal macro parameter name -%s:%s: Non-unique macro parameter name -3.8.3(18) -%s:%s: Missing ')' in parameter list for #define %s -%s:%s: Missing ')' in macro instantiation -%s:%s: Bad punctuator in the parameter list for #define %s -%s:%s: Macro %s redefined. -%s:%s: # operator should be followed by a macro argument name -%s:%s: Badly formed constant expression%s -3.4(9), 3.8 -%s:%s: Division by zero in #if or #elif -3.8 -unknown command line option %s -extraneous input/output file name %s -%s: %s: Unterminated string or character constant -A preprocessing string or character constant token was not -terminated. Note that preprocessing directives are processed -after the source file has been divided into preprocessing tokens. -2.1.1.2(30) 3.1(18) 3.8 -%s: %s: -%s: %s: -%s: %s: Unterminated comment -%s: %s: Unknown directive type %s -%s: %s: #elif or #else after #else directive -%s: %s: Bad identifier after the %s -%s: %s: #%s accepts only one identifier as parameter -3.8 -%s: %s: Bad identifier after the %s -%s: %s: text following #%s violates the ANSI C standard. -3.8 -%s: %s: Bad character %s occurs after the # directive. -3.8 -%s: %s: the ## operator shall not be the %s token in the replacement list -3.8.3.3 -%s: %s: the defined operator takes identifier as operand only. -3.8.1 -%s: %s: Not in a conditional directive while using %s -%s: %s: Illegal filename specification for #include -%s: %s: Invalid file name %s for #include -%s: %s: Cannot open file %s for #include -%s: %s: Bad argument for #line command -%s: %s: #error %s -%s: %s: Tried to redefine predefined macro %s, attempt ignored -3.8.7(22) -%s: %s: Undefining predefined macro %s -3.8.7(22) -%s: %s: Undefined the ANSI standard library defined macro %s -4.1.2.1(9) -%s: %s: The number of arguments in the macro invocation does not match the definition -%s: %s: Illegal character %s in preprocessor if -%s: %s: Illegal character %s for number in preprocessor if -%s: %s: No string is allowed in preprocessor if -%s: %s: Not supported pragma %s -%s: %s: Not supported #pragma format -%s: %s: ANSI C does not allow #ident; %s -%s: %s: Not supported #ident format -This cpp extension accepts the following format: -#ident "any string" -%s: %s: Not supported #assert/#unassert format -This cpp extension accepts the following format: -#assert identifier -#assert identifier ( pp-tokens ) -#unassert identifier -#unassert identifier ( pp-tokens ) -%s: %s: Bad assertion predicate format -The correct syntax for this cpp extension is: -#assert identifier ( pp-token ) -%s: %s: directive is an upward-compatible ANSI C extension -%s: This option requires an argument -%s: %s: A macro has expanded recursively more than %s times. Further expansion will be disabled! Use command-line option: -Wp,-max_rec_depth=depth to recurse deeper. -A status return from cpp to cfe -Syntax Error -The token read was unexpected. -Syntax Error -- cannot backup -The token read was unexpected. -Yacc stack overflow -The expression is too complicated to parse. -Trailing comma in enumerator list -The use of a trailing comma in an enumerator list is not standard C. There -may be portability problems. -3.5.2.2 -Empty declaration -Empty declarations are invalid in standard C. -3.5 -%s declared, but not referenced. -redeclaration of '%s'; previous declaration at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -'%s' undefined; reoccurrences will not be reported. -Non-function name referenced in function call. -3.3.2.2(18) -The number of arguments doesn't agree with the number in the declaration. -3.3.2.2(5) -'%s' section name longer than 8 characters. Name truncated. -'%s' is already placed by pragma alloc_text. -Cannot write ucode file while compiling %s -1) The file system is full -2) Permissions problem -Must have corresponding formal argument for '%s' -Parameter found in the declaration part, but not in the argument list. -3.7.1(7) -Non-prototype declaration is an obsolescent feature. -The use of function definitions with separate parameter identifier -and declaration lists (not prototype-format parameter type and -identifier declarators) is an obsolescent feature. -3.9.5 -Incompatible function declarations for %s -For two function types to be compatible, both shall specify compatible -return types. Moreover, the parameter type lists, if both are present, -shall agree in the number of parameters and in use of the ellipsis -terminator; corresponding parameters shall have compatible types. If -one type has a parameter type list and the other type is specified by -a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. If one type has a parameter type list and the -other is specified by a function definition that contains a (possibly -empty) identifier list, both shall agree in the number of parameters, -and the type of each prototype parameter shall be compatible with the -type that results from application of the default argument promotions -to the type of the corresponding identifier. (For each parameter -declared with function or array type, its type for these comparisons -is the one that results from conversion to a pointer type. For each -parameter declared with qualified type, its type for these comparisons -is the unqualified version of its declared type.) There you have it! -3.5.4.3(15) -Incompatible function return type for this function. -For two function types to be compatible, both shall specify compatible -return types. -3.5.4.3(15) -The number of parameters for function is different from the previous declaration -The parameter type lists, if both are present, shall agree in the -number of parameters and in use of the ellipsis terminator. -3.5.4.3(15) -Incompatible type for the function parameter -If both parameter type lists are present, corresponding -parameters shall have compatible types. -3.5.4.3(15) -Function %s is redeclared with an incompatible argument type (after default argument promotion), which could lead to undefined run-time behaviour. -The redeclaration could cause arguments at a call site to be passed -inconsistently with what the function implementation expects, and -parameters would therefore be accessed erroneously when executing the -function body. Note that a float argument is promoted to a double -when passed (potentially through fp registers) to an unprototyped -function. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, ellipsis terminator not allowed -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the type of each parameter shall be -compatible with the type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype declaration and non-prototype definition found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other is specified by a -function definition that contains a (possibly empty) identifier list, -both shall agree in the number of parameters, and the type of each -prototype parameter shall be compatible with the type that results -from application of the default argument promotions to the type of the -corresponding identifier. -3.5.4.3(15) -Empty declaration specifiers -Standard C requires at least a storage class specifier, type specifier, -or a type qualifier in declarations. 'extern int' assumed. -3.5 -Can't write to the file %s -1) The output file cannot be opened for writing. -2) Out of file space. -Duplicate '%s' -typedef, extern, static, auto, register, const, volatile may not -appear more than once in the same specifier list or qualifier list. -Duplicate occurrence ignored. -3.5.1(10) , 3.5.3(5) -Null input -There is nothing to compile. -Illegal type combination -3.5.2 -Missing ';' at end of structure / union member declaration -In standard C, each member declaration must be terminated by a ';'. A -terminating ';' is assumed. -3.5.2.1 -Missing member name in structure / union -In standard C, each member declaration have a member name. The missing -member is assumed to not exist. -3.5.2.1 -This variable is initialized twice. -Neither 'const' or 'volatile' have any effect on function results. -Qualifiers only apply to expressions designating an object that -can be altered or examined. -3.5.3(10) -An integer constant expression is required here. -The expression that defines the value of an enumeration constant -shall be an integral constant expression that has a value -representable as an int. -3.5.2.2(28) -(previous declaration of '%s' at line %s in file '%s') -Must be an integer type greater than zero. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -Array size cannot be a long long. -Arrays with more than 2^32 elements are not yet supported. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -bit-field '%s' width is not an integer constant -The expression that specifies the width of a bit-field shall be an -integral constant expression. -3.5.2.1(15) -bit-field '%s' width is negative -The expression that specifies the width of a bit-field shall be -non-negative. -3.5.2.1(15) -bit-field '%s' type required to be int, unsigned int, or signed int. -A bit-field shall have type int, unsigned int, or signed int. -3.5.2.1(30) -bit-field %s's type not integer. -Non-scalar type or pointer type to a non-object for increment or decrement operator. -The operand of the prefix/postfix increment or decrement operator shall have scalar type; if it is of pointer type, it must point to an object. -3.3.2.4(37), 3.3.3.1(25) -Assign value to a function type. -An assignment operator shall have a modifiable lvalue as its left operand. -3.2.2.1(5) -Assign value to an array. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for variable of incomplete type. -The operand of increment and decrement operator shall be a modifiable -scalar lvalue. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -The left-hand side of the '.' operator must be an addressable lvalue, when a bit-field is not contained within a unit of 32 bits alignment. -This is a restriction in our implementation, which can be worked -around by always accessing long long bit-fields indirectly (i.e. -by means of the '->' operator). -This expression is not an lvalue. -3.2.2.1 -Modified an rvalue. -3.2.2.1 -Change value for constant variable. -The operand of increment and decrement operators shall be modifiable -scalar lvalues. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for constant field of a struct or union. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Dereferenced a non-pointer. -The operand of the unary * operator shall have pointer type. -3.3.3.2(39) -The operand of the unary + or - operator shall have arithmetic type. -3.3.3.3(6) -The operand of the unary ~ operator shall have integral type. -3.3.3.3(6) -The operand of the unary ! operator shall have scalar type. -3.3.3.3(6) -Constants must have arithmetic type. -3.1.3 -Bad type name for cast operator -The type name for the cast operator should either be void or a -qualified or unqualified scalar type. -3.3.4(22) -Improper cast of non-scalar type expression. -The operand for the cast operator shall be of scalar type. -3.3.4(23) -Cast a pointer into a non-integral type. -A pointer may be converted to an integral type. -3.3.4(31) -Cast a non-integral type into a pointer. -An integral type may be converted to a pointer. -3.3.4(31) -Duplicate member '%s' -Two members of a struct may not have the same name. -3.1.2.2(7,25) -Invalid constant expression. -Constant expressions shall not contain assignment, increment, decrement, -function-call, or comma operators, except when they are contained within -the operand of the sizeof operator. -3.4(9) -Constant expressions must be derived from a constant value or a constant -variable. -3.4 -Dangerous operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. This operand is NOT an lvalue, but we let it pass. -Note that a segmentation error with possible core dump will result -when the resulting address does not denote a valid (declared) -storage location. This feature will be discontinued in future -releases of the compiler! -3.3.3.2(36) -Unacceptable operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. -3.3.3.2(36) -'&' before array or function; ignored -Unacceptable operand of sizeof operator. -The sizeof operator shall not be applied to an expression that has -function type or an incomplete type, to the parenthesized name of such -a type, or to an lvalue that designates a bit-field object. -3.3.3.4 -Unacceptable operand of a multiplicative operator. -Each of the operands of a multiplicative operator shall have arithmetic type. -3.3.5(18) -Unacceptable operand of the remainder operator -Each of the operands of the remainder (%) operator shall have integral type. -3.3.5(18) -Unacceptable operand of '+'. -For the + operator, either both operands shall have arithmetic type, or -one operand shall be a pointer to an object type and the other shall -have integral type. -3.3.6(39) -Unacceptable operand of '-'. -For the subtraction operator, one of the following shall hold: both operands -have arithmetic type; operands are pointers to qualified or unqualified -versions of compatible object types; or the left operand is a pointer -to an object type and the right operand has integral type. -3.3.6(39) -Unacceptable operand of shift operator. -Each of the operands of bitwise shift operators shall have integral type. -3.3.7(9) -Unacceptable operand of relational operator. -For relational operators, one of the following shall hold: both -operands have arithmetic type; both operands are pointers to qualified -or unqualified versions of compatible object types; or both operands -are pointers to qualified or unqualified versions of compatible -incomplete types. -3.3.8(32) -Unacceptable operand of == or != -For the == or != operator, one of the following shall hold: both operands -are pointers to qualified or unqualified versions of compatible types; one -operand is a pointer to an object or incomplete type and the other is a -pointer to a qualified or unqualified version of void; or one operand is -a pointer and the other is a null pointer constant. -3.3.9(21) -Unacceptable operand of &. -Each of the operands shall have integral type. -3.3.10(7) -Unacceptable operand of ^. -Each of the operands shall have integral type. -3.3.11(18) -Unacceptable operand of |. -Each of the operands shall have integral type. -3.3.12(30) -Unacceptable operand of &&. -Each of the operands shall have scalar type. -3.3.13(7) -Unacceptable operand of ||. -Each of the operands shall have scalar type. -3.3.14(20) -Unacceptable operand of conditional operator. -The first operand of conditional operator shall have scalar type. One -of the following shall hold for the second and third operands: -both operands have arithmetic type; both operands have compatible -structure or union types; both operands have void type; both operands -are pointers to qualified or unqualified versions of compatible types; -one operand is a pointer and the other is a null pointer constant; or -one operand is pointer to an object or incomplete type and the other -is a pointer to a qualified or unqualified version of void. -3.3.15 -Duplicate label '%s' -A label name can only occur once in a function. -3.1.2.1(25) -Division by zero. -3.3.5 -Subscripting a non-array. -3.3.2.1 -Subscripting an array of incomplete type which is not an object type. -The element of the array shall have an object type. -3.3.2.1 -Should only subscript an array with an integral expression -3.3.2.1 -Subscripting an unbounded array -3.3.2.1 -Array index out of range -3.3.2.1 -Selector requires struct/union pointer as left hand side -In K&R mode the expression is implicitly converted to the '.' selector -for a struct/union left-hand side. -3.3.2.3 -Selector requires struct/union as left hand side -In K&R mode the expression is implicitly converted to the '->' selector -for a struct/union pointer left-hand side. -3.3.2.3 -member of structure or union required -3.3.2.3 -types have different qualifier specifications -For two qualified types to be compatible, both shall have the -identically qualified version of a compatible type; qualified -and unqualified versions of a type are distinct types. For two -types to be compatible their types must be the same. -3.5.3(26) -Incompatible array type due to different array size -For two array types to be compatible, both shall have compatible element -types; if both size specifiers are present, they shall have the -same value. -3.5.4.2(11) -Incompatible array type due to incompatible element type -For two array types to be compatible, both shall have compatible element -types. -3.5.4.2(11) -Incompatible pointer type assignment -The type pointed to by the left-hand side of simple assignment -statement is incompatible with the type pointed to by the right-hand side. -3.3.16.1, 3.5.4.1(21) -Incompatible base type of pointer type -K&R feature. -Type %s of %s is incompatible with type %s of %s -Incompatible types can be resolved by casting or by other means. -3.3.16.1 -illegal combination of pointer and integer -Assigning an integral expression to a pointer is a bad practice. -Type for %s is incompatible with %s -Incompatible types can be resolved by casting or by other means. -3.1.2.6 -Bad operand type for += or -= -3.3.16.2(26) -A case or default label appears outside a switch statement -A case or default label shall appear only in a switch statement. -3.6.1 -The controlling expression of the if statement is not scalar type -The controlling expression of an if statement shall have scalar type. -3.6.4.1 -The controlling expression of switch statement is not integral type -The controlling expression of an switch statement shall have integral type. -3.6.4.2(20) -The case label is not an integral constant expression -The case label shall be an integral constant expression. -3.6.4.2(22) -Duplicate case label in the same switch statement -No two of the case constant expressions in the same switch statement -shall have the same value after conversion. -3.6.4.2(22) -More than one default label in the same switch statement -There may be at most one default label in a switch statement. -3.6.4.2(23) -The controlling expression of the iteration statement is not scalar -type -The controlling expression of a iteration statement shall have scalar -type. -3.6.5.1 -label '%s' used, but not defined -The identifier in a goto statement shall name a label located -somewhere in the enclosing function. -3.6.6.1 -A continue statement shall appear only in or as a loop body -3.6.6.2 -A break statement shall appear only in or as a switch body or loop body -3.6.6.3 -A return statement with an expression should not appear -in a function '%s', whose return type is void -3.6.6.4(24) -A return statement without an expression appears in a -function '%s', whose return type is not void -If a return statement without an expression is executed, and the value -of the function call is used by the caller, the behavior is undefined. -3.6.6.4(33) -Internal Error: statement stack underflow -Long double not supported; double assumed. -Long float not standard; double assumed. -Only 'register' allowed in parameter declaration -The only storage-class specifier that shall occur in a parameter -declaration is 'register'; illegal storage class ignored. -3.5.4.3(25) -Name(s) without types in a function declaration -An old-style function declaration is not allowed to have names -in the parameter list; useless names ignored -3.5.4.3(26) -Functions cannot return functions -3.7.1(33), 3.3.2.2 -Functions cannot return a non-object type -3.3.2.2 -enum declaration must contain enum literals -Although structs or unions may delay the declaration of their members, -a similar construction with enum does not exist and is not necessary, -as there can be no mutual dependencies between the declaration of an -enumerated type and any other type. -3.5.2.3(27) -Register qualification has no effect for this type of object -Register declarations for array, struct, and function types have -no effect. -3.5.1(16), 3.5.1(19) -Functions cannot be declared 'register' -The declaration of an identifier for a function that has block -scope shall have no explicit storage-class specifier other than -'extern'. -3.5.1(19) -'%s' cannot be initialized -The type of the entity to be initialized shall be an object type -or an array of unknown size. -3.5.7(32) -Cannot initialize 'extern' variable '%s' within a function -If the declaration of an identifier has block scope, and the -identifier has 'extern' or 'static' linkage, the declaration -shall have no initializer for the identifier; initialization -allowed anyway. -3.5.7(35) -initializing an 'extern' is an ANSI C extension -conflicting declarations for '%s' -'static' and 'extern' declarations conflict. Which is meant? -3.1.2.2(15), 3.1.2.2(27) -Too many initial values for '%s' -3.5.7(1) -incompatible types in initialization -3.3.16(35) -redefinition of '%s'; previous definition at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -bit-fields as members of a union are an ANSI C invention. -storage size for '%s' isn't known -type mismatch in initialization -Missing braces in a union initialization or illegally formed -initialization. -3.5.7(5) -union '%s' only allowed one initializer for the first member -3.5.7(5) -width of '%s' exceeds its type -the specified bitfield width is too large to be contained within a -bitfield type. -structure has no member named '%s' -This is allowed for compatibility with AT&T pcc-based compilers. -Reference of an expression of void type or an incomplete type. -3.2.2.1 -element size of an array shall not be zero -3.2.2.5(25) -invalid combination of type specifiers -Although order is unimportant, not all type specifiers can occur together. -3.5.2 -declaration must at least declare an identifier, tag, or the member of an enumeration -3.5(16) -at most one storage class may be given in the declaration -Duplicate occurrence ignored. -3.5.1(10) -size of function's return type is zero -The return type of a function must be void or an object type other than array. -3.7.1(33) -Expecting an integral return type from the main function -identifier missing from parameter declaration -Prototypes for function definitions require identifiers in parameter -declarations. -3.7.1(4) -only 'register' allowed for storage class for parameters -The declarations in the declaration list shall contain no storage class -other than 'register', and no initializations. -3.7.1(10) -parameters declarations can not have initializations -3.7.1(10) -only one instance of 'void' allowed in the parameter list -'void' must occur by itself (specifying that the function has no parameters). -3.5.4.3(1) -%s must have function type -1) An argument list must be explicitly present in the declarator; it cannot - be inherited from a typedef (3.5.4.3). -2) The declarator is not a function. -3.7.1(30) -Illegal hexadecimal constant -You have no digits after the 0x or 0X. 0x0 assumed. -3.1.3.2 -value overflows its type in this context. Value is set to be '%s'! -3.2.1.4 -value is outside range representable for type '%s' -missing member name -K&R mode permits a missing member name; otherwise, only bitfields can omit -the member name. -3.5.2.1(10) -useless keyword or type name in declaration -Type was ignored. -'%s' declared within and is limited to this function prototype -Possible program error, since parameter type checking will always fail -unless the type declaration is visible to the caller. -3.1.2.1(35) -Extra spaces within operator, %s assumed -In ANSI C, the compound assignment operator cannot have embedded -white space characters. -3.1.5 -missing size for array '%s' -Incomplete types permitted for identifiers with internal or -external linkage, but not automatic linkage. -3.1.2.5(10) -can't jump into (from outside of) the body of a 'try' or into either type of handler -'%s' missing, please #include excpt.h -excpt.h required to declare exception statements, intrinsics or compiler -runtime names. -local function declarations cannot be 'static' -A function declaration can only contain the storage-class 'static' -if it is at file scope. Declaration made 'extern'. -3.5.1(19) -static function '%s' declared and referenced, but not defined. -If an identifier declared with internal linkage is used in an -expression (other than as a part of the operand of a sizeof -operator), there shall be exactly one external definition for -the identifier in the translation unit. -3.7(12) -pragma argument '%s' must be declared prior to being used in a pragma -Pragma name ignored. -Pragma not supported -'%s' not enabled as intrinsic -It may have already appeared in a function pragma, or never occurred in -an intrinsic pragma. -'%s' is already enabled as an intrinsic -weak definition for '%s' is later redefined; pragma weak ignored. -definition of primary name '%s' not found; pragma weak ignored. -definition of secondary name '%s' not found; pragma weak ignored. -primary name '%s' is declared as a common or external, and is not defined -with initial value within this file; pragma weak ignored. -useless '%s' storage class ignored -array of functions not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -array of voids not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -argument for pragma pack must be an integer constant; pragma ignored -'%s' has wrong tag type. -Identifier redeclared in the same scope/block. -3.1.2.3 -missing dimension bound -For multidimensional arrays, the constant bounds of the array may be -omitted only for the first member of the sequence. -3.1.2.5(23) -Internal error in parameters to function substr; loc: '%s'; len: '%s'. -Internal error in parameters to function insertstr; indx: '%s'. -Internal error in function get_tag_name; input is a non-tagged type. -Internal error in function gen_type_str -- not a type tree '%s' -Cannot open file '%s' -Prototype should be moved after tag or a typedef declaration. -Please look for comments in the extracted header file. -The extracted header file includes prototypes for static functions, -which should be removed, if you wish to include the header in a source file -other than the originator. -ANSI C requires formal parameter before "..." -This extension is meant to be used for compatibility with varargs.h -3.5.4.3(35) -syntax error: "&..." invalid -extension used to access "..." formal arguments. -function '%s' initialized like a variable -The type of entity to be initialized shall be an object type or an -array of unknown size. -3.5.7(31) -initializer not an array aggregate -The initializer for an object that has aggregate type shall be a -brace-enclosed list of initializers for the members of the aggregate, -written in increasing subscript or member order. -3.5.7(20) -'%s' type is incomplete; cannot initialize -Was the struct ever defined? -3.5.7.(31) -'%s' is not standard ANSI. -This keyword/type is not defined in strict ANSI mode. -3.1.1 -not a legal asm string -The first operand of an asm string should be, after argument substitution, -a legal assembly string. -The -float option will be ignored in ANSI mode. -The -float option is ignored, since otherwise program semantics would -violate the ANSI standard. In particular, fp constants are always -'double' with ANSI-C, while with -float the type of fp constants will -depend on the context and may be 'float'. -ANSI C support unavailable with C compiler bundled with RISC/os -The C compiler bundled with RISC/os does not support ANSI C. ANSI -C support requires a separate license. -Ignored invalid warning number(s) in -woff option, %s%s ! -Warning numbers must be in the range %s to %s. -The set of warning numbers in cfe is disjoint from the set of warning numbers -in accom, since accom warnings cannot be mapped one-to-one to cfe warnings. -'%s' not handled as an intrinsic due to incompatible argument types . -'__unalign' only qualifies pointers -'__unalign' indicates the object pointed at by pointer is unaligned (e.g., -int * __unalign p). This is an extension to ANSI C and like 'volatile' -and 'const' can follow the '*' in pointer declarations, but unlike both -cannot qualify a base type. -index expression is an anachronism -ANSI C++ doesn't support array index expressions in delete. -5.3.4 -member cannot be of function or incomplete type. -3.5.2.1(12) -Illegal lint option, '%s', is ignored. -cannot open header message buffer file -cannot write header message buffer file -cannot read header message buffer file -cannot seek in header message buffer file -struct/union/enum '%s' is used, but not defined -static '%s' unused -nonportable character comparison (chars may be signed or unsigned) -redundant comparison of unsigned with constant expression -redundant statement, control flow cannot reach this statement -'%s' may be used before set -function parameter '%s' is not used in function '%s' -'%s' can be const qualified, since it is not set within its lifetime. -'%s' is not used in function '%s' -'%s' set but unused in function '%s' -control may fall through %s statement -function '%s' has return(e); and return; -function '%s' may return random value to place of invocation %s -label without goto: '%s' -width of %s constant is smaller than size of type (%s) -explicit conversion from '%s' to '%s' %s -implicit conversion from '%s' to '%s' %s -'%s' may be indistinguishable from '%s' due to internal name truncation -Promoted formal parameter and promoted argument have incompatible types -No prototype for the definition of '%s' %s -References to '%s' are substituted by its literal initializer - (as included in %s) -============== -unsupported language linkage -string-literal specifies an unsupported linkage -7.4(1) -No prototype for the call to %s -To achieve better type-checking, there should be a full prototype for -the function being called. -3.5.4.3 -'inline' only applies to function declarations -leave statment can occur only within try body -Microsoft extension -Use of a Microsoft extension detected without usage of the -compiler option -msft. -No parameter mentioned -A file with no declarations or definitions is accepted as an extension to ANSI C -The translation unit must contain at least one external definition. -3.7 -Incompatible signed and unsigned version of a type -Yacc initialization error -Internal error: yacc cannot initialize itself. -The cfe option %s may not be in future releases. We suggest that you not use this option! -Incompatible char and unsigned char versions of a type -Lshift with undefined behaviour. -Lshift with a negative right operand, or a right operand that is greater -than or equal to the width in bits of the promoted left operand, results -in undefined behaviour. -3.3.7(11) -useless type name in declaration, possibly a semicolon is missing. -Type was ignored. -constant initializer expression is invalid (refers to automatic variables). -All the expressions in an initializer for an object that has static storage -duration or in the initializer list for an object that has aggregate or -union type shall be constant expressions. Otherwise, unexpected results -may occur. -3.5.7(32) and 3.4 -invalid explicit or implicit conversion of an address constant to an integral value in a constant initializing expression. -An address constant in a constant initializing expression can neither -initialize a bit-field nor be directly or indirectly converted to an -integral type of size different from an address type. -6.4 diff --git a/tools/ido5.3_compiler/usr/lib/libc.so.1 b/tools/ido5.3_compiler/usr/lib/libc.so.1 deleted file mode 100755 index 17495ef6c..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/libc.so.1 and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/libexc.so b/tools/ido5.3_compiler/usr/lib/libexc.so deleted file mode 100755 index 209c53666..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/libexc.so and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/libgen.so b/tools/ido5.3_compiler/usr/lib/libgen.so deleted file mode 100755 index 7b8ec7fd5..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/libgen.so and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/libm.so b/tools/ido5.3_compiler/usr/lib/libm.so deleted file mode 100755 index 05bf47817..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/libm.so and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/ugen b/tools/ido5.3_compiler/usr/lib/ugen deleted file mode 100755 index beb81f4bd..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/ugen and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/ujoin b/tools/ido5.3_compiler/usr/lib/ujoin deleted file mode 100755 index 23a4cbbde..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/ujoin and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/uld b/tools/ido5.3_compiler/usr/lib/uld deleted file mode 100755 index bd182fdc7..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/uld and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/umerge b/tools/ido5.3_compiler/usr/lib/umerge deleted file mode 100755 index e8e09e664..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/umerge and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/uopt b/tools/ido5.3_compiler/usr/lib/uopt deleted file mode 100755 index 5451428ba..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/uopt and /dev/null differ diff --git a/tools/ido5.3_compiler/usr/lib/usplit b/tools/ido5.3_compiler/usr/lib/usplit deleted file mode 100755 index 112abfcde..000000000 Binary files a/tools/ido5.3_compiler/usr/lib/usplit and /dev/null differ diff --git a/tools/ido7.1_compiler/lib/cpp b/tools/ido7.1_compiler/lib/cpp deleted file mode 100755 index 5ff7599f4..000000000 Binary files a/tools/ido7.1_compiler/lib/cpp and /dev/null differ diff --git a/tools/ido7.1_compiler/lib/libc.so.1 b/tools/ido7.1_compiler/lib/libc.so.1 deleted file mode 100755 index 895c545a9..000000000 Binary files a/tools/ido7.1_compiler/lib/libc.so.1 and /dev/null differ diff --git a/tools/ido7.1_compiler/lib/libmalloc.so b/tools/ido7.1_compiler/lib/libmalloc.so deleted file mode 100755 index 2a59e0a49..000000000 Binary files a/tools/ido7.1_compiler/lib/libmalloc.so and /dev/null differ diff --git a/tools/ido7.1_compiler/lib/rld b/tools/ido7.1_compiler/lib/rld deleted file mode 100755 index efa7bc55c..000000000 Binary files a/tools/ido7.1_compiler/lib/rld and /dev/null differ diff --git a/tools/ido7.1_compiler/usr/bin/cc b/tools/ido7.1_compiler/usr/bin/cc deleted file mode 100755 index 5481e4f32..000000000 Binary files a/tools/ido7.1_compiler/usr/bin/cc and /dev/null differ diff --git a/tools/ido7.1_compiler/usr/lib/as1 b/tools/ido7.1_compiler/usr/lib/as1 deleted file mode 100755 index 7cbed08c0..000000000 Binary files a/tools/ido7.1_compiler/usr/lib/as1 and /dev/null differ diff --git a/tools/ido7.1_compiler/usr/lib/cfe b/tools/ido7.1_compiler/usr/lib/cfe deleted file mode 100755 index 63121653a..000000000 Binary files a/tools/ido7.1_compiler/usr/lib/cfe and /dev/null differ diff --git a/tools/ido7.1_compiler/usr/lib/err.english.cc b/tools/ido7.1_compiler/usr/lib/err.english.cc deleted file mode 100755 index b5d5be36e..000000000 --- a/tools/ido7.1_compiler/usr/lib/err.english.cc +++ /dev/null @@ -1,1260 +0,0 @@ -@ - 358 358 358 - 6464 6482 6553 - 6553 6593 6728 - 6728 6746 6803 - 6803 6808 6808 - 6808 6818 6818 - 6818 6826 6826 - 6826 6847 6847 - 6847 6875 6922 - 6922 6930 6930 - 6930 6939 6939 - 6939 6948 6948 - 6948 6974 7120 - 7120 7149 7204 - 7210 7248 7311 - 7317 7350 7442 - 7450 7497 7627 - 7635 7709 7930 - 7938 7975 8063 - 8071 8113 8253 - 8261 8289 8289 - 8298 8338 8445 - 8460 8502 8635 - 8650 8690 8819 - 8834 8857 8965 - 8965 9008 9113 - 9119 9142 9227 - 9235 9282 9451 - 9451 9462 9462 - 9462 9477 9477 - 9477 9497 9497 - 9497 9545 9545 - 9545 9584 9584 - 9584 9604 9662 - 9662 9682 9720 - 9720 9749 9749 - 9749 9788 9788 - 9788 9802 9802 - 9802 9829 9829 - 9829 9861 9861 - 9861 9904 9904 - 9904 9920 9920 - 9920 9962 9962 - 9962 9988 9988 - 9988 10014 10014 -10014 10035 10035 -10035 10054 10097 -10097 10115 10115 -10115 10147 10147 -10147 10183 10183 -10183 10208 10208 -10208 10236 10236 -10236 10269 10269 -10269 10304 10304 -10304 10328 10328 -10328 10351 10351 -10351 10371 10371 -10371 10402 10402 -10402 10447 10447 -10447 10497 10497 -10497 10533 10533 -10533 10598 10598 -10606 10630 10630 -10640 10671 10671 -10690 10719 10719 -10728 10752 10795 -10795 10837 10837 -10837 10876 10876 -10876 10900 10900 -10900 10948 10948 -10960 11021 11103 -11103 11128 11128 -11128 11153 11153 -11153 11216 11216 -11216 11239 11239 -11239 11303 11303 -11303 11347 11347 -11357 11393 11393 -11393 11432 11432 -11442 11494 11494 -11494 11536 11536 -11536 11595 11595 -11595 11622 11622 -11622 11684 11684 -11684 11726 11726 -11738 11778 11778 -11782 11813 11813 -11813 11850 11850 -11850 11900 12087 -12111 12120 12120 -12120 12129 12129 -12129 12158 12158 -12158 12192 12192 -12192 12237 12237 -12237 12273 12273 -12273 12326 12326 -12330 12366 12366 -12366 12423 12423 -12427 12482 12482 -12486 12560 12560 -12568 12631 12631 -12637 12691 12691 -12691 12743 12743 -12743 12785 12785 -12785 12826 12826 -12826 12865 12865 -12865 12883 12883 -12883 12946 12946 -12956 12995 12995 -13005 13066 13066 -13077 13163 13163 -13163 13211 13211 -13211 13270 13270 -13270 13318 13318 -13318 13350 13350 -13350 13387 13387 -13387 13428 13428 -13428 13464 13533 -13533 13580 13737 -13737 13776 13854 -13854 13913 13913 -13913 13950 13950 -13950 14118 14118 -14118 14150 14150 -14150 14163 14194 -14194 14224 14255 -14255 14275 14319 -14319 14353 14458 -14466 14484 14530 -14534 14567 14567 -14567 14635 14682 -14690 14742 14742 -14742 14789 14789 -14801 14875 14875 -14886 14947 14947 -14947 14992 14992 -14992 15035 15085 -15085 15134 15205 -15214 15267 15448 -15454 15496 16810 -16822 16875 16960 -16972 17053 17179 -17191 17236 17332 -17344 17491 17841 -17853 17939 18304 -18316 18471 18774 -18786 18952 19323 -19335 19364 19496 -19500 19527 19598 -19598 19613 19776 -19797 19808 19837 -19837 19862 19862 -19868 19927 20026 -20034 20075 20179 -20187 20223 20223 -20223 20290 20382 -20392 20441 20589 -20601 20656 20656 -20656 20699 20818 -20826 20860 21038 -21046 21094 21191 -21203 21236 21314 -21326 21395 21457 -21469 21502 21502 -21502 21587 21731 -21756 21789 21864 -21875 21901 21976 -22013 22059 22220 -22257 22397 22561 -22561 22595 22595 -22603 22623 22623 -22631 22667 22828 -22865 22919 22994 -23031 23059 23120 -23132 23201 23201 -23212 23274 23274 -23285 23345 23345 -23356 23393 23393 -23399 23431 23532 -23542 23587 23646 -23656 23697 23745 -23755 23796 23844 -23854 23876 23928 -23942 23971 24153 -24160 24243 24243 -24247 24273 24743 -24755 24784 24984 -24996 25034 25034 -25034 25075 25273 -25281 25332 25410 -25420 25467 25544 -25554 25583 25744 -25754 25783 26061 -26071 26111 26185 -26194 26239 26525 -26535 26568 26914 -26924 26951 26998 -27008 27035 27082 -27093 27120 27167 -27178 27206 27251 -27261 27289 27334 -27345 27391 27931 -27938 27959 28007 -28019 28037 28037 -28043 28069 28069 -28077 28147 28199 -28207 28266 28266 -28274 28306 28306 -28314 28339 28339 -28347 28404 28510 -28518 28567 28682 -28690 28728 28728 -28736 28782 29023 -29033 29085 29234 -29246 29303 29383 -29395 29432 29570 -29592 29631 29644 -29644 29693 29758 -29767 29810 29875 -29875 29911 29976 -29984 30014 30014 -30027 30086 30151 -30157 30223 30293 -30301 30369 30445 -30457 30511 30568 -30580 30630 30743 -30755 30812 30874 -30886 30959 31035 -31043 31076 31175 -31183 31243 31243 -31251 31323 31323 -31331 31433 31433 -31445 31544 31686 -31698 31740 31740 -31740 31783 31783 -31783 31824 31824 -31824 31873 31996 -32008 32056 32164 -32176 32210 32210 -32229 32271 32271 -32279 32323 32569 -32581 32642 32718 -32739 32779 32916 -32926 32953 33047 -33057 33116 33315 -33325 33373 33373 -33373 33407 33469 -33494 33527 33527 -33536 33573 33573 -33584 33650 33697 -33705 33763 33763 -33763 33797 33797 -33797 33829 33906 -33915 33976 33976 -33985 34016 34098 -34098 34133 34198 -34198 34261 34261 -34269 34312 34312 -34324 34363 34438 -34444 34530 34530 -34538 34596 34626 -34636 34675 34754 -34764 34821 34821 -34821 34867 34950 -34959 35016 35135 -35145 35198 35198 -35208 35266 35344 -35355 35382 35537 -35547 35576 35629 -35637 35705 35705 -35713 35764 35764 -35764 35784 35876 -35888 35932 35950 -35950 36013 36138 -36150 36191 36280 -36286 36314 36419 -36431 36516 36516 -36516 36554 36642 -36642 36689 36808 -36818 36881 37105 -37113 37183 37204 -37204 37225 37225 -37225 37255 37348 -37348 37388 37388 -37388 37454 37454 -37454 37518 37518 -37518 37584 37584 -37584 37717 37717 -37717 37752 37752 -37752 37783 37889 -37901 37928 38034 -38046 38115 38115 -38115 38140 38187 -38195 38219 38339 -38351 38422 38422 -38422 38486 38486 -38486 38555 38555 -38555 38619 38619 -38619 38641 38641 -38641 38758 38758 -38758 38929 38929 -38929 38975 39043 -39055 39084 39133 -39133 39175 39265 -39275 39310 39494 -39504 39547 39576 -39587 39614 39668 -39674 39697 39797 -39797 39845 40094 -40094 40158 40264 -40264 40369 40523 -40523 40593 40593 -40593 40629 40876 -40876 40911 40971 -40977 41026 41026 -41038 41077 41077 -41077 41116 41116 -41116 41156 41156 -41156 41195 41195 -41195 41237 41237 -41237 41285 41285 -41285 41304 41304 -41304 41371 41371 -41371 41429 41429 -41429 41491 41491 -41491 41519 41519 -41519 41572 41572 -41572 41642 41642 -41642 41676 41676 -41676 41713 41713 -41713 41751 41751 -41751 41792 41792 -41792 41856 41856 -41856 41881 41881 -41881 41944 41944 -41944 41985 41985 -41985 42026 42026 -42026 42098 42098 -42098 42170 42170 -42170 42213 42213 -42213 42275 42275 -42275 42302 42302 -42302 42317 42317 -42317 42346 42394 -42401 42433 42530 -42538 42585 42585 -42585 42631 42631 -42631 42651 42733 -42733 42756 42756 -42756 42837 42905 -42909 42960 42960 -42960 42986 43033 -43033 43124 43124 -43124 43179 43179 -43179 43212 43384 -43394 43461 43479 -43479 43555 43788 -43806 43929 44124 -44128 44128 44128 -Out of memory: %s -There is no more memory left in the system for compiling this program. -Internal Error Unknown Error Message %s -1) An internal error, while attempting to print an unavailable message -2) The error message file is inaccessible or has other problems -Unknown Signal %s -1) An unknown signal has been caught -2) 2 Nested signals -line -Warning: -Fatal: -Source not available -Too many errors... goodbye. -There is a limit of 30 errors before aborting. -Error: -reserved -reserved -Unknown Control Statement -1) The line begins with a '#' and is not of the form: - # "" -2) Please compile this program with the preprocessor enabled. -Unknown character %s ignored -The character is not part of the source character set. -2.2.1 -Unknown control character \%s ignored -The control character is not part of the source character set. -2.2.1 -Illegal character %s in exponent -1) Digits or sign expected after 'e' or 'E'. -2) Digits are expected after sign in exponent. -3.1.3.1 -Constant is out of range and may be truncated. -The constant is too large to be accurately represented and may be -truncated. The limits are in the system include file limits.h. -2.2.4.2 -Constant is out of range for a 32-bit data type, but accepted as written. -The constant is too large to fit in a 32-bit data type, but will be -accurately represented in a wider data type. The value may be truncated, -depending on its context. The limits are in the system include file -limits.h. -2.2.4.2 -Character constant size out of range -1) No characters in a character constant. -2) More than 4 bytes in a character constant. -3.1.3.4 -Wide character constant size out of range -1) No characters in the multibyte sequence (0 assumed). -2) More than 1 byte in the multi-byte sequence (only the first byte was converted). -3.1.3.4 -Invalid multibyte character -4.10.7.2 -Newline in string or character constant -1) Terminate your string or character constant with closing quotes. -2) Put a backslash before the newline. -3.1.3.4, 3.1.4 -Octal character escape too large: %s > %s -1) Terminate end of octal sequence with a non-octal character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Hex character escape too large: %s > %s -1) Terminate end of hex sequence with a non-hex character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Unexpected End-of-file -1) Unterminated string or character constant -2) Missing closing comment marker (*/) -3) File system problems -Unrecognized escape sequence in string \%s -Recognized escape sequences are \a, \b, \f, \n, \r, \t, and \v. -Character will be treated as un-escaped. -3.9.2 -Illegal octal digit %s -Octal constants, beginning with 0, must only have digits between 0 and 7, -inclusive. -3.1.3.2 -Unable to open temporary file for compiling %s -1) TMPDIR environment variable is set to a directory that you have no - permissions for. -2) The file system is full. -3) System errors beyond the scope of the compiler. -%s: Hangup -%s: Interrupt -%s: Quit (ASCII FS) -%s: Illegal instruction (not reset when caught) -%s: Trace trap (not reset when caught) -%s: IOT instruction -Also SIGABRT, used by abort, replace SIGIOT in the future -%s: EMT instruction -Also SIGXCPU, Exceeded CPU time limit -%s: Floating point exception -%s: Kill (cannot be caught or ignored) -%s: Bus error -%s: Segmentation violation -%s: Bad argument to system call -%s: Write on a pipe with no one to read it -%s: Alarm clock -%s: Software termination signal from kill -%s: User defined signal 1 -%s: User defined signal 2 -%s: Death of a child -Power-fail restart -%s: Also SIGXFSZ, exceeded file size limit -%s: Window change -%s: Handset, line status change -%s: Sendablestop signalnot from tty -%s: Stop signal from tty -%s: Pollable event occurred -%s: Input/Output possible signal -%s: Urgent condition on IO channel -%s: Window size changes -%s: Virtual time alarm -%s: Profiling alarm -%s: Continue a stopped process -%s: To readers pgrp upon background tty read -%s: Like TTIN for output if (tp->t_local<OSTOP) -%s: Resource lost (eg, record-lock) -'auto' and 'register' are not allowed in an external declaration -3.7(10) -must have function type -3.7.1(30) -Functions cannot return arrays -3.7.1(33), 3.3.2.2 -Declaration list not allowed -3.7.1(5) -Too many input files %s -The command line may contain only one file -cpp internal error: input stack underflow -cpp internal error: if stack underflow -Cannot open the file %s -No new-line character at the end of the file %s -2.1.1.2(30) -Fatal: Exceeded the limit of nesting level for #include file -Fatal: Exceeded the limit of nesting level for #include file. This limit -is 200. -Fail to read the file %s -Cannot write the file %s -%s: %s: An if directive is not terminated properly in the file -%s: %s: nested comment -%s:%s: Illegal macro name %s; macro name shall be an identifier -%s:%s: Illegal preprocessing token sequence -3.8.3(35) -%s:%s: Illegal macro parameter name -%s:%s: Non-unique macro parameter name -3.8.3(18) -%s:%s: Missing ')' in parameter list for #define %s -%s:%s: Missing ')' in macro instantiation -%s:%s: Bad punctuator in the parameter list for #define %s -%s:%s: Macro %s redefined. -%s:%s: # operator should be followed by a macro argument name -%s:%s: Badly formed constant expression%s -3.4(9), 3.8 -%s:%s: Division by zero in #if or #elif -3.8 -unknown command line option %s -extraneous input/output file name %s -%s: %s: Unterminated string or character constant -A preprocessing string or character constant token was not -terminated. Note that preprocessing directives are processed -after the source file has been divided into preprocessing tokens. -2.1.1.2(30) 3.1(18) 3.8 -%s: %s: -%s: %s: -%s: %s: Unterminated comment -%s: %s: Unknown directive type %s -%s: %s: #elif or #else after #else directive -%s: %s: Bad identifier after the %s -%s: %s: #%s accepts only one identifier as parameter -3.8 -%s: %s: Bad identifier after the %s -%s: %s: text following #%s violates the ANSI C standard. -3.8 -%s: %s: Bad character %s occurs after the # directive. -3.8 -%s: %s: the ## operator shall not be the %s token in the replacement list -3.8.3.3 -%s: %s: the defined operator takes identifier as operand only. -3.8.1 -%s: %s: Not in a conditional directive while using %s -%s: %s: Illegal filename specification for #include -%s: %s: Invalid file name %s for #include -%s: %s: Cannot open file %s for #include -%s: %s: Bad argument for #line command -%s: %s: #error %s -%s: %s: Tried to redefine predefined macro %s, attempt ignored -3.8.7(22) -%s: %s: Undefining predefined macro %s -3.8.7(22) -%s: %s: Undefined the ANSI standard library defined macro %s -4.1.2.1(9) -%s: %s: The number of arguments in the macro invocation does not match the definition -%s: %s: Illegal character %s in preprocessor if -%s: %s: Illegal character %s for number in preprocessor if -%s: %s: No string is allowed in preprocessor if -%s: %s: Not supported pragma %s -%s: %s: Not supported #pragma format -%s: %s: ANSI C does not allow #ident; %s -%s: %s: Not supported #ident format -This cpp extension accepts the following format: -#ident "any string" -%s: %s: Not supported #assert/#unassert format -This cpp extension accepts the following format: -#assert identifier -#assert identifier ( pp-tokens ) -#unassert identifier -#unassert identifier ( pp-tokens ) -%s: %s: Bad assertion predicate format -The correct syntax for this cpp extension is: -#assert identifier ( pp-token ) -%s: %s: directive is an upward-compatible ANSI C extension -%s: This option requires an argument -%s: %s: A macro has expanded recursively more than %s times. Further expansion will be disabled! Use command-line option: -Wp,-max_rec_depth=depth to recurse deeper. -A status return from cpp to cfe -Syntax Error -The token read was unexpected. -Syntax Error -- cannot backup -The token read was unexpected. -Yacc stack overflow -The expression is too complicated to parse. -Trailing comma in enumerator list -The use of a trailing comma in an enumerator list is not standard C. There -may be portability problems. -3.5.2.2 -Empty declaration -Empty declarations are invalid in standard C. -3.5 -%s declared, but not referenced. -redeclaration of '%s'; previous declaration at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -'%s' undefined; reoccurrences will not be reported. -Non-function name referenced in function call. -3.3.2.2(18) -The number of arguments doesn't agree with the number in the declaration. -3.3.2.2(5) -'%s' section name longer than 8 characters. Name truncated. -'%s' is already placed by pragma alloc_text. -Cannot write ucode file while compiling %s -1) The file system is full -2) Permissions problem -Must have corresponding formal argument for '%s' -Parameter found in the declaration part, but not in the argument list. -3.7.1(7) -Non-prototype declaration is an obsolescent feature. -The use of function definitions with separate parameter identifier -and declaration lists (not prototype-format parameter type and -identifier declarators) is an obsolescent feature. -3.9.5 -Incompatible function declarations for %s -For two function types to be compatible, both shall specify compatible -return types. Moreover, the parameter type lists, if both are present, -shall agree in the number of parameters and in use of the ellipsis -terminator; corresponding parameters shall have compatible types. If -one type has a parameter type list and the other type is specified by -a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. If one type has a parameter type list and the -other is specified by a function definition that contains a (possibly -empty) identifier list, both shall agree in the number of parameters, -and the type of each prototype parameter shall be compatible with the -type that results from application of the default argument promotions -to the type of the corresponding identifier. (For each parameter -declared with function or array type, its type for these comparisons -is the one that results from conversion to a pointer type. For each -parameter declared with qualified type, its type for these comparisons -is the unqualified version of its declared type.) There you have it! -3.5.4.3(15) -Incompatible function return type for this function. -For two function types to be compatible, both shall specify compatible -return types. -3.5.4.3(15) -The number of parameters for function is different from the previous declaration -The parameter type lists, if both are present, shall agree in the -number of parameters and in use of the ellipsis terminator. -3.5.4.3(15) -Incompatible type for the function parameter -If both parameter type lists are present, corresponding -parameters shall have compatible types. -3.5.4.3(15) -Function %s is redeclared with an incompatible argument type (after default argument promotion), which could lead to undefined run-time behaviour. -The redeclaration could cause arguments at a call site to be passed -inconsistently with what the function implementation expects, and -parameters would therefore be accessed erroneously when executing the -function body. Note that a float argument is promoted to a double -when passed (potentially through fp registers) to an unprototyped -function. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, ellipsis terminator not allowed -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the type of each parameter shall be -compatible with the type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype declaration and non-prototype definition found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other is specified by a -function definition that contains a (possibly empty) identifier list, -both shall agree in the number of parameters, and the type of each -prototype parameter shall be compatible with the type that results -from application of the default argument promotions to the type of the -corresponding identifier. -3.5.4.3(15) -Empty declaration specifiers -Standard C requires at least a storage class specifier, type specifier, -or a type qualifier in declarations. 'extern int' assumed. -3.5 -Can't write to the file %s -1) The output file cannot be opened for writing. -2) Out of file space. -Duplicate '%s' -typedef, extern, static, auto, register, const, volatile may not -appear more than once in the same specifier list or qualifier list. -Duplicate occurrence ignored. -3.5.1(10) , 3.5.3(5) -Null input -There is nothing to compile. -Illegal type combination -3.5.2 -Missing ';' at end of structure / union member declaration -In standard C, each member declaration must be terminated by a ';'. A -terminating ';' is assumed. -3.5.2.1 -Missing member name in structure / union -In standard C, each member declaration have a member name. The missing -member is assumed to not exist. -3.5.2.1 -This variable is initialized twice. -Neither 'const' or 'volatile' have any effect on function results. -Qualifiers only apply to expressions designating an object that -can be altered or examined. -3.5.3(10) -An integer constant expression is required here. -The expression that defines the value of an enumeration constant -shall be an integral constant expression that has a value -representable as an int. -3.5.2.2(28) -(previous declaration of '%s' at line %s in file '%s') -Must be an integer type greater than zero. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -Array size cannot be a long long. -Arrays with more than 2^32 elements are not yet supported. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -bit-field '%s' width is not an integer constant -The expression that specifies the width of a bit-field shall be an -integral constant expression. -3.5.2.1(15) -bit-field '%s' width is negative -The expression that specifies the width of a bit-field shall be -non-negative. -3.5.2.1(15) -bit-field '%s' type required to be int, unsigned int, or signed int. -A bit-field shall have type int, unsigned int, or signed int. -3.5.2.1(30) -bit-field %s's type not integer. -Non-scalar type or pointer type to a non-object for increment or decrement operator. -The operand of the prefix/postfix increment or decrement operator shall have scalar type; if it is of pointer type, it must point to an object. -3.3.2.4(37), 3.3.3.1(25) -Assign value to a function type. -An assignment operator shall have a modifiable lvalue as its left operand. -3.2.2.1(5) -Assign value to an array. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for variable of incomplete type. -The operand of increment and decrement operator shall be a modifiable -scalar lvalue. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -The left-hand side of the '.' operator must be an addressable lvalue, when a bit-field is not contained within a unit of 32 bits alignment. -This is a restriction in our implementation, which can be worked -around by always accessing long long bit-fields indirectly (i.e. -by means of the '->' operator). -This expression is not an lvalue. -3.2.2.1 -Modified an rvalue. -3.2.2.1 -Change value for constant variable. -The operand of increment and decrement operators shall be modifiable -scalar lvalues. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for constant field of a struct or union. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Dereferenced a non-pointer. -The operand of the unary * operator shall have pointer type. -3.3.3.2(39) -The operand of the unary + or - operator shall have arithmetic type. -3.3.3.3(6) -The operand of the unary ~ operator shall have integral type. -3.3.3.3(6) -The operand of the unary ! operator shall have scalar type. -3.3.3.3(6) -Constants must have arithmetic type. -3.1.3 -Bad type name for cast operator -The type name for the cast operator should either be void or a -qualified or unqualified scalar type. -3.3.4(22) -Improper cast of non-scalar type expression. -The operand for the cast operator shall be of scalar type. -3.3.4(23) -Cast a pointer into a non-integral type. -A pointer may be converted to an integral type. -3.3.4(31) -Cast a non-integral type into a pointer. -An integral type may be converted to a pointer. -3.3.4(31) -Duplicate member '%s' -Two members of a struct may not have the same name. -3.1.2.2(7,25) -Invalid constant expression. -Constant expressions shall not contain assignment, increment, decrement, -function-call, or comma operators, except when they are contained within -the operand of the sizeof operator. -3.4(9) -Constant expressions must be derived from a constant value or a constant -variable. -3.4 -Dangerous operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. This operand is NOT an lvalue, but we let it pass. -Note that a segmentation error with possible core dump will result -when the resulting address does not denote a valid (declared) -storage location. This feature will be discontinued in future -releases of the compiler! -3.3.3.2(36) -Unacceptable operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. -3.3.3.2(36) -'&' before array or function; ignored -Unacceptable operand of sizeof operator. -The sizeof operator shall not be applied to an expression that has -function type or an incomplete type, to the parenthesized name of such -a type, or to an lvalue that designates a bit-field object. -3.3.3.4 -Unacceptable operand of a multiplicative operator. -Each of the operands of a multiplicative operator shall have arithmetic type. -3.3.5(18) -Unacceptable operand of the remainder operator -Each of the operands of the remainder (%) operator shall have integral type. -3.3.5(18) -Unacceptable operand of '+'. -For the + operator, either both operands shall have arithmetic type, or -one operand shall be a pointer to an object type and the other shall -have integral type. -3.3.6(39) -Unacceptable operand of '-'. -For the subtraction operator, one of the following shall hold: both operands -have arithmetic type; operands are pointers to qualified or unqualified -versions of compatible object types; or the left operand is a pointer -to an object type and the right operand has integral type. -3.3.6(39) -Unacceptable operand of shift operator. -Each of the operands of bitwise shift operators shall have integral type. -3.3.7(9) -Unacceptable operand of relational operator. -For relational operators, one of the following shall hold: both -operands have arithmetic type; both operands are pointers to qualified -or unqualified versions of compatible object types; or both operands -are pointers to qualified or unqualified versions of compatible -incomplete types. -3.3.8(32) -Unacceptable operand of == or != -For the == or != operator, one of the following shall hold: both operands -are pointers to qualified or unqualified versions of compatible types; one -operand is a pointer to an object or incomplete type and the other is a -pointer to a qualified or unqualified version of void; or one operand is -a pointer and the other is a null pointer constant. -3.3.9(21) -Unacceptable operand of &. -Each of the operands shall have integral type. -3.3.10(7) -Unacceptable operand of ^. -Each of the operands shall have integral type. -3.3.11(18) -Unacceptable operand of |. -Each of the operands shall have integral type. -3.3.12(30) -Unacceptable operand of &&. -Each of the operands shall have scalar type. -3.3.13(7) -Unacceptable operand of ||. -Each of the operands shall have scalar type. -3.3.14(20) -Unacceptable operand of conditional operator. -The first operand of conditional operator shall have scalar type. One -of the following shall hold for the second and third operands: -both operands have arithmetic type; both operands have compatible -structure or union types; both operands have void type; both operands -are pointers to qualified or unqualified versions of compatible types; -one operand is a pointer and the other is a null pointer constant; or -one operand is pointer to an object or incomplete type and the other -is a pointer to a qualified or unqualified version of void. -3.3.15 -Duplicate label '%s' -A label name can only occur once in a function. -3.1.2.1(25) -Division by zero. -3.3.5 -Subscripting a non-array. -3.3.2.1 -Subscripting an array of incomplete type which is not an object type. -The element of the array shall have an object type. -3.3.2.1 -Should only subscript an array with an integral expression -3.3.2.1 -Subscripting an unbounded array -3.3.2.1 -Array index out of range -3.3.2.1 -Selector requires struct/union pointer as left hand side -In K&R mode the expression is implicitly converted to the '.' selector -for a struct/union left-hand side. -3.3.2.3 -Selector requires struct/union as left hand side -In K&R mode the expression is implicitly converted to the '->' selector -for a struct/union pointer left-hand side. -3.3.2.3 -member of structure or union required -3.3.2.3 -types have different qualifier specifications -For two qualified types to be compatible, both shall have the -identically qualified version of a compatible type; qualified -and unqualified versions of a type are distinct types. For two -types to be compatible their types must be the same. -3.5.3(26) -Incompatible array type due to different array size -For two array types to be compatible, both shall have compatible element -types; if both size specifiers are present, they shall have the -same value. -3.5.4.2(11) -Incompatible array type due to incompatible element type -For two array types to be compatible, both shall have compatible element -types. -3.5.4.2(11) -Incompatible pointer type assignment -The type pointed to by the left-hand side of simple assignment -statement is incompatible with the type pointed to by the right-hand side. -3.3.16.1, 3.5.4.1(21) -Incompatible base type of pointer type -K&R feature. -Type %s of %s is incompatible with type %s of %s -Incompatible types can be resolved by casting or by other means. -3.3.16.1 -illegal combination of pointer and integer -Assigning an integral expression to a pointer is a bad practice. -Type for %s is incompatible with %s -Incompatible types can be resolved by casting or by other means. -3.1.2.6 -Bad operand type for += or -= -3.3.16.2(26) -A case or default label appears outside a switch statement -A case or default label shall appear only in a switch statement. -3.6.1 -The controlling expression of the if statement is not scalar type -The controlling expression of an if statement shall have scalar type. -3.6.4.1 -The controlling expression of switch statement is not integral type -The controlling expression of an switch statement shall have integral type. -3.6.4.2(20) -The case label is not an integral constant expression -The case label shall be an integral constant expression. -3.6.4.2(22) -Duplicate case label in the same switch statement -No two of the case constant expressions in the same switch statement -shall have the same value after conversion. -3.6.4.2(22) -More than one default label in the same switch statement -There may be at most one default label in a switch statement. -3.6.4.2(23) -The controlling expression of the iteration statement is not scalar -type -The controlling expression of a iteration statement shall have scalar -type. -3.6.5.1 -label '%s' used, but not defined -The identifier in a goto statement shall name a label located -somewhere in the enclosing function. -3.6.6.1 -A continue statement shall appear only in or as a loop body -3.6.6.2 -A break statement shall appear only in or as a switch body or loop body -3.6.6.3 -A return statement with an expression should not appear -in a function '%s', whose return type is void -3.6.6.4(24) -A return statement without an expression appears in a -function '%s', whose return type is not void -If a return statement without an expression is executed, and the value -of the function call is used by the caller, the behavior is undefined. -3.6.6.4(33) -Internal Error: statement stack underflow -Long double not supported; double assumed. -Long float not standard; double assumed. -Only 'register' allowed in parameter declaration -The only storage-class specifier that shall occur in a parameter -declaration is 'register'; illegal storage class ignored. -3.5.4.3(25) -Name(s) without types in a function declaration -An old-style function declaration is not allowed to have names -in the parameter list; useless names ignored -3.5.4.3(26) -Functions cannot return functions -3.7.1(33), 3.3.2.2 -Functions cannot return a non-object type -3.3.2.2 -enum declaration must contain enum literals -Although structs or unions may delay the declaration of their members, -a similar construction with enum does not exist and is not necessary, -as there can be no mutual dependencies between the declaration of an -enumerated type and any other type. -3.5.2.3(27) -Register qualification has no effect for this type of object -Register declarations for array, struct, and function types have -no effect. -3.5.1(16), 3.5.1(19) -Functions cannot be declared 'register' -The declaration of an identifier for a function that has block -scope shall have no explicit storage-class specifier other than -'extern'. -3.5.1(19) -'%s' cannot be initialized -The type of the entity to be initialized shall be an object type -or an array of unknown size. -3.5.7(32) -Cannot initialize 'extern' variable '%s' within a function -If the declaration of an identifier has block scope, and the -identifier has 'extern' or 'static' linkage, the declaration -shall have no initializer for the identifier; initialization -allowed anyway. -3.5.7(35) -initializing an 'extern' is an ANSI C extension -conflicting declarations for '%s' -'static' and 'extern' declarations conflict. Which is meant? -3.1.2.2(15), 3.1.2.2(27) -Too many initial values for '%s' -3.5.7(1) -incompatible types in initialization -3.3.16(35) -redefinition of '%s'; previous definition at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -bit-fields as members of a union are an ANSI C invention. -storage size for '%s' isn't known -type mismatch in initialization -Missing braces in a union initialization or illegally formed -initialization. -3.5.7(5) -union '%s' only allowed one initializer for the first member -3.5.7(5) -width of '%s' exceeds its type -the specified bitfield width is too large to be contained within a -bitfield type. -structure has no member named '%s' -This is allowed for compatibility with AT&T pcc-based compilers. -Reference of an expression of void type or an incomplete type. -3.2.2.1 -element size of an array shall not be zero -3.2.2.5(25) -invalid combination of type specifiers -Although order is unimportant, not all type specifiers can occur together. -3.5.2 -declaration must at least declare an identifier, tag, or the member of an enumeration -3.5(16) -at most one storage class may be given in the declaration -Duplicate occurrence ignored. -3.5.1(10) -size of function's return type is zero -The return type of a function must be void or an object type other than array. -3.7.1(33) -Expecting an integral return type from the main function -identifier missing from parameter declaration -Prototypes for function definitions require identifiers in parameter -declarations. -3.7.1(4) -only 'register' allowed for storage class for parameters -The declarations in the declaration list shall contain no storage class -other than 'register', and no initializations. -3.7.1(10) -parameters declarations can not have initializations -3.7.1(10) -only one instance of 'void' allowed in the parameter list -'void' must occur by itself (specifying that the function has no parameters). -3.5.4.3(1) -%s must have function type -1) An argument list must be explicitly present in the declarator; it cannot - be inherited from a typedef (3.5.4.3). -2) The declarator is not a function. -3.7.1(30) -Illegal hexadecimal constant -You have no digits after the 0x or 0X. 0x0 assumed. -3.1.3.2 -value overflows its type in this context. Value is set to be '%s'! -3.2.1.4 -value is outside range representable for type '%s' -missing member name -K&R mode permits a missing member name; otherwise, only bitfields can omit -the member name. -3.5.2.1(10) -useless keyword or type name in declaration -Type was ignored. -'%s' declared within and is limited to this function prototype -Possible program error, since parameter type checking will always fail -unless the type declaration is visible to the caller. -3.1.2.1(35) -Extra spaces within operator, %s assumed -In ANSI C, the compound assignment operator cannot have embedded -white space characters. -3.1.5 -missing size for array '%s' -Incomplete types permitted for identifiers with internal or -external linkage, but not automatic linkage. -3.1.2.5(10) -can't jump into (from outside of) the body of a 'try' or into either type of handler -'%s' missing, please #include excpt.h -excpt.h required to declare exception statements, intrinsics or compiler -runtime names. -local function declarations cannot be 'static' -A function declaration can only contain the storage-class 'static' -if it is at file scope. Declaration made 'extern'. -3.5.1(19) -static function '%s' declared and referenced, but not defined. -If an identifier declared with internal linkage is used in an -expression (other than as a part of the operand of a sizeof -operator), there shall be exactly one external definition for -the identifier in the translation unit. -3.7(12) -pragma argument '%s' must be declared prior to being used in a pragma -Pragma name ignored. -Pragma not supported -'%s' not enabled as intrinsic -It may have already appeared in a function pragma, or never occurred in -an intrinsic pragma. -'%s' is already enabled as an intrinsic -weak definition for '%s' is later redefined; pragma weak ignored. -definition of primary name '%s' not found; pragma weak ignored. -definition of secondary name '%s' not found; pragma weak ignored. -primary name '%s' is declared as a common or external, and is not defined -with initial value within this file; pragma weak ignored. -useless '%s' storage class ignored -array of functions not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -array of voids not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -argument for pragma pack must be an integer constant; pragma ignored -'%s' has wrong tag type. -Identifier redeclared in the same scope/block. -3.1.2.3 -missing dimension bound -For multidimensional arrays, the constant bounds of the array may be -omitted only for the first member of the sequence. -3.1.2.5(23) -Internal error in parameters to function substr; loc: '%s'; len: '%s'. -Internal error in parameters to function insertstr; indx: '%s'. -Internal error in function get_tag_name; input is a non-tagged type. -Internal error in function gen_type_str -- not a type tree '%s' -Cannot open file '%s' -Prototype should be moved after tag or a typedef declaration. -Please look for comments in the extracted header file. -The extracted header file includes prototypes for static functions, -which should be removed, if you wish to include the header in a source file -other than the originator. -ANSI C requires formal parameter before "..." -This extension is meant to be used for compatibility with varargs.h -3.5.4.3(35) -syntax error: "&..." invalid -extension used to access "..." formal arguments. -function '%s' initialized like a variable -The type of entity to be initialized shall be an object type or an -array of unknown size. -3.5.7(31) -initializer not an array aggregate -The initializer for an object that has aggregate type shall be a -brace-enclosed list of initializers for the members of the aggregate, -written in increasing subscript or member order. -3.5.7(20) -'%s' type is incomplete; cannot initialize -Was the struct ever defined? -3.5.7.(31) -'%s' is not standard ANSI. -This keyword/type is not defined in strict ANSI mode. -3.1.1 -not a legal asm string -The first operand of an asm string should be, after argument substitution, -a legal assembly string. -The -float option will be ignored in ANSI mode. -The -float option is ignored, since otherwise program semantics would -violate the ANSI standard. In particular, fp constants are always -'double' with ANSI-C, while with -float the type of fp constants will -depend on the context and may be 'float'. -ANSI C support unavailable with C compiler bundled with RISC/os -The C compiler bundled with RISC/os does not support ANSI C. ANSI -C support requires a separate license. -Ignored invalid warning number(s) in -woff option, %s%s ! -Warning numbers must be in the range %s to %s. -The set of warning numbers in cfe is disjoint from the set of warning numbers -in accom, since accom warnings cannot be mapped one-to-one to cfe warnings. -'%s' not handled as an intrinsic due to incompatible argument types . -'__unalign' only qualifies pointers -'__unalign' indicates the object pointed at by pointer is unaligned (e.g., -int * __unalign p). This is an extension to ANSI C and like 'volatile' -and 'const' can follow the '*' in pointer declarations, but unlike both -cannot qualify a base type. -index expression is an anachronism -ANSI C++ doesn't support array index expressions in delete. -5.3.4 -member cannot be of function or incomplete type. -3.5.2.1(12) -Illegal lint option, '%s', is ignored. -cannot open header message buffer file -cannot write header message buffer file -cannot read header message buffer file -cannot seek in header message buffer file -struct/union/enum '%s' is used, but not defined -static '%s' unused -nonportable character comparison (chars may be signed or unsigned) -redundant comparison of unsigned with constant expression -redundant statement, control flow cannot reach this statement -'%s' may be used before set -function parameter '%s' is not used in function '%s' -'%s' can be const qualified, since it is not set within its lifetime. -'%s' is not used in function '%s' -'%s' set but unused in function '%s' -control may fall through %s statement -function '%s' has return(e); and return; -function '%s' may return random value to place of invocation %s -label without goto: '%s' -only %s bits of '%s' constant (type '%s') are explicitly given -explicit conversion from '%s' to '%s' %s -implicit conversion from '%s' to '%s' %s -'%s' may be indistinguishable from '%s' due to internal name truncation -Promoted formal parameter and promoted argument have incompatible types -No prototype for the definition of '%s' %s -References to '%s' are substituted by its literal initializer - (as included in %s) -============== -unsupported language linkage -string-literal specifies an unsupported linkage -7.4(1) -No prototype for the call to %s -To achieve better type-checking, there should be a full prototype for -the function being called. -3.5.4.3 -'inline' only applies to function declarations -leave statment can occur only within try body -Microsoft extension -Use of a Microsoft extension detected without usage of the -compiler option -msft. -No parameter mentioned -A file with no declarations or definitions is accepted as an extension to ANSI C -The translation unit must contain at least one external definition. -3.7 -Incompatible signed and unsigned version of a type -Yacc initialization error -Internal error: yacc cannot initialize itself. -The cfe option %s may not be in future releases. We suggest that you not use this option! -Incompatible char and unsigned char versions of a type -Lshift with undefined behaviour. -Lshift with a negative right operand, or a right operand that is greater -than or equal to the width in bits of the promoted left operand, results -in undefined behaviour. -3.3.7(11) -useless type name in declaration, possibly a semicolon is missing. -Type was ignored. -constant initializer expression is invalid (refers to automatic variables). -All the expressions in an initializer for an object that has static storage -duration or in the initializer list for an object that has aggregate or -union type shall be constant expressions. Otherwise, unexpected results -may occur. -3.5.7(32) and 3.4 -invalid explicit or implicit conversion of an address constant to an integral value in a constant initializing expression. -An address constant in a constant initializing expression can neither -initialize a bit-field nor be directly or indirectly converted to an -integral type of size different from an address type. -6.4 diff --git a/tools/ido7.1_compiler/usr/lib/libc.so.1 b/tools/ido7.1_compiler/usr/lib/libc.so.1 deleted file mode 100755 index 895c545a9..000000000 Binary files a/tools/ido7.1_compiler/usr/lib/libc.so.1 and /dev/null differ diff --git a/tools/ido7.1_compiler/usr/lib/libexc.so b/tools/ido7.1_compiler/usr/lib/libexc.so deleted file mode 100755 index bacd3b371..000000000 Binary files a/tools/ido7.1_compiler/usr/lib/libexc.so and /dev/null differ diff --git a/tools/ido7.1_compiler/usr/lib/libm.so b/tools/ido7.1_compiler/usr/lib/libm.so deleted file mode 100755 index 99632ebf6..000000000 Binary files a/tools/ido7.1_compiler/usr/lib/libm.so and /dev/null differ diff --git a/tools/ido7.1_compiler/usr/lib/ugen b/tools/ido7.1_compiler/usr/lib/ugen deleted file mode 100755 index cb3ce289a..000000000 Binary files a/tools/ido7.1_compiler/usr/lib/ugen and /dev/null differ diff --git a/tools/ido7.1_compiler/usr/lib/umerge b/tools/ido7.1_compiler/usr/lib/umerge deleted file mode 100755 index 8cb8c663e..000000000 Binary files a/tools/ido7.1_compiler/usr/lib/umerge and /dev/null differ diff --git a/tools/ido7.1_compiler/usr/lib/uopt b/tools/ido7.1_compiler/usr/lib/uopt deleted file mode 100755 index ee8f344a5..000000000 Binary files a/tools/ido7.1_compiler/usr/lib/uopt and /dev/null differ diff --git a/tools/ido_block_numbers.py b/tools/ido_block_numbers.py new file mode 100755 index 000000000..8858481dc --- /dev/null +++ b/tools/ido_block_numbers.py @@ -0,0 +1,302 @@ +#!/usr/bin/env python3 + +# SPDX-FileCopyrightText: © 2024 ZeldaRET +# SPDX-License-Identifier: CC0-1.0 + +# IDO symbol table parser for BSS ordering debugging. The compiler will assign +# "block numbers" or "dense numbers" to symbols in order as it encounters them +# in the source file, and the BSS section is sorted by this block number mod 256. +# This script dumps the compiler-generated symbol table so you can see which +# block numbers are assigned to each symbol. +# +# Resources: +# https://hackmd.io/@Roman971/BJ2DOyhBa +# https://github.com/decompals/ultralib/blob/main/tools/mdebug.py +# https://www.cs.unibo.it/~solmi/teaching/arch_2002-2003/AssemblyLanguageProgDoc.pdf +# https://github.com/decompals/IDO/blob/main/IDO_7.1/dist/compiler_eoe/usr/include/sym.h + +import argparse +import itertools +from pathlib import Path +import platform +import struct +import subprocess +import sys + + +class Header: + SIZE = 0x60 + + def __init__(self, data): + ( + self.magic, + self.vstamp, + self.ilineMax, + self.cbLine, + self.cbLineOffset, + self.idnMax, + self.cbDnOffset, + self.ipdMax, + self.cbPdOffset, + self.isymMax, + self.cbSymOffset, + self.ioptMax, + self.cbOptOffset, + self.iauxMax, + self.cbAuxOffset, + self.issMax, + self.cbSsOffset, + self.issExtMax, + self.cbSsExtOffset, + self.ifdMax, + self.cbFdOffset, + self.crfd, + self.cbRfdOffset, + self.iextMax, + self.cbExtOffset, + ) = struct.unpack(">2H23I", data) + + +class FileDescriptor: + SIZE = 0x48 + + def __init__(self, data): + ( + self.adr, + self.rss, + self.issBase, + self.cbSs, + self.isymBase, + self.csym, + self.ilineBase, + self.cline, + self.ioptBase, + self.copt, + self.ipdFirst, + self.cpd, + self.iauxBase, + self.caux, + self.rfdBase, + self.crfd, + self.flags, + self.cbLineOffset, + self.cbLine, + ) = struct.unpack(">10I2H7I", data) + + +class Symbol: + SIZE = 0xC + + def __init__(self, data): + ( + self.iss, + self.value, + self.flags, + ) = struct.unpack(">3I", data) + + def symbol_type(self): + symbol_types = { + 0: "nil", + 1: "global", + 2: "static", + 3: "param", + 4: "local", + 5: "label", + 6: "proc", + 7: "block", + 8: "end", + 9: "member", + 10: "typedef", + 11: "file", + 14: "staticproc", + 15: "constant", + 26: "struct", + 27: "union", + 28: "enum", + 34: "indirect", + } + return symbol_types[self.flags >> 26] + + def symbol_storage_class(self): + symbol_storage_classes = { + 0: "nil", + 1: "text", + 2: "data", + 3: "bss", + 4: "register", + 5: "abs", + 6: "undefined", + 8: "bits", + 9: "dbx", + 10: "regimage", + 11: "info", + } + return symbol_storage_classes[(self.flags >> 21) & 0x1F] + + +class ExternalSymbol: + SIZE = 0x10 + + def __init__(self, data): + ( + self.flags, + self.ifd, + ) = struct.unpack(">2H", data[0:4]) + self.asym = Symbol(data[4:]) + + +def read_entry(data, base, offset, size): + start = base + offset * size + return data[start : start + size] + + +def read_string(data, start): + size = 0 + while data[start + size] != 0: + size += 1 + return data[start : start + size].decode("ascii") + + +def print_symbol_table(data): + header = Header(data[0 : Header.SIZE]) + + print(f"block [mod 256]: linkage type class name") + + # File descriptors + fds = [] + for i in range(header.ifdMax): + fds.append( + FileDescriptor(read_entry(data, header.cbFdOffset, i, FileDescriptor.SIZE)) + ) + + # Symbol identifiers ("dense numbers") + for i in range(header.idnMax): + ifd, isym = struct.unpack(">II", read_entry(data, header.cbDnOffset, i, 8)) + + if isym == 0xFFFFF: + # TODO: is this always a string? + extern = False + sym_name = "" + st = "string" + sc = "" + else: + extern = ifd == 0x7FFFFFFF + if extern: + ext = ExternalSymbol( + read_entry(data, header.cbExtOffset, isym, ExternalSymbol.SIZE) + ) + sym = ext.asym + sym_name = read_string(data, header.cbSsExtOffset + sym.iss) + else: + fd = fds[ifd] + sym = Symbol( + read_entry( + data, header.cbSymOffset, fd.isymBase + isym, Symbol.SIZE + ) + ) + sym_name = read_string(data, header.cbSsOffset + fd.issBase + sym.iss) + st = sym.symbol_type() + sc = sym.symbol_storage_class() + + print( + f'{i:>9} [{i%256:>3}]: {"extern" if extern else "":<7} {st:<10} {sc:<9} {sym_name:<40}' + ) + + +def find_compiler_command_line(filename, oot_version): + is_macos = platform.system() == "Darwin" + make = "gmake" if is_macos else "make" + make_command_line = [ + make, + "--always-make", + "--dry-run", + f"VERSION={oot_version}", + ] + + print(f"Running {make} to find compiler command line ...", file=sys.stderr) + make_output = ( + subprocess.check_output(make_command_line).decode("utf-8").splitlines() + ) + + found = 0 + for line in make_output: + parts = line.split() + if "-o" in parts and str(filename) in parts: + makefile_command_line = parts + found += 1 + + if found != 1: + print( + f"Could not determine compiler command line for {filename}", file=sys.stderr + ) + sys.exit(1) + + # Assume command line is of the form: + # tools/reencode.sh [COMPILER] [COMPILER_ARGS] + compiler_command_line = makefile_command_line[1:] + + print(f'Command line: {" ".join(compiler_command_line)}', file=sys.stderr) + return compiler_command_line + + +def generate_symbol_table(command_line): + # Find source file in compiler arguments + source_file = None + args = [] + for arg in command_line: + if arg.endswith(".c"): + source_file = Path(arg) + else: + args.append(arg) + + if source_file is None: + raise Exception("No source file found") + + source_contents = source_file.read_text() + + stem = "reencode_tmp" + input_file = Path(f"{stem}.c") + symbol_table_file = Path(f"{stem}.T") + ucode_file = Path(f"{stem}.B") + + try: + # Write temporary file with #line directive to simulate asm-processor + with open(input_file, "w") as f: + f.write('#line 1 "{}"\n'.format(source_file)) + f.write(source_contents) + + # Invoke compiler + # -Hf stops compilation after cfe so we can inspect the symbol table + subprocess.run(args + ["-Hf", input_file], check=True) + + # Read symbol table + return symbol_table_file.read_bytes() + finally: + # Cleanup + input_file.unlink(missing_ok=True) + symbol_table_file.unlink(missing_ok=True) + ucode_file.unlink(missing_ok=True) + + +def main(): + parser = argparse.ArgumentParser( + description="Dump IDO symbol table for debugging BSS ordering" + ) + parser.add_argument("filename", metavar="FILE", type=Path, help="C source file") + parser.add_argument( + "-v", + "--oot-version", + type=str, + default="gc-eu-mq-dbg", + help="OOT version (default: gc-eu-mq-dbg)", + ) + + args = parser.parse_args() + + command_line = find_compiler_command_line(args.filename, args.oot_version) + data = generate_symbol_table(command_line) + print_symbol_table(data) + + +if __name__ == "__main__": + main() diff --git a/tools/ido_recomp/linux/5.3/as0 b/tools/ido_recomp/linux/5.3/as0 deleted file mode 100755 index cdac712e5..000000000 Binary files a/tools/ido_recomp/linux/5.3/as0 and /dev/null differ diff --git a/tools/ido_recomp/linux/5.3/as1 b/tools/ido_recomp/linux/5.3/as1 deleted file mode 100755 index f89911f80..000000000 Binary files a/tools/ido_recomp/linux/5.3/as1 and /dev/null differ diff --git a/tools/ido_recomp/linux/5.3/cc b/tools/ido_recomp/linux/5.3/cc deleted file mode 100755 index be5bed557..000000000 Binary files a/tools/ido_recomp/linux/5.3/cc and /dev/null differ diff --git a/tools/ido_recomp/linux/5.3/cfe b/tools/ido_recomp/linux/5.3/cfe deleted file mode 100755 index c257f65a6..000000000 Binary files a/tools/ido_recomp/linux/5.3/cfe and /dev/null differ diff --git a/tools/ido_recomp/linux/5.3/err.english.cc b/tools/ido_recomp/linux/5.3/err.english.cc deleted file mode 100644 index 6976e38a9..000000000 --- a/tools/ido_recomp/linux/5.3/err.english.cc +++ /dev/null @@ -1,1260 +0,0 @@ -@ - 358 358 358 - 6464 6482 6553 - 6553 6593 6728 - 6728 6746 6803 - 6803 6808 6808 - 6808 6818 6818 - 6818 6826 6826 - 6826 6847 6847 - 6847 6875 6922 - 6922 6930 6930 - 6930 6939 6939 - 6939 6948 6948 - 6948 6974 7120 - 7120 7149 7204 - 7210 7248 7311 - 7317 7350 7442 - 7450 7497 7627 - 7635 7709 7930 - 7938 7975 8063 - 8071 8113 8253 - 8261 8289 8289 - 8298 8338 8445 - 8460 8502 8635 - 8650 8690 8819 - 8834 8857 8965 - 8965 9008 9113 - 9119 9142 9227 - 9235 9282 9451 - 9451 9462 9462 - 9462 9477 9477 - 9477 9497 9497 - 9497 9545 9545 - 9545 9584 9584 - 9584 9604 9662 - 9662 9682 9720 - 9720 9749 9749 - 9749 9788 9788 - 9788 9802 9802 - 9802 9829 9829 - 9829 9861 9861 - 9861 9904 9904 - 9904 9920 9920 - 9920 9962 9962 - 9962 9988 9988 - 9988 10014 10014 -10014 10035 10035 -10035 10054 10097 -10097 10115 10115 -10115 10147 10147 -10147 10183 10183 -10183 10208 10208 -10208 10236 10236 -10236 10269 10269 -10269 10304 10304 -10304 10328 10328 -10328 10351 10351 -10351 10371 10371 -10371 10402 10402 -10402 10447 10447 -10447 10497 10497 -10497 10533 10533 -10533 10598 10598 -10606 10630 10630 -10640 10671 10671 -10690 10719 10719 -10728 10752 10795 -10795 10837 10837 -10837 10876 10876 -10876 10900 10900 -10900 10948 10948 -10960 11021 11103 -11103 11128 11128 -11128 11153 11153 -11153 11216 11216 -11216 11239 11239 -11239 11303 11303 -11303 11347 11347 -11357 11393 11393 -11393 11432 11432 -11442 11494 11494 -11494 11536 11536 -11536 11595 11595 -11595 11622 11622 -11622 11684 11684 -11684 11726 11726 -11738 11778 11778 -11782 11813 11813 -11813 11850 11850 -11850 11900 12087 -12111 12120 12120 -12120 12129 12129 -12129 12158 12158 -12158 12192 12192 -12192 12237 12237 -12237 12273 12273 -12273 12326 12326 -12330 12366 12366 -12366 12423 12423 -12427 12482 12482 -12486 12560 12560 -12568 12631 12631 -12637 12691 12691 -12691 12743 12743 -12743 12785 12785 -12785 12826 12826 -12826 12865 12865 -12865 12883 12883 -12883 12946 12946 -12956 12995 12995 -13005 13066 13066 -13077 13163 13163 -13163 13211 13211 -13211 13270 13270 -13270 13318 13318 -13318 13350 13350 -13350 13387 13387 -13387 13428 13428 -13428 13464 13533 -13533 13580 13737 -13737 13776 13854 -13854 13913 13913 -13913 13950 13950 -13950 14118 14118 -14118 14150 14150 -14150 14163 14194 -14194 14224 14255 -14255 14275 14319 -14319 14353 14458 -14466 14484 14530 -14534 14567 14567 -14567 14635 14682 -14690 14742 14742 -14742 14789 14789 -14801 14875 14875 -14886 14947 14947 -14947 14992 14992 -14992 15035 15085 -15085 15134 15205 -15214 15267 15448 -15454 15496 16810 -16822 16875 16960 -16972 17053 17179 -17191 17236 17332 -17344 17491 17841 -17853 17939 18304 -18316 18471 18774 -18786 18952 19323 -19335 19364 19496 -19500 19527 19598 -19598 19613 19776 -19797 19808 19837 -19837 19862 19862 -19868 19927 20026 -20034 20075 20179 -20187 20223 20223 -20223 20290 20382 -20392 20441 20589 -20601 20656 20656 -20656 20699 20818 -20826 20860 21038 -21046 21094 21191 -21203 21236 21314 -21326 21395 21457 -21469 21502 21502 -21502 21587 21731 -21756 21789 21864 -21875 21901 21976 -22013 22059 22220 -22257 22397 22561 -22561 22595 22595 -22603 22623 22623 -22631 22667 22828 -22865 22919 22994 -23031 23059 23120 -23132 23201 23201 -23212 23274 23274 -23285 23345 23345 -23356 23393 23393 -23399 23431 23532 -23542 23587 23646 -23656 23697 23745 -23755 23796 23844 -23854 23876 23928 -23942 23971 24153 -24160 24243 24243 -24247 24273 24743 -24755 24784 24984 -24996 25034 25034 -25034 25075 25273 -25281 25332 25410 -25420 25467 25544 -25554 25583 25744 -25754 25783 26061 -26071 26111 26185 -26194 26239 26525 -26535 26568 26914 -26924 26951 26998 -27008 27035 27082 -27093 27120 27167 -27178 27206 27251 -27261 27289 27334 -27345 27391 27931 -27938 27959 28007 -28019 28037 28037 -28043 28069 28069 -28077 28147 28199 -28207 28266 28266 -28274 28306 28306 -28314 28339 28339 -28347 28404 28510 -28518 28567 28682 -28690 28728 28728 -28736 28782 29023 -29033 29085 29234 -29246 29303 29383 -29395 29432 29570 -29592 29631 29644 -29644 29693 29758 -29767 29810 29875 -29875 29911 29976 -29984 30014 30014 -30027 30086 30151 -30157 30223 30293 -30301 30369 30445 -30457 30511 30568 -30580 30630 30743 -30755 30812 30874 -30886 30959 31035 -31043 31076 31175 -31183 31243 31243 -31251 31323 31323 -31331 31433 31433 -31445 31544 31686 -31698 31740 31740 -31740 31783 31783 -31783 31824 31824 -31824 31873 31996 -32008 32056 32164 -32176 32210 32210 -32229 32271 32271 -32279 32323 32569 -32581 32642 32718 -32739 32779 32916 -32926 32953 33047 -33057 33116 33315 -33325 33373 33373 -33373 33407 33469 -33494 33527 33527 -33536 33573 33573 -33584 33650 33697 -33705 33763 33763 -33763 33797 33797 -33797 33829 33906 -33915 33976 33976 -33985 34016 34098 -34098 34133 34198 -34198 34261 34261 -34269 34312 34312 -34324 34363 34438 -34444 34530 34530 -34538 34596 34626 -34636 34675 34754 -34764 34821 34821 -34821 34867 34950 -34959 35016 35135 -35145 35198 35198 -35208 35266 35344 -35355 35382 35537 -35547 35576 35629 -35637 35705 35705 -35713 35764 35764 -35764 35784 35876 -35888 35932 35950 -35950 36013 36138 -36150 36191 36280 -36286 36314 36419 -36431 36516 36516 -36516 36554 36642 -36642 36689 36808 -36818 36881 37105 -37113 37183 37204 -37204 37225 37225 -37225 37255 37348 -37348 37388 37388 -37388 37454 37454 -37454 37518 37518 -37518 37584 37584 -37584 37717 37717 -37717 37752 37752 -37752 37783 37889 -37901 37928 38034 -38046 38115 38115 -38115 38140 38187 -38195 38219 38339 -38351 38422 38422 -38422 38486 38486 -38486 38555 38555 -38555 38619 38619 -38619 38641 38641 -38641 38758 38758 -38758 38929 38929 -38929 38975 39043 -39055 39084 39133 -39133 39175 39265 -39275 39310 39494 -39504 39547 39576 -39587 39614 39668 -39674 39697 39797 -39797 39845 40094 -40094 40158 40264 -40264 40369 40523 -40523 40593 40593 -40593 40629 40876 -40876 40911 40971 -40977 41026 41026 -41038 41077 41077 -41077 41116 41116 -41116 41156 41156 -41156 41195 41195 -41195 41237 41237 -41237 41285 41285 -41285 41304 41304 -41304 41371 41371 -41371 41429 41429 -41429 41491 41491 -41491 41519 41519 -41519 41572 41572 -41572 41642 41642 -41642 41676 41676 -41676 41713 41713 -41713 41751 41751 -41751 41792 41792 -41792 41856 41856 -41856 41881 41881 -41881 41936 41936 -41936 41977 41977 -41977 42018 42018 -42018 42090 42090 -42090 42162 42162 -42162 42205 42205 -42205 42267 42267 -42267 42294 42294 -42294 42309 42309 -42309 42338 42386 -42393 42425 42522 -42530 42577 42577 -42577 42623 42623 -42623 42643 42725 -42725 42748 42748 -42748 42829 42897 -42901 42952 42952 -42952 42978 43025 -43025 43116 43116 -43116 43171 43171 -43171 43204 43376 -43386 43453 43471 -43471 43547 43780 -43798 43921 44116 -44120 44120 44120 -Out of memory: %s -There is no more memory left in the system for compiling this program. -Internal Error Unknown Error Message %s -1) An internal error, while attempting to print an unavailable message -2) The error message file is inaccessible or has other problems -Unknown Signal %s -1) An unknown signal has been caught -2) 2 Nested signals -line -Warning: -Fatal: -Source not available -Too many errors... goodbye. -There is a limit of 30 errors before aborting. -Error: -reserved -reserved -Unknown Control Statement -1) The line begins with a '#' and is not of the form: - # "" -2) Please compile this program with the preprocessor enabled. -Unknown character %s ignored -The character is not part of the source character set. -2.2.1 -Unknown control character \%s ignored -The control character is not part of the source character set. -2.2.1 -Illegal character %s in exponent -1) Digits or sign expected after 'e' or 'E'. -2) Digits are expected after sign in exponent. -3.1.3.1 -Constant is out of range and may be truncated. -The constant is too large to be accurately represented and may be -truncated. The limits are in the system include file limits.h. -2.2.4.2 -Constant is out of range for a 32-bit data type, but accepted as written. -The constant is too large to fit in a 32-bit data type, but will be -accurately represented in a wider data type. The value may be truncated, -depending on its context. The limits are in the system include file -limits.h. -2.2.4.2 -Character constant size out of range -1) No characters in a character constant. -2) More than 4 bytes in a character constant. -3.1.3.4 -Wide character constant size out of range -1) No characters in the multibyte sequence (0 assumed). -2) More than 1 byte in the multi-byte sequence (only the first byte was converted). -3.1.3.4 -Invalid multibyte character -4.10.7.2 -Newline in string or character constant -1) Terminate your string or character constant with closing quotes. -2) Put a backslash before the newline. -3.1.3.4, 3.1.4 -Octal character escape too large: %s > %s -1) Terminate end of octal sequence with a non-octal character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Hex character escape too large: %s > %s -1) Terminate end of hex sequence with a non-hex character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Unexpected End-of-file -1) Unterminated string or character constant -2) Missing closing comment marker (*/) -3) File system problems -Unrecognized escape sequence in string \%s -Recognized escape sequences are \a, \b, \f, \n, \r, \t, and \v. -Character will be treated as un-escaped. -3.9.2 -Illegal octal digit %s -Octal constants, beginning with 0, must only have digits between 0 and 7, -inclusive. -3.1.3.2 -Unable to open temporary file for compiling %s -1) TMPDIR environment variable is set to a directory that you have no - permissions for. -2) The file system is full. -3) System errors beyond the scope of the compiler. -%s: Hangup -%s: Interrupt -%s: Quit (ASCII FS) -%s: Illegal instruction (not reset when caught) -%s: Trace trap (not reset when caught) -%s: IOT instruction -Also SIGABRT, used by abort, replace SIGIOT in the future -%s: EMT instruction -Also SIGXCPU, Exceeded CPU time limit -%s: Floating point exception -%s: Kill (cannot be caught or ignored) -%s: Bus error -%s: Segmentation violation -%s: Bad argument to system call -%s: Write on a pipe with no one to read it -%s: Alarm clock -%s: Software termination signal from kill -%s: User defined signal 1 -%s: User defined signal 2 -%s: Death of a child -Power-fail restart -%s: Also SIGXFSZ, exceeded file size limit -%s: Window change -%s: Handset, line status change -%s: Sendablestop signalnot from tty -%s: Stop signal from tty -%s: Pollable event occurred -%s: Input/Output possible signal -%s: Urgent condition on IO channel -%s: Window size changes -%s: Virtual time alarm -%s: Profiling alarm -%s: Continue a stopped process -%s: To readers pgrp upon background tty read -%s: Like TTIN for output if (tp->t_local<OSTOP) -%s: Resource lost (eg, record-lock) -'auto' and 'register' are not allowed in an external declaration -3.7(10) -must have function type -3.7.1(30) -Functions cannot return arrays -3.7.1(33), 3.3.2.2 -Declaration list not allowed -3.7.1(5) -Too many input files %s -The command line may contain only one file -cpp internal error: input stack underflow -cpp internal error: if stack underflow -Cannot open the file %s -No new-line character at the end of the file %s -2.1.1.2(30) -Fatal: Exceeded the limit of nesting level for #include file -Fatal: Exceeded the limit of nesting level for #include file. This limit -is 200. -Fail to read the file %s -Cannot write the file %s -%s: %s: An if directive is not terminated properly in the file -%s: %s: nested comment -%s:%s: Illegal macro name %s; macro name shall be an identifier -%s:%s: Illegal preprocessing token sequence -3.8.3(35) -%s:%s: Illegal macro parameter name -%s:%s: Non-unique macro parameter name -3.8.3(18) -%s:%s: Missing ')' in parameter list for #define %s -%s:%s: Missing ')' in macro instantiation -%s:%s: Bad punctuator in the parameter list for #define %s -%s:%s: Macro %s redefined. -%s:%s: # operator should be followed by a macro argument name -%s:%s: Badly formed constant expression%s -3.4(9), 3.8 -%s:%s: Division by zero in #if or #elif -3.8 -unknown command line option %s -extraneous input/output file name %s -%s: %s: Unterminated string or character constant -A preprocessing string or character constant token was not -terminated. Note that preprocessing directives are processed -after the source file has been divided into preprocessing tokens. -2.1.1.2(30) 3.1(18) 3.8 -%s: %s: -%s: %s: -%s: %s: Unterminated comment -%s: %s: Unknown directive type %s -%s: %s: #elif or #else after #else directive -%s: %s: Bad identifier after the %s -%s: %s: #%s accepts only one identifier as parameter -3.8 -%s: %s: Bad identifier after the %s -%s: %s: text following #%s violates the ANSI C standard. -3.8 -%s: %s: Bad character %s occurs after the # directive. -3.8 -%s: %s: the ## operator shall not be the %s token in the replacement list -3.8.3.3 -%s: %s: the defined operator takes identifier as operand only. -3.8.1 -%s: %s: Not in a conditional directive while using %s -%s: %s: Illegal filename specification for #include -%s: %s: Invalid file name %s for #include -%s: %s: Cannot open file %s for #include -%s: %s: Bad argument for #line command -%s: %s: #error %s -%s: %s: Tried to redefine predefined macro %s, attempt ignored -3.8.7(22) -%s: %s: Undefining predefined macro %s -3.8.7(22) -%s: %s: Undefined the ANSI standard library defined macro %s -4.1.2.1(9) -%s: %s: The number of arguments in the macro invocation does not match the definition -%s: %s: Illegal character %s in preprocessor if -%s: %s: Illegal character %s for number in preprocessor if -%s: %s: No string is allowed in preprocessor if -%s: %s: Not supported pragma %s -%s: %s: Not supported #pragma format -%s: %s: ANSI C does not allow #ident; %s -%s: %s: Not supported #ident format -This cpp extension accepts the following format: -#ident "any string" -%s: %s: Not supported #assert/#unassert format -This cpp extension accepts the following format: -#assert identifier -#assert identifier ( pp-tokens ) -#unassert identifier -#unassert identifier ( pp-tokens ) -%s: %s: Bad assertion predicate format -The correct syntax for this cpp extension is: -#assert identifier ( pp-token ) -%s: %s: directive is an upward-compatible ANSI C extension -%s: This option requires an argument -%s: %s: A macro has expanded recursively more than %s times. Further expansion will be disabled! Use command-line option: -Wp,-max_rec_depth=depth to recurse deeper. -A status return from cpp to cfe -Syntax Error -The token read was unexpected. -Syntax Error -- cannot backup -The token read was unexpected. -Yacc stack overflow -The expression is too complicated to parse. -Trailing comma in enumerator list -The use of a trailing comma in an enumerator list is not standard C. There -may be portability problems. -3.5.2.2 -Empty declaration -Empty declarations are invalid in standard C. -3.5 -%s declared, but not referenced. -redeclaration of '%s'; previous declaration at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -'%s' undefined; reoccurrences will not be reported. -Non-function name referenced in function call. -3.3.2.2(18) -The number of arguments doesn't agree with the number in the declaration. -3.3.2.2(5) -'%s' section name longer than 8 characters. Name truncated. -'%s' is already placed by pragma alloc_text. -Cannot write ucode file while compiling %s -1) The file system is full -2) Permissions problem -Must have corresponding formal argument for '%s' -Parameter found in the declaration part, but not in the argument list. -3.7.1(7) -Non-prototype declaration is an obsolescent feature. -The use of function definitions with separate parameter identifier -and declaration lists (not prototype-format parameter type and -identifier declarators) is an obsolescent feature. -3.9.5 -Incompatible function declarations for %s -For two function types to be compatible, both shall specify compatible -return types. Moreover, the parameter type lists, if both are present, -shall agree in the number of parameters and in use of the ellipsis -terminator; corresponding parameters shall have compatible types. If -one type has a parameter type list and the other type is specified by -a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. If one type has a parameter type list and the -other is specified by a function definition that contains a (possibly -empty) identifier list, both shall agree in the number of parameters, -and the type of each prototype parameter shall be compatible with the -type that results from application of the default argument promotions -to the type of the corresponding identifier. (For each parameter -declared with function or array type, its type for these comparisons -is the one that results from conversion to a pointer type. For each -parameter declared with qualified type, its type for these comparisons -is the unqualified version of its declared type.) There you have it! -3.5.4.3(15) -Incompatible function return type for this function. -For two function types to be compatible, both shall specify compatible -return types. -3.5.4.3(15) -The number of parameters for function is different from the previous declaration -The parameter type lists, if both are present, shall agree in the -number of parameters and in use of the ellipsis terminator. -3.5.4.3(15) -Incompatible type for the function parameter -If both parameter type lists are present, corresponding -parameters shall have compatible types. -3.5.4.3(15) -Function %s is redeclared with an incompatible argument type (after default argument promotion), which could lead to undefined run-time behaviour. -The redeclaration could cause arguments at a call site to be passed -inconsistently with what the function implementation expects, and -parameters would therefore be accessed erroneously when executing the -function body. Note that a float argument is promoted to a double -when passed (potentially through fp registers) to an unprototyped -function. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, ellipsis terminator not allowed -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the type of each parameter shall be -compatible with the type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype declaration and non-prototype definition found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other is specified by a -function definition that contains a (possibly empty) identifier list, -both shall agree in the number of parameters, and the type of each -prototype parameter shall be compatible with the type that results -from application of the default argument promotions to the type of the -corresponding identifier. -3.5.4.3(15) -Empty declaration specifiers -Standard C requires at least a storage class specifier, type specifier, -or a type qualifier in declarations. 'extern int' assumed. -3.5 -Can't write to the file %s -1) The output file cannot be opened for writing. -2) Out of file space. -Duplicate '%s' -typedef, extern, static, auto, register, const, volatile may not -appear more than once in the same specifier list or qualifier list. -Duplicate occurrence ignored. -3.5.1(10) , 3.5.3(5) -Null input -There is nothing to compile. -Illegal type combination -3.5.2 -Missing ';' at end of structure / union member declaration -In standard C, each member declaration must be terminated by a ';'. A -terminating ';' is assumed. -3.5.2.1 -Missing member name in structure / union -In standard C, each member declaration have a member name. The missing -member is assumed to not exist. -3.5.2.1 -This variable is initialized twice. -Neither 'const' or 'volatile' have any effect on function results. -Qualifiers only apply to expressions designating an object that -can be altered or examined. -3.5.3(10) -An integer constant expression is required here. -The expression that defines the value of an enumeration constant -shall be an integral constant expression that has a value -representable as an int. -3.5.2.2(28) -(previous declaration of '%s' at line %s in file '%s') -Must be an integer type greater than zero. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -Array size cannot be a long long. -Arrays with more than 2^32 elements are not yet supported. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -bit-field '%s' width is not an integer constant -The expression that specifies the width of a bit-field shall be an -integral constant expression. -3.5.2.1(15) -bit-field '%s' width is negative -The expression that specifies the width of a bit-field shall be -non-negative. -3.5.2.1(15) -bit-field '%s' type required to be int, unsigned int, or signed int. -A bit-field shall have type int, unsigned int, or signed int. -3.5.2.1(30) -bit-field %s's type not integer. -Non-scalar type or pointer type to a non-object for increment or decrement operator. -The operand of the prefix/postfix increment or decrement operator shall have scalar type; if it is of pointer type, it must point to an object. -3.3.2.4(37), 3.3.3.1(25) -Assign value to a function type. -An assignment operator shall have a modifiable lvalue as its left operand. -3.2.2.1(5) -Assign value to an array. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for variable of incomplete type. -The operand of increment and decrement operator shall be a modifiable -scalar lvalue. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -The left-hand side of the '.' operator must be an addressable lvalue, when a bit-field is not contained within a unit of 32 bits alignment. -This is a restriction in our implementation, which can be worked -around by always accessing long long bit-fields indirectly (i.e. -by means of the '->' operator). -This expression is not an lvalue. -3.2.2.1 -Modified an rvalue. -3.2.2.1 -Change value for constant variable. -The operand of increment and decrement operators shall be modifiable -scalar lvalues. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for constant field of a struct or union. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Dereferenced a non-pointer. -The operand of the unary * operator shall have pointer type. -3.3.3.2(39) -The operand of the unary + or - operator shall have arithmetic type. -3.3.3.3(6) -The operand of the unary ~ operator shall have integral type. -3.3.3.3(6) -The operand of the unary ! operator shall have scalar type. -3.3.3.3(6) -Constants must have arithmetic type. -3.1.3 -Bad type name for cast operator -The type name for the cast operator should either be void or a -qualified or unqualified scalar type. -3.3.4(22) -Improper cast of non-scalar type expression. -The operand for the cast operator shall be of scalar type. -3.3.4(23) -Cast a pointer into a non-integral type. -A pointer may be converted to an integral type. -3.3.4(31) -Cast a non-integral type into a pointer. -An integral type may be converted to a pointer. -3.3.4(31) -Duplicate member '%s' -Two members of a struct may not have the same name. -3.1.2.2(7,25) -Invalid constant expression. -Constant expressions shall not contain assignment, increment, decrement, -function-call, or comma operators, except when they are contained within -the operand of the sizeof operator. -3.4(9) -Constant expressions must be derived from a constant value or a constant -variable. -3.4 -Dangerous operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. This operand is NOT an lvalue, but we let it pass. -Note that a segmentation error with possible core dump will result -when the resulting address does not denote a valid (declared) -storage location. This feature will be discontinued in future -releases of the compiler! -3.3.3.2(36) -Unacceptable operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. -3.3.3.2(36) -'&' before array or function; ignored -Unacceptable operand of sizeof operator. -The sizeof operator shall not be applied to an expression that has -function type or an incomplete type, to the parenthesized name of such -a type, or to an lvalue that designates a bit-field object. -3.3.3.4 -Unacceptable operand of a multiplicative operator. -Each of the operands of a multiplicative operator shall have arithmetic type. -3.3.5(18) -Unacceptable operand of the remainder operator -Each of the operands of the remainder (%) operator shall have integral type. -3.3.5(18) -Unacceptable operand of '+'. -For the + operator, either both operands shall have arithmetic type, or -one operand shall be a pointer to an object type and the other shall -have integral type. -3.3.6(39) -Unacceptable operand of '-'. -For the subtraction operator, one of the following shall hold: both operands -have arithmetic type; operands are pointers to qualified or unqualified -versions of compatible object types; or the left operand is a pointer -to an object type and the right operand has integral type. -3.3.6(39) -Unacceptable operand of shift operator. -Each of the operands of bitwise shift operators shall have integral type. -3.3.7(9) -Unacceptable operand of relational operator. -For relational operators, one of the following shall hold: both -operands have arithmetic type; both operands are pointers to qualified -or unqualified versions of compatible object types; or both operands -are pointers to qualified or unqualified versions of compatible -incomplete types. -3.3.8(32) -Unacceptable operand of == or != -For the == or != operator, one of the following shall hold: both operands -are pointers to qualified or unqualified versions of compatible types; one -operand is a pointer to an object or incomplete type and the other is a -pointer to a qualified or unqualified version of void; or one operand is -a pointer and the other is a null pointer constant. -3.3.9(21) -Unacceptable operand of &. -Each of the operands shall have integral type. -3.3.10(7) -Unacceptable operand of ^. -Each of the operands shall have integral type. -3.3.11(18) -Unacceptable operand of |. -Each of the operands shall have integral type. -3.3.12(30) -Unacceptable operand of &&. -Each of the operands shall have scalar type. -3.3.13(7) -Unacceptable operand of ||. -Each of the operands shall have scalar type. -3.3.14(20) -Unacceptable operand of conditional operator. -The first operand of conditional operator shall have scalar type. One -of the following shall hold for the second and third operands: -both operands have arithmetic type; both operands have compatible -structure or union types; both operands have void type; both operands -are pointers to qualified or unqualified versions of compatible types; -one operand is a pointer and the other is a null pointer constant; or -one operand is pointer to an object or incomplete type and the other -is a pointer to a qualified or unqualified version of void. -3.3.15 -Duplicate label '%s' -A label name can only occur once in a function. -3.1.2.1(25) -Division by zero. -3.3.5 -Subscripting a non-array. -3.3.2.1 -Subscripting an array of incomplete type which is not an object type. -The element of the array shall have an object type. -3.3.2.1 -Should only subscript an array with an integral expression -3.3.2.1 -Subscripting an unbounded array -3.3.2.1 -Array index out of range -3.3.2.1 -Selector requires struct/union pointer as left hand side -In K&R mode the expression is implicitly converted to the '.' selector -for a struct/union left-hand side. -3.3.2.3 -Selector requires struct/union as left hand side -In K&R mode the expression is implicitly converted to the '->' selector -for a struct/union pointer left-hand side. -3.3.2.3 -member of structure or union required -3.3.2.3 -types have different qualifier specifications -For two qualified types to be compatible, both shall have the -identically qualified version of a compatible type; qualified -and unqualified versions of a type are distinct types. For two -types to be compatible their types must be the same. -3.5.3(26) -Incompatible array type due to different array size -For two array types to be compatible, both shall have compatible element -types; if both size specifiers are present, they shall have the -same value. -3.5.4.2(11) -Incompatible array type due to incompatible element type -For two array types to be compatible, both shall have compatible element -types. -3.5.4.2(11) -Incompatible pointer type assignment -The type pointed to by the left-hand side of simple assignment -statement is incompatible with the type pointed to by the right-hand side. -3.3.16.1, 3.5.4.1(21) -Incompatible base type of pointer type -K&R feature. -Type %s of %s is incompatible with type %s of %s -Incompatible types can be resolved by casting or by other means. -3.3.16.1 -illegal combination of pointer and integer -Assigning an integral expression to a pointer is a bad practice. -Type for %s is incompatible with %s -Incompatible types can be resolved by casting or by other means. -3.1.2.6 -Bad operand type for += or -= -3.3.16.2(26) -A case or default label appears outside a switch statement -A case or default label shall appear only in a switch statement. -3.6.1 -The controlling expression of the if statement is not scalar type -The controlling expression of an if statement shall have scalar type. -3.6.4.1 -The controlling expression of switch statement is not integral type -The controlling expression of an switch statement shall have integral type. -3.6.4.2(20) -The case label is not an integral constant expression -The case label shall be an integral constant expression. -3.6.4.2(22) -Duplicate case label in the same switch statement -No two of the case constant expressions in the same switch statement -shall have the same value after conversion. -3.6.4.2(22) -More than one default label in the same switch statement -There may be at most one default label in a switch statement. -3.6.4.2(23) -The controlling expression of the iteration statement is not scalar -type -The controlling expression of a iteration statement shall have scalar -type. -3.6.5.1 -label '%s' used, but not defined -The identifier in a goto statement shall name a label located -somewhere in the enclosing function. -3.6.6.1 -A continue statement shall appear only in or as a loop body -3.6.6.2 -A break statement shall appear only in or as a switch body or loop body -3.6.6.3 -A return statement with an expression should not appear -in a function '%s', whose return type is void -3.6.6.4(24) -A return statement without an expression appears in a -function '%s', whose return type is not void -If a return statement without an expression is executed, and the value -of the function call is used by the caller, the behavior is undefined. -3.6.6.4(33) -Internal Error: statement stack underflow -Long double not supported; double assumed. -Long float not standard; double assumed. -Only 'register' allowed in parameter declaration -The only storage-class specifier that shall occur in a parameter -declaration is 'register'; illegal storage class ignored. -3.5.4.3(25) -Name(s) without types in a function declaration -An old-style function declaration is not allowed to have names -in the parameter list; useless names ignored -3.5.4.3(26) -Functions cannot return functions -3.7.1(33), 3.3.2.2 -Functions cannot return a non-object type -3.3.2.2 -enum declaration must contain enum literals -Although structs or unions may delay the declaration of their members, -a similar construction with enum does not exist and is not necessary, -as there can be no mutual dependencies between the declaration of an -enumerated type and any other type. -3.5.2.3(27) -Register qualification has no effect for this type of object -Register declarations for array, struct, and function types have -no effect. -3.5.1(16), 3.5.1(19) -Functions cannot be declared 'register' -The declaration of an identifier for a function that has block -scope shall have no explicit storage-class specifier other than -'extern'. -3.5.1(19) -'%s' cannot be initialized -The type of the entity to be initialized shall be an object type -or an array of unknown size. -3.5.7(32) -Cannot initialize 'extern' variable '%s' within a function -If the declaration of an identifier has block scope, and the -identifier has 'extern' or 'static' linkage, the declaration -shall have no initializer for the identifier; initialization -allowed anyway. -3.5.7(35) -initializing an 'extern' is an ANSI C extension -conflicting declarations for '%s' -'static' and 'extern' declarations conflict. Which is meant? -3.1.2.2(15), 3.1.2.2(27) -Too many initial values for '%s' -3.5.7(1) -incompatible types in initialization -3.3.16(35) -redefinition of '%s'; previous definition at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -bit-fields as members of a union are an ANSI C invention. -storage size for '%s' isn't known -type mismatch in initialization -Missing braces in a union initialization or illegally formed -initialization. -3.5.7(5) -union '%s' only allowed one initializer for the first member -3.5.7(5) -width of '%s' exceeds its type -the specified bitfield width is too large to be contained within a -bitfield type. -structure has no member named '%s' -This is allowed for compatibility with AT&T pcc-based compilers. -Reference of an expression of void type or an incomplete type. -3.2.2.1 -element size of an array shall not be zero -3.2.2.5(25) -invalid combination of type specifiers -Although order is unimportant, not all type specifiers can occur together. -3.5.2 -declaration must at least declare an identifier, tag, or the member of an enumeration -3.5(16) -at most one storage class may be given in the declaration -Duplicate occurrence ignored. -3.5.1(10) -size of function's return type is zero -The return type of a function must be void or an object type other than array. -3.7.1(33) -Expecting an integral return type from the main function -identifier missing from parameter declaration -Prototypes for function definitions require identifiers in parameter -declarations. -3.7.1(4) -only 'register' allowed for storage class for parameters -The declarations in the declaration list shall contain no storage class -other than 'register', and no initializations. -3.7.1(10) -parameters declarations can not have initializations -3.7.1(10) -only one instance of 'void' allowed in the parameter list -'void' must occur by itself (specifying that the function has no parameters). -3.5.4.3(1) -%s must have function type -1) An argument list must be explicitly present in the declarator; it cannot - be inherited from a typedef (3.5.4.3). -2) The declarator is not a function. -3.7.1(30) -Illegal hexadecimal constant -You have no digits after the 0x or 0X. 0x0 assumed. -3.1.3.2 -value overflows its type in this context. Value is set to be '%s'! -3.2.1.4 -value is outside range representable for type '%s' -missing member name -K&R mode permits a missing member name; otherwise, only bitfields can omit -the member name. -3.5.2.1(10) -useless keyword or type name in declaration -Type was ignored. -'%s' declared within and is limited to this function prototype -Possible program error, since parameter type checking will always fail -unless the type declaration is visible to the caller. -3.1.2.1(35) -Extra spaces within operator, %s assumed -In ANSI C, the compound assignment operator cannot have embedded -white space characters. -3.1.5 -missing size for array '%s' -Incomplete types permitted for identifiers with internal or -external linkage, but not automatic linkage. -3.1.2.5(10) -can't jump into (from outside of) the body of a 'try' or into either type of handler -'%s' missing, please #include excpt.h -excpt.h required to declare exception statements, intrinsics or compiler -runtime names. -local function declarations cannot be 'static' -A function declaration can only contain the storage-class 'static' -if it is at file scope. Declaration made 'extern'. -3.5.1(19) -static function '%s' declared and referenced, but not defined. -If an identifier declared with internal linkage is used in an -expression (other than as a part of the operand of a sizeof -operator), there shall be exactly one external definition for -the identifier in the translation unit. -3.7(12) -pragma argument '%s' must be declared prior to being used in a pragma -Pragma name ignored. -Pragma not supported -'%s' not enabled as intrinsic -It may have already appeared in a function pragma, or never occurred in -an intrinsic pragma. -'%s' is already enabled as an intrinsic -weak definition for '%s' is later redefined; pragma weak ignored. -definition of primary name '%s' not found; pragma weak ignored. -definition of secondary name '%s' not found; pragma weak ignored. -primary name '%s' is declared as a common or external, and is not defined -with initial value within this file; pragma weak ignored. -useless '%s' storage class ignored -array of functions not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -array of voids not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -argument for pragma pack must be an integer constant; pragma ignored -'%s' has wrong tag type. -Identifier redeclared in the same scope/block. -3.1.2.3 -missing dimension bound -For multidimensional arrays, the constant bounds of the array may be -omitted only for the first member of the sequence. -3.1.2.5(23) -Internal error in parameters to function substr; loc: '%s'; len: '%s'. -Internal error in parameters to function insertstr; indx: '%s'. -Internal error in function get_tag_name; input is a non-tagged type. -Internal error in function gen_type_str -- not a type tree '%s' -Cannot open file '%s' -Prototype should be moved after tag or a typedef declaration. -Please look for comments in the extracted header file. -The extracted header file includes prototypes for static functions, -which should be removed, if you wish to include the header in a source file -other than the originator. -ANSI C requires formal parameter before "..." -This extension is meant to be used for compatibility with varargs.h -3.5.4.3(35) -syntax error: "&..." invalid -extension used to access "..." formal arguments. -function '%s' initialized like a variable -The type of entity to be initialized shall be an object type or an -array of unknown size. -3.5.7(31) -initializer not an array aggregate -The initializer for an object that has aggregate type shall be a -brace-enclosed list of initializers for the members of the aggregate, -written in increasing subscript or member order. -3.5.7(20) -'%s' type is incomplete; cannot initialize -Was the struct ever defined? -3.5.7.(31) -'%s' is not standard ANSI. -This keyword/type is not defined in strict ANSI mode. -3.1.1 -not a legal asm string -The first operand of an asm string should be, after argument substitution, -a legal assembly string. -The -float option will be ignored in ANSI mode. -The -float option is ignored, since otherwise program semantics would -violate the ANSI standard. In particular, fp constants are always -'double' with ANSI-C, while with -float the type of fp constants will -depend on the context and may be 'float'. -ANSI C support unavailable with C compiler bundled with RISC/os -The C compiler bundled with RISC/os does not support ANSI C. ANSI -C support requires a separate license. -Ignored invalid warning number(s) in -woff option, %s%s ! -Warning numbers must be in the range %s to %s. -The set of warning numbers in cfe is disjoint from the set of warning numbers -in accom, since accom warnings cannot be mapped one-to-one to cfe warnings. -'%s' not handled as an intrinsic due to incompatible argument types . -'__unalign' only qualifies pointers -'__unalign' indicates the object pointed at by pointer is unaligned (e.g., -int * __unalign p). This is an extension to ANSI C and like 'volatile' -and 'const' can follow the '*' in pointer declarations, but unlike both -cannot qualify a base type. -index expression is an anachronism -ANSI C++ doesn't support array index expressions in delete. -5.3.4 -member cannot be of function or incomplete type. -3.5.2.1(12) -Illegal lint option, '%s', is ignored. -cannot open header message buffer file -cannot write header message buffer file -cannot read header message buffer file -cannot seek in header message buffer file -struct/union/enum '%s' is used, but not defined -static '%s' unused -nonportable character comparison (chars may be signed or unsigned) -redundant comparison of unsigned with constant expression -redundant statement, control flow cannot reach this statement -'%s' may be used before set -function parameter '%s' is not used in function '%s' -'%s' can be const qualified, since it is not set within its lifetime. -'%s' is not used in function '%s' -'%s' set but unused in function '%s' -control may fall through %s statement -function '%s' has return(e); and return; -function '%s' may return random value to place of invocation %s -label without goto: '%s' -width of %s constant is smaller than size of type (%s) -explicit conversion from '%s' to '%s' %s -implicit conversion from '%s' to '%s' %s -'%s' may be indistinguishable from '%s' due to internal name truncation -Promoted formal parameter and promoted argument have incompatible types -No prototype for the definition of '%s' %s -References to '%s' are substituted by its literal initializer - (as included in %s) -============== -unsupported language linkage -string-literal specifies an unsupported linkage -7.4(1) -No prototype for the call to %s -To achieve better type-checking, there should be a full prototype for -the function being called. -3.5.4.3 -'inline' only applies to function declarations -leave statment can occur only within try body -Microsoft extension -Use of a Microsoft extension detected without usage of the -compiler option -msft. -No parameter mentioned -A file with no declarations or definitions is accepted as an extension to ANSI C -The translation unit must contain at least one external definition. -3.7 -Incompatible signed and unsigned version of a type -Yacc initialization error -Internal error: yacc cannot initialize itself. -The cfe option %s may not be in future releases. We suggest that you not use this option! -Incompatible char and unsigned char versions of a type -Lshift with undefined behaviour. -Lshift with a negative right operand, or a right operand that is greater -than or equal to the width in bits of the promoted left operand, results -in undefined behaviour. -3.3.7(11) -useless type name in declaration, possibly a semicolon is missing. -Type was ignored. -constant initializer expression is invalid (refers to automatic variables). -All the expressions in an initializer for an object that has static storage -duration or in the initializer list for an object that has aggregate or -union type shall be constant expressions. Otherwise, unexpected results -may occur. -3.5.7(32) and 3.4 -invalid explicit or implicit conversion of an address constant to an integral value in a constant initializing expression. -An address constant in a constant initializing expression can neither -initialize a bit-field nor be directly or indirectly converted to an -integral type of size different from an address type. -6.4 diff --git a/tools/ido_recomp/linux/5.3/ugen b/tools/ido_recomp/linux/5.3/ugen deleted file mode 100755 index d356300bf..000000000 Binary files a/tools/ido_recomp/linux/5.3/ugen and /dev/null differ diff --git a/tools/ido_recomp/linux/5.3/ujoin b/tools/ido_recomp/linux/5.3/ujoin deleted file mode 100755 index 5a3162799..000000000 Binary files a/tools/ido_recomp/linux/5.3/ujoin and /dev/null differ diff --git a/tools/ido_recomp/linux/5.3/uld b/tools/ido_recomp/linux/5.3/uld deleted file mode 100755 index a65a2239b..000000000 Binary files a/tools/ido_recomp/linux/5.3/uld and /dev/null differ diff --git a/tools/ido_recomp/linux/5.3/umerge b/tools/ido_recomp/linux/5.3/umerge deleted file mode 100755 index 36fa5ac6e..000000000 Binary files a/tools/ido_recomp/linux/5.3/umerge and /dev/null differ diff --git a/tools/ido_recomp/linux/5.3/uopt b/tools/ido_recomp/linux/5.3/uopt deleted file mode 100755 index f44642087..000000000 Binary files a/tools/ido_recomp/linux/5.3/uopt and /dev/null differ diff --git a/tools/ido_recomp/linux/5.3/usplit b/tools/ido_recomp/linux/5.3/usplit deleted file mode 100755 index 5aa4151ed..000000000 Binary files a/tools/ido_recomp/linux/5.3/usplit and /dev/null differ diff --git a/tools/ido_recomp/linux/7.1/as0 b/tools/ido_recomp/linux/7.1/as0 deleted file mode 100755 index 1a69a14a5..000000000 Binary files a/tools/ido_recomp/linux/7.1/as0 and /dev/null differ diff --git a/tools/ido_recomp/linux/7.1/as1 b/tools/ido_recomp/linux/7.1/as1 deleted file mode 100755 index 047cfdd7f..000000000 Binary files a/tools/ido_recomp/linux/7.1/as1 and /dev/null differ diff --git a/tools/ido_recomp/linux/7.1/cc b/tools/ido_recomp/linux/7.1/cc deleted file mode 100755 index 61c43ede1..000000000 Binary files a/tools/ido_recomp/linux/7.1/cc and /dev/null differ diff --git a/tools/ido_recomp/linux/7.1/cfe b/tools/ido_recomp/linux/7.1/cfe deleted file mode 100755 index 75235c112..000000000 Binary files a/tools/ido_recomp/linux/7.1/cfe and /dev/null differ diff --git a/tools/ido_recomp/linux/7.1/err.english.cc b/tools/ido_recomp/linux/7.1/err.english.cc deleted file mode 100644 index b5d5be36e..000000000 --- a/tools/ido_recomp/linux/7.1/err.english.cc +++ /dev/null @@ -1,1260 +0,0 @@ -@ - 358 358 358 - 6464 6482 6553 - 6553 6593 6728 - 6728 6746 6803 - 6803 6808 6808 - 6808 6818 6818 - 6818 6826 6826 - 6826 6847 6847 - 6847 6875 6922 - 6922 6930 6930 - 6930 6939 6939 - 6939 6948 6948 - 6948 6974 7120 - 7120 7149 7204 - 7210 7248 7311 - 7317 7350 7442 - 7450 7497 7627 - 7635 7709 7930 - 7938 7975 8063 - 8071 8113 8253 - 8261 8289 8289 - 8298 8338 8445 - 8460 8502 8635 - 8650 8690 8819 - 8834 8857 8965 - 8965 9008 9113 - 9119 9142 9227 - 9235 9282 9451 - 9451 9462 9462 - 9462 9477 9477 - 9477 9497 9497 - 9497 9545 9545 - 9545 9584 9584 - 9584 9604 9662 - 9662 9682 9720 - 9720 9749 9749 - 9749 9788 9788 - 9788 9802 9802 - 9802 9829 9829 - 9829 9861 9861 - 9861 9904 9904 - 9904 9920 9920 - 9920 9962 9962 - 9962 9988 9988 - 9988 10014 10014 -10014 10035 10035 -10035 10054 10097 -10097 10115 10115 -10115 10147 10147 -10147 10183 10183 -10183 10208 10208 -10208 10236 10236 -10236 10269 10269 -10269 10304 10304 -10304 10328 10328 -10328 10351 10351 -10351 10371 10371 -10371 10402 10402 -10402 10447 10447 -10447 10497 10497 -10497 10533 10533 -10533 10598 10598 -10606 10630 10630 -10640 10671 10671 -10690 10719 10719 -10728 10752 10795 -10795 10837 10837 -10837 10876 10876 -10876 10900 10900 -10900 10948 10948 -10960 11021 11103 -11103 11128 11128 -11128 11153 11153 -11153 11216 11216 -11216 11239 11239 -11239 11303 11303 -11303 11347 11347 -11357 11393 11393 -11393 11432 11432 -11442 11494 11494 -11494 11536 11536 -11536 11595 11595 -11595 11622 11622 -11622 11684 11684 -11684 11726 11726 -11738 11778 11778 -11782 11813 11813 -11813 11850 11850 -11850 11900 12087 -12111 12120 12120 -12120 12129 12129 -12129 12158 12158 -12158 12192 12192 -12192 12237 12237 -12237 12273 12273 -12273 12326 12326 -12330 12366 12366 -12366 12423 12423 -12427 12482 12482 -12486 12560 12560 -12568 12631 12631 -12637 12691 12691 -12691 12743 12743 -12743 12785 12785 -12785 12826 12826 -12826 12865 12865 -12865 12883 12883 -12883 12946 12946 -12956 12995 12995 -13005 13066 13066 -13077 13163 13163 -13163 13211 13211 -13211 13270 13270 -13270 13318 13318 -13318 13350 13350 -13350 13387 13387 -13387 13428 13428 -13428 13464 13533 -13533 13580 13737 -13737 13776 13854 -13854 13913 13913 -13913 13950 13950 -13950 14118 14118 -14118 14150 14150 -14150 14163 14194 -14194 14224 14255 -14255 14275 14319 -14319 14353 14458 -14466 14484 14530 -14534 14567 14567 -14567 14635 14682 -14690 14742 14742 -14742 14789 14789 -14801 14875 14875 -14886 14947 14947 -14947 14992 14992 -14992 15035 15085 -15085 15134 15205 -15214 15267 15448 -15454 15496 16810 -16822 16875 16960 -16972 17053 17179 -17191 17236 17332 -17344 17491 17841 -17853 17939 18304 -18316 18471 18774 -18786 18952 19323 -19335 19364 19496 -19500 19527 19598 -19598 19613 19776 -19797 19808 19837 -19837 19862 19862 -19868 19927 20026 -20034 20075 20179 -20187 20223 20223 -20223 20290 20382 -20392 20441 20589 -20601 20656 20656 -20656 20699 20818 -20826 20860 21038 -21046 21094 21191 -21203 21236 21314 -21326 21395 21457 -21469 21502 21502 -21502 21587 21731 -21756 21789 21864 -21875 21901 21976 -22013 22059 22220 -22257 22397 22561 -22561 22595 22595 -22603 22623 22623 -22631 22667 22828 -22865 22919 22994 -23031 23059 23120 -23132 23201 23201 -23212 23274 23274 -23285 23345 23345 -23356 23393 23393 -23399 23431 23532 -23542 23587 23646 -23656 23697 23745 -23755 23796 23844 -23854 23876 23928 -23942 23971 24153 -24160 24243 24243 -24247 24273 24743 -24755 24784 24984 -24996 25034 25034 -25034 25075 25273 -25281 25332 25410 -25420 25467 25544 -25554 25583 25744 -25754 25783 26061 -26071 26111 26185 -26194 26239 26525 -26535 26568 26914 -26924 26951 26998 -27008 27035 27082 -27093 27120 27167 -27178 27206 27251 -27261 27289 27334 -27345 27391 27931 -27938 27959 28007 -28019 28037 28037 -28043 28069 28069 -28077 28147 28199 -28207 28266 28266 -28274 28306 28306 -28314 28339 28339 -28347 28404 28510 -28518 28567 28682 -28690 28728 28728 -28736 28782 29023 -29033 29085 29234 -29246 29303 29383 -29395 29432 29570 -29592 29631 29644 -29644 29693 29758 -29767 29810 29875 -29875 29911 29976 -29984 30014 30014 -30027 30086 30151 -30157 30223 30293 -30301 30369 30445 -30457 30511 30568 -30580 30630 30743 -30755 30812 30874 -30886 30959 31035 -31043 31076 31175 -31183 31243 31243 -31251 31323 31323 -31331 31433 31433 -31445 31544 31686 -31698 31740 31740 -31740 31783 31783 -31783 31824 31824 -31824 31873 31996 -32008 32056 32164 -32176 32210 32210 -32229 32271 32271 -32279 32323 32569 -32581 32642 32718 -32739 32779 32916 -32926 32953 33047 -33057 33116 33315 -33325 33373 33373 -33373 33407 33469 -33494 33527 33527 -33536 33573 33573 -33584 33650 33697 -33705 33763 33763 -33763 33797 33797 -33797 33829 33906 -33915 33976 33976 -33985 34016 34098 -34098 34133 34198 -34198 34261 34261 -34269 34312 34312 -34324 34363 34438 -34444 34530 34530 -34538 34596 34626 -34636 34675 34754 -34764 34821 34821 -34821 34867 34950 -34959 35016 35135 -35145 35198 35198 -35208 35266 35344 -35355 35382 35537 -35547 35576 35629 -35637 35705 35705 -35713 35764 35764 -35764 35784 35876 -35888 35932 35950 -35950 36013 36138 -36150 36191 36280 -36286 36314 36419 -36431 36516 36516 -36516 36554 36642 -36642 36689 36808 -36818 36881 37105 -37113 37183 37204 -37204 37225 37225 -37225 37255 37348 -37348 37388 37388 -37388 37454 37454 -37454 37518 37518 -37518 37584 37584 -37584 37717 37717 -37717 37752 37752 -37752 37783 37889 -37901 37928 38034 -38046 38115 38115 -38115 38140 38187 -38195 38219 38339 -38351 38422 38422 -38422 38486 38486 -38486 38555 38555 -38555 38619 38619 -38619 38641 38641 -38641 38758 38758 -38758 38929 38929 -38929 38975 39043 -39055 39084 39133 -39133 39175 39265 -39275 39310 39494 -39504 39547 39576 -39587 39614 39668 -39674 39697 39797 -39797 39845 40094 -40094 40158 40264 -40264 40369 40523 -40523 40593 40593 -40593 40629 40876 -40876 40911 40971 -40977 41026 41026 -41038 41077 41077 -41077 41116 41116 -41116 41156 41156 -41156 41195 41195 -41195 41237 41237 -41237 41285 41285 -41285 41304 41304 -41304 41371 41371 -41371 41429 41429 -41429 41491 41491 -41491 41519 41519 -41519 41572 41572 -41572 41642 41642 -41642 41676 41676 -41676 41713 41713 -41713 41751 41751 -41751 41792 41792 -41792 41856 41856 -41856 41881 41881 -41881 41944 41944 -41944 41985 41985 -41985 42026 42026 -42026 42098 42098 -42098 42170 42170 -42170 42213 42213 -42213 42275 42275 -42275 42302 42302 -42302 42317 42317 -42317 42346 42394 -42401 42433 42530 -42538 42585 42585 -42585 42631 42631 -42631 42651 42733 -42733 42756 42756 -42756 42837 42905 -42909 42960 42960 -42960 42986 43033 -43033 43124 43124 -43124 43179 43179 -43179 43212 43384 -43394 43461 43479 -43479 43555 43788 -43806 43929 44124 -44128 44128 44128 -Out of memory: %s -There is no more memory left in the system for compiling this program. -Internal Error Unknown Error Message %s -1) An internal error, while attempting to print an unavailable message -2) The error message file is inaccessible or has other problems -Unknown Signal %s -1) An unknown signal has been caught -2) 2 Nested signals -line -Warning: -Fatal: -Source not available -Too many errors... goodbye. -There is a limit of 30 errors before aborting. -Error: -reserved -reserved -Unknown Control Statement -1) The line begins with a '#' and is not of the form: - # "" -2) Please compile this program with the preprocessor enabled. -Unknown character %s ignored -The character is not part of the source character set. -2.2.1 -Unknown control character \%s ignored -The control character is not part of the source character set. -2.2.1 -Illegal character %s in exponent -1) Digits or sign expected after 'e' or 'E'. -2) Digits are expected after sign in exponent. -3.1.3.1 -Constant is out of range and may be truncated. -The constant is too large to be accurately represented and may be -truncated. The limits are in the system include file limits.h. -2.2.4.2 -Constant is out of range for a 32-bit data type, but accepted as written. -The constant is too large to fit in a 32-bit data type, but will be -accurately represented in a wider data type. The value may be truncated, -depending on its context. The limits are in the system include file -limits.h. -2.2.4.2 -Character constant size out of range -1) No characters in a character constant. -2) More than 4 bytes in a character constant. -3.1.3.4 -Wide character constant size out of range -1) No characters in the multibyte sequence (0 assumed). -2) More than 1 byte in the multi-byte sequence (only the first byte was converted). -3.1.3.4 -Invalid multibyte character -4.10.7.2 -Newline in string or character constant -1) Terminate your string or character constant with closing quotes. -2) Put a backslash before the newline. -3.1.3.4, 3.1.4 -Octal character escape too large: %s > %s -1) Terminate end of octal sequence with a non-octal character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Hex character escape too large: %s > %s -1) Terminate end of hex sequence with a non-hex character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Unexpected End-of-file -1) Unterminated string or character constant -2) Missing closing comment marker (*/) -3) File system problems -Unrecognized escape sequence in string \%s -Recognized escape sequences are \a, \b, \f, \n, \r, \t, and \v. -Character will be treated as un-escaped. -3.9.2 -Illegal octal digit %s -Octal constants, beginning with 0, must only have digits between 0 and 7, -inclusive. -3.1.3.2 -Unable to open temporary file for compiling %s -1) TMPDIR environment variable is set to a directory that you have no - permissions for. -2) The file system is full. -3) System errors beyond the scope of the compiler. -%s: Hangup -%s: Interrupt -%s: Quit (ASCII FS) -%s: Illegal instruction (not reset when caught) -%s: Trace trap (not reset when caught) -%s: IOT instruction -Also SIGABRT, used by abort, replace SIGIOT in the future -%s: EMT instruction -Also SIGXCPU, Exceeded CPU time limit -%s: Floating point exception -%s: Kill (cannot be caught or ignored) -%s: Bus error -%s: Segmentation violation -%s: Bad argument to system call -%s: Write on a pipe with no one to read it -%s: Alarm clock -%s: Software termination signal from kill -%s: User defined signal 1 -%s: User defined signal 2 -%s: Death of a child -Power-fail restart -%s: Also SIGXFSZ, exceeded file size limit -%s: Window change -%s: Handset, line status change -%s: Sendablestop signalnot from tty -%s: Stop signal from tty -%s: Pollable event occurred -%s: Input/Output possible signal -%s: Urgent condition on IO channel -%s: Window size changes -%s: Virtual time alarm -%s: Profiling alarm -%s: Continue a stopped process -%s: To readers pgrp upon background tty read -%s: Like TTIN for output if (tp->t_local<OSTOP) -%s: Resource lost (eg, record-lock) -'auto' and 'register' are not allowed in an external declaration -3.7(10) -must have function type -3.7.1(30) -Functions cannot return arrays -3.7.1(33), 3.3.2.2 -Declaration list not allowed -3.7.1(5) -Too many input files %s -The command line may contain only one file -cpp internal error: input stack underflow -cpp internal error: if stack underflow -Cannot open the file %s -No new-line character at the end of the file %s -2.1.1.2(30) -Fatal: Exceeded the limit of nesting level for #include file -Fatal: Exceeded the limit of nesting level for #include file. This limit -is 200. -Fail to read the file %s -Cannot write the file %s -%s: %s: An if directive is not terminated properly in the file -%s: %s: nested comment -%s:%s: Illegal macro name %s; macro name shall be an identifier -%s:%s: Illegal preprocessing token sequence -3.8.3(35) -%s:%s: Illegal macro parameter name -%s:%s: Non-unique macro parameter name -3.8.3(18) -%s:%s: Missing ')' in parameter list for #define %s -%s:%s: Missing ')' in macro instantiation -%s:%s: Bad punctuator in the parameter list for #define %s -%s:%s: Macro %s redefined. -%s:%s: # operator should be followed by a macro argument name -%s:%s: Badly formed constant expression%s -3.4(9), 3.8 -%s:%s: Division by zero in #if or #elif -3.8 -unknown command line option %s -extraneous input/output file name %s -%s: %s: Unterminated string or character constant -A preprocessing string or character constant token was not -terminated. Note that preprocessing directives are processed -after the source file has been divided into preprocessing tokens. -2.1.1.2(30) 3.1(18) 3.8 -%s: %s: -%s: %s: -%s: %s: Unterminated comment -%s: %s: Unknown directive type %s -%s: %s: #elif or #else after #else directive -%s: %s: Bad identifier after the %s -%s: %s: #%s accepts only one identifier as parameter -3.8 -%s: %s: Bad identifier after the %s -%s: %s: text following #%s violates the ANSI C standard. -3.8 -%s: %s: Bad character %s occurs after the # directive. -3.8 -%s: %s: the ## operator shall not be the %s token in the replacement list -3.8.3.3 -%s: %s: the defined operator takes identifier as operand only. -3.8.1 -%s: %s: Not in a conditional directive while using %s -%s: %s: Illegal filename specification for #include -%s: %s: Invalid file name %s for #include -%s: %s: Cannot open file %s for #include -%s: %s: Bad argument for #line command -%s: %s: #error %s -%s: %s: Tried to redefine predefined macro %s, attempt ignored -3.8.7(22) -%s: %s: Undefining predefined macro %s -3.8.7(22) -%s: %s: Undefined the ANSI standard library defined macro %s -4.1.2.1(9) -%s: %s: The number of arguments in the macro invocation does not match the definition -%s: %s: Illegal character %s in preprocessor if -%s: %s: Illegal character %s for number in preprocessor if -%s: %s: No string is allowed in preprocessor if -%s: %s: Not supported pragma %s -%s: %s: Not supported #pragma format -%s: %s: ANSI C does not allow #ident; %s -%s: %s: Not supported #ident format -This cpp extension accepts the following format: -#ident "any string" -%s: %s: Not supported #assert/#unassert format -This cpp extension accepts the following format: -#assert identifier -#assert identifier ( pp-tokens ) -#unassert identifier -#unassert identifier ( pp-tokens ) -%s: %s: Bad assertion predicate format -The correct syntax for this cpp extension is: -#assert identifier ( pp-token ) -%s: %s: directive is an upward-compatible ANSI C extension -%s: This option requires an argument -%s: %s: A macro has expanded recursively more than %s times. Further expansion will be disabled! Use command-line option: -Wp,-max_rec_depth=depth to recurse deeper. -A status return from cpp to cfe -Syntax Error -The token read was unexpected. -Syntax Error -- cannot backup -The token read was unexpected. -Yacc stack overflow -The expression is too complicated to parse. -Trailing comma in enumerator list -The use of a trailing comma in an enumerator list is not standard C. There -may be portability problems. -3.5.2.2 -Empty declaration -Empty declarations are invalid in standard C. -3.5 -%s declared, but not referenced. -redeclaration of '%s'; previous declaration at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -'%s' undefined; reoccurrences will not be reported. -Non-function name referenced in function call. -3.3.2.2(18) -The number of arguments doesn't agree with the number in the declaration. -3.3.2.2(5) -'%s' section name longer than 8 characters. Name truncated. -'%s' is already placed by pragma alloc_text. -Cannot write ucode file while compiling %s -1) The file system is full -2) Permissions problem -Must have corresponding formal argument for '%s' -Parameter found in the declaration part, but not in the argument list. -3.7.1(7) -Non-prototype declaration is an obsolescent feature. -The use of function definitions with separate parameter identifier -and declaration lists (not prototype-format parameter type and -identifier declarators) is an obsolescent feature. -3.9.5 -Incompatible function declarations for %s -For two function types to be compatible, both shall specify compatible -return types. Moreover, the parameter type lists, if both are present, -shall agree in the number of parameters and in use of the ellipsis -terminator; corresponding parameters shall have compatible types. If -one type has a parameter type list and the other type is specified by -a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. If one type has a parameter type list and the -other is specified by a function definition that contains a (possibly -empty) identifier list, both shall agree in the number of parameters, -and the type of each prototype parameter shall be compatible with the -type that results from application of the default argument promotions -to the type of the corresponding identifier. (For each parameter -declared with function or array type, its type for these comparisons -is the one that results from conversion to a pointer type. For each -parameter declared with qualified type, its type for these comparisons -is the unqualified version of its declared type.) There you have it! -3.5.4.3(15) -Incompatible function return type for this function. -For two function types to be compatible, both shall specify compatible -return types. -3.5.4.3(15) -The number of parameters for function is different from the previous declaration -The parameter type lists, if both are present, shall agree in the -number of parameters and in use of the ellipsis terminator. -3.5.4.3(15) -Incompatible type for the function parameter -If both parameter type lists are present, corresponding -parameters shall have compatible types. -3.5.4.3(15) -Function %s is redeclared with an incompatible argument type (after default argument promotion), which could lead to undefined run-time behaviour. -The redeclaration could cause arguments at a call site to be passed -inconsistently with what the function implementation expects, and -parameters would therefore be accessed erroneously when executing the -function body. Note that a float argument is promoted to a double -when passed (potentially through fp registers) to an unprototyped -function. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, ellipsis terminator not allowed -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the type of each parameter shall be -compatible with the type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype declaration and non-prototype definition found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other is specified by a -function definition that contains a (possibly empty) identifier list, -both shall agree in the number of parameters, and the type of each -prototype parameter shall be compatible with the type that results -from application of the default argument promotions to the type of the -corresponding identifier. -3.5.4.3(15) -Empty declaration specifiers -Standard C requires at least a storage class specifier, type specifier, -or a type qualifier in declarations. 'extern int' assumed. -3.5 -Can't write to the file %s -1) The output file cannot be opened for writing. -2) Out of file space. -Duplicate '%s' -typedef, extern, static, auto, register, const, volatile may not -appear more than once in the same specifier list or qualifier list. -Duplicate occurrence ignored. -3.5.1(10) , 3.5.3(5) -Null input -There is nothing to compile. -Illegal type combination -3.5.2 -Missing ';' at end of structure / union member declaration -In standard C, each member declaration must be terminated by a ';'. A -terminating ';' is assumed. -3.5.2.1 -Missing member name in structure / union -In standard C, each member declaration have a member name. The missing -member is assumed to not exist. -3.5.2.1 -This variable is initialized twice. -Neither 'const' or 'volatile' have any effect on function results. -Qualifiers only apply to expressions designating an object that -can be altered or examined. -3.5.3(10) -An integer constant expression is required here. -The expression that defines the value of an enumeration constant -shall be an integral constant expression that has a value -representable as an int. -3.5.2.2(28) -(previous declaration of '%s' at line %s in file '%s') -Must be an integer type greater than zero. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -Array size cannot be a long long. -Arrays with more than 2^32 elements are not yet supported. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -bit-field '%s' width is not an integer constant -The expression that specifies the width of a bit-field shall be an -integral constant expression. -3.5.2.1(15) -bit-field '%s' width is negative -The expression that specifies the width of a bit-field shall be -non-negative. -3.5.2.1(15) -bit-field '%s' type required to be int, unsigned int, or signed int. -A bit-field shall have type int, unsigned int, or signed int. -3.5.2.1(30) -bit-field %s's type not integer. -Non-scalar type or pointer type to a non-object for increment or decrement operator. -The operand of the prefix/postfix increment or decrement operator shall have scalar type; if it is of pointer type, it must point to an object. -3.3.2.4(37), 3.3.3.1(25) -Assign value to a function type. -An assignment operator shall have a modifiable lvalue as its left operand. -3.2.2.1(5) -Assign value to an array. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for variable of incomplete type. -The operand of increment and decrement operator shall be a modifiable -scalar lvalue. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -The left-hand side of the '.' operator must be an addressable lvalue, when a bit-field is not contained within a unit of 32 bits alignment. -This is a restriction in our implementation, which can be worked -around by always accessing long long bit-fields indirectly (i.e. -by means of the '->' operator). -This expression is not an lvalue. -3.2.2.1 -Modified an rvalue. -3.2.2.1 -Change value for constant variable. -The operand of increment and decrement operators shall be modifiable -scalar lvalues. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for constant field of a struct or union. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Dereferenced a non-pointer. -The operand of the unary * operator shall have pointer type. -3.3.3.2(39) -The operand of the unary + or - operator shall have arithmetic type. -3.3.3.3(6) -The operand of the unary ~ operator shall have integral type. -3.3.3.3(6) -The operand of the unary ! operator shall have scalar type. -3.3.3.3(6) -Constants must have arithmetic type. -3.1.3 -Bad type name for cast operator -The type name for the cast operator should either be void or a -qualified or unqualified scalar type. -3.3.4(22) -Improper cast of non-scalar type expression. -The operand for the cast operator shall be of scalar type. -3.3.4(23) -Cast a pointer into a non-integral type. -A pointer may be converted to an integral type. -3.3.4(31) -Cast a non-integral type into a pointer. -An integral type may be converted to a pointer. -3.3.4(31) -Duplicate member '%s' -Two members of a struct may not have the same name. -3.1.2.2(7,25) -Invalid constant expression. -Constant expressions shall not contain assignment, increment, decrement, -function-call, or comma operators, except when they are contained within -the operand of the sizeof operator. -3.4(9) -Constant expressions must be derived from a constant value or a constant -variable. -3.4 -Dangerous operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. This operand is NOT an lvalue, but we let it pass. -Note that a segmentation error with possible core dump will result -when the resulting address does not denote a valid (declared) -storage location. This feature will be discontinued in future -releases of the compiler! -3.3.3.2(36) -Unacceptable operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. -3.3.3.2(36) -'&' before array or function; ignored -Unacceptable operand of sizeof operator. -The sizeof operator shall not be applied to an expression that has -function type or an incomplete type, to the parenthesized name of such -a type, or to an lvalue that designates a bit-field object. -3.3.3.4 -Unacceptable operand of a multiplicative operator. -Each of the operands of a multiplicative operator shall have arithmetic type. -3.3.5(18) -Unacceptable operand of the remainder operator -Each of the operands of the remainder (%) operator shall have integral type. -3.3.5(18) -Unacceptable operand of '+'. -For the + operator, either both operands shall have arithmetic type, or -one operand shall be a pointer to an object type and the other shall -have integral type. -3.3.6(39) -Unacceptable operand of '-'. -For the subtraction operator, one of the following shall hold: both operands -have arithmetic type; operands are pointers to qualified or unqualified -versions of compatible object types; or the left operand is a pointer -to an object type and the right operand has integral type. -3.3.6(39) -Unacceptable operand of shift operator. -Each of the operands of bitwise shift operators shall have integral type. -3.3.7(9) -Unacceptable operand of relational operator. -For relational operators, one of the following shall hold: both -operands have arithmetic type; both operands are pointers to qualified -or unqualified versions of compatible object types; or both operands -are pointers to qualified or unqualified versions of compatible -incomplete types. -3.3.8(32) -Unacceptable operand of == or != -For the == or != operator, one of the following shall hold: both operands -are pointers to qualified or unqualified versions of compatible types; one -operand is a pointer to an object or incomplete type and the other is a -pointer to a qualified or unqualified version of void; or one operand is -a pointer and the other is a null pointer constant. -3.3.9(21) -Unacceptable operand of &. -Each of the operands shall have integral type. -3.3.10(7) -Unacceptable operand of ^. -Each of the operands shall have integral type. -3.3.11(18) -Unacceptable operand of |. -Each of the operands shall have integral type. -3.3.12(30) -Unacceptable operand of &&. -Each of the operands shall have scalar type. -3.3.13(7) -Unacceptable operand of ||. -Each of the operands shall have scalar type. -3.3.14(20) -Unacceptable operand of conditional operator. -The first operand of conditional operator shall have scalar type. One -of the following shall hold for the second and third operands: -both operands have arithmetic type; both operands have compatible -structure or union types; both operands have void type; both operands -are pointers to qualified or unqualified versions of compatible types; -one operand is a pointer and the other is a null pointer constant; or -one operand is pointer to an object or incomplete type and the other -is a pointer to a qualified or unqualified version of void. -3.3.15 -Duplicate label '%s' -A label name can only occur once in a function. -3.1.2.1(25) -Division by zero. -3.3.5 -Subscripting a non-array. -3.3.2.1 -Subscripting an array of incomplete type which is not an object type. -The element of the array shall have an object type. -3.3.2.1 -Should only subscript an array with an integral expression -3.3.2.1 -Subscripting an unbounded array -3.3.2.1 -Array index out of range -3.3.2.1 -Selector requires struct/union pointer as left hand side -In K&R mode the expression is implicitly converted to the '.' selector -for a struct/union left-hand side. -3.3.2.3 -Selector requires struct/union as left hand side -In K&R mode the expression is implicitly converted to the '->' selector -for a struct/union pointer left-hand side. -3.3.2.3 -member of structure or union required -3.3.2.3 -types have different qualifier specifications -For two qualified types to be compatible, both shall have the -identically qualified version of a compatible type; qualified -and unqualified versions of a type are distinct types. For two -types to be compatible their types must be the same. -3.5.3(26) -Incompatible array type due to different array size -For two array types to be compatible, both shall have compatible element -types; if both size specifiers are present, they shall have the -same value. -3.5.4.2(11) -Incompatible array type due to incompatible element type -For two array types to be compatible, both shall have compatible element -types. -3.5.4.2(11) -Incompatible pointer type assignment -The type pointed to by the left-hand side of simple assignment -statement is incompatible with the type pointed to by the right-hand side. -3.3.16.1, 3.5.4.1(21) -Incompatible base type of pointer type -K&R feature. -Type %s of %s is incompatible with type %s of %s -Incompatible types can be resolved by casting or by other means. -3.3.16.1 -illegal combination of pointer and integer -Assigning an integral expression to a pointer is a bad practice. -Type for %s is incompatible with %s -Incompatible types can be resolved by casting or by other means. -3.1.2.6 -Bad operand type for += or -= -3.3.16.2(26) -A case or default label appears outside a switch statement -A case or default label shall appear only in a switch statement. -3.6.1 -The controlling expression of the if statement is not scalar type -The controlling expression of an if statement shall have scalar type. -3.6.4.1 -The controlling expression of switch statement is not integral type -The controlling expression of an switch statement shall have integral type. -3.6.4.2(20) -The case label is not an integral constant expression -The case label shall be an integral constant expression. -3.6.4.2(22) -Duplicate case label in the same switch statement -No two of the case constant expressions in the same switch statement -shall have the same value after conversion. -3.6.4.2(22) -More than one default label in the same switch statement -There may be at most one default label in a switch statement. -3.6.4.2(23) -The controlling expression of the iteration statement is not scalar -type -The controlling expression of a iteration statement shall have scalar -type. -3.6.5.1 -label '%s' used, but not defined -The identifier in a goto statement shall name a label located -somewhere in the enclosing function. -3.6.6.1 -A continue statement shall appear only in or as a loop body -3.6.6.2 -A break statement shall appear only in or as a switch body or loop body -3.6.6.3 -A return statement with an expression should not appear -in a function '%s', whose return type is void -3.6.6.4(24) -A return statement without an expression appears in a -function '%s', whose return type is not void -If a return statement without an expression is executed, and the value -of the function call is used by the caller, the behavior is undefined. -3.6.6.4(33) -Internal Error: statement stack underflow -Long double not supported; double assumed. -Long float not standard; double assumed. -Only 'register' allowed in parameter declaration -The only storage-class specifier that shall occur in a parameter -declaration is 'register'; illegal storage class ignored. -3.5.4.3(25) -Name(s) without types in a function declaration -An old-style function declaration is not allowed to have names -in the parameter list; useless names ignored -3.5.4.3(26) -Functions cannot return functions -3.7.1(33), 3.3.2.2 -Functions cannot return a non-object type -3.3.2.2 -enum declaration must contain enum literals -Although structs or unions may delay the declaration of their members, -a similar construction with enum does not exist and is not necessary, -as there can be no mutual dependencies between the declaration of an -enumerated type and any other type. -3.5.2.3(27) -Register qualification has no effect for this type of object -Register declarations for array, struct, and function types have -no effect. -3.5.1(16), 3.5.1(19) -Functions cannot be declared 'register' -The declaration of an identifier for a function that has block -scope shall have no explicit storage-class specifier other than -'extern'. -3.5.1(19) -'%s' cannot be initialized -The type of the entity to be initialized shall be an object type -or an array of unknown size. -3.5.7(32) -Cannot initialize 'extern' variable '%s' within a function -If the declaration of an identifier has block scope, and the -identifier has 'extern' or 'static' linkage, the declaration -shall have no initializer for the identifier; initialization -allowed anyway. -3.5.7(35) -initializing an 'extern' is an ANSI C extension -conflicting declarations for '%s' -'static' and 'extern' declarations conflict. Which is meant? -3.1.2.2(15), 3.1.2.2(27) -Too many initial values for '%s' -3.5.7(1) -incompatible types in initialization -3.3.16(35) -redefinition of '%s'; previous definition at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -bit-fields as members of a union are an ANSI C invention. -storage size for '%s' isn't known -type mismatch in initialization -Missing braces in a union initialization or illegally formed -initialization. -3.5.7(5) -union '%s' only allowed one initializer for the first member -3.5.7(5) -width of '%s' exceeds its type -the specified bitfield width is too large to be contained within a -bitfield type. -structure has no member named '%s' -This is allowed for compatibility with AT&T pcc-based compilers. -Reference of an expression of void type or an incomplete type. -3.2.2.1 -element size of an array shall not be zero -3.2.2.5(25) -invalid combination of type specifiers -Although order is unimportant, not all type specifiers can occur together. -3.5.2 -declaration must at least declare an identifier, tag, or the member of an enumeration -3.5(16) -at most one storage class may be given in the declaration -Duplicate occurrence ignored. -3.5.1(10) -size of function's return type is zero -The return type of a function must be void or an object type other than array. -3.7.1(33) -Expecting an integral return type from the main function -identifier missing from parameter declaration -Prototypes for function definitions require identifiers in parameter -declarations. -3.7.1(4) -only 'register' allowed for storage class for parameters -The declarations in the declaration list shall contain no storage class -other than 'register', and no initializations. -3.7.1(10) -parameters declarations can not have initializations -3.7.1(10) -only one instance of 'void' allowed in the parameter list -'void' must occur by itself (specifying that the function has no parameters). -3.5.4.3(1) -%s must have function type -1) An argument list must be explicitly present in the declarator; it cannot - be inherited from a typedef (3.5.4.3). -2) The declarator is not a function. -3.7.1(30) -Illegal hexadecimal constant -You have no digits after the 0x or 0X. 0x0 assumed. -3.1.3.2 -value overflows its type in this context. Value is set to be '%s'! -3.2.1.4 -value is outside range representable for type '%s' -missing member name -K&R mode permits a missing member name; otherwise, only bitfields can omit -the member name. -3.5.2.1(10) -useless keyword or type name in declaration -Type was ignored. -'%s' declared within and is limited to this function prototype -Possible program error, since parameter type checking will always fail -unless the type declaration is visible to the caller. -3.1.2.1(35) -Extra spaces within operator, %s assumed -In ANSI C, the compound assignment operator cannot have embedded -white space characters. -3.1.5 -missing size for array '%s' -Incomplete types permitted for identifiers with internal or -external linkage, but not automatic linkage. -3.1.2.5(10) -can't jump into (from outside of) the body of a 'try' or into either type of handler -'%s' missing, please #include excpt.h -excpt.h required to declare exception statements, intrinsics or compiler -runtime names. -local function declarations cannot be 'static' -A function declaration can only contain the storage-class 'static' -if it is at file scope. Declaration made 'extern'. -3.5.1(19) -static function '%s' declared and referenced, but not defined. -If an identifier declared with internal linkage is used in an -expression (other than as a part of the operand of a sizeof -operator), there shall be exactly one external definition for -the identifier in the translation unit. -3.7(12) -pragma argument '%s' must be declared prior to being used in a pragma -Pragma name ignored. -Pragma not supported -'%s' not enabled as intrinsic -It may have already appeared in a function pragma, or never occurred in -an intrinsic pragma. -'%s' is already enabled as an intrinsic -weak definition for '%s' is later redefined; pragma weak ignored. -definition of primary name '%s' not found; pragma weak ignored. -definition of secondary name '%s' not found; pragma weak ignored. -primary name '%s' is declared as a common or external, and is not defined -with initial value within this file; pragma weak ignored. -useless '%s' storage class ignored -array of functions not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -array of voids not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -argument for pragma pack must be an integer constant; pragma ignored -'%s' has wrong tag type. -Identifier redeclared in the same scope/block. -3.1.2.3 -missing dimension bound -For multidimensional arrays, the constant bounds of the array may be -omitted only for the first member of the sequence. -3.1.2.5(23) -Internal error in parameters to function substr; loc: '%s'; len: '%s'. -Internal error in parameters to function insertstr; indx: '%s'. -Internal error in function get_tag_name; input is a non-tagged type. -Internal error in function gen_type_str -- not a type tree '%s' -Cannot open file '%s' -Prototype should be moved after tag or a typedef declaration. -Please look for comments in the extracted header file. -The extracted header file includes prototypes for static functions, -which should be removed, if you wish to include the header in a source file -other than the originator. -ANSI C requires formal parameter before "..." -This extension is meant to be used for compatibility with varargs.h -3.5.4.3(35) -syntax error: "&..." invalid -extension used to access "..." formal arguments. -function '%s' initialized like a variable -The type of entity to be initialized shall be an object type or an -array of unknown size. -3.5.7(31) -initializer not an array aggregate -The initializer for an object that has aggregate type shall be a -brace-enclosed list of initializers for the members of the aggregate, -written in increasing subscript or member order. -3.5.7(20) -'%s' type is incomplete; cannot initialize -Was the struct ever defined? -3.5.7.(31) -'%s' is not standard ANSI. -This keyword/type is not defined in strict ANSI mode. -3.1.1 -not a legal asm string -The first operand of an asm string should be, after argument substitution, -a legal assembly string. -The -float option will be ignored in ANSI mode. -The -float option is ignored, since otherwise program semantics would -violate the ANSI standard. In particular, fp constants are always -'double' with ANSI-C, while with -float the type of fp constants will -depend on the context and may be 'float'. -ANSI C support unavailable with C compiler bundled with RISC/os -The C compiler bundled with RISC/os does not support ANSI C. ANSI -C support requires a separate license. -Ignored invalid warning number(s) in -woff option, %s%s ! -Warning numbers must be in the range %s to %s. -The set of warning numbers in cfe is disjoint from the set of warning numbers -in accom, since accom warnings cannot be mapped one-to-one to cfe warnings. -'%s' not handled as an intrinsic due to incompatible argument types . -'__unalign' only qualifies pointers -'__unalign' indicates the object pointed at by pointer is unaligned (e.g., -int * __unalign p). This is an extension to ANSI C and like 'volatile' -and 'const' can follow the '*' in pointer declarations, but unlike both -cannot qualify a base type. -index expression is an anachronism -ANSI C++ doesn't support array index expressions in delete. -5.3.4 -member cannot be of function or incomplete type. -3.5.2.1(12) -Illegal lint option, '%s', is ignored. -cannot open header message buffer file -cannot write header message buffer file -cannot read header message buffer file -cannot seek in header message buffer file -struct/union/enum '%s' is used, but not defined -static '%s' unused -nonportable character comparison (chars may be signed or unsigned) -redundant comparison of unsigned with constant expression -redundant statement, control flow cannot reach this statement -'%s' may be used before set -function parameter '%s' is not used in function '%s' -'%s' can be const qualified, since it is not set within its lifetime. -'%s' is not used in function '%s' -'%s' set but unused in function '%s' -control may fall through %s statement -function '%s' has return(e); and return; -function '%s' may return random value to place of invocation %s -label without goto: '%s' -only %s bits of '%s' constant (type '%s') are explicitly given -explicit conversion from '%s' to '%s' %s -implicit conversion from '%s' to '%s' %s -'%s' may be indistinguishable from '%s' due to internal name truncation -Promoted formal parameter and promoted argument have incompatible types -No prototype for the definition of '%s' %s -References to '%s' are substituted by its literal initializer - (as included in %s) -============== -unsupported language linkage -string-literal specifies an unsupported linkage -7.4(1) -No prototype for the call to %s -To achieve better type-checking, there should be a full prototype for -the function being called. -3.5.4.3 -'inline' only applies to function declarations -leave statment can occur only within try body -Microsoft extension -Use of a Microsoft extension detected without usage of the -compiler option -msft. -No parameter mentioned -A file with no declarations or definitions is accepted as an extension to ANSI C -The translation unit must contain at least one external definition. -3.7 -Incompatible signed and unsigned version of a type -Yacc initialization error -Internal error: yacc cannot initialize itself. -The cfe option %s may not be in future releases. We suggest that you not use this option! -Incompatible char and unsigned char versions of a type -Lshift with undefined behaviour. -Lshift with a negative right operand, or a right operand that is greater -than or equal to the width in bits of the promoted left operand, results -in undefined behaviour. -3.3.7(11) -useless type name in declaration, possibly a semicolon is missing. -Type was ignored. -constant initializer expression is invalid (refers to automatic variables). -All the expressions in an initializer for an object that has static storage -duration or in the initializer list for an object that has aggregate or -union type shall be constant expressions. Otherwise, unexpected results -may occur. -3.5.7(32) and 3.4 -invalid explicit or implicit conversion of an address constant to an integral value in a constant initializing expression. -An address constant in a constant initializing expression can neither -initialize a bit-field nor be directly or indirectly converted to an -integral type of size different from an address type. -6.4 diff --git a/tools/ido_recomp/linux/7.1/ugen b/tools/ido_recomp/linux/7.1/ugen deleted file mode 100755 index 32d8d0be6..000000000 Binary files a/tools/ido_recomp/linux/7.1/ugen and /dev/null differ diff --git a/tools/ido_recomp/linux/7.1/ujoin b/tools/ido_recomp/linux/7.1/ujoin deleted file mode 100755 index 49b35ba6a..000000000 Binary files a/tools/ido_recomp/linux/7.1/ujoin and /dev/null differ diff --git a/tools/ido_recomp/linux/7.1/uld b/tools/ido_recomp/linux/7.1/uld deleted file mode 100755 index 756d30cd4..000000000 Binary files a/tools/ido_recomp/linux/7.1/uld and /dev/null differ diff --git a/tools/ido_recomp/linux/7.1/umerge b/tools/ido_recomp/linux/7.1/umerge deleted file mode 100755 index 569e56e76..000000000 Binary files a/tools/ido_recomp/linux/7.1/umerge and /dev/null differ diff --git a/tools/ido_recomp/linux/7.1/uopt b/tools/ido_recomp/linux/7.1/uopt deleted file mode 100755 index 349d1d6ff..000000000 Binary files a/tools/ido_recomp/linux/7.1/uopt and /dev/null differ diff --git a/tools/ido_recomp/linux/7.1/usplit b/tools/ido_recomp/linux/7.1/usplit deleted file mode 100755 index 563c5f8a2..000000000 Binary files a/tools/ido_recomp/linux/7.1/usplit and /dev/null differ diff --git a/tools/ido_recomp/macos/5.3/as0 b/tools/ido_recomp/macos/5.3/as0 deleted file mode 100755 index 1d2b7a725..000000000 Binary files a/tools/ido_recomp/macos/5.3/as0 and /dev/null differ diff --git a/tools/ido_recomp/macos/5.3/as1 b/tools/ido_recomp/macos/5.3/as1 deleted file mode 100755 index 44fada1c5..000000000 Binary files a/tools/ido_recomp/macos/5.3/as1 and /dev/null differ diff --git a/tools/ido_recomp/macos/5.3/cc b/tools/ido_recomp/macos/5.3/cc deleted file mode 100755 index 9e3c8f8c9..000000000 Binary files a/tools/ido_recomp/macos/5.3/cc and /dev/null differ diff --git a/tools/ido_recomp/macos/5.3/cfe b/tools/ido_recomp/macos/5.3/cfe deleted file mode 100755 index 86d98c79d..000000000 Binary files a/tools/ido_recomp/macos/5.3/cfe and /dev/null differ diff --git a/tools/ido_recomp/macos/5.3/err.english.cc b/tools/ido_recomp/macos/5.3/err.english.cc deleted file mode 100644 index 6976e38a9..000000000 --- a/tools/ido_recomp/macos/5.3/err.english.cc +++ /dev/null @@ -1,1260 +0,0 @@ -@ - 358 358 358 - 6464 6482 6553 - 6553 6593 6728 - 6728 6746 6803 - 6803 6808 6808 - 6808 6818 6818 - 6818 6826 6826 - 6826 6847 6847 - 6847 6875 6922 - 6922 6930 6930 - 6930 6939 6939 - 6939 6948 6948 - 6948 6974 7120 - 7120 7149 7204 - 7210 7248 7311 - 7317 7350 7442 - 7450 7497 7627 - 7635 7709 7930 - 7938 7975 8063 - 8071 8113 8253 - 8261 8289 8289 - 8298 8338 8445 - 8460 8502 8635 - 8650 8690 8819 - 8834 8857 8965 - 8965 9008 9113 - 9119 9142 9227 - 9235 9282 9451 - 9451 9462 9462 - 9462 9477 9477 - 9477 9497 9497 - 9497 9545 9545 - 9545 9584 9584 - 9584 9604 9662 - 9662 9682 9720 - 9720 9749 9749 - 9749 9788 9788 - 9788 9802 9802 - 9802 9829 9829 - 9829 9861 9861 - 9861 9904 9904 - 9904 9920 9920 - 9920 9962 9962 - 9962 9988 9988 - 9988 10014 10014 -10014 10035 10035 -10035 10054 10097 -10097 10115 10115 -10115 10147 10147 -10147 10183 10183 -10183 10208 10208 -10208 10236 10236 -10236 10269 10269 -10269 10304 10304 -10304 10328 10328 -10328 10351 10351 -10351 10371 10371 -10371 10402 10402 -10402 10447 10447 -10447 10497 10497 -10497 10533 10533 -10533 10598 10598 -10606 10630 10630 -10640 10671 10671 -10690 10719 10719 -10728 10752 10795 -10795 10837 10837 -10837 10876 10876 -10876 10900 10900 -10900 10948 10948 -10960 11021 11103 -11103 11128 11128 -11128 11153 11153 -11153 11216 11216 -11216 11239 11239 -11239 11303 11303 -11303 11347 11347 -11357 11393 11393 -11393 11432 11432 -11442 11494 11494 -11494 11536 11536 -11536 11595 11595 -11595 11622 11622 -11622 11684 11684 -11684 11726 11726 -11738 11778 11778 -11782 11813 11813 -11813 11850 11850 -11850 11900 12087 -12111 12120 12120 -12120 12129 12129 -12129 12158 12158 -12158 12192 12192 -12192 12237 12237 -12237 12273 12273 -12273 12326 12326 -12330 12366 12366 -12366 12423 12423 -12427 12482 12482 -12486 12560 12560 -12568 12631 12631 -12637 12691 12691 -12691 12743 12743 -12743 12785 12785 -12785 12826 12826 -12826 12865 12865 -12865 12883 12883 -12883 12946 12946 -12956 12995 12995 -13005 13066 13066 -13077 13163 13163 -13163 13211 13211 -13211 13270 13270 -13270 13318 13318 -13318 13350 13350 -13350 13387 13387 -13387 13428 13428 -13428 13464 13533 -13533 13580 13737 -13737 13776 13854 -13854 13913 13913 -13913 13950 13950 -13950 14118 14118 -14118 14150 14150 -14150 14163 14194 -14194 14224 14255 -14255 14275 14319 -14319 14353 14458 -14466 14484 14530 -14534 14567 14567 -14567 14635 14682 -14690 14742 14742 -14742 14789 14789 -14801 14875 14875 -14886 14947 14947 -14947 14992 14992 -14992 15035 15085 -15085 15134 15205 -15214 15267 15448 -15454 15496 16810 -16822 16875 16960 -16972 17053 17179 -17191 17236 17332 -17344 17491 17841 -17853 17939 18304 -18316 18471 18774 -18786 18952 19323 -19335 19364 19496 -19500 19527 19598 -19598 19613 19776 -19797 19808 19837 -19837 19862 19862 -19868 19927 20026 -20034 20075 20179 -20187 20223 20223 -20223 20290 20382 -20392 20441 20589 -20601 20656 20656 -20656 20699 20818 -20826 20860 21038 -21046 21094 21191 -21203 21236 21314 -21326 21395 21457 -21469 21502 21502 -21502 21587 21731 -21756 21789 21864 -21875 21901 21976 -22013 22059 22220 -22257 22397 22561 -22561 22595 22595 -22603 22623 22623 -22631 22667 22828 -22865 22919 22994 -23031 23059 23120 -23132 23201 23201 -23212 23274 23274 -23285 23345 23345 -23356 23393 23393 -23399 23431 23532 -23542 23587 23646 -23656 23697 23745 -23755 23796 23844 -23854 23876 23928 -23942 23971 24153 -24160 24243 24243 -24247 24273 24743 -24755 24784 24984 -24996 25034 25034 -25034 25075 25273 -25281 25332 25410 -25420 25467 25544 -25554 25583 25744 -25754 25783 26061 -26071 26111 26185 -26194 26239 26525 -26535 26568 26914 -26924 26951 26998 -27008 27035 27082 -27093 27120 27167 -27178 27206 27251 -27261 27289 27334 -27345 27391 27931 -27938 27959 28007 -28019 28037 28037 -28043 28069 28069 -28077 28147 28199 -28207 28266 28266 -28274 28306 28306 -28314 28339 28339 -28347 28404 28510 -28518 28567 28682 -28690 28728 28728 -28736 28782 29023 -29033 29085 29234 -29246 29303 29383 -29395 29432 29570 -29592 29631 29644 -29644 29693 29758 -29767 29810 29875 -29875 29911 29976 -29984 30014 30014 -30027 30086 30151 -30157 30223 30293 -30301 30369 30445 -30457 30511 30568 -30580 30630 30743 -30755 30812 30874 -30886 30959 31035 -31043 31076 31175 -31183 31243 31243 -31251 31323 31323 -31331 31433 31433 -31445 31544 31686 -31698 31740 31740 -31740 31783 31783 -31783 31824 31824 -31824 31873 31996 -32008 32056 32164 -32176 32210 32210 -32229 32271 32271 -32279 32323 32569 -32581 32642 32718 -32739 32779 32916 -32926 32953 33047 -33057 33116 33315 -33325 33373 33373 -33373 33407 33469 -33494 33527 33527 -33536 33573 33573 -33584 33650 33697 -33705 33763 33763 -33763 33797 33797 -33797 33829 33906 -33915 33976 33976 -33985 34016 34098 -34098 34133 34198 -34198 34261 34261 -34269 34312 34312 -34324 34363 34438 -34444 34530 34530 -34538 34596 34626 -34636 34675 34754 -34764 34821 34821 -34821 34867 34950 -34959 35016 35135 -35145 35198 35198 -35208 35266 35344 -35355 35382 35537 -35547 35576 35629 -35637 35705 35705 -35713 35764 35764 -35764 35784 35876 -35888 35932 35950 -35950 36013 36138 -36150 36191 36280 -36286 36314 36419 -36431 36516 36516 -36516 36554 36642 -36642 36689 36808 -36818 36881 37105 -37113 37183 37204 -37204 37225 37225 -37225 37255 37348 -37348 37388 37388 -37388 37454 37454 -37454 37518 37518 -37518 37584 37584 -37584 37717 37717 -37717 37752 37752 -37752 37783 37889 -37901 37928 38034 -38046 38115 38115 -38115 38140 38187 -38195 38219 38339 -38351 38422 38422 -38422 38486 38486 -38486 38555 38555 -38555 38619 38619 -38619 38641 38641 -38641 38758 38758 -38758 38929 38929 -38929 38975 39043 -39055 39084 39133 -39133 39175 39265 -39275 39310 39494 -39504 39547 39576 -39587 39614 39668 -39674 39697 39797 -39797 39845 40094 -40094 40158 40264 -40264 40369 40523 -40523 40593 40593 -40593 40629 40876 -40876 40911 40971 -40977 41026 41026 -41038 41077 41077 -41077 41116 41116 -41116 41156 41156 -41156 41195 41195 -41195 41237 41237 -41237 41285 41285 -41285 41304 41304 -41304 41371 41371 -41371 41429 41429 -41429 41491 41491 -41491 41519 41519 -41519 41572 41572 -41572 41642 41642 -41642 41676 41676 -41676 41713 41713 -41713 41751 41751 -41751 41792 41792 -41792 41856 41856 -41856 41881 41881 -41881 41936 41936 -41936 41977 41977 -41977 42018 42018 -42018 42090 42090 -42090 42162 42162 -42162 42205 42205 -42205 42267 42267 -42267 42294 42294 -42294 42309 42309 -42309 42338 42386 -42393 42425 42522 -42530 42577 42577 -42577 42623 42623 -42623 42643 42725 -42725 42748 42748 -42748 42829 42897 -42901 42952 42952 -42952 42978 43025 -43025 43116 43116 -43116 43171 43171 -43171 43204 43376 -43386 43453 43471 -43471 43547 43780 -43798 43921 44116 -44120 44120 44120 -Out of memory: %s -There is no more memory left in the system for compiling this program. -Internal Error Unknown Error Message %s -1) An internal error, while attempting to print an unavailable message -2) The error message file is inaccessible or has other problems -Unknown Signal %s -1) An unknown signal has been caught -2) 2 Nested signals -line -Warning: -Fatal: -Source not available -Too many errors... goodbye. -There is a limit of 30 errors before aborting. -Error: -reserved -reserved -Unknown Control Statement -1) The line begins with a '#' and is not of the form: - # "" -2) Please compile this program with the preprocessor enabled. -Unknown character %s ignored -The character is not part of the source character set. -2.2.1 -Unknown control character \%s ignored -The control character is not part of the source character set. -2.2.1 -Illegal character %s in exponent -1) Digits or sign expected after 'e' or 'E'. -2) Digits are expected after sign in exponent. -3.1.3.1 -Constant is out of range and may be truncated. -The constant is too large to be accurately represented and may be -truncated. The limits are in the system include file limits.h. -2.2.4.2 -Constant is out of range for a 32-bit data type, but accepted as written. -The constant is too large to fit in a 32-bit data type, but will be -accurately represented in a wider data type. The value may be truncated, -depending on its context. The limits are in the system include file -limits.h. -2.2.4.2 -Character constant size out of range -1) No characters in a character constant. -2) More than 4 bytes in a character constant. -3.1.3.4 -Wide character constant size out of range -1) No characters in the multibyte sequence (0 assumed). -2) More than 1 byte in the multi-byte sequence (only the first byte was converted). -3.1.3.4 -Invalid multibyte character -4.10.7.2 -Newline in string or character constant -1) Terminate your string or character constant with closing quotes. -2) Put a backslash before the newline. -3.1.3.4, 3.1.4 -Octal character escape too large: %s > %s -1) Terminate end of octal sequence with a non-octal character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Hex character escape too large: %s > %s -1) Terminate end of hex sequence with a non-hex character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Unexpected End-of-file -1) Unterminated string or character constant -2) Missing closing comment marker (*/) -3) File system problems -Unrecognized escape sequence in string \%s -Recognized escape sequences are \a, \b, \f, \n, \r, \t, and \v. -Character will be treated as un-escaped. -3.9.2 -Illegal octal digit %s -Octal constants, beginning with 0, must only have digits between 0 and 7, -inclusive. -3.1.3.2 -Unable to open temporary file for compiling %s -1) TMPDIR environment variable is set to a directory that you have no - permissions for. -2) The file system is full. -3) System errors beyond the scope of the compiler. -%s: Hangup -%s: Interrupt -%s: Quit (ASCII FS) -%s: Illegal instruction (not reset when caught) -%s: Trace trap (not reset when caught) -%s: IOT instruction -Also SIGABRT, used by abort, replace SIGIOT in the future -%s: EMT instruction -Also SIGXCPU, Exceeded CPU time limit -%s: Floating point exception -%s: Kill (cannot be caught or ignored) -%s: Bus error -%s: Segmentation violation -%s: Bad argument to system call -%s: Write on a pipe with no one to read it -%s: Alarm clock -%s: Software termination signal from kill -%s: User defined signal 1 -%s: User defined signal 2 -%s: Death of a child -Power-fail restart -%s: Also SIGXFSZ, exceeded file size limit -%s: Window change -%s: Handset, line status change -%s: Sendablestop signalnot from tty -%s: Stop signal from tty -%s: Pollable event occurred -%s: Input/Output possible signal -%s: Urgent condition on IO channel -%s: Window size changes -%s: Virtual time alarm -%s: Profiling alarm -%s: Continue a stopped process -%s: To readers pgrp upon background tty read -%s: Like TTIN for output if (tp->t_local<OSTOP) -%s: Resource lost (eg, record-lock) -'auto' and 'register' are not allowed in an external declaration -3.7(10) -must have function type -3.7.1(30) -Functions cannot return arrays -3.7.1(33), 3.3.2.2 -Declaration list not allowed -3.7.1(5) -Too many input files %s -The command line may contain only one file -cpp internal error: input stack underflow -cpp internal error: if stack underflow -Cannot open the file %s -No new-line character at the end of the file %s -2.1.1.2(30) -Fatal: Exceeded the limit of nesting level for #include file -Fatal: Exceeded the limit of nesting level for #include file. This limit -is 200. -Fail to read the file %s -Cannot write the file %s -%s: %s: An if directive is not terminated properly in the file -%s: %s: nested comment -%s:%s: Illegal macro name %s; macro name shall be an identifier -%s:%s: Illegal preprocessing token sequence -3.8.3(35) -%s:%s: Illegal macro parameter name -%s:%s: Non-unique macro parameter name -3.8.3(18) -%s:%s: Missing ')' in parameter list for #define %s -%s:%s: Missing ')' in macro instantiation -%s:%s: Bad punctuator in the parameter list for #define %s -%s:%s: Macro %s redefined. -%s:%s: # operator should be followed by a macro argument name -%s:%s: Badly formed constant expression%s -3.4(9), 3.8 -%s:%s: Division by zero in #if or #elif -3.8 -unknown command line option %s -extraneous input/output file name %s -%s: %s: Unterminated string or character constant -A preprocessing string or character constant token was not -terminated. Note that preprocessing directives are processed -after the source file has been divided into preprocessing tokens. -2.1.1.2(30) 3.1(18) 3.8 -%s: %s: -%s: %s: -%s: %s: Unterminated comment -%s: %s: Unknown directive type %s -%s: %s: #elif or #else after #else directive -%s: %s: Bad identifier after the %s -%s: %s: #%s accepts only one identifier as parameter -3.8 -%s: %s: Bad identifier after the %s -%s: %s: text following #%s violates the ANSI C standard. -3.8 -%s: %s: Bad character %s occurs after the # directive. -3.8 -%s: %s: the ## operator shall not be the %s token in the replacement list -3.8.3.3 -%s: %s: the defined operator takes identifier as operand only. -3.8.1 -%s: %s: Not in a conditional directive while using %s -%s: %s: Illegal filename specification for #include -%s: %s: Invalid file name %s for #include -%s: %s: Cannot open file %s for #include -%s: %s: Bad argument for #line command -%s: %s: #error %s -%s: %s: Tried to redefine predefined macro %s, attempt ignored -3.8.7(22) -%s: %s: Undefining predefined macro %s -3.8.7(22) -%s: %s: Undefined the ANSI standard library defined macro %s -4.1.2.1(9) -%s: %s: The number of arguments in the macro invocation does not match the definition -%s: %s: Illegal character %s in preprocessor if -%s: %s: Illegal character %s for number in preprocessor if -%s: %s: No string is allowed in preprocessor if -%s: %s: Not supported pragma %s -%s: %s: Not supported #pragma format -%s: %s: ANSI C does not allow #ident; %s -%s: %s: Not supported #ident format -This cpp extension accepts the following format: -#ident "any string" -%s: %s: Not supported #assert/#unassert format -This cpp extension accepts the following format: -#assert identifier -#assert identifier ( pp-tokens ) -#unassert identifier -#unassert identifier ( pp-tokens ) -%s: %s: Bad assertion predicate format -The correct syntax for this cpp extension is: -#assert identifier ( pp-token ) -%s: %s: directive is an upward-compatible ANSI C extension -%s: This option requires an argument -%s: %s: A macro has expanded recursively more than %s times. Further expansion will be disabled! Use command-line option: -Wp,-max_rec_depth=depth to recurse deeper. -A status return from cpp to cfe -Syntax Error -The token read was unexpected. -Syntax Error -- cannot backup -The token read was unexpected. -Yacc stack overflow -The expression is too complicated to parse. -Trailing comma in enumerator list -The use of a trailing comma in an enumerator list is not standard C. There -may be portability problems. -3.5.2.2 -Empty declaration -Empty declarations are invalid in standard C. -3.5 -%s declared, but not referenced. -redeclaration of '%s'; previous declaration at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -'%s' undefined; reoccurrences will not be reported. -Non-function name referenced in function call. -3.3.2.2(18) -The number of arguments doesn't agree with the number in the declaration. -3.3.2.2(5) -'%s' section name longer than 8 characters. Name truncated. -'%s' is already placed by pragma alloc_text. -Cannot write ucode file while compiling %s -1) The file system is full -2) Permissions problem -Must have corresponding formal argument for '%s' -Parameter found in the declaration part, but not in the argument list. -3.7.1(7) -Non-prototype declaration is an obsolescent feature. -The use of function definitions with separate parameter identifier -and declaration lists (not prototype-format parameter type and -identifier declarators) is an obsolescent feature. -3.9.5 -Incompatible function declarations for %s -For two function types to be compatible, both shall specify compatible -return types. Moreover, the parameter type lists, if both are present, -shall agree in the number of parameters and in use of the ellipsis -terminator; corresponding parameters shall have compatible types. If -one type has a parameter type list and the other type is specified by -a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. If one type has a parameter type list and the -other is specified by a function definition that contains a (possibly -empty) identifier list, both shall agree in the number of parameters, -and the type of each prototype parameter shall be compatible with the -type that results from application of the default argument promotions -to the type of the corresponding identifier. (For each parameter -declared with function or array type, its type for these comparisons -is the one that results from conversion to a pointer type. For each -parameter declared with qualified type, its type for these comparisons -is the unqualified version of its declared type.) There you have it! -3.5.4.3(15) -Incompatible function return type for this function. -For two function types to be compatible, both shall specify compatible -return types. -3.5.4.3(15) -The number of parameters for function is different from the previous declaration -The parameter type lists, if both are present, shall agree in the -number of parameters and in use of the ellipsis terminator. -3.5.4.3(15) -Incompatible type for the function parameter -If both parameter type lists are present, corresponding -parameters shall have compatible types. -3.5.4.3(15) -Function %s is redeclared with an incompatible argument type (after default argument promotion), which could lead to undefined run-time behaviour. -The redeclaration could cause arguments at a call site to be passed -inconsistently with what the function implementation expects, and -parameters would therefore be accessed erroneously when executing the -function body. Note that a float argument is promoted to a double -when passed (potentially through fp registers) to an unprototyped -function. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, ellipsis terminator not allowed -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the type of each parameter shall be -compatible with the type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype declaration and non-prototype definition found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other is specified by a -function definition that contains a (possibly empty) identifier list, -both shall agree in the number of parameters, and the type of each -prototype parameter shall be compatible with the type that results -from application of the default argument promotions to the type of the -corresponding identifier. -3.5.4.3(15) -Empty declaration specifiers -Standard C requires at least a storage class specifier, type specifier, -or a type qualifier in declarations. 'extern int' assumed. -3.5 -Can't write to the file %s -1) The output file cannot be opened for writing. -2) Out of file space. -Duplicate '%s' -typedef, extern, static, auto, register, const, volatile may not -appear more than once in the same specifier list or qualifier list. -Duplicate occurrence ignored. -3.5.1(10) , 3.5.3(5) -Null input -There is nothing to compile. -Illegal type combination -3.5.2 -Missing ';' at end of structure / union member declaration -In standard C, each member declaration must be terminated by a ';'. A -terminating ';' is assumed. -3.5.2.1 -Missing member name in structure / union -In standard C, each member declaration have a member name. The missing -member is assumed to not exist. -3.5.2.1 -This variable is initialized twice. -Neither 'const' or 'volatile' have any effect on function results. -Qualifiers only apply to expressions designating an object that -can be altered or examined. -3.5.3(10) -An integer constant expression is required here. -The expression that defines the value of an enumeration constant -shall be an integral constant expression that has a value -representable as an int. -3.5.2.2(28) -(previous declaration of '%s' at line %s in file '%s') -Must be an integer type greater than zero. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -Array size cannot be a long long. -Arrays with more than 2^32 elements are not yet supported. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -bit-field '%s' width is not an integer constant -The expression that specifies the width of a bit-field shall be an -integral constant expression. -3.5.2.1(15) -bit-field '%s' width is negative -The expression that specifies the width of a bit-field shall be -non-negative. -3.5.2.1(15) -bit-field '%s' type required to be int, unsigned int, or signed int. -A bit-field shall have type int, unsigned int, or signed int. -3.5.2.1(30) -bit-field %s's type not integer. -Non-scalar type or pointer type to a non-object for increment or decrement operator. -The operand of the prefix/postfix increment or decrement operator shall have scalar type; if it is of pointer type, it must point to an object. -3.3.2.4(37), 3.3.3.1(25) -Assign value to a function type. -An assignment operator shall have a modifiable lvalue as its left operand. -3.2.2.1(5) -Assign value to an array. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for variable of incomplete type. -The operand of increment and decrement operator shall be a modifiable -scalar lvalue. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -The left-hand side of the '.' operator must be an addressable lvalue, when a bit-field is not contained within a unit of 32 bits alignment. -This is a restriction in our implementation, which can be worked -around by always accessing long long bit-fields indirectly (i.e. -by means of the '->' operator). -This expression is not an lvalue. -3.2.2.1 -Modified an rvalue. -3.2.2.1 -Change value for constant variable. -The operand of increment and decrement operators shall be modifiable -scalar lvalues. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for constant field of a struct or union. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Dereferenced a non-pointer. -The operand of the unary * operator shall have pointer type. -3.3.3.2(39) -The operand of the unary + or - operator shall have arithmetic type. -3.3.3.3(6) -The operand of the unary ~ operator shall have integral type. -3.3.3.3(6) -The operand of the unary ! operator shall have scalar type. -3.3.3.3(6) -Constants must have arithmetic type. -3.1.3 -Bad type name for cast operator -The type name for the cast operator should either be void or a -qualified or unqualified scalar type. -3.3.4(22) -Improper cast of non-scalar type expression. -The operand for the cast operator shall be of scalar type. -3.3.4(23) -Cast a pointer into a non-integral type. -A pointer may be converted to an integral type. -3.3.4(31) -Cast a non-integral type into a pointer. -An integral type may be converted to a pointer. -3.3.4(31) -Duplicate member '%s' -Two members of a struct may not have the same name. -3.1.2.2(7,25) -Invalid constant expression. -Constant expressions shall not contain assignment, increment, decrement, -function-call, or comma operators, except when they are contained within -the operand of the sizeof operator. -3.4(9) -Constant expressions must be derived from a constant value or a constant -variable. -3.4 -Dangerous operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. This operand is NOT an lvalue, but we let it pass. -Note that a segmentation error with possible core dump will result -when the resulting address does not denote a valid (declared) -storage location. This feature will be discontinued in future -releases of the compiler! -3.3.3.2(36) -Unacceptable operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. -3.3.3.2(36) -'&' before array or function; ignored -Unacceptable operand of sizeof operator. -The sizeof operator shall not be applied to an expression that has -function type or an incomplete type, to the parenthesized name of such -a type, or to an lvalue that designates a bit-field object. -3.3.3.4 -Unacceptable operand of a multiplicative operator. -Each of the operands of a multiplicative operator shall have arithmetic type. -3.3.5(18) -Unacceptable operand of the remainder operator -Each of the operands of the remainder (%) operator shall have integral type. -3.3.5(18) -Unacceptable operand of '+'. -For the + operator, either both operands shall have arithmetic type, or -one operand shall be a pointer to an object type and the other shall -have integral type. -3.3.6(39) -Unacceptable operand of '-'. -For the subtraction operator, one of the following shall hold: both operands -have arithmetic type; operands are pointers to qualified or unqualified -versions of compatible object types; or the left operand is a pointer -to an object type and the right operand has integral type. -3.3.6(39) -Unacceptable operand of shift operator. -Each of the operands of bitwise shift operators shall have integral type. -3.3.7(9) -Unacceptable operand of relational operator. -For relational operators, one of the following shall hold: both -operands have arithmetic type; both operands are pointers to qualified -or unqualified versions of compatible object types; or both operands -are pointers to qualified or unqualified versions of compatible -incomplete types. -3.3.8(32) -Unacceptable operand of == or != -For the == or != operator, one of the following shall hold: both operands -are pointers to qualified or unqualified versions of compatible types; one -operand is a pointer to an object or incomplete type and the other is a -pointer to a qualified or unqualified version of void; or one operand is -a pointer and the other is a null pointer constant. -3.3.9(21) -Unacceptable operand of &. -Each of the operands shall have integral type. -3.3.10(7) -Unacceptable operand of ^. -Each of the operands shall have integral type. -3.3.11(18) -Unacceptable operand of |. -Each of the operands shall have integral type. -3.3.12(30) -Unacceptable operand of &&. -Each of the operands shall have scalar type. -3.3.13(7) -Unacceptable operand of ||. -Each of the operands shall have scalar type. -3.3.14(20) -Unacceptable operand of conditional operator. -The first operand of conditional operator shall have scalar type. One -of the following shall hold for the second and third operands: -both operands have arithmetic type; both operands have compatible -structure or union types; both operands have void type; both operands -are pointers to qualified or unqualified versions of compatible types; -one operand is a pointer and the other is a null pointer constant; or -one operand is pointer to an object or incomplete type and the other -is a pointer to a qualified or unqualified version of void. -3.3.15 -Duplicate label '%s' -A label name can only occur once in a function. -3.1.2.1(25) -Division by zero. -3.3.5 -Subscripting a non-array. -3.3.2.1 -Subscripting an array of incomplete type which is not an object type. -The element of the array shall have an object type. -3.3.2.1 -Should only subscript an array with an integral expression -3.3.2.1 -Subscripting an unbounded array -3.3.2.1 -Array index out of range -3.3.2.1 -Selector requires struct/union pointer as left hand side -In K&R mode the expression is implicitly converted to the '.' selector -for a struct/union left-hand side. -3.3.2.3 -Selector requires struct/union as left hand side -In K&R mode the expression is implicitly converted to the '->' selector -for a struct/union pointer left-hand side. -3.3.2.3 -member of structure or union required -3.3.2.3 -types have different qualifier specifications -For two qualified types to be compatible, both shall have the -identically qualified version of a compatible type; qualified -and unqualified versions of a type are distinct types. For two -types to be compatible their types must be the same. -3.5.3(26) -Incompatible array type due to different array size -For two array types to be compatible, both shall have compatible element -types; if both size specifiers are present, they shall have the -same value. -3.5.4.2(11) -Incompatible array type due to incompatible element type -For two array types to be compatible, both shall have compatible element -types. -3.5.4.2(11) -Incompatible pointer type assignment -The type pointed to by the left-hand side of simple assignment -statement is incompatible with the type pointed to by the right-hand side. -3.3.16.1, 3.5.4.1(21) -Incompatible base type of pointer type -K&R feature. -Type %s of %s is incompatible with type %s of %s -Incompatible types can be resolved by casting or by other means. -3.3.16.1 -illegal combination of pointer and integer -Assigning an integral expression to a pointer is a bad practice. -Type for %s is incompatible with %s -Incompatible types can be resolved by casting or by other means. -3.1.2.6 -Bad operand type for += or -= -3.3.16.2(26) -A case or default label appears outside a switch statement -A case or default label shall appear only in a switch statement. -3.6.1 -The controlling expression of the if statement is not scalar type -The controlling expression of an if statement shall have scalar type. -3.6.4.1 -The controlling expression of switch statement is not integral type -The controlling expression of an switch statement shall have integral type. -3.6.4.2(20) -The case label is not an integral constant expression -The case label shall be an integral constant expression. -3.6.4.2(22) -Duplicate case label in the same switch statement -No two of the case constant expressions in the same switch statement -shall have the same value after conversion. -3.6.4.2(22) -More than one default label in the same switch statement -There may be at most one default label in a switch statement. -3.6.4.2(23) -The controlling expression of the iteration statement is not scalar -type -The controlling expression of a iteration statement shall have scalar -type. -3.6.5.1 -label '%s' used, but not defined -The identifier in a goto statement shall name a label located -somewhere in the enclosing function. -3.6.6.1 -A continue statement shall appear only in or as a loop body -3.6.6.2 -A break statement shall appear only in or as a switch body or loop body -3.6.6.3 -A return statement with an expression should not appear -in a function '%s', whose return type is void -3.6.6.4(24) -A return statement without an expression appears in a -function '%s', whose return type is not void -If a return statement without an expression is executed, and the value -of the function call is used by the caller, the behavior is undefined. -3.6.6.4(33) -Internal Error: statement stack underflow -Long double not supported; double assumed. -Long float not standard; double assumed. -Only 'register' allowed in parameter declaration -The only storage-class specifier that shall occur in a parameter -declaration is 'register'; illegal storage class ignored. -3.5.4.3(25) -Name(s) without types in a function declaration -An old-style function declaration is not allowed to have names -in the parameter list; useless names ignored -3.5.4.3(26) -Functions cannot return functions -3.7.1(33), 3.3.2.2 -Functions cannot return a non-object type -3.3.2.2 -enum declaration must contain enum literals -Although structs or unions may delay the declaration of their members, -a similar construction with enum does not exist and is not necessary, -as there can be no mutual dependencies between the declaration of an -enumerated type and any other type. -3.5.2.3(27) -Register qualification has no effect for this type of object -Register declarations for array, struct, and function types have -no effect. -3.5.1(16), 3.5.1(19) -Functions cannot be declared 'register' -The declaration of an identifier for a function that has block -scope shall have no explicit storage-class specifier other than -'extern'. -3.5.1(19) -'%s' cannot be initialized -The type of the entity to be initialized shall be an object type -or an array of unknown size. -3.5.7(32) -Cannot initialize 'extern' variable '%s' within a function -If the declaration of an identifier has block scope, and the -identifier has 'extern' or 'static' linkage, the declaration -shall have no initializer for the identifier; initialization -allowed anyway. -3.5.7(35) -initializing an 'extern' is an ANSI C extension -conflicting declarations for '%s' -'static' and 'extern' declarations conflict. Which is meant? -3.1.2.2(15), 3.1.2.2(27) -Too many initial values for '%s' -3.5.7(1) -incompatible types in initialization -3.3.16(35) -redefinition of '%s'; previous definition at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -bit-fields as members of a union are an ANSI C invention. -storage size for '%s' isn't known -type mismatch in initialization -Missing braces in a union initialization or illegally formed -initialization. -3.5.7(5) -union '%s' only allowed one initializer for the first member -3.5.7(5) -width of '%s' exceeds its type -the specified bitfield width is too large to be contained within a -bitfield type. -structure has no member named '%s' -This is allowed for compatibility with AT&T pcc-based compilers. -Reference of an expression of void type or an incomplete type. -3.2.2.1 -element size of an array shall not be zero -3.2.2.5(25) -invalid combination of type specifiers -Although order is unimportant, not all type specifiers can occur together. -3.5.2 -declaration must at least declare an identifier, tag, or the member of an enumeration -3.5(16) -at most one storage class may be given in the declaration -Duplicate occurrence ignored. -3.5.1(10) -size of function's return type is zero -The return type of a function must be void or an object type other than array. -3.7.1(33) -Expecting an integral return type from the main function -identifier missing from parameter declaration -Prototypes for function definitions require identifiers in parameter -declarations. -3.7.1(4) -only 'register' allowed for storage class for parameters -The declarations in the declaration list shall contain no storage class -other than 'register', and no initializations. -3.7.1(10) -parameters declarations can not have initializations -3.7.1(10) -only one instance of 'void' allowed in the parameter list -'void' must occur by itself (specifying that the function has no parameters). -3.5.4.3(1) -%s must have function type -1) An argument list must be explicitly present in the declarator; it cannot - be inherited from a typedef (3.5.4.3). -2) The declarator is not a function. -3.7.1(30) -Illegal hexadecimal constant -You have no digits after the 0x or 0X. 0x0 assumed. -3.1.3.2 -value overflows its type in this context. Value is set to be '%s'! -3.2.1.4 -value is outside range representable for type '%s' -missing member name -K&R mode permits a missing member name; otherwise, only bitfields can omit -the member name. -3.5.2.1(10) -useless keyword or type name in declaration -Type was ignored. -'%s' declared within and is limited to this function prototype -Possible program error, since parameter type checking will always fail -unless the type declaration is visible to the caller. -3.1.2.1(35) -Extra spaces within operator, %s assumed -In ANSI C, the compound assignment operator cannot have embedded -white space characters. -3.1.5 -missing size for array '%s' -Incomplete types permitted for identifiers with internal or -external linkage, but not automatic linkage. -3.1.2.5(10) -can't jump into (from outside of) the body of a 'try' or into either type of handler -'%s' missing, please #include excpt.h -excpt.h required to declare exception statements, intrinsics or compiler -runtime names. -local function declarations cannot be 'static' -A function declaration can only contain the storage-class 'static' -if it is at file scope. Declaration made 'extern'. -3.5.1(19) -static function '%s' declared and referenced, but not defined. -If an identifier declared with internal linkage is used in an -expression (other than as a part of the operand of a sizeof -operator), there shall be exactly one external definition for -the identifier in the translation unit. -3.7(12) -pragma argument '%s' must be declared prior to being used in a pragma -Pragma name ignored. -Pragma not supported -'%s' not enabled as intrinsic -It may have already appeared in a function pragma, or never occurred in -an intrinsic pragma. -'%s' is already enabled as an intrinsic -weak definition for '%s' is later redefined; pragma weak ignored. -definition of primary name '%s' not found; pragma weak ignored. -definition of secondary name '%s' not found; pragma weak ignored. -primary name '%s' is declared as a common or external, and is not defined -with initial value within this file; pragma weak ignored. -useless '%s' storage class ignored -array of functions not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -array of voids not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -argument for pragma pack must be an integer constant; pragma ignored -'%s' has wrong tag type. -Identifier redeclared in the same scope/block. -3.1.2.3 -missing dimension bound -For multidimensional arrays, the constant bounds of the array may be -omitted only for the first member of the sequence. -3.1.2.5(23) -Internal error in parameters to function substr; loc: '%s'; len: '%s'. -Internal error in parameters to function insertstr; indx: '%s'. -Internal error in function get_tag_name; input is a non-tagged type. -Internal error in function gen_type_str -- not a type tree '%s' -Cannot open file '%s' -Prototype should be moved after tag or a typedef declaration. -Please look for comments in the extracted header file. -The extracted header file includes prototypes for static functions, -which should be removed, if you wish to include the header in a source file -other than the originator. -ANSI C requires formal parameter before "..." -This extension is meant to be used for compatibility with varargs.h -3.5.4.3(35) -syntax error: "&..." invalid -extension used to access "..." formal arguments. -function '%s' initialized like a variable -The type of entity to be initialized shall be an object type or an -array of unknown size. -3.5.7(31) -initializer not an array aggregate -The initializer for an object that has aggregate type shall be a -brace-enclosed list of initializers for the members of the aggregate, -written in increasing subscript or member order. -3.5.7(20) -'%s' type is incomplete; cannot initialize -Was the struct ever defined? -3.5.7.(31) -'%s' is not standard ANSI. -This keyword/type is not defined in strict ANSI mode. -3.1.1 -not a legal asm string -The first operand of an asm string should be, after argument substitution, -a legal assembly string. -The -float option will be ignored in ANSI mode. -The -float option is ignored, since otherwise program semantics would -violate the ANSI standard. In particular, fp constants are always -'double' with ANSI-C, while with -float the type of fp constants will -depend on the context and may be 'float'. -ANSI C support unavailable with C compiler bundled with RISC/os -The C compiler bundled with RISC/os does not support ANSI C. ANSI -C support requires a separate license. -Ignored invalid warning number(s) in -woff option, %s%s ! -Warning numbers must be in the range %s to %s. -The set of warning numbers in cfe is disjoint from the set of warning numbers -in accom, since accom warnings cannot be mapped one-to-one to cfe warnings. -'%s' not handled as an intrinsic due to incompatible argument types . -'__unalign' only qualifies pointers -'__unalign' indicates the object pointed at by pointer is unaligned (e.g., -int * __unalign p). This is an extension to ANSI C and like 'volatile' -and 'const' can follow the '*' in pointer declarations, but unlike both -cannot qualify a base type. -index expression is an anachronism -ANSI C++ doesn't support array index expressions in delete. -5.3.4 -member cannot be of function or incomplete type. -3.5.2.1(12) -Illegal lint option, '%s', is ignored. -cannot open header message buffer file -cannot write header message buffer file -cannot read header message buffer file -cannot seek in header message buffer file -struct/union/enum '%s' is used, but not defined -static '%s' unused -nonportable character comparison (chars may be signed or unsigned) -redundant comparison of unsigned with constant expression -redundant statement, control flow cannot reach this statement -'%s' may be used before set -function parameter '%s' is not used in function '%s' -'%s' can be const qualified, since it is not set within its lifetime. -'%s' is not used in function '%s' -'%s' set but unused in function '%s' -control may fall through %s statement -function '%s' has return(e); and return; -function '%s' may return random value to place of invocation %s -label without goto: '%s' -width of %s constant is smaller than size of type (%s) -explicit conversion from '%s' to '%s' %s -implicit conversion from '%s' to '%s' %s -'%s' may be indistinguishable from '%s' due to internal name truncation -Promoted formal parameter and promoted argument have incompatible types -No prototype for the definition of '%s' %s -References to '%s' are substituted by its literal initializer - (as included in %s) -============== -unsupported language linkage -string-literal specifies an unsupported linkage -7.4(1) -No prototype for the call to %s -To achieve better type-checking, there should be a full prototype for -the function being called. -3.5.4.3 -'inline' only applies to function declarations -leave statment can occur only within try body -Microsoft extension -Use of a Microsoft extension detected without usage of the -compiler option -msft. -No parameter mentioned -A file with no declarations or definitions is accepted as an extension to ANSI C -The translation unit must contain at least one external definition. -3.7 -Incompatible signed and unsigned version of a type -Yacc initialization error -Internal error: yacc cannot initialize itself. -The cfe option %s may not be in future releases. We suggest that you not use this option! -Incompatible char and unsigned char versions of a type -Lshift with undefined behaviour. -Lshift with a negative right operand, or a right operand that is greater -than or equal to the width in bits of the promoted left operand, results -in undefined behaviour. -3.3.7(11) -useless type name in declaration, possibly a semicolon is missing. -Type was ignored. -constant initializer expression is invalid (refers to automatic variables). -All the expressions in an initializer for an object that has static storage -duration or in the initializer list for an object that has aggregate or -union type shall be constant expressions. Otherwise, unexpected results -may occur. -3.5.7(32) and 3.4 -invalid explicit or implicit conversion of an address constant to an integral value in a constant initializing expression. -An address constant in a constant initializing expression can neither -initialize a bit-field nor be directly or indirectly converted to an -integral type of size different from an address type. -6.4 diff --git a/tools/ido_recomp/macos/5.3/ugen b/tools/ido_recomp/macos/5.3/ugen deleted file mode 100755 index add44a34d..000000000 Binary files a/tools/ido_recomp/macos/5.3/ugen and /dev/null differ diff --git a/tools/ido_recomp/macos/5.3/ujoin b/tools/ido_recomp/macos/5.3/ujoin deleted file mode 100755 index 5e7ed4789..000000000 Binary files a/tools/ido_recomp/macos/5.3/ujoin and /dev/null differ diff --git a/tools/ido_recomp/macos/5.3/uld b/tools/ido_recomp/macos/5.3/uld deleted file mode 100755 index 64fc3899c..000000000 Binary files a/tools/ido_recomp/macos/5.3/uld and /dev/null differ diff --git a/tools/ido_recomp/macos/5.3/umerge b/tools/ido_recomp/macos/5.3/umerge deleted file mode 100755 index c66ef9f2f..000000000 Binary files a/tools/ido_recomp/macos/5.3/umerge and /dev/null differ diff --git a/tools/ido_recomp/macos/5.3/uopt b/tools/ido_recomp/macos/5.3/uopt deleted file mode 100755 index 0872f9c17..000000000 Binary files a/tools/ido_recomp/macos/5.3/uopt and /dev/null differ diff --git a/tools/ido_recomp/macos/5.3/usplit b/tools/ido_recomp/macos/5.3/usplit deleted file mode 100755 index 2a7c35188..000000000 Binary files a/tools/ido_recomp/macos/5.3/usplit and /dev/null differ diff --git a/tools/ido_recomp/macos/7.1/as0 b/tools/ido_recomp/macos/7.1/as0 deleted file mode 100755 index 9a2fd2f0a..000000000 Binary files a/tools/ido_recomp/macos/7.1/as0 and /dev/null differ diff --git a/tools/ido_recomp/macos/7.1/as1 b/tools/ido_recomp/macos/7.1/as1 deleted file mode 100755 index e91f7d1a2..000000000 Binary files a/tools/ido_recomp/macos/7.1/as1 and /dev/null differ diff --git a/tools/ido_recomp/macos/7.1/cc b/tools/ido_recomp/macos/7.1/cc deleted file mode 100755 index b487956f2..000000000 Binary files a/tools/ido_recomp/macos/7.1/cc and /dev/null differ diff --git a/tools/ido_recomp/macos/7.1/cfe b/tools/ido_recomp/macos/7.1/cfe deleted file mode 100755 index f86fc3743..000000000 Binary files a/tools/ido_recomp/macos/7.1/cfe and /dev/null differ diff --git a/tools/ido_recomp/macos/7.1/err.english.cc b/tools/ido_recomp/macos/7.1/err.english.cc deleted file mode 100644 index b5d5be36e..000000000 --- a/tools/ido_recomp/macos/7.1/err.english.cc +++ /dev/null @@ -1,1260 +0,0 @@ -@ - 358 358 358 - 6464 6482 6553 - 6553 6593 6728 - 6728 6746 6803 - 6803 6808 6808 - 6808 6818 6818 - 6818 6826 6826 - 6826 6847 6847 - 6847 6875 6922 - 6922 6930 6930 - 6930 6939 6939 - 6939 6948 6948 - 6948 6974 7120 - 7120 7149 7204 - 7210 7248 7311 - 7317 7350 7442 - 7450 7497 7627 - 7635 7709 7930 - 7938 7975 8063 - 8071 8113 8253 - 8261 8289 8289 - 8298 8338 8445 - 8460 8502 8635 - 8650 8690 8819 - 8834 8857 8965 - 8965 9008 9113 - 9119 9142 9227 - 9235 9282 9451 - 9451 9462 9462 - 9462 9477 9477 - 9477 9497 9497 - 9497 9545 9545 - 9545 9584 9584 - 9584 9604 9662 - 9662 9682 9720 - 9720 9749 9749 - 9749 9788 9788 - 9788 9802 9802 - 9802 9829 9829 - 9829 9861 9861 - 9861 9904 9904 - 9904 9920 9920 - 9920 9962 9962 - 9962 9988 9988 - 9988 10014 10014 -10014 10035 10035 -10035 10054 10097 -10097 10115 10115 -10115 10147 10147 -10147 10183 10183 -10183 10208 10208 -10208 10236 10236 -10236 10269 10269 -10269 10304 10304 -10304 10328 10328 -10328 10351 10351 -10351 10371 10371 -10371 10402 10402 -10402 10447 10447 -10447 10497 10497 -10497 10533 10533 -10533 10598 10598 -10606 10630 10630 -10640 10671 10671 -10690 10719 10719 -10728 10752 10795 -10795 10837 10837 -10837 10876 10876 -10876 10900 10900 -10900 10948 10948 -10960 11021 11103 -11103 11128 11128 -11128 11153 11153 -11153 11216 11216 -11216 11239 11239 -11239 11303 11303 -11303 11347 11347 -11357 11393 11393 -11393 11432 11432 -11442 11494 11494 -11494 11536 11536 -11536 11595 11595 -11595 11622 11622 -11622 11684 11684 -11684 11726 11726 -11738 11778 11778 -11782 11813 11813 -11813 11850 11850 -11850 11900 12087 -12111 12120 12120 -12120 12129 12129 -12129 12158 12158 -12158 12192 12192 -12192 12237 12237 -12237 12273 12273 -12273 12326 12326 -12330 12366 12366 -12366 12423 12423 -12427 12482 12482 -12486 12560 12560 -12568 12631 12631 -12637 12691 12691 -12691 12743 12743 -12743 12785 12785 -12785 12826 12826 -12826 12865 12865 -12865 12883 12883 -12883 12946 12946 -12956 12995 12995 -13005 13066 13066 -13077 13163 13163 -13163 13211 13211 -13211 13270 13270 -13270 13318 13318 -13318 13350 13350 -13350 13387 13387 -13387 13428 13428 -13428 13464 13533 -13533 13580 13737 -13737 13776 13854 -13854 13913 13913 -13913 13950 13950 -13950 14118 14118 -14118 14150 14150 -14150 14163 14194 -14194 14224 14255 -14255 14275 14319 -14319 14353 14458 -14466 14484 14530 -14534 14567 14567 -14567 14635 14682 -14690 14742 14742 -14742 14789 14789 -14801 14875 14875 -14886 14947 14947 -14947 14992 14992 -14992 15035 15085 -15085 15134 15205 -15214 15267 15448 -15454 15496 16810 -16822 16875 16960 -16972 17053 17179 -17191 17236 17332 -17344 17491 17841 -17853 17939 18304 -18316 18471 18774 -18786 18952 19323 -19335 19364 19496 -19500 19527 19598 -19598 19613 19776 -19797 19808 19837 -19837 19862 19862 -19868 19927 20026 -20034 20075 20179 -20187 20223 20223 -20223 20290 20382 -20392 20441 20589 -20601 20656 20656 -20656 20699 20818 -20826 20860 21038 -21046 21094 21191 -21203 21236 21314 -21326 21395 21457 -21469 21502 21502 -21502 21587 21731 -21756 21789 21864 -21875 21901 21976 -22013 22059 22220 -22257 22397 22561 -22561 22595 22595 -22603 22623 22623 -22631 22667 22828 -22865 22919 22994 -23031 23059 23120 -23132 23201 23201 -23212 23274 23274 -23285 23345 23345 -23356 23393 23393 -23399 23431 23532 -23542 23587 23646 -23656 23697 23745 -23755 23796 23844 -23854 23876 23928 -23942 23971 24153 -24160 24243 24243 -24247 24273 24743 -24755 24784 24984 -24996 25034 25034 -25034 25075 25273 -25281 25332 25410 -25420 25467 25544 -25554 25583 25744 -25754 25783 26061 -26071 26111 26185 -26194 26239 26525 -26535 26568 26914 -26924 26951 26998 -27008 27035 27082 -27093 27120 27167 -27178 27206 27251 -27261 27289 27334 -27345 27391 27931 -27938 27959 28007 -28019 28037 28037 -28043 28069 28069 -28077 28147 28199 -28207 28266 28266 -28274 28306 28306 -28314 28339 28339 -28347 28404 28510 -28518 28567 28682 -28690 28728 28728 -28736 28782 29023 -29033 29085 29234 -29246 29303 29383 -29395 29432 29570 -29592 29631 29644 -29644 29693 29758 -29767 29810 29875 -29875 29911 29976 -29984 30014 30014 -30027 30086 30151 -30157 30223 30293 -30301 30369 30445 -30457 30511 30568 -30580 30630 30743 -30755 30812 30874 -30886 30959 31035 -31043 31076 31175 -31183 31243 31243 -31251 31323 31323 -31331 31433 31433 -31445 31544 31686 -31698 31740 31740 -31740 31783 31783 -31783 31824 31824 -31824 31873 31996 -32008 32056 32164 -32176 32210 32210 -32229 32271 32271 -32279 32323 32569 -32581 32642 32718 -32739 32779 32916 -32926 32953 33047 -33057 33116 33315 -33325 33373 33373 -33373 33407 33469 -33494 33527 33527 -33536 33573 33573 -33584 33650 33697 -33705 33763 33763 -33763 33797 33797 -33797 33829 33906 -33915 33976 33976 -33985 34016 34098 -34098 34133 34198 -34198 34261 34261 -34269 34312 34312 -34324 34363 34438 -34444 34530 34530 -34538 34596 34626 -34636 34675 34754 -34764 34821 34821 -34821 34867 34950 -34959 35016 35135 -35145 35198 35198 -35208 35266 35344 -35355 35382 35537 -35547 35576 35629 -35637 35705 35705 -35713 35764 35764 -35764 35784 35876 -35888 35932 35950 -35950 36013 36138 -36150 36191 36280 -36286 36314 36419 -36431 36516 36516 -36516 36554 36642 -36642 36689 36808 -36818 36881 37105 -37113 37183 37204 -37204 37225 37225 -37225 37255 37348 -37348 37388 37388 -37388 37454 37454 -37454 37518 37518 -37518 37584 37584 -37584 37717 37717 -37717 37752 37752 -37752 37783 37889 -37901 37928 38034 -38046 38115 38115 -38115 38140 38187 -38195 38219 38339 -38351 38422 38422 -38422 38486 38486 -38486 38555 38555 -38555 38619 38619 -38619 38641 38641 -38641 38758 38758 -38758 38929 38929 -38929 38975 39043 -39055 39084 39133 -39133 39175 39265 -39275 39310 39494 -39504 39547 39576 -39587 39614 39668 -39674 39697 39797 -39797 39845 40094 -40094 40158 40264 -40264 40369 40523 -40523 40593 40593 -40593 40629 40876 -40876 40911 40971 -40977 41026 41026 -41038 41077 41077 -41077 41116 41116 -41116 41156 41156 -41156 41195 41195 -41195 41237 41237 -41237 41285 41285 -41285 41304 41304 -41304 41371 41371 -41371 41429 41429 -41429 41491 41491 -41491 41519 41519 -41519 41572 41572 -41572 41642 41642 -41642 41676 41676 -41676 41713 41713 -41713 41751 41751 -41751 41792 41792 -41792 41856 41856 -41856 41881 41881 -41881 41944 41944 -41944 41985 41985 -41985 42026 42026 -42026 42098 42098 -42098 42170 42170 -42170 42213 42213 -42213 42275 42275 -42275 42302 42302 -42302 42317 42317 -42317 42346 42394 -42401 42433 42530 -42538 42585 42585 -42585 42631 42631 -42631 42651 42733 -42733 42756 42756 -42756 42837 42905 -42909 42960 42960 -42960 42986 43033 -43033 43124 43124 -43124 43179 43179 -43179 43212 43384 -43394 43461 43479 -43479 43555 43788 -43806 43929 44124 -44128 44128 44128 -Out of memory: %s -There is no more memory left in the system for compiling this program. -Internal Error Unknown Error Message %s -1) An internal error, while attempting to print an unavailable message -2) The error message file is inaccessible or has other problems -Unknown Signal %s -1) An unknown signal has been caught -2) 2 Nested signals -line -Warning: -Fatal: -Source not available -Too many errors... goodbye. -There is a limit of 30 errors before aborting. -Error: -reserved -reserved -Unknown Control Statement -1) The line begins with a '#' and is not of the form: - # "" -2) Please compile this program with the preprocessor enabled. -Unknown character %s ignored -The character is not part of the source character set. -2.2.1 -Unknown control character \%s ignored -The control character is not part of the source character set. -2.2.1 -Illegal character %s in exponent -1) Digits or sign expected after 'e' or 'E'. -2) Digits are expected after sign in exponent. -3.1.3.1 -Constant is out of range and may be truncated. -The constant is too large to be accurately represented and may be -truncated. The limits are in the system include file limits.h. -2.2.4.2 -Constant is out of range for a 32-bit data type, but accepted as written. -The constant is too large to fit in a 32-bit data type, but will be -accurately represented in a wider data type. The value may be truncated, -depending on its context. The limits are in the system include file -limits.h. -2.2.4.2 -Character constant size out of range -1) No characters in a character constant. -2) More than 4 bytes in a character constant. -3.1.3.4 -Wide character constant size out of range -1) No characters in the multibyte sequence (0 assumed). -2) More than 1 byte in the multi-byte sequence (only the first byte was converted). -3.1.3.4 -Invalid multibyte character -4.10.7.2 -Newline in string or character constant -1) Terminate your string or character constant with closing quotes. -2) Put a backslash before the newline. -3.1.3.4, 3.1.4 -Octal character escape too large: %s > %s -1) Terminate end of octal sequence with a non-octal character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Hex character escape too large: %s > %s -1) Terminate end of hex sequence with a non-hex character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Unexpected End-of-file -1) Unterminated string or character constant -2) Missing closing comment marker (*/) -3) File system problems -Unrecognized escape sequence in string \%s -Recognized escape sequences are \a, \b, \f, \n, \r, \t, and \v. -Character will be treated as un-escaped. -3.9.2 -Illegal octal digit %s -Octal constants, beginning with 0, must only have digits between 0 and 7, -inclusive. -3.1.3.2 -Unable to open temporary file for compiling %s -1) TMPDIR environment variable is set to a directory that you have no - permissions for. -2) The file system is full. -3) System errors beyond the scope of the compiler. -%s: Hangup -%s: Interrupt -%s: Quit (ASCII FS) -%s: Illegal instruction (not reset when caught) -%s: Trace trap (not reset when caught) -%s: IOT instruction -Also SIGABRT, used by abort, replace SIGIOT in the future -%s: EMT instruction -Also SIGXCPU, Exceeded CPU time limit -%s: Floating point exception -%s: Kill (cannot be caught or ignored) -%s: Bus error -%s: Segmentation violation -%s: Bad argument to system call -%s: Write on a pipe with no one to read it -%s: Alarm clock -%s: Software termination signal from kill -%s: User defined signal 1 -%s: User defined signal 2 -%s: Death of a child -Power-fail restart -%s: Also SIGXFSZ, exceeded file size limit -%s: Window change -%s: Handset, line status change -%s: Sendablestop signalnot from tty -%s: Stop signal from tty -%s: Pollable event occurred -%s: Input/Output possible signal -%s: Urgent condition on IO channel -%s: Window size changes -%s: Virtual time alarm -%s: Profiling alarm -%s: Continue a stopped process -%s: To readers pgrp upon background tty read -%s: Like TTIN for output if (tp->t_local<OSTOP) -%s: Resource lost (eg, record-lock) -'auto' and 'register' are not allowed in an external declaration -3.7(10) -must have function type -3.7.1(30) -Functions cannot return arrays -3.7.1(33), 3.3.2.2 -Declaration list not allowed -3.7.1(5) -Too many input files %s -The command line may contain only one file -cpp internal error: input stack underflow -cpp internal error: if stack underflow -Cannot open the file %s -No new-line character at the end of the file %s -2.1.1.2(30) -Fatal: Exceeded the limit of nesting level for #include file -Fatal: Exceeded the limit of nesting level for #include file. This limit -is 200. -Fail to read the file %s -Cannot write the file %s -%s: %s: An if directive is not terminated properly in the file -%s: %s: nested comment -%s:%s: Illegal macro name %s; macro name shall be an identifier -%s:%s: Illegal preprocessing token sequence -3.8.3(35) -%s:%s: Illegal macro parameter name -%s:%s: Non-unique macro parameter name -3.8.3(18) -%s:%s: Missing ')' in parameter list for #define %s -%s:%s: Missing ')' in macro instantiation -%s:%s: Bad punctuator in the parameter list for #define %s -%s:%s: Macro %s redefined. -%s:%s: # operator should be followed by a macro argument name -%s:%s: Badly formed constant expression%s -3.4(9), 3.8 -%s:%s: Division by zero in #if or #elif -3.8 -unknown command line option %s -extraneous input/output file name %s -%s: %s: Unterminated string or character constant -A preprocessing string or character constant token was not -terminated. Note that preprocessing directives are processed -after the source file has been divided into preprocessing tokens. -2.1.1.2(30) 3.1(18) 3.8 -%s: %s: -%s: %s: -%s: %s: Unterminated comment -%s: %s: Unknown directive type %s -%s: %s: #elif or #else after #else directive -%s: %s: Bad identifier after the %s -%s: %s: #%s accepts only one identifier as parameter -3.8 -%s: %s: Bad identifier after the %s -%s: %s: text following #%s violates the ANSI C standard. -3.8 -%s: %s: Bad character %s occurs after the # directive. -3.8 -%s: %s: the ## operator shall not be the %s token in the replacement list -3.8.3.3 -%s: %s: the defined operator takes identifier as operand only. -3.8.1 -%s: %s: Not in a conditional directive while using %s -%s: %s: Illegal filename specification for #include -%s: %s: Invalid file name %s for #include -%s: %s: Cannot open file %s for #include -%s: %s: Bad argument for #line command -%s: %s: #error %s -%s: %s: Tried to redefine predefined macro %s, attempt ignored -3.8.7(22) -%s: %s: Undefining predefined macro %s -3.8.7(22) -%s: %s: Undefined the ANSI standard library defined macro %s -4.1.2.1(9) -%s: %s: The number of arguments in the macro invocation does not match the definition -%s: %s: Illegal character %s in preprocessor if -%s: %s: Illegal character %s for number in preprocessor if -%s: %s: No string is allowed in preprocessor if -%s: %s: Not supported pragma %s -%s: %s: Not supported #pragma format -%s: %s: ANSI C does not allow #ident; %s -%s: %s: Not supported #ident format -This cpp extension accepts the following format: -#ident "any string" -%s: %s: Not supported #assert/#unassert format -This cpp extension accepts the following format: -#assert identifier -#assert identifier ( pp-tokens ) -#unassert identifier -#unassert identifier ( pp-tokens ) -%s: %s: Bad assertion predicate format -The correct syntax for this cpp extension is: -#assert identifier ( pp-token ) -%s: %s: directive is an upward-compatible ANSI C extension -%s: This option requires an argument -%s: %s: A macro has expanded recursively more than %s times. Further expansion will be disabled! Use command-line option: -Wp,-max_rec_depth=depth to recurse deeper. -A status return from cpp to cfe -Syntax Error -The token read was unexpected. -Syntax Error -- cannot backup -The token read was unexpected. -Yacc stack overflow -The expression is too complicated to parse. -Trailing comma in enumerator list -The use of a trailing comma in an enumerator list is not standard C. There -may be portability problems. -3.5.2.2 -Empty declaration -Empty declarations are invalid in standard C. -3.5 -%s declared, but not referenced. -redeclaration of '%s'; previous declaration at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -'%s' undefined; reoccurrences will not be reported. -Non-function name referenced in function call. -3.3.2.2(18) -The number of arguments doesn't agree with the number in the declaration. -3.3.2.2(5) -'%s' section name longer than 8 characters. Name truncated. -'%s' is already placed by pragma alloc_text. -Cannot write ucode file while compiling %s -1) The file system is full -2) Permissions problem -Must have corresponding formal argument for '%s' -Parameter found in the declaration part, but not in the argument list. -3.7.1(7) -Non-prototype declaration is an obsolescent feature. -The use of function definitions with separate parameter identifier -and declaration lists (not prototype-format parameter type and -identifier declarators) is an obsolescent feature. -3.9.5 -Incompatible function declarations for %s -For two function types to be compatible, both shall specify compatible -return types. Moreover, the parameter type lists, if both are present, -shall agree in the number of parameters and in use of the ellipsis -terminator; corresponding parameters shall have compatible types. If -one type has a parameter type list and the other type is specified by -a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. If one type has a parameter type list and the -other is specified by a function definition that contains a (possibly -empty) identifier list, both shall agree in the number of parameters, -and the type of each prototype parameter shall be compatible with the -type that results from application of the default argument promotions -to the type of the corresponding identifier. (For each parameter -declared with function or array type, its type for these comparisons -is the one that results from conversion to a pointer type. For each -parameter declared with qualified type, its type for these comparisons -is the unqualified version of its declared type.) There you have it! -3.5.4.3(15) -Incompatible function return type for this function. -For two function types to be compatible, both shall specify compatible -return types. -3.5.4.3(15) -The number of parameters for function is different from the previous declaration -The parameter type lists, if both are present, shall agree in the -number of parameters and in use of the ellipsis terminator. -3.5.4.3(15) -Incompatible type for the function parameter -If both parameter type lists are present, corresponding -parameters shall have compatible types. -3.5.4.3(15) -Function %s is redeclared with an incompatible argument type (after default argument promotion), which could lead to undefined run-time behaviour. -The redeclaration could cause arguments at a call site to be passed -inconsistently with what the function implementation expects, and -parameters would therefore be accessed erroneously when executing the -function body. Note that a float argument is promoted to a double -when passed (potentially through fp registers) to an unprototyped -function. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, ellipsis terminator not allowed -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the type of each parameter shall be -compatible with the type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype declaration and non-prototype definition found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other is specified by a -function definition that contains a (possibly empty) identifier list, -both shall agree in the number of parameters, and the type of each -prototype parameter shall be compatible with the type that results -from application of the default argument promotions to the type of the -corresponding identifier. -3.5.4.3(15) -Empty declaration specifiers -Standard C requires at least a storage class specifier, type specifier, -or a type qualifier in declarations. 'extern int' assumed. -3.5 -Can't write to the file %s -1) The output file cannot be opened for writing. -2) Out of file space. -Duplicate '%s' -typedef, extern, static, auto, register, const, volatile may not -appear more than once in the same specifier list or qualifier list. -Duplicate occurrence ignored. -3.5.1(10) , 3.5.3(5) -Null input -There is nothing to compile. -Illegal type combination -3.5.2 -Missing ';' at end of structure / union member declaration -In standard C, each member declaration must be terminated by a ';'. A -terminating ';' is assumed. -3.5.2.1 -Missing member name in structure / union -In standard C, each member declaration have a member name. The missing -member is assumed to not exist. -3.5.2.1 -This variable is initialized twice. -Neither 'const' or 'volatile' have any effect on function results. -Qualifiers only apply to expressions designating an object that -can be altered or examined. -3.5.3(10) -An integer constant expression is required here. -The expression that defines the value of an enumeration constant -shall be an integral constant expression that has a value -representable as an int. -3.5.2.2(28) -(previous declaration of '%s' at line %s in file '%s') -Must be an integer type greater than zero. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -Array size cannot be a long long. -Arrays with more than 2^32 elements are not yet supported. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -bit-field '%s' width is not an integer constant -The expression that specifies the width of a bit-field shall be an -integral constant expression. -3.5.2.1(15) -bit-field '%s' width is negative -The expression that specifies the width of a bit-field shall be -non-negative. -3.5.2.1(15) -bit-field '%s' type required to be int, unsigned int, or signed int. -A bit-field shall have type int, unsigned int, or signed int. -3.5.2.1(30) -bit-field %s's type not integer. -Non-scalar type or pointer type to a non-object for increment or decrement operator. -The operand of the prefix/postfix increment or decrement operator shall have scalar type; if it is of pointer type, it must point to an object. -3.3.2.4(37), 3.3.3.1(25) -Assign value to a function type. -An assignment operator shall have a modifiable lvalue as its left operand. -3.2.2.1(5) -Assign value to an array. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for variable of incomplete type. -The operand of increment and decrement operator shall be a modifiable -scalar lvalue. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -The left-hand side of the '.' operator must be an addressable lvalue, when a bit-field is not contained within a unit of 32 bits alignment. -This is a restriction in our implementation, which can be worked -around by always accessing long long bit-fields indirectly (i.e. -by means of the '->' operator). -This expression is not an lvalue. -3.2.2.1 -Modified an rvalue. -3.2.2.1 -Change value for constant variable. -The operand of increment and decrement operators shall be modifiable -scalar lvalues. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for constant field of a struct or union. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Dereferenced a non-pointer. -The operand of the unary * operator shall have pointer type. -3.3.3.2(39) -The operand of the unary + or - operator shall have arithmetic type. -3.3.3.3(6) -The operand of the unary ~ operator shall have integral type. -3.3.3.3(6) -The operand of the unary ! operator shall have scalar type. -3.3.3.3(6) -Constants must have arithmetic type. -3.1.3 -Bad type name for cast operator -The type name for the cast operator should either be void or a -qualified or unqualified scalar type. -3.3.4(22) -Improper cast of non-scalar type expression. -The operand for the cast operator shall be of scalar type. -3.3.4(23) -Cast a pointer into a non-integral type. -A pointer may be converted to an integral type. -3.3.4(31) -Cast a non-integral type into a pointer. -An integral type may be converted to a pointer. -3.3.4(31) -Duplicate member '%s' -Two members of a struct may not have the same name. -3.1.2.2(7,25) -Invalid constant expression. -Constant expressions shall not contain assignment, increment, decrement, -function-call, or comma operators, except when they are contained within -the operand of the sizeof operator. -3.4(9) -Constant expressions must be derived from a constant value or a constant -variable. -3.4 -Dangerous operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. This operand is NOT an lvalue, but we let it pass. -Note that a segmentation error with possible core dump will result -when the resulting address does not denote a valid (declared) -storage location. This feature will be discontinued in future -releases of the compiler! -3.3.3.2(36) -Unacceptable operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. -3.3.3.2(36) -'&' before array or function; ignored -Unacceptable operand of sizeof operator. -The sizeof operator shall not be applied to an expression that has -function type or an incomplete type, to the parenthesized name of such -a type, or to an lvalue that designates a bit-field object. -3.3.3.4 -Unacceptable operand of a multiplicative operator. -Each of the operands of a multiplicative operator shall have arithmetic type. -3.3.5(18) -Unacceptable operand of the remainder operator -Each of the operands of the remainder (%) operator shall have integral type. -3.3.5(18) -Unacceptable operand of '+'. -For the + operator, either both operands shall have arithmetic type, or -one operand shall be a pointer to an object type and the other shall -have integral type. -3.3.6(39) -Unacceptable operand of '-'. -For the subtraction operator, one of the following shall hold: both operands -have arithmetic type; operands are pointers to qualified or unqualified -versions of compatible object types; or the left operand is a pointer -to an object type and the right operand has integral type. -3.3.6(39) -Unacceptable operand of shift operator. -Each of the operands of bitwise shift operators shall have integral type. -3.3.7(9) -Unacceptable operand of relational operator. -For relational operators, one of the following shall hold: both -operands have arithmetic type; both operands are pointers to qualified -or unqualified versions of compatible object types; or both operands -are pointers to qualified or unqualified versions of compatible -incomplete types. -3.3.8(32) -Unacceptable operand of == or != -For the == or != operator, one of the following shall hold: both operands -are pointers to qualified or unqualified versions of compatible types; one -operand is a pointer to an object or incomplete type and the other is a -pointer to a qualified or unqualified version of void; or one operand is -a pointer and the other is a null pointer constant. -3.3.9(21) -Unacceptable operand of &. -Each of the operands shall have integral type. -3.3.10(7) -Unacceptable operand of ^. -Each of the operands shall have integral type. -3.3.11(18) -Unacceptable operand of |. -Each of the operands shall have integral type. -3.3.12(30) -Unacceptable operand of &&. -Each of the operands shall have scalar type. -3.3.13(7) -Unacceptable operand of ||. -Each of the operands shall have scalar type. -3.3.14(20) -Unacceptable operand of conditional operator. -The first operand of conditional operator shall have scalar type. One -of the following shall hold for the second and third operands: -both operands have arithmetic type; both operands have compatible -structure or union types; both operands have void type; both operands -are pointers to qualified or unqualified versions of compatible types; -one operand is a pointer and the other is a null pointer constant; or -one operand is pointer to an object or incomplete type and the other -is a pointer to a qualified or unqualified version of void. -3.3.15 -Duplicate label '%s' -A label name can only occur once in a function. -3.1.2.1(25) -Division by zero. -3.3.5 -Subscripting a non-array. -3.3.2.1 -Subscripting an array of incomplete type which is not an object type. -The element of the array shall have an object type. -3.3.2.1 -Should only subscript an array with an integral expression -3.3.2.1 -Subscripting an unbounded array -3.3.2.1 -Array index out of range -3.3.2.1 -Selector requires struct/union pointer as left hand side -In K&R mode the expression is implicitly converted to the '.' selector -for a struct/union left-hand side. -3.3.2.3 -Selector requires struct/union as left hand side -In K&R mode the expression is implicitly converted to the '->' selector -for a struct/union pointer left-hand side. -3.3.2.3 -member of structure or union required -3.3.2.3 -types have different qualifier specifications -For two qualified types to be compatible, both shall have the -identically qualified version of a compatible type; qualified -and unqualified versions of a type are distinct types. For two -types to be compatible their types must be the same. -3.5.3(26) -Incompatible array type due to different array size -For two array types to be compatible, both shall have compatible element -types; if both size specifiers are present, they shall have the -same value. -3.5.4.2(11) -Incompatible array type due to incompatible element type -For two array types to be compatible, both shall have compatible element -types. -3.5.4.2(11) -Incompatible pointer type assignment -The type pointed to by the left-hand side of simple assignment -statement is incompatible with the type pointed to by the right-hand side. -3.3.16.1, 3.5.4.1(21) -Incompatible base type of pointer type -K&R feature. -Type %s of %s is incompatible with type %s of %s -Incompatible types can be resolved by casting or by other means. -3.3.16.1 -illegal combination of pointer and integer -Assigning an integral expression to a pointer is a bad practice. -Type for %s is incompatible with %s -Incompatible types can be resolved by casting or by other means. -3.1.2.6 -Bad operand type for += or -= -3.3.16.2(26) -A case or default label appears outside a switch statement -A case or default label shall appear only in a switch statement. -3.6.1 -The controlling expression of the if statement is not scalar type -The controlling expression of an if statement shall have scalar type. -3.6.4.1 -The controlling expression of switch statement is not integral type -The controlling expression of an switch statement shall have integral type. -3.6.4.2(20) -The case label is not an integral constant expression -The case label shall be an integral constant expression. -3.6.4.2(22) -Duplicate case label in the same switch statement -No two of the case constant expressions in the same switch statement -shall have the same value after conversion. -3.6.4.2(22) -More than one default label in the same switch statement -There may be at most one default label in a switch statement. -3.6.4.2(23) -The controlling expression of the iteration statement is not scalar -type -The controlling expression of a iteration statement shall have scalar -type. -3.6.5.1 -label '%s' used, but not defined -The identifier in a goto statement shall name a label located -somewhere in the enclosing function. -3.6.6.1 -A continue statement shall appear only in or as a loop body -3.6.6.2 -A break statement shall appear only in or as a switch body or loop body -3.6.6.3 -A return statement with an expression should not appear -in a function '%s', whose return type is void -3.6.6.4(24) -A return statement without an expression appears in a -function '%s', whose return type is not void -If a return statement without an expression is executed, and the value -of the function call is used by the caller, the behavior is undefined. -3.6.6.4(33) -Internal Error: statement stack underflow -Long double not supported; double assumed. -Long float not standard; double assumed. -Only 'register' allowed in parameter declaration -The only storage-class specifier that shall occur in a parameter -declaration is 'register'; illegal storage class ignored. -3.5.4.3(25) -Name(s) without types in a function declaration -An old-style function declaration is not allowed to have names -in the parameter list; useless names ignored -3.5.4.3(26) -Functions cannot return functions -3.7.1(33), 3.3.2.2 -Functions cannot return a non-object type -3.3.2.2 -enum declaration must contain enum literals -Although structs or unions may delay the declaration of their members, -a similar construction with enum does not exist and is not necessary, -as there can be no mutual dependencies between the declaration of an -enumerated type and any other type. -3.5.2.3(27) -Register qualification has no effect for this type of object -Register declarations for array, struct, and function types have -no effect. -3.5.1(16), 3.5.1(19) -Functions cannot be declared 'register' -The declaration of an identifier for a function that has block -scope shall have no explicit storage-class specifier other than -'extern'. -3.5.1(19) -'%s' cannot be initialized -The type of the entity to be initialized shall be an object type -or an array of unknown size. -3.5.7(32) -Cannot initialize 'extern' variable '%s' within a function -If the declaration of an identifier has block scope, and the -identifier has 'extern' or 'static' linkage, the declaration -shall have no initializer for the identifier; initialization -allowed anyway. -3.5.7(35) -initializing an 'extern' is an ANSI C extension -conflicting declarations for '%s' -'static' and 'extern' declarations conflict. Which is meant? -3.1.2.2(15), 3.1.2.2(27) -Too many initial values for '%s' -3.5.7(1) -incompatible types in initialization -3.3.16(35) -redefinition of '%s'; previous definition at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -bit-fields as members of a union are an ANSI C invention. -storage size for '%s' isn't known -type mismatch in initialization -Missing braces in a union initialization or illegally formed -initialization. -3.5.7(5) -union '%s' only allowed one initializer for the first member -3.5.7(5) -width of '%s' exceeds its type -the specified bitfield width is too large to be contained within a -bitfield type. -structure has no member named '%s' -This is allowed for compatibility with AT&T pcc-based compilers. -Reference of an expression of void type or an incomplete type. -3.2.2.1 -element size of an array shall not be zero -3.2.2.5(25) -invalid combination of type specifiers -Although order is unimportant, not all type specifiers can occur together. -3.5.2 -declaration must at least declare an identifier, tag, or the member of an enumeration -3.5(16) -at most one storage class may be given in the declaration -Duplicate occurrence ignored. -3.5.1(10) -size of function's return type is zero -The return type of a function must be void or an object type other than array. -3.7.1(33) -Expecting an integral return type from the main function -identifier missing from parameter declaration -Prototypes for function definitions require identifiers in parameter -declarations. -3.7.1(4) -only 'register' allowed for storage class for parameters -The declarations in the declaration list shall contain no storage class -other than 'register', and no initializations. -3.7.1(10) -parameters declarations can not have initializations -3.7.1(10) -only one instance of 'void' allowed in the parameter list -'void' must occur by itself (specifying that the function has no parameters). -3.5.4.3(1) -%s must have function type -1) An argument list must be explicitly present in the declarator; it cannot - be inherited from a typedef (3.5.4.3). -2) The declarator is not a function. -3.7.1(30) -Illegal hexadecimal constant -You have no digits after the 0x or 0X. 0x0 assumed. -3.1.3.2 -value overflows its type in this context. Value is set to be '%s'! -3.2.1.4 -value is outside range representable for type '%s' -missing member name -K&R mode permits a missing member name; otherwise, only bitfields can omit -the member name. -3.5.2.1(10) -useless keyword or type name in declaration -Type was ignored. -'%s' declared within and is limited to this function prototype -Possible program error, since parameter type checking will always fail -unless the type declaration is visible to the caller. -3.1.2.1(35) -Extra spaces within operator, %s assumed -In ANSI C, the compound assignment operator cannot have embedded -white space characters. -3.1.5 -missing size for array '%s' -Incomplete types permitted for identifiers with internal or -external linkage, but not automatic linkage. -3.1.2.5(10) -can't jump into (from outside of) the body of a 'try' or into either type of handler -'%s' missing, please #include excpt.h -excpt.h required to declare exception statements, intrinsics or compiler -runtime names. -local function declarations cannot be 'static' -A function declaration can only contain the storage-class 'static' -if it is at file scope. Declaration made 'extern'. -3.5.1(19) -static function '%s' declared and referenced, but not defined. -If an identifier declared with internal linkage is used in an -expression (other than as a part of the operand of a sizeof -operator), there shall be exactly one external definition for -the identifier in the translation unit. -3.7(12) -pragma argument '%s' must be declared prior to being used in a pragma -Pragma name ignored. -Pragma not supported -'%s' not enabled as intrinsic -It may have already appeared in a function pragma, or never occurred in -an intrinsic pragma. -'%s' is already enabled as an intrinsic -weak definition for '%s' is later redefined; pragma weak ignored. -definition of primary name '%s' not found; pragma weak ignored. -definition of secondary name '%s' not found; pragma weak ignored. -primary name '%s' is declared as a common or external, and is not defined -with initial value within this file; pragma weak ignored. -useless '%s' storage class ignored -array of functions not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -array of voids not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -argument for pragma pack must be an integer constant; pragma ignored -'%s' has wrong tag type. -Identifier redeclared in the same scope/block. -3.1.2.3 -missing dimension bound -For multidimensional arrays, the constant bounds of the array may be -omitted only for the first member of the sequence. -3.1.2.5(23) -Internal error in parameters to function substr; loc: '%s'; len: '%s'. -Internal error in parameters to function insertstr; indx: '%s'. -Internal error in function get_tag_name; input is a non-tagged type. -Internal error in function gen_type_str -- not a type tree '%s' -Cannot open file '%s' -Prototype should be moved after tag or a typedef declaration. -Please look for comments in the extracted header file. -The extracted header file includes prototypes for static functions, -which should be removed, if you wish to include the header in a source file -other than the originator. -ANSI C requires formal parameter before "..." -This extension is meant to be used for compatibility with varargs.h -3.5.4.3(35) -syntax error: "&..." invalid -extension used to access "..." formal arguments. -function '%s' initialized like a variable -The type of entity to be initialized shall be an object type or an -array of unknown size. -3.5.7(31) -initializer not an array aggregate -The initializer for an object that has aggregate type shall be a -brace-enclosed list of initializers for the members of the aggregate, -written in increasing subscript or member order. -3.5.7(20) -'%s' type is incomplete; cannot initialize -Was the struct ever defined? -3.5.7.(31) -'%s' is not standard ANSI. -This keyword/type is not defined in strict ANSI mode. -3.1.1 -not a legal asm string -The first operand of an asm string should be, after argument substitution, -a legal assembly string. -The -float option will be ignored in ANSI mode. -The -float option is ignored, since otherwise program semantics would -violate the ANSI standard. In particular, fp constants are always -'double' with ANSI-C, while with -float the type of fp constants will -depend on the context and may be 'float'. -ANSI C support unavailable with C compiler bundled with RISC/os -The C compiler bundled with RISC/os does not support ANSI C. ANSI -C support requires a separate license. -Ignored invalid warning number(s) in -woff option, %s%s ! -Warning numbers must be in the range %s to %s. -The set of warning numbers in cfe is disjoint from the set of warning numbers -in accom, since accom warnings cannot be mapped one-to-one to cfe warnings. -'%s' not handled as an intrinsic due to incompatible argument types . -'__unalign' only qualifies pointers -'__unalign' indicates the object pointed at by pointer is unaligned (e.g., -int * __unalign p). This is an extension to ANSI C and like 'volatile' -and 'const' can follow the '*' in pointer declarations, but unlike both -cannot qualify a base type. -index expression is an anachronism -ANSI C++ doesn't support array index expressions in delete. -5.3.4 -member cannot be of function or incomplete type. -3.5.2.1(12) -Illegal lint option, '%s', is ignored. -cannot open header message buffer file -cannot write header message buffer file -cannot read header message buffer file -cannot seek in header message buffer file -struct/union/enum '%s' is used, but not defined -static '%s' unused -nonportable character comparison (chars may be signed or unsigned) -redundant comparison of unsigned with constant expression -redundant statement, control flow cannot reach this statement -'%s' may be used before set -function parameter '%s' is not used in function '%s' -'%s' can be const qualified, since it is not set within its lifetime. -'%s' is not used in function '%s' -'%s' set but unused in function '%s' -control may fall through %s statement -function '%s' has return(e); and return; -function '%s' may return random value to place of invocation %s -label without goto: '%s' -only %s bits of '%s' constant (type '%s') are explicitly given -explicit conversion from '%s' to '%s' %s -implicit conversion from '%s' to '%s' %s -'%s' may be indistinguishable from '%s' due to internal name truncation -Promoted formal parameter and promoted argument have incompatible types -No prototype for the definition of '%s' %s -References to '%s' are substituted by its literal initializer - (as included in %s) -============== -unsupported language linkage -string-literal specifies an unsupported linkage -7.4(1) -No prototype for the call to %s -To achieve better type-checking, there should be a full prototype for -the function being called. -3.5.4.3 -'inline' only applies to function declarations -leave statment can occur only within try body -Microsoft extension -Use of a Microsoft extension detected without usage of the -compiler option -msft. -No parameter mentioned -A file with no declarations or definitions is accepted as an extension to ANSI C -The translation unit must contain at least one external definition. -3.7 -Incompatible signed and unsigned version of a type -Yacc initialization error -Internal error: yacc cannot initialize itself. -The cfe option %s may not be in future releases. We suggest that you not use this option! -Incompatible char and unsigned char versions of a type -Lshift with undefined behaviour. -Lshift with a negative right operand, or a right operand that is greater -than or equal to the width in bits of the promoted left operand, results -in undefined behaviour. -3.3.7(11) -useless type name in declaration, possibly a semicolon is missing. -Type was ignored. -constant initializer expression is invalid (refers to automatic variables). -All the expressions in an initializer for an object that has static storage -duration or in the initializer list for an object that has aggregate or -union type shall be constant expressions. Otherwise, unexpected results -may occur. -3.5.7(32) and 3.4 -invalid explicit or implicit conversion of an address constant to an integral value in a constant initializing expression. -An address constant in a constant initializing expression can neither -initialize a bit-field nor be directly or indirectly converted to an -integral type of size different from an address type. -6.4 diff --git a/tools/ido_recomp/macos/7.1/ugen b/tools/ido_recomp/macos/7.1/ugen deleted file mode 100755 index 1e9839b4e..000000000 Binary files a/tools/ido_recomp/macos/7.1/ugen and /dev/null differ diff --git a/tools/ido_recomp/macos/7.1/ujoin b/tools/ido_recomp/macos/7.1/ujoin deleted file mode 100755 index d2512e934..000000000 Binary files a/tools/ido_recomp/macos/7.1/ujoin and /dev/null differ diff --git a/tools/ido_recomp/macos/7.1/uld b/tools/ido_recomp/macos/7.1/uld deleted file mode 100755 index a746a8236..000000000 Binary files a/tools/ido_recomp/macos/7.1/uld and /dev/null differ diff --git a/tools/ido_recomp/macos/7.1/umerge b/tools/ido_recomp/macos/7.1/umerge deleted file mode 100755 index a561c0801..000000000 Binary files a/tools/ido_recomp/macos/7.1/umerge and /dev/null differ diff --git a/tools/ido_recomp/macos/7.1/uopt b/tools/ido_recomp/macos/7.1/uopt deleted file mode 100755 index 30817f201..000000000 Binary files a/tools/ido_recomp/macos/7.1/uopt and /dev/null differ diff --git a/tools/ido_recomp/macos/7.1/usplit b/tools/ido_recomp/macos/7.1/usplit deleted file mode 100755 index 247279453..000000000 Binary files a/tools/ido_recomp/macos/7.1/usplit and /dev/null differ diff --git a/tools/ido_recomp/windows/5.3/as0.exe b/tools/ido_recomp/windows/5.3/as0.exe deleted file mode 100755 index 0c4926085..000000000 Binary files a/tools/ido_recomp/windows/5.3/as0.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/5.3/as1.exe b/tools/ido_recomp/windows/5.3/as1.exe deleted file mode 100755 index 2d79cc536..000000000 Binary files a/tools/ido_recomp/windows/5.3/as1.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/5.3/cc.exe b/tools/ido_recomp/windows/5.3/cc.exe deleted file mode 100755 index 7c08eac81..000000000 Binary files a/tools/ido_recomp/windows/5.3/cc.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/5.3/cfe.exe b/tools/ido_recomp/windows/5.3/cfe.exe deleted file mode 100755 index 2f5de5f18..000000000 Binary files a/tools/ido_recomp/windows/5.3/cfe.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/5.3/err.english.cc b/tools/ido_recomp/windows/5.3/err.english.cc deleted file mode 100644 index 6976e38a9..000000000 --- a/tools/ido_recomp/windows/5.3/err.english.cc +++ /dev/null @@ -1,1260 +0,0 @@ -@ - 358 358 358 - 6464 6482 6553 - 6553 6593 6728 - 6728 6746 6803 - 6803 6808 6808 - 6808 6818 6818 - 6818 6826 6826 - 6826 6847 6847 - 6847 6875 6922 - 6922 6930 6930 - 6930 6939 6939 - 6939 6948 6948 - 6948 6974 7120 - 7120 7149 7204 - 7210 7248 7311 - 7317 7350 7442 - 7450 7497 7627 - 7635 7709 7930 - 7938 7975 8063 - 8071 8113 8253 - 8261 8289 8289 - 8298 8338 8445 - 8460 8502 8635 - 8650 8690 8819 - 8834 8857 8965 - 8965 9008 9113 - 9119 9142 9227 - 9235 9282 9451 - 9451 9462 9462 - 9462 9477 9477 - 9477 9497 9497 - 9497 9545 9545 - 9545 9584 9584 - 9584 9604 9662 - 9662 9682 9720 - 9720 9749 9749 - 9749 9788 9788 - 9788 9802 9802 - 9802 9829 9829 - 9829 9861 9861 - 9861 9904 9904 - 9904 9920 9920 - 9920 9962 9962 - 9962 9988 9988 - 9988 10014 10014 -10014 10035 10035 -10035 10054 10097 -10097 10115 10115 -10115 10147 10147 -10147 10183 10183 -10183 10208 10208 -10208 10236 10236 -10236 10269 10269 -10269 10304 10304 -10304 10328 10328 -10328 10351 10351 -10351 10371 10371 -10371 10402 10402 -10402 10447 10447 -10447 10497 10497 -10497 10533 10533 -10533 10598 10598 -10606 10630 10630 -10640 10671 10671 -10690 10719 10719 -10728 10752 10795 -10795 10837 10837 -10837 10876 10876 -10876 10900 10900 -10900 10948 10948 -10960 11021 11103 -11103 11128 11128 -11128 11153 11153 -11153 11216 11216 -11216 11239 11239 -11239 11303 11303 -11303 11347 11347 -11357 11393 11393 -11393 11432 11432 -11442 11494 11494 -11494 11536 11536 -11536 11595 11595 -11595 11622 11622 -11622 11684 11684 -11684 11726 11726 -11738 11778 11778 -11782 11813 11813 -11813 11850 11850 -11850 11900 12087 -12111 12120 12120 -12120 12129 12129 -12129 12158 12158 -12158 12192 12192 -12192 12237 12237 -12237 12273 12273 -12273 12326 12326 -12330 12366 12366 -12366 12423 12423 -12427 12482 12482 -12486 12560 12560 -12568 12631 12631 -12637 12691 12691 -12691 12743 12743 -12743 12785 12785 -12785 12826 12826 -12826 12865 12865 -12865 12883 12883 -12883 12946 12946 -12956 12995 12995 -13005 13066 13066 -13077 13163 13163 -13163 13211 13211 -13211 13270 13270 -13270 13318 13318 -13318 13350 13350 -13350 13387 13387 -13387 13428 13428 -13428 13464 13533 -13533 13580 13737 -13737 13776 13854 -13854 13913 13913 -13913 13950 13950 -13950 14118 14118 -14118 14150 14150 -14150 14163 14194 -14194 14224 14255 -14255 14275 14319 -14319 14353 14458 -14466 14484 14530 -14534 14567 14567 -14567 14635 14682 -14690 14742 14742 -14742 14789 14789 -14801 14875 14875 -14886 14947 14947 -14947 14992 14992 -14992 15035 15085 -15085 15134 15205 -15214 15267 15448 -15454 15496 16810 -16822 16875 16960 -16972 17053 17179 -17191 17236 17332 -17344 17491 17841 -17853 17939 18304 -18316 18471 18774 -18786 18952 19323 -19335 19364 19496 -19500 19527 19598 -19598 19613 19776 -19797 19808 19837 -19837 19862 19862 -19868 19927 20026 -20034 20075 20179 -20187 20223 20223 -20223 20290 20382 -20392 20441 20589 -20601 20656 20656 -20656 20699 20818 -20826 20860 21038 -21046 21094 21191 -21203 21236 21314 -21326 21395 21457 -21469 21502 21502 -21502 21587 21731 -21756 21789 21864 -21875 21901 21976 -22013 22059 22220 -22257 22397 22561 -22561 22595 22595 -22603 22623 22623 -22631 22667 22828 -22865 22919 22994 -23031 23059 23120 -23132 23201 23201 -23212 23274 23274 -23285 23345 23345 -23356 23393 23393 -23399 23431 23532 -23542 23587 23646 -23656 23697 23745 -23755 23796 23844 -23854 23876 23928 -23942 23971 24153 -24160 24243 24243 -24247 24273 24743 -24755 24784 24984 -24996 25034 25034 -25034 25075 25273 -25281 25332 25410 -25420 25467 25544 -25554 25583 25744 -25754 25783 26061 -26071 26111 26185 -26194 26239 26525 -26535 26568 26914 -26924 26951 26998 -27008 27035 27082 -27093 27120 27167 -27178 27206 27251 -27261 27289 27334 -27345 27391 27931 -27938 27959 28007 -28019 28037 28037 -28043 28069 28069 -28077 28147 28199 -28207 28266 28266 -28274 28306 28306 -28314 28339 28339 -28347 28404 28510 -28518 28567 28682 -28690 28728 28728 -28736 28782 29023 -29033 29085 29234 -29246 29303 29383 -29395 29432 29570 -29592 29631 29644 -29644 29693 29758 -29767 29810 29875 -29875 29911 29976 -29984 30014 30014 -30027 30086 30151 -30157 30223 30293 -30301 30369 30445 -30457 30511 30568 -30580 30630 30743 -30755 30812 30874 -30886 30959 31035 -31043 31076 31175 -31183 31243 31243 -31251 31323 31323 -31331 31433 31433 -31445 31544 31686 -31698 31740 31740 -31740 31783 31783 -31783 31824 31824 -31824 31873 31996 -32008 32056 32164 -32176 32210 32210 -32229 32271 32271 -32279 32323 32569 -32581 32642 32718 -32739 32779 32916 -32926 32953 33047 -33057 33116 33315 -33325 33373 33373 -33373 33407 33469 -33494 33527 33527 -33536 33573 33573 -33584 33650 33697 -33705 33763 33763 -33763 33797 33797 -33797 33829 33906 -33915 33976 33976 -33985 34016 34098 -34098 34133 34198 -34198 34261 34261 -34269 34312 34312 -34324 34363 34438 -34444 34530 34530 -34538 34596 34626 -34636 34675 34754 -34764 34821 34821 -34821 34867 34950 -34959 35016 35135 -35145 35198 35198 -35208 35266 35344 -35355 35382 35537 -35547 35576 35629 -35637 35705 35705 -35713 35764 35764 -35764 35784 35876 -35888 35932 35950 -35950 36013 36138 -36150 36191 36280 -36286 36314 36419 -36431 36516 36516 -36516 36554 36642 -36642 36689 36808 -36818 36881 37105 -37113 37183 37204 -37204 37225 37225 -37225 37255 37348 -37348 37388 37388 -37388 37454 37454 -37454 37518 37518 -37518 37584 37584 -37584 37717 37717 -37717 37752 37752 -37752 37783 37889 -37901 37928 38034 -38046 38115 38115 -38115 38140 38187 -38195 38219 38339 -38351 38422 38422 -38422 38486 38486 -38486 38555 38555 -38555 38619 38619 -38619 38641 38641 -38641 38758 38758 -38758 38929 38929 -38929 38975 39043 -39055 39084 39133 -39133 39175 39265 -39275 39310 39494 -39504 39547 39576 -39587 39614 39668 -39674 39697 39797 -39797 39845 40094 -40094 40158 40264 -40264 40369 40523 -40523 40593 40593 -40593 40629 40876 -40876 40911 40971 -40977 41026 41026 -41038 41077 41077 -41077 41116 41116 -41116 41156 41156 -41156 41195 41195 -41195 41237 41237 -41237 41285 41285 -41285 41304 41304 -41304 41371 41371 -41371 41429 41429 -41429 41491 41491 -41491 41519 41519 -41519 41572 41572 -41572 41642 41642 -41642 41676 41676 -41676 41713 41713 -41713 41751 41751 -41751 41792 41792 -41792 41856 41856 -41856 41881 41881 -41881 41936 41936 -41936 41977 41977 -41977 42018 42018 -42018 42090 42090 -42090 42162 42162 -42162 42205 42205 -42205 42267 42267 -42267 42294 42294 -42294 42309 42309 -42309 42338 42386 -42393 42425 42522 -42530 42577 42577 -42577 42623 42623 -42623 42643 42725 -42725 42748 42748 -42748 42829 42897 -42901 42952 42952 -42952 42978 43025 -43025 43116 43116 -43116 43171 43171 -43171 43204 43376 -43386 43453 43471 -43471 43547 43780 -43798 43921 44116 -44120 44120 44120 -Out of memory: %s -There is no more memory left in the system for compiling this program. -Internal Error Unknown Error Message %s -1) An internal error, while attempting to print an unavailable message -2) The error message file is inaccessible or has other problems -Unknown Signal %s -1) An unknown signal has been caught -2) 2 Nested signals -line -Warning: -Fatal: -Source not available -Too many errors... goodbye. -There is a limit of 30 errors before aborting. -Error: -reserved -reserved -Unknown Control Statement -1) The line begins with a '#' and is not of the form: - # "" -2) Please compile this program with the preprocessor enabled. -Unknown character %s ignored -The character is not part of the source character set. -2.2.1 -Unknown control character \%s ignored -The control character is not part of the source character set. -2.2.1 -Illegal character %s in exponent -1) Digits or sign expected after 'e' or 'E'. -2) Digits are expected after sign in exponent. -3.1.3.1 -Constant is out of range and may be truncated. -The constant is too large to be accurately represented and may be -truncated. The limits are in the system include file limits.h. -2.2.4.2 -Constant is out of range for a 32-bit data type, but accepted as written. -The constant is too large to fit in a 32-bit data type, but will be -accurately represented in a wider data type. The value may be truncated, -depending on its context. The limits are in the system include file -limits.h. -2.2.4.2 -Character constant size out of range -1) No characters in a character constant. -2) More than 4 bytes in a character constant. -3.1.3.4 -Wide character constant size out of range -1) No characters in the multibyte sequence (0 assumed). -2) More than 1 byte in the multi-byte sequence (only the first byte was converted). -3.1.3.4 -Invalid multibyte character -4.10.7.2 -Newline in string or character constant -1) Terminate your string or character constant with closing quotes. -2) Put a backslash before the newline. -3.1.3.4, 3.1.4 -Octal character escape too large: %s > %s -1) Terminate end of octal sequence with a non-octal character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Hex character escape too large: %s > %s -1) Terminate end of hex sequence with a non-hex character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Unexpected End-of-file -1) Unterminated string or character constant -2) Missing closing comment marker (*/) -3) File system problems -Unrecognized escape sequence in string \%s -Recognized escape sequences are \a, \b, \f, \n, \r, \t, and \v. -Character will be treated as un-escaped. -3.9.2 -Illegal octal digit %s -Octal constants, beginning with 0, must only have digits between 0 and 7, -inclusive. -3.1.3.2 -Unable to open temporary file for compiling %s -1) TMPDIR environment variable is set to a directory that you have no - permissions for. -2) The file system is full. -3) System errors beyond the scope of the compiler. -%s: Hangup -%s: Interrupt -%s: Quit (ASCII FS) -%s: Illegal instruction (not reset when caught) -%s: Trace trap (not reset when caught) -%s: IOT instruction -Also SIGABRT, used by abort, replace SIGIOT in the future -%s: EMT instruction -Also SIGXCPU, Exceeded CPU time limit -%s: Floating point exception -%s: Kill (cannot be caught or ignored) -%s: Bus error -%s: Segmentation violation -%s: Bad argument to system call -%s: Write on a pipe with no one to read it -%s: Alarm clock -%s: Software termination signal from kill -%s: User defined signal 1 -%s: User defined signal 2 -%s: Death of a child -Power-fail restart -%s: Also SIGXFSZ, exceeded file size limit -%s: Window change -%s: Handset, line status change -%s: Sendablestop signalnot from tty -%s: Stop signal from tty -%s: Pollable event occurred -%s: Input/Output possible signal -%s: Urgent condition on IO channel -%s: Window size changes -%s: Virtual time alarm -%s: Profiling alarm -%s: Continue a stopped process -%s: To readers pgrp upon background tty read -%s: Like TTIN for output if (tp->t_local<OSTOP) -%s: Resource lost (eg, record-lock) -'auto' and 'register' are not allowed in an external declaration -3.7(10) -must have function type -3.7.1(30) -Functions cannot return arrays -3.7.1(33), 3.3.2.2 -Declaration list not allowed -3.7.1(5) -Too many input files %s -The command line may contain only one file -cpp internal error: input stack underflow -cpp internal error: if stack underflow -Cannot open the file %s -No new-line character at the end of the file %s -2.1.1.2(30) -Fatal: Exceeded the limit of nesting level for #include file -Fatal: Exceeded the limit of nesting level for #include file. This limit -is 200. -Fail to read the file %s -Cannot write the file %s -%s: %s: An if directive is not terminated properly in the file -%s: %s: nested comment -%s:%s: Illegal macro name %s; macro name shall be an identifier -%s:%s: Illegal preprocessing token sequence -3.8.3(35) -%s:%s: Illegal macro parameter name -%s:%s: Non-unique macro parameter name -3.8.3(18) -%s:%s: Missing ')' in parameter list for #define %s -%s:%s: Missing ')' in macro instantiation -%s:%s: Bad punctuator in the parameter list for #define %s -%s:%s: Macro %s redefined. -%s:%s: # operator should be followed by a macro argument name -%s:%s: Badly formed constant expression%s -3.4(9), 3.8 -%s:%s: Division by zero in #if or #elif -3.8 -unknown command line option %s -extraneous input/output file name %s -%s: %s: Unterminated string or character constant -A preprocessing string or character constant token was not -terminated. Note that preprocessing directives are processed -after the source file has been divided into preprocessing tokens. -2.1.1.2(30) 3.1(18) 3.8 -%s: %s: -%s: %s: -%s: %s: Unterminated comment -%s: %s: Unknown directive type %s -%s: %s: #elif or #else after #else directive -%s: %s: Bad identifier after the %s -%s: %s: #%s accepts only one identifier as parameter -3.8 -%s: %s: Bad identifier after the %s -%s: %s: text following #%s violates the ANSI C standard. -3.8 -%s: %s: Bad character %s occurs after the # directive. -3.8 -%s: %s: the ## operator shall not be the %s token in the replacement list -3.8.3.3 -%s: %s: the defined operator takes identifier as operand only. -3.8.1 -%s: %s: Not in a conditional directive while using %s -%s: %s: Illegal filename specification for #include -%s: %s: Invalid file name %s for #include -%s: %s: Cannot open file %s for #include -%s: %s: Bad argument for #line command -%s: %s: #error %s -%s: %s: Tried to redefine predefined macro %s, attempt ignored -3.8.7(22) -%s: %s: Undefining predefined macro %s -3.8.7(22) -%s: %s: Undefined the ANSI standard library defined macro %s -4.1.2.1(9) -%s: %s: The number of arguments in the macro invocation does not match the definition -%s: %s: Illegal character %s in preprocessor if -%s: %s: Illegal character %s for number in preprocessor if -%s: %s: No string is allowed in preprocessor if -%s: %s: Not supported pragma %s -%s: %s: Not supported #pragma format -%s: %s: ANSI C does not allow #ident; %s -%s: %s: Not supported #ident format -This cpp extension accepts the following format: -#ident "any string" -%s: %s: Not supported #assert/#unassert format -This cpp extension accepts the following format: -#assert identifier -#assert identifier ( pp-tokens ) -#unassert identifier -#unassert identifier ( pp-tokens ) -%s: %s: Bad assertion predicate format -The correct syntax for this cpp extension is: -#assert identifier ( pp-token ) -%s: %s: directive is an upward-compatible ANSI C extension -%s: This option requires an argument -%s: %s: A macro has expanded recursively more than %s times. Further expansion will be disabled! Use command-line option: -Wp,-max_rec_depth=depth to recurse deeper. -A status return from cpp to cfe -Syntax Error -The token read was unexpected. -Syntax Error -- cannot backup -The token read was unexpected. -Yacc stack overflow -The expression is too complicated to parse. -Trailing comma in enumerator list -The use of a trailing comma in an enumerator list is not standard C. There -may be portability problems. -3.5.2.2 -Empty declaration -Empty declarations are invalid in standard C. -3.5 -%s declared, but not referenced. -redeclaration of '%s'; previous declaration at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -'%s' undefined; reoccurrences will not be reported. -Non-function name referenced in function call. -3.3.2.2(18) -The number of arguments doesn't agree with the number in the declaration. -3.3.2.2(5) -'%s' section name longer than 8 characters. Name truncated. -'%s' is already placed by pragma alloc_text. -Cannot write ucode file while compiling %s -1) The file system is full -2) Permissions problem -Must have corresponding formal argument for '%s' -Parameter found in the declaration part, but not in the argument list. -3.7.1(7) -Non-prototype declaration is an obsolescent feature. -The use of function definitions with separate parameter identifier -and declaration lists (not prototype-format parameter type and -identifier declarators) is an obsolescent feature. -3.9.5 -Incompatible function declarations for %s -For two function types to be compatible, both shall specify compatible -return types. Moreover, the parameter type lists, if both are present, -shall agree in the number of parameters and in use of the ellipsis -terminator; corresponding parameters shall have compatible types. If -one type has a parameter type list and the other type is specified by -a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. If one type has a parameter type list and the -other is specified by a function definition that contains a (possibly -empty) identifier list, both shall agree in the number of parameters, -and the type of each prototype parameter shall be compatible with the -type that results from application of the default argument promotions -to the type of the corresponding identifier. (For each parameter -declared with function or array type, its type for these comparisons -is the one that results from conversion to a pointer type. For each -parameter declared with qualified type, its type for these comparisons -is the unqualified version of its declared type.) There you have it! -3.5.4.3(15) -Incompatible function return type for this function. -For two function types to be compatible, both shall specify compatible -return types. -3.5.4.3(15) -The number of parameters for function is different from the previous declaration -The parameter type lists, if both are present, shall agree in the -number of parameters and in use of the ellipsis terminator. -3.5.4.3(15) -Incompatible type for the function parameter -If both parameter type lists are present, corresponding -parameters shall have compatible types. -3.5.4.3(15) -Function %s is redeclared with an incompatible argument type (after default argument promotion), which could lead to undefined run-time behaviour. -The redeclaration could cause arguments at a call site to be passed -inconsistently with what the function implementation expects, and -parameters would therefore be accessed erroneously when executing the -function body. Note that a float argument is promoted to a double -when passed (potentially through fp registers) to an unprototyped -function. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, ellipsis terminator not allowed -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the type of each parameter shall be -compatible with the type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype declaration and non-prototype definition found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other is specified by a -function definition that contains a (possibly empty) identifier list, -both shall agree in the number of parameters, and the type of each -prototype parameter shall be compatible with the type that results -from application of the default argument promotions to the type of the -corresponding identifier. -3.5.4.3(15) -Empty declaration specifiers -Standard C requires at least a storage class specifier, type specifier, -or a type qualifier in declarations. 'extern int' assumed. -3.5 -Can't write to the file %s -1) The output file cannot be opened for writing. -2) Out of file space. -Duplicate '%s' -typedef, extern, static, auto, register, const, volatile may not -appear more than once in the same specifier list or qualifier list. -Duplicate occurrence ignored. -3.5.1(10) , 3.5.3(5) -Null input -There is nothing to compile. -Illegal type combination -3.5.2 -Missing ';' at end of structure / union member declaration -In standard C, each member declaration must be terminated by a ';'. A -terminating ';' is assumed. -3.5.2.1 -Missing member name in structure / union -In standard C, each member declaration have a member name. The missing -member is assumed to not exist. -3.5.2.1 -This variable is initialized twice. -Neither 'const' or 'volatile' have any effect on function results. -Qualifiers only apply to expressions designating an object that -can be altered or examined. -3.5.3(10) -An integer constant expression is required here. -The expression that defines the value of an enumeration constant -shall be an integral constant expression that has a value -representable as an int. -3.5.2.2(28) -(previous declaration of '%s' at line %s in file '%s') -Must be an integer type greater than zero. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -Array size cannot be a long long. -Arrays with more than 2^32 elements are not yet supported. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -bit-field '%s' width is not an integer constant -The expression that specifies the width of a bit-field shall be an -integral constant expression. -3.5.2.1(15) -bit-field '%s' width is negative -The expression that specifies the width of a bit-field shall be -non-negative. -3.5.2.1(15) -bit-field '%s' type required to be int, unsigned int, or signed int. -A bit-field shall have type int, unsigned int, or signed int. -3.5.2.1(30) -bit-field %s's type not integer. -Non-scalar type or pointer type to a non-object for increment or decrement operator. -The operand of the prefix/postfix increment or decrement operator shall have scalar type; if it is of pointer type, it must point to an object. -3.3.2.4(37), 3.3.3.1(25) -Assign value to a function type. -An assignment operator shall have a modifiable lvalue as its left operand. -3.2.2.1(5) -Assign value to an array. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for variable of incomplete type. -The operand of increment and decrement operator shall be a modifiable -scalar lvalue. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -The left-hand side of the '.' operator must be an addressable lvalue, when a bit-field is not contained within a unit of 32 bits alignment. -This is a restriction in our implementation, which can be worked -around by always accessing long long bit-fields indirectly (i.e. -by means of the '->' operator). -This expression is not an lvalue. -3.2.2.1 -Modified an rvalue. -3.2.2.1 -Change value for constant variable. -The operand of increment and decrement operators shall be modifiable -scalar lvalues. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for constant field of a struct or union. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Dereferenced a non-pointer. -The operand of the unary * operator shall have pointer type. -3.3.3.2(39) -The operand of the unary + or - operator shall have arithmetic type. -3.3.3.3(6) -The operand of the unary ~ operator shall have integral type. -3.3.3.3(6) -The operand of the unary ! operator shall have scalar type. -3.3.3.3(6) -Constants must have arithmetic type. -3.1.3 -Bad type name for cast operator -The type name for the cast operator should either be void or a -qualified or unqualified scalar type. -3.3.4(22) -Improper cast of non-scalar type expression. -The operand for the cast operator shall be of scalar type. -3.3.4(23) -Cast a pointer into a non-integral type. -A pointer may be converted to an integral type. -3.3.4(31) -Cast a non-integral type into a pointer. -An integral type may be converted to a pointer. -3.3.4(31) -Duplicate member '%s' -Two members of a struct may not have the same name. -3.1.2.2(7,25) -Invalid constant expression. -Constant expressions shall not contain assignment, increment, decrement, -function-call, or comma operators, except when they are contained within -the operand of the sizeof operator. -3.4(9) -Constant expressions must be derived from a constant value or a constant -variable. -3.4 -Dangerous operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. This operand is NOT an lvalue, but we let it pass. -Note that a segmentation error with possible core dump will result -when the resulting address does not denote a valid (declared) -storage location. This feature will be discontinued in future -releases of the compiler! -3.3.3.2(36) -Unacceptable operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. -3.3.3.2(36) -'&' before array or function; ignored -Unacceptable operand of sizeof operator. -The sizeof operator shall not be applied to an expression that has -function type or an incomplete type, to the parenthesized name of such -a type, or to an lvalue that designates a bit-field object. -3.3.3.4 -Unacceptable operand of a multiplicative operator. -Each of the operands of a multiplicative operator shall have arithmetic type. -3.3.5(18) -Unacceptable operand of the remainder operator -Each of the operands of the remainder (%) operator shall have integral type. -3.3.5(18) -Unacceptable operand of '+'. -For the + operator, either both operands shall have arithmetic type, or -one operand shall be a pointer to an object type and the other shall -have integral type. -3.3.6(39) -Unacceptable operand of '-'. -For the subtraction operator, one of the following shall hold: both operands -have arithmetic type; operands are pointers to qualified or unqualified -versions of compatible object types; or the left operand is a pointer -to an object type and the right operand has integral type. -3.3.6(39) -Unacceptable operand of shift operator. -Each of the operands of bitwise shift operators shall have integral type. -3.3.7(9) -Unacceptable operand of relational operator. -For relational operators, one of the following shall hold: both -operands have arithmetic type; both operands are pointers to qualified -or unqualified versions of compatible object types; or both operands -are pointers to qualified or unqualified versions of compatible -incomplete types. -3.3.8(32) -Unacceptable operand of == or != -For the == or != operator, one of the following shall hold: both operands -are pointers to qualified or unqualified versions of compatible types; one -operand is a pointer to an object or incomplete type and the other is a -pointer to a qualified or unqualified version of void; or one operand is -a pointer and the other is a null pointer constant. -3.3.9(21) -Unacceptable operand of &. -Each of the operands shall have integral type. -3.3.10(7) -Unacceptable operand of ^. -Each of the operands shall have integral type. -3.3.11(18) -Unacceptable operand of |. -Each of the operands shall have integral type. -3.3.12(30) -Unacceptable operand of &&. -Each of the operands shall have scalar type. -3.3.13(7) -Unacceptable operand of ||. -Each of the operands shall have scalar type. -3.3.14(20) -Unacceptable operand of conditional operator. -The first operand of conditional operator shall have scalar type. One -of the following shall hold for the second and third operands: -both operands have arithmetic type; both operands have compatible -structure or union types; both operands have void type; both operands -are pointers to qualified or unqualified versions of compatible types; -one operand is a pointer and the other is a null pointer constant; or -one operand is pointer to an object or incomplete type and the other -is a pointer to a qualified or unqualified version of void. -3.3.15 -Duplicate label '%s' -A label name can only occur once in a function. -3.1.2.1(25) -Division by zero. -3.3.5 -Subscripting a non-array. -3.3.2.1 -Subscripting an array of incomplete type which is not an object type. -The element of the array shall have an object type. -3.3.2.1 -Should only subscript an array with an integral expression -3.3.2.1 -Subscripting an unbounded array -3.3.2.1 -Array index out of range -3.3.2.1 -Selector requires struct/union pointer as left hand side -In K&R mode the expression is implicitly converted to the '.' selector -for a struct/union left-hand side. -3.3.2.3 -Selector requires struct/union as left hand side -In K&R mode the expression is implicitly converted to the '->' selector -for a struct/union pointer left-hand side. -3.3.2.3 -member of structure or union required -3.3.2.3 -types have different qualifier specifications -For two qualified types to be compatible, both shall have the -identically qualified version of a compatible type; qualified -and unqualified versions of a type are distinct types. For two -types to be compatible their types must be the same. -3.5.3(26) -Incompatible array type due to different array size -For two array types to be compatible, both shall have compatible element -types; if both size specifiers are present, they shall have the -same value. -3.5.4.2(11) -Incompatible array type due to incompatible element type -For two array types to be compatible, both shall have compatible element -types. -3.5.4.2(11) -Incompatible pointer type assignment -The type pointed to by the left-hand side of simple assignment -statement is incompatible with the type pointed to by the right-hand side. -3.3.16.1, 3.5.4.1(21) -Incompatible base type of pointer type -K&R feature. -Type %s of %s is incompatible with type %s of %s -Incompatible types can be resolved by casting or by other means. -3.3.16.1 -illegal combination of pointer and integer -Assigning an integral expression to a pointer is a bad practice. -Type for %s is incompatible with %s -Incompatible types can be resolved by casting or by other means. -3.1.2.6 -Bad operand type for += or -= -3.3.16.2(26) -A case or default label appears outside a switch statement -A case or default label shall appear only in a switch statement. -3.6.1 -The controlling expression of the if statement is not scalar type -The controlling expression of an if statement shall have scalar type. -3.6.4.1 -The controlling expression of switch statement is not integral type -The controlling expression of an switch statement shall have integral type. -3.6.4.2(20) -The case label is not an integral constant expression -The case label shall be an integral constant expression. -3.6.4.2(22) -Duplicate case label in the same switch statement -No two of the case constant expressions in the same switch statement -shall have the same value after conversion. -3.6.4.2(22) -More than one default label in the same switch statement -There may be at most one default label in a switch statement. -3.6.4.2(23) -The controlling expression of the iteration statement is not scalar -type -The controlling expression of a iteration statement shall have scalar -type. -3.6.5.1 -label '%s' used, but not defined -The identifier in a goto statement shall name a label located -somewhere in the enclosing function. -3.6.6.1 -A continue statement shall appear only in or as a loop body -3.6.6.2 -A break statement shall appear only in or as a switch body or loop body -3.6.6.3 -A return statement with an expression should not appear -in a function '%s', whose return type is void -3.6.6.4(24) -A return statement without an expression appears in a -function '%s', whose return type is not void -If a return statement without an expression is executed, and the value -of the function call is used by the caller, the behavior is undefined. -3.6.6.4(33) -Internal Error: statement stack underflow -Long double not supported; double assumed. -Long float not standard; double assumed. -Only 'register' allowed in parameter declaration -The only storage-class specifier that shall occur in a parameter -declaration is 'register'; illegal storage class ignored. -3.5.4.3(25) -Name(s) without types in a function declaration -An old-style function declaration is not allowed to have names -in the parameter list; useless names ignored -3.5.4.3(26) -Functions cannot return functions -3.7.1(33), 3.3.2.2 -Functions cannot return a non-object type -3.3.2.2 -enum declaration must contain enum literals -Although structs or unions may delay the declaration of their members, -a similar construction with enum does not exist and is not necessary, -as there can be no mutual dependencies between the declaration of an -enumerated type and any other type. -3.5.2.3(27) -Register qualification has no effect for this type of object -Register declarations for array, struct, and function types have -no effect. -3.5.1(16), 3.5.1(19) -Functions cannot be declared 'register' -The declaration of an identifier for a function that has block -scope shall have no explicit storage-class specifier other than -'extern'. -3.5.1(19) -'%s' cannot be initialized -The type of the entity to be initialized shall be an object type -or an array of unknown size. -3.5.7(32) -Cannot initialize 'extern' variable '%s' within a function -If the declaration of an identifier has block scope, and the -identifier has 'extern' or 'static' linkage, the declaration -shall have no initializer for the identifier; initialization -allowed anyway. -3.5.7(35) -initializing an 'extern' is an ANSI C extension -conflicting declarations for '%s' -'static' and 'extern' declarations conflict. Which is meant? -3.1.2.2(15), 3.1.2.2(27) -Too many initial values for '%s' -3.5.7(1) -incompatible types in initialization -3.3.16(35) -redefinition of '%s'; previous definition at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -bit-fields as members of a union are an ANSI C invention. -storage size for '%s' isn't known -type mismatch in initialization -Missing braces in a union initialization or illegally formed -initialization. -3.5.7(5) -union '%s' only allowed one initializer for the first member -3.5.7(5) -width of '%s' exceeds its type -the specified bitfield width is too large to be contained within a -bitfield type. -structure has no member named '%s' -This is allowed for compatibility with AT&T pcc-based compilers. -Reference of an expression of void type or an incomplete type. -3.2.2.1 -element size of an array shall not be zero -3.2.2.5(25) -invalid combination of type specifiers -Although order is unimportant, not all type specifiers can occur together. -3.5.2 -declaration must at least declare an identifier, tag, or the member of an enumeration -3.5(16) -at most one storage class may be given in the declaration -Duplicate occurrence ignored. -3.5.1(10) -size of function's return type is zero -The return type of a function must be void or an object type other than array. -3.7.1(33) -Expecting an integral return type from the main function -identifier missing from parameter declaration -Prototypes for function definitions require identifiers in parameter -declarations. -3.7.1(4) -only 'register' allowed for storage class for parameters -The declarations in the declaration list shall contain no storage class -other than 'register', and no initializations. -3.7.1(10) -parameters declarations can not have initializations -3.7.1(10) -only one instance of 'void' allowed in the parameter list -'void' must occur by itself (specifying that the function has no parameters). -3.5.4.3(1) -%s must have function type -1) An argument list must be explicitly present in the declarator; it cannot - be inherited from a typedef (3.5.4.3). -2) The declarator is not a function. -3.7.1(30) -Illegal hexadecimal constant -You have no digits after the 0x or 0X. 0x0 assumed. -3.1.3.2 -value overflows its type in this context. Value is set to be '%s'! -3.2.1.4 -value is outside range representable for type '%s' -missing member name -K&R mode permits a missing member name; otherwise, only bitfields can omit -the member name. -3.5.2.1(10) -useless keyword or type name in declaration -Type was ignored. -'%s' declared within and is limited to this function prototype -Possible program error, since parameter type checking will always fail -unless the type declaration is visible to the caller. -3.1.2.1(35) -Extra spaces within operator, %s assumed -In ANSI C, the compound assignment operator cannot have embedded -white space characters. -3.1.5 -missing size for array '%s' -Incomplete types permitted for identifiers with internal or -external linkage, but not automatic linkage. -3.1.2.5(10) -can't jump into (from outside of) the body of a 'try' or into either type of handler -'%s' missing, please #include excpt.h -excpt.h required to declare exception statements, intrinsics or compiler -runtime names. -local function declarations cannot be 'static' -A function declaration can only contain the storage-class 'static' -if it is at file scope. Declaration made 'extern'. -3.5.1(19) -static function '%s' declared and referenced, but not defined. -If an identifier declared with internal linkage is used in an -expression (other than as a part of the operand of a sizeof -operator), there shall be exactly one external definition for -the identifier in the translation unit. -3.7(12) -pragma argument '%s' must be declared prior to being used in a pragma -Pragma name ignored. -Pragma not supported -'%s' not enabled as intrinsic -It may have already appeared in a function pragma, or never occurred in -an intrinsic pragma. -'%s' is already enabled as an intrinsic -weak definition for '%s' is later redefined; pragma weak ignored. -definition of primary name '%s' not found; pragma weak ignored. -definition of secondary name '%s' not found; pragma weak ignored. -primary name '%s' is declared as a common or external, and is not defined -with initial value within this file; pragma weak ignored. -useless '%s' storage class ignored -array of functions not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -array of voids not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -argument for pragma pack must be an integer constant; pragma ignored -'%s' has wrong tag type. -Identifier redeclared in the same scope/block. -3.1.2.3 -missing dimension bound -For multidimensional arrays, the constant bounds of the array may be -omitted only for the first member of the sequence. -3.1.2.5(23) -Internal error in parameters to function substr; loc: '%s'; len: '%s'. -Internal error in parameters to function insertstr; indx: '%s'. -Internal error in function get_tag_name; input is a non-tagged type. -Internal error in function gen_type_str -- not a type tree '%s' -Cannot open file '%s' -Prototype should be moved after tag or a typedef declaration. -Please look for comments in the extracted header file. -The extracted header file includes prototypes for static functions, -which should be removed, if you wish to include the header in a source file -other than the originator. -ANSI C requires formal parameter before "..." -This extension is meant to be used for compatibility with varargs.h -3.5.4.3(35) -syntax error: "&..." invalid -extension used to access "..." formal arguments. -function '%s' initialized like a variable -The type of entity to be initialized shall be an object type or an -array of unknown size. -3.5.7(31) -initializer not an array aggregate -The initializer for an object that has aggregate type shall be a -brace-enclosed list of initializers for the members of the aggregate, -written in increasing subscript or member order. -3.5.7(20) -'%s' type is incomplete; cannot initialize -Was the struct ever defined? -3.5.7.(31) -'%s' is not standard ANSI. -This keyword/type is not defined in strict ANSI mode. -3.1.1 -not a legal asm string -The first operand of an asm string should be, after argument substitution, -a legal assembly string. -The -float option will be ignored in ANSI mode. -The -float option is ignored, since otherwise program semantics would -violate the ANSI standard. In particular, fp constants are always -'double' with ANSI-C, while with -float the type of fp constants will -depend on the context and may be 'float'. -ANSI C support unavailable with C compiler bundled with RISC/os -The C compiler bundled with RISC/os does not support ANSI C. ANSI -C support requires a separate license. -Ignored invalid warning number(s) in -woff option, %s%s ! -Warning numbers must be in the range %s to %s. -The set of warning numbers in cfe is disjoint from the set of warning numbers -in accom, since accom warnings cannot be mapped one-to-one to cfe warnings. -'%s' not handled as an intrinsic due to incompatible argument types . -'__unalign' only qualifies pointers -'__unalign' indicates the object pointed at by pointer is unaligned (e.g., -int * __unalign p). This is an extension to ANSI C and like 'volatile' -and 'const' can follow the '*' in pointer declarations, but unlike both -cannot qualify a base type. -index expression is an anachronism -ANSI C++ doesn't support array index expressions in delete. -5.3.4 -member cannot be of function or incomplete type. -3.5.2.1(12) -Illegal lint option, '%s', is ignored. -cannot open header message buffer file -cannot write header message buffer file -cannot read header message buffer file -cannot seek in header message buffer file -struct/union/enum '%s' is used, but not defined -static '%s' unused -nonportable character comparison (chars may be signed or unsigned) -redundant comparison of unsigned with constant expression -redundant statement, control flow cannot reach this statement -'%s' may be used before set -function parameter '%s' is not used in function '%s' -'%s' can be const qualified, since it is not set within its lifetime. -'%s' is not used in function '%s' -'%s' set but unused in function '%s' -control may fall through %s statement -function '%s' has return(e); and return; -function '%s' may return random value to place of invocation %s -label without goto: '%s' -width of %s constant is smaller than size of type (%s) -explicit conversion from '%s' to '%s' %s -implicit conversion from '%s' to '%s' %s -'%s' may be indistinguishable from '%s' due to internal name truncation -Promoted formal parameter and promoted argument have incompatible types -No prototype for the definition of '%s' %s -References to '%s' are substituted by its literal initializer - (as included in %s) -============== -unsupported language linkage -string-literal specifies an unsupported linkage -7.4(1) -No prototype for the call to %s -To achieve better type-checking, there should be a full prototype for -the function being called. -3.5.4.3 -'inline' only applies to function declarations -leave statment can occur only within try body -Microsoft extension -Use of a Microsoft extension detected without usage of the -compiler option -msft. -No parameter mentioned -A file with no declarations or definitions is accepted as an extension to ANSI C -The translation unit must contain at least one external definition. -3.7 -Incompatible signed and unsigned version of a type -Yacc initialization error -Internal error: yacc cannot initialize itself. -The cfe option %s may not be in future releases. We suggest that you not use this option! -Incompatible char and unsigned char versions of a type -Lshift with undefined behaviour. -Lshift with a negative right operand, or a right operand that is greater -than or equal to the width in bits of the promoted left operand, results -in undefined behaviour. -3.3.7(11) -useless type name in declaration, possibly a semicolon is missing. -Type was ignored. -constant initializer expression is invalid (refers to automatic variables). -All the expressions in an initializer for an object that has static storage -duration or in the initializer list for an object that has aggregate or -union type shall be constant expressions. Otherwise, unexpected results -may occur. -3.5.7(32) and 3.4 -invalid explicit or implicit conversion of an address constant to an integral value in a constant initializing expression. -An address constant in a constant initializing expression can neither -initialize a bit-field nor be directly or indirectly converted to an -integral type of size different from an address type. -6.4 diff --git a/tools/ido_recomp/windows/5.3/ugen.exe b/tools/ido_recomp/windows/5.3/ugen.exe deleted file mode 100755 index 0f919c234..000000000 Binary files a/tools/ido_recomp/windows/5.3/ugen.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/5.3/ujoin.exe b/tools/ido_recomp/windows/5.3/ujoin.exe deleted file mode 100755 index f1397ee0c..000000000 Binary files a/tools/ido_recomp/windows/5.3/ujoin.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/5.3/uld.exe b/tools/ido_recomp/windows/5.3/uld.exe deleted file mode 100755 index d415d9ba0..000000000 Binary files a/tools/ido_recomp/windows/5.3/uld.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/5.3/umerge.exe b/tools/ido_recomp/windows/5.3/umerge.exe deleted file mode 100755 index 23bf7b251..000000000 Binary files a/tools/ido_recomp/windows/5.3/umerge.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/5.3/uopt.exe b/tools/ido_recomp/windows/5.3/uopt.exe deleted file mode 100755 index 248beabc7..000000000 Binary files a/tools/ido_recomp/windows/5.3/uopt.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/5.3/usplit.exe b/tools/ido_recomp/windows/5.3/usplit.exe deleted file mode 100755 index 6ac2a6382..000000000 Binary files a/tools/ido_recomp/windows/5.3/usplit.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/7.1/as0.exe b/tools/ido_recomp/windows/7.1/as0.exe deleted file mode 100755 index 346827a49..000000000 Binary files a/tools/ido_recomp/windows/7.1/as0.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/7.1/as1.exe b/tools/ido_recomp/windows/7.1/as1.exe deleted file mode 100755 index 7076875b9..000000000 Binary files a/tools/ido_recomp/windows/7.1/as1.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/7.1/cc.exe b/tools/ido_recomp/windows/7.1/cc.exe deleted file mode 100755 index 53bf83433..000000000 Binary files a/tools/ido_recomp/windows/7.1/cc.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/7.1/cfe.exe b/tools/ido_recomp/windows/7.1/cfe.exe deleted file mode 100755 index 0286c3fa5..000000000 Binary files a/tools/ido_recomp/windows/7.1/cfe.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/7.1/err.english.cc b/tools/ido_recomp/windows/7.1/err.english.cc deleted file mode 100644 index b5d5be36e..000000000 --- a/tools/ido_recomp/windows/7.1/err.english.cc +++ /dev/null @@ -1,1260 +0,0 @@ -@ - 358 358 358 - 6464 6482 6553 - 6553 6593 6728 - 6728 6746 6803 - 6803 6808 6808 - 6808 6818 6818 - 6818 6826 6826 - 6826 6847 6847 - 6847 6875 6922 - 6922 6930 6930 - 6930 6939 6939 - 6939 6948 6948 - 6948 6974 7120 - 7120 7149 7204 - 7210 7248 7311 - 7317 7350 7442 - 7450 7497 7627 - 7635 7709 7930 - 7938 7975 8063 - 8071 8113 8253 - 8261 8289 8289 - 8298 8338 8445 - 8460 8502 8635 - 8650 8690 8819 - 8834 8857 8965 - 8965 9008 9113 - 9119 9142 9227 - 9235 9282 9451 - 9451 9462 9462 - 9462 9477 9477 - 9477 9497 9497 - 9497 9545 9545 - 9545 9584 9584 - 9584 9604 9662 - 9662 9682 9720 - 9720 9749 9749 - 9749 9788 9788 - 9788 9802 9802 - 9802 9829 9829 - 9829 9861 9861 - 9861 9904 9904 - 9904 9920 9920 - 9920 9962 9962 - 9962 9988 9988 - 9988 10014 10014 -10014 10035 10035 -10035 10054 10097 -10097 10115 10115 -10115 10147 10147 -10147 10183 10183 -10183 10208 10208 -10208 10236 10236 -10236 10269 10269 -10269 10304 10304 -10304 10328 10328 -10328 10351 10351 -10351 10371 10371 -10371 10402 10402 -10402 10447 10447 -10447 10497 10497 -10497 10533 10533 -10533 10598 10598 -10606 10630 10630 -10640 10671 10671 -10690 10719 10719 -10728 10752 10795 -10795 10837 10837 -10837 10876 10876 -10876 10900 10900 -10900 10948 10948 -10960 11021 11103 -11103 11128 11128 -11128 11153 11153 -11153 11216 11216 -11216 11239 11239 -11239 11303 11303 -11303 11347 11347 -11357 11393 11393 -11393 11432 11432 -11442 11494 11494 -11494 11536 11536 -11536 11595 11595 -11595 11622 11622 -11622 11684 11684 -11684 11726 11726 -11738 11778 11778 -11782 11813 11813 -11813 11850 11850 -11850 11900 12087 -12111 12120 12120 -12120 12129 12129 -12129 12158 12158 -12158 12192 12192 -12192 12237 12237 -12237 12273 12273 -12273 12326 12326 -12330 12366 12366 -12366 12423 12423 -12427 12482 12482 -12486 12560 12560 -12568 12631 12631 -12637 12691 12691 -12691 12743 12743 -12743 12785 12785 -12785 12826 12826 -12826 12865 12865 -12865 12883 12883 -12883 12946 12946 -12956 12995 12995 -13005 13066 13066 -13077 13163 13163 -13163 13211 13211 -13211 13270 13270 -13270 13318 13318 -13318 13350 13350 -13350 13387 13387 -13387 13428 13428 -13428 13464 13533 -13533 13580 13737 -13737 13776 13854 -13854 13913 13913 -13913 13950 13950 -13950 14118 14118 -14118 14150 14150 -14150 14163 14194 -14194 14224 14255 -14255 14275 14319 -14319 14353 14458 -14466 14484 14530 -14534 14567 14567 -14567 14635 14682 -14690 14742 14742 -14742 14789 14789 -14801 14875 14875 -14886 14947 14947 -14947 14992 14992 -14992 15035 15085 -15085 15134 15205 -15214 15267 15448 -15454 15496 16810 -16822 16875 16960 -16972 17053 17179 -17191 17236 17332 -17344 17491 17841 -17853 17939 18304 -18316 18471 18774 -18786 18952 19323 -19335 19364 19496 -19500 19527 19598 -19598 19613 19776 -19797 19808 19837 -19837 19862 19862 -19868 19927 20026 -20034 20075 20179 -20187 20223 20223 -20223 20290 20382 -20392 20441 20589 -20601 20656 20656 -20656 20699 20818 -20826 20860 21038 -21046 21094 21191 -21203 21236 21314 -21326 21395 21457 -21469 21502 21502 -21502 21587 21731 -21756 21789 21864 -21875 21901 21976 -22013 22059 22220 -22257 22397 22561 -22561 22595 22595 -22603 22623 22623 -22631 22667 22828 -22865 22919 22994 -23031 23059 23120 -23132 23201 23201 -23212 23274 23274 -23285 23345 23345 -23356 23393 23393 -23399 23431 23532 -23542 23587 23646 -23656 23697 23745 -23755 23796 23844 -23854 23876 23928 -23942 23971 24153 -24160 24243 24243 -24247 24273 24743 -24755 24784 24984 -24996 25034 25034 -25034 25075 25273 -25281 25332 25410 -25420 25467 25544 -25554 25583 25744 -25754 25783 26061 -26071 26111 26185 -26194 26239 26525 -26535 26568 26914 -26924 26951 26998 -27008 27035 27082 -27093 27120 27167 -27178 27206 27251 -27261 27289 27334 -27345 27391 27931 -27938 27959 28007 -28019 28037 28037 -28043 28069 28069 -28077 28147 28199 -28207 28266 28266 -28274 28306 28306 -28314 28339 28339 -28347 28404 28510 -28518 28567 28682 -28690 28728 28728 -28736 28782 29023 -29033 29085 29234 -29246 29303 29383 -29395 29432 29570 -29592 29631 29644 -29644 29693 29758 -29767 29810 29875 -29875 29911 29976 -29984 30014 30014 -30027 30086 30151 -30157 30223 30293 -30301 30369 30445 -30457 30511 30568 -30580 30630 30743 -30755 30812 30874 -30886 30959 31035 -31043 31076 31175 -31183 31243 31243 -31251 31323 31323 -31331 31433 31433 -31445 31544 31686 -31698 31740 31740 -31740 31783 31783 -31783 31824 31824 -31824 31873 31996 -32008 32056 32164 -32176 32210 32210 -32229 32271 32271 -32279 32323 32569 -32581 32642 32718 -32739 32779 32916 -32926 32953 33047 -33057 33116 33315 -33325 33373 33373 -33373 33407 33469 -33494 33527 33527 -33536 33573 33573 -33584 33650 33697 -33705 33763 33763 -33763 33797 33797 -33797 33829 33906 -33915 33976 33976 -33985 34016 34098 -34098 34133 34198 -34198 34261 34261 -34269 34312 34312 -34324 34363 34438 -34444 34530 34530 -34538 34596 34626 -34636 34675 34754 -34764 34821 34821 -34821 34867 34950 -34959 35016 35135 -35145 35198 35198 -35208 35266 35344 -35355 35382 35537 -35547 35576 35629 -35637 35705 35705 -35713 35764 35764 -35764 35784 35876 -35888 35932 35950 -35950 36013 36138 -36150 36191 36280 -36286 36314 36419 -36431 36516 36516 -36516 36554 36642 -36642 36689 36808 -36818 36881 37105 -37113 37183 37204 -37204 37225 37225 -37225 37255 37348 -37348 37388 37388 -37388 37454 37454 -37454 37518 37518 -37518 37584 37584 -37584 37717 37717 -37717 37752 37752 -37752 37783 37889 -37901 37928 38034 -38046 38115 38115 -38115 38140 38187 -38195 38219 38339 -38351 38422 38422 -38422 38486 38486 -38486 38555 38555 -38555 38619 38619 -38619 38641 38641 -38641 38758 38758 -38758 38929 38929 -38929 38975 39043 -39055 39084 39133 -39133 39175 39265 -39275 39310 39494 -39504 39547 39576 -39587 39614 39668 -39674 39697 39797 -39797 39845 40094 -40094 40158 40264 -40264 40369 40523 -40523 40593 40593 -40593 40629 40876 -40876 40911 40971 -40977 41026 41026 -41038 41077 41077 -41077 41116 41116 -41116 41156 41156 -41156 41195 41195 -41195 41237 41237 -41237 41285 41285 -41285 41304 41304 -41304 41371 41371 -41371 41429 41429 -41429 41491 41491 -41491 41519 41519 -41519 41572 41572 -41572 41642 41642 -41642 41676 41676 -41676 41713 41713 -41713 41751 41751 -41751 41792 41792 -41792 41856 41856 -41856 41881 41881 -41881 41944 41944 -41944 41985 41985 -41985 42026 42026 -42026 42098 42098 -42098 42170 42170 -42170 42213 42213 -42213 42275 42275 -42275 42302 42302 -42302 42317 42317 -42317 42346 42394 -42401 42433 42530 -42538 42585 42585 -42585 42631 42631 -42631 42651 42733 -42733 42756 42756 -42756 42837 42905 -42909 42960 42960 -42960 42986 43033 -43033 43124 43124 -43124 43179 43179 -43179 43212 43384 -43394 43461 43479 -43479 43555 43788 -43806 43929 44124 -44128 44128 44128 -Out of memory: %s -There is no more memory left in the system for compiling this program. -Internal Error Unknown Error Message %s -1) An internal error, while attempting to print an unavailable message -2) The error message file is inaccessible or has other problems -Unknown Signal %s -1) An unknown signal has been caught -2) 2 Nested signals -line -Warning: -Fatal: -Source not available -Too many errors... goodbye. -There is a limit of 30 errors before aborting. -Error: -reserved -reserved -Unknown Control Statement -1) The line begins with a '#' and is not of the form: - # "" -2) Please compile this program with the preprocessor enabled. -Unknown character %s ignored -The character is not part of the source character set. -2.2.1 -Unknown control character \%s ignored -The control character is not part of the source character set. -2.2.1 -Illegal character %s in exponent -1) Digits or sign expected after 'e' or 'E'. -2) Digits are expected after sign in exponent. -3.1.3.1 -Constant is out of range and may be truncated. -The constant is too large to be accurately represented and may be -truncated. The limits are in the system include file limits.h. -2.2.4.2 -Constant is out of range for a 32-bit data type, but accepted as written. -The constant is too large to fit in a 32-bit data type, but will be -accurately represented in a wider data type. The value may be truncated, -depending on its context. The limits are in the system include file -limits.h. -2.2.4.2 -Character constant size out of range -1) No characters in a character constant. -2) More than 4 bytes in a character constant. -3.1.3.4 -Wide character constant size out of range -1) No characters in the multibyte sequence (0 assumed). -2) More than 1 byte in the multi-byte sequence (only the first byte was converted). -3.1.3.4 -Invalid multibyte character -4.10.7.2 -Newline in string or character constant -1) Terminate your string or character constant with closing quotes. -2) Put a backslash before the newline. -3.1.3.4, 3.1.4 -Octal character escape too large: %s > %s -1) Terminate end of octal sequence with a non-octal character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Hex character escape too large: %s > %s -1) Terminate end of hex sequence with a non-hex character. -2) Select a character value within the limits. -Value may be truncated -3.1.3.4, 3.1.4 -Unexpected End-of-file -1) Unterminated string or character constant -2) Missing closing comment marker (*/) -3) File system problems -Unrecognized escape sequence in string \%s -Recognized escape sequences are \a, \b, \f, \n, \r, \t, and \v. -Character will be treated as un-escaped. -3.9.2 -Illegal octal digit %s -Octal constants, beginning with 0, must only have digits between 0 and 7, -inclusive. -3.1.3.2 -Unable to open temporary file for compiling %s -1) TMPDIR environment variable is set to a directory that you have no - permissions for. -2) The file system is full. -3) System errors beyond the scope of the compiler. -%s: Hangup -%s: Interrupt -%s: Quit (ASCII FS) -%s: Illegal instruction (not reset when caught) -%s: Trace trap (not reset when caught) -%s: IOT instruction -Also SIGABRT, used by abort, replace SIGIOT in the future -%s: EMT instruction -Also SIGXCPU, Exceeded CPU time limit -%s: Floating point exception -%s: Kill (cannot be caught or ignored) -%s: Bus error -%s: Segmentation violation -%s: Bad argument to system call -%s: Write on a pipe with no one to read it -%s: Alarm clock -%s: Software termination signal from kill -%s: User defined signal 1 -%s: User defined signal 2 -%s: Death of a child -Power-fail restart -%s: Also SIGXFSZ, exceeded file size limit -%s: Window change -%s: Handset, line status change -%s: Sendablestop signalnot from tty -%s: Stop signal from tty -%s: Pollable event occurred -%s: Input/Output possible signal -%s: Urgent condition on IO channel -%s: Window size changes -%s: Virtual time alarm -%s: Profiling alarm -%s: Continue a stopped process -%s: To readers pgrp upon background tty read -%s: Like TTIN for output if (tp->t_local<OSTOP) -%s: Resource lost (eg, record-lock) -'auto' and 'register' are not allowed in an external declaration -3.7(10) -must have function type -3.7.1(30) -Functions cannot return arrays -3.7.1(33), 3.3.2.2 -Declaration list not allowed -3.7.1(5) -Too many input files %s -The command line may contain only one file -cpp internal error: input stack underflow -cpp internal error: if stack underflow -Cannot open the file %s -No new-line character at the end of the file %s -2.1.1.2(30) -Fatal: Exceeded the limit of nesting level for #include file -Fatal: Exceeded the limit of nesting level for #include file. This limit -is 200. -Fail to read the file %s -Cannot write the file %s -%s: %s: An if directive is not terminated properly in the file -%s: %s: nested comment -%s:%s: Illegal macro name %s; macro name shall be an identifier -%s:%s: Illegal preprocessing token sequence -3.8.3(35) -%s:%s: Illegal macro parameter name -%s:%s: Non-unique macro parameter name -3.8.3(18) -%s:%s: Missing ')' in parameter list for #define %s -%s:%s: Missing ')' in macro instantiation -%s:%s: Bad punctuator in the parameter list for #define %s -%s:%s: Macro %s redefined. -%s:%s: # operator should be followed by a macro argument name -%s:%s: Badly formed constant expression%s -3.4(9), 3.8 -%s:%s: Division by zero in #if or #elif -3.8 -unknown command line option %s -extraneous input/output file name %s -%s: %s: Unterminated string or character constant -A preprocessing string or character constant token was not -terminated. Note that preprocessing directives are processed -after the source file has been divided into preprocessing tokens. -2.1.1.2(30) 3.1(18) 3.8 -%s: %s: -%s: %s: -%s: %s: Unterminated comment -%s: %s: Unknown directive type %s -%s: %s: #elif or #else after #else directive -%s: %s: Bad identifier after the %s -%s: %s: #%s accepts only one identifier as parameter -3.8 -%s: %s: Bad identifier after the %s -%s: %s: text following #%s violates the ANSI C standard. -3.8 -%s: %s: Bad character %s occurs after the # directive. -3.8 -%s: %s: the ## operator shall not be the %s token in the replacement list -3.8.3.3 -%s: %s: the defined operator takes identifier as operand only. -3.8.1 -%s: %s: Not in a conditional directive while using %s -%s: %s: Illegal filename specification for #include -%s: %s: Invalid file name %s for #include -%s: %s: Cannot open file %s for #include -%s: %s: Bad argument for #line command -%s: %s: #error %s -%s: %s: Tried to redefine predefined macro %s, attempt ignored -3.8.7(22) -%s: %s: Undefining predefined macro %s -3.8.7(22) -%s: %s: Undefined the ANSI standard library defined macro %s -4.1.2.1(9) -%s: %s: The number of arguments in the macro invocation does not match the definition -%s: %s: Illegal character %s in preprocessor if -%s: %s: Illegal character %s for number in preprocessor if -%s: %s: No string is allowed in preprocessor if -%s: %s: Not supported pragma %s -%s: %s: Not supported #pragma format -%s: %s: ANSI C does not allow #ident; %s -%s: %s: Not supported #ident format -This cpp extension accepts the following format: -#ident "any string" -%s: %s: Not supported #assert/#unassert format -This cpp extension accepts the following format: -#assert identifier -#assert identifier ( pp-tokens ) -#unassert identifier -#unassert identifier ( pp-tokens ) -%s: %s: Bad assertion predicate format -The correct syntax for this cpp extension is: -#assert identifier ( pp-token ) -%s: %s: directive is an upward-compatible ANSI C extension -%s: This option requires an argument -%s: %s: A macro has expanded recursively more than %s times. Further expansion will be disabled! Use command-line option: -Wp,-max_rec_depth=depth to recurse deeper. -A status return from cpp to cfe -Syntax Error -The token read was unexpected. -Syntax Error -- cannot backup -The token read was unexpected. -Yacc stack overflow -The expression is too complicated to parse. -Trailing comma in enumerator list -The use of a trailing comma in an enumerator list is not standard C. There -may be portability problems. -3.5.2.2 -Empty declaration -Empty declarations are invalid in standard C. -3.5 -%s declared, but not referenced. -redeclaration of '%s'; previous declaration at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -'%s' undefined; reoccurrences will not be reported. -Non-function name referenced in function call. -3.3.2.2(18) -The number of arguments doesn't agree with the number in the declaration. -3.3.2.2(5) -'%s' section name longer than 8 characters. Name truncated. -'%s' is already placed by pragma alloc_text. -Cannot write ucode file while compiling %s -1) The file system is full -2) Permissions problem -Must have corresponding formal argument for '%s' -Parameter found in the declaration part, but not in the argument list. -3.7.1(7) -Non-prototype declaration is an obsolescent feature. -The use of function definitions with separate parameter identifier -and declaration lists (not prototype-format parameter type and -identifier declarators) is an obsolescent feature. -3.9.5 -Incompatible function declarations for %s -For two function types to be compatible, both shall specify compatible -return types. Moreover, the parameter type lists, if both are present, -shall agree in the number of parameters and in use of the ellipsis -terminator; corresponding parameters shall have compatible types. If -one type has a parameter type list and the other type is specified by -a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. If one type has a parameter type list and the -other is specified by a function definition that contains a (possibly -empty) identifier list, both shall agree in the number of parameters, -and the type of each prototype parameter shall be compatible with the -type that results from application of the default argument promotions -to the type of the corresponding identifier. (For each parameter -declared with function or array type, its type for these comparisons -is the one that results from conversion to a pointer type. For each -parameter declared with qualified type, its type for these comparisons -is the unqualified version of its declared type.) There you have it! -3.5.4.3(15) -Incompatible function return type for this function. -For two function types to be compatible, both shall specify compatible -return types. -3.5.4.3(15) -The number of parameters for function is different from the previous declaration -The parameter type lists, if both are present, shall agree in the -number of parameters and in use of the ellipsis terminator. -3.5.4.3(15) -Incompatible type for the function parameter -If both parameter type lists are present, corresponding -parameters shall have compatible types. -3.5.4.3(15) -Function %s is redeclared with an incompatible argument type (after default argument promotion), which could lead to undefined run-time behaviour. -The redeclaration could cause arguments at a call site to be passed -inconsistently with what the function implementation expects, and -parameters would therefore be accessed erroneously when executing the -function body. Note that a float argument is promoted to a double -when passed (potentially through fp registers) to an unprototyped -function. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, ellipsis terminator not allowed -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the parameter list shall not have -an ellipsis terminator and the type of each parameter shall be -compatible with they type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype and non-prototype declaration found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other type is specified -by a function declarator that is not part of a function definition and -contains an empty identifier list, the type of each parameter shall be -compatible with the type that results from application of the default -argument promotions. -3.5.4.3(15) -prototype declaration and non-prototype definition found for %s, the type of this parameter is not compatible with the type after applying default argument promotion -If one type has a parameter type list and the other is specified by a -function definition that contains a (possibly empty) identifier list, -both shall agree in the number of parameters, and the type of each -prototype parameter shall be compatible with the type that results -from application of the default argument promotions to the type of the -corresponding identifier. -3.5.4.3(15) -Empty declaration specifiers -Standard C requires at least a storage class specifier, type specifier, -or a type qualifier in declarations. 'extern int' assumed. -3.5 -Can't write to the file %s -1) The output file cannot be opened for writing. -2) Out of file space. -Duplicate '%s' -typedef, extern, static, auto, register, const, volatile may not -appear more than once in the same specifier list or qualifier list. -Duplicate occurrence ignored. -3.5.1(10) , 3.5.3(5) -Null input -There is nothing to compile. -Illegal type combination -3.5.2 -Missing ';' at end of structure / union member declaration -In standard C, each member declaration must be terminated by a ';'. A -terminating ';' is assumed. -3.5.2.1 -Missing member name in structure / union -In standard C, each member declaration have a member name. The missing -member is assumed to not exist. -3.5.2.1 -This variable is initialized twice. -Neither 'const' or 'volatile' have any effect on function results. -Qualifiers only apply to expressions designating an object that -can be altered or examined. -3.5.3(10) -An integer constant expression is required here. -The expression that defines the value of an enumeration constant -shall be an integral constant expression that has a value -representable as an int. -3.5.2.2(28) -(previous declaration of '%s' at line %s in file '%s') -Must be an integer type greater than zero. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -Array size cannot be a long long. -Arrays with more than 2^32 elements are not yet supported. -The array size must be either a char, signed or unsigned integer or -an enumerated type with a value greater than zero. -3.5.4.2 -bit-field '%s' width is not an integer constant -The expression that specifies the width of a bit-field shall be an -integral constant expression. -3.5.2.1(15) -bit-field '%s' width is negative -The expression that specifies the width of a bit-field shall be -non-negative. -3.5.2.1(15) -bit-field '%s' type required to be int, unsigned int, or signed int. -A bit-field shall have type int, unsigned int, or signed int. -3.5.2.1(30) -bit-field %s's type not integer. -Non-scalar type or pointer type to a non-object for increment or decrement operator. -The operand of the prefix/postfix increment or decrement operator shall have scalar type; if it is of pointer type, it must point to an object. -3.3.2.4(37), 3.3.3.1(25) -Assign value to a function type. -An assignment operator shall have a modifiable lvalue as its left operand. -3.2.2.1(5) -Assign value to an array. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for variable of incomplete type. -The operand of increment and decrement operator shall be a modifiable -scalar lvalue. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -The left-hand side of the '.' operator must be an addressable lvalue, when a bit-field is not contained within a unit of 32 bits alignment. -This is a restriction in our implementation, which can be worked -around by always accessing long long bit-fields indirectly (i.e. -by means of the '->' operator). -This expression is not an lvalue. -3.2.2.1 -Modified an rvalue. -3.2.2.1 -Change value for constant variable. -The operand of increment and decrement operators shall be modifiable -scalar lvalues. An assignment operator shall have a modifiable lvalue -as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Change value for constant field of a struct or union. -An assignment operator shall have a modifiable lvalue as its left operand. -3.3.2.4(36), 3.3.3.1(24), 3.2.2.1(5) -Dereferenced a non-pointer. -The operand of the unary * operator shall have pointer type. -3.3.3.2(39) -The operand of the unary + or - operator shall have arithmetic type. -3.3.3.3(6) -The operand of the unary ~ operator shall have integral type. -3.3.3.3(6) -The operand of the unary ! operator shall have scalar type. -3.3.3.3(6) -Constants must have arithmetic type. -3.1.3 -Bad type name for cast operator -The type name for the cast operator should either be void or a -qualified or unqualified scalar type. -3.3.4(22) -Improper cast of non-scalar type expression. -The operand for the cast operator shall be of scalar type. -3.3.4(23) -Cast a pointer into a non-integral type. -A pointer may be converted to an integral type. -3.3.4(31) -Cast a non-integral type into a pointer. -An integral type may be converted to a pointer. -3.3.4(31) -Duplicate member '%s' -Two members of a struct may not have the same name. -3.1.2.2(7,25) -Invalid constant expression. -Constant expressions shall not contain assignment, increment, decrement, -function-call, or comma operators, except when they are contained within -the operand of the sizeof operator. -3.4(9) -Constant expressions must be derived from a constant value or a constant -variable. -3.4 -Dangerous operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. This operand is NOT an lvalue, but we let it pass. -Note that a segmentation error with possible core dump will result -when the resulting address does not denote a valid (declared) -storage location. This feature will be discontinued in future -releases of the compiler! -3.3.3.2(36) -Unacceptable operand of '&'. -The operand of the unary & operator shall be either a function -designator or an lvalue that designates an object that is not a -bit-field and is not declared with the register storage-class -specifier. -3.3.3.2(36) -'&' before array or function; ignored -Unacceptable operand of sizeof operator. -The sizeof operator shall not be applied to an expression that has -function type or an incomplete type, to the parenthesized name of such -a type, or to an lvalue that designates a bit-field object. -3.3.3.4 -Unacceptable operand of a multiplicative operator. -Each of the operands of a multiplicative operator shall have arithmetic type. -3.3.5(18) -Unacceptable operand of the remainder operator -Each of the operands of the remainder (%) operator shall have integral type. -3.3.5(18) -Unacceptable operand of '+'. -For the + operator, either both operands shall have arithmetic type, or -one operand shall be a pointer to an object type and the other shall -have integral type. -3.3.6(39) -Unacceptable operand of '-'. -For the subtraction operator, one of the following shall hold: both operands -have arithmetic type; operands are pointers to qualified or unqualified -versions of compatible object types; or the left operand is a pointer -to an object type and the right operand has integral type. -3.3.6(39) -Unacceptable operand of shift operator. -Each of the operands of bitwise shift operators shall have integral type. -3.3.7(9) -Unacceptable operand of relational operator. -For relational operators, one of the following shall hold: both -operands have arithmetic type; both operands are pointers to qualified -or unqualified versions of compatible object types; or both operands -are pointers to qualified or unqualified versions of compatible -incomplete types. -3.3.8(32) -Unacceptable operand of == or != -For the == or != operator, one of the following shall hold: both operands -are pointers to qualified or unqualified versions of compatible types; one -operand is a pointer to an object or incomplete type and the other is a -pointer to a qualified or unqualified version of void; or one operand is -a pointer and the other is a null pointer constant. -3.3.9(21) -Unacceptable operand of &. -Each of the operands shall have integral type. -3.3.10(7) -Unacceptable operand of ^. -Each of the operands shall have integral type. -3.3.11(18) -Unacceptable operand of |. -Each of the operands shall have integral type. -3.3.12(30) -Unacceptable operand of &&. -Each of the operands shall have scalar type. -3.3.13(7) -Unacceptable operand of ||. -Each of the operands shall have scalar type. -3.3.14(20) -Unacceptable operand of conditional operator. -The first operand of conditional operator shall have scalar type. One -of the following shall hold for the second and third operands: -both operands have arithmetic type; both operands have compatible -structure or union types; both operands have void type; both operands -are pointers to qualified or unqualified versions of compatible types; -one operand is a pointer and the other is a null pointer constant; or -one operand is pointer to an object or incomplete type and the other -is a pointer to a qualified or unqualified version of void. -3.3.15 -Duplicate label '%s' -A label name can only occur once in a function. -3.1.2.1(25) -Division by zero. -3.3.5 -Subscripting a non-array. -3.3.2.1 -Subscripting an array of incomplete type which is not an object type. -The element of the array shall have an object type. -3.3.2.1 -Should only subscript an array with an integral expression -3.3.2.1 -Subscripting an unbounded array -3.3.2.1 -Array index out of range -3.3.2.1 -Selector requires struct/union pointer as left hand side -In K&R mode the expression is implicitly converted to the '.' selector -for a struct/union left-hand side. -3.3.2.3 -Selector requires struct/union as left hand side -In K&R mode the expression is implicitly converted to the '->' selector -for a struct/union pointer left-hand side. -3.3.2.3 -member of structure or union required -3.3.2.3 -types have different qualifier specifications -For two qualified types to be compatible, both shall have the -identically qualified version of a compatible type; qualified -and unqualified versions of a type are distinct types. For two -types to be compatible their types must be the same. -3.5.3(26) -Incompatible array type due to different array size -For two array types to be compatible, both shall have compatible element -types; if both size specifiers are present, they shall have the -same value. -3.5.4.2(11) -Incompatible array type due to incompatible element type -For two array types to be compatible, both shall have compatible element -types. -3.5.4.2(11) -Incompatible pointer type assignment -The type pointed to by the left-hand side of simple assignment -statement is incompatible with the type pointed to by the right-hand side. -3.3.16.1, 3.5.4.1(21) -Incompatible base type of pointer type -K&R feature. -Type %s of %s is incompatible with type %s of %s -Incompatible types can be resolved by casting or by other means. -3.3.16.1 -illegal combination of pointer and integer -Assigning an integral expression to a pointer is a bad practice. -Type for %s is incompatible with %s -Incompatible types can be resolved by casting or by other means. -3.1.2.6 -Bad operand type for += or -= -3.3.16.2(26) -A case or default label appears outside a switch statement -A case or default label shall appear only in a switch statement. -3.6.1 -The controlling expression of the if statement is not scalar type -The controlling expression of an if statement shall have scalar type. -3.6.4.1 -The controlling expression of switch statement is not integral type -The controlling expression of an switch statement shall have integral type. -3.6.4.2(20) -The case label is not an integral constant expression -The case label shall be an integral constant expression. -3.6.4.2(22) -Duplicate case label in the same switch statement -No two of the case constant expressions in the same switch statement -shall have the same value after conversion. -3.6.4.2(22) -More than one default label in the same switch statement -There may be at most one default label in a switch statement. -3.6.4.2(23) -The controlling expression of the iteration statement is not scalar -type -The controlling expression of a iteration statement shall have scalar -type. -3.6.5.1 -label '%s' used, but not defined -The identifier in a goto statement shall name a label located -somewhere in the enclosing function. -3.6.6.1 -A continue statement shall appear only in or as a loop body -3.6.6.2 -A break statement shall appear only in or as a switch body or loop body -3.6.6.3 -A return statement with an expression should not appear -in a function '%s', whose return type is void -3.6.6.4(24) -A return statement without an expression appears in a -function '%s', whose return type is not void -If a return statement without an expression is executed, and the value -of the function call is used by the caller, the behavior is undefined. -3.6.6.4(33) -Internal Error: statement stack underflow -Long double not supported; double assumed. -Long float not standard; double assumed. -Only 'register' allowed in parameter declaration -The only storage-class specifier that shall occur in a parameter -declaration is 'register'; illegal storage class ignored. -3.5.4.3(25) -Name(s) without types in a function declaration -An old-style function declaration is not allowed to have names -in the parameter list; useless names ignored -3.5.4.3(26) -Functions cannot return functions -3.7.1(33), 3.3.2.2 -Functions cannot return a non-object type -3.3.2.2 -enum declaration must contain enum literals -Although structs or unions may delay the declaration of their members, -a similar construction with enum does not exist and is not necessary, -as there can be no mutual dependencies between the declaration of an -enumerated type and any other type. -3.5.2.3(27) -Register qualification has no effect for this type of object -Register declarations for array, struct, and function types have -no effect. -3.5.1(16), 3.5.1(19) -Functions cannot be declared 'register' -The declaration of an identifier for a function that has block -scope shall have no explicit storage-class specifier other than -'extern'. -3.5.1(19) -'%s' cannot be initialized -The type of the entity to be initialized shall be an object type -or an array of unknown size. -3.5.7(32) -Cannot initialize 'extern' variable '%s' within a function -If the declaration of an identifier has block scope, and the -identifier has 'extern' or 'static' linkage, the declaration -shall have no initializer for the identifier; initialization -allowed anyway. -3.5.7(35) -initializing an 'extern' is an ANSI C extension -conflicting declarations for '%s' -'static' and 'extern' declarations conflict. Which is meant? -3.1.2.2(15), 3.1.2.2(27) -Too many initial values for '%s' -3.5.7(1) -incompatible types in initialization -3.3.16(35) -redefinition of '%s'; previous definition at line %s in file '%s' -Identifier redeclared in the same scope/block. -3.1.2.3 -bit-fields as members of a union are an ANSI C invention. -storage size for '%s' isn't known -type mismatch in initialization -Missing braces in a union initialization or illegally formed -initialization. -3.5.7(5) -union '%s' only allowed one initializer for the first member -3.5.7(5) -width of '%s' exceeds its type -the specified bitfield width is too large to be contained within a -bitfield type. -structure has no member named '%s' -This is allowed for compatibility with AT&T pcc-based compilers. -Reference of an expression of void type or an incomplete type. -3.2.2.1 -element size of an array shall not be zero -3.2.2.5(25) -invalid combination of type specifiers -Although order is unimportant, not all type specifiers can occur together. -3.5.2 -declaration must at least declare an identifier, tag, or the member of an enumeration -3.5(16) -at most one storage class may be given in the declaration -Duplicate occurrence ignored. -3.5.1(10) -size of function's return type is zero -The return type of a function must be void or an object type other than array. -3.7.1(33) -Expecting an integral return type from the main function -identifier missing from parameter declaration -Prototypes for function definitions require identifiers in parameter -declarations. -3.7.1(4) -only 'register' allowed for storage class for parameters -The declarations in the declaration list shall contain no storage class -other than 'register', and no initializations. -3.7.1(10) -parameters declarations can not have initializations -3.7.1(10) -only one instance of 'void' allowed in the parameter list -'void' must occur by itself (specifying that the function has no parameters). -3.5.4.3(1) -%s must have function type -1) An argument list must be explicitly present in the declarator; it cannot - be inherited from a typedef (3.5.4.3). -2) The declarator is not a function. -3.7.1(30) -Illegal hexadecimal constant -You have no digits after the 0x or 0X. 0x0 assumed. -3.1.3.2 -value overflows its type in this context. Value is set to be '%s'! -3.2.1.4 -value is outside range representable for type '%s' -missing member name -K&R mode permits a missing member name; otherwise, only bitfields can omit -the member name. -3.5.2.1(10) -useless keyword or type name in declaration -Type was ignored. -'%s' declared within and is limited to this function prototype -Possible program error, since parameter type checking will always fail -unless the type declaration is visible to the caller. -3.1.2.1(35) -Extra spaces within operator, %s assumed -In ANSI C, the compound assignment operator cannot have embedded -white space characters. -3.1.5 -missing size for array '%s' -Incomplete types permitted for identifiers with internal or -external linkage, but not automatic linkage. -3.1.2.5(10) -can't jump into (from outside of) the body of a 'try' or into either type of handler -'%s' missing, please #include excpt.h -excpt.h required to declare exception statements, intrinsics or compiler -runtime names. -local function declarations cannot be 'static' -A function declaration can only contain the storage-class 'static' -if it is at file scope. Declaration made 'extern'. -3.5.1(19) -static function '%s' declared and referenced, but not defined. -If an identifier declared with internal linkage is used in an -expression (other than as a part of the operand of a sizeof -operator), there shall be exactly one external definition for -the identifier in the translation unit. -3.7(12) -pragma argument '%s' must be declared prior to being used in a pragma -Pragma name ignored. -Pragma not supported -'%s' not enabled as intrinsic -It may have already appeared in a function pragma, or never occurred in -an intrinsic pragma. -'%s' is already enabled as an intrinsic -weak definition for '%s' is later redefined; pragma weak ignored. -definition of primary name '%s' not found; pragma weak ignored. -definition of secondary name '%s' not found; pragma weak ignored. -primary name '%s' is declared as a common or external, and is not defined -with initial value within this file; pragma weak ignored. -useless '%s' storage class ignored -array of functions not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -array of voids not allowed -The element type must be an object type representing a region -of data storage which can represent values. -3.1.2.5(23) -argument for pragma pack must be an integer constant; pragma ignored -'%s' has wrong tag type. -Identifier redeclared in the same scope/block. -3.1.2.3 -missing dimension bound -For multidimensional arrays, the constant bounds of the array may be -omitted only for the first member of the sequence. -3.1.2.5(23) -Internal error in parameters to function substr; loc: '%s'; len: '%s'. -Internal error in parameters to function insertstr; indx: '%s'. -Internal error in function get_tag_name; input is a non-tagged type. -Internal error in function gen_type_str -- not a type tree '%s' -Cannot open file '%s' -Prototype should be moved after tag or a typedef declaration. -Please look for comments in the extracted header file. -The extracted header file includes prototypes for static functions, -which should be removed, if you wish to include the header in a source file -other than the originator. -ANSI C requires formal parameter before "..." -This extension is meant to be used for compatibility with varargs.h -3.5.4.3(35) -syntax error: "&..." invalid -extension used to access "..." formal arguments. -function '%s' initialized like a variable -The type of entity to be initialized shall be an object type or an -array of unknown size. -3.5.7(31) -initializer not an array aggregate -The initializer for an object that has aggregate type shall be a -brace-enclosed list of initializers for the members of the aggregate, -written in increasing subscript or member order. -3.5.7(20) -'%s' type is incomplete; cannot initialize -Was the struct ever defined? -3.5.7.(31) -'%s' is not standard ANSI. -This keyword/type is not defined in strict ANSI mode. -3.1.1 -not a legal asm string -The first operand of an asm string should be, after argument substitution, -a legal assembly string. -The -float option will be ignored in ANSI mode. -The -float option is ignored, since otherwise program semantics would -violate the ANSI standard. In particular, fp constants are always -'double' with ANSI-C, while with -float the type of fp constants will -depend on the context and may be 'float'. -ANSI C support unavailable with C compiler bundled with RISC/os -The C compiler bundled with RISC/os does not support ANSI C. ANSI -C support requires a separate license. -Ignored invalid warning number(s) in -woff option, %s%s ! -Warning numbers must be in the range %s to %s. -The set of warning numbers in cfe is disjoint from the set of warning numbers -in accom, since accom warnings cannot be mapped one-to-one to cfe warnings. -'%s' not handled as an intrinsic due to incompatible argument types . -'__unalign' only qualifies pointers -'__unalign' indicates the object pointed at by pointer is unaligned (e.g., -int * __unalign p). This is an extension to ANSI C and like 'volatile' -and 'const' can follow the '*' in pointer declarations, but unlike both -cannot qualify a base type. -index expression is an anachronism -ANSI C++ doesn't support array index expressions in delete. -5.3.4 -member cannot be of function or incomplete type. -3.5.2.1(12) -Illegal lint option, '%s', is ignored. -cannot open header message buffer file -cannot write header message buffer file -cannot read header message buffer file -cannot seek in header message buffer file -struct/union/enum '%s' is used, but not defined -static '%s' unused -nonportable character comparison (chars may be signed or unsigned) -redundant comparison of unsigned with constant expression -redundant statement, control flow cannot reach this statement -'%s' may be used before set -function parameter '%s' is not used in function '%s' -'%s' can be const qualified, since it is not set within its lifetime. -'%s' is not used in function '%s' -'%s' set but unused in function '%s' -control may fall through %s statement -function '%s' has return(e); and return; -function '%s' may return random value to place of invocation %s -label without goto: '%s' -only %s bits of '%s' constant (type '%s') are explicitly given -explicit conversion from '%s' to '%s' %s -implicit conversion from '%s' to '%s' %s -'%s' may be indistinguishable from '%s' due to internal name truncation -Promoted formal parameter and promoted argument have incompatible types -No prototype for the definition of '%s' %s -References to '%s' are substituted by its literal initializer - (as included in %s) -============== -unsupported language linkage -string-literal specifies an unsupported linkage -7.4(1) -No prototype for the call to %s -To achieve better type-checking, there should be a full prototype for -the function being called. -3.5.4.3 -'inline' only applies to function declarations -leave statment can occur only within try body -Microsoft extension -Use of a Microsoft extension detected without usage of the -compiler option -msft. -No parameter mentioned -A file with no declarations or definitions is accepted as an extension to ANSI C -The translation unit must contain at least one external definition. -3.7 -Incompatible signed and unsigned version of a type -Yacc initialization error -Internal error: yacc cannot initialize itself. -The cfe option %s may not be in future releases. We suggest that you not use this option! -Incompatible char and unsigned char versions of a type -Lshift with undefined behaviour. -Lshift with a negative right operand, or a right operand that is greater -than or equal to the width in bits of the promoted left operand, results -in undefined behaviour. -3.3.7(11) -useless type name in declaration, possibly a semicolon is missing. -Type was ignored. -constant initializer expression is invalid (refers to automatic variables). -All the expressions in an initializer for an object that has static storage -duration or in the initializer list for an object that has aggregate or -union type shall be constant expressions. Otherwise, unexpected results -may occur. -3.5.7(32) and 3.4 -invalid explicit or implicit conversion of an address constant to an integral value in a constant initializing expression. -An address constant in a constant initializing expression can neither -initialize a bit-field nor be directly or indirectly converted to an -integral type of size different from an address type. -6.4 diff --git a/tools/ido_recomp/windows/7.1/ugen.exe b/tools/ido_recomp/windows/7.1/ugen.exe deleted file mode 100755 index 30577e396..000000000 Binary files a/tools/ido_recomp/windows/7.1/ugen.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/7.1/ujoin.exe b/tools/ido_recomp/windows/7.1/ujoin.exe deleted file mode 100755 index 18fc825bc..000000000 Binary files a/tools/ido_recomp/windows/7.1/ujoin.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/7.1/uld.exe b/tools/ido_recomp/windows/7.1/uld.exe deleted file mode 100755 index a0bb88593..000000000 Binary files a/tools/ido_recomp/windows/7.1/uld.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/7.1/umerge.exe b/tools/ido_recomp/windows/7.1/umerge.exe deleted file mode 100755 index 3e6698ada..000000000 Binary files a/tools/ido_recomp/windows/7.1/umerge.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/7.1/uopt.exe b/tools/ido_recomp/windows/7.1/uopt.exe deleted file mode 100755 index ae714d528..000000000 Binary files a/tools/ido_recomp/windows/7.1/uopt.exe and /dev/null differ diff --git a/tools/ido_recomp/windows/7.1/usplit.exe b/tools/ido_recomp/windows/7.1/usplit.exe deleted file mode 100755 index f61837d0f..000000000 Binary files a/tools/ido_recomp/windows/7.1/usplit.exe and /dev/null differ diff --git a/tools/m2ctx.py b/tools/m2ctx.py deleted file mode 100755 index 7e5c522c8..000000000 --- a/tools/m2ctx.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/python3 - -import os -import sys -import subprocess -import argparse -from pathlib import Path - -script_dir = os.path.dirname(os.path.realpath(__file__)) -root_dir = script_dir + "/../" -src_dir = root_dir + "src/" - - -def get_c_dir(dirname): - for root, dirs, files in os.walk(src_dir): - for directory in dirs: - if directory == dirname: - return os.path.join(root, directory) - - -def get_c_file(directory): - for root, dirs, files in os.walk(directory): - for file in files: - if file.endswith(".c") and "data" not in file: - return file - - -def import_c_file(in_file): - in_file = os.path.relpath(in_file, root_dir) - cpp_command = ["gcc", "-E", "-P", "-Iinclude", "-Isrc", "-undef", "-DM2CTX", "-D__sgi", "-D_LANGUAGE_C", - "-DNON_MATCHING", "-D_Static_assert(x, y)=", "-D__attribute__(x)=", in_file] - try: - return subprocess.check_output(cpp_command, cwd=root_dir, encoding="utf-8") - except subprocess.CalledProcessError: - print( - "Failed to preprocess input file, when running command:\n" - + cpp_command, - file=sys.stderr, - ) - sys.exit(1) - - -def main(): - parser = argparse.ArgumentParser(usage="./m2ctx.py path/to/file.c or ./m2ctx.py (from an actor or gamestate's asm dir)", - description="Creates a ctx.c file for mips2c. " - "Output will be saved as oot/ctx.c") - parser.add_argument('filepath', help="path of c file to be processed") - args = parser.parse_args() - - if args.filepath: - c_file_path = args.filepath - print("Using file: {}".format(c_file_path)) - else: - this_dir = Path.cwd() - c_dir_path = get_c_dir(this_dir.name) - if c_dir_path is None: - sys.exit( - "Cannot find appropriate c file dir. In argumentless mode, run this script from the c file's corresponding asm dir.") - c_file = get_c_file(c_dir_path) - c_file_path = os.path.join(c_dir_path, c_file) - print("Using file: {}".format(c_file_path)) - - output = import_c_file(c_file_path) - - with open(os.path.join(root_dir, "ctx.c"), "w", encoding="UTF-8") as f: - f.write(output) - - -if __name__ == "__main__": - main() diff --git a/tools/mkdmadata.c b/tools/mkdmadata.c index c83864b55..fbbd5da9e 100644 --- a/tools/mkdmadata.c +++ b/tools/mkdmadata.c @@ -16,24 +16,38 @@ static void write_dmadata_table(FILE *fout) { int i; - for (i = 0; i < g_segmentsCount; i++) + for (i = 0; i < g_segmentsCount; i++) { + // Don't emit dma entry for segments set with NOLOAD + if (g_segments[i].flags & FLAG_NOLOAD) { + continue; + } + fprintf(fout, "DEFINE_DMA_ENTRY(%s, \"%s\")\n", g_segments[i].name, g_segments[i].name); + } } static void write_compress_ranges(FILE *fout) { int i; + int rom_index = 0; bool continue_list = false; int stride_first = -1; for (i = 0; i < g_segmentsCount; i++) { - if (g_segments[i].compress) { - if (stride_first == -1) - stride_first = i; + bool compress = g_segments[i].compress; + + // Don't consider segments set with NOLOAD when calculating indices + if (g_segments[i].flags & FLAG_NOLOAD) { + continue; } - if (!g_segments[i].compress || i == g_segmentsCount - 1) { + + if (compress) { + if (stride_first == -1) + stride_first = rom_index; + } + if (!compress || i == g_segmentsCount - 1) { if (stride_first != -1) { - int stride_last = i - 1; + int stride_last = compress ? rom_index : rom_index - 1; if (continue_list) { fprintf(fout, ","); } @@ -46,6 +60,8 @@ static void write_compress_ranges(FILE *fout) stride_first = -1; } } + + rom_index++; } } diff --git a/tools/mkldscript.c b/tools/mkldscript.c index ed61e543e..9157bc79d 100644 --- a/tools/mkldscript.c +++ b/tools/mkldscript.c @@ -51,11 +51,13 @@ static void write_ld_script(FILE *fout) " ..%s ", seg->name, seg->name, seg->name, seg->name); if (seg->fields & (1 << STMT_after)) - fprintf(fout, "_%sSegmentEnd ", seg->after); + fprintf(fout, "(_%sSegmentEnd + %i) & ~ %i ", seg->after, seg->align - 1, seg->align - 1); else if (seg->fields & (1 << STMT_number)) fprintf(fout, "0x%02X000000 ", seg->number); else if (seg->fields & (1 << STMT_address)) fprintf(fout, "0x%08X ", seg->address); + else + fprintf(fout, "ALIGN(0x%X) ", seg->align); // (AT(_RomSize) isn't necessary, but adds useful "load address" lines to the map file) fprintf(fout, ": AT(_RomSize)\n {\n" @@ -64,9 +66,6 @@ static void write_ld_script(FILE *fout) " _%sSegmentTextStart = .;\n", seg->name, seg->name); - if (seg->fields & (1 << STMT_align)) - fprintf(fout, " . = ALIGN(0x%X);\n", seg->align); - for (j = 0; j < seg->includesCount; j++) { fprintf(fout, " %s (.text)\n", seg->includes[j].fpath); @@ -109,8 +108,6 @@ static void write_ld_script(FILE *fout) fprintf(fout, " %s (.data)\n" " . = ALIGN(0x10);\n", seg->includes[j].fpath); - fprintf(fout, " %s (.rodata)\n" - " . = ALIGN(0x10);\n", seg->includes[j].fpath); // Compilers other than IDO, such as GCC, produce different sections such as // the ones named directly below. These sections do not contain values that // need relocating, but we need to ensure that the base .rodata section @@ -119,12 +116,11 @@ static void write_ld_script(FILE *fout) // the beginning of the entire rodata area in order to remain consistent. // Inconsistencies will lead to various .rodata reloc crashes as a result of // either missing relocs or wrong relocs. - fprintf(fout, " %s (.rodata.str1.4)\n" - " . = ALIGN(0x10);\n", seg->includes[j].fpath); - fprintf(fout, " %s (.rodata.cst4)\n" - " . = ALIGN(0x10);\n", seg->includes[j].fpath); - fprintf(fout, " %s (.rodata.cst8)\n" - " . = ALIGN(0x10);\n", seg->includes[j].fpath); + fprintf(fout, " %s (.rodata)\n" + " %s (.rodata.str*)\n" + " %s (.rodata.cst*)\n" + " . = ALIGN(0x10);\n", + seg->includes[j].fpath, seg->includes[j].fpath, seg->includes[j].fpath); } fprintf(fout, " _%sSegmentRoDataEnd = .;\n", seg->name); @@ -169,9 +165,6 @@ static void write_ld_script(FILE *fout) " _%sSegmentBssStart = .;\n", seg->name, seg->name, seg->name, seg->name); - if (seg->fields & (1 << STMT_align)) - fprintf(fout, " . = ALIGN(0x%X);\n", seg->align); - for (j = 0; j < seg->includesCount; j++) fprintf(fout, " %s (.sbss)\n" " . = ALIGN(0x10);\n", seg->includes[j].fpath); diff --git a/tools/msgdis.py b/tools/msgdis.py old mode 100644 new mode 100755 index a946779fa..72045e13f --- a/tools/msgdis.py +++ b/tools/msgdis.py @@ -5,6 +5,9 @@ import re, struct from os import path +import argparse + +VERSION = "" # =================================================== # Util @@ -258,12 +261,14 @@ textbox_ypos = { 3: "TEXTBOX_POS_BOTTOM", } -# message entry tables vrom addresses -nes_message_entry_table_addr = 0x00BC24C0 -ger_message_entry_table_addr = 0x00BC66E8 -fra_message_entry_table_addr = 0x00BC87F8 -staff_message_entry_table_addr = 0x00BCA908 -staff_message_entry_table_addr_end = 0x00BCAA90 +# Global variables for baserom version and message entry table vrom addresses, +# set based on command line arguments in main() +version = None +nes_message_entry_table_addr = None +ger_message_entry_table_addr = None +fra_message_entry_table_addr = None +staff_message_entry_table_addr = None +staff_message_entry_table_addr_end = None nes_message_entry_table = [] ger_message_entry_table = [] @@ -280,9 +285,10 @@ def read_tables(): global combined_message_entry_table global staff_message_entry_table + global VERSION baserom = None - with open("baseroms/gc-eu-mq-dbg/baserom-decompressed.z64","rb") as infile: + with open(f"baseroms/{version}/baserom-decompressed.z64","rb") as infile: baserom = infile.read() nes_message_entry_table = as_message_table_entry(baserom[nes_message_entry_table_addr:ger_message_entry_table_addr]) @@ -314,6 +320,7 @@ def fixup_message(message): def dump_all_text(): # text id, ypos, type, nes, ger, fra + global VERSION messages = [] for i,entry in enumerate(combined_message_entry_table,0): if entry[0] == 0xFFFD: @@ -326,7 +333,7 @@ def dump_all_text(): nes_offset = segmented_to_physical(entry[3]) nes_length = next_entry[3] - entry[3] nes_text = "" - with open("baseroms/gc-eu-mq-dbg/segments/nes_message_data_static","rb") as infile: + with open(f"extracted/{version}/baserom/nes_message_data_static","rb") as infile: infile.seek(nes_offset) nes_text = fixup_message(decode(infile.read(nes_length), entry[1]).replace("\x00","",-1)) @@ -337,13 +344,13 @@ def dump_all_text(): next_entry = combined_message_entry_table[i+2] ger_offset = segmented_to_physical(entry[4]) ger_length = next_entry[4] - entry[4] - with open("baseroms/gc-eu-mq-dbg/segments/ger_message_data_static","rb") as infile: + with open(f"extracted/{version}/baserom/ger_message_data_static","rb") as infile: infile.seek(ger_offset) ger_text = fixup_message(decode(infile.read(ger_length), entry[1]).replace("\x00","",-1)) fra_offset = segmented_to_physical(entry[5]) fra_length = next_entry[5] - entry[5] - with open("baseroms/gc-eu-mq-dbg/segments/fra_message_data_static","rb") as infile: + with open(f"extracted/{version}/baserom/fra_message_data_static","rb") as infile: infile.seek(fra_offset) fra_text = fixup_message(decode(infile.read(fra_length), entry[1]).replace("\x00","",-1)) @@ -352,7 +359,7 @@ def dump_all_text(): return messages def dump_staff_text(): - staff_message_data_static_size = path.getsize("baseroms/gc-eu-mq-dbg/segments/staff_message_data_static") + staff_message_data_static_size = path.getsize(f"extracted/{version}/baserom/staff_message_data_static") # text id, ypos, type, staff messages = [] for i,entry in enumerate(staff_message_entry_table,0): @@ -361,7 +368,7 @@ def dump_staff_text(): staff_offset = segmented_to_physical(entry[3]) # hacky way to ensure the staff message entry table is read all the way to the end staff_length = (staff_message_data_static_size if entry[0] == 0x052F else segmented_to_physical(next_entry[3])) - segmented_to_physical(entry[3]) - with open("baseroms/gc-eu-mq-dbg/segments/staff_message_data_static","rb") as infile: + with open(f"extracted/{version}/baserom/staff_message_data_static","rb") as infile: infile.seek(staff_offset) messages.append((entry[0], entry[1], entry[2], fixup_message(decode(infile.read(staff_length), entry[1]).replace("\x00","",-1)))) else: @@ -375,18 +382,46 @@ def extract_all_text(text_out, staff_text_out): if text_out is not None: out = "" for message in dump_all_text(): - if message[0] == 0xFFFF: + # Skip 0xFFFC and 0xFFFD because they are committed + # Skip 0xFFFF, the last entry + if message[0] in {0xFFFC, 0xFFFD, 0xFFFF}: continue - if message[0] == 0xFFFC: - out += "#ifdef DEFINE_MESSAGE_FFFC\n" - out += f"DEFINE_MESSAGE(0x{message[0]:04X}, {textbox_type[message[1]]}, {textbox_ypos[message[2]]}," + is_nes_message = message[0] == 0xFFFC + if not is_nes_message: + out += "DEFINE_MESSAGE" + else: + out += "DEFINE_MESSAGE_NES" + out += f"(0x{message[0]:04X}, {textbox_type[message[1]]}, {textbox_ypos[message[2]]}," out += "\n" - out += f"{message[3]}" + ("\n" if message[3] != "" else "") + "," + + if message[0] in [0x00B4, 0x00B5]: + out += "#if !GS_COUNT_IN_TEXT\n" + + tokenFreezeMode = ( + "#if DISABLE_PLAYER_FREEZE\n" + + "FADE(\"\\x20\")\n" + + "#endif\n" + ) if message[0] in [0x00B4, 0x00B5] else "" + + out += f"{message[3]}" + ("\n" if message[3] != "" else "") + f"{tokenFreezeMode}," out += "\n" if message[3] != "" else "" - out += f"{message[4]}" + ("\n" if message[4] != "" else "") + "," + out += f"{message[4]}" + ("\n" if message[4] != "" else "") + f"{tokenFreezeMode}," out += "\n" if message[4] != "" else "" - out += f"{message[5]}\n)" + out += f"{message[5]}\n" + tokenFreezeMode + + if message[0] in [0x00B4, 0x00B5]: + out += "#else\n" + out += "\"You got a \" COLOR(RED) \"Gold Skulltula Token\" COLOR(DEFAULT) \"!\\n\"\n" + out += f"\"You've collected \" COLOR(RED) TOKENS COLOR(DEFAULT) \" tokens in total.\"\n{tokenFreezeMode},\n" + out += "\"Du hast eine \" COLOR(RED) \"Goldene Skulltula\" COLOR(DEFAULT) \" zerstört!\\n\"\n" + out += f"\"Sie haben insgesamt \" COLOR(RED) TOKENS COLOR(DEFAULT) \" gesammelt.\"\n{tokenFreezeMode},\n" + out += "\"Vous venez de détruire une \" COLOR(RED) \"Skulltula d'or\" COLOR(DEFAULT) \"!\\n\"\n" + out += f"\"Vous en avez désormais \" COLOR(RED) TOKENS COLOR(DEFAULT) \".\"\n{tokenFreezeMode}" + out += "#endif\n" + + out += ")" + if message[0] == 0xFFFC: out += "\n#endif" out += "\n\n" @@ -404,3 +439,47 @@ def extract_all_text(text_out, staff_text_out): with open(staff_text_out, "w", encoding="utf8") as outfile: outfile.write(out.strip() + "\n") + + +def main(): + global version + global nes_message_entry_table_addr + global ger_message_entry_table_addr + global fra_message_entry_table_addr + global staff_message_entry_table_addr + global staff_message_entry_table_addr_end + + parser = argparse.ArgumentParser( + description="Extract text from the baserom into .h files" + ) + parser.add_argument("--oot-version", help="OOT version", default="gc-eu-mq-dbg", choices=["gc-eu-mq", "gc-eu-mq-dbg", "hackeroot-mq"]) + parser.add_argument("--text-out", help="Path to output .h file for text") + parser.add_argument( + "--staff-text-out", help="Path to output .h file for staff text" + ) + + args = parser.parse_args() + if not (args.text_out or args.staff_text_out): + parser.error("No output file requested") + + version = args.oot_version + if version in {"gc-eu-mq-dbg", "hackeroot-mq"}: + nes_message_entry_table_addr = 0x00BC24C0 + ger_message_entry_table_addr = 0x00BC66E8 + fra_message_entry_table_addr = 0x00BC87F8 + staff_message_entry_table_addr = 0x00BCA908 + staff_message_entry_table_addr_end = 0x00BCAA90 + elif version == "gc-eu-mq": + nes_message_entry_table_addr = 0x00B7E8F0 + ger_message_entry_table_addr = 0x00B82B18 + fra_message_entry_table_addr = 0x00B84C28 + staff_message_entry_table_addr = 0x00B86D38 + staff_message_entry_table_addr_end = 0x00B86EC0 + else: + parser.error("Unsupported OOT version") + + extract_all_text(args.text_out, args.staff_text_out) + + +if __name__ == "__main__": + main() diff --git a/tools/msgenc.py b/tools/msgenc.py index b62b7383c..9af3b8045 100644 --- a/tools/msgenc.py +++ b/tools/msgenc.py @@ -4,6 +4,7 @@ # import argparse, ast, re +import sys def read_charmap(path): with open(path) as infile: @@ -50,22 +51,40 @@ def convert_text(text, charmap): def main(): parser = argparse.ArgumentParser(description="Encode message_data_static text headers") - parser.add_argument("charmap", help="path to charmap file specifying custom encoding elements") - parser.add_argument("input", help="path to file to be encoded") - parser.add_argument("output", help="encoded file") + parser.add_argument( + "input", + help="path to file to be encoded, or - for stdin", + ) + parser.add_argument( + "--output", + "-o", + help="path to write encoded file, or - for stdout", + required=True, + ) + parser.add_argument( + "--charmap", + help="path to charmap file specifying custom encoding elements", + required=True, + ) args = parser.parse_args() charmap = read_charmap(args.charmap) text = "" - with open(args.input, "r") as infile: - text = infile.read() + if args.input == "-": + text = sys.stdin.read() + else: + with open(args.input, "r") as infile: + text = infile.read() text = remove_comments(text) text = convert_text(text, charmap) - with open(args.output, "w", encoding="raw_unicode_escape") as outfile: - outfile.write(text) + if args.output == "-": + sys.stdout.buffer.write(text.encode("raw_unicode_escape")) + else: + with open(args.output, "w", encoding="raw_unicode_escape") as outfile: + outfile.write(text) if __name__ == "__main__": main() diff --git a/tools/namefixer.py b/tools/namefixer.py deleted file mode 100755 index 150d094c4..000000000 --- a/tools/namefixer.py +++ /dev/null @@ -1,509 +0,0 @@ -#!/usr/bin/env python3 - -import os -import argparse - -# all occurrences of keys will be replaced by associated value -simpleReplace = { - "Math_Rand_":"Rand_", - "ACTORTYPE":"ACTORCAT", - "DistToLink":"DistToPlayer", - "HitItem":"HitInfo", - "ENTR_YDAN_BOSS": "ENTR_DEKU_TREE_BOSS", - "ENTR_DDAN_BOSS": "ENTR_DODONGOS_CAVERN_BOSS", - "ENTR_BDAN_BOSS": "ENTR_JABU_JABU_BOSS", - "ENTR_MORIBOSSROOM": "ENTR_FOREST_TEMPLE_BOSS", - "ENTR_FIRE_BS": "ENTR_FIRE_TEMPLE_BOSS", - "ENTR_MIZUSIN_BS": "ENTR_WATER_TEMPLE_BOSS", - "ENTR_JYASINBOSS": "ENTR_SPIRIT_TEMPLE_BOSS", - "ENTR_HAKADAN_BS": "ENTR_SHADOW_TEMPLE_BOSS", - #"ENTR_GANON_BOSS": "ENTR_GANONDORF_BOSS", # ENTR_GANON_BOSS is also in the new names - "ENTR_YDAN": "ENTR_DEKU_TREE", - "ENTR_DDAN": "ENTR_DODONGOS_CAVERN", - "ENTR_BDAN": "ENTR_JABU_JABU", - "ENTR_BMORI1": "ENTR_FOREST_TEMPLE", - "ENTR_HIDAN": "ENTR_FIRE_TEMPLE", - "ENTR_MIZUSIN": "ENTR_WATER_TEMPLE", - "ENTR_JYASINZOU": "ENTR_SPIRIT_TEMPLE", - "ENTR_HAKADANCH": "ENTR_BOTTOM_OF_THE_WELL", - "ENTR_HAKADAN": "ENTR_SHADOW_TEMPLE", - "ENTR_ICE_DOUKUTO": "ENTR_ICE_CAVERN", - "ENTR_MEN": "ENTR_GERUDO_TRAINING_GROUND", - "ENTR_GERUDOWAY": "ENTR_THIEVES_HIDEOUT", - "ENTR_GANONTIKA_SONOGO": "ENTR_INSIDE_GANONS_CASTLE_COLLAPSE", - "ENTR_GANONTIKA": "ENTR_INSIDE_GANONS_CASTLE", - "ENTR_GANON_SONOGO": "ENTR_GANONS_TOWER_COLLAPSE_INTERIOR", - "ENTR_TAKARAYA": "ENTR_TREASURE_BOX_SHOP", - "ENTR_GANON_FINAL": "ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR", - "ENTR_ENTRA_N": "ENTR_MARKET_ENTRANCE_NIGHT", - "ENTR_ENTRA": "ENTR_MARKET_ENTRANCE_DAY", - "ENTR_ENRUI": "ENTR_MARKET_ENTRANCE_RUINS", - "ENTR_MARKET_ALLEY_N": "ENTR_BACK_ALLEY_NIGHT", - "ENTR_MARKET_ALLEY": "ENTR_BACK_ALLEY_DAY", - "ENTR_SHRINE_N": "ENTR_TEMPLE_OF_TIME_EXTERIOR_NIGHT", - "ENTR_SHRINE_R": "ENTR_TEMPLE_OF_TIME_EXTERIOR_RUINS", - "ENTR_SHRINE": "ENTR_TEMPLE_OF_TIME_EXTERIOR_DAY", - "ENTR_KOKIRI_HOME3": "ENTR_TWINS_HOUSE", - "ENTR_KOKIRI_HOME4": "ENTR_MIDOS_HOUSE", - "ENTR_KOKIRI_HOME5": "ENTR_SARIAS_HOUSE", - "ENTR_KOKIRI_HOME": "ENTR_KNOW_IT_ALL_BROS_HOUSE", - "ENTR_KAKARIKO3": "ENTR_BACK_ALLEY_HOUSE", - "ENTR_SHOP1": "ENTR_BAZAAR", - "ENTR_GOLON": "ENTR_GORON_SHOP", - "ENTR_ZOORA": "ENTR_ZORA_SHOP", - "ENTR_DRAG": "ENTR_POTION_SHOP_KAKARIKO", - "ENTR_ALLEY_SHOP": "ENTR_POTION_SHOP_MARKET", - "ENTR_NIGHT_SHOP": "ENTR_BOMBCHU_SHOP", - "ENTR_FACE_SHOP": "ENTR_HAPPY_MASK_SHOP", - "ENTR_LINK_HOME": "ENTR_LINKS_HOUSE", - "ENTR_MALON_STABLE": "ENTR_STABLE", - "ENTR_LABO": "ENTR_IMPAS_HOUSE", - "ENTR_HYLIA_LABO": "ENTR_LAKESIDE_LABORATORY", - "ENTR_TENT": "ENTR_CARPENTERS_TENT", - "ENTR_HUT": "ENTR_GRAVEKEEPERS_HUT", - "ENTR_DAIYOUSEI_IZUMI": "ENTR_GREAT_FAIRYS_FOUNTAIN_MAGIC", - "ENTR_YOUSEI_IZUMI_TATE": "ENTR_FAIRYS_FOUNTAIN", - "ENTR_YOUSEI_IZUMI_YOKO": "ENTR_GREAT_FAIRYS_FOUNTAIN_SPELLS", - "ENTR_KAKUSIANA": "ENTR_GROTTOS", - "ENTR_HAKAANA2": "ENTR_GRAVE_WITH_FAIRYS_FOUNTAIN", - "ENTR_HAKAANA_OUKE": "ENTR_ROYAL_FAMILYS_TOMB", - "ENTR_HAKAANA": "ENTR_REDEAD_GRAVE", - "ENTR_SYATEKIJYOU": "ENTR_SHOOTING_GALLERY", - "ENTR_TOKINOMA": "ENTR_TEMPLE_OF_TIME", - "ENTR_KENJYANOMA": "ENTR_CHAMBER_OF_THE_SAGES", - "ENTR_HAIRAL_NIWA_N": "ENTR_CASTLE_COURTYARD_GUARDS_NIGHT", - "ENTR_HAIRAL_NIWA_": "ENTR_CASTLE_COURTYARD_GUARDS_DAY_", - "ENTR_HIRAL_DEMO": "ENTR_CUTSCENE_MAP", - "ENTR_HAKASITARELAY": "ENTR_WINDMILL_AND_DAMPES_GRAVE", - "ENTR_TURIBORI": "ENTR_FISHING_POND", - "ENTR_NAKANIWA": "ENTR_CASTLE_COURTYARD_ZELDA", - "ENTR_BOWLING": "ENTR_BOMBCHU_BOWLING_ALLEY", - "ENTR_SOUKO": "ENTR_LON_LON_BUILDINGS", - "ENTR_MIHARIGOYA": "ENTR_MARKET_GUARD_HOUSE", - "ENTR_MAHOUYA": "ENTR_POTION_SHOP_GRANNY", - "ENTR_GANON_DEMO": "ENTR_GANON_BOSS", - "ENTR_KINSUTA": "ENTR_HOUSE_OF_SKULLTULA", - "ENTR_SPOT00": "ENTR_HYRULE_FIELD", - "ENTR_SPOT01": "ENTR_KAKARIKO_VILLAGE", - "ENTR_SPOT02": "ENTR_GRAVEYARD", - "ENTR_SPOT03": "ENTR_ZORAS_RIVER", - "ENTR_SPOT04": "ENTR_KOKIRI_FOREST", - "ENTR_SPOT05": "ENTR_SACRED_FOREST_MEADOW", - "ENTR_SPOT06": "ENTR_LAKE_HYLIA", - "ENTR_SPOT07": "ENTR_ZORAS_DOMAIN", - "ENTR_SPOT08": "ENTR_ZORAS_FOUNTAIN", - "ENTR_SPOT09": "ENTR_GERUDO_VALLEY", - "ENTR_SPOT10": "ENTR_LOST_WOODS", - "ENTR_SPOT11": "ENTR_DESERT_COLOSSUS", - "ENTR_SPOT12": "ENTR_GERUDOS_FORTRESS", - "ENTR_SPOT13": "ENTR_HAUNTED_WASTELAND", - "ENTR_SPOT15": "ENTR_HYRULE_CASTLE", - "ENTR_SPOT16": "ENTR_DEATH_MOUNTAIN_TRAIL", - "ENTR_SPOT17": "ENTR_DEATH_MOUNTAIN_CRATER", - "ENTR_SPOT18": "ENTR_GORON_CITY", - "ENTR_SPOT20": "ENTR_LON_LON_RANCH", - "ENTR_GANON_TOU": "ENTR_OUTSIDE_GANONS_CASTLE", - "ENTR_GANON_0": "ENTR_GANONS_TOWER_0", - "ENTR_GANON_1": "ENTR_GANONS_TOWER_1", - "ENTR_GANON_2": "ENTR_GANONS_TOWER_2", - "ENTR_KAKARIKO_0": "ENTR_KAKARIKO_CENTER_GUEST_HOUSE_0", - "ENTR_IMPA_0": "ENTR_DOG_LADY_HOUSE_0", -} - -# all occurrences of keys will be replaced by associated value, -# if the occurence is the whole word -# for example, if there is a space before and an open parenthesis after, -# like for a function call: ` func_8002E4B4(` -wordReplace = { - "SkelAnime_FrameUpdateMatrix":"SkelAnime_Update", - "SkelAnime_ChangeAnimTransitionRepeat":"Animation_MorphToLoop", - "SkelAnime_ChangeAnimDefaultRepeat":"Animation_PlayLoop", - "SkelAnime_ChangeAnimPlaybackRepeat":"Animation_PlayLoopSetSpeed", - "SkelAnime_ChangeAnimTransitionStop":"Animation_MorphToPlayOnce", - "SkelAnime_ChangeAnimDefaultStop":"Animation_PlayOnce", - "SkelAnime_ChangeAnimPlaybackStop":"Animation_PlayOnceSetSpeed", - "SkelAnime_ChangeAnimImpl":"Animation_ChangeImpl", - "SkelAnime_ChangeAnim":"Animation_Change", - "SkelAnime_GetFrameCount":"Animation_GetLastFrame", - "func_800A56C8":"Animation_OnFrame", - "skelAnime.animCurrentFrame":"skelAnime.curFrame", - "skelAnime.animPlaybackSpeed":"skelAnime.playSpeed", - "skelAnime.initialFrame":"skelAnime.startFrame", - "skelAnime.animFrameCount":"skelAnime.endFrame", - "skelAnime.totalFrames":"skelAnime.animLength", - "skelAnime.limbDrawTbl":"skelAnime.jointTable", - "skelAnime.transitionDrawTbl":"skelAnime.morphTable", - "skelAnime.transCurrentFrame":"skelAnime.morphWeight", - "skelAnime.transitionStep":"skelAnime.morphRate", - "skelAnime.flags":"skelAnime.moveFlags", - "skelAnime.prevFrameRot":"skelAnime.prevRot", - "skelAnime.prevFramePos":"skelAnime.prevTransl", - "skelAnime.unk_3E":"skelAnime.baseTransl", - "skelAnime.unk_03":"skelAnime.taper", - "func_800CA540(":"Math_FactorialF(", - "func_800CA63C(":"Math_Factorial(", - "func_800CA6FC(":"Math_PowF(", - "func_800CA720(":"Math_SinF(", - "func_800CA774(":"Math_CosF(", - "Math_atan2f(":"Math_FAtan2F(", - "atan2f(":"Math_Atan2F(", - "atan2s(":"Math_Atan2S(", - "Math_Coss(":"Math_CosS(", - "Math_Sins(":"Math_SinS(", - "Math_ApproxUpdateScaledS(":"Math_ScaledStepToS(", - "Math_ApproxS(":"Math_StepToS(", - "Math_ApproxF(":"Math_StepToF(", - "func_80077A90(":"Math_StepUntilAngleS(", - "func_80077AF8(":"Math_StepUntilS(", - "func_80077B58(":"Math_StepToAngleS(", - "func_80077C1C(":"Math_StepUntilF(", - "func_80077C6C(":"Math_AsymStepToF(", - "Math_SmoothScaleMaxMinF(":"Math_SmoothStepToF(", - "Math_SmoothScaleMaxF(":"Math_ApproachF(", - "Math_SmoothDownscaleMaxF(":"Math_ApproachZeroF(", - "func_800784D8(":"Math_SmoothStepToDegF(", - "Math_SmoothScaleMaxMinS(":"Math_SmoothStepToS(", - "Math_SmoothScaleMaxS(":"Math_ApproachS(", - "Actor_SetHeight":"Actor_SetFocus", - "func_8002E4B4":"Actor_UpdateBgCheckInfo", - "func_8002BDB0":"Actor_SetFeetPos", - "func_8002DA78":"Actor_WorldYawTowardActor", - "func_8002DAC0":"Actor_WorldYawTowardPoint", - "func_8002DB48":"Actor_WorldDistXYZToActor", - "func_8002DB6C":"Actor_WorldDistXYZToPoint", - "func_8002DAE0":"Actor_WorldPitchTowardActor", - "func_8002DB28":"Actor_WorldPitchTowardPoint", - "func_8002DB8C":"Actor_WorldDistXZToActor", - "func_8002DBB0":"Actor_WorldDistXZToPoint", - "func_8002EEE4":"Actor_GetFocus", - "func_8002EF14":"Actor_GetWorld", - "func_8002EF44":"Actor_GetWorldPosShapeRot", - "actor.unk_1F":"actor.targetMode", - "ICHAIN_U8(unk_1F":"ICHAIN_U8(targetMode", - "actor.initPosRot":"actor.home", - "actor.posRot.":"actor.world.", - "actor.posRot2":"actor.focus", - "actor.unk_4C":"actor.targetArrowOffset", - "ICHAIN_F32(unk_4C":"ICHAIN_F32(targetArrowOffset", - "actor.groundY":"actor.floorHeight", - "actor.wallPolySource":"actor.wallBgId", - "actor.floorPolySource":"actor.floorBgId", - "actor.wallPolyRot":"actor.wallYaw", - "yawTowardsLink":"yawTowardsPlayer", - "colChkInfo.unk_10":"colChkInfo.cylRadius", - "colChkInfo.unk_12":"colChkInfo.cylHeight", - "colChkInfo.unk_14":"colChkInfo.cylYShift", - "shape.unk_08":"shape.yOffset", - "shape.shadowDrawFunc":"shape.shadowDraw", - "shape.unk_10":"shape.shadowScale", - "shape.unk_14":"shape.shadowAlpha", - "actor.unk_CC":"actor.shape.feetPos", - "actor.pos4":"actor.prevPos", - "actor.unk_10C":"actor.isTargeted", - "actor.unk_10D":"actor.targetPriority", - "actor.dmgEffectTimer":"actor.colorFilterTimer", - "actor.dmgEffectParams":"actor.colorFilterParams", - "actor.unk_116":"actor.dropFlag", - "actorCtx.actorList[":"actorCtx.actorLists[", - "Actor_ChangeType":"Actor_ChangeCategory", - "ActorShadow_DrawFunc_Squiggly":"ActorShadow_DrawHorse", - "ActorShadow_DrawFunc_":"ActorShadow_Draw", - "actor.type":"actor.category", - ".body.":".info.", - "bumper.unk_06":"bumper.hitPos", - "base.list":"base.elements", - "toucher.flags":"toucher.dmgFlags", - "bumper.flags":"bumper.dmgFlags", - "maskA ":"ocFlags1 ", - "maskB ":"ocFlags2 ", - ".base.type":".base.colType", - "COLTYPE_UNK11":"COLTYPE_HARD", - "COLTYPE_UNK12":"COLTYPE_WOOD", - "COLTYPE_UNK13":"COLTYPE_TREE", - "COLTYPE_METAL_SHIELD":"COLTYPE_METAL", - "COLTYPE_UNK10":"COLTYPE_NONE", - "COLTYPE_UNK":"COLTYPE_HIT", - "info.flags":"info.elemtype", - "ColliderBody":"ColliderInfo", - "ColliderJntSphItem":"ColliderJntSphElement", - "ColliderTrisItem":"ColliderTrisElement", - "Collider_CylinderUpdate":"Collider_UpdateCylinder", - "func_800628A4":"Collider_UpdateSpheres", - "func_800627A0":"Collider_SetTrisVertices", - "func_80062734":"Collider_SetQuadVertices", - "func_80061ED4":"CollisionCheck_SetInfo", - "func_80061EFC":"CollisionCheck_SetInfo2", - "func_80061EB0":"CollisionCheck_SetInfoNoDamageTable", - "func_8002E084": "Actor_IsFacingPlayer", - "func_8002E0D0": "Actor_ActorAIsFacingActorB", - "func_8002E12C": "Actor_IsFacingAndNearPlayer", - "func_8002E1A8": "Actor_ActorAIsFacingAndNearActorB", - "func_8002F434": "Actor_OfferGetItem", - "func_8002F554": "Actor_OfferGetItemNearby", - "func_8002F580": "Actor_OfferCarry", - "func_80033A84": "Actor_IsTargeted", - "func_80033AB8": "Actor_OtherIsTargeted", - "func_80035650": "Actor_SetDropFlag", - "func_8003573C": "Actor_SetDropFlagJntSph", - "func_80033780": "Actor_GetProjectileActor", - "func_80033260": "Actor_SpawnFloorDustRing", - "Actor_SpawnFloorDust": "Actor_SpawnFloorDustRing", - "func_80032C7C": "Enemy_StartFinishingBlow", - "actorCtx.unk_00": "actorCtx.freezeFlashTimer", - "func_800339B8": "Actor_TestFloorInDirection", - "Matrix_Reverse": "Matrix_Transpose", - "func_800D20CC": "Matrix_MtxFToYXZRotS", - "func_800D2264": "Matrix_MtxFToZYXRotS", - "func_800D23FC": "Matrix_RotateAxis", - "PLAYER": ("GET_PLAYER(play)", {"ignore": (-1, '"PLAYER"')}), # ignore "PLAYER" in sSfxBankNames - "ACTIVE_CAM": "GET_ACTIVE_CAM(play)", - "SkinMatrix_SetRotateRPY": "SkinMatrix_SetRotateZYX", - "SkinMatrix_SetScaleRotateYRPTranslate": "SkinMatrix_SetScaleRotateYXZTranslate", - "SkinMatrix_SetScaleRotateYXZTranslate": "SkinMatrix_SetTranslateRotateYXZScale", - "SkinMatrix_SetRotateRPYTranslate": "SkinMatrix_SetRotateZYXTranslate", - "SkinMatrix_SetRotateZYXTranslate": "SkinMatrix_SetTranslateRotateZYX", - "Matrix_RotateRPY": "Matrix_RotateZYX", - "Matrix_JointPosition": "Matrix_TranslateRotateZYX", - "func_800D1694": "Matrix_SetTranslateRotateYXZ", - "func_800D1FD4": "Matrix_ReplaceRotation", - "func_800A7EC0": "SkinMatrix_SetRotateAxis", - "func_800D2A34": "Matrix_SetTranslateUniformScaleMtxF", - "func_800D2A98": "Matrix_SetTranslateUniformScaleMtx", - "func_800D2CEC": "Matrix_SetTranslateScaleMtx2", - "SCENE_YDAN": "SCENE_DEKU_TREE", - "SCENE_DDAN": "SCENE_DODONGOS_CAVERN", - "SCENE_BDAN": "SCENE_JABU_JABU", - "SCENE_BMORI1": "SCENE_FOREST_TEMPLE", - "SCENE_HIDAN": "SCENE_FIRE_TEMPLE", - "SCENE_MIZUSIN": "SCENE_WATER_TEMPLE", - "SCENE_JYASINZOU": "SCENE_SPIRIT_TEMPLE", - "SCENE_HAKADAN": "SCENE_SHADOW_TEMPLE", - "SCENE_HAKADANCH": "SCENE_BOTTOM_OF_THE_WELL", - "SCENE_ICE_DOUKUTO": "SCENE_ICE_CAVERN", - "SCENE_GANON": "SCENE_GANONS_TOWER", - "SCENE_MEN": "SCENE_GERUDO_TRAINING_GROUND", - "SCENE_GERUDOWAY": "SCENE_THIEVES_HIDEOUT", - "SCENE_GANONTIKA": "SCENE_INSIDE_GANONS_CASTLE", - "SCENE_GANON_SONOGO": "SCENE_GANONS_TOWER_COLLAPSE_INTERIOR", - "SCENE_GANONTIKA_SONOGO": "SCENE_INSIDE_GANONS_CASTLE_COLLAPSE", - "SCENE_TAKARAYA": "SCENE_TREASURE_BOX_SHOP", - "SCENE_YDAN_BOSS": "SCENE_DEKU_TREE_BOSS", - "SCENE_DDAN_BOSS": "SCENE_DODONGOS_CAVERN_BOSS", - "SCENE_BDAN_BOSS": "SCENE_JABU_JABU_BOSS", - "SCENE_MORIBOSSROOM": "SCENE_FOREST_TEMPLE_BOSS", - "SCENE_FIRE_BS": "SCENE_FIRE_TEMPLE_BOSS", - "SCENE_MIZUSIN_BS": "SCENE_WATER_TEMPLE_BOSS", - "SCENE_JYASINBOSS": "SCENE_SPIRIT_TEMPLE_BOSS", - "SCENE_HAKADAN_BS": "SCENE_SHADOW_TEMPLE_BOSS", - #"SCENE_GANON_BOSS": "SCENE_GANONDORF_BOSS", # SCENE_GANON_BOSS is also in the new scene enum - "SCENE_GANON_FINAL": "SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR", - "SCENE_ENTRA": "SCENE_MARKET_ENTRANCE_DAY", - "SCENE_ENTRA_N": "SCENE_MARKET_ENTRANCE_NIGHT", - "SCENE_ENRUI": "SCENE_MARKET_ENTRANCE_RUINS", - "SCENE_MARKET_ALLEY": "SCENE_BACK_ALLEY_DAY", - "SCENE_MARKET_ALLEY_N": "SCENE_BACK_ALLEY_NIGHT", - "SCENE_SHRINE": "SCENE_TEMPLE_OF_TIME_EXTERIOR_DAY", - "SCENE_SHRINE_N": "SCENE_TEMPLE_OF_TIME_EXTERIOR_NIGHT", - "SCENE_SHRINE_R": "SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS", - "SCENE_KOKIRI_HOME": "SCENE_KNOW_IT_ALL_BROS_HOUSE", - "SCENE_KOKIRI_HOME3": "SCENE_TWINS_HOUSE", - "SCENE_KOKIRI_HOME4": "SCENE_MIDOS_HOUSE", - "SCENE_KOKIRI_HOME5": "SCENE_SARIAS_HOUSE", - "SCENE_KAKARIKO": "SCENE_KAKARIKO_CENTER_GUEST_HOUSE", - "SCENE_KAKARIKO3": "SCENE_BACK_ALLEY_HOUSE", - "SCENE_SHOP1": "SCENE_BAZAAR", - "SCENE_GOLON": "SCENE_GORON_SHOP", - "SCENE_ZOORA": "SCENE_ZORA_SHOP", - "SCENE_DRAG": "SCENE_POTION_SHOP_KAKARIKO", - "SCENE_ALLEY_SHOP": "SCENE_POTION_SHOP_MARKET", - "SCENE_NIGHT_SHOP": "SCENE_BOMBCHU_SHOP", - "SCENE_FACE_SHOP": "SCENE_HAPPY_MASK_SHOP", - "SCENE_LINK_HOME": "SCENE_LINKS_HOUSE", - "SCENE_IMPA": "SCENE_DOG_LADY_HOUSE", - "SCENE_MALON_STABLE": "SCENE_STABLE", - "SCENE_LABO": "SCENE_IMPAS_HOUSE", - "SCENE_HYLIA_LABO": "SCENE_LAKESIDE_LABORATORY", - "SCENE_TENT": "SCENE_CARPENTERS_TENT", - "SCENE_HUT": "SCENE_GRAVEKEEPERS_HUT", - "SCENE_DAIYOUSEI_IZUMI": "SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC", - "SCENE_YOUSEI_IZUMI_TATE": "SCENE_FAIRYS_FOUNTAIN", - "SCENE_YOUSEI_IZUMI_YOKO": "SCENE_GREAT_FAIRYS_FOUNTAIN_SPELLS", - "SCENE_KAKUSIANA": "SCENE_GROTTOS", - "SCENE_HAKAANA": "SCENE_REDEAD_GRAVE", - "SCENE_HAKAANA2": "SCENE_GRAVE_WITH_FAIRYS_FOUNTAIN", - "SCENE_HAKAANA_OUKE": "SCENE_ROYAL_FAMILYS_TOMB", - "SCENE_SYATEKIJYOU": "SCENE_SHOOTING_GALLERY", - "SCENE_TOKINOMA": "SCENE_TEMPLE_OF_TIME", - "SCENE_KENJYANOMA": "SCENE_CHAMBER_OF_THE_SAGES", - "SCENE_HAIRAL_NIWA": "SCENE_CASTLE_COURTYARD_GUARDS_DAY", - "SCENE_HAIRAL_NIWA_N": "SCENE_CASTLE_COURTYARD_GUARDS_NIGHT", - "SCENE_HIRAL_DEMO": "SCENE_CUTSCENE_MAP", - "SCENE_HAKASITARELAY": "SCENE_WINDMILL_AND_DAMPES_GRAVE", - "SCENE_TURIBORI": "SCENE_FISHING_POND", - "SCENE_NAKANIWA": "SCENE_CASTLE_COURTYARD_ZELDA", - "SCENE_BOWLING": "SCENE_BOMBCHU_BOWLING_ALLEY", - "SCENE_SOUKO": "SCENE_LON_LON_BUILDINGS", - "SCENE_MIHARIGOYA": "SCENE_MARKET_GUARD_HOUSE", - "SCENE_MAHOUYA": "SCENE_POTION_SHOP_GRANNY", - "SCENE_GANON_DEMO": "SCENE_GANON_BOSS", - "SCENE_KINSUTA": "SCENE_HOUSE_OF_SKULLTULA", - "SCENE_SPOT00": "SCENE_HYRULE_FIELD", - "SCENE_SPOT01": "SCENE_KAKARIKO_VILLAGE", - "SCENE_SPOT02": "SCENE_GRAVEYARD", - "SCENE_SPOT03": "SCENE_ZORAS_RIVER", - "SCENE_SPOT04": "SCENE_KOKIRI_FOREST", - "SCENE_SPOT05": "SCENE_SACRED_FOREST_MEADOW", - "SCENE_SPOT06": "SCENE_LAKE_HYLIA", - "SCENE_SPOT07": "SCENE_ZORAS_DOMAIN", - "SCENE_SPOT08": "SCENE_ZORAS_FOUNTAIN", - "SCENE_SPOT09": "SCENE_GERUDO_VALLEY", - "SCENE_SPOT10": "SCENE_LOST_WOODS", - "SCENE_SPOT11": "SCENE_DESERT_COLOSSUS", - "SCENE_SPOT12": "SCENE_GERUDOS_FORTRESS", - "SCENE_SPOT13": "SCENE_HAUNTED_WASTELAND", - "SCENE_SPOT15": "SCENE_HYRULE_CASTLE", - "SCENE_SPOT16": "SCENE_DEATH_MOUNTAIN_TRAIL", - "SCENE_SPOT17": "SCENE_DEATH_MOUNTAIN_CRATER", - "SCENE_SPOT18": "SCENE_GORON_CITY", - "SCENE_SPOT20": "SCENE_LON_LON_RANCH", - "SCENE_GANON_TOU": "SCENE_OUTSIDE_GANONS_CASTLE", - "SDC_SPOT00": "SDC_HYRULE_FIELD", - "SDC_SPOT01": "SDC_KAKARIKO_VILLAGE", - "SDC_SPOT03": "SDC_ZORAS_RIVER", - "SDC_SPOT04": "SDC_KOKIRI_FOREST", - "SDC_SPOT06": "SDC_LAKE_HYLIA", - "SDC_SPOT07": "SDC_ZORAS_DOMAIN", - "SDC_SPOT08": "SDC_ZORAS_FOUNTAIN", - "SDC_SPOT09": "SDC_GERUDO_VALLEY", - "SDC_SPOT10": "SDC_LOST_WOODS", - "SDC_SPOT11": "SDC_DESERT_COLOSSUS", - "SDC_SPOT12": "SDC_GERUDOS_FORTRESS", - "SDC_SPOT13": "SDC_HAUNTED_WASTELAND", - "SDC_SPOT15": "SDC_HYRULE_CASTLE", - "SDC_SPOT16": "SDC_DEATH_MOUNTAIN_TRAIL", - "SDC_SPOT17": "SDC_DEATH_MOUNTAIN_CRATER", - "SDC_SPOT18": "SDC_GORON_CITY", - "SDC_SPOT20": "SDC_LON_LON_RANCH", - "SDC_HIDAN": "SDC_FIRE_TEMPLE", - "SDC_YDAN": "SDC_DEKU_TREE", - "SDC_DDAN": "SDC_DODONGOS_CAVERN", - "SDC_BDAN": "SDC_JABU_JABU", - "SDC_BMORI1": "SDC_FOREST_TEMPLE", - "SDC_MIZUSIN": "SDC_WATER_TEMPLE", - "SDC_HAKADAN": "SDC_SHADOW_TEMPLE_AND_WELL", - "SDC_JYASINZOU": "SDC_SPIRIT_TEMPLE", - "SDC_GANONTIKA": "SDC_INSIDE_GANONS_CASTLE", - "SDC_MEN": "SDC_GERUDO_TRAINING_GROUND", - "SDC_YDAN_BOSS": "SDC_DEKU_TREE_BOSS", - "SDC_MIZUSIN_BS": "SDC_WATER_TEMPLE_BOSS", - "SDC_TOKINOMA": "SDC_TEMPLE_OF_TIME", - "SDC_KAKUSIANA": "SDC_GROTTOS", - "SDC_KENJYANOMA": "SDC_CHAMBER_OF_THE_SAGES", - "SDC_GREAT_FAIRY_FOUNTAIN": "SDC_GREAT_FAIRYS_FOUNTAIN", - "SDC_SYATEKIJYOU": "SDC_SHOOTING_GALLERY", - "SDC_HAIRAL_NIWA": "SDC_CASTLE_COURTYARD_GUARDS", - "SDC_GANON_CASTLE_EXTERIOR": "SDC_OUTSIDE_GANONS_CASTLE", - "SDC_ICE_DOUKUTO": "SDC_ICE_CAVERN", - "SDC_GANON_FINAL": "SDC_GANONS_TOWER_COLLAPSE_EXTERIOR", - "SDC_FAIRY_FOUNTAIN": "SDC_FAIRYS_FOUNTAIN", - "SDC_GERUDOWAY": "SDC_THIEVES_HIDEOUT", - "SDC_BOWLING": "SDC_BOMBCHU_BOWLING_ALLEY", - "SDC_HAKAANA_OUKE": "SDC_ROYAL_FAMILYS_TOMB", - "SDC_HYLIA_LABO": "SDC_LAKESIDE_LABORATORY", - "SDC_SOUKO": "SDC_LON_LON_BUILDINGS", - "SDC_MIHARIGOYA": "SDC_MARKET_GUARD_HOUSE", - "SDC_MAHOUYA": "SDC_POTION_SHOP_GRANNY", - "SDC_TURIBORI": "SDC_FISHING_POND", - "SDC_GANON_SONOGO": "SDC_GANONS_TOWER_COLLAPSE_INTERIOR", - "SDC_GANONTIKA_SONOGO": "SDC_INSIDE_GANONS_CASTLE_COLLAPSE", - "ENTR_HAIRAL_NIWA": "ENTR_CASTLE_COURTYARD_GUARDS_DAY", -} - -# [a-zA-Z0-9_] -def is_word_char(c): - return (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') or (c >= '0' and c <= '9') or c == '_' - -def replace_single(file): - with open(file, 'r', encoding = 'utf-8') as infile: - srcdata = infile.read() - - changesCount = 0 - - for old, new in simpleReplace.items(): - # replace `old` with `new` - if old in srcdata: - changesCount += 1 - print(old, "->", new) - srcdata = srcdata.replace(old, new) - - for old, new in wordReplace.items(): - # `new` can be a tuple where the first element is what to replace `old` with, - # and the second element is a dict containing "custom behavior" properties. - if isinstance(new, tuple): - custom_behavior = True - new, custom_behavior_data = new - # The "ignore" data is a tuple where the first element is an offset relative to - # where `old` was found, and the string from that index must differ from the - # tuple's second element for the replacement to be done. - custom_behavior_ignore_data = custom_behavior_data.get("ignore") - custom_behavior_ignore = custom_behavior_ignore_data is not None - if custom_behavior_ignore: - custom_behavior_ignore_offset, custom_behavior_ignore_match = custom_behavior_ignore_data - else: - custom_behavior = False - # replace `old` with `new` if the occurence of `old` is the whole word - oldStartIdx = srcdata.find(old) - if oldStartIdx >= 0: - old_start_as_word = is_word_char(old[0]) - old_end_as_word = is_word_char(old[-1]) - replaceCount = 0 - while oldStartIdx >= 0: - replace = True - if old_start_as_word: - if oldStartIdx == 0: - pass - elif is_word_char(srcdata[oldStartIdx-1]): - replace = False - if old_end_as_word: - oldEndIdx = oldStartIdx + len(old) - if oldEndIdx >= len(srcdata): - pass - elif is_word_char(srcdata[oldEndIdx]): - replace = False - if replace and custom_behavior and custom_behavior_ignore: - if srcdata[oldStartIdx + custom_behavior_ignore_offset:].startswith(custom_behavior_ignore_match): - replace = False - if replace: - srcdata = srcdata[:oldStartIdx] + new + srcdata[oldEndIdx:] - replaceCount += 1 - oldStartIdx = srcdata.find(old, oldStartIdx + len(new)) - if replaceCount > 0: - changesCount += 1 - print(old, "->", new) - - if changesCount > 0: - print('Changed', changesCount, 'entry' if changesCount == 1 else 'entries', 'in', file) - with open(file, 'w', encoding = 'utf-8', newline = '\n') as outfile: - outfile.write(srcdata) - -def replace_all(repo): - for subdir, dirs, files in os.walk(repo + os.sep + 'src'): - for filename in files: - if filename.endswith('.c'): - file = subdir + os.sep + filename - replace_single(file) - for subdir, dirs, files in os.walk(repo + os.sep + 'asm' + os.sep + 'non_matchings'): - for filename in files: - if filename.endswith('.s'): - file = subdir + os.sep + filename - replace_single(file) - -parser = argparse.ArgumentParser(description='Apply function renames to a file') -parser.add_argument('file', help="source file to be processed. use . to process the whole repo") - -if __name__ == "__main__": - args = parser.parse_args() - if args.file == '.': - replace_all(os.curdir) - else: - replace_single(args.file) diff --git a/tools/overlayhelpers/colliderinit.py b/tools/overlayhelpers/colliderinit.py deleted file mode 100755 index 94f9685db..000000000 --- a/tools/overlayhelpers/colliderinit.py +++ /dev/null @@ -1,477 +0,0 @@ -#!/usr/bin/env python3 - -import os -import struct -import argparse -from filemap import GetFromVRam, GetFromRom - -T_DEFAULT = '' -TType1 = 'Type1' -T_ACTOR = '_Actor' - -TYPE_ENUM = [ - "COLTYPE_HIT0", - "COLTYPE_HIT1", - "COLTYPE_HIT2", - "COLTYPE_HIT3", - "COLTYPE_HIT4", - "COLTYPE_HIT5", - "COLTYPE_HIT6", - "COLTYPE_HIT7", - "COLTYPE_HIT8", - "COLTYPE_METAL", - "COLTYPE_NONE", - "COLTYPE_WOOD", - "COLTYPE_HARD", - "COLTYPE_TREE" ] - -SHAPE_ENUM = [ - "COLSHAPE_JNTSPH", - "COLSHAPE_CYLINDER", - "COLSHAPE_TRIS", - "COLSHAPE_QUAD" ] - -ELEMTYPE_UNKENUM = [ - "ELEMTYPE_UNK0", - "ELEMTYPE_UNK1", - "ELEMTYPE_UNK2", - "ELEMTYPE_UNK3", - "ELEMTYPE_UNK4", - "ELEMTYPE_UNK5", - "ELEMTYPE_UNK6"] - -ATFLAGS_ENUM = [ - "AT_ON", - "AT_HIT", - "AT_BOUNCED", - "AT_TYPE_PLAYER", - "AT_TYPE_ENEMY", - "AT_TYPE_OTHER", - "AT_SELF"] - -ACFLAGS_ENUM = [ - "AC_ON", - "AC_HIT", - "AC_HARD", - "AC_TYPE_PLAYER", - "AC_TYPE_ENEMY", - "AC_TYPE_OTHER", - "AC_NO_DAMAGE", - "AC_BOUNCED"] - -OCFLAGS_ENUM = [ - "OC1_ON", - "OC1_HIT", - "OC1_NO_PUSH", - "OC1_TYPE_PLAYER", - "OC1_TYPE_1", - "OC1_TYPE_2"] - -OCTYPE_ENUM = [ - "OC2_HIT_PLAYER", - "OC2_UNK1", - "OC2_UNK2", - "OC2_TYPE_PLAYER", - "OC2_TYPE_1", - "OC2_TYPE_2", - "OC2_FIRST_ONLY"] - -TOUCHERFLAGS_ENUM = [ - "TOUCH_ON", - "TOUCH_HIT", - "TOUCH_NEAREST", - "TOUCH_SFX_HARD", - "TOUCH_SFX_WOOD", - "TOUCH_AT_HITMARK", - "TOUCH_DREW_HITMARK", - "TOUCH_UNK7"] - -BUMPERFLAGS_ENUM = [ - "BUMP_ON", - "BUMP_HIT", - "BUMP_HOOKABLE", - "BUMP_NO_AT_INFO", - "BUMP_NO_DAMAGE", - "BUMP_NO_SWORD_SFX", - "BUMP_NO_HITMARK", - "BUMP_DRAW_HITMARK"] - -OCELEMFLAGS_ENUM = [ - "OCELEM_ON", - "OCELEM_HIT", - "OCELEM_UNK2", - "OCELEM_UNK3", - "OCELEM_UNK4", - "OCELEM_UNK5", - "OCELEM_UNK6", - "OCELEM_UNK7",] - -sf_ColliderInit = ">BBBBBB" -sf_ColliderInitType1 = ">BBBBB" -sf_ColliderInitToActor = ">IBBBB" -sf_ColliderBodyInit = ">B3xIBB2xIBB2xBBB" -sf_JntSph = ">II" -sf_JntSphElement = ">Bx5h" -sf_Cylinder16 = ">6h" -sf_Tris = ">II" -sf_TrisElement = ">9f" -sf_Quad = ">12f" - -f_ColliderInit = "{{ {0}, {1}, {2}, {3}, {4}, {5}, }}" -f_ColliderInitType1 = "{{ {0}, {1}, {2}, {3}, {4}, }}" -f_ColliderInitToActor = "{{ {0}, {1}, {2}, {3}, {4}, }}" -f_ColliderBodyInit = "{{ {0}, {{ 0x{1:08X}, 0x{2:02X}, 0x{3:02X} }}, {{ 0x{4:08X}, 0x{5:02X}, 0x{6:02X} }}, {7}, {8}, {9}, }}" -f_JntSph = "{0}, D_{1:08X}" -f_JntSphElement = "{{ {0}, {{ {{ {1}, {2}, {3} }}, {4} }}, {5} }}" -f_Cylinder16 = "{{ {0}, {1}, {2}, {{ {3}, {4}, {5} }} }}" -f_Tris = "{0}, D_{1:08X}" -f_TrisElement = "{{ {{ {{ {0}f, {1}f, {2}f }}, {{ {3}f, {4}f, {5}f }}, {{ {6}f, {7}f, {8}f }} }} }}" -f_Quad = "{{ {{ {{ {0}f, {1}f, {2}f }}, {{ {3}f, {4}f, {5}f }}, {{ {6}f, {7}f, {8}f }}, {{ {9}f, {10}f, {11}f }} }} }}" - -def GetATflags(at): - for i, flag in enumerate(ATFLAGS_ENUM): - if(i == 0): - if(at & (1 << i)): - output = "AT_ON" - else: - output = "AT_NONE" - elif(at & (1 << i)): - output += " | " + flag - return output.replace("AT_TYPE_PLAYER | AT_TYPE_ENEMY | AT_TYPE_OTHER","AT_TYPE_ALL") - -def GetACflags(at): - for i, flag in enumerate(ACFLAGS_ENUM): - if(i == 0): - if(at & (1 << i)): - output = "AC_ON" - else: - output = "AC_NONE" - elif(at & (1 << i)): - output += " | " + flag - return output.replace("AC_TYPE_OTHER | AC_TYPE_ENEMY | AC_TYPE_PLAYER","AC_TYPE_ALL") - -def GetOCflags(at): - for i, flag in enumerate(OCFLAGS_ENUM): - if(i == 0): - if(at & (1 << i)): - output = "OC1_ON" - else: - output = "OC1_NONE" - elif(at & (1 << i)): - output += " | " + flag - return output.replace("OC1_TYPE_PLAYER | OC1_TYPE_1 | OC1_TYPE_2","OC1_TYPE_ALL") - -def GetOCtype(at): - output = "" - for i, flag in enumerate(OCTYPE_ENUM): - if(at & (1 << i)): - output = " | " + flag + output - if(output == ""): - return "OC2_NONE" - else: - return output.strip(" | ") - -def GetToucherFlags(at): - for i, flag in enumerate(TOUCHERFLAGS_ENUM): - if(i == 0): - if(at & (1 << i)): - output = "TOUCH_ON" - else: - output = "TOUCH_NONE" - elif(at & (1 << i)): - output += " | " + flag - if(i == 4 and output.find("SFX") == -1 and output.find("OFF") == -1): - output += " | TOUCH_SFX_NORMAL" - return output.replace("TOUCH_SFX_HARD | TOUCH_SFX_WOOD", "TOUCH_SFX_NONE") - -def GetBumperFlags(at): - for i, flag in enumerate(BUMPERFLAGS_ENUM): - if(i == 0): - if(at & (1 << i)): - output = "BUMP_ON" - else: - output = "BUMP_NONE" - elif(at & (1 << i)): - output += " | " + flag - return output - -def GetOcElemFlags(at): - for i, flag in enumerate(OCELEMFLAGS_ENUM): - if(i == 0): - if(at & (1 << i)): - output = "OCELEM_ON" - else: - output = "OCELEM_NONE" - elif(at & (1 << i)): - output += " | " + flag - return output - -def GetColliderFormat(type): - if type == T_DEFAULT: - return (sf_ColliderInit, f_ColliderInit) - if type == TType1: - return (sf_ColliderInitType1, f_ColliderInitType1) - if type == T_ACTOR: - return (sf_ColliderInitToActor, f_ColliderInitToActor) - return None - -def GetColliderStr(data, off, type): - cf = GetColliderFormat(type) - cBase = list(struct.unpack_from(cf[0], data, off)) - if type == T_ACTOR: - if cBase[0] == 0: - cBase[0] = 'NULL' - else: - cBase[0] = '0x{0:08X}'.format(cBase[0]) - else: - if cBase[0] < 14: - cBase[0] = TYPE_ENUM[cBase[0]] - else: - cBase[0] = '0x{0:02X}'.format(cBase[0]) - - cBase[1] = GetATflags(cBase[1]) - cBase[2] = GetACflags(cBase[2]) - cBase[3] = GetOCflags(cBase[3]) - - if type == T_DEFAULT: - cBase[4] = GetOCtype(cBase[4]) - i = 5 - else: - i = 4 - - if cBase[i] < 4: - cBase[i] = SHAPE_ENUM[cBase[i]] - else: - cBase[i] = '0x{0:02X}'.format(cBase[i]) - - return cf[1].format(*cBase) - -def GetItems(data, off, count, structf, fmt, size): - result = '' - for i in range(count): - ioff = (i * size) - cBody = list(struct.unpack_from(sf_ColliderBodyInit, data, off + ioff)) - cItem = struct.unpack_from(structf, data, off + 0x18 + ioff) - - if cBody[0] < 7: - cBody[0] = ELEMTYPE_UNKENUM[cBody[0]] - else: - cBody[0] = '0x{0:02X}'.format(cBody[0]) - - cBody[7] = GetToucherFlags(cBody[7]) - cBody[8] = GetBumperFlags(cBody[8]) - cBody[9] = GetOcElemFlags(cBody[9]) - - result += ''' - {{ - {0}, - {1}, - }},'''.format(f_ColliderBodyInit.format(*cBody), fmt.format(*cItem)) - return result - -def GetJntSphElements(data, off, count): - items = GetItems(data, off, count, sf_JntSphElement, f_JntSphElement, 0x24) - return(''' -static ColliderJntSphElementInit sJntSphElementsInit[{0}] = {{{1} -}}; -'''.format(count, items)) - -def GetJntSph(data, off, type): - sBase = GetColliderStr(data, off, type) - cJntSph = struct.unpack_from(sf_JntSph, data, off + 8) - - return(''' -static ColliderJntSphInit{0} sJntSphInit = {{ - {1}, - {2}, -}}; -'''.format(type, sBase, f_JntSph.format(*cJntSph))) - - -def GetTrisElements(data, off, count): - items = GetItems(data, off, count, sf_TrisElement, f_TrisElement, 0x3C) - return(''' -static ColliderTrisElementInit sTrisElementsInit[{0}] = {{{1} -}}; -'''.format(count, items)) - - -def GetCylinder(data, off, type): - sBase = GetColliderStr(data, off, type) - cBody = list(struct.unpack_from(sf_ColliderBodyInit, data, off + 0x08)) - cCyl16 = struct.unpack_from(sf_Cylinder16, data, off + 0x20) - - if cBody[0] < 7: - cBody[0] = ELEMTYPE_UNKENUM[cBody[0]] - else: - cBody[0] = '0x{0:02X}'.format(cBody[0]) - - cBody[7] = GetToucherFlags(cBody[7]) - cBody[8] = GetBumperFlags(cBody[8]) - cBody[9] = GetOcElemFlags(cBody[9]) - - return(''' -static ColliderCylinderInit{0} sCylinderInit = {{ - {1}, - {2}, - {3}, -}}; -'''.format(type,sBase,f_ColliderBodyInit.format(*cBody),f_Cylinder16.format(*cCyl16))) - -def GetTris(data, off, type): - sBase = GetColliderStr(data, off, type) - cTris = struct.unpack_from(sf_Tris, data, off + 8) - - return(''' -static ColliderTrisInit{0} sTrisInit = {{ - {1}, - {2}, -}}; -'''.format(type, sBase, f_Tris.format(*cTris))) - -def GetQuad(data, off, type): - sBase = GetColliderStr(data, off, type) - cBody = list(struct.unpack_from(sf_ColliderBodyInit, data, off + 0x08)) - cQuad = struct.unpack_from(sf_Quad, data, off + 0x20) - - if cBody[0] < 7: - cBody[0] = ELEMTYPE_UNKENUM[cBody[0]] - else: - cBody[0] = '0x{0:02X}'.format(cBody[0]) - - cBody[7] = GetToucherFlags(cBody[7]) - cBody[8] = GetBumperFlags(cBody[8]) - cBody[9] = GetOcElemFlags(cBody[9]) - - return(''' -static ColliderQuadInit{0} sQuadInit = {{ - {1}, - {2}, - {3}, -}}; -'''.format(type, sBase, f_ColliderBodyInit.format(*cBody), f_Quad.format(*cQuad))) - -def GetColliderInit(address, type, num, path): - TYPE_DICT = { - 'ColliderJntSphInit' : (GetJntSph, 'Shape', T_DEFAULT), - 'ColliderCylinderInit' : (GetCylinder, 'Shape', T_DEFAULT), - 'ColliderTrisInit': (GetTris, 'Shape', T_DEFAULT), - 'ColliderQuadInit': (GetQuad, 'Shape', T_DEFAULT), - 'ColliderJntSphElementInit' : (GetJntSphElements, 'Item'), - 'ColliderTrisElementInit' : (GetTrisElements, 'Item') - } - - update = [(k, v[0]) for k,v in TYPE_DICT.items() if v[1] == 'Shape'] - for i in update: - for j in (TType1, T_ACTOR): - TYPE_DICT[i[0] + j] = (i[1], 'Shape', j) - - fileResult = None - - if address >= 0x80000000: - fileResult = GetFromVRam(address) - else: - fileResult = GetFromRom(address) - - if fileResult is None: - return("Invalid address") - - print(fileResult) - - selectedType = TYPE_DICT[type] - arg2 = None - if selectedType[1] == 'Shape': - arg2 = selectedType[2] - elif num > 0: - arg2 = num - else: - return("ItemInit type must specify number of elements") - - ovlFile = open(path + "/baseroms/gc-eu-mq-dbg/segments/" + fileResult.name, "rb") - ovlData = bytearray(ovlFile.read()) - ovlFile.close() - - return selectedType[0](ovlData, fileResult.offset, arg2) - -def GetColliderInitFull(address, type, num, path): - if(type.find('Element') != -1): - return GetColliderInit(address, type, num, path) - - base = GetColliderInit(address, type, 0, path) - - if(type.find('JntSph') != -1): - [num, address2, dummy] = base.split('\n')[3].split(',') - hexaddress = int(address2.strip(' D_'), 16) - if(hexaddress == 0): - return base.replace(address2,' NULL') - else: - elements = GetColliderInit(hexaddress, 'ColliderJntSphElementInit', int(num), path) - return elements + base.replace(address2,' sJntSphElementsInit') - elif(type.find('Tris') != -1): - [num, address2, dummy] = base.split('\n')[3].split(',') - hexaddress = int(address2.strip(' D_'), 16) - if(hexaddress == 0): - return base.replace(address2,' NULL') - else: - elements = GetColliderInit(hexaddress, 'ColliderTrisElementInit', int(num), path) - return elements + base.replace(address2,' sTrisElementsInit') - else: - return base - -#ovlName = 'ovl_Obj_Comb' -#address = 0x000780 -#inputType = 'ColliderJntSphElementInit' - -#ovlName = 'ovl_En_Boom' -#address = 0x0007D0 -#inputType = 'ColliderQuadInit' - -#ovlName = input("Overlay Name (baserom): ") - -def HexParse(s): - return int(s, 16) - -parser = argparse.ArgumentParser() -parser.add_argument('address', help="VRam or Rom address of the struct", type=HexParse) -parser.add_argument('type', help="Type name (e.g. ColliderQuadInit)") -parser.add_argument('num', nargs='?', default=0, type=HexParse, help="Number of elements. Only applies to ItemInit types") - -args = parser.parse_args() - -scriptDir = os.path.dirname(os.path.realpath(__file__)) - -repo = scriptDir + os.sep + ".." + os.sep + ".." - -print(GetColliderInitFull(args.address, args.type, args.num, repo)) -# print(GetColliderInit(args.address, args.type, args.num, "../..")) - -# fileResult = None - -# if args.address >= 0x80000000: -# fileResult = GetFromVRam(args.address) -# else: -# fileResult = GetFromRom(args.address) - -# if fileResult is None: -# print("Invalid address") -# exit() - -# print(fileResult) - -# selectedType = TYPE_DICT[args.type] -# arg2 = None -# if selectedType[1] == 'Shape': -# arg2 = selectedType[2] -# elif args.num > 0: -# arg2 = args.num -# else: -# print("ItemInit type must specify number of elements") -# exit() - -# script_dir = os.path.dirname(os.path.realpath(__file__)) - -# ovlFile = open(script_dir + "/../../baseroms/" + fileResult.name, "rb") -# ovlData = bytearray(ovlFile.read()) -# ovlFile.close() - -# selectedType[0](ovlData, fileResult.offset, arg2) diff --git a/tools/overlayhelpers/damage_table.py b/tools/overlayhelpers/damage_table.py deleted file mode 100755 index 63587f536..000000000 --- a/tools/overlayhelpers/damage_table.py +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env python3 - -import os -import argparse -from filemap import GetFromVRam, GetFromRom - -damage_types = [ - 'Deku nut', - 'Deku stick', - 'Slingshot', - 'Explosive', - 'Boomerang', - 'Normal arrow', - 'Hammer swing', - 'Hookshot', - 'Kokiri sword', - 'Master sword', - "Giant's Knife", - 'Fire arrow', - 'Ice arrow', - 'Light arrow', - 'Unk arrow 1', - 'Unk arrow 2', - 'Unk arrow 3', - 'Fire magic', - 'Ice magic', - 'Light magic', - 'Shield', - 'Mirror Ray', - 'Kokiri spin', - 'Giant spin', - 'Master spin', - 'Kokiri jump', - 'Giant jump', - 'Master jump', - 'Unknown 1', - 'Unblockable', - 'Hammer jump', - 'Unknown 2' -] - -def convert_dmg_table_str(dmg_table_str): - split_data = dmg_table_str.replace(' ','').replace('\n','').replace('{',',').replace('}',',').split(',') - hex_data = [int(x, 16) for x in split_data if '0x' in x] - - name = dmg_table_str.split('=')[0].split()[-1] - - return make_table(name, hex_data) - -def replace_damage_table_all(repo): - actors = 'src' + os.sep + 'overlays' + os.sep + 'actors' - for subdir, dirs, files in os.walk(repo + os.sep + actors): - for filename in files: - if(filename.endswith('.c')): - file = subdir + os.sep + filename - status = replace_damage_table(file) - if(status < 0): - print('Encountered error in', file) - elif(status > 0): - print('Updated', status, 'table' + ('s' if status > 1 else ''), file) - return 1 - -def replace_damage_table(src): - with open(src, 'r', encoding = 'utf-8') as srcfile: - srcdata = srcfile.readlines() - read_table = False - replacements = [] - - for i, line in enumerate(srcdata): - if("DamageTable" in line and "= {" in line): - if(read_table): - print('Bad formatting in', file, 'at line', i) - return -1 - else: - read_table = True - start = i - - if(read_table and "DMG_" in line): - read_table = False - - if(read_table and ";" in line): - dmg_table_str = "".join(srcdata[start:i+1]) - damage_table = convert_dmg_table_str(dmg_table_str) - replacements += [[dmg_table_str, damage_table]] - read_table = False - - if len(replacements) == 0: - return 0 - - with open(src,'r', encoding = 'utf-8') as srcfile: - srcstr = srcfile.read() - for replace in replacements: - srcstr = srcstr.replace(replace[0], replace[1]) - with open(src,'w', encoding = 'utf-8', newline = '\n') as outfile: - outfile.write(srcstr) - return len(replacements) - -def make_table(name, data): - damage_table = "DamageTable " + name + " = {\n" - linestart = " /* " - padlen = max([len(x) for x in damage_types]) - for i, dbyte in enumerate(data): - typestr = damage_types[i] - typestr += ' ' * (padlen - len(typestr)) + ' */ ' - damage_table += linestart + typestr + format_damage_byte(dbyte) - damage_table += '};\n' - - return damage_table - -def format_damage_byte(dbyte): - effect = (dbyte >> 4) & 0xF - damage = dbyte & 0xF - - effstr = format(effect, 'X') - dstr = str(damage) - - dtentry = 'DMG_ENTRY(' + dstr + ' , 0x' + effstr + '),\n' - - return dtentry - -def get_damage_bytes(address, repo): - file_result = None - - if address >= 0x80000000: - file_result = GetFromVRam(address) - else: - file_result = GetFromRom(address) - - if file_result is None: - print("Invalid address") - exit() - - print(file_result) - - with open(repo + os.sep + "baseroms/gc-eu-mq-dbg/segments" + os.sep + file_result.name, "rb") as ovl_file: - ovl_data = bytearray(ovl_file.read()) - - damage_data = ovl_data[file_result.offset:file_result.offset+0x20] - - damage_table = make_table('D_' + format(address, 'X'), damage_data) - - return damage_table - -def hex_parse(s): - return int(s, 16) - -parser = argparse.ArgumentParser(description = "Converts raw bytes into a formatted damage table") -parser.add_argument('-a', metavar='address', dest='address', help="VRam or Rom address of the damage table", type=hex_parse) -parser.add_argument('-f', metavar='file', dest='file', help='C file with unformatted damage tables') - -if __name__ == "__main__": - args = parser.parse_args() - script_dir = os.path.dirname(os.path.realpath(__file__)) - repo = script_dir + os.sep + ".." + os.sep + ".." - if(args.address): - print(get_damage_bytes(args.address, repo)) - elif(args.file): - replace_damage_table(args.file) - else: - print('Error: address or file required. Use -h for more detail.') diff --git a/tools/overlayhelpers/filemap.py b/tools/overlayhelpers/filemap.py deleted file mode 100644 index 3bf4eb9b9..000000000 --- a/tools/overlayhelpers/filemap.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python3 - -import os -import json - -table = None - -class AddrRange: - def __init__(self, start, end): - self.start = start - self.end = end - def __str__(self): - return "{0:08X}:{1:08X}".format(self.start, self.end) - -class FileResult: - def __init__(self, name, vrom, vram, offset): - self.name = name - self.vrom = vrom - self.vram = vram - self.offset = offset - - def __str__(self): - return "{0}: Rom {1} VRam {2} Offset {3:06X}".format(self.name, self.vrom, self.vram, self.offset) - -def PVA(a): - return a & 0x1FFFFFF -def UVA(a): - #a *= 0x10 - a += 0x80000000 - return a - -def CreateAddrLookup(dict, recs, tracer): - recs = sorted(recs, key= lambda x: x[0]) - length = len(recs) - print(length) - recs.append((recs[length-1][1], None, None)) - recs = sorted(recs, key=lambda x: x[0], reverse=True) - - for i in range(length): - if recs[i][0] != recs[i+1][1]: - if tracer != "ra" or recs[i][0] != recs[i+1][1] + 0xFFF & -0x1000: - print(tracer) - print(recs[i]) - print(recs[i+1]) - for item in recs: - dict[item[0]] = item[2] - -def CreateTable(): - - vrecs = [] - rrecs = [] - vrecs.append((PVA(0x80157D90), PVA(0x80800000), None)) - - dict = { - "va" : {}, - "ra" : {}, - "ft" : {} - } - - with open("filetable.txt", "r") as file: - for line in file: - li = line.rstrip().split('\t') - rrec = (int(li[2],16), int(li[3],16), li[7]) - vrec = (PVA(int(li[4],16)), PVA(int(li[5],16)), li[7]) - rrecs.append(rrec) - vrecs.append(vrec) - dict["ft"][li[7]] = (rrec[0], rrec[1]) - file = None - - with open("filetable2.txt", "r") as file: - for line in file: - li = line.rstrip().split('\t') - rrec = (int(li[2],16), int(li[3],16), li[5]) - rrecs.append(rrec) - dict["ft"][li[5]] = (rrec[0], rrec[1]) - - CreateAddrLookup(dict["va"], vrecs, "va") - CreateAddrLookup(dict["ra"], rrecs, "ra") - - with open("filetable.json", "w") as table: - json.dump(dict, table) - -def AddressLookup(lookupTable, addr): - start = 0 - end = 0 - key = None - - for k, v in lookupTable.items(): - if addr >= k: - start = k - key = v - break - end = k - return (key, start, end) - -def GetFromVRam(addr): - key, vramStart, vramEnd = AddressLookup(table["va"], PVA(addr)) - - if key is None: - return None - - ftl = table["ft"][key] - vrom = AddrRange(ftl[0], ftl[1]) - vram = AddrRange(UVA(vramStart), UVA(vramEnd)) - - offset = addr - vram.start - - return FileResult(key, vrom, vram, offset) - -def GetFromRom(addr): - key, romStart, romEnd = AddressLookup(table["ra"], addr) - - if key is None: - return None - - vrom = AddrRange(romStart, romEnd) - offset = addr - vrom.start - - return FileResult(key, vrom, None, offset) - -#CreateTable() -with open(os.path.join(os.path.dirname(__file__), 'filetable.json'), "r") as table: - table = json.load(table) -table["va"] = {int(k):v for k,v in table["va"].items()} -table["ra"] = {int(k):v for k,v in table["ra"].items()} diff --git a/tools/overlayhelpers/filetable.json b/tools/overlayhelpers/filetable.json deleted file mode 100644 index 33ec79907..000000000 --- a/tools/overlayhelpers/filetable.json +++ /dev/null @@ -1 +0,0 @@ -{"va": {"12248064": null, "12246208": "ovl_Shot_Sun", "12241936": "ovl_Oceff_Wipe4", "12235760": "ovl_Oceff_Wipe3", "12229552": "ovl_Oceff_Wipe2", "12225936": "ovl_Oceff_Wipe", "12218592": "ovl_Oceff_Storm", "12214384": "ovl_Oceff_Spot", "12200608": "ovl_Object_Kankyo", "12197360": "ovl_Obj_Warp2block", "12193120": "ovl_Obj_Tsubo", "12189600": "ovl_Obj_Timeblock", "12186288": "ovl_Obj_Syokudai", "12177936": "ovl_Obj_Switch", "12177360": "ovl_Obj_Roomtimer", "12169600": "ovl_Obj_Oshihiki", "12167632": "ovl_Obj_Mure3", "12164928": "ovl_Obj_Mure2", "12159648": "ovl_Obj_Mure", "12158224": "ovl_Obj_Makeoshihiki", "12157552": "ovl_Obj_Makekinsuta", "12151712": "ovl_Obj_Lightswitch", "12148944": "ovl_Obj_Lift", "12147152": "ovl_Obj_Kibako2", "12143776": "ovl_Obj_Kibako", "12141152": "ovl_Obj_Ice_Poly", "12139360": "ovl_Obj_Hsblock", "12138592": "ovl_Obj_Hana", "12136336": "ovl_Obj_Hamishi", "12135168": "ovl_Obj_Elevator", "12133408": "ovl_Obj_Dekujr", "12131168": "ovl_Obj_Comb", "12129776": "ovl_Obj_Bombiwa", "12129376": "ovl_Obj_Blockstop", "12118656": "ovl_Obj_Bean", "12111952": "ovl_Mir_Ray", "12103936": "ovl_Magic_Wind", "12094832": "ovl_Magic_Fire", "12088272": "ovl_Magic_Dark", "12085536": "ovl_Item_Shield", "12083504": "ovl_Item_Ocarina", "12083168": "ovl_Item_Inbox", "12080624": "ovl_Item_Etcetera", "12079440": "ovl_Item_B_Heart", "11966880": "ovl_Fishing", "11949856": "ovl_End_Title", "11938240": "ovl_En_fHG", "11928096": "ovl_En_Zo", "11909040": "ovl_En_Zl4", "11875248": "ovl_En_Zl3", "11856272": "ovl_En_Zl2", "11840320": "ovl_En_Zl1", "11812944": "ovl_En_Zf", "11811264": "ovl_En_Yukabyun", "11808192": "ovl_En_Yabusame_Mark", "11780576": "ovl_En_Xc", "11775856": "ovl_En_Wood02", "11771600": "ovl_En_Wonder_Talk2", "11768048": "ovl_En_Wonder_Talk", "11763808": "ovl_En_Wonder_Item", "11746480": "ovl_En_Wf", "11739792": "ovl_En_Weiyer", "11735072": "ovl_En_Weather_Tag", "11728160": "ovl_En_Wallmas", "11726320": "ovl_En_Wall_Tubo", "11719776": "ovl_En_Vm", "11706880": "ovl_En_Viewer", "11702176": "ovl_En_Vb_Ball", "11701936": "ovl_En_Vase", "11691696": "ovl_En_Vali", "11688176": "ovl_En_Tubo_Trap", "11683424": "ovl_En_Trap", "11676912": "ovl_En_Tr", "11668960": "ovl_En_Tp", "11665776": "ovl_En_Toryo", "11655552": "ovl_En_Torch2", "11655312": "ovl_En_Torch", "11647232": "ovl_En_Tk", "11635328": "ovl_En_Tite", "11633504": "ovl_En_Tg", "11632432": "ovl_En_Tana", "11629920": "ovl_En_Takara_Man", "11614880": "ovl_En_Ta", "11606256": "ovl_En_Syateki_Niw", "11602032": "ovl_En_Syateki_Man", "11597488": "ovl_En_Syateki_Itm", "11582896": "ovl_En_Sw", "11581344": "ovl_En_Stream", "11564352": "ovl_En_Sth", "11552912": "ovl_En_St", "11543152": "ovl_En_Ssh", "11542192": "ovl_En_Skjneedle", "11526832": "ovl_En_Skj", "11520416": "ovl_En_Skb", "11516800": "ovl_En_Siofuki", "11515536": "ovl_En_Si", "11511584": "ovl_En_Shopnuts", "11505184": "ovl_En_Sda", "11504752": "ovl_En_Scene_Change", "11499504": "ovl_En_Sb", "11490656": "ovl_En_Sa", "11478352": "ovl_En_Ru2", "11447312": "ovl_En_Ru1", "11437120": "ovl_En_Rr", "11432624": "ovl_En_Rl", "11430192": "ovl_En_River_Sound", "11422928": "ovl_En_Reeba", "11412480": "ovl_En_Rd", "11411648": "ovl_En_Pu_box", "11394384": "ovl_En_Poh", "11374480": "ovl_En_Po_Sisters", "11368256": "ovl_En_Po_Relay", "11352832": "ovl_En_Po_Field", "11349168": "ovl_En_Po_Desert", "11334816": "ovl_En_Peehat", "11328976": "ovl_En_Part", "11312928": "ovl_En_Owl", "11283616": "ovl_En_Ossan", "11273824": "ovl_En_Okuta", "11267360": "ovl_En_Okarina_Tag", "11265888": "ovl_En_Okarina_Effect", "11265696": "ovl_En_OE2", "11258800": "ovl_En_Ny", "11256032": "ovl_En_Nwc", "11254352": "ovl_En_Nutsball", "11246656": "ovl_En_Niw_Lady", "11243392": "ovl_En_Niw_Girl", "11229056": "ovl_En_Niw", "11210128": "ovl_En_Nb", "11207712": "ovl_En_Mu", "11205920": "ovl_En_Ms", "11202128": "ovl_En_Mm2", "11196272": "ovl_En_Mm", "11192576": "ovl_En_Mk", "11182672": "ovl_En_Md", "11165776": "ovl_En_Mb", "11156224": "ovl_En_Mag", "11152032": "ovl_En_Ma3", "11147680": "ovl_En_Ma2", "11142800": "ovl_En_Ma1", "11136992": "ovl_En_M_Thunder", "11136576": "ovl_En_M_Fire1", "11135440": "ovl_En_Lightbox", "11131712": "ovl_En_Light", "11126096": "ovl_En_Kz", "11120544": "ovl_En_Kusa", "11103664": "ovl_En_Ko", "11096912": "ovl_En_Karebaba", "11083680": "ovl_En_Kanban", "11078944": "ovl_En_Kakasi3", "11075600": "ovl_En_Kakasi2", "11071856": "ovl_En_Kakasi", "11048864": "ovl_En_Jsjutan", "11046416": "ovl_En_Js", "11040768": "ovl_En_Jj", "11040384": "ovl_En_It", "11002976": "ovl_En_Ishi", "10993184": "ovl_En_Insect", "10981296": "ovl_En_In", "10961680": "ovl_En_Ik", "10956784": "ovl_En_Ice_Hono", "10941872": "ovl_En_Hy", "10940320": "ovl_En_Hs2", "10937248": "ovl_En_Hs", "10934480": "ovl_En_Horse_Zelda", "10924624": "ovl_En_Horse_Normal", "10916816": "ovl_En_Horse_Link_Child", "10913376": "ovl_En_Horse_Ganon", "10909008": "ovl_En_Horse_Game_Check", "10859248": "ovl_En_Horse", "10853424": "ovl_En_Honotrap", "10849296": "ovl_En_Holl", "10842624": "ovl_En_Hintnuts", "10838224": "ovl_En_Heishi4", "10835520": "ovl_En_Heishi3", "10825376": "ovl_En_Heishi2", "10818256": "ovl_En_Heishi1", "10816848": "ovl_En_Hata", "10813984": "ovl_En_Guest", "10806048": "ovl_En_Gs", "10796192": "ovl_En_Goroiwa", "10784448": "ovl_En_Goma", "10759472": "ovl_En_Go2", "10741104": "ovl_En_Go", "10737376": "ovl_En_Gm", "10725200": "ovl_En_GirlA", "10703632": "ovl_En_GeldB", "10700320": "ovl_En_Ge3", "10693584": "ovl_En_Ge2", "10684784": "ovl_En_Ge1", "10678656": "ovl_En_Gb", "10649600": "ovl_En_Ganon_Organ", "10632544": "ovl_En_Ganon_Mant", "10624704": "ovl_En_G_Switch", "10616256": "ovl_En_Fz", "10610080": "ovl_En_Fw", "10606608": "ovl_En_Fu", "10594720": "ovl_En_Fr", "10581264": "ovl_En_Floormas", "10572416": "ovl_En_Fish", "10563696": "ovl_En_Firefly", "10558496": "ovl_En_Fire_Rock", "10547808": "ovl_En_Fhg_Fire", "10544304": "ovl_En_Fd_Fire", "10532544": "ovl_En_Fd", "10527760": "ovl_En_Ex_Ruppy", "10522272": "ovl_En_Ex_Item", "10516880": "ovl_En_Encount2", "10512160": "ovl_En_Encount1", "10492976": "ovl_En_Elf", "10485664": "ovl_En_Eiyer", "10485136": "ovl_En_Eg", "10483440": "ovl_En_Dy_Extra", "10476592": "ovl_En_Du", "10473520": "ovl_En_Ds", "10469840": "ovl_En_Door", "10465232": "ovl_En_Dog", "10453584": "ovl_En_Dodongo", "10445760": "ovl_En_Dodojr", "10433216": "ovl_En_Dnt_Nomal", "10427104": "ovl_En_Dnt_Jiji", "10422496": "ovl_En_Dnt_Demo", "10416976": "ovl_En_Dns", "10410096": "ovl_En_Diving_Game", "10406016": "ovl_En_Dha", "10399040": "ovl_En_Dh", "10392928": "ovl_En_Dekunuts", "10377168": "ovl_En_Dekubaba", "10371872": "ovl_En_Daiku_Kakariko", "10365744": "ovl_En_Daiku", "10361008": "ovl_En_Cs", "10355264": "ovl_En_Crow", "10350080": "ovl_En_Cow", "10302896": "ovl_En_Clear_Tag", "10299024": "ovl_En_Changer", "10296032": "ovl_En_Bx", "10282720": "ovl_En_Bw", "10276976": "ovl_En_Butte", "10271744": "ovl_En_Bubble", "10267408": "ovl_En_Brob", "10259904": "ovl_En_Box", "10257536": "ovl_En_Boom", "10252128": "ovl_En_Bombf", "10246192": "ovl_En_Bom_Chu", "10243648": "ovl_En_Bom_Bowl_Pit", "10237488": "ovl_En_Bom_Bowl_Man", "10233552": "ovl_En_Bom", "10231904": "ovl_En_Blkobj", "10230704": "ovl_En_Bird", "10221728": "ovl_En_Bili", "10210400": "ovl_En_Bigokuta", "10207280": "ovl_En_Bdfire", "10191584": "ovl_En_Bb", "10183504": "ovl_En_Ba", "10178816": "ovl_En_Attack_Niw", "10172704": "ovl_En_Arrow", "10172368": "ovl_En_Arow_Trap", "10171392": "ovl_En_Anubice_Tag", "10167712": "ovl_En_Anubice_Fire", "10162464": "ovl_En_Anubice", "10158960": "ovl_En_Ani", "10149664": "ovl_En_Am", "10147584": "ovl_Elf_Msg2", "10144544": "ovl_Elf_Msg", "10143488": "ovl_Effect_Ss_Stone1", "10142416": "ovl_Effect_Ss_Stick", "10142000": "ovl_Effect_Ss_Solder_Srch_Ball", "10141024": "ovl_Effect_Ss_Sibuki2", "10139184": "ovl_Effect_Ss_Sibuki", "10137328": "ovl_Effect_Ss_Lightning", "10135568": "ovl_Effect_Ss_KiraKira", "10131072": "ovl_Effect_Ss_Kakera", "10129840": "ovl_Effect_Ss_K_Fire", "10128368": "ovl_Effect_Ss_Ice_Smoke", "10127104": "ovl_Effect_Ss_Ice_Piece", "10125648": "ovl_Effect_Ss_HitMark", "10123760": "ovl_Effect_Ss_Hahen", "10122560": "ovl_Effect_Ss_G_Splash", "10121008": "ovl_Effect_Ss_G_Spk", "10119520": "ovl_Effect_Ss_G_Ripple", "10118048": "ovl_Effect_Ss_G_Magma2", "10117456": "ovl_Effect_Ss_G_Magma", "10116816": "ovl_Effect_Ss_G_Fire", "10114880": "ovl_Effect_Ss_Fire_Tail", "10110560": "ovl_Effect_Ss_Fhg_Flash", "10109216": "ovl_Effect_Ss_Fcircle", "10108096": "ovl_Effect_Ss_Extra", "10105648": "ovl_Effect_Ss_En_Ice", "10103648": "ovl_Effect_Ss_En_Fire", "10101456": "ovl_Effect_Ss_Dust", "10099888": "ovl_Effect_Ss_Dt_Bubble", "10099504": "ovl_Effect_Ss_Dead_Sound", "10098192": "ovl_Effect_Ss_Dead_Ds", "10096608": "ovl_Effect_Ss_Dead_Dd", "10095264": "ovl_Effect_Ss_Dead_Db", "10093904": "ovl_Effect_Ss_D_Fire", "10092608": "ovl_Effect_Ss_Bubble", "10090064": "ovl_Effect_Ss_Bomb2", "10088880": "ovl_Effect_Ss_Bomb", "10087856": "ovl_Effect_Ss_Blast", "10082512": "ovl_Eff_Dust", "10079408": "ovl_Efc_Erupc", "10061696": "ovl_Door_Warp1", "10061344": "ovl_Door_Toki", "10052256": "ovl_Door_Shutter", "10046544": "ovl_Door_Killer", "10044896": "ovl_Door_Gerudo", "10043120": "ovl_Door_Ana", "10041024": "ovl_Demo_Tre_Lgt", "10031664": "ovl_Demo_Shd", "10019936": "ovl_Demo_Sa", "10014672": "ovl_Demo_Kekkai", "9997952": "ovl_Demo_Kankyo", "9980896": "ovl_Demo_Im", "9974528": "ovl_Demo_Ik", "9950832": "ovl_Demo_Gt", "9947248": "ovl_Demo_Go", "9931056": "ovl_Demo_Gj", "9928256": "ovl_Demo_Geff", "9925520": "ovl_Demo_Ext", "9899856": "ovl_Demo_Effect", "9884848": "ovl_Demo_Ec", "9870032": "ovl_Demo_Du", "9857360": "ovl_Demo_6K", "9761472": "ovl_Boss_Va", "9669840": "ovl_Boss_Tw", "9618896": "ovl_Boss_Sst", "9550592": "ovl_Boss_Mo", "9525776": "ovl_Boss_Goma", "9504320": "ovl_Boss_Ganondrof", "9424704": "ovl_Boss_Ganon2", "9267312": "ovl_Boss_Ganon", "9250416": "ovl_Boss_Fd2", "9219520": "ovl_Boss_Fd", "9179536": "ovl_Boss_Dodongo", "9178144": "ovl_Bg_Zg", "9171984": "ovl_Bg_Ydan_Sp", "9170240": "ovl_Bg_Ydan_Maruta", "9168128": "ovl_Bg_Ydan_Hasi", "9166176": "ovl_Bg_Vb_Sima", "9165792": "ovl_Bg_Umajump", "9159936": "ovl_Bg_Treemouth", "9154112": "ovl_Bg_Toki_Swd", "9150208": "ovl_Bg_Toki_Hikari", "9148688": "ovl_Bg_Sst_Floor", "9147344": "ovl_Bg_Spot18_Shutter", "9144592": "ovl_Bg_Spot18_Obj", "9144192": "ovl_Bg_Spot18_Futa", "9139984": "ovl_Bg_Spot18_Basket", "9139200": "ovl_Bg_Spot17_Funen", "9137088": "ovl_Bg_Spot17_Bakudankabe", "9135168": "ovl_Bg_Spot16_Doughnut", "9129008": "ovl_Bg_Spot16_Bombstone", "9128016": "ovl_Bg_Spot15_Saku", "9124192": "ovl_Bg_Spot15_Rrbox", "9122848": "ovl_Bg_Spot12_Saku", "9121680": "ovl_Bg_Spot12_Gate", "9119728": "ovl_Bg_Spot11_Oasis", "9118080": "ovl_Bg_Spot11_Bakudankabe", "9116384": "ovl_Bg_Spot09_Obj", "9111904": "ovl_Bg_Spot08_Iceblock", "9110224": "ovl_Bg_Spot08_Bakudankabe", "9108528": "ovl_Bg_Spot07_Taki", "9103232": "ovl_Bg_Spot06_Objects", "9102448": "ovl_Bg_Spot05_Soko", "9100000": "ovl_Bg_Spot03_Taki", "9094752": "ovl_Bg_Spot02_Objects", "9093440": "ovl_Bg_Spot01_Objects2", "9092736": "ovl_Bg_Spot01_Idosoko", "9091808": "ovl_Bg_Spot01_Idomizu", "9088224": "ovl_Bg_Spot01_Idohashira", "9087424": "ovl_Bg_Spot01_Fusya", "9082752": "ovl_Bg_Spot00_Hanebasi", "9082336": "ovl_Bg_Spot00_Break", "9080400": "ovl_Bg_Relay_Objects", "9079520": "ovl_Bg_Pushbox", "9076912": "ovl_Bg_Po_Syokudai", "9069072": "ovl_Bg_Po_Event", "9065840": "ovl_Bg_Mori_Rakkatenjo", "9063872": "ovl_Bg_Mori_Kaitenkabe", "9061952": "ovl_Bg_Mori_Idomizu", "9058256": "ovl_Bg_Mori_Hineri", "9056352": "ovl_Bg_Mori_Hashira4", "9053536": "ovl_Bg_Mori_Hashigo", "9050112": "ovl_Bg_Mori_Elevator", "9046976": "ovl_Bg_Mori_Bigst", "9045888": "ovl_Bg_Mjin", "9042096": "ovl_Bg_Mizu_Water", "9041632": "ovl_Bg_Mizu_Uzu", "9039440": "ovl_Bg_Mizu_Shutter", "9034800": "ovl_Bg_Mizu_Movebg", "9028736": "ovl_Bg_Mizu_Bwall", "9028400": "ovl_Bg_Menkuri_Nisekabe", "9028016": "ovl_Bg_Menkuri_Kaiten", "9026672": "ovl_Bg_Menkuri_Eye", "9024576": "ovl_Bg_Jya_Zurerukabe", "9019696": "ovl_Bg_Jya_Megami", "9018272": "ovl_Bg_Jya_Lift", "9017152": "ovl_Bg_Jya_Kanaami", "9013408": "ovl_Bg_Jya_Ironobj", "9011392": "ovl_Bg_Jya_Haheniron", "9009520": "ovl_Bg_Jya_Goroiwa", "9001200": "ovl_Bg_Jya_Cobra", "8999328": "ovl_Bg_Jya_Bombiwa", "8996000": "ovl_Bg_Jya_Bombchuiwa", "8995232": "ovl_Bg_Jya_Block", "8992480": "ovl_Bg_Jya_Bigmirror", "8991424": "ovl_Bg_Jya_Amishutter", "8989536": "ovl_Bg_Jya_1flift", "8988480": "ovl_Bg_Ingate", "8986400": "ovl_Bg_Ice_Turara", "8985280": "ovl_Bg_Ice_Shutter", "8980288": "ovl_Bg_Ice_Shelter", "8976400": "ovl_Bg_Ice_Objects", "8975296": "ovl_Bg_Hidan_Syoku", "8971216": "ovl_Bg_Hidan_Sima", "8965824": "ovl_Bg_Hidan_Sekizou", "8962560": "ovl_Bg_Hidan_Rsekizou", "8958080": "ovl_Bg_Hidan_Rock", "8953888": "ovl_Bg_Hidan_Kowarerukabe", "8952160": "ovl_Bg_Hidan_Kousi", "8950064": "ovl_Bg_Hidan_Hrock", "8945728": "ovl_Bg_Hidan_Hamstep", "8942320": "ovl_Bg_Hidan_Fwbig", "8941120": "ovl_Bg_Hidan_Fslift", "8939104": "ovl_Bg_Hidan_Firewall", "8936992": "ovl_Bg_Hidan_Dalm", "8933792": "ovl_Bg_Hidan_Curtain", "8927120": "ovl_Bg_Heavy_Block", "8922560": "ovl_Bg_Haka_Zou", "8920320": "ovl_Bg_Haka_Water", "8917584": "ovl_Bg_Haka_Tubo", "8912032": "ovl_Bg_Haka_Trap", "8909056": "ovl_Bg_Haka_Ship", "8905952": "ovl_Bg_Haka_Sgami", "8904240": "ovl_Bg_Haka_MeganeBG", "8903232": "ovl_Bg_Haka_Megane", "8900544": "ovl_Bg_Haka_Huta", "8895984": "ovl_Bg_Haka_Gate", "8894128": "ovl_Bg_Haka", "8891840": "ovl_Bg_Gnd_Soulmeiro", "8891472": "ovl_Bg_Gnd_Nisekabe", "8886944": "ovl_Bg_Gnd_Iceblock", "8885440": "ovl_Bg_Gnd_Firemeiro", "8883248": "ovl_Bg_Gnd_Darkmeiro", "8881856": "ovl_Bg_Gjyo_Bridge", "8880480": "ovl_Bg_Gate_Shutter", "8870176": "ovl_Bg_Ganon_Otyuka", "8857648": "ovl_Bg_Dy_Yoseizo", "8854016": "ovl_Bg_Dodoago", "8851696": "ovl_Bg_Ddan_Kd", "8850096": "ovl_Bg_Ddan_Jd", "8846304": "ovl_Bg_Breakwall", "8843616": "ovl_Bg_Bowl_Wall", "8841168": "ovl_Bg_Bombwall", "8840528": "ovl_Bg_Bom_Guard", "8835088": "ovl_Bg_Bdan_Switch", "8830112": "ovl_Bg_Bdan_Objects", "8821936": "ovl_Arrow_Light", "8813776": "ovl_Arrow_Ice", "8805648": "ovl_Arrow_Fire", "8802048": "ovl_Arms_Hook", "8779344": "ovl_En_Test", "8751984": "ovl_map_mark_data", "8593936": "ovl_player_actor", "8468512": "ovl_kaleido_scope", "8404288": "ovl_file_choose", "8403952": "ovl_opening", "8391568": "ovl_select", "8388608": "ovl_title", "1408400": null, "118368": "code", "93600": "dmadata", "1120": "boot"}, "ra": {"56418368": null, "56418304": "softsprite_matrix_static", "56414208": "anime_texture_6_static", "56410112": "anime_texture_5_static", "56406016": "anime_texture_4_static", "56401920": "anime_texture_3_static", "56397824": "anime_texture_2_static", "56393728": "anime_texture_1_static", "56389632": "anime_model_6_static", "56385536": "anime_model_5_static", "56381440": "anime_model_4_static", "56377344": "anime_model_3_static", "56373248": "anime_model_2_static", "56369152": "anime_model_1_static", "56365056": "bump_texture_static", "56324096": "test01_room_0", "56307712": "test01_scene", "56266752": "ganontikasonogo_room_1", "56168448": "ganontikasonogo_room_0", "56147968": "ganontikasonogo_scene", "56086528": "kinsuta_room_0", "56078336": "kinsuta_scene", "55885824": "face_shop_room_0", "55881728": "face_shop_scene", "55857152": "besitu_room_0", "55853056": "besitu_scene", "55832576": "ganon_demo_room_0", "55791616": "ganon_demo_scene", "55754752": "ganon_sonogo_room_4", "55730176": "ganon_sonogo_room_3", "55693312": "ganon_sonogo_room_2", "55660544": "ganon_sonogo_room_1", "55627776": "ganon_sonogo_room_0", "55595008": "ganon_sonogo_scene", "55582720": "takaraya_room_6", "55570432": "takaraya_room_5", "55554048": "takaraya_room_4", "55541760": "takaraya_room_3", "55529472": "takaraya_room_2", "55521280": "takaraya_room_1", "55480320": "takaraya_room_0", "55447552": "takaraya_scene", "55418880": "mahouya_room_0", "55373824": "mahouya_scene", "55357440": "miharigoya_room_0", "55304192": "miharigoya_scene", "55267328": "souko_room_2", "55222272": "souko_room_1", "55181312": "souko_room_0", "55152640": "souko_scene", "55119872": "hylia_labo_room_0", "55046144": "hylia_labo_scene", "55017472": "hakaana_ouke_room_2", "54996992": "hakaana_ouke_room_1", "54951936": "hakaana_ouke_room_0", "54931456": "hakaana_ouke_scene", "54902784": "bowling_room_0", "54841344": "bowling_scene", "54824960": "hairal_niwa_n_room_0", "54784000": "hairal_niwa_n_scene", "54763520": "gerudoway_room_5", "54747136": "gerudoway_room_4", "54697984": "gerudoway_room_3", "54681600": "gerudoway_room_2", "54648832": "gerudoway_room_1", "54628352": "gerudoway_room_0", "54571008": "gerudoway_scene", "54542336": "hakaana2_room_0", "54484992": "hakaana2_scene", "54145024": "shrine_r_room_0", "54136832": "shrine_r_scene", "53796864": "shrine_n_room_0", "53788672": "shrine_n_scene", "53760000": "turibori_room_0", "53682176": "turibori_scene", "53342208": "shrine_room_0", "53334016": "shrine_scene", "53301248": "hakasitarelay_room_6", "53280768": "hakasitarelay_room_5", "53260288": "hakasitarelay_room_4", "53223424": "hakasitarelay_room_3", "53186560": "hakasitarelay_room_2", "53157888": "hakasitarelay_room_1", "53125120": "hakasitarelay_room_0", "53063680": "hakasitarelay_scene", "52965376": "hairal_niwa2_room_0", "52953088": "hairal_niwa2_scene", "52776960": "kakariko3_room_0", "52772864": "kakariko3_scene", "52719616": "ganon_final_room_0", "52641792": "ganon_final_scene", "52441088": "kokiri_home5_room_0", "52432896": "kokiri_home5_scene", "52199424": "kokiri_home4_room_0", "52191232": "kokiri_home4_scene", "52142080": "jyasinboss_room_3", "52125696": "jyasinboss_room_2", "52092928": "jyasinboss_room_1", "52088832": "jyasinboss_room_0", "52051968": "jyasinboss_scene", "52027392": "ganon_boss_room_0", "51994624": "ganon_boss_scene", "51970048": "ganon_room_9", "51941376": "ganon_room_8", "51896320": "ganon_room_7", "51855360": "ganon_room_6", "51818496": "ganon_room_5", "51777536": "ganon_room_4", "51744768": "ganon_room_3", "51712000": "ganon_room_2", "51679232": "ganon_room_1", "51646464": "ganon_room_0", "51576832": "ganon_scene", "51527680": "MIZUsin_bs_room_1", "51507200": "MIZUsin_bs_room_0", "51499008": "MIZUsin_bs_scene", "51474432": "HAKAdan_bs_room_1", "51462144": "HAKAdan_bs_room_0", "51449856": "HAKAdan_bs_scene", "51421184": "ydan_boss_room_1", "51392512": "ydan_boss_room_0", "51384320": "ydan_boss_scene", "51367936": "ddan_boss_room_1", "51347456": "ddan_boss_room_0", "51335168": "ddan_boss_scene", "51236864": "nakaniwa_room_0", "51220480": "nakaniwa_scene", "51007488": "tent_room_0", "51003392": "tent_scene", "50819072": "labo_room_0", "50814976": "labo_scene", "50655232": "impa_room_0", "50651136": "impa_scene", "50483200": "night_shop_room_0", "50479104": "night_shop_scene", "50319360": "alley_shop_room_0", "50315264": "alley_shop_scene", "50135040": "drag_room_0", "50130944": "drag_scene", "49971200": "zoora_room_0", "49967104": "zoora_scene", "49807360": "golon_room_0", "49803264": "golon_scene", "49782784": "yousei_izumi_yoko_room_0", "49729536": "yousei_izumi_yoko_scene", "49709056": "yousei_izumi_tate_room_0", "49672192": "yousei_izumi_tate_scene", "49639424": "hakaana_room_0", "49635328": "hakaana_scene", "49618944": "daiyousei_izumi_room_0", "49561600": "daiyousei_izumi_scene", "49389568": "hut_room_0", "49385472": "hut_scene", "49356800": "FIRE_bs_room_1", "49336320": "FIRE_bs_room_0", "49315840": "FIRE_bs_scene", "49291264": "bdan_boss_room_1", "49274880": "bdan_boss_room_0", "49270784": "bdan_boss_scene", "49094656": "kakariko_room_0", "49090560": "kakariko_scene", "48898048": "malon_stable_room_0", "48893952": "malon_stable_scene", "48668672": "kokiri_home3_room_0", "48660480": "kokiri_home3_scene", "48656384": "hiral_demo_room_0", "48640000": "hiral_demo_scene", "48156672": "market_alley_n_room_0", "48148480": "market_alley_n_scene", "47992832": "enrui_room_0", "47988736": "enrui_scene", "47833088": "entra_n_room_0", "47828992": "entra_n_scene", "47816704": "market_ruins_room_0", "47808512": "market_ruins_scene", "47779840": "spot20_room_0", "47706112": "spot20_scene", "47222784": "market_alley_room_0", "47214592": "market_alley_scene", "47198208": "sasatest_room_0", "47185920": "sasatest_scene", "47104000": "ganon_tou_room_0", "47083520": "ganon_tou_scene", "47038464": "hairal_niwa_room_0", "46964736": "hairal_niwa_scene", "46792704": "shop1_room_0", "46788608": "shop1_scene", "46755840": "syatekijyou_room_0", "46702592": "syatekijyou_scene", "46645248": "moribossroom_room_1", "46620672": "moribossroom_room_0", "46612480": "moribossroom_scene", "46456832": "entra_room_0", "46452736": "entra_scene", "46424064": "kakusiana_room_13", "46391296": "kakusiana_room_12", "46354432": "kakusiana_room_11", "46329856": "kakusiana_room_10", "46305280": "kakusiana_room_9", "46288896": "kakusiana_room_8", "46272512": "kakusiana_room_7", "46247936": "kakusiana_room_6", "46227456": "kakusiana_room_5", "46194688": "kakusiana_room_4", "46170112": "kakusiana_room_3", "46157824": "kakusiana_room_2", "46133248": "kakusiana_room_1", "46100480": "kakusiana_room_0", "46043136": "kakusiana_scene", "45862912": "kokiri_home_room_0", "45858816": "kokiri_home_scene", "45658112": "kokiri_shop_room_0", "45654016": "kokiri_shop_scene", "45490176": "link_home_room_0", "45481984": "link_home_scene", "45449216": "sutaru_room_0", "45445120": "sutaru_scene", "45412352": "tokinoma_room_1", "45314048": "tokinoma_room_0", "45236224": "tokinoma_scene", "45154304": "kenjyanoma_room_0", "45137920": "kenjyanoma_scene", "45133824": "testroom_room_4", "45117440": "testroom_room_3", "45101056": "testroom_room_2", "45088768": "testroom_room_1", "45068288": "testroom_room_0", "45047808": "testroom_scene", "45023232": "market_night_room_0", "45010944": "market_night_scene", "44986368": "market_day_room_0", "44974080": "market_day_scene", "44851200": "spot18_room_3", "44777472": "spot18_room_2", "44748800": "spot18_room_1", "44670976": "spot18_room_0", "44625920": "spot18_scene", "44548096": "spot17_room_1", "44519424": "spot17_room_0", "44453888": "spot17_scene", "44408832": "spot16_room_0", "44281856": "spot16_scene", "44224512": "spot15_room_0", "44122112": "spot15_scene", "44044288": "spot13_room_1", "44040192": "spot13_room_0", "44015616": "spot13_scene", "43962368": "spot12_room_1", "43888640": "spot12_room_0", "43823104": "spot12_scene", "43769856": "spot11_room_0", "43663360": "spot11_scene", "43646976": "spot10_room_9", "43634688": "spot10_room_8", "43622400": "spot10_room_7", "43606016": "spot10_room_6", "43577344": "spot10_room_5", "43565056": "spot10_room_4", "43540480": "spot10_room_3", "43520000": "spot10_room_2", "43483136": "spot10_room_1", "43470848": "spot10_room_0", "43401216": "spot10_scene", "43364352": "spot09_room_0", "43290624": "spot09_scene", "43253760": "spot08_room_0", "43180032": "spot08_scene", "43126784": "spot07_room_1", "43098112": "spot07_room_0", "43057152": "spot07_scene", "43012096": "spot06_room_0", "42897408": "spot06_scene", "42856448": "spot05_room_0", "42770432": "spot05_scene", "42745856": "spot04_room_2", "42708992": "spot04_room_1", "42594304": "spot04_room_0", "42520576": "spot04_scene", "42487808": "spot03_room_1", "42430464": "spot03_room_0", "42381312": "spot03_scene", "42258432": "spot02_room_1", "42246144": "spot02_room_0", "42196992": "spot02_scene", "42156032": "spot01_room_0", "42037248": "spot01_scene", "41947136": "spot00_room_0", "41771008": "spot00_scene", "41615360": "depth_test_room_0", "41611264": "depth_test_scene", "41570304": "syotes2_room_0", "41558016": "syotes2_scene", "41504768": "syotes_room_0", "41496576": "syotes_scene", "41463808": "ganontika_room_19", "41410560": "ganontika_room_18", "41373696": "ganontika_room_17", "41361408": "ganontika_room_16", "41328640": "ganontika_room_15", "41283584": "ganontika_room_14", "41250816": "ganontika_room_13", "41201664": "ganontika_room_12", "41172992": "ganontika_room_11", "41144320": "ganontika_room_10", "41095168": "ganontika_room_9", "41054208": "ganontika_room_8", "41021440": "ganontika_room_7", "40955904": "ganontika_room_6", "40923136": "ganontika_room_5", "40890368": "ganontika_room_4", "40849408": "ganontika_room_3", "40816640": "ganontika_room_2", "40697856": "ganontika_room_1", "40656896": "ganontika_room_0", "40517632": "ganontika_scene", "40493056": "men_room_10", "40476672": "men_room_9", "40439808": "men_room_8", "40402944": "men_room_7", "40370176": "men_room_6", "40345600": "men_room_5", "40300544": "men_room_4", "40267776": "men_room_3", "40243200": "men_room_2", "40202240": "men_room_1", "40136704": "men_room_0", "40062976": "men_scene", "40038400": "ice_doukutu_room_11", "40017920": "ice_doukutu_room_10", "39981056": "ice_doukutu_room_9", "39972864": "ice_doukutu_room_8", "39948288": "ice_doukutu_room_7", "39927808": "ice_doukutu_room_6", "39890944": "ice_doukutu_room_5", "39858176": "ice_doukutu_room_4", "39821312": "ice_doukutu_room_3", "39796736": "ice_doukutu_room_2", "39743488": "ice_doukutu_room_1", "39706624": "ice_doukutu_room_0", "39632896": "ice_doukutu_scene", "39620608": "HAKAdanCH_room_6", "39608320": "HAKAdanCH_room_5", "39596032": "HAKAdanCH_room_4", "39587840": "HAKAdanCH_room_3", "39571456": "HAKAdanCH_room_2", "39522304": "HAKAdanCH_room_1", "39432192": "HAKAdanCH_room_0", "39378944": "HAKAdanCH_scene", "39366656": "HAKAdan_room_22", "39317504": "HAKAdan_room_21", "39309312": "HAKAdan_room_20", "39297024": "HAKAdan_room_19", "39239680": "HAKAdan_room_18", "39227392": "HAKAdan_room_17", "39215104": "HAKAdan_room_16", "39182336": "HAKAdan_room_15", "39157760": "HAKAdan_room_14", "39149568": "HAKAdan_room_13", "39124992": "HAKAdan_room_12", "39108608": "HAKAdan_room_11", "39075840": "HAKAdan_room_10", "39022592": "HAKAdan_room_9", "38998016": "HAKAdan_room_8", "38989824": "HAKAdan_room_7", "38957056": "HAKAdan_room_6", "38932480": "HAKAdan_room_5", "38924288": "HAKAdan_room_4", "38912000": "HAKAdan_room_3", "38866944": "HAKAdan_room_2", "38858752": "HAKAdan_room_1", "38809600": "HAKAdan_room_0", "38707200": "HAKAdan_scene", "38670336": "jyasinzou_room_28", "38645760": "jyasinzou_room_27", "38592512": "jyasinzou_room_26", "38502400": "jyasinzou_room_25", "38473728": "jyasinzou_room_24", "38432768": "jyasinzou_room_23", "38416384": "jyasinzou_room_22", "38395904": "jyasinzou_room_21", "38359040": "jyasinzou_room_20", "38334464": "jyasinzou_room_19", "38309888": "jyasinzou_room_18", "38268928": "jyasinzou_room_17", "38240256": "jyasinzou_room_16", "38203392": "jyasinzou_room_15", "38182912": "jyasinzou_room_14", "38158336": "jyasinzou_room_13", "38146048": "jyasinzou_room_12", "38137856": "jyasinzou_room_11", "38100992": "jyasinzou_room_10", "38076416": "jyasinzou_room_9", "38039552": "jyasinzou_room_8", "38014976": "jyasinzou_room_7", "37994496": "jyasinzou_room_6", "37892096": "jyasinzou_room_5", "37859328": "jyasinzou_room_4", "37842944": "jyasinzou_room_3", "37818368": "jyasinzou_room_2", "37777408": "jyasinzou_room_1", "37707776": "jyasinzou_room_0", "37601280": "jyasinzou_scene", "37560320": "MIZUsin_room_22", "37527552": "MIZUsin_room_21", "37498880": "MIZUsin_room_20", "37482496": "MIZUsin_room_19", "37462016": "MIZUsin_room_18", "37425152": "MIZUsin_room_17", "37408768": "MIZUsin_room_16", "37376000": "MIZUsin_room_15", "37347328": "MIZUsin_room_14", "37343232": "MIZUsin_room_13", "37314560": "MIZUsin_room_12", "37294080": "MIZUsin_room_11", "37265408": "MIZUsin_room_10", "37228544": "MIZUsin_room_9", "37171200": "MIZUsin_room_8", "37146624": "MIZUsin_room_7", "37097472": "MIZUsin_room_6", "37052416": "MIZUsin_room_5", "37023744": "MIZUsin_room_4", "36995072": "MIZUsin_room_3", "36970496": "MIZUsin_room_2", "36925440": "MIZUsin_room_1", "36835328": "MIZUsin_room_0", "36745216": "MIZUsin_scene", "36716544": "HIDAN_room_26", "36687872": "HIDAN_room_25", "36663296": "HIDAN_room_24", "36634624": "HIDAN_room_23", "36605952": "HIDAN_room_22", "36569088": "HIDAN_room_21", "36540416": "HIDAN_room_20", "36519936": "HIDAN_room_19", "36503552": "HIDAN_room_18", "36462592": "HIDAN_room_17", "36413440": "HIDAN_room_16", "36405248": "HIDAN_room_15", "36392960": "HIDAN_room_14", "36339712": "HIDAN_room_13", "36327424": "HIDAN_room_12", "36311040": "HIDAN_room_11", "36208640": "HIDAN_room_10", "36171776": "HIDAN_room_9", "36130816": "HIDAN_room_8", "36114432": "HIDAN_room_7", "36085760": "HIDAN_room_6", "36040704": "HIDAN_room_5", "36007936": "HIDAN_room_4", "35995648": "HIDAN_room_3", "35926016": "HIDAN_room_2", "35872768": "HIDAN_room_1", "35840000": "HIDAN_room_0", "35729408": "HIDAN_scene", "35721216": "Bmori1_room_22", "35713024": "Bmori1_room_21", "35704832": "Bmori1_room_20", "35700736": "Bmori1_room_19", "35692544": "Bmori1_room_18", "35651584": "Bmori1_room_17", "35631104": "Bmori1_room_16", "35618816": "Bmori1_room_15", "35594240": "Bmori1_room_14", "35557376": "Bmori1_room_13", "35520512": "Bmori1_room_12", "35475456": "Bmori1_room_11", "35450880": "Bmori1_room_10", "35405824": "Bmori1_room_9", "35307520": "Bmori1_room_8", "35229696": "Bmori1_room_7", "35188736": "Bmori1_room_6", "35172352": "Bmori1_room_5", "35155968": "Bmori1_room_4", "35139584": "Bmori1_room_3", "35074048": "Bmori1_room_2", "35049472": "Bmori1_room_1", "34992128": "Bmori1_room_0", "34902016": "Bmori1_scene", "34889728": "bdan_room_15", "34861056": "bdan_room_14", "34848768": "bdan_room_13", "34832384": "bdan_room_12", "34816000": "bdan_room_11", "34799616": "bdan_room_10", "34783232": "bdan_room_9", "34766848": "bdan_room_8", "34750464": "bdan_room_7", "34729984": "bdan_room_6", "34701312": "bdan_room_5", "34680832": "bdan_room_4", "34648064": "bdan_room_3", "34607104": "bdan_room_2", "34582528": "bdan_room_1", "34562048": "bdan_room_0", "34471936": "bdan_scene", "34447360": "ddan_room_16", "34435072": "ddan_room_15", "34422784": "ddan_room_14", "34410496": "ddan_room_13", "34373632": "ddan_room_12", "34361344": "ddan_room_11", "34328576": "ddan_room_10", "34279424": "ddan_room_9", "34238464": "ddan_room_8", "34205696": "ddan_room_7", "34193408": "ddan_room_6", "34168832": "ddan_room_5", "34127872": "ddan_room_4", "34070528": "ddan_room_3", "34037760": "ddan_room_2", "33996800": "ddan_room_1", "33882112": "ddan_room_0", "33792000": "ddan_scene", "33759232": "ydan_room_11", "33738752": "ydan_room_10", "33697792": "ydan_room_9", "33693696": "ydan_room_8", "33656832": "ydan_room_7", "33636352": "ydan_room_6", "33599488": "ydan_room_5", "33579008": "ydan_room_4", "33492992": "ydan_room_3", "33468416": "ydan_room_2", "33447936": "ydan_room_1", "33357824": "ydan_room_0", "33300480": "ydan_scene", "33296384": "elf_message_ydan", "33292288": "elf_message_field", "33288192": "vr_FCVR_pal_static", "33157120": "vr_FCVR_static", "33153024": "vr_TTVR_pal_static", "32956416": "vr_TTVR_static", "32952320": "vr_LBVR_pal_static", "32690176": "vr_LBVR_static", "32686080": "vr_NSVR_pal_static", "32555008": "vr_NSVR_static", "32550912": "vr_ALVR_pal_static", "32419840": "vr_ALVR_static", "32415744": "vr_DGVR_pal_static", "32284672": "vr_DGVR_static", "32280576": "vr_ZRVR_pal_static", "32149504": "vr_ZRVR_static", "32145408": "vr_GLVR_pal_static", "32014336": "vr_GLVR_static", "32010240": "vr_KSVR_pal_static", "31879168": "vr_KSVR_static", "31875072": "vr_IPVR_pal_static", "31612928": "vr_IPVR_static", "31608832": "vr_KR3VR_pal_static", "31412224": "vr_KR3VR_static", "31408128": "vr_KKRVR_pal_static", "31145984": "vr_KKRVR_static", "31141888": "vr_MLVR_pal_static", "30879744": "vr_MLVR_static", "30875648": "vr_SP1a_pal_static", "30744576": "vr_SP1a_static", "30740480": "vr_K5VR_pal_static", "30543872": "vr_K5VR_static", "30539776": "vr_K4VR_pal_static", "30343168": "vr_K4VR_static", "30339072": "vr_K3VR_pal_static", "30142464": "vr_K3VR_static", "30138368": "vr_KHVR_pal_static", "29876224": "vr_KHVR_static", "29872128": "vr_LHVR_pal_static", "29609984": "vr_LHVR_static", "29605888": "vr_RUVR_pal_static", "29343744": "vr_RUVR_static", "29339648": "vr_MNVR_pal_static", "29077504": "vr_MNVR_static", "29073408": "vr_MDVR_pal_static", "28811264": "vr_MDVR_static", "28807168": "vr_holy1_pal_static", "28741632": "vr_holy1_static", "28737536": "vr_holy0_pal_static", "28672000": "vr_holy0_static", "28667904": "vr_cloud3_pal_static", "28618752": "vr_cloud3_static", "28614656": "vr_cloud2_pal_static", "28565504": "vr_cloud2_static", "28561408": "vr_cloud1_pal_static", "28512256": "vr_cloud1_static", "28508160": "vr_cloud0_pal_static", "28459008": "vr_cloud0_static", "28454912": "vr_fine3_pal_static", "28405760": "vr_fine3_static", "28401664": "vr_fine2_pal_static", "28352512": "vr_fine2_static", "28348416": "vr_fine1_pal_static", "28299264": "vr_fine1_static", "28295168": "vr_fine0_pal_static", "28246016": "vr_fine0_static", "28229632": "parameter_static", "27934720": "title_static", "27922432": "nintendo_rogo_static", "27910144": "z_select_static", "27897856": "g_pn_57", "27885568": "g_pn_56", "27873280": "g_pn_55", "27860992": "g_pn_54", "27848704": "g_pn_53", "27836416": "g_pn_52", "27824128": "g_pn_51", "27811840": "g_pn_50", "27799552": "g_pn_49", "27787264": "g_pn_48", "27774976": "g_pn_47", "27762688": "g_pn_46", "27750400": "g_pn_45", "27738112": "g_pn_44", "27725824": "g_pn_43", "27713536": "g_pn_42", "27701248": "g_pn_41", "27688960": "g_pn_40", "27676672": "g_pn_39", "27664384": "g_pn_38", "27652096": "g_pn_37", "27639808": "g_pn_36", "27627520": "g_pn_35", "27615232": "g_pn_34", "27602944": "g_pn_33", "27590656": "g_pn_32", "27578368": "g_pn_31", "27566080": "g_pn_30", "27553792": "g_pn_29", "27541504": "g_pn_28", "27529216": "g_pn_27", "27516928": "g_pn_26", "27504640": "g_pn_25", "27492352": "g_pn_24", "27480064": "g_pn_23", "27467776": "g_pn_22", "27455488": "g_pn_21", "27443200": "g_pn_20", "27430912": "g_pn_19", "27418624": "g_pn_18", "27406336": "g_pn_17", "27394048": "g_pn_16", "27381760": "g_pn_15", "27369472": "g_pn_14", "27357184": "g_pn_13", "27344896": "g_pn_12", "27332608": "g_pn_11", "27320320": "g_pn_10", "27308032": "g_pn_09", "27295744": "g_pn_08", "27283456": "g_pn_07", "27271168": "g_pn_06", "27258880": "g_pn_05", "27246592": "g_pn_04", "27234304": "g_pn_03", "27222016": "g_pn_02", "27209728": "g_pn_01", "27090944": "object_zl4", "27086848": "object_timeblock", "27082752": "object_ouke_haka", "27074560": "object_door_killer", "27070464": "object_gi_sword_1", "27058176": "object_cob", "27037696": "object_cow", "27029504": "object_crow", "27021312": "object_bwall", "26968064": "object_ps", "26963968": "object_gs", "26947584": "object_haka_door", "26943488": "object_geff", "26898432": "object_gj", "26877952": "object_skb", "26832896": "object_wf", "26787840": "object_mu", "26759168": "object_po_composer", "26746880": "object_spot01_matoyab", "26730496": "object_spot01_matoya", "26726400": "object_gi_rupy", "26640384": "object_ganon_anime3", "26570752": "object_ganon_anime2", "26521600": "object_ganon_anime1", "26513408": "object_gi_dekupouch", "26505216": "object_efc_doughnut", "26443776": "object_demo_kekkai", "26415104": "object_po_field", "26398720": "object_bowl", "26394624": "object_gi_soul", "26390528": "object_gi_ghost", "26386432": "object_gi_butterfly", "26382336": "object_gi_insect", "26378240": "object_gi_fire", "26365952": "object_dnk", "26349568": "object_dns", "26341376": "object_kibako2", "26333184": "object_spot11_obj", "26329088": "object_spot01_objects2", "26316800": "object_jya_door", "26304512": "object_jya_iron", "26271744": "object_dog", "26230784": "object_gr", "26181632": "object_geldb", "26161152": "object_shopnuts", "26120192": "object_gla", "26112000": "object_spot00_break", "26091520": "object_rs", "26075136": "object_hintnuts", "26071040": "object_bombiwa", "26058752": "object_spot12_obj", "26050560": "object_spot05_objects", "26017792": "object_bg", "25989120": "object_bigokuta", "25964544": "object_ssh", "25960448": "object_gi_goddess", "25956352": "object_gi_sutaru", "25866240": "object_fish", "25812992": "object_ec", "25792512": "object_ds2", "25788416": "object_gi_m_arrow", "25780224": "object_gi_hoverboots", "25772032": "object_zg", "25751552": "object_ts", "25722880": "object_ka", "25501696": "object_ganon2", "25493504": "object_gi_gerudomask", "25485312": "object_gi_zoramask", "25477120": "object_gi_golonmask", "25432064": "object_zl2_anime2", "25382912": "object_zl2_anime1", "25370624": "object_efc_erupc", "25288704": "object_gt", "25284608": "object_door_gerudo", "25128960": "object_mag", "25120768": "object_gi_frog", "25116672": "object_gi_soldout", "25112576": "object_gi_bracelet", "25108480": "object_gi_prescription", "25071616": "object_cs", "25047040": "object_js", "25042944": "object_gi_brokensword", "25034752": "object_gi_ticketstone", "25030656": "object_gi_mushroom", "25026560": "object_gi_powder", "25022464": "object_gi_eye_lotion", "25001984": "object_os", "24985600": "object_fa", "24948736": "object_mm", "24944640": "object_stream", "24940544": "object_siofuki", "24932352": "object_ganon_objects", "24924160": "object_gi_truth_mask", "24920064": "object_gi_rabit_mask", "24915968": "object_gi_skj_mask", "24911872": "object_gi_redead_mask", "24907776": "object_gi_ki_tan_mask", "24879104": "object_fu", "24854528": "object_mk", "24784896": "object_owl", "24776704": "object_gjyo_objects", "24768512": "object_kanban", "24764416": "object_gi_coin", "24756224": "object_gi_gloves", "24748032": "object_tsubo", "24743936": "object_kusa", "24731648": "object_lightswitch", "24723456": "object_ingate", "24694784": "object_hs", "24678400": "object_ms", "24674304": "object_gm", "24592384": "object_blkobj", "24588288": "object_nwc", "24551424": "object_daiku", "24518656": "object_toryo", "24510464": "object_goroiwa", "24498176": "object_mamenoki", "24489984": "object_d_lift", "24481792": "object_d_hsblock", "24473600": "object_d_elevator", "24465408": "object_gnd_magic", "24461312": "object_gi_seed", "24453120": "object_gi_boots_2", "24449024": "object_yabusame_point", "24403968": "object_ge1", "24383488": "object_bob", "24367104": "object_fz", "24338432": "object_spot07_object", "24330240": "object_spot03_object", "24305664": "object_boj", "24276992": "object_ane", "24256512": "object_ds", "24252416": "object_gi_ocarina_0", "24231936": "object_bba", "24211456": "object_bji", "24207360": "object_gi_bottle_letter", "24170496": "object_skj", "24162304": "object_gi_niwatori", "24150016": "object_cne", "24125440": "object_ahg", "23990272": "object_ik", "23965696": "object_aob", "23961600": "object_masterzoora", "23957504": "object_mastergolon", "23945216": "object_masterkokirihead", "23941120": "object_masterkokiri", "23932928": "object_umajump", "23896064": "object_kz", "23842816": "object_zo", "23814144": "object_kw1", "23789568": "object_km1", "23744512": "object_md", "23732224": "object_spot01_objects", "23728128": "object_gi_longsword", "23724032": "object_gi_grass", "23719936": "object_gi_hammer", "23715840": "object_gi_saw", "23711744": "object_gi_fish", "23707648": "object_gi_bean", "23699456": "object_gi_clothes", "23580672": "object_jya_obj", "23572480": "object_spot15_obj", "23568384": "object_gi_letter", "23560192": "object_gi_shield_3", "23543808": "object_demo_6k", "23511040": "object_ani", "23502848": "object_gi_liquid", "23494656": "object_gi_glasses", "23490560": "object_gi_bow", "23486464": "object_gi_boomerang", "23482368": "object_gi_pachinko", "23433216": "object_fr", "23420928": "object_ny", "23310336": "object_sst", "23236608": "object_ganon", "23199744": "object_ma1", "23191552": "object_gi_milk", "23187456": "object_gi_ocarina", "23179264": "object_gi_hookshot", "23171072": "object_gi_shield_2", "23166976": "object_gi_scale", "23158784": "object_gi_egg", "23154688": "object_gi_bomb_2", "23146496": "object_gi_arrow", "23138304": "object_gi_gerudo", "23121920": "object_anubice", "23109632": "object_bxa", "23105536": "object_rr", "22863872": "object_tw", "22818816": "object_hni", "22810624": "object_gi_purse", "22769664": "object_ma2", "22732800": "object_oF1s", "22728704": "object_gi_bomb_1", "22720512": "object_gi_magicpot", "22704128": "object_dekujr", "22700032": "object_gi_shield_1", "22634496": "object_ru2", "22564864": "object_oF1d_map", "22556672": "object_gi_map", "22552576": "object_gi_stick", "22548480": "object_gi_bottle", "22503424": "object_os_anime", "22482944": "object_oE4s", "22454272": "object_oE1s", "22446080": "object_spot16_obj", "22368256": "object_tr", "22265856": "object_in", "22261760": "object_gi_bombpouch", "22257664": "object_gi_arrowcase", "22249472": "object_gi_hearts", "22159360": "object_sa", "22151168": "object_gi_nuts", "22126592": "object_gi_medal", "22118400": "object_gi_bosskey", "22114304": "object_gi_compass", "22110208": "object_gi_heart", "22106112": "object_gi_melody", "22093824": "object_sb", "22052864": "object_mo", "21950464": "object_nb", "21934080": "object_shop_dungen", "21925888": "object_spot17_obj", "21893120": "object_bdoor", "21839872": "object_spot18_obj", "21737472": "object_spot09_obj", "21721088": "object_gi_jewel", "21712896": "object_brob", "21704704": "object_mir_ray", "21700608": "object_gi_key", "21696512": "object_demo_tre_lgt", "21688320": "object_efc_tw", "21655552": "object_rl", "21614592": "object_dh", "21540864": "object_fd2", "21524480": "object_syokudai", "21442560": "object_ru1", "21434368": "object_haka", "21340160": "object_spot02_objects", "21303296": "object_horse_link_child", "21270528": "object_fw", "21192704": "object_du", "21118976": "object_fd", "21045248": "object_gndd", "21037056": "object_heavy_object", "20975616": "object_po_sisters", "20914176": "object_rd", "20860928": "object_sd", "20807680": "object_bdan_objects", "20783104": "object_medal", "20770816": "object_triforce_spot", "20762624": "object_light_ring", "20742144": "object_god_lgt", "20733952": "object_efc_star_field", "20725760": "object_efc_lgt_shower", "20721664": "object_efc_flash", "20717568": "object_efc_fire_ball", "20713472": "object_efc_crystal_light", "20684800": "object_hakach_objects", "20553728": "object_bv", "20537344": "object_vm", "20418560": "object_xc", "20369408": "object_tk", "20307968": "object_ta", "20230144": "object_im", "20221952": "object_vase", "20209664": "object_trap", "20201472": "object_pu_box", "20193280": "object_lightbox", "20156416": "object_wood02", "20144128": "object_bird", "20131840": "object_hata", "20127744": "object_warp2", "20103168": "object_spot08_obj", "20062208": "object_mori_tex", "20025344": "object_mori_objects", "19996672": "object_mori_hineri2a", "19976192": "object_mori_hineri2", "19959808": "object_mori_hineri1a", "19943424": "object_relay_objects", "19906560": "object_ice_objects", "19894272": "object_spot06_objects", "19771392": "object_haka_objects", "19763200": "object_mjin_oka", "19759104": "object_mjin_wind", "19755008": "object_mjin_soul", "19750912": "object_mjin_ice", "19746816": "object_mjin_flame", "19742720": "object_mjin_dark", "19738624": "object_mjin_flash", "19730432": "object_mjin", "19660800": "object_zl2", "19652608": "object_yukabyun", "19615744": "object_toki_objects", "19607552": "object_Bb", "19582976": "object_mori_hineri1", "19542016": "object_ossan", "19464192": "object_fhg", "19415040": "object_mizu_objects", "19406848": "object_oA11", "19394560": "object_oA10", "19374080": "object_vali", "19357696": "object_oE12", "19341312": "object_oE11", "19329024": "object_oE10", "19316736": "object_oE9", "19300352": "object_oE8", "19288064": "object_oE7", "19275776": "object_oE6", "19251200": "object_oE5", "19214336": "object_menkuri_objects", "19193856": "object_oE4", "19161088": "object_oE3", "19144704": "object_dekunuts", "19140608": "object_b_heart", "19128320": "object_warp1", "19103744": "object_opening_demo1", "19070976": "object_horse_zelda", "19062784": "object_oB4", "19042304": "object_oB3", "19021824": "object_oB2", "19017728": "object_oA9", "19009536": "object_oA8", "18960384": "object_jj", "18952192": "object_oA7", "18944000": "object_oA6", "18935808": "object_oA5", "18927616": "object_oA4", "18915328": "object_oA3", "18898944": "object_dekubaba", "18874368": "object_am", "18796544": "object_gnd", "18755584": "object_ydan_objects", "18731008": "object_oE2", "18706432": "object_oE_anime", "18677760": "object_oE1", "18616320": "object_sk2", "18608128": "object_bombf", "18522112": "object_mb", "18513920": "object_spot00_objects", "18489344": "object_oA2", "18436096": "object_horse_ganon", "18337792": "object_hidan_objects", "18300928": "object_ddan_objects", "18292736": "object_spot04_objects", "18280448": "object_o_anime", "18251776": "object_oB1", "18210816": "object_horse_normal", "18194432": "object_ei", "18182144": "object_bw", "18157568": "object_st", "18137088": "object_oA1", "18128896": "object_tp", "18104320": "object_bl", "18083840": "object_torch2", "18071552": "object_dodojr", "18063360": "object_bubble", "18042880": "object_gol", "17956864": "object_zl1", "17825792": "object_goma", "17731584": "object_zf", "17674240": "object_horse", "17473536": "object_kingdodongo", "17465344": "object_peehat", "17457152": "object_reeba", "17440768": "object_tite", "17428480": "object_niw", "17408000": "object_fire", "17367040": "object_dodongo", "17358848": "object_firefly", "17235968": "object_dy_obj", "17190912": "object_wallmaster", "17166336": "object_poh", "17149952": "object_okuta", "17068032": "object_human", "17043456": "object_box", "16859136": "object_link_child", "16629760": "object_link_boy", "16625664": "gameplay_object_exchange_static", "16527360": "gameplay_dangeon_keep", "16470016": "gameplay_field_keep", "16113664": "gameplay_keep", "16107728": "ovl_Shot_Sun", "16103456": "ovl_Oceff_Wipe4", "16097280": "ovl_Oceff_Wipe3", "16091072": "ovl_Oceff_Wipe2", "16087456": "ovl_Oceff_Wipe", "16080112": "ovl_Oceff_Storm", "16075904": "ovl_Oceff_Spot", "16062128": "ovl_Object_Kankyo", "16058880": "ovl_Obj_Warp2block", "16054640": "ovl_Obj_Tsubo", "16051120": "ovl_Obj_Timeblock", "16047824": "ovl_Obj_Syokudai", "16039472": "ovl_Obj_Switch", "16038896": "ovl_Obj_Roomtimer", "16031136": "ovl_Obj_Oshihiki", "16029168": "ovl_Obj_Mure3", "16026464": "ovl_Obj_Mure2", "16021184": "ovl_Obj_Mure", "16019760": "ovl_Obj_Makeoshihiki", "16019088": "ovl_Obj_Makekinsuta", "16013248": "ovl_Obj_Lightswitch", "16010480": "ovl_Obj_Lift", "16008688": "ovl_Obj_Kibako2", "16005312": "ovl_Obj_Kibako", "16002688": "ovl_Obj_Ice_Poly", "16000896": "ovl_Obj_Hsblock", "16000128": "ovl_Obj_Hana", "15997872": "ovl_Obj_Hamishi", "15996704": "ovl_Obj_Elevator", "15994944": "ovl_Obj_Dekujr", "15992704": "ovl_Obj_Comb", "15991312": "ovl_Obj_Bombiwa", "15990912": "ovl_Obj_Blockstop", "15980192": "ovl_Obj_Bean", "15973488": "ovl_Mir_Ray", "15965472": "ovl_Magic_Wind", "15956368": "ovl_Magic_Fire", "15949808": "ovl_Magic_Dark", "15947072": "ovl_Item_Shield", "15945040": "ovl_Item_Ocarina", "15944704": "ovl_Item_Inbox", "15942160": "ovl_Item_Etcetera", "15940976": "ovl_Item_B_Heart", "15857312": "ovl_Fishing", "15840288": "ovl_End_Title", "15828672": "ovl_En_fHG", "15818528": "ovl_En_Zo", "15799472": "ovl_En_Zl4", "15765680": "ovl_En_Zl3", "15746704": "ovl_En_Zl2", "15730752": "ovl_En_Zl1", "15703392": "ovl_En_Zf", "15701712": "ovl_En_Yukabyun", "15698640": "ovl_En_Yabusame_Mark", "15671072": "ovl_En_Xc", "15666368": "ovl_En_Wood02", "15662112": "ovl_En_Wonder_Talk2", "15658560": "ovl_En_Wonder_Talk", "15654544": "ovl_En_Wonder_Item", "15637216": "ovl_En_Wf", "15630528": "ovl_En_Weiyer", "15625808": "ovl_En_Weather_Tag", "15618896": "ovl_En_Wallmas", "15617056": "ovl_En_Wall_Tubo", "15610512": "ovl_En_Vm", "15597648": "ovl_En_Viewer", "15592944": "ovl_En_Vb_Ball", "15592704": "ovl_En_Vase", "15582464": "ovl_En_Vali", "15578944": "ovl_En_Tubo_Trap", "15574192": "ovl_En_Trap", "15567680": "ovl_En_Tr", "15559728": "ovl_En_Tp", "15556544": "ovl_En_Toryo", "15546384": "ovl_En_Torch2", "15546144": "ovl_En_Torch", "15538064": "ovl_En_Tk", "15526160": "ovl_En_Tite", "15524336": "ovl_En_Tg", "15523264": "ovl_En_Tana", "15520752": "ovl_En_Takara_Man", "15505712": "ovl_En_Ta", "15497088": "ovl_En_Syateki_Niw", "15492864": "ovl_En_Syateki_Man", "15488320": "ovl_En_Syateki_Itm", "15473856": "ovl_En_Sw", "15472304": "ovl_En_Stream", "15455312": "ovl_En_Sth", "15443872": "ovl_En_St", "15434112": "ovl_En_Ssh", "15433152": "ovl_En_Skjneedle", "15417808": "ovl_En_Skj", "15411392": "ovl_En_Skb", "15407776": "ovl_En_Siofuki", "15406512": "ovl_En_Si", "15402560": "ovl_En_Shopnuts", "15396352": "ovl_En_Sda", "15395920": "ovl_En_Scene_Change", "15390672": "ovl_En_Sb", "15381824": "ovl_En_Sa", "15369520": "ovl_En_Ru2", "15338480": "ovl_En_Ru1", "15328288": "ovl_En_Rr", "15323792": "ovl_En_Rl", "15321360": "ovl_En_River_Sound", "15314096": "ovl_En_Reeba", "15303648": "ovl_En_Rd", "15302816": "ovl_En_Pu_box", "15285552": "ovl_En_Poh", "15265648": "ovl_En_Po_Sisters", "15259424": "ovl_En_Po_Relay", "15244144": "ovl_En_Po_Field", "15240480": "ovl_En_Po_Desert", "15226128": "ovl_En_Peehat", "15220288": "ovl_En_Part", "15204240": "ovl_En_Owl", "15174928": "ovl_En_Ossan", "15165136": "ovl_En_Okuta", "15158672": "ovl_En_Okarina_Tag", "15157200": "ovl_En_Okarina_Effect", "15157008": "ovl_En_OE2", "15150112": "ovl_En_Ny", "15147344": "ovl_En_Nwc", "15145664": "ovl_En_Nutsball", "15137968": "ovl_En_Niw_Lady", "15134704": "ovl_En_Niw_Girl", "15120368": "ovl_En_Niw", "15101440": "ovl_En_Nb", "15099024": "ovl_En_Mu", "15097232": "ovl_En_Ms", "15093440": "ovl_En_Mm2", "15087584": "ovl_En_Mm", "15083888": "ovl_En_Mk", "15073984": "ovl_En_Md", "15057088": "ovl_En_Mb", "15047536": "ovl_En_Mag", "15043344": "ovl_En_Ma3", "15038992": "ovl_En_Ma2", "15034112": "ovl_En_Ma1", "15028304": "ovl_En_M_Thunder", "15027888": "ovl_En_M_Fire1", "15026752": "ovl_En_Lightbox", "15023024": "ovl_En_Light", "15017408": "ovl_En_Kz", "15011856": "ovl_En_Kusa", "14994976": "ovl_En_Ko", "14988224": "ovl_En_Karebaba", "14974992": "ovl_En_Kanban", "14970256": "ovl_En_Kakasi3", "14966912": "ovl_En_Kakasi2", "14963168": "ovl_En_Kakasi", "14943088": "ovl_En_Jsjutan", "14940640": "ovl_En_Js", "14934992": "ovl_En_Jj", "14934608": "ovl_En_It", "14897200": "ovl_En_Ishi", "14887408": "ovl_En_Insect", "14875520": "ovl_En_In", "14855920": "ovl_En_Ik", "14851024": "ovl_En_Ice_Hono", "14836112": "ovl_En_Hy", "14834560": "ovl_En_Hs2", "14831488": "ovl_En_Hs", "14828720": "ovl_En_Horse_Zelda", "14818864": "ovl_En_Horse_Normal", "14811056": "ovl_En_Horse_Link_Child", "14807616": "ovl_En_Horse_Ganon", "14803248": "ovl_En_Horse_Game_Check", "14753488": "ovl_En_Horse", "14747664": "ovl_En_Honotrap", "14743536": "ovl_En_Holl", "14736864": "ovl_En_Hintnuts", "14732464": "ovl_En_Heishi4", "14729760": "ovl_En_Heishi3", "14719616": "ovl_En_Heishi2", "14712496": "ovl_En_Heishi1", "14711088": "ovl_En_Hata", "14708224": "ovl_En_Guest", "14700288": "ovl_En_Gs", "14690432": "ovl_En_Goroiwa", "14678688": "ovl_En_Goma", "14653712": "ovl_En_Go2", "14635344": "ovl_En_Go", "14631616": "ovl_En_Gm", "14619440": "ovl_En_GirlA", "14597872": "ovl_En_GeldB", "14594560": "ovl_En_Ge3", "14587824": "ovl_En_Ge2", "14579024": "ovl_En_Ge1", "14572896": "ovl_En_Gb", "14543840": "ovl_En_Ganon_Organ", "14526784": "ovl_En_Ganon_Mant", "14518944": "ovl_En_G_Switch", "14510496": "ovl_En_Fz", "14504320": "ovl_En_Fw", "14500864": "ovl_En_Fu", "14488976": "ovl_En_Fr", "14475520": "ovl_En_Floormas", "14466672": "ovl_En_Fish", "14457952": "ovl_En_Firefly", "14452752": "ovl_En_Fire_Rock", "14442064": "ovl_En_Fhg_Fire", "14438560": "ovl_En_Fd_Fire", "14426800": "ovl_En_Fd", "14422016": "ovl_En_Ex_Ruppy", "14416528": "ovl_En_Ex_Item", "14411136": "ovl_En_Encount2", "14406416": "ovl_En_Encount1", "14387232": "ovl_En_Elf", "14379920": "ovl_En_Eiyer", "14379392": "ovl_En_Eg", "14377696": "ovl_En_Dy_Extra", "14370848": "ovl_En_Du", "14367776": "ovl_En_Ds", "14364096": "ovl_En_Door", "14359488": "ovl_En_Dog", "14347840": "ovl_En_Dodongo", "14340016": "ovl_En_Dodojr", "14327472": "ovl_En_Dnt_Nomal", "14321360": "ovl_En_Dnt_Jiji", "14316752": "ovl_En_Dnt_Demo", "14311232": "ovl_En_Dns", "14304352": "ovl_En_Diving_Game", "14300272": "ovl_En_Dha", "14293296": "ovl_En_Dh", "14287184": "ovl_En_Dekunuts", "14271424": "ovl_En_Dekubaba", "14266128": "ovl_En_Daiku_Kakariko", "14260000": "ovl_En_Daiku", "14255264": "ovl_En_Cs", "14249520": "ovl_En_Crow", "14244336": "ovl_En_Cow", "14207952": "ovl_En_Clear_Tag", "14204080": "ovl_En_Changer", "14201088": "ovl_En_Bx", "14187776": "ovl_En_Bw", "14182032": "ovl_En_Butte", "14176800": "ovl_En_Bubble", "14172464": "ovl_En_Brob", "14164976": "ovl_En_Box", "14162608": "ovl_En_Boom", "14157200": "ovl_En_Bombf", "14151264": "ovl_En_Bom_Chu", "14148720": "ovl_En_Bom_Bowl_Pit", "14142560": "ovl_En_Bom_Bowl_Man", "14138624": "ovl_En_Bom", "14136976": "ovl_En_Blkobj", "14135776": "ovl_En_Bird", "14126800": "ovl_En_Bili", "14115472": "ovl_En_Bigokuta", "14112352": "ovl_En_Bdfire", "14096656": "ovl_En_Bb", "14088576": "ovl_En_Ba", "14083888": "ovl_En_Attack_Niw", "14077776": "ovl_En_Arrow", "14077440": "ovl_En_Arow_Trap", "14076464": "ovl_En_Anubice_Tag", "14072784": "ovl_En_Anubice_Fire", "14067536": "ovl_En_Anubice", "14064032": "ovl_En_Ani", "14054736": "ovl_En_Am", "14052656": "ovl_Elf_Msg2", "14049616": "ovl_Elf_Msg", "14048560": "ovl_Effect_Ss_Stone1", "14047488": "ovl_Effect_Ss_Stick", "14047072": "ovl_Effect_Ss_Solder_Srch_Ball", "14046096": "ovl_Effect_Ss_Sibuki2", "14044256": "ovl_Effect_Ss_Sibuki", "14042400": "ovl_Effect_Ss_Lightning", "14040640": "ovl_Effect_Ss_KiraKira", "14036144": "ovl_Effect_Ss_Kakera", "14034912": "ovl_Effect_Ss_K_Fire", "14033440": "ovl_Effect_Ss_Ice_Smoke", "14032176": "ovl_Effect_Ss_Ice_Piece", "14030720": "ovl_Effect_Ss_HitMark", "14028832": "ovl_Effect_Ss_Hahen", "14027632": "ovl_Effect_Ss_G_Splash", "14026080": "ovl_Effect_Ss_G_Spk", "14024592": "ovl_Effect_Ss_G_Ripple", "14023120": "ovl_Effect_Ss_G_Magma2", "14022528": "ovl_Effect_Ss_G_Magma", "14021888": "ovl_Effect_Ss_G_Fire", "14019952": "ovl_Effect_Ss_Fire_Tail", "14015632": "ovl_Effect_Ss_Fhg_Flash", "14014288": "ovl_Effect_Ss_Fcircle", "14013168": "ovl_Effect_Ss_Extra", "14010720": "ovl_Effect_Ss_En_Ice", "14008720": "ovl_Effect_Ss_En_Fire", "14006528": "ovl_Effect_Ss_Dust", "14004960": "ovl_Effect_Ss_Dt_Bubble", "14004576": "ovl_Effect_Ss_Dead_Sound", "14003264": "ovl_Effect_Ss_Dead_Ds", "14001680": "ovl_Effect_Ss_Dead_Dd", "14000336": "ovl_Effect_Ss_Dead_Db", "13998976": "ovl_Effect_Ss_D_Fire", "13997680": "ovl_Effect_Ss_Bubble", "13995136": "ovl_Effect_Ss_Bomb2", "13993952": "ovl_Effect_Ss_Bomb", "13992928": "ovl_Effect_Ss_Blast", "13987584": "ovl_Eff_Dust", "13984480": "ovl_Efc_Erupc", "13966784": "ovl_Door_Warp1", "13966432": "ovl_Door_Toki", "13957344": "ovl_Door_Shutter", "13951632": "ovl_Door_Killer", "13949984": "ovl_Door_Gerudo", "13948208": "ovl_Door_Ana", "13946112": "ovl_Demo_Tre_Lgt", "13936752": "ovl_Demo_Shd", "13925024": "ovl_Demo_Sa", "13919760": "ovl_Demo_Kekkai", "13903120": "ovl_Demo_Kankyo", "13886064": "ovl_Demo_Im", "13879696": "ovl_Demo_Ik", "13856000": "ovl_Demo_Gt", "13852416": "ovl_Demo_Go", "13836224": "ovl_Demo_Gj", "13833424": "ovl_Demo_Geff", "13830688": "ovl_Demo_Ext", "13805024": "ovl_Demo_Effect", "13790016": "ovl_Demo_Ec", "13775200": "ovl_Demo_Du", "13762528": "ovl_Demo_6K", "13701968": "ovl_Boss_Va", "13621216": "ovl_Boss_Tw", "13570336": "ovl_Boss_Sst", "13521248": "ovl_Boss_Mo", "13496432": "ovl_Boss_Goma", "13474976": "ovl_Boss_Ganondrof", "13402304": "ovl_Boss_Ganon2", "13260144": "ovl_Boss_Ganon", "13243248": "ovl_Boss_Fd2", "13212352": "ovl_Boss_Fd", "13172368": "ovl_Boss_Dodongo", "13170976": "ovl_Bg_Zg", "13164816": "ovl_Bg_Ydan_Sp", "13163072": "ovl_Bg_Ydan_Maruta", "13160960": "ovl_Bg_Ydan_Hasi", "13159008": "ovl_Bg_Vb_Sima", "13158624": "ovl_Bg_Umajump", "13152768": "ovl_Bg_Treemouth", "13146944": "ovl_Bg_Toki_Swd", "13143040": "ovl_Bg_Toki_Hikari", "13141520": "ovl_Bg_Sst_Floor", "13140176": "ovl_Bg_Spot18_Shutter", "13137424": "ovl_Bg_Spot18_Obj", "13137024": "ovl_Bg_Spot18_Futa", "13132816": "ovl_Bg_Spot18_Basket", "13132032": "ovl_Bg_Spot17_Funen", "13129920": "ovl_Bg_Spot17_Bakudankabe", "13128000": "ovl_Bg_Spot16_Doughnut", "13121840": "ovl_Bg_Spot16_Bombstone", "13120848": "ovl_Bg_Spot15_Saku", "13117024": "ovl_Bg_Spot15_Rrbox", "13115680": "ovl_Bg_Spot12_Saku", "13114512": "ovl_Bg_Spot12_Gate", "13112560": "ovl_Bg_Spot11_Oasis", "13110912": "ovl_Bg_Spot11_Bakudankabe", "13109216": "ovl_Bg_Spot09_Obj", "13104736": "ovl_Bg_Spot08_Iceblock", "13103056": "ovl_Bg_Spot08_Bakudankabe", "13101360": "ovl_Bg_Spot07_Taki", "13096064": "ovl_Bg_Spot06_Objects", "13095280": "ovl_Bg_Spot05_Soko", "13092832": "ovl_Bg_Spot03_Taki", "13087584": "ovl_Bg_Spot02_Objects", "13086272": "ovl_Bg_Spot01_Objects2", "13085568": "ovl_Bg_Spot01_Idosoko", "13084640": "ovl_Bg_Spot01_Idomizu", "13081056": "ovl_Bg_Spot01_Idohashira", "13080256": "ovl_Bg_Spot01_Fusya", "13075584": "ovl_Bg_Spot00_Hanebasi", "13075168": "ovl_Bg_Spot00_Break", "13073232": "ovl_Bg_Relay_Objects", "13072352": "ovl_Bg_Pushbox", "13069744": "ovl_Bg_Po_Syokudai", "13061920": "ovl_Bg_Po_Event", "13058688": "ovl_Bg_Mori_Rakkatenjo", "13056720": "ovl_Bg_Mori_Kaitenkabe", "13054800": "ovl_Bg_Mori_Idomizu", "13051104": "ovl_Bg_Mori_Hineri", "13049216": "ovl_Bg_Mori_Hashira4", "13046400": "ovl_Bg_Mori_Hashigo", "13042976": "ovl_Bg_Mori_Elevator", "13039840": "ovl_Bg_Mori_Bigst", "13038752": "ovl_Bg_Mjin", "13034960": "ovl_Bg_Mizu_Water", "13034496": "ovl_Bg_Mizu_Uzu", "13032304": "ovl_Bg_Mizu_Shutter", "13027680": "ovl_Bg_Mizu_Movebg", "13021616": "ovl_Bg_Mizu_Bwall", "13021280": "ovl_Bg_Menkuri_Nisekabe", "13020896": "ovl_Bg_Menkuri_Kaiten", "13019568": "ovl_Bg_Menkuri_Eye", "13017472": "ovl_Bg_Jya_Zurerukabe", "13012592": "ovl_Bg_Jya_Megami", "13011168": "ovl_Bg_Jya_Lift", "13010048": "ovl_Bg_Jya_Kanaami", "13006304": "ovl_Bg_Jya_Ironobj", "13004288": "ovl_Bg_Jya_Haheniron", "13002416": "ovl_Bg_Jya_Goroiwa", "12994096": "ovl_Bg_Jya_Cobra", "12992224": "ovl_Bg_Jya_Bombiwa", "12988896": "ovl_Bg_Jya_Bombchuiwa", "12988128": "ovl_Bg_Jya_Block", "12985376": "ovl_Bg_Jya_Bigmirror", "12984320": "ovl_Bg_Jya_Amishutter", "12982432": "ovl_Bg_Jya_1flift", "12981376": "ovl_Bg_Ingate", "12979296": "ovl_Bg_Ice_Turara", "12978176": "ovl_Bg_Ice_Shutter", "12973184": "ovl_Bg_Ice_Shelter", "12969296": "ovl_Bg_Ice_Objects", "12968192": "ovl_Bg_Hidan_Syoku", "12964112": "ovl_Bg_Hidan_Sima", "12958720": "ovl_Bg_Hidan_Sekizou", "12955456": "ovl_Bg_Hidan_Rsekizou", "12950976": "ovl_Bg_Hidan_Rock", "12946784": "ovl_Bg_Hidan_Kowarerukabe", "12945056": "ovl_Bg_Hidan_Kousi", "12942960": "ovl_Bg_Hidan_Hrock", "12938624": "ovl_Bg_Hidan_Hamstep", "12935216": "ovl_Bg_Hidan_Fwbig", "12934016": "ovl_Bg_Hidan_Fslift", "12932000": "ovl_Bg_Hidan_Firewall", "12929888": "ovl_Bg_Hidan_Dalm", "12926688": "ovl_Bg_Hidan_Curtain", "12920016": "ovl_Bg_Heavy_Block", "12915456": "ovl_Bg_Haka_Zou", "12913216": "ovl_Bg_Haka_Water", "12910480": "ovl_Bg_Haka_Tubo", "12904928": "ovl_Bg_Haka_Trap", "12901952": "ovl_Bg_Haka_Ship", "12898848": "ovl_Bg_Haka_Sgami", "12897136": "ovl_Bg_Haka_MeganeBG", "12896128": "ovl_Bg_Haka_Megane", "12893440": "ovl_Bg_Haka_Huta", "12888896": "ovl_Bg_Haka_Gate", "12887040": "ovl_Bg_Haka", "12884752": "ovl_Bg_Gnd_Soulmeiro", "12884384": "ovl_Bg_Gnd_Nisekabe", "12879872": "ovl_Bg_Gnd_Iceblock", "12878368": "ovl_Bg_Gnd_Firemeiro", "12876176": "ovl_Bg_Gnd_Darkmeiro", "12874784": "ovl_Bg_Gjyo_Bridge", "12873408": "ovl_Bg_Gate_Shutter", "12863104": "ovl_Bg_Ganon_Otyuka", "12850576": "ovl_Bg_Dy_Yoseizo", "12847056": "ovl_Bg_Dodoago", "12844736": "ovl_Bg_Ddan_Kd", "12843136": "ovl_Bg_Ddan_Jd", "12839344": "ovl_Bg_Breakwall", "12836656": "ovl_Bg_Bowl_Wall", "12834208": "ovl_Bg_Bombwall", "12833568": "ovl_Bg_Bom_Guard", "12828128": "ovl_Bg_Bdan_Switch", "12823152": "ovl_Bg_Bdan_Objects", "12814976": "ovl_Arrow_Light", "12806816": "ovl_Arrow_Ice", "12798688": "ovl_Arrow_Fire", "12795088": "ovl_Arms_Hook", "12772384": "ovl_En_Test", "12745024": "ovl_map_mark_data", "12587184": "ovl_player_actor", "12461872": "ovl_kaleido_scope", "12397680": "ovl_file_choose", "12397344": "ovl_opening", "12384960": "ovl_select", "12382000": "ovl_title", "11091968": "code", "10113024": "map_i_static", "9973760": "map_48x85_static", "9912320": "map_grand_static", "9908224": "staff_message_data_static", "9678848": "fra_message_data_static", "9433088": "ger_message_data_static", "9199616": "nes_message_data_static", "9179136": "nes_font_static", "9170944": "message_texture_static", "9150464": "message_static", "9113600": "do_action_static", "8904704": "map_name_static", "8523776": "item_name_static", "8458240": "icon_item_fra_static", "8396800": "icon_item_ger_static", "8339456": "icon_item_nes_static", "8323072": "icon_item_gameover_static", "8314880": "icon_item_dungeon_static", "8265728": "icon_item_field_static", "8216576": "icon_item_24_static", "7651328": "icon_item_static", "5135360": "link_animetion", "608368": "Audiotable", "282096": "Audioseq", "102448": "Audiobank", "77680": "dmadata", "4192": "boot", "0": "makerom"}, "ft": {"boot": [4192, 77680], "dmadata": [77680, 102448], "code": [11091968, 12382000], "ovl_title": [12382000, 12384960], "ovl_select": [12384960, 12397344], "ovl_opening": [12397344, 12397680], "ovl_file_choose": [12397680, 12461872], "ovl_kaleido_scope": [12461872, 12587184], "ovl_player_actor": [12587184, 12745024], "ovl_map_mark_data": [12745024, 12772384], "ovl_En_Test": [12772384, 12795088], "ovl_Arms_Hook": [12795088, 12798688], "ovl_Arrow_Fire": [12798688, 12806816], "ovl_Arrow_Ice": [12806816, 12814976], "ovl_Arrow_Light": [12814976, 12823152], "ovl_Bg_Bdan_Objects": [12823152, 12828128], "ovl_Bg_Bdan_Switch": [12828128, 12833568], "ovl_Bg_Bom_Guard": [12833568, 12834208], "ovl_Bg_Bombwall": [12834208, 12836656], "ovl_Bg_Bowl_Wall": [12836656, 12839344], "ovl_Bg_Breakwall": [12839344, 12843136], "ovl_Bg_Ddan_Jd": [12843136, 12844736], "ovl_Bg_Ddan_Kd": [12844736, 12847056], "ovl_Bg_Dodoago": [12847056, 12850576], "ovl_Bg_Dy_Yoseizo": [12850576, 12863104], "ovl_Bg_Ganon_Otyuka": [12863104, 12873408], "ovl_Bg_Gate_Shutter": [12873408, 12874784], "ovl_Bg_Gjyo_Bridge": [12874784, 12876176], "ovl_Bg_Gnd_Darkmeiro": [12876176, 12878368], "ovl_Bg_Gnd_Firemeiro": [12878368, 12879872], "ovl_Bg_Gnd_Iceblock": [12879872, 12884384], "ovl_Bg_Gnd_Nisekabe": [12884384, 12884752], "ovl_Bg_Gnd_Soulmeiro": [12884752, 12887040], "ovl_Bg_Haka": [12887040, 12888896], "ovl_Bg_Haka_Gate": [12888896, 12893440], "ovl_Bg_Haka_Huta": [12893440, 12896128], "ovl_Bg_Haka_Megane": [12896128, 12897136], "ovl_Bg_Haka_MeganeBG": [12897136, 12898848], "ovl_Bg_Haka_Sgami": [12898848, 12901952], "ovl_Bg_Haka_Ship": [12901952, 12904928], "ovl_Bg_Haka_Trap": [12904928, 12910480], "ovl_Bg_Haka_Tubo": [12910480, 12913216], "ovl_Bg_Haka_Water": [12913216, 12915456], "ovl_Bg_Haka_Zou": [12915456, 12920016], "ovl_Bg_Heavy_Block": [12920016, 12926688], "ovl_Bg_Hidan_Curtain": [12926688, 12929888], "ovl_Bg_Hidan_Dalm": [12929888, 12932000], "ovl_Bg_Hidan_Firewall": [12932000, 12934016], "ovl_Bg_Hidan_Fslift": [12934016, 12935216], "ovl_Bg_Hidan_Fwbig": [12935216, 12938624], "ovl_Bg_Hidan_Hamstep": [12938624, 12942960], "ovl_Bg_Hidan_Hrock": [12942960, 12945056], "ovl_Bg_Hidan_Kousi": [12945056, 12946784], "ovl_Bg_Hidan_Kowarerukabe": [12946784, 12950976], "ovl_Bg_Hidan_Rock": [12950976, 12955456], "ovl_Bg_Hidan_Rsekizou": [12955456, 12958720], "ovl_Bg_Hidan_Sekizou": [12958720, 12964112], "ovl_Bg_Hidan_Sima": [12964112, 12968192], "ovl_Bg_Hidan_Syoku": [12968192, 12969296], "ovl_Bg_Ice_Objects": [12969296, 12973184], "ovl_Bg_Ice_Shelter": [12973184, 12978176], "ovl_Bg_Ice_Shutter": [12978176, 12979296], "ovl_Bg_Ice_Turara": [12979296, 12981376], "ovl_Bg_Ingate": [12981376, 12982432], "ovl_Bg_Jya_1flift": [12982432, 12984320], "ovl_Bg_Jya_Amishutter": [12984320, 12985376], "ovl_Bg_Jya_Bigmirror": [12985376, 12988128], "ovl_Bg_Jya_Block": [12988128, 12988896], "ovl_Bg_Jya_Bombchuiwa": [12988896, 12992224], "ovl_Bg_Jya_Bombiwa": [12992224, 12994096], "ovl_Bg_Jya_Cobra": [12994096, 13002416], "ovl_Bg_Jya_Goroiwa": [13002416, 13004288], "ovl_Bg_Jya_Haheniron": [13004288, 13006304], "ovl_Bg_Jya_Ironobj": [13006304, 13010048], "ovl_Bg_Jya_Kanaami": [13010048, 13011168], "ovl_Bg_Jya_Lift": [13011168, 13012592], "ovl_Bg_Jya_Megami": [13012592, 13017472], "ovl_Bg_Jya_Zurerukabe": [13017472, 13019568], "ovl_Bg_Menkuri_Eye": [13019568, 13020896], "ovl_Bg_Menkuri_Kaiten": [13020896, 13021280], "ovl_Bg_Menkuri_Nisekabe": [13021280, 13021616], "ovl_Bg_Mizu_Bwall": [13021616, 13027680], "ovl_Bg_Mizu_Movebg": [13027680, 13032304], "ovl_Bg_Mizu_Shutter": [13032304, 13034496], "ovl_Bg_Mizu_Uzu": [13034496, 13034960], "ovl_Bg_Mizu_Water": [13034960, 13038752], "ovl_Bg_Mjin": [13038752, 13039840], "ovl_Bg_Mori_Bigst": [13039840, 13042976], "ovl_Bg_Mori_Elevator": [13042976, 13046400], "ovl_Bg_Mori_Hashigo": [13046400, 13049216], "ovl_Bg_Mori_Hashira4": [13049216, 13051104], "ovl_Bg_Mori_Hineri": [13051104, 13054800], "ovl_Bg_Mori_Idomizu": [13054800, 13056720], "ovl_Bg_Mori_Kaitenkabe": [13056720, 13058688], "ovl_Bg_Mori_Rakkatenjo": [13058688, 13061920], "ovl_Bg_Po_Event": [13061920, 13069744], "ovl_Bg_Po_Syokudai": [13069744, 13072352], "ovl_Bg_Pushbox": [13072352, 13073232], "ovl_Bg_Relay_Objects": [13073232, 13075168], "ovl_Bg_Spot00_Break": [13075168, 13075584], "ovl_Bg_Spot00_Hanebasi": [13075584, 13080256], "ovl_Bg_Spot01_Fusya": [13080256, 13081056], "ovl_Bg_Spot01_Idohashira": [13081056, 13084640], "ovl_Bg_Spot01_Idomizu": [13084640, 13085568], "ovl_Bg_Spot01_Idosoko": [13085568, 13086272], "ovl_Bg_Spot01_Objects2": [13086272, 13087584], "ovl_Bg_Spot02_Objects": [13087584, 13092832], "ovl_Bg_Spot03_Taki": [13092832, 13095280], "ovl_Bg_Spot05_Soko": [13095280, 13096064], "ovl_Bg_Spot06_Objects": [13096064, 13101360], "ovl_Bg_Spot07_Taki": [13101360, 13103056], "ovl_Bg_Spot08_Bakudankabe": [13103056, 13104736], "ovl_Bg_Spot08_Iceblock": [13104736, 13109216], "ovl_Bg_Spot09_Obj": [13109216, 13110912], "ovl_Bg_Spot11_Bakudankabe": [13110912, 13112560], "ovl_Bg_Spot11_Oasis": [13112560, 13114512], "ovl_Bg_Spot12_Gate": [13114512, 13115680], "ovl_Bg_Spot12_Saku": [13115680, 13117024], "ovl_Bg_Spot15_Rrbox": [13117024, 13120848], "ovl_Bg_Spot15_Saku": [13120848, 13121840], "ovl_Bg_Spot16_Bombstone": [13121840, 13128000], "ovl_Bg_Spot16_Doughnut": [13128000, 13129920], "ovl_Bg_Spot17_Bakudankabe": [13129920, 13132032], "ovl_Bg_Spot17_Funen": [13132032, 13132816], "ovl_Bg_Spot18_Basket": [13132816, 13137024], "ovl_Bg_Spot18_Futa": [13137024, 13137424], "ovl_Bg_Spot18_Obj": [13137424, 13140176], "ovl_Bg_Spot18_Shutter": [13140176, 13141520], "ovl_Bg_Sst_Floor": [13141520, 13143040], "ovl_Bg_Toki_Hikari": [13143040, 13146944], "ovl_Bg_Toki_Swd": [13146944, 13152768], "ovl_Bg_Treemouth": [13152768, 13158624], "ovl_Bg_Umajump": [13158624, 13159008], "ovl_Bg_Vb_Sima": [13159008, 13160960], "ovl_Bg_Ydan_Hasi": [13160960, 13163072], "ovl_Bg_Ydan_Maruta": [13163072, 13164816], "ovl_Bg_Ydan_Sp": [13164816, 13170976], "ovl_Bg_Zg": [13170976, 13172368], "ovl_Boss_Dodongo": [13172368, 13212352], "ovl_Boss_Fd": [13212352, 13243248], "ovl_Boss_Fd2": [13243248, 13260144], "ovl_Boss_Ganon": [13260144, 13402304], "ovl_Boss_Ganon2": [13402304, 13474976], "ovl_Boss_Ganondrof": [13474976, 13496432], "ovl_Boss_Goma": [13496432, 13521248], "ovl_Boss_Mo": [13521248, 13570336], "ovl_Boss_Sst": [13570336, 13621216], "ovl_Boss_Tw": [13621216, 13701968], "ovl_Boss_Va": [13701968, 13762528], "ovl_Demo_6K": [13762528, 13775200], "ovl_Demo_Du": [13775200, 13790016], "ovl_Demo_Ec": [13790016, 13805024], "ovl_Demo_Effect": [13805024, 13830688], "ovl_Demo_Ext": [13830688, 13833424], "ovl_Demo_Geff": [13833424, 13836224], "ovl_Demo_Gj": [13836224, 13852416], "ovl_Demo_Go": [13852416, 13856000], "ovl_Demo_Gt": [13856000, 13879696], "ovl_Demo_Ik": [13879696, 13886064], "ovl_Demo_Im": [13886064, 13903120], "ovl_Demo_Kankyo": [13903120, 13919760], "ovl_Demo_Kekkai": [13919760, 13925024], "ovl_Demo_Sa": [13925024, 13936752], "ovl_Demo_Shd": [13936752, 13946112], "ovl_Demo_Tre_Lgt": [13946112, 13948208], "ovl_Door_Ana": [13948208, 13949984], "ovl_Door_Gerudo": [13949984, 13951632], "ovl_Door_Killer": [13951632, 13957344], "ovl_Door_Shutter": [13957344, 13966432], "ovl_Door_Toki": [13966432, 13966784], "ovl_Door_Warp1": [13966784, 13984480], "ovl_Efc_Erupc": [13984480, 13987584], "ovl_Eff_Dust": [13987584, 13992928], "ovl_Effect_Ss_Blast": [13992928, 13993952], "ovl_Effect_Ss_Bomb": [13993952, 13995136], "ovl_Effect_Ss_Bomb2": [13995136, 13997680], "ovl_Effect_Ss_Bubble": [13997680, 13998976], "ovl_Effect_Ss_D_Fire": [13998976, 14000336], "ovl_Effect_Ss_Dead_Db": [14000336, 14001680], "ovl_Effect_Ss_Dead_Dd": [14001680, 14003264], "ovl_Effect_Ss_Dead_Ds": [14003264, 14004576], "ovl_Effect_Ss_Dead_Sound": [14004576, 14004960], "ovl_Effect_Ss_Dt_Bubble": [14004960, 14006528], "ovl_Effect_Ss_Dust": [14006528, 14008720], "ovl_Effect_Ss_En_Fire": [14008720, 14010720], "ovl_Effect_Ss_En_Ice": [14010720, 14013168], "ovl_Effect_Ss_Extra": [14013168, 14014288], "ovl_Effect_Ss_Fcircle": [14014288, 14015632], "ovl_Effect_Ss_Fhg_Flash": [14015632, 14019952], "ovl_Effect_Ss_Fire_Tail": [14019952, 14021888], "ovl_Effect_Ss_G_Fire": [14021888, 14022528], "ovl_Effect_Ss_G_Magma": [14022528, 14023120], "ovl_Effect_Ss_G_Magma2": [14023120, 14024592], "ovl_Effect_Ss_G_Ripple": [14024592, 14026080], "ovl_Effect_Ss_G_Spk": [14026080, 14027632], "ovl_Effect_Ss_G_Splash": [14027632, 14028832], "ovl_Effect_Ss_Hahen": [14028832, 14030720], "ovl_Effect_Ss_HitMark": [14030720, 14032176], "ovl_Effect_Ss_Ice_Piece": [14032176, 14033440], "ovl_Effect_Ss_Ice_Smoke": [14033440, 14034912], "ovl_Effect_Ss_K_Fire": [14034912, 14036144], "ovl_Effect_Ss_Kakera": [14036144, 14040640], "ovl_Effect_Ss_KiraKira": [14040640, 14042400], "ovl_Effect_Ss_Lightning": [14042400, 14044256], "ovl_Effect_Ss_Sibuki": [14044256, 14046096], "ovl_Effect_Ss_Sibuki2": [14046096, 14047072], "ovl_Effect_Ss_Solder_Srch_Ball": [14047072, 14047488], "ovl_Effect_Ss_Stick": [14047488, 14048560], "ovl_Effect_Ss_Stone1": [14048560, 14049616], "ovl_Elf_Msg": [14049616, 14052656], "ovl_Elf_Msg2": [14052656, 14054736], "ovl_En_Am": [14054736, 14064032], "ovl_En_Ani": [14064032, 14067536], "ovl_En_Anubice": [14067536, 14072784], "ovl_En_Anubice_Fire": [14072784, 14076464], "ovl_En_Anubice_Tag": [14076464, 14077440], "ovl_En_Arow_Trap": [14077440, 14077776], "ovl_En_Arrow": [14077776, 14083888], "ovl_En_Attack_Niw": [14083888, 14088576], "ovl_En_Ba": [14088576, 14096656], "ovl_En_Bb": [14096656, 14112352], "ovl_En_Bdfire": [14112352, 14115472], "ovl_En_Bigokuta": [14115472, 14126800], "ovl_En_Bili": [14126800, 14135776], "ovl_En_Bird": [14135776, 14136976], "ovl_En_Blkobj": [14136976, 14138624], "ovl_En_Bom": [14138624, 14142560], "ovl_En_Bom_Bowl_Man": [14142560, 14148720], "ovl_En_Bom_Bowl_Pit": [14148720, 14151264], "ovl_En_Bom_Chu": [14151264, 14157200], "ovl_En_Bombf": [14157200, 14162608], "ovl_En_Boom": [14162608, 14164976], "ovl_En_Box": [14164976, 14172464], "ovl_En_Brob": [14172464, 14176800], "ovl_En_Bubble": [14176800, 14182032], "ovl_En_Butte": [14182032, 14187776], "ovl_En_Bw": [14187776, 14201088], "ovl_En_Bx": [14201088, 14204080], "ovl_En_Changer": [14204080, 14207952], "ovl_En_Clear_Tag": [14207952, 14244336], "ovl_En_Cow": [14244336, 14249520], "ovl_En_Crow": [14249520, 14255264], "ovl_En_Cs": [14255264, 14260000], "ovl_En_Daiku": [14260000, 14266128], "ovl_En_Daiku_Kakariko": [14266128, 14271424], "ovl_En_Dekubaba": [14271424, 14287184], "ovl_En_Dekunuts": [14287184, 14293296], "ovl_En_Dh": [14293296, 14300272], "ovl_En_Dha": [14300272, 14304352], "ovl_En_Diving_Game": [14304352, 14311232], "ovl_En_Dns": [14311232, 14316752], "ovl_En_Dnt_Demo": [14316752, 14321360], "ovl_En_Dnt_Jiji": [14321360, 14327472], "ovl_En_Dnt_Nomal": [14327472, 14340016], "ovl_En_Dodojr": [14340016, 14347840], "ovl_En_Dodongo": [14347840, 14359488], "ovl_En_Dog": [14359488, 14364096], "ovl_En_Door": [14364096, 14367776], "ovl_En_Ds": [14367776, 14370848], "ovl_En_Du": [14370848, 14377696], "ovl_En_Dy_Extra": [14377696, 14379392], "ovl_En_Eg": [14379392, 14379920], "ovl_En_Eiyer": [14379920, 14387232], "ovl_En_Elf": [14387232, 14406416], "ovl_En_Encount1": [14406416, 14411136], "ovl_En_Encount2": [14411136, 14416528], "ovl_En_Ex_Item": [14416528, 14422016], "ovl_En_Ex_Ruppy": [14422016, 14426800], "ovl_En_Fd": [14426800, 14438560], "ovl_En_Fd_Fire": [14438560, 14442064], "ovl_En_Fhg_Fire": [14442064, 14452752], "ovl_En_Fire_Rock": [14452752, 14457952], "ovl_En_Firefly": [14457952, 14466672], "ovl_En_Fish": [14466672, 14475520], "ovl_En_Floormas": [14475520, 14488976], "ovl_En_Fr": [14488976, 14500864], "ovl_En_Fu": [14500864, 14504320], "ovl_En_Fw": [14504320, 14510496], "ovl_En_Fz": [14510496, 14518944], "ovl_En_G_Switch": [14518944, 14526784], "ovl_En_Ganon_Mant": [14526784, 14543840], "ovl_En_Ganon_Organ": [14543840, 14572896], "ovl_En_Gb": [14572896, 14579024], "ovl_En_Ge1": [14579024, 14587824], "ovl_En_Ge2": [14587824, 14594560], "ovl_En_Ge3": [14594560, 14597872], "ovl_En_GeldB": [14597872, 14619440], "ovl_En_GirlA": [14619440, 14631616], "ovl_En_Gm": [14631616, 14635344], "ovl_En_Go": [14635344, 14653712], "ovl_En_Go2": [14653712, 14678688], "ovl_En_Goma": [14678688, 14690432], "ovl_En_Goroiwa": [14690432, 14700288], "ovl_En_Gs": [14700288, 14708224], "ovl_En_Guest": [14708224, 14711088], "ovl_En_Hata": [14711088, 14712496], "ovl_En_Heishi1": [14712496, 14719616], "ovl_En_Heishi2": [14719616, 14729760], "ovl_En_Heishi3": [14729760, 14732464], "ovl_En_Heishi4": [14732464, 14736864], "ovl_En_Hintnuts": [14736864, 14743536], "ovl_En_Holl": [14743536, 14747664], "ovl_En_Honotrap": [14747664, 14753488], "ovl_En_Horse": [14753488, 14803248], "ovl_En_Horse_Game_Check": [14803248, 14807616], "ovl_En_Horse_Ganon": [14807616, 14811056], "ovl_En_Horse_Link_Child": [14811056, 14818864], "ovl_En_Horse_Normal": [14818864, 14828720], "ovl_En_Horse_Zelda": [14828720, 14831488], "ovl_En_Hs": [14831488, 14834560], "ovl_En_Hs2": [14834560, 14836112], "ovl_En_Hy": [14836112, 14851024], "ovl_En_Ice_Hono": [14851024, 14855920], "ovl_En_Ik": [14855920, 14875520], "ovl_En_In": [14875520, 14887408], "ovl_En_Insect": [14887408, 14897200], "ovl_En_Ishi": [14897200, 14934608], "ovl_En_It": [14934608, 14934992], "ovl_En_Jj": [14934992, 14940640], "ovl_En_Js": [14940640, 14943088], "ovl_En_Jsjutan": [14943088, 14963168], "ovl_En_Kakasi": [14963168, 14966912], "ovl_En_Kakasi2": [14966912, 14970256], "ovl_En_Kakasi3": [14970256, 14974992], "ovl_En_Kanban": [14974992, 14988224], "ovl_En_Karebaba": [14988224, 14994976], "ovl_En_Ko": [14994976, 15011856], "ovl_En_Kusa": [15011856, 15017408], "ovl_En_Kz": [15017408, 15023024], "ovl_En_Light": [15023024, 15026752], "ovl_En_Lightbox": [15026752, 15027888], "ovl_En_M_Fire1": [15027888, 15028304], "ovl_En_M_Thunder": [15028304, 15034112], "ovl_En_Ma1": [15034112, 15038992], "ovl_En_Ma2": [15038992, 15043344], "ovl_En_Ma3": [15043344, 15047536], "ovl_En_Mag": [15047536, 15057088], "ovl_En_Mb": [15057088, 15073984], "ovl_En_Md": [15073984, 15083888], "ovl_En_Mk": [15083888, 15087584], "ovl_En_Mm": [15087584, 15093440], "ovl_En_Mm2": [15093440, 15097232], "ovl_En_Ms": [15097232, 15099024], "ovl_En_Mu": [15099024, 15101440], "ovl_En_Nb": [15101440, 15120368], "ovl_En_Niw": [15120368, 15134704], "ovl_En_Niw_Girl": [15134704, 15137968], "ovl_En_Niw_Lady": [15137968, 15145664], "ovl_En_Nutsball": [15145664, 15147344], "ovl_En_Nwc": [15147344, 15150112], "ovl_En_Ny": [15150112, 15157008], "ovl_En_OE2": [15157008, 15157200], "ovl_En_Okarina_Effect": [15157200, 15158672], "ovl_En_Okarina_Tag": [15158672, 15165136], "ovl_En_Okuta": [15165136, 15174928], "ovl_En_Ossan": [15174928, 15204240], "ovl_En_Owl": [15204240, 15220288], "ovl_En_Part": [15220288, 15226128], "ovl_En_Peehat": [15226128, 15240480], "ovl_En_Po_Desert": [15240480, 15244144], "ovl_En_Po_Field": [15244144, 15259424], "ovl_En_Po_Relay": [15259424, 15265648], "ovl_En_Po_Sisters": [15265648, 15285552], "ovl_En_Poh": [15285552, 15302816], "ovl_En_Pu_box": [15302816, 15303648], "ovl_En_Rd": [15303648, 15314096], "ovl_En_Reeba": [15314096, 15321360], "ovl_En_River_Sound": [15321360, 15323792], "ovl_En_Rl": [15323792, 15328288], "ovl_En_Rr": [15328288, 15338480], "ovl_En_Ru1": [15338480, 15369520], "ovl_En_Ru2": [15369520, 15381824], "ovl_En_Sa": [15381824, 15390672], "ovl_En_Sb": [15390672, 15395920], "ovl_En_Scene_Change": [15395920, 15396352], "ovl_En_Sda": [15396352, 15402560], "ovl_En_Shopnuts": [15402560, 15406512], "ovl_En_Si": [15406512, 15407776], "ovl_En_Siofuki": [15407776, 15411392], "ovl_En_Skb": [15411392, 15417808], "ovl_En_Skj": [15417808, 15433152], "ovl_En_Skjneedle": [15433152, 15434112], "ovl_En_Ssh": [15434112, 15443872], "ovl_En_St": [15443872, 15455312], "ovl_En_Sth": [15455312, 15472304], "ovl_En_Stream": [15472304, 15473856], "ovl_En_Sw": [15473856, 15488320], "ovl_En_Syateki_Itm": [15488320, 15492864], "ovl_En_Syateki_Man": [15492864, 15497088], "ovl_En_Syateki_Niw": [15497088, 15505712], "ovl_En_Ta": [15505712, 15520752], "ovl_En_Takara_Man": [15520752, 15523264], "ovl_En_Tana": [15523264, 15524336], "ovl_En_Tg": [15524336, 15526160], "ovl_En_Tite": [15526160, 15538064], "ovl_En_Tk": [15538064, 15546144], "ovl_En_Torch": [15546144, 15546384], "ovl_En_Torch2": [15546384, 15556544], "ovl_En_Toryo": [15556544, 15559728], "ovl_En_Tp": [15559728, 15567680], "ovl_En_Tr": [15567680, 15574192], "ovl_En_Trap": [15574192, 15578944], "ovl_En_Tubo_Trap": [15578944, 15582464], "ovl_En_Vali": [15582464, 15592704], "ovl_En_Vase": [15592704, 15592944], "ovl_En_Vb_Ball": [15592944, 15597648], "ovl_En_Viewer": [15597648, 15610512], "ovl_En_Vm": [15610512, 15617056], "ovl_En_Wall_Tubo": [15617056, 15618896], "ovl_En_Wallmas": [15618896, 15625808], "ovl_En_Weather_Tag": [15625808, 15630528], "ovl_En_Weiyer": [15630528, 15637216], "ovl_En_Wf": [15637216, 15654544], "ovl_En_Wonder_Item": [15654544, 15658560], "ovl_En_Wonder_Talk": [15658560, 15662112], "ovl_En_Wonder_Talk2": [15662112, 15666368], "ovl_En_Wood02": [15666368, 15671072], "ovl_En_Xc": [15671072, 15698640], "ovl_En_Yabusame_Mark": [15698640, 15701712], "ovl_En_Yukabyun": [15701712, 15703392], "ovl_En_Zf": [15703392, 15730752], "ovl_En_Zl1": [15730752, 15746704], "ovl_En_Zl2": [15746704, 15765680], "ovl_En_Zl3": [15765680, 15799472], "ovl_En_Zl4": [15799472, 15818528], "ovl_En_Zo": [15818528, 15828672], "ovl_En_fHG": [15828672, 15840288], "ovl_End_Title": [15840288, 15857312], "ovl_Fishing": [15857312, 15940976], "ovl_Item_B_Heart": [15940976, 15942160], "ovl_Item_Etcetera": [15942160, 15944704], "ovl_Item_Inbox": [15944704, 15945040], "ovl_Item_Ocarina": [15945040, 15947072], "ovl_Item_Shield": [15947072, 15949808], "ovl_Magic_Dark": [15949808, 15956368], "ovl_Magic_Fire": [15956368, 15965472], "ovl_Magic_Wind": [15965472, 15973488], "ovl_Mir_Ray": [15973488, 15980192], "ovl_Obj_Bean": [15980192, 15990912], "ovl_Obj_Blockstop": [15990912, 15991312], "ovl_Obj_Bombiwa": [15991312, 15992704], "ovl_Obj_Comb": [15992704, 15994944], "ovl_Obj_Dekujr": [15994944, 15996704], "ovl_Obj_Elevator": [15996704, 15997872], "ovl_Obj_Hamishi": [15997872, 16000128], "ovl_Obj_Hana": [16000128, 16000896], "ovl_Obj_Hsblock": [16000896, 16002688], "ovl_Obj_Ice_Poly": [16002688, 16005312], "ovl_Obj_Kibako": [16005312, 16008688], "ovl_Obj_Kibako2": [16008688, 16010480], "ovl_Obj_Lift": [16010480, 16013248], "ovl_Obj_Lightswitch": [16013248, 16019088], "ovl_Obj_Makekinsuta": [16019088, 16019760], "ovl_Obj_Makeoshihiki": [16019760, 16021184], "ovl_Obj_Mure": [16021184, 16026464], "ovl_Obj_Mure2": [16026464, 16029168], "ovl_Obj_Mure3": [16029168, 16031136], "ovl_Obj_Oshihiki": [16031136, 16038896], "ovl_Obj_Roomtimer": [16038896, 16039472], "ovl_Obj_Switch": [16039472, 16047824], "ovl_Obj_Syokudai": [16047824, 16051120], "ovl_Obj_Timeblock": [16051120, 16054640], "ovl_Obj_Tsubo": [16054640, 16058880], "ovl_Obj_Warp2block": [16058880, 16062128], "ovl_Object_Kankyo": [16062128, 16075904], "ovl_Oceff_Spot": [16075904, 16080112], "ovl_Oceff_Storm": [16080112, 16087456], "ovl_Oceff_Wipe": [16087456, 16091072], "ovl_Oceff_Wipe2": [16091072, 16097280], "ovl_Oceff_Wipe3": [16097280, 16103456], "ovl_Oceff_Wipe4": [16103456, 16107728], "ovl_Shot_Sun": [16107728, 16109584], "makerom": [0, 4192], "Audiobank": [102448, 282096], "Audioseq": [282096, 608368], "Audiotable": [608368, 5135360], "link_animetion": [5135360, 7649328], "icon_item_static": [7651328, 8215712], "icon_item_24_static": [8216576, 8262656], "icon_item_field_static": [8265728, 8313136], "icon_item_dungeon_static": [8314880, 8322432], "icon_item_gameover_static": [8323072, 8338560], "icon_item_nes_static": [8339456, 8395904], "icon_item_ger_static": [8396800, 8457088], "icon_item_fra_static": [8458240, 8520832], "item_name_static": [8523776, 8901632], "map_name_static": [8904704, 9110528], "do_action_static": [9113600, 9147008], "message_static": [9150464, 9167232], "message_texture_static": [9170944, 9175552], "nes_font_static": [9179136, 9197056], "nes_message_data_static": [9199616, 9429280], "ger_message_data_static": [9433088, 9677264], "fra_message_data_static": [9678848, 9904576], "staff_message_data_static": [9908224, 9912144], "map_grand_static": [9912320, 9970512], "map_i_static": [10113024, 11088144], "map_48x85_static": [9973760, 10112480], "gameplay_keep": [16113664, 16467888], "gameplay_field_keep": [16470016, 16524080], "gameplay_dangeon_keep": [16527360, 16624368], "gameplay_object_exchange_static": [16625664, 16625680], "object_link_boy": [16629760, 16857088], "object_link_child": [16859136, 17043328], "object_box": [17043456, 17068032], "object_human": [17068032, 17146240], "object_okuta": [17149952, 17165440], "object_poh": [17166336, 17187040], "object_wallmaster": [17190912, 17231984], "object_dy_obj": [17235968, 17356080], "object_firefly": [17358848, 17365184], "object_dodongo": [17367040, 17406272], "object_fire": [17408000, 17424544], "object_niw": [17428480, 17438016], "object_tite": [17440768, 17455664], "object_reeba": [17457152, 17465072], "object_peehat": [17465344, 17472656], "object_kingdodongo": [17473536, 17673440], "object_horse": [17674240, 17731344], "object_zf": [17731584, 17822624], "object_goma": [17825792, 17954304], "object_zl1": [17956864, 18039744], "object_gol": [18042880, 18059808], "object_bubble": [18063360, 18067648], "object_dodojr": [18071552, 18079984], "object_torch2": [18083840, 18102128], "object_bl": [18104320, 18126928], "object_tp": [18128896, 18136304], "object_oA1": [18137088, 18155280], "object_st": [18157568, 18181040], "object_bw": [18182144, 18190944], "object_ei": [18194432, 18207776], "object_horse_normal": [18210816, 18251712], "object_oB1": [18251776, 18278064], "object_o_anime": [18280448, 18288976], "object_spot04_objects": [18292736, 18298560], "object_ddan_objects": [18300928, 18335584], "object_hidan_objects": [18337792, 18435360], "object_horse_ganon": [18436096, 18485392], "object_oA2": [18489344, 18511568], "object_spot00_objects": [18513920, 18521104], "object_mb": [18522112, 18604448], "object_bombf": [18608128, 18614784], "object_sk2": [18616320, 18675712], "object_oE1": [18677760, 18704400], "object_oE_anime": [18706432, 18727008], "object_oE2": [18731008, 18754160], "object_ydan_objects": [18755584, 18792576], "object_gnd": [18796544, 18874368], "object_am": [18874368, 18897744], "object_dekubaba": [18898944, 18913728], "object_oA3": [18915328, 18923824], "object_oA4": [18927616, 18933552], "object_oA5": [18935808, 18941616], "object_oA6": [18944000, 18950656], "object_oA7": [18952192, 18957648], "object_jj": [18960384, 19008192], "object_oA8": [19009536, 19015600], "object_oA9": [19017728, 19019040], "object_oB2": [19021824, 19038432], "object_oB3": [19042304, 19059856], "object_oB4": [19062784, 19069040], "object_horse_zelda": [19070976, 19100000], "object_opening_demo1": [19103744, 19124320], "object_warp1": [19128320, 19139760], "object_b_heart": [19140608, 19142208], "object_dekunuts": [19144704, 19158624], "object_oE3": [19161088, 19190048], "object_oE4": [19193856, 19214288], "object_menkuri_objects": [19214336, 19249936], "object_oE5": [19251200, 19273152], "object_oE6": [19275776, 19287632], "object_oE7": [19288064, 19298912], "object_oE8": [19300352, 19313616], "object_oE9": [19316736, 19328784], "object_oE10": [19329024, 19339728], "object_oE11": [19341312, 19354096], "object_oE12": [19357696, 19371968], "object_vali": [19374080, 19392592], "object_oA10": [19394560, 19406512], "object_oA11": [19406848, 19412416], "object_mizu_objects": [19415040, 19460896], "object_fhg": [19464192, 19538400], "object_ossan": [19542016, 19581776], "object_mori_hineri1": [19582976, 19604720], "object_Bb": [19607552, 19614272], "object_toki_objects": [19615744, 19649616], "object_yukabyun": [19652608, 19657968], "object_zl2": [19660800, 19729792], "object_mjin": [19730432, 19735184], "object_mjin_flash": [19738624, 19742720], "object_mjin_dark": [19742720, 19746816], "object_mjin_flame": [19746816, 19750912], "object_mjin_ice": [19750912, 19755008], "object_mjin_soul": [19755008, 19759104], "object_mjin_wind": [19759104, 19763200], "object_mjin_oka": [19763200, 19770208], "object_haka_objects": [19771392, 19891888], "object_spot06_objects": [19894272, 19905952], "object_ice_objects": [19906560, 19942736], "object_relay_objects": [19943424, 19957296], "object_mori_hineri1a": [19959808, 19973312], "object_mori_hineri2": [19976192, 19993600], "object_mori_hineri2a": [19996672, 20021424], "object_mori_objects": [20025344, 20060688], "object_mori_tex": [20062208, 20102656], "object_spot08_obj": [20103168, 20125184], "object_warp2": [20127744, 20127760], "object_hata": [20131840, 20144096], "object_bird": [20144128, 20152736], "object_wood02": [20156416, 20191184], "object_lightbox": [20193280, 20201280], "object_pu_box": [20201472, 20207104], "object_trap": [20209664, 20218848], "object_vase": [20221952, 20227472], "object_im": [20230144, 20304432], "object_ta": [20307968, 20366320], "object_tk": [20369408, 20418128], "object_xc": [20418560, 20533504], "object_vm": [20537344, 20553584], "object_bv": [20553728, 20681136], "object_hakach_objects": [20684800, 20712176], "object_efc_crystal_light": [20713472, 20716192], "object_efc_fire_ball": [20717568, 20720896], "object_efc_flash": [20721664, 20721680], "object_efc_lgt_shower": [20725760, 20730576], "object_efc_star_field": [20733952, 20740048], "object_god_lgt": [20742144, 20759376], "object_light_ring": [20762624, 20767360], "object_triforce_spot": [20770816, 20781328], "object_medal": [20783104, 20803904], "object_bdan_objects": [20807680, 20860176], "object_sd": [20860928, 20911840], "object_rd": [20914176, 20975600], "object_po_sisters": [20975616, 21033920], "object_heavy_object": [21037056, 21043936], "object_gndd": [21045248, 21117440], "object_fd": [21118976, 21190256], "object_du": [21192704, 21266480], "object_fw": [21270528, 21302752], "object_horse_link_child": [21303296, 21338912], "object_spot02_objects": [21340160, 21431840], "object_haka": [21434368, 21439584], "object_ru1": [21442560, 21523072], "object_syokudai": [21524480, 21539984], "object_fd2": [21540864, 21613200], "object_dh": [21614592, 21651648], "object_rl": [21655552, 21687120], "object_efc_tw": [21688320, 21693168], "object_demo_tre_lgt": [21696512, 21696528], "object_gi_key": [21700608, 21703200], "object_mir_ray": [21704704, 21712128], "object_brob": [21712896, 21719712], "object_gi_jewel": [21721088, 21735040], "object_spot09_obj": [21737472, 21837968], "object_spot18_obj": [21839872, 21891600], "object_bdoor": [21893120, 21923264], "object_spot17_obj": [21925888, 21932080], "object_shop_dungen": [21934080, 21948960], "object_nb": [21950464, 22049248], "object_mo": [22052864, 22089840], "object_sb": [22093824, 22105248], "object_gi_melody": [22106112, 22109472], "object_gi_heart": [22110208, 22110704], "object_gi_compass": [22114304, 22117648], "object_gi_bosskey": [22118400, 22122512], "object_gi_medal": [22126592, 22147952], "object_gi_nuts": [22151168, 22155712], "object_sa": [22159360, 22245936], "object_gi_hearts": [22249472, 22255536], "object_gi_arrowcase": [22257664, 22260912], "object_gi_bombpouch": [22261760, 22265440], "object_in": [22265856, 22367312], "object_tr": [22368256, 22445616], "object_spot16_obj": [22446080, 22451456], "object_oE1s": [22454272, 22480224], "object_oE4s": [22482944, 22502912], "object_os_anime": [22503424, 22545984], "object_gi_bottle": [22548480, 22550768], "object_gi_stick": [22552576, 22554304], "object_gi_map": [22556672, 22561120], "object_oF1d_map": [22564864, 22631840], "object_ru2": [22634496, 22698192], "object_gi_shield_1": [22700032, 22703440], "object_dekujr": [22704128, 22717712], "object_gi_magicpot": [22720512, 22725072], "object_gi_bomb_1": [22728704, 22731952], "object_oF1s": [22732800, 22767776], "object_ma2": [22769664, 22810352], "object_gi_purse": [22810624, 22817648], "object_hni": [22818816, 22863728], "object_tw": [22863872, 23105456], "object_rr": [23105536, 23109120], "object_bxa": [23109632, 23120880], "object_anubice": [23121920, 23136672], "object_gi_gerudo": [23138304, 23143232], "object_gi_arrow": [23146496, 23153424], "object_gi_bomb_2": [23154688, 23156384], "object_gi_egg": [23158784, 23163680], "object_gi_scale": [23166976, 23170544], "object_gi_shield_2": [23171072, 23175280], "object_gi_hookshot": [23179264, 23184736], "object_gi_ocarina": [23187456, 23190448], "object_gi_milk": [23191552, 23196784], "object_ma1": [23199744, 23235968], "object_ganon": [23236608, 23307520], "object_sst": [23310336, 23419824], "object_ny": [23420928, 23429488], "object_fr": [23433216, 23479472], "object_gi_pachinko": [23482368, 23485536], "object_gi_boomerang": [23486464, 23489952], "object_gi_bow": [23490560, 23493936], "object_gi_glasses": [23494656, 23499136], "object_gi_liquid": [23502848, 23509200], "object_ani": [23511040, 23541504], "object_demo_6k": [23543808, 23559072], "object_gi_shield_3": [23560192, 23564992], "object_gi_letter": [23568384, 23571968], "object_spot15_obj": [23572480, 23579904], "object_jya_obj": [23580672, 23695680], "object_gi_clothes": [23699456, 23705696], "object_gi_bean": [23707648, 23709888], "object_gi_fish": [23711744, 23714128], "object_gi_saw": [23715840, 23718784], "object_gi_hammer": [23719936, 23723200], "object_gi_grass": [23724032, 23727120], "object_gi_longsword": [23728128, 23730368], "object_spot01_objects": [23732224, 23741584], "object_md": [23744512, 23785808], "object_km1": [23789568, 23812544], "object_kw1": [23814144, 23840992], "object_zo": [23842816, 23892032], "object_kz": [23896064, 23930592], "object_umajump": [23932928, 23938160], "object_masterkokiri": [23941120, 23942336], "object_masterkokirihead": [23945216, 23956640], "object_mastergolon": [23957504, 23957776], "object_masterzoora": [23961600, 23963552], "object_aob": [23965696, 23987888], "object_ik": [23990272, 24122832], "object_ahg": [24125440, 24148400], "object_cne": [24150016, 24160720], "object_gi_niwatori": [24162304, 24168944], "object_skj": [24170496, 24206896], "object_gi_bottle_letter": [24207360, 24210560], "object_bji": [24211456, 24228240], "object_bba": [24231936, 24248976], "object_gi_ocarina_0": [24252416, 24255504], "object_ds": [24256512, 24274816], "object_ane": [24276992, 24305584], "object_boj": [24305664, 24329408], "object_spot03_object": [24330240, 24335968], "object_spot07_object": [24338432, 24366384], "object_fz": [24367104, 24380624], "object_bob": [24383488, 24403744], "object_ge1": [24403968, 24446128], "object_yabusame_point": [24449024, 24452688], "object_gi_boots_2": [24453120, 24460224], "object_gi_seed": [24461312, 24464064], "object_gnd_magic": [24465408, 24470144], "object_d_elevator": [24473600, 24478608], "object_d_hsblock": [24481792, 24487776], "object_d_lift": [24489984, 24496128], "object_mamenoki": [24498176, 24508128], "object_goroiwa": [24510464, 24516768], "object_toryo": [24518656, 24547680], "object_daiku": [24551424, 24586352], "object_nwc": [24588288, 24591776], "object_blkobj": [24592384, 24672400], "object_gm": [24674304, 24675024], "object_ms": [24678400, 24694224], "object_hs": [24694784, 24719984], "object_ingate": [24723456, 24728048], "object_lightswitch": [24731648, 24740896], "object_kusa": [24743936, 24744832], "object_tsubo": [24748032, 24754672], "object_gi_gloves": [24756224, 24762720], "object_gi_coin": [24764416, 24766544], "object_kanban": [24768512, 24774576], "object_gjyo_objects": [24776704, 24782320], "object_owl": [24784896, 24850624], "object_mk": [24854528, 24878592], "object_fu": [24879104, 24906912], "object_gi_ki_tan_mask": [24907776, 24911344], "object_gi_redead_mask": [24911872, 24914576], "object_gi_skj_mask": [24915968, 24919264], "object_gi_rabit_mask": [24920064, 24923904], "object_gi_truth_mask": [24924160, 24930400], "object_ganon_objects": [24932352, 24936816], "object_siofuki": [24940544, 24944048], "object_stream": [24944640, 24947328], "object_mm": [24948736, 24981616], "object_fa": [24985600, 25000848], "object_os": [25001984, 25020016], "object_gi_eye_lotion": [25022464, 25024880], "object_gi_powder": [25026560, 25029504], "object_gi_mushroom": [25030656, 25033936], "object_gi_ticketstone": [25034752, 25039520], "object_gi_brokensword": [25042944, 25045392], "object_js": [25047040, 25071408], "object_cs": [25071616, 25105744], "object_gi_prescription": [25108480, 25111584], "object_gi_bracelet": [25112576, 25115632], "object_gi_soldout": [25116672, 25117904], "object_gi_frog": [25120768, 25125136], "object_mag": [25128960, 25282880], "object_door_gerudo": [25284608, 25287072], "object_gt": [25288704, 25368048], "object_efc_erupc": [25370624, 25381104], "object_zl2_anime1": [25382912, 25429520], "object_zl2_anime2": [25432064, 25475808], "object_gi_golonmask": [25477120, 25483184], "object_gi_zoramask": [25485312, 25490992], "object_gi_gerudomask": [25493504, 25498624], "object_ganon2": [25501696, 25721840], "object_ka": [25722880, 25749440], "object_ts": [25751552, 25772016], "object_zg": [25772032, 25776640], "object_gi_hoverboots": [25780224, 25788016], "object_gi_m_arrow": [25788416, 25792128], "object_ds2": [25792512, 25809520], "object_ec": [25812992, 25864496], "object_fish": [25866240, 25953776], "object_gi_sutaru": [25956352, 25957968], "object_gi_goddess": [25960448, 25963600], "object_ssh": [25964544, 25988096], "object_bigokuta": [25989120, 26016720], "object_bg": [26017792, 26047168], "object_spot05_objects": [26050560, 26055408], "object_spot12_obj": [26058752, 26067904], "object_bombiwa": [26071040, 26073856], "object_hintnuts": [26075136, 26087744], "object_rs": [26091520, 26110080], "object_spot00_break": [26112000, 26119712], "object_gla": [26120192, 26160880], "object_shopnuts": [26161152, 26178960], "object_geldb": [26181632, 26228464], "object_gr": [26230784, 26270864], "object_dog": [26271744, 26301088], "object_jya_iron": [26304512, 26314336], "object_jya_door": [26316800, 26325632], "object_spot01_objects2": [26329088, 26329104], "object_spot11_obj": [26333184, 26339984], "object_kibako2": [26341376, 26345664], "object_dns": [26349568, 26363856], "object_dnk": [26365952, 26377776], "object_gi_fire": [26378240, 26382304], "object_gi_insect": [26382336, 26385392], "object_gi_butterfly": [26386432, 26389456], "object_gi_ghost": [26390528, 26394032], "object_gi_soul": [26394624, 26398640], "object_bowl": [26398720, 26412272], "object_po_field": [26415104, 26442304], "object_demo_kekkai": [26443776, 26504464], "object_efc_doughnut": [26505216, 26509392], "object_gi_dekupouch": [26513408, 26517584], "object_ganon_anime1": [26521600, 26569792], "object_ganon_anime2": [26570752, 26637616], "object_ganon_anime3": [26640384, 26724336], "object_gi_rupy": [26726400, 26728448], "object_spot01_matoya": [26730496, 26746000], "object_spot01_matoyab": [26746880, 26755552], "object_po_composer": [26759168, 26787744], "object_mu": [26787840, 26832464], "object_wf": [26832896, 26875136], "object_skb": [26877952, 26896400], "object_gj": [26898432, 26941216], "object_geff": [26943488, 26947504], "object_haka_door": [26947584, 26962288], "object_gs": [26963968, 26966656], "object_ps": [26968064, 27019520], "object_bwall": [27021312, 27025744], "object_crow": [27029504, 27033808], "object_cow": [27037696, 27057840], "object_cob": [27058176, 27066896], "object_gi_sword_1": [27070464, 27073824], "object_door_killer": [27074560, 27081696], "object_ouke_haka": [27082752, 27085168], "object_timeblock": [27086848, 27089760], "object_zl4": [27090944, 27209248], "g_pn_01": [27209728, 27220096], "g_pn_02": [27222016, 27232384], "g_pn_03": [27234304, 27244672], "g_pn_04": [27246592, 27256960], "g_pn_05": [27258880, 27269248], "g_pn_06": [27271168, 27281536], "g_pn_07": [27283456, 27293824], "g_pn_08": [27295744, 27306112], "g_pn_09": [27308032, 27318400], "g_pn_10": [27320320, 27330688], "g_pn_11": [27332608, 27342976], "g_pn_12": [27344896, 27355264], "g_pn_13": [27357184, 27367552], "g_pn_14": [27369472, 27379840], "g_pn_15": [27381760, 27392128], "g_pn_16": [27394048, 27404416], "g_pn_17": [27406336, 27416704], "g_pn_18": [27418624, 27428992], "g_pn_19": [27430912, 27441280], "g_pn_20": [27443200, 27453568], "g_pn_21": [27455488, 27465856], "g_pn_22": [27467776, 27478144], "g_pn_23": [27480064, 27490432], "g_pn_24": [27492352, 27502720], "g_pn_25": [27504640, 27515008], "g_pn_26": [27516928, 27527296], "g_pn_27": [27529216, 27539584], "g_pn_28": [27541504, 27551872], "g_pn_29": [27553792, 27564160], "g_pn_30": [27566080, 27576448], "g_pn_31": [27578368, 27588736], "g_pn_32": [27590656, 27601024], "g_pn_33": [27602944, 27613312], "g_pn_34": [27615232, 27625600], "g_pn_35": [27627520, 27637888], "g_pn_36": [27639808, 27650176], "g_pn_37": [27652096, 27662464], "g_pn_38": [27664384, 27674752], "g_pn_39": [27676672, 27687040], "g_pn_40": [27688960, 27699328], "g_pn_41": [27701248, 27711616], "g_pn_42": [27713536, 27723904], "g_pn_43": [27725824, 27736192], "g_pn_44": [27738112, 27748480], "g_pn_45": [27750400, 27760768], "g_pn_46": [27762688, 27773056], "g_pn_47": [27774976, 27785344], "g_pn_48": [27787264, 27797632], "g_pn_49": [27799552, 27809920], "g_pn_50": [27811840, 27822208], "g_pn_51": [27824128, 27834496], "g_pn_52": [27836416, 27846784], "g_pn_53": [27848704, 27859072], "g_pn_54": [27860992, 27871360], "g_pn_55": [27873280, 27883648], "g_pn_56": [27885568, 27895936], "g_pn_57": [27897856, 27908224], "z_select_static": [27910144, 27918848], "nintendo_rogo_static": [27922432, 27934144], "title_static": [27934720, 28226624], "parameter_static": [28229632, 28244736], "vr_fine0_static": [28246016, 28295168], "vr_fine0_pal_static": [28295168, 28295424], "vr_fine1_static": [28299264, 28348416], "vr_fine1_pal_static": [28348416, 28348672], "vr_fine2_static": [28352512, 28401664], "vr_fine2_pal_static": [28401664, 28401920], "vr_fine3_static": [28405760, 28454912], "vr_fine3_pal_static": [28454912, 28455168], "vr_cloud0_static": [28459008, 28508160], "vr_cloud0_pal_static": [28508160, 28508416], "vr_cloud1_static": [28512256, 28561408], "vr_cloud1_pal_static": [28561408, 28561664], "vr_cloud2_static": [28565504, 28614656], "vr_cloud2_pal_static": [28614656, 28614912], "vr_cloud3_static": [28618752, 28667904], "vr_cloud3_pal_static": [28667904, 28668160], "vr_holy0_static": [28672000, 28737536], "vr_holy0_pal_static": [28737536, 28737792], "vr_holy1_static": [28741632, 28807168], "vr_holy1_pal_static": [28807168, 28807424], "vr_MDVR_static": [28811264, 29073408], "vr_MDVR_pal_static": [29073408, 29075456], "vr_MNVR_static": [29077504, 29339648], "vr_MNVR_pal_static": [29339648, 29341696], "vr_RUVR_static": [29343744, 29605888], "vr_RUVR_pal_static": [29605888, 29607936], "vr_LHVR_static": [29609984, 29872128], "vr_LHVR_pal_static": [29872128, 29874176], "vr_KHVR_static": [29876224, 30138368], "vr_KHVR_pal_static": [30138368, 30140416], "vr_K3VR_static": [30142464, 30339072], "vr_K3VR_pal_static": [30339072, 30340608], "vr_K4VR_static": [30343168, 30539776], "vr_K4VR_pal_static": [30539776, 30541312], "vr_K5VR_static": [30543872, 30740480], "vr_K5VR_pal_static": [30740480, 30742016], "vr_SP1a_static": [30744576, 30875648], "vr_SP1a_pal_static": [30875648, 30876672], "vr_MLVR_static": [30879744, 31141888], "vr_MLVR_pal_static": [31141888, 31143936], "vr_KKRVR_static": [31145984, 31408128], "vr_KKRVR_pal_static": [31408128, 31410176], "vr_KR3VR_static": [31412224, 31608832], "vr_KR3VR_pal_static": [31608832, 31610368], "vr_IPVR_static": [31612928, 31875072], "vr_IPVR_pal_static": [31875072, 31877120], "vr_KSVR_static": [31879168, 32010240], "vr_KSVR_pal_static": [32010240, 32011264], "vr_GLVR_static": [32014336, 32145408], "vr_GLVR_pal_static": [32145408, 32146432], "vr_ZRVR_static": [32149504, 32280576], "vr_ZRVR_pal_static": [32280576, 32281600], "vr_DGVR_static": [32284672, 32415744], "vr_DGVR_pal_static": [32415744, 32416768], "vr_ALVR_static": [32419840, 32550912], "vr_ALVR_pal_static": [32550912, 32551936], "vr_NSVR_static": [32555008, 32686080], "vr_NSVR_pal_static": [32686080, 32687104], "vr_LBVR_static": [32690176, 32952320], "vr_LBVR_pal_static": [32952320, 32954368], "vr_TTVR_static": [32956416, 33153024], "vr_TTVR_pal_static": [33153024, 33154560], "vr_FCVR_static": [33157120, 33288192], "vr_FCVR_pal_static": [33288192, 33289216], "elf_message_field": [33292288, 33292400], "elf_message_ydan": [33296384, 33296400], "syotes_scene": [41496576, 41503744], "syotes_room_0": [41504768, 41557888], "syotes2_scene": [41558016, 41567408], "syotes2_room_0": [41570304, 41611008], "depth_test_scene": [41611264, 41612032], "depth_test_room_0": [41615360, 41770736], "spot00_scene": [41771008, 41943584], "spot00_room_0": [41947136, 42033712], "spot01_scene": [42037248, 42152272], "spot01_room_0": [42156032, 42196704], "spot02_scene": [42196992, 42245248], "spot02_room_0": [42246144, 42256096], "spot02_room_1": [42258432, 42381200], "spot03_scene": [42381312, 42427744], "spot03_room_0": [42430464, 42486144], "spot03_room_1": [42487808, 42517760], "spot04_scene": [42520576, 42590784], "spot04_room_0": [42594304, 42706064], "spot04_room_1": [42708992, 42743168], "spot04_room_2": [42745856, 42766448], "spot05_scene": [42770432, 42855776], "spot05_room_0": [42856448, 42897152], "spot06_scene": [42897408, 43009072], "spot06_room_0": [43012096, 43054624], "spot07_scene": [43057152, 43096096], "spot07_room_0": [43098112, 43123440], "spot07_room_1": [43126784, 43178400], "spot08_scene": [43180032, 43251360], "spot08_room_0": [43253760, 43286880], "spot09_scene": [43290624, 43360608], "spot09_room_0": [43364352, 43399104], "spot10_scene": [43401216, 43467824], "spot10_room_0": [43470848, 43480560], "spot10_room_1": [43483136, 43516976], "spot10_room_2": [43520000, 43539440], "spot10_room_3": [43540480, 43563696], "spot10_room_4": [43565056, 43574480], "spot10_room_5": [43577344, 43606000], "spot10_room_6": [43606016, 43621104], "spot10_room_7": [43622400, 43632064], "spot10_room_8": [43634688, 43644528], "spot10_room_9": [43646976, 43662304], "spot11_scene": [43663360, 43767008], "spot11_room_0": [43769856, 43820992], "spot12_scene": [43823104, 43888256], "spot12_room_0": [43888640, 43959744], "spot12_room_1": [43962368, 44011680], "spot13_scene": [44015616, 44039728], "spot13_room_0": [44040192, 44042512], "spot13_room_1": [44044288, 44120640], "spot15_scene": [44122112, 44221696], "spot15_room_0": [44224512, 44278208], "spot16_scene": [44281856, 44407440], "spot16_room_0": [44408832, 44453136], "spot17_scene": [44453888, 44519136], "spot17_room_0": [44519424, 44546176], "spot17_room_1": [44548096, 44622688], "spot18_scene": [44625920, 44667984], "spot18_room_0": [44670976, 44746704], "spot18_room_1": [44748800, 44773888], "spot18_room_2": [44777472, 44849584], "spot18_room_3": [44851200, 44973296], "ydan_scene": [33300480, 33356320], "ydan_room_0": [33357824, 33444688], "ydan_room_1": [33447936, 33464832], "ydan_room_2": [33468416, 33492784], "ydan_room_3": [33492992, 33575344], "ydan_room_4": [33579008, 33598512], "ydan_room_5": [33599488, 33633168], "ydan_room_6": [33636352, 33656576], "ydan_room_7": [33656832, 33692320], "ydan_room_8": [33693696, 33697168], "ydan_room_9": [33697792, 33736864], "ydan_room_10": [33738752, 33758720], "ydan_room_11": [33759232, 33788272], "ddan_scene": [33792000, 33878336], "ddan_room_0": [33882112, 33994912], "ddan_room_1": [33996800, 34036592], "ddan_room_2": [34037760, 34070208], "ddan_room_3": [34070528, 34127472], "ddan_room_4": [34127872, 34167136], "ddan_room_5": [34168832, 34193088], "ddan_room_6": [34193408, 34202800], "ddan_room_7": [34205696, 34236160], "ddan_room_8": [34238464, 34276768], "ddan_room_9": [34279424, 34325808], "ddan_room_10": [34328576, 34361104], "ddan_room_11": [34361344, 34369584], "ddan_room_12": [34373632, 34408320], "ddan_room_13": [34410496, 34419920], "ddan_room_14": [34422784, 34432208], "ddan_room_15": [34435072, 34445616], "ddan_room_16": [34447360, 34469216], "bdan_scene": [34471936, 34559968], "bdan_room_0": [34562048, 34578752], "bdan_room_1": [34582528, 34607040], "bdan_room_2": [34607104, 34644544], "bdan_room_3": [34648064, 34677344], "bdan_room_4": [34680832, 34697472], "bdan_room_5": [34701312, 34726032], "bdan_room_6": [34729984, 34746944], "bdan_room_7": [34750464, 34763984], "bdan_room_8": [34766848, 34781248], "bdan_room_9": [34783232, 34798640], "bdan_room_10": [34799616, 34813984], "bdan_room_11": [34816000, 34830832], "bdan_room_12": [34832384, 34847968], "bdan_room_13": [34848768, 34859904], "bdan_room_14": [34861056, 34886096], "bdan_room_15": [34889728, 34899680], "Bmori1_scene": [34902016, 34992016], "Bmori1_room_0": [34992128, 35048336], "Bmori1_room_1": [35049472, 35072880], "Bmori1_room_2": [35074048, 35137920], "Bmori1_room_3": [35139584, 35154400], "Bmori1_room_4": [35155968, 35168960], "Bmori1_room_5": [35172352, 35186128], "Bmori1_room_6": [35188736, 35226672], "Bmori1_room_7": [35229696, 35307488], "Bmori1_room_8": [35307520, 35404464], "Bmori1_room_9": [35405824, 35447136], "Bmori1_room_10": [35450880, 35472352], "Bmori1_room_11": [35475456, 35519456], "Bmori1_room_12": [35520512, 35554272], "Bmori1_room_13": [35557376, 35592880], "Bmori1_room_14": [35594240, 35617648], "Bmori1_room_15": [35618816, 35628768], "Bmori1_room_16": [35631104, 35651488], "Bmori1_room_17": [35651584, 35688688], "Bmori1_room_18": [35692544, 35697456], "Bmori1_room_19": [35700736, 35702016], "Bmori1_room_20": [35704832, 35709696], "Bmori1_room_21": [35713024, 35719024], "Bmori1_room_22": [35721216, 35728864], "HIDAN_scene": [35729408, 35837904], "HIDAN_room_0": [35840000, 35869424], "HIDAN_room_1": [35872768, 35924272], "HIDAN_room_2": [35926016, 35991600], "HIDAN_room_3": [35995648, 36005072], "HIDAN_room_4": [36007936, 36038896], "HIDAN_room_5": [36040704, 36082400], "HIDAN_room_6": [36085760, 36114320], "HIDAN_room_7": [36114432, 36129360], "HIDAN_room_8": [36130816, 36170464], "HIDAN_room_9": [36171776, 36206448], "HIDAN_room_10": [36208640, 36308000], "HIDAN_room_11": [36311040, 36325344], "HIDAN_room_12": [36327424, 36338544], "HIDAN_room_13": [36339712, 36391824], "HIDAN_room_14": [36392960, 36401664], "HIDAN_room_15": [36405248, 36409744], "HIDAN_room_16": [36413440, 36461024], "HIDAN_room_17": [36462592, 36499824], "HIDAN_room_18": [36503552, 36518912], "HIDAN_room_19": [36519936, 36536880], "HIDAN_room_20": [36540416, 36568336], "HIDAN_room_21": [36569088, 36603008], "HIDAN_room_22": [36605952, 36633328], "HIDAN_room_23": [36634624, 36662560], "HIDAN_room_24": [36663296, 36685120], "HIDAN_room_25": [36687872, 36715232], "HIDAN_room_26": [36716544, 36743328], "MIZUsin_scene": [36745216, 36834352], "MIZUsin_room_0": [36835328, 36924464], "MIZUsin_room_1": [36925440, 36966864], "MIZUsin_room_2": [36970496, 36994192], "MIZUsin_room_3": [36995072, 37021632], "MIZUsin_room_4": [37023744, 37048352], "MIZUsin_room_5": [37052416, 37094976], "MIZUsin_room_6": [37097472, 37143296], "MIZUsin_room_7": [37146624, 37168480], "MIZUsin_room_8": [37171200, 37227904], "MIZUsin_room_9": [37228544, 37261488], "MIZUsin_room_10": [37265408, 37290096], "MIZUsin_room_11": [37294080, 37313056], "MIZUsin_room_12": [37314560, 37342768], "MIZUsin_room_13": [37343232, 37345792], "MIZUsin_room_14": [37347328, 37375616], "MIZUsin_room_15": [37376000, 37405808], "MIZUsin_room_16": [37408768, 37423920], "MIZUsin_room_17": [37425152, 37460656], "MIZUsin_room_18": [37462016, 37478656], "MIZUsin_room_19": [37482496, 37497136], "MIZUsin_room_20": [37498880, 37525568], "MIZUsin_room_21": [37527552, 37557408], "MIZUsin_room_22": [37560320, 37597424], "jyasinzou_scene": [37601280, 37706528], "jyasinzou_room_0": [37707776, 37777392], "jyasinzou_room_1": [37777408, 37815120], "jyasinzou_room_2": [37818368, 37841840], "jyasinzou_room_3": [37842944, 37858256], "jyasinzou_room_4": [37859328, 37888640], "jyasinzou_room_5": [37892096, 37990416], "jyasinzou_room_6": [37994496, 38012912], "jyasinzou_room_7": [38014976, 38036752], "jyasinzou_room_8": [38039552, 38072496], "jyasinzou_room_9": [38076416, 38100432], "jyasinzou_room_10": [38100992, 38134176], "jyasinzou_room_11": [38137856, 38141968], "jyasinzou_room_12": [38146048, 38154464], "jyasinzou_room_13": [38158336, 38181040], "jyasinzou_room_14": [38182912, 38202528], "jyasinzou_room_15": [38203392, 38237344], "jyasinzou_room_16": [38240256, 38265280], "jyasinzou_room_17": [38268928, 38307408], "jyasinzou_room_18": [38309888, 38333664], "jyasinzou_room_19": [38334464, 38358480], "jyasinzou_room_20": [38359040, 38392256], "jyasinzou_room_21": [38395904, 38413920], "jyasinzou_room_22": [38416384, 38428784], "jyasinzou_room_23": [38432768, 38470160], "jyasinzou_room_24": [38473728, 38499536], "jyasinzou_room_25": [38502400, 38591392], "jyasinzou_room_26": [38592512, 38644480], "jyasinzou_room_27": [38645760, 38668048], "jyasinzou_room_28": [38670336, 38705712], "HAKAdan_scene": [38707200, 38806464], "HAKAdan_room_0": [38809600, 38854992], "HAKAdan_room_1": [38858752, 38865648], "HAKAdan_room_2": [38866944, 38910432], "HAKAdan_room_3": [38912000, 38922624], "HAKAdan_room_4": [38924288, 38931552], "HAKAdan_room_5": [38932480, 38955712], "HAKAdan_room_6": [38957056, 38987248], "HAKAdan_room_7": [38989824, 38996704], "HAKAdan_room_8": [38998016, 39018656], "HAKAdan_room_9": [39022592, 39074960], "HAKAdan_room_10": [39075840, 39106544], "HAKAdan_room_11": [39108608, 39124576], "HAKAdan_room_12": [39124992, 39147344], "HAKAdan_room_13": [39149568, 39153696], "HAKAdan_room_14": [39157760, 39180544], "HAKAdan_room_15": [39182336, 39211712], "HAKAdan_room_16": [39215104, 39225648], "HAKAdan_room_17": [39227392, 39239136], "HAKAdan_room_18": [39239680, 39293712], "HAKAdan_room_19": [39297024, 39308672], "HAKAdan_room_20": [39309312, 39317056], "HAKAdan_room_21": [39317504, 39364016], "HAKAdan_room_22": [39366656, 39377328], "HAKAdanCH_scene": [39378944, 39429520], "HAKAdanCH_room_0": [39432192, 39520032], "HAKAdanCH_room_1": [39522304, 39567664], "HAKAdanCH_room_2": [39571456, 39584096], "HAKAdanCH_room_3": [39587840, 39595200], "HAKAdanCH_room_4": [39596032, 39605408], "HAKAdanCH_room_5": [39608320, 39618960], "HAKAdanCH_room_6": [39620608, 39632544], "ice_doukutu_scene": [39632896, 39704256], "ice_doukutu_room_0": [39706624, 39741056], "ice_doukutu_room_1": [39743488, 39793968], "ice_doukutu_room_2": [39796736, 39820032], "ice_doukutu_room_3": [39821312, 39854224], "ice_doukutu_room_4": [39858176, 39888464], "ice_doukutu_room_5": [39890944, 39925888], "ice_doukutu_room_6": [39927808, 39944624], "ice_doukutu_room_7": [39948288, 39971056], "ice_doukutu_room_8": [39972864, 39979296], "ice_doukutu_room_9": [39981056, 40015504], "ice_doukutu_room_10": [40017920, 40035296], "ice_doukutu_room_11": [40038400, 40061008], "men_scene": [40062976, 40133824], "men_room_0": [40136704, 40202128], "men_room_1": [40202240, 40239728], "men_room_2": [40243200, 40263760], "men_room_3": [40267776, 40299600], "men_room_4": [40300544, 40341984], "men_room_5": [40345600, 40366112], "men_room_6": [40370176, 40402816], "men_room_7": [40402944, 40436416], "men_room_8": [40439808, 40473136], "men_room_9": [40476672, 40491120], "men_room_10": [40493056, 40516688], "ganontika_scene": [40517632, 40654800], "ganontika_room_0": [40656896, 40694288], "ganontika_room_1": [40697856, 40815056], "ganontika_room_2": [40816640, 40847328], "ganontika_room_3": [40849408, 40888896], "ganontika_room_4": [40890368, 40922256], "ganontika_room_5": [40923136, 40953120], "ganontika_room_6": [40955904, 41020512], "ganontika_room_7": [41021440, 41053328], "ganontika_room_8": [41054208, 41091104], "ganontika_room_9": [41095168, 41142304], "ganontika_room_10": [41144320, 41171904], "ganontika_room_11": [41172992, 41199952], "ganontika_room_12": [41201664, 41247344], "ganontika_room_13": [41250816, 41282880], "ganontika_room_14": [41283584, 41325008], "ganontika_room_15": [41328640, 41360704], "ganontika_room_16": [41361408, 41373232], "ganontika_room_17": [41373696, 41408032], "ganontika_room_18": [41410560, 41461472], "ganontika_room_19": [41463808, 41495872], "market_day_scene": [44974080, 44983920], "market_day_room_0": [44986368, 45009008], "market_night_scene": [45010944, 45020720], "market_night_room_0": [45023232, 45045664], "testroom_scene": [45047808, 45064704], "testroom_room_0": [45068288, 45086208], "testroom_room_1": [45088768, 45097968], "testroom_room_2": [45101056, 45113984], "testroom_room_3": [45117440, 45132320], "testroom_room_4": [45133824, 45134592], "kenjyanoma_scene": [45137920, 45152496], "kenjyanoma_room_0": [45154304, 45232400], "tokinoma_scene": [45236224, 45311904], "tokinoma_room_0": [45314048, 45408736], "tokinoma_room_1": [45412352, 45441232], "sutaru_scene": [45445120, 45448112], "sutaru_room_0": [45449216, 45478640], "link_home_scene": [45481984, 45488992], "link_home_room_0": [45490176, 45653120], "kokiri_shop_scene": [45654016, 45656448], "kokiri_shop_room_0": [45658112, 45857936], "kokiri_home_scene": [45858816, 45862080], "kokiri_home_room_0": [45862912, 46042160], "kakusiana_scene": [46043136, 46098464], "kakusiana_room_0": [46100480, 46129824], "kakusiana_room_1": [46133248, 46154128], "kakusiana_room_2": [46157824, 46168256], "kakusiana_room_3": [46170112, 46190896], "kakusiana_room_4": [46194688, 46225760], "kakusiana_room_5": [46227456, 46245600], "kakusiana_room_6": [46247936, 46271088], "kakusiana_room_7": [46272512, 46288848], "kakusiana_room_8": [46288896, 46302768], "kakusiana_room_9": [46305280, 46328528], "kakusiana_room_10": [46329856, 46352944], "kakusiana_room_11": [46354432, 46388912], "kakusiana_room_12": [46391296, 46423632], "kakusiana_room_13": [46424064, 46452432], "entra_scene": [46452736, 46453728], "entra_room_0": [46456832, 46611312], "moribossroom_scene": [46612480, 46618880], "moribossroom_room_0": [46620672, 46644928], "moribossroom_room_1": [46645248, 46701232], "syatekijyou_scene": [46702592, 46752448], "syatekijyou_room_0": [46755840, 46786288], "shop1_scene": [46788608, 46789360], "shop1_room_0": [46792704, 46962608], "hairal_niwa_scene": [46964736, 47035280], "hairal_niwa_room_0": [47038464, 47081696], "ganon_tou_scene": [47083520, 47102832], "ganon_tou_room_0": [47104000, 47184624], "sasatest_scene": [47185920, 47196960], "sasatest_room_0": [47198208, 47212112], "market_alley_scene": [47214592, 47219280], "market_alley_room_0": [47222784, 47703808], "spot20_scene": [47706112, 47779360], "spot20_room_0": [47779840, 47806160], "market_ruins_scene": [47808512, 47814192], "market_ruins_room_0": [47816704, 47826976], "entra_n_scene": [47828992, 47830064], "entra_n_room_0": [47833088, 47987568], "enrui_scene": [47988736, 47989728], "enrui_room_0": [47992832, 48147296], "market_alley_n_scene": [48148480, 48153328], "market_alley_n_room_0": [48156672, 48637680], "hiral_demo_scene": [48640000, 48655696], "hiral_demo_room_0": [48656384, 48657984], "kokiri_home3_scene": [48660480, 48666528], "kokiri_home3_room_0": [48668672, 48891408], "malon_stable_scene": [48893952, 48895600], "malon_stable_room_0": [48898048, 49087056], "kakariko_scene": [49090560, 49094304], "kakariko_room_0": [49094656, 49270720], "bdan_boss_scene": [49270784, 49274432], "bdan_boss_room_0": [49274880, 49287200], "bdan_boss_room_1": [49291264, 49311936], "FIRE_bs_scene": [49315840, 49335296], "FIRE_bs_room_0": [49336320, 49353328], "FIRE_bs_room_1": [49356800, 49385440], "hut_scene": [49385472, 49386768], "hut_room_0": [49389568, 49558944], "daiyousei_izumi_scene": [49561600, 49618944], "daiyousei_izumi_room_0": [49618944, 49633552], "hakaana_scene": [49635328, 49638032], "hakaana_room_0": [49639424, 49670352], "yousei_izumi_tate_scene": [49672192, 49707024], "yousei_izumi_tate_room_0": [49709056, 49726160], "yousei_izumi_yoko_scene": [49729536, 49782176], "yousei_izumi_yoko_room_0": [49782784, 49799184], "golon_scene": [49803264, 49804192], "golon_room_0": [49807360, 49963472], "zoora_scene": [49967104, 49968016], "zoora_room_0": [49971200, 50127328], "drag_scene": [50130944, 50131952], "drag_room_0": [50135040, 50314848], "alley_shop_scene": [50315264, 50316720], "alley_shop_room_0": [50319360, 50478128], "night_shop_scene": [50479104, 50480752], "night_shop_room_0": [50483200, 50649440], "impa_scene": [50651136, 50654480], "impa_room_0": [50655232, 50814880], "labo_scene": [50814976, 50818800], "labo_room_0": [50819072, 51001072], "tent_scene": [51003392, 51005056], "tent_room_0": [51007488, 51218080], "nakaniwa_scene": [51220480, 51235360], "nakaniwa_room_0": [51236864, 51334848], "ddan_boss_scene": [51335168, 51345504], "ddan_boss_room_0": [51347456, 51367472], "ddan_boss_room_1": [51367936, 51383776], "ydan_boss_scene": [51384320, 51390272], "ydan_boss_room_0": [51392512, 51421168], "ydan_boss_room_1": [51421184, 51447792], "HAKAdan_bs_scene": [51449856, 51459968], "HAKAdan_bs_room_0": [51462144, 51472864], "HAKAdan_bs_room_1": [51474432, 51498832], "MIZUsin_bs_scene": [51499008, 51505760], "MIZUsin_bs_room_0": [51507200, 51524720], "MIZUsin_bs_room_1": [51527680, 51573488], "ganon_scene": [51576832, 51644336], "ganon_room_0": [51646464, 51678928], "ganon_room_1": [51679232, 51709808], "ganon_room_2": [51712000, 51742800], "ganon_room_3": [51744768, 51775280], "ganon_room_4": [51777536, 51814608], "ganon_room_5": [51818496, 51854096], "ganon_room_6": [51855360, 51895200], "ganon_room_7": [51896320, 51939232], "ganon_room_8": [51941376, 51968992], "ganon_room_9": [51970048, 51992864], "ganon_boss_scene": [51994624, 52026400], "ganon_boss_room_0": [52027392, 52051584], "jyasinboss_scene": [52051968, 52088048], "jyasinboss_room_0": [52088832, 52092880], "jyasinboss_room_1": [52092928, 52125248], "jyasinboss_room_2": [52125696, 52141504], "jyasinboss_room_3": [52142080, 52188928], "kokiri_home4_scene": [52191232, 52198064], "kokiri_home4_room_0": [52199424, 52431184], "kokiri_home5_scene": [52432896, 52438032], "kokiri_home5_room_0": [52441088, 52641632], "ganon_final_scene": [52641792, 52715904], "ganon_final_room_0": [52719616, 52772528], "kakariko3_scene": [52772864, 52774976], "kakariko3_room_0": [52776960, 52950400], "hairal_niwa2_scene": [52953088, 52964624], "hairal_niwa2_room_0": [52965376, 53062656], "hakasitarelay_scene": [53063680, 53121648], "hakasitarelay_room_0": [53125120, 53154496], "hakasitarelay_room_1": [53157888, 53184288], "hakasitarelay_room_2": [53186560, 53220528], "hakasitarelay_room_3": [53223424, 53259488], "hakasitarelay_room_4": [53260288, 53277824], "hakasitarelay_room_5": [53280768, 53298256], "hakasitarelay_room_6": [53301248, 53332656], "shrine_scene": [53334016, 53339360], "shrine_room_0": [53342208, 53680880], "turibori_scene": [53682176, 53757664], "turibori_room_0": [53760000, 53786464], "shrine_n_scene": [53788672, 53794048], "shrine_n_room_0": [53796864, 54135568], "shrine_r_scene": [54136832, 54142096], "shrine_r_room_0": [54145024, 54483696], "hakaana2_scene": [54484992, 54538384], "hakaana2_room_0": [54542336, 54568976], "gerudoway_scene": [54571008, 54626592], "gerudoway_room_0": [54628352, 54648128], "gerudoway_room_1": [54648832, 54678192], "gerudoway_room_2": [54681600, 54697552], "gerudoway_room_3": [54697984, 54743824], "gerudoway_room_4": [54747136, 54761760], "gerudoway_room_5": [54763520, 54783552], "hairal_niwa_n_scene": [54784000, 54821104], "hairal_niwa_n_room_0": [54824960, 54838816], "bowling_scene": [54841344, 54901536], "bowling_room_0": [54902784, 54927840], "hakaana_ouke_scene": [54931456, 54950624], "hakaana_ouke_room_0": [54951936, 54994944], "hakaana_ouke_room_1": [54996992, 55015424], "hakaana_ouke_room_2": [55017472, 55042320], "hylia_labo_scene": [55046144, 55115920], "hylia_labo_room_0": [55119872, 55150032], "souko_scene": [55152640, 55180304], "souko_room_0": [55181312, 55219520], "souko_room_1": [55222272, 55264304], "souko_room_2": [55267328, 55300480], "miharigoya_scene": [55304192, 55354704], "miharigoya_room_0": [55357440, 55373232], "mahouya_scene": [55373824, 55417376], "mahouya_room_0": [55418880, 55446160], "takaraya_scene": [55447552, 55476656], "takaraya_room_0": [55480320, 55520704], "takaraya_room_1": [55521280, 55529472], "takaraya_room_2": [55529472, 55537712], "takaraya_room_3": [55541760, 55552032], "takaraya_room_4": [55554048, 55566368], "takaraya_room_5": [55570432, 55582720], "takaraya_room_6": [55582720, 55593728], "ganon_sonogo_scene": [55595008, 55627536], "ganon_sonogo_room_0": [55627776, 55660160], "ganon_sonogo_room_1": [55660544, 55692208], "ganon_sonogo_room_2": [55693312, 55729312], "ganon_sonogo_room_3": [55730176, 55752256], "ganon_sonogo_room_4": [55754752, 55790832], "ganon_demo_scene": [55791616, 55828592], "ganon_demo_room_0": [55832576, 55849296], "besitu_scene": [55853056, 55854256], "besitu_room_0": [55857152, 55878880], "face_shop_scene": [55881728, 55882608], "face_shop_room_0": [55885824, 56075840], "kinsuta_scene": [56078336, 56083984], "kinsuta_room_0": [56086528, 56144032], "ganontikasonogo_scene": [56147968, 56167168], "ganontikasonogo_room_0": [56168448, 56265600], "ganontikasonogo_room_1": [56266752, 56307488], "test01_scene": [56307712, 56323616], "test01_room_0": [56324096, 56363248], "bump_texture_static": [56365056, 56366080], "anime_model_1_static": [56369152, 56369168], "anime_model_2_static": [56373248, 56373264], "anime_model_3_static": [56377344, 56377360], "anime_model_4_static": [56381440, 56381456], "anime_model_5_static": [56385536, 56385552], "anime_model_6_static": [56389632, 56389648], "anime_texture_1_static": [56393728, 56393744], "anime_texture_2_static": [56397824, 56397840], "anime_texture_3_static": [56401920, 56401936], "anime_texture_4_static": [56406016, 56406032], "anime_texture_5_static": [56410112, 56410128], "anime_texture_6_static": [56414208, 56414224], "softsprite_matrix_static": [56418304, 56418368]}} \ No newline at end of file diff --git a/tools/overlayhelpers/lmapmark.py b/tools/overlayhelpers/lmapmark.py deleted file mode 100644 index cf5f11187..000000000 --- a/tools/overlayhelpers/lmapmark.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python3 -import os -import struct - -SIMPLIFY_OUTPUT = True -OVL_KALEIDO_SCOPE_RAM = 0x80813820 -gPauseMapMarkDataTable = 0x8082B2C0 - -SCENES = [ - ("Deku Tree", 5), - ("Dodongo's Cavern", 2), - ("Jabu-Jabu's Belly", 2), - ("Forest Temple", 4), - ("Fire Temple", 5), - ("Water Temple", 4), - ("Spirit Temple", 4), - ("Shadow Temple", 4), - ("Bottom of the Well", 3), - ("Ice Cavern", 1), -] - -def RamToOff(vram): - return vram - OVL_KALEIDO_SCOPE_RAM - -def GetPoints(data, ptr): - points = [] - off = RamToOff(ptr) - for i in range(12): - v = struct.unpack_from(">hhff", data[off:off+0x0C]) - if not (SIMPLIFY_OUTPUT and v[0] == 0 and v[2] == 0 and v[3] == 0): - points.append([v[0], v[2], v[3]]) - off = off + 0x0C - return points - -def GetIconData(data, ptr): - off = RamToOff(ptr) - v = struct.unpack_from(">hhiIii", data[off:off+0x14]) - points = GetPoints(data, ptr+0x14) - return [v[0], v[2], v[3], v[4], v[5], points] - -def GetSceneMap(data, ptr): - icons = [] - for i in range(3): - icon = GetIconData(data, ptr + (i * 0xA4)) - if not SIMPLIFY_OUTPUT or icon[0] != 0 or icon[4] > 0: - icons.append(icon) - return icons - -def GetIconName(v): - if v == 0: - return "PAUSE_MAP_MARK_CHEST" - if v == 1: - return "PAUSE_MAP_MARK_BOSS" - if v == -1: - return "PAUSE_MAP_MARK_NONE" - return v - -def GetVtxPointer(v): - if v == 0: - return "NULL" - if v == 0x80830610: - return "sMarkBossVtx" - if v == 0x80830650: - return "sMarkChestVtx" - -def IND(n): - return ' ' * 4 * n - - -scriptDir = os.path.dirname(os.path.realpath(__file__)) -repo = scriptDir + os.sep + ".." + os.sep + ".." - - -kaleido_scope_data = [] -with open(repo + "/baseroms/gc-eu-mq-dbg/segments/ovl_kaleido_scope", "rb") as file: - kaleido_scope_data = bytearray(file.read()) - -scenemaps = [] -i = 0 - -for name, numMaps in SCENES: - maps = [] - for k in range(numMaps): - maps.append(GetSceneMap(kaleido_scope_data, gPauseMapMarkDataTable + (i * 0x1EC))) - i += 1 - scenemaps.append((name, maps)) - -cstr = "" - -cstr += "PauseMapMarksData gPauseMapMarkDataTable[] = {\n" -for scenemap in scenemaps: - for mapId, map in enumerate(scenemap[1]): - cstr += IND(1) + f"// {scenemap[0]} map {mapId}\n" - cstr += IND(1) + "{\n" - for icon in map: - if SIMPLIFY_OUTPUT and icon[0] == -1: - cstr += IND(2) + f"{{ {GetIconName(icon[0])}, 0, NULL, 0, 0, {{ 0 }} }},\n" - else: - cstr += IND(2) + "{\n" - cstr += IND(3) + f"{GetIconName(icon[0])}, {icon[1]}, {GetVtxPointer(icon[2])}, {icon[3]}, {icon[4]},\n" - cstr += IND(3) + "{\n" - for point in icon[5]: - cstr += IND(4) + f"{{ {point[0]}, {point[1]}f, {point[2]}f }},\n" - cstr += IND(3) + "}\n" - cstr += IND(2) + "},\n" - cstr += IND(1) + "},\n" -cstr += "};" - -print(cstr) diff --git a/tools/overlayhelpers/mapmark.py b/tools/overlayhelpers/mapmark.py deleted file mode 100644 index b354bd9d0..000000000 --- a/tools/overlayhelpers/mapmark.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/env python3 -import os -import struct -import sys - -NUM_SCENES = 10 -SIMPLIFY_OUTPUT = True # setting to True reduces the final output by ~9k lines -MAP_MARK_RAM = 0x80858B70 -gMapMarkDataTable = 0x8085F5E8 - -DUNGEON_NAMES = [ - ("DekuTree", "Deku Tree"), - ("DodongosCavern", "Dodongo's Cavern"), - ("JabuJabuBelly", "Jabu-Jabu's Belly"), - ("ForestTemple", "Forest Temple"), - ("FireTemple", "Fire Temple"), - ("WaterTemple", "Water Temple"), - ("SpiritTemple", "Spirit Temple"), - ("ShadowTemple", "Shadow Temple"), - ("BottomWell", "Bottom of the Well"), - ("IceCavern", "Ice Cavern") -] - -HEADER = """\ -#include "global.h" -""" - -def RamToOff(vram): - return vram - MAP_MARK_RAM - -def GetMapPtrs(data): - off = RamToOff(gMapMarkDataTable) - return struct.unpack_from(">10L", data[off:off+(NUM_SCENES * 4)]) - -def GetMapsPerScene(ptrs): - result = [] - endAddr = list(ptrs) - endAddr.append(gMapMarkDataTable) - for i, ptr in enumerate(ptrs): - v = (endAddr[i+1] - ptr) // 0x72 - result.append(v) - return result - -def GetPoints(data, ptr, numPoints): - points = [] - off = RamToOff(ptr) - for i in range(numPoints): - points.append(struct.unpack_from(">bBB", data[off:off+3])) - off = off + 3 - return points - -def GetIconData(data, ptr): - off = RamToOff(ptr) - v = struct.unpack_from(">bB", data[off:off+2]) - points = GetPoints(data, ptr+2, v[1] if SIMPLIFY_OUTPUT else 12) - return [v[0], v[1], points] - -def GetSceneMap(data, ptr): - icons = [] - for i in range(3): - icon = GetIconData(data, ptr + (i * 0x26)) - if not SIMPLIFY_OUTPUT or icon[0] != 0 or icon[1] > 0: - icons.append(icon) - return icons - -def GetSceneMaps(data, ptr, numMaps): - maps = [] - for i in range(numMaps): - maps.append(GetSceneMap(data, ptr + (i * 0x72))) - return maps - -def GetDungeonSymbol(i): - return f"sMapMark{DUNGEON_NAMES[i][0]}" - -def GetDungeonName(i): - return DUNGEON_NAMES[i][1] - -def GetIconName(v): - if v == 0: - return "MAP_MARK_CHEST" - if v == 1: - return "MAP_MARK_BOSS" - if v == -1: - return "MAP_MARK_NONE" - return v - -def IND(n): - return ' ' * 4 * n - - -if len(sys.argv) != 2: - print("Script requires an output filename for the generated .c file") - quit() - -scriptDir = os.path.dirname(os.path.realpath(__file__)) -repo = scriptDir + os.sep + ".." + os.sep + ".." - - -map_mark_data = [] -with open(repo + "/baseroms/gc-eu-mq-dbg/segments/ovl_map_mark_data", "rb") as file: - map_mark_data = bytearray(file.read()) - -scenemaps = [] - -scenemap_ptrs = GetMapPtrs(map_mark_data) -maps_per_scene = GetMapsPerScene(scenemap_ptrs) -for i in range(NUM_SCENES): - scenemaps.append((i, GetSceneMaps(map_mark_data, scenemap_ptrs[i], maps_per_scene[i]))) - -cstr = HEADER - -for scenemap in scenemaps: - cstr += f"MapMarkData {GetDungeonSymbol(scenemap[0])}[] = {{\n" - for mapId, map in enumerate(scenemap[1]): - cstr += IND(1) + f"// {GetDungeonName(scenemap[0])} minimap {mapId}\n" - cstr += IND(1) + "{\n" - for icon in map: - if SIMPLIFY_OUTPUT and icon[0] == -1: - cstr += IND(2) + f"{{ {GetIconName(icon[0])}, 0, {{ 0 }} }},\n" - else: - cstr += IND(2) + "{\n" - cstr += IND(3) + f"{GetIconName(icon[0])}, {icon[1]},\n" - cstr += IND(3) + "{\n" - for point in icon[2]: - cstr += IND(4) + f"{{ {point[0]}, {point[1]}, {point[2]} }},\n" - cstr += IND(3) + "}\n" - cstr += IND(2) + "},\n" - cstr += IND(1) + "},\n" - cstr += "};\n\n" - -cstr += "MapMarkData* gMapMarkDataTable[] = {\n" -for scenemap in scenemaps: - cstr += f" {GetDungeonSymbol(scenemap[0])},\n" -cstr += "};\n" - -with open(sys.argv[1], "w") as file: - file.write(cstr) diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml deleted file mode 100644 index 57c19f3b5..000000000 --- a/tools/permuter_settings.toml +++ /dev/null @@ -1,29 +0,0 @@ -[preserve_macros] -"g[DS]P.*" = "void" -"gDma.*" = "void" -"a[A-Z].*" = "void" -"G_IM_SIZ_.*" = "int" -"G_[AC]C.*" = "int" -LOG = "void" -SET_FULLSCREEN_VIEWPORT = "void" -OPEN_DISPS = "void" -CLOSE_DISPS = "void" -GRAPH_ALLOC = "void*" -LOG_UTILS_CHECK_NULL_POINTER = "void" -PRINTF = "void" -WORK_DISP = "void*" -POLY_OPA_DISP = "void*" -POLY_XLU_DISP = "void*" -OVERLAY_DISP = "void*" -"G_MTX_.*" = "int" -ABS = "int" -SQ = "int" -CLAMP = "int" - -[decompme.compilers] -"tools/ido_recomp/linux/7.1/cc" = "ido7.1" -"tools/ido_recomp/macos/7.1/cc" = "ido7.1" -"tools/ido_recomp/windows/7.1/cc" = "ido7.1" -"tools/ido_recomp/linux/5.3/cc" = "ido5.3" -"tools/ido_recomp/macos/5.3/cc" = "ido5.3" -"tools/ido_recomp/windows/5.3/cc" = "ido5.3" diff --git a/tools/reencode.sh b/tools/reencode.sh new file mode 100755 index 000000000..d027faf5b --- /dev/null +++ b/tools/reencode.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# The repo uses UTF-8 for text encoding, but the strings in the ROM are encoded in EUC-JP. +# This means for matching the source must be re-encoded to EUC-JP before IDO compiles it. +# This is conceptually equivalent to `gcc --finput-charset=UTF-8 --fexec-charset=EUC-JP`, +# except IDO has no equivalent arguments. +# Usage: reencode.sh [compile command minus input file...] [single input file] + +set -e + +# The last argument, the input source file to be compiled +srcfile="${@: -1}" + +# Create a temporary file, and remove it on script exit +tempfile=`mktemp`_oot.c +trap "rm -f $tempfile" EXIT + +# Re-encode from UTF-8 to EUC-JP +{ + printf '#line 1 "%s"\n' "$srcfile" # linemarker + cat "$srcfile" +} | iconv -f UTF-8 -t EUC-JP > "$tempfile" + +# All arguments but the last, forming the compile command +# Also include the source file's directory to have the include path as if we compiled the original source. +# Pass the EUC-JP encoded temporary file for compilation. +"${@:1:$# - 1}" -I `dirname $srcfile` $tempfile diff --git a/tools/sfxconvert.py b/tools/sfxconvert.py deleted file mode 100644 index a125467ae..000000000 --- a/tools/sfxconvert.py +++ /dev/null @@ -1,167 +0,0 @@ -#!/usr/bin/env python3 - -import os -import argparse - -AudioFunctions = {} -Verbose = False -Verbose2 = False - -def set_verbose(v): - global Verbose - global Verbose2 - - Verbose = v - Verbose2 = v - return 1 - -def make_audio_dict(AudioFunctions, repo): - with open(repo + os.sep + 'include' + os.sep + 'functions.h','r') as funcfile: - funcdata = funcfile.readlines() - for i, line in enumerate(funcdata): - if(line.count('sfxId')): - funcname, argnum = get_func_data(funcdata,i) - if(funcname != None): - AudioFunctions[funcname] = argnum - return 1 - -def get_func_data(funcdata,i): - j = i - while(funcdata[j - 1].count(';') == 0): - j -= 1 - k = i + 1 - while(funcdata[k - 1].count(';') == 0): - k += 1 - prototype = "".join(funcdata[j:k]) - argdata = prototype.replace('(',',').replace(')',',').split(',') - funcname = argdata[0].split(' ')[1] - for x in range(len(argdata)): - if(argdata[x].count('sfxId')): - break - if(x == len(argdata) - 1): - print('sfxId not found in ', funcname) - return None,-1 - return funcname, x - 1 - -def lookup_sfx(idnum, repo): - if(type(idnum) is int): - id = '0x' + format(idnum,'X') - elif(idnum.isnumeric()): - id = '0x' + format(int(idnum),'X') - else: - id = idnum - idfix,sfxFlag = fix_sfx_flag(id) - with open(repo + os.sep + 'include' + os.sep + 'sfx.h','r') as sfxfile: - for line in sfxfile: - if(line.count(idfix)): - return line.split(' ')[1] + sfxFlag - return 'INVALID_ID' - -def fix_sfx_flag(id): - if(id.endswith(' - SFX_FLAG')): - splitdata = id.split('-') - return splitdata[0].strip(), ' -' + splitdata[1] - if not(int(id,16) & 0x800): - newid = '0x' + format(int(id,16) + 0x800,'X') - sfxFlag = ' - SFX_FLAG' - else : - newid = id - sfxFlag = '' - return newid,sfxFlag - -def fix_sfx_func(sourcedata, i, j, repo): - data = ''.join(sourcedata[i:j]) - func = data.split('(')[0].strip() - index = data.find(func) - argnum = AudioFunctions.get(func,-1) - if(argnum == -1 or index == -1): - print('Function lookup error at line', i, 'in', func) - return -1 - args = data[index:].replace('(',',').replace(')',',').split(',') - sfxId = args[argnum + 1].strip() - if(sfxId.count('NA_SE') != 0): - return 0 - newId = lookup_sfx(sfxId, repo) - if(newId == 'INVALID_ID'): - print('ID parse error at line', i, 'in', func) - return -2 - for k in range(i, j): - sourcedata[k] = sourcedata[k].replace(sfxId,newId) - if Verbose: - print('Replaced', sfxId, 'with', newId, 'in', func, 'at line', i + 1) - return 1 - -def find_audio_func(line): - audiofuncs = list(AudioFunctions.keys()) - funcname = line.split('(')[0].strip() - for func in audiofuncs: - if(line.count(func)): - return func - return False - -def fix_sfx_all(repo): - global Verbose2 - - tv = Verbose2 - Verbose2 = False - - for subdir, dirs, files in os.walk(repo + os.sep + 'src'): - for filename in files: - if(filename.endswith('.c')): - file = subdir + os.sep + filename - fix_sfx(file, repo) - - Verbose2 = tv - return 1 - -def fix_sfx(file, repo, outfile = None): - if(outfile == None): - outfile = file - make_audio_dict(AudioFunctions, repo) - with open(file,'r',encoding='utf-8') as sourcefile: - sourcedata = sourcefile.readlines() - replacements = set() - j = 0 - lookuperrors = 0 - funcerrors = 0 - iderrors = 0 - fixes = 0 - for i, line in enumerate(sourcedata): - if(i < j): - continue - if(find_audio_func(line)): - j = i - while(sourcedata[j].count(';') == 0): - j += 1 - status = fix_sfx_func(sourcedata, i, j + 1, repo) - if(status == -2): - iderrors += 1 - elif(status == -1): - lookuperrors += 1 - elif(status > 0): - fixes += 1 - if(fixes > 0): - with open(outfile,'w',encoding ='utf-8',newline='\n') as outfile: - outfile.writelines(sourcedata) - if Verbose: - print(file, 'updated') - elif Verbose2: - print('No changes made to', file) - if(lookuperrors > 0): - print('Problem with function lookup. Try formatting functions.h') - if(iderrors > 0): - print('Problem with id parsing. Make sure your SFX ids are in hex.') - return 1 - -parser = argparse.ArgumentParser(description='Convert hex SFX ids to macros') -parser.add_argument('file', help="source file to be processed") -parser.add_argument('repo', help="directory of the decomp repo") -parser.add_argument('-o', metavar='outfile',dest='outfile',help='file to write to instead of original') -parser.add_argument('-v', action='store_true',help='show what changes are made') - -if __name__ == "__main__": - args = parser.parse_args() - set_verbose(args.v) - fix_sfx(args.file, args.repo, outfile=args.outfile) - - diff --git a/tools/spec.c b/tools/spec.c index 3f130b07a..39dd088ec 100644 --- a/tools/spec.c +++ b/tools/spec.c @@ -83,6 +83,10 @@ static bool parse_flags(char *str, unsigned int *flags) f |= FLAG_OBJECT; else if (strcmp(str, "RAW") == 0) f |= FLAG_RAW; + else if (strcmp(str, "NOLOAD") == 0) + f |= FLAG_NOLOAD; + else if (strcmp(str, "SYMS") == 0) + f |= FLAG_SYMS; else return false; diff --git a/tools/spec.h b/tools/spec.h index 8591a6b37..f0a16eeb4 100644 --- a/tools/spec.h +++ b/tools/spec.h @@ -27,6 +27,8 @@ enum { FLAG_BOOT = (1 << 0), FLAG_OBJECT = (1 << 1), FLAG_RAW = (1 << 2), + FLAG_NOLOAD = (1 << 3), + FLAG_SYMS = (1 << 4) }; struct Include { diff --git a/tools/split_out.py b/tools/split_out.py deleted file mode 100644 index 0bc39b4b4..000000000 --- a/tools/split_out.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/python3 - -import os -import sys - - -def search_files(search_path, ext, search_str): - for root, dirs, files in os.walk(search_path): - for file in files: - if file.endswith(ext): - file_path = os.path.join(root, file) - with open(file_path) as f: - file_text = f.read() - if search_str in file_text: - print("Found \"" + search_str + "\" in " + file_path) - return root, file_path, file_text - - -def split_files(file_text, func_search): - s_pos = file_text.index(func_search) - line_pos = file_text.rindex("\n", 0, s_pos) + 1 - chunk = file_text[line_pos:] - new_file = "glabel func_" + func_search[1:-1] + "\n" + chunk - initial_file = file_text[:line_pos] - return initial_file, new_file - - -def main(): - if len(sys.argv) != 2: - print("Usage: ./split_out.py func_ASDFASDF") - return - - func = sys.argv[1] - func_addr = func.replace("func_", "") - func_search = " " + func_addr + " " - - fs_root, fs_path, fs_text = search_files("asm", ".s", func_search) - - initial_file, new_file = split_files(fs_text, func_search) - - print("Removing and replacing " + fs_path) - os.remove(fs_path) - with open(fs_path, "w", newline="\n") as f: - f.write(initial_file) - - new_file_path = os.path.join(fs_root, func + ".s") - print("Creating " + new_file_path) - with open(new_file_path, "w", newline="\n") as f: - f.write(new_file) - - search_path = fs_path.replace("\\", "/") - ps_root, ps_path, ps_text = search_files("src", ".c", search_path) - - print("Splicing new pragma statement into " + ps_path) - with open(ps_path, "r+", newline="\n") as f: - file_text = f.read() - s_pos = file_text.index(search_path) - line_pos = file_text.index("\n", s_pos + 1) - file_text = file_text[0:line_pos] + "\n\n#pragma GLOBAL_ASM(\"" + search_path[:-15] + func + ".s\")" \ - + file_text[line_pos:] - f.seek(0) - f.write(file_text) - f.truncate() - - -main() diff --git a/tools/vt_fmt.py b/tools/vt_fmt.py deleted file mode 100755 index 139ddb7d7..000000000 --- a/tools/vt_fmt.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/python3 - -import argparse -import re - -COLORS = [ - 'BLACK', - 'RED', - 'GREEN', - 'YELLOW', - 'BLUE', - 'PURPLE', - 'CYAN', - 'WHITE', -] - -def re_match(exp, text): - return re.compile(exp).match(text) is not None - -def vt_fmt(text): - curLiteral = False - chars = "" - - i = 0 - while i < len(text): - if text[i:i+5].lower() == '\\x1b[': - if curLiteral: - chars += '\"' - if i > 0: - chars += ' ' - - i += 5 - - code = text[i:text.find('m', i)] - i += len(code) - - if re_match('^4[0-7];3[0-7]$', code): - chars += 'VT_COL(' + COLORS[int(code[1])] + ', ' + COLORS[int(code[4])] + ')' - elif re_match('^4[0-7]$', code): - chars += 'VT_BGCOL(' + COLORS[int(code[1])] + ')' - elif re_match('^3[0-7]$', code): - chars += 'VT_FGCOL(' + COLORS[int(code[1])] + ')' - elif len(code) == 0: - chars += 'VT_RST' - else: - raise Exception('Invalid String') - - curLiteral = False - else: - if not curLiteral: - chars += ' \"' - chars += text[i] - curLiteral = True - - i += 1 - - - if curLiteral: - chars += '\"' - - return chars - - -def main(): - parser = argparse.ArgumentParser(description='Properly formats VT macros') - parser.add_argument('string', help='String to format') - args = parser.parse_args() - - print(vt_fmt(args.string)) - - -if __name__ == "__main__": - main() diff --git a/tools/vtxdis.c b/tools/vtxdis.c deleted file mode 100644 index 86a8d0b2a..000000000 --- a/tools/vtxdis.c +++ /dev/null @@ -1,256 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#define VTXDIS_VER "0.2" - -#define SWAP16(x) (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8)) - -typedef struct { - int16_t pos[3]; /* 0x00 */ - int16_t flag; /* 0x06 */ - int16_t tpos[2]; /* 0x08 */ - uint8_t cn[4]; /* 0x0C */ -} Vtx; /* 0x10 */ - -static char *filename = NULL; -static char *data = NULL; -static int32_t offset = 0; -static int32_t data_len = 0; -static int16_t count = 0; - -static const struct option cmdline_opts[] = { - { "offset", required_argument, NULL, 'o', }, - { "length", required_argument, NULL, 'l', }, - { "file" , required_argument, NULL, 'f', }, - { "version", no_argument, NULL, '~', }, - { "help", no_argument, NULL, '?', }, - { "count", required_argument, NULL, 'c', }, - { 0, 0, 0, 0 }, -}; - -static uint32_t parse_int(const char *num){ - uint32_t ret; - char outnum[21]; - - if(strlen(num) > 2 && num[0] == '0' && (num[1] == 'x' || num[1] == 'X')) { - strncpy(outnum, &num[2], 20); - sscanf(outnum, "%"SCNx32, &ret); - } else if(strlen(num) == 0){ - ret = -1; - } else { - strncpy(outnum, num, 20); - sscanf(outnum, "%"SCNu32, &ret); - } - return ret; - -} - -static inline void print_usage(void) -{ - puts("vtxdis version " VTXDIS_VER "\n" - "Usage:\n" - " vtxdis -f/--file FILE [options]\n" - " vtxdis -?/--help\n" - " vtxdis --version\n" - "Options:\n" - " -f, --file The file path to extract vertex data from.\n" - " -c, --count The number of vertices to extract.\n" - " -l, --length The amount of data to extract vertices from.\n" - " -o, --offset The offset into file to start reading vertex data.\n" - " -?, --help Prints this help message\n" - " --version Prints the current version\n" - ); -} - -static inline void print_version(void){ - puts("Version: " VTXDIS_VER); -} - -static void print_vtx_data(Vtx *vtx, int vtx_cnt) -{ - puts("{"); - for(int i = 0; i < vtx_cnt; i++) - { - Vtx *v = &vtx[i]; - printf(" VTX(%d, %d, %d, %d, %d, %d, %d, %d, %d),\n", v->pos[0], v->pos[1], v->pos[2], v->tpos[0], v->tpos[1], v->cn[0], v->cn[1], v->cn[2], v->cn[3]); - - } - puts("}"); -} - -static void parse_file(void) -{ - unsigned int alloc_size = 0; - struct stat sbuffer; - stat(filename, &sbuffer); - if(errno != 0){ - perror("Count not stat file."); - exit(1); - } - - /* sanity checks */ - if(count > 0) - { - alloc_size = sizeof(Vtx) * count; - if((offset > 0 && (offset + alloc_size) > sbuffer.st_size) || alloc_size > sbuffer.st_size) - { - puts("Requested data is beyond file boundaries."); - exit(1); - } - } - else if(data_len > 0) - { - alloc_size = data_len; - - if((offset > 0 && (offset + alloc_size) > sbuffer.st_size) || alloc_size > sbuffer.st_size) - { - puts("Requested data is beyond file boundaries."); - exit(1); - } - } - else - { - if (offset > 0) - { - alloc_size = sbuffer.st_size - offset; - } - else - { - alloc_size = sbuffer.st_size; - } - } - - if(alloc_size % sizeof(Vtx) != 0) - { - printf("Requested data size is not a multiple of sizeof(Vtx). Requested size is %8x", alloc_size); - exit(1); - } - - FILE *file = fopen(filename, "rb"); - if(!file){ - perror("Could not open file"); - exit(1); - } - - if(offset > 0){ - if(fseek(file, offset, SEEK_SET)){ - perror("Could not seek file"); - fclose(file); - exit(1); - } - } - - Vtx *data = malloc(alloc_size); - if(!data){ - fclose(file); - perror("Could not allocate vtx data"); - exit(1); - } - - if(!fread(data, alloc_size, 1, file)){ - perror("Could not read from file"); - fclose(file); - free(data); - exit(1); - } - - fclose(file); - - unsigned int vtx_cnt = alloc_size / sizeof(Vtx); - for(unsigned int i = 0; i < vtx_cnt; i++){ - Vtx *v = &data[i]; - - v->pos[0] = SWAP16(v->pos[0]); - v->pos[1] = SWAP16(v->pos[1]); - v->pos[2] = SWAP16(v->pos[2]); - v->flag = SWAP16(v->flag); - v->tpos[0] = SWAP16(v->tpos[0]); - v->tpos[1] = SWAP16(v->tpos[1]); - } - - print_vtx_data(data, vtx_cnt); - free(data); -} - -int main(int argc, char **argv) -{ - int opt; - - while(1){ - opt = getopt_long(argc, argv, "o:l:f:c:v?", cmdline_opts, NULL); - if(opt == -1){ - break; - } - switch(opt){ - case 'd': - data = optarg; - break; - case '~': - print_version(); - return 0; - case '?': - print_usage(); - return 0; - case 'l': - data_len = parse_int(optarg); - break; - case 'o': - offset = parse_int(optarg); - break; - case 'f': - filename = optarg; - break; - case 'c': - count = parse_int(optarg); - break; - } - } - - if (filename == NULL && data == NULL) - { - puts("Must specify -f or -d"); - print_usage(); - exit(1); - } - - if(data_len < 0) - { - puts("Invalid -l/--length parameter passed."); - print_usage(); - exit(1); - } - - if(offset < 0) - { - puts("Invalid -o/--offset parameter passed."); - print_usage(); - exit(1); - } - - if(count < 0) - { - puts("Invalid -c/--count parameter passed."); - print_usage(); - exit(1); - } - - if(count > 0 && data_len > 0) - { - puts("Cannot specify both -c/--count and -l/--length."); - print_usage(); - exit(1); - } - - if(filename != NULL) - { - parse_file(); - } - - return 0; -} diff --git a/tools/yaz0.c b/tools/yaz0.c deleted file mode 100644 index 5b3156e44..000000000 --- a/tools/yaz0.c +++ /dev/null @@ -1,238 +0,0 @@ -#include -#include -#include -#include - -#include "yaz0.h" - -// decoder implementation by thakis of http://www.amnoid.de - -// src points to the yaz0 source data (to the "real" source data, not at the header!) -// dst points to a buffer uncompressedSize bytes large (you get uncompressedSize from -// the second 4 bytes in the Yaz0 header). -void yaz0_decode(uint8_t* src, uint8_t* dst, int uncompressedSize) -{ - int srcPlace = 0, dstPlace = 0; // current read/write positions - - unsigned int validBitCount = 0; // number of valid bits left in "code" byte - uint8_t currCodeByte; - while (dstPlace < uncompressedSize) - { - // read new "code" byte if the current one is used up - if (validBitCount == 0) - { - currCodeByte = src[srcPlace]; - ++srcPlace; - validBitCount = 8; - } - - if ((currCodeByte & 0x80) != 0) - { - // straight copy - dst[dstPlace] = src[srcPlace]; - dstPlace++; - srcPlace++; - } - else - { - // RLE part - uint8_t byte1 = src[srcPlace]; - uint8_t byte2 = src[srcPlace + 1]; - srcPlace += 2; - - unsigned int dist = ((byte1 & 0xF) << 8) | byte2; - unsigned int copySource = dstPlace - (dist + 1); - - unsigned int numBytes = byte1 >> 4; - if (numBytes == 0) - { - numBytes = src[srcPlace] + 0x12; - srcPlace++; - } - else - { - numBytes += 2; - } - - // copy run - for (unsigned int i = 0; i < numBytes; ++i) - { - dst[dstPlace] = dst[copySource]; - copySource++; - dstPlace++; - } - } - - // use next bit from "code" byte - currCodeByte <<= 1; - validBitCount -= 1; - } -} - -// encoder implementation by shevious, with bug fixes by notwa - -typedef uint32_t uint32_t; -typedef uint8_t uint8_t; - -#define MAX_RUNLEN (0xFF + 0x12) - -// simple and straight encoding scheme for Yaz0 -static uint32_t simpleEnc(uint8_t *src, int size, int pos, uint32_t *pMatchPos) -{ - int numBytes = 1; - int matchPos = 0; - - int startPos = pos - 0x1000; - int end = size - pos; - - if (startPos < 0) - startPos = 0; - - // maximum runlength for 3 byte encoding - if (end > MAX_RUNLEN) - end = MAX_RUNLEN; - - for (int i = startPos; i < pos; i++) - { - int j; - - for (j = 0; j < end; j++) - { - if (src[i + j] != src[j + pos]) - break; - } - if (j > numBytes) - { - numBytes = j; - matchPos = i; - } - } - - *pMatchPos = matchPos; - - if (numBytes == 2) - numBytes = 1; - - return numBytes; -} - -// a lookahead encoding scheme for ngc Yaz0 -static uint32_t nintendoEnc(uint8_t *src, int size, int pos, uint32_t *pMatchPos) -{ - uint32_t numBytes = 1; - static uint32_t numBytes1; - static uint32_t matchPos; - static int prevFlag = 0; - - // if prevFlag is set, it means that the previous position - // was determined by look-ahead try. - // so just use it. this is not the best optimization, - // but nintendo's choice for speed. - if (prevFlag == 1) - { - *pMatchPos = matchPos; - prevFlag = 0; - return numBytes1; - } - - prevFlag = 0; - numBytes = simpleEnc(src, size, pos, &matchPos); - *pMatchPos = matchPos; - - // if this position is RLE encoded, then compare to copying 1 byte and next position(pos+1) encoding - if (numBytes >= 3) - { - numBytes1 = simpleEnc(src, size, pos + 1, &matchPos); - // if the next position encoding is +2 longer than current position, choose it. - // this does not guarantee the best optimization, but fairly good optimization with speed. - if (numBytes1 >= numBytes + 2) - { - numBytes = 1; - prevFlag = 1; - } - } - return numBytes; -} - -int yaz0_encode(uint8_t *src, uint8_t *dst, int srcSize) -{ - int srcPos = 0; - int dstPos = 0; - int bufPos = 0; - - uint8_t buf[24]; // 8 codes * 3 bytes maximum - - uint32_t validBitCount = 0; // number of valid bits left in "code" byte - uint8_t currCodeByte = 0; // a bitfield, set bits meaning copy, unset meaning RLE - - while (srcPos < srcSize) - { - uint32_t numBytes; - uint32_t matchPos; - - numBytes = nintendoEnc(src, srcSize, srcPos, &matchPos); - if (numBytes < 3) - { - // straight copy - buf[bufPos] = src[srcPos]; - bufPos++; - srcPos++; - //set flag for straight copy - currCodeByte |= (0x80 >> validBitCount); - } - else - { - //RLE part - uint32_t dist = srcPos - matchPos - 1; - uint8_t byte1, byte2, byte3; - - if (numBytes >= 0x12) // 3 byte encoding - { - byte1 = 0 | (dist >> 8); - byte2 = dist & 0xFF; - buf[bufPos++] = byte1; - buf[bufPos++] = byte2; - // maximum runlength for 3 byte encoding - if (numBytes > MAX_RUNLEN) - numBytes = MAX_RUNLEN; - byte3 = numBytes - 0x12; - buf[bufPos++] = byte3; - } - else // 2 byte encoding - { - byte1 = ((numBytes - 2) << 4) | (dist >> 8); - byte2 = dist & 0xFF; - buf[bufPos++] = byte1; - buf[bufPos++] = byte2; - } - srcPos += numBytes; - } - - validBitCount++; - - // write eight codes - if (validBitCount == 8) - { - dst[dstPos++] = currCodeByte; - for (int j = 0; j < bufPos; j++) - dst[dstPos++] = buf[j]; - - currCodeByte = 0; - validBitCount = 0; - bufPos = 0; - } - } - - if (validBitCount > 0) - { - dst[dstPos++] = currCodeByte; - for (int j = 0; j < bufPos; j++) - dst[dstPos++] = buf[j]; - - currCodeByte = 0; - validBitCount = 0; - bufPos = 0; - } - - return dstPos; -} diff --git a/tools/yaz0.h b/tools/yaz0.h deleted file mode 100644 index 0cc3703ec..000000000 --- a/tools/yaz0.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _YAZ0_H_ -#define _YAZ0_H_ - -int yaz0_encode2(uint8_t *src, uint8_t *dest, int uncompressedSize); - -void yaz0_decode(uint8_t* src, uint8_t* dst, int uncompressedSize); - -int yaz0_encode(uint8_t *src, uint8_t *dest, int srcSize); - -#endif // _YAZ0_H_ diff --git a/tools/yaz0tool.c b/tools/yaz0tool.c deleted file mode 100644 index b21468fa2..000000000 --- a/tools/yaz0tool.c +++ /dev/null @@ -1,201 +0,0 @@ -#ifdef __linux__ -#define _POSIX_C_SOURCE 199309L -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "yaz0.h" -#include "util.h" - -// TODO: Windows support -static unsigned long int get_time_milliseconds(void) -{ -#ifdef __linux__ - struct timespec tspec; - - clock_gettime(CLOCK_MONOTONIC, &tspec); - return (tspec.tv_sec * 1000) + tspec.tv_nsec / 1000000; -#else - // dummy - return 0; -#endif -} - -static void print_report(unsigned long int time, size_t compSize, size_t uncompSize) -{ - unsigned int minutes = time / (1000 * 60); - float seconds = (float)(time % (1000 * 60)) / 1000; - - printf("compression ratio: %.2fKiB / %.2fKiB (%.2f%%)\n" - "time: %um %.3fs\n", - (float)compSize / 1024, (float)uncompSize / 1024, - (float)compSize * 100 / (float)uncompSize, - minutes, seconds); -} - -static void compress_file(const char *inputFileName, const char *outputFileName, bool verbose) -{ - size_t uncompSize; - uint8_t *input = util_read_whole_file(inputFileName, &uncompSize); - uint8_t *output = malloc(uncompSize * 2); // TODO: figure out how much space we need - unsigned long int time; - - if (verbose) - { - printf("decompressing %s\n", inputFileName); - time = get_time_milliseconds(); - } - - // compress data - size_t compSize = yaz0_encode(input, output, uncompSize); - - if (verbose) - time = get_time_milliseconds() - time; - - // make Yaz0 header - uint8_t header[16] = {0}; - header[0] = 'Y'; - header[1] = 'a'; - header[2] = 'z'; - header[3] = '0'; - util_write_uint32_be(header + 4, uncompSize); - - // write output file - FILE *outFile = fopen(outputFileName, "wb"); - if (outFile == NULL) - util_fatal_error("failed to open file '%s' for writing", outputFileName); - fwrite(header, sizeof(header), 1, outFile); - fwrite(output, compSize, 1, outFile); - fclose(outFile); - - free(input); - free(output); - - if (verbose) - print_report(time, compSize, uncompSize); -} - -static void decompress_file(const char *inputFileName, const char *outputFileName, bool verbose) -{ - size_t compSize; - uint8_t *input = util_read_whole_file(inputFileName, &compSize); - size_t uncompSize; - uint8_t *output; - unsigned long int time = 0; - - // read header - if (input[0] != 'Y' || input[1] != 'a' || input[2] != 'z' || input[3] != '0') - util_fatal_error("file '%s' does not have a valid Yaz0 header", inputFileName); - uncompSize = util_read_uint32_be(input + 4); - - // decompress data - output = malloc(uncompSize); - - if (verbose) - { - printf("decompressing %s\n", inputFileName); - time = get_time_milliseconds(); - } - - yaz0_decode(input + 16, output, uncompSize); - - if (verbose) - time = get_time_milliseconds() - time; - - // write output file - FILE *outFile = fopen(outputFileName, "wb"); - fwrite(output, uncompSize, 1, outFile); - fclose(outFile); - - free(input); - free(output); - - if (verbose) - print_report(time, compSize, uncompSize); -} - -static void usage(const char *execName) -{ - printf("Yaz0 compressor/decompressor\n" - "usage: %s [-d] [-h] [-v] INPUT_FILE OUTPUT_FILE\n" - "compresses INPUT_FILE using Yaz0 encoding and writes output to OUTPUT_FILE\n" - "Available options:\n" - "-d: decompresses INPUT_FILE, a Yaz0 compressed file, and writes decompressed\n" - " output to OUTPUT_FILE\n" - "-v: prints verbose output (compression ratio and time)\n" - "-h: shows this help message\n", - execName); -} - -int main(int argc, char **argv) -{ - int i; - const char *inputFileName = NULL; - const char *outputFileName = NULL; - bool decompress = false; - bool verbose = false; - - // parse arguments - for (i = 1; i < argc; i++) - { - char *arg = argv[i]; - - if (arg[0] == '-') - { - if (strcmp(arg, "-d") == 0) - decompress = true; - else if (strcmp(arg, "-v") == 0) - verbose = true; - else if (strcmp(arg, "-h") == 0) - { - usage(argv[0]); - return 0; - } - else - { - printf("unknown option %s\n", arg); - usage(argv[0]); - return 1; - } - } - else - { - if (inputFileName == NULL) - inputFileName = arg; - else if (outputFileName == NULL) - outputFileName = arg; - else - { - puts("too many files specified"); - usage(argv[0]); - return 1; - } - } - } - - if (inputFileName == NULL) - { - puts("no input file specified"); - usage(argv[0]); - return 1; - } - if (outputFileName == NULL) - { - puts("no output file specified"); - usage(argv[0]); - return 1; - } - - if (decompress) - decompress_file(inputFileName, outputFileName, verbose); - else - compress_file(inputFileName, outputFileName, verbose); - - return 0; -} diff --git a/tools/z64compress/.editorconfig b/tools/z64compress/.editorconfig new file mode 100644 index 000000000..342ff359c --- /dev/null +++ b/tools/z64compress/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +# Matches multiple files with brace expansion notation +[*.{c,h,ch}] +charset = utf-8 +indent_style = tab +indent_size = 3 +trim_trailing_whitespace = false + +[*.md] +trim_trailing_whitespace = false diff --git a/tools/z64compress/.gitignore b/tools/z64compress/.gitignore new file mode 100644 index 000000000..6a47e0517 --- /dev/null +++ b/tools/z64compress/.gitignore @@ -0,0 +1,3 @@ +bin/ +o/ +z64compress diff --git a/tools/z64compress/LICENSE b/tools/z64compress/LICENSE new file mode 100644 index 000000000..f288702d2 --- /dev/null +++ b/tools/z64compress/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/tools/z64compress/Makefile b/tools/z64compress/Makefile new file mode 100644 index 000000000..7a83c6190 --- /dev/null +++ b/tools/z64compress/Makefile @@ -0,0 +1,49 @@ +CC := gcc +CFLAGS := -DNDEBUG -s -Os -flto -Wall -Wextra + +# Target platform, specify with TARGET= on the command line, linux64 is default. +# Currently supported: linux64, linux32, win32 +TARGET ?= linux64 + +ifeq ($(TARGET),linux32) + TARGET_CFLAGS := -m32 +else ifeq ($(TARGET),win32) +# If using a cross compiler, specify the compiler executable on the command line. +# make TARGET=win32 CC=~/c/mxe/usr/bin/i686-w64-mingw32.static-gcc + TARGET_LIBS := -mconsole -municode +else ifneq ($(TARGET),linux64) + $(error Supported targets: linux64, linux32, win32) +endif + +# Whether to use native optimizations, specify with NATIVE_OPT=0/1 on the command line, default is 0. +# This is not supported by all compilers which is particularly an issue on Mac, and may inhibit tests. +NATIVE_OPT ?= 0 +ifeq ($(NATIVE_OPT),1) + TARGET_CFLAGS += -march=native -mtune=native +endif + +OBJ_DIR := o/$(TARGET) + +$(OBJ_DIR)/src/enc/%.o: CFLAGS := -DNDEBUG -s -Ofast -flto -Wall -Isrc/enc/libdeflate + +SRC_DIRS := $(shell find src -type d) +C_DIRS := $(shell find src -type d -not -path "src/enc/libdeflate/*") +C_FILES := $(foreach dir,$(C_DIRS),$(wildcard $(dir)/*.c)) +C_FILES += src/enc/libdeflate/lib/deflate_compress.c src/enc/libdeflate/lib/utils.c +O_FILES := $(foreach f,$(C_FILES:.c=.o),$(OBJ_DIR)/$f) + +# Make build directories +$(shell mkdir -p $(foreach dir,$(SRC_DIRS),$(OBJ_DIR)/$(dir))) + +.PHONY: all clean + +all: z64compress + +z64compress: $(O_FILES) + $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(O_FILES) -lm -lpthread -lz $(TARGET_LIBS) -o z64compress + +$(OBJ_DIR)/%.o: %.c + $(CC) -c $(TARGET_CFLAGS) $(CFLAGS) $< -o $@ + +clean: + $(RM) -rf z64compress bin o diff --git a/tools/z64compress/README.md b/tools/z64compress/README.md new file mode 100644 index 000000000..4e9a6ba86 --- /dev/null +++ b/tools/z64compress/README.md @@ -0,0 +1,102 @@ +# z64compress + +`z64compress` is a program for compressing Zelda 64 roms: be they retail, hacked traditionally, or custom-built from the [`Ocarina of Time`](https://github.com/zeldaret/oot) or [`Majora's Mask`](https://github.com/zeldaret/mm) reverse engineering projects. It is written in highly efficient C and leverages the power of multithreading to make compression as fast as possible. To reduce overhead on subsequent compressions, an optional cache directory can be specified. + +In addition to the default `yaz`, it supports some faster and more compact algorithms such as `DEFLATE`, `lzo`, `ucl`, and `aplib`. In order to use these, grab patches or code from my [`z64enc` repository](https://github.com/z64me/z64enc). + +If you add an algorithm, please make sure `valgrind` reports no memory leaks or other errors before making a pull request. Thank you! + +(By the way, `valgrind` works better without the `-march=native -mtune=native` optimizations, so turn those off when testing `valgrind`.) + +## Usage +This is a command line application. Learn from these common examples and adapt the arguments to your needs: +``` + compressing oot debug + --in "path/to/in.z64" + --out "path/to/out.z64" + --mb 32 + --codec yaz + --cache "path/to/cache" + --dma "0x12F70,1548" + --compress "9-14,28-END" + --threads 4 + + compressing oot ntsc 1.0 + --in "path/to/in.z64" + --out "path/to/out.z64" + --mb 32 + --codec yaz + --cache "path/to/cache" + --dma "0x7430,1526" + --compress "10-14,27-END" + --threads 4 + + compressing mm usa + --in "path/to/in.z64" + --out "path/to/out.z64" + --mb 32 + --codec yaz + --cache "path/to/cache" + --dma "0x1A500,1568" + --compress "10-14,23,24,31-END" + --skip "1127" + --repack "15-20,22" + --threads 4 +``` + +## Arguments +``` + --in uncompressed input rom + + --out compressed output rom + + --matching attempt matching compression at the cost of + some optimizations and reduced performance + + --mb how many mb the compressed rom should be + + --codec currently supported codecs + yaz + ucl + lzo + zlib + aplib + * to use non-yaz codecs, find patches + and code on my z64enc repo + + --cache is optional and won't be created if + no path is specified (having a cache + makes subsequent compressions faster) + * pro-tip: linux users who don't want a + cache to persist across power cycles + can use the path "/tmp/z64compress" + + --dma specify dmadata address and count + + --compress enable compression on specified files + + --skip disable compression on specified files + + --repack handles Majora's Mask archives + + --threads optional multithreading; + exclude this argument to disable it + + --only-stdout reserve stderr for errors and print + everything else to stdout + + arguments are executed as they + are parsed, so order matters! +``` + +## Building +First, clone the repository and initialize its submodules: +``` +git clone https://github.com/z64me/z64compress.git +cd z64compress +git submodule update --init +``` + +A Makefile-based build system is provided. Choose the target platform with `make TARGET=linux64|linux32|win32`, default is linux64. If building for windows with a cross compiler, specify the compiler executable with `make TARGET=win32 CC=/path/to/executable`. + +Alternatively, I have included shell scripts for building Linux and Windows binaries. Windows binaries are built using a cross compiler ([I recommend `MXE`](https://mxe.cc/)). diff --git a/tools/z64compress/release-linux.sh b/tools/z64compress/release-linux.sh new file mode 100755 index 000000000..bdac70dcc --- /dev/null +++ b/tools/z64compress/release-linux.sh @@ -0,0 +1,14 @@ +# build compression functions (slow) +gcc -DNDEBUG -s -Ofast -flto -lm -c -Wall -march=native -mtune=native src/enc/*.c src/enc/lzo/*.c src/enc/ucl/comp/*.c src/enc/apultra/*.c +mkdir -p o +mv *.o o + +# build everything else +gcc -o z64compress -DNDEBUG src/*.c o/*.o src/enc/libdeflate/lib/deflate_compress.c src/enc/libdeflate/lib/utils.c -Isrc/enc/libdeflate -Wall -Wextra -s -Os -flto -lpthread -lz -march=native -mtune=native + +# move to bin directory +mkdir -p bin/linux64 +mv z64compress bin/linux64 + + + diff --git a/tools/z64compress/release-linux32.sh b/tools/z64compress/release-linux32.sh new file mode 100755 index 000000000..06d829a7d --- /dev/null +++ b/tools/z64compress/release-linux32.sh @@ -0,0 +1,14 @@ +# build compression functions (slow) +gcc -m32 -DNDEBUG -s -Ofast -flto -lm -c -Wall -march=native -mtune=native src/enc/*.c src/enc/lzo/*.c src/enc/ucl/comp/*.c src/enc/apultra/*.c +mkdir -p o +mv *.o o + +# build everything else +gcc -m32 -o z64compress -DNDEBUG src/*.c o/*.o src/enc/libdeflate/lib/deflate_compress.c src/enc/libdeflate/lib/utils.c -Isrc/enc/libdeflate -Wall -Wextra -s -Os -flto -lpthread -lz -march=native -mtune=native + +# move to bin directory +mkdir -p bin/linux32 +mv z64compress bin/linux32 + + + diff --git a/tools/z64compress/release-win32.sh b/tools/z64compress/release-win32.sh new file mode 100755 index 000000000..94fc245c9 --- /dev/null +++ b/tools/z64compress/release-win32.sh @@ -0,0 +1,12 @@ +# build compression functions (slow) +i686-w64-mingw32.static-gcc -DNDEBUG -s -Ofast -flto -lm -c -Wall src/enc/*.c src/enc/lzo/*.c src/enc/ucl/comp/*.c src/enc/apultra/*.c +mkdir -p o +mv *.o o + +# build everything else +i686-w64-mingw32.static-gcc -o z64compress.exe -DNDEBUG src/*.c o/*.o src/enc/libdeflate/lib/deflate_compress.c src/enc/libdeflate/lib/utils.c -Isrc/enc/libdeflate -Wall -Wextra -s -Os -flto -lpthread -lz -mconsole -municode + +# move to bin directory +mkdir -p bin/win32 +mv z64compress.exe bin/win32 + diff --git a/tools/z64compress/src/enc/aplib.c b/tools/z64compress/src/enc/aplib.c new file mode 100644 index 000000000..c2e720a7b --- /dev/null +++ b/tools/z64compress/src/enc/aplib.c @@ -0,0 +1,48 @@ +#include +#include +#include +#include "apultra/libapultra.h" + +static void compression_progress(long long nOriginalSize, long long nCompressedSize) { + /* do nothing */ +} + +int +aplenc( + void *_src + , unsigned src_sz + , void *_dst + , unsigned *dst_sz + , void *_ctx +) +{ + unsigned char *src = _src; + unsigned char *dst = _dst; + int nMaxCompressedSize = apultra_get_max_compressed_size(src_sz); + apultra_stats stats; + + extern int g_hlen; /* header length */ + memset(dst, 0, g_hlen); + memcpy(dst, "APL0", 4); + dst[4] = (src_sz >> 24); + dst[5] = (src_sz >> 16); + dst[6] = (src_sz >> 8); + dst[7] = (src_sz >> 0); + + *dst_sz = apultra_compress( + src + , dst + g_hlen + , src_sz + , nMaxCompressedSize + , 0 /* flags */ + , 0 /* nMaxWindowSize */ + , 0 /* nDictionarySize */ + , compression_progress + , &stats + ); + + *dst_sz = *dst_sz + g_hlen; + + return 0; +} + diff --git a/tools/z64compress/src/enc/apultra/apultra.c b/tools/z64compress/src/enc/apultra/apultra.c new file mode 100644 index 000000000..24dc2b692 --- /dev/null +++ b/tools/z64compress/src/enc/apultra/apultra.c @@ -0,0 +1,1225 @@ +#if 0 +/* + * apultra.c - command line compression utility for the apultra library + * + * Copyright (C) 2019 Emmanuel Marty + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori + * + * Inspired by cap by Sven-Åke Dahl. https://github.com/svendahl/cap + * Also inspired by Charles Bloom's compression blog. http://cbloomrants.blogspot.com/ + * With ideas from LZ4 by Yann Collet. https://github.com/lz4/lz4 + * With help and support from spke + * + */ + +#include +#include +#include +#ifdef _WIN32 +#include +#include +#else +#include +#endif +#include "libapultra.h" + +#define OPT_VERBOSE 1 +#define OPT_STATS 2 +#define OPT_BACKWARD 4 + +#define TOOL_VERSION "1.4.1" + +/*---------------------------------------------------------------------------*/ + +#ifdef _WIN32 +LARGE_INTEGER hpc_frequency; +BOOL hpc_available = FALSE; +#endif + +static void do_init_time() { +#ifdef _WIN32 + hpc_frequency.QuadPart = 0; + hpc_available = QueryPerformanceFrequency(&hpc_frequency); +#endif +} + +static long long do_get_time() { + long long nTime; + +#ifdef _WIN32 + if (hpc_available) { + LARGE_INTEGER nCurTime; + + /* Use HPC hardware for best precision */ + QueryPerformanceCounter(&nCurTime); + nTime = (long long)(nCurTime.QuadPart * 1000000LL / hpc_frequency.QuadPart); + } + else { + struct _timeb tb; + _ftime(&tb); + + nTime = ((long long)tb.time * 1000LL + (long long)tb.millitm) * 1000LL; + } +#else + struct timeval tm; + gettimeofday(&tm, NULL); + + nTime = (long long)tm.tv_sec * 1000000LL + (long long)tm.tv_usec; +#endif + return nTime; +} + +static void do_reverse_buffer(unsigned char *pBuffer, size_t nBufferSize) { + size_t nMidPoint = nBufferSize / 2; + size_t i, j; + + for (i = 0, j = nBufferSize - 1; i < nMidPoint; i++, j--) { + unsigned char c = pBuffer[i]; + pBuffer[i] = pBuffer[j]; + pBuffer[j] = c; + } +} + +/*---------------------------------------------------------------------------*/ + +static void compression_progress(long long nOriginalSize, long long nCompressedSize) { + if (nOriginalSize >= 512 * 1024) { + fprintf(stdout, "\r%lld => %lld (%g %%) \b\b\b\b\b", nOriginalSize, nCompressedSize, (double)(nCompressedSize * 100.0 / nOriginalSize)); + fflush(stdout); + } +} + +static int do_compress(const char *pszInFilename, const char *pszOutFilename, const char *pszDictionaryFilename, const unsigned int nOptions, const unsigned int nMaxWindowSize) { + long long nStartTime = 0LL, nEndTime = 0LL; + size_t nOriginalSize = 0L, nCompressedSize = 0L, nMaxCompressedSize; + int nFlags = 0; + apultra_stats stats; + unsigned char *pDecompressedData; + unsigned char *pCompressedData; + + if (nOptions & OPT_VERBOSE) { + nStartTime = do_get_time(); + } + + FILE* f_dict = NULL; + size_t nDictionarySize = 0; + if (pszDictionaryFilename) { + /* Open the dictionary */ + f_dict = fopen(pszDictionaryFilename, "rb"); + if (!f_dict) { + fprintf(stderr, "error opening dictionary '%s' for reading\n", pszDictionaryFilename); + return 100; + } + + /* Get dictionary size */ + fseek(f_dict, 0, SEEK_END); + nDictionarySize = (size_t)ftell(f_dict); + fseek(f_dict, 0, SEEK_SET); + + if (nDictionarySize > BLOCK_SIZE) nDictionarySize = BLOCK_SIZE; + } + + /* Read the whole original file in memory */ + + FILE *f_in = fopen(pszInFilename, "rb"); + if (!f_in) { + if (f_dict) fclose(f_dict); + fprintf(stderr, "error opening '%s' for reading\n", pszInFilename); + return 100; + } + + fseek(f_in, 0, SEEK_END); + nOriginalSize = (size_t)ftell(f_in); + fseek(f_in, 0, SEEK_SET); + + pDecompressedData = (unsigned char*)malloc(nDictionarySize + nOriginalSize); + if (!pDecompressedData) { + fclose(f_in); + if (f_dict) fclose(f_dict); + fprintf(stderr, "out of memory for reading '%s', %zd bytes needed\n", pszInFilename, nOriginalSize); + return 100; + } + + if (f_dict) { + /* Read dictionary data */ + if (fread(pDecompressedData + ((nOptions & OPT_BACKWARD) ? nOriginalSize : 0), 1, nDictionarySize, f_dict) != nDictionarySize) { + free(pDecompressedData); + fclose(f_in); + fclose(f_dict); + fprintf(stderr, "I/O error while reading dictionary '%s'\n", pszDictionaryFilename); + return 100; + } + + fclose(f_dict); + f_dict = NULL; + } + + /* Read input file data */ + if (fread(pDecompressedData + ((nOptions & OPT_BACKWARD) ? 0 : nDictionarySize), 1, nOriginalSize, f_in) != nOriginalSize) { + free(pDecompressedData); + fclose(f_in); + fprintf(stderr, "I/O error while reading '%s'\n", pszInFilename); + return 100; + } + + fclose(f_in); + + if (nOptions & OPT_BACKWARD) + do_reverse_buffer(pDecompressedData, nDictionarySize + nOriginalSize); + + /* Allocate max compressed size */ + + nMaxCompressedSize = apultra_get_max_compressed_size(nDictionarySize + nOriginalSize); + + pCompressedData = (unsigned char*)malloc(nMaxCompressedSize); + if (!pCompressedData) { + free(pDecompressedData); + fprintf(stderr, "out of memory for compressing '%s', %zd bytes needed\n", pszInFilename, nMaxCompressedSize); + return 100; + } + + memset(pCompressedData, 0, nMaxCompressedSize); + + nCompressedSize = apultra_compress(pDecompressedData, pCompressedData, nDictionarySize + nOriginalSize, nMaxCompressedSize, nFlags, nMaxWindowSize, nDictionarySize, compression_progress, &stats); + + if ((nOptions & OPT_VERBOSE)) { + nEndTime = do_get_time(); + } + + if (nCompressedSize == -1) { + free(pCompressedData); + free(pDecompressedData); + fprintf(stderr, "compression error for '%s'\n", pszInFilename); + return 100; + } + + if (nOptions & OPT_BACKWARD) + do_reverse_buffer(pCompressedData, nCompressedSize); + + if (pszOutFilename) { + FILE *f_out; + + /* Write whole compressed file out */ + + f_out = fopen(pszOutFilename, "wb"); + if (f_out) { + fwrite(pCompressedData, 1, nCompressedSize, f_out); + fclose(f_out); + } + } + + free(pCompressedData); + free(pDecompressedData); + + if ((nOptions & OPT_VERBOSE)) { + double fDelta = ((double)(nEndTime - nStartTime)) / 1000000.0; + double fSpeed = ((double)nOriginalSize / 1048576.0) / fDelta; + fprintf(stdout, "\rCompressed '%s' in %g seconds, %.02g Mb/s, %d tokens (%g bytes/token), %d into %d bytes ==> %g %%\n", + pszInFilename, fDelta, fSpeed, stats.commands_divisor, (double)nOriginalSize / (double)stats.commands_divisor, + (int)nOriginalSize, (int)nCompressedSize, (double)(nCompressedSize * 100.0 / nOriginalSize)); + } + + if (nOptions & OPT_STATS) { + fprintf(stdout, "Tokens: literals: %d short matches: %d normal matches: %d large matches: %d rep matches: %d EOD: %d\n", + stats.num_literals, stats.num_4bit_matches, stats.num_7bit_matches, stats.num_variable_matches, stats.num_rep_matches, stats.num_eod); + if (stats.match_divisor > 0) { + fprintf(stdout, "Offsets: min: %d avg: %d max: %d count: %d\n", stats.min_offset, (int)(stats.total_offsets / (long long)stats.match_divisor), stats.max_offset, stats.match_divisor); + fprintf(stdout, "Match lens: min: %d avg: %d max: %d count: %d\n", stats.min_match_len, stats.total_match_lens / stats.match_divisor, stats.max_match_len, stats.match_divisor); + } + else { + fprintf(stdout, "Offsets: none\n"); + fprintf(stdout, "Match lens: none\n"); + } + if (stats.rle1_divisor > 0) { + fprintf(stdout, "RLE1 lens: min: %d avg: %d max: %d count: %d\n", stats.min_rle1_len, stats.total_rle1_lens / stats.rle1_divisor, stats.max_rle1_len, stats.rle1_divisor); + } + else { + fprintf(stdout, "RLE1 lens: none\n"); + } + if (stats.rle2_divisor > 0) { + fprintf(stdout, "RLE2 lens: min: %d avg: %d max: %d count: %d\n", stats.min_rle2_len, stats.total_rle2_lens / stats.rle2_divisor, stats.max_rle2_len, stats.rle2_divisor); + } + else { + fprintf(stdout, "RLE2 lens: none\n"); + } + fprintf(stdout, "Safe distance: %d (0x%X)\n", stats.safe_dist, stats.safe_dist); + } + return 0; +} + +/*---------------------------------------------------------------------------*/ + +static int do_decompress(const char *pszInFilename, const char *pszOutFilename, const char *pszDictionaryFilename, const unsigned int nOptions) { + long long nStartTime = 0LL, nEndTime = 0LL; + size_t nCompressedSize, nMaxDecompressedSize, nOriginalSize; + unsigned char *pCompressedData; + unsigned char *pDecompressedData; + int nFlags = 0; + + /* Read the whole compressed file in memory */ + + FILE *f_in = fopen(pszInFilename, "rb"); + if (!f_in) { + fprintf(stderr, "error opening '%s' for reading\n", pszInFilename); + return 100; + } + + fseek(f_in, 0, SEEK_END); + nCompressedSize = (size_t)ftell(f_in); + fseek(f_in, 0, SEEK_SET); + + pCompressedData = (unsigned char*)malloc(nCompressedSize); + if (!pCompressedData) { + fclose(f_in); + fprintf(stderr, "out of memory for reading '%s', %zd bytes needed\n", pszInFilename, nCompressedSize); + return 100; + } + + if (fread(pCompressedData, 1, nCompressedSize, f_in) != nCompressedSize) { + free(pCompressedData); + fclose(f_in); + fprintf(stderr, "I/O error while reading '%s'\n", pszInFilename); + return 100; + } + + fclose(f_in); + + if (nOptions & OPT_BACKWARD) + do_reverse_buffer(pCompressedData, nCompressedSize); + + /* Get max decompressed size */ + + nMaxDecompressedSize = apultra_get_max_decompressed_size(pCompressedData, nCompressedSize, nFlags); + if (nMaxDecompressedSize == -1) { + free(pCompressedData); + fprintf(stderr, "invalid compressed format for file '%s'\n", pszInFilename); + return 100; + } + + FILE* f_dict = NULL; + size_t nDictionarySize = 0; + if (pszDictionaryFilename) { + /* Open the dictionary */ + f_dict = fopen(pszDictionaryFilename, "rb"); + if (!f_dict) { + fprintf(stderr, "error opening dictionary '%s' for reading\n", pszDictionaryFilename); + return 100; + } + + /* Get dictionary size */ + fseek(f_dict, 0, SEEK_END); + nDictionarySize = (size_t)ftell(f_dict); + fseek(f_dict, 0, SEEK_SET); + + if (nDictionarySize > BLOCK_SIZE) nDictionarySize = BLOCK_SIZE; + } + + /* Allocate max decompressed size */ + + pDecompressedData = (unsigned char*)malloc(nDictionarySize + nMaxDecompressedSize); + if (!pDecompressedData) { + free(pCompressedData); + if (f_dict) fclose(f_dict); + fprintf(stderr, "out of memory for decompressing '%s', %zd bytes needed\n", pszInFilename, nMaxDecompressedSize); + return 100; + } + + memset(pDecompressedData, 0, nDictionarySize + nMaxDecompressedSize); + + if (f_dict) { + /* Read dictionary data */ + if (fread(pDecompressedData, 1, nDictionarySize, f_dict) != nDictionarySize) { + free(pDecompressedData); + fclose(f_in); + fclose(f_dict); + fprintf(stderr, "I/O error while reading dictionary '%s'\n", pszDictionaryFilename); + return 100; + } + + fclose(f_dict); + f_dict = NULL; + + if (nOptions & OPT_BACKWARD) + do_reverse_buffer(pDecompressedData, nDictionarySize); + } + + if (nOptions & OPT_VERBOSE) { + nStartTime = do_get_time(); + } + + nOriginalSize = apultra_decompress(pCompressedData, pDecompressedData, nCompressedSize, nMaxDecompressedSize, nDictionarySize, nFlags); + if (nOriginalSize == -1) { + free(pDecompressedData); + free(pCompressedData); + + fprintf(stderr, "decompression error for '%s'\n", pszInFilename); + return 100; + } + + if (nOptions & OPT_BACKWARD) + do_reverse_buffer(pDecompressedData + nDictionarySize, nOriginalSize); + + if (pszOutFilename) { + FILE *f_out; + + /* Write whole decompressed file out */ + + f_out = fopen(pszOutFilename, "wb"); + if (f_out) { + fwrite(pDecompressedData + nDictionarySize, 1, nOriginalSize, f_out); + fclose(f_out); + } + } + + free(pDecompressedData); + free(pCompressedData); + + if (nOptions & OPT_VERBOSE) { + nEndTime = do_get_time(); + double fDelta = ((double)(nEndTime - nStartTime)) / 1000000.0; + double fSpeed = ((double)nOriginalSize / 1048576.0) / fDelta; + fprintf(stdout, "Decompressed '%s' in %g seconds, %g Mb/s\n", + pszInFilename, fDelta, fSpeed); + } + + return 0; +} + +/*---------------------------------------------------------------------------*/ + +static int do_compare(const char *pszInFilename, const char *pszOutFilename, const char *pszDictionaryFilename, const unsigned int nOptions) { + long long nStartTime = 0LL, nEndTime = 0LL; + size_t nCompressedSize, nMaxDecompressedSize, nOriginalSize, nDecompressedSize; + unsigned char *pCompressedData = NULL; + unsigned char *pOriginalData = NULL; + unsigned char *pDecompressedData = NULL; + int nFlags = 0; + + /* Read the whole compressed file in memory */ + + FILE *f_in = fopen(pszInFilename, "rb"); + if (!f_in) { + fprintf(stderr, "error opening '%s' for reading\n", pszInFilename); + return 100; + } + + fseek(f_in, 0, SEEK_END); + nCompressedSize = (size_t)ftell(f_in); + fseek(f_in, 0, SEEK_SET); + + pCompressedData = (unsigned char*)malloc(nCompressedSize); + if (!pCompressedData) { + fclose(f_in); + fprintf(stderr, "out of memory for reading '%s', %zd bytes needed\n", pszInFilename, nCompressedSize); + return 100; + } + + if (fread(pCompressedData, 1, nCompressedSize, f_in) != nCompressedSize) { + free(pCompressedData); + fclose(f_in); + fprintf(stderr, "I/O error while reading '%s'\n", pszInFilename); + return 100; + } + + fclose(f_in); + + if (nOptions & OPT_BACKWARD) + do_reverse_buffer(pCompressedData, nCompressedSize); + + /* Read the whole original file in memory */ + + f_in = fopen(pszOutFilename, "rb"); + if (!f_in) { + free(pCompressedData); + fprintf(stderr, "error opening '%s' for reading\n", pszInFilename); + return 100; + } + + fseek(f_in, 0, SEEK_END); + nOriginalSize = (size_t)ftell(f_in); + fseek(f_in, 0, SEEK_SET); + + pOriginalData = (unsigned char*)malloc(nOriginalSize); + if (!pOriginalData) { + fclose(f_in); + free(pCompressedData); + fprintf(stderr, "out of memory for reading '%s', %zd bytes needed\n", pszInFilename, nOriginalSize); + return 100; + } + + if (fread(pOriginalData, 1, nOriginalSize, f_in) != nOriginalSize) { + free(pOriginalData); + fclose(f_in); + free(pCompressedData); + fprintf(stderr, "I/O error while reading '%s'\n", pszInFilename); + return 100; + } + + fclose(f_in); + + /* Get max decompressed size */ + + nMaxDecompressedSize = apultra_get_max_decompressed_size(pCompressedData, nCompressedSize, nFlags); + if (nMaxDecompressedSize == -1) { + free(pOriginalData); + free(pCompressedData); + fprintf(stderr, "invalid compressed format for file '%s'\n", pszInFilename); + return 100; + } + + FILE* f_dict = NULL; + size_t nDictionarySize = 0; + if (pszDictionaryFilename) { + /* Open the dictionary */ + f_dict = fopen(pszDictionaryFilename, "rb"); + if (!f_dict) { + fprintf(stderr, "error opening dictionary '%s' for reading\n", pszDictionaryFilename); + return 100; + } + + /* Get dictionary size */ + fseek(f_dict, 0, SEEK_END); + nDictionarySize = (size_t)ftell(f_dict); + fseek(f_dict, 0, SEEK_SET); + + if (nDictionarySize > BLOCK_SIZE) nDictionarySize = BLOCK_SIZE; + } + + /* Allocate max decompressed size */ + + pDecompressedData = (unsigned char*)malloc(nDictionarySize + nMaxDecompressedSize); + if (!pDecompressedData) { + free(pOriginalData); + free(pCompressedData); + if (f_dict) fclose(f_dict); + fprintf(stderr, "out of memory for decompressing '%s', %zd bytes needed\n", pszInFilename, nMaxDecompressedSize); + return 100; + } + + memset(pDecompressedData, 0, nDictionarySize + nMaxDecompressedSize); + + if (f_dict) { + /* Read dictionary data */ + if (fread(pDecompressedData, 1, nDictionarySize, f_dict) != nDictionarySize) { + free(pDecompressedData); + fclose(f_in); + fclose(f_dict); + fprintf(stderr, "I/O error while reading dictionary '%s'\n", pszDictionaryFilename); + return 100; + } + + fclose(f_dict); + f_dict = NULL; + + if (nOptions & OPT_BACKWARD) + do_reverse_buffer(pDecompressedData, nDictionarySize); + } + + if (nOptions & OPT_VERBOSE) { + nStartTime = do_get_time(); + } + + nDecompressedSize = apultra_decompress(pCompressedData, pDecompressedData, nCompressedSize, nMaxDecompressedSize, nDictionarySize, nFlags); + if (nDecompressedSize == -1) { + free(pDecompressedData); + free(pOriginalData); + free(pCompressedData); + + fprintf(stderr, "decompression error for '%s'\n", pszInFilename); + return 100; + } + + if (nOptions & OPT_BACKWARD) + do_reverse_buffer(pDecompressedData + nDictionarySize, nDecompressedSize); + + if (nDecompressedSize != nOriginalSize || memcmp(pDecompressedData + nDictionarySize, pOriginalData, nOriginalSize)) { + fprintf(stderr, "error comparing compressed file '%s' with original '%s'\n", pszInFilename, pszOutFilename); + return 100; + } + + free(pDecompressedData); + free(pOriginalData); + free(pCompressedData); + + if (nOptions & OPT_VERBOSE) { + nEndTime = do_get_time(); + double fDelta = ((double)(nEndTime - nStartTime)) / 1000000.0; + double fSpeed = ((double)nOriginalSize / 1048576.0) / fDelta; + fprintf(stdout, "Compared '%s' in %g seconds, %g Mb/s\n", + pszInFilename, fDelta, fSpeed); + } + + return 0; +} + +/*---------------------------------------------------------------------------*/ + +static void generate_compressible_data(unsigned char *pBuffer, size_t nBufferSize, unsigned int nSeed, int nNumLiteralValues, float fMatchProbability) { + size_t nIndex = 0; + int nMatchProbability = (int)(fMatchProbability * 1023.0f); + + srand(nSeed); + + if (nIndex >= nBufferSize) return; + pBuffer[nIndex++] = rand() % nNumLiteralValues; + + while (nIndex < nBufferSize) { + if ((rand() & 1023) >= nMatchProbability) { + size_t nLiteralCount = rand() & 127; + if (nLiteralCount > (nBufferSize - nIndex)) + nLiteralCount = nBufferSize - nIndex; + + while (nLiteralCount--) + pBuffer[nIndex++] = rand() % nNumLiteralValues; + } + else { + size_t nMatchLength = MIN_MATCH_SIZE + (rand() & 1023); + size_t nMatchOffset; + + if (nMatchLength > (nBufferSize - nIndex)) + nMatchLength = nBufferSize - nIndex; + if (nMatchLength > nIndex) + nMatchLength = nIndex; + + if (nMatchLength < nIndex) + nMatchOffset = rand() % (nIndex - nMatchLength); + else + nMatchOffset = 0; + + while (nMatchLength--) { + pBuffer[nIndex] = pBuffer[nIndex - nMatchOffset]; + nIndex++; + } + } + } +} + +static void xor_data(unsigned char *pBuffer, size_t nBufferSize, unsigned int nSeed, float fXorProbability) { + size_t nIndex = 0; + int nXorProbability = (int)(fXorProbability * 1023.0f); + + srand(nSeed); + + if (nIndex >= nBufferSize) return; + + while (nIndex < nBufferSize) { + if ((rand() & 1023) < nXorProbability) { + pBuffer[nIndex] ^= 0xff; + } + nIndex++; + } +} + +static int do_self_test(const unsigned int nOptions, const unsigned int nMaxWindowSize, const int nIsQuickTest) { + unsigned char *pGeneratedData; + unsigned char *pCompressedData; + unsigned char *pTmpCompressedData; + unsigned char *pTmpDecompressedData; + size_t nGeneratedDataSize; + size_t nMaxCompressedDataSize; + unsigned int nSeed = 123; + int nFlags = 0; + int i; + + pGeneratedData = (unsigned char*)malloc(4 * BLOCK_SIZE); + if (!pGeneratedData) { + fprintf(stderr, "out of memory, %d bytes needed\n", 4 * BLOCK_SIZE); + return 100; + } + + nMaxCompressedDataSize = apultra_get_max_compressed_size(4 * BLOCK_SIZE); + pCompressedData = (unsigned char*)malloc(nMaxCompressedDataSize); + if (!pCompressedData) { + free(pGeneratedData); + pGeneratedData = NULL; + + fprintf(stderr, "out of memory, %zd bytes needed\n", nMaxCompressedDataSize); + return 100; + } + + pTmpCompressedData = (unsigned char*)malloc(nMaxCompressedDataSize); + if (!pTmpCompressedData) { + free(pCompressedData); + pCompressedData = NULL; + free(pGeneratedData); + pGeneratedData = NULL; + + fprintf(stderr, "out of memory, %zd bytes needed\n", nMaxCompressedDataSize); + return 100; + } + + pTmpDecompressedData = (unsigned char*)malloc(4 * BLOCK_SIZE); + if (!pTmpDecompressedData) { + free(pTmpCompressedData); + pTmpCompressedData = NULL; + free(pCompressedData); + pCompressedData = NULL; + free(pGeneratedData); + pGeneratedData = NULL; + + fprintf(stderr, "out of memory, %d bytes needed\n", 4 * BLOCK_SIZE); + return 100; + } + + memset(pGeneratedData, 0, 4 * BLOCK_SIZE); + memset(pCompressedData, 0, nMaxCompressedDataSize); + memset(pTmpCompressedData, 0, nMaxCompressedDataSize); + + /* Test compressing with a too small buffer to do anything, expect to fail cleanly */ + for (i = 0; i < 12; i++) { + generate_compressible_data(pGeneratedData, i, nSeed, 256, 0.5f); + apultra_compress(pGeneratedData, pCompressedData, i, i, nFlags, nMaxWindowSize, 0 /* dictionary size */, NULL, NULL); + } + + size_t nDataSizeStep = 128; + float fProbabilitySizeStep = nIsQuickTest ? 0.005f : 0.0005f; + + for (nGeneratedDataSize = 1024; nGeneratedDataSize <= (nIsQuickTest ? 1024U : (4U * BLOCK_SIZE)); nGeneratedDataSize += nDataSizeStep) { + float fMatchProbability; + + fprintf(stdout, "size %zd", nGeneratedDataSize); + for (fMatchProbability = 0; fMatchProbability <= 0.995f; fMatchProbability += fProbabilitySizeStep) { + int nNumLiteralValues[12] = { 1, 2, 3, 15, 30, 56, 96, 137, 178, 191, 255, 256 }; + float fXorProbability; + + fputc('.', stdout); + fflush(stdout); + + for (i = 0; i < 12; i++) { + /* Generate data to compress */ + generate_compressible_data(pGeneratedData, nGeneratedDataSize, nSeed, nNumLiteralValues[i], fMatchProbability); + + /* Try to compress it, expected to succeed */ + size_t nActualCompressedSize = apultra_compress(pGeneratedData, pCompressedData, nGeneratedDataSize, apultra_get_max_compressed_size(nGeneratedDataSize), + nFlags, nMaxWindowSize, 0 /* dictionary size */, NULL, NULL); + if (nActualCompressedSize == -1 || nActualCompressedSize < (1 + 1 + 1 /* footer */)) { + free(pTmpDecompressedData); + pTmpDecompressedData = NULL; + free(pTmpCompressedData); + pTmpCompressedData = NULL; + free(pCompressedData); + pCompressedData = NULL; + free(pGeneratedData); + pGeneratedData = NULL; + + fprintf(stderr, "\nself-test: error compressing size %zd, seed %d, match probability %f, literals range %d\n", nGeneratedDataSize, nSeed, fMatchProbability, nNumLiteralValues[i]); + return 100; + } + + /* Try to decompress it, expected to succeed */ + size_t nActualDecompressedSize; + nActualDecompressedSize = apultra_decompress(pCompressedData, pTmpDecompressedData, nActualCompressedSize, nGeneratedDataSize, 0 /* dictionary size */, nFlags); + if (nActualDecompressedSize == -1) { + free(pTmpDecompressedData); + pTmpDecompressedData = NULL; + free(pTmpCompressedData); + pTmpCompressedData = NULL; + free(pCompressedData); + pCompressedData = NULL; + free(pGeneratedData); + pGeneratedData = NULL; + + fprintf(stderr, "\nself-test: error decompressing size %zd, seed %d, match probability %f, literals range %d\n", nGeneratedDataSize, nSeed, fMatchProbability, nNumLiteralValues[i]); + return 100; + } + + if (memcmp(pGeneratedData, pTmpDecompressedData, nGeneratedDataSize)) { + free(pTmpDecompressedData); + pTmpDecompressedData = NULL; + free(pTmpCompressedData); + pTmpCompressedData = NULL; + free(pCompressedData); + pCompressedData = NULL; + free(pGeneratedData); + pGeneratedData = NULL; + + fprintf(stderr, "\nself-test: error comparing decompressed and original data, size %zd, seed %d, match probability %f, literals range %d\n", nGeneratedDataSize, nSeed, fMatchProbability, nNumLiteralValues[i]); + return 100; + } + + /* Try to decompress corrupted data, expected to fail cleanly, without crashing or corrupting memory outside the output buffer */ + for (fXorProbability = 0.05f; fXorProbability <= 0.5f; fXorProbability += 0.05f) { + memcpy(pTmpCompressedData, pCompressedData, nActualCompressedSize); + xor_data(pTmpCompressedData, nActualCompressedSize, nSeed, fXorProbability); + apultra_decompress(pTmpCompressedData, pGeneratedData, nActualCompressedSize, nGeneratedDataSize, 0 /* dictionary size */, nFlags); + } + } + + nSeed++; + } + + fputc(10, stdout); + fflush(stdout); + + nDataSizeStep <<= 1; + if (nDataSizeStep > (128 * 4096)) + nDataSizeStep = 128 * 4096; + fProbabilitySizeStep *= 1.25; + if (fProbabilitySizeStep > (0.0005f * 4096)) + fProbabilitySizeStep = 0.0005f * 4096; + } + + free(pTmpDecompressedData); + pTmpDecompressedData = NULL; + + free(pTmpCompressedData); + pTmpCompressedData = NULL; + + free(pCompressedData); + pCompressedData = NULL; + + free(pGeneratedData); + pGeneratedData = NULL; + + fprintf(stdout, "All tests passed.\n"); + return 0; +} + +/*---------------------------------------------------------------------------*/ + +static int do_compr_benchmark(const char *pszInFilename, const char *pszOutFilename, const char *pszDictionaryFilename, const unsigned int nOptions, const unsigned int nMaxWindowSize) { + size_t nFileSize, nMaxCompressedSize; + unsigned char *pFileData; + unsigned char *pCompressedData; + int nFlags = 0; + int i; + + if (pszDictionaryFilename) { + fprintf(stderr, "in-memory benchmarking does not support dictionaries\n"); + return 100; + } + + /* Read the whole original file in memory */ + + FILE *f_in = fopen(pszInFilename, "rb"); + if (!f_in) { + fprintf(stderr, "error opening '%s' for reading\n", pszInFilename); + return 100; + } + + fseek(f_in, 0, SEEK_END); + nFileSize = (size_t)ftell(f_in); + fseek(f_in, 0, SEEK_SET); + + pFileData = (unsigned char*)malloc(nFileSize); + if (!pFileData) { + fclose(f_in); + fprintf(stderr, "out of memory for reading '%s', %zd bytes needed\n", pszInFilename, nFileSize); + return 100; + } + + if (fread(pFileData, 1, nFileSize, f_in) != nFileSize) { + free(pFileData); + fclose(f_in); + fprintf(stderr, "I/O error while reading '%s'\n", pszInFilename); + return 100; + } + + fclose(f_in); + + if (nOptions & OPT_BACKWARD) + do_reverse_buffer(pFileData, nFileSize); + + /* Allocate max compressed size */ + + nMaxCompressedSize = apultra_get_max_compressed_size(nFileSize); + + pCompressedData = (unsigned char*)malloc(nMaxCompressedSize + 2048); + if (!pCompressedData) { + free(pFileData); + fprintf(stderr, "out of memory for compressing '%s', %zd bytes needed\n", pszInFilename, nMaxCompressedSize); + return 100; + } + + memset(pCompressedData + 1024, 0, nMaxCompressedSize); + + long long nBestCompTime = -1; + + size_t nActualCompressedSize = 0; + size_t nRightGuardPos = nMaxCompressedSize; + + for (i = 0; i < 5; i++) { + unsigned char nGuard = 0x33 + i; + int j; + + /* Write guard bytes around the output buffer, to help check for writes outside of it by the compressor */ + memset(pCompressedData, nGuard, 1024); + memset(pCompressedData + 1024 + nRightGuardPos, nGuard, 1024); + + long long t0 = do_get_time(); + nActualCompressedSize = apultra_compress(pFileData, pCompressedData + 1024, nFileSize, nRightGuardPos, nFlags, nMaxWindowSize, 0 /* dictionary size */, NULL, NULL); + long long t1 = do_get_time(); + if (nActualCompressedSize == -1) { + free(pCompressedData); + free(pFileData); + fprintf(stderr, "compression error\n"); + return 100; + } + + long long nCurDecTime = t1 - t0; + if (nBestCompTime == -1 || nBestCompTime > nCurDecTime) + nBestCompTime = nCurDecTime; + + /* Check guard bytes before the output buffer */ + for (j = 0; j < 1024; j++) { + if (pCompressedData[j] != nGuard) { + free(pCompressedData); + free(pFileData); + fprintf(stderr, "error, wrote outside of output buffer at %d!\n", j - 1024); + return 100; + } + } + + /* Check guard bytes after the output buffer */ + for (j = 0; j < 1024; j++) { + if (pCompressedData[1024 + nRightGuardPos + j] != nGuard) { + free(pCompressedData); + free(pFileData); + fprintf(stderr, "error, wrote outside of output buffer at %d!\n", j); + return 100; + } + } + + nRightGuardPos = nActualCompressedSize; + } + + if (nOptions & OPT_BACKWARD) + do_reverse_buffer(pCompressedData + 1024, nActualCompressedSize); + + if (pszOutFilename) { + FILE *f_out; + + /* Write whole compressed file out */ + + f_out = fopen(pszOutFilename, "wb"); + if (f_out) { + fwrite(pCompressedData + 1024, 1, nActualCompressedSize, f_out); + fclose(f_out); + } + } + + free(pCompressedData); + free(pFileData); + + fprintf(stdout, "compressed size: %zd bytes\n", nActualCompressedSize); + fprintf(stdout, "compression time: %lld microseconds (%g Mb/s)\n", nBestCompTime, ((double)nActualCompressedSize / 1024.0) / ((double)nBestCompTime / 1000.0)); + + return 0; +} + +/*---------------------------------------------------------------------------*/ + +static int do_dec_benchmark(const char *pszInFilename, const char *pszOutFilename, const char *pszDictionaryFilename, const unsigned int nOptions) { + size_t nFileSize, nMaxDecompressedSize; + unsigned char *pFileData; + unsigned char *pDecompressedData; + int nFlags = 0; + int i; + + if (pszDictionaryFilename) { + fprintf(stderr, "in-memory benchmarking does not support dictionaries\n"); + return 100; + } + + /* Read the whole compressed file in memory */ + + FILE *f_in = fopen(pszInFilename, "rb"); + if (!f_in) { + fprintf(stderr, "error opening '%s' for reading\n", pszInFilename); + return 100; + } + + fseek(f_in, 0, SEEK_END); + nFileSize = (size_t)ftell(f_in); + fseek(f_in, 0, SEEK_SET); + + pFileData = (unsigned char*)malloc(nFileSize); + if (!pFileData) { + fclose(f_in); + fprintf(stderr, "out of memory for reading '%s', %zd bytes needed\n", pszInFilename, nFileSize); + return 100; + } + + if (fread(pFileData, 1, nFileSize, f_in) != nFileSize) { + free(pFileData); + fclose(f_in); + fprintf(stderr, "I/O error while reading '%s'\n", pszInFilename); + return 100; + } + + fclose(f_in); + + if (nOptions & OPT_BACKWARD) + do_reverse_buffer(pFileData, nFileSize); + + /* Allocate max decompressed size */ + + nMaxDecompressedSize = apultra_get_max_decompressed_size(pFileData, nFileSize, nFlags); + if (nMaxDecompressedSize == -1) { + free(pFileData); + fprintf(stderr, "invalid compressed format for file '%s'\n", pszInFilename); + return 100; + } + + pDecompressedData = (unsigned char*)malloc(nMaxDecompressedSize); + if (!pDecompressedData) { + free(pFileData); + fprintf(stderr, "out of memory for decompressing '%s', %zd bytes needed\n", pszInFilename, nMaxDecompressedSize); + return 100; + } + + memset(pDecompressedData, 0, nMaxDecompressedSize); + + long long nBestDecTime = -1; + + size_t nActualDecompressedSize = 0; + for (i = 0; i < 50; i++) { + long long t0 = do_get_time(); + nActualDecompressedSize = apultra_decompress(pFileData, pDecompressedData, nFileSize, nMaxDecompressedSize, 0 /* dictionary size */, nFlags); + long long t1 = do_get_time(); + if (nActualDecompressedSize == -1) { + free(pDecompressedData); + free(pFileData); + fprintf(stderr, "decompression error\n"); + return 100; + } + + long long nCurDecTime = t1 - t0; + if (nBestDecTime == -1 || nBestDecTime > nCurDecTime) + nBestDecTime = nCurDecTime; + } + + if (nOptions & OPT_BACKWARD) + do_reverse_buffer(pDecompressedData, nActualDecompressedSize); + + if (pszOutFilename) { + FILE *f_out; + + /* Write whole decompressed file out */ + + f_out = fopen(pszOutFilename, "wb"); + if (f_out) { + fwrite(pDecompressedData, 1, nActualDecompressedSize, f_out); + fclose(f_out); + } + } + + free(pDecompressedData); + free(pFileData); + + fprintf(stdout, "decompressed size: %zd bytes\n", nActualDecompressedSize); + fprintf(stdout, "decompression time: %lld microseconds (%g Mb/s)\n", nBestDecTime, ((double)nActualDecompressedSize / 1024.0) / ((double)nBestDecTime / 1000.0)); + + return 0; +} + +/*---------------------------------------------------------------------------*/ + +int main(int argc, char **argv) { + int i; + const char *pszInFilename = NULL; + const char *pszOutFilename = NULL; + const char *pszDictionaryFilename = NULL; + int nArgsError = 0; + int nCommandDefined = 0; + int nVerifyCompression = 0; + char cCommand = 'z'; + unsigned int nOptions = 0; + unsigned int nMaxWindowSize = 0; + + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-d")) { + if (!nCommandDefined) { + nCommandDefined = 1; + cCommand = 'd'; + } + else + nArgsError = 1; + } + else if (!strcmp(argv[i], "-z")) { + if (!nCommandDefined) { + nCommandDefined = 1; + cCommand = 'z'; + } + else + nArgsError = 1; + } + else if (!strcmp(argv[i], "-c")) { + if (!nVerifyCompression) { + nVerifyCompression = 1; + } + else + nArgsError = 1; + } + else if (!strcmp(argv[i], "-cbench")) { + if (!nCommandDefined) { + nCommandDefined = 1; + cCommand = 'B'; + } + else + nArgsError = 1; + } + else if (!strcmp(argv[i], "-dbench")) { + if (!nCommandDefined) { + nCommandDefined = 1; + cCommand = 'b'; + } + else + nArgsError = 1; + } + else if (!strcmp(argv[i], "-test")) { + if (!nCommandDefined) { + nCommandDefined = 1; + cCommand = 't'; + } + else + nArgsError = 1; + } + else if (!strcmp(argv[i], "-quicktest")) { + if (!nCommandDefined) { + nCommandDefined = 1; + cCommand = 'T'; + } + else + nArgsError = 1; + } + else if (!strcmp(argv[i], "-D")) { + if (!pszDictionaryFilename && (i + 1) < argc) { + pszDictionaryFilename = argv[i + 1]; + i++; + } + else + nArgsError = 1; + } + else if (!strncmp(argv[i], "-D", 2)) { + if (!pszDictionaryFilename) { + pszDictionaryFilename = argv[i] + 2; + } + else + nArgsError = 1; + } + else if (!strcmp(argv[i], "-v")) { + if ((nOptions & OPT_VERBOSE) == 0) { + nOptions |= OPT_VERBOSE; + } + else + nArgsError = 1; + } + else if (!strcmp(argv[i], "-w")) { + if (!nMaxWindowSize && (i + 1) < argc) { + char *pEnd = NULL; + nMaxWindowSize = (int)strtol(argv[i + 1], &pEnd, 10); + if (pEnd && pEnd != argv[i + 1] && (nMaxWindowSize >= 16 && nMaxWindowSize <= 0x200000)) { + i++; + } + else { + nArgsError = 1; + } + } + else + nArgsError = 1; + } + else if (!strncmp(argv[i], "-w", 2)) { + if (!nMaxWindowSize) { + char *pEnd = NULL; + nMaxWindowSize = (int)strtol(argv[i] + 2, &pEnd, 10); + if (!(pEnd && pEnd != (argv[i] + 2) && (nMaxWindowSize >= 16 && nMaxWindowSize <= 0x200000))) { + nArgsError = 1; + } + } + else + nArgsError = 1; + } + else if (!strcmp(argv[i], "-stats")) { + if ((nOptions & OPT_STATS) == 0) { + nOptions |= OPT_STATS; + } + else + nArgsError = 1; + } + else if (!strcmp(argv[i], "-b")) { + if ((nOptions & OPT_BACKWARD) == 0) { + nOptions |= OPT_BACKWARD; + } + else + nArgsError = 1; + } + else { + if (!pszInFilename) + pszInFilename = argv[i]; + else { + if (!pszOutFilename) + pszOutFilename = argv[i]; + else + nArgsError = 1; + } + } + } + + if (!nArgsError && cCommand == 't') { + return do_self_test(nOptions, nMaxWindowSize, 0); + } + else if (!nArgsError && cCommand == 'T') { + return do_self_test(nOptions, nMaxWindowSize, 1); + } + + if (nArgsError || !pszInFilename || !pszOutFilename) { + fprintf(stderr, "apultra command-line tool v" TOOL_VERSION " by Emmanuel Marty and spke\n"); + fprintf(stderr, "usage: %s [-c] [-d] [-v] [-b] \n", argv[0]); + fprintf(stderr, " -c: check resulting stream after compressing\n"); + fprintf(stderr, " -d: decompress (default: compress)\n"); + fprintf(stderr, " -b: backwards compression or decompression\n"); + fprintf(stderr, " -w : maximum window size, in bytes (16..2097152), defaults to maximum\n"); + fprintf(stderr, " -D : use dictionary file\n"); + fprintf(stderr, " -cbench: benchmark in-memory compression\n"); + fprintf(stderr, " -dbench: benchmark in-memory decompression\n"); + fprintf(stderr, " -test: run full automated self-tests\n"); + fprintf(stderr, "-quicktest: run quick automated self-tests\n"); + fprintf(stderr, " -stats: show compressed data stats\n"); + fprintf(stderr, " -v: be verbose\n"); + return 100; + } + + do_init_time(); + + if (cCommand == 'z') { + int nResult = do_compress(pszInFilename, pszOutFilename, pszDictionaryFilename, nOptions, nMaxWindowSize); + if (nResult == 0 && nVerifyCompression) { + return do_compare(pszOutFilename, pszInFilename, pszDictionaryFilename, nOptions); + } else { + return nResult; + } + } + else if (cCommand == 'd') { + return do_decompress(pszInFilename, pszOutFilename, pszDictionaryFilename, nOptions); + } + else if (cCommand == 'B') { + return do_compr_benchmark(pszInFilename, pszOutFilename, pszDictionaryFilename, nOptions, nMaxWindowSize); + } + else if (cCommand == 'b') { + return do_dec_benchmark(pszInFilename, pszOutFilename, pszDictionaryFilename, nOptions); + } + else { + return 100; + } +} +#endif diff --git a/tools/z64compress/src/enc/apultra/divsufsort.c b/tools/z64compress/src/enc/apultra/divsufsort.c new file mode 100644 index 000000000..3a1c75304 --- /dev/null +++ b/tools/z64compress/src/enc/apultra/divsufsort.c @@ -0,0 +1,460 @@ +/* + * divsufsort.c for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "divsufsort_private.h" +#ifdef _OPENMP +# include +#endif + + +/*- Private Functions -*/ + +/* Sorts suffixes of type B*. */ +static +saidx_t +sort_typeBstar(const sauchar_t *T, saidx_t *SA, + saidx_t *bucket_A, saidx_t *bucket_B, + saidx_t n) { + saidx_t *PAb, *ISAb, *buf; +#ifdef _OPENMP + saidx_t *curbuf; + saidx_t l; +#endif + saidx_t i, j, k, t, m, bufsize; + saint_t c0, c1; +#ifdef _OPENMP + saint_t d0, d1; + int tmp; +#endif + + /* Initialize bucket arrays. */ + for(i = 0; i < BUCKET_A_SIZE; ++i) { bucket_A[i] = 0; } + for(i = 0; i < BUCKET_B_SIZE; ++i) { bucket_B[i] = 0; } + + /* Count the number of occurrences of the first one or two characters of each + type A, B and B* suffix. Moreover, store the beginning position of all + type B* suffixes into the array SA. */ + for(i = n - 1, m = n, c0 = T[n - 1]; 0 <= i;) { + /* type A suffix. */ + do { ++BUCKET_A(c1 = c0); } while((0 <= --i) && ((c0 = T[i]) >= c1)); + if(0 <= i) { + /* type B* suffix. */ + ++BUCKET_BSTAR(c0, c1); + SA[--m] = i; + /* type B suffix. */ + for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) <= c1); --i, c1 = c0) { + ++BUCKET_B(c0, c1); + } + } + } + m = n - m; +/* +note: + A type B* suffix is lexicographically smaller than a type B suffix that + begins with the same first two characters. +*/ + + /* Calculate the index of start/end point of each bucket. */ + for(c0 = 0, i = 0, j = 0; c0 < ALPHABET_SIZE; ++c0) { + t = i + BUCKET_A(c0); + BUCKET_A(c0) = i + j; /* start point */ + i = t + BUCKET_B(c0, c0); + for(c1 = c0 + 1; c1 < ALPHABET_SIZE; ++c1) { + j += BUCKET_BSTAR(c0, c1); + BUCKET_BSTAR(c0, c1) = j; /* end point */ + i += BUCKET_B(c0, c1); + } + } + + if(0 < m) { + /* Sort the type B* suffixes by their first two characters. */ + PAb = SA + n - m; ISAb = SA + m; + for(i = m - 2; 0 <= i; --i) { + t = PAb[i], c0 = T[t], c1 = T[t + 1]; + SA[--BUCKET_BSTAR(c0, c1)] = i; + } + t = PAb[m - 1], c0 = T[t], c1 = T[t + 1]; + SA[--BUCKET_BSTAR(c0, c1)] = m - 1; + + /* Sort the type B* substrings using sssort. */ +#ifdef _OPENMP + tmp = omp_get_max_threads(); + buf = SA + m, bufsize = (n - (2 * m)) / tmp; + c0 = ALPHABET_SIZE - 2, c1 = ALPHABET_SIZE - 1, j = m; +#pragma omp parallel default(shared) private(curbuf, k, l, d0, d1, tmp) + { + tmp = omp_get_thread_num(); + curbuf = buf + tmp * bufsize; + k = 0; + for(;;) { + #pragma omp critical(sssort_lock) + { + if(0 < (l = j)) { + d0 = c0, d1 = c1; + do { + k = BUCKET_BSTAR(d0, d1); + if(--d1 <= d0) { + d1 = ALPHABET_SIZE - 1; + if(--d0 < 0) { break; } + } + } while(((l - k) <= 1) && (0 < (l = k))); + c0 = d0, c1 = d1, j = k; + } + } + if(l == 0) { break; } + sssort(T, PAb, SA + k, SA + l, + curbuf, bufsize, 2, n, *(SA + k) == (m - 1)); + } + } +#else + buf = SA + m, bufsize = n - (2 * m); + for(c0 = ALPHABET_SIZE - 2, j = m; 0 < j; --c0) { + for(c1 = ALPHABET_SIZE - 1; c0 < c1; j = i, --c1) { + i = BUCKET_BSTAR(c0, c1); + if(1 < (j - i)) { + sssort(T, PAb, SA + i, SA + j, + buf, bufsize, 2, n, *(SA + i) == (m - 1)); + } + } + } +#endif + + /* Compute ranks of type B* substrings. */ + for(i = m - 1; 0 <= i; --i) { + if(0 <= SA[i]) { + j = i; + do { ISAb[SA[i]] = i; } while((0 <= --i) && (0 <= SA[i])); + SA[i + 1] = i - j; + if(i <= 0) { break; } + } + j = i; + do { ISAb[SA[i] = ~SA[i]] = j; } while(SA[--i] < 0); + ISAb[SA[i]] = j; + } + + /* Construct the inverse suffix array of type B* suffixes using trsort. */ + trsort(ISAb, SA, m, 1); + + /* Set the sorted order of tyoe B* suffixes. */ + for(i = n - 1, j = m, c0 = T[n - 1]; 0 <= i;) { + for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) >= c1); --i, c1 = c0) { } + if(0 <= i) { + t = i; + for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) <= c1); --i, c1 = c0) { } + SA[ISAb[--j]] = ((t == 0) || (1 < (t - i))) ? t : ~t; + } + } + + /* Calculate the index of start/end point of each bucket. */ + BUCKET_B(ALPHABET_SIZE - 1, ALPHABET_SIZE - 1) = n; /* end point */ + for(c0 = ALPHABET_SIZE - 2, k = m - 1; 0 <= c0; --c0) { + i = BUCKET_A(c0 + 1) - 1; + for(c1 = ALPHABET_SIZE - 1; c0 < c1; --c1) { + t = i - BUCKET_B(c0, c1); + BUCKET_B(c0, c1) = i; /* end point */ + + /* Move all type B* suffixes to the correct position. */ + for(i = t, j = BUCKET_BSTAR(c0, c1); + j <= k; + --i, --k) { SA[i] = SA[k]; } + } + BUCKET_BSTAR(c0, c0 + 1) = i - BUCKET_B(c0, c0) + 1; /* start point */ + BUCKET_B(c0, c0) = i; /* end point */ + } + } + + return m; +} + +/* Constructs the suffix array by using the sorted order of type B* suffixes. */ +static +void +construct_SA(const sauchar_t *T, saidx_t *SA, + saidx_t *bucket_A, saidx_t *bucket_B, + saidx_t n, saidx_t m) { + saidx_t *i, *j, *k; + saidx_t s; + saint_t c0, c1, c2; + + if(0 < m) { + /* Construct the sorted order of type B suffixes by using + the sorted order of type B* suffixes. */ + for(c1 = ALPHABET_SIZE - 2; 0 <= c1; --c1) { + /* Scan the suffix array from right to left. */ + for(i = SA + BUCKET_BSTAR(c1, c1 + 1), + j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1; + i <= j; + --j) { + if(0 < (s = *j)) { + assert(T[s] == c1); + assert(((s + 1) < n) && (T[s] <= T[s + 1])); + assert(T[s - 1] <= T[s]); + *j = ~s; + c0 = T[--s]; + if((0 < s) && (T[s - 1] > c0)) { s = ~s; } + if(c0 != c2) { + if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; } + k = SA + BUCKET_B(c2 = c0, c1); + } + assert(k < j); + *k-- = s; + } else { + assert(((s == 0) && (T[s] == c1)) || (s < 0)); + *j = ~s; + } + } + } + } + + /* Construct the suffix array by using + the sorted order of type B suffixes. */ + k = SA + BUCKET_A(c2 = T[n - 1]); + *k++ = (T[n - 2] < c2) ? ~(n - 1) : (n - 1); + /* Scan the suffix array from left to right. */ + for(i = SA, j = SA + n; i < j; ++i) { + if(0 < (s = *i)) { + assert(T[s - 1] >= T[s]); + c0 = T[--s]; + if((s == 0) || (T[s - 1] < c0)) { s = ~s; } + if(c0 != c2) { + BUCKET_A(c2) = k - SA; + k = SA + BUCKET_A(c2 = c0); + } + assert(i < k); + *k++ = s; + } else { + assert(s < 0); + *i = ~s; + } + } +} + +#if 0 +/* Constructs the burrows-wheeler transformed string directly + by using the sorted order of type B* suffixes. */ +static +saidx_t +construct_BWT(const sauchar_t *T, saidx_t *SA, + saidx_t *bucket_A, saidx_t *bucket_B, + saidx_t n, saidx_t m) { + saidx_t *i, *j, *k, *orig; + saidx_t s; + saint_t c0, c1, c2; + + if(0 < m) { + /* Construct the sorted order of type B suffixes by using + the sorted order of type B* suffixes. */ + for(c1 = ALPHABET_SIZE - 2; 0 <= c1; --c1) { + /* Scan the suffix array from right to left. */ + for(i = SA + BUCKET_BSTAR(c1, c1 + 1), + j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1; + i <= j; + --j) { + if(0 < (s = *j)) { + assert(T[s] == c1); + assert(((s + 1) < n) && (T[s] <= T[s + 1])); + assert(T[s - 1] <= T[s]); + c0 = T[--s]; + *j = ~((saidx_t)c0); + if((0 < s) && (T[s - 1] > c0)) { s = ~s; } + if(c0 != c2) { + if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; } + k = SA + BUCKET_B(c2 = c0, c1); + } + assert(k < j); + *k-- = s; + } else if(s != 0) { + *j = ~s; +#ifndef NDEBUG + } else { + assert(T[s] == c1); +#endif + } + } + } + } + + /* Construct the BWTed string by using + the sorted order of type B suffixes. */ + k = SA + BUCKET_A(c2 = T[n - 1]); + *k++ = (T[n - 2] < c2) ? ~((saidx_t)T[n - 2]) : (n - 1); + /* Scan the suffix array from left to right. */ + for(i = SA, j = SA + n, orig = SA; i < j; ++i) { + if(0 < (s = *i)) { + assert(T[s - 1] >= T[s]); + c0 = T[--s]; + *i = c0; + if((0 < s) && (T[s - 1] < c0)) { s = ~((saidx_t)T[s - 1]); } + if(c0 != c2) { + BUCKET_A(c2) = k - SA; + k = SA + BUCKET_A(c2 = c0); + } + assert(i < k); + *k++ = s; + } else if(s != 0) { + *i = ~s; + } else { + orig = i; + } + } + + return orig - SA; +} +#endif + +/*---------------------------------------------------------------------------*/ + +/** + * Initialize suffix array context + * + * @return 0 for success, or non-zero in case of an error + */ +int divsufsort_init(divsufsort_ctx_t *ctx) { + ctx->bucket_A = (saidx_t *)malloc(BUCKET_A_SIZE * sizeof(saidx_t)); + ctx->bucket_B = NULL; + + if (ctx->bucket_A) { + ctx->bucket_B = (saidx_t *)malloc(BUCKET_B_SIZE * sizeof(saidx_t)); + + if (ctx->bucket_B) + return 0; + } + + divsufsort_destroy(ctx); + return -1; +} + +/** + * Destroy suffix array context + * + * @param ctx suffix array context to destroy + */ +void divsufsort_destroy(divsufsort_ctx_t *ctx) { + if (ctx->bucket_B) { + free(ctx->bucket_B); + ctx->bucket_B = NULL; + } + + if (ctx->bucket_A) { + free(ctx->bucket_A); + ctx->bucket_A = NULL; + } +} + +/*- Function -*/ + +saint_t +divsufsort_build_array(divsufsort_ctx_t *ctx, const sauchar_t *T, saidx_t *SA, saidx_t n) { + saidx_t m; + saint_t err = 0; + + /* Check arguments. */ + if((T == NULL) || (SA == NULL) || (n < 0)) { return -1; } + else if(n == 0) { return 0; } + else if(n == 1) { SA[0] = 0; return 0; } + else if(n == 2) { m = (T[0] < T[1]); SA[m ^ 1] = 0, SA[m] = 1; return 0; } + + /* Suffixsort. */ + if((ctx->bucket_A != NULL) && (ctx->bucket_B != NULL)) { + m = sort_typeBstar(T, SA, ctx->bucket_A, ctx->bucket_B, n); + construct_SA(T, SA, ctx->bucket_A, ctx->bucket_B, n, m); + } else { + err = -2; + } + + return err; +} + +#if 0 +saidx_t +divbwt(const sauchar_t *T, sauchar_t *U, saidx_t *A, saidx_t n) { + saidx_t *B; + saidx_t *bucket_A, *bucket_B; + saidx_t m, pidx, i; + + /* Check arguments. */ + if((T == NULL) || (U == NULL) || (n < 0)) { return -1; } + else if(n <= 1) { if(n == 1) { U[0] = T[0]; } return n; } + + if((B = A) == NULL) { B = (saidx_t *)malloc((size_t)(n + 1) * sizeof(saidx_t)); } + bucket_A = (saidx_t *)malloc(BUCKET_A_SIZE * sizeof(saidx_t)); + bucket_B = (saidx_t *)malloc(BUCKET_B_SIZE * sizeof(saidx_t)); + + /* Burrows-Wheeler Transform. */ + if((B != NULL) && (bucket_A != NULL) && (bucket_B != NULL)) { + m = sort_typeBstar(T, B, bucket_A, bucket_B, n); + pidx = construct_BWT(T, B, bucket_A, bucket_B, n, m); + + /* Copy to output string. */ + U[0] = T[n - 1]; + for(i = 0; i < pidx; ++i) { U[i + 1] = (sauchar_t)B[i]; } + for(i += 1; i < n; ++i) { U[i] = (sauchar_t)B[i]; } + pidx += 1; + } else { + pidx = -2; + } + + free(bucket_B); + free(bucket_A); + if(A == NULL) { free(B); } + + return pidx; +} + +const char * +divsufsort_version(void) { + return PROJECT_VERSION_FULL; +} +#endif + +saint_t +divsufsort(const sauchar_t *T, saidx_t *SA, saidx_t n) { + saidx_t *bucket_A, *bucket_B; + saidx_t m; + saint_t err = 0; + + /* Check arguments. */ + if((T == NULL) || (SA == NULL) || (n < 0)) { return -1; } + else if(n == 0) { return 0; } + else if(n == 1) { SA[0] = 0; return 0; } + else if(n == 2) { m = (T[0] < T[1]); SA[m ^ 1] = 0, SA[m] = 1; return 0; } + + bucket_A = (saidx_t *)malloc(BUCKET_A_SIZE * sizeof(saidx_t)); + bucket_B = (saidx_t *)malloc(BUCKET_B_SIZE * sizeof(saidx_t)); + + /* Suffixsort. */ + if((bucket_A != NULL) && (bucket_B != NULL)) { + m = sort_typeBstar(T, SA, bucket_A, bucket_B, n); + construct_SA(T, SA, bucket_A, bucket_B, n, m); + } else { + err = -2; + } + + free(bucket_B); + free(bucket_A); + + return err; +} diff --git a/tools/z64compress/src/enc/apultra/divsufsort.h b/tools/z64compress/src/enc/apultra/divsufsort.h new file mode 100644 index 000000000..5c617ee73 --- /dev/null +++ b/tools/z64compress/src/enc/apultra/divsufsort.h @@ -0,0 +1,192 @@ +/* + * divsufsort.h for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _DIVSUFSORT_H +#define _DIVSUFSORT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define DIVSUFSORT_API + +/*- Datatypes -*/ +#ifndef SAUCHAR_T +#define SAUCHAR_T +typedef unsigned char sauchar_t; +#endif /* SAUCHAR_T */ +#ifndef SAINT_T +#define SAINT_T +typedef int saint_t; +#endif /* SAINT_T */ +#ifndef SAIDX_T +#define SAIDX_T +typedef int saidx_t; +#endif /* SAIDX_T */ +#ifndef PRIdSAIDX_T +#define PRIdSAIDX_T "d" +#endif + +/*- divsufsort context */ +typedef struct _divsufsort_ctx_t { + saidx_t *bucket_A; + saidx_t *bucket_B; +} divsufsort_ctx_t; + +/*- Prototypes -*/ + +/** + * Initialize suffix array context + * + * @return 0 for success, or non-zero in case of an error + */ +int divsufsort_init(divsufsort_ctx_t *ctx); + +/** + * Destroy suffix array context + * + * @param ctx suffix array context to destroy + */ +void divsufsort_destroy(divsufsort_ctx_t *ctx); + +/** + * Constructs the suffix array of a given string. + * @param ctx suffix array context + * @param T[0..n-1] The input string. + * @param SA[0..n-1] The output array of suffixes. + * @param n The length of the given string. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saint_t divsufsort_build_array(divsufsort_ctx_t *ctx, const sauchar_t *T, saidx_t *SA, saidx_t n); + +#if 0 +/** + * Constructs the burrows-wheeler transformed string of a given string. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param A[0..n-1] The temporary array. (can be NULL) + * @param n The length of the given string. + * @return The primary index if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saidx_t +divbwt(const sauchar_t *T, sauchar_t *U, saidx_t *A, saidx_t n); + +/** + * Returns the version of the divsufsort library. + * @return The version number string. + */ +DIVSUFSORT_API +const char * +divsufsort_version(void); + + +/** + * Constructs the burrows-wheeler transformed string of a given string and suffix array. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param SA[0..n-1] The suffix array. (can be NULL) + * @param n The length of the given string. + * @param idx The output primary index. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saint_t +bw_transform(const sauchar_t *T, sauchar_t *U, + saidx_t *SA /* can NULL */, + saidx_t n, saidx_t *idx); + +/** + * Inverse BW-transforms a given BWTed string. + * @param T[0..n-1] The input string. + * @param U[0..n-1] The output string. (can be T) + * @param A[0..n-1] The temporary array. (can be NULL) + * @param n The length of the given string. + * @param idx The primary index. + * @return 0 if no error occurred, -1 or -2 otherwise. + */ +DIVSUFSORT_API +saint_t +inverse_bw_transform(const sauchar_t *T, sauchar_t *U, + saidx_t *A /* can NULL */, + saidx_t n, saidx_t idx); + +/** + * Checks the correctness of a given suffix array. + * @param T[0..n-1] The input string. + * @param SA[0..n-1] The input suffix array. + * @param n The length of the given string. + * @param verbose The verbose mode. + * @return 0 if no error occurred. + */ +DIVSUFSORT_API +saint_t +sufcheck(const sauchar_t *T, const saidx_t *SA, saidx_t n, saint_t verbose); + +/** + * Search for the pattern P in the string T. + * @param T[0..Tsize-1] The input string. + * @param Tsize The length of the given string. + * @param P[0..Psize-1] The input pattern string. + * @param Psize The length of the given pattern string. + * @param SA[0..SAsize-1] The input suffix array. + * @param SAsize The length of the given suffix array. + * @param idx The output index. + * @return The count of matches if no error occurred, -1 otherwise. + */ +DIVSUFSORT_API +saidx_t +sa_search(const sauchar_t *T, saidx_t Tsize, + const sauchar_t *P, saidx_t Psize, + const saidx_t *SA, saidx_t SAsize, + saidx_t *left); + +/** + * Search for the character c in the string T. + * @param T[0..Tsize-1] The input string. + * @param Tsize The length of the given string. + * @param SA[0..SAsize-1] The input suffix array. + * @param SAsize The length of the given suffix array. + * @param c The input character. + * @param idx The output index. + * @return The count of matches if no error occurred, -1 otherwise. + */ +DIVSUFSORT_API +saidx_t +sa_simplesearch(const sauchar_t *T, saidx_t Tsize, + const saidx_t *SA, saidx_t SAsize, + saint_t c, saidx_t *left); +#endif + +saint_t +divsufsort(const sauchar_t *T, saidx_t *SA, saidx_t n); + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* _DIVSUFSORT_H */ diff --git a/tools/z64compress/src/enc/apultra/divsufsort_config.h b/tools/z64compress/src/enc/apultra/divsufsort_config.h new file mode 100644 index 000000000..f112983cf --- /dev/null +++ b/tools/z64compress/src/enc/apultra/divsufsort_config.h @@ -0,0 +1,9 @@ +#define HAVE_STRING_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STDINT_H 1 +#define INLINE inline + +#ifdef _MSC_VER +#pragma warning( disable : 4244 ) +#endif /* _MSC_VER */ diff --git a/tools/z64compress/src/enc/apultra/divsufsort_private.h b/tools/z64compress/src/enc/apultra/divsufsort_private.h new file mode 100644 index 000000000..b4d97ad4b --- /dev/null +++ b/tools/z64compress/src/enc/apultra/divsufsort_private.h @@ -0,0 +1,205 @@ +/* + * divsufsort_private.h for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _DIVSUFSORT_PRIVATE_H +#define _DIVSUFSORT_PRIVATE_H 1 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "divsufsort_config.h" +#include +#include +#if HAVE_STRING_H +# include +#endif +#if HAVE_STDLIB_H +# include +#endif +#if HAVE_MEMORY_H +# include +#endif +#if HAVE_STDDEF_H +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if defined(BUILD_DIVSUFSORT64) +# include "divsufsort64.h" +# ifndef SAIDX_T +# define SAIDX_T +# define saidx_t saidx64_t +# endif /* SAIDX_T */ +# ifndef PRIdSAIDX_T +# define PRIdSAIDX_T PRIdSAIDX64_T +# endif /* PRIdSAIDX_T */ +# define divsufsort divsufsort64 +# define divbwt divbwt64 +# define divsufsort_version divsufsort64_version +# define bw_transform bw_transform64 +# define inverse_bw_transform inverse_bw_transform64 +# define sufcheck sufcheck64 +# define sa_search sa_search64 +# define sa_simplesearch sa_simplesearch64 +# define sssort sssort64 +# define trsort trsort64 +#else +# include "divsufsort.h" +#endif + + +/*- Constants -*/ +#if !defined(UINT8_MAX) +# define UINT8_MAX (255) +#endif /* UINT8_MAX */ +#if defined(ALPHABET_SIZE) && (ALPHABET_SIZE < 1) +# undef ALPHABET_SIZE +#endif +#if !defined(ALPHABET_SIZE) +# define ALPHABET_SIZE (UINT8_MAX + 1) +#endif +/* for divsufsort.c */ +#define BUCKET_A_SIZE (ALPHABET_SIZE) +#define BUCKET_B_SIZE (ALPHABET_SIZE * ALPHABET_SIZE) +/* for sssort.c */ +#if defined(SS_INSERTIONSORT_THRESHOLD) +# if SS_INSERTIONSORT_THRESHOLD < 1 +# undef SS_INSERTIONSORT_THRESHOLD +# define SS_INSERTIONSORT_THRESHOLD (1) +# endif +#else +# define SS_INSERTIONSORT_THRESHOLD (8) +#endif +#if defined(SS_BLOCKSIZE) +# if SS_BLOCKSIZE < 0 +# undef SS_BLOCKSIZE +# define SS_BLOCKSIZE (0) +# elif 32768 <= SS_BLOCKSIZE +# undef SS_BLOCKSIZE +# define SS_BLOCKSIZE (32767) +# endif +#else +# define SS_BLOCKSIZE (1024) +#endif +/* minstacksize = log(SS_BLOCKSIZE) / log(3) * 2 */ +#if SS_BLOCKSIZE == 0 +# if defined(BUILD_DIVSUFSORT64) +# define SS_MISORT_STACKSIZE (96) +# else +# define SS_MISORT_STACKSIZE (64) +# endif +#elif SS_BLOCKSIZE <= 4096 +# define SS_MISORT_STACKSIZE (16) +#else +# define SS_MISORT_STACKSIZE (24) +#endif +#if defined(BUILD_DIVSUFSORT64) +# define SS_SMERGE_STACKSIZE (64) +#else +# define SS_SMERGE_STACKSIZE (32) +#endif +/* for trsort.c */ +#define TR_INSERTIONSORT_THRESHOLD (8) +#if defined(BUILD_DIVSUFSORT64) +# define TR_STACKSIZE (96) +#else +# define TR_STACKSIZE (64) +#endif + + +/*- Macros -*/ +#ifndef SWAP +# define SWAP(_a, _b) do { t = (_a); (_a) = (_b); (_b) = t; } while(0) +#endif /* SWAP */ +#ifndef MIN +# define MIN(_a, _b) (((_a) < (_b)) ? (_a) : (_b)) +#endif /* MIN */ +#ifndef MAX +# define MAX(_a, _b) (((_a) > (_b)) ? (_a) : (_b)) +#endif /* MAX */ +#define STACK_PUSH(_a, _b, _c, _d)\ + do {\ + assert(ssize < STACK_SIZE);\ + stack[ssize].a = (_a), stack[ssize].b = (_b),\ + stack[ssize].c = (_c), stack[ssize++].d = (_d);\ + } while(0) +#define STACK_PUSH5(_a, _b, _c, _d, _e)\ + do {\ + assert(ssize < STACK_SIZE);\ + stack[ssize].a = (_a), stack[ssize].b = (_b),\ + stack[ssize].c = (_c), stack[ssize].d = (_d), stack[ssize++].e = (_e);\ + } while(0) +#define STACK_POP(_a, _b, _c, _d)\ + do {\ + assert(0 <= ssize);\ + if(ssize == 0) { return; }\ + (_a) = stack[--ssize].a, (_b) = stack[ssize].b,\ + (_c) = stack[ssize].c, (_d) = stack[ssize].d;\ + } while(0) +#define STACK_POP5(_a, _b, _c, _d, _e)\ + do {\ + assert(0 <= ssize);\ + if(ssize == 0) { return; }\ + (_a) = stack[--ssize].a, (_b) = stack[ssize].b,\ + (_c) = stack[ssize].c, (_d) = stack[ssize].d, (_e) = stack[ssize].e;\ + } while(0) +/* for divsufsort.c */ +#define BUCKET_A(_c0) bucket_A[(_c0)] +#if ALPHABET_SIZE == 256 +#define BUCKET_B(_c0, _c1) (bucket_B[((_c1) << 8) | (_c0)]) +#define BUCKET_BSTAR(_c0, _c1) (bucket_B[((_c0) << 8) | (_c1)]) +#else +#define BUCKET_B(_c0, _c1) (bucket_B[(_c1) * ALPHABET_SIZE + (_c0)]) +#define BUCKET_BSTAR(_c0, _c1) (bucket_B[(_c0) * ALPHABET_SIZE + (_c1)]) +#endif + + +/*- Private Prototypes -*/ +/* sssort.c */ +void +sssort(const sauchar_t *Td, const saidx_t *PA, + saidx_t *first, saidx_t *last, + saidx_t *buf, saidx_t bufsize, + saidx_t depth, saidx_t n, saint_t lastsuffix); +/* trsort.c */ +void +trsort(saidx_t *ISA, saidx_t *SA, saidx_t n, saidx_t depth); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* _DIVSUFSORT_PRIVATE_H */ diff --git a/tools/z64compress/src/enc/apultra/expand.c b/tools/z64compress/src/enc/apultra/expand.c new file mode 100644 index 000000000..c5ad18229 --- /dev/null +++ b/tools/z64compress/src/enc/apultra/expand.c @@ -0,0 +1,396 @@ +/* + * expand.c - decompressor implementation + * + * Copyright (C) 2019 Emmanuel Marty + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori + * + * Inspired by cap by Sven-Åke Dahl. https://github.com/svendahl/cap + * Also inspired by Charles Bloom's compression blog. http://cbloomrants.blogspot.com/ + * With ideas from LZ4 by Yann Collet. https://github.com/lz4/lz4 + * With help and support from spke + * + */ + +#include +#include +#include "format.h" +#include "expand.h" +#include "libapultra.h" + +#ifdef _MSC_VER +#define FORCE_INLINE __forceinline +#else /* _MSC_VER */ +#define FORCE_INLINE __attribute__((always_inline)) +#endif /* _MSC_VER */ + +static inline FORCE_INLINE int apultra_read_bit(const unsigned char **ppInBlock, const unsigned char *pDataEnd, int *nCurBitMask, unsigned char *bits) { + const unsigned char *pInBlock = *ppInBlock; + int nBit; + + if ((*nCurBitMask) == 0) { + if (pInBlock >= pDataEnd) return -1; + (*bits) = *pInBlock++; + (*nCurBitMask) = 128; + } + + nBit = ((*bits) & 128) ? 1 : 0; + + (*bits) <<= 1; + (*nCurBitMask) >>= 1; + + *ppInBlock = pInBlock; + return nBit; +} + +static inline FORCE_INLINE int apultra_read_gamma2(const unsigned char **ppInBlock, const unsigned char *pDataEnd, int *nCurBitMask, unsigned char *bits) { + int bit; + unsigned int v = 1; + + do { + v = (v << 1) + apultra_read_bit(ppInBlock, pDataEnd, nCurBitMask, bits); + bit = apultra_read_bit(ppInBlock, pDataEnd, nCurBitMask, bits); + if (bit < 0) return bit; + } while (bit); + + return v; +} + +/** + * Get maximum decompressed size of compressed data + * + * @param pInputData compressed data + * @param nInputSize compressed size in bytes + * @param nFlags compression flags (set to 0) + * + * @return maximum decompressed size + */ +size_t apultra_get_max_decompressed_size(const unsigned char *pInputData, size_t nInputSize, const unsigned int nFlags) { + const unsigned char *pInputDataEnd = pInputData + nInputSize; + int nCurBitMask = 0; + unsigned char bits = 0; + int nMatchOffset = -1; + int nFollowsLiteral = 3; + size_t nDecompressedSize = 0; + + if (pInputData >= pInputDataEnd) + return -1; + pInputData++; + nDecompressedSize++; + + while (1) { + int nResult; + + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + + if (!nResult) { + /* '0': literal */ + if (pInputData < pInputDataEnd) { + pInputData++; + nDecompressedSize++; + nFollowsLiteral = 3; + } + else { + return -1; + } + } + else { + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + + if (nResult == 0) { + unsigned int nMatchLen; + + /* '10': 8+n bits offset */ + int nMatchOffsetHi = apultra_read_gamma2(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + nMatchOffsetHi -= nFollowsLiteral; + if (nMatchOffsetHi >= 0) { + nMatchOffset = ((unsigned int) nMatchOffsetHi) << 8; + nMatchOffset |= (unsigned int)(*pInputData++); + + nMatchLen = apultra_read_gamma2(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + + if (nMatchOffset < 128 || nMatchOffset >= MINMATCH4_OFFSET) + nMatchLen += 2; + else if (nMatchOffset >= MINMATCH3_OFFSET) + nMatchLen++; + } + else { + /* else rep-match */ + nMatchLen = apultra_read_gamma2(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + } + + nFollowsLiteral = 2; + + nDecompressedSize += nMatchLen; + } + else { + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + + if (nResult == 0) { + unsigned int nCommand; + unsigned int nMatchLen; + + /* '110': 7 bits offset + 1 bit length */ + nCommand = (unsigned int)(*pInputData++); + if (nCommand == 0x00) { + /* EOD. No match len follows. */ + break; + } + + /* Bits 7-1: offset; bit 0: length */ + nMatchOffset = (nCommand >> 1); + nMatchLen = (nCommand & 1) + 2; + + nFollowsLiteral = 2; + nDecompressedSize += nMatchLen; + } + else { + unsigned int nShortMatchOffset; + + /* '111': 4 bit offset */ + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + nShortMatchOffset = nResult << 3; + + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + nShortMatchOffset |= nResult << 2; + + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + nShortMatchOffset |= nResult << 1; + + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + nShortMatchOffset |= nResult << 0; + + nFollowsLiteral = 3; + nDecompressedSize++; + } + } + } + } + + return nDecompressedSize; +} + +/** + * Decompress data in memory + * + * @param pInputData compressed data + * @param pOutBuffer buffer for decompressed data + * @param nInputSize compressed size in bytes + * @param nMaxOutBufferSize maximum capacity of decompression buffer + * @param nDictionarySize size of dictionary in front of input data (0 for none) + * @param nFlags compression flags (set to 0) + * + * @return actual decompressed size, or -1 for error + */ +size_t apultra_decompress(const unsigned char *pInputData, unsigned char *pOutData, size_t nInputSize, size_t nMaxOutBufferSize, size_t nDictionarySize, const unsigned int nFlags) { + const unsigned char *pInputDataEnd = pInputData + nInputSize; + unsigned char *pCurOutData = pOutData + nDictionarySize; + const unsigned char *pOutDataEnd = pCurOutData + nMaxOutBufferSize; + const unsigned char *pOutDataFastEnd = pOutDataEnd - 20; + int nCurBitMask = 0; + unsigned char bits = 0; + int nMatchOffset = -1; + int nFollowsLiteral = 3; + + if (pInputData >= pInputDataEnd && pCurOutData < pOutDataEnd) + return -1; + *pCurOutData++ = *pInputData++; + + while (1) { + int nResult; + + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + + if (!nResult) { + /* '0': literal */ + if (pInputData < pInputDataEnd && pCurOutData < pOutDataEnd) { + *pCurOutData++ = *pInputData++; + nFollowsLiteral = 3; + } + else { + return -1; + } + } + else { + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + + if (nResult == 0) { + unsigned int nMatchLen; + + /* '10': 8+n bits offset */ + int nMatchOffsetHi = apultra_read_gamma2(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + nMatchOffsetHi -= nFollowsLiteral; + if (nMatchOffsetHi >= 0) { + nMatchOffset = ((unsigned int) nMatchOffsetHi) << 8; + nMatchOffset |= (unsigned int)(*pInputData++); + + nMatchLen = apultra_read_gamma2(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + + if (nMatchOffset < 128 || nMatchOffset >= MINMATCH4_OFFSET) + nMatchLen += 2; + else if (nMatchOffset >= MINMATCH3_OFFSET) + nMatchLen++; + } + else { + /* else rep-match */ + nMatchLen = apultra_read_gamma2(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + } + + nFollowsLiteral = 2; + const unsigned char *pSrc = pCurOutData - nMatchOffset; + if (pSrc >= pOutData && (pSrc + nMatchLen) <= pOutDataEnd) { + if (nMatchLen < 11 && nMatchOffset >= 8 && pCurOutData < pOutDataFastEnd) { + memcpy(pCurOutData, pSrc, 8); + memcpy(pCurOutData + 8, pSrc + 8, 2); + pCurOutData += nMatchLen; + } + else { + if ((pCurOutData + nMatchLen) <= pOutDataEnd) { + /* Do a deterministic, left to right byte copy instead of memcpy() so as to handle overlaps */ + + if (nMatchOffset >= 16 && (pCurOutData + nMatchLen) < (pOutDataFastEnd - 15)) { + const unsigned char *pCopySrc = pSrc; + unsigned char *pCopyDst = pCurOutData; + const unsigned char *pCopyEndDst = pCurOutData + nMatchLen; + + do { + memcpy(pCopyDst, pCopySrc, 16); + pCopySrc += 16; + pCopyDst += 16; + } while (pCopyDst < pCopyEndDst); + + pCurOutData += nMatchLen; + } + else { + while (nMatchLen) { + *pCurOutData++ = *pSrc++; + nMatchLen--; + } + } + } + else { + return -1; + } + } + } + else { + return -1; + } + } + else { + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + + if (nResult == 0) { + unsigned int nCommand; + unsigned int nMatchLen; + + /* '110': 7 bits offset + 1 bit length */ + nCommand = (unsigned int)(*pInputData++); + if (nCommand == 0x00) { + /* EOD. No match len follows. */ + break; + } + + /* Bits 7-1: offset; bit 0: length */ + nMatchOffset = (nCommand >> 1); + nMatchLen = (nCommand & 1) + 2; + + nFollowsLiteral = 2; + const unsigned char *pSrc = pCurOutData - nMatchOffset; + if (pSrc >= pOutData && (pSrc + nMatchLen) <= pOutDataEnd) { + if (nMatchOffset >= 8 && pCurOutData < pOutDataFastEnd) { + memcpy(pCurOutData, pSrc, 8); + memcpy(pCurOutData + 8, pSrc + 8, 2); + pCurOutData += nMatchLen; + } + else { + if ((pCurOutData + nMatchLen) <= pOutDataEnd) { + while (nMatchLen) { + *pCurOutData++ = *pSrc++; + nMatchLen--; + } + } + else { + return -1; + } + } + } + else { + return -1; + } + } + else { + unsigned int nShortMatchOffset; + + /* '111': 4 bit offset */ + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + nShortMatchOffset = nResult << 3; + + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + nShortMatchOffset |= nResult << 2; + + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + nShortMatchOffset |= nResult << 1; + + nResult = apultra_read_bit(&pInputData, pInputDataEnd, &nCurBitMask, &bits); + if (nResult < 0) return -1; + nShortMatchOffset |= nResult << 0; + + nFollowsLiteral = 3; + if (nShortMatchOffset) { + /* Short offset, 1-15 */ + const unsigned char *pSrc = pCurOutData - nShortMatchOffset; + if (pSrc >= pOutData && (pCurOutData + 1) <= pOutDataEnd && (pSrc + 1) <= pOutDataEnd) { + *pCurOutData++ = *pSrc++; + } + else { + return -1; + } + } + else { + /* Write zero */ + if ((pCurOutData + 1) <= pOutDataEnd) { + *pCurOutData++ = 0; + } + else { + return -1; + } + } + } + } + } + } + + return (size_t)(pCurOutData - pOutData) - nDictionarySize; +} diff --git a/tools/z64compress/src/enc/apultra/expand.h b/tools/z64compress/src/enc/apultra/expand.h new file mode 100644 index 000000000..9cd658ad8 --- /dev/null +++ b/tools/z64compress/src/enc/apultra/expand.h @@ -0,0 +1,71 @@ +/* + * expand.h - decompressor definitions + * + * Copyright (C) 2019 Emmanuel Marty + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori + * + * Inspired by cap by Sven-Åke Dahl. https://github.com/svendahl/cap + * Also inspired by Charles Bloom's compression blog. http://cbloomrants.blogspot.com/ + * With ideas from LZ4 by Yann Collet. https://github.com/lz4/lz4 + * With help and support from spke + * + */ + +#ifndef _EXPAND_H +#define _EXPAND_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Get maximum decompressed size of compressed data + * + * @param pInputData compressed data + * @param nInputSize compressed size in bytes + * @param nFlags compression flags (set to 0) + * + * @return maximum decompressed size + */ +size_t apultra_get_max_decompressed_size(const unsigned char *pInputData, size_t nInputSize, const unsigned int nFlags); + +/** + * Decompress data in memory + * + * @param pInputData compressed data + * @param pOutBuffer buffer for decompressed data + * @param nInputSize compressed size in bytes + * @param nMaxOutBufferSize maximum capacity of decompression buffer + * @param nDictionarySize size of dictionary in front of input data (0 for none) + * @param nFlags compression flags (set to 0) + * + * @return actual decompressed size, or -1 for error + */ +size_t apultra_decompress(const unsigned char *pInputData, unsigned char *pOutBuffer, size_t nInputSize, size_t nMaxOutBufferSize, size_t nDictionarySize, const unsigned int nFlags); + +#ifdef __cplusplus +} +#endif + +#endif /* _EXPAND_H */ diff --git a/tools/z64compress/src/enc/apultra/format.h b/tools/z64compress/src/enc/apultra/format.h new file mode 100644 index 000000000..1e280c1b3 --- /dev/null +++ b/tools/z64compress/src/enc/apultra/format.h @@ -0,0 +1,47 @@ +/* + * format.h - byte stream format definitions + * + * Copyright (C) 2019 Emmanuel Marty + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori + * + * Inspired by cap by Sven-Åke Dahl. https://github.com/svendahl/cap + * Also inspired by Charles Bloom's compression blog. http://cbloomrants.blogspot.com/ + * With ideas from LZ4 by Yann Collet. https://github.com/lz4/lz4 + * With help and support from spke + * + */ + +#ifndef _FORMAT_H +#define _FORMAT_H + +#define MIN_OFFSET 1 +#define MAX_OFFSET 0x1fffff + +#define MAX_VARLEN 0x1fffff + +#define BLOCK_SIZE 0x100000 + +#define MIN_MATCH_SIZE 1 +#define MINMATCH3_OFFSET 1280 +#define MINMATCH4_OFFSET 32000 + +#endif /* _FORMAT_H */ diff --git a/tools/z64compress/src/enc/apultra/libapultra.h b/tools/z64compress/src/enc/apultra/libapultra.h new file mode 100644 index 000000000..36fd29555 --- /dev/null +++ b/tools/z64compress/src/enc/apultra/libapultra.h @@ -0,0 +1,40 @@ +/* + * libapultra.h - library definitions + * + * Copyright (C) 2019 Emmanuel Marty + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori + * + * Inspired by cap by Sven-Åke Dahl. https://github.com/svendahl/cap + * Also inspired by Charles Bloom's compression blog. http://cbloomrants.blogspot.com/ + * With ideas from LZ4 by Yann Collet. https://github.com/lz4/lz4 + * With help and support from spke + * + */ + +#ifndef _LIB_APULTRA_H +#define _LIB_APULTRA_H + +#include "format.h" +#include "shrink.h" +#include "expand.h" + +#endif /* _LIB_APULTRA_H */ diff --git a/tools/z64compress/src/enc/apultra/matchfinder.c b/tools/z64compress/src/enc/apultra/matchfinder.c new file mode 100644 index 000000000..8d7802a52 --- /dev/null +++ b/tools/z64compress/src/enc/apultra/matchfinder.c @@ -0,0 +1,449 @@ +/* + * matchfinder.c - LZ match finder implementation + * + * The following copying information applies to this specific source code file: + * + * Written in 2019 by Emmanuel Marty + * Portions written in 2014-2015 by Eric Biggers + * + * To the extent possible under law, the author(s) have dedicated all copyright + * and related and neighboring rights to this software to the public domain + * worldwide via the Creative Commons Zero 1.0 Universal Public Domain + * Dedication (the "CC0"). + * + * This software is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the CC0 for more details. + * + * You should have received a copy of the CC0 along with this software; if not + * see . + */ + +/* + * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori + * + * Inspired by cap by Sven-Åke Dahl. https://github.com/svendahl/cap + * Also inspired by Charles Bloom's compression blog. http://cbloomrants.blogspot.com/ + * With ideas from LZ4 by Yann Collet. https://github.com/lz4/lz4 + * With help and support from spke + * + */ + +#include +#include +#include "matchfinder.h" +#include "format.h" +#include "libapultra.h" + +/** + * Hash index into TAG_BITS + * + * @param nIndex index value + * + * @return hash + */ +static inline int apultra_get_index_tag(unsigned int nIndex) { + return (int)(((unsigned long long)nIndex * 11400714819323198485ULL) >> (64ULL - TAG_BITS)); +} + +/** + * Parse input data, build suffix array and overlaid data structures to speed up match finding + * + * @param pCompressor compression context + * @param pInWindow pointer to input data window (previously compressed bytes + bytes to compress) + * @param nInWindowSize total input size in bytes (previously compressed bytes + bytes to compress) + * + * @return 0 for success, non-zero for failure + */ +int apultra_build_suffix_array(apultra_compressor *pCompressor, const unsigned char *pInWindow, const int nInWindowSize) { + unsigned long long *intervals = pCompressor->intervals; + + /* Build suffix array from input data */ + saidx_t *suffixArray = (saidx_t*)intervals; + if (divsufsort_build_array(&pCompressor->divsufsort_context, pInWindow, suffixArray, nInWindowSize) != 0) { + return 100; + } + + int i, r; + + for (i = nInWindowSize - 1; i >= 0; i--) { + intervals[i] = suffixArray[i]; + } + + int *PLCP = (int*)pCompressor->pos_data; /* Use temporarily */ + int *Phi = PLCP; + int nCurLen = 0; + + /* Compute the permuted LCP first (Kärkkäinen method) */ + Phi[intervals[0]] = -1; + for (i = 1; i < nInWindowSize; i++) + Phi[intervals[i]] = (unsigned int)intervals[i - 1]; + for (i = 0; i < nInWindowSize; i++) { + if (Phi[i] == -1) { + PLCP[i] = 0; + continue; + } + int nMaxLen = (i > Phi[i]) ? (nInWindowSize - i) : (nInWindowSize - Phi[i]); + while (nCurLen < nMaxLen && pInWindow[i + nCurLen] == pInWindow[Phi[i] + nCurLen]) nCurLen++; + PLCP[i] = nCurLen; + if (nCurLen > 0) + nCurLen--; + } + + /* Rotate permuted LCP into the LCP. This has better cache locality than the direct Kasai LCP method. This also + * saves us from having to build the inverse suffix array index, as the LCP is calculated without it using this method, + * and the interval builder below doesn't need it either. */ + intervals[0] &= POS_MASK; + + for (i = 1; i < nInWindowSize; i++) { + int nIndex = (int)(intervals[i] & POS_MASK); + int nLen = PLCP[nIndex]; + if (nLen < MIN_MATCH_SIZE) + nLen = 0; + if (nLen > LCP_MAX) + nLen = LCP_MAX; + int nTaggedLen = 0; + if (nLen) + nTaggedLen = (nLen << TAG_BITS) | (apultra_get_index_tag((unsigned int)nIndex) & ((1 << TAG_BITS) - 1)); + intervals[i] = ((unsigned long long)nIndex) | (((unsigned long long)nTaggedLen) << LCP_SHIFT); + } + + /** + * Build intervals for finding matches + * + * Methodology and code fragment taken from wimlib (CC0 license): + * https://wimlib.net/git/?p=wimlib;a=blob_plain;f=src/lcpit_matchfinder.c;h=a2d6a1e0cd95200d1f3a5464d8359d5736b14cbe;hb=HEAD + */ + unsigned long long * const SA_and_LCP = intervals; + unsigned long long *pos_data = pCompressor->pos_data; + unsigned long long next_interval_idx; + unsigned long long *top = pCompressor->open_intervals; + unsigned long long prev_pos = SA_and_LCP[0] & POS_MASK; + + *top = 0; + intervals[0] = 0; + next_interval_idx = 1; + + for (r = 1; r < nInWindowSize; r++) { + const unsigned long long next_pos = SA_and_LCP[r] & POS_MASK; + const unsigned long long next_lcp = SA_and_LCP[r] & LCP_MASK; + const unsigned long long top_lcp = *top & LCP_MASK; + + if (next_lcp == top_lcp) { + /* Continuing the deepest open interval */ + pos_data[prev_pos] = *top; + } + else if (next_lcp > top_lcp) { + /* Opening a new interval */ + *++top = next_lcp | next_interval_idx++; + pos_data[prev_pos] = *top; + } + else { + /* Closing the deepest open interval */ + pos_data[prev_pos] = *top; + for (;;) { + const unsigned long long closed_interval_idx = *top-- & POS_MASK; + const unsigned long long superinterval_lcp = *top & LCP_MASK; + + if (next_lcp == superinterval_lcp) { + /* Continuing the superinterval */ + intervals[closed_interval_idx] = *top; + break; + } + else if (next_lcp > superinterval_lcp) { + /* Creating a new interval that is a + * superinterval of the one being + * closed, but still a subinterval of + * its superinterval */ + *++top = next_lcp | next_interval_idx++; + intervals[closed_interval_idx] = *top; + break; + } + else { + /* Also closing the superinterval */ + intervals[closed_interval_idx] = *top; + } + } + } + prev_pos = next_pos; + } + + /* Close any still-open intervals. */ + pos_data[prev_pos] = *top; + for (; top > pCompressor->open_intervals; top--) + intervals[*top & POS_MASK] = *(top - 1); + + /* Success */ + return 0; +} + +/** + * Find matches at the specified offset in the input window + * + * @param pCompressor compression context + * @param nOffset offset to find matches at, in the input window + * @param pMatches pointer to returned matches + * @param pMatchDepth pointer to returned match depths + * @param pMatch1 pointer to 1-byte length, 4 bit offset match + * @param nMaxMatches maximum number of matches to return (0 for none) + * @param nBlockFlags bit 0: 1 for first block, 0 otherwise; bit 1: 1 for last block, 0 otherwise + * + * @return number of matches + */ +int apultra_find_matches_at(apultra_compressor *pCompressor, const int nOffset, apultra_match *pMatches, unsigned short *pMatchDepth, unsigned char *pMatch1, const int nMaxMatches, const int nBlockFlags) { + unsigned long long *intervals = pCompressor->intervals; + unsigned long long *pos_data = pCompressor->pos_data; + unsigned long long ref; + unsigned long long super_ref; + unsigned long long match_pos; + apultra_match *matchptr; + unsigned short *depthptr; + const int nMaxOffset = pCompressor->max_offset; + + *pMatch1 = 0; + + /** + * Find matches using intervals + * + * Taken from wimlib (CC0 license): + * https://wimlib.net/git/?p=wimlib;a=blob_plain;f=src/lcpit_matchfinder.c;h=a2d6a1e0cd95200d1f3a5464d8359d5736b14cbe;hb=HEAD + */ + + /* Get the deepest lcp-interval containing the current suffix. */ + ref = pos_data[nOffset]; + + pos_data[nOffset] = 0; + + /* Ascend until we reach a visited interval, the root, or a child of the + * root. Link unvisited intervals to the current suffix as we go. */ + while ((super_ref = intervals[ref & POS_MASK]) & LCP_MASK) { + intervals[ref & POS_MASK] = nOffset | VISITED_FLAG; + ref = super_ref; + } + + if (super_ref == 0) { + /* In this case, the current interval may be any of: + * (1) the root; + * (2) an unvisited child of the root */ + + if (ref != 0) /* Not the root? */ + intervals[ref & POS_MASK] = nOffset | VISITED_FLAG; + return 0; + } + + /* Ascend indirectly via pos_data[] links. */ + match_pos = super_ref & EXCL_VISITED_MASK; + matchptr = pMatches; + depthptr = pMatchDepth; + int nPrevOffset = 0; + int nPrevLen = 0; + int nCurDepth = 0; + unsigned short *cur_depth = NULL; + + if (nOffset >= match_pos && (nBlockFlags & 3) == 3) { + int nMatchOffset = (int)(nOffset - match_pos); + int nMatchLen = (int)(ref >> (LCP_SHIFT + TAG_BITS)); + + if ((matchptr - pMatches) < nMaxMatches) { + if (nMatchOffset <= nMaxOffset) { + if (nPrevOffset && nPrevLen > 2 && nMatchOffset == (nPrevOffset - 1) && nMatchLen == (nPrevLen - 1) && cur_depth && nCurDepth < LCP_MAX) { + nCurDepth++; + *cur_depth = nCurDepth; + } + else { + nCurDepth = 0; + + cur_depth = depthptr; + matchptr->length = nMatchLen; + matchptr->offset = nMatchOffset; + *depthptr = 0; + matchptr++; + depthptr++; + } + + nPrevLen = nMatchLen; + nPrevOffset = nMatchOffset; + } + } + } + + for (;;) { + if ((super_ref = pos_data[match_pos]) > ref) { + match_pos = intervals[super_ref & POS_MASK] & EXCL_VISITED_MASK; + + if (nOffset >= match_pos && (nBlockFlags & 3) == 3) { + int nMatchOffset = (int)(nOffset - match_pos); + int nMatchLen = (int)(ref >> (LCP_SHIFT + TAG_BITS)); + + if ((matchptr - pMatches) < nMaxMatches) { + if (nMatchOffset <= nMaxOffset && abs(nMatchOffset - nPrevOffset) >= 128) { + if (nPrevOffset && nPrevLen > 2 && nMatchOffset == (nPrevOffset - 1) && nMatchLen == (nPrevLen - 1) && cur_depth && nCurDepth < LCP_MAX) { + nCurDepth++; + *cur_depth = nCurDepth | 0x8000; + } + else { + nCurDepth = 0; + + cur_depth = depthptr; + matchptr->length = nMatchLen; + matchptr->offset = nMatchOffset; + *depthptr = 0x8000; + matchptr++; + depthptr++; + } + + nPrevLen = nMatchLen; + nPrevOffset = nMatchOffset; + } + } + } + } + + while ((super_ref = pos_data[match_pos]) > ref) { + match_pos = intervals[super_ref & POS_MASK] & EXCL_VISITED_MASK; + + if (nOffset > match_pos && (nBlockFlags & 3) == 3) { + int nMatchOffset = (int)(nOffset - match_pos); + int nMatchLen = (int)(ref >> (LCP_SHIFT + TAG_BITS)); + + if ((matchptr - pMatches) < nMaxMatches) { + if (nMatchOffset <= nMaxOffset && (nMatchLen >= 3 || (nMatchLen >= 2 && (matchptr - pMatches) < (nMaxMatches - 1))) && nMatchLen < 1280 && abs(nMatchOffset - nPrevOffset) >= 128) { + if (nPrevOffset && nPrevLen > 2 && nMatchOffset == (nPrevOffset - 1) && nMatchLen == (nPrevLen - 1) && cur_depth && nCurDepth < LCP_MAX) { + nCurDepth++; + *cur_depth = nCurDepth | 0x8000; + } + else { + nCurDepth = 0; + + cur_depth = depthptr; + matchptr->length = nMatchLen; + matchptr->offset = nMatchOffset; + *depthptr = 0x8000; + matchptr++; + depthptr++; + } + + nPrevLen = nMatchLen; + nPrevOffset = nMatchOffset; + } + } + } + } + + intervals[ref & POS_MASK] = nOffset | VISITED_FLAG; + pos_data[match_pos] = (unsigned long long)ref; + + int nMatchOffset = (int)(nOffset - match_pos); + int nMatchLen = (int)(ref >> (LCP_SHIFT + TAG_BITS)); + + if ((matchptr - pMatches) < nMaxMatches) { + if (nMatchOffset <= nMaxOffset && nMatchOffset != nPrevOffset) { + if (nPrevOffset && nPrevLen > 2 && nMatchOffset == (nPrevOffset - 1) && nMatchLen == (nPrevLen - 1) && cur_depth && nCurDepth < LCP_MAX) { + nCurDepth++; + *cur_depth = nCurDepth; + } + else { + nCurDepth = 0; + + cur_depth = depthptr; + matchptr->length = nMatchLen; + matchptr->offset = nMatchOffset; + *depthptr = 0; + matchptr++; + depthptr++; + } + + nPrevLen = nMatchLen; + nPrevOffset = nMatchOffset; + } + } + + if (nMatchOffset && nMatchOffset < 16 && nMatchLen) + *pMatch1 = nMatchOffset; + + if (super_ref == 0) + break; + ref = super_ref; + match_pos = intervals[ref & POS_MASK] & EXCL_VISITED_MASK; + + if (nOffset > match_pos && (nBlockFlags & 3) == 3) { + int nMatchOffset = (int)(nOffset - match_pos); + int nMatchLen = (int)(ref >> (LCP_SHIFT + TAG_BITS)); + + if ((matchptr - pMatches) < nMaxMatches) { + if (nMatchOffset <= nMaxOffset && nMatchLen >= 2 && abs(nMatchOffset - nPrevOffset) >= 128) { + if (nPrevOffset && nPrevLen > 2 && nMatchOffset == (nPrevOffset - 1) && nMatchLen == (nPrevLen - 1) && cur_depth && nCurDepth < LCP_MAX) { + nCurDepth++; + *cur_depth = nCurDepth | 0x8000; + } + else { + nCurDepth = 0; + + cur_depth = depthptr; + matchptr->length = nMatchLen; + matchptr->offset = nMatchOffset; + *depthptr = 0x8000; + matchptr++; + depthptr++; + } + + nPrevLen = nMatchLen; + nPrevOffset = nMatchOffset; + } + } + } + } + + return (int)(matchptr - pMatches); +} + +/** + * Skip previously compressed bytes + * + * @param pCompressor compression context + * @param nStartOffset current offset in input window (typically 0) + * @param nEndOffset offset to skip to in input window (typically the number of previously compressed bytes) + */ +void apultra_skip_matches(apultra_compressor *pCompressor, const int nStartOffset, const int nEndOffset) { + apultra_match match; + unsigned short depth; + unsigned char match1; + int i; + + /* Skipping still requires scanning for matches, as this also performs a lazy update of the intervals. However, + * we don't store the matches. */ + for (i = nStartOffset; i < nEndOffset; i++) { + apultra_find_matches_at(pCompressor, i, &match, &depth, &match1, 0, 0); + } +} + +/** + * Find all matches for the data to be compressed + * + * @param pCompressor compression context + * @param nMatchesPerOffset maximum number of matches to store for each offset + * @param nStartOffset current offset in input window (typically the number of previously compressed bytes) + * @param nEndOffset offset to end finding matches at (typically the size of the total input window in bytes + * @param nBlockFlags bit 0: 1 for first block, 0 otherwise; bit 1: 1 for last block, 0 otherwise + */ +void apultra_find_all_matches(apultra_compressor *pCompressor, const int nMatchesPerOffset, const int nStartOffset, const int nEndOffset, const int nBlockFlags) { + apultra_match *pMatch = pCompressor->match; + unsigned short *pMatchDepth = pCompressor->match_depth; + unsigned char *pMatch1 = pCompressor->match1; + int i; + + for (i = nStartOffset; i < nEndOffset; i++) { + int nMatches = apultra_find_matches_at(pCompressor, i, pMatch, pMatchDepth, pMatch1, nMatchesPerOffset, nBlockFlags); + + while (nMatches < nMatchesPerOffset) { + pMatch[nMatches].length = 0; + pMatch[nMatches].offset = 0; + pMatchDepth[nMatches] = 0; + nMatches++; + } + + pMatch += nMatchesPerOffset; + pMatchDepth += nMatchesPerOffset; + pMatch1++; + } +} diff --git a/tools/z64compress/src/enc/apultra/matchfinder.h b/tools/z64compress/src/enc/apultra/matchfinder.h new file mode 100644 index 000000000..4a6935435 --- /dev/null +++ b/tools/z64compress/src/enc/apultra/matchfinder.h @@ -0,0 +1,94 @@ +/* + * matchfinder.h - LZ match finder definitions + * + * Copyright (C) 2019 Emmanuel Marty + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori + * + * Inspired by cap by Sven-Åke Dahl. https://github.com/svendahl/cap + * Also inspired by Charles Bloom's compression blog. http://cbloomrants.blogspot.com/ + * With ideas from LZ4 by Yann Collet. https://github.com/lz4/lz4 + * With help and support from spke + * + */ + +#ifndef _MATCHFINDER_H +#define _MATCHFINDER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declarations */ +typedef struct _apultra_match apultra_match; +typedef struct _apultra_compressor apultra_compressor; + +/** + * Parse input data, build suffix array and overlaid data structures to speed up match finding + * + * @param pCompressor compression context + * @param pInWindow pointer to input data window (previously compressed bytes + bytes to compress) + * @param nInWindowSize total input size in bytes (previously compressed bytes + bytes to compress) + * + * @return 0 for success, non-zero for failure + */ +int apultra_build_suffix_array(apultra_compressor *pCompressor, const unsigned char *pInWindow, const int nInWindowSize); + +/** + * Find matches at the specified offset in the input window + * + * @param pCompressor compression context + * @param nOffset offset to find matches at, in the input window + * @param pMatches pointer to returned matches + * @param pMatchDepth pointer to returned match depths + * @param pMatch1 pointer to 1-byte length, 4 bit offset match + * @param nMaxMatches maximum number of matches to return (0 for none) + * @param nBlockFlags bit 0: 1 for first block, 0 otherwise; bit 1: 1 for last block, 0 otherwise + * + * @return number of matches + */ +int apultra_find_matches_at(apultra_compressor *pCompressor, const int nOffset, apultra_match *pMatches, unsigned short *pMatchDepth, unsigned char *pMatch1, const int nMaxMatches, const int nBlockFlags); + +/** + * Skip previously compressed bytes + * + * @param pCompressor compression context + * @param nStartOffset current offset in input window (typically 0) + * @param nEndOffset offset to skip to in input window (typically the number of previously compressed bytes) + */ +void apultra_skip_matches(apultra_compressor *pCompressor, const int nStartOffset, const int nEndOffset); + +/** + * Find all matches for the data to be compressed + * + * @param pCompressor compression context + * @param nMatchesPerOffset maximum number of matches to store for each offset + * @param nStartOffset current offset in input window (typically the number of previously compressed bytes) + * @param nEndOffset offset to end finding matches at (typically the size of the total input window in bytes + * @param nBlockFlags bit 0: 1 for first block, 0 otherwise; bit 1: 1 for last block, 0 otherwise + */ +void apultra_find_all_matches(apultra_compressor *pCompressor, const int nMatchesPerOffset, const int nStartOffset, const int nEndOffset, const int nBlockFlags); + +#ifdef __cplusplus +} +#endif + +#endif /* _MATCHFINDER_H */ diff --git a/tools/z64compress/src/enc/apultra/shrink.c b/tools/z64compress/src/enc/apultra/shrink.c new file mode 100644 index 000000000..ece2144e8 --- /dev/null +++ b/tools/z64compress/src/enc/apultra/shrink.c @@ -0,0 +1,1731 @@ +/* + * shrink.c - compressor implementation + * + * Copyright (C) 2019 Emmanuel Marty + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori + * + * Inspired by cap by Sven-Åke Dahl. https://github.com/svendahl/cap + * Also inspired by Charles Bloom's compression blog. http://cbloomrants.blogspot.com/ + * With ideas from LZ4 by Yann Collet. https://github.com/lz4/lz4 + * With help and support from spke + * + */ + +#include +#include +#include +#include "libapultra.h" +#include "matchfinder.h" +#include "shrink.h" +#include "format.h" + +#define TOKEN_CODE_LARGE_MATCH 2 /* 10 */ +#define TOKEN_SIZE_LARGE_MATCH 2 + +#define TOKEN_CODE_7BIT_MATCH 6 /* 110 */ +#define TOKEN_SIZE_7BIT_MATCH 3 + +#define TOKEN_CODE_4BIT_MATCH 7 /* 111 */ +#define TOKEN_SIZE_4BIT_MATCH 3 + +#define CountShift(N,bits) if ((N)>>(bits)) { (N)>>=(bits); (n) += (bits); } + +/** Gamma2 bit counts for common values, up to 255 */ +static char _gamma2_size[256] = { + 0, 0, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +}; + +/** + * Write bitpacked value to output (compressed) buffer + * + * @param pOutData pointer to output buffer + * @param nOutOffset current write index into output buffer + * @param nMaxOutDataSize maximum size of output buffer, in bytes + * @param nValue value to write + * @param nBits number of least significant bits to write in value + * @param nCurBitsOffset write index into output buffer, of current byte being filled with bits + * @param nCurBitShift bit shift count + * + * @return updated write index into output buffer, or -1 in case of an error + */ +static int apultra_write_bits(unsigned char *pOutData, int nOutOffset, const int nMaxOutDataSize, const int nValue, const int nBits, int *nCurBitsOffset, int *nCurBitShift) { + int i; + + if (nOutOffset < 0) return -1; + + for (i = nBits - 1; i >= 0; i--) { + if ((*nCurBitsOffset) == INT_MIN) { + /* Allocate a new byte in the stream to pack bits in */ + if (nOutOffset >= nMaxOutDataSize) return -1; + (*nCurBitsOffset) = nOutOffset; + (*nCurBitShift) = 7; + pOutData[nOutOffset++] = 0; + } + + pOutData[(*nCurBitsOffset)] |= ((nValue >> i) & 1) << (*nCurBitShift); + + (*nCurBitShift) --; + if ((*nCurBitShift) == -1) { + /* Current byte is full */ + (*nCurBitsOffset) = INT_MIN; + } + } + + return nOutOffset; +} + +/** + * Get size of gamma2 encoded value + * + * @param nValue value of evaluate (2..n) + * + * @return number of bits required + */ +static int apultra_get_gamma2_size(int nValue) { + if (nValue >= 0 && nValue < 256) + return _gamma2_size[nValue]; + else { + unsigned int n = 0; + CountShift(nValue, 16); + CountShift(nValue, 8); + CountShift(nValue, 4); + CountShift(nValue, 2); + CountShift(nValue, 1); + + return n << 1; + } +} + +/** + * Write gamma2 encoded value to output (compressed) buffer + * + * @param pOutData pointer to output buffer + * @param nOutOffset current write index into output buffer + * @param nMaxOutDataSize maximum size of output buffer, in bytes + * @param nValue value of write (2..n) + * @param nCurBitsOffset write index into output buffer, of current byte being filled with bits + * @param nCurBitShift bit shift count + * + * @return updated write index into output buffer, or -1 in case of an error + */ +static int apultra_write_gamma2_value(unsigned char *pOutData, int nOutOffset, const int nMaxOutDataSize, int nValue, int *nCurBitsOffset, int *nCurBitShift) { + int msb = 30; + while ((nValue >> msb--) == 0); + + while (msb > 0) { + int bit = (nValue >> msb) & 1; + + nOutOffset = apultra_write_bits(pOutData, nOutOffset, nMaxOutDataSize, bit, 1, nCurBitsOffset, nCurBitShift); + msb--; + nOutOffset = apultra_write_bits(pOutData, nOutOffset, nMaxOutDataSize, 1, 1, nCurBitsOffset, nCurBitShift); + } + + nOutOffset = apultra_write_bits(pOutData, nOutOffset, nMaxOutDataSize, nValue & 1, 1, nCurBitsOffset, nCurBitShift); + nOutOffset = apultra_write_bits(pOutData, nOutOffset, nMaxOutDataSize, 0, 1, nCurBitsOffset, nCurBitShift); + return nOutOffset; +} + +/** + * Get the number of extra bits required to represent a match offset + * + * @param nLength match length + * @param nMatchOffset match offset + * @param nFollowsLiteral non-zero if the match follows a literal, zero if it immediately follows another match + * + * @return number of extra bits required + */ +static inline int apultra_get_offset_varlen_size(const int nLength, const int nMatchOffset, const int nFollowsLiteral) { + if (nLength <= 3 && nMatchOffset < 128) + return 8 + TOKEN_SIZE_7BIT_MATCH; + else { + if (nFollowsLiteral) + return 8 + TOKEN_SIZE_LARGE_MATCH + apultra_get_gamma2_size((nMatchOffset >> 8) + 3); + else + return 8 + TOKEN_SIZE_LARGE_MATCH + apultra_get_gamma2_size((nMatchOffset >> 8) + 2); + } +} + +/** + * Get the number of extra bits required to represent a match length + * + * @param nLength match length + * @param nMatchOffset match offset + * + * @return number of extra bits required + */ +static inline int apultra_get_match_varlen_size(int nLength, const int nMatchOffset) { + if (nLength <= 3 && nMatchOffset < 128) + return 0; + else { + if (nMatchOffset < 128 || nMatchOffset >= MINMATCH4_OFFSET) + return apultra_get_gamma2_size(nLength - 2); + else if (nMatchOffset < MINMATCH3_OFFSET) + return apultra_get_gamma2_size(nLength); + else + return apultra_get_gamma2_size(nLength - 1); + } +} + +/** + * Insert forward rep candidate + * + * @param pCompressor compression context + * @param pInWindow pointer to input data window (previously compressed bytes + bytes to compress) + * @param i input data window position whose matches are being considered + * @param nMatchOffset match offset to use as rep candidate + * @param nStartOffset current offset in input window (typically the number of previously compressed bytes) + * @param nEndOffset offset to end finding matches at (typically the size of the total input window in bytes + * @param nArrivalsPerPosition maximum number of arrivals per input buffer position + * @param nDepth current insertion depth + */ +static void apultra_insert_forward_match(apultra_compressor *pCompressor, const unsigned char *pInWindow, const int i, const int nMatchOffset, const int nStartOffset, const int nEndOffset, const int nArrivalsPerPosition, int nDepth) { + const apultra_arrival *arrival = pCompressor->arrival + ((i - nStartOffset) * nArrivalsPerPosition); + const int *rle_len = (int*)pCompressor->intervals /* reuse */; + int* visited = ((int*)pCompressor->pos_data) - nStartOffset /* reuse */; + int* visited2 = visited + (nEndOffset - nStartOffset) /* reuse */; + int j; + + for (j = 0; j < nArrivalsPerPosition && arrival[j].from_slot; j++) { + if (arrival[j].follows_literal) { + int nRepOffset = arrival[j].rep_offset; + + if (nMatchOffset != nRepOffset && nRepOffset) { + int nRepPos = arrival[j].rep_pos; + + if (nRepPos >= nStartOffset && + nRepPos < nEndOffset && + visited[nRepPos] != nMatchOffset) { + + visited[nRepPos] = nMatchOffset; + + if (visited2[nRepPos] != nMatchOffset && nRepPos >= nMatchOffset && pCompressor->match[((nRepPos - nStartOffset) << MATCHES_PER_INDEX_SHIFT) + NMATCHES_PER_INDEX - 1].length == 0) { + const unsigned char* pInWindowAtRepOffset = pInWindow + nRepPos; + + if (pInWindowAtRepOffset[0] == pInWindowAtRepOffset[-nMatchOffset]) { + int nLen0 = rle_len[nRepPos - nMatchOffset]; + int nLen1 = rle_len[nRepPos]; + int nMinLen = (nLen0 < nLen1) ? nLen0 : nLen1; + + int nMaxRepLen = nEndOffset - nRepPos; + if (nMaxRepLen > LCP_MAX) + nMaxRepLen = LCP_MAX; + + if (nMinLen > nMaxRepLen) + nMinLen = nMaxRepLen; + + const unsigned char* pInWindowMax = pInWindowAtRepOffset + nMaxRepLen; + pInWindowAtRepOffset += nMinLen; + + while ((pInWindowAtRepOffset + 8) < pInWindowMax && !memcmp(pInWindowAtRepOffset, pInWindowAtRepOffset - nMatchOffset, 8)) + pInWindowAtRepOffset += 8; + while ((pInWindowAtRepOffset + 4) < pInWindowMax && !memcmp(pInWindowAtRepOffset, pInWindowAtRepOffset - nMatchOffset, 4)) + pInWindowAtRepOffset += 4; + while (pInWindowAtRepOffset < pInWindowMax && pInWindowAtRepOffset[0] == pInWindowAtRepOffset[-nMatchOffset]) + pInWindowAtRepOffset++; + + int nCurRepLen = (int)(pInWindowAtRepOffset - (pInWindow + nRepPos)); + + if (nCurRepLen >= 2) { + apultra_match* fwd_match = pCompressor->match + ((nRepPos - nStartOffset) << MATCHES_PER_INDEX_SHIFT); + unsigned short* fwd_depth = pCompressor->match_depth + ((nRepPos - nStartOffset) << MATCHES_PER_INDEX_SHIFT); + int r; + + for (r = 0; fwd_match[r].length >= MIN_MATCH_SIZE; r++) { + if (fwd_match[r].offset == nMatchOffset && (fwd_depth[r] & 0x3fff) == 0) { + if ((int)fwd_match[r].length < nCurRepLen) { + fwd_match[r].length = nCurRepLen; + fwd_depth[r] = 0; + } + r = NMATCHES_PER_INDEX; + break; + } + } + + if (r < NMATCHES_PER_INDEX) { + visited2[nRepPos] = nMatchOffset; + + fwd_match[r].offset = nMatchOffset; + fwd_match[r].length = nCurRepLen; + fwd_depth[r] = 0; + + if (nDepth < 9) + apultra_insert_forward_match(pCompressor, pInWindow, nRepPos, nMatchOffset, nStartOffset, nEndOffset, nArrivalsPerPosition, nDepth + 1); + } + } + } + } + } + } + } + } +} + +/** + * Attempt to pick optimal matches, so as to produce the smallest possible output that decompresses to the same input + * + * @param pCompressor compression context + * @param pInWindow pointer to input data window (previously compressed bytes + bytes to compress) + * @param nStartOffset current offset in input window (typically the number of previously compressed bytes) + * @param nEndOffset offset to end finding matches at (typically the size of the total input window in bytes + * @param nInsertForwardReps non-zero to insert forward repmatch candidates, zero to use the previously inserted candidates + * @param nCurRepMatchOffset starting rep offset for this block + * @param nBlockFlags bit 0: 1 for first block, 0 otherwise; bit 1: 1 for last block, 0 otherwise + * @param nArrivalsPerPosition maximum number of arrivals per input buffer position + */ +static void apultra_optimize_forward(apultra_compressor *pCompressor, const unsigned char *pInWindow, const int nStartOffset, const int nEndOffset, const int nInsertForwardReps, const int *nCurRepMatchOffset, const int nBlockFlags, const int nArrivalsPerPosition) { + apultra_arrival *arrival = pCompressor->arrival - (nStartOffset * nArrivalsPerPosition); + const int* rle_len = (int*)pCompressor->intervals /* reuse */; + int* visited = ((int*)pCompressor->pos_data) - nStartOffset /* reuse */; + int i, j, n; + + if ((nEndOffset - nStartOffset) > pCompressor->block_size) return; + + memset(arrival + (nStartOffset * nArrivalsPerPosition), 0, sizeof(apultra_arrival) * ((nEndOffset - nStartOffset + 1) * nArrivalsPerPosition)); + + arrival[nStartOffset * nArrivalsPerPosition].from_slot = -1; + arrival[nStartOffset * nArrivalsPerPosition].rep_offset = *nCurRepMatchOffset; + + for (i = (nStartOffset * nArrivalsPerPosition); i != ((nEndOffset+1) * nArrivalsPerPosition); i++) { + arrival[i].cost = 0x40000000; + } + + if (nInsertForwardReps) { + memset(visited + nStartOffset, 0, 2 * (nEndOffset - nStartOffset) * sizeof(int)); + } + + for (i = nStartOffset; i != nEndOffset; i++) { + apultra_arrival *cur_arrival = &arrival[i * nArrivalsPerPosition]; + int m; + + const unsigned char nMatch1Offs = pCompressor->match1[i - nStartOffset]; + int nShortOffset; + int nShortLen; + int nLiteralScore; + int nLiteralCost; + + if ((pInWindow[i] != 0 && nMatch1Offs == 0) || (i == nStartOffset && (nBlockFlags & 1))) { + nShortOffset = 0; + nShortLen = 0; + nLiteralCost = 9 /* literal bit + literal byte */; + } + else { + nShortOffset = (pInWindow[i] == 0) ? 0 : nMatch1Offs; + nShortLen = 1; + nLiteralCost = 4 + TOKEN_SIZE_4BIT_MATCH /* command and offset cost; no length cost */; + } + + nLiteralScore = nShortOffset ? 3 : 1; + + if (cur_arrival[nArrivalsPerPosition].from_slot) { + for (j = 0; j < nArrivalsPerPosition && cur_arrival[j].from_slot; j++) { + int nPrevCost = cur_arrival[j].cost & 0x3fffffff; + int nCodingChoiceCost = nPrevCost + nLiteralCost; + int nScore = cur_arrival[j].score + nLiteralScore; + + apultra_arrival* pDestSlots = &cur_arrival[nArrivalsPerPosition]; + if (nCodingChoiceCost < pDestSlots[nArrivalsPerPosition - 1].cost || + (nCodingChoiceCost == pDestSlots[nArrivalsPerPosition - 1].cost && nScore < pDestSlots[nArrivalsPerPosition - 1].score)) { + int nRepOffset = cur_arrival[j].rep_offset; + int exists = 0; + + for (n = 0; + pDestSlots[n].cost < nCodingChoiceCost; + n++) { + if (pDestSlots[n].rep_offset == nRepOffset) { + exists = 1; + break; + } + } + + if (!exists) { + for (; + n < nArrivalsPerPosition && pDestSlots[n].cost == nCodingChoiceCost && nScore >= pDestSlots[n].score; + n++) { + if (pDestSlots[n].rep_offset == nRepOffset) { + exists = 1; + break; + } + } + + if (!exists) { + if (n < nArrivalsPerPosition) { + int nn; + + for (nn = n; + nn < nArrivalsPerPosition && pDestSlots[nn].cost == nCodingChoiceCost; + nn++) { + if (pDestSlots[nn].rep_offset == nRepOffset) { + exists = 1; + break; + } + } + + if (!exists) { + int z; + + for (z = n; z < nArrivalsPerPosition - 1 && pDestSlots[z].from_slot; z++) { + if (pDestSlots[z].rep_offset == nRepOffset) + break; + } + + apultra_arrival* pDestArrival = &pDestSlots[n]; + memmove(&pDestSlots[n + 1], + &pDestSlots[n], + sizeof(apultra_arrival) * (z - n)); + + pDestArrival->cost = nCodingChoiceCost; + pDestArrival->from_pos = i; + pDestArrival->from_slot = j + 1; + pDestArrival->follows_literal = 1; + pDestArrival->rep_offset = nRepOffset; + pDestArrival->short_offset = nShortOffset; + pDestArrival->rep_pos = cur_arrival[j].rep_pos; + pDestArrival->match_len = nShortLen; + pDestArrival->score = nScore; + } + } + } + } + } + } + } + else { + for (j = 0; j < nArrivalsPerPosition && cur_arrival[j].from_slot; j++) { + int nPrevCost = cur_arrival[j].cost & 0x3fffffff; + int nCodingChoiceCost = nPrevCost + nLiteralCost; + int nScore = cur_arrival[j].score + nLiteralScore; + + apultra_arrival* pDestArrival = &cur_arrival[nArrivalsPerPosition + j]; + + pDestArrival->cost = nCodingChoiceCost; + pDestArrival->from_pos = i; + pDestArrival->from_slot = j + 1; + pDestArrival->follows_literal = 1; + pDestArrival->rep_offset = cur_arrival[j].rep_offset; + pDestArrival->short_offset = nShortOffset; + pDestArrival->rep_pos = cur_arrival[j].rep_pos; + pDestArrival->match_len = nShortLen; + pDestArrival->score = nScore; + } + } + + if (i == nStartOffset && (nBlockFlags & 1)) continue; + + const apultra_match *match = pCompressor->match + ((i - nStartOffset) << MATCHES_PER_INDEX_SHIFT); + const unsigned short *match_depth = pCompressor->match_depth + ((i - nStartOffset) << MATCHES_PER_INDEX_SHIFT); + int nNumArrivalsForThisPos = j, nOverallMinRepLen = 0, nOverallMaxRepLen = 0; + + int nRepLenForArrival[NARRIVALS_PER_POSITION_MAX]; + memset(nRepLenForArrival, 0, nArrivalsPerPosition * sizeof(int)); + + int nRepMatchArrivalIdx[NARRIVALS_PER_POSITION_MAX + 1]; + int nNumRepMatchArrivals = 0; + + int nMaxRepLenForPos = nEndOffset - i; + if (nMaxRepLenForPos > LCP_MAX) + nMaxRepLenForPos = LCP_MAX; + const unsigned char* pInWindowStart = pInWindow + i; + const unsigned char* pInWindowMax = pInWindowStart + nMaxRepLenForPos; + const int nLen1 = rle_len[i]; + + for (j = 0; j < nNumArrivalsForThisPos && (i + 2) <= nEndOffset; j++) { + if (cur_arrival[j].follows_literal) { + int nRepOffset = cur_arrival[j].rep_offset; + + if (nRepOffset && i >= nRepOffset) { + if (pInWindowStart[0] == pInWindowStart[-nRepOffset]) { + int nLen0 = rle_len[i - nRepOffset]; + int nMinLen = (nLen0 < nLen1) ? nLen0 : nLen1; + + if (nMinLen > nMaxRepLenForPos) + nMinLen = nMaxRepLenForPos; + + const unsigned char* pInWindowAtRepOffset = pInWindowStart + nMinLen; + while ((pInWindowAtRepOffset + 8) < pInWindowMax && !memcmp(pInWindowAtRepOffset, pInWindowAtRepOffset - nRepOffset, 8)) + pInWindowAtRepOffset += 8; + while ((pInWindowAtRepOffset + 4) < pInWindowMax && !memcmp(pInWindowAtRepOffset, pInWindowAtRepOffset - nRepOffset, 4)) + pInWindowAtRepOffset += 4; + while (pInWindowAtRepOffset < pInWindowMax && pInWindowAtRepOffset[0] == pInWindowAtRepOffset[-nRepOffset]) + pInWindowAtRepOffset++; + + int nCurMaxLen = (int)(pInWindowAtRepOffset - pInWindowStart); + + if (nCurMaxLen >= 2) { + nRepLenForArrival[j] = nCurMaxLen; + nRepMatchArrivalIdx[nNumRepMatchArrivals++] = j; + + if (nOverallMaxRepLen < nCurMaxLen) + nOverallMaxRepLen = nCurMaxLen; + } + } + } + } + } + nRepMatchArrivalIdx[nNumRepMatchArrivals] = -1; + + for (m = 0; m < NMATCHES_PER_INDEX && match[m].length; m++) { + const int nOrigMatchLen = match[m].length; + const int nOrigMatchOffset = match[m].offset; + const unsigned int nOrigMatchDepth = match_depth[m] & 0x3fff; + const int nScorePenalty = 3 + ((match_depth[m] & 0x8000) >> 15); + unsigned int d; + + for (d = 0; d <= nOrigMatchDepth; d += (nOrigMatchDepth ? nOrigMatchDepth : 1)) { + const int nMatchOffset = nOrigMatchOffset - d; + int nMatchLen = nOrigMatchLen - d; + + if ((i + nMatchLen) > nEndOffset) + nMatchLen = nEndOffset - i; + + if (nInsertForwardReps) { + apultra_insert_forward_match(pCompressor, pInWindow, i, nMatchOffset, nStartOffset, nEndOffset, nArrivalsPerPosition, 0); + } + + if (nMatchLen >= 2) { + int nStartingMatchLen, nJumpMatchLen, k; + int nNoRepMatchOffsetCostForLit[2], nNoRepMatchOffsetCostDelta; + int nMinMatchLenForOffset; + int nNoRepCostAdjusment = (nMatchLen >= LCP_MAX) ? 1 : 0; + + if (nMatchOffset < MINMATCH3_OFFSET) + nMinMatchLenForOffset = 2; + else { + if (nMatchOffset < MINMATCH4_OFFSET) + nMinMatchLenForOffset = 3; + else + nMinMatchLenForOffset = 4; + } + + if (nMatchLen >= LEAVE_ALONE_MATCH_SIZE && i >= nMatchLen) + nStartingMatchLen = nMatchLen; + else + nStartingMatchLen = 2; + + if ((nBlockFlags & 3) == 3 && nMatchLen > 90 && i >= 90) + nJumpMatchLen = 90; + else + nJumpMatchLen = nMatchLen + 1; + + if (nStartingMatchLen <= 3 && nMatchOffset < 128) { + nNoRepMatchOffsetCostForLit[0] = 8 + TOKEN_SIZE_7BIT_MATCH; + nNoRepMatchOffsetCostForLit[1] = 8 + TOKEN_SIZE_7BIT_MATCH; + } + else { + nNoRepMatchOffsetCostForLit[0] = 8 + TOKEN_SIZE_LARGE_MATCH + apultra_get_gamma2_size((nMatchOffset >> 8) + 2); + nNoRepMatchOffsetCostForLit[1] = 8 + TOKEN_SIZE_LARGE_MATCH + apultra_get_gamma2_size((nMatchOffset >> 8) + 3); + } + nNoRepMatchOffsetCostDelta = nNoRepMatchOffsetCostForLit[1] - nNoRepMatchOffsetCostForLit[0]; + + for (k = nStartingMatchLen; k <= nMatchLen; k++) { + int nRepMatchMatchLenCost = apultra_get_gamma2_size(k); + apultra_arrival *pDestSlots = &cur_arrival[k * nArrivalsPerPosition]; + + /* Insert non-repmatch candidate */ + + if (k >= nMinMatchLenForOffset) { + int nNoRepMatchMatchLenCost; + + if (k <= 3 && nMatchOffset < 128) + nNoRepMatchMatchLenCost = 0; + else { + if (nMatchOffset < 128 || nMatchOffset >= MINMATCH4_OFFSET) + nNoRepMatchMatchLenCost = apultra_get_gamma2_size(k - 2); + else if (nMatchOffset < MINMATCH3_OFFSET) + nNoRepMatchMatchLenCost = nRepMatchMatchLenCost; + else + nNoRepMatchMatchLenCost = apultra_get_gamma2_size(k - 1); + } + + for (j = 0; j < nNumArrivalsForThisPos; j++) { + if (nMatchOffset != cur_arrival[j].rep_offset || cur_arrival[j].follows_literal == 0) { + int nPrevCost = cur_arrival[j].cost & 0x3fffffff; + int nMatchCmdCost = nNoRepMatchMatchLenCost + nNoRepMatchOffsetCostForLit[cur_arrival[j].follows_literal]; + int nCodingChoiceCost = nPrevCost + nMatchCmdCost; + + if (nCodingChoiceCost <= (pDestSlots[nArrivalsPerPosition - 1].cost + 1)) { + int nScore = cur_arrival[j].score + nScorePenalty; + + if (nCodingChoiceCost < pDestSlots[nArrivalsPerPosition - 2].cost || + (nCodingChoiceCost == pDestSlots[nArrivalsPerPosition - 2].cost && nScore < pDestSlots[nArrivalsPerPosition - 2].score)) { + int exists = 0; + + for (n = 0; + pDestSlots[n].cost < nCodingChoiceCost; + n++) { + if (pDestSlots[n].rep_offset == nMatchOffset) { + exists = 1; + break; + } + } + + if (!exists) { + int nRevisedCodingChoiceCost = nCodingChoiceCost - nNoRepCostAdjusment; + + for (; + n < nArrivalsPerPosition - 1 && pDestSlots[n].cost == nRevisedCodingChoiceCost && nScore >= pDestSlots[n].score; + n++) { + if (pDestSlots[n].rep_offset == nMatchOffset) { + exists = 1; + break; + } + } + + if (!exists) { + if (n < nArrivalsPerPosition - 1) { + int nn; + + for (nn = n; + nn < nArrivalsPerPosition && pDestSlots[nn].cost == nCodingChoiceCost; + nn++) { + if (pDestSlots[nn].rep_offset == nMatchOffset) { + exists = 1; + break; + } + } + + if (!exists) { + int z; + + for (z = n; z < nArrivalsPerPosition - 1 && pDestSlots[z].from_slot; z++) { + if (pDestSlots[z].rep_offset == nMatchOffset) + break; + } + + apultra_arrival* pDestArrival = &pDestSlots[n]; + memmove(&pDestSlots[n + 1], + &pDestSlots[n], + sizeof(apultra_arrival) * (z - n)); + + pDestArrival->cost = nRevisedCodingChoiceCost; + pDestArrival->from_pos = i; + pDestArrival->from_slot = j + 1; + pDestArrival->follows_literal = 0; + pDestArrival->rep_offset = nMatchOffset; + pDestArrival->short_offset = 0; + pDestArrival->rep_pos = i; + pDestArrival->match_len = k; + pDestArrival->score = nScore; + } + } + } + } + else { + if ((nCodingChoiceCost - pDestSlots[n].cost) >= nNoRepMatchOffsetCostDelta) + break; + } + } + if (cur_arrival[j].follows_literal == 0 || nNoRepMatchOffsetCostDelta == 0) + break; + } + else { + break; + } + } + } + } + + /* Insert repmatch candidate */ + + if (k > nOverallMinRepLen && k <= nOverallMaxRepLen) { + int nRepMatchCmdCost = TOKEN_SIZE_LARGE_MATCH + 2 /* apultra_get_gamma2_size(2) */ + nRepMatchMatchLenCost; + int nCurRepMatchArrival; + + if (k <= 90) + nOverallMinRepLen = k; + else if (nOverallMaxRepLen == k) + nOverallMaxRepLen--; + + for (nCurRepMatchArrival = 0; (j = nRepMatchArrivalIdx[nCurRepMatchArrival]) >= 0; nCurRepMatchArrival++) { + if (nRepLenForArrival[j] >= k) { + int nPrevCost = cur_arrival[j].cost & 0x3fffffff; + int nRepCodingChoiceCost = nPrevCost + nRepMatchCmdCost; + int nScore = cur_arrival[j].score + 2; + + if (nRepCodingChoiceCost < pDestSlots[nArrivalsPerPosition - 1].cost || + (nRepCodingChoiceCost == pDestSlots[nArrivalsPerPosition - 1].cost && nScore < pDestSlots[nArrivalsPerPosition - 1].score)) { + int nRepOffset = cur_arrival[j].rep_offset; + int exists = 0; + + for (n = 0; + pDestSlots[n].cost < nRepCodingChoiceCost; + n++) { + if (pDestSlots[n].rep_offset == nRepOffset) { + exists = 1; + break; + } + } + + if (!exists) { + for (; + n < nArrivalsPerPosition && pDestSlots[n].cost == nRepCodingChoiceCost && nScore >= pDestSlots[n].score; + n++) { + if (pDestSlots[n].rep_offset == nRepOffset) { + exists = 1; + break; + } + } + + if (!exists) { + if (n < nArrivalsPerPosition) { + int nn; + + for (nn = n; + nn < nArrivalsPerPosition && pDestSlots[nn].cost == nRepCodingChoiceCost; + nn++) { + if (pDestSlots[nn].rep_offset == nRepOffset) { + exists = 1; + break; + } + } + + if (!exists) { + int z; + + for (z = n; z < nArrivalsPerPosition - 1 && pDestSlots[z].from_slot; z++) { + if (pDestSlots[z].rep_offset == nRepOffset) + break; + } + + apultra_arrival* pDestArrival = &pDestSlots[n]; + memmove(&pDestSlots[n + 1], + &pDestSlots[n], + sizeof(apultra_arrival) * (z - n)); + + pDestArrival->cost = nRepCodingChoiceCost; + pDestArrival->from_pos = i; + pDestArrival->from_slot = j + 1; + pDestArrival->follows_literal = 0; + pDestArrival->rep_offset = nRepOffset; + pDestArrival->short_offset = 0; + pDestArrival->rep_pos = i; + pDestArrival->match_len = k; + pDestArrival->score = nScore; + } + } + } + } + } + else { + break; + } + } + } + } + + if (k == 3 && nMatchOffset < 128) { + nNoRepMatchOffsetCostForLit[0] = 8 + TOKEN_SIZE_LARGE_MATCH + 2 /* apultra_get_gamma2_size((nMatchOffset >> 8) + 2) */; + nNoRepMatchOffsetCostForLit[1] = 8 + TOKEN_SIZE_LARGE_MATCH + 2 /* apultra_get_gamma2_size((nMatchOffset >> 8) + 3) */; + } + + if (k == nJumpMatchLen) + k = nMatchLen - 1; + } + } + + if (nOrigMatchLen >= 512) + break; + } + } + } + + if (!nInsertForwardReps) { + const apultra_arrival* end_arrival = &arrival[(i * nArrivalsPerPosition) + 0]; + apultra_final_match* pBestMatch = pCompressor->best_match - nStartOffset; + + while (end_arrival->from_slot > 0 && end_arrival->from_pos >= 0 && (int)end_arrival->from_pos < nEndOffset) { + pBestMatch[end_arrival->from_pos].length = end_arrival->match_len; + if (end_arrival->match_len >= 2) + pBestMatch[end_arrival->from_pos].offset = end_arrival->rep_offset; + else + pBestMatch[end_arrival->from_pos].offset = end_arrival->short_offset; + + end_arrival = &arrival[(end_arrival->from_pos * nArrivalsPerPosition) + (end_arrival->from_slot - 1)]; + } + } +} + +/** + * Attempt to replace matches by literals when it makes the final bitstream smaller, and merge large matches + * + * @param pCompressor compression context + * @param pInWindow pointer to input data window (previously compressed bytes + bytes to compress) + * @param pBestMatch optimal matches to evaluate and update + * @param nStartOffset current offset in input window (typically the number of previously compressed bytes) + * @param nEndOffset offset to end finding matches at (typically the size of the total input window in bytes + * @param nCurRepMatchOffset starting rep offset for this block + * @param nBlockFlags bit 0: 1 for first block, 0 otherwise; bit 1: 1 for last block, 0 otherwise + * + * @return non-zero if the number of tokens was reduced, 0 if it wasn't + */ +static int apultra_reduce_commands(apultra_compressor *pCompressor, const unsigned char *pInWindow, apultra_final_match *pBestMatch, const int nStartOffset, const int nEndOffset, const int *nCurRepMatchOffset, const int nBlockFlags) { + int i; + int nRepMatchOffset = *nCurRepMatchOffset; + int nFollowsLiteral = 0; + int nDidReduce = 0; + int nLastMatchLen = 0; + const unsigned char *match1 = pCompressor->match1 - nStartOffset; + + for (i = nStartOffset + ((nBlockFlags & 1) ? 1 : 0); i < nEndOffset; ) { + apultra_final_match *pMatch = pBestMatch + i; + + if (pMatch->length <= 1 && + (i + 1) < nEndOffset && + pBestMatch[i + 1].length >= 2 && + pBestMatch[i + 1].length < MAX_VARLEN && + pBestMatch[i + 1].offset && + i >= pBestMatch[i + 1].offset && + (i + pBestMatch[i + 1].length + 1) <= nEndOffset && + !memcmp(pInWindow + i - (pBestMatch[i + 1].offset), pInWindow + i, pBestMatch[i + 1].length + 1)) { + if ((pBestMatch[i + 1].offset < MINMATCH3_OFFSET || (pBestMatch[i + 1].length + 1) >= 3 || (pBestMatch[i + 1].offset == nRepMatchOffset && nFollowsLiteral)) && + (pBestMatch[i + 1].offset < MINMATCH4_OFFSET || (pBestMatch[i + 1].length + 1) >= 4 || (pBestMatch[i + 1].offset == nRepMatchOffset && nFollowsLiteral))) { + + int nCurPartialCommandSize = (pMatch->length == 1) ? (TOKEN_SIZE_4BIT_MATCH + 4) : (1 /* literal bit */ + 8 /* literal size */); + if (pBestMatch[i + 1].offset == nRepMatchOffset /* always follows a literal, the one at the current position */) { + nCurPartialCommandSize += TOKEN_SIZE_LARGE_MATCH + 2 /* apultra_get_gamma2_size(2) */ + apultra_get_gamma2_size(pBestMatch[i + 1].length); + } + else { + nCurPartialCommandSize += apultra_get_offset_varlen_size(pBestMatch[i + 1].length, pBestMatch[i + 1].offset, 1) + apultra_get_match_varlen_size(pBestMatch[i + 1].length, pBestMatch[i + 1].offset); + } + + int nReducedPartialCommandSize; + if (pBestMatch[i + 1].offset == nRepMatchOffset && nFollowsLiteral) { + nReducedPartialCommandSize = TOKEN_SIZE_LARGE_MATCH + 2 /* apultra_get_gamma2_size(2) */ + apultra_get_gamma2_size(pBestMatch[i + 1].length); + } + else { + nReducedPartialCommandSize = apultra_get_offset_varlen_size(pBestMatch[i + 1].length, pBestMatch[i + 1].offset, nFollowsLiteral) + apultra_get_match_varlen_size(pBestMatch[i + 1].length, pBestMatch[i + 1].offset); + } + + if (nReducedPartialCommandSize < nCurPartialCommandSize || (nFollowsLiteral == 0 && nLastMatchLen >= LCP_MAX)) { + /* Merge */ + pBestMatch[i].length = pBestMatch[i + 1].length + 1; + pBestMatch[i].offset = pBestMatch[i + 1].offset; + pBestMatch[i + 1].length = 0; + pBestMatch[i + 1].offset = 0; + nDidReduce = 1; + continue; + } + } + } + + if (pMatch->length >= 2) { + if (pMatch->length < 32 && /* Don't waste time considering large matches, they will always win over literals */ + (i + pMatch->length) < nEndOffset /* Don't consider the last match in the block, we can only reduce a match inbetween other tokens */) { + int nNextIndex = i + pMatch->length; + int nNextFollowsLiteral = 0; + int nCannotEncode = 0; + + while (nNextIndex < nEndOffset && pBestMatch[nNextIndex].length < 2) { + nNextIndex++; + nNextFollowsLiteral = 1; + } + + if (nNextIndex < nEndOffset && pBestMatch[nNextIndex].length >= 2) { + if (nRepMatchOffset && nRepMatchOffset != pMatch->offset && pBestMatch[nNextIndex].offset && pMatch->offset != pBestMatch[nNextIndex].offset && + nNextFollowsLiteral) { + /* Try to gain a match forward */ + if (i >= pBestMatch[nNextIndex].offset && (i - pBestMatch[nNextIndex].offset + pMatch->length) <= nEndOffset) { + if ((pBestMatch[nNextIndex].offset < MINMATCH3_OFFSET || pMatch->length >= 3) && + (pBestMatch[nNextIndex].offset < MINMATCH4_OFFSET || pMatch->length >= 4)) { + int nMaxLen = 0; + const unsigned char* pInWindowAtPos = pInWindow + i; + while (nMaxLen < pMatch->length && pInWindowAtPos[nMaxLen - pBestMatch[nNextIndex].offset] == pInWindowAtPos[nMaxLen]) + nMaxLen++; + + if (nMaxLen >= pMatch->length) { + /* Replace */ + pMatch->offset = pBestMatch[nNextIndex].offset; + nDidReduce = 1; + } + else if (nMaxLen >= 2) { + if ((nFollowsLiteral && nRepMatchOffset == pBestMatch[nNextIndex].offset) || + ((pBestMatch[nNextIndex].offset < MINMATCH3_OFFSET || nMaxLen >= 3) && + (pBestMatch[nNextIndex].offset < MINMATCH4_OFFSET || nMaxLen >= 4))) { + + int nPartialSizeBefore, nPartialSizeAfter, j; + + nPartialSizeBefore = apultra_get_offset_varlen_size(pMatch->length, pMatch->offset, nFollowsLiteral); + nPartialSizeBefore += apultra_get_match_varlen_size(pMatch->length, pMatch->offset); + + nPartialSizeBefore += apultra_get_offset_varlen_size(pBestMatch[nNextIndex].length, pBestMatch[nNextIndex].offset, 1); + nPartialSizeBefore += apultra_get_match_varlen_size(pBestMatch[nNextIndex].length, pBestMatch[nNextIndex].offset); + + nPartialSizeAfter = apultra_get_offset_varlen_size(nMaxLen, pBestMatch[nNextIndex].offset, nFollowsLiteral); + if (nFollowsLiteral && nRepMatchOffset == pBestMatch[nNextIndex].offset) + nPartialSizeAfter += apultra_get_gamma2_size(nMaxLen); + else + nPartialSizeAfter += apultra_get_match_varlen_size(nMaxLen, pBestMatch[nNextIndex].offset); + + nPartialSizeAfter += TOKEN_SIZE_LARGE_MATCH + 2 /* apultra_get_gamma2_size(2) */; + nPartialSizeAfter += apultra_get_gamma2_size(pBestMatch[nNextIndex].length); + + for (j = nMaxLen; j < pMatch->length; j++) { + if (pInWindow[i + j] == 0 || match1[i + j]) + nPartialSizeAfter += TOKEN_SIZE_4BIT_MATCH + 4; + else + nPartialSizeAfter += 1 /* literal bit */ + 8 /* literal byte */; + } + + if (nPartialSizeAfter < nPartialSizeBefore) { + /* We gain a repmatch that is shorter than the original match as this is the best we can do, so it is followed by extra literals, but + * we have calculated that this is shorter */ + + int nOrigLen = pMatch->length; + int j; + + pMatch->offset = pBestMatch[nNextIndex].offset; + pMatch->length = nMaxLen; + + for (j = nMaxLen; j < nOrigLen; j++) { + pBestMatch[i + j].offset = match1[i + j]; + pBestMatch[i + j].length = (pInWindow[i + j] && match1[i+j] == 0) ? 0 : 1; + } + + nDidReduce = 1; + continue; + } + } + } + } + } + } + + /* Calculate this command's current cost */ + + int nCurCommandSize; + if (pMatch->offset == nRepMatchOffset && nFollowsLiteral) { + nCurCommandSize = TOKEN_SIZE_LARGE_MATCH + 2 /* apultra_get_gamma2_size(2) */ + apultra_get_gamma2_size(pMatch->length); + } + else { + nCurCommandSize = apultra_get_offset_varlen_size(pMatch->length, pMatch->offset, nFollowsLiteral) + apultra_get_match_varlen_size(pMatch->length, pMatch->offset); + } + + /* Calculate the next command's current cost */ + int nNextCommandSize; + if (pBestMatch[nNextIndex].offset == pMatch->offset && nNextFollowsLiteral && pBestMatch[nNextIndex].length >= 2) { + nNextCommandSize = TOKEN_SIZE_LARGE_MATCH + 2 /* apultra_get_gamma2_size(2) */ + apultra_get_gamma2_size(pBestMatch[nNextIndex].length); + } + else { + nNextCommandSize = apultra_get_offset_varlen_size(pBestMatch[nNextIndex].length, pBestMatch[nNextIndex].offset, nNextFollowsLiteral) + apultra_get_match_varlen_size(pBestMatch[nNextIndex].length, pBestMatch[nNextIndex].offset); + } + + int nOriginalCombinedCommandSize = nCurCommandSize + nNextCommandSize; + + /* Calculate the cost of replacing this match command by literals + the effect on the cost of the next command */ + int nReducedCommandSize = 0; + int j; + + for (j = 0; j < pMatch->length; j++) { + if (pInWindow[i + j] == 0 || match1[i + j]) + nReducedCommandSize += TOKEN_SIZE_4BIT_MATCH + 4; + else + nReducedCommandSize += 1 /* literal bit */ + 8; + } + + if (pBestMatch[nNextIndex].offset == nRepMatchOffset /* the new command would always follow literals, the ones we create */ && pBestMatch[nNextIndex].length >= 2) { + nReducedCommandSize += TOKEN_SIZE_LARGE_MATCH + 2 /* apultra_get_gamma2_size(2) */ + apultra_get_gamma2_size(pBestMatch[nNextIndex].length); + } + else { + if ((pBestMatch[nNextIndex].length < 3 && pBestMatch[nNextIndex].offset >= MINMATCH3_OFFSET) || + (pBestMatch[nNextIndex].length < 4 && pBestMatch[nNextIndex].offset >= MINMATCH4_OFFSET)) { + /* This match length can only be encoded with a rep-match */ + nCannotEncode = 1; + } + else { + nReducedCommandSize += apultra_get_offset_varlen_size(pBestMatch[nNextIndex].length, pBestMatch[nNextIndex].offset, 1 /* follows literals */) + apultra_get_match_varlen_size(pBestMatch[nNextIndex].length, pBestMatch[nNextIndex].offset); + } + } + + if (!nCannotEncode && nOriginalCombinedCommandSize > nReducedCommandSize) { + /* Reduce */ + int nMatchLen = pMatch->length; + int j; + + for (j = 0; j < nMatchLen; j++) { + pBestMatch[i + j].offset = match1[i + j]; + pBestMatch[i + j].length = (pInWindow[i + j] && match1[i + j] == 0) ? 0 : 1; + } + + nDidReduce = 1; + continue; + } + } + } + + if ((i + pMatch->length) < nEndOffset && pMatch->offset > 0 && + pBestMatch[i + pMatch->length].offset > 0 && + pBestMatch[i + pMatch->length].length >= 2 && + (pMatch->length + pBestMatch[i + pMatch->length].length) >= LEAVE_ALONE_MATCH_SIZE && + (pMatch->length + pBestMatch[i + pMatch->length].length) <= MAX_VARLEN && + (i + pMatch->length) >= pMatch->offset && + (i + pMatch->length) >= pBestMatch[i + pMatch->length].offset && + (i + pMatch->length + pBestMatch[i + pMatch->length].length) <= nEndOffset && + !memcmp(pInWindow + i + pMatch->length - pMatch->offset, + pInWindow + i + pMatch->length - pBestMatch[i + pMatch->length].offset, + pBestMatch[i + pMatch->length].length)) { + int nMatchLen = pMatch->length; + + /* Join large matches */ + + int nNextIndex = i + pMatch->length + pBestMatch[i + pMatch->length].length; + int nNextFollowsLiteral = 0; + int nCannotEncode = 0; + + while (nNextIndex < nEndOffset && pBestMatch[nNextIndex].length < 2) { + nNextIndex++; + nNextFollowsLiteral = 1; + } + + if (nNextIndex < nEndOffset && nNextFollowsLiteral && pBestMatch[nNextIndex].length >= 2 && + pBestMatch[nNextIndex].offset == pBestMatch[i + pMatch->length].offset) { + if ((pBestMatch[nNextIndex].offset >= MINMATCH3_OFFSET && pBestMatch[nNextIndex].length < 3) || + (pBestMatch[nNextIndex].offset >= MINMATCH4_OFFSET && pBestMatch[nNextIndex].length < 4)) { + nCannotEncode = 1; + } + } + + if (!nCannotEncode) { + pMatch->length += pBestMatch[i + nMatchLen].length; + pBestMatch[i + nMatchLen].offset = 0; + pBestMatch[i + nMatchLen].length = -1; + nDidReduce = 1; + continue; + } + } + + nRepMatchOffset = pMatch->offset; + nFollowsLiteral = 0; + nLastMatchLen = pMatch->length; + + i += pMatch->length; + } + else { + /* 4 bits offset (1 byte match) or literal */ + i++; + nFollowsLiteral = 1; + nLastMatchLen = 0; + } + } + + return nDidReduce; +} + +/** + * Emit a block of compressed data + * + * @param pCompressor compression context + * @param pBestMatch optimal matches to emit + * @param pInWindow pointer to input data window (previously compressed bytes + bytes to compress) + * @param nStartOffset current offset in input window (typically the number of previously compressed bytes) + * @param nEndOffset offset to end finding matches at (typically the size of the total input window in bytes + * @param pOutData pointer to output buffer + * @param nMaxOutDataSize maximum size of output buffer, in bytes + * @param nCurBitsOffset write index into output buffer, of current byte being filled with bits + * @param nCurBitShift bit shift count + * @param nFollowsLiteral non-zero if the next command to be issued follows a literal, 0 if not + * @param nCurRepMatchOffset starting rep offset for this block, updated after the block is compressed successfully + * @param nBlockFlags bit 0: 1 for first block, 0 otherwise; bit 1: 1 for last block, 0 otherwise + * + * @return size of compressed data in output buffer, or -1 if the data is uncompressible + */ +static int apultra_write_block(apultra_compressor *pCompressor, apultra_final_match *pBestMatch, const unsigned char *pInWindow, const int nStartOffset, const int nEndOffset, unsigned char *pOutData, int nOutOffset, const int nMaxOutDataSize, int *nCurBitsOffset, int *nCurBitShift, int *nFollowsLiteral, int *nCurRepMatchOffset, const int nBlockFlags) { + int i; + int nRepMatchOffset = *nCurRepMatchOffset; + const int nMaxOffset = pCompressor->max_offset; + + if (nBlockFlags & 1) { + if (nOutOffset < 0 || nOutOffset >= nMaxOutDataSize) + return -1; + pOutData[nOutOffset++] = pInWindow[nStartOffset]; + *nFollowsLiteral = 1; + } + + for (i = nStartOffset + ((nBlockFlags & 1) ? 1 : 0); i < nEndOffset; ) { + const apultra_final_match *pMatch = pBestMatch + i; + + if (pMatch->length >= 2) { + int nMatchOffset = pMatch->offset; + int nMatchLen = pMatch->length; + + if (nMatchOffset < MIN_OFFSET || nMatchOffset > nMaxOffset) + return -1; + + if (nMatchOffset == nRepMatchOffset && *nFollowsLiteral) { + /* Rep-match */ + nOutOffset = apultra_write_bits(pOutData, nOutOffset, nMaxOutDataSize, TOKEN_CODE_LARGE_MATCH, TOKEN_SIZE_LARGE_MATCH, nCurBitsOffset, nCurBitShift); + nOutOffset = apultra_write_bits(pOutData, nOutOffset, nMaxOutDataSize, 0 /* length of 2 encoded as gamma 2 */, 2, nCurBitsOffset, nCurBitShift); + + /* The match length isn't encoded in the command, emit elias gamma value */ + nOutOffset = apultra_write_gamma2_value(pOutData, nOutOffset, nMaxOutDataSize, nMatchLen, nCurBitsOffset, nCurBitShift); + if (nOutOffset < 0) return -1; + + *nFollowsLiteral = 0; + + pCompressor->stats.num_rep_matches++; + } + else { + if (nMatchLen <= 3 && nMatchOffset < 128) { + /* 7 bits offset + 1 bit length */ + nOutOffset = apultra_write_bits(pOutData, nOutOffset, nMaxOutDataSize, TOKEN_CODE_7BIT_MATCH, TOKEN_SIZE_7BIT_MATCH, nCurBitsOffset, nCurBitShift); + + if (nOutOffset < 0 || nOutOffset >= nMaxOutDataSize) + return -1; + pOutData[nOutOffset++] = ((nMatchOffset) & 0x7f) << 1 | (nMatchLen - 2); + + *nFollowsLiteral = 0; + nRepMatchOffset = nMatchOffset; + + pCompressor->stats.num_7bit_matches++; + } + else { + /* 8+n bits offset */ + nOutOffset = apultra_write_bits(pOutData, nOutOffset, nMaxOutDataSize, TOKEN_CODE_LARGE_MATCH, TOKEN_SIZE_LARGE_MATCH, nCurBitsOffset, nCurBitShift); + + if (nOutOffset < 0 || nOutOffset >= nMaxOutDataSize) + return -1; + if (*nFollowsLiteral) + nOutOffset = apultra_write_gamma2_value(pOutData, nOutOffset, nMaxOutDataSize, (nMatchOffset >> 8) + 3, nCurBitsOffset, nCurBitShift); + else + nOutOffset = apultra_write_gamma2_value(pOutData, nOutOffset, nMaxOutDataSize, (nMatchOffset >> 8) + 2, nCurBitsOffset, nCurBitShift); + pOutData[nOutOffset++] = nMatchOffset & 0xff; + + /* The match length isn't encoded in the command, emit elias gamma value */ + + if (nMatchOffset < 128 || nMatchOffset >= MINMATCH4_OFFSET) + nOutOffset = apultra_write_gamma2_value(pOutData, nOutOffset, nMaxOutDataSize, nMatchLen - 2, nCurBitsOffset, nCurBitShift); + else if (nMatchOffset < MINMATCH3_OFFSET) + nOutOffset = apultra_write_gamma2_value(pOutData, nOutOffset, nMaxOutDataSize, nMatchLen, nCurBitsOffset, nCurBitShift); + else + nOutOffset = apultra_write_gamma2_value(pOutData, nOutOffset, nMaxOutDataSize, nMatchLen - 1, nCurBitsOffset, nCurBitShift); + if (nOutOffset < 0) return -1; + + *nFollowsLiteral = 0; + nRepMatchOffset = nMatchOffset; + + pCompressor->stats.num_variable_matches++; + } + } + + if (nMatchOffset < pCompressor->stats.min_offset || pCompressor->stats.min_offset == -1) + pCompressor->stats.min_offset = nMatchOffset; + if (nMatchOffset > pCompressor->stats.max_offset) + pCompressor->stats.max_offset = nMatchOffset; + pCompressor->stats.total_offsets += (long long)nMatchOffset; + + if (nMatchLen < pCompressor->stats.min_match_len || pCompressor->stats.min_match_len == -1) + pCompressor->stats.min_match_len = nMatchLen; + if (nMatchLen > pCompressor->stats.max_match_len) + pCompressor->stats.max_match_len = nMatchLen; + pCompressor->stats.total_match_lens += nMatchLen; + pCompressor->stats.match_divisor++; + + if (nMatchOffset == 1) { + if (nMatchLen < pCompressor->stats.min_rle1_len || pCompressor->stats.min_rle1_len == -1) + pCompressor->stats.min_rle1_len = nMatchLen; + if (nMatchLen > pCompressor->stats.max_rle1_len) + pCompressor->stats.max_rle1_len = nMatchLen; + pCompressor->stats.total_rle1_lens += nMatchLen; + pCompressor->stats.rle1_divisor++; + } + else if (nMatchOffset == 2) { + if (nMatchLen < pCompressor->stats.min_rle2_len || pCompressor->stats.min_rle2_len == -1) + pCompressor->stats.min_rle2_len = nMatchLen; + if (nMatchLen > pCompressor->stats.max_rle2_len) + pCompressor->stats.max_rle2_len = nMatchLen; + pCompressor->stats.total_rle2_lens += nMatchLen; + pCompressor->stats.rle2_divisor++; + } + + i += nMatchLen; + + pCompressor->stats.commands_divisor++; + } + else if (pMatch->length == 1) { + int nMatchOffset = pMatch->offset; + + /* 4 bits offset */ + + if (nMatchOffset < 0 || nMatchOffset > 15) + return -1; + + nOutOffset = apultra_write_bits(pOutData, nOutOffset, nMaxOutDataSize, TOKEN_CODE_4BIT_MATCH, TOKEN_SIZE_4BIT_MATCH, nCurBitsOffset, nCurBitShift); + nOutOffset = apultra_write_bits(pOutData, nOutOffset, nMaxOutDataSize, nMatchOffset, 4, nCurBitsOffset, nCurBitShift); + if (nOutOffset < 0) return -1; + + pCompressor->stats.num_4bit_matches++; + pCompressor->stats.commands_divisor++; + + i++; + *nFollowsLiteral = 1; + } + else { + /* Literal */ + + nOutOffset = apultra_write_bits(pOutData, nOutOffset, nMaxOutDataSize, 0 /* literal */, 1, nCurBitsOffset, nCurBitShift); + + if (nOutOffset < 0 || nOutOffset >= nMaxOutDataSize) + return -1; + pOutData[nOutOffset++] = pInWindow[i]; + + pCompressor->stats.num_literals++; + pCompressor->stats.commands_divisor++; + i++; + *nFollowsLiteral = 1; + } + + int nCurSafeDist = (i - nStartOffset) - nOutOffset; + if (nCurSafeDist >= 0 && pCompressor->stats.safe_dist < nCurSafeDist) + pCompressor->stats.safe_dist = nCurSafeDist; + } + + if (nBlockFlags & 2) { + /* 8 bits offset */ + + nOutOffset = apultra_write_bits(pOutData, nOutOffset, nMaxOutDataSize, TOKEN_CODE_7BIT_MATCH, TOKEN_SIZE_7BIT_MATCH, nCurBitsOffset, nCurBitShift); + + if (nOutOffset < 0 || nOutOffset >= nMaxOutDataSize) + return -1; + pOutData[nOutOffset++] = 0x00; /* Offset: EOD */ + pCompressor->stats.num_eod++; + pCompressor->stats.commands_divisor++; + + int nCurSafeDist = (i - nStartOffset) - nOutOffset; + if (nCurSafeDist >= 0 && pCompressor->stats.safe_dist < nCurSafeDist) + pCompressor->stats.safe_dist = nCurSafeDist; + } + + *nCurRepMatchOffset = nRepMatchOffset; + return nOutOffset; +} + +/** + * Select the most optimal matches, reduce the token count if possible, and then emit a block of compressed data + * + * @param pCompressor compression context + * @param pInWindow pointer to input data window (previously compressed bytes + bytes to compress) + * @param nPreviousBlockSize number of previously compressed bytes (or 0 for none) + * @param nInDataSize number of input bytes to compress + * @param pOutData pointer to output buffer + * @param nMaxOutDataSize maximum size of output buffer, in bytes + * @param nCurBitsOffset write index into output buffer, of current byte being filled with bits + * @param nCurBitShift bit shift count + * @param nCurFollowsLiteral non-zero if the next command to be issued follows a literal, 0 if not + * @param nCurRepMatchOffset starting rep offset for this block, updated after the block is compressed successfully + * @param nBlockFlags bit 0: 1 for first block, 0 otherwise; bit 1: 1 for last block, 0 otherwise + * + * @return size of compressed data in output buffer, or -1 if the data is uncompressible + */ +static int apultra_optimize_and_write_block(apultra_compressor *pCompressor, const unsigned char *pInWindow, const int nPreviousBlockSize, const int nInDataSize, unsigned char *pOutData, const int nMaxOutDataSize, int *nCurBitsOffset, int *nCurBitShift, int *nCurFollowsLiteral, int *nCurRepMatchOffset, const int nBlockFlags) { + int nOutOffset = 0; + const int nEndOffset = nPreviousBlockSize + nInDataSize; + const int nArrivalsPerPosition = pCompressor->max_arrivals; + int *rle_len = (int*)pCompressor->intervals /* reuse */; + int i, nPosition; + + memset(pCompressor->best_match, 0, pCompressor->block_size * sizeof(apultra_final_match)); + + if ((nBlockFlags & 3) == 3) { + int *first_offset_for_byte = pCompressor->first_offset_for_byte; + int *next_offset_for_pos = pCompressor->next_offset_for_pos; + + /* Supplement 2 and 3-byte matches */ + + memset(first_offset_for_byte, 0xff, sizeof(int) * 65536); + memset(next_offset_for_pos, 0xff, sizeof(int) * nInDataSize); + + for (nPosition = nPreviousBlockSize; nPosition < (nEndOffset - 1); nPosition++) { + next_offset_for_pos[nPosition - nPreviousBlockSize] = first_offset_for_byte[((unsigned int)pInWindow[nPosition]) | (((unsigned int)pInWindow[nPosition + 1]) << 8)]; + first_offset_for_byte[((unsigned int)pInWindow[nPosition]) | (((unsigned int)pInWindow[nPosition + 1]) << 8)] = nPosition; + } + + for (nPosition = nPreviousBlockSize + 1; nPosition < (nEndOffset - 1); nPosition++) { + apultra_match *match = pCompressor->match + ((nPosition - nPreviousBlockSize) << MATCHES_PER_INDEX_SHIFT); + unsigned short *match_depth = pCompressor->match_depth + ((nPosition - nPreviousBlockSize) << MATCHES_PER_INDEX_SHIFT); + int m = 0, nInserted = 0; + int nMatchPos; + + while (m < 15 && match[m].length) + m++; + + for (nMatchPos = next_offset_for_pos[nPosition - nPreviousBlockSize]; m < 15 && nMatchPos >= 0; nMatchPos = next_offset_for_pos[nMatchPos - nPreviousBlockSize]) { + int nMatchOffset = nPosition - nMatchPos; + + if (nMatchOffset <= pCompressor->max_offset) { + int nExistingMatchIdx; + int nAlreadyExists = 0; + + for (nExistingMatchIdx = 0; nExistingMatchIdx < m; nExistingMatchIdx++) { + if (match[nExistingMatchIdx].offset == nMatchOffset || + (match[nExistingMatchIdx].offset - (match_depth[nExistingMatchIdx] & 0x3fff)) == nMatchOffset) { + nAlreadyExists = 1; + break; + } + } + + if (!nAlreadyExists) { + match[m].length = (nPosition < (nEndOffset - 2) && pInWindow[nMatchPos + 2] == pInWindow[nPosition + 2]) ? 3 : 2; + match[m].offset = nMatchOffset; + match_depth[m] = 0x4000; + m++; + nInserted++; + if (nInserted >= 6) + break; + } + } + else { + break; + } + } + } + } + + i = 0; + while (i < nEndOffset) { + int nRangeStartIdx = i; + unsigned char c = pInWindow[nRangeStartIdx]; + do { + i++; + } + while (i < nEndOffset && pInWindow[i] == c); + while (nRangeStartIdx < i) { + rle_len[nRangeStartIdx] = i - nRangeStartIdx; + nRangeStartIdx++; + } + } + + apultra_optimize_forward(pCompressor, pInWindow, nPreviousBlockSize, nEndOffset, 1 /* nInsertForwardReps */, nCurRepMatchOffset, nBlockFlags, nArrivalsPerPosition); + + if ((nBlockFlags & 3) == 3 && nArrivalsPerPosition == NARRIVALS_PER_POSITION_MAX) { + const int* next_offset_for_pos = pCompressor->next_offset_for_pos; + int* offset_cache = pCompressor->offset_cache; + + /* Supplement matches further */ + + memset(offset_cache, 0xff, sizeof(int) * 2048); + + for (nPosition = nPreviousBlockSize + 1; nPosition < (nEndOffset - 1); nPosition++) { + apultra_match* match = pCompressor->match + ((nPosition - nPreviousBlockSize) << MATCHES_PER_INDEX_SHIFT); + + if (match[0].length < 8) { + unsigned short* match_depth = pCompressor->match_depth + ((nPosition - nPreviousBlockSize) << MATCHES_PER_INDEX_SHIFT); + int m = 0, nInserted = 0; + int nMatchPos; + + while (m < 46 && match[m].length) { + offset_cache[match[m].offset & 2047] = nPosition; + offset_cache[(match[m].offset - (match_depth[m] & 0x3fff)) & 2047] = nPosition; + m++; + } + + for (nMatchPos = next_offset_for_pos[nPosition - nPreviousBlockSize]; m < 46 && nMatchPos >= 0; nMatchPos = next_offset_for_pos[nMatchPos - nPreviousBlockSize]) { + int nMatchOffset = nPosition - nMatchPos; + + if (nMatchOffset <= pCompressor->max_offset) { + int nAlreadyExists = 0; + + if (offset_cache[nMatchOffset & 2047] == nPosition) { + int nExistingMatchIdx; + + for (nExistingMatchIdx = 0; nExistingMatchIdx < m; nExistingMatchIdx++) { + if (match[nExistingMatchIdx].offset == nMatchOffset || + (match[nExistingMatchIdx].offset - (match_depth[nExistingMatchIdx] & 0x3fff)) == nMatchOffset) { + nAlreadyExists = 1; + + if (match_depth[nExistingMatchIdx] == 0x4000) { + int nMatchLen = 2; + while (nMatchLen < 16 && nPosition < (nEndOffset - nMatchLen) && pInWindow[nMatchPos + nMatchLen] == pInWindow[nPosition + nMatchLen]) + nMatchLen++; + if (nMatchLen > (int)match[nExistingMatchIdx].length) + match[nExistingMatchIdx].length = nMatchLen; + } + + break; + } + } + } + + if (!nAlreadyExists) { + int nForwardPos = nPosition + 2 + 1; + int nGotMatch = 0; + + while (nForwardPos >= nMatchOffset && (nForwardPos + 2) < nEndOffset && nForwardPos < (nPosition + 2 + 1 + 5)) { + if (!memcmp(pInWindow + nForwardPos, pInWindow + nForwardPos - nMatchOffset, 2)) { + nGotMatch = 1; + break; + } + nForwardPos++; + } + + if (nGotMatch) { + int nMatchLen = 2; + while (nMatchLen < 16 && nPosition < (nEndOffset - nMatchLen) && pInWindow[nMatchPos + nMatchLen] == pInWindow[nPosition + nMatchLen]) + nMatchLen++; + match[m].length = nMatchLen; + match[m].offset = nMatchOffset; + match_depth[m] = 0; + m++; + + apultra_insert_forward_match(pCompressor, pInWindow, nPosition, nMatchOffset, nPreviousBlockSize, nEndOffset, nArrivalsPerPosition, 8); + + nInserted++; + if (nInserted >= 18 || (nInserted >= 15 && m >= 38)) + break; + } + } + } + else { + break; + } + } + } + } + } + + /* Pick optimal matches */ + apultra_optimize_forward(pCompressor, pInWindow, nPreviousBlockSize, nEndOffset, 0 /* nInsertForwardReps */, nCurRepMatchOffset, nBlockFlags, nArrivalsPerPosition); + + /* Apply reduction and merge pass */ + int nDidReduce; + int nPasses = 0; + do { + nDidReduce = apultra_reduce_commands(pCompressor, pInWindow, pCompressor->best_match - nPreviousBlockSize, nPreviousBlockSize, nEndOffset, nCurRepMatchOffset, nBlockFlags); + nPasses++; + } while (nDidReduce && nPasses < 20); + + /* Write compressed block */ + + return apultra_write_block(pCompressor, pCompressor->best_match - nPreviousBlockSize, pInWindow, nPreviousBlockSize, nEndOffset, pOutData, nOutOffset, nMaxOutDataSize, nCurBitsOffset, nCurBitShift, nCurFollowsLiteral, nCurRepMatchOffset, nBlockFlags); +} + +/* Forward declaration */ +static void apultra_compressor_destroy(apultra_compressor *pCompressor); + +/** + * Initialize compression context + * + * @param pCompressor compression context to initialize + * @param nBlockSize maximum size of input data (bytes to compress only) + * @param nMaxWindowSize maximum size of input data window (previously compressed bytes + bytes to compress) + * @param nMaxArrivals maximum number of arrivals per position + * @param nFlags compression flags + * + * @return 0 for success, non-zero for failure + */ +static int apultra_compressor_init(apultra_compressor *pCompressor, const int nBlockSize, const int nMaxWindowSize, const int nMaxArrivals, const int nFlags) { + int nResult; + + nResult = divsufsort_init(&pCompressor->divsufsort_context); + pCompressor->intervals = NULL; + pCompressor->pos_data = NULL; + pCompressor->open_intervals = NULL; + pCompressor->match = NULL; + pCompressor->match_depth = NULL; + pCompressor->match1 = NULL; + pCompressor->best_match = NULL; + pCompressor->arrival = NULL; + pCompressor->first_offset_for_byte = NULL; + pCompressor->next_offset_for_pos = NULL; + pCompressor->offset_cache = NULL; + pCompressor->flags = nFlags; + pCompressor->block_size = nBlockSize; + pCompressor->max_arrivals = nMaxArrivals; + + memset(&pCompressor->stats, 0, sizeof(pCompressor->stats)); + pCompressor->stats.min_match_len = -1; + pCompressor->stats.min_offset = -1; + pCompressor->stats.min_rle1_len = -1; + pCompressor->stats.min_rle2_len = -1; + + if (!nResult) { + pCompressor->intervals = (unsigned long long *)malloc(nMaxWindowSize * sizeof(unsigned long long)); + + if (pCompressor->intervals) { + pCompressor->pos_data = (unsigned long long *)malloc(nMaxWindowSize * sizeof(unsigned long long)); + + if (pCompressor->pos_data) { + pCompressor->open_intervals = (unsigned long long *)malloc((LCP_AND_TAG_MAX + 1) * sizeof(unsigned long long)); + + if (pCompressor->open_intervals) { + pCompressor->arrival = (apultra_arrival *)malloc((nBlockSize + 1) * nMaxArrivals * sizeof(apultra_arrival)); + + if (pCompressor->arrival) { + pCompressor->best_match = (apultra_final_match *)malloc(nBlockSize * sizeof(apultra_final_match)); + + if (pCompressor->best_match) { + pCompressor->match = (apultra_match *)malloc(nBlockSize * NMATCHES_PER_INDEX * sizeof(apultra_match)); + if (pCompressor->match) { + pCompressor->match_depth = (unsigned short *)malloc(nBlockSize * NMATCHES_PER_INDEX * sizeof(unsigned short)); + if (pCompressor->match_depth) { + pCompressor->match1 = (unsigned char *)malloc(nBlockSize * sizeof(unsigned char)); + if (pCompressor->match1) { + pCompressor->first_offset_for_byte = (int*)malloc(65536 * sizeof(int)); + if (pCompressor->first_offset_for_byte) { + pCompressor->next_offset_for_pos = (int*)malloc(nBlockSize * sizeof(int)); + if (pCompressor->next_offset_for_pos) { + if (nMaxArrivals == NARRIVALS_PER_POSITION_MAX) { + pCompressor->offset_cache = (int*)malloc(2048 * sizeof(int)); + if (pCompressor->offset_cache) { + return 0; + } + } + else { + return 0; + } + } + } + } + } + } + } + } + } + } + } + } + + apultra_compressor_destroy(pCompressor); + return 100; +} + +/** + * Clean up compression context and free up any associated resources + * + * @param pCompressor compression context to clean up + */ +static void apultra_compressor_destroy(apultra_compressor *pCompressor) { + divsufsort_destroy(&pCompressor->divsufsort_context); + + if (pCompressor->offset_cache) { + free(pCompressor->offset_cache); + pCompressor->offset_cache = NULL; + } + + if (pCompressor->next_offset_for_pos) { + free(pCompressor->next_offset_for_pos); + pCompressor->next_offset_for_pos = NULL; + } + + if (pCompressor->first_offset_for_byte) { + free(pCompressor->first_offset_for_byte); + pCompressor->first_offset_for_byte = NULL; + } + + if (pCompressor->match1) { + free(pCompressor->match1); + pCompressor->match1 = NULL; + } + + if (pCompressor->match_depth) { + free(pCompressor->match_depth); + pCompressor->match_depth = NULL; + } + + if (pCompressor->match) { + free(pCompressor->match); + pCompressor->match = NULL; + } + + if (pCompressor->arrival) { + free(pCompressor->arrival); + pCompressor->arrival = NULL; + } + + if (pCompressor->best_match) { + free(pCompressor->best_match); + pCompressor->best_match = NULL; + } + + if (pCompressor->open_intervals) { + free(pCompressor->open_intervals); + pCompressor->open_intervals = NULL; + } + + if (pCompressor->pos_data) { + free(pCompressor->pos_data); + pCompressor->pos_data = NULL; + } + + if (pCompressor->intervals) { + free(pCompressor->intervals); + pCompressor->intervals = NULL; + } +} + +/** + * Compress one block of data + * + * @param pCompressor compression context + * @param pInWindow pointer to input data window (previously compressed bytes + bytes to compress) + * @param nPreviousBlockSize number of previously compressed bytes (or 0 for none) + * @param nInDataSize number of input bytes to compress + * @param pOutData pointer to output buffer + * @param nMaxOutDataSize maximum size of output buffer, in bytes + * @param nCurBitsOffset write index into output buffer, of current byte being filled with bits + * @param nCurBitShift bit shift count + * @param nCurFollowsLiteral non-zero if the next command to be issued follows a literal, 0 if not + * @param nCurRepMatchOffset starting rep offset for this block, updated after the block is compressed successfully + * @param nBlockFlags bit 0: 1 for first block, 0 otherwise; bit 1: 1 for last block, 0 otherwise + * + * @return size of compressed data in output buffer, or -1 if the data is uncompressible + */ +static int apultra_compressor_shrink_block(apultra_compressor *pCompressor, const unsigned char *pInWindow, const int nPreviousBlockSize, const int nInDataSize, unsigned char *pOutData, const int nMaxOutDataSize, int *nCurBitsOffset, int *nCurBitShift, int *nCurFollowsLiteral, int *nCurRepMatchOffset, const int nBlockFlags) { + int nCompressedSize; + + if (apultra_build_suffix_array(pCompressor, pInWindow, nPreviousBlockSize + nInDataSize)) + nCompressedSize = -1; + else { + if (nPreviousBlockSize) { + apultra_skip_matches(pCompressor, 0, nPreviousBlockSize); + } + apultra_find_all_matches(pCompressor, NMATCHES_PER_INDEX, nPreviousBlockSize, nPreviousBlockSize + nInDataSize, nBlockFlags); + + nCompressedSize = apultra_optimize_and_write_block(pCompressor, pInWindow, nPreviousBlockSize, nInDataSize, pOutData, nMaxOutDataSize, nCurBitsOffset, nCurBitShift, nCurFollowsLiteral, nCurRepMatchOffset, nBlockFlags); + } + + return nCompressedSize; +} + +/** + * Get maximum compressed size of input(source) data + * + * @param nInputSize input(source) size in bytes + * + * @return maximum compressed size + */ +size_t apultra_get_max_compressed_size(size_t nInputSize) { + return ((nInputSize * 9 /* literals + literal bits */ + 1 /* match bit */ + 2 /* 7+1 command bits */ + 8 /* EOD offset bits */) + 7) >> 3; +} + +/** + * Compress memory + * + * @param pInputData pointer to input(source) data to compress + * @param pOutBuffer buffer for compressed data + * @param nInputSize input(source) size in bytes + * @param nMaxOutBufferSize maximum capacity of compression buffer + * @param nFlags compression flags (set to 0) + * @param nMaxWindowSize maximum window size to use (0 for default) + * @param nDictionarySize size of dictionary in front of input data (0 for none) + * @param progress progress function, called after compressing each block, or NULL for none + * @param pStats pointer to compression stats that are filled if this function is successful, or NULL + * + * @return actual compressed size, or -1 for error + */ +size_t apultra_compress(const unsigned char *pInputData, unsigned char *pOutBuffer, size_t nInputSize, size_t nMaxOutBufferSize, + const unsigned int nFlags, size_t nMaxWindowSize, size_t nDictionarySize, void(*progress)(long long nOriginalSize, long long nCompressedSize), apultra_stats *pStats) { + apultra_compressor compressor; + size_t nOriginalSize = 0; + size_t nCompressedSize = 0L; + int nResult; + int nMaxArrivals = NARRIVALS_PER_POSITION_SMALL; + int nError = 0; + const int nBlockSize = (nInputSize < BLOCK_SIZE) ? ((nInputSize < 1024) ? 1024 : (int)nInputSize) : BLOCK_SIZE; + const int nMaxOutBlockSize = (int)apultra_get_max_compressed_size(nBlockSize); + + if (nDictionarySize < nInputSize) { + int nInDataSize = (int)(nInputSize - nDictionarySize); + if (nInDataSize > nBlockSize) + nInDataSize = nBlockSize; + + if (nInDataSize > 0 && (nDictionarySize + nInDataSize) >= nInputSize) { + if (nInputSize <= 262144) + nMaxArrivals = NARRIVALS_PER_POSITION_MAX; + else + nMaxArrivals = NARRIVALS_PER_POSITION_NORMAL; + } + } + + nResult = apultra_compressor_init(&compressor, nBlockSize, nBlockSize * 2, nMaxArrivals, nFlags); + if (nResult != 0) { + return -1; + } + + compressor.max_offset = nMaxWindowSize ? (int)nMaxWindowSize : MAX_OFFSET; + + int nPreviousBlockSize = 0; + int nNumBlocks = 0; + int nCurBitsOffset = INT_MIN, nCurBitShift = 0, nCurFollowsLiteral = 0; + int nBlockFlags = 1; + int nCurRepMatchOffset = 0; + + if (nDictionarySize) { + nOriginalSize = (int)nDictionarySize; + nPreviousBlockSize = (int)nDictionarySize; + } + + while (nOriginalSize < nInputSize && !nError) { + int nInDataSize; + + nInDataSize = (int)(nInputSize - nOriginalSize); + if (nInDataSize > nBlockSize) + nInDataSize = nBlockSize; + + if (nInDataSize > 0) { + int nOutDataSize; + int nOutDataEnd = (int)(nMaxOutBufferSize - nCompressedSize); + + if (nOutDataEnd > nMaxOutBlockSize) + nOutDataEnd = nMaxOutBlockSize; + + if ((nOriginalSize + nInDataSize) >= nInputSize) + nBlockFlags |= 2; + nOutDataSize = apultra_compressor_shrink_block(&compressor, pInputData + nOriginalSize - nPreviousBlockSize, nPreviousBlockSize, nInDataSize, pOutBuffer + nCompressedSize, nOutDataEnd, + &nCurBitsOffset, &nCurBitShift, &nCurFollowsLiteral, &nCurRepMatchOffset, nBlockFlags); + nBlockFlags &= (~1); + + if (nOutDataSize >= 0) { + /* Write compressed block */ + + if (!nError) { + nOriginalSize += nInDataSize; + nCompressedSize += nOutDataSize; + if (nCurBitsOffset != INT_MIN) + nCurBitsOffset -= nOutDataSize; + } + } + else { + nError = -1; + } + + nPreviousBlockSize = nInDataSize; + nNumBlocks++; + } + + if (!nError && nOriginalSize < nInputSize) { + if (progress) + progress(nOriginalSize, nCompressedSize); + } + } + + if (progress) + progress(nOriginalSize, nCompressedSize); + if (pStats) + *pStats = compressor.stats; + + apultra_compressor_destroy(&compressor); + + if (nError) { + return -1; + } + else { + return nCompressedSize; + } +} diff --git a/tools/z64compress/src/enc/apultra/shrink.h b/tools/z64compress/src/enc/apultra/shrink.h new file mode 100644 index 000000000..bd905936f --- /dev/null +++ b/tools/z64compress/src/enc/apultra/shrink.h @@ -0,0 +1,174 @@ +/* + * shrink.h - compressor definitions + * + * Copyright (C) 2019 Emmanuel Marty + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * Uses the libdivsufsort library Copyright (c) 2003-2008 Yuta Mori + * + * Inspired by cap by Sven-Åke Dahl. https://github.com/svendahl/cap + * Also inspired by Charles Bloom's compression blog. http://cbloomrants.blogspot.com/ + * With ideas from LZ4 by Yann Collet. https://github.com/lz4/lz4 + * With help and support from spke + * + */ + +#ifndef _SHRINK_H +#define _SHRINK_H + +#include "divsufsort.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define LCP_BITS 15 +#define TAG_BITS 4 +#define LCP_MAX ((1U<<(LCP_BITS - TAG_BITS)) - 1) +#define LCP_AND_TAG_MAX ((1U< + * With ideas from Lizard by Przemyslaw Skibinski and Yann Collet. https://github.com/inikep/lizard + * Also with ideas from smallz4 by Stephan Brumme. https://create.stephan-brumme.com/smallz4/ + * + */ + +#include +#include +//#include "shrink_context.h" +//#include "shrink_block.h" +#include "format.h" +#include "matchfinder.h" +//#include "lib.h" diff --git a/tools/z64compress/src/enc/apultra/sssort.c b/tools/z64compress/src/enc/apultra/sssort.c new file mode 100644 index 000000000..4a18fd2ab --- /dev/null +++ b/tools/z64compress/src/enc/apultra/sssort.c @@ -0,0 +1,815 @@ +/* + * sssort.c for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "divsufsort_private.h" + + +/*- Private Functions -*/ + +static const saint_t lg_table[256]= { + -1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 +}; + +#if (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) + +static INLINE +saint_t +ss_ilg(saidx_t n) { +#if SS_BLOCKSIZE == 0 +# if defined(BUILD_DIVSUFSORT64) + return (n >> 32) ? + ((n >> 48) ? + ((n >> 56) ? + 56 + lg_table[(n >> 56) & 0xff] : + 48 + lg_table[(n >> 48) & 0xff]) : + ((n >> 40) ? + 40 + lg_table[(n >> 40) & 0xff] : + 32 + lg_table[(n >> 32) & 0xff])) : + ((n & 0xffff0000) ? + ((n & 0xff000000) ? + 24 + lg_table[(n >> 24) & 0xff] : + 16 + lg_table[(n >> 16) & 0xff]) : + ((n & 0x0000ff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff])); +# else + return (n & 0xffff0000) ? + ((n & 0xff000000) ? + 24 + lg_table[(n >> 24) & 0xff] : + 16 + lg_table[(n >> 16) & 0xff]) : + ((n & 0x0000ff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff]); +# endif +#elif SS_BLOCKSIZE < 256 + return lg_table[n]; +#else + return (n & 0xff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff]; +#endif +} + +#endif /* (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) */ + +#if SS_BLOCKSIZE != 0 + +static const saint_t sqq_table[256] = { + 0, 16, 22, 27, 32, 35, 39, 42, 45, 48, 50, 53, 55, 57, 59, 61, + 64, 65, 67, 69, 71, 73, 75, 76, 78, 80, 81, 83, 84, 86, 87, 89, + 90, 91, 93, 94, 96, 97, 98, 99, 101, 102, 103, 104, 106, 107, 108, 109, +110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, +128, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, +143, 144, 144, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 155, +156, 157, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, +169, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 178, 179, 180, +181, 181, 182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191, +192, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 201, +202, 203, 203, 204, 204, 205, 206, 206, 207, 208, 208, 209, 209, 210, 211, 211, +212, 212, 213, 214, 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 221, +221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, 227, 228, 229, 229, 230, +230, 231, 231, 232, 232, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, +239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, +247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 +}; + +static INLINE +saidx_t +ss_isqrt(saidx_t x) { + saidx_t y, e; + + if(x >= (SS_BLOCKSIZE * SS_BLOCKSIZE)) { return SS_BLOCKSIZE; } + e = (x & 0xffff0000) ? + ((x & 0xff000000) ? + 24 + lg_table[(x >> 24) & 0xff] : + 16 + lg_table[(x >> 16) & 0xff]) : + ((x & 0x0000ff00) ? + 8 + lg_table[(x >> 8) & 0xff] : + 0 + lg_table[(x >> 0) & 0xff]); + + if(e >= 16) { + y = sqq_table[x >> ((e - 6) - (e & 1))] << ((e >> 1) - 7); + if(e >= 24) { y = (y + 1 + x / y) >> 1; } + y = (y + 1 + x / y) >> 1; + } else if(e >= 8) { + y = (sqq_table[x >> ((e - 6) - (e & 1))] >> (7 - (e >> 1))) + 1; + } else { + return sqq_table[x] >> 4; + } + + return (x < (y * y)) ? y - 1 : y; +} + +#endif /* SS_BLOCKSIZE != 0 */ + + +/*---------------------------------------------------------------------------*/ + +/* Compares two suffixes. */ +static INLINE +saint_t +ss_compare(const sauchar_t *T, + const saidx_t *p1, const saidx_t *p2, + saidx_t depth) { + const sauchar_t *U1, *U2, *U1n, *U2n; + + for(U1 = T + depth + *p1, + U2 = T + depth + *p2, + U1n = T + *(p1 + 1) + 2, + U2n = T + *(p2 + 1) + 2; + (U1 < U1n) && (U2 < U2n) && (*U1 == *U2); + ++U1, ++U2) { + } + + return U1 < U1n ? + (U2 < U2n ? *U1 - *U2 : 1) : + (U2 < U2n ? -1 : 0); +} + + +/*---------------------------------------------------------------------------*/ + +#if (SS_BLOCKSIZE != 1) && (SS_INSERTIONSORT_THRESHOLD != 1) + +/* Insertionsort for small size groups */ +static +void +ss_insertionsort(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *last, saidx_t depth) { + saidx_t *i, *j; + saidx_t t; + saint_t r; + + for(i = last - 2; first <= i; --i) { + for(t = *i, j = i + 1; 0 < (r = ss_compare(T, PA + t, PA + *j, depth));) { + do { *(j - 1) = *j; } while((++j < last) && (*j < 0)); + if(last <= j) { break; } + } + if(r == 0) { *j = ~*j; } + *(j - 1) = t; + } +} + +#endif /* (SS_BLOCKSIZE != 1) && (SS_INSERTIONSORT_THRESHOLD != 1) */ + + +/*---------------------------------------------------------------------------*/ + +#if (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) + +static INLINE +void +ss_fixdown(const sauchar_t *Td, const saidx_t *PA, + saidx_t *SA, saidx_t i, saidx_t size) { + saidx_t j, k; + saidx_t v; + saint_t c, d, e; + + for(v = SA[i], c = Td[PA[v]]; (j = 2 * i + 1) < size; SA[i] = SA[k], i = k) { + d = Td[PA[SA[k = j++]]]; + if(d < (e = Td[PA[SA[j]]])) { k = j; d = e; } + if(d <= c) { break; } + } + SA[i] = v; +} + +/* Simple top-down heapsort. */ +static +void +ss_heapsort(const sauchar_t *Td, const saidx_t *PA, saidx_t *SA, saidx_t size) { + saidx_t i, m; + saidx_t t; + + m = size; + if((size % 2) == 0) { + m--; + if(Td[PA[SA[m / 2]]] < Td[PA[SA[m]]]) { SWAP(SA[m], SA[m / 2]); } + } + + for(i = m / 2 - 1; 0 <= i; --i) { ss_fixdown(Td, PA, SA, i, m); } + if((size % 2) == 0) { SWAP(SA[0], SA[m]); ss_fixdown(Td, PA, SA, 0, m); } + for(i = m - 1; 0 < i; --i) { + t = SA[0], SA[0] = SA[i]; + ss_fixdown(Td, PA, SA, 0, i); + SA[i] = t; + } +} + + +/*---------------------------------------------------------------------------*/ + +/* Returns the median of three elements. */ +static INLINE +saidx_t * +ss_median3(const sauchar_t *Td, const saidx_t *PA, + saidx_t *v1, saidx_t *v2, saidx_t *v3) { + saidx_t *t; + if(Td[PA[*v1]] > Td[PA[*v2]]) { SWAP(v1, v2); } + if(Td[PA[*v2]] > Td[PA[*v3]]) { + if(Td[PA[*v1]] > Td[PA[*v3]]) { return v1; } + else { return v3; } + } + return v2; +} + +/* Returns the median of five elements. */ +static INLINE +saidx_t * +ss_median5(const sauchar_t *Td, const saidx_t *PA, + saidx_t *v1, saidx_t *v2, saidx_t *v3, saidx_t *v4, saidx_t *v5) { + saidx_t *t; + if(Td[PA[*v2]] > Td[PA[*v3]]) { SWAP(v2, v3); } + if(Td[PA[*v4]] > Td[PA[*v5]]) { SWAP(v4, v5); } + if(Td[PA[*v2]] > Td[PA[*v4]]) { SWAP(v2, v4); SWAP(v3, v5); } + if(Td[PA[*v1]] > Td[PA[*v3]]) { SWAP(v1, v3); } + if(Td[PA[*v1]] > Td[PA[*v4]]) { SWAP(v1, v4); SWAP(v3, v5); } + if(Td[PA[*v3]] > Td[PA[*v4]]) { return v4; } + return v3; +} + +/* Returns the pivot element. */ +static INLINE +saidx_t * +ss_pivot(const sauchar_t *Td, const saidx_t *PA, saidx_t *first, saidx_t *last) { + saidx_t *middle; + saidx_t t; + + t = last - first; + middle = first + t / 2; + + if(t <= 512) { + if(t <= 32) { + return ss_median3(Td, PA, first, middle, last - 1); + } else { + t >>= 2; + return ss_median5(Td, PA, first, first + t, middle, last - 1 - t, last - 1); + } + } + t >>= 3; + first = ss_median3(Td, PA, first, first + t, first + (t << 1)); + middle = ss_median3(Td, PA, middle - t, middle, middle + t); + last = ss_median3(Td, PA, last - 1 - (t << 1), last - 1 - t, last - 1); + return ss_median3(Td, PA, first, middle, last); +} + + +/*---------------------------------------------------------------------------*/ + +/* Binary partition for substrings. */ +static INLINE +saidx_t * +ss_partition(const saidx_t *PA, + saidx_t *first, saidx_t *last, saidx_t depth) { + saidx_t *a, *b; + saidx_t t; + for(a = first - 1, b = last;;) { + for(; (++a < b) && ((PA[*a] + depth) >= (PA[*a + 1] + 1));) { *a = ~*a; } + for(; (a < --b) && ((PA[*b] + depth) < (PA[*b + 1] + 1));) { } + if(b <= a) { break; } + t = ~*b; + *b = *a; + *a = t; + } + if(first < a) { *first = ~*first; } + return a; +} + +/* Multikey introsort for medium size groups. */ +static +void +ss_mintrosort(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *last, + saidx_t depth) { +#define STACK_SIZE SS_MISORT_STACKSIZE + struct { saidx_t *a, *b, c; saint_t d; } stack[STACK_SIZE]; + const sauchar_t *Td; + saidx_t *a, *b, *c, *d, *e, *f; + saidx_t s, t; + saint_t ssize; + saint_t limit; + saint_t v, x = 0; + + for(ssize = 0, limit = ss_ilg(last - first);;) { + + if((last - first) <= SS_INSERTIONSORT_THRESHOLD) { +#if 1 < SS_INSERTIONSORT_THRESHOLD + if(1 < (last - first)) { ss_insertionsort(T, PA, first, last, depth); } +#endif + STACK_POP(first, last, depth, limit); + continue; + } + + Td = T + depth; + if(limit-- == 0) { ss_heapsort(Td, PA, first, last - first); } + if(limit < 0) { + for(a = first + 1, v = Td[PA[*first]]; a < last; ++a) { + if((x = Td[PA[*a]]) != v) { + if(1 < (a - first)) { break; } + v = x; + first = a; + } + } + if(Td[PA[*first] - 1] < v) { + first = ss_partition(PA, first, a, depth); + } + if((a - first) <= (last - a)) { + if(1 < (a - first)) { + STACK_PUSH(a, last, depth, -1); + last = a, depth += 1, limit = ss_ilg(a - first); + } else { + first = a, limit = -1; + } + } else { + if(1 < (last - a)) { + STACK_PUSH(first, a, depth + 1, ss_ilg(a - first)); + first = a, limit = -1; + } else { + last = a, depth += 1, limit = ss_ilg(a - first); + } + } + continue; + } + + /* choose pivot */ + a = ss_pivot(Td, PA, first, last); + v = Td[PA[*a]]; + SWAP(*first, *a); + + /* partition */ + for(b = first; (++b < last) && ((x = Td[PA[*b]]) == v);) { } + if(((a = b) < last) && (x < v)) { + for(; (++b < last) && ((x = Td[PA[*b]]) <= v);) { + if(x == v) { SWAP(*b, *a); ++a; } + } + } + for(c = last; (b < --c) && ((x = Td[PA[*c]]) == v);) { } + if((b < (d = c)) && (x > v)) { + for(; (b < --c) && ((x = Td[PA[*c]]) >= v);) { + if(x == v) { SWAP(*c, *d); --d; } + } + } + for(; b < c;) { + SWAP(*b, *c); + for(; (++b < c) && ((x = Td[PA[*b]]) <= v);) { + if(x == v) { SWAP(*b, *a); ++a; } + } + for(; (b < --c) && ((x = Td[PA[*c]]) >= v);) { + if(x == v) { SWAP(*c, *d); --d; } + } + } + + if(a <= d) { + c = b - 1; + + if((s = a - first) > (t = b - a)) { s = t; } + for(e = first, f = b - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } + if((s = d - c) > (t = last - d - 1)) { s = t; } + for(e = b, f = last - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } + + a = first + (b - a), c = last - (d - c); + b = (v <= Td[PA[*a] - 1]) ? a : ss_partition(PA, a, c, depth); + + if((a - first) <= (last - c)) { + if((last - c) <= (c - b)) { + STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); + STACK_PUSH(c, last, depth, limit); + last = a; + } else if((a - first) <= (c - b)) { + STACK_PUSH(c, last, depth, limit); + STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); + last = a; + } else { + STACK_PUSH(c, last, depth, limit); + STACK_PUSH(first, a, depth, limit); + first = b, last = c, depth += 1, limit = ss_ilg(c - b); + } + } else { + if((a - first) <= (c - b)) { + STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); + STACK_PUSH(first, a, depth, limit); + first = c; + } else if((last - c) <= (c - b)) { + STACK_PUSH(first, a, depth, limit); + STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); + first = c; + } else { + STACK_PUSH(first, a, depth, limit); + STACK_PUSH(c, last, depth, limit); + first = b, last = c, depth += 1, limit = ss_ilg(c - b); + } + } + } else { + limit += 1; + if(Td[PA[*first] - 1] < v) { + first = ss_partition(PA, first, last, depth); + limit = ss_ilg(last - first); + } + depth += 1; + } + } +#undef STACK_SIZE +} + +#endif /* (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) */ + + +/*---------------------------------------------------------------------------*/ + +#if SS_BLOCKSIZE != 0 + +static INLINE +void +ss_blockswap(saidx_t *a, saidx_t *b, saidx_t n) { + saidx_t t; + for(; 0 < n; --n, ++a, ++b) { + t = *a, *a = *b, *b = t; + } +} + +static INLINE +void +ss_rotate(saidx_t *first, saidx_t *middle, saidx_t *last) { + saidx_t *a, *b, t; + saidx_t l, r; + l = middle - first, r = last - middle; + for(; (0 < l) && (0 < r);) { + if(l == r) { ss_blockswap(first, middle, l); break; } + if(l < r) { + a = last - 1, b = middle - 1; + t = *a; + do { + *a-- = *b, *b-- = *a; + if(b < first) { + *a = t; + last = a; + if((r -= l + 1) <= l) { break; } + a -= 1, b = middle - 1; + t = *a; + } + } while(1); + } else { + a = first, b = middle; + t = *a; + do { + *a++ = *b, *b++ = *a; + if(last <= b) { + *a = t; + first = a + 1; + if((l -= r + 1) <= r) { break; } + a += 1, b = middle; + t = *a; + } + } while(1); + } + } +} + + +/*---------------------------------------------------------------------------*/ + +static +void +ss_inplacemerge(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *middle, saidx_t *last, + saidx_t depth) { + const saidx_t *p; + saidx_t *a, *b; + saidx_t len, half; + saint_t q, r; + saint_t x; + + for(;;) { + if(*(last - 1) < 0) { x = 1; p = PA + ~*(last - 1); } + else { x = 0; p = PA + *(last - 1); } + for(a = first, len = middle - first, half = len >> 1, r = -1; + 0 < len; + len = half, half >>= 1) { + b = a + half; + q = ss_compare(T, PA + ((0 <= *b) ? *b : ~*b), p, depth); + if(q < 0) { + a = b + 1; + half -= (len & 1) ^ 1; + } else { + r = q; + } + } + if(a < middle) { + if(r == 0) { *a = ~*a; } + ss_rotate(a, middle, last); + last -= middle - a; + middle = a; + if(first == middle) { break; } + } + --last; + if(x != 0) { while(*--last < 0) { } } + if(middle == last) { break; } + } +} + + +/*---------------------------------------------------------------------------*/ + +/* Merge-forward with internal buffer. */ +static +void +ss_mergeforward(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *middle, saidx_t *last, + saidx_t *buf, saidx_t depth) { + saidx_t *a, *b, *c, *bufend; + saidx_t t; + saint_t r; + + bufend = buf + (middle - first) - 1; + ss_blockswap(buf, first, middle - first); + + for(t = *(a = first), b = buf, c = middle;;) { + r = ss_compare(T, PA + *b, PA + *c, depth); + if(r < 0) { + do { + *a++ = *b; + if(bufend <= b) { *bufend = t; return; } + *b++ = *a; + } while(*b < 0); + } else if(r > 0) { + do { + *a++ = *c, *c++ = *a; + if(last <= c) { + while(b < bufend) { *a++ = *b, *b++ = *a; } + *a = *b, *b = t; + return; + } + } while(*c < 0); + } else { + *c = ~*c; + do { + *a++ = *b; + if(bufend <= b) { *bufend = t; return; } + *b++ = *a; + } while(*b < 0); + + do { + *a++ = *c, *c++ = *a; + if(last <= c) { + while(b < bufend) { *a++ = *b, *b++ = *a; } + *a = *b, *b = t; + return; + } + } while(*c < 0); + } + } +} + +/* Merge-backward with internal buffer. */ +static +void +ss_mergebackward(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *middle, saidx_t *last, + saidx_t *buf, saidx_t depth) { + const saidx_t *p1, *p2; + saidx_t *a, *b, *c, *bufend; + saidx_t t; + saint_t r; + saint_t x; + + bufend = buf + (last - middle) - 1; + ss_blockswap(buf, middle, last - middle); + + x = 0; + if(*bufend < 0) { p1 = PA + ~*bufend; x |= 1; } + else { p1 = PA + *bufend; } + if(*(middle - 1) < 0) { p2 = PA + ~*(middle - 1); x |= 2; } + else { p2 = PA + *(middle - 1); } + for(t = *(a = last - 1), b = bufend, c = middle - 1;;) { + r = ss_compare(T, p1, p2, depth); + if(0 < r) { + if(x & 1) { do { *a-- = *b, *b-- = *a; } while(*b < 0); x ^= 1; } + *a-- = *b; + if(b <= buf) { *buf = t; break; } + *b-- = *a; + if(*b < 0) { p1 = PA + ~*b; x |= 1; } + else { p1 = PA + *b; } + } else if(r < 0) { + if(x & 2) { do { *a-- = *c, *c-- = *a; } while(*c < 0); x ^= 2; } + *a-- = *c, *c-- = *a; + if(c < first) { + while(buf < b) { *a-- = *b, *b-- = *a; } + *a = *b, *b = t; + break; + } + if(*c < 0) { p2 = PA + ~*c; x |= 2; } + else { p2 = PA + *c; } + } else { + if(x & 1) { do { *a-- = *b, *b-- = *a; } while(*b < 0); x ^= 1; } + *a-- = ~*b; + if(b <= buf) { *buf = t; break; } + *b-- = *a; + if(x & 2) { do { *a-- = *c, *c-- = *a; } while(*c < 0); x ^= 2; } + *a-- = *c, *c-- = *a; + if(c < first) { + while(buf < b) { *a-- = *b, *b-- = *a; } + *a = *b, *b = t; + break; + } + if(*b < 0) { p1 = PA + ~*b; x |= 1; } + else { p1 = PA + *b; } + if(*c < 0) { p2 = PA + ~*c; x |= 2; } + else { p2 = PA + *c; } + } + } +} + +/* D&C based merge. */ +static +void +ss_swapmerge(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *middle, saidx_t *last, + saidx_t *buf, saidx_t bufsize, saidx_t depth) { +#define STACK_SIZE SS_SMERGE_STACKSIZE +#define GETIDX(a) ((0 <= (a)) ? (a) : (~(a))) +#define MERGE_CHECK(a, b, c)\ + do {\ + if(((c) & 1) ||\ + (((c) & 2) && (ss_compare(T, PA + GETIDX(*((a) - 1)), PA + *(a), depth) == 0))) {\ + *(a) = ~*(a);\ + }\ + if(((c) & 4) && ((ss_compare(T, PA + GETIDX(*((b) - 1)), PA + *(b), depth) == 0))) {\ + *(b) = ~*(b);\ + }\ + } while(0) + struct { saidx_t *a, *b, *c; saint_t d; } stack[STACK_SIZE]; + saidx_t *l, *r, *lm, *rm; + saidx_t m, len, half; + saint_t ssize; + saint_t check, next; + + for(check = 0, ssize = 0;;) { + if((last - middle) <= bufsize) { + if((first < middle) && (middle < last)) { + ss_mergebackward(T, PA, first, middle, last, buf, depth); + } + MERGE_CHECK(first, last, check); + STACK_POP(first, middle, last, check); + continue; + } + + if((middle - first) <= bufsize) { + if(first < middle) { + ss_mergeforward(T, PA, first, middle, last, buf, depth); + } + MERGE_CHECK(first, last, check); + STACK_POP(first, middle, last, check); + continue; + } + + for(m = 0, len = MIN(middle - first, last - middle), half = len >> 1; + 0 < len; + len = half, half >>= 1) { + if(ss_compare(T, PA + GETIDX(*(middle + m + half)), + PA + GETIDX(*(middle - m - half - 1)), depth) < 0) { + m += half + 1; + half -= (len & 1) ^ 1; + } + } + + if(0 < m) { + lm = middle - m, rm = middle + m; + ss_blockswap(lm, middle, m); + l = r = middle, next = 0; + if(rm < last) { + if(*rm < 0) { + *rm = ~*rm; + if(first < lm) { for(; *--l < 0;) { } next |= 4; } + next |= 1; + } else if(first < lm) { + for(; *r < 0; ++r) { } + next |= 2; + } + } + + if((l - first) <= (last - r)) { + STACK_PUSH(r, rm, last, (next & 3) | (check & 4)); + middle = lm, last = l, check = (check & 3) | (next & 4); + } else { + if((next & 2) && (r == middle)) { next ^= 6; } + STACK_PUSH(first, lm, l, (check & 3) | (next & 4)); + first = r, middle = rm, check = (next & 3) | (check & 4); + } + } else { + if(ss_compare(T, PA + GETIDX(*(middle - 1)), PA + *middle, depth) == 0) { + *middle = ~*middle; + } + MERGE_CHECK(first, last, check); + STACK_POP(first, middle, last, check); + } + } +#undef STACK_SIZE +} + +#endif /* SS_BLOCKSIZE != 0 */ + + +/*---------------------------------------------------------------------------*/ + +/*- Function -*/ + +/* Substring sort */ +void +sssort(const sauchar_t *T, const saidx_t *PA, + saidx_t *first, saidx_t *last, + saidx_t *buf, saidx_t bufsize, + saidx_t depth, saidx_t n, saint_t lastsuffix) { + saidx_t *a; +#if SS_BLOCKSIZE != 0 + saidx_t *b, *middle, *curbuf; + saidx_t j, k, curbufsize, limit; +#endif + saidx_t i; + + if(lastsuffix != 0) { ++first; } + +#if SS_BLOCKSIZE == 0 + ss_mintrosort(T, PA, first, last, depth); +#else + if((bufsize < SS_BLOCKSIZE) && + (bufsize < (last - first)) && + (bufsize < (limit = ss_isqrt(last - first)))) { + if(SS_BLOCKSIZE < limit) { limit = SS_BLOCKSIZE; } + buf = middle = last - limit, bufsize = limit; + } else { + middle = last, limit = 0; + } + for(a = first, i = 0; SS_BLOCKSIZE < (middle - a); a += SS_BLOCKSIZE, ++i) { +#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE + ss_mintrosort(T, PA, a, a + SS_BLOCKSIZE, depth); +#elif 1 < SS_BLOCKSIZE + ss_insertionsort(T, PA, a, a + SS_BLOCKSIZE, depth); +#endif + curbufsize = last - (a + SS_BLOCKSIZE); + curbuf = a + SS_BLOCKSIZE; + if(curbufsize <= bufsize) { curbufsize = bufsize, curbuf = buf; } + for(b = a, k = SS_BLOCKSIZE, j = i; j & 1; b -= k, k <<= 1, j >>= 1) { + ss_swapmerge(T, PA, b - k, b, b + k, curbuf, curbufsize, depth); + } + } +#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE + ss_mintrosort(T, PA, a, middle, depth); +#elif 1 < SS_BLOCKSIZE + ss_insertionsort(T, PA, a, middle, depth); +#endif + for(k = SS_BLOCKSIZE; i != 0; k <<= 1, i >>= 1) { + if(i & 1) { + ss_swapmerge(T, PA, a - k, a, middle, buf, bufsize, depth); + a -= k; + } + } + if(limit != 0) { +#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE + ss_mintrosort(T, PA, middle, last, depth); +#elif 1 < SS_BLOCKSIZE + ss_insertionsort(T, PA, middle, last, depth); +#endif + ss_inplacemerge(T, PA, first, middle, last, depth); + } +#endif + + if(lastsuffix != 0) { + /* Insert last type B* suffix. */ + saidx_t PAi[2]; PAi[0] = PA[*(first - 1)], PAi[1] = n - 2; + for(a = first, i = *(first - 1); + (a < last) && ((*a < 0) || (0 < ss_compare(T, &(PAi[0]), PA + *a, depth))); + ++a) { + *(a - 1) = *a; + } + *(a - 1) = i; + } +} diff --git a/tools/z64compress/src/enc/apultra/trsort.c b/tools/z64compress/src/enc/apultra/trsort.c new file mode 100644 index 000000000..6fe3e67ba --- /dev/null +++ b/tools/z64compress/src/enc/apultra/trsort.c @@ -0,0 +1,586 @@ +/* + * trsort.c for libdivsufsort + * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "divsufsort_private.h" + + +/*- Private Functions -*/ + +static const saint_t lg_table[256]= { + -1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 +}; + +static INLINE +saint_t +tr_ilg(saidx_t n) { +#if defined(BUILD_DIVSUFSORT64) + return (n >> 32) ? + ((n >> 48) ? + ((n >> 56) ? + 56 + lg_table[(n >> 56) & 0xff] : + 48 + lg_table[(n >> 48) & 0xff]) : + ((n >> 40) ? + 40 + lg_table[(n >> 40) & 0xff] : + 32 + lg_table[(n >> 32) & 0xff])) : + ((n & 0xffff0000) ? + ((n & 0xff000000) ? + 24 + lg_table[(n >> 24) & 0xff] : + 16 + lg_table[(n >> 16) & 0xff]) : + ((n & 0x0000ff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff])); +#else + return (n & 0xffff0000) ? + ((n & 0xff000000) ? + 24 + lg_table[(n >> 24) & 0xff] : + 16 + lg_table[(n >> 16) & 0xff]) : + ((n & 0x0000ff00) ? + 8 + lg_table[(n >> 8) & 0xff] : + 0 + lg_table[(n >> 0) & 0xff]); +#endif +} + + +/*---------------------------------------------------------------------------*/ + +/* Simple insertionsort for small size groups. */ +static +void +tr_insertionsort(const saidx_t *ISAd, saidx_t *first, saidx_t *last) { + saidx_t *a, *b; + saidx_t t, r; + + for(a = first + 1; a < last; ++a) { + for(t = *a, b = a - 1; 0 > (r = ISAd[t] - ISAd[*b]);) { + do { *(b + 1) = *b; } while((first <= --b) && (*b < 0)); + if(b < first) { break; } + } + if(r == 0) { *b = ~*b; } + *(b + 1) = t; + } +} + + +/*---------------------------------------------------------------------------*/ + +static INLINE +void +tr_fixdown(const saidx_t *ISAd, saidx_t *SA, saidx_t i, saidx_t size) { + saidx_t j, k; + saidx_t v; + saidx_t c, d, e; + + for(v = SA[i], c = ISAd[v]; (j = 2 * i + 1) < size; SA[i] = SA[k], i = k) { + d = ISAd[SA[k = j++]]; + if(d < (e = ISAd[SA[j]])) { k = j; d = e; } + if(d <= c) { break; } + } + SA[i] = v; +} + +/* Simple top-down heapsort. */ +static +void +tr_heapsort(const saidx_t *ISAd, saidx_t *SA, saidx_t size) { + saidx_t i, m; + saidx_t t; + + m = size; + if((size % 2) == 0) { + m--; + if(ISAd[SA[m / 2]] < ISAd[SA[m]]) { SWAP(SA[m], SA[m / 2]); } + } + + for(i = m / 2 - 1; 0 <= i; --i) { tr_fixdown(ISAd, SA, i, m); } + if((size % 2) == 0) { SWAP(SA[0], SA[m]); tr_fixdown(ISAd, SA, 0, m); } + for(i = m - 1; 0 < i; --i) { + t = SA[0], SA[0] = SA[i]; + tr_fixdown(ISAd, SA, 0, i); + SA[i] = t; + } +} + + +/*---------------------------------------------------------------------------*/ + +/* Returns the median of three elements. */ +static INLINE +saidx_t * +tr_median3(const saidx_t *ISAd, saidx_t *v1, saidx_t *v2, saidx_t *v3) { + saidx_t *t; + if(ISAd[*v1] > ISAd[*v2]) { SWAP(v1, v2); } + if(ISAd[*v2] > ISAd[*v3]) { + if(ISAd[*v1] > ISAd[*v3]) { return v1; } + else { return v3; } + } + return v2; +} + +/* Returns the median of five elements. */ +static INLINE +saidx_t * +tr_median5(const saidx_t *ISAd, + saidx_t *v1, saidx_t *v2, saidx_t *v3, saidx_t *v4, saidx_t *v5) { + saidx_t *t; + if(ISAd[*v2] > ISAd[*v3]) { SWAP(v2, v3); } + if(ISAd[*v4] > ISAd[*v5]) { SWAP(v4, v5); } + if(ISAd[*v2] > ISAd[*v4]) { SWAP(v2, v4); SWAP(v3, v5); } + if(ISAd[*v1] > ISAd[*v3]) { SWAP(v1, v3); } + if(ISAd[*v1] > ISAd[*v4]) { SWAP(v1, v4); SWAP(v3, v5); } + if(ISAd[*v3] > ISAd[*v4]) { return v4; } + return v3; +} + +/* Returns the pivot element. */ +static INLINE +saidx_t * +tr_pivot(const saidx_t *ISAd, saidx_t *first, saidx_t *last) { + saidx_t *middle; + saidx_t t; + + t = last - first; + middle = first + t / 2; + + if(t <= 512) { + if(t <= 32) { + return tr_median3(ISAd, first, middle, last - 1); + } else { + t >>= 2; + return tr_median5(ISAd, first, first + t, middle, last - 1 - t, last - 1); + } + } + t >>= 3; + first = tr_median3(ISAd, first, first + t, first + (t << 1)); + middle = tr_median3(ISAd, middle - t, middle, middle + t); + last = tr_median3(ISAd, last - 1 - (t << 1), last - 1 - t, last - 1); + return tr_median3(ISAd, first, middle, last); +} + + +/*---------------------------------------------------------------------------*/ + +typedef struct _trbudget_t trbudget_t; +struct _trbudget_t { + saidx_t chance; + saidx_t remain; + saidx_t incval; + saidx_t count; +}; + +static INLINE +void +trbudget_init(trbudget_t *budget, saidx_t chance, saidx_t incval) { + budget->chance = chance; + budget->remain = budget->incval = incval; +} + +static INLINE +saint_t +trbudget_check(trbudget_t *budget, saidx_t size) { + if(size <= budget->remain) { budget->remain -= size; return 1; } + if(budget->chance == 0) { budget->count += size; return 0; } + budget->remain += budget->incval - size; + budget->chance -= 1; + return 1; +} + + +/*---------------------------------------------------------------------------*/ + +static INLINE +void +tr_partition(const saidx_t *ISAd, + saidx_t *first, saidx_t *middle, saidx_t *last, + saidx_t **pa, saidx_t **pb, saidx_t v) { + saidx_t *a, *b, *c, *d, *e, *f; + saidx_t t, s; + saidx_t x = 0; + + for(b = middle - 1; (++b < last) && ((x = ISAd[*b]) == v);) { } + if(((a = b) < last) && (x < v)) { + for(; (++b < last) && ((x = ISAd[*b]) <= v);) { + if(x == v) { SWAP(*b, *a); ++a; } + } + } + for(c = last; (b < --c) && ((x = ISAd[*c]) == v);) { } + if((b < (d = c)) && (x > v)) { + for(; (b < --c) && ((x = ISAd[*c]) >= v);) { + if(x == v) { SWAP(*c, *d); --d; } + } + } + for(; b < c;) { + SWAP(*b, *c); + for(; (++b < c) && ((x = ISAd[*b]) <= v);) { + if(x == v) { SWAP(*b, *a); ++a; } + } + for(; (b < --c) && ((x = ISAd[*c]) >= v);) { + if(x == v) { SWAP(*c, *d); --d; } + } + } + + if(a <= d) { + c = b - 1; + if((s = a - first) > (t = b - a)) { s = t; } + for(e = first, f = b - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } + if((s = d - c) > (t = last - d - 1)) { s = t; } + for(e = b, f = last - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } + first += (b - a), last -= (d - c); + } + *pa = first, *pb = last; +} + +static +void +tr_copy(saidx_t *ISA, const saidx_t *SA, + saidx_t *first, saidx_t *a, saidx_t *b, saidx_t *last, + saidx_t depth) { + /* sort suffixes of middle partition + by using sorted order of suffixes of left and right partition. */ + saidx_t *c, *d, *e; + saidx_t s, v; + + v = b - SA - 1; + for(c = first, d = a - 1; c <= d; ++c) { + if((0 <= (s = *c - depth)) && (ISA[s] == v)) { + *++d = s; + ISA[s] = d - SA; + } + } + for(c = last - 1, e = d + 1, d = b; e < d; --c) { + if((0 <= (s = *c - depth)) && (ISA[s] == v)) { + *--d = s; + ISA[s] = d - SA; + } + } +} + +static +void +tr_partialcopy(saidx_t *ISA, const saidx_t *SA, + saidx_t *first, saidx_t *a, saidx_t *b, saidx_t *last, + saidx_t depth) { + saidx_t *c, *d, *e; + saidx_t s, v; + saidx_t rank, lastrank, newrank = -1; + + v = b - SA - 1; + lastrank = -1; + for(c = first, d = a - 1; c <= d; ++c) { + if((0 <= (s = *c - depth)) && (ISA[s] == v)) { + *++d = s; + rank = ISA[s + depth]; + if(lastrank != rank) { lastrank = rank; newrank = d - SA; } + ISA[s] = newrank; + } + } + + lastrank = -1; + for(e = d; first <= e; --e) { + rank = ISA[*e]; + if(lastrank != rank) { lastrank = rank; newrank = e - SA; } + if(newrank != rank) { ISA[*e] = newrank; } + } + + lastrank = -1; + for(c = last - 1, e = d + 1, d = b; e < d; --c) { + if((0 <= (s = *c - depth)) && (ISA[s] == v)) { + *--d = s; + rank = ISA[s + depth]; + if(lastrank != rank) { lastrank = rank; newrank = d - SA; } + ISA[s] = newrank; + } + } +} + +static +void +tr_introsort(saidx_t *ISA, const saidx_t *ISAd, + saidx_t *SA, saidx_t *first, saidx_t *last, + trbudget_t *budget) { +#define STACK_SIZE TR_STACKSIZE + struct { const saidx_t *a; saidx_t *b, *c; saint_t d, e; }stack[STACK_SIZE]; + saidx_t *a, *b, *c; + saidx_t t; + saidx_t v, x = 0; + saidx_t incr = ISAd - ISA; + saint_t limit, next; + saint_t ssize, trlink = -1; + + for(ssize = 0, limit = tr_ilg(last - first);;) { + + if(limit < 0) { + if(limit == -1) { + /* tandem repeat partition */ + tr_partition(ISAd - incr, first, first, last, &a, &b, last - SA - 1); + + /* update ranks */ + if(a < last) { + for(c = first, v = a - SA - 1; c < a; ++c) { ISA[*c] = v; } + } + if(b < last) { + for(c = a, v = b - SA - 1; c < b; ++c) { ISA[*c] = v; } + } + + /* push */ + if(1 < (b - a)) { + STACK_PUSH5(NULL, a, b, 0, 0); + STACK_PUSH5(ISAd - incr, first, last, -2, trlink); + trlink = ssize - 2; + } + if((a - first) <= (last - b)) { + if(1 < (a - first)) { + STACK_PUSH5(ISAd, b, last, tr_ilg(last - b), trlink); + last = a, limit = tr_ilg(a - first); + } else if(1 < (last - b)) { + first = b, limit = tr_ilg(last - b); + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } else { + if(1 < (last - b)) { + STACK_PUSH5(ISAd, first, a, tr_ilg(a - first), trlink); + first = b, limit = tr_ilg(last - b); + } else if(1 < (a - first)) { + last = a, limit = tr_ilg(a - first); + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + } else if(limit == -2) { + /* tandem repeat copy */ + a = stack[--ssize].b, b = stack[ssize].c; + if(stack[ssize].d == 0) { + tr_copy(ISA, SA, first, a, b, last, ISAd - ISA); + } else { + if(0 <= trlink) { stack[trlink].d = -1; } + tr_partialcopy(ISA, SA, first, a, b, last, ISAd - ISA); + } + STACK_POP5(ISAd, first, last, limit, trlink); + } else { + /* sorted partition */ + if(0 <= *first) { + a = first; + do { ISA[*a] = a - SA; } while((++a < last) && (0 <= *a)); + first = a; + } + if(first < last) { + a = first; do { *a = ~*a; } while(*++a < 0); + next = (ISA[*a] != ISAd[*a]) ? tr_ilg(a - first + 1) : -1; + if(++a < last) { for(b = first, v = a - SA - 1; b < a; ++b) { ISA[*b] = v; } } + + /* push */ + if(trbudget_check(budget, a - first)) { + if((a - first) <= (last - a)) { + STACK_PUSH5(ISAd, a, last, -3, trlink); + ISAd += incr, last = a, limit = next; + } else { + if(1 < (last - a)) { + STACK_PUSH5(ISAd + incr, first, a, next, trlink); + first = a, limit = -3; + } else { + ISAd += incr, last = a, limit = next; + } + } + } else { + if(0 <= trlink) { stack[trlink].d = -1; } + if(1 < (last - a)) { + first = a, limit = -3; + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + continue; + } + + if((last - first) <= TR_INSERTIONSORT_THRESHOLD) { + tr_insertionsort(ISAd, first, last); + limit = -3; + continue; + } + + if(limit-- == 0) { + tr_heapsort(ISAd, first, last - first); + for(a = last - 1; first < a; a = b) { + for(x = ISAd[*a], b = a - 1; (first <= b) && (ISAd[*b] == x); --b) { *b = ~*b; } + } + limit = -3; + continue; + } + + /* choose pivot */ + a = tr_pivot(ISAd, first, last); + SWAP(*first, *a); + v = ISAd[*first]; + + /* partition */ + tr_partition(ISAd, first, first + 1, last, &a, &b, v); + if((last - first) != (b - a)) { + next = (ISA[*a] != v) ? tr_ilg(b - a) : -1; + + /* update ranks */ + for(c = first, v = a - SA - 1; c < a; ++c) { ISA[*c] = v; } + if(b < last) { for(c = a, v = b - SA - 1; c < b; ++c) { ISA[*c] = v; } } + + /* push */ + if((1 < (b - a)) && (trbudget_check(budget, b - a))) { + if((a - first) <= (last - b)) { + if((last - b) <= (b - a)) { + if(1 < (a - first)) { + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + STACK_PUSH5(ISAd, b, last, limit, trlink); + last = a; + } else if(1 < (last - b)) { + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + first = b; + } else { + ISAd += incr, first = a, last = b, limit = next; + } + } else if((a - first) <= (b - a)) { + if(1 < (a - first)) { + STACK_PUSH5(ISAd, b, last, limit, trlink); + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + last = a; + } else { + STACK_PUSH5(ISAd, b, last, limit, trlink); + ISAd += incr, first = a, last = b, limit = next; + } + } else { + STACK_PUSH5(ISAd, b, last, limit, trlink); + STACK_PUSH5(ISAd, first, a, limit, trlink); + ISAd += incr, first = a, last = b, limit = next; + } + } else { + if((a - first) <= (b - a)) { + if(1 < (last - b)) { + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + STACK_PUSH5(ISAd, first, a, limit, trlink); + first = b; + } else if(1 < (a - first)) { + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + last = a; + } else { + ISAd += incr, first = a, last = b, limit = next; + } + } else if((last - b) <= (b - a)) { + if(1 < (last - b)) { + STACK_PUSH5(ISAd, first, a, limit, trlink); + STACK_PUSH5(ISAd + incr, a, b, next, trlink); + first = b; + } else { + STACK_PUSH5(ISAd, first, a, limit, trlink); + ISAd += incr, first = a, last = b, limit = next; + } + } else { + STACK_PUSH5(ISAd, first, a, limit, trlink); + STACK_PUSH5(ISAd, b, last, limit, trlink); + ISAd += incr, first = a, last = b, limit = next; + } + } + } else { + if((1 < (b - a)) && (0 <= trlink)) { stack[trlink].d = -1; } + if((a - first) <= (last - b)) { + if(1 < (a - first)) { + STACK_PUSH5(ISAd, b, last, limit, trlink); + last = a; + } else if(1 < (last - b)) { + first = b; + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } else { + if(1 < (last - b)) { + STACK_PUSH5(ISAd, first, a, limit, trlink); + first = b; + } else if(1 < (a - first)) { + last = a; + } else { + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + } + } else { + if(trbudget_check(budget, last - first)) { + limit = tr_ilg(last - first), ISAd += incr; + } else { + if(0 <= trlink) { stack[trlink].d = -1; } + STACK_POP5(ISAd, first, last, limit, trlink); + } + } + } +#undef STACK_SIZE +} + + + +/*---------------------------------------------------------------------------*/ + +/*- Function -*/ + +/* Tandem repeat sort */ +void +trsort(saidx_t *ISA, saidx_t *SA, saidx_t n, saidx_t depth) { + saidx_t *ISAd; + saidx_t *first, *last; + trbudget_t budget; + saidx_t t, skip, unsorted; + + trbudget_init(&budget, tr_ilg(n) * 2 / 3, n); +/* trbudget_init(&budget, tr_ilg(n) * 3 / 4, n); */ + for(ISAd = ISA + depth; -n < *SA; ISAd += ISAd - ISA) { + first = SA; + skip = 0; + unsorted = 0; + do { + if((t = *first) < 0) { first -= t; skip += t; } + else { + if(skip != 0) { *(first + skip) = skip; skip = 0; } + last = SA + ISA[t] + 1; + if(1 < (last - first)) { + budget.count = 0; + tr_introsort(ISA, ISAd, SA, first, last, &budget); + if(budget.count != 0) { unsorted += budget.count; } + else { skip = first - last; } + } else if((last - first) == 1) { + skip = -1; + } + first = last; + } + } while(first < (SA + n)); + if(skip != 0) { *(first + skip) = skip; } + if(unsorted == 0) { break; } + } +} diff --git a/tools/z64compress/src/enc/enc.h b/tools/z64compress/src/enc/enc.h new file mode 100644 index 000000000..60bae3b96 --- /dev/null +++ b/tools/z64compress/src/enc/enc.h @@ -0,0 +1,59 @@ +#ifndef Z64COMPRESS_ENC_H_INCLUDED +#define Z64COMPRESS_ENC_H_INCLUDED + +int yazenc( + void *src + , unsigned src_sz + , void *dst + , unsigned *dst_sz + , void *_ctx +); +void *yazCtx_new(void); +void yazCtx_free(void *_ctx); +int yazdec(void *_src, void *_dst, unsigned dstSz, unsigned *srcSz); + +int lzoenc( + void *src + , unsigned src_sz + , void *dst + , unsigned *dst_sz + , void *_ctx +); +void *lzoCtx_new(void); +void lzoCtx_free(void *_ctx); + +int uclenc( + void *src + , unsigned src_sz + , void *dst + , unsigned *dst_sz + , void *_ctx +); + +int zx7enc( + void *src + , unsigned src_sz + , void *dst + , unsigned *dst_sz + , void *_ctx +); + +int +zlibenc( + void *_src + , unsigned src_sz + , void *_dst + , unsigned *dst_sz + , void *_ctx +); + +int aplenc( + void *_src + , unsigned src_sz + , void *_dst + , unsigned *dst_sz + , void *_ctx +); + +#endif /* Z64COMPRESS_ENC_H_INCLUDED */ + diff --git a/tools/z64compress/src/enc/libdeflate/.cirrus.yml b/tools/z64compress/src/enc/libdeflate/.cirrus.yml new file mode 100644 index 000000000..a4f5cad51 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/.cirrus.yml @@ -0,0 +1,10 @@ +task: + freebsd_instance: + matrix: + - image_family: freebsd-12-3 + - image_family: freebsd-13-0 + install_script: pkg install -y cmake + script: + - cmake -B build -DLIBDEFLATE_BUILD_TESTS=1 + - cmake --build build + - ctest --test-dir build diff --git a/tools/z64compress/src/enc/libdeflate/.github/workflows/ci.yml b/tools/z64compress/src/enc/libdeflate/.github/workflows/ci.yml new file mode 100644 index 000000000..6902e8e16 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/.github/workflows/ci.yml @@ -0,0 +1,192 @@ +name: CI +on: [pull_request] + +jobs: + x86_64-build-and-test: + name: Build and test (x86_64, ${{ matrix.os }}, ${{ matrix.compiler }}) + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-18.04] + compiler: [gcc, clang] + runs-on: ${{ matrix.os }} + env: + CC: ${{ matrix.compiler }} + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang llvm libz-dev valgrind + - run: scripts/run_tests.sh + + other-arch-build-and-test: + name: Build and test (${{ matrix.arch }}, Debian Bullseye, ${{ matrix.compiler }}) + strategy: + matrix: + arch: [armv6, armv7, aarch64, s390x, ppc64le] + compiler: [gcc, clang] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: uraimo/run-on-arch-action@v2.2.0 + with: + arch: ${{ matrix.arch }} + distro: bullseye + githubToken: ${{ github.token }} + install: | + apt-get update + apt-get install -y build-essential cmake clang llvm libz-dev + run: | + tests=(regular) + if [ ${{matrix.compiler}} = clang ]; then + tests+=(ubsan) + fi + CC=${{matrix.compiler}} scripts/run_tests.sh "${tests[@]}" + + macos-build-and-test: + name: Build and test (macOS) + runs-on: macos-latest + env: + CFLAGS: -Werror -DLIBDEFLATE_ENABLE_ASSERTIONS + steps: + - uses: actions/checkout@v2 + - run: cmake -B build -DLIBDEFLATE_BUILD_TESTS=1 + - run: cmake --build build --verbose + - run: ctest --test-dir build + + windows-msys2-build-and-test: + name: Build and test (Windows, MSYS2, ${{matrix.sys}}) + runs-on: windows-latest + strategy: + matrix: + include: + - { sys: mingw64, env: x86_64 } + - { sys: mingw32, env: i686 } + defaults: + run: + shell: msys2 {0} + env: + CFLAGS: -Werror -DLIBDEFLATE_ENABLE_ASSERTIONS + steps: + - uses: actions/checkout@v2 + - uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + update: true + install: > + make + mingw-w64-${{matrix.env}}-cc + mingw-w64-${{matrix.env}}-cmake + mingw-w64-${{matrix.env}}-ninja + mingw-w64-${{matrix.env}}-zlib + - run: cmake -B build -G Ninja -DLIBDEFLATE_BUILD_TESTS=1 + - run: cmake --build build --verbose + - run: ctest --test-dir build + + windows-visualstudio-build-and-test: + name: Build and test (Windows, Visual Studio ${{matrix.toolset}}, ${{matrix.platform.vs}}) + strategy: + matrix: + platform: [ {vs: x64, vcpkg: x64-windows}, + {vs: Win32, vcpkg: x86-windows} ] + toolset: [v143, ClangCL] + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: microsoft/setup-msbuild@v1.1 + - run: vcpkg install zlib:${{matrix.platform.vcpkg}} + - run: > + echo C:\vcpkg\packages\zlib_${{matrix.platform.vcpkg}}\bin + | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - run: > + cmake -B build -G "Visual Studio 17 2022" -T ${{matrix.toolset}} + -A ${{matrix.platform.vs}} -DLIBDEFLATE_BUILD_TESTS=1 + -DCMAKE_C_FLAGS="/W4 /WX /DLIBDEFLATE_ENABLE_ASSERTIONS /IC:\vcpkg\packages\zlib_${{matrix.platform.vcpkg}}\include" + -DZLIB_LIBRARY=C:\vcpkg\packages\zlib_${{matrix.platform.vcpkg}}\lib\zlib.lib + - run: cmake --build build --verbose --config Debug + - run: ctest --test-dir build -C Debug + + windows-visualstudio-build: + name: Build (Windows, Visual Studio ${{matrix.toolset}}, ${{matrix.platform}}) + strategy: + matrix: + platform: [ARM64, ARM] + toolset: [v143, ClangCL] + exclude: # Exclude unsupported combinations + - platform: ARM + toolset: ClangCL + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: microsoft/setup-msbuild@v1.1 + - run: > + cmake -B build -G "Visual Studio 17 2022" -T ${{matrix.toolset}} + -A ${{matrix.platform}} -DCMAKE_C_FLAGS="/W4 /WX" + - run: cmake --build build --verbose + + run-clang-static-analyzer: + name: Run clang static analyzer + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang-tools + - run: scan-build cmake -B build -DLIBDEFLATE_BUILD_TESTS=1 + - run: scan-build cmake --build build --verbose + + run-shellcheck: + name: Run shellcheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y shellcheck + - name: Run shellcheck + run: shellcheck scripts/*.sh + + cross-compile-for-windows: + name: Cross compile for Windows + runs-on: ubuntu-latest + env: + CFLAGS: -Werror -DLIBDEFLATE_ENABLE_ASSERTIONS + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 libz-mingw-w64-dev + # Unfortunately Ubuntu doesn't have {i686,x86_64}-w64-mingw32-cmake like + # some distros have, so we have to provide our own toolchain files here. + - name: 32-bit build + run: | + scripts/cmake-helper.sh -DLIBDEFLATE_BUILD_TESTS=1 \ + -DCMAKE_TOOLCHAIN_FILE=scripts/toolchain-i686-w64-mingw32.cmake + cmake --build build --verbose + - name: 64-bit build + run: | + scripts/cmake-helper.sh -DLIBDEFLATE_BUILD_TESTS=1 \ + -DCMAKE_TOOLCHAIN_FILE=scripts/toolchain-x86_64-w64-mingw32.cmake + cmake --build build --verbose + + cross-compile-for-android: + name: Cross compile for ${{matrix.abi}} Android on ${{matrix.os}} + strategy: + matrix: + os: [ubuntu-18.04, ubuntu-20.04, macos-latest] + abi: [armeabi-v7a, arm64-v8a, x86, x86_64] + runs-on: ${{matrix.os}} + env: + CFLAGS: -Werror -DLIBDEFLATE_ENABLE_ASSERTIONS + steps: + - uses: actions/checkout@v2 + - run: | + scripts/cmake-helper.sh \ + -DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_LATEST_HOME"/build/cmake/android.toolchain.cmake \ + -DANDROID_ABI=${{matrix.abi}} \ + -DANDROID_PLATFORM=28 \ + -DLIBDEFLATE_BUILD_TESTS=1 + cmake --build build --verbose diff --git a/tools/z64compress/src/enc/libdeflate/.gitignore b/tools/z64compress/src/enc/libdeflate/.gitignore new file mode 100644 index 000000000..3a696efc5 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/.gitignore @@ -0,0 +1,3 @@ +/build* +cscope* +tags diff --git a/tools/z64compress/src/enc/libdeflate/COPYING b/tools/z64compress/src/enc/libdeflate/COPYING new file mode 100644 index 000000000..1f1b81cd5 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/COPYING @@ -0,0 +1,21 @@ +Copyright 2016 Eric Biggers + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation files +(the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/z64compress/src/enc/libdeflate/NEWS.md b/tools/z64compress/src/enc/libdeflate/NEWS.md new file mode 100644 index 000000000..497ae2199 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/NEWS.md @@ -0,0 +1,389 @@ +# libdeflate release notes + +## Version 1.15 + +* libdeflate now uses CMake instead of a plain Makefile. + +* Improved MSVC support. Enabled most architecture-specific code with MSVC, + fixed building with clang in MSVC compatibility mode, and other improvements. + +* When libdeflate is built with MinGW, the static library and import library are + now named using the MinGW convention (`*.a` and `*.dll.a`) instead of the + Visual Studio convention. This affects the official Windows binaries. + +## Version 1.14 + +Significantly improved decompression performance on all platforms. Examples +include (measuring DEFLATE only): + +| Platform | Speedup over v1.13 | +|------------------------------------|--------------------| +| x86_64 (Intel Comet Lake), gcc | 1.287x | +| x86_64 (Intel Comet Lake), clang | 1.437x | +| x86_64 (Intel Ice Lake), gcc | 1.332x | +| x86_64 (Intel Ice Lake), clang | 1.296x | +| x86_64 (Intel Sandy Bridge), gcc | 1.162x | +| x86_64 (Intel Sandy Bridge), clang | 1.092x | +| x86_64 (AMD Zen 2), gcc | 1.263x | +| x86_64 (AMD Zen 2), clang | 1.259x | +| i386 (Intel Comet Lake), gcc | 1.570x | +| i386 (Intel Comet Lake), clang | 1.344x | +| arm64 (Apple M1), clang | 1.306x | +| arm64 (Cortex-A76), clang | 1.355x | +| arm64 (Cortex-A55), clang | 1.190x | +| arm32 (Cortex-A76), clang | 1.665x | +| arm32 (Cortex-A55), clang | 1.283x | + +Thanks to Dougall Johnson (https://dougallj.wordpress.com/) for ideas for many +of the improvements. + +## Version 1.13 + +* Changed the 32-bit Windows build of the library to use the default calling + convention (cdecl) instead of stdcall, reverting a change from libdeflate 1.4. + +* Fixed a couple macOS compatibility issues with the gzip program. + +## Version 1.12 + +This release focuses on improving the performance of the CRC-32 and Adler-32 +checksum algorithms on x86 and ARM (both 32-bit and 64-bit). + +* Build updates: + + * Fixed building libdeflate on Apple platforms. + + * For Visual Studio builds, Visual Studio 2015 or later is now required. + +* CRC-32 algorithm updates: + + * Improved CRC-32 performance on short inputs on x86 and ARM. + + * Improved CRC-32 performance on Apple Silicon Macs by using a 12-way pmull + implementation. Performance on large inputs on M1 is now about 67 GB/s, + compared to 8 GB/s before, or 31 GB/s with the Apple-provided zlib. + + * Improved CRC-32 performance on some other ARM CPUs by reworking the code so + that multiple crc32 instructions can be issued in parallel. + + * Improved CRC-32 performance on some x86 CPUs by increasing the stride length + of the pclmul implementation. + +* Adler-32 algorithm updates: + + * Improved Adler-32 performance on some x86 CPUs by optimizing the AVX-2 + implementation. E.g., performance on Zen 1 improved from 19 to 30 GB/s, and + on Ice Lake from 35 to 41 GB/s (if the AVX-512 implementation is excluded). + + * Removed the AVX-512 implementation of Adler-32 to avoid CPU frequency + downclocking, and because the AVX-2 implementation was made faster. + + * Improved Adler-32 performance on some ARM CPUs by optimizing the NEON + implementation. E.g., Apple M1 improved from about 36 to 52 GB/s. + +## Version 1.11 + +* Library updates: + + * Improved compression performance slightly. + + * Detect arm64 CPU features on Apple platforms, which should improve + performance in some areas such as CRC-32 computation. + +* Program updates: + + * The included `gzip` and `gunzip` programs now support the `-q` option. + + * The included `gunzip` program now passes through non-gzip data when both + the `-f` and `-c` options are used. + +* Build updates: + + * Avoided a build error on arm32 with certain gcc versions, by disabling + building `crc32_arm()` as dynamically-dispatched code when needed. + + * Support building with the LLVM toolchain on Windows. + + * Disabled the use of the "stdcall" ABI in static library builds on Windows. + + * Use the correct `install_name` in macOS builds. + + * Support Haiku builds. + +## Version 1.10 + +* Added an additional check to the decompressor to make it quickly detect + certain bad inputs and not try to generate an unbounded amount of output. + + Note: this was only a problem when decompressing with an unknown output size, + which isn't the recommended use case of libdeflate. However, + `libdeflate-gunzip` has to do this, and it would run out of memory as it would + keep trying to allocate a larger output buffer. + +* Fixed a build error on Solaris. + +* Cleaned up a few things in the compression code. + +## Version 1.9 + +* Made many improvements to the compression algorithms, and rebalanced the + compression levels: + + * Heuristics were implemented which significantly improve the compression + ratio on data where short matches aren't useful, such as DNA sequencing + data. This applies to all compression levels, but primarily to levels 1-9. + + * Level 1 was made much faster, though it often compresses slightly worse than + before (but still better than zlib). + + * Levels 8-9 were also made faster, though they often compress slightly worse + than before (but still better than zlib). On some data, levels 8-9 are much + faster and compress much better than before; this change addressed an issue + where levels 8-9 did poorly on certain files. The algorithm used by levels + 8-9 is now more similar to that of levels 6-7 than to that of levels 10-12. + + * Levels 2-3, 7, and 10-12 were strengthened slightly. + + * Levels 4-6 were also strengthened slightly, but some of this improvement was + traded off to speed them up slightly as well. + + * Levels 1-9 had their per-compressor memory usage greatly reduced. + + As always, compression ratios will vary depending on the input data, and + compression speeds will vary depending on the input data and target platform. + +* `make install` will now install a pkg-config file for libdeflate. + +* The Makefile now supports the `DISABLE_SHARED` parameter to disable building + the shared library. + +* Improved the Android build support in the Makefile. + +## Version 1.8 + +* Added `-t` (test) option to `libdeflate-gunzip`. + +* Unaligned access optimizations are now enabled on WebAssembly builds. + +* Fixed a build error when building with the Intel C Compiler (ICC). + +* Fixed a build error when building with uClibc. + +* libdeflate's CI system has switched from Travis CI to GitHub Actions. + +* Made some improvements to test scripts. + +## Version 1.7 + +* Added support for compression level 0, "no compression". + +* Added an ARM CRC32 instruction accelerated implementation of CRC32. + +* Added support for linking the programs to the shared library version of + libdeflate rather than to the static library version. + +* Made the compression level affect the minimum input size at which compression + is attempted. + +* Fixed undefined behavior in x86 Adler32 implementation. (No miscompilations + were observed in practice.) + +* Fixed undefined behavior in x86 CPU feature code. (No miscompilations were + observed in practice.) + +* Fixed installing shared lib symlink on macOS. + +* Documented third-party bindings. + +* Made a lot of improvements to the testing scripts and the CI configuration + file. + +* Lots of other small improvements and cleanups. + +## Version 1.6 + +* Prevented gcc 10 from miscompiling libdeflate (workaround for + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94994). + +* Removed workaround for gcc 5 and earlier producing slow code on ARM32. If + this affects you, please upgrade your compiler. + +* New API function: `libdeflate_zlib_decompress_ex()`. It provides the actual + size of the stream that was decompressed, like the gzip and DEFLATE + equivalents. + +* `libdeflate_zlib_decompress()` now accepts trailing bytes after the end of the + stream, like the gzip and DEFLATE equivalents. + +* Added support for custom memory allocators. (New API function: + `libdeflate_set_memory_allocator()`) + +* Added support for building the library in freestanding mode. + +* Building libdeflate no longer requires `CPPFLAGS=-Icommon`. + +## Version 1.5 + +* Fixed up stdcall support on 32-bit Windows: the functions are now exported + using both suffixed and non-suffixed names, and fixed `libdeflate.h` to be + MSVC-compatible again. + +## Version 1.4 + +* The 32-bit Windows build of libdeflate now uses the "stdcall" calling + convention instead of "cdecl". If you're calling `libdeflate.dll` directly + from C or C++, you'll need to recompile your code. If you're calling it from + another language, or calling it indirectly using `LoadLibrary()`, you'll need + to update your code to use the stdcall calling convention. + +* The Makefile now supports building libdeflate as a shared + library (`.dylib`) on macOS. + +* Fixed a bug where support for certain optimizations and optional features + (file access hints and more precise timestamps) was incorrectly omitted when + libdeflate was compiled with `-Werror`. + +* Added `make check` target to the Makefile. + +* Added CI configuration files. + +## Version 1.3 + +* `make install` now supports customizing the directories into which binaries, + headers, and libraries are installed. + +* `make install` now installs into `/usr/local` by default. To change it, use + e.g. `make install PREFIX=/usr`. + +* `make install` now works on more platforms. + +* The Makefile now supports overriding the optimization flags. + +* The compression functions now correctly handle an output data buffer >= 4 GiB + in size, and `gzip` and `gunzip` now correctly handle multi-gigabyte files (if + enough memory is available). + +## Version 1.2 + +* Slight improvements to decompression speed. + +* Added an AVX-512BW implementation of Adler-32. + +* The Makefile now supports a user-specified installation `PREFIX`. + +* Fixed build error with some Visual Studio versions. + +## Version 1.1 + +* Fixed crash in CRC-32 code when the prebuilt libdeflate for 32-bit Windows was + called by a program built with Visual Studio. + +* Improved the worst-case decompression speed of malicious data. + +* Fixed build error when compiling for an ARM processor without hardware + floating point support. + +* Improved performance on the PowerPC64 architecture. + +* Added soname to `libdeflate.so`, to make packaging easier. + +* Added `make install` target to the Makefile. + +* The Makefile now supports user-specified `CPPFLAGS`. + +* The Windows binary releases now include the import library for + `libdeflate.dll`. `libdeflate.lib` is now the import library, and + `libdeflatestatic.lib` is the static library. + +## Version 1.0 + +* Added support for multi-member gzip files. + +* Moved architecture-specific code into subdirectories. If you aren't using the + provided Makefile to build libdeflate, you now need to compile `lib/*.c` and + `lib/*/*.c` instead of just `lib/*.c`. + +* Added an ARM PMULL implementation of CRC-32, which speeds up gzip compression + and decompression on 32-bit and 64-bit ARM processors that have the + Cryptography Extensions. + +* Improved detection of CPU features, resulting in accelerated functions being + used in more cases. This includes: + + * Detect CPU features on 32-bit x86, not just 64-bit as was done previously. + + * Detect CPU features on ARM, both 32 and 64-bit. (Limited to Linux only + currently.) + +## Version 0.8 + +* Build fixes for certain platforms and compilers. + +* libdeflate now produces the same output on all CPU architectures. + +* Improved documentation for building libdeflate on Windows. + +## Version 0.7 + +* Fixed a very rare bug that caused data to be compressed incorrectly. The bug + affected compression levels 7 and below since libdeflate v0.2. Although there + have been no user reports of the bug, and I believe it would have been highly + unlikely to encounter on realistic data, it could occur on data specially + crafted to reproduce it. + +* Fixed a compilation error when building with clang 3.7. + +## Version 0.6 + +* Various improvements to the gzip program's behavior. + +* Faster CRC-32 on AVX-capable processors. + +* Other minor changes. + +## Version 0.5 + +* The CRC-32 checksum algorithm has been optimized with carryless multiplication + instructions for `x86_64` (PCLMUL). This speeds up gzip compression and + decompression. + +* Build fixes for certain platforms and compilers. + +* Added more test programs and scripts. + +* libdeflate is now entirely MIT-licensed. + +## Version 0.4 + +* The Adler-32 checksum algorithm has been optimized with vector instructions + for `x86_64` (SSE2 and AVX2) and ARM (NEON). This speeds up zlib compression + and decompression. + +* To avoid naming collisions, functions and definitions in libdeflate's API have + been renamed to be prefixed with `libdeflate_` or `LIBDEFLATE_`. Programs + using the old API will need to be updated. + +* Various bug fixes and other improvements. + +## Version 0.3 + +* Some bug fixes and other minor changes. + +## Version 0.2 + +* Implemented a new block splitting algorithm which typically improves the + compression ratio slightly at all compression levels. + +* The compressor now outputs each block using the cheapest type (dynamic + Huffman, static Huffman, or uncompressed). + +* The gzip program has received an overhaul and now behaves more like the + standard version. + +* Build system updates, including: some build options were changed and some + build options were removed, and the default 'make' target now includes the + gzip program as well as the library. + +## Version 0.1 + +* Initial official release. diff --git a/tools/z64compress/src/enc/libdeflate/README.md b/tools/z64compress/src/enc/libdeflate/README.md new file mode 100644 index 000000000..f5bbd93c2 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/README.md @@ -0,0 +1,204 @@ +# Overview + +libdeflate is a library for fast, whole-buffer DEFLATE-based compression and +decompression. + +The supported formats are: + +- DEFLATE (raw) +- zlib (a.k.a. DEFLATE with a zlib wrapper) +- gzip (a.k.a. DEFLATE with a gzip wrapper) + +libdeflate is heavily optimized. It is significantly faster than the zlib +library, both for compression and decompression, and especially on x86 +processors. In addition, libdeflate provides optional high compression modes +that provide a better compression ratio than the zlib's "level 9". + +libdeflate itself is a library. The following command-line programs which use +this library are also included: + +* `libdeflate-gzip`, a program which can be a drop-in replacement for standard + `gzip` under some circumstances. Note that `libdeflate-gzip` has some + limitations; it is provided for convenience and is **not** meant to be the + main use case of libdeflate. It needs a lot of memory to process large files, + and it omits support for some infrequently-used options of GNU gzip. + +* `benchmark`, a test program that does round-trip compression and decompression + of the provided data, and measures the compression and decompression speed. + It can use libdeflate, zlib, or a combination of the two. + +* `checksum`, a test program that checksums the provided data with Adler-32 or + CRC-32, and optionally measures the speed. It can use libdeflate or zlib. + +For the release notes, see the [NEWS file](NEWS.md). + +## Table of Contents + +- [Building](#building) + - [Using CMake](#using-cmake) + - [Directly integrating the library sources](#directly-integrating-the-library-sources) +- [API](#api) +- [Bindings for other programming languages](#bindings-for-other-programming-languages) +- [DEFLATE vs. zlib vs. gzip](#deflate-vs-zlib-vs-gzip) +- [Compression levels](#compression-levels) +- [Motivation](#motivation) +- [License](#license) + +# Building + +## Using CMake + +libdeflate uses [CMake](https://cmake.org/). It can be built just like any +other CMake project, e.g. with: + + cmake -B build && cmake --build build + +By default the following targets are built: + +- The static library (normally called `libdeflate.a`) +- The shared library (normally called `libdeflate.so`) +- The `libdeflate-gzip` program, including its alias `libdeflate-gunzip` + +Besides the standard CMake build and installation options, there are some +libdeflate-specific build options. See `CMakeLists.txt` for the list of these +options. To set an option, add `-DOPTION=VALUE` to the `cmake` command. + +Prebuilt Windows binaries can be downloaded from +https://github.com/ebiggers/libdeflate/releases. + +## Directly integrating the library sources + +Although the official build system is CMake, care has been taken to keep the +library source files compilable directly, without a prerequisite configuration +step. Therefore, it is also fine to just add the library source files directly +to your application, without using CMake. + +You should compile both `lib/*.c` and `lib/*/*.c`. You don't need to worry +about excluding irrelevant architecture-specific code, as this is already +handled in the source files themselves using `#ifdef`s. + +It is strongly recommended to use either gcc or clang, and to use `-O2`. + +If you are doing a freestanding build with `-ffreestanding`, you must add +`-DFREESTANDING` as well (matching what the `CMakeLists.txt` does). + +# API + +libdeflate has a simple API that is not zlib-compatible. You can create +compressors and decompressors and use them to compress or decompress buffers. +See libdeflate.h for details. + +There is currently no support for streaming. This has been considered, but it +always significantly increases complexity and slows down fast paths. +Unfortunately, at this point it remains a future TODO. So: if your application +compresses data in "chunks", say, less than 1 MB in size, then libdeflate is a +great choice for you; that's what it's designed to do. This is perfect for +certain use cases such as transparent filesystem compression. But if your +application compresses large files as a single compressed stream, similarly to +the `gzip` program, then libdeflate isn't for you. + +Note that with chunk-based compression, you generally should have the +uncompressed size of each chunk stored outside of the compressed data itself. +This enables you to allocate an output buffer of the correct size without +guessing. However, libdeflate's decompression routines do optionally provide +the actual number of output bytes in case you need it. + +Windows developers: note that the calling convention of libdeflate.dll is +"cdecl". (libdeflate v1.4 through v1.12 used "stdcall" instead.) + +# Bindings for other programming languages + +The libdeflate project itself only provides a C library. If you need to use +libdeflate from a programming language other than C or C++, consider using the +following bindings: + +* C#: [LibDeflate.NET](https://github.com/jzebedee/LibDeflate.NET) +* Go: [go-libdeflate](https://github.com/4kills/go-libdeflate) +* Java: [libdeflate-java](https://github.com/astei/libdeflate-java) +* Julia: [LibDeflate.jl](https://github.com/jakobnissen/LibDeflate.jl) +* Perl: [Gzip::Libdeflate](https://github.com/benkasminbullock/gzip-libdeflate) +* Python: [deflate](https://github.com/dcwatson/deflate) +* Ruby: [libdeflate-ruby](https://github.com/kaorimatz/libdeflate-ruby) +* Rust: [libdeflater](https://github.com/adamkewley/libdeflater) + +Note: these are third-party projects which haven't necessarily been vetted by +the authors of libdeflate. Please direct all questions, bugs, and improvements +for these bindings to their authors. + +# DEFLATE vs. zlib vs. gzip + +The DEFLATE format ([rfc1951](https://www.ietf.org/rfc/rfc1951.txt)), the zlib +format ([rfc1950](https://www.ietf.org/rfc/rfc1950.txt)), and the gzip format +([rfc1952](https://www.ietf.org/rfc/rfc1952.txt)) are commonly confused with +each other as well as with the [zlib software library](http://zlib.net), which +actually supports all three formats. libdeflate (this library) also supports +all three formats. + +Briefly, DEFLATE is a raw compressed stream, whereas zlib and gzip are different +wrappers for this stream. Both zlib and gzip include checksums, but gzip can +include extra information such as the original filename. Generally, you should +choose a format as follows: + +- If you are compressing whole files with no subdivisions, similar to the `gzip` + program, you probably should use the gzip format. +- Otherwise, if you don't need the features of the gzip header and footer but do + still want a checksum for corruption detection, you probably should use the + zlib format. +- Otherwise, you probably should use raw DEFLATE. This is ideal if you don't + need checksums, e.g. because they're simply not needed for your use case or + because you already compute your own checksums that are stored separately from + the compressed stream. + +Note that gzip and zlib streams can be distinguished from each other based on +their starting bytes, but this is not necessarily true of raw DEFLATE streams. + +# Compression levels + +An often-underappreciated fact of compression formats such as DEFLATE is that +there are an enormous number of different ways that a given input could be +compressed. Different algorithms and different amounts of computation time will +result in different compression ratios, while remaining equally compatible with +the decompressor. + +For this reason, the commonly used zlib library provides nine compression +levels. Level 1 is the fastest but provides the worst compression; level 9 +provides the best compression but is the slowest. It defaults to level 6. +libdeflate uses this same design but is designed to improve on both zlib's +performance *and* compression ratio at every compression level. In addition, +libdeflate's levels go [up to 12](https://xkcd.com/670/) to make room for a +minimum-cost-path based algorithm (sometimes called "optimal parsing") that can +significantly improve on zlib's compression ratio. + +If you are using DEFLATE (or zlib, or gzip) in your application, you should test +different levels to see which works best for your application. + +# Motivation + +Despite DEFLATE's widespread use mainly through the zlib library, in the +compression community this format from the early 1990s is often considered +obsolete. And in a few significant ways, it is. + +So why implement DEFLATE at all, instead of focusing entirely on +bzip2/LZMA/xz/LZ4/LZX/ZSTD/Brotli/LZHAM/LZFSE/[insert cool new format here]? + +To do something better, you need to understand what came before. And it turns +out that most ideas from DEFLATE are still relevant. Many of the newer formats +share a similar structure as DEFLATE, with different tweaks. The effects of +trivial but very useful tweaks, such as increasing the sliding window size, are +often confused with the effects of nontrivial but less useful tweaks. And +actually, many of these formats are similar enough that common algorithms and +optimizations (e.g. those dealing with LZ77 matchfinding) can be reused. + +In addition, comparing compressors fairly is difficult because the performance +of a compressor depends heavily on optimizations which are not intrinsic to the +compression format itself. In this respect, the zlib library sometimes compares +poorly to certain newer code because zlib is not well optimized for modern +processors. libdeflate addresses this by providing an optimized DEFLATE +implementation which can be used for benchmarking purposes. And, of course, +real applications can use it as well. + +# License + +libdeflate is [MIT-licensed](COPYING). + +I am not aware of any patents or patent applications relevant to libdeflate. diff --git a/tools/z64compress/src/enc/libdeflate/common_defs.h b/tools/z64compress/src/enc/libdeflate/common_defs.h new file mode 100644 index 000000000..debdc7d41 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/common_defs.h @@ -0,0 +1,716 @@ +/* + * common_defs.h + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef COMMON_DEFS_H +#define COMMON_DEFS_H + +#include +#include /* for size_t */ +#include +#ifdef _MSC_VER +# include /* for _BitScan*() and other intrinsics */ +# include /* for _byteswap_*() */ + /* Disable MSVC warnings that are expected. */ + /* /W2 */ +# pragma warning(disable : 4146) /* unary minus on unsigned type */ + /* /W3 */ +# pragma warning(disable : 4018) /* signed/unsigned mismatch */ +# pragma warning(disable : 4244) /* possible loss of data */ +# pragma warning(disable : 4267) /* possible loss of precision */ +# pragma warning(disable : 4310) /* cast truncates constant value */ + /* /W4 */ +# pragma warning(disable : 4100) /* unreferenced formal parameter */ +# pragma warning(disable : 4127) /* conditional expression is constant */ +# pragma warning(disable : 4189) /* local variable initialized but not referenced */ +# pragma warning(disable : 4232) /* nonstandard extension used */ +# pragma warning(disable : 4245) /* conversion from 'int' to 'unsigned int' */ +# pragma warning(disable : 4295) /* array too small to include terminating null */ +#endif +#ifndef FREESTANDING +# include /* for memcpy() */ +#endif + +/* ========================================================================== */ +/* Target architecture */ +/* ========================================================================== */ + +/* If possible, define a compiler-independent ARCH_* macro. */ +#undef ARCH_X86_64 +#undef ARCH_X86_32 +#undef ARCH_ARM64 +#undef ARCH_ARM32 +#ifdef _MSC_VER +# if defined(_M_X64) +# define ARCH_X86_64 +# elif defined(_M_IX86) +# define ARCH_X86_32 +# elif defined(_M_ARM64) +# define ARCH_ARM64 +# elif defined(_M_ARM) +# define ARCH_ARM32 +# endif +#else +# if defined(__x86_64__) +# define ARCH_X86_64 +# elif defined(__i386__) +# define ARCH_X86_32 +# elif defined(__aarch64__) +# define ARCH_ARM64 +# elif defined(__arm__) +# define ARCH_ARM32 +# endif +#endif + +/* ========================================================================== */ +/* Type definitions */ +/* ========================================================================== */ + +/* Fixed-width integer types */ +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; +typedef int8_t s8; +typedef int16_t s16; +typedef int32_t s32; +typedef int64_t s64; + +/* ssize_t, if not available in */ +#ifdef _MSC_VER +# ifdef _WIN64 + typedef long long ssize_t; +# else + typedef long ssize_t; +# endif +#endif + +/* + * Word type of the target architecture. Use 'size_t' instead of + * 'unsigned long' to account for platforms such as Windows that use 32-bit + * 'unsigned long' on 64-bit architectures. + */ +typedef size_t machine_word_t; + +/* Number of bytes in a word */ +#define WORDBYTES ((int)sizeof(machine_word_t)) + +/* Number of bits in a word */ +#define WORDBITS (8 * WORDBYTES) + +/* ========================================================================== */ +/* Optional compiler features */ +/* ========================================================================== */ + +/* Compiler version checks. Only use when absolutely necessary. */ +#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) +# define GCC_PREREQ(major, minor) \ + (__GNUC__ > (major) || \ + (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) +#else +# define GCC_PREREQ(major, minor) 0 +#endif +#ifdef __clang__ +# ifdef __apple_build_version__ +# define CLANG_PREREQ(major, minor, apple_version) \ + (__apple_build_version__ >= (apple_version)) +# else +# define CLANG_PREREQ(major, minor, apple_version) \ + (__clang_major__ > (major) || \ + (__clang_major__ == (major) && __clang_minor__ >= (minor))) +# endif +#else +# define CLANG_PREREQ(major, minor, apple_version) 0 +#endif + +/* + * Macros to check for compiler support for attributes and builtins. clang + * implements these macros, but gcc doesn't, so generally any use of one of + * these macros must also be combined with a gcc version check. + */ +#ifndef __has_attribute +# define __has_attribute(attribute) 0 +#endif +#ifndef __has_builtin +# define __has_builtin(builtin) 0 +#endif + +/* inline - suggest that a function be inlined */ +#ifdef _MSC_VER +# define inline __inline +#endif /* else assume 'inline' is usable as-is */ + +/* forceinline - force a function to be inlined, if possible */ +#if defined(__GNUC__) || __has_attribute(always_inline) +# define forceinline inline __attribute__((always_inline)) +#elif defined(_MSC_VER) +# define forceinline __forceinline +#else +# define forceinline inline +#endif + +/* MAYBE_UNUSED - mark a function or variable as maybe unused */ +#if defined(__GNUC__) || __has_attribute(unused) +# define MAYBE_UNUSED __attribute__((unused)) +#else +# define MAYBE_UNUSED +#endif + +/* + * restrict - hint that writes only occur through the given pointer. + * + * Don't use MSVC's __restrict, since it has nonstandard behavior. + * Standard restrict is okay, if it is supported. + */ +#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 201112L) +# if defined(__GNUC__) || defined(__clang__) +# define restrict __restrict__ +# else +# define restrict +# endif +#endif /* else assume 'restrict' is usable as-is */ + +/* likely(expr) - hint that an expression is usually true */ +#if defined(__GNUC__) || __has_builtin(__builtin_expect) +# define likely(expr) __builtin_expect(!!(expr), 1) +#else +# define likely(expr) (expr) +#endif + +/* unlikely(expr) - hint that an expression is usually false */ +#if defined(__GNUC__) || __has_builtin(__builtin_expect) +# define unlikely(expr) __builtin_expect(!!(expr), 0) +#else +# define unlikely(expr) (expr) +#endif + +/* prefetchr(addr) - prefetch into L1 cache for read */ +#undef prefetchr +#if defined(__GNUC__) || __has_builtin(__builtin_prefetch) +# define prefetchr(addr) __builtin_prefetch((addr), 0) +#elif defined(_MSC_VER) +# if defined(ARCH_X86_32) || defined(ARCH_X86_64) +# define prefetchr(addr) _mm_prefetch((addr), _MM_HINT_T0) +# elif defined(ARCH_ARM64) +# define prefetchr(addr) __prefetch2((addr), 0x00 /* prfop=PLDL1KEEP */) +# elif defined(ARCH_ARM32) +# define prefetchr(addr) __prefetch(addr) +# endif +#endif +#ifndef prefetchr +# define prefetchr(addr) +#endif + +/* prefetchw(addr) - prefetch into L1 cache for write */ +#undef prefetchw +#if defined(__GNUC__) || __has_builtin(__builtin_prefetch) +# define prefetchw(addr) __builtin_prefetch((addr), 1) +#elif defined(_MSC_VER) +# if defined(ARCH_X86_32) || defined(ARCH_X86_64) +# define prefetchw(addr) _m_prefetchw(addr) +# elif defined(ARCH_ARM64) +# define prefetchw(addr) __prefetch2((addr), 0x10 /* prfop=PSTL1KEEP */) +# elif defined(ARCH_ARM32) +# define prefetchw(addr) __prefetchw(addr) +# endif +#endif +#ifndef prefetchw +# define prefetchw(addr) +#endif + +/* + * _aligned_attribute(n) - declare that the annotated variable, or variables of + * the annotated type, must be aligned on n-byte boundaries. + */ +#undef _aligned_attribute +#if defined(__GNUC__) || __has_attribute(aligned) +# define _aligned_attribute(n) __attribute__((aligned(n))) +#elif defined(_MSC_VER) +# define _aligned_attribute(n) __declspec(align(n)) +#endif + +/* + * _target_attribute(attrs) - override the compilation target for a function. + * + * This accepts one or more comma-separated suffixes to the -m prefix jointly + * forming the name of a machine-dependent option. On gcc-like compilers, this + * enables codegen for the given targets, including arbitrary compiler-generated + * code as well as the corresponding intrinsics. On other compilers this macro + * expands to nothing, though MSVC allows intrinsics to be used anywhere anyway. + */ +#if GCC_PREREQ(4, 4) || __has_attribute(target) +# define _target_attribute(attrs) __attribute__((target(attrs))) +# define COMPILER_SUPPORTS_TARGET_FUNCTION_ATTRIBUTE 1 +#else +# define _target_attribute(attrs) +# define COMPILER_SUPPORTS_TARGET_FUNCTION_ATTRIBUTE 0 +#endif + +/* ========================================================================== */ +/* Miscellaneous macros */ +/* ========================================================================== */ + +#define ARRAY_LEN(A) (sizeof(A) / sizeof((A)[0])) +#define MIN(a, b) ((a) <= (b) ? (a) : (b)) +#define MAX(a, b) ((a) >= (b) ? (a) : (b)) +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) +#define STATIC_ASSERT(expr) ((void)sizeof(char[1 - 2 * !(expr)])) +#define ALIGN(n, a) (((n) + (a) - 1) & ~((a) - 1)) +#define ROUND_UP(n, d) ((d) * DIV_ROUND_UP((n), (d))) + +/* ========================================================================== */ +/* Endianness handling */ +/* ========================================================================== */ + +/* + * CPU_IS_LITTLE_ENDIAN() - 1 if the CPU is little endian, or 0 if it is big + * endian. When possible this is a compile-time macro that can be used in + * preprocessor conditionals. As a fallback, a generic method is used that + * can't be used in preprocessor conditionals but should still be optimized out. + */ +#if defined(__BYTE_ORDER__) /* gcc v4.6+ and clang */ +# define CPU_IS_LITTLE_ENDIAN() (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +#elif defined(_MSC_VER) +# define CPU_IS_LITTLE_ENDIAN() true +#else +static forceinline bool CPU_IS_LITTLE_ENDIAN(void) +{ + union { + u32 w; + u8 b; + } u; + + u.w = 1; + return u.b; +} +#endif + +/* bswap16(v) - swap the bytes of a 16-bit integer */ +static forceinline u16 bswap16(u16 v) +{ +#if GCC_PREREQ(4, 8) || __has_builtin(__builtin_bswap16) + return __builtin_bswap16(v); +#elif defined(_MSC_VER) + return _byteswap_ushort(v); +#else + return (v << 8) | (v >> 8); +#endif +} + +/* bswap32(v) - swap the bytes of a 32-bit integer */ +static forceinline u32 bswap32(u32 v) +{ +#if GCC_PREREQ(4, 3) || __has_builtin(__builtin_bswap32) + return __builtin_bswap32(v); +#elif defined(_MSC_VER) + return _byteswap_ulong(v); +#else + return ((v & 0x000000FF) << 24) | + ((v & 0x0000FF00) << 8) | + ((v & 0x00FF0000) >> 8) | + ((v & 0xFF000000) >> 24); +#endif +} + +/* bswap64(v) - swap the bytes of a 64-bit integer */ +static forceinline u64 bswap64(u64 v) +{ +#if GCC_PREREQ(4, 3) || __has_builtin(__builtin_bswap64) + return __builtin_bswap64(v); +#elif defined(_MSC_VER) + return _byteswap_uint64(v); +#else + return ((v & 0x00000000000000FF) << 56) | + ((v & 0x000000000000FF00) << 40) | + ((v & 0x0000000000FF0000) << 24) | + ((v & 0x00000000FF000000) << 8) | + ((v & 0x000000FF00000000) >> 8) | + ((v & 0x0000FF0000000000) >> 24) | + ((v & 0x00FF000000000000) >> 40) | + ((v & 0xFF00000000000000) >> 56); +#endif +} + +#define le16_bswap(v) (CPU_IS_LITTLE_ENDIAN() ? (v) : bswap16(v)) +#define le32_bswap(v) (CPU_IS_LITTLE_ENDIAN() ? (v) : bswap32(v)) +#define le64_bswap(v) (CPU_IS_LITTLE_ENDIAN() ? (v) : bswap64(v)) +#define be16_bswap(v) (CPU_IS_LITTLE_ENDIAN() ? bswap16(v) : (v)) +#define be32_bswap(v) (CPU_IS_LITTLE_ENDIAN() ? bswap32(v) : (v)) +#define be64_bswap(v) (CPU_IS_LITTLE_ENDIAN() ? bswap64(v) : (v)) + +/* ========================================================================== */ +/* Unaligned memory accesses */ +/* ========================================================================== */ + +/* + * UNALIGNED_ACCESS_IS_FAST() - 1 if unaligned memory accesses can be performed + * efficiently on the target platform, otherwise 0. + */ +#if (defined(__GNUC__) || defined(__clang__)) && \ + (defined(ARCH_X86_64) || defined(ARCH_X86_32) || \ + defined(__ARM_FEATURE_UNALIGNED) || defined(__powerpc64__) || \ + /* + * For all compilation purposes, WebAssembly behaves like any other CPU + * instruction set. Even though WebAssembly engine might be running on + * top of different actual CPU architectures, the WebAssembly spec + * itself permits unaligned access and it will be fast on most of those + * platforms, and simulated at the engine level on others, so it's + * worth treating it as a CPU architecture with fast unaligned access. + */ defined(__wasm__)) +# define UNALIGNED_ACCESS_IS_FAST 1 +#elif defined(_MSC_VER) +# define UNALIGNED_ACCESS_IS_FAST 1 +#else +# define UNALIGNED_ACCESS_IS_FAST 0 +#endif + +/* + * Implementing unaligned memory accesses using memcpy() is portable, and it + * usually gets optimized appropriately by modern compilers. I.e., each + * memcpy() of 1, 2, 4, or WORDBYTES bytes gets compiled to a load or store + * instruction, not to an actual function call. + * + * We no longer use the "packed struct" approach to unaligned accesses, as that + * is nonstandard, has unclear semantics, and doesn't receive enough testing + * (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94994). + * + * arm32 with __ARM_FEATURE_UNALIGNED in gcc 5 and earlier is a known exception + * where memcpy() generates inefficient code + * (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67366). However, we no longer + * consider that one case important enough to maintain different code for. + * If you run into it, please just use a newer version of gcc (or use clang). + */ + +#ifdef FREESTANDING +# define MEMCOPY __builtin_memcpy +#else +# define MEMCOPY memcpy +#endif + +/* Unaligned loads and stores without endianness conversion */ + +#define DEFINE_UNALIGNED_TYPE(type) \ +static forceinline type \ +load_##type##_unaligned(const void *p) \ +{ \ + type v; \ + \ + MEMCOPY(&v, p, sizeof(v)); \ + return v; \ +} \ + \ +static forceinline void \ +store_##type##_unaligned(type v, void *p) \ +{ \ + MEMCOPY(p, &v, sizeof(v)); \ +} + +DEFINE_UNALIGNED_TYPE(u16) +DEFINE_UNALIGNED_TYPE(u32) +DEFINE_UNALIGNED_TYPE(u64) +DEFINE_UNALIGNED_TYPE(machine_word_t) + +#undef MEMCOPY + +#define load_word_unaligned load_machine_word_t_unaligned +#define store_word_unaligned store_machine_word_t_unaligned + +/* Unaligned loads with endianness conversion */ + +static forceinline u16 +get_unaligned_le16(const u8 *p) +{ + if (UNALIGNED_ACCESS_IS_FAST) + return le16_bswap(load_u16_unaligned(p)); + else + return ((u16)p[1] << 8) | p[0]; +} + +static forceinline u16 +get_unaligned_be16(const u8 *p) +{ + if (UNALIGNED_ACCESS_IS_FAST) + return be16_bswap(load_u16_unaligned(p)); + else + return ((u16)p[0] << 8) | p[1]; +} + +static forceinline u32 +get_unaligned_le32(const u8 *p) +{ + if (UNALIGNED_ACCESS_IS_FAST) + return le32_bswap(load_u32_unaligned(p)); + else + return ((u32)p[3] << 24) | ((u32)p[2] << 16) | + ((u32)p[1] << 8) | p[0]; +} + +static forceinline u32 +get_unaligned_be32(const u8 *p) +{ + if (UNALIGNED_ACCESS_IS_FAST) + return be32_bswap(load_u32_unaligned(p)); + else + return ((u32)p[0] << 24) | ((u32)p[1] << 16) | + ((u32)p[2] << 8) | p[3]; +} + +static forceinline u64 +get_unaligned_le64(const u8 *p) +{ + if (UNALIGNED_ACCESS_IS_FAST) + return le64_bswap(load_u64_unaligned(p)); + else + return ((u64)p[7] << 56) | ((u64)p[6] << 48) | + ((u64)p[5] << 40) | ((u64)p[4] << 32) | + ((u64)p[3] << 24) | ((u64)p[2] << 16) | + ((u64)p[1] << 8) | p[0]; +} + +static forceinline machine_word_t +get_unaligned_leword(const u8 *p) +{ + STATIC_ASSERT(WORDBITS == 32 || WORDBITS == 64); + if (WORDBITS == 32) + return get_unaligned_le32(p); + else + return get_unaligned_le64(p); +} + +/* Unaligned stores with endianness conversion */ + +static forceinline void +put_unaligned_le16(u16 v, u8 *p) +{ + if (UNALIGNED_ACCESS_IS_FAST) { + store_u16_unaligned(le16_bswap(v), p); + } else { + p[0] = (u8)(v >> 0); + p[1] = (u8)(v >> 8); + } +} + +static forceinline void +put_unaligned_be16(u16 v, u8 *p) +{ + if (UNALIGNED_ACCESS_IS_FAST) { + store_u16_unaligned(be16_bswap(v), p); + } else { + p[0] = (u8)(v >> 8); + p[1] = (u8)(v >> 0); + } +} + +static forceinline void +put_unaligned_le32(u32 v, u8 *p) +{ + if (UNALIGNED_ACCESS_IS_FAST) { + store_u32_unaligned(le32_bswap(v), p); + } else { + p[0] = (u8)(v >> 0); + p[1] = (u8)(v >> 8); + p[2] = (u8)(v >> 16); + p[3] = (u8)(v >> 24); + } +} + +static forceinline void +put_unaligned_be32(u32 v, u8 *p) +{ + if (UNALIGNED_ACCESS_IS_FAST) { + store_u32_unaligned(be32_bswap(v), p); + } else { + p[0] = (u8)(v >> 24); + p[1] = (u8)(v >> 16); + p[2] = (u8)(v >> 8); + p[3] = (u8)(v >> 0); + } +} + +static forceinline void +put_unaligned_le64(u64 v, u8 *p) +{ + if (UNALIGNED_ACCESS_IS_FAST) { + store_u64_unaligned(le64_bswap(v), p); + } else { + p[0] = (u8)(v >> 0); + p[1] = (u8)(v >> 8); + p[2] = (u8)(v >> 16); + p[3] = (u8)(v >> 24); + p[4] = (u8)(v >> 32); + p[5] = (u8)(v >> 40); + p[6] = (u8)(v >> 48); + p[7] = (u8)(v >> 56); + } +} + +static forceinline void +put_unaligned_leword(machine_word_t v, u8 *p) +{ + STATIC_ASSERT(WORDBITS == 32 || WORDBITS == 64); + if (WORDBITS == 32) + put_unaligned_le32(v, p); + else + put_unaligned_le64(v, p); +} + +/* ========================================================================== */ +/* Bit manipulation functions */ +/* ========================================================================== */ + +/* + * Bit Scan Reverse (BSR) - find the 0-based index (relative to the least + * significant end) of the *most* significant 1 bit in the input value. The + * input value must be nonzero! + */ + +static forceinline unsigned +bsr32(u32 v) +{ +#if defined(__GNUC__) || __has_builtin(__builtin_clz) + return 31 - __builtin_clz(v); +#elif defined(_MSC_VER) + unsigned long i; + + _BitScanReverse(&i, v); + return i; +#else + unsigned i = 0; + + while ((v >>= 1) != 0) + i++; + return i; +#endif +} + +static forceinline unsigned +bsr64(u64 v) +{ +#if defined(__GNUC__) || __has_builtin(__builtin_clzll) + return 63 - __builtin_clzll(v); +#elif defined(_MSC_VER) && defined(_WIN64) + unsigned long i; + + _BitScanReverse64(&i, v); + return i; +#else + unsigned i = 0; + + while ((v >>= 1) != 0) + i++; + return i; +#endif +} + +static forceinline unsigned +bsrw(machine_word_t v) +{ + STATIC_ASSERT(WORDBITS == 32 || WORDBITS == 64); + if (WORDBITS == 32) + return bsr32(v); + else + return bsr64(v); +} + +/* + * Bit Scan Forward (BSF) - find the 0-based index (relative to the least + * significant end) of the *least* significant 1 bit in the input value. The + * input value must be nonzero! + */ + +static forceinline unsigned +bsf32(u32 v) +{ +#if defined(__GNUC__) || __has_builtin(__builtin_ctz) + return __builtin_ctz(v); +#elif defined(_MSC_VER) + unsigned long i; + + _BitScanForward(&i, v); + return i; +#else + unsigned i = 0; + + for (; (v & 1) == 0; v >>= 1) + i++; + return i; +#endif +} + +static forceinline unsigned +bsf64(u64 v) +{ +#if defined(__GNUC__) || __has_builtin(__builtin_ctzll) + return __builtin_ctzll(v); +#elif defined(_MSC_VER) && defined(_WIN64) + unsigned long i; + + _BitScanForward64(&i, v); + return i; +#else + unsigned i = 0; + + for (; (v & 1) == 0; v >>= 1) + i++; + return i; +#endif +} + +static forceinline unsigned +bsfw(machine_word_t v) +{ + STATIC_ASSERT(WORDBITS == 32 || WORDBITS == 64); + if (WORDBITS == 32) + return bsf32(v); + else + return bsf64(v); +} + +/* + * rbit32(v): reverse the bits in a 32-bit integer. This doesn't have a + * fallback implementation; use '#ifdef rbit32' to check if this is available. + */ +#undef rbit32 +#if (defined(__GNUC__) || defined(__clang__)) && defined(ARCH_ARM32) && \ + (__ARM_ARCH >= 7 || (__ARM_ARCH == 6 && defined(__ARM_ARCH_6T2__))) +static forceinline u32 +rbit32(u32 v) +{ + __asm__("rbit %0, %1" : "=r" (v) : "r" (v)); + return v; +} +#define rbit32 rbit32 +#elif (defined(__GNUC__) || defined(__clang__)) && defined(ARCH_ARM64) +static forceinline u32 +rbit32(u32 v) +{ + __asm__("rbit %w0, %w1" : "=r" (v) : "r" (v)); + return v; +} +#define rbit32 rbit32 +#endif + +#endif /* COMMON_DEFS_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/adler32.c b/tools/z64compress/src/enc/libdeflate/lib/adler32.c new file mode 100644 index 000000000..b743c6943 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/adler32.c @@ -0,0 +1,131 @@ +/* + * adler32.c - Adler-32 checksum algorithm + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "lib_common.h" +#include "libdeflate.h" + +/* The Adler-32 divisor, or "base", value */ +#define DIVISOR 65521 + +/* + * MAX_CHUNK_LEN is the most bytes that can be processed without the possibility + * of s2 overflowing when it is represented as an unsigned 32-bit integer. This + * value was computed using the following Python script: + * + * divisor = 65521 + * count = 0 + * s1 = divisor - 1 + * s2 = divisor - 1 + * while True: + * s1 += 0xFF + * s2 += s1 + * if s2 > 0xFFFFFFFF: + * break + * count += 1 + * print(count) + * + * Note that to get the correct worst-case value, we must assume that every byte + * has value 0xFF and that s1 and s2 started with the highest possible values + * modulo the divisor. + */ +#define MAX_CHUNK_LEN 5552 + +static u32 MAYBE_UNUSED +adler32_generic(u32 adler, const u8 *p, size_t len) +{ + u32 s1 = adler & 0xFFFF; + u32 s2 = adler >> 16; + const u8 * const end = p + len; + + while (p != end) { + size_t chunk_len = MIN(end - p, MAX_CHUNK_LEN); + const u8 *chunk_end = p + chunk_len; + size_t num_unrolled_iterations = chunk_len / 4; + + while (num_unrolled_iterations--) { + s1 += *p++; + s2 += s1; + s1 += *p++; + s2 += s1; + s1 += *p++; + s2 += s1; + s1 += *p++; + s2 += s1; + } + while (p != chunk_end) { + s1 += *p++; + s2 += s1; + } + s1 %= DIVISOR; + s2 %= DIVISOR; + } + + return (s2 << 16) | s1; +} + +/* Include architecture-specific implementation(s) if available. */ +#undef DEFAULT_IMPL +#undef arch_select_adler32_func +typedef u32 (*adler32_func_t)(u32 adler, const u8 *p, size_t len); +#if defined(ARCH_ARM32) || defined(ARCH_ARM64) +# include "arm/adler32_impl.h" +#elif defined(ARCH_X86_32) || defined(ARCH_X86_64) +# include "x86/adler32_impl.h" +#endif + +#ifndef DEFAULT_IMPL +# define DEFAULT_IMPL adler32_generic +#endif + +#ifdef arch_select_adler32_func +static u32 dispatch_adler32(u32 adler, const u8 *p, size_t len); + +static volatile adler32_func_t adler32_impl = dispatch_adler32; + +/* Choose the best implementation at runtime. */ +static u32 dispatch_adler32(u32 adler, const u8 *p, size_t len) +{ + adler32_func_t f = arch_select_adler32_func(); + + if (f == NULL) + f = DEFAULT_IMPL; + + adler32_impl = f; + return f(adler, p, len); +} +#else +/* The best implementation is statically known, so call it directly. */ +#define adler32_impl DEFAULT_IMPL +#endif + +LIBDEFLATEAPI u32 +libdeflate_adler32(u32 adler, const void *buffer, size_t len) +{ + if (buffer == NULL) /* Return initial value. */ + return 1; + return adler32_impl(adler, buffer, len); +} diff --git a/tools/z64compress/src/enc/libdeflate/lib/adler32_vec_template.h b/tools/z64compress/src/enc/libdeflate/lib/adler32_vec_template.h new file mode 100644 index 000000000..98c086bbc --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/adler32_vec_template.h @@ -0,0 +1,123 @@ +/* + * adler32_vec_template.h - template for vectorized Adler-32 implementations + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file contains a template for vectorized Adler-32 implementations. + * + * The inner loop between reductions modulo 65521 of an unvectorized Adler-32 + * implementation looks something like this: + * + * do { + * s1 += *p; + * s2 += s1; + * } while (++p != chunk_end); + * + * For vectorized calculation of s1, we only need to sum the input bytes. They + * can be accumulated into multiple counters which are eventually summed + * together. + * + * For vectorized calculation of s2, the basic idea is that for each iteration + * that processes N bytes, we can perform the following vectorizable + * calculation: + * + * s2 += N*byte_1 + (N-1)*byte_2 + (N-2)*byte_3 + ... + 1*byte_N + * + * Or, equivalently, we can sum the byte_1...byte_N for each iteration into N + * separate counters, then do the multiplications by N...1 just once at the end + * rather than once per iteration. + * + * Also, we must account for how previous bytes will affect s2 by doing the + * following at beginning of each iteration: + * + * s2 += s1 * N + * + * Furthermore, like s1, "s2" can actually be multiple counters which are + * eventually summed together. + */ + +static u32 ATTRIBUTES MAYBE_UNUSED +FUNCNAME(u32 adler, const u8 *p, size_t len) +{ + const size_t max_chunk_len = + MIN(MAX_CHUNK_LEN, IMPL_MAX_CHUNK_LEN) - + (MIN(MAX_CHUNK_LEN, IMPL_MAX_CHUNK_LEN) % IMPL_SEGMENT_LEN); + u32 s1 = adler & 0xFFFF; + u32 s2 = adler >> 16; + const u8 * const end = p + len; + const u8 *vend; + + /* Process a byte at a time until the needed alignment is reached. */ + if (p != end && (uintptr_t)p % IMPL_ALIGNMENT) { + do { + s1 += *p++; + s2 += s1; + } while (p != end && (uintptr_t)p % IMPL_ALIGNMENT); + s1 %= DIVISOR; + s2 %= DIVISOR; + } + + /* + * Process "chunks" of bytes using vector instructions. Chunk lengths + * are limited to MAX_CHUNK_LEN, which guarantees that s1 and s2 never + * overflow before being reduced modulo DIVISOR. For vector processing, + * chunk lengths are also made evenly divisible by IMPL_SEGMENT_LEN and + * may be further limited to IMPL_MAX_CHUNK_LEN. + */ + STATIC_ASSERT(IMPL_SEGMENT_LEN % IMPL_ALIGNMENT == 0); + vend = end - ((size_t)(end - p) % IMPL_SEGMENT_LEN); + while (p != vend) { + size_t chunk_len = MIN((size_t)(vend - p), max_chunk_len); + + s2 += s1 * chunk_len; + + FUNCNAME_CHUNK((const void *)p, (const void *)(p + chunk_len), + &s1, &s2); + + p += chunk_len; + s1 %= DIVISOR; + s2 %= DIVISOR; + } + + /* Process any remaining bytes. */ + if (p != end) { + do { + s1 += *p++; + s2 += s1; + } while (p != end); + s1 %= DIVISOR; + s2 %= DIVISOR; + } + + return (s2 << 16) | s1; +} + +#undef FUNCNAME +#undef FUNCNAME_CHUNK +#undef ATTRIBUTES +#undef IMPL_ALIGNMENT +#undef IMPL_SEGMENT_LEN +#undef IMPL_MAX_CHUNK_LEN diff --git a/tools/z64compress/src/enc/libdeflate/lib/arm/adler32_impl.h b/tools/z64compress/src/enc/libdeflate/lib/arm/adler32_impl.h new file mode 100644 index 000000000..4083b2ef3 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/arm/adler32_impl.h @@ -0,0 +1,272 @@ +/* + * arm/adler32_impl.h - ARM implementations of Adler-32 checksum algorithm + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LIB_ARM_ADLER32_IMPL_H +#define LIB_ARM_ADLER32_IMPL_H + +#include "cpu_features.h" + +/* Regular NEON implementation */ +#if HAVE_NEON_INTRIN && CPU_IS_LITTLE_ENDIAN() +# define adler32_neon adler32_neon +# define FUNCNAME adler32_neon +# define FUNCNAME_CHUNK adler32_neon_chunk +# define IMPL_ALIGNMENT 16 +# define IMPL_SEGMENT_LEN 64 +/* Prevent unsigned overflow of the 16-bit precision byte counters */ +# define IMPL_MAX_CHUNK_LEN (64 * (0xFFFF / 0xFF)) +# if HAVE_NEON_NATIVE +# define ATTRIBUTES +# else +# ifdef ARCH_ARM32 +# define ATTRIBUTES _target_attribute("fpu=neon") +# else +# define ATTRIBUTES _target_attribute("+simd") +# endif +# endif +# include +static forceinline ATTRIBUTES void +adler32_neon_chunk(const uint8x16_t *p, const uint8x16_t * const end, + u32 *s1, u32 *s2) +{ + static const u16 _aligned_attribute(16) mults[64] = { + 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, + 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, + 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, + 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, + }; + const uint16x8_t mults_a = vld1q_u16(&mults[0]); + const uint16x8_t mults_b = vld1q_u16(&mults[8]); + const uint16x8_t mults_c = vld1q_u16(&mults[16]); + const uint16x8_t mults_d = vld1q_u16(&mults[24]); + const uint16x8_t mults_e = vld1q_u16(&mults[32]); + const uint16x8_t mults_f = vld1q_u16(&mults[40]); + const uint16x8_t mults_g = vld1q_u16(&mults[48]); + const uint16x8_t mults_h = vld1q_u16(&mults[56]); + + uint32x4_t v_s1 = vdupq_n_u32(0); + uint32x4_t v_s2 = vdupq_n_u32(0); + /* + * v_byte_sums_* contain the sum of the bytes at index i across all + * 64-byte segments, for each index 0..63. + */ + uint16x8_t v_byte_sums_a = vdupq_n_u16(0); + uint16x8_t v_byte_sums_b = vdupq_n_u16(0); + uint16x8_t v_byte_sums_c = vdupq_n_u16(0); + uint16x8_t v_byte_sums_d = vdupq_n_u16(0); + uint16x8_t v_byte_sums_e = vdupq_n_u16(0); + uint16x8_t v_byte_sums_f = vdupq_n_u16(0); + uint16x8_t v_byte_sums_g = vdupq_n_u16(0); + uint16x8_t v_byte_sums_h = vdupq_n_u16(0); + + do { + /* Load the next 64 bytes. */ + const uint8x16_t bytes1 = *p++; + const uint8x16_t bytes2 = *p++; + const uint8x16_t bytes3 = *p++; + const uint8x16_t bytes4 = *p++; + uint16x8_t tmp; + + /* + * Accumulate the previous s1 counters into the s2 counters. + * The needed multiplication by 64 is delayed to later. + */ + v_s2 = vaddq_u32(v_s2, v_s1); + + /* + * Add the 64 bytes to their corresponding v_byte_sums counters, + * while also accumulating the sums of each adjacent set of 4 + * bytes into v_s1. + */ + tmp = vpaddlq_u8(bytes1); + v_byte_sums_a = vaddw_u8(v_byte_sums_a, vget_low_u8(bytes1)); + v_byte_sums_b = vaddw_u8(v_byte_sums_b, vget_high_u8(bytes1)); + tmp = vpadalq_u8(tmp, bytes2); + v_byte_sums_c = vaddw_u8(v_byte_sums_c, vget_low_u8(bytes2)); + v_byte_sums_d = vaddw_u8(v_byte_sums_d, vget_high_u8(bytes2)); + tmp = vpadalq_u8(tmp, bytes3); + v_byte_sums_e = vaddw_u8(v_byte_sums_e, vget_low_u8(bytes3)); + v_byte_sums_f = vaddw_u8(v_byte_sums_f, vget_high_u8(bytes3)); + tmp = vpadalq_u8(tmp, bytes4); + v_byte_sums_g = vaddw_u8(v_byte_sums_g, vget_low_u8(bytes4)); + v_byte_sums_h = vaddw_u8(v_byte_sums_h, vget_high_u8(bytes4)); + v_s1 = vpadalq_u16(v_s1, tmp); + + } while (p != end); + + /* s2 = 64*s2 + (64*bytesum0 + 63*bytesum1 + ... + 1*bytesum63) */ +#ifdef ARCH_ARM32 +# define umlal2(a, b, c) vmlal_u16((a), vget_high_u16(b), vget_high_u16(c)) +#else +# define umlal2 vmlal_high_u16 +#endif + v_s2 = vqshlq_n_u32(v_s2, 6); + v_s2 = vmlal_u16(v_s2, vget_low_u16(v_byte_sums_a), vget_low_u16(mults_a)); + v_s2 = umlal2(v_s2, v_byte_sums_a, mults_a); + v_s2 = vmlal_u16(v_s2, vget_low_u16(v_byte_sums_b), vget_low_u16(mults_b)); + v_s2 = umlal2(v_s2, v_byte_sums_b, mults_b); + v_s2 = vmlal_u16(v_s2, vget_low_u16(v_byte_sums_c), vget_low_u16(mults_c)); + v_s2 = umlal2(v_s2, v_byte_sums_c, mults_c); + v_s2 = vmlal_u16(v_s2, vget_low_u16(v_byte_sums_d), vget_low_u16(mults_d)); + v_s2 = umlal2(v_s2, v_byte_sums_d, mults_d); + v_s2 = vmlal_u16(v_s2, vget_low_u16(v_byte_sums_e), vget_low_u16(mults_e)); + v_s2 = umlal2(v_s2, v_byte_sums_e, mults_e); + v_s2 = vmlal_u16(v_s2, vget_low_u16(v_byte_sums_f), vget_low_u16(mults_f)); + v_s2 = umlal2(v_s2, v_byte_sums_f, mults_f); + v_s2 = vmlal_u16(v_s2, vget_low_u16(v_byte_sums_g), vget_low_u16(mults_g)); + v_s2 = umlal2(v_s2, v_byte_sums_g, mults_g); + v_s2 = vmlal_u16(v_s2, vget_low_u16(v_byte_sums_h), vget_low_u16(mults_h)); + v_s2 = umlal2(v_s2, v_byte_sums_h, mults_h); +#undef umlal2 + + /* Horizontal sum to finish up */ +#ifdef ARCH_ARM32 + *s1 += vgetq_lane_u32(v_s1, 0) + vgetq_lane_u32(v_s1, 1) + + vgetq_lane_u32(v_s1, 2) + vgetq_lane_u32(v_s1, 3); + *s2 += vgetq_lane_u32(v_s2, 0) + vgetq_lane_u32(v_s2, 1) + + vgetq_lane_u32(v_s2, 2) + vgetq_lane_u32(v_s2, 3); +#else + *s1 += vaddvq_u32(v_s1); + *s2 += vaddvq_u32(v_s2); +#endif +} +# include "../adler32_vec_template.h" +#endif /* Regular NEON implementation */ + +/* NEON+dotprod implementation */ +#if HAVE_DOTPROD_INTRIN && CPU_IS_LITTLE_ENDIAN() +# define adler32_neon_dotprod adler32_neon_dotprod +# define FUNCNAME adler32_neon_dotprod +# define FUNCNAME_CHUNK adler32_neon_dotprod_chunk +# define IMPL_ALIGNMENT 16 +# define IMPL_SEGMENT_LEN 64 +# define IMPL_MAX_CHUNK_LEN MAX_CHUNK_LEN +# if HAVE_DOTPROD_NATIVE +# define ATTRIBUTES +# else +# ifdef __clang__ +# define ATTRIBUTES _target_attribute("dotprod") + /* + * With gcc, arch=armv8.2-a is needed for dotprod intrinsics, unless the + * default target is armv8.3-a or later in which case it must be omitted. + * armv8.3-a or later can be detected by checking for __ARM_FEATURE_JCVT. + */ +# elif defined(__ARM_FEATURE_JCVT) +# define ATTRIBUTES _target_attribute("+dotprod") +# else +# define ATTRIBUTES _target_attribute("arch=armv8.2-a+dotprod") +# endif +# endif +# include +static forceinline ATTRIBUTES void +adler32_neon_dotprod_chunk(const uint8x16_t *p, const uint8x16_t * const end, + u32 *s1, u32 *s2) +{ + static const u8 _aligned_attribute(16) mults[64] = { + 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, + 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, + 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, + 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, + }; + const uint8x16_t mults_a = vld1q_u8(&mults[0]); + const uint8x16_t mults_b = vld1q_u8(&mults[16]); + const uint8x16_t mults_c = vld1q_u8(&mults[32]); + const uint8x16_t mults_d = vld1q_u8(&mults[48]); + const uint8x16_t ones = vdupq_n_u8(1); + uint32x4_t v_s1_a = vdupq_n_u32(0); + uint32x4_t v_s1_b = vdupq_n_u32(0); + uint32x4_t v_s1_c = vdupq_n_u32(0); + uint32x4_t v_s1_d = vdupq_n_u32(0); + uint32x4_t v_s2_a = vdupq_n_u32(0); + uint32x4_t v_s2_b = vdupq_n_u32(0); + uint32x4_t v_s2_c = vdupq_n_u32(0); + uint32x4_t v_s2_d = vdupq_n_u32(0); + uint32x4_t v_s1_sums_a = vdupq_n_u32(0); + uint32x4_t v_s1_sums_b = vdupq_n_u32(0); + uint32x4_t v_s1_sums_c = vdupq_n_u32(0); + uint32x4_t v_s1_sums_d = vdupq_n_u32(0); + uint32x4_t v_s1; + uint32x4_t v_s2; + uint32x4_t v_s1_sums; + + do { + uint8x16_t bytes_a = *p++; + uint8x16_t bytes_b = *p++; + uint8x16_t bytes_c = *p++; + uint8x16_t bytes_d = *p++; + + v_s1_sums_a = vaddq_u32(v_s1_sums_a, v_s1_a); + v_s1_a = vdotq_u32(v_s1_a, bytes_a, ones); + v_s2_a = vdotq_u32(v_s2_a, bytes_a, mults_a); + + v_s1_sums_b = vaddq_u32(v_s1_sums_b, v_s1_b); + v_s1_b = vdotq_u32(v_s1_b, bytes_b, ones); + v_s2_b = vdotq_u32(v_s2_b, bytes_b, mults_b); + + v_s1_sums_c = vaddq_u32(v_s1_sums_c, v_s1_c); + v_s1_c = vdotq_u32(v_s1_c, bytes_c, ones); + v_s2_c = vdotq_u32(v_s2_c, bytes_c, mults_c); + + v_s1_sums_d = vaddq_u32(v_s1_sums_d, v_s1_d); + v_s1_d = vdotq_u32(v_s1_d, bytes_d, ones); + v_s2_d = vdotq_u32(v_s2_d, bytes_d, mults_d); + } while (p != end); + + v_s1 = vaddq_u32(vaddq_u32(v_s1_a, v_s1_b), vaddq_u32(v_s1_c, v_s1_d)); + v_s2 = vaddq_u32(vaddq_u32(v_s2_a, v_s2_b), vaddq_u32(v_s2_c, v_s2_d)); + v_s1_sums = vaddq_u32(vaddq_u32(v_s1_sums_a, v_s1_sums_b), + vaddq_u32(v_s1_sums_c, v_s1_sums_d)); + v_s2 = vaddq_u32(v_s2, vqshlq_n_u32(v_s1_sums, 6)); + + *s1 += vaddvq_u32(v_s1); + *s2 += vaddvq_u32(v_s2); +} +# include "../adler32_vec_template.h" +#endif /* NEON+dotprod implementation */ + +#if defined(adler32_neon_dotprod) && HAVE_DOTPROD_NATIVE +#define DEFAULT_IMPL adler32_neon_dotprod +#else +static inline adler32_func_t +arch_select_adler32_func(void) +{ + const u32 features MAYBE_UNUSED = get_arm_cpu_features(); + +#ifdef adler32_neon_dotprod + if (HAVE_NEON(features) && HAVE_DOTPROD(features)) + return adler32_neon_dotprod; +#endif +#ifdef adler32_neon + if (HAVE_NEON(features)) + return adler32_neon; +#endif + return NULL; +} +#define arch_select_adler32_func arch_select_adler32_func +#endif + +#endif /* LIB_ARM_ADLER32_IMPL_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/arm/cpu_features.c b/tools/z64compress/src/enc/libdeflate/lib/arm/cpu_features.c new file mode 100644 index 000000000..ed710bc6f --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/arm/cpu_features.c @@ -0,0 +1,211 @@ +/* + * arm/cpu_features.c - feature detection for ARM CPUs + * + * Copyright 2018 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * ARM CPUs don't have a standard way for unprivileged programs to detect CPU + * features. But an OS-specific way can be used when available. + */ + +#ifdef __APPLE__ +#undef _ANSI_SOURCE +#define _DARWIN_C_SOURCE /* for sysctlbyname() */ +#endif + +#include "../cpu_features_common.h" /* must be included first */ +#include "cpu_features.h" + +#if HAVE_DYNAMIC_ARM_CPU_FEATURES + +#ifdef __linux__ +/* + * On Linux, arm32 and arm64 CPU features can be detected by reading the + * AT_HWCAP and AT_HWCAP2 values from /proc/self/auxv. + * + * Ideally we'd use the C library function getauxval(), but it's not guaranteed + * to be available: it was only added to glibc in 2.16, and in Android it was + * added to API level 18 for arm32 and level 21 for arm64. + */ + +#include +#include +#include +#include + +#define AT_HWCAP 16 +#define AT_HWCAP2 26 + +static void scan_auxv(unsigned long *hwcap, unsigned long *hwcap2) +{ + int fd; + unsigned long auxbuf[32]; + int filled = 0; + int i; + + fd = open("/proc/self/auxv", O_RDONLY); + if (fd < 0) + return; + + for (;;) { + do { + int ret = read(fd, &((char *)auxbuf)[filled], + sizeof(auxbuf) - filled); + if (ret <= 0) { + if (ret < 0 && errno == EINTR) + continue; + goto out; + } + filled += ret; + } while (filled < 2 * sizeof(long)); + + i = 0; + do { + unsigned long type = auxbuf[i]; + unsigned long value = auxbuf[i + 1]; + + if (type == AT_HWCAP) + *hwcap = value; + else if (type == AT_HWCAP2) + *hwcap2 = value; + i += 2; + filled -= 2 * sizeof(long); + } while (filled >= 2 * sizeof(long)); + + memmove(auxbuf, &auxbuf[i], filled); + } +out: + close(fd); +} + +static u32 query_arm_cpu_features(void) +{ + u32 features = 0; + unsigned long hwcap = 0; + unsigned long hwcap2 = 0; + + scan_auxv(&hwcap, &hwcap2); + +#ifdef ARCH_ARM32 + STATIC_ASSERT(sizeof(long) == 4); + if (hwcap & (1 << 12)) /* HWCAP_NEON */ + features |= ARM_CPU_FEATURE_NEON; + if (hwcap2 & (1 << 1)) /* HWCAP2_PMULL */ + features |= ARM_CPU_FEATURE_PMULL; + if (hwcap2 & (1 << 4)) /* HWCAP2_CRC32 */ + features |= ARM_CPU_FEATURE_CRC32; +#else + STATIC_ASSERT(sizeof(long) == 8); + if (hwcap & (1 << 1)) /* HWCAP_ASIMD */ + features |= ARM_CPU_FEATURE_NEON; + if (hwcap & (1 << 4)) /* HWCAP_PMULL */ + features |= ARM_CPU_FEATURE_PMULL; + if (hwcap & (1 << 7)) /* HWCAP_CRC32 */ + features |= ARM_CPU_FEATURE_CRC32; + if (hwcap & (1 << 17)) /* HWCAP_SHA3 */ + features |= ARM_CPU_FEATURE_SHA3; + if (hwcap & (1 << 20)) /* HWCAP_ASIMDDP */ + features |= ARM_CPU_FEATURE_DOTPROD; +#endif + return features; +} + +#elif defined(__APPLE__) +/* On Apple platforms, arm64 CPU features can be detected via sysctlbyname(). */ + +#include +#include + +static const struct { + const char *name; + u32 feature; +} feature_sysctls[] = { + { "hw.optional.neon", ARM_CPU_FEATURE_NEON }, + { "hw.optional.AdvSIMD", ARM_CPU_FEATURE_NEON }, + { "hw.optional.arm.FEAT_PMULL", ARM_CPU_FEATURE_PMULL }, + { "hw.optional.armv8_crc32", ARM_CPU_FEATURE_CRC32 }, + { "hw.optional.armv8_2_sha3", ARM_CPU_FEATURE_SHA3 }, + { "hw.optional.arm.FEAT_SHA3", ARM_CPU_FEATURE_SHA3 }, + { "hw.optional.arm.FEAT_DotProd", ARM_CPU_FEATURE_DOTPROD }, +}; + +static u32 query_arm_cpu_features(void) +{ + u32 features = 0; + size_t i; + + for (i = 0; i < ARRAY_LEN(feature_sysctls); i++) { + const char *name = feature_sysctls[i].name; + u32 val = 0; + size_t valsize = sizeof(val); + + if (sysctlbyname(name, &val, &valsize, NULL, 0) == 0 && + valsize == sizeof(val) && val == 1) + features |= feature_sysctls[i].feature; + } + return features; +} +#elif defined(_WIN32) + +#include + +static u32 query_arm_cpu_features(void) +{ + u32 features = ARM_CPU_FEATURE_NEON; + + if (IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE)) + features |= ARM_CPU_FEATURE_PMULL; + if (IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE)) + features |= ARM_CPU_FEATURE_CRC32; + + /* FIXME: detect SHA3 and DOTPROD support too. */ + + return features; +} +#else +#error "unhandled case" +#endif + +static const struct cpu_feature arm_cpu_feature_table[] = { + {ARM_CPU_FEATURE_NEON, "neon"}, + {ARM_CPU_FEATURE_PMULL, "pmull"}, + {ARM_CPU_FEATURE_CRC32, "crc32"}, + {ARM_CPU_FEATURE_SHA3, "sha3"}, + {ARM_CPU_FEATURE_DOTPROD, "dotprod"}, +}; + +volatile u32 libdeflate_arm_cpu_features = 0; + +void libdeflate_init_arm_cpu_features(void) +{ + u32 features = query_arm_cpu_features(); + + disable_cpu_features_for_testing(&features, arm_cpu_feature_table, + ARRAY_LEN(arm_cpu_feature_table)); + + libdeflate_arm_cpu_features = features | ARM_CPU_FEATURES_KNOWN; +} + +#endif /* HAVE_DYNAMIC_ARM_CPU_FEATURES */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/arm/cpu_features.h b/tools/z64compress/src/enc/libdeflate/lib/arm/cpu_features.h new file mode 100644 index 000000000..548d31ea8 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/arm/cpu_features.h @@ -0,0 +1,223 @@ +/* + * arm/cpu_features.h - feature detection for ARM CPUs + * + * Copyright 2018 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LIB_ARM_CPU_FEATURES_H +#define LIB_ARM_CPU_FEATURES_H + +#include "../lib_common.h" + +#define HAVE_DYNAMIC_ARM_CPU_FEATURES 0 + +#if defined(ARCH_ARM32) || defined(ARCH_ARM64) + +#if !defined(FREESTANDING) && \ + (COMPILER_SUPPORTS_TARGET_FUNCTION_ATTRIBUTE || defined(_MSC_VER)) && \ + (defined(__linux__) || \ + (defined(__APPLE__) && defined(ARCH_ARM64)) || \ + (defined(_WIN32) && defined(ARCH_ARM64))) +# undef HAVE_DYNAMIC_ARM_CPU_FEATURES +# define HAVE_DYNAMIC_ARM_CPU_FEATURES 1 +#endif + +#define ARM_CPU_FEATURE_NEON 0x00000001 +#define ARM_CPU_FEATURE_PMULL 0x00000002 +#define ARM_CPU_FEATURE_CRC32 0x00000004 +#define ARM_CPU_FEATURE_SHA3 0x00000008 +#define ARM_CPU_FEATURE_DOTPROD 0x00000010 + +#define HAVE_NEON(features) (HAVE_NEON_NATIVE || ((features) & ARM_CPU_FEATURE_NEON)) +#define HAVE_PMULL(features) (HAVE_PMULL_NATIVE || ((features) & ARM_CPU_FEATURE_PMULL)) +#define HAVE_CRC32(features) (HAVE_CRC32_NATIVE || ((features) & ARM_CPU_FEATURE_CRC32)) +#define HAVE_SHA3(features) (HAVE_SHA3_NATIVE || ((features) & ARM_CPU_FEATURE_SHA3)) +#define HAVE_DOTPROD(features) (HAVE_DOTPROD_NATIVE || ((features) & ARM_CPU_FEATURE_DOTPROD)) + +#if HAVE_DYNAMIC_ARM_CPU_FEATURES +#define ARM_CPU_FEATURES_KNOWN 0x80000000 +extern volatile u32 libdeflate_arm_cpu_features; + +void libdeflate_init_arm_cpu_features(void); + +static inline u32 get_arm_cpu_features(void) +{ + if (libdeflate_arm_cpu_features == 0) + libdeflate_init_arm_cpu_features(); + return libdeflate_arm_cpu_features; +} +#else /* HAVE_DYNAMIC_ARM_CPU_FEATURES */ +static inline u32 get_arm_cpu_features(void) { return 0; } +#endif /* !HAVE_DYNAMIC_ARM_CPU_FEATURES */ + +/* NEON */ +#if defined(__ARM_NEON) || defined(ARCH_ARM64) +# define HAVE_NEON_NATIVE 1 +#else +# define HAVE_NEON_NATIVE 0 +#endif +/* + * With both gcc and clang, NEON intrinsics require that the main target has + * NEON enabled already. Exception: with gcc 6.1 and later (r230411 for arm32, + * r226563 for arm64), hardware floating point support is sufficient. + */ +#if HAVE_NEON_NATIVE || \ + (HAVE_DYNAMIC_ARM_CPU_FEATURES && GCC_PREREQ(6, 1) && defined(__ARM_FP)) +# define HAVE_NEON_INTRIN 1 +#else +# define HAVE_NEON_INTRIN 0 +#endif + +/* PMULL */ +#ifdef __ARM_FEATURE_CRYPTO +# define HAVE_PMULL_NATIVE 1 +#else +# define HAVE_PMULL_NATIVE 0 +#endif +#if HAVE_PMULL_NATIVE || \ + (HAVE_DYNAMIC_ARM_CPU_FEATURES && \ + (GCC_PREREQ(6, 1) || __has_builtin(__builtin_neon_vmull_p64) || \ + defined(_MSC_VER)) && \ + /* + * On arm32 with clang, the crypto intrinsics (which include pmull) + * are not defined, even when using -mfpu=crypto-neon-fp-armv8, + * because clang's puts their definitions behind + * __aarch64__. + */ \ + !(defined(ARCH_ARM32) && defined(__clang__))) +# define HAVE_PMULL_INTRIN CPU_IS_LITTLE_ENDIAN() /* untested on big endian */ + /* Work around MSVC's vmull_p64() taking poly64x1_t instead of poly64_t */ +# ifdef _MSC_VER +# define compat_vmull_p64(a, b) vmull_p64(vcreate_p64(a), vcreate_p64(b)) +# else +# define compat_vmull_p64(a, b) vmull_p64((a), (b)) +# endif +#else +# define HAVE_PMULL_INTRIN 0 +#endif + +/* CRC32 */ +#ifdef __ARM_FEATURE_CRC32 +# define HAVE_CRC32_NATIVE 1 +#else +# define HAVE_CRC32_NATIVE 0 +#endif +/* + * Support for ARM CRC32 intrinsics when CRC32 instructions are not enabled in + * the main target has been affected by two gcc bugs, which we must avoid by + * only allowing gcc versions that have the corresponding fixes. First, gcc + * commit 943766d37ae4 ("[arm] Fix use of CRC32 intrinsics with Armv8-a and + * hard-float"), i.e. gcc 8.4+, 9.3+, 10.1+, or 11+, is needed. Second, gcc + * commit c1cdabe3aab8 ("arm: reorder assembler architecture directives + * [PR101723]"), i.e. gcc 9.5+, 10.4+, 11.3+, or 12+, is needed when binutils is + * 2.34 or later, due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104439. + * We use the second set of prerequisites, as they are stricter and we have no + * way to detect the binutils version directly from a C source file. + */ +#if HAVE_CRC32_NATIVE || \ + (HAVE_DYNAMIC_ARM_CPU_FEATURES && \ + (__has_builtin(__builtin_arm_crc32b) || \ + GCC_PREREQ(11, 3) || \ + (GCC_PREREQ(10, 4) && !GCC_PREREQ(11, 0)) || \ + (GCC_PREREQ(9, 5) && !GCC_PREREQ(10, 0)) || \ + defined(_MSC_VER))) +# define HAVE_CRC32_INTRIN 1 +#else +# define HAVE_CRC32_INTRIN 0 +#endif + +/* SHA3 (needed for the eor3 instruction) */ +#if defined(ARCH_ARM64) && !defined(_MSC_VER) +# ifdef __ARM_FEATURE_SHA3 +# define HAVE_SHA3_NATIVE 1 +# else +# define HAVE_SHA3_NATIVE 0 +# endif +# define HAVE_SHA3_TARGET (HAVE_DYNAMIC_ARM_CPU_FEATURES && \ + (GCC_PREREQ(8, 1) /* r256478 */ || \ + CLANG_PREREQ(7, 0, 10010463) /* r338010 */)) +# define HAVE_SHA3_INTRIN (HAVE_NEON_INTRIN && \ + (HAVE_SHA3_NATIVE || HAVE_SHA3_TARGET) && \ + (GCC_PREREQ(9, 1) /* r268049 */ || \ + __has_builtin(__builtin_neon_veor3q_v))) +#else +# define HAVE_SHA3_NATIVE 0 +# define HAVE_SHA3_TARGET 0 +# define HAVE_SHA3_INTRIN 0 +#endif + +/* dotprod */ +#ifdef ARCH_ARM64 +# ifdef __ARM_FEATURE_DOTPROD +# define HAVE_DOTPROD_NATIVE 1 +# else +# define HAVE_DOTPROD_NATIVE 0 +# endif +# if HAVE_DOTPROD_NATIVE || \ + (HAVE_DYNAMIC_ARM_CPU_FEATURES && \ + (GCC_PREREQ(8, 1) || __has_builtin(__builtin_neon_vdotq_v) || \ + defined(_MSC_VER))) +# define HAVE_DOTPROD_INTRIN 1 +# else +# define HAVE_DOTPROD_INTRIN 0 +# endif +#else +# define HAVE_DOTPROD_NATIVE 0 +# define HAVE_DOTPROD_INTRIN 0 +#endif + +/* + * Work around bugs in arm_acle.h and arm_neon.h where sometimes intrinsics are + * only defined when the corresponding __ARM_FEATURE_* macro is defined. The + * intrinsics actually work in target attribute functions too if they are + * defined, though, so work around this by temporarily defining the + * corresponding __ARM_FEATURE_* macros while including the headers. + */ +#if HAVE_CRC32_INTRIN && !HAVE_CRC32_NATIVE && \ + (defined(__clang__) || defined(ARCH_ARM32)) +# define __ARM_FEATURE_CRC32 1 +#endif +#if HAVE_SHA3_INTRIN && !HAVE_SHA3_NATIVE && defined(__clang__) +# define __ARM_FEATURE_SHA3 1 +#endif +#if HAVE_DOTPROD_INTRIN && !HAVE_DOTPROD_NATIVE && defined(__clang__) +# define __ARM_FEATURE_DOTPROD 1 +#endif +#if HAVE_CRC32_INTRIN && !HAVE_CRC32_NATIVE && \ + (defined(__clang__) || defined(ARCH_ARM32)) +# include +# undef __ARM_FEATURE_CRC32 +#endif +#if HAVE_SHA3_INTRIN && !HAVE_SHA3_NATIVE && defined(__clang__) +# include +# undef __ARM_FEATURE_SHA3 +#endif +#if HAVE_DOTPROD_INTRIN && !HAVE_DOTPROD_NATIVE && defined(__clang__) +# include +# undef __ARM_FEATURE_DOTPROD +#endif + +#endif /* ARCH_ARM32 || ARCH_ARM64 */ + +#endif /* LIB_ARM_CPU_FEATURES_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/arm/crc32_impl.h b/tools/z64compress/src/enc/libdeflate/lib/arm/crc32_impl.h new file mode 100644 index 000000000..e426a63d6 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/arm/crc32_impl.h @@ -0,0 +1,665 @@ +/* + * arm/crc32_impl.h - ARM implementations of the gzip CRC-32 algorithm + * + * Copyright 2022 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LIB_ARM_CRC32_IMPL_H +#define LIB_ARM_CRC32_IMPL_H + +#include "cpu_features.h" + +/* + * crc32_arm_crc() - implementation using crc32 instructions (only) + * + * In general this implementation is straightforward. However, naive use of the + * crc32 instructions is serial: one of the two inputs to each crc32 instruction + * is the output of the previous one. To take advantage of CPUs that can + * execute multiple crc32 instructions in parallel, when possible we interleave + * the checksumming of several adjacent chunks, then combine their CRCs. + * + * However, without pmull, combining CRCs is fairly slow. So in this pmull-less + * version, we only use a large chunk length, and thus we only do chunked + * processing if there is a lot of data to checksum. This also means that a + * variable chunk length wouldn't help much, so we just support a fixed length. + */ +#if HAVE_CRC32_INTRIN +# if HAVE_CRC32_NATIVE +# define ATTRIBUTES +# else +# ifdef ARCH_ARM32 +# ifdef __clang__ +# define ATTRIBUTES _target_attribute("armv8-a,crc") +# else +# define ATTRIBUTES _target_attribute("arch=armv8-a+crc") +# endif +# else +# ifdef __clang__ +# define ATTRIBUTES _target_attribute("crc") +# else +# define ATTRIBUTES _target_attribute("+crc") +# endif +# endif +# endif + +#ifndef _MSC_VER +# include +#endif + +/* + * Combine the CRCs for 4 adjacent chunks of length L = CRC32_FIXED_CHUNK_LEN + * bytes each by computing: + * + * [ crc0*x^(3*8*L) + crc1*x^(2*8*L) + crc2*x^(1*8*L) + crc3 ] mod G(x) + * + * This has been optimized in several ways: + * + * - The needed multipliers (x to some power, reduced mod G(x)) were + * precomputed. + * + * - The 3 multiplications are interleaved. + * + * - The reduction mod G(x) is delayed to the end and done using __crc32d. + * Note that the use of __crc32d introduces an extra factor of x^32. To + * cancel that out along with the extra factor of x^1 that gets introduced + * because of how the 63-bit products are aligned in their 64-bit integers, + * the multipliers are actually x^(j*8*L - 33) instead of x^(j*8*L). + */ +static forceinline ATTRIBUTES u32 +combine_crcs_slow(u32 crc0, u32 crc1, u32 crc2, u32 crc3) +{ + u64 res0 = 0, res1 = 0, res2 = 0; + int i; + + /* Multiply crc{0,1,2} by CRC32_FIXED_CHUNK_MULT_{3,2,1}. */ + for (i = 0; i < 32; i++) { + if (CRC32_FIXED_CHUNK_MULT_3 & (1U << i)) + res0 ^= (u64)crc0 << i; + if (CRC32_FIXED_CHUNK_MULT_2 & (1U << i)) + res1 ^= (u64)crc1 << i; + if (CRC32_FIXED_CHUNK_MULT_1 & (1U << i)) + res2 ^= (u64)crc2 << i; + } + /* Add the different parts and reduce mod G(x). */ + return __crc32d(0, res0 ^ res1 ^ res2) ^ crc3; +} + +#define crc32_arm_crc crc32_arm_crc +static u32 ATTRIBUTES MAYBE_UNUSED +crc32_arm_crc(u32 crc, const u8 *p, size_t len) +{ + if (len >= 64) { + const size_t align = -(uintptr_t)p & 7; + + /* Align p to the next 8-byte boundary. */ + if (align) { + if (align & 1) + crc = __crc32b(crc, *p++); + if (align & 2) { + crc = __crc32h(crc, le16_bswap(*(u16 *)p)); + p += 2; + } + if (align & 4) { + crc = __crc32w(crc, le32_bswap(*(u32 *)p)); + p += 4; + } + len -= align; + } + /* + * Interleave the processing of multiple adjacent data chunks to + * take advantage of instruction-level parallelism. + * + * Some CPUs don't prefetch the data if it's being fetched in + * multiple interleaved streams, so do explicit prefetching. + */ + while (len >= CRC32_NUM_CHUNKS * CRC32_FIXED_CHUNK_LEN) { + const u64 *wp0 = (const u64 *)p; + const u64 * const wp0_end = + (const u64 *)(p + CRC32_FIXED_CHUNK_LEN); + u32 crc1 = 0, crc2 = 0, crc3 = 0; + + STATIC_ASSERT(CRC32_NUM_CHUNKS == 4); + STATIC_ASSERT(CRC32_FIXED_CHUNK_LEN % (4 * 8) == 0); + do { + prefetchr(&wp0[64 + 0*CRC32_FIXED_CHUNK_LEN/8]); + prefetchr(&wp0[64 + 1*CRC32_FIXED_CHUNK_LEN/8]); + prefetchr(&wp0[64 + 2*CRC32_FIXED_CHUNK_LEN/8]); + prefetchr(&wp0[64 + 3*CRC32_FIXED_CHUNK_LEN/8]); + crc = __crc32d(crc, le64_bswap(wp0[0*CRC32_FIXED_CHUNK_LEN/8])); + crc1 = __crc32d(crc1, le64_bswap(wp0[1*CRC32_FIXED_CHUNK_LEN/8])); + crc2 = __crc32d(crc2, le64_bswap(wp0[2*CRC32_FIXED_CHUNK_LEN/8])); + crc3 = __crc32d(crc3, le64_bswap(wp0[3*CRC32_FIXED_CHUNK_LEN/8])); + wp0++; + crc = __crc32d(crc, le64_bswap(wp0[0*CRC32_FIXED_CHUNK_LEN/8])); + crc1 = __crc32d(crc1, le64_bswap(wp0[1*CRC32_FIXED_CHUNK_LEN/8])); + crc2 = __crc32d(crc2, le64_bswap(wp0[2*CRC32_FIXED_CHUNK_LEN/8])); + crc3 = __crc32d(crc3, le64_bswap(wp0[3*CRC32_FIXED_CHUNK_LEN/8])); + wp0++; + crc = __crc32d(crc, le64_bswap(wp0[0*CRC32_FIXED_CHUNK_LEN/8])); + crc1 = __crc32d(crc1, le64_bswap(wp0[1*CRC32_FIXED_CHUNK_LEN/8])); + crc2 = __crc32d(crc2, le64_bswap(wp0[2*CRC32_FIXED_CHUNK_LEN/8])); + crc3 = __crc32d(crc3, le64_bswap(wp0[3*CRC32_FIXED_CHUNK_LEN/8])); + wp0++; + crc = __crc32d(crc, le64_bswap(wp0[0*CRC32_FIXED_CHUNK_LEN/8])); + crc1 = __crc32d(crc1, le64_bswap(wp0[1*CRC32_FIXED_CHUNK_LEN/8])); + crc2 = __crc32d(crc2, le64_bswap(wp0[2*CRC32_FIXED_CHUNK_LEN/8])); + crc3 = __crc32d(crc3, le64_bswap(wp0[3*CRC32_FIXED_CHUNK_LEN/8])); + wp0++; + } while (wp0 != wp0_end); + crc = combine_crcs_slow(crc, crc1, crc2, crc3); + p += CRC32_NUM_CHUNKS * CRC32_FIXED_CHUNK_LEN; + len -= CRC32_NUM_CHUNKS * CRC32_FIXED_CHUNK_LEN; + } + /* + * Due to the large fixed chunk length used above, there might + * still be a lot of data left. So use a 64-byte loop here, + * instead of a loop that is less unrolled. + */ + while (len >= 64) { + crc = __crc32d(crc, le64_bswap(*(u64 *)(p + 0))); + crc = __crc32d(crc, le64_bswap(*(u64 *)(p + 8))); + crc = __crc32d(crc, le64_bswap(*(u64 *)(p + 16))); + crc = __crc32d(crc, le64_bswap(*(u64 *)(p + 24))); + crc = __crc32d(crc, le64_bswap(*(u64 *)(p + 32))); + crc = __crc32d(crc, le64_bswap(*(u64 *)(p + 40))); + crc = __crc32d(crc, le64_bswap(*(u64 *)(p + 48))); + crc = __crc32d(crc, le64_bswap(*(u64 *)(p + 56))); + p += 64; + len -= 64; + } + } + if (len & 32) { + crc = __crc32d(crc, get_unaligned_le64(p + 0)); + crc = __crc32d(crc, get_unaligned_le64(p + 8)); + crc = __crc32d(crc, get_unaligned_le64(p + 16)); + crc = __crc32d(crc, get_unaligned_le64(p + 24)); + p += 32; + } + if (len & 16) { + crc = __crc32d(crc, get_unaligned_le64(p + 0)); + crc = __crc32d(crc, get_unaligned_le64(p + 8)); + p += 16; + } + if (len & 8) { + crc = __crc32d(crc, get_unaligned_le64(p)); + p += 8; + } + if (len & 4) { + crc = __crc32w(crc, get_unaligned_le32(p)); + p += 4; + } + if (len & 2) { + crc = __crc32h(crc, get_unaligned_le16(p)); + p += 2; + } + if (len & 1) + crc = __crc32b(crc, *p); + return crc; +} +#undef ATTRIBUTES +#endif /* crc32_arm_crc() */ + +/* + * crc32_arm_crc_pmullcombine() - implementation using crc32 instructions, plus + * pmull instructions for CRC combining + * + * This is similar to crc32_arm_crc(), but it enables the use of pmull + * (carryless multiplication) instructions for the steps where the CRCs of + * adjacent data chunks are combined. As this greatly speeds up CRC + * combination, this implementation also differs from crc32_arm_crc() in that it + * uses a variable chunk length which can get fairly small. The precomputed + * multipliers needed for the selected chunk length are loaded from a table. + * + * Note that pmull is used here only for combining the CRCs of separately + * checksummed chunks, not for folding the data itself. See crc32_arm_pmull*() + * for implementations that use pmull for folding the data itself. + */ +#if HAVE_CRC32_INTRIN && HAVE_PMULL_INTRIN +# if HAVE_CRC32_NATIVE && HAVE_PMULL_NATIVE +# define ATTRIBUTES +# else +# ifdef ARCH_ARM32 +# define ATTRIBUTES _target_attribute("arch=armv8-a+crc,fpu=crypto-neon-fp-armv8") +# else +# ifdef __clang__ +# define ATTRIBUTES _target_attribute("crc,crypto") +# else +# define ATTRIBUTES _target_attribute("+crc,+crypto") +# endif +# endif +# endif + +#ifndef _MSC_VER +# include +#endif +#include + +/* Do carryless multiplication of two 32-bit values. */ +static forceinline ATTRIBUTES u64 +clmul_u32(u32 a, u32 b) +{ + uint64x2_t res = vreinterpretq_u64_p128( + compat_vmull_p64((poly64_t)a, (poly64_t)b)); + + return vgetq_lane_u64(res, 0); +} + +/* + * Like combine_crcs_slow(), but uses vmull_p64 to do the multiplications more + * quickly, and supports a variable chunk length. The chunk length is + * 'i * CRC32_MIN_VARIABLE_CHUNK_LEN' + * where 1 <= i < ARRAY_LEN(crc32_mults_for_chunklen). + */ +static forceinline ATTRIBUTES u32 +combine_crcs_fast(u32 crc0, u32 crc1, u32 crc2, u32 crc3, size_t i) +{ + u64 res0 = clmul_u32(crc0, crc32_mults_for_chunklen[i][0]); + u64 res1 = clmul_u32(crc1, crc32_mults_for_chunklen[i][1]); + u64 res2 = clmul_u32(crc2, crc32_mults_for_chunklen[i][2]); + + return __crc32d(0, res0 ^ res1 ^ res2) ^ crc3; +} + +#define crc32_arm_crc_pmullcombine crc32_arm_crc_pmullcombine +static u32 ATTRIBUTES MAYBE_UNUSED +crc32_arm_crc_pmullcombine(u32 crc, const u8 *p, size_t len) +{ + const size_t align = -(uintptr_t)p & 7; + + if (len >= align + CRC32_NUM_CHUNKS * CRC32_MIN_VARIABLE_CHUNK_LEN) { + /* Align p to the next 8-byte boundary. */ + if (align) { + if (align & 1) + crc = __crc32b(crc, *p++); + if (align & 2) { + crc = __crc32h(crc, le16_bswap(*(u16 *)p)); + p += 2; + } + if (align & 4) { + crc = __crc32w(crc, le32_bswap(*(u32 *)p)); + p += 4; + } + len -= align; + } + /* + * Handle CRC32_MAX_VARIABLE_CHUNK_LEN specially, so that better + * code is generated for it. + */ + while (len >= CRC32_NUM_CHUNKS * CRC32_MAX_VARIABLE_CHUNK_LEN) { + const u64 *wp0 = (const u64 *)p; + const u64 * const wp0_end = + (const u64 *)(p + CRC32_MAX_VARIABLE_CHUNK_LEN); + u32 crc1 = 0, crc2 = 0, crc3 = 0; + + STATIC_ASSERT(CRC32_NUM_CHUNKS == 4); + STATIC_ASSERT(CRC32_MAX_VARIABLE_CHUNK_LEN % (4 * 8) == 0); + do { + prefetchr(&wp0[64 + 0*CRC32_MAX_VARIABLE_CHUNK_LEN/8]); + prefetchr(&wp0[64 + 1*CRC32_MAX_VARIABLE_CHUNK_LEN/8]); + prefetchr(&wp0[64 + 2*CRC32_MAX_VARIABLE_CHUNK_LEN/8]); + prefetchr(&wp0[64 + 3*CRC32_MAX_VARIABLE_CHUNK_LEN/8]); + crc = __crc32d(crc, le64_bswap(wp0[0*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + crc1 = __crc32d(crc1, le64_bswap(wp0[1*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + crc2 = __crc32d(crc2, le64_bswap(wp0[2*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + crc3 = __crc32d(crc3, le64_bswap(wp0[3*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + wp0++; + crc = __crc32d(crc, le64_bswap(wp0[0*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + crc1 = __crc32d(crc1, le64_bswap(wp0[1*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + crc2 = __crc32d(crc2, le64_bswap(wp0[2*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + crc3 = __crc32d(crc3, le64_bswap(wp0[3*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + wp0++; + crc = __crc32d(crc, le64_bswap(wp0[0*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + crc1 = __crc32d(crc1, le64_bswap(wp0[1*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + crc2 = __crc32d(crc2, le64_bswap(wp0[2*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + crc3 = __crc32d(crc3, le64_bswap(wp0[3*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + wp0++; + crc = __crc32d(crc, le64_bswap(wp0[0*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + crc1 = __crc32d(crc1, le64_bswap(wp0[1*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + crc2 = __crc32d(crc2, le64_bswap(wp0[2*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + crc3 = __crc32d(crc3, le64_bswap(wp0[3*CRC32_MAX_VARIABLE_CHUNK_LEN/8])); + wp0++; + } while (wp0 != wp0_end); + crc = combine_crcs_fast(crc, crc1, crc2, crc3, + ARRAY_LEN(crc32_mults_for_chunklen) - 1); + p += CRC32_NUM_CHUNKS * CRC32_MAX_VARIABLE_CHUNK_LEN; + len -= CRC32_NUM_CHUNKS * CRC32_MAX_VARIABLE_CHUNK_LEN; + } + /* Handle up to one variable-length chunk. */ + if (len >= CRC32_NUM_CHUNKS * CRC32_MIN_VARIABLE_CHUNK_LEN) { + const size_t i = len / (CRC32_NUM_CHUNKS * + CRC32_MIN_VARIABLE_CHUNK_LEN); + const size_t chunk_len = + i * CRC32_MIN_VARIABLE_CHUNK_LEN; + const u64 *wp0 = (const u64 *)(p + 0*chunk_len); + const u64 *wp1 = (const u64 *)(p + 1*chunk_len); + const u64 *wp2 = (const u64 *)(p + 2*chunk_len); + const u64 *wp3 = (const u64 *)(p + 3*chunk_len); + const u64 * const wp0_end = wp1; + u32 crc1 = 0, crc2 = 0, crc3 = 0; + + STATIC_ASSERT(CRC32_NUM_CHUNKS == 4); + STATIC_ASSERT(CRC32_MIN_VARIABLE_CHUNK_LEN % (4 * 8) == 0); + do { + prefetchr(wp0 + 64); + prefetchr(wp1 + 64); + prefetchr(wp2 + 64); + prefetchr(wp3 + 64); + crc = __crc32d(crc, le64_bswap(*wp0++)); + crc1 = __crc32d(crc1, le64_bswap(*wp1++)); + crc2 = __crc32d(crc2, le64_bswap(*wp2++)); + crc3 = __crc32d(crc3, le64_bswap(*wp3++)); + crc = __crc32d(crc, le64_bswap(*wp0++)); + crc1 = __crc32d(crc1, le64_bswap(*wp1++)); + crc2 = __crc32d(crc2, le64_bswap(*wp2++)); + crc3 = __crc32d(crc3, le64_bswap(*wp3++)); + crc = __crc32d(crc, le64_bswap(*wp0++)); + crc1 = __crc32d(crc1, le64_bswap(*wp1++)); + crc2 = __crc32d(crc2, le64_bswap(*wp2++)); + crc3 = __crc32d(crc3, le64_bswap(*wp3++)); + crc = __crc32d(crc, le64_bswap(*wp0++)); + crc1 = __crc32d(crc1, le64_bswap(*wp1++)); + crc2 = __crc32d(crc2, le64_bswap(*wp2++)); + crc3 = __crc32d(crc3, le64_bswap(*wp3++)); + } while (wp0 != wp0_end); + crc = combine_crcs_fast(crc, crc1, crc2, crc3, i); + p += CRC32_NUM_CHUNKS * chunk_len; + len -= CRC32_NUM_CHUNKS * chunk_len; + } + + while (len >= 32) { + crc = __crc32d(crc, le64_bswap(*(u64 *)(p + 0))); + crc = __crc32d(crc, le64_bswap(*(u64 *)(p + 8))); + crc = __crc32d(crc, le64_bswap(*(u64 *)(p + 16))); + crc = __crc32d(crc, le64_bswap(*(u64 *)(p + 24))); + p += 32; + len -= 32; + } + } else { + while (len >= 32) { + crc = __crc32d(crc, get_unaligned_le64(p + 0)); + crc = __crc32d(crc, get_unaligned_le64(p + 8)); + crc = __crc32d(crc, get_unaligned_le64(p + 16)); + crc = __crc32d(crc, get_unaligned_le64(p + 24)); + p += 32; + len -= 32; + } + } + if (len & 16) { + crc = __crc32d(crc, get_unaligned_le64(p + 0)); + crc = __crc32d(crc, get_unaligned_le64(p + 8)); + p += 16; + } + if (len & 8) { + crc = __crc32d(crc, get_unaligned_le64(p)); + p += 8; + } + if (len & 4) { + crc = __crc32w(crc, get_unaligned_le32(p)); + p += 4; + } + if (len & 2) { + crc = __crc32h(crc, get_unaligned_le16(p)); + p += 2; + } + if (len & 1) + crc = __crc32b(crc, *p); + return crc; +} +#undef ATTRIBUTES +#endif /* crc32_arm_crc_pmullcombine() */ + +/* + * crc32_arm_pmullx4() - implementation using "folding" with pmull instructions + * + * This implementation is intended for CPUs that support pmull instructions but + * not crc32 instructions. + */ +#if HAVE_PMULL_INTRIN +# define crc32_arm_pmullx4 crc32_arm_pmullx4 +# define SUFFIX _pmullx4 +# if HAVE_PMULL_NATIVE +# define ATTRIBUTES +# else +# ifdef ARCH_ARM32 +# define ATTRIBUTES _target_attribute("fpu=crypto-neon-fp-armv8") +# else +# ifdef __clang__ +# define ATTRIBUTES _target_attribute("crypto") +# else +# define ATTRIBUTES _target_attribute("+crypto") +# endif +# endif +# endif +# define ENABLE_EOR3 0 +# include "crc32_pmull_helpers.h" + +static u32 ATTRIBUTES MAYBE_UNUSED +crc32_arm_pmullx4(u32 crc, const u8 *p, size_t len) +{ + static const u64 _aligned_attribute(16) mults[3][2] = { + CRC32_1VECS_MULTS, + CRC32_4VECS_MULTS, + CRC32_2VECS_MULTS, + }; + static const u64 _aligned_attribute(16) final_mults[3][2] = { + { CRC32_FINAL_MULT, 0 }, + { CRC32_BARRETT_CONSTANT_1, 0 }, + { CRC32_BARRETT_CONSTANT_2, 0 }, + }; + const uint8x16_t zeroes = vdupq_n_u8(0); + const uint8x16_t mask32 = vreinterpretq_u8_u64(vdupq_n_u64(0xFFFFFFFF)); + const poly64x2_t multipliers_1 = load_multipliers(mults[0]); + uint8x16_t v0, v1, v2, v3; + + if (len < 64 + 15) { + if (len < 16) + return crc32_slice1(crc, p, len); + v0 = veorq_u8(vld1q_u8(p), u32_to_bytevec(crc)); + p += 16; + len -= 16; + while (len >= 16) { + v0 = fold_vec(v0, vld1q_u8(p), multipliers_1); + p += 16; + len -= 16; + } + } else { + const poly64x2_t multipliers_4 = load_multipliers(mults[1]); + const poly64x2_t multipliers_2 = load_multipliers(mults[2]); + const size_t align = -(uintptr_t)p & 15; + const uint8x16_t *vp; + + v0 = veorq_u8(vld1q_u8(p), u32_to_bytevec(crc)); + p += 16; + /* Align p to the next 16-byte boundary. */ + if (align) { + v0 = fold_partial_vec(v0, p, align, multipliers_1); + p += align; + len -= align; + } + vp = (const uint8x16_t *)p; + v1 = *vp++; + v2 = *vp++; + v3 = *vp++; + while (len >= 64 + 64) { + v0 = fold_vec(v0, *vp++, multipliers_4); + v1 = fold_vec(v1, *vp++, multipliers_4); + v2 = fold_vec(v2, *vp++, multipliers_4); + v3 = fold_vec(v3, *vp++, multipliers_4); + len -= 64; + } + v0 = fold_vec(v0, v2, multipliers_2); + v1 = fold_vec(v1, v3, multipliers_2); + if (len & 32) { + v0 = fold_vec(v0, *vp++, multipliers_2); + v1 = fold_vec(v1, *vp++, multipliers_2); + } + v0 = fold_vec(v0, v1, multipliers_1); + if (len & 16) + v0 = fold_vec(v0, *vp++, multipliers_1); + p = (const u8 *)vp; + len &= 15; + } + + /* Handle any remaining partial block now before reducing to 32 bits. */ + if (len) + v0 = fold_partial_vec(v0, p, len, multipliers_1); + + /* + * Fold 128 => 96 bits. This also implicitly appends 32 zero bits, + * which is equivalent to multiplying by x^32. This is needed because + * the CRC is defined as M(x)*x^32 mod G(x), not just M(x) mod G(x). + */ + + v0 = veorq_u8(vextq_u8(v0, zeroes, 8), + clmul_high(vextq_u8(zeroes, v0, 8), multipliers_1)); + + /* Fold 96 => 64 bits. */ + v0 = veorq_u8(vextq_u8(v0, zeroes, 4), + clmul_low(vandq_u8(v0, mask32), + load_multipliers(final_mults[0]))); + + /* Reduce 64 => 32 bits using Barrett reduction. */ + v1 = clmul_low(vandq_u8(v0, mask32), load_multipliers(final_mults[1])); + v1 = clmul_low(vandq_u8(v1, mask32), load_multipliers(final_mults[2])); + return vgetq_lane_u32(vreinterpretq_u32_u8(veorq_u8(v0, v1)), 1); +} +#undef SUFFIX +#undef ATTRIBUTES +#undef ENABLE_EOR3 +#endif /* crc32_arm_pmullx4() */ + +/* + * crc32_arm_pmullx12_crc() - large-stride implementation using "folding" with + * pmull instructions, where crc32 instructions are also available + * + * See crc32_pmull_wide.h for explanation. + */ +#if defined(ARCH_ARM64) && HAVE_PMULL_INTRIN && HAVE_CRC32_INTRIN +# define crc32_arm_pmullx12_crc crc32_arm_pmullx12_crc +# define SUFFIX _pmullx12_crc +# if HAVE_PMULL_NATIVE && HAVE_CRC32_NATIVE +# define ATTRIBUTES +# else +# ifdef __clang__ +# define ATTRIBUTES _target_attribute("crypto,crc") +# else +# define ATTRIBUTES _target_attribute("+crypto,+crc") +# endif +# endif +# define ENABLE_EOR3 0 +# include "crc32_pmull_wide.h" +#endif + +/* + * crc32_arm_pmullx12_crc_eor3() + * + * This like crc32_arm_pmullx12_crc(), but it adds the eor3 instruction (from + * the sha3 extension) for even better performance. + * + * Note: we require HAVE_SHA3_TARGET (or HAVE_SHA3_NATIVE) rather than + * HAVE_SHA3_INTRIN, as we have an inline asm fallback for eor3. + */ +#if defined(ARCH_ARM64) && HAVE_PMULL_INTRIN && HAVE_CRC32_INTRIN && \ + (HAVE_SHA3_TARGET || HAVE_SHA3_NATIVE) +# define crc32_arm_pmullx12_crc_eor3 crc32_arm_pmullx12_crc_eor3 +# define SUFFIX _pmullx12_crc_eor3 +# if HAVE_PMULL_NATIVE && HAVE_CRC32_NATIVE && HAVE_SHA3_NATIVE +# define ATTRIBUTES +# else +# ifdef __clang__ +# define ATTRIBUTES _target_attribute("crypto,crc,sha3") + /* + * With gcc, arch=armv8.2-a is needed for the sha3 intrinsics, unless the + * default target is armv8.3-a or later in which case it must be omitted. + * armv8.3-a or later can be detected by checking for __ARM_FEATURE_JCVT. + */ +# elif defined(__ARM_FEATURE_JCVT) +# define ATTRIBUTES _target_attribute("+crypto,+crc,+sha3") +# else +# define ATTRIBUTES _target_attribute("arch=armv8.2-a+crypto+crc+sha3") +# endif +# endif +# define ENABLE_EOR3 1 +# include "crc32_pmull_wide.h" +#endif + +/* + * On the Apple M1 processor, crc32 instructions max out at about 25.5 GB/s in + * the best case of using a 3-way or greater interleaved chunked implementation, + * whereas a pmull-based implementation achieves 68 GB/s provided that the + * stride length is large enough (about 10+ vectors with eor3, or 12+ without). + * + * For now we assume that crc32 instructions are preferable in other cases. + */ +#define PREFER_PMULL_TO_CRC 0 +#ifdef __APPLE__ +# include +# if TARGET_OS_OSX +# undef PREFER_PMULL_TO_CRC +# define PREFER_PMULL_TO_CRC 1 +# endif +#endif + +/* + * If the best implementation is statically available, use it unconditionally. + * Otherwise choose the best implementation at runtime. + */ +#if PREFER_PMULL_TO_CRC && defined(crc32_arm_pmullx12_crc_eor3) && \ + HAVE_PMULL_NATIVE && HAVE_CRC32_NATIVE && HAVE_SHA3_NATIVE +# define DEFAULT_IMPL crc32_arm_pmullx12_crc_eor3 +#elif !PREFER_PMULL_TO_CRC && defined(crc32_arm_crc_pmullcombine) && \ + HAVE_CRC32_NATIVE && HAVE_PMULL_NATIVE +# define DEFAULT_IMPL crc32_arm_crc_pmullcombine +#else +static inline crc32_func_t +arch_select_crc32_func(void) +{ + const u32 features MAYBE_UNUSED = get_arm_cpu_features(); + +#if PREFER_PMULL_TO_CRC && defined(crc32_arm_pmullx12_crc_eor3) + if (HAVE_PMULL(features) && HAVE_CRC32(features) && HAVE_SHA3(features)) + return crc32_arm_pmullx12_crc_eor3; +#endif +#if PREFER_PMULL_TO_CRC && defined(crc32_arm_pmullx12_crc) + if (HAVE_PMULL(features) && HAVE_CRC32(features)) + return crc32_arm_pmullx12_crc; +#endif +#ifdef crc32_arm_crc_pmullcombine + if (HAVE_CRC32(features) && HAVE_PMULL(features)) + return crc32_arm_crc_pmullcombine; +#endif +#ifdef crc32_arm_crc + if (HAVE_CRC32(features)) + return crc32_arm_crc; +#endif +#ifdef crc32_arm_pmullx4 + if (HAVE_PMULL(features)) + return crc32_arm_pmullx4; +#endif + return NULL; +} +#define arch_select_crc32_func arch_select_crc32_func +#endif + +#endif /* LIB_ARM_CRC32_IMPL_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/arm/crc32_pmull_helpers.h b/tools/z64compress/src/enc/libdeflate/lib/arm/crc32_pmull_helpers.h new file mode 100644 index 000000000..1cd1cc188 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/arm/crc32_pmull_helpers.h @@ -0,0 +1,184 @@ +/* + * arm/crc32_pmull_helpers.h - helper functions for CRC-32 folding with PMULL + * + * Copyright 2022 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file is a "template" for instantiating helper functions for CRC folding + * with pmull instructions. It accepts the following parameters: + * + * SUFFIX: + * Name suffix to append to all instantiated functions. + * ATTRIBUTES: + * Target function attributes to use. + * ENABLE_EOR3: + * Use the eor3 instruction (from the sha3 extension). + */ + +#include + +/* Create a vector with 'a' in the first 4 bytes, and the rest zeroed out. */ +#undef u32_to_bytevec +static forceinline ATTRIBUTES uint8x16_t +ADD_SUFFIX(u32_to_bytevec)(u32 a) +{ + return vreinterpretq_u8_u32(vsetq_lane_u32(a, vdupq_n_u32(0), 0)); +} +#define u32_to_bytevec ADD_SUFFIX(u32_to_bytevec) + +/* Load two 64-bit values into a vector. */ +#undef load_multipliers +static forceinline ATTRIBUTES poly64x2_t +ADD_SUFFIX(load_multipliers)(const u64 p[2]) +{ + return vreinterpretq_p64_u64(vld1q_u64(p)); +} +#define load_multipliers ADD_SUFFIX(load_multipliers) + +/* Do carryless multiplication of the low halves of two vectors. */ +#undef clmul_low +static forceinline ATTRIBUTES uint8x16_t +ADD_SUFFIX(clmul_low)(uint8x16_t a, poly64x2_t b) +{ + return vreinterpretq_u8_p128( + compat_vmull_p64(vgetq_lane_p64(vreinterpretq_p64_u8(a), 0), + vgetq_lane_p64(b, 0))); +} +#define clmul_low ADD_SUFFIX(clmul_low) + +/* Do carryless multiplication of the high halves of two vectors. */ +#undef clmul_high +static forceinline ATTRIBUTES uint8x16_t +ADD_SUFFIX(clmul_high)(uint8x16_t a, poly64x2_t b) +{ +#if defined(__clang__) && defined(ARCH_ARM64) + /* + * Use inline asm to ensure that pmull2 is really used. This works + * around clang bug https://github.com/llvm/llvm-project/issues/52868. + */ + uint8x16_t res; + + __asm__("pmull2 %0.1q, %1.2d, %2.2d" : "=w" (res) : "w" (a), "w" (b)); + return res; +#else + return vreinterpretq_u8_p128(vmull_high_p64(vreinterpretq_p64_u8(a), b)); +#endif +} +#define clmul_high ADD_SUFFIX(clmul_high) + +#undef eor3 +static forceinline ATTRIBUTES uint8x16_t +ADD_SUFFIX(eor3)(uint8x16_t a, uint8x16_t b, uint8x16_t c) +{ +#if ENABLE_EOR3 +#if HAVE_SHA3_INTRIN + return veor3q_u8(a, b, c); +#else + uint8x16_t res; + + __asm__("eor3 %0.16b, %1.16b, %2.16b, %3.16b" + : "=w" (res) : "w" (a), "w" (b), "w" (c)); + return res; +#endif +#else /* ENABLE_EOR3 */ + return veorq_u8(veorq_u8(a, b), c); +#endif /* !ENABLE_EOR3 */ +} +#define eor3 ADD_SUFFIX(eor3) + +#undef fold_vec +static forceinline ATTRIBUTES uint8x16_t +ADD_SUFFIX(fold_vec)(uint8x16_t src, uint8x16_t dst, poly64x2_t multipliers) +{ + uint8x16_t a = clmul_low(src, multipliers); + uint8x16_t b = clmul_high(src, multipliers); + + return eor3(a, b, dst); +} +#define fold_vec ADD_SUFFIX(fold_vec) + +#undef vtbl +static forceinline ATTRIBUTES uint8x16_t +ADD_SUFFIX(vtbl)(uint8x16_t table, uint8x16_t indices) +{ +#ifdef ARCH_ARM64 + return vqtbl1q_u8(table, indices); +#else + uint8x8x2_t tab2; + + tab2.val[0] = vget_low_u8(table); + tab2.val[1] = vget_high_u8(table); + + return vcombine_u8(vtbl2_u8(tab2, vget_low_u8(indices)), + vtbl2_u8(tab2, vget_high_u8(indices))); +#endif +} +#define vtbl ADD_SUFFIX(vtbl) + +/* + * Given v containing a 16-byte polynomial, and a pointer 'p' that points to the + * next '1 <= len <= 15' data bytes, rearrange the concatenation of v and the + * data into vectors x0 and x1 that contain 'len' bytes and 16 bytes, + * respectively. Then fold x0 into x1 and return the result. Assumes that + * 'p + len - 16' is in-bounds. + */ +#undef fold_partial_vec +static forceinline ATTRIBUTES MAYBE_UNUSED uint8x16_t +ADD_SUFFIX(fold_partial_vec)(uint8x16_t v, const u8 *p, size_t len, + poly64x2_t multipliers_1) +{ + /* + * vtbl(v, shift_tab[len..len+15]) left shifts v by 16-len bytes. + * vtbl(v, shift_tab[len+16..len+31]) right shifts v by len bytes. + */ + static const u8 shift_tab[48] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + }; + const uint8x16_t lshift = vld1q_u8(&shift_tab[len]); + const uint8x16_t rshift = vld1q_u8(&shift_tab[len + 16]); + uint8x16_t x0, x1, bsl_mask; + + /* x0 = v left-shifted by '16 - len' bytes */ + x0 = vtbl(v, lshift); + + /* Create a vector of '16 - len' 0x00 bytes, then 'len' 0xff bytes. */ + bsl_mask = vreinterpretq_u8_s8( + vshrq_n_s8(vreinterpretq_s8_u8(rshift), 7)); + + /* + * x1 = the last '16 - len' bytes from v (i.e. v right-shifted by 'len' + * bytes) followed by the remaining data. + */ + x1 = vbslq_u8(bsl_mask /* 0 bits select from arg3, 1 bits from arg2 */, + vld1q_u8(p + len - 16), vtbl(v, rshift)); + + return fold_vec(x0, x1, multipliers_1); +} +#define fold_partial_vec ADD_SUFFIX(fold_partial_vec) diff --git a/tools/z64compress/src/enc/libdeflate/lib/arm/crc32_pmull_wide.h b/tools/z64compress/src/enc/libdeflate/lib/arm/crc32_pmull_wide.h new file mode 100644 index 000000000..a72e1d876 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/arm/crc32_pmull_wide.h @@ -0,0 +1,227 @@ +/* + * arm/crc32_pmull_wide.h - gzip CRC-32 with PMULL (extra-wide version) + * + * Copyright 2022 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file is a "template" for instantiating PMULL-based crc32_arm functions. + * The "parameters" are: + * + * SUFFIX: + * Name suffix to append to all instantiated functions. + * ATTRIBUTES: + * Target function attributes to use. + * ENABLE_EOR3: + * Use the eor3 instruction (from the sha3 extension). + * + * This is the extra-wide version; it uses an unusually large stride length of + * 12, and it assumes that crc32 instructions are available too. It's intended + * for powerful CPUs that support both pmull and crc32 instructions, but where + * throughput of pmull and xor (given enough instructions issued in parallel) is + * significantly higher than that of crc32, thus making the crc32 instructions + * (counterintuitively) not actually the fastest way to compute the CRC-32. The + * Apple M1 processor is an example of such a CPU. + */ + +#ifndef _MSC_VER +# include +#endif +#include + +#include "crc32_pmull_helpers.h" + +static u32 ATTRIBUTES MAYBE_UNUSED +ADD_SUFFIX(crc32_arm)(u32 crc, const u8 *p, size_t len) +{ + uint8x16_t v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11; + + if (len < 3 * 192) { + static const u64 _aligned_attribute(16) mults[3][2] = { + CRC32_4VECS_MULTS, CRC32_2VECS_MULTS, CRC32_1VECS_MULTS, + }; + poly64x2_t multipliers_4, multipliers_2, multipliers_1; + + if (len < 64) + goto tail; + multipliers_4 = load_multipliers(mults[0]); + multipliers_2 = load_multipliers(mults[1]); + multipliers_1 = load_multipliers(mults[2]); + /* + * Short length; don't bother aligning the pointer, and fold + * 64 bytes (4 vectors) at a time, at most. + */ + v0 = veorq_u8(vld1q_u8(p + 0), u32_to_bytevec(crc)); + v1 = vld1q_u8(p + 16); + v2 = vld1q_u8(p + 32); + v3 = vld1q_u8(p + 48); + p += 64; + len -= 64; + while (len >= 64) { + v0 = fold_vec(v0, vld1q_u8(p + 0), multipliers_4); + v1 = fold_vec(v1, vld1q_u8(p + 16), multipliers_4); + v2 = fold_vec(v2, vld1q_u8(p + 32), multipliers_4); + v3 = fold_vec(v3, vld1q_u8(p + 48), multipliers_4); + p += 64; + len -= 64; + } + v0 = fold_vec(v0, v2, multipliers_2); + v1 = fold_vec(v1, v3, multipliers_2); + if (len >= 32) { + v0 = fold_vec(v0, vld1q_u8(p + 0), multipliers_2); + v1 = fold_vec(v1, vld1q_u8(p + 16), multipliers_2); + p += 32; + len -= 32; + } + v0 = fold_vec(v0, v1, multipliers_1); + } else { + static const u64 _aligned_attribute(16) mults[4][2] = { + CRC32_12VECS_MULTS, CRC32_6VECS_MULTS, + CRC32_3VECS_MULTS, CRC32_1VECS_MULTS, + }; + const poly64x2_t multipliers_12 = load_multipliers(mults[0]); + const poly64x2_t multipliers_6 = load_multipliers(mults[1]); + const poly64x2_t multipliers_3 = load_multipliers(mults[2]); + const poly64x2_t multipliers_1 = load_multipliers(mults[3]); + const size_t align = -(uintptr_t)p & 15; + const uint8x16_t *vp; + + /* Align p to the next 16-byte boundary. */ + if (align) { + if (align & 1) + crc = __crc32b(crc, *p++); + if (align & 2) { + crc = __crc32h(crc, le16_bswap(*(u16 *)p)); + p += 2; + } + if (align & 4) { + crc = __crc32w(crc, le32_bswap(*(u32 *)p)); + p += 4; + } + if (align & 8) { + crc = __crc32d(crc, le64_bswap(*(u64 *)p)); + p += 8; + } + len -= align; + } + vp = (const uint8x16_t *)p; + v0 = veorq_u8(*vp++, u32_to_bytevec(crc)); + v1 = *vp++; + v2 = *vp++; + v3 = *vp++; + v4 = *vp++; + v5 = *vp++; + v6 = *vp++; + v7 = *vp++; + v8 = *vp++; + v9 = *vp++; + v10 = *vp++; + v11 = *vp++; + len -= 192; + /* Fold 192 bytes (12 vectors) at a time. */ + do { + v0 = fold_vec(v0, *vp++, multipliers_12); + v1 = fold_vec(v1, *vp++, multipliers_12); + v2 = fold_vec(v2, *vp++, multipliers_12); + v3 = fold_vec(v3, *vp++, multipliers_12); + v4 = fold_vec(v4, *vp++, multipliers_12); + v5 = fold_vec(v5, *vp++, multipliers_12); + v6 = fold_vec(v6, *vp++, multipliers_12); + v7 = fold_vec(v7, *vp++, multipliers_12); + v8 = fold_vec(v8, *vp++, multipliers_12); + v9 = fold_vec(v9, *vp++, multipliers_12); + v10 = fold_vec(v10, *vp++, multipliers_12); + v11 = fold_vec(v11, *vp++, multipliers_12); + len -= 192; + } while (len >= 192); + + /* + * Fewer than 192 bytes left. Fold v0-v11 down to just v0, + * while processing up to 144 more bytes. + */ + v0 = fold_vec(v0, v6, multipliers_6); + v1 = fold_vec(v1, v7, multipliers_6); + v2 = fold_vec(v2, v8, multipliers_6); + v3 = fold_vec(v3, v9, multipliers_6); + v4 = fold_vec(v4, v10, multipliers_6); + v5 = fold_vec(v5, v11, multipliers_6); + if (len >= 96) { + v0 = fold_vec(v0, *vp++, multipliers_6); + v1 = fold_vec(v1, *vp++, multipliers_6); + v2 = fold_vec(v2, *vp++, multipliers_6); + v3 = fold_vec(v3, *vp++, multipliers_6); + v4 = fold_vec(v4, *vp++, multipliers_6); + v5 = fold_vec(v5, *vp++, multipliers_6); + len -= 96; + } + v0 = fold_vec(v0, v3, multipliers_3); + v1 = fold_vec(v1, v4, multipliers_3); + v2 = fold_vec(v2, v5, multipliers_3); + if (len >= 48) { + v0 = fold_vec(v0, *vp++, multipliers_3); + v1 = fold_vec(v1, *vp++, multipliers_3); + v2 = fold_vec(v2, *vp++, multipliers_3); + len -= 48; + } + v0 = fold_vec(v0, v1, multipliers_1); + v0 = fold_vec(v0, v2, multipliers_1); + p = (const u8 *)vp; + } + /* Reduce 128 to 32 bits using crc32 instructions. */ + crc = __crc32d(0, vgetq_lane_u64(vreinterpretq_u64_u8(v0), 0)); + crc = __crc32d(crc, vgetq_lane_u64(vreinterpretq_u64_u8(v0), 1)); +tail: + /* Finish up the remainder using crc32 instructions. */ + if (len & 32) { + crc = __crc32d(crc, get_unaligned_le64(p + 0)); + crc = __crc32d(crc, get_unaligned_le64(p + 8)); + crc = __crc32d(crc, get_unaligned_le64(p + 16)); + crc = __crc32d(crc, get_unaligned_le64(p + 24)); + p += 32; + } + if (len & 16) { + crc = __crc32d(crc, get_unaligned_le64(p + 0)); + crc = __crc32d(crc, get_unaligned_le64(p + 8)); + p += 16; + } + if (len & 8) { + crc = __crc32d(crc, get_unaligned_le64(p)); + p += 8; + } + if (len & 4) { + crc = __crc32w(crc, get_unaligned_le32(p)); + p += 4; + } + if (len & 2) { + crc = __crc32h(crc, get_unaligned_le16(p)); + p += 2; + } + if (len & 1) + crc = __crc32b(crc, *p); + return crc; +} + +#undef SUFFIX +#undef ATTRIBUTES +#undef ENABLE_EOR3 diff --git a/tools/z64compress/src/enc/libdeflate/lib/arm/matchfinder_impl.h b/tools/z64compress/src/enc/libdeflate/lib/arm/matchfinder_impl.h new file mode 100644 index 000000000..b20f56a3b --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/arm/matchfinder_impl.h @@ -0,0 +1,79 @@ +/* + * arm/matchfinder_impl.h - ARM implementations of matchfinder functions + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LIB_ARM_MATCHFINDER_IMPL_H +#define LIB_ARM_MATCHFINDER_IMPL_H + +#include "cpu_features.h" + +#if HAVE_NEON_NATIVE +# include +static forceinline void +matchfinder_init_neon(mf_pos_t *data, size_t size) +{ + int16x8_t *p = (int16x8_t *)data; + int16x8_t v = vdupq_n_s16(MATCHFINDER_INITVAL); + + STATIC_ASSERT(MATCHFINDER_MEM_ALIGNMENT % sizeof(*p) == 0); + STATIC_ASSERT(MATCHFINDER_SIZE_ALIGNMENT % (4 * sizeof(*p)) == 0); + STATIC_ASSERT(sizeof(mf_pos_t) == 2); + + do { + p[0] = v; + p[1] = v; + p[2] = v; + p[3] = v; + p += 4; + size -= 4 * sizeof(*p); + } while (size != 0); +} +#define matchfinder_init matchfinder_init_neon + +static forceinline void +matchfinder_rebase_neon(mf_pos_t *data, size_t size) +{ + int16x8_t *p = (int16x8_t *)data; + int16x8_t v = vdupq_n_s16((u16)-MATCHFINDER_WINDOW_SIZE); + + STATIC_ASSERT(MATCHFINDER_MEM_ALIGNMENT % sizeof(*p) == 0); + STATIC_ASSERT(MATCHFINDER_SIZE_ALIGNMENT % (4 * sizeof(*p)) == 0); + STATIC_ASSERT(sizeof(mf_pos_t) == 2); + + do { + p[0] = vqaddq_s16(p[0], v); + p[1] = vqaddq_s16(p[1], v); + p[2] = vqaddq_s16(p[2], v); + p[3] = vqaddq_s16(p[3], v); + p += 4; + size -= 4 * sizeof(*p); + } while (size != 0); +} +#define matchfinder_rebase matchfinder_rebase_neon + +#endif /* HAVE_NEON_NATIVE */ + +#endif /* LIB_ARM_MATCHFINDER_IMPL_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/bt_matchfinder.h b/tools/z64compress/src/enc/libdeflate/lib/bt_matchfinder.h new file mode 100644 index 000000000..b247d4bcc --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/bt_matchfinder.h @@ -0,0 +1,342 @@ +/* + * bt_matchfinder.h - Lempel-Ziv matchfinding with a hash table of binary trees + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * ---------------------------------------------------------------------------- + * + * This is a Binary Trees (bt) based matchfinder. + * + * The main data structure is a hash table where each hash bucket contains a + * binary tree of sequences whose first 4 bytes share the same hash code. Each + * sequence is identified by its starting position in the input buffer. Each + * binary tree is always sorted such that each left child represents a sequence + * lexicographically lesser than its parent and each right child represents a + * sequence lexicographically greater than its parent. + * + * The algorithm processes the input buffer sequentially. At each byte + * position, the hash code of the first 4 bytes of the sequence beginning at + * that position (the sequence being matched against) is computed. This + * identifies the hash bucket to use for that position. Then, a new binary tree + * node is created to represent the current sequence. Then, in a single tree + * traversal, the hash bucket's binary tree is searched for matches and is + * re-rooted at the new node. + * + * Compared to the simpler algorithm that uses linked lists instead of binary + * trees (see hc_matchfinder.h), the binary tree version gains more information + * at each node visitation. Ideally, the binary tree version will examine only + * 'log(n)' nodes to find the same matches that the linked list version will + * find by examining 'n' nodes. In addition, the binary tree version can + * examine fewer bytes at each node by taking advantage of the common prefixes + * that result from the sort order, whereas the linked list version may have to + * examine up to the full length of the match at each node. + * + * However, it is not always best to use the binary tree version. It requires + * nearly twice as much memory as the linked list version, and it takes time to + * keep the binary trees sorted, even at positions where the compressor does not + * need matches. Generally, when doing fast compression on small buffers, + * binary trees are the wrong approach. They are best suited for thorough + * compression and/or large buffers. + * + * ---------------------------------------------------------------------------- + */ + +#ifndef LIB_BT_MATCHFINDER_H +#define LIB_BT_MATCHFINDER_H + +#include "matchfinder_common.h" + +#define BT_MATCHFINDER_HASH3_ORDER 16 +#define BT_MATCHFINDER_HASH3_WAYS 2 +#define BT_MATCHFINDER_HASH4_ORDER 16 + +#define BT_MATCHFINDER_TOTAL_HASH_SIZE \ + (((1UL << BT_MATCHFINDER_HASH3_ORDER) * BT_MATCHFINDER_HASH3_WAYS + \ + (1UL << BT_MATCHFINDER_HASH4_ORDER)) * sizeof(mf_pos_t)) + +/* Representation of a match found by the bt_matchfinder */ +struct lz_match { + + /* The number of bytes matched. */ + u16 length; + + /* The offset back from the current position that was matched. */ + u16 offset; +}; + +struct MATCHFINDER_ALIGNED bt_matchfinder { + + /* The hash table for finding length 3 matches */ + mf_pos_t hash3_tab[1UL << BT_MATCHFINDER_HASH3_ORDER][BT_MATCHFINDER_HASH3_WAYS]; + + /* The hash table which contains the roots of the binary trees for + * finding length 4+ matches */ + mf_pos_t hash4_tab[1UL << BT_MATCHFINDER_HASH4_ORDER]; + + /* The child node references for the binary trees. The left and right + * children of the node for the sequence with position 'pos' are + * 'child_tab[pos * 2]' and 'child_tab[pos * 2 + 1]', respectively. */ + mf_pos_t child_tab[2UL * MATCHFINDER_WINDOW_SIZE]; +}; + +/* Prepare the matchfinder for a new input buffer. */ +static forceinline void +bt_matchfinder_init(struct bt_matchfinder *mf) +{ + STATIC_ASSERT(BT_MATCHFINDER_TOTAL_HASH_SIZE % + MATCHFINDER_SIZE_ALIGNMENT == 0); + + matchfinder_init((mf_pos_t *)mf, BT_MATCHFINDER_TOTAL_HASH_SIZE); +} + +static forceinline void +bt_matchfinder_slide_window(struct bt_matchfinder *mf) +{ + STATIC_ASSERT(sizeof(*mf) % MATCHFINDER_SIZE_ALIGNMENT == 0); + + matchfinder_rebase((mf_pos_t *)mf, sizeof(*mf)); +} + +static forceinline mf_pos_t * +bt_left_child(struct bt_matchfinder *mf, s32 node) +{ + return &mf->child_tab[2 * (node & (MATCHFINDER_WINDOW_SIZE - 1)) + 0]; +} + +static forceinline mf_pos_t * +bt_right_child(struct bt_matchfinder *mf, s32 node) +{ + return &mf->child_tab[2 * (node & (MATCHFINDER_WINDOW_SIZE - 1)) + 1]; +} + +/* The minimum permissible value of 'max_len' for bt_matchfinder_get_matches() + * and bt_matchfinder_skip_byte(). There must be sufficiently many bytes + * remaining to load a 32-bit integer from the *next* position. */ +#define BT_MATCHFINDER_REQUIRED_NBYTES 5 + +/* Advance the binary tree matchfinder by one byte, optionally recording + * matches. @record_matches should be a compile-time constant. */ +static forceinline struct lz_match * +bt_matchfinder_advance_one_byte(struct bt_matchfinder * const mf, + const u8 * const in_base, + const ptrdiff_t cur_pos, + const u32 max_len, + const u32 nice_len, + const u32 max_search_depth, + u32 * const next_hashes, + struct lz_match *lz_matchptr, + const bool record_matches) +{ + const u8 *in_next = in_base + cur_pos; + u32 depth_remaining = max_search_depth; + const s32 cutoff = cur_pos - MATCHFINDER_WINDOW_SIZE; + u32 next_hashseq; + u32 hash3; + u32 hash4; + s32 cur_node; +#if BT_MATCHFINDER_HASH3_WAYS >= 2 + s32 cur_node_2; +#endif + const u8 *matchptr; + mf_pos_t *pending_lt_ptr, *pending_gt_ptr; + u32 best_lt_len, best_gt_len; + u32 len; + u32 best_len = 3; + + STATIC_ASSERT(BT_MATCHFINDER_HASH3_WAYS >= 1 && + BT_MATCHFINDER_HASH3_WAYS <= 2); + + next_hashseq = get_unaligned_le32(in_next + 1); + + hash3 = next_hashes[0]; + hash4 = next_hashes[1]; + + next_hashes[0] = lz_hash(next_hashseq & 0xFFFFFF, BT_MATCHFINDER_HASH3_ORDER); + next_hashes[1] = lz_hash(next_hashseq, BT_MATCHFINDER_HASH4_ORDER); + prefetchw(&mf->hash3_tab[next_hashes[0]]); + prefetchw(&mf->hash4_tab[next_hashes[1]]); + + cur_node = mf->hash3_tab[hash3][0]; + mf->hash3_tab[hash3][0] = cur_pos; +#if BT_MATCHFINDER_HASH3_WAYS >= 2 + cur_node_2 = mf->hash3_tab[hash3][1]; + mf->hash3_tab[hash3][1] = cur_node; +#endif + if (record_matches && cur_node > cutoff) { + u32 seq3 = load_u24_unaligned(in_next); + if (seq3 == load_u24_unaligned(&in_base[cur_node])) { + lz_matchptr->length = 3; + lz_matchptr->offset = in_next - &in_base[cur_node]; + lz_matchptr++; + } + #if BT_MATCHFINDER_HASH3_WAYS >= 2 + else if (cur_node_2 > cutoff && + seq3 == load_u24_unaligned(&in_base[cur_node_2])) + { + lz_matchptr->length = 3; + lz_matchptr->offset = in_next - &in_base[cur_node_2]; + lz_matchptr++; + } + #endif + } + + cur_node = mf->hash4_tab[hash4]; + mf->hash4_tab[hash4] = cur_pos; + + pending_lt_ptr = bt_left_child(mf, cur_pos); + pending_gt_ptr = bt_right_child(mf, cur_pos); + + if (cur_node <= cutoff) { + *pending_lt_ptr = MATCHFINDER_INITVAL; + *pending_gt_ptr = MATCHFINDER_INITVAL; + return lz_matchptr; + } + + best_lt_len = 0; + best_gt_len = 0; + len = 0; + + for (;;) { + matchptr = &in_base[cur_node]; + + if (matchptr[len] == in_next[len]) { + len = lz_extend(in_next, matchptr, len + 1, max_len); + if (!record_matches || len > best_len) { + if (record_matches) { + best_len = len; + lz_matchptr->length = len; + lz_matchptr->offset = in_next - matchptr; + lz_matchptr++; + } + if (len >= nice_len) { + *pending_lt_ptr = *bt_left_child(mf, cur_node); + *pending_gt_ptr = *bt_right_child(mf, cur_node); + return lz_matchptr; + } + } + } + + if (matchptr[len] < in_next[len]) { + *pending_lt_ptr = cur_node; + pending_lt_ptr = bt_right_child(mf, cur_node); + cur_node = *pending_lt_ptr; + best_lt_len = len; + if (best_gt_len < len) + len = best_gt_len; + } else { + *pending_gt_ptr = cur_node; + pending_gt_ptr = bt_left_child(mf, cur_node); + cur_node = *pending_gt_ptr; + best_gt_len = len; + if (best_lt_len < len) + len = best_lt_len; + } + + if (cur_node <= cutoff || !--depth_remaining) { + *pending_lt_ptr = MATCHFINDER_INITVAL; + *pending_gt_ptr = MATCHFINDER_INITVAL; + return lz_matchptr; + } + } +} + +/* + * Retrieve a list of matches with the current position. + * + * @mf + * The matchfinder structure. + * @in_base + * Pointer to the next byte in the input buffer to process _at the last + * time bt_matchfinder_init() or bt_matchfinder_slide_window() was called_. + * @cur_pos + * The current position in the input buffer relative to @in_base (the + * position of the sequence being matched against). + * @max_len + * The maximum permissible match length at this position. Must be >= + * BT_MATCHFINDER_REQUIRED_NBYTES. + * @nice_len + * Stop searching if a match of at least this length is found. + * Must be <= @max_len. + * @max_search_depth + * Limit on the number of potential matches to consider. Must be >= 1. + * @next_hashes + * The precomputed hash codes for the sequence beginning at @in_next. + * These will be used and then updated with the precomputed hashcodes for + * the sequence beginning at @in_next + 1. + * @lz_matchptr + * An array in which this function will record the matches. The recorded + * matches will be sorted by strictly increasing length and (non-strictly) + * increasing offset. The maximum number of matches that may be found is + * 'nice_len - 2'. + * + * The return value is a pointer to the next available slot in the @lz_matchptr + * array. (If no matches were found, this will be the same as @lz_matchptr.) + */ +static forceinline struct lz_match * +bt_matchfinder_get_matches(struct bt_matchfinder *mf, + const u8 *in_base, + ptrdiff_t cur_pos, + u32 max_len, + u32 nice_len, + u32 max_search_depth, + u32 next_hashes[2], + struct lz_match *lz_matchptr) +{ + return bt_matchfinder_advance_one_byte(mf, + in_base, + cur_pos, + max_len, + nice_len, + max_search_depth, + next_hashes, + lz_matchptr, + true); +} + +/* + * Advance the matchfinder, but don't record any matches. + * + * This is very similar to bt_matchfinder_get_matches() because both functions + * must do hashing and tree re-rooting. + */ +static forceinline void +bt_matchfinder_skip_byte(struct bt_matchfinder *mf, + const u8 *in_base, + ptrdiff_t cur_pos, + u32 nice_len, + u32 max_search_depth, + u32 next_hashes[2]) +{ + bt_matchfinder_advance_one_byte(mf, + in_base, + cur_pos, + nice_len, + nice_len, + max_search_depth, + next_hashes, + NULL, + false); +} + +#endif /* LIB_BT_MATCHFINDER_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/cpu_features_common.h b/tools/z64compress/src/enc/libdeflate/lib/cpu_features_common.h new file mode 100644 index 000000000..bfcaa3637 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/cpu_features_common.h @@ -0,0 +1,91 @@ +/* + * cpu_features_common.h - code shared by all lib/$arch/cpu_features.c + * + * Copyright 2020 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LIB_CPU_FEATURES_COMMON_H +#define LIB_CPU_FEATURES_COMMON_H + +#if defined(TEST_SUPPORT__DO_NOT_USE) && !defined(FREESTANDING) +# undef _ANSI_SOURCE /* for strdup() and strtok_r() */ +# ifndef __APPLE__ +# define _GNU_SOURCE 1 +# endif +# include +# include +# include +#endif + +#include "lib_common.h" + +struct cpu_feature { + u32 bit; + const char *name; +}; + +#if defined(TEST_SUPPORT__DO_NOT_USE) && !defined(FREESTANDING) +/* Disable any features that are listed in $LIBDEFLATE_DISABLE_CPU_FEATURES. */ +static inline void +disable_cpu_features_for_testing(u32 *features, + const struct cpu_feature *feature_table, + size_t feature_table_length) +{ + char *env_value, *strbuf, *p, *saveptr = NULL; + size_t i; + + env_value = getenv("LIBDEFLATE_DISABLE_CPU_FEATURES"); + if (!env_value) + return; + strbuf = strdup(env_value); + if (!strbuf) + abort(); + p = strtok_r(strbuf, ",", &saveptr); + while (p) { + for (i = 0; i < feature_table_length; i++) { + if (strcmp(p, feature_table[i].name) == 0) { + *features &= ~feature_table[i].bit; + break; + } + } + if (i == feature_table_length) { + fprintf(stderr, + "unrecognized feature in LIBDEFLATE_DISABLE_CPU_FEATURES: \"%s\"\n", + p); + abort(); + } + p = strtok_r(NULL, ",", &saveptr); + } + free(strbuf); +} +#else /* TEST_SUPPORT__DO_NOT_USE */ +static inline void +disable_cpu_features_for_testing(u32 *features, + const struct cpu_feature *feature_table, + size_t feature_table_length) +{ +} +#endif /* !TEST_SUPPORT__DO_NOT_USE */ + +#endif /* LIB_CPU_FEATURES_COMMON_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/crc32.c b/tools/z64compress/src/enc/libdeflate/lib/crc32.c new file mode 100644 index 000000000..61c2cc763 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/crc32.c @@ -0,0 +1,263 @@ +/* + * crc32.c - CRC-32 checksum algorithm for the gzip format + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * High-level description of CRC + * ============================= + * + * Consider a bit sequence 'bits[1...len]'. Interpret 'bits' as the "message" + * polynomial M(x) with coefficients in GF(2) (the field of integers modulo 2), + * where the coefficient of 'x^i' is 'bits[len - i]'. Then, compute: + * + * R(x) = M(x)*x^n mod G(x) + * + * where G(x) is a selected "generator" polynomial of degree 'n'. The remainder + * R(x) is a polynomial of max degree 'n - 1'. The CRC of 'bits' is R(x) + * interpreted as a bitstring of length 'n'. + * + * CRC used in gzip + * ================ + * + * In the gzip format (RFC 1952): + * + * - The bitstring to checksum is formed from the bytes of the uncompressed + * data by concatenating the bits from the bytes in order, proceeding + * from the low-order bit to the high-order bit within each byte. + * + * - The generator polynomial G(x) is: x^32 + x^26 + x^23 + x^22 + x^16 + + * x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1. + * Consequently, the CRC length is 32 bits ("CRC-32"). + * + * - The highest order 32 coefficients of M(x)*x^n are inverted. + * + * - All 32 coefficients of R(x) are inverted. + * + * The two inversions cause added leading and trailing zero bits to affect the + * resulting CRC, whereas with a regular CRC such bits would have no effect on + * the CRC. + * + * Computation and optimizations + * ============================= + * + * We can compute R(x) through "long division", maintaining only 32 bits of + * state at any given time. Multiplication by 'x' can be implemented as + * right-shifting by 1 (assuming the polynomial<=>bitstring mapping where the + * highest order bit represents the coefficient of x^0), and both addition and + * subtraction can be implemented as bitwise exclusive OR (since we are working + * in GF(2)). Here is an unoptimized implementation: + * + * static u32 crc32_gzip(const u8 *p, size_t len) + * { + * u32 crc = 0; + * const u32 divisor = 0xEDB88320; + * + * for (size_t i = 0; i < len * 8 + 32; i++) { + * int bit; + * u32 multiple; + * + * if (i < len * 8) + * bit = (p[i / 8] >> (i % 8)) & 1; + * else + * bit = 0; // one of the 32 appended 0 bits + * + * if (i < 32) // the first 32 bits are inverted + * bit ^= 1; + * + * if (crc & 1) + * multiple = divisor; + * else + * multiple = 0; + * + * crc >>= 1; + * crc |= (u32)bit << 31; + * crc ^= multiple; + * } + * + * return ~crc; + * } + * + * In this implementation, the 32-bit integer 'crc' maintains the remainder of + * the currently processed portion of the message (with 32 zero bits appended) + * when divided by the generator polynomial. 'crc' is the representation of + * R(x), and 'divisor' is the representation of G(x) excluding the x^32 + * coefficient. For each bit to process, we multiply R(x) by 'x^1', then add + * 'x^0' if the new bit is a 1. If this causes R(x) to gain a nonzero x^32 + * term, then we subtract G(x) from R(x). + * + * We can speed this up by taking advantage of the fact that XOR is commutative + * and associative, so the order in which we combine the inputs into 'crc' is + * unimportant. And since each message bit we add doesn't affect the choice of + * 'multiple' until 32 bits later, we need not actually add each message bit + * until that point: + * + * static u32 crc32_gzip(const u8 *p, size_t len) + * { + * u32 crc = ~0; + * const u32 divisor = 0xEDB88320; + * + * for (size_t i = 0; i < len * 8; i++) { + * int bit; + * u32 multiple; + * + * bit = (p[i / 8] >> (i % 8)) & 1; + * crc ^= bit; + * if (crc & 1) + * multiple = divisor; + * else + * multiple = 0; + * crc >>= 1; + * crc ^= multiple; + * } + * + * return ~crc; + * } + * + * With the above implementation we get the effect of 32 appended 0 bits for + * free; they never affect the choice of a divisor, nor would they change the + * value of 'crc' if they were to be actually XOR'ed in. And by starting with a + * remainder of all 1 bits, we get the effect of complementing the first 32 + * message bits. + * + * The next optimization is to process the input in multi-bit units. Suppose + * that we insert the next 'n' message bits into the remainder. Then we get an + * intermediate remainder of length '32 + n' bits, and the CRC of the extra 'n' + * bits is the amount by which the low 32 bits of the remainder will change as a + * result of cancelling out those 'n' bits. Taking n=8 (one byte) and + * precomputing a table containing the CRC of each possible byte, we get + * crc32_slice1() defined below. + * + * As a further optimization, we could increase the multi-bit unit size to 16. + * However, that is inefficient because the table size explodes from 256 entries + * (1024 bytes) to 65536 entries (262144 bytes), which wastes memory and won't + * fit in L1 cache on typical processors. + * + * However, we can actually process 4 bytes at a time using 4 different tables + * with 256 entries each. Logically, we form a 64-bit intermediate remainder + * and cancel out the high 32 bits in 8-bit chunks. Bits 32-39 are cancelled + * out by the CRC of those bits, whereas bits 40-47 are be cancelled out by the + * CRC of those bits with 8 zero bits appended, and so on. + * + * In crc32_slice8(), this method is extended to 8 bytes at a time. The + * intermediate remainder (which we never actually store explicitly) is 96 bits. + * + * On CPUs that support fast carryless multiplication, CRCs can be computed even + * more quickly via "folding". See e.g. the x86 PCLMUL implementation. + */ + +#include "lib_common.h" +#include "libdeflate.h" +#include "crc32_multipliers.h" +#include "crc32_tables.h" + +/* This is the default implementation. It uses the slice-by-8 method. */ +static u32 MAYBE_UNUSED +crc32_slice8(u32 crc, const u8 *p, size_t len) +{ + const u8 * const end = p + len; + const u8 *end64; + + for (; ((uintptr_t)p & 7) && p != end; p++) + crc = (crc >> 8) ^ crc32_slice8_table[(u8)crc ^ *p]; + + end64 = p + ((end - p) & ~7); + for (; p != end64; p += 8) { + u32 v1 = le32_bswap(*(const u32 *)(p + 0)); + u32 v2 = le32_bswap(*(const u32 *)(p + 4)); + + crc = crc32_slice8_table[0x700 + (u8)((crc ^ v1) >> 0)] ^ + crc32_slice8_table[0x600 + (u8)((crc ^ v1) >> 8)] ^ + crc32_slice8_table[0x500 + (u8)((crc ^ v1) >> 16)] ^ + crc32_slice8_table[0x400 + (u8)((crc ^ v1) >> 24)] ^ + crc32_slice8_table[0x300 + (u8)(v2 >> 0)] ^ + crc32_slice8_table[0x200 + (u8)(v2 >> 8)] ^ + crc32_slice8_table[0x100 + (u8)(v2 >> 16)] ^ + crc32_slice8_table[0x000 + (u8)(v2 >> 24)]; + } + + for (; p != end; p++) + crc = (crc >> 8) ^ crc32_slice8_table[(u8)crc ^ *p]; + + return crc; +} + +/* + * This is a more lightweight generic implementation, which can be used as a + * subroutine by architecture-specific implementations to process small amounts + * of unaligned data at the beginning and/or end of the buffer. + */ +static forceinline u32 MAYBE_UNUSED +crc32_slice1(u32 crc, const u8 *p, size_t len) +{ + size_t i; + + for (i = 0; i < len; i++) + crc = (crc >> 8) ^ crc32_slice1_table[(u8)crc ^ p[i]]; + return crc; +} + +/* Include architecture-specific implementation(s) if available. */ +#undef DEFAULT_IMPL +#undef arch_select_crc32_func +typedef u32 (*crc32_func_t)(u32 crc, const u8 *p, size_t len); +#if defined(ARCH_ARM32) || defined(ARCH_ARM64) +# include "arm/crc32_impl.h" +#elif defined(ARCH_X86_32) || defined(ARCH_X86_64) +# include "x86/crc32_impl.h" +#endif + +#ifndef DEFAULT_IMPL +# define DEFAULT_IMPL crc32_slice8 +#endif + +#ifdef arch_select_crc32_func +static u32 dispatch_crc32(u32 crc, const u8 *p, size_t len); + +static volatile crc32_func_t crc32_impl = dispatch_crc32; + +/* Choose the best implementation at runtime. */ +static u32 dispatch_crc32(u32 crc, const u8 *p, size_t len) +{ + crc32_func_t f = arch_select_crc32_func(); + + if (f == NULL) + f = DEFAULT_IMPL; + + crc32_impl = f; + return f(crc, p, len); +} +#else +/* The best implementation is statically known, so call it directly. */ +#define crc32_impl DEFAULT_IMPL +#endif + +LIBDEFLATEAPI u32 +libdeflate_crc32(u32 crc, const void *p, size_t len) +{ + if (p == NULL) /* Return initial value. */ + return 0; + return ~crc32_impl(~crc, p, len); +} diff --git a/tools/z64compress/src/enc/libdeflate/lib/crc32_multipliers.h b/tools/z64compress/src/enc/libdeflate/lib/crc32_multipliers.h new file mode 100644 index 000000000..580b775bd --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/crc32_multipliers.h @@ -0,0 +1,329 @@ +/* + * crc32_multipliers.h - constants for CRC-32 folding + * + * THIS FILE WAS GENERATED BY gen_crc32_multipliers.c. DO NOT EDIT. + */ + +#define CRC32_1VECS_MULT_1 0xae689191 /* x^159 mod G(x) */ +#define CRC32_1VECS_MULT_2 0xccaa009e /* x^95 mod G(x) */ +#define CRC32_1VECS_MULTS { CRC32_1VECS_MULT_1, CRC32_1VECS_MULT_2 } + +#define CRC32_2VECS_MULT_1 0xf1da05aa /* x^287 mod G(x) */ +#define CRC32_2VECS_MULT_2 0x81256527 /* x^223 mod G(x) */ +#define CRC32_2VECS_MULTS { CRC32_2VECS_MULT_1, CRC32_2VECS_MULT_2 } + +#define CRC32_3VECS_MULT_1 0x3db1ecdc /* x^415 mod G(x) */ +#define CRC32_3VECS_MULT_2 0xaf449247 /* x^351 mod G(x) */ +#define CRC32_3VECS_MULTS { CRC32_3VECS_MULT_1, CRC32_3VECS_MULT_2 } + +#define CRC32_4VECS_MULT_1 0x8f352d95 /* x^543 mod G(x) */ +#define CRC32_4VECS_MULT_2 0x1d9513d7 /* x^479 mod G(x) */ +#define CRC32_4VECS_MULTS { CRC32_4VECS_MULT_1, CRC32_4VECS_MULT_2 } + +#define CRC32_5VECS_MULT_1 0x1c279815 /* x^671 mod G(x) */ +#define CRC32_5VECS_MULT_2 0xae0b5394 /* x^607 mod G(x) */ +#define CRC32_5VECS_MULTS { CRC32_5VECS_MULT_1, CRC32_5VECS_MULT_2 } + +#define CRC32_6VECS_MULT_1 0xdf068dc2 /* x^799 mod G(x) */ +#define CRC32_6VECS_MULT_2 0x57c54819 /* x^735 mod G(x) */ +#define CRC32_6VECS_MULTS { CRC32_6VECS_MULT_1, CRC32_6VECS_MULT_2 } + +#define CRC32_7VECS_MULT_1 0x31f8303f /* x^927 mod G(x) */ +#define CRC32_7VECS_MULT_2 0x0cbec0ed /* x^863 mod G(x) */ +#define CRC32_7VECS_MULTS { CRC32_7VECS_MULT_1, CRC32_7VECS_MULT_2 } + +#define CRC32_8VECS_MULT_1 0x33fff533 /* x^1055 mod G(x) */ +#define CRC32_8VECS_MULT_2 0x910eeec1 /* x^991 mod G(x) */ +#define CRC32_8VECS_MULTS { CRC32_8VECS_MULT_1, CRC32_8VECS_MULT_2 } + +#define CRC32_9VECS_MULT_1 0x26b70c3d /* x^1183 mod G(x) */ +#define CRC32_9VECS_MULT_2 0x3f41287a /* x^1119 mod G(x) */ +#define CRC32_9VECS_MULTS { CRC32_9VECS_MULT_1, CRC32_9VECS_MULT_2 } + +#define CRC32_10VECS_MULT_1 0xe3543be0 /* x^1311 mod G(x) */ +#define CRC32_10VECS_MULT_2 0x9026d5b1 /* x^1247 mod G(x) */ +#define CRC32_10VECS_MULTS { CRC32_10VECS_MULT_1, CRC32_10VECS_MULT_2 } + +#define CRC32_11VECS_MULT_1 0x5a1bb05d /* x^1439 mod G(x) */ +#define CRC32_11VECS_MULT_2 0xd1df2327 /* x^1375 mod G(x) */ +#define CRC32_11VECS_MULTS { CRC32_11VECS_MULT_1, CRC32_11VECS_MULT_2 } + +#define CRC32_12VECS_MULT_1 0x596c8d81 /* x^1567 mod G(x) */ +#define CRC32_12VECS_MULT_2 0xf5e48c85 /* x^1503 mod G(x) */ +#define CRC32_12VECS_MULTS { CRC32_12VECS_MULT_1, CRC32_12VECS_MULT_2 } + +#define CRC32_FINAL_MULT 0xb8bc6765 /* x^63 mod G(x) */ +#define CRC32_BARRETT_CONSTANT_1 0x00000001f7011641ULL /* floor(x^64 / G(x)) */ +#define CRC32_BARRETT_CONSTANT_2 0x00000001db710641ULL /* G(x) */ +#define CRC32_BARRETT_CONSTANTS { CRC32_BARRETT_CONSTANT_1, CRC32_BARRETT_CONSTANT_2 } + +#define CRC32_NUM_CHUNKS 4 +#define CRC32_MIN_VARIABLE_CHUNK_LEN 128UL +#define CRC32_MAX_VARIABLE_CHUNK_LEN 16384UL + +/* Multipliers for implementations that use a variable chunk length */ +static const u32 crc32_mults_for_chunklen[][CRC32_NUM_CHUNKS - 1] MAYBE_UNUSED = { + { 0 /* unused row */ }, + /* chunk_len=128 */ + { 0xd31343ea /* x^3039 mod G(x) */, 0xe95c1271 /* x^2015 mod G(x) */, 0x910eeec1 /* x^991 mod G(x) */, }, + /* chunk_len=256 */ + { 0x1d6708a0 /* x^6111 mod G(x) */, 0x0c30f51d /* x^4063 mod G(x) */, 0xe95c1271 /* x^2015 mod G(x) */, }, + /* chunk_len=384 */ + { 0xdb3839f3 /* x^9183 mod G(x) */, 0x1d6708a0 /* x^6111 mod G(x) */, 0xd31343ea /* x^3039 mod G(x) */, }, + /* chunk_len=512 */ + { 0x1753ab84 /* x^12255 mod G(x) */, 0xbbf2f6d6 /* x^8159 mod G(x) */, 0x0c30f51d /* x^4063 mod G(x) */, }, + /* chunk_len=640 */ + { 0x3796455c /* x^15327 mod G(x) */, 0xb8e0e4a8 /* x^10207 mod G(x) */, 0xc352f6de /* x^5087 mod G(x) */, }, + /* chunk_len=768 */ + { 0x3954de39 /* x^18399 mod G(x) */, 0x1753ab84 /* x^12255 mod G(x) */, 0x1d6708a0 /* x^6111 mod G(x) */, }, + /* chunk_len=896 */ + { 0x632d78c5 /* x^21471 mod G(x) */, 0x3fc33de4 /* x^14303 mod G(x) */, 0x9a1b53c8 /* x^7135 mod G(x) */, }, + /* chunk_len=1024 */ + { 0xa0decef3 /* x^24543 mod G(x) */, 0x7b4aa8b7 /* x^16351 mod G(x) */, 0xbbf2f6d6 /* x^8159 mod G(x) */, }, + /* chunk_len=1152 */ + { 0xe9c09bb0 /* x^27615 mod G(x) */, 0x3954de39 /* x^18399 mod G(x) */, 0xdb3839f3 /* x^9183 mod G(x) */, }, + /* chunk_len=1280 */ + { 0xd51917a4 /* x^30687 mod G(x) */, 0xcae68461 /* x^20447 mod G(x) */, 0xb8e0e4a8 /* x^10207 mod G(x) */, }, + /* chunk_len=1408 */ + { 0x154a8a62 /* x^33759 mod G(x) */, 0x41e7589c /* x^22495 mod G(x) */, 0x3e9a43cd /* x^11231 mod G(x) */, }, + /* chunk_len=1536 */ + { 0xf196555d /* x^36831 mod G(x) */, 0xa0decef3 /* x^24543 mod G(x) */, 0x1753ab84 /* x^12255 mod G(x) */, }, + /* chunk_len=1664 */ + { 0x8eec2999 /* x^39903 mod G(x) */, 0xefb0a128 /* x^26591 mod G(x) */, 0x6044fbb0 /* x^13279 mod G(x) */, }, + /* chunk_len=1792 */ + { 0x27892abf /* x^42975 mod G(x) */, 0x48d72bb1 /* x^28639 mod G(x) */, 0x3fc33de4 /* x^14303 mod G(x) */, }, + /* chunk_len=1920 */ + { 0x77bc2419 /* x^46047 mod G(x) */, 0xd51917a4 /* x^30687 mod G(x) */, 0x3796455c /* x^15327 mod G(x) */, }, + /* chunk_len=2048 */ + { 0xcea114a5 /* x^49119 mod G(x) */, 0x68c0a2c5 /* x^32735 mod G(x) */, 0x7b4aa8b7 /* x^16351 mod G(x) */, }, + /* chunk_len=2176 */ + { 0xa1077e85 /* x^52191 mod G(x) */, 0x188cc628 /* x^34783 mod G(x) */, 0x0c21f835 /* x^17375 mod G(x) */, }, + /* chunk_len=2304 */ + { 0xc5ed75e1 /* x^55263 mod G(x) */, 0xf196555d /* x^36831 mod G(x) */, 0x3954de39 /* x^18399 mod G(x) */, }, + /* chunk_len=2432 */ + { 0xca4fba3f /* x^58335 mod G(x) */, 0x0acfa26f /* x^38879 mod G(x) */, 0x6cb21510 /* x^19423 mod G(x) */, }, + /* chunk_len=2560 */ + { 0xcf5bcdc4 /* x^61407 mod G(x) */, 0x4fae7fc0 /* x^40927 mod G(x) */, 0xcae68461 /* x^20447 mod G(x) */, }, + /* chunk_len=2688 */ + { 0xf36b9d16 /* x^64479 mod G(x) */, 0x27892abf /* x^42975 mod G(x) */, 0x632d78c5 /* x^21471 mod G(x) */, }, + /* chunk_len=2816 */ + { 0xf76fd988 /* x^67551 mod G(x) */, 0xed5c39b1 /* x^45023 mod G(x) */, 0x41e7589c /* x^22495 mod G(x) */, }, + /* chunk_len=2944 */ + { 0x6c45d92e /* x^70623 mod G(x) */, 0xff809fcd /* x^47071 mod G(x) */, 0x0c46baec /* x^23519 mod G(x) */, }, + /* chunk_len=3072 */ + { 0x6116b82b /* x^73695 mod G(x) */, 0xcea114a5 /* x^49119 mod G(x) */, 0xa0decef3 /* x^24543 mod G(x) */, }, + /* chunk_len=3200 */ + { 0x4d9899bb /* x^76767 mod G(x) */, 0x9f9d8d9c /* x^51167 mod G(x) */, 0x53deb236 /* x^25567 mod G(x) */, }, + /* chunk_len=3328 */ + { 0x3e7c93b9 /* x^79839 mod G(x) */, 0x6666b805 /* x^53215 mod G(x) */, 0xefb0a128 /* x^26591 mod G(x) */, }, + /* chunk_len=3456 */ + { 0x388b20ac /* x^82911 mod G(x) */, 0xc5ed75e1 /* x^55263 mod G(x) */, 0xe9c09bb0 /* x^27615 mod G(x) */, }, + /* chunk_len=3584 */ + { 0x0956d953 /* x^85983 mod G(x) */, 0x97fbdb14 /* x^57311 mod G(x) */, 0x48d72bb1 /* x^28639 mod G(x) */, }, + /* chunk_len=3712 */ + { 0x55cb4dfe /* x^89055 mod G(x) */, 0x1b37c832 /* x^59359 mod G(x) */, 0xc07331b3 /* x^29663 mod G(x) */, }, + /* chunk_len=3840 */ + { 0x52222fea /* x^92127 mod G(x) */, 0xcf5bcdc4 /* x^61407 mod G(x) */, 0xd51917a4 /* x^30687 mod G(x) */, }, + /* chunk_len=3968 */ + { 0x0603989b /* x^95199 mod G(x) */, 0xb03c8112 /* x^63455 mod G(x) */, 0x5e04b9a5 /* x^31711 mod G(x) */, }, + /* chunk_len=4096 */ + { 0x4470c029 /* x^98271 mod G(x) */, 0x2339d155 /* x^65503 mod G(x) */, 0x68c0a2c5 /* x^32735 mod G(x) */, }, + /* chunk_len=4224 */ + { 0xb6f35093 /* x^101343 mod G(x) */, 0xf76fd988 /* x^67551 mod G(x) */, 0x154a8a62 /* x^33759 mod G(x) */, }, + /* chunk_len=4352 */ + { 0xc46805ba /* x^104415 mod G(x) */, 0x416f9449 /* x^69599 mod G(x) */, 0x188cc628 /* x^34783 mod G(x) */, }, + /* chunk_len=4480 */ + { 0xc3876592 /* x^107487 mod G(x) */, 0x4b809189 /* x^71647 mod G(x) */, 0xc35cf6e7 /* x^35807 mod G(x) */, }, + /* chunk_len=4608 */ + { 0x5b0c98b9 /* x^110559 mod G(x) */, 0x6116b82b /* x^73695 mod G(x) */, 0xf196555d /* x^36831 mod G(x) */, }, + /* chunk_len=4736 */ + { 0x30d13e5f /* x^113631 mod G(x) */, 0x4c5a315a /* x^75743 mod G(x) */, 0x8c224466 /* x^37855 mod G(x) */, }, + /* chunk_len=4864 */ + { 0x54afca53 /* x^116703 mod G(x) */, 0xbccfa2c1 /* x^77791 mod G(x) */, 0x0acfa26f /* x^38879 mod G(x) */, }, + /* chunk_len=4992 */ + { 0x93102436 /* x^119775 mod G(x) */, 0x3e7c93b9 /* x^79839 mod G(x) */, 0x8eec2999 /* x^39903 mod G(x) */, }, + /* chunk_len=5120 */ + { 0xbd2655a8 /* x^122847 mod G(x) */, 0x3e116c9d /* x^81887 mod G(x) */, 0x4fae7fc0 /* x^40927 mod G(x) */, }, + /* chunk_len=5248 */ + { 0x70cd7f26 /* x^125919 mod G(x) */, 0x408e57f2 /* x^83935 mod G(x) */, 0x1691be45 /* x^41951 mod G(x) */, }, + /* chunk_len=5376 */ + { 0x2d546c53 /* x^128991 mod G(x) */, 0x0956d953 /* x^85983 mod G(x) */, 0x27892abf /* x^42975 mod G(x) */, }, + /* chunk_len=5504 */ + { 0xb53410a8 /* x^132063 mod G(x) */, 0x42ebf0ad /* x^88031 mod G(x) */, 0x161f3c12 /* x^43999 mod G(x) */, }, + /* chunk_len=5632 */ + { 0x67a93f75 /* x^135135 mod G(x) */, 0xcf3233e4 /* x^90079 mod G(x) */, 0xed5c39b1 /* x^45023 mod G(x) */, }, + /* chunk_len=5760 */ + { 0x9830ac33 /* x^138207 mod G(x) */, 0x52222fea /* x^92127 mod G(x) */, 0x77bc2419 /* x^46047 mod G(x) */, }, + /* chunk_len=5888 */ + { 0xb0b6fc3e /* x^141279 mod G(x) */, 0x2fde73f8 /* x^94175 mod G(x) */, 0xff809fcd /* x^47071 mod G(x) */, }, + /* chunk_len=6016 */ + { 0x84170f16 /* x^144351 mod G(x) */, 0xced90d99 /* x^96223 mod G(x) */, 0x30de0f98 /* x^48095 mod G(x) */, }, + /* chunk_len=6144 */ + { 0xd7017a0c /* x^147423 mod G(x) */, 0x4470c029 /* x^98271 mod G(x) */, 0xcea114a5 /* x^49119 mod G(x) */, }, + /* chunk_len=6272 */ + { 0xadb25de6 /* x^150495 mod G(x) */, 0x84f40beb /* x^100319 mod G(x) */, 0x2b7e0e1b /* x^50143 mod G(x) */, }, + /* chunk_len=6400 */ + { 0x8282fddc /* x^153567 mod G(x) */, 0xec855937 /* x^102367 mod G(x) */, 0x9f9d8d9c /* x^51167 mod G(x) */, }, + /* chunk_len=6528 */ + { 0x46362bee /* x^156639 mod G(x) */, 0xc46805ba /* x^104415 mod G(x) */, 0xa1077e85 /* x^52191 mod G(x) */, }, + /* chunk_len=6656 */ + { 0xb9077a01 /* x^159711 mod G(x) */, 0xdf7a24ac /* x^106463 mod G(x) */, 0x6666b805 /* x^53215 mod G(x) */, }, + /* chunk_len=6784 */ + { 0xf51d9bc6 /* x^162783 mod G(x) */, 0x2b52dc39 /* x^108511 mod G(x) */, 0x7e774cf6 /* x^54239 mod G(x) */, }, + /* chunk_len=6912 */ + { 0x4ca19a29 /* x^165855 mod G(x) */, 0x5b0c98b9 /* x^110559 mod G(x) */, 0xc5ed75e1 /* x^55263 mod G(x) */, }, + /* chunk_len=7040 */ + { 0xdc0fc3fc /* x^168927 mod G(x) */, 0xb939fcdf /* x^112607 mod G(x) */, 0x3678fed2 /* x^56287 mod G(x) */, }, + /* chunk_len=7168 */ + { 0x63c3d167 /* x^171999 mod G(x) */, 0x70f9947d /* x^114655 mod G(x) */, 0x97fbdb14 /* x^57311 mod G(x) */, }, + /* chunk_len=7296 */ + { 0x5851d254 /* x^175071 mod G(x) */, 0x54afca53 /* x^116703 mod G(x) */, 0xca4fba3f /* x^58335 mod G(x) */, }, + /* chunk_len=7424 */ + { 0xfeacf2a1 /* x^178143 mod G(x) */, 0x7a3c0a6a /* x^118751 mod G(x) */, 0x1b37c832 /* x^59359 mod G(x) */, }, + /* chunk_len=7552 */ + { 0x93b7edc8 /* x^181215 mod G(x) */, 0x1fea4d2a /* x^120799 mod G(x) */, 0x58fa96ee /* x^60383 mod G(x) */, }, + /* chunk_len=7680 */ + { 0x5539e44a /* x^184287 mod G(x) */, 0xbd2655a8 /* x^122847 mod G(x) */, 0xcf5bcdc4 /* x^61407 mod G(x) */, }, + /* chunk_len=7808 */ + { 0xde32a3d2 /* x^187359 mod G(x) */, 0x4ff61aa1 /* x^124895 mod G(x) */, 0x6a6a3694 /* x^62431 mod G(x) */, }, + /* chunk_len=7936 */ + { 0xf0baeeb6 /* x^190431 mod G(x) */, 0x7ae2f6f4 /* x^126943 mod G(x) */, 0xb03c8112 /* x^63455 mod G(x) */, }, + /* chunk_len=8064 */ + { 0xbe15887f /* x^193503 mod G(x) */, 0x2d546c53 /* x^128991 mod G(x) */, 0xf36b9d16 /* x^64479 mod G(x) */, }, + /* chunk_len=8192 */ + { 0x64f34a05 /* x^196575 mod G(x) */, 0xe0ee5efe /* x^131039 mod G(x) */, 0x2339d155 /* x^65503 mod G(x) */, }, + /* chunk_len=8320 */ + { 0x1b6d1aea /* x^199647 mod G(x) */, 0xfeafb67c /* x^133087 mod G(x) */, 0x4fb001a8 /* x^66527 mod G(x) */, }, + /* chunk_len=8448 */ + { 0x82adb0b8 /* x^202719 mod G(x) */, 0x67a93f75 /* x^135135 mod G(x) */, 0xf76fd988 /* x^67551 mod G(x) */, }, + /* chunk_len=8576 */ + { 0x694587c7 /* x^205791 mod G(x) */, 0x3b34408b /* x^137183 mod G(x) */, 0xeccb2978 /* x^68575 mod G(x) */, }, + /* chunk_len=8704 */ + { 0xd2fc57c3 /* x^208863 mod G(x) */, 0x07fcf8c6 /* x^139231 mod G(x) */, 0x416f9449 /* x^69599 mod G(x) */, }, + /* chunk_len=8832 */ + { 0x9dd6837c /* x^211935 mod G(x) */, 0xb0b6fc3e /* x^141279 mod G(x) */, 0x6c45d92e /* x^70623 mod G(x) */, }, + /* chunk_len=8960 */ + { 0x3a9d1f97 /* x^215007 mod G(x) */, 0xefd033b2 /* x^143327 mod G(x) */, 0x4b809189 /* x^71647 mod G(x) */, }, + /* chunk_len=9088 */ + { 0x1eee1d2a /* x^218079 mod G(x) */, 0xf2a6e46e /* x^145375 mod G(x) */, 0x55b4c814 /* x^72671 mod G(x) */, }, + /* chunk_len=9216 */ + { 0xb57c7728 /* x^221151 mod G(x) */, 0xd7017a0c /* x^147423 mod G(x) */, 0x6116b82b /* x^73695 mod G(x) */, }, + /* chunk_len=9344 */ + { 0xf2fc5d61 /* x^224223 mod G(x) */, 0x242aac86 /* x^149471 mod G(x) */, 0x05245cf0 /* x^74719 mod G(x) */, }, + /* chunk_len=9472 */ + { 0x26387824 /* x^227295 mod G(x) */, 0xc15c4ca5 /* x^151519 mod G(x) */, 0x4c5a315a /* x^75743 mod G(x) */, }, + /* chunk_len=9600 */ + { 0x8c151e77 /* x^230367 mod G(x) */, 0x8282fddc /* x^153567 mod G(x) */, 0x4d9899bb /* x^76767 mod G(x) */, }, + /* chunk_len=9728 */ + { 0x8ea1f680 /* x^233439 mod G(x) */, 0xf5ff6cdd /* x^155615 mod G(x) */, 0xbccfa2c1 /* x^77791 mod G(x) */, }, + /* chunk_len=9856 */ + { 0xe8cf3d2a /* x^236511 mod G(x) */, 0x338b1fb1 /* x^157663 mod G(x) */, 0xeda61f70 /* x^78815 mod G(x) */, }, + /* chunk_len=9984 */ + { 0x21f15b59 /* x^239583 mod G(x) */, 0xb9077a01 /* x^159711 mod G(x) */, 0x3e7c93b9 /* x^79839 mod G(x) */, }, + /* chunk_len=10112 */ + { 0x6f68d64a /* x^242655 mod G(x) */, 0x901b0161 /* x^161759 mod G(x) */, 0xb9fd3537 /* x^80863 mod G(x) */, }, + /* chunk_len=10240 */ + { 0x71b74d95 /* x^245727 mod G(x) */, 0xf5ddd5ad /* x^163807 mod G(x) */, 0x3e116c9d /* x^81887 mod G(x) */, }, + /* chunk_len=10368 */ + { 0x4c2e7261 /* x^248799 mod G(x) */, 0x4ca19a29 /* x^165855 mod G(x) */, 0x388b20ac /* x^82911 mod G(x) */, }, + /* chunk_len=10496 */ + { 0x8a2d38e8 /* x^251871 mod G(x) */, 0xd27ee0a1 /* x^167903 mod G(x) */, 0x408e57f2 /* x^83935 mod G(x) */, }, + /* chunk_len=10624 */ + { 0x7e58ca17 /* x^254943 mod G(x) */, 0x69dfedd2 /* x^169951 mod G(x) */, 0x3a76805e /* x^84959 mod G(x) */, }, + /* chunk_len=10752 */ + { 0xf997967f /* x^258015 mod G(x) */, 0x63c3d167 /* x^171999 mod G(x) */, 0x0956d953 /* x^85983 mod G(x) */, }, + /* chunk_len=10880 */ + { 0x48215963 /* x^261087 mod G(x) */, 0x71e1dfe0 /* x^174047 mod G(x) */, 0x42a6d410 /* x^87007 mod G(x) */, }, + /* chunk_len=11008 */ + { 0xa704b94c /* x^264159 mod G(x) */, 0x679f198a /* x^176095 mod G(x) */, 0x42ebf0ad /* x^88031 mod G(x) */, }, + /* chunk_len=11136 */ + { 0x1d699056 /* x^267231 mod G(x) */, 0xfeacf2a1 /* x^178143 mod G(x) */, 0x55cb4dfe /* x^89055 mod G(x) */, }, + /* chunk_len=11264 */ + { 0x6800bcc5 /* x^270303 mod G(x) */, 0x16024f15 /* x^180191 mod G(x) */, 0xcf3233e4 /* x^90079 mod G(x) */, }, + /* chunk_len=11392 */ + { 0x2d48e4ca /* x^273375 mod G(x) */, 0xbe61582f /* x^182239 mod G(x) */, 0x46026283 /* x^91103 mod G(x) */, }, + /* chunk_len=11520 */ + { 0x4c4c2b55 /* x^276447 mod G(x) */, 0x5539e44a /* x^184287 mod G(x) */, 0x52222fea /* x^92127 mod G(x) */, }, + /* chunk_len=11648 */ + { 0xd8ce94cb /* x^279519 mod G(x) */, 0xbc613c26 /* x^186335 mod G(x) */, 0x33776b4b /* x^93151 mod G(x) */, }, + /* chunk_len=11776 */ + { 0xd0b5a02b /* x^282591 mod G(x) */, 0x490d3cc6 /* x^188383 mod G(x) */, 0x2fde73f8 /* x^94175 mod G(x) */, }, + /* chunk_len=11904 */ + { 0xa223f7ec /* x^285663 mod G(x) */, 0xf0baeeb6 /* x^190431 mod G(x) */, 0x0603989b /* x^95199 mod G(x) */, }, + /* chunk_len=12032 */ + { 0x58de337a /* x^288735 mod G(x) */, 0x3bf3d597 /* x^192479 mod G(x) */, 0xced90d99 /* x^96223 mod G(x) */, }, + /* chunk_len=12160 */ + { 0x37f5d8f4 /* x^291807 mod G(x) */, 0x4d5b699b /* x^194527 mod G(x) */, 0xd7262e5f /* x^97247 mod G(x) */, }, + /* chunk_len=12288 */ + { 0xfa8a435d /* x^294879 mod G(x) */, 0x64f34a05 /* x^196575 mod G(x) */, 0x4470c029 /* x^98271 mod G(x) */, }, + /* chunk_len=12416 */ + { 0x238709fe /* x^297951 mod G(x) */, 0x52e7458f /* x^198623 mod G(x) */, 0x9a174cd3 /* x^99295 mod G(x) */, }, + /* chunk_len=12544 */ + { 0x9e1ba6f5 /* x^301023 mod G(x) */, 0xef0272f7 /* x^200671 mod G(x) */, 0x84f40beb /* x^100319 mod G(x) */, }, + /* chunk_len=12672 */ + { 0xcd8b57fa /* x^304095 mod G(x) */, 0x82adb0b8 /* x^202719 mod G(x) */, 0xb6f35093 /* x^101343 mod G(x) */, }, + /* chunk_len=12800 */ + { 0x0aed142f /* x^307167 mod G(x) */, 0xb1650290 /* x^204767 mod G(x) */, 0xec855937 /* x^102367 mod G(x) */, }, + /* chunk_len=12928 */ + { 0xd1f064db /* x^310239 mod G(x) */, 0x6e7340d3 /* x^206815 mod G(x) */, 0x5c28cb52 /* x^103391 mod G(x) */, }, + /* chunk_len=13056 */ + { 0x464ac895 /* x^313311 mod G(x) */, 0xd2fc57c3 /* x^208863 mod G(x) */, 0xc46805ba /* x^104415 mod G(x) */, }, + /* chunk_len=13184 */ + { 0xa0e6beea /* x^316383 mod G(x) */, 0xcfeec3d0 /* x^210911 mod G(x) */, 0x0225d214 /* x^105439 mod G(x) */, }, + /* chunk_len=13312 */ + { 0x78703ce0 /* x^319455 mod G(x) */, 0xc60f6075 /* x^212959 mod G(x) */, 0xdf7a24ac /* x^106463 mod G(x) */, }, + /* chunk_len=13440 */ + { 0xfea48165 /* x^322527 mod G(x) */, 0x3a9d1f97 /* x^215007 mod G(x) */, 0xc3876592 /* x^107487 mod G(x) */, }, + /* chunk_len=13568 */ + { 0xdb89b8db /* x^325599 mod G(x) */, 0xa6172211 /* x^217055 mod G(x) */, 0x2b52dc39 /* x^108511 mod G(x) */, }, + /* chunk_len=13696 */ + { 0x7ca03731 /* x^328671 mod G(x) */, 0x1db42849 /* x^219103 mod G(x) */, 0xc5df246e /* x^109535 mod G(x) */, }, + /* chunk_len=13824 */ + { 0x8801d0aa /* x^331743 mod G(x) */, 0xb57c7728 /* x^221151 mod G(x) */, 0x5b0c98b9 /* x^110559 mod G(x) */, }, + /* chunk_len=13952 */ + { 0xf89cd7f0 /* x^334815 mod G(x) */, 0xcc396a0b /* x^223199 mod G(x) */, 0xdb799c51 /* x^111583 mod G(x) */, }, + /* chunk_len=14080 */ + { 0x1611a808 /* x^337887 mod G(x) */, 0xaeae6105 /* x^225247 mod G(x) */, 0xb939fcdf /* x^112607 mod G(x) */, }, + /* chunk_len=14208 */ + { 0xe3cdb888 /* x^340959 mod G(x) */, 0x26387824 /* x^227295 mod G(x) */, 0x30d13e5f /* x^113631 mod G(x) */, }, + /* chunk_len=14336 */ + { 0x552a4cf6 /* x^344031 mod G(x) */, 0xee2d04bb /* x^229343 mod G(x) */, 0x70f9947d /* x^114655 mod G(x) */, }, + /* chunk_len=14464 */ + { 0x85e248e9 /* x^347103 mod G(x) */, 0x0a79663f /* x^231391 mod G(x) */, 0x53339cf7 /* x^115679 mod G(x) */, }, + /* chunk_len=14592 */ + { 0x1c61c3e9 /* x^350175 mod G(x) */, 0x8ea1f680 /* x^233439 mod G(x) */, 0x54afca53 /* x^116703 mod G(x) */, }, + /* chunk_len=14720 */ + { 0xb14cfc2b /* x^353247 mod G(x) */, 0x2e073302 /* x^235487 mod G(x) */, 0x10897992 /* x^117727 mod G(x) */, }, + /* chunk_len=14848 */ + { 0x6ec444cc /* x^356319 mod G(x) */, 0x9e819f13 /* x^237535 mod G(x) */, 0x7a3c0a6a /* x^118751 mod G(x) */, }, + /* chunk_len=14976 */ + { 0xe2fa5f80 /* x^359391 mod G(x) */, 0x21f15b59 /* x^239583 mod G(x) */, 0x93102436 /* x^119775 mod G(x) */, }, + /* chunk_len=15104 */ + { 0x6d33f4c6 /* x^362463 mod G(x) */, 0x31a27455 /* x^241631 mod G(x) */, 0x1fea4d2a /* x^120799 mod G(x) */, }, + /* chunk_len=15232 */ + { 0xb6dec609 /* x^365535 mod G(x) */, 0x4d437056 /* x^243679 mod G(x) */, 0x42eb1e2a /* x^121823 mod G(x) */, }, + /* chunk_len=15360 */ + { 0x1846c518 /* x^368607 mod G(x) */, 0x71b74d95 /* x^245727 mod G(x) */, 0xbd2655a8 /* x^122847 mod G(x) */, }, + /* chunk_len=15488 */ + { 0x9f947f8a /* x^371679 mod G(x) */, 0x2b501619 /* x^247775 mod G(x) */, 0xa4924b0e /* x^123871 mod G(x) */, }, + /* chunk_len=15616 */ + { 0xb7442f4d /* x^374751 mod G(x) */, 0xba30a5d8 /* x^249823 mod G(x) */, 0x4ff61aa1 /* x^124895 mod G(x) */, }, + /* chunk_len=15744 */ + { 0xe2c93242 /* x^377823 mod G(x) */, 0x8a2d38e8 /* x^251871 mod G(x) */, 0x70cd7f26 /* x^125919 mod G(x) */, }, + /* chunk_len=15872 */ + { 0xcd6863df /* x^380895 mod G(x) */, 0x78fd88dc /* x^253919 mod G(x) */, 0x7ae2f6f4 /* x^126943 mod G(x) */, }, + /* chunk_len=16000 */ + { 0xd512001d /* x^383967 mod G(x) */, 0xe6612dff /* x^255967 mod G(x) */, 0x5c4d0ca9 /* x^127967 mod G(x) */, }, + /* chunk_len=16128 */ + { 0x4e8d6b6c /* x^387039 mod G(x) */, 0xf997967f /* x^258015 mod G(x) */, 0x2d546c53 /* x^128991 mod G(x) */, }, + /* chunk_len=16256 */ + { 0xfa653ba1 /* x^390111 mod G(x) */, 0xc99014d4 /* x^260063 mod G(x) */, 0xa0c9fd27 /* x^130015 mod G(x) */, }, + /* chunk_len=16384 */ + { 0x49893408 /* x^393183 mod G(x) */, 0x29c2448b /* x^262111 mod G(x) */, 0xe0ee5efe /* x^131039 mod G(x) */, }, +}; + +/* Multipliers for implementations that use a large fixed chunk length */ +#define CRC32_FIXED_CHUNK_LEN 32768UL +#define CRC32_FIXED_CHUNK_MULT_1 0x29c2448b /* x^262111 mod G(x) */ +#define CRC32_FIXED_CHUNK_MULT_2 0x4b912f53 /* x^524255 mod G(x) */ +#define CRC32_FIXED_CHUNK_MULT_3 0x454c93be /* x^786399 mod G(x) */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/crc32_tables.h b/tools/z64compress/src/enc/libdeflate/lib/crc32_tables.h new file mode 100644 index 000000000..86228c72a --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/crc32_tables.h @@ -0,0 +1,587 @@ +/* + * crc32_tables.h - data tables for CRC-32 computation + * + * THIS FILE WAS GENERATED BY gen_crc32_tables.c. DO NOT EDIT. + */ + +static const u32 crc32_slice1_table[] MAYBE_UNUSED = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, + 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, + 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, + 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, + 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, + 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, + 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, + 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, + 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, + 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, + 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, + 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, + 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, + 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, + 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, +}; + +static const u32 crc32_slice8_table[] MAYBE_UNUSED = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, + 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, + 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, + 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, + 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, + 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, + 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, + 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, + 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, + 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, + 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, + 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, + 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, + 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, + 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, + 0x00000000, 0x191b3141, 0x32366282, 0x2b2d53c3, + 0x646cc504, 0x7d77f445, 0x565aa786, 0x4f4196c7, + 0xc8d98a08, 0xd1c2bb49, 0xfaefe88a, 0xe3f4d9cb, + 0xacb54f0c, 0xb5ae7e4d, 0x9e832d8e, 0x87981ccf, + 0x4ac21251, 0x53d92310, 0x78f470d3, 0x61ef4192, + 0x2eaed755, 0x37b5e614, 0x1c98b5d7, 0x05838496, + 0x821b9859, 0x9b00a918, 0xb02dfadb, 0xa936cb9a, + 0xe6775d5d, 0xff6c6c1c, 0xd4413fdf, 0xcd5a0e9e, + 0x958424a2, 0x8c9f15e3, 0xa7b24620, 0xbea97761, + 0xf1e8e1a6, 0xe8f3d0e7, 0xc3de8324, 0xdac5b265, + 0x5d5daeaa, 0x44469feb, 0x6f6bcc28, 0x7670fd69, + 0x39316bae, 0x202a5aef, 0x0b07092c, 0x121c386d, + 0xdf4636f3, 0xc65d07b2, 0xed705471, 0xf46b6530, + 0xbb2af3f7, 0xa231c2b6, 0x891c9175, 0x9007a034, + 0x179fbcfb, 0x0e848dba, 0x25a9de79, 0x3cb2ef38, + 0x73f379ff, 0x6ae848be, 0x41c51b7d, 0x58de2a3c, + 0xf0794f05, 0xe9627e44, 0xc24f2d87, 0xdb541cc6, + 0x94158a01, 0x8d0ebb40, 0xa623e883, 0xbf38d9c2, + 0x38a0c50d, 0x21bbf44c, 0x0a96a78f, 0x138d96ce, + 0x5ccc0009, 0x45d73148, 0x6efa628b, 0x77e153ca, + 0xbabb5d54, 0xa3a06c15, 0x888d3fd6, 0x91960e97, + 0xded79850, 0xc7cca911, 0xece1fad2, 0xf5facb93, + 0x7262d75c, 0x6b79e61d, 0x4054b5de, 0x594f849f, + 0x160e1258, 0x0f152319, 0x243870da, 0x3d23419b, + 0x65fd6ba7, 0x7ce65ae6, 0x57cb0925, 0x4ed03864, + 0x0191aea3, 0x188a9fe2, 0x33a7cc21, 0x2abcfd60, + 0xad24e1af, 0xb43fd0ee, 0x9f12832d, 0x8609b26c, + 0xc94824ab, 0xd05315ea, 0xfb7e4629, 0xe2657768, + 0x2f3f79f6, 0x362448b7, 0x1d091b74, 0x04122a35, + 0x4b53bcf2, 0x52488db3, 0x7965de70, 0x607eef31, + 0xe7e6f3fe, 0xfefdc2bf, 0xd5d0917c, 0xcccba03d, + 0x838a36fa, 0x9a9107bb, 0xb1bc5478, 0xa8a76539, + 0x3b83984b, 0x2298a90a, 0x09b5fac9, 0x10aecb88, + 0x5fef5d4f, 0x46f46c0e, 0x6dd93fcd, 0x74c20e8c, + 0xf35a1243, 0xea412302, 0xc16c70c1, 0xd8774180, + 0x9736d747, 0x8e2de606, 0xa500b5c5, 0xbc1b8484, + 0x71418a1a, 0x685abb5b, 0x4377e898, 0x5a6cd9d9, + 0x152d4f1e, 0x0c367e5f, 0x271b2d9c, 0x3e001cdd, + 0xb9980012, 0xa0833153, 0x8bae6290, 0x92b553d1, + 0xddf4c516, 0xc4eff457, 0xefc2a794, 0xf6d996d5, + 0xae07bce9, 0xb71c8da8, 0x9c31de6b, 0x852aef2a, + 0xca6b79ed, 0xd37048ac, 0xf85d1b6f, 0xe1462a2e, + 0x66de36e1, 0x7fc507a0, 0x54e85463, 0x4df36522, + 0x02b2f3e5, 0x1ba9c2a4, 0x30849167, 0x299fa026, + 0xe4c5aeb8, 0xfdde9ff9, 0xd6f3cc3a, 0xcfe8fd7b, + 0x80a96bbc, 0x99b25afd, 0xb29f093e, 0xab84387f, + 0x2c1c24b0, 0x350715f1, 0x1e2a4632, 0x07317773, + 0x4870e1b4, 0x516bd0f5, 0x7a468336, 0x635db277, + 0xcbfad74e, 0xd2e1e60f, 0xf9ccb5cc, 0xe0d7848d, + 0xaf96124a, 0xb68d230b, 0x9da070c8, 0x84bb4189, + 0x03235d46, 0x1a386c07, 0x31153fc4, 0x280e0e85, + 0x674f9842, 0x7e54a903, 0x5579fac0, 0x4c62cb81, + 0x8138c51f, 0x9823f45e, 0xb30ea79d, 0xaa1596dc, + 0xe554001b, 0xfc4f315a, 0xd7626299, 0xce7953d8, + 0x49e14f17, 0x50fa7e56, 0x7bd72d95, 0x62cc1cd4, + 0x2d8d8a13, 0x3496bb52, 0x1fbbe891, 0x06a0d9d0, + 0x5e7ef3ec, 0x4765c2ad, 0x6c48916e, 0x7553a02f, + 0x3a1236e8, 0x230907a9, 0x0824546a, 0x113f652b, + 0x96a779e4, 0x8fbc48a5, 0xa4911b66, 0xbd8a2a27, + 0xf2cbbce0, 0xebd08da1, 0xc0fdde62, 0xd9e6ef23, + 0x14bce1bd, 0x0da7d0fc, 0x268a833f, 0x3f91b27e, + 0x70d024b9, 0x69cb15f8, 0x42e6463b, 0x5bfd777a, + 0xdc656bb5, 0xc57e5af4, 0xee530937, 0xf7483876, + 0xb809aeb1, 0xa1129ff0, 0x8a3fcc33, 0x9324fd72, + 0x00000000, 0x01c26a37, 0x0384d46e, 0x0246be59, + 0x0709a8dc, 0x06cbc2eb, 0x048d7cb2, 0x054f1685, + 0x0e1351b8, 0x0fd13b8f, 0x0d9785d6, 0x0c55efe1, + 0x091af964, 0x08d89353, 0x0a9e2d0a, 0x0b5c473d, + 0x1c26a370, 0x1de4c947, 0x1fa2771e, 0x1e601d29, + 0x1b2f0bac, 0x1aed619b, 0x18abdfc2, 0x1969b5f5, + 0x1235f2c8, 0x13f798ff, 0x11b126a6, 0x10734c91, + 0x153c5a14, 0x14fe3023, 0x16b88e7a, 0x177ae44d, + 0x384d46e0, 0x398f2cd7, 0x3bc9928e, 0x3a0bf8b9, + 0x3f44ee3c, 0x3e86840b, 0x3cc03a52, 0x3d025065, + 0x365e1758, 0x379c7d6f, 0x35dac336, 0x3418a901, + 0x3157bf84, 0x3095d5b3, 0x32d36bea, 0x331101dd, + 0x246be590, 0x25a98fa7, 0x27ef31fe, 0x262d5bc9, + 0x23624d4c, 0x22a0277b, 0x20e69922, 0x2124f315, + 0x2a78b428, 0x2bbade1f, 0x29fc6046, 0x283e0a71, + 0x2d711cf4, 0x2cb376c3, 0x2ef5c89a, 0x2f37a2ad, + 0x709a8dc0, 0x7158e7f7, 0x731e59ae, 0x72dc3399, + 0x7793251c, 0x76514f2b, 0x7417f172, 0x75d59b45, + 0x7e89dc78, 0x7f4bb64f, 0x7d0d0816, 0x7ccf6221, + 0x798074a4, 0x78421e93, 0x7a04a0ca, 0x7bc6cafd, + 0x6cbc2eb0, 0x6d7e4487, 0x6f38fade, 0x6efa90e9, + 0x6bb5866c, 0x6a77ec5b, 0x68315202, 0x69f33835, + 0x62af7f08, 0x636d153f, 0x612bab66, 0x60e9c151, + 0x65a6d7d4, 0x6464bde3, 0x662203ba, 0x67e0698d, + 0x48d7cb20, 0x4915a117, 0x4b531f4e, 0x4a917579, + 0x4fde63fc, 0x4e1c09cb, 0x4c5ab792, 0x4d98dda5, + 0x46c49a98, 0x4706f0af, 0x45404ef6, 0x448224c1, + 0x41cd3244, 0x400f5873, 0x4249e62a, 0x438b8c1d, + 0x54f16850, 0x55330267, 0x5775bc3e, 0x56b7d609, + 0x53f8c08c, 0x523aaabb, 0x507c14e2, 0x51be7ed5, + 0x5ae239e8, 0x5b2053df, 0x5966ed86, 0x58a487b1, + 0x5deb9134, 0x5c29fb03, 0x5e6f455a, 0x5fad2f6d, + 0xe1351b80, 0xe0f771b7, 0xe2b1cfee, 0xe373a5d9, + 0xe63cb35c, 0xe7fed96b, 0xe5b86732, 0xe47a0d05, + 0xef264a38, 0xeee4200f, 0xeca29e56, 0xed60f461, + 0xe82fe2e4, 0xe9ed88d3, 0xebab368a, 0xea695cbd, + 0xfd13b8f0, 0xfcd1d2c7, 0xfe976c9e, 0xff5506a9, + 0xfa1a102c, 0xfbd87a1b, 0xf99ec442, 0xf85cae75, + 0xf300e948, 0xf2c2837f, 0xf0843d26, 0xf1465711, + 0xf4094194, 0xf5cb2ba3, 0xf78d95fa, 0xf64fffcd, + 0xd9785d60, 0xd8ba3757, 0xdafc890e, 0xdb3ee339, + 0xde71f5bc, 0xdfb39f8b, 0xddf521d2, 0xdc374be5, + 0xd76b0cd8, 0xd6a966ef, 0xd4efd8b6, 0xd52db281, + 0xd062a404, 0xd1a0ce33, 0xd3e6706a, 0xd2241a5d, + 0xc55efe10, 0xc49c9427, 0xc6da2a7e, 0xc7184049, + 0xc25756cc, 0xc3953cfb, 0xc1d382a2, 0xc011e895, + 0xcb4dafa8, 0xca8fc59f, 0xc8c97bc6, 0xc90b11f1, + 0xcc440774, 0xcd866d43, 0xcfc0d31a, 0xce02b92d, + 0x91af9640, 0x906dfc77, 0x922b422e, 0x93e92819, + 0x96a63e9c, 0x976454ab, 0x9522eaf2, 0x94e080c5, + 0x9fbcc7f8, 0x9e7eadcf, 0x9c381396, 0x9dfa79a1, + 0x98b56f24, 0x99770513, 0x9b31bb4a, 0x9af3d17d, + 0x8d893530, 0x8c4b5f07, 0x8e0de15e, 0x8fcf8b69, + 0x8a809dec, 0x8b42f7db, 0x89044982, 0x88c623b5, + 0x839a6488, 0x82580ebf, 0x801eb0e6, 0x81dcdad1, + 0x8493cc54, 0x8551a663, 0x8717183a, 0x86d5720d, + 0xa9e2d0a0, 0xa820ba97, 0xaa6604ce, 0xaba46ef9, + 0xaeeb787c, 0xaf29124b, 0xad6fac12, 0xacadc625, + 0xa7f18118, 0xa633eb2f, 0xa4755576, 0xa5b73f41, + 0xa0f829c4, 0xa13a43f3, 0xa37cfdaa, 0xa2be979d, + 0xb5c473d0, 0xb40619e7, 0xb640a7be, 0xb782cd89, + 0xb2cddb0c, 0xb30fb13b, 0xb1490f62, 0xb08b6555, + 0xbbd72268, 0xba15485f, 0xb853f606, 0xb9919c31, + 0xbcde8ab4, 0xbd1ce083, 0xbf5a5eda, 0xbe9834ed, + 0x00000000, 0xb8bc6765, 0xaa09c88b, 0x12b5afee, + 0x8f629757, 0x37def032, 0x256b5fdc, 0x9dd738b9, + 0xc5b428ef, 0x7d084f8a, 0x6fbde064, 0xd7018701, + 0x4ad6bfb8, 0xf26ad8dd, 0xe0df7733, 0x58631056, + 0x5019579f, 0xe8a530fa, 0xfa109f14, 0x42acf871, + 0xdf7bc0c8, 0x67c7a7ad, 0x75720843, 0xcdce6f26, + 0x95ad7f70, 0x2d111815, 0x3fa4b7fb, 0x8718d09e, + 0x1acfe827, 0xa2738f42, 0xb0c620ac, 0x087a47c9, + 0xa032af3e, 0x188ec85b, 0x0a3b67b5, 0xb28700d0, + 0x2f503869, 0x97ec5f0c, 0x8559f0e2, 0x3de59787, + 0x658687d1, 0xdd3ae0b4, 0xcf8f4f5a, 0x7733283f, + 0xeae41086, 0x525877e3, 0x40edd80d, 0xf851bf68, + 0xf02bf8a1, 0x48979fc4, 0x5a22302a, 0xe29e574f, + 0x7f496ff6, 0xc7f50893, 0xd540a77d, 0x6dfcc018, + 0x359fd04e, 0x8d23b72b, 0x9f9618c5, 0x272a7fa0, + 0xbafd4719, 0x0241207c, 0x10f48f92, 0xa848e8f7, + 0x9b14583d, 0x23a83f58, 0x311d90b6, 0x89a1f7d3, + 0x1476cf6a, 0xaccaa80f, 0xbe7f07e1, 0x06c36084, + 0x5ea070d2, 0xe61c17b7, 0xf4a9b859, 0x4c15df3c, + 0xd1c2e785, 0x697e80e0, 0x7bcb2f0e, 0xc377486b, + 0xcb0d0fa2, 0x73b168c7, 0x6104c729, 0xd9b8a04c, + 0x446f98f5, 0xfcd3ff90, 0xee66507e, 0x56da371b, + 0x0eb9274d, 0xb6054028, 0xa4b0efc6, 0x1c0c88a3, + 0x81dbb01a, 0x3967d77f, 0x2bd27891, 0x936e1ff4, + 0x3b26f703, 0x839a9066, 0x912f3f88, 0x299358ed, + 0xb4446054, 0x0cf80731, 0x1e4da8df, 0xa6f1cfba, + 0xfe92dfec, 0x462eb889, 0x549b1767, 0xec277002, + 0x71f048bb, 0xc94c2fde, 0xdbf98030, 0x6345e755, + 0x6b3fa09c, 0xd383c7f9, 0xc1366817, 0x798a0f72, + 0xe45d37cb, 0x5ce150ae, 0x4e54ff40, 0xf6e89825, + 0xae8b8873, 0x1637ef16, 0x048240f8, 0xbc3e279d, + 0x21e91f24, 0x99557841, 0x8be0d7af, 0x335cb0ca, + 0xed59b63b, 0x55e5d15e, 0x47507eb0, 0xffec19d5, + 0x623b216c, 0xda874609, 0xc832e9e7, 0x708e8e82, + 0x28ed9ed4, 0x9051f9b1, 0x82e4565f, 0x3a58313a, + 0xa78f0983, 0x1f336ee6, 0x0d86c108, 0xb53aa66d, + 0xbd40e1a4, 0x05fc86c1, 0x1749292f, 0xaff54e4a, + 0x322276f3, 0x8a9e1196, 0x982bbe78, 0x2097d91d, + 0x78f4c94b, 0xc048ae2e, 0xd2fd01c0, 0x6a4166a5, + 0xf7965e1c, 0x4f2a3979, 0x5d9f9697, 0xe523f1f2, + 0x4d6b1905, 0xf5d77e60, 0xe762d18e, 0x5fdeb6eb, + 0xc2098e52, 0x7ab5e937, 0x680046d9, 0xd0bc21bc, + 0x88df31ea, 0x3063568f, 0x22d6f961, 0x9a6a9e04, + 0x07bda6bd, 0xbf01c1d8, 0xadb46e36, 0x15080953, + 0x1d724e9a, 0xa5ce29ff, 0xb77b8611, 0x0fc7e174, + 0x9210d9cd, 0x2aacbea8, 0x38191146, 0x80a57623, + 0xd8c66675, 0x607a0110, 0x72cfaefe, 0xca73c99b, + 0x57a4f122, 0xef189647, 0xfdad39a9, 0x45115ecc, + 0x764dee06, 0xcef18963, 0xdc44268d, 0x64f841e8, + 0xf92f7951, 0x41931e34, 0x5326b1da, 0xeb9ad6bf, + 0xb3f9c6e9, 0x0b45a18c, 0x19f00e62, 0xa14c6907, + 0x3c9b51be, 0x842736db, 0x96929935, 0x2e2efe50, + 0x2654b999, 0x9ee8defc, 0x8c5d7112, 0x34e11677, + 0xa9362ece, 0x118a49ab, 0x033fe645, 0xbb838120, + 0xe3e09176, 0x5b5cf613, 0x49e959fd, 0xf1553e98, + 0x6c820621, 0xd43e6144, 0xc68bceaa, 0x7e37a9cf, + 0xd67f4138, 0x6ec3265d, 0x7c7689b3, 0xc4caeed6, + 0x591dd66f, 0xe1a1b10a, 0xf3141ee4, 0x4ba87981, + 0x13cb69d7, 0xab770eb2, 0xb9c2a15c, 0x017ec639, + 0x9ca9fe80, 0x241599e5, 0x36a0360b, 0x8e1c516e, + 0x866616a7, 0x3eda71c2, 0x2c6fde2c, 0x94d3b949, + 0x090481f0, 0xb1b8e695, 0xa30d497b, 0x1bb12e1e, + 0x43d23e48, 0xfb6e592d, 0xe9dbf6c3, 0x516791a6, + 0xccb0a91f, 0x740cce7a, 0x66b96194, 0xde0506f1, + 0x00000000, 0x3d6029b0, 0x7ac05360, 0x47a07ad0, + 0xf580a6c0, 0xc8e08f70, 0x8f40f5a0, 0xb220dc10, + 0x30704bc1, 0x0d106271, 0x4ab018a1, 0x77d03111, + 0xc5f0ed01, 0xf890c4b1, 0xbf30be61, 0x825097d1, + 0x60e09782, 0x5d80be32, 0x1a20c4e2, 0x2740ed52, + 0x95603142, 0xa80018f2, 0xefa06222, 0xd2c04b92, + 0x5090dc43, 0x6df0f5f3, 0x2a508f23, 0x1730a693, + 0xa5107a83, 0x98705333, 0xdfd029e3, 0xe2b00053, + 0xc1c12f04, 0xfca106b4, 0xbb017c64, 0x866155d4, + 0x344189c4, 0x0921a074, 0x4e81daa4, 0x73e1f314, + 0xf1b164c5, 0xccd14d75, 0x8b7137a5, 0xb6111e15, + 0x0431c205, 0x3951ebb5, 0x7ef19165, 0x4391b8d5, + 0xa121b886, 0x9c419136, 0xdbe1ebe6, 0xe681c256, + 0x54a11e46, 0x69c137f6, 0x2e614d26, 0x13016496, + 0x9151f347, 0xac31daf7, 0xeb91a027, 0xd6f18997, + 0x64d15587, 0x59b17c37, 0x1e1106e7, 0x23712f57, + 0x58f35849, 0x659371f9, 0x22330b29, 0x1f532299, + 0xad73fe89, 0x9013d739, 0xd7b3ade9, 0xead38459, + 0x68831388, 0x55e33a38, 0x124340e8, 0x2f236958, + 0x9d03b548, 0xa0639cf8, 0xe7c3e628, 0xdaa3cf98, + 0x3813cfcb, 0x0573e67b, 0x42d39cab, 0x7fb3b51b, + 0xcd93690b, 0xf0f340bb, 0xb7533a6b, 0x8a3313db, + 0x0863840a, 0x3503adba, 0x72a3d76a, 0x4fc3feda, + 0xfde322ca, 0xc0830b7a, 0x872371aa, 0xba43581a, + 0x9932774d, 0xa4525efd, 0xe3f2242d, 0xde920d9d, + 0x6cb2d18d, 0x51d2f83d, 0x167282ed, 0x2b12ab5d, + 0xa9423c8c, 0x9422153c, 0xd3826fec, 0xeee2465c, + 0x5cc29a4c, 0x61a2b3fc, 0x2602c92c, 0x1b62e09c, + 0xf9d2e0cf, 0xc4b2c97f, 0x8312b3af, 0xbe729a1f, + 0x0c52460f, 0x31326fbf, 0x7692156f, 0x4bf23cdf, + 0xc9a2ab0e, 0xf4c282be, 0xb362f86e, 0x8e02d1de, + 0x3c220dce, 0x0142247e, 0x46e25eae, 0x7b82771e, + 0xb1e6b092, 0x8c869922, 0xcb26e3f2, 0xf646ca42, + 0x44661652, 0x79063fe2, 0x3ea64532, 0x03c66c82, + 0x8196fb53, 0xbcf6d2e3, 0xfb56a833, 0xc6368183, + 0x74165d93, 0x49767423, 0x0ed60ef3, 0x33b62743, + 0xd1062710, 0xec660ea0, 0xabc67470, 0x96a65dc0, + 0x248681d0, 0x19e6a860, 0x5e46d2b0, 0x6326fb00, + 0xe1766cd1, 0xdc164561, 0x9bb63fb1, 0xa6d61601, + 0x14f6ca11, 0x2996e3a1, 0x6e369971, 0x5356b0c1, + 0x70279f96, 0x4d47b626, 0x0ae7ccf6, 0x3787e546, + 0x85a73956, 0xb8c710e6, 0xff676a36, 0xc2074386, + 0x4057d457, 0x7d37fde7, 0x3a978737, 0x07f7ae87, + 0xb5d77297, 0x88b75b27, 0xcf1721f7, 0xf2770847, + 0x10c70814, 0x2da721a4, 0x6a075b74, 0x576772c4, + 0xe547aed4, 0xd8278764, 0x9f87fdb4, 0xa2e7d404, + 0x20b743d5, 0x1dd76a65, 0x5a7710b5, 0x67173905, + 0xd537e515, 0xe857cca5, 0xaff7b675, 0x92979fc5, + 0xe915e8db, 0xd475c16b, 0x93d5bbbb, 0xaeb5920b, + 0x1c954e1b, 0x21f567ab, 0x66551d7b, 0x5b3534cb, + 0xd965a31a, 0xe4058aaa, 0xa3a5f07a, 0x9ec5d9ca, + 0x2ce505da, 0x11852c6a, 0x562556ba, 0x6b457f0a, + 0x89f57f59, 0xb49556e9, 0xf3352c39, 0xce550589, + 0x7c75d999, 0x4115f029, 0x06b58af9, 0x3bd5a349, + 0xb9853498, 0x84e51d28, 0xc34567f8, 0xfe254e48, + 0x4c059258, 0x7165bbe8, 0x36c5c138, 0x0ba5e888, + 0x28d4c7df, 0x15b4ee6f, 0x521494bf, 0x6f74bd0f, + 0xdd54611f, 0xe03448af, 0xa794327f, 0x9af41bcf, + 0x18a48c1e, 0x25c4a5ae, 0x6264df7e, 0x5f04f6ce, + 0xed242ade, 0xd044036e, 0x97e479be, 0xaa84500e, + 0x4834505d, 0x755479ed, 0x32f4033d, 0x0f942a8d, + 0xbdb4f69d, 0x80d4df2d, 0xc774a5fd, 0xfa148c4d, + 0x78441b9c, 0x4524322c, 0x028448fc, 0x3fe4614c, + 0x8dc4bd5c, 0xb0a494ec, 0xf704ee3c, 0xca64c78c, + 0x00000000, 0xcb5cd3a5, 0x4dc8a10b, 0x869472ae, + 0x9b914216, 0x50cd91b3, 0xd659e31d, 0x1d0530b8, + 0xec53826d, 0x270f51c8, 0xa19b2366, 0x6ac7f0c3, + 0x77c2c07b, 0xbc9e13de, 0x3a0a6170, 0xf156b2d5, + 0x03d6029b, 0xc88ad13e, 0x4e1ea390, 0x85427035, + 0x9847408d, 0x531b9328, 0xd58fe186, 0x1ed33223, + 0xef8580f6, 0x24d95353, 0xa24d21fd, 0x6911f258, + 0x7414c2e0, 0xbf481145, 0x39dc63eb, 0xf280b04e, + 0x07ac0536, 0xccf0d693, 0x4a64a43d, 0x81387798, + 0x9c3d4720, 0x57619485, 0xd1f5e62b, 0x1aa9358e, + 0xebff875b, 0x20a354fe, 0xa6372650, 0x6d6bf5f5, + 0x706ec54d, 0xbb3216e8, 0x3da66446, 0xf6fab7e3, + 0x047a07ad, 0xcf26d408, 0x49b2a6a6, 0x82ee7503, + 0x9feb45bb, 0x54b7961e, 0xd223e4b0, 0x197f3715, + 0xe82985c0, 0x23755665, 0xa5e124cb, 0x6ebdf76e, + 0x73b8c7d6, 0xb8e41473, 0x3e7066dd, 0xf52cb578, + 0x0f580a6c, 0xc404d9c9, 0x4290ab67, 0x89cc78c2, + 0x94c9487a, 0x5f959bdf, 0xd901e971, 0x125d3ad4, + 0xe30b8801, 0x28575ba4, 0xaec3290a, 0x659ffaaf, + 0x789aca17, 0xb3c619b2, 0x35526b1c, 0xfe0eb8b9, + 0x0c8e08f7, 0xc7d2db52, 0x4146a9fc, 0x8a1a7a59, + 0x971f4ae1, 0x5c439944, 0xdad7ebea, 0x118b384f, + 0xe0dd8a9a, 0x2b81593f, 0xad152b91, 0x6649f834, + 0x7b4cc88c, 0xb0101b29, 0x36846987, 0xfdd8ba22, + 0x08f40f5a, 0xc3a8dcff, 0x453cae51, 0x8e607df4, + 0x93654d4c, 0x58399ee9, 0xdeadec47, 0x15f13fe2, + 0xe4a78d37, 0x2ffb5e92, 0xa96f2c3c, 0x6233ff99, + 0x7f36cf21, 0xb46a1c84, 0x32fe6e2a, 0xf9a2bd8f, + 0x0b220dc1, 0xc07ede64, 0x46eaacca, 0x8db67f6f, + 0x90b34fd7, 0x5bef9c72, 0xdd7beedc, 0x16273d79, + 0xe7718fac, 0x2c2d5c09, 0xaab92ea7, 0x61e5fd02, + 0x7ce0cdba, 0xb7bc1e1f, 0x31286cb1, 0xfa74bf14, + 0x1eb014d8, 0xd5ecc77d, 0x5378b5d3, 0x98246676, + 0x852156ce, 0x4e7d856b, 0xc8e9f7c5, 0x03b52460, + 0xf2e396b5, 0x39bf4510, 0xbf2b37be, 0x7477e41b, + 0x6972d4a3, 0xa22e0706, 0x24ba75a8, 0xefe6a60d, + 0x1d661643, 0xd63ac5e6, 0x50aeb748, 0x9bf264ed, + 0x86f75455, 0x4dab87f0, 0xcb3ff55e, 0x006326fb, + 0xf135942e, 0x3a69478b, 0xbcfd3525, 0x77a1e680, + 0x6aa4d638, 0xa1f8059d, 0x276c7733, 0xec30a496, + 0x191c11ee, 0xd240c24b, 0x54d4b0e5, 0x9f886340, + 0x828d53f8, 0x49d1805d, 0xcf45f2f3, 0x04192156, + 0xf54f9383, 0x3e134026, 0xb8873288, 0x73dbe12d, + 0x6eded195, 0xa5820230, 0x2316709e, 0xe84aa33b, + 0x1aca1375, 0xd196c0d0, 0x5702b27e, 0x9c5e61db, + 0x815b5163, 0x4a0782c6, 0xcc93f068, 0x07cf23cd, + 0xf6999118, 0x3dc542bd, 0xbb513013, 0x700de3b6, + 0x6d08d30e, 0xa65400ab, 0x20c07205, 0xeb9ca1a0, + 0x11e81eb4, 0xdab4cd11, 0x5c20bfbf, 0x977c6c1a, + 0x8a795ca2, 0x41258f07, 0xc7b1fda9, 0x0ced2e0c, + 0xfdbb9cd9, 0x36e74f7c, 0xb0733dd2, 0x7b2fee77, + 0x662adecf, 0xad760d6a, 0x2be27fc4, 0xe0beac61, + 0x123e1c2f, 0xd962cf8a, 0x5ff6bd24, 0x94aa6e81, + 0x89af5e39, 0x42f38d9c, 0xc467ff32, 0x0f3b2c97, + 0xfe6d9e42, 0x35314de7, 0xb3a53f49, 0x78f9ecec, + 0x65fcdc54, 0xaea00ff1, 0x28347d5f, 0xe368aefa, + 0x16441b82, 0xdd18c827, 0x5b8cba89, 0x90d0692c, + 0x8dd55994, 0x46898a31, 0xc01df89f, 0x0b412b3a, + 0xfa1799ef, 0x314b4a4a, 0xb7df38e4, 0x7c83eb41, + 0x6186dbf9, 0xaada085c, 0x2c4e7af2, 0xe712a957, + 0x15921919, 0xdececabc, 0x585ab812, 0x93066bb7, + 0x8e035b0f, 0x455f88aa, 0xc3cbfa04, 0x089729a1, + 0xf9c19b74, 0x329d48d1, 0xb4093a7f, 0x7f55e9da, + 0x6250d962, 0xa90c0ac7, 0x2f987869, 0xe4c4abcc, + 0x00000000, 0xa6770bb4, 0x979f1129, 0x31e81a9d, + 0xf44f2413, 0x52382fa7, 0x63d0353a, 0xc5a73e8e, + 0x33ef4e67, 0x959845d3, 0xa4705f4e, 0x020754fa, + 0xc7a06a74, 0x61d761c0, 0x503f7b5d, 0xf64870e9, + 0x67de9cce, 0xc1a9977a, 0xf0418de7, 0x56368653, + 0x9391b8dd, 0x35e6b369, 0x040ea9f4, 0xa279a240, + 0x5431d2a9, 0xf246d91d, 0xc3aec380, 0x65d9c834, + 0xa07ef6ba, 0x0609fd0e, 0x37e1e793, 0x9196ec27, + 0xcfbd399c, 0x69ca3228, 0x582228b5, 0xfe552301, + 0x3bf21d8f, 0x9d85163b, 0xac6d0ca6, 0x0a1a0712, + 0xfc5277fb, 0x5a257c4f, 0x6bcd66d2, 0xcdba6d66, + 0x081d53e8, 0xae6a585c, 0x9f8242c1, 0x39f54975, + 0xa863a552, 0x0e14aee6, 0x3ffcb47b, 0x998bbfcf, + 0x5c2c8141, 0xfa5b8af5, 0xcbb39068, 0x6dc49bdc, + 0x9b8ceb35, 0x3dfbe081, 0x0c13fa1c, 0xaa64f1a8, + 0x6fc3cf26, 0xc9b4c492, 0xf85cde0f, 0x5e2bd5bb, + 0x440b7579, 0xe27c7ecd, 0xd3946450, 0x75e36fe4, + 0xb044516a, 0x16335ade, 0x27db4043, 0x81ac4bf7, + 0x77e43b1e, 0xd19330aa, 0xe07b2a37, 0x460c2183, + 0x83ab1f0d, 0x25dc14b9, 0x14340e24, 0xb2430590, + 0x23d5e9b7, 0x85a2e203, 0xb44af89e, 0x123df32a, + 0xd79acda4, 0x71edc610, 0x4005dc8d, 0xe672d739, + 0x103aa7d0, 0xb64dac64, 0x87a5b6f9, 0x21d2bd4d, + 0xe47583c3, 0x42028877, 0x73ea92ea, 0xd59d995e, + 0x8bb64ce5, 0x2dc14751, 0x1c295dcc, 0xba5e5678, + 0x7ff968f6, 0xd98e6342, 0xe86679df, 0x4e11726b, + 0xb8590282, 0x1e2e0936, 0x2fc613ab, 0x89b1181f, + 0x4c162691, 0xea612d25, 0xdb8937b8, 0x7dfe3c0c, + 0xec68d02b, 0x4a1fdb9f, 0x7bf7c102, 0xdd80cab6, + 0x1827f438, 0xbe50ff8c, 0x8fb8e511, 0x29cfeea5, + 0xdf879e4c, 0x79f095f8, 0x48188f65, 0xee6f84d1, + 0x2bc8ba5f, 0x8dbfb1eb, 0xbc57ab76, 0x1a20a0c2, + 0x8816eaf2, 0x2e61e146, 0x1f89fbdb, 0xb9fef06f, + 0x7c59cee1, 0xda2ec555, 0xebc6dfc8, 0x4db1d47c, + 0xbbf9a495, 0x1d8eaf21, 0x2c66b5bc, 0x8a11be08, + 0x4fb68086, 0xe9c18b32, 0xd82991af, 0x7e5e9a1b, + 0xefc8763c, 0x49bf7d88, 0x78576715, 0xde206ca1, + 0x1b87522f, 0xbdf0599b, 0x8c184306, 0x2a6f48b2, + 0xdc27385b, 0x7a5033ef, 0x4bb82972, 0xedcf22c6, + 0x28681c48, 0x8e1f17fc, 0xbff70d61, 0x198006d5, + 0x47abd36e, 0xe1dcd8da, 0xd034c247, 0x7643c9f3, + 0xb3e4f77d, 0x1593fcc9, 0x247be654, 0x820cede0, + 0x74449d09, 0xd23396bd, 0xe3db8c20, 0x45ac8794, + 0x800bb91a, 0x267cb2ae, 0x1794a833, 0xb1e3a387, + 0x20754fa0, 0x86024414, 0xb7ea5e89, 0x119d553d, + 0xd43a6bb3, 0x724d6007, 0x43a57a9a, 0xe5d2712e, + 0x139a01c7, 0xb5ed0a73, 0x840510ee, 0x22721b5a, + 0xe7d525d4, 0x41a22e60, 0x704a34fd, 0xd63d3f49, + 0xcc1d9f8b, 0x6a6a943f, 0x5b828ea2, 0xfdf58516, + 0x3852bb98, 0x9e25b02c, 0xafcdaab1, 0x09baa105, + 0xfff2d1ec, 0x5985da58, 0x686dc0c5, 0xce1acb71, + 0x0bbdf5ff, 0xadcafe4b, 0x9c22e4d6, 0x3a55ef62, + 0xabc30345, 0x0db408f1, 0x3c5c126c, 0x9a2b19d8, + 0x5f8c2756, 0xf9fb2ce2, 0xc813367f, 0x6e643dcb, + 0x982c4d22, 0x3e5b4696, 0x0fb35c0b, 0xa9c457bf, + 0x6c636931, 0xca146285, 0xfbfc7818, 0x5d8b73ac, + 0x03a0a617, 0xa5d7ada3, 0x943fb73e, 0x3248bc8a, + 0xf7ef8204, 0x519889b0, 0x6070932d, 0xc6079899, + 0x304fe870, 0x9638e3c4, 0xa7d0f959, 0x01a7f2ed, + 0xc400cc63, 0x6277c7d7, 0x539fdd4a, 0xf5e8d6fe, + 0x647e3ad9, 0xc209316d, 0xf3e12bf0, 0x55962044, + 0x90311eca, 0x3646157e, 0x07ae0fe3, 0xa1d90457, + 0x579174be, 0xf1e67f0a, 0xc00e6597, 0x66796e23, + 0xa3de50ad, 0x05a95b19, 0x34414184, 0x92364a30, + 0x00000000, 0xccaa009e, 0x4225077d, 0x8e8f07e3, + 0x844a0efa, 0x48e00e64, 0xc66f0987, 0x0ac50919, + 0xd3e51bb5, 0x1f4f1b2b, 0x91c01cc8, 0x5d6a1c56, + 0x57af154f, 0x9b0515d1, 0x158a1232, 0xd92012ac, + 0x7cbb312b, 0xb01131b5, 0x3e9e3656, 0xf23436c8, + 0xf8f13fd1, 0x345b3f4f, 0xbad438ac, 0x767e3832, + 0xaf5e2a9e, 0x63f42a00, 0xed7b2de3, 0x21d12d7d, + 0x2b142464, 0xe7be24fa, 0x69312319, 0xa59b2387, + 0xf9766256, 0x35dc62c8, 0xbb53652b, 0x77f965b5, + 0x7d3c6cac, 0xb1966c32, 0x3f196bd1, 0xf3b36b4f, + 0x2a9379e3, 0xe639797d, 0x68b67e9e, 0xa41c7e00, + 0xaed97719, 0x62737787, 0xecfc7064, 0x205670fa, + 0x85cd537d, 0x496753e3, 0xc7e85400, 0x0b42549e, + 0x01875d87, 0xcd2d5d19, 0x43a25afa, 0x8f085a64, + 0x562848c8, 0x9a824856, 0x140d4fb5, 0xd8a74f2b, + 0xd2624632, 0x1ec846ac, 0x9047414f, 0x5ced41d1, + 0x299dc2ed, 0xe537c273, 0x6bb8c590, 0xa712c50e, + 0xadd7cc17, 0x617dcc89, 0xeff2cb6a, 0x2358cbf4, + 0xfa78d958, 0x36d2d9c6, 0xb85dde25, 0x74f7debb, + 0x7e32d7a2, 0xb298d73c, 0x3c17d0df, 0xf0bdd041, + 0x5526f3c6, 0x998cf358, 0x1703f4bb, 0xdba9f425, + 0xd16cfd3c, 0x1dc6fda2, 0x9349fa41, 0x5fe3fadf, + 0x86c3e873, 0x4a69e8ed, 0xc4e6ef0e, 0x084cef90, + 0x0289e689, 0xce23e617, 0x40ace1f4, 0x8c06e16a, + 0xd0eba0bb, 0x1c41a025, 0x92cea7c6, 0x5e64a758, + 0x54a1ae41, 0x980baedf, 0x1684a93c, 0xda2ea9a2, + 0x030ebb0e, 0xcfa4bb90, 0x412bbc73, 0x8d81bced, + 0x8744b5f4, 0x4beeb56a, 0xc561b289, 0x09cbb217, + 0xac509190, 0x60fa910e, 0xee7596ed, 0x22df9673, + 0x281a9f6a, 0xe4b09ff4, 0x6a3f9817, 0xa6959889, + 0x7fb58a25, 0xb31f8abb, 0x3d908d58, 0xf13a8dc6, + 0xfbff84df, 0x37558441, 0xb9da83a2, 0x7570833c, + 0x533b85da, 0x9f918544, 0x111e82a7, 0xddb48239, + 0xd7718b20, 0x1bdb8bbe, 0x95548c5d, 0x59fe8cc3, + 0x80de9e6f, 0x4c749ef1, 0xc2fb9912, 0x0e51998c, + 0x04949095, 0xc83e900b, 0x46b197e8, 0x8a1b9776, + 0x2f80b4f1, 0xe32ab46f, 0x6da5b38c, 0xa10fb312, + 0xabcaba0b, 0x6760ba95, 0xe9efbd76, 0x2545bde8, + 0xfc65af44, 0x30cfafda, 0xbe40a839, 0x72eaa8a7, + 0x782fa1be, 0xb485a120, 0x3a0aa6c3, 0xf6a0a65d, + 0xaa4de78c, 0x66e7e712, 0xe868e0f1, 0x24c2e06f, + 0x2e07e976, 0xe2ade9e8, 0x6c22ee0b, 0xa088ee95, + 0x79a8fc39, 0xb502fca7, 0x3b8dfb44, 0xf727fbda, + 0xfde2f2c3, 0x3148f25d, 0xbfc7f5be, 0x736df520, + 0xd6f6d6a7, 0x1a5cd639, 0x94d3d1da, 0x5879d144, + 0x52bcd85d, 0x9e16d8c3, 0x1099df20, 0xdc33dfbe, + 0x0513cd12, 0xc9b9cd8c, 0x4736ca6f, 0x8b9ccaf1, + 0x8159c3e8, 0x4df3c376, 0xc37cc495, 0x0fd6c40b, + 0x7aa64737, 0xb60c47a9, 0x3883404a, 0xf42940d4, + 0xfeec49cd, 0x32464953, 0xbcc94eb0, 0x70634e2e, + 0xa9435c82, 0x65e95c1c, 0xeb665bff, 0x27cc5b61, + 0x2d095278, 0xe1a352e6, 0x6f2c5505, 0xa386559b, + 0x061d761c, 0xcab77682, 0x44387161, 0x889271ff, + 0x825778e6, 0x4efd7878, 0xc0727f9b, 0x0cd87f05, + 0xd5f86da9, 0x19526d37, 0x97dd6ad4, 0x5b776a4a, + 0x51b26353, 0x9d1863cd, 0x1397642e, 0xdf3d64b0, + 0x83d02561, 0x4f7a25ff, 0xc1f5221c, 0x0d5f2282, + 0x079a2b9b, 0xcb302b05, 0x45bf2ce6, 0x89152c78, + 0x50353ed4, 0x9c9f3e4a, 0x121039a9, 0xdeba3937, + 0xd47f302e, 0x18d530b0, 0x965a3753, 0x5af037cd, + 0xff6b144a, 0x33c114d4, 0xbd4e1337, 0x71e413a9, + 0x7b211ab0, 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, + 0x2c8e0fff, 0xe0240f61, 0x6eab0882, 0xa201081c, + 0xa8c40105, 0x646e019b, 0xeae10678, 0x264b06e6, +}; diff --git a/tools/z64compress/src/enc/libdeflate/lib/decompress_template.h b/tools/z64compress/src/enc/libdeflate/lib/decompress_template.h new file mode 100644 index 000000000..2d9dfa82b --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/decompress_template.h @@ -0,0 +1,774 @@ +/* + * decompress_template.h + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This is the actual DEFLATE decompression routine, lifted out of + * deflate_decompress.c so that it can be compiled multiple times with different + * target instruction sets. + */ + +#ifndef ATTRIBUTES +# define ATTRIBUTES +#endif +#ifndef EXTRACT_VARBITS +# define EXTRACT_VARBITS(word, count) ((word) & BITMASK(count)) +#endif +#ifndef EXTRACT_VARBITS8 +# define EXTRACT_VARBITS8(word, count) ((word) & BITMASK((u8)(count))) +#endif + +static enum libdeflate_result ATTRIBUTES MAYBE_UNUSED +FUNCNAME(struct libdeflate_decompressor * restrict d, + const void * restrict in, size_t in_nbytes, + void * restrict out, size_t out_nbytes_avail, + size_t *actual_in_nbytes_ret, size_t *actual_out_nbytes_ret) +{ + u8 *out_next = out; + u8 * const out_end = out_next + out_nbytes_avail; + u8 * const out_fastloop_end = + out_end - MIN(out_nbytes_avail, FASTLOOP_MAX_BYTES_WRITTEN); + + /* Input bitstream state; see deflate_decompress.c for documentation */ + const u8 *in_next = in; + const u8 * const in_end = in_next + in_nbytes; + const u8 * const in_fastloop_end = + in_end - MIN(in_nbytes, FASTLOOP_MAX_BYTES_READ); + bitbuf_t bitbuf = 0; + bitbuf_t saved_bitbuf; + u32 bitsleft = 0; + size_t overread_count = 0; + + bool is_final_block; + unsigned block_type; + unsigned num_litlen_syms; + unsigned num_offset_syms; + bitbuf_t litlen_tablemask; + u32 entry; + +next_block: + /* Starting to read the next block */ + ; + + STATIC_ASSERT(CAN_CONSUME(1 + 2 + 5 + 5 + 4 + 3)); + REFILL_BITS(); + + /* BFINAL: 1 bit */ + is_final_block = bitbuf & BITMASK(1); + + /* BTYPE: 2 bits */ + block_type = (bitbuf >> 1) & BITMASK(2); + + if (block_type == DEFLATE_BLOCKTYPE_DYNAMIC_HUFFMAN) { + + /* Dynamic Huffman block */ + + /* The order in which precode lengths are stored */ + static const u8 deflate_precode_lens_permutation[DEFLATE_NUM_PRECODE_SYMS] = { + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 + }; + + unsigned num_explicit_precode_lens; + unsigned i; + + /* Read the codeword length counts. */ + + STATIC_ASSERT(DEFLATE_NUM_LITLEN_SYMS == 257 + BITMASK(5)); + num_litlen_syms = 257 + ((bitbuf >> 3) & BITMASK(5)); + + STATIC_ASSERT(DEFLATE_NUM_OFFSET_SYMS == 1 + BITMASK(5)); + num_offset_syms = 1 + ((bitbuf >> 8) & BITMASK(5)); + + STATIC_ASSERT(DEFLATE_NUM_PRECODE_SYMS == 4 + BITMASK(4)); + num_explicit_precode_lens = 4 + ((bitbuf >> 13) & BITMASK(4)); + + d->static_codes_loaded = false; + + /* + * Read the precode codeword lengths. + * + * A 64-bit bitbuffer is just one bit too small to hold the + * maximum number of precode lens, so to minimize branches we + * merge one len with the previous fields. + */ + STATIC_ASSERT(DEFLATE_MAX_PRE_CODEWORD_LEN == (1 << 3) - 1); + if (CAN_CONSUME(3 * (DEFLATE_NUM_PRECODE_SYMS - 1))) { + d->u.precode_lens[deflate_precode_lens_permutation[0]] = + (bitbuf >> 17) & BITMASK(3); + bitbuf >>= 20; + bitsleft -= 20; + REFILL_BITS(); + i = 1; + do { + d->u.precode_lens[deflate_precode_lens_permutation[i]] = + bitbuf & BITMASK(3); + bitbuf >>= 3; + bitsleft -= 3; + } while (++i < num_explicit_precode_lens); + } else { + bitbuf >>= 17; + bitsleft -= 17; + i = 0; + do { + if ((u8)bitsleft < 3) + REFILL_BITS(); + d->u.precode_lens[deflate_precode_lens_permutation[i]] = + bitbuf & BITMASK(3); + bitbuf >>= 3; + bitsleft -= 3; + } while (++i < num_explicit_precode_lens); + } + for (; i < DEFLATE_NUM_PRECODE_SYMS; i++) + d->u.precode_lens[deflate_precode_lens_permutation[i]] = 0; + + /* Build the decode table for the precode. */ + SAFETY_CHECK(build_precode_decode_table(d)); + + /* Decode the litlen and offset codeword lengths. */ + i = 0; + do { + unsigned presym; + u8 rep_val; + unsigned rep_count; + + if ((u8)bitsleft < DEFLATE_MAX_PRE_CODEWORD_LEN + 7) + REFILL_BITS(); + + /* + * The code below assumes that the precode decode table + * doesn't have any subtables. + */ + STATIC_ASSERT(PRECODE_TABLEBITS == DEFLATE_MAX_PRE_CODEWORD_LEN); + + /* Decode the next precode symbol. */ + entry = d->u.l.precode_decode_table[ + bitbuf & BITMASK(DEFLATE_MAX_PRE_CODEWORD_LEN)]; + bitbuf >>= (u8)entry; + bitsleft -= entry; /* optimization: subtract full entry */ + presym = entry >> 16; + + if (presym < 16) { + /* Explicit codeword length */ + d->u.l.lens[i++] = presym; + continue; + } + + /* Run-length encoded codeword lengths */ + + /* + * Note: we don't need verify that the repeat count + * doesn't overflow the number of elements, since we've + * sized the lens array to have enough extra space to + * allow for the worst-case overrun (138 zeroes when + * only 1 length was remaining). + * + * In the case of the small repeat counts (presyms 16 + * and 17), it is fastest to always write the maximum + * number of entries. That gets rid of branches that + * would otherwise be required. + * + * It is not just because of the numerical order that + * our checks go in the order 'presym < 16', 'presym == + * 16', and 'presym == 17'. For typical data this is + * ordered from most frequent to least frequent case. + */ + STATIC_ASSERT(DEFLATE_MAX_LENS_OVERRUN == 138 - 1); + + if (presym == 16) { + /* Repeat the previous length 3 - 6 times. */ + SAFETY_CHECK(i != 0); + rep_val = d->u.l.lens[i - 1]; + STATIC_ASSERT(3 + BITMASK(2) == 6); + rep_count = 3 + (bitbuf & BITMASK(2)); + bitbuf >>= 2; + bitsleft -= 2; + d->u.l.lens[i + 0] = rep_val; + d->u.l.lens[i + 1] = rep_val; + d->u.l.lens[i + 2] = rep_val; + d->u.l.lens[i + 3] = rep_val; + d->u.l.lens[i + 4] = rep_val; + d->u.l.lens[i + 5] = rep_val; + i += rep_count; + } else if (presym == 17) { + /* Repeat zero 3 - 10 times. */ + STATIC_ASSERT(3 + BITMASK(3) == 10); + rep_count = 3 + (bitbuf & BITMASK(3)); + bitbuf >>= 3; + bitsleft -= 3; + d->u.l.lens[i + 0] = 0; + d->u.l.lens[i + 1] = 0; + d->u.l.lens[i + 2] = 0; + d->u.l.lens[i + 3] = 0; + d->u.l.lens[i + 4] = 0; + d->u.l.lens[i + 5] = 0; + d->u.l.lens[i + 6] = 0; + d->u.l.lens[i + 7] = 0; + d->u.l.lens[i + 8] = 0; + d->u.l.lens[i + 9] = 0; + i += rep_count; + } else { + /* Repeat zero 11 - 138 times. */ + STATIC_ASSERT(11 + BITMASK(7) == 138); + rep_count = 11 + (bitbuf & BITMASK(7)); + bitbuf >>= 7; + bitsleft -= 7; + memset(&d->u.l.lens[i], 0, + rep_count * sizeof(d->u.l.lens[i])); + i += rep_count; + } + } while (i < num_litlen_syms + num_offset_syms); + + } else if (block_type == DEFLATE_BLOCKTYPE_UNCOMPRESSED) { + u16 len, nlen; + + /* + * Uncompressed block: copy 'len' bytes literally from the input + * buffer to the output buffer. + */ + + bitsleft -= 3; /* for BTYPE and BFINAL */ + + /* + * Align the bitstream to the next byte boundary. This means + * the next byte boundary as if we were reading a byte at a + * time. Therefore, we have to rewind 'in_next' by any bytes + * that have been refilled but not actually consumed yet (not + * counting overread bytes, which don't increment 'in_next'). + */ + bitsleft = (u8)bitsleft; + SAFETY_CHECK(overread_count <= (bitsleft >> 3)); + in_next -= (bitsleft >> 3) - overread_count; + overread_count = 0; + bitbuf = 0; + bitsleft = 0; + + SAFETY_CHECK(in_end - in_next >= 4); + len = get_unaligned_le16(in_next); + nlen = get_unaligned_le16(in_next + 2); + in_next += 4; + + SAFETY_CHECK(len == (u16)~nlen); + if (unlikely(len > out_end - out_next)) + return LIBDEFLATE_INSUFFICIENT_SPACE; + SAFETY_CHECK(len <= in_end - in_next); + + memcpy(out_next, in_next, len); + in_next += len; + out_next += len; + + goto block_done; + + } else { + unsigned i; + + SAFETY_CHECK(block_type == DEFLATE_BLOCKTYPE_STATIC_HUFFMAN); + + /* + * Static Huffman block: build the decode tables for the static + * codes. Skip doing so if the tables are already set up from + * an earlier static block; this speeds up decompression of + * degenerate input of many empty or very short static blocks. + * + * Afterwards, the remainder is the same as decompressing a + * dynamic Huffman block. + */ + + bitbuf >>= 3; /* for BTYPE and BFINAL */ + bitsleft -= 3; + + if (d->static_codes_loaded) + goto have_decode_tables; + + d->static_codes_loaded = true; + + STATIC_ASSERT(DEFLATE_NUM_LITLEN_SYMS == 288); + STATIC_ASSERT(DEFLATE_NUM_OFFSET_SYMS == 32); + + for (i = 0; i < 144; i++) + d->u.l.lens[i] = 8; + for (; i < 256; i++) + d->u.l.lens[i] = 9; + for (; i < 280; i++) + d->u.l.lens[i] = 7; + for (; i < 288; i++) + d->u.l.lens[i] = 8; + + for (; i < 288 + 32; i++) + d->u.l.lens[i] = 5; + + num_litlen_syms = 288; + num_offset_syms = 32; + } + + /* Decompressing a Huffman block (either dynamic or static) */ + + SAFETY_CHECK(build_offset_decode_table(d, num_litlen_syms, num_offset_syms)); + SAFETY_CHECK(build_litlen_decode_table(d, num_litlen_syms, num_offset_syms)); +have_decode_tables: + litlen_tablemask = BITMASK(d->litlen_tablebits); + + /* + * This is the "fastloop" for decoding literals and matches. It does + * bounds checks on in_next and out_next in the loop conditions so that + * additional bounds checks aren't needed inside the loop body. + * + * To reduce latency, the bitbuffer is refilled and the next litlen + * decode table entry is preloaded before each loop iteration. + */ + if (in_next >= in_fastloop_end || out_next >= out_fastloop_end) + goto generic_loop; + REFILL_BITS_IN_FASTLOOP(); + entry = d->u.litlen_decode_table[bitbuf & litlen_tablemask]; + do { + u32 length, offset, lit; + const u8 *src; + u8 *dst; + + /* + * Consume the bits for the litlen decode table entry. Save the + * original bitbuf for later, in case the extra match length + * bits need to be extracted from it. + */ + saved_bitbuf = bitbuf; + bitbuf >>= (u8)entry; + bitsleft -= entry; /* optimization: subtract full entry */ + + /* + * Begin by checking for a "fast" literal, i.e. a literal that + * doesn't need a subtable. + */ + if (entry & HUFFDEC_LITERAL) { + /* + * On 64-bit platforms, we decode up to 2 extra fast + * literals in addition to the primary item, as this + * increases performance and still leaves enough bits + * remaining for what follows. We could actually do 3, + * assuming LITLEN_TABLEBITS=11, but that actually + * decreases performance slightly (perhaps by messing + * with the branch prediction of the conditional refill + * that happens later while decoding the match offset). + * + * Note: the definitions of FASTLOOP_MAX_BYTES_WRITTEN + * and FASTLOOP_MAX_BYTES_READ need to be updated if the + * number of extra literals decoded here is changed. + */ + if (/* enough bits for 2 fast literals + length + offset preload? */ + CAN_CONSUME_AND_THEN_PRELOAD(2 * LITLEN_TABLEBITS + + LENGTH_MAXBITS, + OFFSET_TABLEBITS) && + /* enough bits for 2 fast literals + slow literal + litlen preload? */ + CAN_CONSUME_AND_THEN_PRELOAD(2 * LITLEN_TABLEBITS + + DEFLATE_MAX_LITLEN_CODEWORD_LEN, + LITLEN_TABLEBITS)) { + /* 1st extra fast literal */ + lit = entry >> 16; + entry = d->u.litlen_decode_table[bitbuf & litlen_tablemask]; + saved_bitbuf = bitbuf; + bitbuf >>= (u8)entry; + bitsleft -= entry; + *out_next++ = lit; + if (entry & HUFFDEC_LITERAL) { + /* 2nd extra fast literal */ + lit = entry >> 16; + entry = d->u.litlen_decode_table[bitbuf & litlen_tablemask]; + saved_bitbuf = bitbuf; + bitbuf >>= (u8)entry; + bitsleft -= entry; + *out_next++ = lit; + if (entry & HUFFDEC_LITERAL) { + /* + * Another fast literal, but + * this one is in lieu of the + * primary item, so it doesn't + * count as one of the extras. + */ + lit = entry >> 16; + entry = d->u.litlen_decode_table[bitbuf & litlen_tablemask]; + REFILL_BITS_IN_FASTLOOP(); + *out_next++ = lit; + continue; + } + } + } else { + /* + * Decode a literal. While doing so, preload + * the next litlen decode table entry and refill + * the bitbuffer. To reduce latency, we've + * arranged for there to be enough "preloadable" + * bits remaining to do the table preload + * independently of the refill. + */ + STATIC_ASSERT(CAN_CONSUME_AND_THEN_PRELOAD( + LITLEN_TABLEBITS, LITLEN_TABLEBITS)); + lit = entry >> 16; + entry = d->u.litlen_decode_table[bitbuf & litlen_tablemask]; + REFILL_BITS_IN_FASTLOOP(); + *out_next++ = lit; + continue; + } + } + + /* + * It's not a literal entry, so it can be a length entry, a + * subtable pointer entry, or an end-of-block entry. Detect the + * two unlikely cases by testing the HUFFDEC_EXCEPTIONAL flag. + */ + if (unlikely(entry & HUFFDEC_EXCEPTIONAL)) { + /* Subtable pointer or end-of-block entry */ + + if (unlikely(entry & HUFFDEC_END_OF_BLOCK)) + goto block_done; + + /* + * A subtable is required. Load and consume the + * subtable entry. The subtable entry can be of any + * type: literal, length, or end-of-block. + */ + entry = d->u.litlen_decode_table[(entry >> 16) + + EXTRACT_VARBITS(bitbuf, (entry >> 8) & 0x3F)]; + saved_bitbuf = bitbuf; + bitbuf >>= (u8)entry; + bitsleft -= entry; + + /* + * 32-bit platforms that use the byte-at-a-time refill + * method have to do a refill here for there to always + * be enough bits to decode a literal that requires a + * subtable, then preload the next litlen decode table + * entry; or to decode a match length that requires a + * subtable, then preload the offset decode table entry. + */ + if (!CAN_CONSUME_AND_THEN_PRELOAD(DEFLATE_MAX_LITLEN_CODEWORD_LEN, + LITLEN_TABLEBITS) || + !CAN_CONSUME_AND_THEN_PRELOAD(LENGTH_MAXBITS, + OFFSET_TABLEBITS)) + REFILL_BITS_IN_FASTLOOP(); + if (entry & HUFFDEC_LITERAL) { + /* Decode a literal that required a subtable. */ + lit = entry >> 16; + entry = d->u.litlen_decode_table[bitbuf & litlen_tablemask]; + REFILL_BITS_IN_FASTLOOP(); + *out_next++ = lit; + continue; + } + if (unlikely(entry & HUFFDEC_END_OF_BLOCK)) + goto block_done; + /* Else, it's a length that required a subtable. */ + } + + /* + * Decode the match length: the length base value associated + * with the litlen symbol (which we extract from the decode + * table entry), plus the extra length bits. We don't need to + * consume the extra length bits here, as they were included in + * the bits consumed by the entry earlier. We also don't need + * to check for too-long matches here, as this is inside the + * fastloop where it's already been verified that the output + * buffer has enough space remaining to copy a max-length match. + */ + length = entry >> 16; + length += EXTRACT_VARBITS8(saved_bitbuf, entry) >> (u8)(entry >> 8); + + /* + * Decode the match offset. There are enough "preloadable" bits + * remaining to preload the offset decode table entry, but a + * refill might be needed before consuming it. + */ + STATIC_ASSERT(CAN_CONSUME_AND_THEN_PRELOAD(LENGTH_MAXFASTBITS, + OFFSET_TABLEBITS)); + entry = d->offset_decode_table[bitbuf & BITMASK(OFFSET_TABLEBITS)]; + if (CAN_CONSUME_AND_THEN_PRELOAD(OFFSET_MAXBITS, + LITLEN_TABLEBITS)) { + /* + * Decoding a match offset on a 64-bit platform. We may + * need to refill once, but then we can decode the whole + * offset and preload the next litlen table entry. + */ + if (unlikely(entry & HUFFDEC_EXCEPTIONAL)) { + /* Offset codeword requires a subtable */ + if (unlikely((u8)bitsleft < OFFSET_MAXBITS + + LITLEN_TABLEBITS - PRELOAD_SLACK)) + REFILL_BITS_IN_FASTLOOP(); + bitbuf >>= OFFSET_TABLEBITS; + bitsleft -= OFFSET_TABLEBITS; + entry = d->offset_decode_table[(entry >> 16) + + EXTRACT_VARBITS(bitbuf, (entry >> 8) & 0x3F)]; + } else if (unlikely((u8)bitsleft < OFFSET_MAXFASTBITS + + LITLEN_TABLEBITS - PRELOAD_SLACK)) + REFILL_BITS_IN_FASTLOOP(); + } else { + /* Decoding a match offset on a 32-bit platform */ + REFILL_BITS_IN_FASTLOOP(); + if (unlikely(entry & HUFFDEC_EXCEPTIONAL)) { + /* Offset codeword requires a subtable */ + bitbuf >>= OFFSET_TABLEBITS; + bitsleft -= OFFSET_TABLEBITS; + entry = d->offset_decode_table[(entry >> 16) + + EXTRACT_VARBITS(bitbuf, (entry >> 8) & 0x3F)]; + REFILL_BITS_IN_FASTLOOP(); + /* No further refill needed before extra bits */ + STATIC_ASSERT(CAN_CONSUME( + OFFSET_MAXBITS - OFFSET_TABLEBITS)); + } else { + /* No refill needed before extra bits */ + STATIC_ASSERT(CAN_CONSUME(OFFSET_MAXFASTBITS)); + } + } + saved_bitbuf = bitbuf; + bitbuf >>= (u8)entry; + bitsleft -= entry; /* optimization: subtract full entry */ + offset = entry >> 16; + offset += EXTRACT_VARBITS8(saved_bitbuf, entry) >> (u8)(entry >> 8); + + /* Validate the match offset; needed even in the fastloop. */ + SAFETY_CHECK(offset <= out_next - (const u8 *)out); + src = out_next - offset; + dst = out_next; + out_next += length; + + /* + * Before starting to issue the instructions to copy the match, + * refill the bitbuffer and preload the litlen decode table + * entry for the next loop iteration. This can increase + * performance by allowing the latency of the match copy to + * overlap with these other operations. To further reduce + * latency, we've arranged for there to be enough bits remaining + * to do the table preload independently of the refill, except + * on 32-bit platforms using the byte-at-a-time refill method. + */ + if (!CAN_CONSUME_AND_THEN_PRELOAD( + MAX(OFFSET_MAXBITS - OFFSET_TABLEBITS, + OFFSET_MAXFASTBITS), + LITLEN_TABLEBITS) && + unlikely((u8)bitsleft < LITLEN_TABLEBITS - PRELOAD_SLACK)) + REFILL_BITS_IN_FASTLOOP(); + entry = d->u.litlen_decode_table[bitbuf & litlen_tablemask]; + REFILL_BITS_IN_FASTLOOP(); + + /* + * Copy the match. On most CPUs the fastest method is a + * word-at-a-time copy, unconditionally copying about 5 words + * since this is enough for most matches without being too much. + * + * The normal word-at-a-time copy works for offset >= WORDBYTES, + * which is most cases. The case of offset == 1 is also common + * and is worth optimizing for, since it is just RLE encoding of + * the previous byte, which is the result of compressing long + * runs of the same byte. + * + * Writing past the match 'length' is allowed here, since it's + * been ensured there is enough output space left for a slight + * overrun. FASTLOOP_MAX_BYTES_WRITTEN needs to be updated if + * the maximum possible overrun here is changed. + */ + if (UNALIGNED_ACCESS_IS_FAST && offset >= WORDBYTES) { + store_word_unaligned(load_word_unaligned(src), dst); + src += WORDBYTES; + dst += WORDBYTES; + store_word_unaligned(load_word_unaligned(src), dst); + src += WORDBYTES; + dst += WORDBYTES; + store_word_unaligned(load_word_unaligned(src), dst); + src += WORDBYTES; + dst += WORDBYTES; + store_word_unaligned(load_word_unaligned(src), dst); + src += WORDBYTES; + dst += WORDBYTES; + store_word_unaligned(load_word_unaligned(src), dst); + src += WORDBYTES; + dst += WORDBYTES; + while (dst < out_next) { + store_word_unaligned(load_word_unaligned(src), dst); + src += WORDBYTES; + dst += WORDBYTES; + store_word_unaligned(load_word_unaligned(src), dst); + src += WORDBYTES; + dst += WORDBYTES; + store_word_unaligned(load_word_unaligned(src), dst); + src += WORDBYTES; + dst += WORDBYTES; + store_word_unaligned(load_word_unaligned(src), dst); + src += WORDBYTES; + dst += WORDBYTES; + store_word_unaligned(load_word_unaligned(src), dst); + src += WORDBYTES; + dst += WORDBYTES; + } + } else if (UNALIGNED_ACCESS_IS_FAST && offset == 1) { + machine_word_t v; + + /* + * This part tends to get auto-vectorized, so keep it + * copying a multiple of 16 bytes at a time. + */ + v = (machine_word_t)0x0101010101010101 * src[0]; + store_word_unaligned(v, dst); + dst += WORDBYTES; + store_word_unaligned(v, dst); + dst += WORDBYTES; + store_word_unaligned(v, dst); + dst += WORDBYTES; + store_word_unaligned(v, dst); + dst += WORDBYTES; + while (dst < out_next) { + store_word_unaligned(v, dst); + dst += WORDBYTES; + store_word_unaligned(v, dst); + dst += WORDBYTES; + store_word_unaligned(v, dst); + dst += WORDBYTES; + store_word_unaligned(v, dst); + dst += WORDBYTES; + } + } else if (UNALIGNED_ACCESS_IS_FAST) { + store_word_unaligned(load_word_unaligned(src), dst); + src += offset; + dst += offset; + store_word_unaligned(load_word_unaligned(src), dst); + src += offset; + dst += offset; + do { + store_word_unaligned(load_word_unaligned(src), dst); + src += offset; + dst += offset; + store_word_unaligned(load_word_unaligned(src), dst); + src += offset; + dst += offset; + } while (dst < out_next); + } else { + *dst++ = *src++; + *dst++ = *src++; + do { + *dst++ = *src++; + } while (dst < out_next); + } + } while (in_next < in_fastloop_end && out_next < out_fastloop_end); + + /* + * This is the generic loop for decoding literals and matches. This + * handles cases where in_next and out_next are close to the end of + * their respective buffers. Usually this loop isn't performance- + * critical, as most time is spent in the fastloop above instead. We + * therefore omit some optimizations here in favor of smaller code. + */ +generic_loop: + for (;;) { + u32 length, offset; + const u8 *src; + u8 *dst; + + REFILL_BITS(); + entry = d->u.litlen_decode_table[bitbuf & litlen_tablemask]; + saved_bitbuf = bitbuf; + bitbuf >>= (u8)entry; + bitsleft -= entry; + if (unlikely(entry & HUFFDEC_SUBTABLE_POINTER)) { + entry = d->u.litlen_decode_table[(entry >> 16) + + EXTRACT_VARBITS(bitbuf, (entry >> 8) & 0x3F)]; + saved_bitbuf = bitbuf; + bitbuf >>= (u8)entry; + bitsleft -= entry; + } + length = entry >> 16; + if (entry & HUFFDEC_LITERAL) { + if (unlikely(out_next == out_end)) + return LIBDEFLATE_INSUFFICIENT_SPACE; + *out_next++ = length; + continue; + } + if (unlikely(entry & HUFFDEC_END_OF_BLOCK)) + goto block_done; + length += EXTRACT_VARBITS8(saved_bitbuf, entry) >> (u8)(entry >> 8); + if (unlikely(length > out_end - out_next)) + return LIBDEFLATE_INSUFFICIENT_SPACE; + + if (!CAN_CONSUME(LENGTH_MAXBITS + OFFSET_MAXBITS)) + REFILL_BITS(); + entry = d->offset_decode_table[bitbuf & BITMASK(OFFSET_TABLEBITS)]; + if (unlikely(entry & HUFFDEC_EXCEPTIONAL)) { + bitbuf >>= OFFSET_TABLEBITS; + bitsleft -= OFFSET_TABLEBITS; + entry = d->offset_decode_table[(entry >> 16) + + EXTRACT_VARBITS(bitbuf, (entry >> 8) & 0x3F)]; + if (!CAN_CONSUME(OFFSET_MAXBITS)) + REFILL_BITS(); + } + offset = entry >> 16; + offset += EXTRACT_VARBITS8(bitbuf, entry) >> (u8)(entry >> 8); + bitbuf >>= (u8)entry; + bitsleft -= entry; + + SAFETY_CHECK(offset <= out_next - (const u8 *)out); + src = out_next - offset; + dst = out_next; + out_next += length; + + STATIC_ASSERT(DEFLATE_MIN_MATCH_LEN == 3); + *dst++ = *src++; + *dst++ = *src++; + do { + *dst++ = *src++; + } while (dst < out_next); + } + +block_done: + /* Finished decoding a block */ + + if (!is_final_block) + goto next_block; + + /* That was the last block. */ + + bitsleft = (u8)bitsleft; + + /* + * If any of the implicit appended zero bytes were consumed (not just + * refilled) before hitting end of stream, then the data is bad. + */ + SAFETY_CHECK(overread_count <= (bitsleft >> 3)); + + /* Optionally return the actual number of bytes consumed. */ + if (actual_in_nbytes_ret) { + /* Don't count bytes that were refilled but not consumed. */ + in_next -= (bitsleft >> 3) - overread_count; + + *actual_in_nbytes_ret = in_next - (u8 *)in; + } + + /* Optionally return the actual number of bytes written. */ + if (actual_out_nbytes_ret) { + *actual_out_nbytes_ret = out_next - (u8 *)out; + } else { + if (out_next != out_end) + return LIBDEFLATE_SHORT_OUTPUT; + } + return LIBDEFLATE_SUCCESS; +} + +#undef FUNCNAME +#undef ATTRIBUTES +#undef EXTRACT_VARBITS +#undef EXTRACT_VARBITS8 diff --git a/tools/z64compress/src/enc/libdeflate/lib/deflate_compress.c b/tools/z64compress/src/enc/libdeflate/lib/deflate_compress.c new file mode 100644 index 000000000..7c92d9823 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/deflate_compress.c @@ -0,0 +1,3877 @@ +/* + * deflate_compress.c - a compressor for DEFLATE + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "deflate_compress.h" +#include "deflate_constants.h" + +#include "libdeflate.h" + +/******************************************************************************/ + +/* + * The following parameters can be changed at build time to customize the + * compression algorithms slightly: + * + * (Note, not all customizable parameters are here. Some others can be found in + * libdeflate_alloc_compressor() and in *_matchfinder.h.) + */ + +/* + * If this parameter is defined to 1, then the near-optimal parsing algorithm + * will be included, and compression levels 10-12 will use it. This algorithm + * usually produces a compression ratio significantly better than the other + * algorithms. However, it is slow. If this parameter is defined to 0, then + * levels 10-12 will be the same as level 9 and will use the lazy2 algorithm. + */ +#define SUPPORT_NEAR_OPTIMAL_PARSING 1 + +/* + * This is the minimum block length that the compressor will use, in + * uncompressed bytes. This should be a value below which using shorter blocks + * is unlikely to be worthwhile, due to the per-block overhead. This value does + * not apply to the final block, which may be shorter than this (if the input is + * shorter, it will have to be), or to the final uncompressed block in a series + * of uncompressed blocks that cover more than UINT16_MAX bytes. + * + * This value is also approximately the amount by which what would otherwise be + * the second-to-last block is allowed to grow past the soft maximum length in + * order to avoid having to use a very short final block. + * + * Defining a fixed minimum block length is needed in order to guarantee a + * reasonable upper bound on the compressed size. It's also needed because our + * block splitting algorithm doesn't work well on very short blocks. + */ +#define MIN_BLOCK_LENGTH 5000 + +/* + * For the greedy, lazy, lazy2, and near-optimal compressors: This is the soft + * maximum block length, in uncompressed bytes. The compressor will try to end + * blocks at this length, but it may go slightly past it if there is a match + * that straddles this limit or if the input data ends soon after this limit. + * This parameter doesn't apply to uncompressed blocks, which the DEFLATE format + * limits to 65535 bytes. + * + * This should be a value above which it is very likely that splitting the block + * would produce a better compression ratio. For the near-optimal compressor, + * increasing/decreasing this parameter will increase/decrease per-compressor + * memory usage linearly. + */ +#define SOFT_MAX_BLOCK_LENGTH 300000 + +/* + * For the greedy, lazy, and lazy2 compressors: this is the length of the + * sequence store, which is an array where the compressor temporarily stores + * matches that it's going to use in the current block. This value is the + * maximum number of matches that can be used in a block. If the sequence store + * fills up, then the compressor will be forced to end the block early. This + * value should be large enough so that this rarely happens, due to the block + * being ended normally before then. Increasing/decreasing this value will + * increase/decrease per-compressor memory usage linearly. + */ +#define SEQ_STORE_LENGTH 50000 + +/* + * For deflate_compress_fastest(): This is the soft maximum block length. + * deflate_compress_fastest() doesn't use the regular block splitting algorithm; + * it only ends blocks when they reach FAST_SOFT_MAX_BLOCK_LENGTH bytes or + * FAST_SEQ_STORE_LENGTH matches. Therefore, this value should be lower than + * the regular SOFT_MAX_BLOCK_LENGTH. + */ +#define FAST_SOFT_MAX_BLOCK_LENGTH 65535 + +/* + * For deflate_compress_fastest(): this is the length of the sequence store. + * This is like SEQ_STORE_LENGTH, but this should be a lower value. + */ +#define FAST_SEQ_STORE_LENGTH 8192 + +/* + * These are the maximum codeword lengths, in bits, the compressor will use for + * each Huffman code. The DEFLATE format defines limits for these. However, + * further limiting litlen codewords to 14 bits is beneficial, since it has + * negligible effect on compression ratio but allows some optimizations when + * outputting bits. (It allows 4 literals to be written at once rather than 3.) + */ +#define MAX_LITLEN_CODEWORD_LEN 14 +#define MAX_OFFSET_CODEWORD_LEN DEFLATE_MAX_OFFSET_CODEWORD_LEN +#define MAX_PRE_CODEWORD_LEN DEFLATE_MAX_PRE_CODEWORD_LEN + +#if SUPPORT_NEAR_OPTIMAL_PARSING + +/* Parameters specific to the near-optimal parsing algorithm */ + +/* + * BIT_COST is a scaling factor that allows the near-optimal compressor to + * consider fractional bit costs when deciding which literal/match sequence to + * use. This is useful when the true symbol costs are unknown. For example, if + * the compressor thinks that a symbol has 6.5 bits of entropy, it can set its + * cost to 6.5 bits rather than have to use 6 or 7 bits. Although in the end + * each symbol will use a whole number of bits due to the Huffman coding, + * considering fractional bits can be helpful due to the limited information. + * + * BIT_COST should be a power of 2. A value of 8 or 16 works well. A higher + * value isn't very useful since the calculations are approximate anyway. + * + * BIT_COST doesn't apply to deflate_flush_block(), which considers whole bits. + */ +#define BIT_COST 16 + +/* + * The NOSTAT_BITS value for a given alphabet is the number of bits assumed to + * be needed to output a symbol that was unused in the previous optimization + * pass. Assigning a default cost allows the symbol to be used in the next + * optimization pass. However, the cost should be relatively high because the + * symbol probably won't be used very many times (if at all). + */ +#define LITERAL_NOSTAT_BITS 13 +#define LENGTH_NOSTAT_BITS 13 +#define OFFSET_NOSTAT_BITS 10 + +/* + * This is (slightly less than) the maximum number of matches that the + * near-optimal compressor will cache per block. This behaves similarly to + * SEQ_STORE_LENGTH for the other compressors. + */ +#define MATCH_CACHE_LENGTH (SOFT_MAX_BLOCK_LENGTH * 5) + +#endif /* SUPPORT_NEAR_OPTIMAL_PARSING */ + +/******************************************************************************/ + +/* Include the needed matchfinders. */ +#define MATCHFINDER_WINDOW_ORDER DEFLATE_WINDOW_ORDER +#include "hc_matchfinder.h" +#include "ht_matchfinder.h" +#if SUPPORT_NEAR_OPTIMAL_PARSING +# include "bt_matchfinder.h" +/* + * This is the maximum number of matches the binary trees matchfinder can find + * at a single position. Since the matchfinder never finds more than one match + * for the same length, presuming one of each possible length is sufficient for + * an upper bound. (This says nothing about whether it is worthwhile to + * consider so many matches; this is just defining the worst case.) + */ +#define MAX_MATCHES_PER_POS \ + (DEFLATE_MAX_MATCH_LEN - DEFLATE_MIN_MATCH_LEN + 1) +#endif + +/* + * The largest block length we will ever use is when the final block is of + * length SOFT_MAX_BLOCK_LENGTH + MIN_BLOCK_LENGTH - 1, or when any block is of + * length SOFT_MAX_BLOCK_LENGTH + 1 + DEFLATE_MAX_MATCH_LEN. The latter case + * occurs when the lazy2 compressor chooses two literals and a maximum-length + * match, starting at SOFT_MAX_BLOCK_LENGTH - 1. + */ +#define MAX_BLOCK_LENGTH \ + MAX(SOFT_MAX_BLOCK_LENGTH + MIN_BLOCK_LENGTH - 1, \ + SOFT_MAX_BLOCK_LENGTH + 1 + DEFLATE_MAX_MATCH_LEN) + +static forceinline void +check_buildtime_parameters(void) +{ + /* + * Verify that MIN_BLOCK_LENGTH is being honored, as + * libdeflate_deflate_compress_bound() depends on it. + */ + STATIC_ASSERT(SOFT_MAX_BLOCK_LENGTH >= MIN_BLOCK_LENGTH); + STATIC_ASSERT(FAST_SOFT_MAX_BLOCK_LENGTH >= MIN_BLOCK_LENGTH); + STATIC_ASSERT(SEQ_STORE_LENGTH * DEFLATE_MIN_MATCH_LEN >= + MIN_BLOCK_LENGTH); + STATIC_ASSERT(FAST_SEQ_STORE_LENGTH * HT_MATCHFINDER_MIN_MATCH_LEN >= + MIN_BLOCK_LENGTH); +#if SUPPORT_NEAR_OPTIMAL_PARSING + STATIC_ASSERT(MIN_BLOCK_LENGTH * MAX_MATCHES_PER_POS <= + MATCH_CACHE_LENGTH); +#endif + + /* The definition of MAX_BLOCK_LENGTH assumes this. */ + STATIC_ASSERT(FAST_SOFT_MAX_BLOCK_LENGTH <= SOFT_MAX_BLOCK_LENGTH); + + /* Verify that the sequence stores aren't uselessly large. */ + STATIC_ASSERT(SEQ_STORE_LENGTH * DEFLATE_MIN_MATCH_LEN <= + SOFT_MAX_BLOCK_LENGTH + MIN_BLOCK_LENGTH); + STATIC_ASSERT(FAST_SEQ_STORE_LENGTH * HT_MATCHFINDER_MIN_MATCH_LEN <= + FAST_SOFT_MAX_BLOCK_LENGTH + MIN_BLOCK_LENGTH); + + /* Verify that the maximum codeword lengths are valid. */ + STATIC_ASSERT( + MAX_LITLEN_CODEWORD_LEN <= DEFLATE_MAX_LITLEN_CODEWORD_LEN); + STATIC_ASSERT( + MAX_OFFSET_CODEWORD_LEN <= DEFLATE_MAX_OFFSET_CODEWORD_LEN); + STATIC_ASSERT( + MAX_PRE_CODEWORD_LEN <= DEFLATE_MAX_PRE_CODEWORD_LEN); + STATIC_ASSERT( + (1U << MAX_LITLEN_CODEWORD_LEN) >= DEFLATE_NUM_LITLEN_SYMS); + STATIC_ASSERT( + (1U << MAX_OFFSET_CODEWORD_LEN) >= DEFLATE_NUM_OFFSET_SYMS); + STATIC_ASSERT( + (1U << MAX_PRE_CODEWORD_LEN) >= DEFLATE_NUM_PRECODE_SYMS); +} + +/******************************************************************************/ + +/* Table: length slot => length slot base value */ +static const unsigned deflate_length_slot_base[] = { + 3, 4, 5, 6, 7, 8, 9, 10, + 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, + 131, 163, 195, 227, 258, +}; + +/* Table: length slot => number of extra length bits */ +static const u8 deflate_extra_length_bits[] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 2, 2, 2, 2, + 3, 3, 3, 3, 4, 4, 4, 4, + 5, 5, 5, 5, 0, +}; + +/* Table: offset slot => offset slot base value */ +static const unsigned deflate_offset_slot_base[] = { + 1, 2, 3, 4, 5, 7, 9, 13, + 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, + 4097, 6145, 8193, 12289, 16385, 24577, +}; + +/* Table: offset slot => number of extra offset bits */ +static const u8 deflate_extra_offset_bits[] = { + 0, 0, 0, 0, 1, 1, 2, 2, + 3, 3, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 8, 9, 9, 10, 10, + 11, 11, 12, 12, 13, 13, +}; + +/* Table: length => length slot */ +static const u8 deflate_length_slot[DEFLATE_MAX_MATCH_LEN + 1] = { + 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, + 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, + 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, + 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 28, +}; + +/* + * A condensed table which maps offset => offset slot as follows: + * + * offset <= 256: deflate_offset_slot[offset] + * offset > 256: deflate_offset_slot[256 + ((offset - 1) >> 7)] + * + * This table was generated by scripts/gen_offset_slot_map.py. + */ +static const u8 deflate_offset_slot[512] = { + 0, 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, + 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, + 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 0, 16, 17, 18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, + 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, + 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +}; + +/* The order in which precode codeword lengths are stored */ +static const u8 deflate_precode_lens_permutation[DEFLATE_NUM_PRECODE_SYMS] = { + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 +}; + +/* Table: precode symbol => number of extra bits */ +static const u8 deflate_extra_precode_bits[DEFLATE_NUM_PRECODE_SYMS] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7 +}; + +/* Codewords for the DEFLATE Huffman codes */ +struct deflate_codewords { + u32 litlen[DEFLATE_NUM_LITLEN_SYMS]; + u32 offset[DEFLATE_NUM_OFFSET_SYMS]; +}; + +/* + * Codeword lengths (in bits) for the DEFLATE Huffman codes. + * A zero length means the corresponding symbol had zero frequency. + */ +struct deflate_lens { + u8 litlen[DEFLATE_NUM_LITLEN_SYMS]; + u8 offset[DEFLATE_NUM_OFFSET_SYMS]; +}; + +/* Codewords and lengths for the DEFLATE Huffman codes */ +struct deflate_codes { + struct deflate_codewords codewords; + struct deflate_lens lens; +}; + +/* Symbol frequency counters for the DEFLATE Huffman codes */ +struct deflate_freqs { + u32 litlen[DEFLATE_NUM_LITLEN_SYMS]; + u32 offset[DEFLATE_NUM_OFFSET_SYMS]; +}; + +/* + * Represents a run of literals followed by a match or end-of-block. This + * struct is needed to temporarily store items chosen by the parser, since items + * cannot be written until all items for the block have been chosen and the + * block's Huffman codes have been computed. + */ +struct deflate_sequence { + + /* + * Bits 0..22: the number of literals in this run. This may be 0 and + * can be at most MAX_BLOCK_LENGTH. The literals are not stored + * explicitly in this structure; instead, they are read directly from + * the uncompressed data. + * + * Bits 23..31: the length of the match which follows the literals, or 0 + * if this literal run was the last in the block, so there is no match + * which follows it. + */ +#define SEQ_LENGTH_SHIFT 23 +#define SEQ_LITRUNLEN_MASK (((u32)1 << SEQ_LENGTH_SHIFT) - 1) + u32 litrunlen_and_length; + + /* + * If 'length' doesn't indicate end-of-block, then this is the offset of + * the match which follows the literals. + */ + u16 offset; + + /* + * If 'length' doesn't indicate end-of-block, then this is the offset + * slot of the match which follows the literals. + */ + u16 offset_slot; +}; + +#if SUPPORT_NEAR_OPTIMAL_PARSING + +/* Costs for the near-optimal parsing algorithm */ +struct deflate_costs { + + /* The cost to output each possible literal */ + u32 literal[DEFLATE_NUM_LITERALS]; + + /* The cost to output each possible match length */ + u32 length[DEFLATE_MAX_MATCH_LEN + 1]; + + /* The cost to output a match offset of each possible offset slot */ + u32 offset_slot[DEFLATE_NUM_OFFSET_SYMS]; +}; + +/* + * This structure represents a byte position in the input data and a node in the + * graph of possible match/literal choices for the current block. + * + * Logically, each incoming edge to this node is labeled with a literal or a + * match that can be taken to reach this position from an earlier position; and + * each outgoing edge from this node is labeled with a literal or a match that + * can be taken to advance from this position to a later position. + * + * But these "edges" are actually stored elsewhere (in 'match_cache'). Here we + * associate with each node just two pieces of information: + * + * 'cost_to_end' is the minimum cost to reach the end of the block from + * this position. + * + * 'item' represents the literal or match that must be chosen from here to + * reach the end of the block with the minimum cost. Equivalently, this + * can be interpreted as the label of the outgoing edge on the minimum-cost + * path to the "end of block" node from this node. + */ +struct deflate_optimum_node { + + u32 cost_to_end; + + /* + * Notes on the match/literal representation used here: + * + * The low bits of 'item' are the length: 1 if this is a literal, + * or the match length if this is a match. + * + * The high bits of 'item' are the actual literal byte if this is a + * literal, or the match offset if this is a match. + */ +#define OPTIMUM_OFFSET_SHIFT 9 +#define OPTIMUM_LEN_MASK (((u32)1 << OPTIMUM_OFFSET_SHIFT) - 1) + u32 item; + +}; + +#endif /* SUPPORT_NEAR_OPTIMAL_PARSING */ + +/* Block split statistics. See "Block splitting algorithm" below. */ +#define NUM_LITERAL_OBSERVATION_TYPES 8 +#define NUM_MATCH_OBSERVATION_TYPES 2 +#define NUM_OBSERVATION_TYPES (NUM_LITERAL_OBSERVATION_TYPES + \ + NUM_MATCH_OBSERVATION_TYPES) +#define NUM_OBSERVATIONS_PER_BLOCK_CHECK 512 +struct block_split_stats { + u32 new_observations[NUM_OBSERVATION_TYPES]; + u32 observations[NUM_OBSERVATION_TYPES]; + u32 num_new_observations; + u32 num_observations; +}; + +struct deflate_output_bitstream; + +/* The main DEFLATE compressor structure */ +struct libdeflate_compressor { + + /* Pointer to the compress() implementation chosen at allocation time */ + void (*impl)(struct libdeflate_compressor *restrict c, const u8 *in, + size_t in_nbytes, struct deflate_output_bitstream *os); + + /* The compression level with which this compressor was created */ + unsigned compression_level; + + /* Anything of this size or less we won't bother trying to compress. */ + size_t max_passthrough_size; + + /* + * The maximum search depth: consider at most this many potential + * matches at each position + */ + unsigned max_search_depth; + + /* + * The "nice" match length: if a match of this length is found, choose + * it immediately without further consideration + */ + unsigned nice_match_length; + + /* Frequency counters for the current block */ + struct deflate_freqs freqs; + + /* Block split statistics for the current block */ + struct block_split_stats split_stats; + + /* Dynamic Huffman codes for the current block */ + struct deflate_codes codes; + + /* The static Huffman codes defined by the DEFLATE format */ + struct deflate_codes static_codes; + + /* Temporary space for block flushing */ + union { + /* Information about the precode */ + struct { + u32 freqs[DEFLATE_NUM_PRECODE_SYMS]; + u32 codewords[DEFLATE_NUM_PRECODE_SYMS]; + u8 lens[DEFLATE_NUM_PRECODE_SYMS]; + unsigned items[DEFLATE_NUM_LITLEN_SYMS + + DEFLATE_NUM_OFFSET_SYMS]; + unsigned num_litlen_syms; + unsigned num_offset_syms; + unsigned num_explicit_lens; + unsigned num_items; + } precode; + /* + * The "full" length codewords. Used only after the information + * in 'precode' is no longer needed. + */ + struct { + u32 codewords[DEFLATE_MAX_MATCH_LEN + 1]; + u8 lens[DEFLATE_MAX_MATCH_LEN + 1]; + } length; + } o; + + union { + /* Data for greedy or lazy parsing */ + struct { + /* Hash chains matchfinder */ + struct hc_matchfinder hc_mf; + + /* Matches and literals chosen for the current block */ + struct deflate_sequence sequences[SEQ_STORE_LENGTH + 1]; + + } g; /* (g)reedy */ + + /* Data for fastest parsing */ + struct { + /* Hash table matchfinder */ + struct ht_matchfinder ht_mf; + + /* Matches and literals chosen for the current block */ + struct deflate_sequence sequences[ + FAST_SEQ_STORE_LENGTH + 1]; + + } f; /* (f)astest */ + + #if SUPPORT_NEAR_OPTIMAL_PARSING + /* Data for near-optimal parsing */ + struct { + + /* Binary tree matchfinder */ + struct bt_matchfinder bt_mf; + + /* + * Cached matches for the current block. This array + * contains the matches that were found at each position + * in the block. Specifically, for each position, there + * is a list of matches found at that position, if any, + * sorted by strictly increasing length. In addition, + * following the matches for each position, there is a + * special 'struct lz_match' whose 'length' member + * contains the number of matches found at that + * position, and whose 'offset' member contains the + * literal at that position. + * + * Note: in rare cases, there will be a very high number + * of matches in the block and this array will overflow. + * If this happens, we force the end of the current + * block. MATCH_CACHE_LENGTH is the length at which we + * actually check for overflow. The extra slots beyond + * this are enough to absorb the worst case overflow, + * which occurs if starting at + * &match_cache[MATCH_CACHE_LENGTH - 1], we write + * MAX_MATCHES_PER_POS matches and a match count header, + * then skip searching for matches at + * 'DEFLATE_MAX_MATCH_LEN - 1' positions and write the + * match count header for each. + */ + struct lz_match match_cache[MATCH_CACHE_LENGTH + + MAX_MATCHES_PER_POS + + DEFLATE_MAX_MATCH_LEN - 1]; + + /* + * Array of nodes, one per position, for running the + * minimum-cost path algorithm. + * + * This array must be large enough to accommodate the + * worst-case number of nodes, which is MAX_BLOCK_LENGTH + * plus 1 for the end-of-block node. + */ + struct deflate_optimum_node optimum_nodes[ + MAX_BLOCK_LENGTH + 1]; + + /* The current cost model being used */ + struct deflate_costs costs; + + /* + * A table that maps match offset to offset slot. This + * differs from deflate_offset_slot[] in that this is a + * full map, not a condensed one. The full map is more + * appropriate for the near-optimal parser, since the + * near-optimal parser does more offset => offset_slot + * translations, it doesn't intersperse them with + * matchfinding (so cache evictions are less of a + * concern), and it uses more memory anyway. + */ + u8 offset_slot_full[DEFLATE_MAX_MATCH_OFFSET + 1]; + + /* Literal/match statistics saved from previous block */ + u32 prev_observations[NUM_OBSERVATION_TYPES]; + u32 prev_num_observations; + + /* + * Approximate match length frequencies based on a + * greedy parse, gathered during matchfinding. This is + * used for setting the initial symbol costs. + */ + u32 new_match_len_freqs[DEFLATE_MAX_MATCH_LEN + 1]; + u32 match_len_freqs[DEFLATE_MAX_MATCH_LEN + 1]; + + unsigned num_optim_passes; + } n; /* (n)ear-optimal */ + #endif /* SUPPORT_NEAR_OPTIMAL_PARSING */ + + } p; /* (p)arser */ +}; + +/* + * The type for the bitbuffer variable, which temporarily holds bits that are + * being packed into bytes and written to the output buffer. For best + * performance, this should have size equal to a machine word. + */ +typedef machine_word_t bitbuf_t; + +/* + * The capacity of the bitbuffer, in bits. This is 1 less than the real size, + * in order to avoid undefined behavior when doing bitbuf >>= bitcount & ~7. + */ +#define BITBUF_NBITS (8 * sizeof(bitbuf_t) - 1) + +/* + * Can the specified number of bits always be added to 'bitbuf' after any + * pending bytes have been flushed? There can be up to 7 bits remaining after a + * flush, so the count must not exceed BITBUF_NBITS after adding 'n' more bits. + */ +#define CAN_BUFFER(n) (7 + (n) <= BITBUF_NBITS) + +/* + * Structure to keep track of the current state of sending bits to the + * compressed output buffer + */ +struct deflate_output_bitstream { + + /* Bits that haven't yet been written to the output buffer */ + bitbuf_t bitbuf; + + /* + * Number of bits currently held in @bitbuf. This can be between 0 and + * BITBUF_NBITS in general, or between 0 and 7 after a flush. + */ + unsigned bitcount; + + /* + * Pointer to the position in the output buffer at which the next byte + * should be written + */ + u8 *next; + + /* + * Pointer to near the end of the output buffer. 'next' will never + * exceed this. There are OUTPUT_END_PADDING bytes reserved after this + * to allow branchlessly writing a whole word at this location. + */ + u8 *end; +}; + +/* + * OUTPUT_END_PADDING is the size, in bytes, of the extra space that must be + * present following os->end, in order to not overrun the buffer when generating + * output. When UNALIGNED_ACCESS_IS_FAST, we need at least sizeof(bitbuf_t) + * bytes for put_unaligned_leword(). Otherwise we need only 1 byte. However, + * to make the compression algorithm produce the same result on all CPU + * architectures (which is sometimes desirable), we have to unconditionally use + * the maximum for any CPU, which is sizeof(bitbuf_t) == 8. + */ +#define OUTPUT_END_PADDING 8 + +/* + * Add some bits to the bitbuffer variable of the output bitstream. The caller + * must ensure that 'bitcount + n <= BITBUF_NBITS', by calling FLUSH_BITS() + * frequently enough. + */ +#define ADD_BITS(bits, n) \ +do { \ + bitbuf |= (bitbuf_t)(bits) << bitcount; \ + bitcount += (n); \ + ASSERT(bitcount <= BITBUF_NBITS); \ +} while (0) + +/* Flush bits from the bitbuffer variable to the output buffer. */ +#define FLUSH_BITS() \ +do { \ + if (UNALIGNED_ACCESS_IS_FAST) { \ + /* Flush a whole word (branchlessly). */ \ + put_unaligned_leword(bitbuf, out_next); \ + bitbuf >>= bitcount & ~7; \ + out_next += MIN(out_end - out_next, bitcount >> 3); \ + bitcount &= 7; \ + } else { \ + /* Flush a byte at a time. */ \ + while (bitcount >= 8) { \ + *out_next = bitbuf; \ + if (out_next != out_end) \ + out_next++; \ + bitcount -= 8; \ + bitbuf >>= 8; \ + } \ + } \ +} while (0) + +/* + * Given the binary tree node A[subtree_idx] whose children already satisfy the + * maxheap property, swap the node with its greater child until it is greater + * than or equal to both of its children, so that the maxheap property is + * satisfied in the subtree rooted at A[subtree_idx]. 'A' uses 1-based indices. + */ +static void +heapify_subtree(u32 A[], unsigned length, unsigned subtree_idx) +{ + unsigned parent_idx; + unsigned child_idx; + u32 v; + + v = A[subtree_idx]; + parent_idx = subtree_idx; + while ((child_idx = parent_idx * 2) <= length) { + if (child_idx < length && A[child_idx + 1] > A[child_idx]) + child_idx++; + if (v >= A[child_idx]) + break; + A[parent_idx] = A[child_idx]; + parent_idx = child_idx; + } + A[parent_idx] = v; +} + +/* + * Rearrange the array 'A' so that it satisfies the maxheap property. + * 'A' uses 1-based indices, so the children of A[i] are A[i*2] and A[i*2 + 1]. + */ +static void +heapify_array(u32 A[], unsigned length) +{ + unsigned subtree_idx; + + for (subtree_idx = length / 2; subtree_idx >= 1; subtree_idx--) + heapify_subtree(A, length, subtree_idx); +} + +/* + * Sort the array 'A', which contains 'length' unsigned 32-bit integers. + * + * Note: name this function heap_sort() instead of heapsort() to avoid colliding + * with heapsort() from stdlib.h on BSD-derived systems --- though this isn't + * necessary when compiling with -D_ANSI_SOURCE, which is the better solution. + */ +static void +heap_sort(u32 A[], unsigned length) +{ + A--; /* Use 1-based indices */ + + heapify_array(A, length); + + while (length >= 2) { + u32 tmp = A[length]; + + A[length] = A[1]; + A[1] = tmp; + length--; + heapify_subtree(A, length, 1); + } +} + +#define NUM_SYMBOL_BITS 10 +#define NUM_FREQ_BITS (32 - NUM_SYMBOL_BITS) +#define SYMBOL_MASK ((1 << NUM_SYMBOL_BITS) - 1) +#define FREQ_MASK (~SYMBOL_MASK) + +#define GET_NUM_COUNTERS(num_syms) (num_syms) + +/* + * Sort the symbols primarily by frequency and secondarily by symbol value. + * Discard symbols with zero frequency and fill in an array with the remaining + * symbols, along with their frequencies. The low NUM_SYMBOL_BITS bits of each + * array entry will contain the symbol value, and the remaining bits will + * contain the frequency. + * + * @num_syms + * Number of symbols in the alphabet, at most 1 << NUM_SYMBOL_BITS. + * + * @freqs[num_syms] + * Frequency of each symbol, summing to at most (1 << NUM_FREQ_BITS) - 1. + * + * @lens[num_syms] + * An array that eventually will hold the length of each codeword. This + * function only fills in the codeword lengths for symbols that have zero + * frequency, which are not well defined per se but will be set to 0. + * + * @symout[num_syms] + * The output array, described above. + * + * Returns the number of entries in 'symout' that were filled. This is the + * number of symbols that have nonzero frequency. + */ +static unsigned +sort_symbols(unsigned num_syms, const u32 freqs[], u8 lens[], u32 symout[]) +{ + unsigned sym; + unsigned i; + unsigned num_used_syms; + unsigned num_counters; + unsigned counters[GET_NUM_COUNTERS(DEFLATE_MAX_NUM_SYMS)]; + + /* + * We use heapsort, but with an added optimization. Since often most + * symbol frequencies are low, we first do a count sort using a limited + * number of counters. High frequencies are counted in the last + * counter, and only they will be sorted with heapsort. + * + * Note: with more symbols, it is generally beneficial to have more + * counters. About 1 counter per symbol seems fastest. + */ + + num_counters = GET_NUM_COUNTERS(num_syms); + + memset(counters, 0, num_counters * sizeof(counters[0])); + + /* Count the frequencies. */ + for (sym = 0; sym < num_syms; sym++) + counters[MIN(freqs[sym], num_counters - 1)]++; + + /* + * Make the counters cumulative, ignoring the zero-th, which counted + * symbols with zero frequency. As a side effect, this calculates the + * number of symbols with nonzero frequency. + */ + num_used_syms = 0; + for (i = 1; i < num_counters; i++) { + unsigned count = counters[i]; + + counters[i] = num_used_syms; + num_used_syms += count; + } + + /* + * Sort nonzero-frequency symbols using the counters. At the same time, + * set the codeword lengths of zero-frequency symbols to 0. + */ + for (sym = 0; sym < num_syms; sym++) { + u32 freq = freqs[sym]; + + if (freq != 0) { + symout[counters[MIN(freq, num_counters - 1)]++] = + sym | (freq << NUM_SYMBOL_BITS); + } else { + lens[sym] = 0; + } + } + + /* Sort the symbols counted in the last counter. */ + heap_sort(symout + counters[num_counters - 2], + counters[num_counters - 1] - counters[num_counters - 2]); + + return num_used_syms; +} + +/* + * Build a Huffman tree. + * + * This is an optimized implementation that + * (a) takes advantage of the frequencies being already sorted; + * (b) only generates non-leaf nodes, since the non-leaf nodes of a Huffman + * tree are sufficient to generate a canonical code; + * (c) Only stores parent pointers, not child pointers; + * (d) Produces the nodes in the same memory used for input frequency + * information. + * + * Array 'A', which contains 'sym_count' entries, is used for both input and + * output. For this function, 'sym_count' must be at least 2. + * + * For input, the array must contain the frequencies of the symbols, sorted in + * increasing order. Specifically, each entry must contain a frequency left + * shifted by NUM_SYMBOL_BITS bits. Any data in the low NUM_SYMBOL_BITS bits of + * the entries will be ignored by this function. Although these bits will, in + * fact, contain the symbols that correspond to the frequencies, this function + * is concerned with frequencies only and keeps the symbols as-is. + * + * For output, this function will produce the non-leaf nodes of the Huffman + * tree. These nodes will be stored in the first (sym_count - 1) entries of the + * array. Entry A[sym_count - 2] will represent the root node. Each other node + * will contain the zero-based index of its parent node in 'A', left shifted by + * NUM_SYMBOL_BITS bits. The low NUM_SYMBOL_BITS bits of each entry in A will + * be kept as-is. Again, note that although these low bits will, in fact, + * contain a symbol value, this symbol will have *no relationship* with the + * Huffman tree node that happens to occupy the same slot. This is because this + * implementation only generates the non-leaf nodes of the tree. + */ +static void +build_tree(u32 A[], unsigned sym_count) +{ + const unsigned last_idx = sym_count - 1; + + /* Index of the next lowest frequency leaf that still needs a parent */ + unsigned i = 0; + + /* + * Index of the next lowest frequency non-leaf that still needs a + * parent, or 'e' if there is currently no such node + */ + unsigned b = 0; + + /* Index of the next spot for a non-leaf (will overwrite a leaf) */ + unsigned e = 0; + + do { + u32 new_freq; + + /* + * Select the next two lowest frequency nodes among the leaves + * A[i] and non-leaves A[b], and create a new node A[e] to be + * their parent. Set the new node's frequency to the sum of the + * frequencies of its two children. + * + * Usually the next two lowest frequency nodes are of the same + * type (leaf or non-leaf), so check those cases first. + */ + if (i + 1 <= last_idx && + (b == e || (A[i + 1] & FREQ_MASK) <= (A[b] & FREQ_MASK))) { + /* Two leaves */ + new_freq = (A[i] & FREQ_MASK) + (A[i + 1] & FREQ_MASK); + i += 2; + } else if (b + 2 <= e && + (i > last_idx || + (A[b + 1] & FREQ_MASK) < (A[i] & FREQ_MASK))) { + /* Two non-leaves */ + new_freq = (A[b] & FREQ_MASK) + (A[b + 1] & FREQ_MASK); + A[b] = (e << NUM_SYMBOL_BITS) | (A[b] & SYMBOL_MASK); + A[b + 1] = (e << NUM_SYMBOL_BITS) | + (A[b + 1] & SYMBOL_MASK); + b += 2; + } else { + /* One leaf and one non-leaf */ + new_freq = (A[i] & FREQ_MASK) + (A[b] & FREQ_MASK); + A[b] = (e << NUM_SYMBOL_BITS) | (A[b] & SYMBOL_MASK); + i++; + b++; + } + A[e] = new_freq | (A[e] & SYMBOL_MASK); + /* + * A binary tree with 'n' leaves has 'n - 1' non-leaves, so the + * tree is complete once we've created 'n - 1' non-leaves. + */ + } while (++e < last_idx); +} + +/* + * Given the stripped-down Huffman tree constructed by build_tree(), determine + * the number of codewords that should be assigned each possible length, taking + * into account the length-limited constraint. + * + * @A + * The array produced by build_tree(), containing parent index information + * for the non-leaf nodes of the Huffman tree. Each entry in this array is + * a node; a node's parent always has a greater index than that node + * itself. This function will overwrite the parent index information in + * this array, so essentially it will destroy the tree. However, the data + * in the low NUM_SYMBOL_BITS of each entry will be preserved. + * + * @root_idx + * The 0-based index of the root node in 'A', and consequently one less + * than the number of tree node entries in 'A'. (Or, really 2 less than + * the actual length of 'A'.) + * + * @len_counts + * An array of length ('max_codeword_len' + 1) in which the number of + * codewords having each length <= max_codeword_len will be returned. + * + * @max_codeword_len + * The maximum permissible codeword length. + */ +static void +compute_length_counts(u32 A[], unsigned root_idx, unsigned len_counts[], + unsigned max_codeword_len) +{ + unsigned len; + int node; + + /* + * The key observations are: + * + * (1) We can traverse the non-leaf nodes of the tree, always visiting a + * parent before its children, by simply iterating through the array + * in reverse order. Consequently, we can compute the depth of each + * node in one pass, overwriting the parent indices with depths. + * + * (2) We can initially assume that in the real Huffman tree, both + * children of the root are leaves. This corresponds to two + * codewords of length 1. Then, whenever we visit a (non-leaf) node + * during the traversal, we modify this assumption to account for + * the current node *not* being a leaf, but rather its two children + * being leaves. This causes the loss of one codeword for the + * current depth and the addition of two codewords for the current + * depth plus one. + * + * (3) We can handle the length-limited constraint fairly easily by + * simply using the largest length available when a depth exceeds + * max_codeword_len. + */ + + for (len = 0; len <= max_codeword_len; len++) + len_counts[len] = 0; + len_counts[1] = 2; + + /* Set the root node's depth to 0. */ + A[root_idx] &= SYMBOL_MASK; + + for (node = root_idx - 1; node >= 0; node--) { + + /* Calculate the depth of this node. */ + + unsigned parent = A[node] >> NUM_SYMBOL_BITS; + unsigned parent_depth = A[parent] >> NUM_SYMBOL_BITS; + unsigned depth = parent_depth + 1; + + /* + * Set the depth of this node so that it is available when its + * children (if any) are processed. + */ + A[node] = (A[node] & SYMBOL_MASK) | (depth << NUM_SYMBOL_BITS); + + /* + * If needed, decrease the length to meet the length-limited + * constraint. This is not the optimal method for generating + * length-limited Huffman codes! But it should be good enough. + */ + if (depth >= max_codeword_len) { + depth = max_codeword_len; + do { + depth--; + } while (len_counts[depth] == 0); + } + + /* + * Account for the fact that we have a non-leaf node at the + * current depth. + */ + len_counts[depth]--; + len_counts[depth + 1] += 2; + } +} + +/* + * DEFLATE uses bit-reversed codewords, so we must bit-reverse the codewords + * after generating them. All codewords have length <= 16 bits. If the CPU has + * a bit-reversal instruction, then that is the fastest method. Otherwise the + * fastest method is to reverse the bits in each of the two bytes using a table. + * The table method is slightly faster than using bitwise operations to flip + * adjacent 1, 2, 4, and then 8-bit fields, even if 2 to 4 codewords are packed + * into a machine word and processed together using that method. + */ + +#ifdef rbit32 +static forceinline u32 reverse_codeword(u32 codeword, u8 len) +{ + return rbit32(codeword) >> ((32 - len) & 31); +} +#else +/* Generated by scripts/gen_bitreverse_tab.py */ +static const u8 bitreverse_tab[256] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, + 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, + 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, + 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, + 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, + 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, + 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, + 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, + 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, + 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, + 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, + 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, + 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, + 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, + 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, + 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, + 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, + 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, + 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, + 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, + 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, + 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, + 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, + 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, + 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, + 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, + 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, +}; + +static forceinline u32 reverse_codeword(u32 codeword, u8 len) +{ + STATIC_ASSERT(DEFLATE_MAX_CODEWORD_LEN <= 16); + codeword = ((u32)bitreverse_tab[codeword & 0xff] << 8) | + bitreverse_tab[codeword >> 8]; + return codeword >> (16 - len); +} +#endif /* !rbit32 */ + +/* + * Generate the codewords for a canonical Huffman code. + * + * @A + * The output array for codewords. In addition, initially this + * array must contain the symbols, sorted primarily by frequency and + * secondarily by symbol value, in the low NUM_SYMBOL_BITS bits of + * each entry. + * + * @len + * Output array for codeword lengths. + * + * @len_counts + * An array that provides the number of codewords that will have + * each possible length <= max_codeword_len. + * + * @max_codeword_len + * Maximum length, in bits, of each codeword. + * + * @num_syms + * Number of symbols in the alphabet, including symbols with zero + * frequency. This is the length of the 'A' and 'len' arrays. + */ +static void +gen_codewords(u32 A[], u8 lens[], const unsigned len_counts[], + unsigned max_codeword_len, unsigned num_syms) +{ + u32 next_codewords[DEFLATE_MAX_CODEWORD_LEN + 1]; + unsigned i; + unsigned len; + unsigned sym; + + /* + * Given the number of codewords that will have each length, assign + * codeword lengths to symbols. We do this by assigning the lengths in + * decreasing order to the symbols sorted primarily by increasing + * frequency and secondarily by increasing symbol value. + */ + for (i = 0, len = max_codeword_len; len >= 1; len--) { + unsigned count = len_counts[len]; + + while (count--) + lens[A[i++] & SYMBOL_MASK] = len; + } + + /* + * Generate the codewords themselves. We initialize the + * 'next_codewords' array to provide the lexicographically first + * codeword of each length, then assign codewords in symbol order. This + * produces a canonical code. + */ + next_codewords[0] = 0; + next_codewords[1] = 0; + for (len = 2; len <= max_codeword_len; len++) + next_codewords[len] = + (next_codewords[len - 1] + len_counts[len - 1]) << 1; + + for (sym = 0; sym < num_syms; sym++) { + /* DEFLATE requires bit-reversed codewords. */ + A[sym] = reverse_codeword(next_codewords[lens[sym]]++, + lens[sym]); + } +} + +/* + * --------------------------------------------------------------------- + * deflate_make_huffman_code() + * --------------------------------------------------------------------- + * + * Given an alphabet and the frequency of each symbol in it, construct a + * length-limited canonical Huffman code. + * + * @num_syms + * The number of symbols in the alphabet. The symbols are the integers in + * the range [0, num_syms - 1]. This parameter must be at least 2 and + * must not exceed (1 << NUM_SYMBOL_BITS). + * + * @max_codeword_len + * The maximum permissible codeword length. + * + * @freqs + * An array of length @num_syms that gives the frequency of each symbol. + * It is valid for some, none, or all of the frequencies to be 0. The sum + * of frequencies must not exceed (1 << NUM_FREQ_BITS) - 1. + * + * @lens + * An array of @num_syms entries in which this function will return the + * length, in bits, of the codeword assigned to each symbol. Symbols with + * 0 frequency will not have codewords per se, but their entries in this + * array will be set to 0. No lengths greater than @max_codeword_len will + * be assigned. + * + * @codewords + * An array of @num_syms entries in which this function will return the + * codeword for each symbol, right-justified and padded on the left with + * zeroes. Codewords for symbols with 0 frequency will be undefined. + * + * --------------------------------------------------------------------- + * + * This function builds a length-limited canonical Huffman code. + * + * A length-limited Huffman code contains no codewords longer than some + * specified length, and has exactly (with some algorithms) or approximately + * (with the algorithm used here) the minimum weighted path length from the + * root, given this constraint. + * + * A canonical Huffman code satisfies the properties that a longer codeword + * never lexicographically precedes a shorter codeword, and the lexicographic + * ordering of codewords of the same length is the same as the lexicographic + * ordering of the corresponding symbols. A canonical Huffman code, or more + * generally a canonical prefix code, can be reconstructed from only a list + * containing the codeword length of each symbol. + * + * The classic algorithm to generate a Huffman code creates a node for each + * symbol, then inserts these nodes into a min-heap keyed by symbol frequency. + * Then, repeatedly, the two lowest-frequency nodes are removed from the + * min-heap and added as the children of a new node having frequency equal to + * the sum of its two children, which is then inserted into the min-heap. When + * only a single node remains in the min-heap, it is the root of the Huffman + * tree. The codeword for each symbol is determined by the path needed to reach + * the corresponding node from the root. Descending to the left child appends a + * 0 bit, whereas descending to the right child appends a 1 bit. + * + * The classic algorithm is relatively easy to understand, but it is subject to + * a number of inefficiencies. In practice, it is fastest to first sort the + * symbols by frequency. (This itself can be subject to an optimization based + * on the fact that most frequencies tend to be low.) At the same time, we sort + * secondarily by symbol value, which aids the process of generating a canonical + * code. Then, during tree construction, no heap is necessary because both the + * leaf nodes and the unparented non-leaf nodes can be easily maintained in + * sorted order. Consequently, there can never be more than two possibilities + * for the next-lowest-frequency node. + * + * In addition, because we're generating a canonical code, we actually don't + * need the leaf nodes of the tree at all, only the non-leaf nodes. This is + * because for canonical code generation we don't need to know where the symbols + * are in the tree. Rather, we only need to know how many leaf nodes have each + * depth (codeword length). And this information can, in fact, be quickly + * generated from the tree of non-leaves only. + * + * Furthermore, we can build this stripped-down Huffman tree directly in the + * array in which the codewords are to be generated, provided that these array + * slots are large enough to hold a symbol and frequency value. + * + * Still furthermore, we don't even need to maintain explicit child pointers. + * We only need the parent pointers, and even those can be overwritten in-place + * with depth information as part of the process of extracting codeword lengths + * from the tree. So in summary, we do NOT need a big structure like: + * + * struct huffman_tree_node { + * unsigned int symbol; + * unsigned int frequency; + * unsigned int depth; + * struct huffman_tree_node *left_child; + * struct huffman_tree_node *right_child; + * }; + * + * + * ... which often gets used in "naive" implementations of Huffman code + * generation. + * + * Many of these optimizations are based on the implementation in 7-Zip (source + * file: C/HuffEnc.c), which was placed in the public domain by Igor Pavlov. + */ +static void +deflate_make_huffman_code(unsigned num_syms, unsigned max_codeword_len, + const u32 freqs[], u8 lens[], u32 codewords[]) +{ + u32 *A = codewords; + unsigned num_used_syms; + + STATIC_ASSERT(DEFLATE_MAX_NUM_SYMS <= 1 << NUM_SYMBOL_BITS); + STATIC_ASSERT(MAX_BLOCK_LENGTH <= ((u32)1 << NUM_FREQ_BITS) - 1); + + /* + * We begin by sorting the symbols primarily by frequency and + * secondarily by symbol value. As an optimization, the array used for + * this purpose ('A') shares storage with the space in which we will + * eventually return the codewords. + */ + num_used_syms = sort_symbols(num_syms, freqs, lens, A); + + /* + * 'num_used_syms' is the number of symbols with nonzero frequency. + * This may be less than @num_syms. 'num_used_syms' is also the number + * of entries in 'A' that are valid. Each entry consists of a distinct + * symbol and a nonzero frequency packed into a 32-bit integer. + */ + + /* + * Handle special cases where only 0 or 1 symbols were used (had nonzero + * frequency). + */ + + if (unlikely(num_used_syms == 0)) { + /* + * Code is empty. sort_symbols() already set all lengths to 0, + * so there is nothing more to do. + */ + return; + } + + if (unlikely(num_used_syms == 1)) { + /* + * Only one symbol was used, so we only need one codeword. But + * two codewords are needed to form the smallest complete + * Huffman code, which uses codewords 0 and 1. Therefore, we + * choose another symbol to which to assign a codeword. We use + * 0 (if the used symbol is not 0) or 1 (if the used symbol is + * 0). In either case, the lesser-valued symbol must be + * assigned codeword 0 so that the resulting code is canonical. + */ + + unsigned sym = A[0] & SYMBOL_MASK; + unsigned nonzero_idx = sym ? sym : 1; + + codewords[0] = 0; + lens[0] = 1; + codewords[nonzero_idx] = 1; + lens[nonzero_idx] = 1; + return; + } + + /* + * Build a stripped-down version of the Huffman tree, sharing the array + * 'A' with the symbol values. Then extract length counts from the tree + * and use them to generate the final codewords. + */ + + build_tree(A, num_used_syms); + + { + unsigned len_counts[DEFLATE_MAX_CODEWORD_LEN + 1]; + + compute_length_counts(A, num_used_syms - 2, + len_counts, max_codeword_len); + + gen_codewords(A, lens, len_counts, max_codeword_len, num_syms); + } +} + +/* + * Clear the Huffman symbol frequency counters. This must be called when + * starting a new DEFLATE block. + */ +static void +deflate_reset_symbol_frequencies(struct libdeflate_compressor *c) +{ + memset(&c->freqs, 0, sizeof(c->freqs)); +} + +/* + * Build the literal/length and offset Huffman codes for a DEFLATE block. + * + * This takes as input the frequency tables for each alphabet and produces as + * output a set of tables that map symbols to codewords and codeword lengths. + */ +static void +deflate_make_huffman_codes(const struct deflate_freqs *freqs, + struct deflate_codes *codes) +{ + deflate_make_huffman_code(DEFLATE_NUM_LITLEN_SYMS, + MAX_LITLEN_CODEWORD_LEN, + freqs->litlen, + codes->lens.litlen, + codes->codewords.litlen); + + deflate_make_huffman_code(DEFLATE_NUM_OFFSET_SYMS, + MAX_OFFSET_CODEWORD_LEN, + freqs->offset, + codes->lens.offset, + codes->codewords.offset); +} + +/* Initialize c->static_codes. */ +static void +deflate_init_static_codes(struct libdeflate_compressor *c) +{ + unsigned i; + + for (i = 0; i < 144; i++) + c->freqs.litlen[i] = 1 << (9 - 8); + for (; i < 256; i++) + c->freqs.litlen[i] = 1 << (9 - 9); + for (; i < 280; i++) + c->freqs.litlen[i] = 1 << (9 - 7); + for (; i < 288; i++) + c->freqs.litlen[i] = 1 << (9 - 8); + + for (i = 0; i < 32; i++) + c->freqs.offset[i] = 1 << (5 - 5); + + deflate_make_huffman_codes(&c->freqs, &c->static_codes); +} + +/* Return the offset slot for the given match offset, using the small map. */ +static forceinline unsigned +deflate_get_offset_slot(unsigned offset) +{ +#if 1 + if (offset <= 256) + return deflate_offset_slot[offset]; + else + return deflate_offset_slot[256 + ((offset - 1) >> 7)]; +#else /* Branchless version */ + u32 i1 = offset; + u32 i2 = 256 + ((offset - 1) >> 7); + u32 is_small = (s32)(offset - 257) >> 31; + + return deflate_offset_slot[(i1 & is_small) ^ (i2 & ~is_small)]; +#endif +} + +static unsigned +deflate_compute_precode_items(const u8 lens[], const unsigned num_lens, + u32 precode_freqs[], unsigned precode_items[]) +{ + unsigned *itemptr; + unsigned run_start; + unsigned run_end; + unsigned extra_bits; + u8 len; + + memset(precode_freqs, 0, + DEFLATE_NUM_PRECODE_SYMS * sizeof(precode_freqs[0])); + + itemptr = precode_items; + run_start = 0; + do { + /* Find the next run of codeword lengths. */ + + /* len = the length being repeated */ + len = lens[run_start]; + + /* Extend the run. */ + run_end = run_start; + do { + run_end++; + } while (run_end != num_lens && len == lens[run_end]); + + if (len == 0) { + /* Run of zeroes. */ + + /* Symbol 18: RLE 11 to 138 zeroes at a time. */ + while ((run_end - run_start) >= 11) { + extra_bits = MIN((run_end - run_start) - 11, + 0x7F); + precode_freqs[18]++; + *itemptr++ = 18 | (extra_bits << 5); + run_start += 11 + extra_bits; + } + + /* Symbol 17: RLE 3 to 10 zeroes at a time. */ + if ((run_end - run_start) >= 3) { + extra_bits = MIN((run_end - run_start) - 3, + 0x7); + precode_freqs[17]++; + *itemptr++ = 17 | (extra_bits << 5); + run_start += 3 + extra_bits; + } + } else { + + /* A run of nonzero lengths. */ + + /* Symbol 16: RLE 3 to 6 of the previous length. */ + if ((run_end - run_start) >= 4) { + precode_freqs[len]++; + *itemptr++ = len; + run_start++; + do { + extra_bits = MIN((run_end - run_start) - + 3, 0x3); + precode_freqs[16]++; + *itemptr++ = 16 | (extra_bits << 5); + run_start += 3 + extra_bits; + } while ((run_end - run_start) >= 3); + } + } + + /* Output any remaining lengths without RLE. */ + while (run_start != run_end) { + precode_freqs[len]++; + *itemptr++ = len; + run_start++; + } + } while (run_start != num_lens); + + return itemptr - precode_items; +} + +/* + * Huffman codeword lengths for dynamic Huffman blocks are compressed using a + * separate Huffman code, the "precode", which contains a symbol for each + * possible codeword length in the larger code as well as several special + * symbols to represent repeated codeword lengths (a form of run-length + * encoding). The precode is itself constructed in canonical form, and its + * codeword lengths are represented literally in 19 3-bit fields that + * immediately precede the compressed codeword lengths of the larger code. + */ + +/* Precompute the information needed to output dynamic Huffman codes. */ +static void +deflate_precompute_huffman_header(struct libdeflate_compressor *c) +{ + /* Compute how many litlen and offset symbols are needed. */ + + for (c->o.precode.num_litlen_syms = DEFLATE_NUM_LITLEN_SYMS; + c->o.precode.num_litlen_syms > 257; + c->o.precode.num_litlen_syms--) + if (c->codes.lens.litlen[c->o.precode.num_litlen_syms - 1] != 0) + break; + + for (c->o.precode.num_offset_syms = DEFLATE_NUM_OFFSET_SYMS; + c->o.precode.num_offset_syms > 1; + c->o.precode.num_offset_syms--) + if (c->codes.lens.offset[c->o.precode.num_offset_syms - 1] != 0) + break; + + /* + * If we're not using the full set of literal/length codeword lengths, + * then temporarily move the offset codeword lengths over so that the + * literal/length and offset codeword lengths are contiguous. + */ + STATIC_ASSERT(offsetof(struct deflate_lens, offset) == + DEFLATE_NUM_LITLEN_SYMS); + if (c->o.precode.num_litlen_syms != DEFLATE_NUM_LITLEN_SYMS) { + memmove((u8 *)&c->codes.lens + c->o.precode.num_litlen_syms, + (u8 *)&c->codes.lens + DEFLATE_NUM_LITLEN_SYMS, + c->o.precode.num_offset_syms); + } + + /* + * Compute the "items" (RLE / literal tokens and extra bits) with which + * the codeword lengths in the larger code will be output. + */ + c->o.precode.num_items = + deflate_compute_precode_items((u8 *)&c->codes.lens, + c->o.precode.num_litlen_syms + + c->o.precode.num_offset_syms, + c->o.precode.freqs, + c->o.precode.items); + + /* Build the precode. */ + deflate_make_huffman_code(DEFLATE_NUM_PRECODE_SYMS, + MAX_PRE_CODEWORD_LEN, + c->o.precode.freqs, c->o.precode.lens, + c->o.precode.codewords); + + /* Count how many precode lengths we actually need to output. */ + for (c->o.precode.num_explicit_lens = DEFLATE_NUM_PRECODE_SYMS; + c->o.precode.num_explicit_lens > 4; + c->o.precode.num_explicit_lens--) + if (c->o.precode.lens[deflate_precode_lens_permutation[ + c->o.precode.num_explicit_lens - 1]] != 0) + break; + + /* Restore the offset codeword lengths if needed. */ + if (c->o.precode.num_litlen_syms != DEFLATE_NUM_LITLEN_SYMS) { + memmove((u8 *)&c->codes.lens + DEFLATE_NUM_LITLEN_SYMS, + (u8 *)&c->codes.lens + c->o.precode.num_litlen_syms, + c->o.precode.num_offset_syms); + } +} + +/* + * To make it faster to output matches, compute the "full" match length + * codewords, i.e. the concatenation of the litlen codeword and the extra bits + * for each possible match length. + */ +static void +deflate_compute_full_len_codewords(struct libdeflate_compressor *c, + const struct deflate_codes *codes) +{ + unsigned len; + + STATIC_ASSERT(MAX_LITLEN_CODEWORD_LEN + + DEFLATE_MAX_EXTRA_LENGTH_BITS <= 32); + + for (len = DEFLATE_MIN_MATCH_LEN; len <= DEFLATE_MAX_MATCH_LEN; len++) { + unsigned slot = deflate_length_slot[len]; + unsigned litlen_sym = DEFLATE_FIRST_LEN_SYM + slot; + u32 extra_bits = len - deflate_length_slot_base[slot]; + + c->o.length.codewords[len] = + codes->codewords.litlen[litlen_sym] | + (extra_bits << codes->lens.litlen[litlen_sym]); + c->o.length.lens[len] = codes->lens.litlen[litlen_sym] + + deflate_extra_length_bits[slot]; + } +} + +/* Write a match to the output buffer. */ +#define WRITE_MATCH(c_, codes_, length_, offset_, offset_slot_) \ +do { \ + const struct libdeflate_compressor *c__ = (c_); \ + const struct deflate_codes *codes__ = (codes_); \ + unsigned length__ = (length_); \ + unsigned offset__ = (offset_); \ + unsigned offset_slot__ = (offset_slot_); \ + \ + /* Litlen symbol and extra length bits */ \ + STATIC_ASSERT(CAN_BUFFER(MAX_LITLEN_CODEWORD_LEN + \ + DEFLATE_MAX_EXTRA_LENGTH_BITS)); \ + ADD_BITS(c__->o.length.codewords[length__], \ + c__->o.length.lens[length__]); \ + \ + if (!CAN_BUFFER(MAX_LITLEN_CODEWORD_LEN + \ + DEFLATE_MAX_EXTRA_LENGTH_BITS + \ + MAX_OFFSET_CODEWORD_LEN + \ + DEFLATE_MAX_EXTRA_OFFSET_BITS)) \ + FLUSH_BITS(); \ + \ + /* Offset symbol */ \ + ADD_BITS(codes__->codewords.offset[offset_slot__], \ + codes__->lens.offset[offset_slot__]); \ + \ + if (!CAN_BUFFER(MAX_OFFSET_CODEWORD_LEN + \ + DEFLATE_MAX_EXTRA_OFFSET_BITS)) \ + FLUSH_BITS(); \ + \ + /* Extra offset bits */ \ + ADD_BITS(offset__ - deflate_offset_slot_base[offset_slot__], \ + deflate_extra_offset_bits[offset_slot__]); \ + \ + FLUSH_BITS(); \ +} while (0) + +/* + * Choose the best type of block to use (dynamic Huffman, static Huffman, or + * uncompressed), then output it. + */ +static void +deflate_flush_block(struct libdeflate_compressor *c, + struct deflate_output_bitstream *os, + const u8 *block_begin, u32 block_length, + const struct deflate_sequence *sequences, + bool is_final_block) +{ + /* + * It is hard to get compilers to understand that writes to 'os->next' + * don't alias 'os'. That hurts performance significantly, as + * everything in 'os' would keep getting re-loaded. ('restrict' + * *should* do the trick, but it's unreliable.) Therefore, we keep all + * the output bitstream state in local variables, and output bits using + * macros. This is similar to what the decompressor does. + */ + const u8 *in_next = block_begin; + const u8 * const in_end = block_begin + block_length; + bitbuf_t bitbuf = os->bitbuf; + unsigned bitcount = os->bitcount; + u8 *out_next = os->next; + u8 * const out_end = os->end; + /* The cost for each block type, in bits */ + u32 dynamic_cost = 0; + u32 static_cost = 0; + u32 uncompressed_cost = 0; + u32 best_cost; + struct deflate_codes *codes; + unsigned sym; + + ASSERT(block_length >= MIN_BLOCK_LENGTH || is_final_block); + ASSERT(block_length <= MAX_BLOCK_LENGTH); + ASSERT(bitcount <= 7); + ASSERT((bitbuf & ~(((bitbuf_t)1 << bitcount) - 1)) == 0); + ASSERT(out_next <= out_end); + + if (sequences != NULL /* !near_optimal */ || + !SUPPORT_NEAR_OPTIMAL_PARSING) { + /* Tally the end-of-block symbol. */ + c->freqs.litlen[DEFLATE_END_OF_BLOCK]++; + + /* Build dynamic Huffman codes. */ + deflate_make_huffman_codes(&c->freqs, &c->codes); + } /* Else, this was already done. */ + + /* Precompute the precode items and build the precode. */ + deflate_precompute_huffman_header(c); + + /* Account for the cost of encoding dynamic Huffman codes. */ + dynamic_cost += 5 + 5 + 4 + (3 * c->o.precode.num_explicit_lens); + for (sym = 0; sym < DEFLATE_NUM_PRECODE_SYMS; sym++) { + u32 extra = deflate_extra_precode_bits[sym]; + + dynamic_cost += c->o.precode.freqs[sym] * + (extra + c->o.precode.lens[sym]); + } + + /* Account for the cost of encoding literals. */ + for (sym = 0; sym < 144; sym++) { + dynamic_cost += c->freqs.litlen[sym] * + c->codes.lens.litlen[sym]; + static_cost += c->freqs.litlen[sym] * 8; + } + for (; sym < 256; sym++) { + dynamic_cost += c->freqs.litlen[sym] * + c->codes.lens.litlen[sym]; + static_cost += c->freqs.litlen[sym] * 9; + } + + /* Account for the cost of encoding the end-of-block symbol. */ + dynamic_cost += c->codes.lens.litlen[DEFLATE_END_OF_BLOCK]; + static_cost += 7; + + /* Account for the cost of encoding lengths. */ + for (sym = DEFLATE_FIRST_LEN_SYM; + sym < DEFLATE_FIRST_LEN_SYM + ARRAY_LEN(deflate_extra_length_bits); + sym++) { + u32 extra = deflate_extra_length_bits[ + sym - DEFLATE_FIRST_LEN_SYM]; + + dynamic_cost += c->freqs.litlen[sym] * + (extra + c->codes.lens.litlen[sym]); + static_cost += c->freqs.litlen[sym] * + (extra + c->static_codes.lens.litlen[sym]); + } + + /* Account for the cost of encoding offsets. */ + for (sym = 0; sym < ARRAY_LEN(deflate_extra_offset_bits); sym++) { + u32 extra = deflate_extra_offset_bits[sym]; + + dynamic_cost += c->freqs.offset[sym] * + (extra + c->codes.lens.offset[sym]); + static_cost += c->freqs.offset[sym] * (extra + 5); + } + + /* Compute the cost of using uncompressed blocks. */ + uncompressed_cost += (-(bitcount + 3) & 7) + 32 + + (40 * (DIV_ROUND_UP(block_length, + UINT16_MAX) - 1)) + + (8 * block_length); + + /* Choose and output the cheapest type of block. */ + best_cost = MIN(static_cost, uncompressed_cost); + if (dynamic_cost < best_cost) { + const unsigned num_explicit_lens = c->o.precode.num_explicit_lens; + const unsigned num_precode_items = c->o.precode.num_items; + unsigned precode_sym, precode_item; + unsigned i; + + /* Dynamic Huffman block */ + + best_cost = dynamic_cost; + codes = &c->codes; + STATIC_ASSERT(CAN_BUFFER(1 + 2 + 5 + 5 + 4 + 3)); + ADD_BITS(is_final_block, 1); + ADD_BITS(DEFLATE_BLOCKTYPE_DYNAMIC_HUFFMAN, 2); + ADD_BITS(c->o.precode.num_litlen_syms - 257, 5); + ADD_BITS(c->o.precode.num_offset_syms - 1, 5); + ADD_BITS(num_explicit_lens - 4, 4); + + /* Output the lengths of the codewords in the precode. */ + if (CAN_BUFFER(3 * (DEFLATE_NUM_PRECODE_SYMS - 1))) { + /* + * A 64-bit bitbuffer is just one bit too small to hold + * the maximum number of precode lens, so to minimize + * flushes we merge one len with the previous fields. + */ + precode_sym = deflate_precode_lens_permutation[0]; + ADD_BITS(c->o.precode.lens[precode_sym], 3); + FLUSH_BITS(); + i = 1; /* num_explicit_lens >= 4 */ + do { + precode_sym = + deflate_precode_lens_permutation[i]; + ADD_BITS(c->o.precode.lens[precode_sym], 3); + } while (++i < num_explicit_lens); + FLUSH_BITS(); + } else { + FLUSH_BITS(); + i = 0; + do { + precode_sym = + deflate_precode_lens_permutation[i]; + ADD_BITS(c->o.precode.lens[precode_sym], 3); + FLUSH_BITS(); + } while (++i < num_explicit_lens); + } + + /* + * Output the lengths of the codewords in the litlen and offset + * codes, encoded by the precode. + */ + i = 0; + do { + precode_item = c->o.precode.items[i]; + precode_sym = precode_item & 0x1F; + STATIC_ASSERT(CAN_BUFFER(MAX_PRE_CODEWORD_LEN + 7)); + ADD_BITS(c->o.precode.codewords[precode_sym], + c->o.precode.lens[precode_sym]); + ADD_BITS(precode_item >> 5, + deflate_extra_precode_bits[precode_sym]); + FLUSH_BITS(); + } while (++i < num_precode_items); + } else if (static_cost < uncompressed_cost) { + /* Static Huffman block */ + codes = &c->static_codes; + ADD_BITS(is_final_block, 1); + ADD_BITS(DEFLATE_BLOCKTYPE_STATIC_HUFFMAN, 2); + FLUSH_BITS(); + } else { + /* + * Uncompressed block(s). DEFLATE limits the length of + * uncompressed blocks to UINT16_MAX bytes, so if the length of + * the "block" we're flushing is over UINT16_MAX, we actually + * output multiple blocks. + */ + do { + u8 bfinal = 0; + size_t len = UINT16_MAX; + + if (in_end - in_next <= UINT16_MAX) { + bfinal = is_final_block; + len = in_end - in_next; + } + if (out_end - out_next < + (bitcount + 3 + 7) / 8 + 4 + len) { + /* Not enough output space remaining. */ + out_next = out_end; + goto out; + } + /* + * Output BFINAL (1 bit) and BTYPE (2 bits), then align + * to a byte boundary. + */ + STATIC_ASSERT(DEFLATE_BLOCKTYPE_UNCOMPRESSED == 0); + *out_next++ = (bfinal << bitcount) | bitbuf; + if (bitcount > 5) + *out_next++ = 0; + bitbuf = 0; + bitcount = 0; + /* Output LEN and NLEN, then the data itself. */ + put_unaligned_le16(len, out_next); + out_next += 2; + put_unaligned_le16(~len, out_next); + out_next += 2; + memcpy(out_next, in_next, len); + out_next += len; + in_next += len; + } while (in_next != in_end); + /* Done outputting uncompressed block(s) */ + goto out; + } + + /* Output the literals and matches for a dynamic or static block. */ + ASSERT(bitcount <= 7); + deflate_compute_full_len_codewords(c, codes); +#if SUPPORT_NEAR_OPTIMAL_PARSING + if (sequences == NULL) { + /* Output the literals and matches from the minimum-cost path */ + struct deflate_optimum_node *cur_node = + &c->p.n.optimum_nodes[0]; + struct deflate_optimum_node * const end_node = + &c->p.n.optimum_nodes[block_length]; + do { + unsigned length = cur_node->item & OPTIMUM_LEN_MASK; + unsigned offset = cur_node->item >> + OPTIMUM_OFFSET_SHIFT; + if (length == 1) { + /* Literal */ + ADD_BITS(codes->codewords.litlen[offset], + codes->lens.litlen[offset]); + FLUSH_BITS(); + } else { + /* Match */ + WRITE_MATCH(c, codes, length, offset, + c->p.n.offset_slot_full[offset]); + } + cur_node += length; + } while (cur_node != end_node); + } else +#endif /* SUPPORT_NEAR_OPTIMAL_PARSING */ + { + /* Output the literals and matches from the sequences list. */ + const struct deflate_sequence *seq; + + for (seq = sequences; ; seq++) { + u32 litrunlen = seq->litrunlen_and_length & + SEQ_LITRUNLEN_MASK; + unsigned length = seq->litrunlen_and_length >> + SEQ_LENGTH_SHIFT; + unsigned lit; + + /* Output a run of literals. */ + if (CAN_BUFFER(4 * MAX_LITLEN_CODEWORD_LEN)) { + for (; litrunlen >= 4; litrunlen -= 4) { + lit = *in_next++; + ADD_BITS(codes->codewords.litlen[lit], + codes->lens.litlen[lit]); + lit = *in_next++; + ADD_BITS(codes->codewords.litlen[lit], + codes->lens.litlen[lit]); + lit = *in_next++; + ADD_BITS(codes->codewords.litlen[lit], + codes->lens.litlen[lit]); + lit = *in_next++; + ADD_BITS(codes->codewords.litlen[lit], + codes->lens.litlen[lit]); + FLUSH_BITS(); + } + if (litrunlen-- != 0) { + lit = *in_next++; + ADD_BITS(codes->codewords.litlen[lit], + codes->lens.litlen[lit]); + if (litrunlen-- != 0) { + lit = *in_next++; + ADD_BITS(codes->codewords.litlen[lit], + codes->lens.litlen[lit]); + if (litrunlen-- != 0) { + lit = *in_next++; + ADD_BITS(codes->codewords.litlen[lit], + codes->lens.litlen[lit]); + } + } + FLUSH_BITS(); + } + } else { + while (litrunlen--) { + lit = *in_next++; + ADD_BITS(codes->codewords.litlen[lit], + codes->lens.litlen[lit]); + FLUSH_BITS(); + } + } + + if (length == 0) { /* Last sequence? */ + ASSERT(in_next == in_end); + break; + } + + /* Output a match. */ + WRITE_MATCH(c, codes, length, seq->offset, + seq->offset_slot); + in_next += length; + } + } + + /* Output the end-of-block symbol. */ + ASSERT(bitcount <= 7); + ADD_BITS(codes->codewords.litlen[DEFLATE_END_OF_BLOCK], + codes->lens.litlen[DEFLATE_END_OF_BLOCK]); + FLUSH_BITS(); +out: + ASSERT(bitcount <= 7); + /* + * Assert that the block cost was computed correctly, as + * libdeflate_deflate_compress_bound() relies on this via the assumption + * that uncompressed blocks will always be used when cheaper. + */ + ASSERT(8 * (out_next - os->next) + bitcount - os->bitcount == + 3 + best_cost || out_next == out_end); + + os->bitbuf = bitbuf; + os->bitcount = bitcount; + os->next = out_next; +} + +/******************************************************************************/ + +/* + * Block splitting algorithm. The problem is to decide when it is worthwhile to + * start a new block with new Huffman codes. There is a theoretically optimal + * solution: recursively consider every possible block split, considering the + * exact cost of each block, and choose the minimum cost approach. But this is + * far too slow. Instead, as an approximation, we can count symbols and after + * every N symbols, compare the expected distribution of symbols based on the + * previous data with the actual distribution. If they differ "by enough", then + * start a new block. + * + * As an optimization and heuristic, we don't distinguish between every symbol + * but rather we combine many symbols into a single "observation type". For + * literals we only look at the high bits and low bits, and for matches we only + * look at whether the match is long or not. The assumption is that for typical + * "real" data, places that are good block boundaries will tend to be noticeable + * based only on changes in these aggregate probabilities, without looking for + * subtle differences in individual symbols. For example, a change from ASCII + * bytes to non-ASCII bytes, or from few matches (generally less compressible) + * to many matches (generally more compressible), would be easily noticed based + * on the aggregates. + * + * For determining whether the probability distributions are "different enough" + * to start a new block, the simple heuristic of splitting when the sum of + * absolute differences exceeds a constant seems to be good enough. We also add + * a number proportional to the block length so that the algorithm is more + * likely to end long blocks than short blocks. This reflects the general + * expectation that it will become increasingly beneficial to start a new block + * as the current block grows longer. + * + * Finally, for an approximation, it is not strictly necessary that the exact + * symbols being used are considered. With "near-optimal parsing", for example, + * the actual symbols that will be used are unknown until after the block + * boundary is chosen and the block has been optimized. Since the final choices + * cannot be used, we can use preliminary "greedy" choices instead. + */ + +/* Initialize the block split statistics when starting a new block. */ +static void +init_block_split_stats(struct block_split_stats *stats) +{ + int i; + + for (i = 0; i < NUM_OBSERVATION_TYPES; i++) { + stats->new_observations[i] = 0; + stats->observations[i] = 0; + } + stats->num_new_observations = 0; + stats->num_observations = 0; +} + +/* + * Literal observation. Heuristic: use the top 2 bits and low 1 bits of the + * literal, for 8 possible literal observation types. + */ +static forceinline void +observe_literal(struct block_split_stats *stats, u8 lit) +{ + stats->new_observations[((lit >> 5) & 0x6) | (lit & 1)]++; + stats->num_new_observations++; +} + +/* + * Match observation. Heuristic: use one observation type for "short match" and + * one observation type for "long match". + */ +static forceinline void +observe_match(struct block_split_stats *stats, unsigned length) +{ + stats->new_observations[NUM_LITERAL_OBSERVATION_TYPES + + (length >= 9)]++; + stats->num_new_observations++; +} + +static void +merge_new_observations(struct block_split_stats *stats) +{ + int i; + + for (i = 0; i < NUM_OBSERVATION_TYPES; i++) { + stats->observations[i] += stats->new_observations[i]; + stats->new_observations[i] = 0; + } + stats->num_observations += stats->num_new_observations; + stats->num_new_observations = 0; +} + +static bool +do_end_block_check(struct block_split_stats *stats, u32 block_length) +{ + if (stats->num_observations > 0) { + /* + * Compute the sum of absolute differences of probabilities. To + * avoid needing to use floating point arithmetic or do slow + * divisions, we do all arithmetic with the probabilities + * multiplied by num_observations * num_new_observations. E.g., + * for the "old" observations the probabilities would be + * (double)observations[i] / num_observations, but since we + * multiply by both num_observations and num_new_observations we + * really do observations[i] * num_new_observations. + */ + u32 total_delta = 0; + u32 num_items; + u32 cutoff; + int i; + + for (i = 0; i < NUM_OBSERVATION_TYPES; i++) { + u32 expected = stats->observations[i] * + stats->num_new_observations; + u32 actual = stats->new_observations[i] * + stats->num_observations; + u32 delta = (actual > expected) ? actual - expected : + expected - actual; + + total_delta += delta; + } + + num_items = stats->num_observations + + stats->num_new_observations; + /* + * Heuristic: the cutoff is when the sum of absolute differences + * of probabilities becomes at least 200/512. As above, the + * probability is multiplied by both num_new_observations and + * num_observations. Be careful to avoid integer overflow. + */ + cutoff = stats->num_new_observations * 200 / 512 * + stats->num_observations; + /* + * Very short blocks have a lot of overhead for the Huffman + * codes, so only use them if it clearly seems worthwhile. + * (This is an additional penalty, which adds to the smaller + * penalty below which scales more slowly.) + */ + if (block_length < 10000 && num_items < 8192) + cutoff += (u64)cutoff * (8192 - num_items) / 8192; + + /* Ready to end the block? */ + if (total_delta + + (block_length / 4096) * stats->num_observations >= cutoff) + return true; + } + merge_new_observations(stats); + return false; +} + +static forceinline bool +ready_to_check_block(const struct block_split_stats *stats, + const u8 *in_block_begin, const u8 *in_next, + const u8 *in_end) +{ + return stats->num_new_observations >= NUM_OBSERVATIONS_PER_BLOCK_CHECK + && in_next - in_block_begin >= MIN_BLOCK_LENGTH + && in_end - in_next >= MIN_BLOCK_LENGTH; +} + +static forceinline bool +should_end_block(struct block_split_stats *stats, + const u8 *in_block_begin, const u8 *in_next, const u8 *in_end) +{ + /* Ready to try to end the block (again)? */ + if (!ready_to_check_block(stats, in_block_begin, in_next, in_end)) + return false; + + return do_end_block_check(stats, in_next - in_block_begin); +} + +/******************************************************************************/ + +static void +deflate_begin_sequences(struct libdeflate_compressor *c, + struct deflate_sequence *first_seq) +{ + deflate_reset_symbol_frequencies(c); + first_seq->litrunlen_and_length = 0; +} + +static forceinline void +deflate_choose_literal(struct libdeflate_compressor *c, unsigned literal, + bool gather_split_stats, struct deflate_sequence *seq) +{ + c->freqs.litlen[literal]++; + + if (gather_split_stats) + observe_literal(&c->split_stats, literal); + + STATIC_ASSERT(MAX_BLOCK_LENGTH <= SEQ_LITRUNLEN_MASK); + seq->litrunlen_and_length++; +} + +static forceinline void +deflate_choose_match(struct libdeflate_compressor *c, + unsigned length, unsigned offset, bool gather_split_stats, + struct deflate_sequence **seq_p) +{ + struct deflate_sequence *seq = *seq_p; + unsigned length_slot = deflate_length_slot[length]; + unsigned offset_slot = deflate_get_offset_slot(offset); + + c->freqs.litlen[DEFLATE_FIRST_LEN_SYM + length_slot]++; + c->freqs.offset[offset_slot]++; + if (gather_split_stats) + observe_match(&c->split_stats, length); + + seq->litrunlen_and_length |= (u32)length << SEQ_LENGTH_SHIFT; + seq->offset = offset; + seq->offset_slot = offset_slot; + + seq++; + seq->litrunlen_and_length = 0; + *seq_p = seq; +} + +/* + * Decrease the maximum and nice match lengths if we're approaching the end of + * the input buffer. + */ +static forceinline void +adjust_max_and_nice_len(unsigned *max_len, unsigned *nice_len, size_t remaining) +{ + if (unlikely(remaining < DEFLATE_MAX_MATCH_LEN)) { + *max_len = remaining; + *nice_len = MIN(*nice_len, *max_len); + } +} + +/* + * Choose the minimum match length for the greedy and lazy parsers. + * + * By default the minimum match length is 3, which is the smallest length the + * DEFLATE format allows. However, with greedy and lazy parsing, some data + * (e.g. DNA sequencing data) benefits greatly from a longer minimum length. + * Typically, this is because literals are very cheap. In general, the + * near-optimal parser handles this case naturally, but the greedy and lazy + * parsers need a heuristic to decide when to use short matches. + * + * The heuristic we use is to make the minimum match length depend on the number + * of different literals that exist in the data. If there are many different + * literals, then literals will probably be expensive, so short matches will + * probably be worthwhile. Conversely, if not many literals are used, then + * probably literals will be cheap and short matches won't be worthwhile. + */ +static unsigned +choose_min_match_len(unsigned num_used_literals, unsigned max_search_depth) +{ + /* map from num_used_literals to min_len */ + static const u8 min_lens[] = { + 9, 9, 9, 9, 9, 9, 8, 8, 7, 7, 6, 6, 6, 6, 6, 6, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + /* The rest is implicitly 3. */ + }; + unsigned min_len; + + STATIC_ASSERT(DEFLATE_MIN_MATCH_LEN <= 3); + STATIC_ASSERT(ARRAY_LEN(min_lens) <= DEFLATE_NUM_LITERALS + 1); + + if (num_used_literals >= ARRAY_LEN(min_lens)) + return 3; + min_len = min_lens[num_used_literals]; + /* + * With a low max_search_depth, it may be too hard to find long matches. + */ + if (max_search_depth < 16) { + if (max_search_depth < 5) + min_len = MIN(min_len, 4); + else if (max_search_depth < 10) + min_len = MIN(min_len, 5); + else + min_len = MIN(min_len, 7); + } + return min_len; +} + +static unsigned +calculate_min_match_len(const u8 *data, size_t data_len, + unsigned max_search_depth) +{ + u8 used[256] = { 0 }; + unsigned num_used_literals = 0; + size_t i; + + /* + * For an initial approximation, scan the first 4 KiB of data. The + * caller may use recalculate_min_match_len() to update min_len later. + */ + data_len = MIN(data_len, 4096); + for (i = 0; i < data_len; i++) + used[data[i]] = 1; + for (i = 0; i < 256; i++) + num_used_literals += used[i]; + return choose_min_match_len(num_used_literals, max_search_depth); +} + +/* + * Recalculate the minimum match length for a block, now that we know the + * distribution of literals that are actually being used (freqs->litlen). + */ +static unsigned +recalculate_min_match_len(const struct deflate_freqs *freqs, + unsigned max_search_depth) +{ + u32 literal_freq = 0; + u32 cutoff; + unsigned num_used_literals = 0; + int i; + + for (i = 0; i < DEFLATE_NUM_LITERALS; i++) + literal_freq += freqs->litlen[i]; + + cutoff = literal_freq >> 10; /* Ignore literals used very rarely. */ + + for (i = 0; i < DEFLATE_NUM_LITERALS; i++) { + if (freqs->litlen[i] > cutoff) + num_used_literals++; + } + return choose_min_match_len(num_used_literals, max_search_depth); +} + +static forceinline const u8 * +choose_max_block_end(const u8 *in_block_begin, const u8 *in_end, + size_t soft_max_len) +{ + if (in_end - in_block_begin < soft_max_len + MIN_BLOCK_LENGTH) + return in_end; + return in_block_begin + soft_max_len; +} + +/* + * This is the level 0 "compressor". It always outputs uncompressed blocks. + */ +static size_t +deflate_compress_none(const u8 *in, size_t in_nbytes, + u8 *out, size_t out_nbytes_avail) +{ + const u8 *in_next = in; + const u8 * const in_end = in + in_nbytes; + u8 *out_next = out; + u8 * const out_end = out + out_nbytes_avail; + + /* + * If the input is zero-length, we still must output a block in order + * for the output to be a valid DEFLATE stream. Handle this case + * specially to avoid potentially passing NULL to memcpy() below. + */ + if (unlikely(in_nbytes == 0)) { + if (out_nbytes_avail < 5) + return 0; + /* BFINAL and BTYPE */ + *out_next++ = 1 | (DEFLATE_BLOCKTYPE_UNCOMPRESSED << 1); + /* LEN and NLEN */ + put_unaligned_le32(0xFFFF0000, out_next); + return 5; + } + + do { + u8 bfinal = 0; + size_t len = UINT16_MAX; + + if (in_end - in_next <= UINT16_MAX) { + bfinal = 1; + len = in_end - in_next; + } + if (out_end - out_next < 5 + len) + return 0; + /* + * Output BFINAL and BTYPE. The stream is already byte-aligned + * here, so this step always requires outputting exactly 1 byte. + */ + *out_next++ = bfinal | (DEFLATE_BLOCKTYPE_UNCOMPRESSED << 1); + + /* Output LEN and NLEN, then the data itself. */ + put_unaligned_le16(len, out_next); + out_next += 2; + put_unaligned_le16(~len, out_next); + out_next += 2; + memcpy(out_next, in_next, len); + out_next += len; + in_next += len; + } while (in_next != in_end); + + return out_next - out; +} + +/* + * This is a faster variant of deflate_compress_greedy(). It uses the + * ht_matchfinder rather than the hc_matchfinder. It also skips the block + * splitting algorithm and just uses fixed length blocks. c->max_search_depth + * has no effect with this algorithm, as it is hardcoded in ht_matchfinder.h. + */ +static void +deflate_compress_fastest(struct libdeflate_compressor * restrict c, + const u8 *in, size_t in_nbytes, + struct deflate_output_bitstream *os) +{ + const u8 *in_next = in; + const u8 *in_end = in_next + in_nbytes; + const u8 *in_cur_base = in_next; + unsigned max_len = DEFLATE_MAX_MATCH_LEN; + unsigned nice_len = MIN(c->nice_match_length, max_len); + u32 next_hash = 0; + + ht_matchfinder_init(&c->p.f.ht_mf); + + do { + /* Starting a new DEFLATE block */ + + const u8 * const in_block_begin = in_next; + const u8 * const in_max_block_end = choose_max_block_end( + in_next, in_end, FAST_SOFT_MAX_BLOCK_LENGTH); + struct deflate_sequence *seq = c->p.f.sequences; + + deflate_begin_sequences(c, seq); + + do { + u32 length; + u32 offset; + size_t remaining = in_end - in_next; + + if (unlikely(remaining < DEFLATE_MAX_MATCH_LEN)) { + max_len = remaining; + if (max_len < HT_MATCHFINDER_REQUIRED_NBYTES) { + do { + deflate_choose_literal(c, + *in_next++, false, seq); + } while (--max_len); + break; + } + nice_len = MIN(nice_len, max_len); + } + length = ht_matchfinder_longest_match(&c->p.f.ht_mf, + &in_cur_base, + in_next, + max_len, + nice_len, + &next_hash, + &offset); + if (length) { + /* Match found */ + deflate_choose_match(c, length, offset, false, + &seq); + ht_matchfinder_skip_bytes(&c->p.f.ht_mf, + &in_cur_base, + in_next + 1, + in_end, + length - 1, + &next_hash); + in_next += length; + } else { + /* No match found */ + deflate_choose_literal(c, *in_next++, false, + seq); + } + + /* Check if it's time to output another block. */ + } while (in_next < in_max_block_end && + seq < &c->p.f.sequences[FAST_SEQ_STORE_LENGTH]); + + deflate_flush_block(c, os, in_block_begin, + in_next - in_block_begin, + c->p.f.sequences, in_next == in_end); + } while (in_next != in_end); +} + +/* + * This is the "greedy" DEFLATE compressor. It always chooses the longest match. + */ +static void +deflate_compress_greedy(struct libdeflate_compressor * restrict c, + const u8 *in, size_t in_nbytes, + struct deflate_output_bitstream *os) +{ + const u8 *in_next = in; + const u8 *in_end = in_next + in_nbytes; + const u8 *in_cur_base = in_next; + unsigned max_len = DEFLATE_MAX_MATCH_LEN; + unsigned nice_len = MIN(c->nice_match_length, max_len); + u32 next_hashes[2] = {0, 0}; + + hc_matchfinder_init(&c->p.g.hc_mf); + + do { + /* Starting a new DEFLATE block */ + + const u8 * const in_block_begin = in_next; + const u8 * const in_max_block_end = choose_max_block_end( + in_next, in_end, SOFT_MAX_BLOCK_LENGTH); + struct deflate_sequence *seq = c->p.g.sequences; + unsigned min_len; + + init_block_split_stats(&c->split_stats); + deflate_begin_sequences(c, seq); + min_len = calculate_min_match_len(in_next, + in_max_block_end - in_next, + c->max_search_depth); + do { + u32 length; + u32 offset; + + adjust_max_and_nice_len(&max_len, &nice_len, + in_end - in_next); + length = hc_matchfinder_longest_match( + &c->p.g.hc_mf, + &in_cur_base, + in_next, + min_len - 1, + max_len, + nice_len, + c->max_search_depth, + next_hashes, + &offset); + + if (length >= min_len && + (length > DEFLATE_MIN_MATCH_LEN || + offset <= 4096)) { + /* Match found */ + deflate_choose_match(c, length, offset, true, + &seq); + hc_matchfinder_skip_bytes(&c->p.g.hc_mf, + &in_cur_base, + in_next + 1, + in_end, + length - 1, + next_hashes); + in_next += length; + } else { + /* No match found */ + deflate_choose_literal(c, *in_next++, true, + seq); + } + + /* Check if it's time to output another block. */ + } while (in_next < in_max_block_end && + seq < &c->p.g.sequences[SEQ_STORE_LENGTH] && + !should_end_block(&c->split_stats, + in_block_begin, in_next, in_end)); + + deflate_flush_block(c, os, in_block_begin, + in_next - in_block_begin, + c->p.g.sequences, in_next == in_end); + } while (in_next != in_end); +} + +static forceinline void +deflate_compress_lazy_generic(struct libdeflate_compressor * restrict c, + const u8 *in, size_t in_nbytes, + struct deflate_output_bitstream *os, bool lazy2) +{ + const u8 *in_next = in; + const u8 *in_end = in_next + in_nbytes; + const u8 *in_cur_base = in_next; + unsigned max_len = DEFLATE_MAX_MATCH_LEN; + unsigned nice_len = MIN(c->nice_match_length, max_len); + u32 next_hashes[2] = {0, 0}; + + hc_matchfinder_init(&c->p.g.hc_mf); + + do { + /* Starting a new DEFLATE block */ + + const u8 * const in_block_begin = in_next; + const u8 * const in_max_block_end = choose_max_block_end( + in_next, in_end, SOFT_MAX_BLOCK_LENGTH); + const u8 *next_recalc_min_len = + in_next + MIN(in_end - in_next, 10000); + struct deflate_sequence *seq = c->p.g.sequences; + unsigned min_len; + + init_block_split_stats(&c->split_stats); + deflate_begin_sequences(c, seq); + min_len = calculate_min_match_len(in_next, + in_max_block_end - in_next, + c->max_search_depth); + do { + unsigned cur_len; + unsigned cur_offset; + unsigned next_len; + unsigned next_offset; + + /* + * Recalculate the minimum match length if it hasn't + * been done recently. + */ + if (in_next >= next_recalc_min_len) { + min_len = recalculate_min_match_len( + &c->freqs, + c->max_search_depth); + next_recalc_min_len += + MIN(in_end - next_recalc_min_len, + in_next - in_block_begin); + } + + /* Find the longest match at the current position. */ + adjust_max_and_nice_len(&max_len, &nice_len, + in_end - in_next); + cur_len = hc_matchfinder_longest_match( + &c->p.g.hc_mf, + &in_cur_base, + in_next, + min_len - 1, + max_len, + nice_len, + c->max_search_depth, + next_hashes, + &cur_offset); + if (cur_len < min_len || + (cur_len == DEFLATE_MIN_MATCH_LEN && + cur_offset > 8192)) { + /* No match found. Choose a literal. */ + deflate_choose_literal(c, *in_next++, true, + seq); + continue; + } + in_next++; + +have_cur_match: + /* + * We have a match at the current position. + * If it's very long, choose it immediately. + */ + if (cur_len >= nice_len) { + deflate_choose_match(c, cur_len, cur_offset, + true, &seq); + hc_matchfinder_skip_bytes(&c->p.g.hc_mf, + &in_cur_base, + in_next, + in_end, + cur_len - 1, + next_hashes); + in_next += cur_len - 1; + continue; + } + + /* + * Try to find a better match at the next position. + * + * Note: since we already have a match at the *current* + * position, we use only half the 'max_search_depth' + * when checking the *next* position. This is a useful + * trade-off because it's more worthwhile to use a + * greater search depth on the initial match. + * + * Note: it's possible to structure the code such that + * there's only one call to longest_match(), which + * handles both the "find the initial match" and "try to + * find a better match" cases. However, it is faster to + * have two call sites, with longest_match() inlined at + * each. + */ + adjust_max_and_nice_len(&max_len, &nice_len, + in_end - in_next); + next_len = hc_matchfinder_longest_match( + &c->p.g.hc_mf, + &in_cur_base, + in_next++, + cur_len - 1, + max_len, + nice_len, + c->max_search_depth >> 1, + next_hashes, + &next_offset); + if (next_len >= cur_len && + 4 * (int)(next_len - cur_len) + + ((int)bsr32(cur_offset) - + (int)bsr32(next_offset)) > 2) { + /* + * Found a better match at the next position. + * Output a literal. Then the next match + * becomes the current match. + */ + deflate_choose_literal(c, *(in_next - 2), true, + seq); + cur_len = next_len; + cur_offset = next_offset; + goto have_cur_match; + } + + if (lazy2) { + /* In lazy2 mode, look ahead another position */ + adjust_max_and_nice_len(&max_len, &nice_len, + in_end - in_next); + next_len = hc_matchfinder_longest_match( + &c->p.g.hc_mf, + &in_cur_base, + in_next++, + cur_len - 1, + max_len, + nice_len, + c->max_search_depth >> 2, + next_hashes, + &next_offset); + if (next_len >= cur_len && + 4 * (int)(next_len - cur_len) + + ((int)bsr32(cur_offset) - + (int)bsr32(next_offset)) > 6) { + /* + * There's a much better match two + * positions ahead, so use two literals. + */ + deflate_choose_literal( + c, *(in_next - 3), true, seq); + deflate_choose_literal( + c, *(in_next - 2), true, seq); + cur_len = next_len; + cur_offset = next_offset; + goto have_cur_match; + } + /* + * No better match at either of the next 2 + * positions. Output the current match. + */ + deflate_choose_match(c, cur_len, cur_offset, + true, &seq); + if (cur_len > 3) { + hc_matchfinder_skip_bytes(&c->p.g.hc_mf, + &in_cur_base, + in_next, + in_end, + cur_len - 3, + next_hashes); + in_next += cur_len - 3; + } + } else { /* !lazy2 */ + /* + * No better match at the next position. Output + * the current match. + */ + deflate_choose_match(c, cur_len, cur_offset, + true, &seq); + hc_matchfinder_skip_bytes(&c->p.g.hc_mf, + &in_cur_base, + in_next, + in_end, + cur_len - 2, + next_hashes); + in_next += cur_len - 2; + } + /* Check if it's time to output another block. */ + } while (in_next < in_max_block_end && + seq < &c->p.g.sequences[SEQ_STORE_LENGTH] && + !should_end_block(&c->split_stats, + in_block_begin, in_next, in_end)); + + deflate_flush_block(c, os, in_block_begin, + in_next - in_block_begin, + c->p.g.sequences, in_next == in_end); + } while (in_next != in_end); +} + +/* + * This is the "lazy" DEFLATE compressor. Before choosing a match, it checks to + * see if there's a better match at the next position. If yes, it outputs a + * literal and continues to the next position. If no, it outputs the match. + */ +static void +deflate_compress_lazy(struct libdeflate_compressor * restrict c, + const u8 *in, size_t in_nbytes, + struct deflate_output_bitstream *os) +{ + deflate_compress_lazy_generic(c, in, in_nbytes, os, false); +} + +/* + * The lazy2 compressor. This is similar to the regular lazy one, but it looks + * for a better match at the next 2 positions rather than the next 1. This + * makes it take slightly more time, but compress some inputs slightly more. + */ +static void +deflate_compress_lazy2(struct libdeflate_compressor * restrict c, + const u8 *in, size_t in_nbytes, + struct deflate_output_bitstream *os) +{ + deflate_compress_lazy_generic(c, in, in_nbytes, os, true); +} + +#if SUPPORT_NEAR_OPTIMAL_PARSING + +/* + * Follow the minimum-cost path in the graph of possible match/literal choices + * for the current block and compute the frequencies of the Huffman symbols that + * would be needed to output those matches and literals. + */ +static void +deflate_tally_item_list(struct libdeflate_compressor *c, u32 block_length) +{ + struct deflate_optimum_node *cur_node = &c->p.n.optimum_nodes[0]; + struct deflate_optimum_node *end_node = + &c->p.n.optimum_nodes[block_length]; + + do { + unsigned length = cur_node->item & OPTIMUM_LEN_MASK; + unsigned offset = cur_node->item >> OPTIMUM_OFFSET_SHIFT; + + if (length == 1) { + /* Literal */ + c->freqs.litlen[offset]++; + } else { + /* Match */ + c->freqs.litlen[DEFLATE_FIRST_LEN_SYM + + deflate_length_slot[length]]++; + c->freqs.offset[c->p.n.offset_slot_full[offset]]++; + } + cur_node += length; + } while (cur_node != end_node); + + /* Tally the end-of-block symbol. */ + c->freqs.litlen[DEFLATE_END_OF_BLOCK]++; +} + +/* Set the current cost model from the codeword lengths specified in @lens. */ +static void +deflate_set_costs_from_codes(struct libdeflate_compressor *c, + const struct deflate_lens *lens) +{ + unsigned i; + + /* Literals */ + for (i = 0; i < DEFLATE_NUM_LITERALS; i++) { + u32 bits = (lens->litlen[i] ? + lens->litlen[i] : LITERAL_NOSTAT_BITS); + + c->p.n.costs.literal[i] = bits * BIT_COST; + } + + /* Lengths */ + for (i = DEFLATE_MIN_MATCH_LEN; i <= DEFLATE_MAX_MATCH_LEN; i++) { + unsigned length_slot = deflate_length_slot[i]; + unsigned litlen_sym = DEFLATE_FIRST_LEN_SYM + length_slot; + u32 bits = (lens->litlen[litlen_sym] ? + lens->litlen[litlen_sym] : LENGTH_NOSTAT_BITS); + + bits += deflate_extra_length_bits[length_slot]; + c->p.n.costs.length[i] = bits * BIT_COST; + } + + /* Offset slots */ + for (i = 0; i < ARRAY_LEN(deflate_offset_slot_base); i++) { + u32 bits = (lens->offset[i] ? + lens->offset[i] : OFFSET_NOSTAT_BITS); + + bits += deflate_extra_offset_bits[i]; + c->p.n.costs.offset_slot[i] = bits * BIT_COST; + } +} + +/* + * This lookup table gives the default cost of a literal symbol and of a length + * symbol, depending on the characteristics of the input data. It was generated + * by scripts/gen_default_litlen_costs.py. + * + * This table is indexed first by the estimated match probability: + * + * i=0: data doesn't contain many matches [match_prob=0.25] + * i=1: neutral [match_prob=0.50] + * i=2: data contains lots of matches [match_prob=0.75] + * + * This lookup produces a subtable which maps the number of distinct used + * literals to the default cost of a literal symbol, i.e.: + * + * int(-log2((1 - match_prob) / num_used_literals) * BIT_COST) + * + * ... for num_used_literals in [1, 256] (and 0, which is copied from 1). This + * accounts for literals usually getting cheaper as the number of distinct + * literals decreases, and as the proportion of literals to matches increases. + * + * The lookup also produces the cost of a length symbol, which is: + * + * int(-log2(match_prob/NUM_LEN_SLOTS) * BIT_COST) + * + * Note: we don't currently assign different costs to different literal symbols, + * or to different length symbols, as this is hard to do in a useful way. + */ +static const struct { + u8 used_lits_to_lit_cost[257]; + u8 len_sym_cost; +} default_litlen_costs[] = { + { /* match_prob = 0.25 */ + .used_lits_to_lit_cost = { + 6, 6, 22, 32, 38, 43, 48, 51, + 54, 57, 59, 61, 64, 65, 67, 69, + 70, 72, 73, 74, 75, 76, 77, 79, + 80, 80, 81, 82, 83, 84, 85, 85, + 86, 87, 88, 88, 89, 89, 90, 91, + 91, 92, 92, 93, 93, 94, 95, 95, + 96, 96, 96, 97, 97, 98, 98, 99, + 99, 99, 100, 100, 101, 101, 101, 102, + 102, 102, 103, 103, 104, 104, 104, 105, + 105, 105, 105, 106, 106, 106, 107, 107, + 107, 108, 108, 108, 108, 109, 109, 109, + 109, 110, 110, 110, 111, 111, 111, 111, + 112, 112, 112, 112, 112, 113, 113, 113, + 113, 114, 114, 114, 114, 114, 115, 115, + 115, 115, 115, 116, 116, 116, 116, 116, + 117, 117, 117, 117, 117, 118, 118, 118, + 118, 118, 118, 119, 119, 119, 119, 119, + 120, 120, 120, 120, 120, 120, 121, 121, + 121, 121, 121, 121, 121, 122, 122, 122, + 122, 122, 122, 123, 123, 123, 123, 123, + 123, 123, 124, 124, 124, 124, 124, 124, + 124, 125, 125, 125, 125, 125, 125, 125, + 125, 126, 126, 126, 126, 126, 126, 126, + 127, 127, 127, 127, 127, 127, 127, 127, + 128, 128, 128, 128, 128, 128, 128, 128, + 128, 129, 129, 129, 129, 129, 129, 129, + 129, 129, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 132, 132, 132, + 132, 132, 132, 132, 132, 132, 132, 133, + 133, 133, 133, 133, 133, 133, 133, 133, + 133, 134, 134, 134, 134, 134, 134, 134, + 134, + }, + .len_sym_cost = 109, + }, { /* match_prob = 0.5 */ + .used_lits_to_lit_cost = { + 16, 16, 32, 41, 48, 53, 57, 60, + 64, 66, 69, 71, 73, 75, 76, 78, + 80, 81, 82, 83, 85, 86, 87, 88, + 89, 90, 91, 92, 92, 93, 94, 95, + 96, 96, 97, 98, 98, 99, 99, 100, + 101, 101, 102, 102, 103, 103, 104, 104, + 105, 105, 106, 106, 107, 107, 108, 108, + 108, 109, 109, 110, 110, 110, 111, 111, + 112, 112, 112, 113, 113, 113, 114, 114, + 114, 115, 115, 115, 115, 116, 116, 116, + 117, 117, 117, 118, 118, 118, 118, 119, + 119, 119, 119, 120, 120, 120, 120, 121, + 121, 121, 121, 122, 122, 122, 122, 122, + 123, 123, 123, 123, 124, 124, 124, 124, + 124, 125, 125, 125, 125, 125, 126, 126, + 126, 126, 126, 127, 127, 127, 127, 127, + 128, 128, 128, 128, 128, 128, 129, 129, + 129, 129, 129, 129, 130, 130, 130, 130, + 130, 130, 131, 131, 131, 131, 131, 131, + 131, 132, 132, 132, 132, 132, 132, 133, + 133, 133, 133, 133, 133, 133, 134, 134, + 134, 134, 134, 134, 134, 134, 135, 135, + 135, 135, 135, 135, 135, 135, 136, 136, + 136, 136, 136, 136, 136, 136, 137, 137, + 137, 137, 137, 137, 137, 137, 138, 138, + 138, 138, 138, 138, 138, 138, 138, 139, + 139, 139, 139, 139, 139, 139, 139, 139, + 140, 140, 140, 140, 140, 140, 140, 140, + 140, 141, 141, 141, 141, 141, 141, 141, + 141, 141, 141, 142, 142, 142, 142, 142, + 142, 142, 142, 142, 142, 142, 143, 143, + 143, 143, 143, 143, 143, 143, 143, 143, + 144, + }, + .len_sym_cost = 93, + }, { /* match_prob = 0.75 */ + .used_lits_to_lit_cost = { + 32, 32, 48, 57, 64, 69, 73, 76, + 80, 82, 85, 87, 89, 91, 92, 94, + 96, 97, 98, 99, 101, 102, 103, 104, + 105, 106, 107, 108, 108, 109, 110, 111, + 112, 112, 113, 114, 114, 115, 115, 116, + 117, 117, 118, 118, 119, 119, 120, 120, + 121, 121, 122, 122, 123, 123, 124, 124, + 124, 125, 125, 126, 126, 126, 127, 127, + 128, 128, 128, 129, 129, 129, 130, 130, + 130, 131, 131, 131, 131, 132, 132, 132, + 133, 133, 133, 134, 134, 134, 134, 135, + 135, 135, 135, 136, 136, 136, 136, 137, + 137, 137, 137, 138, 138, 138, 138, 138, + 139, 139, 139, 139, 140, 140, 140, 140, + 140, 141, 141, 141, 141, 141, 142, 142, + 142, 142, 142, 143, 143, 143, 143, 143, + 144, 144, 144, 144, 144, 144, 145, 145, + 145, 145, 145, 145, 146, 146, 146, 146, + 146, 146, 147, 147, 147, 147, 147, 147, + 147, 148, 148, 148, 148, 148, 148, 149, + 149, 149, 149, 149, 149, 149, 150, 150, + 150, 150, 150, 150, 150, 150, 151, 151, + 151, 151, 151, 151, 151, 151, 152, 152, + 152, 152, 152, 152, 152, 152, 153, 153, + 153, 153, 153, 153, 153, 153, 154, 154, + 154, 154, 154, 154, 154, 154, 154, 155, + 155, 155, 155, 155, 155, 155, 155, 155, + 156, 156, 156, 156, 156, 156, 156, 156, + 156, 157, 157, 157, 157, 157, 157, 157, + 157, 157, 157, 158, 158, 158, 158, 158, + 158, 158, 158, 158, 158, 158, 159, 159, + 159, 159, 159, 159, 159, 159, 159, 159, + 160, + }, + .len_sym_cost = 84, + }, +}; + +/* + * Choose the default costs for literal and length symbols. These symbols are + * both part of the litlen alphabet. + */ +static void +deflate_choose_default_litlen_costs(struct libdeflate_compressor *c, + const u8 *block_begin, u32 block_length, + u32 *lit_cost, u32 *len_sym_cost) +{ + unsigned num_used_literals = 0; + u32 literal_freq = block_length; + u32 match_freq = 0; + u32 cutoff; + u32 i; + + /* Calculate the number of distinct literals that exist in the data. */ + memset(c->freqs.litlen, 0, + DEFLATE_NUM_LITERALS * sizeof(c->freqs.litlen[0])); + cutoff = literal_freq >> 11; /* Ignore literals used very rarely. */ + for (i = 0; i < block_length; i++) + c->freqs.litlen[block_begin[i]]++; + for (i = 0; i < DEFLATE_NUM_LITERALS; i++) { + if (c->freqs.litlen[i] > cutoff) + num_used_literals++; + } + if (num_used_literals == 0) + num_used_literals = 1; + + /* + * Estimate the relative frequency of literals and matches in the + * optimal parsing solution. We don't know the optimal solution, so + * this can only be a very rough estimate. Therefore, we basically use + * the match frequency from a greedy parse. We also apply the min_len + * heuristic used by the greedy and lazy parsers, to avoid counting too + * many matches when literals are cheaper than short matches. + */ + match_freq = 0; + i = choose_min_match_len(num_used_literals, c->max_search_depth); + for (; i < ARRAY_LEN(c->p.n.match_len_freqs); i++) { + match_freq += c->p.n.match_len_freqs[i]; + literal_freq -= i * c->p.n.match_len_freqs[i]; + } + if ((s32)literal_freq < 0) /* shouldn't happen */ + literal_freq = 0; + + if (match_freq > literal_freq) + i = 2; /* many matches */ + else if (match_freq * 4 > literal_freq) + i = 1; /* neutral */ + else + i = 0; /* few matches */ + + STATIC_ASSERT(BIT_COST == 16); + *lit_cost = default_litlen_costs[i].used_lits_to_lit_cost[ + num_used_literals]; + *len_sym_cost = default_litlen_costs[i].len_sym_cost; +} + +static forceinline u32 +deflate_default_length_cost(unsigned len, u32 len_sym_cost) +{ + unsigned slot = deflate_length_slot[len]; + u32 num_extra_bits = deflate_extra_length_bits[slot]; + + return len_sym_cost + (num_extra_bits * BIT_COST); +} + +static forceinline u32 +deflate_default_offset_slot_cost(unsigned slot) +{ + u32 num_extra_bits = deflate_extra_offset_bits[slot]; + /* + * Assume that all offset symbols are equally probable. + * The resulting cost is 'int(-log2(1/30) * BIT_COST)', + * where 30 is the number of potentially-used offset symbols. + */ + u32 offset_sym_cost = 4*BIT_COST + (907*BIT_COST)/1000; + + return offset_sym_cost + (num_extra_bits * BIT_COST); +} + +/* Set default symbol costs for the first block's first optimization pass. */ +static void +deflate_set_default_costs(struct libdeflate_compressor *c, + u32 lit_cost, u32 len_sym_cost) +{ + unsigned i; + + /* Literals */ + for (i = 0; i < DEFLATE_NUM_LITERALS; i++) + c->p.n.costs.literal[i] = lit_cost; + + /* Lengths */ + for (i = DEFLATE_MIN_MATCH_LEN; i <= DEFLATE_MAX_MATCH_LEN; i++) + c->p.n.costs.length[i] = + deflate_default_length_cost(i, len_sym_cost); + + /* Offset slots */ + for (i = 0; i < ARRAY_LEN(deflate_offset_slot_base); i++) + c->p.n.costs.offset_slot[i] = + deflate_default_offset_slot_cost(i); +} + +static forceinline void +deflate_adjust_cost(u32 *cost_p, u32 default_cost, int change_amount) +{ + if (change_amount == 0) + /* Block is very similar to previous; prefer previous costs. */ + *cost_p = (default_cost + 3 * *cost_p) / 4; + else if (change_amount == 1) + *cost_p = (default_cost + *cost_p) / 2; + else if (change_amount == 2) + *cost_p = (5 * default_cost + 3 * *cost_p) / 8; + else + /* Block differs greatly from previous; prefer default costs. */ + *cost_p = (3 * default_cost + *cost_p) / 4; +} + +static forceinline void +deflate_adjust_costs_impl(struct libdeflate_compressor *c, + u32 lit_cost, u32 len_sym_cost, int change_amount) +{ + unsigned i; + + /* Literals */ + for (i = 0; i < DEFLATE_NUM_LITERALS; i++) + deflate_adjust_cost(&c->p.n.costs.literal[i], lit_cost, + change_amount); + + /* Lengths */ + for (i = DEFLATE_MIN_MATCH_LEN; i <= DEFLATE_MAX_MATCH_LEN; i++) + deflate_adjust_cost(&c->p.n.costs.length[i], + deflate_default_length_cost(i, + len_sym_cost), + change_amount); + + /* Offset slots */ + for (i = 0; i < ARRAY_LEN(deflate_offset_slot_base); i++) + deflate_adjust_cost(&c->p.n.costs.offset_slot[i], + deflate_default_offset_slot_cost(i), + change_amount); +} + +/* + * Adjust the costs when beginning a new block. + * + * Since the current costs have been optimized for the data, it's undesirable to + * throw them away and start over with the default costs. At the same time, we + * don't want to bias the parse by assuming that the next block will be similar + * to the current block. As a compromise, make the costs closer to the + * defaults, but don't simply set them to the defaults. + */ +static void +deflate_adjust_costs(struct libdeflate_compressor *c, + u32 lit_cost, u32 len_sym_cost) +{ + u64 total_delta = 0; + u64 cutoff; + int i; + + /* + * Decide how different the current block is from the previous block, + * using the block splitting statistics from the current and previous + * blocks. The more different the current block is, the more we prefer + * the default costs rather than the previous block's costs. + * + * The algorithm here is similar to the end-of-block check one, but here + * we compare two entire blocks rather than a partial block with a small + * extra part, and therefore we need 64-bit numbers in some places. + */ + for (i = 0; i < NUM_OBSERVATION_TYPES; i++) { + u64 prev = (u64)c->p.n.prev_observations[i] * + c->split_stats.num_observations; + u64 cur = (u64)c->split_stats.observations[i] * + c->p.n.prev_num_observations; + + total_delta += prev > cur ? prev - cur : cur - prev; + } + cutoff = ((u64)c->p.n.prev_num_observations * + c->split_stats.num_observations * 200) / 512; + + if (4 * total_delta > 9 * cutoff) + deflate_adjust_costs_impl(c, lit_cost, len_sym_cost, 3); + else if (2 * total_delta > 3 * cutoff) + deflate_adjust_costs_impl(c, lit_cost, len_sym_cost, 2); + else if (2 * total_delta > cutoff) + deflate_adjust_costs_impl(c, lit_cost, len_sym_cost, 1); + else + deflate_adjust_costs_impl(c, lit_cost, len_sym_cost, 0); +} + +/* + * Find the minimum-cost path through the graph of possible match/literal + * choices for this block. + * + * We find the minimum cost path from 'c->p.n.optimum_nodes[0]', which + * represents the node at the beginning of the block, to + * 'c->p.n.optimum_nodes[block_length]', which represents the node at the end of + * the block. Edge costs are evaluated using the cost model 'c->p.n.costs'. + * + * The algorithm works backwards, starting at the end node and proceeding + * backwards one node at a time. At each node, the minimum cost to reach the + * end node is computed and the match/literal choice that begins that path is + * saved. + */ +static void +deflate_find_min_cost_path(struct libdeflate_compressor *c, + const u32 block_length, + const struct lz_match *cache_ptr) +{ + struct deflate_optimum_node *end_node = + &c->p.n.optimum_nodes[block_length]; + struct deflate_optimum_node *cur_node = end_node; + + cur_node->cost_to_end = 0; + do { + unsigned num_matches; + unsigned literal; + u32 best_cost_to_end; + + cur_node--; + cache_ptr--; + + num_matches = cache_ptr->length; + literal = cache_ptr->offset; + + /* It's always possible to choose a literal. */ + best_cost_to_end = c->p.n.costs.literal[literal] + + (cur_node + 1)->cost_to_end; + cur_node->item = ((u32)literal << OPTIMUM_OFFSET_SHIFT) | 1; + + /* Also consider matches if there are any. */ + if (num_matches) { + const struct lz_match *match; + unsigned len; + unsigned offset; + unsigned offset_slot; + u32 offset_cost; + u32 cost_to_end; + + /* + * Consider each length from the minimum + * (DEFLATE_MIN_MATCH_LEN) to the length of the longest + * match found at this position. For each length, we + * consider only the smallest offset for which that + * length is available. Although this is not guaranteed + * to be optimal due to the possibility of a larger + * offset costing less than a smaller offset to code, + * this is a very useful heuristic. + */ + match = cache_ptr - num_matches; + len = DEFLATE_MIN_MATCH_LEN; + do { + offset = match->offset; + offset_slot = c->p.n.offset_slot_full[offset]; + offset_cost = + c->p.n.costs.offset_slot[offset_slot]; + do { + cost_to_end = offset_cost + + c->p.n.costs.length[len] + + (cur_node + len)->cost_to_end; + if (cost_to_end < best_cost_to_end) { + best_cost_to_end = cost_to_end; + cur_node->item = len | + ((u32)offset << + OPTIMUM_OFFSET_SHIFT); + } + } while (++len <= match->length); + } while (++match != cache_ptr); + cache_ptr -= num_matches; + } + cur_node->cost_to_end = best_cost_to_end; + } while (cur_node != &c->p.n.optimum_nodes[0]); +} + +/* + * Choose the literal/match sequence to use for the current block. The basic + * algorithm finds a minimum-cost path through the block's graph of + * literal/match choices, given a cost model. However, the cost of each symbol + * is unknown until the Huffman codes have been built, but at the same time the + * Huffman codes depend on the frequencies of chosen symbols. Consequently, + * multiple passes must be used to try to approximate an optimal solution. The + * first pass uses default costs, mixed with the costs from the previous block + * if any. Later passes use the Huffman codeword lengths from the previous pass + * as the costs. + */ +static void +deflate_optimize_block(struct libdeflate_compressor *c, + const u8 *block_begin, u32 block_length, + const struct lz_match *cache_ptr, bool is_first_block, + bool is_final_block) +{ + unsigned num_passes_remaining = c->p.n.num_optim_passes; + u32 lit_cost, len_sym_cost; + u32 i; + + /* + * Force the block to really end at the desired length, even if some + * matches extend beyond it. + */ + for (i = block_length; + i <= MIN(block_length - 1 + DEFLATE_MAX_MATCH_LEN, + ARRAY_LEN(c->p.n.optimum_nodes) - 1); i++) + c->p.n.optimum_nodes[i].cost_to_end = 0x80000000; + + /* Set the initial costs. */ + deflate_choose_default_litlen_costs(c, block_begin, block_length, + &lit_cost, &len_sym_cost); + if (is_first_block) + deflate_set_default_costs(c, lit_cost, len_sym_cost); + else + deflate_adjust_costs(c, lit_cost, len_sym_cost); + + do { + /* Find the minimum cost path for this pass. */ + deflate_find_min_cost_path(c, block_length, cache_ptr); + + /* Compute frequencies of the chosen symbols. */ + deflate_reset_symbol_frequencies(c); + deflate_tally_item_list(c, block_length); + + /* Make the Huffman codes. */ + deflate_make_huffman_codes(&c->freqs, &c->codes); + + /* + * Update the costs. After the last optimization pass, the + * final costs won't be needed for this block, but they will be + * used in determining the initial costs for the next block. + */ + if (--num_passes_remaining || !is_final_block) + deflate_set_costs_from_codes(c, &c->codes.lens); + } while (num_passes_remaining); +} + +static void +deflate_near_optimal_init_stats(struct libdeflate_compressor *c) +{ + init_block_split_stats(&c->split_stats); + memset(c->p.n.new_match_len_freqs, 0, + sizeof(c->p.n.new_match_len_freqs)); + memset(c->p.n.match_len_freqs, 0, sizeof(c->p.n.match_len_freqs)); +} + +static void +deflate_near_optimal_merge_stats(struct libdeflate_compressor *c) +{ + unsigned i; + + merge_new_observations(&c->split_stats); + for (i = 0; i < ARRAY_LEN(c->p.n.match_len_freqs); i++) { + c->p.n.match_len_freqs[i] += c->p.n.new_match_len_freqs[i]; + c->p.n.new_match_len_freqs[i] = 0; + } +} + +/* + * Save some literal/match statistics from the previous block so that + * deflate_adjust_costs() will be able to decide how much the current block + * differs from the previous one. + */ +static void +deflate_near_optimal_save_stats(struct libdeflate_compressor *c) +{ + int i; + + for (i = 0; i < NUM_OBSERVATION_TYPES; i++) + c->p.n.prev_observations[i] = c->split_stats.observations[i]; + c->p.n.prev_num_observations = c->split_stats.num_observations; +} + +static void +deflate_near_optimal_clear_old_stats(struct libdeflate_compressor *c) +{ + int i; + + for (i = 0; i < NUM_OBSERVATION_TYPES; i++) + c->split_stats.observations[i] = 0; + c->split_stats.num_observations = 0; + memset(c->p.n.match_len_freqs, 0, sizeof(c->p.n.match_len_freqs)); +} + +/* + * This is the "near-optimal" DEFLATE compressor. It computes the optimal + * representation of each DEFLATE block using a minimum-cost path search over + * the graph of possible match/literal choices for that block, assuming a + * certain cost for each Huffman symbol. + * + * For several reasons, the end result is not guaranteed to be optimal: + * + * - Nonoptimal choice of blocks + * - Heuristic limitations on which matches are actually considered + * - Symbol costs are unknown until the symbols have already been chosen + * (so iterative optimization must be used) + */ +static void +deflate_compress_near_optimal(struct libdeflate_compressor * restrict c, + const u8 *in, size_t in_nbytes, + struct deflate_output_bitstream *os) +{ + const u8 *in_next = in; + const u8 *in_block_begin = in_next; + const u8 *in_end = in_next + in_nbytes; + const u8 *in_cur_base = in_next; + const u8 *in_next_slide = + in_next + MIN(in_end - in_next, MATCHFINDER_WINDOW_SIZE); + unsigned max_len = DEFLATE_MAX_MATCH_LEN; + unsigned nice_len = MIN(c->nice_match_length, max_len); + struct lz_match *cache_ptr = c->p.n.match_cache; + u32 next_hashes[2] = {0, 0}; + + bt_matchfinder_init(&c->p.n.bt_mf); + deflate_near_optimal_init_stats(c); + + do { + /* Starting a new DEFLATE block */ + const u8 * const in_max_block_end = choose_max_block_end( + in_block_begin, in_end, SOFT_MAX_BLOCK_LENGTH); + const u8 *prev_end_block_check = NULL; + bool change_detected = false; + const u8 *next_observation = in_next; + unsigned min_len; + + /* + * Use the minimum match length heuristic to improve the + * literal/match statistics gathered during matchfinding. + * However, the actual near-optimal parse won't respect min_len, + * as it can accurately assess the costs of different matches. + */ + min_len = calculate_min_match_len( + in_block_begin, + in_max_block_end - in_block_begin, + c->max_search_depth); + + /* + * Find matches until we decide to end the block. We end the + * block if any of the following is true: + * + * (1) Maximum block length has been reached + * (2) Match catch may overflow. + * (3) Block split heuristic says to split now. + */ + for (;;) { + struct lz_match *matches; + unsigned best_len; + size_t remaining = in_end - in_next; + + /* Slide the window forward if needed. */ + if (in_next == in_next_slide) { + bt_matchfinder_slide_window(&c->p.n.bt_mf); + in_cur_base = in_next; + in_next_slide = in_next + + MIN(remaining, MATCHFINDER_WINDOW_SIZE); + } + + /* + * Find matches with the current position using the + * binary tree matchfinder and save them in match_cache. + * + * Note: the binary tree matchfinder is more suited for + * optimal parsing than the hash chain matchfinder. The + * reasons for this include: + * + * - The binary tree matchfinder can find more matches + * in the same number of steps. + * - One of the major advantages of hash chains is that + * skipping positions (not searching for matches at + * them) is faster; however, with optimal parsing we + * search for matches at almost all positions, so this + * advantage of hash chains is negated. + */ + matches = cache_ptr; + best_len = 0; + adjust_max_and_nice_len(&max_len, &nice_len, remaining); + if (likely(max_len >= BT_MATCHFINDER_REQUIRED_NBYTES)) { + cache_ptr = bt_matchfinder_get_matches( + &c->p.n.bt_mf, + in_cur_base, + in_next - in_cur_base, + max_len, + nice_len, + c->max_search_depth, + next_hashes, + matches); + if (cache_ptr > matches) + best_len = cache_ptr[-1].length; + } + if (in_next >= next_observation) { + if (best_len >= min_len) { + observe_match(&c->split_stats, + best_len); + next_observation = in_next + best_len; + c->p.n.new_match_len_freqs[best_len]++; + } else { + observe_literal(&c->split_stats, + *in_next); + next_observation = in_next + 1; + } + } + + cache_ptr->length = cache_ptr - matches; + cache_ptr->offset = *in_next; + in_next++; + cache_ptr++; + + /* + * If there was a very long match found, don't cache any + * matches for the bytes covered by that match. This + * avoids degenerate behavior when compressing highly + * redundant data, where the number of matches can be + * very large. + * + * This heuristic doesn't actually hurt the compression + * ratio very much. If there's a long match, then the + * data must be highly compressible, so it doesn't + * matter much what we do. + */ + if (best_len >= DEFLATE_MIN_MATCH_LEN && + best_len >= nice_len) { + --best_len; + do { + remaining = in_end - in_next; + if (in_next == in_next_slide) { + bt_matchfinder_slide_window( + &c->p.n.bt_mf); + in_cur_base = in_next; + in_next_slide = in_next + + MIN(remaining, + MATCHFINDER_WINDOW_SIZE); + } + adjust_max_and_nice_len(&max_len, + &nice_len, + remaining); + if (max_len >= + BT_MATCHFINDER_REQUIRED_NBYTES) { + bt_matchfinder_skip_byte( + &c->p.n.bt_mf, + in_cur_base, + in_next - in_cur_base, + nice_len, + c->max_search_depth, + next_hashes); + } + cache_ptr->length = 0; + cache_ptr->offset = *in_next; + in_next++; + cache_ptr++; + } while (--best_len); + } + /* Maximum block length or end of input reached? */ + if (in_next >= in_max_block_end) + break; + /* Match cache overflowed? */ + if (cache_ptr >= + &c->p.n.match_cache[MATCH_CACHE_LENGTH]) + break; + /* Not ready to try to end the block (again)? */ + if (!ready_to_check_block(&c->split_stats, + in_block_begin, in_next, + in_end)) + continue; + /* Check if it would be worthwhile to end the block. */ + if (do_end_block_check(&c->split_stats, + in_next - in_block_begin)) { + change_detected = true; + break; + } + /* Ending the block doesn't seem worthwhile here. */ + deflate_near_optimal_merge_stats(c); + prev_end_block_check = in_next; + } + /* + * All the matches for this block have been cached. Now choose + * the precise end of the block and the sequence of items to + * output to represent it, then flush the block. + */ + if (change_detected && prev_end_block_check != NULL) { + /* + * The block is being ended because a recent chunk of + * data differs from the rest of the block. We could + * end the block at 'in_next' like the greedy and lazy + * compressors do, but that's not ideal since it would + * include the differing chunk in the block. The + * near-optimal compressor has time to do a better job. + * Therefore, we rewind to just before the chunk, and + * output a block that only goes up to there. + * + * We then set things up to correctly start the next + * block, considering that some work has already been + * done on it (some matches found and stats gathered). + */ + struct lz_match *orig_cache_ptr = cache_ptr; + const u8 *in_block_end = prev_end_block_check; + u32 block_length = in_block_end - in_block_begin; + bool is_first = (in_block_begin == in); + bool is_final = false; + u32 num_bytes_to_rewind = in_next - in_block_end; + size_t cache_len_rewound; + + /* Rewind the match cache. */ + do { + cache_ptr--; + cache_ptr -= cache_ptr->length; + } while (--num_bytes_to_rewind); + cache_len_rewound = orig_cache_ptr - cache_ptr; + + deflate_optimize_block(c, in_block_begin, block_length, + cache_ptr, is_first, is_final); + deflate_flush_block(c, os, in_block_begin, block_length, + NULL, is_final); + memmove(c->p.n.match_cache, cache_ptr, + cache_len_rewound * sizeof(*cache_ptr)); + cache_ptr = &c->p.n.match_cache[cache_len_rewound]; + deflate_near_optimal_save_stats(c); + /* + * Clear the stats for the just-flushed block, leaving + * just the stats for the beginning of the next block. + */ + deflate_near_optimal_clear_old_stats(c); + in_block_begin = in_block_end; + } else { + /* + * The block is being ended for a reason other than a + * differing data chunk being detected. Don't rewind at + * all; just end the block at the current position. + */ + u32 block_length = in_next - in_block_begin; + bool is_first = (in_block_begin == in); + bool is_final = (in_next == in_end); + + deflate_near_optimal_merge_stats(c); + deflate_optimize_block(c, in_block_begin, block_length, + cache_ptr, is_first, is_final); + deflate_flush_block(c, os, in_block_begin, block_length, + NULL, is_final); + cache_ptr = &c->p.n.match_cache[0]; + deflate_near_optimal_save_stats(c); + deflate_near_optimal_init_stats(c); + in_block_begin = in_next; + } + } while (in_next != in_end); +} + +/* Initialize c->p.n.offset_slot_full. */ +static void +deflate_init_offset_slot_full(struct libdeflate_compressor *c) +{ + unsigned offset_slot; + unsigned offset; + unsigned offset_end; + + for (offset_slot = 0; offset_slot < ARRAY_LEN(deflate_offset_slot_base); + offset_slot++) { + offset = deflate_offset_slot_base[offset_slot]; + offset_end = offset + + (1 << deflate_extra_offset_bits[offset_slot]); + do { + c->p.n.offset_slot_full[offset] = offset_slot; + } while (++offset != offset_end); + } +} + +#endif /* SUPPORT_NEAR_OPTIMAL_PARSING */ + +LIBDEFLATEAPI struct libdeflate_compressor * +libdeflate_alloc_compressor(int compression_level) +{ + struct libdeflate_compressor *c; + size_t size = offsetof(struct libdeflate_compressor, p); + + check_buildtime_parameters(); + + if (compression_level < 0 || compression_level > 12) + return NULL; + +#if SUPPORT_NEAR_OPTIMAL_PARSING + if (compression_level >= 10) + size += sizeof(c->p.n); + else +#endif + { + if (compression_level >= 2) + size += sizeof(c->p.g); + else if (compression_level == 1) + size += sizeof(c->p.f); + } + + c = libdeflate_aligned_malloc(MATCHFINDER_MEM_ALIGNMENT, size); + if (!c) + return NULL; + + c->compression_level = compression_level; + + /* + * The higher the compression level, the more we should bother trying to + * compress very small inputs. + */ + c->max_passthrough_size = 55 - (compression_level * 4); + + switch (compression_level) { + case 0: + c->max_passthrough_size = SIZE_MAX; + c->impl = NULL; /* not used */ + break; + case 1: + c->impl = deflate_compress_fastest; + /* max_search_depth is unused. */ + c->nice_match_length = 32; + break; + case 2: + c->impl = deflate_compress_greedy; + c->max_search_depth = 6; + c->nice_match_length = 10; + break; + case 3: + c->impl = deflate_compress_greedy; + c->max_search_depth = 12; + c->nice_match_length = 14; + break; + case 4: + c->impl = deflate_compress_greedy; + c->max_search_depth = 16; + c->nice_match_length = 30; + break; + case 5: + c->impl = deflate_compress_lazy; + c->max_search_depth = 16; + c->nice_match_length = 30; + break; + case 6: + c->impl = deflate_compress_lazy; + c->max_search_depth = 35; + c->nice_match_length = 65; + break; + case 7: + c->impl = deflate_compress_lazy; + c->max_search_depth = 100; + c->nice_match_length = 130; + break; + case 8: + c->impl = deflate_compress_lazy2; + c->max_search_depth = 300; + c->nice_match_length = DEFLATE_MAX_MATCH_LEN; + break; + case 9: +#if !SUPPORT_NEAR_OPTIMAL_PARSING + default: +#endif + c->impl = deflate_compress_lazy2; + c->max_search_depth = 600; + c->nice_match_length = DEFLATE_MAX_MATCH_LEN; + break; +#if SUPPORT_NEAR_OPTIMAL_PARSING + case 10: + c->impl = deflate_compress_near_optimal; + c->max_search_depth = 35; + c->nice_match_length = 75; + c->p.n.num_optim_passes = 2; + deflate_init_offset_slot_full(c); + break; + case 11: + c->impl = deflate_compress_near_optimal; + c->max_search_depth = 70; + c->nice_match_length = 150; + c->p.n.num_optim_passes = 3; + deflate_init_offset_slot_full(c); + break; + case 12: + default: + c->impl = deflate_compress_near_optimal; + c->max_search_depth = 150; + c->nice_match_length = DEFLATE_MAX_MATCH_LEN; + c->p.n.num_optim_passes = 4; + deflate_init_offset_slot_full(c); + break; +#endif /* SUPPORT_NEAR_OPTIMAL_PARSING */ + } + + deflate_init_static_codes(c); + + return c; +} + +LIBDEFLATEAPI size_t +libdeflate_deflate_compress(struct libdeflate_compressor *c, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail) +{ + struct deflate_output_bitstream os; + + /* + * For extremely short inputs, or for compression level 0, just output + * uncompressed blocks. + */ + if (unlikely(in_nbytes <= c->max_passthrough_size)) + return deflate_compress_none(in, in_nbytes, + out, out_nbytes_avail); + + /* + * Initialize the output bitstream structure. + * + * The end is set to OUTPUT_END_PADDING below the true end, so that + * FLUSH_BITS() can be more efficient. + */ + if (unlikely(out_nbytes_avail <= OUTPUT_END_PADDING)) + return 0; + os.bitbuf = 0; + os.bitcount = 0; + os.next = out; + os.end = os.next + out_nbytes_avail - OUTPUT_END_PADDING; + (*c->impl)(c, in, in_nbytes, &os); + /* + * If 'os.next' reached 'os.end', then either there was not enough space + * in the output buffer, or the compressed size would have been within + * OUTPUT_END_PADDING of the true end. For performance reasons we don't + * distinguish between these cases; we just make sure to return some + * extra space from libdeflate_deflate_compress_bound(). + */ + if (os.next >= os.end) + return 0; + ASSERT(os.bitcount <= 7); + if (os.bitcount) + *os.next++ = os.bitbuf; + return os.next - (u8 *)out; +} + +LIBDEFLATEAPI void +libdeflate_free_compressor(struct libdeflate_compressor *c) +{ + libdeflate_aligned_free(c); +} + +unsigned int +libdeflate_get_compression_level(struct libdeflate_compressor *c) +{ + return c->compression_level; +} + +LIBDEFLATEAPI size_t +libdeflate_deflate_compress_bound(struct libdeflate_compressor *c, + size_t in_nbytes) +{ + size_t bound = 0; + size_t max_blocks; + + /* + * Since the compressor never uses a compressed block when an + * uncompressed block is cheaper, the worst case can be no worse than + * the case where only uncompressed blocks are used. + * + * This is true even though up to 7 bits are "wasted" to byte-align the + * bitstream when a compressed block is followed by an uncompressed + * block. This is because a compressed block wouldn't have been used if + * it wasn't cheaper than an uncompressed block, and uncompressed blocks + * always end on a byte boundary. So the alignment bits will, at worst, + * go up to the place where the uncompressed block would have ended. + */ + + /* + * The minimum length that is passed to deflate_flush_block() is + * MIN_BLOCK_LENGTH bytes, except for the final block if needed. + * + * If deflate_flush_block() decides to use an uncompressed block, it + * actually will (in general) output a series of uncompressed blocks in + * order to stay within the UINT16_MAX limit of DEFLATE. But this can + * be disregarded here as long as '2 * MIN_BLOCK_LENGTH <= UINT16_MAX', + * as in that case this behavior can't result in more blocks than the + * case where deflate_flush_block() is called with min-length inputs. + * + * So the number of uncompressed blocks needed would be bounded by + * DIV_ROUND_UP(in_nbytes, MIN_BLOCK_LENGTH). However, empty inputs + * need 1 (empty) block, which gives the final expression below. + */ + STATIC_ASSERT(2 * MIN_BLOCK_LENGTH <= UINT16_MAX); + max_blocks = MAX(DIV_ROUND_UP(in_nbytes, MIN_BLOCK_LENGTH), 1); + + /* + * Each uncompressed block has 5 bytes of overhead, for the BFINAL, + * BTYPE, LEN, and NLEN fields. (For the reason explained earlier, the + * alignment bits at the very start of the block can be disregarded; + * they would otherwise increase the overhead to 6 bytes per block.) + */ + bound += 5 * max_blocks; + + /* Account for the data itself, stored uncompressed. */ + bound += in_nbytes; + + /* + * Add 1 + OUTPUT_END_PADDING because for performance reasons, the + * compressor doesn't distinguish between cases where there wasn't + * enough space and cases where the compressed size would have been + * 'out_nbytes_avail - OUTPUT_END_PADDING' or greater. Adding + * 1 + OUTPUT_END_PADDING to the bound ensures the needed wiggle room. + */ + bound += 1 + OUTPUT_END_PADDING; + + return bound; +} diff --git a/tools/z64compress/src/enc/libdeflate/lib/deflate_compress.h b/tools/z64compress/src/enc/libdeflate/lib/deflate_compress.h new file mode 100644 index 000000000..9451d548b --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/deflate_compress.h @@ -0,0 +1,15 @@ +#ifndef LIB_DEFLATE_COMPRESS_H +#define LIB_DEFLATE_COMPRESS_H + +#include "lib_common.h" + +/* + * DEFLATE compression is private to deflate_compress.c, but we do need to be + * able to query the compression level for zlib and gzip header generation. + */ + +struct libdeflate_compressor; + +unsigned int libdeflate_get_compression_level(struct libdeflate_compressor *c); + +#endif /* LIB_DEFLATE_COMPRESS_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/deflate_constants.h b/tools/z64compress/src/enc/libdeflate/lib/deflate_constants.h new file mode 100644 index 000000000..95c9e0a50 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/deflate_constants.h @@ -0,0 +1,56 @@ +/* + * deflate_constants.h - constants for the DEFLATE compression format + */ + +#ifndef LIB_DEFLATE_CONSTANTS_H +#define LIB_DEFLATE_CONSTANTS_H + +/* Valid block types */ +#define DEFLATE_BLOCKTYPE_UNCOMPRESSED 0 +#define DEFLATE_BLOCKTYPE_STATIC_HUFFMAN 1 +#define DEFLATE_BLOCKTYPE_DYNAMIC_HUFFMAN 2 + +/* Minimum and maximum supported match lengths (in bytes) */ +#define DEFLATE_MIN_MATCH_LEN 3 +#define DEFLATE_MAX_MATCH_LEN 258 + +/* Maximum supported match offset (in bytes) */ +#define DEFLATE_MAX_MATCH_OFFSET 32768 + +/* log2 of DEFLATE_MAX_MATCH_OFFSET */ +#define DEFLATE_WINDOW_ORDER 15 + +/* Number of symbols in each Huffman code. Note: for the literal/length + * and offset codes, these are actually the maximum values; a given block + * might use fewer symbols. */ +#define DEFLATE_NUM_PRECODE_SYMS 19 +#define DEFLATE_NUM_LITLEN_SYMS 288 +#define DEFLATE_NUM_OFFSET_SYMS 32 + +/* The maximum number of symbols across all codes */ +#define DEFLATE_MAX_NUM_SYMS 288 + +/* Division of symbols in the literal/length code */ +#define DEFLATE_NUM_LITERALS 256 +#define DEFLATE_END_OF_BLOCK 256 +#define DEFLATE_FIRST_LEN_SYM 257 + +/* Maximum codeword length, in bits, within each Huffman code */ +#define DEFLATE_MAX_PRE_CODEWORD_LEN 7 +#define DEFLATE_MAX_LITLEN_CODEWORD_LEN 15 +#define DEFLATE_MAX_OFFSET_CODEWORD_LEN 15 + +/* The maximum codeword length across all codes */ +#define DEFLATE_MAX_CODEWORD_LEN 15 + +/* Maximum possible overrun when decoding codeword lengths */ +#define DEFLATE_MAX_LENS_OVERRUN 137 + +/* + * Maximum number of extra bits that may be required to represent a match + * length or offset. + */ +#define DEFLATE_MAX_EXTRA_LENGTH_BITS 5 +#define DEFLATE_MAX_EXTRA_OFFSET_BITS 13 + +#endif /* LIB_DEFLATE_CONSTANTS_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/deflate_decompress.c b/tools/z64compress/src/enc/libdeflate/lib/deflate_decompress.c new file mode 100644 index 000000000..7d22fc443 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/deflate_decompress.c @@ -0,0 +1,1176 @@ +/* + * deflate_decompress.c - a decompressor for DEFLATE + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * --------------------------------------------------------------------------- + * + * This is a highly optimized DEFLATE decompressor. It is much faster than + * vanilla zlib, typically well over twice as fast, though results vary by CPU. + * + * Why this is faster than vanilla zlib: + * + * - Word accesses rather than byte accesses when reading input + * - Word accesses rather than byte accesses when copying matches + * - Faster Huffman decoding combined with various DEFLATE-specific tricks + * - Larger bitbuffer variable that doesn't need to be refilled as often + * - Other optimizations to remove unnecessary branches + * - Only full-buffer decompression is supported, so the code doesn't need to + * support stopping and resuming decompression. + * - On x86_64, a version of the decompression routine is compiled with BMI2 + * instructions enabled and is used automatically at runtime when supported. + */ + +#include + +#include "lib_common.h" +#include "deflate_constants.h" + +#include "libdeflate.h" + +/* + * If the expression passed to SAFETY_CHECK() evaluates to false, then the + * decompression routine immediately returns LIBDEFLATE_BAD_DATA, indicating the + * compressed data is invalid. + * + * Theoretically, these checks could be disabled for specialized applications + * where all input to the decompressor will be trusted. + */ +#if 0 +# pragma message("UNSAFE DECOMPRESSION IS ENABLED. THIS MUST ONLY BE USED IF THE DECOMPRESSOR INPUT WILL ALWAYS BE TRUSTED!") +# define SAFETY_CHECK(expr) (void)(expr) +#else +# define SAFETY_CHECK(expr) if (unlikely(!(expr))) return LIBDEFLATE_BAD_DATA +#endif + +/***************************************************************************** + * Input bitstream * + *****************************************************************************/ + +/* + * The state of the "input bitstream" consists of the following variables: + * + * - in_next: a pointer to the next unread byte in the input buffer + * + * - in_end: a pointer to just past the end of the input buffer + * + * - bitbuf: a word-sized variable containing bits that have been read from + * the input buffer or from the implicit appended zero bytes + * + * - bitsleft: the number of bits in 'bitbuf' available to be consumed. + * After REFILL_BITS_BRANCHLESS(), 'bitbuf' can actually + * contain more bits than this. However, only the bits counted + * by 'bitsleft' can actually be consumed; the rest can only be + * used for preloading. + * + * As a micro-optimization, we allow bits 8 and higher of + * 'bitsleft' to contain garbage. When consuming the bits + * associated with a decode table entry, this allows us to do + * 'bitsleft -= entry' instead of 'bitsleft -= (u8)entry'. + * On some CPUs, this helps reduce instruction dependencies. + * This does have the disadvantage that 'bitsleft' sometimes + * needs to be cast to 'u8', such as when it's used as a shift + * amount in REFILL_BITS_BRANCHLESS(). But that one happens + * for free since most CPUs ignore high bits in shift amounts. + * + * - overread_count: the total number of implicit appended zero bytes that + * have been loaded into the bitbuffer, including any + * counted by 'bitsleft' and any already consumed + */ + +/* + * The type for the bitbuffer variable ('bitbuf' described above). For best + * performance, this should have size equal to a machine word. + * + * 64-bit platforms have a significant advantage: they get a bigger bitbuffer + * which they don't have to refill as often. + */ +typedef machine_word_t bitbuf_t; +#define BITBUF_NBITS (8 * (int)sizeof(bitbuf_t)) + +/* BITMASK(n) returns a bitmask of length 'n'. */ +#define BITMASK(n) (((bitbuf_t)1 << (n)) - 1) + +/* + * MAX_BITSLEFT is the maximum number of consumable bits, i.e. the maximum value + * of '(u8)bitsleft'. This is the size of the bitbuffer variable, minus 1 if + * the branchless refill method is being used (see REFILL_BITS_BRANCHLESS()). + */ +#define MAX_BITSLEFT \ + (UNALIGNED_ACCESS_IS_FAST ? BITBUF_NBITS - 1 : BITBUF_NBITS) + +/* + * CONSUMABLE_NBITS is the minimum number of bits that are guaranteed to be + * consumable (counted in 'bitsleft') immediately after refilling the bitbuffer. + * Since only whole bytes can be added to 'bitsleft', the worst case is + * 'MAX_BITSLEFT - 7': the smallest amount where another byte doesn't fit. + */ +#define CONSUMABLE_NBITS (MAX_BITSLEFT - 7) + +/* + * FASTLOOP_PRELOADABLE_NBITS is the minimum number of bits that are guaranteed + * to be preloadable immediately after REFILL_BITS_IN_FASTLOOP(). (It is *not* + * guaranteed after REFILL_BITS(), since REFILL_BITS() falls back to a + * byte-at-a-time refill method near the end of input.) This may exceed the + * number of consumable bits (counted by 'bitsleft'). Any bits not counted in + * 'bitsleft' can only be used for precomputation and cannot be consumed. + */ +#define FASTLOOP_PRELOADABLE_NBITS \ + (UNALIGNED_ACCESS_IS_FAST ? BITBUF_NBITS : CONSUMABLE_NBITS) + +/* + * PRELOAD_SLACK is the minimum number of bits that are guaranteed to be + * preloadable but not consumable, following REFILL_BITS_IN_FASTLOOP() and any + * subsequent consumptions. This is 1 bit if the branchless refill method is + * being used, and 0 bits otherwise. + */ +#define PRELOAD_SLACK MAX(0, FASTLOOP_PRELOADABLE_NBITS - MAX_BITSLEFT) + +/* + * CAN_CONSUME(n) is true if it's guaranteed that if the bitbuffer has just been + * refilled, then it's always possible to consume 'n' bits from it. 'n' should + * be a compile-time constant, to enable compile-time evaluation. + */ +#define CAN_CONSUME(n) (CONSUMABLE_NBITS >= (n)) + +/* + * CAN_CONSUME_AND_THEN_PRELOAD(consume_nbits, preload_nbits) is true if it's + * guaranteed that after REFILL_BITS_IN_FASTLOOP(), it's always possible to + * consume 'consume_nbits' bits, then preload 'preload_nbits' bits. The + * arguments should be compile-time constants to enable compile-time evaluation. + */ +#define CAN_CONSUME_AND_THEN_PRELOAD(consume_nbits, preload_nbits) \ + (CONSUMABLE_NBITS >= (consume_nbits) && \ + FASTLOOP_PRELOADABLE_NBITS >= (consume_nbits) + (preload_nbits)) + +/* + * REFILL_BITS_BRANCHLESS() branchlessly refills the bitbuffer variable by + * reading the next word from the input buffer and updating 'in_next' and + * 'bitsleft' based on how many bits were refilled -- counting whole bytes only. + * This is much faster than reading a byte at a time, at least if the CPU is + * little endian and supports fast unaligned memory accesses. + * + * The simplest way of branchlessly updating 'bitsleft' would be: + * + * bitsleft += (MAX_BITSLEFT - bitsleft) & ~7; + * + * To make it faster, we define MAX_BITSLEFT to be 'WORDBITS - 1' rather than + * WORDBITS, so that in binary it looks like 111111 or 11111. Then, we update + * 'bitsleft' by just setting the bits above the low 3 bits: + * + * bitsleft |= MAX_BITSLEFT & ~7; + * + * That compiles down to a single instruction like 'or $0x38, %rbp'. Using + * 'MAX_BITSLEFT == WORDBITS - 1' also has the advantage that refills can be + * done when 'bitsleft == MAX_BITSLEFT' without invoking undefined behavior. + * + * The simplest way of branchlessly updating 'in_next' would be: + * + * in_next += (MAX_BITSLEFT - bitsleft) >> 3; + * + * With 'MAX_BITSLEFT == WORDBITS - 1' we could use an XOR instead, though this + * isn't really better: + * + * in_next += (MAX_BITSLEFT ^ bitsleft) >> 3; + * + * An alternative which can be marginally better is the following: + * + * in_next += sizeof(bitbuf_t) - 1; + * in_next -= (bitsleft >> 3) & 0x7; + * + * It seems this would increase the number of CPU instructions from 3 (sub, shr, + * add) to 4 (add, shr, and, sub). However, if the CPU has a bitfield + * extraction instruction (e.g. arm's ubfx), it stays at 3, and is potentially + * more efficient because the length of the longest dependency chain decreases + * from 3 to 2. This alternative also has the advantage that it ignores the + * high bits in 'bitsleft', so it is compatible with the micro-optimization we + * use where we let the high bits of 'bitsleft' contain garbage. + */ +#define REFILL_BITS_BRANCHLESS() \ +do { \ + bitbuf |= get_unaligned_leword(in_next) << (u8)bitsleft; \ + in_next += sizeof(bitbuf_t) - 1; \ + in_next -= (bitsleft >> 3) & 0x7; \ + bitsleft |= MAX_BITSLEFT & ~7; \ +} while (0) + +/* + * REFILL_BITS() loads bits from the input buffer until the bitbuffer variable + * contains at least CONSUMABLE_NBITS consumable bits. + * + * This checks for the end of input, and it doesn't guarantee + * FASTLOOP_PRELOADABLE_NBITS, so it can't be used in the fastloop. + * + * If we would overread the input buffer, we just don't read anything, leaving + * the bits zeroed but marking them filled. This simplifies the decompressor + * because it removes the need to always be able to distinguish between real + * overreads and overreads caused only by the decompressor's own lookahead. + * + * We do still keep track of the number of bytes that have been overread, for + * two reasons. First, it allows us to determine the exact number of bytes that + * were consumed once the stream ends or an uncompressed block is reached. + * Second, it allows us to stop early if the overread amount gets so large (more + * than sizeof bitbuf) that it can only be caused by a real overread. (The + * second part is arguably unneeded, since libdeflate is buffer-based; given + * infinite zeroes, it will eventually either completely fill the output buffer + * or return an error. However, we do it to be slightly more friendly to the + * not-recommended use case of decompressing with an unknown output size.) + */ +#define REFILL_BITS() \ +do { \ + if (UNALIGNED_ACCESS_IS_FAST && \ + likely(in_end - in_next >= sizeof(bitbuf_t))) { \ + REFILL_BITS_BRANCHLESS(); \ + } else { \ + while ((u8)bitsleft < CONSUMABLE_NBITS) { \ + if (likely(in_next != in_end)) { \ + bitbuf |= (bitbuf_t)*in_next++ << \ + (u8)bitsleft; \ + } else { \ + overread_count++; \ + SAFETY_CHECK(overread_count <= \ + sizeof(bitbuf_t)); \ + } \ + bitsleft += 8; \ + } \ + } \ +} while (0) + +/* + * REFILL_BITS_IN_FASTLOOP() is like REFILL_BITS(), but it doesn't check for the + * end of the input. It can only be used in the fastloop. + */ +#define REFILL_BITS_IN_FASTLOOP() \ +do { \ + STATIC_ASSERT(UNALIGNED_ACCESS_IS_FAST || \ + FASTLOOP_PRELOADABLE_NBITS == CONSUMABLE_NBITS); \ + if (UNALIGNED_ACCESS_IS_FAST) { \ + REFILL_BITS_BRANCHLESS(); \ + } else { \ + while ((u8)bitsleft < CONSUMABLE_NBITS) { \ + bitbuf |= (bitbuf_t)*in_next++ << (u8)bitsleft; \ + bitsleft += 8; \ + } \ + } \ +} while (0) + +/* + * This is the worst-case maximum number of output bytes that are written to + * during each iteration of the fastloop. The worst case is 2 literals, then a + * match of length DEFLATE_MAX_MATCH_LEN. Additionally, some slack space must + * be included for the intentional overrun in the match copy implementation. + */ +#define FASTLOOP_MAX_BYTES_WRITTEN \ + (2 + DEFLATE_MAX_MATCH_LEN + (5 * WORDBYTES) - 1) + +/* + * This is the worst-case maximum number of input bytes that are read during + * each iteration of the fastloop. To get this value, we first compute the + * greatest number of bits that can be refilled during a loop iteration. The + * refill at the beginning can add at most MAX_BITSLEFT, and the amount that can + * be refilled later is no more than the maximum amount that can be consumed by + * 2 literals that don't need a subtable, then a match. We convert this value + * to bytes, rounding up; this gives the maximum number of bytes that 'in_next' + * can be advanced. Finally, we add sizeof(bitbuf_t) to account for + * REFILL_BITS_BRANCHLESS() reading a word past 'in_next'. + */ +#define FASTLOOP_MAX_BYTES_READ \ + (DIV_ROUND_UP(MAX_BITSLEFT + (2 * LITLEN_TABLEBITS) + \ + LENGTH_MAXBITS + OFFSET_MAXBITS, 8) + \ + sizeof(bitbuf_t)) + +/***************************************************************************** + * Huffman decoding * + *****************************************************************************/ + +/* + * The fastest way to decode Huffman-encoded data is basically to use a decode + * table that maps the next TABLEBITS bits of data to their symbol. Each entry + * decode_table[i] maps to the symbol whose codeword is a prefix of 'i'. A + * symbol with codeword length 'n' has '2**(TABLEBITS-n)' entries in the table. + * + * Ideally, TABLEBITS and the maximum codeword length would be the same; some + * compression formats are designed with this goal in mind. Unfortunately, in + * DEFLATE, the maximum litlen and offset codeword lengths are 15 bits, which is + * too large for a practical TABLEBITS. It's not *that* much larger, though, so + * the workaround is to use a single level of subtables. In the main table, + * entries for prefixes of codewords longer than TABLEBITS contain a "pointer" + * to the appropriate subtable along with the number of bits it is indexed with. + * + * The most efficient way to allocate subtables is to allocate them dynamically + * after the main table. The worst-case number of table entries needed, + * including subtables, is precomputable; see the ENOUGH constants below. + * + * A useful optimization is to store the codeword lengths in the decode table so + * that they don't have to be looked up by indexing a separate table that maps + * symbols to their codeword lengths. We basically do this; however, for the + * litlen and offset codes we also implement some DEFLATE-specific optimizations + * that build in the consideration of the "extra bits" and the + * literal/length/end-of-block division. For the exact decode table entry + * format we use, see the definitions of the *_decode_results[] arrays below. + */ + + +/* + * These are the TABLEBITS values we use for each of the DEFLATE Huffman codes, + * along with their corresponding ENOUGH values. + * + * For the precode, we use PRECODE_TABLEBITS == 7 since this is the maximum + * precode codeword length. This avoids ever needing subtables. + * + * For the litlen and offset codes, we cannot realistically avoid ever needing + * subtables, since litlen and offset codewords can be up to 15 bits. A higher + * TABLEBITS reduces the number of lookups that need a subtable, which increases + * performance; however, it increases memory usage and makes building the table + * take longer, which decreases performance. We choose values that work well in + * practice, making subtables rarely needed without making the tables too large. + * + * Our choice of OFFSET_TABLEBITS == 8 is a bit low; without any special + * considerations, 9 would fit the trade-off curve better. However, there is a + * performance benefit to using exactly 8 bits when it is a compile-time + * constant, as many CPUs can take the low byte more easily than the low 9 bits. + * + * zlib treats its equivalents of TABLEBITS as maximum values; whenever it + * builds a table, it caps the actual table_bits to the longest codeword. This + * makes sense in theory, as there's no need for the table to be any larger than + * needed to support the longest codeword. However, having the table bits be a + * compile-time constant is beneficial to the performance of the decode loop, so + * there is a trade-off. libdeflate currently uses the dynamic table_bits + * strategy for the litlen table only, due to its larger maximum size. + * PRECODE_TABLEBITS and OFFSET_TABLEBITS are smaller, so going dynamic there + * isn't as useful, and OFFSET_TABLEBITS=8 is useful as mentioned above. + * + * Each TABLEBITS value has a corresponding ENOUGH value that gives the + * worst-case maximum number of decode table entries, including the main table + * and all subtables. The ENOUGH value depends on three parameters: + * + * (1) the maximum number of symbols in the code (DEFLATE_NUM_*_SYMS) + * (2) the maximum number of main table bits (*_TABLEBITS) + * (3) the maximum allowed codeword length (DEFLATE_MAX_*_CODEWORD_LEN) + * + * The ENOUGH values were computed using the utility program 'enough' from zlib. + */ +#define PRECODE_TABLEBITS 7 +#define PRECODE_ENOUGH 128 /* enough 19 7 7 */ +#define LITLEN_TABLEBITS 11 +#define LITLEN_ENOUGH 2342 /* enough 288 11 15 */ +#define OFFSET_TABLEBITS 8 +#define OFFSET_ENOUGH 402 /* enough 32 8 15 */ + +/* + * make_decode_table_entry() creates a decode table entry for the given symbol + * by combining the static part 'decode_results[sym]' with the dynamic part + * 'len', which is the remaining codeword length (the codeword length for main + * table entries, or the codeword length minus TABLEBITS for subtable entries). + * + * In all cases, we add 'len' to each of the two low-order bytes to create the + * appropriately-formatted decode table entry. See the definitions of the + * *_decode_results[] arrays below, where the entry format is described. + */ +static forceinline u32 +make_decode_table_entry(const u32 decode_results[], u32 sym, u32 len) +{ + return decode_results[sym] + (len << 8) + len; +} + +/* + * Here is the format of our precode decode table entries. Bits not explicitly + * described contain zeroes: + * + * Bit 20-16: presym + * Bit 10-8: codeword length [not used] + * Bit 2-0: codeword length + * + * The precode decode table never has subtables, since we use + * PRECODE_TABLEBITS == DEFLATE_MAX_PRE_CODEWORD_LEN. + * + * precode_decode_results[] contains the static part of the entry for each + * symbol. make_decode_table_entry() produces the final entries. + */ +static const u32 precode_decode_results[] = { +#define ENTRY(presym) ((u32)presym << 16) + ENTRY(0) , ENTRY(1) , ENTRY(2) , ENTRY(3) , + ENTRY(4) , ENTRY(5) , ENTRY(6) , ENTRY(7) , + ENTRY(8) , ENTRY(9) , ENTRY(10) , ENTRY(11) , + ENTRY(12) , ENTRY(13) , ENTRY(14) , ENTRY(15) , + ENTRY(16) , ENTRY(17) , ENTRY(18) , +#undef ENTRY +}; + +/* Litlen and offset decode table entry flags */ + +/* Indicates a literal entry in the litlen decode table */ +#define HUFFDEC_LITERAL 0x80000000 + +/* Indicates that HUFFDEC_SUBTABLE_POINTER or HUFFDEC_END_OF_BLOCK is set */ +#define HUFFDEC_EXCEPTIONAL 0x00008000 + +/* Indicates a subtable pointer entry in the litlen or offset decode table */ +#define HUFFDEC_SUBTABLE_POINTER 0x00004000 + +/* Indicates an end-of-block entry in the litlen decode table */ +#define HUFFDEC_END_OF_BLOCK 0x00002000 + +/* Maximum number of bits that can be consumed by decoding a match length */ +#define LENGTH_MAXBITS (DEFLATE_MAX_LITLEN_CODEWORD_LEN + \ + DEFLATE_MAX_EXTRA_LENGTH_BITS) +#define LENGTH_MAXFASTBITS (LITLEN_TABLEBITS /* no subtable needed */ + \ + DEFLATE_MAX_EXTRA_LENGTH_BITS) + +/* + * Here is the format of our litlen decode table entries. Bits not explicitly + * described contain zeroes: + * + * Literals: + * Bit 31: 1 (HUFFDEC_LITERAL) + * Bit 23-16: literal value + * Bit 15: 0 (!HUFFDEC_EXCEPTIONAL) + * Bit 14: 0 (!HUFFDEC_SUBTABLE_POINTER) + * Bit 13: 0 (!HUFFDEC_END_OF_BLOCK) + * Bit 11-8: remaining codeword length [not used] + * Bit 3-0: remaining codeword length + * Lengths: + * Bit 31: 0 (!HUFFDEC_LITERAL) + * Bit 24-16: length base value + * Bit 15: 0 (!HUFFDEC_EXCEPTIONAL) + * Bit 14: 0 (!HUFFDEC_SUBTABLE_POINTER) + * Bit 13: 0 (!HUFFDEC_END_OF_BLOCK) + * Bit 11-8: remaining codeword length + * Bit 4-0: remaining codeword length + number of extra bits + * End of block: + * Bit 31: 0 (!HUFFDEC_LITERAL) + * Bit 15: 1 (HUFFDEC_EXCEPTIONAL) + * Bit 14: 0 (!HUFFDEC_SUBTABLE_POINTER) + * Bit 13: 1 (HUFFDEC_END_OF_BLOCK) + * Bit 11-8: remaining codeword length [not used] + * Bit 3-0: remaining codeword length + * Subtable pointer: + * Bit 31: 0 (!HUFFDEC_LITERAL) + * Bit 30-16: index of start of subtable + * Bit 15: 1 (HUFFDEC_EXCEPTIONAL) + * Bit 14: 1 (HUFFDEC_SUBTABLE_POINTER) + * Bit 13: 0 (!HUFFDEC_END_OF_BLOCK) + * Bit 11-8: number of subtable bits + * Bit 3-0: number of main table bits + * + * This format has several desirable properties: + * + * - The codeword length, length slot base, and number of extra length bits + * are all built in. This eliminates the need to separately look up this + * information by indexing separate arrays by symbol or length slot. + * + * - The HUFFDEC_* flags enable easily distinguishing between the different + * types of entries. The HUFFDEC_LITERAL flag enables a fast path for + * literals; the high bit is used for this, as some CPUs can test the + * high bit more easily than other bits. The HUFFDEC_EXCEPTIONAL flag + * makes it possible to detect the two unlikely cases (subtable pointer + * and end of block) in a single bit flag test. + * + * - The low byte is the number of bits that need to be removed from the + * bitstream; this makes this value easily accessible, and it enables the + * micro-optimization of doing 'bitsleft -= entry' instead of + * 'bitsleft -= (u8)entry'. It also includes the number of extra bits, + * so they don't need to be removed separately. + * + * - The flags in bits 15-13 are arranged to be 0 when the + * "remaining codeword length" in bits 11-8 is needed, making this value + * fairly easily accessible as well via a shift and downcast. + * + * - Similarly, bits 13-12 are 0 when the "subtable bits" in bits 11-8 are + * needed, making it possible to extract this value with '& 0x3F' rather + * than '& 0xF'. This value is only used as a shift amount, so this can + * save an 'and' instruction as the masking by 0x3F happens implicitly. + * + * litlen_decode_results[] contains the static part of the entry for each + * symbol. make_decode_table_entry() produces the final entries. + */ +static const u32 litlen_decode_results[] = { + + /* Literals */ +#define ENTRY(literal) (HUFFDEC_LITERAL | ((u32)literal << 16)) + ENTRY(0) , ENTRY(1) , ENTRY(2) , ENTRY(3) , + ENTRY(4) , ENTRY(5) , ENTRY(6) , ENTRY(7) , + ENTRY(8) , ENTRY(9) , ENTRY(10) , ENTRY(11) , + ENTRY(12) , ENTRY(13) , ENTRY(14) , ENTRY(15) , + ENTRY(16) , ENTRY(17) , ENTRY(18) , ENTRY(19) , + ENTRY(20) , ENTRY(21) , ENTRY(22) , ENTRY(23) , + ENTRY(24) , ENTRY(25) , ENTRY(26) , ENTRY(27) , + ENTRY(28) , ENTRY(29) , ENTRY(30) , ENTRY(31) , + ENTRY(32) , ENTRY(33) , ENTRY(34) , ENTRY(35) , + ENTRY(36) , ENTRY(37) , ENTRY(38) , ENTRY(39) , + ENTRY(40) , ENTRY(41) , ENTRY(42) , ENTRY(43) , + ENTRY(44) , ENTRY(45) , ENTRY(46) , ENTRY(47) , + ENTRY(48) , ENTRY(49) , ENTRY(50) , ENTRY(51) , + ENTRY(52) , ENTRY(53) , ENTRY(54) , ENTRY(55) , + ENTRY(56) , ENTRY(57) , ENTRY(58) , ENTRY(59) , + ENTRY(60) , ENTRY(61) , ENTRY(62) , ENTRY(63) , + ENTRY(64) , ENTRY(65) , ENTRY(66) , ENTRY(67) , + ENTRY(68) , ENTRY(69) , ENTRY(70) , ENTRY(71) , + ENTRY(72) , ENTRY(73) , ENTRY(74) , ENTRY(75) , + ENTRY(76) , ENTRY(77) , ENTRY(78) , ENTRY(79) , + ENTRY(80) , ENTRY(81) , ENTRY(82) , ENTRY(83) , + ENTRY(84) , ENTRY(85) , ENTRY(86) , ENTRY(87) , + ENTRY(88) , ENTRY(89) , ENTRY(90) , ENTRY(91) , + ENTRY(92) , ENTRY(93) , ENTRY(94) , ENTRY(95) , + ENTRY(96) , ENTRY(97) , ENTRY(98) , ENTRY(99) , + ENTRY(100) , ENTRY(101) , ENTRY(102) , ENTRY(103) , + ENTRY(104) , ENTRY(105) , ENTRY(106) , ENTRY(107) , + ENTRY(108) , ENTRY(109) , ENTRY(110) , ENTRY(111) , + ENTRY(112) , ENTRY(113) , ENTRY(114) , ENTRY(115) , + ENTRY(116) , ENTRY(117) , ENTRY(118) , ENTRY(119) , + ENTRY(120) , ENTRY(121) , ENTRY(122) , ENTRY(123) , + ENTRY(124) , ENTRY(125) , ENTRY(126) , ENTRY(127) , + ENTRY(128) , ENTRY(129) , ENTRY(130) , ENTRY(131) , + ENTRY(132) , ENTRY(133) , ENTRY(134) , ENTRY(135) , + ENTRY(136) , ENTRY(137) , ENTRY(138) , ENTRY(139) , + ENTRY(140) , ENTRY(141) , ENTRY(142) , ENTRY(143) , + ENTRY(144) , ENTRY(145) , ENTRY(146) , ENTRY(147) , + ENTRY(148) , ENTRY(149) , ENTRY(150) , ENTRY(151) , + ENTRY(152) , ENTRY(153) , ENTRY(154) , ENTRY(155) , + ENTRY(156) , ENTRY(157) , ENTRY(158) , ENTRY(159) , + ENTRY(160) , ENTRY(161) , ENTRY(162) , ENTRY(163) , + ENTRY(164) , ENTRY(165) , ENTRY(166) , ENTRY(167) , + ENTRY(168) , ENTRY(169) , ENTRY(170) , ENTRY(171) , + ENTRY(172) , ENTRY(173) , ENTRY(174) , ENTRY(175) , + ENTRY(176) , ENTRY(177) , ENTRY(178) , ENTRY(179) , + ENTRY(180) , ENTRY(181) , ENTRY(182) , ENTRY(183) , + ENTRY(184) , ENTRY(185) , ENTRY(186) , ENTRY(187) , + ENTRY(188) , ENTRY(189) , ENTRY(190) , ENTRY(191) , + ENTRY(192) , ENTRY(193) , ENTRY(194) , ENTRY(195) , + ENTRY(196) , ENTRY(197) , ENTRY(198) , ENTRY(199) , + ENTRY(200) , ENTRY(201) , ENTRY(202) , ENTRY(203) , + ENTRY(204) , ENTRY(205) , ENTRY(206) , ENTRY(207) , + ENTRY(208) , ENTRY(209) , ENTRY(210) , ENTRY(211) , + ENTRY(212) , ENTRY(213) , ENTRY(214) , ENTRY(215) , + ENTRY(216) , ENTRY(217) , ENTRY(218) , ENTRY(219) , + ENTRY(220) , ENTRY(221) , ENTRY(222) , ENTRY(223) , + ENTRY(224) , ENTRY(225) , ENTRY(226) , ENTRY(227) , + ENTRY(228) , ENTRY(229) , ENTRY(230) , ENTRY(231) , + ENTRY(232) , ENTRY(233) , ENTRY(234) , ENTRY(235) , + ENTRY(236) , ENTRY(237) , ENTRY(238) , ENTRY(239) , + ENTRY(240) , ENTRY(241) , ENTRY(242) , ENTRY(243) , + ENTRY(244) , ENTRY(245) , ENTRY(246) , ENTRY(247) , + ENTRY(248) , ENTRY(249) , ENTRY(250) , ENTRY(251) , + ENTRY(252) , ENTRY(253) , ENTRY(254) , ENTRY(255) , +#undef ENTRY + + /* End of block */ + HUFFDEC_EXCEPTIONAL | HUFFDEC_END_OF_BLOCK, + + /* Lengths */ +#define ENTRY(length_base, num_extra_bits) \ + (((u32)(length_base) << 16) | (num_extra_bits)) + ENTRY(3 , 0) , ENTRY(4 , 0) , ENTRY(5 , 0) , ENTRY(6 , 0), + ENTRY(7 , 0) , ENTRY(8 , 0) , ENTRY(9 , 0) , ENTRY(10 , 0), + ENTRY(11 , 1) , ENTRY(13 , 1) , ENTRY(15 , 1) , ENTRY(17 , 1), + ENTRY(19 , 2) , ENTRY(23 , 2) , ENTRY(27 , 2) , ENTRY(31 , 2), + ENTRY(35 , 3) , ENTRY(43 , 3) , ENTRY(51 , 3) , ENTRY(59 , 3), + ENTRY(67 , 4) , ENTRY(83 , 4) , ENTRY(99 , 4) , ENTRY(115, 4), + ENTRY(131, 5) , ENTRY(163, 5) , ENTRY(195, 5) , ENTRY(227, 5), + ENTRY(258, 0) , ENTRY(258, 0) , ENTRY(258, 0) , +#undef ENTRY +}; + +/* Maximum number of bits that can be consumed by decoding a match offset */ +#define OFFSET_MAXBITS (DEFLATE_MAX_OFFSET_CODEWORD_LEN + \ + DEFLATE_MAX_EXTRA_OFFSET_BITS) +#define OFFSET_MAXFASTBITS (OFFSET_TABLEBITS /* no subtable needed */ + \ + DEFLATE_MAX_EXTRA_OFFSET_BITS) + +/* + * Here is the format of our offset decode table entries. Bits not explicitly + * described contain zeroes: + * + * Offsets: + * Bit 31-16: offset base value + * Bit 15: 0 (!HUFFDEC_EXCEPTIONAL) + * Bit 14: 0 (!HUFFDEC_SUBTABLE_POINTER) + * Bit 11-8: remaining codeword length + * Bit 4-0: remaining codeword length + number of extra bits + * Subtable pointer: + * Bit 31-16: index of start of subtable + * Bit 15: 1 (HUFFDEC_EXCEPTIONAL) + * Bit 14: 1 (HUFFDEC_SUBTABLE_POINTER) + * Bit 11-8: number of subtable bits + * Bit 3-0: number of main table bits + * + * These work the same way as the length entries and subtable pointer entries in + * the litlen decode table; see litlen_decode_results[] above. + */ +static const u32 offset_decode_results[] = { +#define ENTRY(offset_base, num_extra_bits) \ + (((u32)(offset_base) << 16) | (num_extra_bits)) + ENTRY(1 , 0) , ENTRY(2 , 0) , ENTRY(3 , 0) , ENTRY(4 , 0) , + ENTRY(5 , 1) , ENTRY(7 , 1) , ENTRY(9 , 2) , ENTRY(13 , 2) , + ENTRY(17 , 3) , ENTRY(25 , 3) , ENTRY(33 , 4) , ENTRY(49 , 4) , + ENTRY(65 , 5) , ENTRY(97 , 5) , ENTRY(129 , 6) , ENTRY(193 , 6) , + ENTRY(257 , 7) , ENTRY(385 , 7) , ENTRY(513 , 8) , ENTRY(769 , 8) , + ENTRY(1025 , 9) , ENTRY(1537 , 9) , ENTRY(2049 , 10) , ENTRY(3073 , 10) , + ENTRY(4097 , 11) , ENTRY(6145 , 11) , ENTRY(8193 , 12) , ENTRY(12289 , 12) , + ENTRY(16385 , 13) , ENTRY(24577 , 13) , ENTRY(24577 , 13) , ENTRY(24577 , 13) , +#undef ENTRY +}; + +/* + * The main DEFLATE decompressor structure. Since libdeflate only supports + * full-buffer decompression, this structure doesn't store the entire + * decompression state, most of which is in stack variables. Instead, this + * struct just contains the decode tables and some temporary arrays used for + * building them, as these are too large to comfortably allocate on the stack. + * + * Storing the decode tables in the decompressor struct also allows the decode + * tables for the static codes to be reused whenever two static Huffman blocks + * are decoded without an intervening dynamic block, even across streams. + */ +struct libdeflate_decompressor { + + /* + * The arrays aren't all needed at the same time. 'precode_lens' and + * 'precode_decode_table' are unneeded after 'lens' has been filled. + * Furthermore, 'lens' need not be retained after building the litlen + * and offset decode tables. In fact, 'lens' can be in union with + * 'litlen_decode_table' provided that 'offset_decode_table' is separate + * and is built first. + */ + + union { + u8 precode_lens[DEFLATE_NUM_PRECODE_SYMS]; + + struct { + u8 lens[DEFLATE_NUM_LITLEN_SYMS + + DEFLATE_NUM_OFFSET_SYMS + + DEFLATE_MAX_LENS_OVERRUN]; + + u32 precode_decode_table[PRECODE_ENOUGH]; + } l; + + u32 litlen_decode_table[LITLEN_ENOUGH]; + } u; + + u32 offset_decode_table[OFFSET_ENOUGH]; + + /* used only during build_decode_table() */ + u16 sorted_syms[DEFLATE_MAX_NUM_SYMS]; + + bool static_codes_loaded; + unsigned litlen_tablebits; +}; + +/* + * Build a table for fast decoding of symbols from a Huffman code. As input, + * this function takes the codeword length of each symbol which may be used in + * the code. As output, it produces a decode table for the canonical Huffman + * code described by the codeword lengths. The decode table is built with the + * assumption that it will be indexed with "bit-reversed" codewords, where the + * low-order bit is the first bit of the codeword. This format is used for all + * Huffman codes in DEFLATE. + * + * @decode_table + * The array in which the decode table will be generated. This array must + * have sufficient length; see the definition of the ENOUGH numbers. + * @lens + * An array which provides, for each symbol, the length of the + * corresponding codeword in bits, or 0 if the symbol is unused. This may + * alias @decode_table, since nothing is written to @decode_table until all + * @lens have been consumed. All codeword lengths are assumed to be <= + * @max_codeword_len but are otherwise considered untrusted. If they do + * not form a valid Huffman code, then the decode table is not built and + * %false is returned. + * @num_syms + * The number of symbols in the code, including all unused symbols. + * @decode_results + * An array which gives the incomplete decode result for each symbol. The + * needed values in this array will be combined with codeword lengths to + * make the final decode table entries using make_decode_table_entry(). + * @table_bits + * The log base-2 of the number of main table entries to use. + * If @table_bits_ret != NULL, then @table_bits is treated as a maximum + * value and it will be decreased if a smaller table would be sufficient. + * @max_codeword_len + * The maximum allowed codeword length for this Huffman code. + * Must be <= DEFLATE_MAX_CODEWORD_LEN. + * @sorted_syms + * A temporary array of length @num_syms. + * @table_bits_ret + * If non-NULL, then the dynamic table_bits is enabled, and the actual + * table_bits value will be returned here. + * + * Returns %true if successful; %false if the codeword lengths do not form a + * valid Huffman code. + */ +static bool +build_decode_table(u32 decode_table[], + const u8 lens[], + const unsigned num_syms, + const u32 decode_results[], + unsigned table_bits, + unsigned max_codeword_len, + u16 *sorted_syms, + unsigned *table_bits_ret) +{ + unsigned len_counts[DEFLATE_MAX_CODEWORD_LEN + 1]; + unsigned offsets[DEFLATE_MAX_CODEWORD_LEN + 1]; + unsigned sym; /* current symbol */ + unsigned codeword; /* current codeword, bit-reversed */ + unsigned len; /* current codeword length in bits */ + unsigned count; /* num codewords remaining with this length */ + u32 codespace_used; /* codespace used out of '2^max_codeword_len' */ + unsigned cur_table_end; /* end index of current table */ + unsigned subtable_prefix; /* codeword prefix of current subtable */ + unsigned subtable_start; /* start index of current subtable */ + unsigned subtable_bits; /* log2 of current subtable length */ + + /* Count how many codewords have each length, including 0. */ + for (len = 0; len <= max_codeword_len; len++) + len_counts[len] = 0; + for (sym = 0; sym < num_syms; sym++) + len_counts[lens[sym]]++; + + /* + * Determine the actual maximum codeword length that was used, and + * decrease table_bits to it if allowed. + */ + while (max_codeword_len > 1 && len_counts[max_codeword_len] == 0) + max_codeword_len--; + if (table_bits_ret != NULL) { + table_bits = MIN(table_bits, max_codeword_len); + *table_bits_ret = table_bits; + } + + /* + * Sort the symbols primarily by increasing codeword length and + * secondarily by increasing symbol value; or equivalently by their + * codewords in lexicographic order, since a canonical code is assumed. + * + * For efficiency, also compute 'codespace_used' in the same pass over + * 'len_counts[]' used to build 'offsets[]' for sorting. + */ + + /* Ensure that 'codespace_used' cannot overflow. */ + STATIC_ASSERT(sizeof(codespace_used) == 4); + STATIC_ASSERT(UINT32_MAX / (1U << (DEFLATE_MAX_CODEWORD_LEN - 1)) >= + DEFLATE_MAX_NUM_SYMS); + + offsets[0] = 0; + offsets[1] = len_counts[0]; + codespace_used = 0; + for (len = 1; len < max_codeword_len; len++) { + offsets[len + 1] = offsets[len] + len_counts[len]; + codespace_used = (codespace_used << 1) + len_counts[len]; + } + codespace_used = (codespace_used << 1) + len_counts[len]; + + for (sym = 0; sym < num_syms; sym++) + sorted_syms[offsets[lens[sym]]++] = sym; + + sorted_syms += offsets[0]; /* Skip unused symbols */ + + /* lens[] is done being used, so we can write to decode_table[] now. */ + + /* + * Check whether the lengths form a complete code (exactly fills the + * codespace), an incomplete code (doesn't fill the codespace), or an + * overfull code (overflows the codespace). A codeword of length 'n' + * uses proportion '1/(2^n)' of the codespace. An overfull code is + * nonsensical, so is considered invalid. An incomplete code is + * considered valid only in two specific cases; see below. + */ + + /* overfull code? */ + if (unlikely(codespace_used > (1U << max_codeword_len))) + return false; + + /* incomplete code? */ + if (unlikely(codespace_used < (1U << max_codeword_len))) { + u32 entry; + unsigned i; + + if (codespace_used == 0) { + /* + * An empty code is allowed. This can happen for the + * offset code in DEFLATE, since a dynamic Huffman block + * need not contain any matches. + */ + + /* sym=0, len=1 (arbitrary) */ + entry = make_decode_table_entry(decode_results, 0, 1); + } else { + /* + * Allow codes with a single used symbol, with codeword + * length 1. The DEFLATE RFC is unclear regarding this + * case. What zlib's decompressor does is permit this + * for the litlen and offset codes and assume the + * codeword is '0' rather than '1'. We do the same + * except we allow this for precodes too, since there's + * no convincing reason to treat the codes differently. + * We also assign both codewords '0' and '1' to the + * symbol to avoid having to handle '1' specially. + */ + if (codespace_used != (1U << (max_codeword_len - 1)) || + len_counts[1] != 1) + return false; + entry = make_decode_table_entry(decode_results, + *sorted_syms, 1); + } + /* + * Note: the decode table still must be fully initialized, in + * case the stream is malformed and contains bits from the part + * of the codespace the incomplete code doesn't use. + */ + for (i = 0; i < (1U << table_bits); i++) + decode_table[i] = entry; + return true; + } + + /* + * The lengths form a complete code. Now, enumerate the codewords in + * lexicographic order and fill the decode table entries for each one. + * + * First, process all codewords with len <= table_bits. Each one gets + * '2^(table_bits-len)' direct entries in the table. + * + * Since DEFLATE uses bit-reversed codewords, these entries aren't + * consecutive but rather are spaced '2^len' entries apart. This makes + * filling them naively somewhat awkward and inefficient, since strided + * stores are less cache-friendly and preclude the use of word or + * vector-at-a-time stores to fill multiple entries per instruction. + * + * To optimize this, we incrementally double the table size. When + * processing codewords with length 'len', the table is treated as + * having only '2^len' entries, so each codeword uses just one entry. + * Then, each time 'len' is incremented, the table size is doubled and + * the first half is copied to the second half. This significantly + * improves performance over naively doing strided stores. + * + * Note that some entries copied for each table doubling may not have + * been initialized yet, but it doesn't matter since they're guaranteed + * to be initialized later (because the Huffman code is complete). + */ + codeword = 0; + len = 1; + while ((count = len_counts[len]) == 0) + len++; + cur_table_end = 1U << len; + while (len <= table_bits) { + /* Process all 'count' codewords with length 'len' bits. */ + do { + unsigned bit; + + /* Fill the first entry for the current codeword. */ + decode_table[codeword] = + make_decode_table_entry(decode_results, + *sorted_syms++, len); + + if (codeword == cur_table_end - 1) { + /* Last codeword (all 1's) */ + for (; len < table_bits; len++) { + memcpy(&decode_table[cur_table_end], + decode_table, + cur_table_end * + sizeof(decode_table[0])); + cur_table_end <<= 1; + } + return true; + } + /* + * To advance to the lexicographically next codeword in + * the canonical code, the codeword must be incremented, + * then 0's must be appended to the codeword as needed + * to match the next codeword's length. + * + * Since the codeword is bit-reversed, appending 0's is + * a no-op. However, incrementing it is nontrivial. To + * do so efficiently, use the 'bsr' instruction to find + * the last (highest order) 0 bit in the codeword, set + * it, and clear any later (higher order) 1 bits. But + * 'bsr' actually finds the highest order 1 bit, so to + * use it first flip all bits in the codeword by XOR'ing + * it with (1U << len) - 1 == cur_table_end - 1. + */ + bit = 1U << bsr32(codeword ^ (cur_table_end - 1)); + codeword &= bit - 1; + codeword |= bit; + } while (--count); + + /* Advance to the next codeword length. */ + do { + if (++len <= table_bits) { + memcpy(&decode_table[cur_table_end], + decode_table, + cur_table_end * sizeof(decode_table[0])); + cur_table_end <<= 1; + } + } while ((count = len_counts[len]) == 0); + } + + /* Process codewords with len > table_bits. These require subtables. */ + cur_table_end = 1U << table_bits; + subtable_prefix = -1; + subtable_start = 0; + for (;;) { + u32 entry; + unsigned i; + unsigned stride; + unsigned bit; + + /* + * Start a new subtable if the first 'table_bits' bits of the + * codeword don't match the prefix of the current subtable. + */ + if ((codeword & ((1U << table_bits) - 1)) != subtable_prefix) { + subtable_prefix = (codeword & ((1U << table_bits) - 1)); + subtable_start = cur_table_end; + /* + * Calculate the subtable length. If the codeword has + * length 'table_bits + n', then the subtable needs + * '2^n' entries. But it may need more; if fewer than + * '2^n' codewords of length 'table_bits + n' remain, + * then the length will need to be incremented to bring + * in longer codewords until the subtable can be + * completely filled. Note that because the Huffman + * code is complete, it will always be possible to fill + * the subtable eventually. + */ + subtable_bits = len - table_bits; + codespace_used = count; + while (codespace_used < (1U << subtable_bits)) { + subtable_bits++; + codespace_used = (codespace_used << 1) + + len_counts[table_bits + subtable_bits]; + } + cur_table_end = subtable_start + (1U << subtable_bits); + + /* + * Create the entry that points from the main table to + * the subtable. + */ + decode_table[subtable_prefix] = + ((u32)subtable_start << 16) | + HUFFDEC_EXCEPTIONAL | + HUFFDEC_SUBTABLE_POINTER | + (subtable_bits << 8) | table_bits; + } + + /* Fill the subtable entries for the current codeword. */ + entry = make_decode_table_entry(decode_results, *sorted_syms++, + len - table_bits); + i = subtable_start + (codeword >> table_bits); + stride = 1U << (len - table_bits); + do { + decode_table[i] = entry; + i += stride; + } while (i < cur_table_end); + + /* Advance to the next codeword. */ + if (codeword == (1U << len) - 1) /* last codeword (all 1's)? */ + return true; + bit = 1U << bsr32(codeword ^ ((1U << len) - 1)); + codeword &= bit - 1; + codeword |= bit; + count--; + while (count == 0) + count = len_counts[++len]; + } +} + +/* Build the decode table for the precode. */ +static bool +build_precode_decode_table(struct libdeflate_decompressor *d) +{ + /* When you change TABLEBITS, you must change ENOUGH, and vice versa! */ + STATIC_ASSERT(PRECODE_TABLEBITS == 7 && PRECODE_ENOUGH == 128); + + STATIC_ASSERT(ARRAY_LEN(precode_decode_results) == + DEFLATE_NUM_PRECODE_SYMS); + + return build_decode_table(d->u.l.precode_decode_table, + d->u.precode_lens, + DEFLATE_NUM_PRECODE_SYMS, + precode_decode_results, + PRECODE_TABLEBITS, + DEFLATE_MAX_PRE_CODEWORD_LEN, + d->sorted_syms, + NULL); +} + +/* Build the decode table for the literal/length code. */ +static bool +build_litlen_decode_table(struct libdeflate_decompressor *d, + unsigned num_litlen_syms, unsigned num_offset_syms) +{ + /* When you change TABLEBITS, you must change ENOUGH, and vice versa! */ + STATIC_ASSERT(LITLEN_TABLEBITS == 11 && LITLEN_ENOUGH == 2342); + + STATIC_ASSERT(ARRAY_LEN(litlen_decode_results) == + DEFLATE_NUM_LITLEN_SYMS); + + return build_decode_table(d->u.litlen_decode_table, + d->u.l.lens, + num_litlen_syms, + litlen_decode_results, + LITLEN_TABLEBITS, + DEFLATE_MAX_LITLEN_CODEWORD_LEN, + d->sorted_syms, + &d->litlen_tablebits); +} + +/* Build the decode table for the offset code. */ +static bool +build_offset_decode_table(struct libdeflate_decompressor *d, + unsigned num_litlen_syms, unsigned num_offset_syms) +{ + /* When you change TABLEBITS, you must change ENOUGH, and vice versa! */ + STATIC_ASSERT(OFFSET_TABLEBITS == 8 && OFFSET_ENOUGH == 402); + + STATIC_ASSERT(ARRAY_LEN(offset_decode_results) == + DEFLATE_NUM_OFFSET_SYMS); + + return build_decode_table(d->offset_decode_table, + d->u.l.lens + num_litlen_syms, + num_offset_syms, + offset_decode_results, + OFFSET_TABLEBITS, + DEFLATE_MAX_OFFSET_CODEWORD_LEN, + d->sorted_syms, + NULL); +} + +/***************************************************************************** + * Main decompression routine + *****************************************************************************/ + +typedef enum libdeflate_result (*decompress_func_t) + (struct libdeflate_decompressor * restrict d, + const void * restrict in, size_t in_nbytes, + void * restrict out, size_t out_nbytes_avail, + size_t *actual_in_nbytes_ret, size_t *actual_out_nbytes_ret); + +#define FUNCNAME deflate_decompress_default +#undef ATTRIBUTES +#undef EXTRACT_VARBITS +#undef EXTRACT_VARBITS8 +#include "decompress_template.h" + +/* Include architecture-specific implementation(s) if available. */ +#undef DEFAULT_IMPL +#undef arch_select_decompress_func +#if defined(ARCH_X86_32) || defined(ARCH_X86_64) +# include "x86/decompress_impl.h" +#endif + +#ifndef DEFAULT_IMPL +# define DEFAULT_IMPL deflate_decompress_default +#endif + +#ifdef arch_select_decompress_func +static enum libdeflate_result +dispatch_decomp(struct libdeflate_decompressor *d, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_in_nbytes_ret, size_t *actual_out_nbytes_ret); + +static volatile decompress_func_t decompress_impl = dispatch_decomp; + +/* Choose the best implementation at runtime. */ +static enum libdeflate_result +dispatch_decomp(struct libdeflate_decompressor *d, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_in_nbytes_ret, size_t *actual_out_nbytes_ret) +{ + decompress_func_t f = arch_select_decompress_func(); + + if (f == NULL) + f = DEFAULT_IMPL; + + decompress_impl = f; + return f(d, in, in_nbytes, out, out_nbytes_avail, + actual_in_nbytes_ret, actual_out_nbytes_ret); +} +#else +/* The best implementation is statically known, so call it directly. */ +# define decompress_impl DEFAULT_IMPL +#endif + +/* + * This is the main DEFLATE decompression routine. See libdeflate.h for the + * documentation. + * + * Note that the real code is in decompress_template.h. The part here just + * handles calling the appropriate implementation depending on the CPU features + * at runtime. + */ +LIBDEFLATEAPI enum libdeflate_result +libdeflate_deflate_decompress_ex(struct libdeflate_decompressor *d, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_in_nbytes_ret, + size_t *actual_out_nbytes_ret) +{ + return decompress_impl(d, in, in_nbytes, out, out_nbytes_avail, + actual_in_nbytes_ret, actual_out_nbytes_ret); +} + +LIBDEFLATEAPI enum libdeflate_result +libdeflate_deflate_decompress(struct libdeflate_decompressor *d, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_out_nbytes_ret) +{ + return libdeflate_deflate_decompress_ex(d, in, in_nbytes, + out, out_nbytes_avail, + NULL, actual_out_nbytes_ret); +} + +LIBDEFLATEAPI struct libdeflate_decompressor * +libdeflate_alloc_decompressor(void) +{ + /* + * Note that only certain parts of the decompressor actually must be + * initialized here: + * + * - 'static_codes_loaded' must be initialized to false. + * + * - The first half of the main portion of each decode table must be + * initialized to any value, to avoid reading from uninitialized + * memory during table expansion in build_decode_table(). (Although, + * this is really just to avoid warnings with dynamic tools like + * valgrind, since build_decode_table() is guaranteed to initialize + * all entries eventually anyway.) + * + * But for simplicity, we currently just zero the whole decompressor. + */ + struct libdeflate_decompressor *d = libdeflate_malloc(sizeof(*d)); + + if (d == NULL) + return NULL; + memset(d, 0, sizeof(*d)); + return d; +} + +LIBDEFLATEAPI void +libdeflate_free_decompressor(struct libdeflate_decompressor *d) +{ + libdeflate_free(d); +} diff --git a/tools/z64compress/src/enc/libdeflate/lib/gzip_compress.c b/tools/z64compress/src/enc/libdeflate/lib/gzip_compress.c new file mode 100644 index 000000000..e343e5068 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/gzip_compress.c @@ -0,0 +1,92 @@ +/* + * gzip_compress.c - compress with a gzip wrapper + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "deflate_compress.h" +#include "gzip_constants.h" + +#include "libdeflate.h" + +LIBDEFLATEAPI size_t +libdeflate_gzip_compress(struct libdeflate_compressor *c, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail) +{ + u8 *out_next = out; + unsigned compression_level; + u8 xfl; + size_t deflate_size; + + if (out_nbytes_avail <= GZIP_MIN_OVERHEAD) + return 0; + + /* ID1 */ + *out_next++ = GZIP_ID1; + /* ID2 */ + *out_next++ = GZIP_ID2; + /* CM */ + *out_next++ = GZIP_CM_DEFLATE; + /* FLG */ + *out_next++ = 0; + /* MTIME */ + put_unaligned_le32(GZIP_MTIME_UNAVAILABLE, out_next); + out_next += 4; + /* XFL */ + xfl = 0; + compression_level = libdeflate_get_compression_level(c); + if (compression_level < 2) + xfl |= GZIP_XFL_FASTEST_COMPRESSION; + else if (compression_level >= 8) + xfl |= GZIP_XFL_SLOWEST_COMPRESSION; + *out_next++ = xfl; + /* OS */ + *out_next++ = GZIP_OS_UNKNOWN; /* OS */ + + /* Compressed data */ + deflate_size = libdeflate_deflate_compress(c, in, in_nbytes, out_next, + out_nbytes_avail - GZIP_MIN_OVERHEAD); + if (deflate_size == 0) + return 0; + out_next += deflate_size; + + /* CRC32 */ + put_unaligned_le32(libdeflate_crc32(0, in, in_nbytes), out_next); + out_next += 4; + + /* ISIZE */ + put_unaligned_le32((u32)in_nbytes, out_next); + out_next += 4; + + return out_next - (u8 *)out; +} + +LIBDEFLATEAPI size_t +libdeflate_gzip_compress_bound(struct libdeflate_compressor *c, + size_t in_nbytes) +{ + return GZIP_MIN_OVERHEAD + + libdeflate_deflate_compress_bound(c, in_nbytes); +} diff --git a/tools/z64compress/src/enc/libdeflate/lib/gzip_constants.h b/tools/z64compress/src/enc/libdeflate/lib/gzip_constants.h new file mode 100644 index 000000000..35e4728d8 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/gzip_constants.h @@ -0,0 +1,45 @@ +/* + * gzip_constants.h - constants for the gzip wrapper format + */ + +#ifndef LIB_GZIP_CONSTANTS_H +#define LIB_GZIP_CONSTANTS_H + +#define GZIP_MIN_HEADER_SIZE 10 +#define GZIP_FOOTER_SIZE 8 +#define GZIP_MIN_OVERHEAD (GZIP_MIN_HEADER_SIZE + GZIP_FOOTER_SIZE) + +#define GZIP_ID1 0x1F +#define GZIP_ID2 0x8B + +#define GZIP_CM_DEFLATE 8 + +#define GZIP_FTEXT 0x01 +#define GZIP_FHCRC 0x02 +#define GZIP_FEXTRA 0x04 +#define GZIP_FNAME 0x08 +#define GZIP_FCOMMENT 0x10 +#define GZIP_FRESERVED 0xE0 + +#define GZIP_MTIME_UNAVAILABLE 0 + +#define GZIP_XFL_SLOWEST_COMPRESSION 0x02 +#define GZIP_XFL_FASTEST_COMPRESSION 0x04 + +#define GZIP_OS_FAT 0 +#define GZIP_OS_AMIGA 1 +#define GZIP_OS_VMS 2 +#define GZIP_OS_UNIX 3 +#define GZIP_OS_VM_CMS 4 +#define GZIP_OS_ATARI_TOS 5 +#define GZIP_OS_HPFS 6 +#define GZIP_OS_MACINTOSH 7 +#define GZIP_OS_Z_SYSTEM 8 +#define GZIP_OS_CP_M 9 +#define GZIP_OS_TOPS_20 10 +#define GZIP_OS_NTFS 11 +#define GZIP_OS_QDOS 12 +#define GZIP_OS_RISCOS 13 +#define GZIP_OS_UNKNOWN 255 + +#endif /* LIB_GZIP_CONSTANTS_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/gzip_decompress.c b/tools/z64compress/src/enc/libdeflate/lib/gzip_decompress.c new file mode 100644 index 000000000..9518e7047 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/gzip_decompress.c @@ -0,0 +1,146 @@ +/* + * gzip_decompress.c - decompress with a gzip wrapper + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "lib_common.h" +#include "gzip_constants.h" + +#include "libdeflate.h" + +LIBDEFLATEAPI enum libdeflate_result +libdeflate_gzip_decompress_ex(struct libdeflate_decompressor *d, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_in_nbytes_ret, + size_t *actual_out_nbytes_ret) +{ + const u8 *in_next = in; + const u8 * const in_end = in_next + in_nbytes; + u8 flg; + size_t actual_in_nbytes; + size_t actual_out_nbytes; + enum libdeflate_result result; + + if (in_nbytes < GZIP_MIN_OVERHEAD) + return LIBDEFLATE_BAD_DATA; + + /* ID1 */ + if (*in_next++ != GZIP_ID1) + return LIBDEFLATE_BAD_DATA; + /* ID2 */ + if (*in_next++ != GZIP_ID2) + return LIBDEFLATE_BAD_DATA; + /* CM */ + if (*in_next++ != GZIP_CM_DEFLATE) + return LIBDEFLATE_BAD_DATA; + flg = *in_next++; + /* MTIME */ + in_next += 4; + /* XFL */ + in_next += 1; + /* OS */ + in_next += 1; + + if (flg & GZIP_FRESERVED) + return LIBDEFLATE_BAD_DATA; + + /* Extra field */ + if (flg & GZIP_FEXTRA) { + u16 xlen = get_unaligned_le16(in_next); + in_next += 2; + + if (in_end - in_next < (u32)xlen + GZIP_FOOTER_SIZE) + return LIBDEFLATE_BAD_DATA; + + in_next += xlen; + } + + /* Original file name (zero terminated) */ + if (flg & GZIP_FNAME) { + while (*in_next++ != 0 && in_next != in_end) + ; + if (in_end - in_next < GZIP_FOOTER_SIZE) + return LIBDEFLATE_BAD_DATA; + } + + /* File comment (zero terminated) */ + if (flg & GZIP_FCOMMENT) { + while (*in_next++ != 0 && in_next != in_end) + ; + if (in_end - in_next < GZIP_FOOTER_SIZE) + return LIBDEFLATE_BAD_DATA; + } + + /* CRC16 for gzip header */ + if (flg & GZIP_FHCRC) { + in_next += 2; + if (in_end - in_next < GZIP_FOOTER_SIZE) + return LIBDEFLATE_BAD_DATA; + } + + /* Compressed data */ + result = libdeflate_deflate_decompress_ex(d, in_next, + in_end - GZIP_FOOTER_SIZE - in_next, + out, out_nbytes_avail, + &actual_in_nbytes, + actual_out_nbytes_ret); + if (result != LIBDEFLATE_SUCCESS) + return result; + + if (actual_out_nbytes_ret) + actual_out_nbytes = *actual_out_nbytes_ret; + else + actual_out_nbytes = out_nbytes_avail; + + in_next += actual_in_nbytes; + + /* CRC32 */ + if (libdeflate_crc32(0, out, actual_out_nbytes) != + get_unaligned_le32(in_next)) + return LIBDEFLATE_BAD_DATA; + in_next += 4; + + /* ISIZE */ + if ((u32)actual_out_nbytes != get_unaligned_le32(in_next)) + return LIBDEFLATE_BAD_DATA; + in_next += 4; + + if (actual_in_nbytes_ret) + *actual_in_nbytes_ret = in_next - (u8 *)in; + + return LIBDEFLATE_SUCCESS; +} + +LIBDEFLATEAPI enum libdeflate_result +libdeflate_gzip_decompress(struct libdeflate_decompressor *d, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_out_nbytes_ret) +{ + return libdeflate_gzip_decompress_ex(d, in, in_nbytes, + out, out_nbytes_avail, + NULL, actual_out_nbytes_ret); +} diff --git a/tools/z64compress/src/enc/libdeflate/lib/hc_matchfinder.h b/tools/z64compress/src/enc/libdeflate/lib/hc_matchfinder.h new file mode 100644 index 000000000..a0cddfca1 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/hc_matchfinder.h @@ -0,0 +1,401 @@ +/* + * hc_matchfinder.h - Lempel-Ziv matchfinding with a hash table of linked lists + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * --------------------------------------------------------------------------- + * + * Algorithm + * + * This is a Hash Chains (hc) based matchfinder. + * + * The main data structure is a hash table where each hash bucket contains a + * linked list (or "chain") of sequences whose first 4 bytes share the same hash + * code. Each sequence is identified by its starting position in the input + * buffer. + * + * The algorithm processes the input buffer sequentially. At each byte + * position, the hash code of the first 4 bytes of the sequence beginning at + * that position (the sequence being matched against) is computed. This + * identifies the hash bucket to use for that position. Then, this hash + * bucket's linked list is searched for matches. Then, a new linked list node + * is created to represent the current sequence and is prepended to the list. + * + * This algorithm has several useful properties: + * + * - It only finds true Lempel-Ziv matches; i.e., those where the matching + * sequence occurs prior to the sequence being matched against. + * + * - The sequences in each linked list are always sorted by decreasing starting + * position. Therefore, the closest (smallest offset) matches are found + * first, which in many compression formats tend to be the cheapest to encode. + * + * - Although fast running time is not guaranteed due to the possibility of the + * lists getting very long, the worst degenerate behavior can be easily + * prevented by capping the number of nodes searched at each position. + * + * - If the compressor decides not to search for matches at a certain position, + * then that position can be quickly inserted without searching the list. + * + * - The algorithm is adaptable to sliding windows: just store the positions + * relative to a "base" value that is updated from time to time, and stop + * searching each list when the sequences get too far away. + * + * ---------------------------------------------------------------------------- + * + * Optimizations + * + * The main hash table and chains handle length 4+ matches. Length 3 matches + * are handled by a separate hash table with no chains. This works well for + * typical "greedy" or "lazy"-style compressors, where length 3 matches are + * often only helpful if they have small offsets. Instead of searching a full + * chain for length 3+ matches, the algorithm just checks for one close length 3 + * match, then focuses on finding length 4+ matches. + * + * The longest_match() and skip_bytes() functions are inlined into the + * compressors that use them. This isn't just about saving the overhead of a + * function call. These functions are intended to be called from the inner + * loops of compressors, where giving the compiler more control over register + * allocation is very helpful. There is also significant benefit to be gained + * from allowing the CPU to predict branches independently at each call site. + * For example, "lazy"-style compressors can be written with two calls to + * longest_match(), each of which starts with a different 'best_len' and + * therefore has significantly different performance characteristics. + * + * Although any hash function can be used, a multiplicative hash is fast and + * works well. + * + * On some processors, it is significantly faster to extend matches by whole + * words (32 or 64 bits) instead of by individual bytes. For this to be the + * case, the processor must implement unaligned memory accesses efficiently and + * must have either a fast "find first set bit" instruction or a fast "find last + * set bit" instruction, depending on the processor's endianness. + * + * The code uses one loop for finding the first match and one loop for finding a + * longer match. Each of these loops is tuned for its respective task and in + * combination are faster than a single generalized loop that handles both + * tasks. + * + * The code also uses a tight inner loop that only compares the last and first + * bytes of a potential match. It is only when these bytes match that a full + * match extension is attempted. + * + * ---------------------------------------------------------------------------- + */ + +#ifndef LIB_HC_MATCHFINDER_H +#define LIB_HC_MATCHFINDER_H + +#include "matchfinder_common.h" + +#define HC_MATCHFINDER_HASH3_ORDER 15 +#define HC_MATCHFINDER_HASH4_ORDER 16 + +#define HC_MATCHFINDER_TOTAL_HASH_SIZE \ + (((1UL << HC_MATCHFINDER_HASH3_ORDER) + \ + (1UL << HC_MATCHFINDER_HASH4_ORDER)) * sizeof(mf_pos_t)) + +struct MATCHFINDER_ALIGNED hc_matchfinder { + + /* The hash table for finding length 3 matches */ + mf_pos_t hash3_tab[1UL << HC_MATCHFINDER_HASH3_ORDER]; + + /* The hash table which contains the first nodes of the linked lists for + * finding length 4+ matches */ + mf_pos_t hash4_tab[1UL << HC_MATCHFINDER_HASH4_ORDER]; + + /* The "next node" references for the linked lists. The "next node" of + * the node for the sequence with position 'pos' is 'next_tab[pos]'. */ + mf_pos_t next_tab[MATCHFINDER_WINDOW_SIZE]; +}; + +/* Prepare the matchfinder for a new input buffer. */ +static forceinline void +hc_matchfinder_init(struct hc_matchfinder *mf) +{ + STATIC_ASSERT(HC_MATCHFINDER_TOTAL_HASH_SIZE % + MATCHFINDER_SIZE_ALIGNMENT == 0); + + matchfinder_init((mf_pos_t *)mf, HC_MATCHFINDER_TOTAL_HASH_SIZE); +} + +static forceinline void +hc_matchfinder_slide_window(struct hc_matchfinder *mf) +{ + STATIC_ASSERT(sizeof(*mf) % MATCHFINDER_SIZE_ALIGNMENT == 0); + + matchfinder_rebase((mf_pos_t *)mf, sizeof(*mf)); +} + +/* + * Find the longest match longer than 'best_len' bytes. + * + * @mf + * The matchfinder structure. + * @in_base_p + * Location of a pointer which points to the place in the input data the + * matchfinder currently stores positions relative to. This may be updated + * by this function. + * @in_next + * Pointer to the next position in the input buffer, i.e. the sequence + * being matched against. + * @best_len + * Require a match longer than this length. + * @max_len + * The maximum permissible match length at this position. + * @nice_len + * Stop searching if a match of at least this length is found. + * Must be <= @max_len. + * @max_search_depth + * Limit on the number of potential matches to consider. Must be >= 1. + * @next_hashes + * The precomputed hash codes for the sequence beginning at @in_next. + * These will be used and then updated with the precomputed hashcodes for + * the sequence beginning at @in_next + 1. + * @offset_ret + * If a match is found, its offset is returned in this location. + * + * Return the length of the match found, or 'best_len' if no match longer than + * 'best_len' was found. + */ +static forceinline u32 +hc_matchfinder_longest_match(struct hc_matchfinder * const mf, + const u8 ** const in_base_p, + const u8 * const in_next, + u32 best_len, + const u32 max_len, + const u32 nice_len, + const u32 max_search_depth, + u32 * const next_hashes, + u32 * const offset_ret) +{ + u32 depth_remaining = max_search_depth; + const u8 *best_matchptr = in_next; + mf_pos_t cur_node3, cur_node4; + u32 hash3, hash4; + u32 next_hashseq; + u32 seq4; + const u8 *matchptr; + u32 len; + u32 cur_pos = in_next - *in_base_p; + const u8 *in_base; + mf_pos_t cutoff; + + if (cur_pos == MATCHFINDER_WINDOW_SIZE) { + hc_matchfinder_slide_window(mf); + *in_base_p += MATCHFINDER_WINDOW_SIZE; + cur_pos = 0; + } + + in_base = *in_base_p; + cutoff = cur_pos - MATCHFINDER_WINDOW_SIZE; + + if (unlikely(max_len < 5)) /* can we read 4 bytes from 'in_next + 1'? */ + goto out; + + /* Get the precomputed hash codes. */ + hash3 = next_hashes[0]; + hash4 = next_hashes[1]; + + /* From the hash buckets, get the first node of each linked list. */ + cur_node3 = mf->hash3_tab[hash3]; + cur_node4 = mf->hash4_tab[hash4]; + + /* Update for length 3 matches. This replaces the singleton node in the + * 'hash3' bucket with the node for the current sequence. */ + mf->hash3_tab[hash3] = cur_pos; + + /* Update for length 4 matches. This prepends the node for the current + * sequence to the linked list in the 'hash4' bucket. */ + mf->hash4_tab[hash4] = cur_pos; + mf->next_tab[cur_pos] = cur_node4; + + /* Compute the next hash codes. */ + next_hashseq = get_unaligned_le32(in_next + 1); + next_hashes[0] = lz_hash(next_hashseq & 0xFFFFFF, HC_MATCHFINDER_HASH3_ORDER); + next_hashes[1] = lz_hash(next_hashseq, HC_MATCHFINDER_HASH4_ORDER); + prefetchw(&mf->hash3_tab[next_hashes[0]]); + prefetchw(&mf->hash4_tab[next_hashes[1]]); + + if (best_len < 4) { /* No match of length >= 4 found yet? */ + + /* Check for a length 3 match if needed. */ + + if (cur_node3 <= cutoff) + goto out; + + seq4 = load_u32_unaligned(in_next); + + if (best_len < 3) { + matchptr = &in_base[cur_node3]; + if (load_u24_unaligned(matchptr) == loaded_u32_to_u24(seq4)) { + best_len = 3; + best_matchptr = matchptr; + } + } + + /* Check for a length 4 match. */ + + if (cur_node4 <= cutoff) + goto out; + + for (;;) { + /* No length 4 match found yet. Check the first 4 bytes. */ + matchptr = &in_base[cur_node4]; + + if (load_u32_unaligned(matchptr) == seq4) + break; + + /* The first 4 bytes did not match. Keep trying. */ + cur_node4 = mf->next_tab[cur_node4 & (MATCHFINDER_WINDOW_SIZE - 1)]; + if (cur_node4 <= cutoff || !--depth_remaining) + goto out; + } + + /* Found a match of length >= 4. Extend it to its full length. */ + best_matchptr = matchptr; + best_len = lz_extend(in_next, best_matchptr, 4, max_len); + if (best_len >= nice_len) + goto out; + cur_node4 = mf->next_tab[cur_node4 & (MATCHFINDER_WINDOW_SIZE - 1)]; + if (cur_node4 <= cutoff || !--depth_remaining) + goto out; + } else { + if (cur_node4 <= cutoff || best_len >= nice_len) + goto out; + } + + /* Check for matches of length >= 5. */ + + for (;;) { + for (;;) { + matchptr = &in_base[cur_node4]; + + /* Already found a length 4 match. Try for a longer + * match; start by checking either the last 4 bytes and + * the first 4 bytes, or the last byte. (The last byte, + * the one which would extend the match length by 1, is + * the most important.) */ + #if UNALIGNED_ACCESS_IS_FAST + if ((load_u32_unaligned(matchptr + best_len - 3) == + load_u32_unaligned(in_next + best_len - 3)) && + (load_u32_unaligned(matchptr) == + load_u32_unaligned(in_next))) + #else + if (matchptr[best_len] == in_next[best_len]) + #endif + break; + + /* Continue to the next node in the list. */ + cur_node4 = mf->next_tab[cur_node4 & (MATCHFINDER_WINDOW_SIZE - 1)]; + if (cur_node4 <= cutoff || !--depth_remaining) + goto out; + } + + #if UNALIGNED_ACCESS_IS_FAST + len = 4; + #else + len = 0; + #endif + len = lz_extend(in_next, matchptr, len, max_len); + if (len > best_len) { + /* This is the new longest match. */ + best_len = len; + best_matchptr = matchptr; + if (best_len >= nice_len) + goto out; + } + + /* Continue to the next node in the list. */ + cur_node4 = mf->next_tab[cur_node4 & (MATCHFINDER_WINDOW_SIZE - 1)]; + if (cur_node4 <= cutoff || !--depth_remaining) + goto out; + } +out: + *offset_ret = in_next - best_matchptr; + return best_len; +} + +/* + * Advance the matchfinder, but don't search for matches. + * + * @mf + * The matchfinder structure. + * @in_base_p + * Location of a pointer which points to the place in the input data the + * matchfinder currently stores positions relative to. This may be updated + * by this function. + * @in_next + * Pointer to the next position in the input buffer. + * @in_end + * Pointer to the end of the input buffer. + * @count + * The number of bytes to advance. Must be > 0. + * @next_hashes + * The precomputed hash codes for the sequence beginning at @in_next. + * These will be used and then updated with the precomputed hashcodes for + * the sequence beginning at @in_next + @count. + */ +static forceinline void +hc_matchfinder_skip_bytes(struct hc_matchfinder * const mf, + const u8 ** const in_base_p, + const u8 *in_next, + const u8 * const in_end, + const u32 count, + u32 * const next_hashes) +{ + u32 cur_pos; + u32 hash3, hash4; + u32 next_hashseq; + u32 remaining = count; + + if (unlikely(count + 5 > in_end - in_next)) + return; + + cur_pos = in_next - *in_base_p; + hash3 = next_hashes[0]; + hash4 = next_hashes[1]; + do { + if (cur_pos == MATCHFINDER_WINDOW_SIZE) { + hc_matchfinder_slide_window(mf); + *in_base_p += MATCHFINDER_WINDOW_SIZE; + cur_pos = 0; + } + mf->hash3_tab[hash3] = cur_pos; + mf->next_tab[cur_pos] = mf->hash4_tab[hash4]; + mf->hash4_tab[hash4] = cur_pos; + + next_hashseq = get_unaligned_le32(++in_next); + hash3 = lz_hash(next_hashseq & 0xFFFFFF, HC_MATCHFINDER_HASH3_ORDER); + hash4 = lz_hash(next_hashseq, HC_MATCHFINDER_HASH4_ORDER); + cur_pos++; + } while (--remaining); + + prefetchw(&mf->hash3_tab[hash3]); + prefetchw(&mf->hash4_tab[hash4]); + next_hashes[0] = hash3; + next_hashes[1] = hash4; +} + +#endif /* LIB_HC_MATCHFINDER_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/ht_matchfinder.h b/tools/z64compress/src/enc/libdeflate/lib/ht_matchfinder.h new file mode 100644 index 000000000..6e5a187c1 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/ht_matchfinder.h @@ -0,0 +1,234 @@ +/* + * ht_matchfinder.h - Lempel-Ziv matchfinding with a hash table + * + * Copyright 2022 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * --------------------------------------------------------------------------- + * + * This is a Hash Table (ht) matchfinder. + * + * This is a variant of the Hash Chains (hc) matchfinder that is optimized for + * very fast compression. The ht_matchfinder stores the hash chains inline in + * the hash table, whereas the hc_matchfinder stores them in a separate array. + * Storing the hash chains inline is the faster method when max_search_depth + * (the maximum chain length) is very small. It is not appropriate when + * max_search_depth is larger, as then it uses too much memory. + * + * Due to its focus on speed, the ht_matchfinder doesn't support length 3 + * matches. It also doesn't allow max_search_depth to vary at runtime; it is + * fixed at build time as HT_MATCHFINDER_BUCKET_SIZE. + * + * See hc_matchfinder.h for more information. + */ + +#ifndef LIB_HT_MATCHFINDER_H +#define LIB_HT_MATCHFINDER_H + +#include "matchfinder_common.h" + +#define HT_MATCHFINDER_HASH_ORDER 15 +#define HT_MATCHFINDER_BUCKET_SIZE 2 + +#define HT_MATCHFINDER_MIN_MATCH_LEN 4 +/* Minimum value of max_len for ht_matchfinder_longest_match() */ +#define HT_MATCHFINDER_REQUIRED_NBYTES 5 + +struct MATCHFINDER_ALIGNED ht_matchfinder { + mf_pos_t hash_tab[1UL << HT_MATCHFINDER_HASH_ORDER] + [HT_MATCHFINDER_BUCKET_SIZE]; +}; + +static forceinline void +ht_matchfinder_init(struct ht_matchfinder *mf) +{ + STATIC_ASSERT(sizeof(*mf) % MATCHFINDER_SIZE_ALIGNMENT == 0); + + matchfinder_init((mf_pos_t *)mf, sizeof(*mf)); +} + +static forceinline void +ht_matchfinder_slide_window(struct ht_matchfinder *mf) +{ + matchfinder_rebase((mf_pos_t *)mf, sizeof(*mf)); +} + +/* Note: max_len must be >= HT_MATCHFINDER_REQUIRED_NBYTES */ +static forceinline u32 +ht_matchfinder_longest_match(struct ht_matchfinder * const mf, + const u8 ** const in_base_p, + const u8 * const in_next, + const u32 max_len, + const u32 nice_len, + u32 * const next_hash, + u32 * const offset_ret) +{ + u32 best_len = 0; + const u8 *best_matchptr = in_next; + u32 cur_pos = in_next - *in_base_p; + const u8 *in_base; + mf_pos_t cutoff; + u32 hash; + u32 seq; + mf_pos_t cur_node; + const u8 *matchptr; +#if HT_MATCHFINDER_BUCKET_SIZE > 1 + mf_pos_t to_insert; + u32 len; +#endif +#if HT_MATCHFINDER_BUCKET_SIZE > 2 + int i; +#endif + + /* This is assumed throughout this function. */ + STATIC_ASSERT(HT_MATCHFINDER_MIN_MATCH_LEN == 4); + + if (cur_pos == MATCHFINDER_WINDOW_SIZE) { + ht_matchfinder_slide_window(mf); + *in_base_p += MATCHFINDER_WINDOW_SIZE; + cur_pos = 0; + } + in_base = *in_base_p; + cutoff = cur_pos - MATCHFINDER_WINDOW_SIZE; + + hash = *next_hash; + STATIC_ASSERT(HT_MATCHFINDER_REQUIRED_NBYTES == 5); + *next_hash = lz_hash(get_unaligned_le32(in_next + 1), + HT_MATCHFINDER_HASH_ORDER); + seq = load_u32_unaligned(in_next); + prefetchw(&mf->hash_tab[*next_hash]); +#if HT_MATCHFINDER_BUCKET_SIZE == 1 + /* Hand-unrolled version for BUCKET_SIZE == 1 */ + cur_node = mf->hash_tab[hash][0]; + mf->hash_tab[hash][0] = cur_pos; + if (cur_node <= cutoff) + goto out; + matchptr = &in_base[cur_node]; + if (load_u32_unaligned(matchptr) == seq) { + best_len = lz_extend(in_next, matchptr, 4, max_len); + best_matchptr = matchptr; + } +#elif HT_MATCHFINDER_BUCKET_SIZE == 2 + /* + * Hand-unrolled version for BUCKET_SIZE == 2. The logic here also + * differs slightly in that it copies the first entry to the second even + * if nice_len is reached on the first, as this can be slightly faster. + */ + cur_node = mf->hash_tab[hash][0]; + mf->hash_tab[hash][0] = cur_pos; + if (cur_node <= cutoff) + goto out; + matchptr = &in_base[cur_node]; + + to_insert = cur_node; + cur_node = mf->hash_tab[hash][1]; + mf->hash_tab[hash][1] = to_insert; + + if (load_u32_unaligned(matchptr) == seq) { + best_len = lz_extend(in_next, matchptr, 4, max_len); + best_matchptr = matchptr; + if (cur_node <= cutoff || best_len >= nice_len) + goto out; + matchptr = &in_base[cur_node]; + if (load_u32_unaligned(matchptr) == seq && + load_u32_unaligned(matchptr + best_len - 3) == + load_u32_unaligned(in_next + best_len - 3)) { + len = lz_extend(in_next, matchptr, 4, max_len); + if (len > best_len) { + best_len = len; + best_matchptr = matchptr; + } + } + } else { + if (cur_node <= cutoff) + goto out; + matchptr = &in_base[cur_node]; + if (load_u32_unaligned(matchptr) == seq) { + best_len = lz_extend(in_next, matchptr, 4, max_len); + best_matchptr = matchptr; + } + } +#else + /* Generic version for HT_MATCHFINDER_BUCKET_SIZE > 2 */ + to_insert = cur_pos; + for (i = 0; i < HT_MATCHFINDER_BUCKET_SIZE; i++) { + cur_node = mf->hash_tab[hash][i]; + mf->hash_tab[hash][i] = to_insert; + if (cur_node <= cutoff) + goto out; + matchptr = &in_base[cur_node]; + if (load_u32_unaligned(matchptr) == seq) { + len = lz_extend(in_next, matchptr, 4, max_len); + if (len > best_len) { + best_len = len; + best_matchptr = matchptr; + if (best_len >= nice_len) + goto out; + } + } + to_insert = cur_node; + } +#endif +out: + *offset_ret = in_next - best_matchptr; + return best_len; +} + +static forceinline void +ht_matchfinder_skip_bytes(struct ht_matchfinder * const mf, + const u8 ** const in_base_p, + const u8 *in_next, + const u8 * const in_end, + const u32 count, + u32 * const next_hash) +{ + s32 cur_pos = in_next - *in_base_p; + u32 hash; + u32 remaining = count; + int i; + + if (unlikely(count + HT_MATCHFINDER_REQUIRED_NBYTES > in_end - in_next)) + return; + + if (cur_pos + count - 1 >= MATCHFINDER_WINDOW_SIZE) { + ht_matchfinder_slide_window(mf); + *in_base_p += MATCHFINDER_WINDOW_SIZE; + cur_pos -= MATCHFINDER_WINDOW_SIZE; + } + + hash = *next_hash; + do { + for (i = HT_MATCHFINDER_BUCKET_SIZE - 1; i > 0; i--) + mf->hash_tab[hash][i] = mf->hash_tab[hash][i - 1]; + mf->hash_tab[hash][0] = cur_pos; + + hash = lz_hash(get_unaligned_le32(++in_next), + HT_MATCHFINDER_HASH_ORDER); + cur_pos++; + } while (--remaining); + + prefetchw(&mf->hash_tab[hash]); + *next_hash = hash; +} + +#endif /* LIB_HT_MATCHFINDER_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/lib_common.h b/tools/z64compress/src/enc/libdeflate/lib/lib_common.h new file mode 100644 index 000000000..6aad0feec --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/lib_common.h @@ -0,0 +1,94 @@ +/* + * lib_common.h - internal header included by all library code + */ + +#ifndef LIB_LIB_COMMON_H +#define LIB_LIB_COMMON_H + +#include "../common_defs.h" + +#ifdef LIBDEFLATE_H + /* + * When building the library, LIBDEFLATEAPI needs to be defined properly before + * including libdeflate.h. + */ +# error "lib_common.h must always be included before libdeflate.h" +#endif + +#if defined(LIBDEFLATE_DLL) && (defined(_WIN32) || defined(__CYGWIN__)) +# define LIBDEFLATE_EXPORT_SYM __declspec(dllexport) +#elif defined(__GNUC__) +# define LIBDEFLATE_EXPORT_SYM __attribute__((visibility("default"))) +#else +# define LIBDEFLATE_EXPORT_SYM +#endif + +/* + * On i386, gcc assumes that the stack is 16-byte aligned at function entry. + * However, some compilers (e.g. MSVC) and programming languages (e.g. Delphi) + * only guarantee 4-byte alignment when calling functions. This is mainly an + * issue on Windows, but it has been seen on Linux too. Work around this ABI + * incompatibility by realigning the stack pointer when entering libdeflate. + * This prevents crashes in SSE/AVX code. + */ +#if defined(__GNUC__) && defined(__i386__) +# define LIBDEFLATE_ALIGN_STACK __attribute__((force_align_arg_pointer)) +#else +# define LIBDEFLATE_ALIGN_STACK +#endif + +#define LIBDEFLATEAPI LIBDEFLATE_EXPORT_SYM LIBDEFLATE_ALIGN_STACK + +void *libdeflate_malloc(size_t size); +void libdeflate_free(void *ptr); + +void *libdeflate_aligned_malloc(size_t alignment, size_t size); +void libdeflate_aligned_free(void *ptr); + +#ifdef FREESTANDING +/* + * With -ffreestanding, may be missing, and we must provide + * implementations of memset(), memcpy(), memmove(), and memcmp(). + * See https://gcc.gnu.org/onlinedocs/gcc/Standards.html + * + * Also, -ffreestanding disables interpreting calls to these functions as + * built-ins. E.g., calling memcpy(&v, p, WORDBYTES) will make a function call, + * not be optimized to a single load instruction. For performance reasons we + * don't want that. So, declare these functions as macros that expand to the + * corresponding built-ins. This approach is recommended in the gcc man page. + * We still need the actual function definitions in case gcc calls them. + */ +void *memset(void *s, int c, size_t n); +#define memset(s, c, n) __builtin_memset((s), (c), (n)) + +void *memcpy(void *dest, const void *src, size_t n); +#define memcpy(dest, src, n) __builtin_memcpy((dest), (src), (n)) + +void *memmove(void *dest, const void *src, size_t n); +#define memmove(dest, src, n) __builtin_memmove((dest), (src), (n)) + +int memcmp(const void *s1, const void *s2, size_t n); +#define memcmp(s1, s2, n) __builtin_memcmp((s1), (s2), (n)) + +#undef LIBDEFLATE_ENABLE_ASSERTIONS +#else +#include +#endif + +/* + * Runtime assertion support. Don't enable this in production builds; it may + * hurt performance significantly. + */ +#ifdef LIBDEFLATE_ENABLE_ASSERTIONS +void libdeflate_assertion_failed(const char *expr, const char *file, int line); +#define ASSERT(expr) { if (unlikely(!(expr))) \ + libdeflate_assertion_failed(#expr, __FILE__, __LINE__); } +#else +#define ASSERT(expr) (void)(expr) +#endif + +#define CONCAT_IMPL(a, b) a##b +#define CONCAT(a, b) CONCAT_IMPL(a, b) +#define ADD_SUFFIX(name) CONCAT(name, SUFFIX) + +#endif /* LIB_LIB_COMMON_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/matchfinder_common.h b/tools/z64compress/src/enc/libdeflate/lib/matchfinder_common.h new file mode 100644 index 000000000..48a243e1d --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/matchfinder_common.h @@ -0,0 +1,199 @@ +/* + * matchfinder_common.h - common code for Lempel-Ziv matchfinding + */ + +#ifndef LIB_MATCHFINDER_COMMON_H +#define LIB_MATCHFINDER_COMMON_H + +#include "lib_common.h" + +#ifndef MATCHFINDER_WINDOW_ORDER +# error "MATCHFINDER_WINDOW_ORDER must be defined!" +#endif + +/* + * Given a 32-bit value that was loaded with the platform's native endianness, + * return a 32-bit value whose high-order 8 bits are 0 and whose low-order 24 + * bits contain the first 3 bytes, arranged in octets in a platform-dependent + * order, at the memory location from which the input 32-bit value was loaded. + */ +static forceinline u32 +loaded_u32_to_u24(u32 v) +{ + if (CPU_IS_LITTLE_ENDIAN()) + return v & 0xFFFFFF; + else + return v >> 8; +} + +/* + * Load the next 3 bytes from @p into the 24 low-order bits of a 32-bit value. + * The order in which the 3 bytes will be arranged as octets in the 24 bits is + * platform-dependent. At least 4 bytes (not 3) must be available at @p. + */ +static forceinline u32 +load_u24_unaligned(const u8 *p) +{ +#if UNALIGNED_ACCESS_IS_FAST + return loaded_u32_to_u24(load_u32_unaligned(p)); +#else + if (CPU_IS_LITTLE_ENDIAN()) + return ((u32)p[0] << 0) | ((u32)p[1] << 8) | ((u32)p[2] << 16); + else + return ((u32)p[2] << 0) | ((u32)p[1] << 8) | ((u32)p[0] << 16); +#endif +} + +#define MATCHFINDER_WINDOW_SIZE (1UL << MATCHFINDER_WINDOW_ORDER) + +typedef s16 mf_pos_t; + +#define MATCHFINDER_INITVAL ((mf_pos_t)-MATCHFINDER_WINDOW_SIZE) + +/* + * Required alignment of the matchfinder buffer pointer and size. The values + * here come from the AVX-2 implementation, which is the worst case. + */ +#define MATCHFINDER_MEM_ALIGNMENT 32 +#define MATCHFINDER_SIZE_ALIGNMENT 128 + +#undef matchfinder_init +#undef matchfinder_rebase +#ifdef _aligned_attribute +# define MATCHFINDER_ALIGNED _aligned_attribute(MATCHFINDER_MEM_ALIGNMENT) +# if defined(ARCH_ARM32) || defined(ARCH_ARM64) +# include "arm/matchfinder_impl.h" +# elif defined(ARCH_X86_32) || defined(ARCH_X86_64) +# include "x86/matchfinder_impl.h" +# endif +#else +# define MATCHFINDER_ALIGNED +#endif + +/* + * Initialize the hash table portion of the matchfinder. + * + * Essentially, this is an optimized memset(). + * + * 'data' must be aligned to a MATCHFINDER_MEM_ALIGNMENT boundary, and + * 'size' must be a multiple of MATCHFINDER_SIZE_ALIGNMENT. + */ +#ifndef matchfinder_init +static forceinline void +matchfinder_init(mf_pos_t *data, size_t size) +{ + size_t num_entries = size / sizeof(*data); + size_t i; + + for (i = 0; i < num_entries; i++) + data[i] = MATCHFINDER_INITVAL; +} +#endif + +/* + * Slide the matchfinder by MATCHFINDER_WINDOW_SIZE bytes. + * + * This must be called just after each MATCHFINDER_WINDOW_SIZE bytes have been + * run through the matchfinder. + * + * This subtracts MATCHFINDER_WINDOW_SIZE bytes from each entry in the given + * array, making the entries be relative to the current position rather than the + * position MATCHFINDER_WINDOW_SIZE bytes prior. To avoid integer underflows, + * entries that would become less than -MATCHFINDER_WINDOW_SIZE stay at + * -MATCHFINDER_WINDOW_SIZE, keeping them permanently out of bounds. + * + * The given array must contain all matchfinder data that is position-relative: + * the hash table(s) as well as any hash chain or binary tree links. Its + * address must be aligned to a MATCHFINDER_MEM_ALIGNMENT boundary, and its size + * must be a multiple of MATCHFINDER_SIZE_ALIGNMENT. + */ +#ifndef matchfinder_rebase +static forceinline void +matchfinder_rebase(mf_pos_t *data, size_t size) +{ + size_t num_entries = size / sizeof(*data); + size_t i; + + if (MATCHFINDER_WINDOW_SIZE == 32768) { + /* + * Branchless version for 32768-byte windows. Clear all bits if + * the value was already negative, then set the sign bit. This + * is equivalent to subtracting 32768 with signed saturation. + */ + for (i = 0; i < num_entries; i++) + data[i] = 0x8000 | (data[i] & ~(data[i] >> 15)); + } else { + for (i = 0; i < num_entries; i++) { + if (data[i] >= 0) + data[i] -= (mf_pos_t)-MATCHFINDER_WINDOW_SIZE; + else + data[i] = (mf_pos_t)-MATCHFINDER_WINDOW_SIZE; + } + } +} +#endif + +/* + * The hash function: given a sequence prefix held in the low-order bits of a + * 32-bit value, multiply by a carefully-chosen large constant. Discard any + * bits of the product that don't fit in a 32-bit value, but take the + * next-highest @num_bits bits of the product as the hash value, as those have + * the most randomness. + */ +static forceinline u32 +lz_hash(u32 seq, unsigned num_bits) +{ + return (u32)(seq * 0x1E35A7BD) >> (32 - num_bits); +} + +/* + * Return the number of bytes at @matchptr that match the bytes at @strptr, up + * to a maximum of @max_len. Initially, @start_len bytes are matched. + */ +static forceinline unsigned +lz_extend(const u8 * const strptr, const u8 * const matchptr, + const unsigned start_len, const unsigned max_len) +{ + unsigned len = start_len; + machine_word_t v_word; + + if (UNALIGNED_ACCESS_IS_FAST) { + + if (likely(max_len - len >= 4 * WORDBYTES)) { + + #define COMPARE_WORD_STEP \ + v_word = load_word_unaligned(&matchptr[len]) ^ \ + load_word_unaligned(&strptr[len]); \ + if (v_word != 0) \ + goto word_differs; \ + len += WORDBYTES; \ + + COMPARE_WORD_STEP + COMPARE_WORD_STEP + COMPARE_WORD_STEP + COMPARE_WORD_STEP + #undef COMPARE_WORD_STEP + } + + while (len + WORDBYTES <= max_len) { + v_word = load_word_unaligned(&matchptr[len]) ^ + load_word_unaligned(&strptr[len]); + if (v_word != 0) + goto word_differs; + len += WORDBYTES; + } + } + + while (len < max_len && matchptr[len] == strptr[len]) + len++; + return len; + +word_differs: + if (CPU_IS_LITTLE_ENDIAN()) + len += (bsfw(v_word) >> 3); + else + len += (WORDBITS - 1 - bsrw(v_word)) >> 3; + return len; +} + +#endif /* LIB_MATCHFINDER_COMMON_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/utils.c b/tools/z64compress/src/enc/libdeflate/lib/utils.c new file mode 100644 index 000000000..c8e5121e5 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/utils.c @@ -0,0 +1,153 @@ +/* + * utils.c - utility functions for libdeflate + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "lib_common.h" + +#include "libdeflate.h" + +#ifdef FREESTANDING +# define malloc NULL +# define free NULL +#else +# include +#endif + +static void *(*libdeflate_malloc_func)(size_t) = malloc; +static void (*libdeflate_free_func)(void *) = free; + +void * +libdeflate_malloc(size_t size) +{ + return (*libdeflate_malloc_func)(size); +} + +void +libdeflate_free(void *ptr) +{ + (*libdeflate_free_func)(ptr); +} + +void * +libdeflate_aligned_malloc(size_t alignment, size_t size) +{ + void *ptr = libdeflate_malloc(sizeof(void *) + alignment - 1 + size); + if (ptr) { + void *orig_ptr = ptr; + ptr = (void *)ALIGN((uintptr_t)ptr + sizeof(void *), alignment); + ((void **)ptr)[-1] = orig_ptr; + } + return ptr; +} + +void +libdeflate_aligned_free(void *ptr) +{ + if (ptr) + libdeflate_free(((void **)ptr)[-1]); +} + +LIBDEFLATEAPI void +libdeflate_set_memory_allocator(void *(*malloc_func)(size_t), + void (*free_func)(void *)) +{ + libdeflate_malloc_func = malloc_func; + libdeflate_free_func = free_func; +} + +/* + * Implementations of libc functions for freestanding library builds. + * Normal library builds don't use these. Not optimized yet; usually the + * compiler expands these functions and doesn't actually call them anyway. + */ +#ifdef FREESTANDING +#undef memset +void * __attribute__((weak)) +memset(void *s, int c, size_t n) +{ + u8 *p = s; + size_t i; + + for (i = 0; i < n; i++) + p[i] = c; + return s; +} + +#undef memcpy +void * __attribute__((weak)) +memcpy(void *dest, const void *src, size_t n) +{ + u8 *d = dest; + const u8 *s = src; + size_t i; + + for (i = 0; i < n; i++) + d[i] = s[i]; + return dest; +} + +#undef memmove +void * __attribute__((weak)) +memmove(void *dest, const void *src, size_t n) +{ + u8 *d = dest; + const u8 *s = src; + size_t i; + + if (d <= s) + return memcpy(d, s, n); + + for (i = n; i > 0; i--) + d[i - 1] = s[i - 1]; + return dest; +} + +#undef memcmp +int __attribute__((weak)) +memcmp(const void *s1, const void *s2, size_t n) +{ + const u8 *p1 = s1; + const u8 *p2 = s2; + size_t i; + + for (i = 0; i < n; i++) { + if (p1[i] != p2[i]) + return (int)p1[i] - (int)p2[i]; + } + return 0; +} +#endif /* FREESTANDING */ + +#ifdef LIBDEFLATE_ENABLE_ASSERTIONS +#include +#include +void +libdeflate_assertion_failed(const char *expr, const char *file, int line) +{ + fprintf(stderr, "Assertion failed: %s at %s:%d\n", expr, file, line); + abort(); +} +#endif /* LIBDEFLATE_ENABLE_ASSERTIONS */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/x86/adler32_impl.h b/tools/z64compress/src/enc/libdeflate/lib/x86/adler32_impl.h new file mode 100644 index 000000000..6285dc80a --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/x86/adler32_impl.h @@ -0,0 +1,287 @@ +/* + * x86/adler32_impl.h - x86 implementations of Adler-32 checksum algorithm + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LIB_X86_ADLER32_IMPL_H +#define LIB_X86_ADLER32_IMPL_H + +#include "cpu_features.h" + +/* + * The following macros horizontally sum the s1 counters and add them to the + * real s1, and likewise for s2. They do this via a series of reductions, each + * of which halves the vector length, until just one counter remains. + * + * The s1 reductions don't depend on the s2 reductions and vice versa, so for + * efficiency they are interleaved. Also, every other s1 counter is 0 due to + * the 'psadbw' instruction (_mm_sad_epu8) summing groups of 8 bytes rather than + * 4; hence, one of the s1 reductions is skipped when going from 128 => 32 bits. + */ + +#define ADLER32_FINISH_VEC_CHUNK_128(s1, s2, v_s1, v_s2) \ +{ \ + __m128i /* __v4su */ s1_last = (v_s1), s2_last = (v_s2); \ + \ + /* 128 => 32 bits */ \ + s2_last = _mm_add_epi32(s2_last, _mm_shuffle_epi32(s2_last, 0x31)); \ + s1_last = _mm_add_epi32(s1_last, _mm_shuffle_epi32(s1_last, 0x02)); \ + s2_last = _mm_add_epi32(s2_last, _mm_shuffle_epi32(s2_last, 0x02)); \ + \ + *(s1) += (u32)_mm_cvtsi128_si32(s1_last); \ + *(s2) += (u32)_mm_cvtsi128_si32(s2_last); \ +} + +#define ADLER32_FINISH_VEC_CHUNK_256(s1, s2, v_s1, v_s2) \ +{ \ + __m128i /* __v4su */ s1_128bit, s2_128bit; \ + \ + /* 256 => 128 bits */ \ + s1_128bit = _mm_add_epi32(_mm256_extracti128_si256((v_s1), 0), \ + _mm256_extracti128_si256((v_s1), 1)); \ + s2_128bit = _mm_add_epi32(_mm256_extracti128_si256((v_s2), 0), \ + _mm256_extracti128_si256((v_s2), 1)); \ + \ + ADLER32_FINISH_VEC_CHUNK_128((s1), (s2), s1_128bit, s2_128bit); \ +} + +/* + * This is a very silly partial workaround for gcc bug + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107892. The bug causes gcc to + * generate extra move instructions in some loops containing vector intrinsics. + * + * An alternate workaround would be to use gcc native vector operations instead + * of vector intrinsics. But that would result in MSVC needing its own code. + */ +#if GCC_PREREQ(1, 0) +# define GCC_UPDATE_VARS(a, b, c, d, e, f) \ + __asm__("" : "+x" (a), "+x" (b), "+x" (c), "+x" (d), "+x" (e), "+x" (f)) +#else +# define GCC_UPDATE_VARS(a, b, c, d, e, f) \ + (void)a, (void)b, (void)c, (void)d, (void)e, (void)f +#endif + +/* SSE2 implementation */ +#if HAVE_SSE2_INTRIN +# define adler32_sse2 adler32_sse2 +# define FUNCNAME adler32_sse2 +# define FUNCNAME_CHUNK adler32_sse2_chunk +# define IMPL_ALIGNMENT 16 +# define IMPL_SEGMENT_LEN 32 +/* + * The 16-bit precision byte counters must not be allowed to undergo *signed* + * overflow, otherwise the signed multiplications at the end (_mm_madd_epi16) + * would behave incorrectly. + */ +# define IMPL_MAX_CHUNK_LEN (32 * (0x7FFF / 0xFF)) +# if HAVE_SSE2_NATIVE +# define ATTRIBUTES +# else +# define ATTRIBUTES _target_attribute("sse2") +# endif +# include +static forceinline ATTRIBUTES void +adler32_sse2_chunk(const __m128i *p, const __m128i *const end, u32 *s1, u32 *s2) +{ + const __m128i zeroes = _mm_setzero_si128(); + const __m128i /* __v8hu */ mults_a = + _mm_setr_epi16(32, 31, 30, 29, 28, 27, 26, 25); + const __m128i /* __v8hu */ mults_b = + _mm_setr_epi16(24, 23, 22, 21, 20, 19, 18, 17); + const __m128i /* __v8hu */ mults_c = + _mm_setr_epi16(16, 15, 14, 13, 12, 11, 10, 9); + const __m128i /* __v8hu */ mults_d = + _mm_setr_epi16(8, 7, 6, 5, 4, 3, 2, 1); + + /* s1 counters: 32-bit, sum of bytes */ + __m128i /* __v4su */ v_s1 = zeroes; + + /* s2 counters: 32-bit, sum of s1 values */ + __m128i /* __v4su */ v_s2 = zeroes; + + /* + * Thirty-two 16-bit counters for byte sums. Each accumulates the bytes + * that eventually need to be multiplied by a number 32...1 for addition + * into s2. + */ + __m128i /* __v8hu */ v_byte_sums_a = zeroes; + __m128i /* __v8hu */ v_byte_sums_b = zeroes; + __m128i /* __v8hu */ v_byte_sums_c = zeroes; + __m128i /* __v8hu */ v_byte_sums_d = zeroes; + + do { + /* Load the next 32 bytes. */ + const __m128i bytes1 = *p++; + const __m128i bytes2 = *p++; + + /* + * Accumulate the previous s1 counters into the s2 counters. + * Logically, this really should be v_s2 += v_s1 * 32, but we + * can do the multiplication (or left shift) later. + */ + v_s2 = _mm_add_epi32(v_s2, v_s1); + + /* + * s1 update: use "Packed Sum of Absolute Differences" to add + * the bytes horizontally with 8 bytes per sum. Then add the + * sums to the s1 counters. + */ + v_s1 = _mm_add_epi32(v_s1, _mm_sad_epu8(bytes1, zeroes)); + v_s1 = _mm_add_epi32(v_s1, _mm_sad_epu8(bytes2, zeroes)); + + /* + * Also accumulate the bytes into 32 separate counters that have + * 16-bit precision. + */ + v_byte_sums_a = _mm_add_epi16( + v_byte_sums_a, _mm_unpacklo_epi8(bytes1, zeroes)); + v_byte_sums_b = _mm_add_epi16( + v_byte_sums_b, _mm_unpackhi_epi8(bytes1, zeroes)); + v_byte_sums_c = _mm_add_epi16( + v_byte_sums_c, _mm_unpacklo_epi8(bytes2, zeroes)); + v_byte_sums_d = _mm_add_epi16( + v_byte_sums_d, _mm_unpackhi_epi8(bytes2, zeroes)); + + GCC_UPDATE_VARS(v_s1, v_s2, v_byte_sums_a, v_byte_sums_b, + v_byte_sums_c, v_byte_sums_d); + } while (p != end); + + /* Finish calculating the s2 counters. */ + v_s2 = _mm_slli_epi32(v_s2, 5); + v_s2 = _mm_add_epi32(v_s2, _mm_madd_epi16(v_byte_sums_a, mults_a)); + v_s2 = _mm_add_epi32(v_s2, _mm_madd_epi16(v_byte_sums_b, mults_b)); + v_s2 = _mm_add_epi32(v_s2, _mm_madd_epi16(v_byte_sums_c, mults_c)); + v_s2 = _mm_add_epi32(v_s2, _mm_madd_epi16(v_byte_sums_d, mults_d)); + + /* Add the counters to the real s1 and s2. */ + ADLER32_FINISH_VEC_CHUNK_128(s1, s2, v_s1, v_s2); +} +# include "../adler32_vec_template.h" +#endif /* HAVE_SSE2_INTRIN */ + +/* + * AVX2 implementation. Basically the same as the SSE2 one, but with the vector + * width doubled. + */ +#if HAVE_AVX2_INTRIN +# define adler32_avx2 adler32_avx2 +# define FUNCNAME adler32_avx2 +# define FUNCNAME_CHUNK adler32_avx2_chunk +# define IMPL_ALIGNMENT 32 +# define IMPL_SEGMENT_LEN 64 +# define IMPL_MAX_CHUNK_LEN (64 * (0x7FFF / 0xFF)) +# if HAVE_AVX2_NATIVE +# define ATTRIBUTES +# else +# define ATTRIBUTES _target_attribute("avx2") +# endif +# include + /* + * With clang in MSVC compatibility mode, immintrin.h incorrectly skips + * including some sub-headers. + */ +# if defined(__clang__) && defined(_MSC_VER) +# include +# include +# endif +static forceinline ATTRIBUTES void +adler32_avx2_chunk(const __m256i *p, const __m256i *const end, u32 *s1, u32 *s2) +{ + const __m256i zeroes = _mm256_setzero_si256(); + /* + * Note, the multipliers have to be in this order because + * _mm256_unpack{lo,hi}_epi8 work on each 128-bit lane separately. + */ + const __m256i /* __v16hu */ mults_a = + _mm256_setr_epi16(64, 63, 62, 61, 60, 59, 58, 57, + 48, 47, 46, 45, 44, 43, 42, 41); + const __m256i /* __v16hu */ mults_b = + _mm256_setr_epi16(56, 55, 54, 53, 52, 51, 50, 49, + 40, 39, 38, 37, 36, 35, 34, 33); + const __m256i /* __v16hu */ mults_c = + _mm256_setr_epi16(32, 31, 30, 29, 28, 27, 26, 25, + 16, 15, 14, 13, 12, 11, 10, 9); + const __m256i /* __v16hu */ mults_d = + _mm256_setr_epi16(24, 23, 22, 21, 20, 19, 18, 17, + 8, 7, 6, 5, 4, 3, 2, 1); + __m256i /* __v8su */ v_s1 = zeroes; + __m256i /* __v8su */ v_s2 = zeroes; + __m256i /* __v16hu */ v_byte_sums_a = zeroes; + __m256i /* __v16hu */ v_byte_sums_b = zeroes; + __m256i /* __v16hu */ v_byte_sums_c = zeroes; + __m256i /* __v16hu */ v_byte_sums_d = zeroes; + + do { + const __m256i bytes1 = *p++; + const __m256i bytes2 = *p++; + + v_s2 = _mm256_add_epi32(v_s2, v_s1); + v_s1 = _mm256_add_epi32(v_s1, _mm256_sad_epu8(bytes1, zeroes)); + v_s1 = _mm256_add_epi32(v_s1, _mm256_sad_epu8(bytes2, zeroes)); + v_byte_sums_a = _mm256_add_epi16( + v_byte_sums_a, _mm256_unpacklo_epi8(bytes1, zeroes)); + v_byte_sums_b = _mm256_add_epi16( + v_byte_sums_b, _mm256_unpackhi_epi8(bytes1, zeroes)); + v_byte_sums_c = _mm256_add_epi16( + v_byte_sums_c, _mm256_unpacklo_epi8(bytes2, zeroes)); + v_byte_sums_d = _mm256_add_epi16( + v_byte_sums_d, _mm256_unpackhi_epi8(bytes2, zeroes)); + + GCC_UPDATE_VARS(v_s1, v_s2, v_byte_sums_a, v_byte_sums_b, + v_byte_sums_c, v_byte_sums_d); + } while (p != end); + + v_s2 = _mm256_slli_epi32(v_s2, 6); + v_s2 = _mm256_add_epi32(v_s2, _mm256_madd_epi16(v_byte_sums_a, mults_a)); + v_s2 = _mm256_add_epi32(v_s2, _mm256_madd_epi16(v_byte_sums_b, mults_b)); + v_s2 = _mm256_add_epi32(v_s2, _mm256_madd_epi16(v_byte_sums_c, mults_c)); + v_s2 = _mm256_add_epi32(v_s2, _mm256_madd_epi16(v_byte_sums_d, mults_d)); + ADLER32_FINISH_VEC_CHUNK_256(s1, s2, v_s1, v_s2); +} +# include "../adler32_vec_template.h" +#endif /* HAVE_AVX2_INTRIN */ + +#if defined(adler32_avx2) && HAVE_AVX2_NATIVE +#define DEFAULT_IMPL adler32_avx2 +#else +static inline adler32_func_t +arch_select_adler32_func(void) +{ + const u32 features MAYBE_UNUSED = get_x86_cpu_features(); + +#ifdef adler32_avx2 + if (HAVE_AVX2(features)) + return adler32_avx2; +#endif +#ifdef adler32_sse2 + if (HAVE_SSE2(features)) + return adler32_sse2; +#endif + return NULL; +} +#define arch_select_adler32_func arch_select_adler32_func +#endif + +#endif /* LIB_X86_ADLER32_IMPL_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/x86/cpu_features.c b/tools/z64compress/src/enc/libdeflate/lib/x86/cpu_features.c new file mode 100644 index 000000000..958777ebd --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/x86/cpu_features.c @@ -0,0 +1,151 @@ +/* + * x86/cpu_features.c - feature detection for x86 CPUs + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "../cpu_features_common.h" /* must be included first */ +#include "cpu_features.h" + +#if HAVE_DYNAMIC_X86_CPU_FEATURES + +/* With old GCC versions we have to manually save and restore the x86_32 PIC + * register (ebx). See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47602 */ +#if defined(ARCH_X86_32) && defined(__PIC__) +# define EBX_CONSTRAINT "=&r" +#else +# define EBX_CONSTRAINT "=b" +#endif + +/* Execute the CPUID instruction. */ +static inline void +cpuid(u32 leaf, u32 subleaf, u32 *a, u32 *b, u32 *c, u32 *d) +{ +#ifdef _MSC_VER + int result[4]; + + __cpuidex(result, leaf, subleaf); + *a = result[0]; + *b = result[1]; + *c = result[2]; + *d = result[3]; +#else + __asm__(".ifnc %%ebx, %1; mov %%ebx, %1; .endif\n" + "cpuid \n" + ".ifnc %%ebx, %1; xchg %%ebx, %1; .endif\n" + : "=a" (*a), EBX_CONSTRAINT (*b), "=c" (*c), "=d" (*d) + : "a" (leaf), "c" (subleaf)); +#endif +} + +/* Read an extended control register. */ +static inline u64 +read_xcr(u32 index) +{ +#ifdef _MSC_VER + return _xgetbv(index); +#else + u32 edx, eax; + + /* Execute the "xgetbv" instruction. Old versions of binutils do not + * recognize this instruction, so list the raw bytes instead. */ + __asm__ (".byte 0x0f, 0x01, 0xd0" : "=d" (edx), "=a" (eax) : "c" (index)); + + return ((u64)edx << 32) | eax; +#endif +} + +#undef BIT +#define BIT(nr) (1UL << (nr)) + +#define XCR0_BIT_SSE BIT(1) +#define XCR0_BIT_AVX BIT(2) + +#define IS_SET(reg, nr) ((reg) & BIT(nr)) +#define IS_ALL_SET(reg, mask) (((reg) & (mask)) == (mask)) + +static const struct cpu_feature x86_cpu_feature_table[] = { + {X86_CPU_FEATURE_SSE2, "sse2"}, + {X86_CPU_FEATURE_PCLMUL, "pclmul"}, + {X86_CPU_FEATURE_AVX, "avx"}, + {X86_CPU_FEATURE_AVX2, "avx2"}, + {X86_CPU_FEATURE_BMI2, "bmi2"}, +}; + +volatile u32 libdeflate_x86_cpu_features = 0; + +/* Initialize libdeflate_x86_cpu_features. */ +void libdeflate_init_x86_cpu_features(void) +{ + u32 features = 0; + u32 dummy1, dummy2, dummy3, dummy4; + u32 max_function; + u32 features_1, features_2, features_3, features_4; + bool os_avx_support = false; + + /* Get maximum supported function */ + cpuid(0, 0, &max_function, &dummy2, &dummy3, &dummy4); + if (max_function < 1) + goto out; + + /* Standard feature flags */ + cpuid(1, 0, &dummy1, &dummy2, &features_2, &features_1); + + if (IS_SET(features_1, 26)) + features |= X86_CPU_FEATURE_SSE2; + + if (IS_SET(features_2, 1)) + features |= X86_CPU_FEATURE_PCLMUL; + + if (IS_SET(features_2, 27)) { /* OSXSAVE set? */ + u64 xcr0 = read_xcr(0); + + os_avx_support = IS_ALL_SET(xcr0, + XCR0_BIT_SSE | + XCR0_BIT_AVX); + } + + if (os_avx_support && IS_SET(features_2, 28)) + features |= X86_CPU_FEATURE_AVX; + + if (max_function < 7) + goto out; + + /* Extended feature flags */ + cpuid(7, 0, &dummy1, &features_3, &features_4, &dummy4); + + if (os_avx_support && IS_SET(features_3, 5)) + features |= X86_CPU_FEATURE_AVX2; + + if (IS_SET(features_3, 8)) + features |= X86_CPU_FEATURE_BMI2; + +out: + disable_cpu_features_for_testing(&features, x86_cpu_feature_table, + ARRAY_LEN(x86_cpu_feature_table)); + + libdeflate_x86_cpu_features = features | X86_CPU_FEATURES_KNOWN; +} + +#endif /* HAVE_DYNAMIC_X86_CPU_FEATURES */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/x86/cpu_features.h b/tools/z64compress/src/enc/libdeflate/lib/x86/cpu_features.h new file mode 100644 index 000000000..561bd567f --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/x86/cpu_features.h @@ -0,0 +1,155 @@ +/* + * x86/cpu_features.h - feature detection for x86 CPUs + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LIB_X86_CPU_FEATURES_H +#define LIB_X86_CPU_FEATURES_H + +#include "../lib_common.h" + +#define HAVE_DYNAMIC_X86_CPU_FEATURES 0 + +#if defined(ARCH_X86_32) || defined(ARCH_X86_64) + +#if COMPILER_SUPPORTS_TARGET_FUNCTION_ATTRIBUTE || defined(_MSC_VER) +# undef HAVE_DYNAMIC_X86_CPU_FEATURES +# define HAVE_DYNAMIC_X86_CPU_FEATURES 1 +#endif + +#define X86_CPU_FEATURE_SSE2 0x00000001 +#define X86_CPU_FEATURE_PCLMUL 0x00000002 +#define X86_CPU_FEATURE_AVX 0x00000004 +#define X86_CPU_FEATURE_AVX2 0x00000008 +#define X86_CPU_FEATURE_BMI2 0x00000010 + +#define HAVE_SSE2(features) (HAVE_SSE2_NATIVE || ((features) & X86_CPU_FEATURE_SSE2)) +#define HAVE_PCLMUL(features) (HAVE_PCLMUL_NATIVE || ((features) & X86_CPU_FEATURE_PCLMUL)) +#define HAVE_AVX(features) (HAVE_AVX_NATIVE || ((features) & X86_CPU_FEATURE_AVX)) +#define HAVE_AVX2(features) (HAVE_AVX2_NATIVE || ((features) & X86_CPU_FEATURE_AVX2)) +#define HAVE_BMI2(features) (HAVE_BMI2_NATIVE || ((features) & X86_CPU_FEATURE_BMI2)) + +#if HAVE_DYNAMIC_X86_CPU_FEATURES +#define X86_CPU_FEATURES_KNOWN 0x80000000 +extern volatile u32 libdeflate_x86_cpu_features; + +void libdeflate_init_x86_cpu_features(void); + +static inline u32 get_x86_cpu_features(void) +{ + if (libdeflate_x86_cpu_features == 0) + libdeflate_init_x86_cpu_features(); + return libdeflate_x86_cpu_features; +} +#else /* HAVE_DYNAMIC_X86_CPU_FEATURES */ +static inline u32 get_x86_cpu_features(void) { return 0; } +#endif /* !HAVE_DYNAMIC_X86_CPU_FEATURES */ + +/* + * Prior to gcc 4.9 (r200349) and clang 3.8 (r239883), x86 intrinsics not + * available in the main target couldn't be used in 'target' attribute + * functions. Unfortunately clang has no feature test macro for this, so we + * have to check its version. + */ +#if HAVE_DYNAMIC_X86_CPU_FEATURES && \ + (GCC_PREREQ(4, 9) || CLANG_PREREQ(3, 8, 7030000) || defined(_MSC_VER)) +# define HAVE_TARGET_INTRINSICS 1 +#else +# define HAVE_TARGET_INTRINSICS 0 +#endif + +/* SSE2 */ +#if defined(__SSE2__) || \ + (defined(_MSC_VER) && \ + (defined(ARCH_X86_64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2))) +# define HAVE_SSE2_NATIVE 1 +#else +# define HAVE_SSE2_NATIVE 0 +#endif +#define HAVE_SSE2_INTRIN (HAVE_SSE2_NATIVE || HAVE_TARGET_INTRINSICS) + +/* PCLMUL */ +#if defined(__PCLMUL__) || (defined(_MSC_VER) && defined(__AVX2__)) +# define HAVE_PCLMUL_NATIVE 1 +#else +# define HAVE_PCLMUL_NATIVE 0 +#endif +#if HAVE_PCLMUL_NATIVE || (HAVE_TARGET_INTRINSICS && \ + (GCC_PREREQ(4, 4) || \ + __has_builtin(__builtin_ia32_pclmulqdq128) || \ + defined(_MSC_VER))) +# define HAVE_PCLMUL_INTRIN 1 +#else +# define HAVE_PCLMUL_INTRIN 0 +#endif + +/* AVX */ +#ifdef __AVX__ +# define HAVE_AVX_NATIVE 1 +#else +# define HAVE_AVX_NATIVE 0 +#endif +#if HAVE_AVX_NATIVE || (HAVE_TARGET_INTRINSICS && \ + (GCC_PREREQ(4, 6) || \ + __has_builtin(__builtin_ia32_maxps256) || \ + defined(_MSC_VER))) +# define HAVE_AVX_INTRIN 1 +#else +# define HAVE_AVX_INTRIN 0 +#endif + +/* AVX2 */ +#ifdef __AVX2__ +# define HAVE_AVX2_NATIVE 1 +#else +# define HAVE_AVX2_NATIVE 0 +#endif +#if HAVE_AVX2_NATIVE || (HAVE_TARGET_INTRINSICS && \ + (GCC_PREREQ(4, 7) || \ + __has_builtin(__builtin_ia32_psadbw256) || \ + defined(_MSC_VER))) +# define HAVE_AVX2_INTRIN 1 +#else +# define HAVE_AVX2_INTRIN 0 +#endif + +/* BMI2 */ +#if defined(__BMI2__) || (defined(_MSC_VER) && defined(__AVX2__)) +# define HAVE_BMI2_NATIVE 1 +#else +# define HAVE_BMI2_NATIVE 0 +#endif +#if HAVE_BMI2_NATIVE || (HAVE_TARGET_INTRINSICS && \ + (GCC_PREREQ(4, 7) || \ + __has_builtin(__builtin_ia32_pdep_di) || \ + defined(_MSC_VER))) +# define HAVE_BMI2_INTRIN 1 +#else +# define HAVE_BMI2_INTRIN 0 +#endif + +#endif /* ARCH_X86_32 || ARCH_X86_64 */ + +#endif /* LIB_X86_CPU_FEATURES_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/x86/crc32_impl.h b/tools/z64compress/src/enc/libdeflate/lib/x86/crc32_impl.h new file mode 100644 index 000000000..79cc7944e --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/x86/crc32_impl.h @@ -0,0 +1,96 @@ +/* + * x86/crc32_impl.h - x86 implementations of the gzip CRC-32 algorithm + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LIB_X86_CRC32_IMPL_H +#define LIB_X86_CRC32_IMPL_H + +#include "cpu_features.h" + +/* PCLMUL implementation */ +#if HAVE_PCLMUL_INTRIN +# define crc32_x86_pclmul crc32_x86_pclmul +# define SUFFIX _pclmul +# if HAVE_PCLMUL_NATIVE +# define ATTRIBUTES +# else +# define ATTRIBUTES _target_attribute("pclmul") +# endif +# define FOLD_PARTIAL_VECS 0 +# include "crc32_pclmul_template.h" +#endif + +/* + * PCLMUL/AVX implementation. This implementation has two benefits over the + * regular PCLMUL one. First, simply compiling against the AVX target can + * improve performance significantly (e.g. 10100 MB/s to 16700 MB/s on Skylake) + * without actually using any AVX intrinsics, probably due to the availability + * of non-destructive VEX-encoded instructions. Second, AVX support implies + * SSSE3 and SSE4.1 support, and we can use SSSE3 and SSE4.1 intrinsics for + * efficient handling of partial blocks. (We *could* compile a variant with + * PCLMUL+SSSE3+SSE4.1 w/o AVX, but for simplicity we don't currently bother.) + * + * FIXME: with MSVC, this isn't actually compiled with AVX code generation + * enabled yet. That would require that this be moved to its own .c file. + */ +#if HAVE_PCLMUL_INTRIN && HAVE_AVX_INTRIN +# define crc32_x86_pclmul_avx crc32_x86_pclmul_avx +# define SUFFIX _pclmul_avx +# if HAVE_PCLMUL_NATIVE && HAVE_AVX_NATIVE +# define ATTRIBUTES +# else +# define ATTRIBUTES _target_attribute("pclmul,avx") +# endif +# define FOLD_PARTIAL_VECS 1 +# include "crc32_pclmul_template.h" +#endif + +/* + * If the best implementation is statically available, use it unconditionally. + * Otherwise choose the best implementation at runtime. + */ +#if defined(crc32_x86_pclmul_avx) && HAVE_PCLMUL_NATIVE && HAVE_AVX_NATIVE +#define DEFAULT_IMPL crc32_x86_pclmul_avx +#else +static inline crc32_func_t +arch_select_crc32_func(void) +{ + const u32 features MAYBE_UNUSED = get_x86_cpu_features(); + +#ifdef crc32_x86_pclmul_avx + if (HAVE_PCLMUL(features) && HAVE_AVX(features)) + return crc32_x86_pclmul_avx; +#endif +#ifdef crc32_x86_pclmul + if (HAVE_PCLMUL(features)) + return crc32_x86_pclmul; +#endif + return NULL; +} +#define arch_select_crc32_func arch_select_crc32_func +#endif + +#endif /* LIB_X86_CRC32_IMPL_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/x86/crc32_pclmul_template.h b/tools/z64compress/src/enc/libdeflate/lib/x86/crc32_pclmul_template.h new file mode 100644 index 000000000..1d5782375 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/x86/crc32_pclmul_template.h @@ -0,0 +1,354 @@ +/* + * x86/crc32_pclmul_template.h - gzip CRC-32 with PCLMULQDQ instructions + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This file is a "template" for instantiating PCLMULQDQ-based crc32_x86 + * functions. The "parameters" are: + * + * SUFFIX: + * Name suffix to append to all instantiated functions. + * ATTRIBUTES: + * Target function attributes to use. + * FOLD_PARTIAL_VECS: + * Use vector instructions to handle any partial blocks at the beginning + * and end, instead of falling back to scalar instructions for those parts. + * Requires SSSE3 and SSE4.1 intrinsics. + * + * The overall algorithm used is CRC folding with carryless multiplication + * instructions. Note that the x86 crc32 instruction cannot be used, as it is + * for a different polynomial, not the gzip one. For an explanation of CRC + * folding with carryless multiplication instructions, see + * scripts/gen_crc32_multipliers.c and the following paper: + * + * "Fast CRC Computation for Generic Polynomials Using PCLMULQDQ Instruction" + * https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf + */ + +#include +/* + * With clang in MSVC compatibility mode, immintrin.h incorrectly skips + * including some sub-headers. + */ +#if defined(__clang__) && defined(_MSC_VER) +# include +# include +# include +#endif + +#undef fold_vec +static forceinline ATTRIBUTES __m128i +ADD_SUFFIX(fold_vec)(__m128i src, __m128i dst, __m128i /* __v2di */ multipliers) +{ + /* + * The immediate constant for PCLMULQDQ specifies which 64-bit halves of + * the 128-bit vectors to multiply: + * + * 0x00 means low halves (higher degree polynomial terms for us) + * 0x11 means high halves (lower degree polynomial terms for us) + */ + dst = _mm_xor_si128(dst, _mm_clmulepi64_si128(src, multipliers, 0x00)); + dst = _mm_xor_si128(dst, _mm_clmulepi64_si128(src, multipliers, 0x11)); + return dst; +} +#define fold_vec ADD_SUFFIX(fold_vec) + +#if FOLD_PARTIAL_VECS +/* + * Given v containing a 16-byte polynomial, and a pointer 'p' that points to the + * next '1 <= len <= 15' data bytes, rearrange the concatenation of v and the + * data into vectors x0 and x1 that contain 'len' bytes and 16 bytes, + * respectively. Then fold x0 into x1 and return the result. Assumes that + * 'p + len - 16' is in-bounds. + */ +#undef fold_partial_vec +static forceinline ATTRIBUTES __m128i +ADD_SUFFIX(fold_partial_vec)(__m128i v, const u8 *p, size_t len, + __m128i /* __v2du */ multipliers_1) +{ + /* + * pshufb(v, shift_tab[len..len+15]) left shifts v by 16-len bytes. + * pshufb(v, shift_tab[len+16..len+31]) right shifts v by len bytes. + */ + static const u8 shift_tab[48] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + }; + __m128i lshift = _mm_loadu_si128((const void *)&shift_tab[len]); + __m128i rshift = _mm_loadu_si128((const void *)&shift_tab[len + 16]); + __m128i x0, x1; + + /* x0 = v left-shifted by '16 - len' bytes */ + x0 = _mm_shuffle_epi8(v, lshift); + + /* + * x1 = the last '16 - len' bytes from v (i.e. v right-shifted by 'len' + * bytes) followed by the remaining data. + */ + x1 = _mm_blendv_epi8(_mm_shuffle_epi8(v, rshift), + _mm_loadu_si128((const void *)(p + len - 16)), + /* msb 0/1 of each byte selects byte from arg1/2 */ + rshift); + + return fold_vec(x0, x1, multipliers_1); +} +#define fold_partial_vec ADD_SUFFIX(fold_partial_vec) +#endif /* FOLD_PARTIAL_VECS */ + +static u32 ATTRIBUTES MAYBE_UNUSED +ADD_SUFFIX(crc32_x86)(u32 crc, const u8 *p, size_t len) +{ + const __m128i /* __v2du */ multipliers_8 = + _mm_set_epi64x(CRC32_8VECS_MULT_2, CRC32_8VECS_MULT_1); + const __m128i /* __v2du */ multipliers_4 = + _mm_set_epi64x(CRC32_4VECS_MULT_2, CRC32_4VECS_MULT_1); + const __m128i /* __v2du */ multipliers_2 = + _mm_set_epi64x(CRC32_2VECS_MULT_2, CRC32_2VECS_MULT_1); + const __m128i /* __v2du */ multipliers_1 = + _mm_set_epi64x(CRC32_1VECS_MULT_2, CRC32_1VECS_MULT_1); + const __m128i /* __v2du */ final_multiplier = + _mm_set_epi64x(0, CRC32_FINAL_MULT); + const __m128i mask32 = _mm_set_epi32(0, 0, 0, 0xFFFFFFFF); + const __m128i /* __v2du */ barrett_reduction_constants = + _mm_set_epi64x(CRC32_BARRETT_CONSTANT_2, + CRC32_BARRETT_CONSTANT_1); + __m128i v0, v1, v2, v3, v4, v5, v6, v7; + + /* + * There are two overall code paths. The first path supports all + * lengths, but is intended for short lengths; it uses unaligned loads + * and does at most 4-way folds. The second path only supports longer + * lengths, aligns the pointer in order to do aligned loads, and does up + * to 8-way folds. The length check below decides which path to take. + */ + if (len < 1024) { + if (len < 16) + return crc32_slice1(crc, p, len); + + v0 = _mm_xor_si128(_mm_loadu_si128((const void *)p), + _mm_cvtsi32_si128(crc)); + p += 16; + + if (len >= 64) { + v1 = _mm_loadu_si128((const void *)(p + 0)); + v2 = _mm_loadu_si128((const void *)(p + 16)); + v3 = _mm_loadu_si128((const void *)(p + 32)); + p += 48; + while (len >= 64 + 64) { + v0 = fold_vec(v0, _mm_loadu_si128((const void *)(p + 0)), + multipliers_4); + v1 = fold_vec(v1, _mm_loadu_si128((const void *)(p + 16)), + multipliers_4); + v2 = fold_vec(v2, _mm_loadu_si128((const void *)(p + 32)), + multipliers_4); + v3 = fold_vec(v3, _mm_loadu_si128((const void *)(p + 48)), + multipliers_4); + p += 64; + len -= 64; + } + v0 = fold_vec(v0, v2, multipliers_2); + v1 = fold_vec(v1, v3, multipliers_2); + if (len & 32) { + v0 = fold_vec(v0, _mm_loadu_si128((const void *)(p + 0)), + multipliers_2); + v1 = fold_vec(v1, _mm_loadu_si128((const void *)(p + 16)), + multipliers_2); + p += 32; + } + v0 = fold_vec(v0, v1, multipliers_1); + if (len & 16) { + v0 = fold_vec(v0, _mm_loadu_si128((const void *)p), + multipliers_1); + p += 16; + } + } else { + if (len >= 32) { + v0 = fold_vec(v0, _mm_loadu_si128((const void *)p), + multipliers_1); + p += 16; + if (len >= 48) { + v0 = fold_vec(v0, _mm_loadu_si128((const void *)p), + multipliers_1); + p += 16; + } + } + } + } else { + const size_t align = -(uintptr_t)p & 15; + const __m128i *vp; + + #if FOLD_PARTIAL_VECS + v0 = _mm_xor_si128(_mm_loadu_si128((const void *)p), + _mm_cvtsi32_si128(crc)); + p += 16; + /* Align p to the next 16-byte boundary. */ + if (align) { + v0 = fold_partial_vec(v0, p, align, multipliers_1); + p += align; + len -= align; + } + vp = (const __m128i *)p; + #else + /* Align p to the next 16-byte boundary. */ + if (align) { + crc = crc32_slice1(crc, p, align); + p += align; + len -= align; + } + vp = (const __m128i *)p; + v0 = _mm_xor_si128(*vp++, _mm_cvtsi32_si128(crc)); + #endif + v1 = *vp++; + v2 = *vp++; + v3 = *vp++; + v4 = *vp++; + v5 = *vp++; + v6 = *vp++; + v7 = *vp++; + do { + v0 = fold_vec(v0, *vp++, multipliers_8); + v1 = fold_vec(v1, *vp++, multipliers_8); + v2 = fold_vec(v2, *vp++, multipliers_8); + v3 = fold_vec(v3, *vp++, multipliers_8); + v4 = fold_vec(v4, *vp++, multipliers_8); + v5 = fold_vec(v5, *vp++, multipliers_8); + v6 = fold_vec(v6, *vp++, multipliers_8); + v7 = fold_vec(v7, *vp++, multipliers_8); + len -= 128; + } while (len >= 128 + 128); + + v0 = fold_vec(v0, v4, multipliers_4); + v1 = fold_vec(v1, v5, multipliers_4); + v2 = fold_vec(v2, v6, multipliers_4); + v3 = fold_vec(v3, v7, multipliers_4); + if (len & 64) { + v0 = fold_vec(v0, *vp++, multipliers_4); + v1 = fold_vec(v1, *vp++, multipliers_4); + v2 = fold_vec(v2, *vp++, multipliers_4); + v3 = fold_vec(v3, *vp++, multipliers_4); + } + + v0 = fold_vec(v0, v2, multipliers_2); + v1 = fold_vec(v1, v3, multipliers_2); + if (len & 32) { + v0 = fold_vec(v0, *vp++, multipliers_2); + v1 = fold_vec(v1, *vp++, multipliers_2); + } + + v0 = fold_vec(v0, v1, multipliers_1); + if (len & 16) + v0 = fold_vec(v0, *vp++, multipliers_1); + + p = (const u8 *)vp; + } + len &= 15; + + /* + * If fold_partial_vec() is available, handle any remaining partial + * block now before reducing to 32 bits. + */ +#if FOLD_PARTIAL_VECS + if (len) + v0 = fold_partial_vec(v0, p, len, multipliers_1); +#endif + + /* + * Fold 128 => 96 bits. This also implicitly appends 32 zero bits, + * which is equivalent to multiplying by x^32. This is needed because + * the CRC is defined as M(x)*x^32 mod G(x), not just M(x) mod G(x). + */ + v0 = _mm_xor_si128(_mm_srli_si128(v0, 8), + _mm_clmulepi64_si128(v0, multipliers_1, 0x10)); + + /* Fold 96 => 64 bits. */ + v0 = _mm_xor_si128(_mm_srli_si128(v0, 4), + _mm_clmulepi64_si128(_mm_and_si128(v0, mask32), + final_multiplier, 0x00)); + + /* + * Reduce 64 => 32 bits using Barrett reduction. + * + * Let M(x) = A(x)*x^32 + B(x) be the remaining message. The goal is to + * compute R(x) = M(x) mod G(x). Since degree(B(x)) < degree(G(x)): + * + * R(x) = (A(x)*x^32 + B(x)) mod G(x) + * = (A(x)*x^32) mod G(x) + B(x) + * + * Then, by the Division Algorithm there exists a unique q(x) such that: + * + * A(x)*x^32 mod G(x) = A(x)*x^32 - q(x)*G(x) + * + * Since the left-hand side is of maximum degree 31, the right-hand side + * must be too. This implies that we can apply 'mod x^32' to the + * right-hand side without changing its value: + * + * (A(x)*x^32 - q(x)*G(x)) mod x^32 = q(x)*G(x) mod x^32 + * + * Note that '+' is equivalent to '-' in polynomials over GF(2). + * + * We also know that: + * + * / A(x)*x^32 \ + * q(x) = floor ( --------- ) + * \ G(x) / + * + * To compute this efficiently, we can multiply the top and bottom by + * x^32 and move the division by G(x) to the top: + * + * / A(x) * floor(x^64 / G(x)) \ + * q(x) = floor ( ------------------------- ) + * \ x^32 / + * + * Note that floor(x^64 / G(x)) is a constant. + * + * So finally we have: + * + * / A(x) * floor(x^64 / G(x)) \ + * R(x) = B(x) + G(x)*floor ( ------------------------- ) + * \ x^32 / + */ + v1 = _mm_clmulepi64_si128(_mm_and_si128(v0, mask32), + barrett_reduction_constants, 0x00); + v1 = _mm_clmulepi64_si128(_mm_and_si128(v1, mask32), + barrett_reduction_constants, 0x10); + v0 = _mm_xor_si128(v0, v1); +#if FOLD_PARTIAL_VECS + crc = _mm_extract_epi32(v0, 1); +#else + crc = _mm_cvtsi128_si32(_mm_shuffle_epi32(v0, 0x01)); + /* Process up to 15 bytes left over at the end. */ + crc = crc32_slice1(crc, p, len); +#endif + return crc; +} + +#undef SUFFIX +#undef ATTRIBUTES +#undef FOLD_PARTIAL_VECS diff --git a/tools/z64compress/src/enc/libdeflate/lib/x86/decompress_impl.h b/tools/z64compress/src/enc/libdeflate/lib/x86/decompress_impl.h new file mode 100644 index 000000000..3e2ec37e7 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/x86/decompress_impl.h @@ -0,0 +1,54 @@ +#ifndef LIB_X86_DECOMPRESS_IMPL_H +#define LIB_X86_DECOMPRESS_IMPL_H + +#include "cpu_features.h" + +/* + * BMI2 optimized version + * + * FIXME: with MSVC, this isn't actually compiled with BMI2 code generation + * enabled yet. That would require that this be moved to its own .c file. + */ +#if HAVE_BMI2_INTRIN +# define deflate_decompress_bmi2 deflate_decompress_bmi2 +# define FUNCNAME deflate_decompress_bmi2 +# if !HAVE_BMI2_NATIVE +# define ATTRIBUTES _target_attribute("bmi2") +# endif + /* + * Even with __attribute__((target("bmi2"))), gcc doesn't reliably use the + * bzhi instruction for 'word & BITMASK(count)'. So use the bzhi intrinsic + * explicitly. EXTRACT_VARBITS() is equivalent to 'word & BITMASK(count)'; + * EXTRACT_VARBITS8() is equivalent to 'word & BITMASK((u8)count)'. + * Nevertheless, their implementation using the bzhi intrinsic is identical, + * as the bzhi instruction truncates the count to 8 bits implicitly. + */ +# ifndef __clang__ +# include +# ifdef ARCH_X86_64 +# define EXTRACT_VARBITS(word, count) _bzhi_u64((word), (count)) +# define EXTRACT_VARBITS8(word, count) _bzhi_u64((word), (count)) +# else +# define EXTRACT_VARBITS(word, count) _bzhi_u32((word), (count)) +# define EXTRACT_VARBITS8(word, count) _bzhi_u32((word), (count)) +# endif +# endif +# include "../decompress_template.h" +#endif /* HAVE_BMI2_INTRIN */ + +#if defined(deflate_decompress_bmi2) && HAVE_BMI2_NATIVE +#define DEFAULT_IMPL deflate_decompress_bmi2 +#else +static inline decompress_func_t +arch_select_decompress_func(void) +{ +#ifdef deflate_decompress_bmi2 + if (HAVE_BMI2(get_x86_cpu_features())) + return deflate_decompress_bmi2; +#endif + return NULL; +} +#define arch_select_decompress_func arch_select_decompress_func +#endif + +#endif /* LIB_X86_DECOMPRESS_IMPL_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/x86/matchfinder_impl.h b/tools/z64compress/src/enc/libdeflate/lib/x86/matchfinder_impl.h new file mode 100644 index 000000000..8433b9b10 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/x86/matchfinder_impl.h @@ -0,0 +1,124 @@ +/* + * x86/matchfinder_impl.h - x86 implementations of matchfinder functions + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LIB_X86_MATCHFINDER_IMPL_H +#define LIB_X86_MATCHFINDER_IMPL_H + +#include "cpu_features.h" + +#if HAVE_AVX2_NATIVE +# include +static forceinline void +matchfinder_init_avx2(mf_pos_t *data, size_t size) +{ + __m256i *p = (__m256i *)data; + __m256i v = _mm256_set1_epi16(MATCHFINDER_INITVAL); + + STATIC_ASSERT(MATCHFINDER_MEM_ALIGNMENT % sizeof(*p) == 0); + STATIC_ASSERT(MATCHFINDER_SIZE_ALIGNMENT % (4 * sizeof(*p)) == 0); + STATIC_ASSERT(sizeof(mf_pos_t) == 2); + + do { + p[0] = v; + p[1] = v; + p[2] = v; + p[3] = v; + p += 4; + size -= 4 * sizeof(*p); + } while (size != 0); +} +#define matchfinder_init matchfinder_init_avx2 + +static forceinline void +matchfinder_rebase_avx2(mf_pos_t *data, size_t size) +{ + __m256i *p = (__m256i *)data; + __m256i v = _mm256_set1_epi16((u16)-MATCHFINDER_WINDOW_SIZE); + + STATIC_ASSERT(MATCHFINDER_MEM_ALIGNMENT % sizeof(*p) == 0); + STATIC_ASSERT(MATCHFINDER_SIZE_ALIGNMENT % (4 * sizeof(*p)) == 0); + STATIC_ASSERT(sizeof(mf_pos_t) == 2); + + do { + /* PADDSW: Add Packed Signed Integers With Signed Saturation */ + p[0] = _mm256_adds_epi16(p[0], v); + p[1] = _mm256_adds_epi16(p[1], v); + p[2] = _mm256_adds_epi16(p[2], v); + p[3] = _mm256_adds_epi16(p[3], v); + p += 4; + size -= 4 * sizeof(*p); + } while (size != 0); +} +#define matchfinder_rebase matchfinder_rebase_avx2 + +#elif HAVE_SSE2_NATIVE +# include +static forceinline void +matchfinder_init_sse2(mf_pos_t *data, size_t size) +{ + __m128i *p = (__m128i *)data; + __m128i v = _mm_set1_epi16(MATCHFINDER_INITVAL); + + STATIC_ASSERT(MATCHFINDER_MEM_ALIGNMENT % sizeof(*p) == 0); + STATIC_ASSERT(MATCHFINDER_SIZE_ALIGNMENT % (4 * sizeof(*p)) == 0); + STATIC_ASSERT(sizeof(mf_pos_t) == 2); + + do { + p[0] = v; + p[1] = v; + p[2] = v; + p[3] = v; + p += 4; + size -= 4 * sizeof(*p); + } while (size != 0); +} +#define matchfinder_init matchfinder_init_sse2 + +static forceinline void +matchfinder_rebase_sse2(mf_pos_t *data, size_t size) +{ + __m128i *p = (__m128i *)data; + __m128i v = _mm_set1_epi16((u16)-MATCHFINDER_WINDOW_SIZE); + + STATIC_ASSERT(MATCHFINDER_MEM_ALIGNMENT % sizeof(*p) == 0); + STATIC_ASSERT(MATCHFINDER_SIZE_ALIGNMENT % (4 * sizeof(*p)) == 0); + STATIC_ASSERT(sizeof(mf_pos_t) == 2); + + do { + /* PADDSW: Add Packed Signed Integers With Signed Saturation */ + p[0] = _mm_adds_epi16(p[0], v); + p[1] = _mm_adds_epi16(p[1], v); + p[2] = _mm_adds_epi16(p[2], v); + p[3] = _mm_adds_epi16(p[3], v); + p += 4; + size -= 4 * sizeof(*p); + } while (size != 0); +} +#define matchfinder_rebase matchfinder_rebase_sse2 +#endif /* HAVE_SSE2_NATIVE */ + +#endif /* LIB_X86_MATCHFINDER_IMPL_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/zlib_compress.c b/tools/z64compress/src/enc/libdeflate/lib/zlib_compress.c new file mode 100644 index 000000000..4f9cc6f08 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/zlib_compress.c @@ -0,0 +1,84 @@ +/* + * zlib_compress.c - compress with a zlib wrapper + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "deflate_compress.h" +#include "zlib_constants.h" + +#include "libdeflate.h" + +LIBDEFLATEAPI size_t +libdeflate_zlib_compress(struct libdeflate_compressor *c, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail) +{ + u8 *out_next = out; + u16 hdr; + unsigned compression_level; + unsigned level_hint; + size_t deflate_size; + + if (out_nbytes_avail <= ZLIB_MIN_OVERHEAD) + return 0; + + /* 2 byte header: CMF and FLG */ + hdr = (ZLIB_CM_DEFLATE << 8) | (ZLIB_CINFO_32K_WINDOW << 12); + compression_level = libdeflate_get_compression_level(c); + if (compression_level < 2) + level_hint = ZLIB_FASTEST_COMPRESSION; + else if (compression_level < 6) + level_hint = ZLIB_FAST_COMPRESSION; + else if (compression_level < 8) + level_hint = ZLIB_DEFAULT_COMPRESSION; + else + level_hint = ZLIB_SLOWEST_COMPRESSION; + hdr |= level_hint << 6; + hdr |= 31 - (hdr % 31); + + put_unaligned_be16(hdr, out_next); + out_next += 2; + + /* Compressed data */ + deflate_size = libdeflate_deflate_compress(c, in, in_nbytes, out_next, + out_nbytes_avail - ZLIB_MIN_OVERHEAD); + if (deflate_size == 0) + return 0; + out_next += deflate_size; + + /* ADLER32 */ + put_unaligned_be32(libdeflate_adler32(1, in, in_nbytes), out_next); + out_next += 4; + + return out_next - (u8 *)out; +} + +LIBDEFLATEAPI size_t +libdeflate_zlib_compress_bound(struct libdeflate_compressor *c, + size_t in_nbytes) +{ + return ZLIB_MIN_OVERHEAD + + libdeflate_deflate_compress_bound(c, in_nbytes); +} diff --git a/tools/z64compress/src/enc/libdeflate/lib/zlib_constants.h b/tools/z64compress/src/enc/libdeflate/lib/zlib_constants.h new file mode 100644 index 000000000..f304310c7 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/zlib_constants.h @@ -0,0 +1,21 @@ +/* + * zlib_constants.h - constants for the zlib wrapper format + */ + +#ifndef LIB_ZLIB_CONSTANTS_H +#define LIB_ZLIB_CONSTANTS_H + +#define ZLIB_MIN_HEADER_SIZE 2 +#define ZLIB_FOOTER_SIZE 4 +#define ZLIB_MIN_OVERHEAD (ZLIB_MIN_HEADER_SIZE + ZLIB_FOOTER_SIZE) + +#define ZLIB_CM_DEFLATE 8 + +#define ZLIB_CINFO_32K_WINDOW 7 + +#define ZLIB_FASTEST_COMPRESSION 0 +#define ZLIB_FAST_COMPRESSION 1 +#define ZLIB_DEFAULT_COMPRESSION 2 +#define ZLIB_SLOWEST_COMPRESSION 3 + +#endif /* LIB_ZLIB_CONSTANTS_H */ diff --git a/tools/z64compress/src/enc/libdeflate/lib/zlib_decompress.c b/tools/z64compress/src/enc/libdeflate/lib/zlib_decompress.c new file mode 100644 index 000000000..b7b3b1f95 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/lib/zlib_decompress.c @@ -0,0 +1,106 @@ +/* + * zlib_decompress.c - decompress with a zlib wrapper + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "lib_common.h" +#include "zlib_constants.h" + +#include "libdeflate.h" + +LIBDEFLATEAPI enum libdeflate_result +libdeflate_zlib_decompress_ex(struct libdeflate_decompressor *d, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_in_nbytes_ret, + size_t *actual_out_nbytes_ret) +{ + const u8 *in_next = in; + const u8 * const in_end = in_next + in_nbytes; + u16 hdr; + size_t actual_in_nbytes; + size_t actual_out_nbytes; + enum libdeflate_result result; + + if (in_nbytes < ZLIB_MIN_OVERHEAD) + return LIBDEFLATE_BAD_DATA; + + /* 2 byte header: CMF and FLG */ + hdr = get_unaligned_be16(in_next); + in_next += 2; + + /* FCHECK */ + if ((hdr % 31) != 0) + return LIBDEFLATE_BAD_DATA; + + /* CM */ + if (((hdr >> 8) & 0xF) != ZLIB_CM_DEFLATE) + return LIBDEFLATE_BAD_DATA; + + /* CINFO */ + if ((hdr >> 12) > ZLIB_CINFO_32K_WINDOW) + return LIBDEFLATE_BAD_DATA; + + /* FDICT */ + if ((hdr >> 5) & 1) + return LIBDEFLATE_BAD_DATA; + + /* Compressed data */ + result = libdeflate_deflate_decompress_ex(d, in_next, + in_end - ZLIB_FOOTER_SIZE - in_next, + out, out_nbytes_avail, + &actual_in_nbytes, actual_out_nbytes_ret); + if (result != LIBDEFLATE_SUCCESS) + return result; + + if (actual_out_nbytes_ret) + actual_out_nbytes = *actual_out_nbytes_ret; + else + actual_out_nbytes = out_nbytes_avail; + + in_next += actual_in_nbytes; + + /* ADLER32 */ + if (libdeflate_adler32(1, out, actual_out_nbytes) != + get_unaligned_be32(in_next)) + return LIBDEFLATE_BAD_DATA; + in_next += 4; + + if (actual_in_nbytes_ret) + *actual_in_nbytes_ret = in_next - (u8 *)in; + + return LIBDEFLATE_SUCCESS; +} + +LIBDEFLATEAPI enum libdeflate_result +libdeflate_zlib_decompress(struct libdeflate_decompressor *d, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_out_nbytes_ret) +{ + return libdeflate_zlib_decompress_ex(d, in, in_nbytes, + out, out_nbytes_avail, + NULL, actual_out_nbytes_ret); +} diff --git a/tools/z64compress/src/enc/libdeflate/libdeflate-config.cmake.in b/tools/z64compress/src/enc/libdeflate/libdeflate-config.cmake.in new file mode 100644 index 000000000..747799df9 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/libdeflate-config.cmake.in @@ -0,0 +1,3 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/libdeflate-targets.cmake") diff --git a/tools/z64compress/src/enc/libdeflate/libdeflate.h b/tools/z64compress/src/enc/libdeflate/libdeflate.h new file mode 100644 index 000000000..f26087597 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/libdeflate.h @@ -0,0 +1,368 @@ +/* + * libdeflate.h - public header for libdeflate + */ + +#ifndef LIBDEFLATE_H +#define LIBDEFLATE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LIBDEFLATE_VERSION_MAJOR 1 +#define LIBDEFLATE_VERSION_MINOR 15 +#define LIBDEFLATE_VERSION_STRING "1.15" + +/* + * Users of libdeflate.dll on Windows can define LIBDEFLATE_DLL to cause + * __declspec(dllimport) to be used. This should be done when it's easy to do. + * Otherwise it's fine to skip it, since it is a very minor performance + * optimization that is irrelevant for most use cases of libdeflate. + */ +#ifndef LIBDEFLATEAPI +# if defined(LIBDEFLATE_DLL) && (defined(_WIN32) || defined(__CYGWIN__)) +# define LIBDEFLATEAPI __declspec(dllimport) +# else +# define LIBDEFLATEAPI +# endif +#endif + +/* ========================================================================== */ +/* Compression */ +/* ========================================================================== */ + +struct libdeflate_compressor; + +/* + * libdeflate_alloc_compressor() allocates a new compressor that supports + * DEFLATE, zlib, and gzip compression. 'compression_level' is the compression + * level on a zlib-like scale but with a higher maximum value (1 = fastest, 6 = + * medium/default, 9 = slow, 12 = slowest). Level 0 is also supported and means + * "no compression", specifically "create a valid stream, but only emit + * uncompressed blocks" (this will expand the data slightly). + * + * The return value is a pointer to the new compressor, or NULL if out of memory + * or if the compression level is invalid (i.e. outside the range [0, 12]). + * + * Note: for compression, the sliding window size is defined at compilation time + * to 32768, the largest size permissible in the DEFLATE format. It cannot be + * changed at runtime. + * + * A single compressor is not safe to use by multiple threads concurrently. + * However, different threads may use different compressors concurrently. + */ +LIBDEFLATEAPI struct libdeflate_compressor * +libdeflate_alloc_compressor(int compression_level); + +/* + * libdeflate_deflate_compress() performs raw DEFLATE compression on a buffer of + * data. It attempts to compress 'in_nbytes' bytes of data located at 'in' and + * write the result to 'out', which has space for 'out_nbytes_avail' bytes. The + * return value is the compressed size in bytes, or 0 if the data could not be + * compressed to 'out_nbytes_avail' bytes or fewer (but see note below). + * + * If compression is successful, then the output data is guaranteed to be a + * valid DEFLATE stream that decompresses to the input data. No other + * guarantees are made about the output data. Notably, different versions of + * libdeflate can produce different compressed data for the same uncompressed + * data, even at the same compression level. Do ***NOT*** do things like + * writing tests that compare compressed data to a golden output, as this can + * break when libdeflate is updated. (This property isn't specific to + * libdeflate; the same is true for zlib and other compression libraries too.) + * + * Note: due to a performance optimization, libdeflate_deflate_compress() + * currently needs a small amount of slack space at the end of the output + * buffer. As a result, it can't actually report compressed sizes very close to + * 'out_nbytes_avail'. This doesn't matter in real-world use cases, and + * libdeflate_deflate_compress_bound() already includes the slack space. + * However, it does mean that testing code that redundantly compresses data + * using an exact-sized output buffer won't work as might be expected: + * + * out_nbytes = libdeflate_deflate_compress(c, in, in_nbytes, out, + * libdeflate_deflate_compress_bound(in_nbytes)); + * // The following assertion will fail. + * assert(libdeflate_deflate_compress(c, in, in_nbytes, out, out_nbytes) != 0); + * + * To avoid this, either don't write tests like the above, or make sure to + * include at least 9 bytes of slack space in 'out_nbytes_avail'. + */ +LIBDEFLATEAPI size_t +libdeflate_deflate_compress(struct libdeflate_compressor *compressor, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail); + +/* + * libdeflate_deflate_compress_bound() returns a worst-case upper bound on the + * number of bytes of compressed data that may be produced by compressing any + * buffer of length less than or equal to 'in_nbytes' using + * libdeflate_deflate_compress() with the specified compressor. This bound will + * necessarily be a number greater than or equal to 'in_nbytes'. It may be an + * overestimate of the true upper bound. The return value is guaranteed to be + * the same for all invocations with the same compressor and same 'in_nbytes'. + * + * As a special case, 'compressor' may be NULL. This causes the bound to be + * taken across *any* libdeflate_compressor that could ever be allocated with + * this build of the library, with any options. + * + * Note that this function is not necessary in many applications. With + * block-based compression, it is usually preferable to separately store the + * uncompressed size of each block and to store any blocks that did not compress + * to less than their original size uncompressed. In that scenario, there is no + * need to know the worst-case compressed size, since the maximum number of + * bytes of compressed data that may be used would always be one less than the + * input length. You can just pass a buffer of that size to + * libdeflate_deflate_compress() and store the data uncompressed if + * libdeflate_deflate_compress() returns 0, indicating that the compressed data + * did not fit into the provided output buffer. + */ +LIBDEFLATEAPI size_t +libdeflate_deflate_compress_bound(struct libdeflate_compressor *compressor, + size_t in_nbytes); + +/* + * Like libdeflate_deflate_compress(), but uses the zlib wrapper format instead + * of raw DEFLATE. + */ +LIBDEFLATEAPI size_t +libdeflate_zlib_compress(struct libdeflate_compressor *compressor, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail); + +/* + * Like libdeflate_deflate_compress_bound(), but assumes the data will be + * compressed with libdeflate_zlib_compress() rather than with + * libdeflate_deflate_compress(). + */ +LIBDEFLATEAPI size_t +libdeflate_zlib_compress_bound(struct libdeflate_compressor *compressor, + size_t in_nbytes); + +/* + * Like libdeflate_deflate_compress(), but uses the gzip wrapper format instead + * of raw DEFLATE. + */ +LIBDEFLATEAPI size_t +libdeflate_gzip_compress(struct libdeflate_compressor *compressor, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail); + +/* + * Like libdeflate_deflate_compress_bound(), but assumes the data will be + * compressed with libdeflate_gzip_compress() rather than with + * libdeflate_deflate_compress(). + */ +LIBDEFLATEAPI size_t +libdeflate_gzip_compress_bound(struct libdeflate_compressor *compressor, + size_t in_nbytes); + +/* + * libdeflate_free_compressor() frees a compressor that was allocated with + * libdeflate_alloc_compressor(). If a NULL pointer is passed in, no action is + * taken. + */ +LIBDEFLATEAPI void +libdeflate_free_compressor(struct libdeflate_compressor *compressor); + +/* ========================================================================== */ +/* Decompression */ +/* ========================================================================== */ + +struct libdeflate_decompressor; + +/* + * libdeflate_alloc_decompressor() allocates a new decompressor that can be used + * for DEFLATE, zlib, and gzip decompression. The return value is a pointer to + * the new decompressor, or NULL if out of memory. + * + * This function takes no parameters, and the returned decompressor is valid for + * decompressing data that was compressed at any compression level and with any + * sliding window size. + * + * A single decompressor is not safe to use by multiple threads concurrently. + * However, different threads may use different decompressors concurrently. + */ +LIBDEFLATEAPI struct libdeflate_decompressor * +libdeflate_alloc_decompressor(void); + +/* + * Result of a call to libdeflate_deflate_decompress(), + * libdeflate_zlib_decompress(), or libdeflate_gzip_decompress(). + */ +enum libdeflate_result { + /* Decompression was successful. */ + LIBDEFLATE_SUCCESS = 0, + + /* Decompression failed because the compressed data was invalid, + * corrupt, or otherwise unsupported. */ + LIBDEFLATE_BAD_DATA = 1, + + /* A NULL 'actual_out_nbytes_ret' was provided, but the data would have + * decompressed to fewer than 'out_nbytes_avail' bytes. */ + LIBDEFLATE_SHORT_OUTPUT = 2, + + /* The data would have decompressed to more than 'out_nbytes_avail' + * bytes. */ + LIBDEFLATE_INSUFFICIENT_SPACE = 3, +}; + +/* + * libdeflate_deflate_decompress() decompresses a DEFLATE stream from the buffer + * 'in' with compressed size up to 'in_nbytes' bytes. The uncompressed data is + * written to 'out', a buffer with size 'out_nbytes_avail' bytes. If + * decompression succeeds, then 0 (LIBDEFLATE_SUCCESS) is returned. Otherwise, + * a nonzero result code such as LIBDEFLATE_BAD_DATA is returned, and the + * contents of the output buffer are undefined. + * + * Decompression stops at the end of the DEFLATE stream (as indicated by the + * BFINAL flag), even if it is actually shorter than 'in_nbytes' bytes. + * + * libdeflate_deflate_decompress() can be used in cases where the actual + * uncompressed size is known (recommended) or unknown (not recommended): + * + * - If the actual uncompressed size is known, then pass the actual + * uncompressed size as 'out_nbytes_avail' and pass NULL for + * 'actual_out_nbytes_ret'. This makes libdeflate_deflate_decompress() fail + * with LIBDEFLATE_SHORT_OUTPUT if the data decompressed to fewer than the + * specified number of bytes. + * + * - If the actual uncompressed size is unknown, then provide a non-NULL + * 'actual_out_nbytes_ret' and provide a buffer with some size + * 'out_nbytes_avail' that you think is large enough to hold all the + * uncompressed data. In this case, if the data decompresses to less than + * or equal to 'out_nbytes_avail' bytes, then + * libdeflate_deflate_decompress() will write the actual uncompressed size + * to *actual_out_nbytes_ret and return 0 (LIBDEFLATE_SUCCESS). Otherwise, + * it will return LIBDEFLATE_INSUFFICIENT_SPACE if the provided buffer was + * not large enough but no other problems were encountered, or another + * nonzero result code if decompression failed for another reason. + */ +LIBDEFLATEAPI enum libdeflate_result +libdeflate_deflate_decompress(struct libdeflate_decompressor *decompressor, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_out_nbytes_ret); + +/* + * Like libdeflate_deflate_decompress(), but adds the 'actual_in_nbytes_ret' + * argument. If decompression succeeds and 'actual_in_nbytes_ret' is not NULL, + * then the actual compressed size of the DEFLATE stream (aligned to the next + * byte boundary) is written to *actual_in_nbytes_ret. + */ +LIBDEFLATEAPI enum libdeflate_result +libdeflate_deflate_decompress_ex(struct libdeflate_decompressor *decompressor, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_in_nbytes_ret, + size_t *actual_out_nbytes_ret); + +/* + * Like libdeflate_deflate_decompress(), but assumes the zlib wrapper format + * instead of raw DEFLATE. + * + * Decompression will stop at the end of the zlib stream, even if it is shorter + * than 'in_nbytes'. If you need to know exactly where the zlib stream ended, + * use libdeflate_zlib_decompress_ex(). + */ +LIBDEFLATEAPI enum libdeflate_result +libdeflate_zlib_decompress(struct libdeflate_decompressor *decompressor, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_out_nbytes_ret); + +/* + * Like libdeflate_zlib_decompress(), but adds the 'actual_in_nbytes_ret' + * argument. If 'actual_in_nbytes_ret' is not NULL and the decompression + * succeeds (indicating that the first zlib-compressed stream in the input + * buffer was decompressed), then the actual number of input bytes consumed is + * written to *actual_in_nbytes_ret. + */ +LIBDEFLATEAPI enum libdeflate_result +libdeflate_zlib_decompress_ex(struct libdeflate_decompressor *decompressor, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_in_nbytes_ret, + size_t *actual_out_nbytes_ret); + +/* + * Like libdeflate_deflate_decompress(), but assumes the gzip wrapper format + * instead of raw DEFLATE. + * + * If multiple gzip-compressed members are concatenated, then only the first + * will be decompressed. Use libdeflate_gzip_decompress_ex() if you need + * multi-member support. + */ +LIBDEFLATEAPI enum libdeflate_result +libdeflate_gzip_decompress(struct libdeflate_decompressor *decompressor, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_out_nbytes_ret); + +/* + * Like libdeflate_gzip_decompress(), but adds the 'actual_in_nbytes_ret' + * argument. If 'actual_in_nbytes_ret' is not NULL and the decompression + * succeeds (indicating that the first gzip-compressed member in the input + * buffer was decompressed), then the actual number of input bytes consumed is + * written to *actual_in_nbytes_ret. + */ +LIBDEFLATEAPI enum libdeflate_result +libdeflate_gzip_decompress_ex(struct libdeflate_decompressor *decompressor, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_in_nbytes_ret, + size_t *actual_out_nbytes_ret); + +/* + * libdeflate_free_decompressor() frees a decompressor that was allocated with + * libdeflate_alloc_decompressor(). If a NULL pointer is passed in, no action + * is taken. + */ +LIBDEFLATEAPI void +libdeflate_free_decompressor(struct libdeflate_decompressor *decompressor); + +/* ========================================================================== */ +/* Checksums */ +/* ========================================================================== */ + +/* + * libdeflate_adler32() updates a running Adler-32 checksum with 'len' bytes of + * data and returns the updated checksum. When starting a new checksum, the + * required initial value for 'adler' is 1. This value is also returned when + * 'buffer' is specified as NULL. + */ +LIBDEFLATEAPI uint32_t +libdeflate_adler32(uint32_t adler, const void *buffer, size_t len); + + +/* + * libdeflate_crc32() updates a running CRC-32 checksum with 'len' bytes of data + * and returns the updated checksum. When starting a new checksum, the required + * initial value for 'crc' is 0. This value is also returned when 'buffer' is + * specified as NULL. + */ +LIBDEFLATEAPI uint32_t +libdeflate_crc32(uint32_t crc, const void *buffer, size_t len); + +/* ========================================================================== */ +/* Custom memory allocator */ +/* ========================================================================== */ + +/* + * Install a custom memory allocator which libdeflate will use for all memory + * allocations. 'malloc_func' is a function that must behave like malloc(), and + * 'free_func' is a function that must behave like free(). + * + * There must not be any libdeflate_compressor or libdeflate_decompressor + * structures in existence when calling this function. + */ +LIBDEFLATEAPI void +libdeflate_set_memory_allocator(void *(*malloc_func)(size_t), + void (*free_func)(void *)); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBDEFLATE_H */ diff --git a/tools/z64compress/src/enc/libdeflate/libdeflate.pc.in b/tools/z64compress/src/enc/libdeflate/libdeflate.pc.in new file mode 100644 index 000000000..b8ced3c69 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/libdeflate.pc.in @@ -0,0 +1,18 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +includedir=@CMAKE_PKGCONFIG_INCLUDEDIR@ +libdir=@CMAKE_PKGCONFIG_LIBDIR@ + +Name: libdeflate +Description: Fast implementation of DEFLATE, zlib, and gzip +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -ldeflate +Cflags: -I${includedir} + +# Note: this library's public header allows LIBDEFLATE_DLL to be defined when +# linking to the DLL on Windows, to make __declspec(dllimport) be used. +# However, the only way to define a shared-library-only flag in a pkgconfig file +# is to use the weird workaround of unconditionally defining it in Cflags, then +# undefining it in Cflags.private. Just don't bother with this, since +# __declspec(dllimport) is optional anyway. It is a very minor performance +# optimization that is irrelevant for most use cases of libdeflate. diff --git a/tools/z64compress/src/enc/libdeflate/programs/benchmark.c b/tools/z64compress/src/enc/libdeflate/programs/benchmark.c new file mode 100644 index 000000000..52af8dafc --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/benchmark.c @@ -0,0 +1,696 @@ +/* + * benchmark.c - a compression testing and benchmark program + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "test_util.h" + +static const tchar *const optstring = T("0::1::2::3::4::5::6::7::8::9::C:D:eghs:VYZz"); + +enum format { + DEFLATE_FORMAT, + ZLIB_FORMAT, + GZIP_FORMAT, +}; + +struct compressor { + int level; + enum format format; + const struct engine *engine; + void *private; +}; + +struct decompressor { + enum format format; + const struct engine *engine; + void *private; +}; + +struct engine { + const tchar *name; + + bool (*init_compressor)(struct compressor *); + size_t (*compress_bound)(struct compressor *, size_t); + size_t (*compress)(struct compressor *, const void *, size_t, + void *, size_t); + void (*destroy_compressor)(struct compressor *); + + bool (*init_decompressor)(struct decompressor *); + bool (*decompress)(struct decompressor *, const void *, size_t, + void *, size_t); + void (*destroy_decompressor)(struct decompressor *); +}; + +/******************************************************************************/ + +static bool +libdeflate_engine_init_compressor(struct compressor *c) +{ + c->private = alloc_compressor(c->level); + return c->private != NULL; +} + +static size_t +libdeflate_engine_compress_bound(struct compressor *c, size_t in_nbytes) +{ + switch (c->format) { + case ZLIB_FORMAT: + return libdeflate_zlib_compress_bound(c->private, in_nbytes); + case GZIP_FORMAT: + return libdeflate_gzip_compress_bound(c->private, in_nbytes); + default: + return libdeflate_deflate_compress_bound(c->private, in_nbytes); + } +} + +static size_t +libdeflate_engine_compress(struct compressor *c, const void *in, + size_t in_nbytes, void *out, size_t out_nbytes_avail) +{ + switch (c->format) { + case ZLIB_FORMAT: + return libdeflate_zlib_compress(c->private, in, in_nbytes, + out, out_nbytes_avail); + case GZIP_FORMAT: + return libdeflate_gzip_compress(c->private, in, in_nbytes, + out, out_nbytes_avail); + default: + return libdeflate_deflate_compress(c->private, in, in_nbytes, + out, out_nbytes_avail); + } +} + +static void +libdeflate_engine_destroy_compressor(struct compressor *c) +{ + libdeflate_free_compressor(c->private); +} + +static bool +libdeflate_engine_init_decompressor(struct decompressor *d) +{ + d->private = alloc_decompressor(); + return d->private != NULL; +} + +static bool +libdeflate_engine_decompress(struct decompressor *d, const void *in, + size_t in_nbytes, void *out, size_t out_nbytes) +{ + switch (d->format) { + case ZLIB_FORMAT: + return !libdeflate_zlib_decompress(d->private, in, in_nbytes, + out, out_nbytes, NULL); + case GZIP_FORMAT: + return !libdeflate_gzip_decompress(d->private, in, in_nbytes, + out, out_nbytes, NULL); + default: + return !libdeflate_deflate_decompress(d->private, in, in_nbytes, + out, out_nbytes, NULL); + } +} + +static void +libdeflate_engine_destroy_decompressor(struct decompressor *d) +{ + libdeflate_free_decompressor(d->private); +} + +static const struct engine libdeflate_engine = { + .name = T("libdeflate"), + + .init_compressor = libdeflate_engine_init_compressor, + .compress_bound = libdeflate_engine_compress_bound, + .compress = libdeflate_engine_compress, + .destroy_compressor = libdeflate_engine_destroy_compressor, + + .init_decompressor = libdeflate_engine_init_decompressor, + .decompress = libdeflate_engine_decompress, + .destroy_decompressor = libdeflate_engine_destroy_decompressor, +}; + +/******************************************************************************/ + +static int +get_libz_window_bits(enum format format) +{ + const int windowBits = 15; + switch (format) { + case ZLIB_FORMAT: + return windowBits; + case GZIP_FORMAT: + return windowBits + 16; + default: + return -windowBits; + } +} + +static bool +libz_engine_init_compressor(struct compressor *c) +{ + z_stream *z; + + if (c->level > 9) { + msg("libz only supports up to compression level 9"); + return false; + } + + z = xmalloc(sizeof(*z)); + if (z == NULL) + return false; + + z->next_in = NULL; + z->avail_in = 0; + z->zalloc = NULL; + z->zfree = NULL; + z->opaque = NULL; + if (deflateInit2(z, c->level, Z_DEFLATED, + get_libz_window_bits(c->format), + 8, Z_DEFAULT_STRATEGY) != Z_OK) + { + msg("unable to initialize deflater"); + free(z); + return false; + } + + c->private = z; + return true; +} + +static size_t +libz_engine_compress_bound(struct compressor *c, size_t in_nbytes) +{ + return deflateBound(c->private, in_nbytes); +} + +static size_t +libz_engine_compress(struct compressor *c, const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail) +{ + z_stream *z = c->private; + + deflateReset(z); + + z->next_in = (void *)in; + z->avail_in = in_nbytes; + z->next_out = out; + z->avail_out = out_nbytes_avail; + + if (deflate(z, Z_FINISH) != Z_STREAM_END) + return 0; + + return out_nbytes_avail - z->avail_out; +} + +static void +libz_engine_destroy_compressor(struct compressor *c) +{ + z_stream *z = c->private; + + deflateEnd(z); + free(z); +} + +static bool +libz_engine_init_decompressor(struct decompressor *d) +{ + z_stream *z; + + z = xmalloc(sizeof(*z)); + if (z == NULL) + return false; + + z->next_in = NULL; + z->avail_in = 0; + z->zalloc = NULL; + z->zfree = NULL; + z->opaque = NULL; + if (inflateInit2(z, get_libz_window_bits(d->format)) != Z_OK) { + msg("unable to initialize inflater"); + free(z); + return false; + } + + d->private = z; + return true; +} + +static bool +libz_engine_decompress(struct decompressor *d, const void *in, size_t in_nbytes, + void *out, size_t out_nbytes) +{ + z_stream *z = d->private; + + inflateReset(z); + + z->next_in = (void *)in; + z->avail_in = in_nbytes; + z->next_out = out; + z->avail_out = out_nbytes; + + return inflate(z, Z_FINISH) == Z_STREAM_END && z->avail_out == 0; +} + +static void +libz_engine_destroy_decompressor(struct decompressor *d) +{ + z_stream *z = d->private; + + inflateEnd(z); + free(z); +} + +static const struct engine libz_engine = { + .name = T("libz"), + + .init_compressor = libz_engine_init_compressor, + .compress_bound = libz_engine_compress_bound, + .compress = libz_engine_compress, + .destroy_compressor = libz_engine_destroy_compressor, + + .init_decompressor = libz_engine_init_decompressor, + .decompress = libz_engine_decompress, + .destroy_decompressor = libz_engine_destroy_decompressor, +}; + +/******************************************************************************/ + +static const struct engine * const all_engines[] = { + &libdeflate_engine, + &libz_engine, +}; + +#define DEFAULT_ENGINE libdeflate_engine + +static const struct engine * +name_to_engine(const tchar *name) +{ + size_t i; + + for (i = 0; i < ARRAY_LEN(all_engines); i++) + if (tstrcmp(all_engines[i]->name, name) == 0) + return all_engines[i]; + return NULL; +} + +/******************************************************************************/ + +static bool +compressor_init(struct compressor *c, int level, enum format format, + const struct engine *engine) +{ + c->level = level; + c->format = format; + c->engine = engine; + return engine->init_compressor(c); +} + +static size_t +compress_bound(struct compressor *c, size_t in_nbytes) +{ + return c->engine->compress_bound(c, in_nbytes); +} + +static size_t +do_compress(struct compressor *c, const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail) +{ + return c->engine->compress(c, in, in_nbytes, out, out_nbytes_avail); +} + +static void +compressor_destroy(struct compressor *c) +{ + if (c->engine != NULL) + c->engine->destroy_compressor(c); +} + +static bool +decompressor_init(struct decompressor *d, enum format format, + const struct engine *engine) +{ + d->format = format; + d->engine = engine; + return engine->init_decompressor(d); +} + +static bool +do_decompress(struct decompressor *d, const void *in, size_t in_nbytes, + void *out, size_t out_nbytes) +{ + return d->engine->decompress(d, in, in_nbytes, out, out_nbytes); +} + +static void +decompressor_destroy(struct decompressor *d) +{ + if (d->engine != NULL) + d->engine->destroy_decompressor(d); +} + +/******************************************************************************/ + +static void +show_available_engines(FILE *fp) +{ + size_t i; + + fprintf(fp, "Available ENGINEs are: "); + for (i = 0; i < ARRAY_LEN(all_engines); i++) { + fprintf(fp, "%"TS, all_engines[i]->name); + if (i < ARRAY_LEN(all_engines) - 1) + fprintf(fp, ", "); + } + fprintf(fp, ". Default is %"TS"\n", DEFAULT_ENGINE.name); +} + +static void +show_usage(FILE *fp) +{ + fprintf(fp, +"Usage: %"TS" [-LVL] [-C ENGINE] [-D ENGINE] [-ghVz] [-s SIZE] [FILE]...\n" +"Benchmark DEFLATE compression and decompression on the specified FILEs.\n" +"\n" +"Options:\n" +" -0 no compression\n" +" -1 fastest (worst) compression\n" +" -6 medium compression (default)\n" +" -12 slowest (best) compression\n" +" -C ENGINE compression engine\n" +" -D ENGINE decompression engine\n" +" -e allow chunks to be expanded (implied by -0)\n" +" -g use gzip format instead of raw DEFLATE\n" +" -h print this help\n" +" -s SIZE chunk size\n" +" -V show version and legal information\n" +" -z use zlib format instead of raw DEFLATE\n" +"\n", prog_invocation_name); + + show_available_engines(fp); +} + +static void +show_version(void) +{ + printf( +"libdeflate compression benchmark program v" LIBDEFLATE_VERSION_STRING "\n" +"Copyright 2016 Eric Biggers\n" +"\n" +"This program is free software which may be modified and/or redistributed\n" +"under the terms of the MIT license. There is NO WARRANTY, to the extent\n" +"permitted by law. See the COPYING file for details.\n" + ); +} + + +/******************************************************************************/ + +static int +do_benchmark(struct file_stream *in, void *original_buf, void *compressed_buf, + void *decompressed_buf, u32 chunk_size, + bool allow_expansion, size_t compressed_buf_size, + struct compressor *compressor, + struct decompressor *decompressor) +{ + u64 total_uncompressed_size = 0; + u64 total_compressed_size = 0; + u64 total_compress_time = 0; + u64 total_decompress_time = 0; + ssize_t ret; + + while ((ret = xread(in, original_buf, chunk_size)) > 0) { + u32 original_size = ret; + size_t out_nbytes_avail; + u32 compressed_size; + u64 start_time; + bool ok; + + total_uncompressed_size += original_size; + + if (allow_expansion) { + out_nbytes_avail = compress_bound(compressor, + original_size); + if (out_nbytes_avail > compressed_buf_size) { + msg("%"TS": bug in compress_bound()", in->name); + return -1; + } + } else { + out_nbytes_avail = original_size - 1; + } + + /* Compress the chunk of data. */ + start_time = timer_ticks(); + compressed_size = do_compress(compressor, + original_buf, + original_size, + compressed_buf, + out_nbytes_avail); + total_compress_time += timer_ticks() - start_time; + + if (compressed_size) { + /* Successfully compressed the chunk of data. */ + + /* Decompress the data we just compressed and compare + * the result with the original. */ + start_time = timer_ticks(); + ok = do_decompress(decompressor, + compressed_buf, compressed_size, + decompressed_buf, original_size); + total_decompress_time += timer_ticks() - start_time; + + if (!ok) { + msg("%"TS": failed to decompress data", + in->name); + return -1; + } + + if (memcmp(original_buf, decompressed_buf, + original_size) != 0) + { + msg("%"TS": data did not decompress to " + "original", in->name); + return -1; + } + + total_compressed_size += compressed_size; + } else { + /* + * The chunk would have compressed to more than + * out_nbytes_avail bytes. + */ + if (allow_expansion) { + msg("%"TS": bug in compress_bound()", in->name); + return -1; + } + total_compressed_size += original_size; + } + } + + if (ret < 0) + return ret; + + if (total_uncompressed_size == 0) { + printf("\tFile was empty.\n"); + return 0; + } + + if (total_compress_time == 0) + total_compress_time = 1; + if (total_decompress_time == 0) + total_decompress_time = 1; + + printf("\tCompressed %"PRIu64 " => %"PRIu64" bytes (%u.%03u%%)\n", + total_uncompressed_size, total_compressed_size, + (unsigned int)(total_compressed_size * 100 / + total_uncompressed_size), + (unsigned int)(total_compressed_size * 100000 / + total_uncompressed_size % 1000)); + printf("\tCompression time: %"PRIu64" ms (%"PRIu64" MB/s)\n", + timer_ticks_to_ms(total_compress_time), + timer_MB_per_s(total_uncompressed_size, total_compress_time)); + printf("\tDecompression time: %"PRIu64" ms (%"PRIu64" MB/s)\n", + timer_ticks_to_ms(total_decompress_time), + timer_MB_per_s(total_uncompressed_size, total_decompress_time)); + + return 0; +} + +int +tmain(int argc, tchar *argv[]) +{ + u32 chunk_size = 1048576; + int level = 6; + enum format format = DEFLATE_FORMAT; + const struct engine *compress_engine = &DEFAULT_ENGINE; + const struct engine *decompress_engine = &DEFAULT_ENGINE; + bool allow_expansion = false; + struct compressor compressor = { 0 }; + struct decompressor decompressor = { 0 }; + size_t compressed_buf_size; + void *original_buf = NULL; + void *compressed_buf = NULL; + void *decompressed_buf = NULL; + tchar *default_file_list[] = { NULL }; + int opt_char; + int i; + int ret; + + begin_program(argv); + + while ((opt_char = tgetopt(argc, argv, optstring)) != -1) { + switch (opt_char) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + level = parse_compression_level(opt_char, toptarg); + if (level < 0) + return 1; + break; + case 'C': + compress_engine = name_to_engine(toptarg); + if (compress_engine == NULL) { + msg("invalid compression engine: \"%"TS"\"", toptarg); + show_available_engines(stderr); + return 1; + } + break; + case 'D': + decompress_engine = name_to_engine(toptarg); + if (decompress_engine == NULL) { + msg("invalid decompression engine: \"%"TS"\"", toptarg); + show_available_engines(stderr); + return 1; + } + break; + case 'e': + allow_expansion = true; + break; + case 'g': + format = GZIP_FORMAT; + break; + case 'h': + show_usage(stdout); + return 0; + case 's': + chunk_size = tstrtoul(toptarg, NULL, 10); + if (chunk_size == 0) { + msg("invalid chunk size: \"%"TS"\"", toptarg); + return 1; + } + break; + case 'V': + show_version(); + return 0; + case 'Y': /* deprecated, use '-C libz' instead */ + compress_engine = &libz_engine; + break; + case 'Z': /* deprecated, use '-D libz' instead */ + decompress_engine = &libz_engine; + break; + case 'z': + format = ZLIB_FORMAT; + break; + default: + show_usage(stderr); + return 1; + } + } + + argc -= toptind; + argv += toptind; + + if (level == 0) + allow_expansion = true; + + ret = -1; + if (!compressor_init(&compressor, level, format, compress_engine)) + goto out; + if (!decompressor_init(&decompressor, format, decompress_engine)) + goto out; + + if (allow_expansion) + compressed_buf_size = compress_bound(&compressor, chunk_size); + else + compressed_buf_size = chunk_size - 1; + + original_buf = xmalloc(chunk_size); + compressed_buf = xmalloc(compressed_buf_size); + decompressed_buf = xmalloc(chunk_size); + + ret = -1; + if (original_buf == NULL || compressed_buf == NULL || + decompressed_buf == NULL) + goto out; + + if (argc == 0) { + argv = default_file_list; + argc = ARRAY_LEN(default_file_list); + } else { + for (i = 0; i < argc; i++) + if (argv[i][0] == '-' && argv[i][1] == '\0') + argv[i] = NULL; + } + + printf("Benchmarking %s compression:\n", + format == DEFLATE_FORMAT ? "DEFLATE" : + format == ZLIB_FORMAT ? "zlib" : "gzip"); + printf("\tCompression level: %d\n", level); + printf("\tChunk size: %"PRIu32"\n", chunk_size); + printf("\tCompression engine: %"TS"\n", compress_engine->name); + printf("\tDecompression engine: %"TS"\n", decompress_engine->name); + + for (i = 0; i < argc; i++) { + struct file_stream in; + + ret = xopen_for_read(argv[i], true, &in); + if (ret != 0) + goto out; + + printf("Processing %"TS"...\n", in.name); + + ret = do_benchmark(&in, original_buf, compressed_buf, + decompressed_buf, chunk_size, + allow_expansion, compressed_buf_size, + &compressor, &decompressor); + xclose(&in); + if (ret != 0) + goto out; + } + ret = 0; +out: + free(decompressed_buf); + free(compressed_buf); + free(original_buf); + decompressor_destroy(&decompressor); + compressor_destroy(&compressor); + return -ret; +} diff --git a/tools/z64compress/src/enc/libdeflate/programs/checksum.c b/tools/z64compress/src/enc/libdeflate/programs/checksum.c new file mode 100644 index 000000000..68cd43c91 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/checksum.c @@ -0,0 +1,218 @@ +/* + * checksum.c - Adler-32 and CRC-32 checksumming program + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "test_util.h" + +static const tchar *const optstring = T("Ahm:s:tZ"); + +static void +show_usage(FILE *fp) +{ + fprintf(fp, +"Usage: %"TS" [-A] [-h] [-m ALIGN] [-s SIZE] [-t] [-Z] [FILE]...\n" +"Calculate Adler-32 or CRC-32 checksums of the specified FILEs.\n" +"\n" +"Options:\n" +" -A use Adler-32 (default is CRC-32)\n" +" -h print this help\n" +" -m ALIGN misalign the buffer by ALIGN bytes\n" +" -s SIZE chunk size in bytes\n" +" -t show checksum speed, excluding I/O\n" +" -Z use zlib implementation instead of libdeflate\n", + prog_invocation_name); +} + +typedef u32 (*cksum_fn_t)(u32, const void *, size_t); + +static u32 +adler32_libdeflate(u32 adler, const void *buf, size_t len) +{ + return libdeflate_adler32(adler, buf, len); +} + +static u32 +crc32_libdeflate(u32 crc, const void *buf, size_t len) +{ + return libdeflate_crc32(crc, buf, len); +} + +static u32 +adler32_zlib(u32 adler, const void *buf, size_t len) +{ + return adler32(adler, buf, len); +} + +static u32 +crc32_zlib(u32 crc, const void *buf, size_t len) +{ + return crc32(crc, buf, len); +} + +static int +checksum_stream(struct file_stream *in, cksum_fn_t cksum, u32 *sum, + void *buf, size_t bufsize, u64 *size_ret, u64 *elapsed_ret) +{ + u64 size = 0; + u64 elapsed = 0; + + for (;;) { + ssize_t ret; + u64 start_time; + + ret = xread(in, buf, bufsize); + if (ret < 0) + return ret; + if (ret == 0) + break; + + size += ret; + start_time = timer_ticks(); + *sum = cksum(*sum, buf, ret); + elapsed += timer_ticks() - start_time; + } + + if (elapsed == 0) + elapsed = 1; + *size_ret = size; + *elapsed_ret = elapsed; + return 0; +} + +int +tmain(int argc, tchar *argv[]) +{ + bool use_adler32 = false; + bool use_zlib_impl = false; + bool do_timing = false; + void *orig_buf = NULL; + void *buf; + size_t misalignment = 0; + size_t bufsize = 131072; + tchar *default_file_list[] = { NULL }; + cksum_fn_t cksum; + int opt_char; + int i; + int ret; + + begin_program(argv); + + while ((opt_char = tgetopt(argc, argv, optstring)) != -1) { + switch (opt_char) { + case 'A': + use_adler32 = true; + break; + case 'h': + show_usage(stdout); + return 0; + case 'm': + misalignment = tstrtoul(toptarg, NULL, 10); + if (misalignment >= 4096) { + msg("invalid misalignment: \"%"TS"\"", toptarg); + return 1; + } + break; + case 's': + bufsize = tstrtoul(toptarg, NULL, 10); + if (bufsize == 0 || bufsize > SIZE_MAX / 2) { + msg("invalid chunk size: \"%"TS"\"", toptarg); + return 1; + } + break; + case 't': + do_timing = true; + break; + case 'Z': + use_zlib_impl = true; + break; + default: + show_usage(stderr); + return 1; + } + } + + argc -= toptind; + argv += toptind; + + if (use_adler32) { + if (use_zlib_impl) + cksum = adler32_zlib; + else + cksum = adler32_libdeflate; + } else { + if (use_zlib_impl) + cksum = crc32_zlib; + else + cksum = crc32_libdeflate; + } + + orig_buf = xmalloc(bufsize + 4096 + misalignment); + if (orig_buf == NULL) + return 1; + buf = (u8 *)orig_buf + (-(uintptr_t)orig_buf % 4096) + misalignment; + + if (argc == 0) { + argv = default_file_list; + argc = ARRAY_LEN(default_file_list); + } else { + for (i = 0; i < argc; i++) + if (argv[i][0] == '-' && argv[i][1] == '\0') + argv[i] = NULL; + } + + for (i = 0; i < argc; i++) { + struct file_stream in; + u32 sum = cksum(0, NULL, 0); + u64 size = 0; + u64 elapsed = 0; + + ret = xopen_for_read(argv[i], true, &in); + if (ret != 0) + goto out; + + ret = checksum_stream(&in, cksum, &sum, buf, bufsize, + &size, &elapsed); + if (ret == 0) { + if (do_timing) { + printf("%08"PRIx32"\t%"TS"\t" + "%"PRIu64" ms\t%"PRIu64" MB/s\n", + sum, in.name, timer_ticks_to_ms(elapsed), + timer_MB_per_s(size, elapsed)); + } else { + printf("%08"PRIx32"\t%"TS"\t\n", sum, in.name); + } + } + + xclose(&in); + + if (ret != 0) + goto out; + } + ret = 0; +out: + free(orig_buf); + return -ret; +} diff --git a/tools/z64compress/src/enc/libdeflate/programs/config.h.in b/tools/z64compress/src/enc/libdeflate/programs/config.h.in new file mode 100644 index 000000000..588aa8dca --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/config.h.in @@ -0,0 +1,22 @@ +#ifndef CONFIG_H +#define CONFIG_H + +/* Is the clock_gettime() function available? */ +#cmakedefine HAVE_CLOCK_GETTIME + +/* Is the futimens() function available? */ +#cmakedefine HAVE_FUTIMENS + +/* Is the futimes() function available? */ +#cmakedefine HAVE_FUTIMES + +/* Is the posix_fadvise() function available? */ +#cmakedefine HAVE_POSIX_FADVISE + +/* Is the posix_madvise() function available? */ +#cmakedefine HAVE_POSIX_MADVISE + +/* Does stat() provide nanosecond-precision timestamps? */ +#cmakedefine HAVE_STAT_NANOSECOND_PRECISION + +#endif /* CONFIG_H */ diff --git a/tools/z64compress/src/enc/libdeflate/programs/gzip.c b/tools/z64compress/src/enc/libdeflate/programs/gzip.c new file mode 100644 index 000000000..c13474af5 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/gzip.c @@ -0,0 +1,701 @@ +/* + * gzip.c - a file compression and decompression program + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __sun +# define __EXTENSIONS__ /* for futimens() */ +#endif + +#include "prog_util.h" + +#include +#include +#include +#ifdef _WIN32 +# include +#else +# include +# include +# include +#endif + +#define GZIP_MIN_HEADER_SIZE 10 +#define GZIP_FOOTER_SIZE 8 +#define GZIP_MIN_OVERHEAD (GZIP_MIN_HEADER_SIZE + GZIP_FOOTER_SIZE) +#define GZIP_ID1 0x1F +#define GZIP_ID2 0x8B + +struct options { + bool to_stdout; + bool decompress; + bool force; + bool keep; + bool test; + int compression_level; + const tchar *suffix; +}; + +static const tchar *const optstring = T("1::2::3::4::5::6::7::8::9::cdfhknqS:tV"); + +static void +show_usage(FILE *fp) +{ + fprintf(fp, +"Usage: %"TS" [-LEVEL] [-cdfhkqtV] [-S SUF] FILE...\n" +"Compress or decompress the specified FILEs.\n" +"\n" +"Options:\n" +" -1 fastest (worst) compression\n" +" -6 medium compression (default)\n" +" -12 slowest (best) compression\n" +" -c write to standard output\n" +" -d decompress\n" +" -f overwrite existing output files; (de)compress hard-linked files;\n" +" allow reading/writing compressed data from/to terminal;\n" +" with gunzip -c, pass through non-gzipped data\n" +" -h print this help\n" +" -k don't delete input files\n" +" -q suppress warnings\n" +" -S SUF use suffix SUF instead of .gz\n" +" -t test file integrity\n" +" -V show version and legal information\n", + prog_invocation_name); +} + +static void +show_version(void) +{ + printf( +"gzip compression program v" LIBDEFLATE_VERSION_STRING "\n" +"Copyright 2016 Eric Biggers\n" +"\n" +"This program is free software which may be modified and/or redistributed\n" +"under the terms of the MIT license. There is NO WARRANTY, to the extent\n" +"permitted by law. See the COPYING file for details.\n" + ); +} + +/* Was the program invoked in decompression mode? */ +static bool +is_gunzip(void) +{ + if (tstrxcmp(prog_invocation_name, T("gunzip")) == 0) + return true; + if (tstrxcmp(prog_invocation_name, T("libdeflate-gunzip")) == 0) + return true; +#ifdef _WIN32 + if (tstrxcmp(prog_invocation_name, T("gunzip.exe")) == 0) + return true; + if (tstrxcmp(prog_invocation_name, T("libdeflate-gunzip.exe")) == 0) + return true; +#endif + return false; +} + +static const tchar * +get_suffix(const tchar *path, const tchar *suffix) +{ + size_t path_len = tstrlen(path); + size_t suffix_len = tstrlen(suffix); + const tchar *p; + + if (path_len <= suffix_len) + return NULL; + p = &path[path_len - suffix_len]; + if (tstrxcmp(p, suffix) == 0) + return p; + return NULL; +} + +static bool +has_suffix(const tchar *path, const tchar *suffix) +{ + return get_suffix(path, suffix) != NULL; +} + +static tchar * +append_suffix(const tchar *path, const tchar *suffix) +{ + size_t path_len = tstrlen(path); + size_t suffix_len = tstrlen(suffix); + tchar *suffixed_path; + + suffixed_path = xmalloc((path_len + suffix_len + 1) * sizeof(tchar)); + if (suffixed_path == NULL) + return NULL; + tmemcpy(suffixed_path, path, path_len); + tmemcpy(&suffixed_path[path_len], suffix, suffix_len + 1); + return suffixed_path; +} + +static int +do_compress(struct libdeflate_compressor *compressor, + struct file_stream *in, struct file_stream *out) +{ + const void *uncompressed_data = in->mmap_mem; + size_t uncompressed_size = in->mmap_size; + void *compressed_data; + size_t actual_compressed_size; + size_t max_compressed_size; + int ret; + + max_compressed_size = libdeflate_gzip_compress_bound(compressor, + uncompressed_size); + compressed_data = xmalloc(max_compressed_size); + if (compressed_data == NULL) { + msg("%"TS": file is probably too large to be processed by this " + "program", in->name); + ret = -1; + goto out; + } + + actual_compressed_size = libdeflate_gzip_compress(compressor, + uncompressed_data, + uncompressed_size, + compressed_data, + max_compressed_size); + if (actual_compressed_size == 0) { + msg("Bug in libdeflate_gzip_compress_bound()!"); + ret = -1; + goto out; + } + + ret = full_write(out, compressed_data, actual_compressed_size); +out: + free(compressed_data); + return ret; +} + +static int +do_decompress(struct libdeflate_decompressor *decompressor, + struct file_stream *in, struct file_stream *out, + const struct options *options) +{ + const u8 *compressed_data = in->mmap_mem; + size_t compressed_size = in->mmap_size; + void *uncompressed_data = NULL; + size_t uncompressed_size; + size_t max_uncompressed_size; + size_t actual_in_nbytes; + size_t actual_out_nbytes; + enum libdeflate_result result; + int ret = 0; + + if (compressed_size < GZIP_MIN_OVERHEAD || + compressed_data[0] != GZIP_ID1 || + compressed_data[1] != GZIP_ID2) { + if (options->force && options->to_stdout) + return full_write(out, compressed_data, compressed_size); + msg("%"TS": not in gzip format", in->name); + return -1; + } + + /* + * Use the ISIZE field as a hint for the decompressed data size. It may + * need to be increased later, however, because the file may contain + * multiple gzip members and the particular ISIZE we happen to use may + * not be the largest; or the real size may be >= 4 GiB, causing ISIZE + * to overflow. In any case, make sure to allocate at least one byte. + */ + uncompressed_size = + get_unaligned_le32(&compressed_data[compressed_size - 4]); + if (uncompressed_size == 0) + uncompressed_size = 1; + + /* + * DEFLATE cannot expand data more than 1032x, so there's no need to + * ever allocate a buffer more than 1032 times larger than the + * compressed data. This is a fail-safe, albeit not a very good one, if + * ISIZE becomes corrupted on a small file. (The 1032x number comes + * from each 2 bits generating a 258-byte match. This is a hard upper + * bound; the real upper bound is slightly smaller due to overhead.) + */ + if (compressed_size <= SIZE_MAX / 1032) + max_uncompressed_size = compressed_size * 1032; + else + max_uncompressed_size = SIZE_MAX; + + do { + if (uncompressed_data == NULL) { + uncompressed_size = MIN(uncompressed_size, + max_uncompressed_size); + uncompressed_data = xmalloc(uncompressed_size); + if (uncompressed_data == NULL) { + msg("%"TS": file is probably too large to be " + "processed by this program", in->name); + ret = -1; + goto out; + } + } + + result = libdeflate_gzip_decompress_ex(decompressor, + compressed_data, + compressed_size, + uncompressed_data, + uncompressed_size, + &actual_in_nbytes, + &actual_out_nbytes); + + if (result == LIBDEFLATE_INSUFFICIENT_SPACE) { + if (uncompressed_size >= max_uncompressed_size) { + msg("Bug in libdeflate_gzip_decompress_ex(): data expanded too much!"); + ret = -1; + goto out; + } + if (uncompressed_size * 2 <= uncompressed_size) { + msg("%"TS": file corrupt or too large to be " + "processed by this program", in->name); + ret = -1; + goto out; + } + uncompressed_size *= 2; + free(uncompressed_data); + uncompressed_data = NULL; + continue; + } + + if (result != LIBDEFLATE_SUCCESS) { + msg("%"TS": file corrupt or not in gzip format", + in->name); + ret = -1; + goto out; + } + + if (actual_in_nbytes == 0 || + actual_in_nbytes > compressed_size || + actual_out_nbytes > uncompressed_size) { + msg("Bug in libdeflate_gzip_decompress_ex(): impossible actual_nbytes value!"); + ret = -1; + goto out; + } + + if (!options->test) { + ret = full_write(out, uncompressed_data, actual_out_nbytes); + if (ret != 0) + goto out; + } + + compressed_data += actual_in_nbytes; + compressed_size -= actual_in_nbytes; + + } while (compressed_size != 0); +out: + free(uncompressed_data); + return ret; +} + +static int +stat_file(struct file_stream *in, stat_t *stbuf, bool allow_hard_links) +{ + if (tfstat(in->fd, stbuf) != 0) { + msg("%"TS": unable to stat file", in->name); + return -1; + } + + if (!S_ISREG(stbuf->st_mode) && !in->is_standard_stream) { + warn("%"TS" is %s -- skipping", + in->name, S_ISDIR(stbuf->st_mode) ? "a directory" : + "not a regular file"); + return -2; + } + + if (stbuf->st_nlink > 1 && !allow_hard_links) { + warn("%"TS" has multiple hard links -- skipping (use -f to process anyway)", + in->name); + return -2; + } + + return 0; +} + +static void +restore_mode(struct file_stream *out, const stat_t *stbuf) +{ +#ifndef _WIN32 + if (fchmod(out->fd, stbuf->st_mode) != 0) + msg_errno("%"TS": unable to preserve mode", out->name); +#endif +} + +static void +restore_owner_and_group(struct file_stream *out, const stat_t *stbuf) +{ +#ifndef _WIN32 + if (fchown(out->fd, stbuf->st_uid, stbuf->st_gid) != 0) { + msg_errno("%"TS": unable to preserve owner and group", + out->name); + } +#endif +} + +static void +restore_timestamps(struct file_stream *out, const tchar *newpath, + const stat_t *stbuf) +{ + int ret; +#ifdef __APPLE__ + struct timespec times[2] = { + { stbuf->st_atime, stbuf->st_atimensec }, + { stbuf->st_mtime, stbuf->st_mtimensec }, + }; + ret = futimens(out->fd, times); +#elif defined(HAVE_FUTIMENS) && defined(HAVE_STAT_NANOSECOND_PRECISION) + struct timespec times[2] = { + stbuf->st_atim, stbuf->st_mtim, + }; + ret = futimens(out->fd, times); +#elif defined(HAVE_FUTIMES) && defined(HAVE_STAT_NANOSECOND_PRECISION) + struct timeval times[2] = { + { stbuf->st_atim.tv_sec, stbuf->st_atim.tv_nsec / 1000, }, + { stbuf->st_mtim.tv_sec, stbuf->st_mtim.tv_nsec / 1000, }, + }; + ret = futimes(out->fd, times); +#else + struct tutimbuf times = { + stbuf->st_atime, stbuf->st_mtime, + }; + ret = tutime(newpath, ×); +#endif + if (ret != 0) + msg_errno("%"TS": unable to preserve timestamps", out->name); +} + +static void +restore_metadata(struct file_stream *out, const tchar *newpath, + const stat_t *stbuf) +{ + restore_mode(out, stbuf); + restore_owner_and_group(out, stbuf); + restore_timestamps(out, newpath, stbuf); +} + +static int +decompress_file(struct libdeflate_decompressor *decompressor, const tchar *path, + const struct options *options) +{ + tchar *oldpath = (tchar *)path; + tchar *newpath = NULL; + struct file_stream in; + struct file_stream out; + stat_t stbuf; + int ret; + int ret2; + + if (path != NULL) { + const tchar *suffix = get_suffix(path, options->suffix); + if (suffix == NULL) { + /* + * Input file is unsuffixed. If the file doesn't exist, + * then try it suffixed. Otherwise, if we're not + * writing to stdout, skip the file with warning status. + * Otherwise, go ahead and try to open the file anyway + * (which will very likely fail). + */ + if (tstat(path, &stbuf) != 0 && errno == ENOENT) { + oldpath = append_suffix(path, options->suffix); + if (oldpath == NULL) + return -1; + if (!options->to_stdout) + newpath = (tchar *)path; + } else if (!options->to_stdout) { + warn("\"%"TS"\" does not end with the %"TS" suffix -- skipping", + path, options->suffix); + return -2; + } + } else if (!options->to_stdout) { + /* + * Input file is suffixed, and we're not writing to + * stdout. Strip the suffix to get the path to the + * output file. + */ + newpath = xmalloc((suffix - oldpath + 1) * + sizeof(tchar)); + if (newpath == NULL) + return -1; + tmemcpy(newpath, oldpath, suffix - oldpath); + newpath[suffix - oldpath] = '\0'; + } + } + + ret = xopen_for_read(oldpath, options->force || options->to_stdout, + &in); + if (ret != 0) + goto out_free_paths; + + if (!options->force && isatty(in.fd)) { + msg("Refusing to read compressed data from terminal. " + "Use -f to override.\nFor help, use -h."); + ret = -1; + goto out_close_in; + } + + ret = stat_file(&in, &stbuf, options->force || options->keep || + oldpath == NULL || newpath == NULL); + if (ret != 0) + goto out_close_in; + + ret = xopen_for_write(newpath, options->force, &out); + if (ret != 0) + goto out_close_in; + + /* TODO: need a streaming-friendly solution */ + ret = map_file_contents(&in, stbuf.st_size); + if (ret != 0) + goto out_close_out; + + ret = do_decompress(decompressor, &in, &out, options); + if (ret != 0) + goto out_close_out; + + if (oldpath != NULL && newpath != NULL) + restore_metadata(&out, newpath, &stbuf); + ret = 0; +out_close_out: + ret2 = xclose(&out); + if (ret == 0) + ret = ret2; + if (ret != 0 && newpath != NULL) + tunlink(newpath); +out_close_in: + xclose(&in); + if (ret == 0 && oldpath != NULL && newpath != NULL && !options->keep) + tunlink(oldpath); +out_free_paths: + if (newpath != path) + free(newpath); + if (oldpath != path) + free(oldpath); + return ret; +} + +static int +compress_file(struct libdeflate_compressor *compressor, const tchar *path, + const struct options *options) +{ + tchar *newpath = NULL; + struct file_stream in; + struct file_stream out; + stat_t stbuf; + int ret; + int ret2; + + if (path != NULL && !options->to_stdout) { + if (!options->force && has_suffix(path, options->suffix)) { + msg("%"TS": already has %"TS" suffix -- skipping", + path, options->suffix); + return 0; + } + newpath = append_suffix(path, options->suffix); + if (newpath == NULL) + return -1; + } + + ret = xopen_for_read(path, options->force || options->to_stdout, &in); + if (ret != 0) + goto out_free_newpath; + + ret = stat_file(&in, &stbuf, options->force || options->keep || + path == NULL || newpath == NULL); + if (ret != 0) + goto out_close_in; + + ret = xopen_for_write(newpath, options->force, &out); + if (ret != 0) + goto out_close_in; + + if (!options->force && isatty(out.fd)) { + msg("Refusing to write compressed data to terminal. " + "Use -f to override.\nFor help, use -h."); + ret = -1; + goto out_close_out; + } + + /* TODO: need a streaming-friendly solution */ + ret = map_file_contents(&in, stbuf.st_size); + if (ret != 0) + goto out_close_out; + + ret = do_compress(compressor, &in, &out); + if (ret != 0) + goto out_close_out; + + if (path != NULL && newpath != NULL) + restore_metadata(&out, newpath, &stbuf); + ret = 0; +out_close_out: + ret2 = xclose(&out); + if (ret == 0) + ret = ret2; + if (ret != 0 && newpath != NULL) + tunlink(newpath); +out_close_in: + xclose(&in); + if (ret == 0 && path != NULL && newpath != NULL && !options->keep) + tunlink(path); +out_free_newpath: + free(newpath); + return ret; +} + +int +tmain(int argc, tchar *argv[]) +{ + tchar *default_file_list[] = { NULL }; + struct options options; + int opt_char; + int i; + int ret; + + begin_program(argv); + + options.to_stdout = false; + options.decompress = is_gunzip(); + options.force = false; + options.keep = false; + options.test = false; + options.compression_level = 6; + options.suffix = T(".gz"); + + while ((opt_char = tgetopt(argc, argv, optstring)) != -1) { + switch (opt_char) { + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + options.compression_level = + parse_compression_level(opt_char, toptarg); + if (options.compression_level < 0) + return 1; + break; + case 'c': + options.to_stdout = true; + break; + case 'd': + options.decompress = true; + break; + case 'f': + options.force = true; + break; + case 'h': + show_usage(stdout); + return 0; + case 'k': + options.keep = true; + break; + case 'n': + /* + * -n means don't save or restore the original filename + * in the gzip header. Currently this implementation + * already behaves this way by default, so accept the + * option as a no-op. + */ + break; + case 'q': + suppress_warnings = true; + break; + case 'S': + options.suffix = toptarg; + if (options.suffix[0] == T('\0')) { + msg("invalid suffix"); + return 1; + } + break; + case 't': + options.test = true; + options.decompress = true; + options.to_stdout = true; + /* + * -t behaves just like the more commonly used -c + * option, except that -t doesn't actually write + * anything. For ease of implementation, just pretend + * that -c was specified too. + */ + break; + case 'V': + show_version(); + return 0; + default: + show_usage(stderr); + return 1; + } + } + + argv += toptind; + argc -= toptind; + + if (argc == 0) { + argv = default_file_list; + argc = ARRAY_LEN(default_file_list); + } else { + for (i = 0; i < argc; i++) + if (argv[i][0] == '-' && argv[i][1] == '\0') + argv[i] = NULL; + } + + ret = 0; + if (options.decompress) { + struct libdeflate_decompressor *d; + + d = alloc_decompressor(); + if (d == NULL) + return 1; + + for (i = 0; i < argc; i++) + ret |= -decompress_file(d, argv[i], &options); + + libdeflate_free_decompressor(d); + } else { + struct libdeflate_compressor *c; + + c = alloc_compressor(options.compression_level); + if (c == NULL) + return 1; + + for (i = 0; i < argc; i++) + ret |= -compress_file(c, argv[i], &options); + + libdeflate_free_compressor(c); + } + + switch (ret) { + case 0: + /* No warnings or errors */ + return 0; + case 2: + /* At least one warning, but no errors */ + if (suppress_warnings) + return 0; + return 2; + default: + /* At least one error */ + return 1; + } +} diff --git a/tools/z64compress/src/enc/libdeflate/programs/prog_util.c b/tools/z64compress/src/enc/libdeflate/programs/prog_util.c new file mode 100644 index 000000000..a4bf1c47d --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/prog_util.c @@ -0,0 +1,522 @@ +/* + * prog_util.c - utility functions for programs + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __APPLE__ +/* for O_NOFOLLOW */ +# undef _POSIX_C_SOURCE +# define _DARWIN_C_SOURCE +#endif + +#include "prog_util.h" + +#include +#include +#include +#ifdef _WIN32 +# include +#else +# include +# include +#endif + +#ifndef O_BINARY +# define O_BINARY 0 +#endif +#ifndef O_SEQUENTIAL +# define O_SEQUENTIAL 0 +#endif +#ifndef O_NOFOLLOW +# define O_NOFOLLOW 0 +#endif +#ifndef O_NONBLOCK +# define O_NONBLOCK 0 +#endif +#ifndef O_NOCTTY +# define O_NOCTTY 0 +#endif + +/* The invocation name of the program (filename component only) */ +const tchar *prog_invocation_name; + +/* Whether to suppress warning messages or not */ +bool suppress_warnings; + +static void +do_msg(const char *format, bool with_errno, va_list va) +{ + int saved_errno = errno; + + fprintf(stderr, "%"TS": ", prog_invocation_name); + vfprintf(stderr, format, va); + if (with_errno) + fprintf(stderr, ": %s\n", strerror(saved_errno)); + else + fprintf(stderr, "\n"); + + errno = saved_errno; +} + +/* Print a message to standard error */ +void +msg(const char *format, ...) +{ + va_list va; + + va_start(va, format); + do_msg(format, false, va); + va_end(va); +} + +/* Print a message to standard error, including a description of errno */ +void +msg_errno(const char *format, ...) +{ + va_list va; + + va_start(va, format); + do_msg(format, true, va); + va_end(va); +} + + +/* Same as msg(), but do nothing if 'suppress_warnings' has been set. */ +void +warn(const char *format, ...) +{ + if (!suppress_warnings) { + va_list va; + + va_start(va, format); + do_msg(format, false, va); + va_end(va); + } +} + +/* malloc() wrapper */ +void * +xmalloc(size_t size) +{ + void *p = malloc(size); + if (p == NULL && size == 0) + p = malloc(1); + if (p == NULL) + msg("Out of memory"); + return p; +} + +/* + * Retrieve a pointer to the filename component of the specified path. + * + * Note: this does not modify the path. Therefore, it is not guaranteed to work + * properly for directories, since a path to a directory might have trailing + * slashes. + */ +static const tchar * +get_filename(const tchar *path) +{ + const tchar *slash = tstrrchr(path, '/'); +#ifdef _WIN32 + const tchar *backslash = tstrrchr(path, '\\'); + if (backslash != NULL && (slash == NULL || backslash > slash)) + slash = backslash; +#endif + if (slash != NULL) + return slash + 1; + return path; +} + +void +begin_program(tchar *argv[]) +{ + prog_invocation_name = get_filename(argv[0]); + +#ifdef FREESTANDING + /* This allows testing freestanding library builds. */ + libdeflate_set_memory_allocator(malloc, free); +#endif +} + +/* Create a copy of 'path' surrounded by double quotes */ +static tchar * +quote_path(const tchar *path) +{ + size_t len = tstrlen(path); + tchar *result; + + result = xmalloc((1 + len + 1 + 1) * sizeof(tchar)); + if (result == NULL) + return NULL; + result[0] = '"'; + tmemcpy(&result[1], path, len); + result[1 + len] = '"'; + result[1 + len + 1] = '\0'; + return result; +} + +/* Open a file for reading, or set up standard input for reading */ +int +xopen_for_read(const tchar *path, bool symlink_ok, struct file_stream *strm) +{ + strm->mmap_token = NULL; + strm->mmap_mem = NULL; + + if (path == NULL) { + strm->is_standard_stream = true; + strm->name = T("standard input"); + strm->fd = STDIN_FILENO; + #ifdef _WIN32 + _setmode(strm->fd, O_BINARY); + #endif + return 0; + } + + strm->is_standard_stream = false; + + strm->name = quote_path(path); + if (strm->name == NULL) + return -1; + + strm->fd = topen(path, O_RDONLY | O_BINARY | O_NONBLOCK | O_NOCTTY | + (symlink_ok ? 0 : O_NOFOLLOW) | O_SEQUENTIAL); + if (strm->fd < 0) { + msg_errno("Can't open %"TS" for reading", strm->name); + free(strm->name); + return -1; + } + +#if defined(HAVE_POSIX_FADVISE) && (O_SEQUENTIAL == 0) + (void)posix_fadvise(strm->fd, 0, 0, POSIX_FADV_SEQUENTIAL); +#endif + + return 0; +} + +/* Open a file for writing, or set up standard output for writing */ +int +xopen_for_write(const tchar *path, bool overwrite, struct file_stream *strm) +{ + int ret = -1; + + strm->mmap_token = NULL; + strm->mmap_mem = NULL; + + if (path == NULL) { + strm->is_standard_stream = true; + strm->name = T("standard output"); + strm->fd = STDOUT_FILENO; + #ifdef _WIN32 + _setmode(strm->fd, O_BINARY); + #endif + return 0; + } + + strm->is_standard_stream = false; + + strm->name = quote_path(path); + if (strm->name == NULL) + goto err; +retry: + strm->fd = topen(path, O_WRONLY | O_BINARY | O_NOFOLLOW | + O_CREAT | O_EXCL, 0644); + if (strm->fd < 0) { + if (errno != EEXIST) { + msg_errno("Can't open %"TS" for writing", strm->name); + goto err; + } + if (!overwrite) { + if (!isatty(STDERR_FILENO) || !isatty(STDIN_FILENO)) { + warn("%"TS" already exists; use -f to overwrite", + strm->name); + ret = -2; /* warning only */ + goto err; + } + fprintf(stderr, "%"TS": %"TS" already exists; " + "overwrite? (y/n) ", + prog_invocation_name, strm->name); + if (getchar() != 'y') { + msg("Not overwriting."); + goto err; + } + } + if (tunlink(path) != 0) { + msg_errno("Unable to delete %"TS, strm->name); + goto err; + } + goto retry; + } + + return 0; + +err: + free(strm->name); + return ret; +} + +/* Read the full contents of a file into memory */ +static int +read_full_contents(struct file_stream *strm) +{ + size_t filled = 0; + size_t capacity = 4096; + char *buf; + int ret; + + buf = xmalloc(capacity); + if (buf == NULL) + return -1; + do { + if (filled == capacity) { + char *newbuf; + + if (capacity == SIZE_MAX) + goto oom; + capacity += MIN(SIZE_MAX - capacity, capacity); + newbuf = realloc(buf, capacity); + if (newbuf == NULL) + goto oom; + buf = newbuf; + } + ret = xread(strm, &buf[filled], capacity - filled); + if (ret < 0) + goto err; + filled += ret; + } while (ret != 0); + + strm->mmap_mem = buf; + strm->mmap_size = filled; + return 0; + +err: + free(buf); + return ret; +oom: + msg("Out of memory! %"TS" is too large to be processed by " + "this program as currently implemented.", strm->name); + ret = -1; + goto err; +} + +/* Map the contents of a file into memory */ +int +map_file_contents(struct file_stream *strm, u64 size) +{ + if (size == 0) /* mmap isn't supported on empty files */ + return read_full_contents(strm); + + if (size > SIZE_MAX) { + msg("%"TS" is too large to be processed by this program", + strm->name); + return -1; + } +#ifdef _WIN32 + strm->mmap_token = CreateFileMapping( + (HANDLE)(intptr_t)_get_osfhandle(strm->fd), + NULL, PAGE_READONLY, 0, 0, NULL); + if (strm->mmap_token == NULL) { + DWORD err = GetLastError(); + if (err == ERROR_BAD_EXE_FORMAT) /* mmap unsupported */ + return read_full_contents(strm); + msg("Unable create file mapping for %"TS": Windows error %u", + strm->name, (unsigned int)err); + return -1; + } + + strm->mmap_mem = MapViewOfFile((HANDLE)strm->mmap_token, + FILE_MAP_READ, 0, 0, size); + if (strm->mmap_mem == NULL) { + msg("Unable to map %"TS" into memory: Windows error %u", + strm->name, (unsigned int)GetLastError()); + CloseHandle((HANDLE)strm->mmap_token); + return -1; + } +#else /* _WIN32 */ + strm->mmap_mem = mmap(NULL, size, PROT_READ, MAP_SHARED, strm->fd, 0); + if (strm->mmap_mem == MAP_FAILED) { + strm->mmap_mem = NULL; + if (errno == ENODEV /* standard */ || + errno == EINVAL /* macOS */) { + /* mmap isn't supported on this file */ + return read_full_contents(strm); + } + if (errno == ENOMEM) { + msg("%"TS" is too large to be processed by this " + "program", strm->name); + } else { + msg_errno("Unable to map %"TS" into memory", + strm->name); + } + return -1; + } + +#ifdef HAVE_POSIX_MADVISE + (void)posix_madvise(strm->mmap_mem, size, POSIX_MADV_SEQUENTIAL); +#endif + strm->mmap_token = strm; /* anything that's not NULL */ + +#endif /* !_WIN32 */ + strm->mmap_size = size; + return 0; +} + +/* + * Read from a file, returning the full count to indicate all bytes were read, a + * short count (possibly 0) to indicate EOF, or -1 to indicate error. + */ +ssize_t +xread(struct file_stream *strm, void *buf, size_t count) +{ + char *p = buf; + size_t orig_count = count; + + while (count != 0) { + ssize_t res = read(strm->fd, p, MIN(count, INT_MAX)); + if (res == 0) + break; + if (res < 0) { + if (errno == EAGAIN || errno == EINTR) + continue; + msg_errno("Error reading from %"TS, strm->name); + return -1; + } + p += res; + count -= res; + } + return orig_count - count; +} + +/* Write to a file, returning 0 if all bytes were written or -1 on error */ +int +full_write(struct file_stream *strm, const void *buf, size_t count) +{ + const char *p = buf; + + while (count != 0) { + ssize_t res = write(strm->fd, p, MIN(count, INT_MAX)); + if (res <= 0) { + msg_errno("Error writing to %"TS, strm->name); + return -1; + } + p += res; + count -= res; + } + return 0; +} + +/* Close a file, returning 0 on success or -1 on error */ +int +xclose(struct file_stream *strm) +{ + int ret = 0; + + if (!strm->is_standard_stream) { + if (close(strm->fd) != 0) { + msg_errno("Error closing %"TS, strm->name); + ret = -1; + } + free(strm->name); + } + + if (strm->mmap_token != NULL) { +#ifdef _WIN32 + UnmapViewOfFile(strm->mmap_mem); + CloseHandle((HANDLE)strm->mmap_token); +#else + munmap(strm->mmap_mem, strm->mmap_size); +#endif + strm->mmap_token = NULL; + } else { + free(strm->mmap_mem); + } + strm->mmap_mem = NULL; + strm->fd = -1; + strm->name = NULL; + return ret; +} + +/* + * Parse the compression level given on the command line, returning the + * compression level on success or -1 on error + */ +int +parse_compression_level(tchar opt_char, const tchar *arg) +{ + int level; + + if (arg == NULL) + arg = T(""); + + if (opt_char < '0' || opt_char > '9') + goto invalid; + level = opt_char - '0'; + + if (arg[0] != '\0') { + if (arg[0] < '0' || arg[0] > '9') + goto invalid; + if (arg[1] != '\0') /* Levels are at most 2 digits */ + goto invalid; + if (level == 0) /* Don't allow arguments like "-01" */ + goto invalid; + level = (level * 10) + (arg[0] - '0'); + } + + if (level < 0 || level > 12) + goto invalid; + + return level; + +invalid: + msg("Invalid compression level: \"%"TC"%"TS"\". " + "Must be an integer in the range [0, 12].", opt_char, arg); + return -1; +} + +/* Allocate a new DEFLATE compressor */ +struct libdeflate_compressor * +alloc_compressor(int level) +{ + struct libdeflate_compressor *c; + + c = libdeflate_alloc_compressor(level); + if (c == NULL) { + msg_errno("Unable to allocate compressor with " + "compression level %d", level); + } + return c; +} + +/* Allocate a new DEFLATE decompressor */ +struct libdeflate_decompressor * +alloc_decompressor(void) +{ + struct libdeflate_decompressor *d; + + d = libdeflate_alloc_decompressor(); + if (d == NULL) + msg_errno("Unable to allocate decompressor"); + + return d; +} diff --git a/tools/z64compress/src/enc/libdeflate/programs/prog_util.h b/tools/z64compress/src/enc/libdeflate/programs/prog_util.h new file mode 100644 index 000000000..08f538399 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/prog_util.h @@ -0,0 +1,177 @@ +/* + * prog_util.h - utility functions for programs + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef PROGRAMS_PROG_UTIL_H +#define PROGRAMS_PROG_UTIL_H + +/* + * To keep the code similar on all platforms, sometimes we intentionally use the + * "deprecated" non-underscore-prefixed variants of functions in msvcrt. + */ +#if defined(_WIN32) && !defined(_CRT_NONSTDC_NO_DEPRECATE) +# define _CRT_NONSTDC_NO_DEPRECATE 1 +#endif +/* + * Similarly, to match other platforms we intentionally use the "non-secure" + * variants, which aren't actually any less secure when used properly. + */ +#if defined(_WIN32) && !defined(_CRT_SECURE_NO_WARNINGS) +# define _CRT_SECURE_NO_WARNINGS 1 +#endif + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "libdeflate.h" + +#include +#include +#include +#include +#include +#ifndef _WIN32 +# include +#endif + +#include "../common_defs.h" + +#if defined(__GNUC__) || __has_attribute(format) +# define _printf(str_idx, args_idx) \ + __attribute__((format(printf, str_idx, args_idx))) +#else +# define _printf(str_idx, args_idx) +#endif + +#ifdef _WIN32 + +/* + * Definitions for Windows builds. Mainly, 'tchar' is defined to be the 2-byte + * 'wchar_t' type instead of 'char'. This is the only "easy" way I know of to + * get full Unicode support on Windows... + */ + +#include +#include +int wmain(int argc, wchar_t **argv); +# define tmain wmain +# define tchar wchar_t +# define _T(text) L##text +# define T(text) _T(text) +# define TS "ls" +# define TC "lc" +# define tmemcpy wmemcpy +# define topen _wopen +# define tstrchr wcschr +# define tstrcmp wcscmp +# define tstrlen wcslen +# define tstrrchr wcsrchr +# define tstrtoul wcstoul +# define tstrxcmp wcsicmp +# define tunlink _wunlink +# define tutimbuf __utimbuf64 +# define tutime _wutime64 +# define tstat _wstat64 +# define tfstat _fstat64 +# define stat_t struct _stat64 +# ifdef _MSC_VER +# define STDIN_FILENO 0 +# define STDOUT_FILENO 1 +# define STDERR_FILENO 2 +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# endif + +#else /* _WIN32 */ + +/* Standard definitions for everyone else */ + +# define tmain main +# define tchar char +# define T(text) text +# define TS "s" +# define TC "c" +# define tmemcpy memcpy +# define topen open +# define tstrchr strchr +# define tstrcmp strcmp +# define tstrlen strlen +# define tstrrchr strrchr +# define tstrtoul strtoul +# define tstrxcmp strcmp +# define tunlink unlink +# define tutimbuf utimbuf +# define tutime utime +# define tstat stat +# define tfstat fstat +# define stat_t struct stat + +#endif /* !_WIN32 */ + +extern const tchar *prog_invocation_name; +extern bool suppress_warnings; + +void _printf(1, 2) msg(const char *fmt, ...); +void _printf(1, 2) msg_errno(const char *fmt, ...); +void _printf(1, 2) warn(const char *fmt, ...); + +void *xmalloc(size_t size); + +void begin_program(tchar *argv[]); + +struct file_stream { + int fd; + tchar *name; + bool is_standard_stream; + void *mmap_token; + void *mmap_mem; + size_t mmap_size; +}; + +int xopen_for_read(const tchar *path, bool symlink_ok, + struct file_stream *strm); +int xopen_for_write(const tchar *path, bool force, struct file_stream *strm); +int map_file_contents(struct file_stream *strm, u64 size); + +ssize_t xread(struct file_stream *strm, void *buf, size_t count); +int full_write(struct file_stream *strm, const void *buf, size_t count); + +int xclose(struct file_stream *strm); + +int parse_compression_level(tchar opt_char, const tchar *arg); + +struct libdeflate_compressor *alloc_compressor(int level); +struct libdeflate_decompressor *alloc_decompressor(void); + +/* tgetopt.c */ + +extern tchar *toptarg; +extern int toptind, topterr, toptopt; + +int tgetopt(int argc, tchar *argv[], const tchar *optstring); + +#endif /* PROGRAMS_PROG_UTIL_H */ diff --git a/tools/z64compress/src/enc/libdeflate/programs/test_checksums.c b/tools/z64compress/src/enc/libdeflate/programs/test_checksums.c new file mode 100644 index 000000000..e66e62443 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/test_checksums.c @@ -0,0 +1,200 @@ +/* + * test_checksums.c + * + * Verify that libdeflate's Adler-32 and CRC-32 functions produce the same + * results as their zlib equivalents. + */ + +#include +#include + +#include "test_util.h" + +static unsigned int rng_seed; + +typedef u32 (*cksum_fn_t)(u32, const void *, size_t); + +static u32 +adler32_libdeflate(u32 adler, const void *buf, size_t len) +{ + return libdeflate_adler32(adler, buf, len); +} + +static u32 +crc32_libdeflate(u32 crc, const void *buf, size_t len) +{ + return libdeflate_crc32(crc, buf, len); +} + +static u32 +adler32_zlib(u32 adler, const void *buf, size_t len) +{ + return adler32(adler, buf, len); +} + +static u32 +crc32_zlib(u32 crc, const void *buf, size_t len) +{ + return crc32(crc, buf, len); +} + +static u32 +select_initial_crc(void) +{ + if (rand() & 1) + return 0; + return ((u32)rand() << 16) | rand(); +} + +static u32 +select_initial_adler(void) +{ + u32 lo, hi; + + if (rand() & 1) + return 1; + + lo = (rand() % 4 == 0 ? 65520 : rand() % 65521); + hi = (rand() % 4 == 0 ? 65520 : rand() % 65521); + return (hi << 16) | lo; +} + +static void +test_initial_values(cksum_fn_t cksum, u32 expected) +{ + ASSERT(cksum(0, NULL, 0) == expected); + if (cksum != adler32_zlib) /* broken */ + ASSERT(cksum(0, NULL, 1) == expected); + ASSERT(cksum(0, NULL, 1234) == expected); + ASSERT(cksum(1234, NULL, 0) == expected); + ASSERT(cksum(1234, NULL, 1234) == expected); +} + +static void +test_multipart(const u8 *buffer, size_t size, const char *name, + cksum_fn_t cksum, u32 v, u32 expected) +{ + size_t division = rand() % (size + 1); + v = cksum(v, buffer, division); + v = cksum(v, buffer + division, size - division); + if (v != expected) { + fprintf(stderr, "%s checksum failed multipart test\n", name); + ASSERT(0); + } +} + +static void +test_checksums(const void *buffer, size_t size, const char *name, + cksum_fn_t cksum1, cksum_fn_t cksum2, u32 initial_value) +{ + u32 v1 = cksum1(initial_value, buffer, size); + u32 v2 = cksum2(initial_value, buffer, size); + + if (v1 != v2) { + fprintf(stderr, "%s checksum mismatch\n", name); + fprintf(stderr, "initial_value=0x%08"PRIx32", buffer=%p, " + "size=%zu, buffer=", initial_value, buffer, size); + for (size_t i = 0; i < MIN(size, 256); i++) + fprintf(stderr, "%02x", ((const u8 *)buffer)[i]); + if (size > 256) + fprintf(stderr, "..."); + fprintf(stderr, "\n"); + ASSERT(0); + } + + if ((rand() & 15) == 0) { + test_multipart(buffer, size, name, cksum1, initial_value, v1); + test_multipart(buffer, size, name, cksum2, initial_value, v1); + } +} + +static void +test_crc32(const void *buffer, size_t size, u32 initial_value) +{ + test_checksums(buffer, size, "CRC-32", + crc32_libdeflate, crc32_zlib, initial_value); +} + +static void +test_adler32(const void *buffer, size_t size, u32 initial_value) +{ + test_checksums(buffer, size, "Adler-32", + adler32_libdeflate, adler32_zlib, initial_value); +} + +static void test_random_buffers(u8 *buf_start, u8 *buf_end, size_t limit, + u32 num_iter) +{ + for (u32 i = 0; i < num_iter; i++) { + size_t start = rand() % limit; + size_t len = rand() % (limit - start); + u32 a0 = select_initial_adler(); + u32 c0 = select_initial_crc(); + + for (size_t j = start; j < start + len; j++) + buf_start[j] = rand(); + + /* Test with chosen size and alignment */ + test_adler32(&buf_start[start], len, a0); + test_crc32(&buf_start[start], len, c0); + + /* Test with chosen size, with guard page before input buffer */ + memmove(buf_start, &buf_start[start], len); + test_adler32(buf_start, len, a0); + test_crc32(buf_start, len, c0); + + /* Test with chosen size, with guard page after input buffer */ + memmove(buf_end - len, buf_start, len); + test_adler32(buf_end - len, len, a0); + test_crc32(buf_end - len, len, c0); + } +} + +int +tmain(int argc, tchar *argv[]) +{ + u8 *buf_start, *buf_end; + + begin_program(argv); + + alloc_guarded_buffer(262144, &buf_start, &buf_end); + + rng_seed = time(NULL); + srand(rng_seed); + + test_initial_values(adler32_libdeflate, 1); + test_initial_values(adler32_zlib, 1); + test_initial_values(crc32_libdeflate, 0); + test_initial_values(crc32_zlib, 0); + + /* Test different buffer sizes and alignments */ + test_random_buffers(buf_start, buf_end, 256, 5000); + test_random_buffers(buf_start, buf_end, 1024, 500); + test_random_buffers(buf_start, buf_end, 32768, 50); + test_random_buffers(buf_start, buf_end, 262144, 25); + + /* + * Test Adler-32 overflow cases. For example, given all 0xFF bytes and + * the highest possible initial (s1, s2) of (65520, 65520), then s2 if + * stored as a 32-bit unsigned integer will overflow if > 5552 bytes are + * processed. Implementations must make sure to reduce s2 modulo 65521 + * before that point. Also, some implementations make use of 16-bit + * counters which can overflow earlier. + */ + memset(buf_start, 0xFF, 32768); + for (u32 i = 0; i < 20; i++) { + u32 initial_value; + + if (i == 0) + initial_value = ((u32)65520 << 16) | 65520; + else + initial_value = select_initial_adler(); + + test_adler32(buf_start, 5553, initial_value); + test_adler32(buf_start, rand() % 32769, initial_value); + buf_start[rand() % 32768] = 0xFE; + } + + free_guarded_buffer(buf_start, buf_end); + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/programs/test_custom_malloc.c b/tools/z64compress/src/enc/libdeflate/programs/test_custom_malloc.c new file mode 100644 index 000000000..2bbb7f098 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/test_custom_malloc.c @@ -0,0 +1,85 @@ +/* + * test_custom_malloc.c + * + * Test libdeflate_set_memory_allocator(). + * Also test injecting allocation failures. + */ + +#include "test_util.h" + +static int malloc_count = 0; +static int free_count = 0; + +static void *do_malloc(size_t size) +{ + malloc_count++; + return malloc(size); +} + +static void *do_fail_malloc(size_t size) +{ + malloc_count++; + return NULL; +} + +static void do_free(void *ptr) +{ + free_count++; + free(ptr); +} + +int +tmain(int argc, tchar *argv[]) +{ + int level; + struct libdeflate_compressor *c; + struct libdeflate_decompressor *d; + + begin_program(argv); + + /* Test that the custom allocator is actually used when requested. */ + + libdeflate_set_memory_allocator(do_malloc, do_free); + ASSERT(malloc_count == 0); + ASSERT(free_count == 0); + + for (level = 0; level <= 12; level++) { + malloc_count = free_count = 0; + c = libdeflate_alloc_compressor(level); + ASSERT(c != NULL); + ASSERT(malloc_count == 1); + ASSERT(free_count == 0); + libdeflate_free_compressor(c); + ASSERT(malloc_count == 1); + ASSERT(free_count == 1); + } + + malloc_count = free_count = 0; + d = libdeflate_alloc_decompressor(); + ASSERT(d != NULL); + ASSERT(malloc_count == 1); + ASSERT(free_count == 0); + libdeflate_free_decompressor(d); + ASSERT(malloc_count == 1); + ASSERT(free_count == 1); + + /* As long as we're here, also test injecting allocation failures. */ + + libdeflate_set_memory_allocator(do_fail_malloc, do_free); + + for (level = 0; level <= 12; level++) { + malloc_count = free_count = 0; + c = libdeflate_alloc_compressor(level); + ASSERT(c == NULL); + ASSERT(malloc_count == 1); + ASSERT(free_count == 0); + } + + malloc_count = free_count = 0; + d = libdeflate_alloc_decompressor(); + ASSERT(d == NULL); + ASSERT(malloc_count == 1); + ASSERT(free_count == 0); + + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/programs/test_incomplete_codes.c b/tools/z64compress/src/enc/libdeflate/programs/test_incomplete_codes.c new file mode 100644 index 000000000..4e441bccb --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/test_incomplete_codes.c @@ -0,0 +1,385 @@ +/* + * test_incomplete_codes.c + * + * Test that the decompressor accepts incomplete Huffman codes in certain + * specific cases. + */ + +#include "test_util.h" + +static void +verify_decompression_libdeflate(const u8 *in, size_t in_nbytes, + u8 *out, size_t out_nbytes_avail, + const u8 *expected_out, + size_t expected_out_nbytes) +{ + struct libdeflate_decompressor *d; + enum libdeflate_result res; + size_t actual_out_nbytes; + + d = libdeflate_alloc_decompressor(); + ASSERT(d != NULL); + + res = libdeflate_deflate_decompress(d, in, in_nbytes, + out, out_nbytes_avail, + &actual_out_nbytes); + ASSERT(res == LIBDEFLATE_SUCCESS); + ASSERT(actual_out_nbytes == expected_out_nbytes); + ASSERT(memcmp(out, expected_out, actual_out_nbytes) == 0); + + libdeflate_free_decompressor(d); +} + +static void +verify_decompression_zlib(const u8 *in, size_t in_nbytes, + u8 *out, size_t out_nbytes_avail, + const u8 *expected_out, size_t expected_out_nbytes) +{ + z_stream z; + int res; + size_t actual_out_nbytes; + + memset(&z, 0, sizeof(z)); + res = inflateInit2(&z, -15); + ASSERT(res == Z_OK); + + z.next_in = (void *)in; + z.avail_in = in_nbytes; + z.next_out = (void *)out; + z.avail_out = out_nbytes_avail; + res = inflate(&z, Z_FINISH); + ASSERT(res == Z_STREAM_END); + actual_out_nbytes = out_nbytes_avail - z.avail_out; + ASSERT(actual_out_nbytes == expected_out_nbytes); + ASSERT(memcmp(out, expected_out, actual_out_nbytes) == 0); + + inflateEnd(&z); +} + +static void +verify_decompression(const u8 *in, size_t in_nbytes, + u8 *out, size_t out_nbytes_avail, + const u8 *expected_out, size_t expected_out_nbytes) +{ + verify_decompression_libdeflate(in, in_nbytes, out, out_nbytes_avail, + expected_out, expected_out_nbytes); + verify_decompression_zlib(in, in_nbytes, out, out_nbytes_avail, + expected_out, expected_out_nbytes); + +} + +/* Test that an empty offset code is accepted. */ +static void +test_empty_offset_code(void) +{ + static const u8 expected_out[] = { 'A', 'B', 'A', 'A' }; + u8 in[128]; + u8 out[128]; + struct output_bitstream os = { .next = in, .end = in + sizeof(in) }; + int i; + + /* + * Generate a DEFLATE stream containing a "dynamic Huffman" block + * containing literals, but no offsets; and having an empty offset code + * (all codeword lengths set to 0). + * + * Litlen code: + * litlensym_A freq=3 len=1 codeword= 0 + * litlensym_B freq=1 len=2 codeword=01 + * litlensym_256 (end-of-block) freq=1 len=2 codeword=11 + * Offset code: + * (empty) + * + * Litlen and offset codeword lengths: + * [0..'A'-1] = 0 presym_18 + * ['A'] = 1 presym_1 + * ['B'] = 2 presym_2 + * ['B'+1..255] = 0 presym_18 presym_18 + * [256] = 2 presym_2 + * [257] = 0 presym_0 + * + * Precode: + * presym_0 freq=1 len=3 codeword=011 + * presym_1 freq=1 len=3 codeword=111 + * presym_2 freq=2 len=2 codeword= 01 + * presym_18 freq=3 len=1 codeword= 0 + */ + + ASSERT(put_bits(&os, 1, 1)); /* BFINAL: 1 */ + ASSERT(put_bits(&os, 2, 2)); /* BTYPE: DYNAMIC_HUFFMAN */ + ASSERT(put_bits(&os, 0, 5)); /* num_litlen_syms: 0 + 257 */ + ASSERT(put_bits(&os, 0, 5)); /* num_offset_syms: 0 + 1 */ + ASSERT(put_bits(&os, 14, 4)); /* num_explicit_precode_lens: 14 + 4 */ + + /* + * Precode codeword lengths: order is + * [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15] + */ + for (i = 0; i < 2; i++) /* presym_{16,17}: len=0 */ + ASSERT(put_bits(&os, 0, 3)); + ASSERT(put_bits(&os, 1, 3)); /* presym_18: len=1 */ + ASSERT(put_bits(&os, 3, 3)); /* presym_0: len=3 */ + for (i = 0; i < 11; i++) /* presym_{8,...,13}: len=0 */ + ASSERT(put_bits(&os, 0, 3)); + ASSERT(put_bits(&os, 2, 3)); /* presym_2: len=2 */ + ASSERT(put_bits(&os, 0, 3)); /* presym_14: len=0 */ + ASSERT(put_bits(&os, 3, 3)); /* presym_1: len=3 */ + + /* Litlen and offset codeword lengths */ + ASSERT(put_bits(&os, 0x0, 1) && + put_bits(&os, 54, 7)); /* presym_18, 65 zeroes */ + ASSERT(put_bits(&os, 0x7, 3)); /* presym_1 */ + ASSERT(put_bits(&os, 0x1, 2)); /* presym_2 */ + ASSERT(put_bits(&os, 0x0, 1) && + put_bits(&os, 89, 7)); /* presym_18, 100 zeroes */ + ASSERT(put_bits(&os, 0x0, 1) && + put_bits(&os, 78, 7)); /* presym_18, 89 zeroes */ + ASSERT(put_bits(&os, 0x1, 2)); /* presym_2 */ + ASSERT(put_bits(&os, 0x3, 3)); /* presym_0 */ + + /* Litlen symbols */ + ASSERT(put_bits(&os, 0x0, 1)); /* litlensym_A */ + ASSERT(put_bits(&os, 0x1, 2)); /* litlensym_B */ + ASSERT(put_bits(&os, 0x0, 1)); /* litlensym_A */ + ASSERT(put_bits(&os, 0x0, 1)); /* litlensym_A */ + ASSERT(put_bits(&os, 0x3, 2)); /* litlensym_256 (end-of-block) */ + + ASSERT(flush_bits(&os)); + + verify_decompression(in, os.next - in, out, sizeof(out), + expected_out, sizeof(expected_out)); +} + +/* Test that a litrunlen code containing only one symbol is accepted. */ +static void +test_singleton_litrunlen_code(void) +{ + u8 in[128]; + u8 out[128]; + struct output_bitstream os = { .next = in, .end = in + sizeof(in) }; + int i; + + /* + * Litlen code: + * litlensym_256 (end-of-block) freq=1 len=1 codeword=0 + * Offset code: + * (empty) + * + * Litlen and offset codeword lengths: + * [0..256] = 0 presym_18 presym_18 + * [256] = 1 presym_1 + * [257] = 0 presym_0 + * + * Precode: + * presym_0 freq=1 len=2 codeword=01 + * presym_1 freq=1 len=2 codeword=11 + * presym_18 freq=2 len=1 codeword= 0 + */ + + ASSERT(put_bits(&os, 1, 1)); /* BFINAL: 1 */ + ASSERT(put_bits(&os, 2, 2)); /* BTYPE: DYNAMIC_HUFFMAN */ + ASSERT(put_bits(&os, 0, 5)); /* num_litlen_syms: 0 + 257 */ + ASSERT(put_bits(&os, 0, 5)); /* num_offset_syms: 0 + 1 */ + ASSERT(put_bits(&os, 14, 4)); /* num_explicit_precode_lens: 14 + 4 */ + + /* + * Precode codeword lengths: order is + * [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15] + */ + for (i = 0; i < 2; i++) /* presym_{16,17}: len=0 */ + ASSERT(put_bits(&os, 0, 3)); + ASSERT(put_bits(&os, 1, 3)); /* presym_18: len=1 */ + ASSERT(put_bits(&os, 2, 3)); /* presym_0: len=2 */ + for (i = 0; i < 13; i++) /* presym_{8,...,14}: len=0 */ + ASSERT(put_bits(&os, 0, 3)); + ASSERT(put_bits(&os, 2, 3)); /* presym_1: len=2 */ + + /* Litlen and offset codeword lengths */ + for (i = 0; i < 2; i++) { + ASSERT(put_bits(&os, 0, 1) && /* presym_18, 128 zeroes */ + put_bits(&os, 117, 7)); + } + ASSERT(put_bits(&os, 0x3, 2)); /* presym_1 */ + ASSERT(put_bits(&os, 0x1, 2)); /* presym_0 */ + + /* Litlen symbols */ + ASSERT(put_bits(&os, 0x0, 1)); /* litlensym_256 (end-of-block) */ + + ASSERT(flush_bits(&os)); + + verify_decompression(in, os.next - in, out, sizeof(out), in, 0); +} + +/* Test that an offset code containing only one symbol is accepted. */ +static void +test_singleton_offset_code(void) +{ + static const u8 expected_out[] = { 255, 255, 255, 255 }; + u8 in[128]; + u8 out[128]; + struct output_bitstream os = { .next = in, .end = in + sizeof(in) }; + int i; + + ASSERT(put_bits(&os, 1, 1)); /* BFINAL: 1 */ + ASSERT(put_bits(&os, 2, 2)); /* BTYPE: DYNAMIC_HUFFMAN */ + + /* + * Litlen code: + * litlensym_255 freq=1 len=1 codeword= 0 + * litlensym_256 (end-of-block) freq=1 len=2 codeword=01 + * litlensym_257 (len 3) freq=1 len=2 codeword=11 + * Offset code: + * offsetsym_0 (offset 0) freq=1 len=1 codeword=0 + * + * Litlen and offset codeword lengths: + * [0..254] = 0 presym_{18,18} + * [255] = 1 presym_1 + * [256] = 1 presym_2 + * [257] = 1 presym_2 + * [258] = 1 presym_1 + * + * Precode: + * presym_1 freq=2 len=2 codeword=01 + * presym_2 freq=2 len=2 codeword=11 + * presym_18 freq=2 len=1 codeword= 0 + */ + + ASSERT(put_bits(&os, 1, 5)); /* num_litlen_syms: 1 + 257 */ + ASSERT(put_bits(&os, 0, 5)); /* num_offset_syms: 0 + 1 */ + ASSERT(put_bits(&os, 14, 4)); /* num_explicit_precode_lens: 14 + 4 */ + /* + * Precode codeword lengths: order is + * [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15] + */ + for (i = 0; i < 2; i++) /* presym_{16,17}: len=0 */ + ASSERT(put_bits(&os, 0, 3)); + ASSERT(put_bits(&os, 1, 3)); /* presym_18: len=1 */ + for (i = 0; i < 12; i++) /* presym_{0,...,13}: len=0 */ + ASSERT(put_bits(&os, 0, 3)); + ASSERT(put_bits(&os, 2, 3)); /* presym_2: len=2 */ + ASSERT(put_bits(&os, 0, 3)); /* presym_14: len=0 */ + ASSERT(put_bits(&os, 2, 3)); /* presym_1: len=2 */ + + /* Litlen and offset codeword lengths */ + ASSERT(put_bits(&os, 0x0, 1) && /* presym_18, 128 zeroes */ + put_bits(&os, 117, 7)); + ASSERT(put_bits(&os, 0x0, 1) && /* presym_18, 127 zeroes */ + put_bits(&os, 116, 7)); + ASSERT(put_bits(&os, 0x1, 2)); /* presym_1 */ + ASSERT(put_bits(&os, 0x3, 2)); /* presym_2 */ + ASSERT(put_bits(&os, 0x3, 2)); /* presym_2 */ + ASSERT(put_bits(&os, 0x1, 2)); /* presym_1 */ + + /* Literal */ + ASSERT(put_bits(&os, 0x0, 1)); /* litlensym_255 */ + + /* Match */ + ASSERT(put_bits(&os, 0x3, 2)); /* litlensym_257 */ + ASSERT(put_bits(&os, 0x0, 1)); /* offsetsym_0 */ + + /* End of block */ + ASSERT(put_bits(&os, 0x1, 2)); /* litlensym_256 */ + + ASSERT(flush_bits(&os)); + + verify_decompression(in, os.next - in, out, sizeof(out), + expected_out, sizeof(expected_out)); +} + +/* Test that an offset code containing only one symbol is accepted, even if that + * symbol is not symbol 0. The codeword should be '0' in either case. */ +static void +test_singleton_offset_code_notsymzero(void) +{ + static const u8 expected_out[] = { 254, 255, 254, 255, 254 }; + u8 in[128]; + u8 out[128]; + struct output_bitstream os = { .next = in, .end = in + sizeof(in) }; + int i; + + ASSERT(put_bits(&os, 1, 1)); /* BFINAL: 1 */ + ASSERT(put_bits(&os, 2, 2)); /* BTYPE: DYNAMIC_HUFFMAN */ + + /* + * Litlen code: + * litlensym_254 len=2 codeword=00 + * litlensym_255 len=2 codeword=10 + * litlensym_256 (end-of-block) len=2 codeword=01 + * litlensym_257 (len 3) len=2 codeword=11 + * Offset code: + * offsetsym_1 (offset 2) len=1 codeword=0 + * + * Litlen and offset codeword lengths: + * [0..253] = 0 presym_{18,18} + * [254] = 2 presym_2 + * [255] = 2 presym_2 + * [256] = 2 presym_2 + * [257] = 2 presym_2 + * [258] = 0 presym_0 + * [259] = 1 presym_1 + * + * Precode: + * presym_0 len=2 codeword=00 + * presym_1 len=2 codeword=10 + * presym_2 len=2 codeword=01 + * presym_18 len=2 codeword=11 + */ + + ASSERT(put_bits(&os, 1, 5)); /* num_litlen_syms: 1 + 257 */ + ASSERT(put_bits(&os, 1, 5)); /* num_offset_syms: 1 + 1 */ + ASSERT(put_bits(&os, 14, 4)); /* num_explicit_precode_lens: 14 + 4 */ + /* + * Precode codeword lengths: order is + * [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15] + */ + for (i = 0; i < 2; i++) /* presym_{16,17}: len=0 */ + ASSERT(put_bits(&os, 0, 3)); + ASSERT(put_bits(&os, 2, 3)); /* presym_18: len=2 */ + ASSERT(put_bits(&os, 2, 3)); /* presym_0: len=2 */ + for (i = 0; i < 11; i++) /* presym_{8,...,13}: len=0 */ + ASSERT(put_bits(&os, 0, 3)); + ASSERT(put_bits(&os, 2, 3)); /* presym_2: len=2 */ + ASSERT(put_bits(&os, 0, 3)); /* presym_14: len=0 */ + ASSERT(put_bits(&os, 2, 3)); /* presym_1: len=2 */ + + /* Litlen and offset codeword lengths */ + ASSERT(put_bits(&os, 0x3, 2) && /* presym_18, 128 zeroes */ + put_bits(&os, 117, 7)); + ASSERT(put_bits(&os, 0x3, 2) && /* presym_18, 126 zeroes */ + put_bits(&os, 115, 7)); + ASSERT(put_bits(&os, 0x1, 2)); /* presym_2 */ + ASSERT(put_bits(&os, 0x1, 2)); /* presym_2 */ + ASSERT(put_bits(&os, 0x1, 2)); /* presym_2 */ + ASSERT(put_bits(&os, 0x1, 2)); /* presym_2 */ + ASSERT(put_bits(&os, 0x0, 2)); /* presym_0 */ + ASSERT(put_bits(&os, 0x2, 2)); /* presym_1 */ + + /* Literals */ + ASSERT(put_bits(&os, 0x0, 2)); /* litlensym_254 */ + ASSERT(put_bits(&os, 0x2, 2)); /* litlensym_255 */ + + /* Match */ + ASSERT(put_bits(&os, 0x3, 2)); /* litlensym_257 */ + ASSERT(put_bits(&os, 0x0, 1)); /* offsetsym_1 */ + + /* End of block */ + ASSERT(put_bits(&os, 0x1, 2)); /* litlensym_256 */ + + ASSERT(flush_bits(&os)); + + verify_decompression(in, os.next - in, out, sizeof(out), + expected_out, sizeof(expected_out)); +} + +int +tmain(int argc, tchar *argv[]) +{ + begin_program(argv); + + test_empty_offset_code(); + test_singleton_litrunlen_code(); + test_singleton_offset_code(); + test_singleton_offset_code_notsymzero(); + + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/programs/test_litrunlen_overflow.c b/tools/z64compress/src/enc/libdeflate/programs/test_litrunlen_overflow.c new file mode 100644 index 000000000..cdec8c802 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/test_litrunlen_overflow.c @@ -0,0 +1,72 @@ +/* + * test_litrunlen_overflow.c + * + * Regression test for commit f2f0df727444 ("deflate_compress: fix corruption + * with long literal run"). Try to compress a file longer than 65535 bytes + * where no 2-byte sequence (3 would be sufficient) is repeated <= 32768 bytes + * apart, and the distribution of bytes remains constant throughout, and yet not + * all bytes are used so the data is still slightly compressible. There will be + * no matches in this data, but the compressor should still output a compressed + * block, and this block should contain more than 65535 consecutive literals, + * which triggered the bug. + * + * Note: on random data, this situation is extremely unlikely if the compressor + * uses all matches it finds, since random data will on average have a 3-byte + * match every (256**3)/32768 = 512 bytes. + */ + +#include "test_util.h" + +int +tmain(int argc, tchar *argv[]) +{ + const int data_size = 2 * 250 * 251; + u8 *orig_data, *compressed_data, *decompressed_data; + int i, stride, multiple, j = 0; + struct libdeflate_decompressor *d; + static const int levels[] = { 3, 6, 12 }; + + begin_program(argv); + + orig_data = xmalloc(data_size); + compressed_data = xmalloc(data_size); + decompressed_data = xmalloc(data_size); + + for (i = 0; i < 2; i++) { + for (stride = 1; stride < 251; stride++) { + for (multiple = 0; multiple < 251; multiple++) + orig_data[j++] = (stride * multiple) % 251; + } + } + ASSERT(j == data_size); + + d = libdeflate_alloc_decompressor(); + ASSERT(d != NULL); + + for (i = 0; i < ARRAY_LEN(levels); i++) { + struct libdeflate_compressor *c; + size_t csize; + enum libdeflate_result res; + + c = libdeflate_alloc_compressor(levels[i]); + ASSERT(c != NULL); + + csize = libdeflate_deflate_compress(c, orig_data, data_size, + compressed_data, data_size); + ASSERT(csize > 0 && csize < data_size); + + res = libdeflate_deflate_decompress(d, compressed_data, csize, + decompressed_data, + data_size, NULL); + ASSERT(res == LIBDEFLATE_SUCCESS); + ASSERT(memcmp(orig_data, decompressed_data, data_size) == 0); + + libdeflate_free_compressor(c); + } + + libdeflate_free_decompressor(d); + free(orig_data); + free(compressed_data); + free(decompressed_data); + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/programs/test_overread.c b/tools/z64compress/src/enc/libdeflate/programs/test_overread.c new file mode 100644 index 000000000..2a6003218 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/test_overread.c @@ -0,0 +1,95 @@ +/* + * test_overread.c + * + * Test that the decompressor doesn't produce an unbounded amount of output if + * it runs out of input, even when implicit zeroes appended to the input would + * continue producing output (as is the case when the input ends during a + * DYNAMIC_HUFFMAN block where a literal has an all-zeroes codeword). + * + * This is a regression test for commit 3f21ec9d6121 ("deflate_decompress: error + * out if overread count gets too large"). + */ + +#include "test_util.h" + +static void +generate_test_input(struct output_bitstream *os) +{ + int i; + + put_bits(os, 0, 1); /* BFINAL: 0 */ + put_bits(os, 2, 2); /* BTYPE: DYNAMIC_HUFFMAN */ + + /* + * Write the Huffman codes. + * + * Litlen code: + * litlensym_0 (0) len=1 codeword=0 + * litlensym_256 (end-of-block) len=1 codeword=1 + * Offset code: + * offsetsym_0 (unused) len=1 codeword=0 + * + * Litlen and offset codeword lengths: + * [0] = 1 presym_1 + * [1..255] = 0 presym_{18,18} + * [256] = 1 presym_1 + * [257] = 1 presym_1 + * + * Precode: + * presym_1 len=1 codeword=0 + * presym_18 len=1 codeword=1 + */ + put_bits(os, 0, 5); /* num_litlen_syms: 0 + 257 */ + put_bits(os, 0, 5); /* num_offset_syms: 0 + 1 */ + put_bits(os, 14, 4); /* num_explicit_precode_lens: 14 + 4 */ + /* + * Precode codeword lengths: order is + * [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15] + */ + put_bits(os, 0, 3); /* presym_16: len=0 */ + put_bits(os, 0, 3); /* presym_17: len=0 */ + put_bits(os, 1, 3); /* presym_18: len=1 */ + for (i = 0; i < 14; i++) /* presym_{0,...,14}: len=0 */ + put_bits(os, 0, 3); + put_bits(os, 1, 3); /* presym_1: len=1 */ + + /* Litlen and offset codeword lengths */ + put_bits(os, 0, 1); /* presym_1 */ + put_bits(os, 1, 1); /* presym_18 ... */ + put_bits(os, 117, 7); /* ... 11 + 117 zeroes */ + put_bits(os, 1, 1); /* presym_18 ... */ + put_bits(os, 116, 7); /* ... 11 + 116 zeroes */ + put_bits(os, 0, 1); /* presym_1 */ + put_bits(os, 0, 1); /* presym_1 */ + + /* Implicit zeroes would generate endless literals from here. */ + + ASSERT(flush_bits(os)); +} + +int +tmain(int argc, tchar *argv[]) +{ + u8 cdata[16]; + u8 udata[256]; + struct output_bitstream os = + { .next = cdata, .end = cdata + sizeof(cdata) }; + struct libdeflate_decompressor *d; + enum libdeflate_result res; + size_t actual_out_nbytes; + + begin_program(argv); + + generate_test_input(&os); + d = libdeflate_alloc_decompressor(); + ASSERT(d != NULL); + + res = libdeflate_deflate_decompress(d, cdata, os.next - cdata, + udata, sizeof(udata), + &actual_out_nbytes); + /* Before the fix, the result was LIBDEFLATE_INSUFFICIENT_SPACE here. */ + ASSERT(res == LIBDEFLATE_BAD_DATA); + + libdeflate_free_decompressor(d); + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/programs/test_slow_decompression.c b/tools/z64compress/src/enc/libdeflate/programs/test_slow_decompression.c new file mode 100644 index 000000000..d5ac26245 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/test_slow_decompression.c @@ -0,0 +1,472 @@ +/* + * test_slow_decompression.c + * + * Test how quickly libdeflate decompresses degenerate/malicious compressed data + * streams that start new Huffman blocks extremely frequently. + */ + +#include "test_util.h" + +/* + * Generate a DEFLATE stream containing all empty "static Huffman" blocks. + * + * libdeflate used to decompress this very slowly (~1000x slower than typical + * data), but now it's much faster (only ~2x slower than typical data) because + * now it skips rebuilding the decode tables for the static Huffman codes when + * they're already loaded into the decompressor. + */ +static void +generate_empty_static_huffman_blocks(u8 *p, size_t len) +{ + struct output_bitstream os = { .next = p, .end = p + len }; + + while (put_bits(&os, 0, 1) && /* BFINAL: 0 */ + put_bits(&os, 1, 2) && /* BTYPE: STATIC_HUFFMAN */ + put_bits(&os, 0, 7)) /* litlensym_256 (end-of-block) */ + ; +} + +static bool +generate_empty_dynamic_huffman_block(struct output_bitstream *os) +{ + int i; + + if (!put_bits(os, 0, 1)) /* BFINAL: 0 */ + return false; + if (!put_bits(os, 2, 2)) /* BTYPE: DYNAMIC_HUFFMAN */ + return false; + + /* + * Write a minimal Huffman code, then the end-of-block symbol. + * + * Litlen code: + * litlensym_256 (end-of-block) freq=1 len=1 codeword=0 + * Offset code: + * offsetsym_0 (unused) freq=0 len=1 codeword=0 + * + * Litlen and offset codeword lengths: + * [0..255] = 0 presym_{18,18} + * [256] = 1 presym_1 + * [257] = 1 presym_1 + * + * Precode: + * presym_1 freq=2 len=1 codeword=0 + * presym_18 freq=2 len=1 codeword=1 + */ + + if (!put_bits(os, 0, 5)) /* num_litlen_syms: 0 + 257 */ + return false; + if (!put_bits(os, 0, 5)) /* num_offset_syms: 0 + 1 */ + return false; + if (!put_bits(os, 14, 4)) /* num_explicit_precode_lens: 14 + 4 */ + return false; + /* + * Precode codeword lengths: order is + * [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15] + */ + for (i = 0; i < 2; i++) { /* presym_{16,17}: len=0 */ + if (!put_bits(os, 0, 3)) + return false; + } + if (!put_bits(os, 1, 3)) /* presym_18: len=1 */ + return false; + for (i = 0; i < 14; i++) { /* presym_{0,...,14}: len=0 */ + if (!put_bits(os, 0, 3)) + return false; + } + if (!put_bits(os, 1, 3)) /* presym_1: len=1 */ + return false; + + /* Litlen and offset codeword lengths */ + for (i = 0; i < 2; i++) { + if (!put_bits(os, 1, 1) || /* presym_18, 128 zeroes */ + !put_bits(os, 117, 7)) + return false; + } + if (!put_bits(os, 0, 1)) /* presym_1 */ + return false; + if (!put_bits(os, 0, 1)) /* presym_1 */ + return false; + /* Done writing the Huffman codes */ + + return put_bits(os, 0, 1); /* litlensym_256 (end-of-block) */ +} + +/* + * Generate a DEFLATE stream containing all empty "dynamic Huffman" blocks. + * + * This is the worst known case currently, being ~100x slower to decompress than + * typical data. + */ +static void +generate_empty_dynamic_huffman_blocks(u8 *p, size_t len) +{ + struct output_bitstream os = { .next = p, .end = p + len }; + + while (generate_empty_dynamic_huffman_block(&os)) + ; +} + +#define NUM_ITERATIONS 100 + +static u64 +do_test_libdeflate(const char *input_type, const u8 *in, size_t in_nbytes, + u8 *out, size_t out_nbytes_avail) +{ + struct libdeflate_decompressor *d; + enum libdeflate_result res; + u64 t; + int i; + + d = libdeflate_alloc_decompressor(); + ASSERT(d != NULL); + + t = timer_ticks(); + for (i = 0; i < NUM_ITERATIONS; i++) { + res = libdeflate_deflate_decompress(d, in, in_nbytes, out, + out_nbytes_avail, NULL); + ASSERT(res == LIBDEFLATE_BAD_DATA || + res == LIBDEFLATE_INSUFFICIENT_SPACE); + } + t = timer_ticks() - t; + + printf("[%s, libdeflate]: %"PRIu64" KB/s\n", input_type, + timer_KB_per_s((u64)in_nbytes * NUM_ITERATIONS, t)); + + libdeflate_free_decompressor(d); + return t; +} + +static u64 +do_test_zlib(const char *input_type, const u8 *in, size_t in_nbytes, + u8 *out, size_t out_nbytes_avail) +{ + z_stream z; + int res; + u64 t; + int i; + + memset(&z, 0, sizeof(z)); + res = inflateInit2(&z, -15); + ASSERT(res == Z_OK); + + t = timer_ticks(); + for (i = 0; i < NUM_ITERATIONS; i++) { + inflateReset(&z); + z.next_in = (void *)in; + z.avail_in = in_nbytes; + z.next_out = out; + z.avail_out = out_nbytes_avail; + res = inflate(&z, Z_FINISH); + ASSERT(res == Z_BUF_ERROR || res == Z_DATA_ERROR); + } + t = timer_ticks() - t; + + printf("[%s, zlib ]: %"PRIu64" KB/s\n", input_type, + timer_KB_per_s((u64)in_nbytes * NUM_ITERATIONS, t)); + + inflateEnd(&z); + return t; +} + +/* + * Test case from https://github.com/ebiggers/libdeflate/issues/33 + * with the gzip header and footer removed to leave just the DEFLATE stream + */ +static const u8 orig_repro[3962] = + "\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a" + "\x6a\x6a\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20" + "\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28" + "\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11" + "\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48" + "\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80" + "\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28\x00" + "\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea" + "\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea" + "\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48" + "\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20" + "\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00" + "\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11" + "\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x63" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92" + "\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00" + "\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48" + "\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20" + "\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00" + "\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x92\x63\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea" + "\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48" + "\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11" + "\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00" + "\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x92\x63\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11" + "\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63" + "\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea" + "\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x92\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a" + "\x6a\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80" + "\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28\x00" + "\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00" + "\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x92\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a\x6a" + "\x6a\x6a\x6a\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00" + "\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80" + "\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00" + "\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04" + "\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20" + "\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28" + "\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00" + "\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04" + "\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00" + "\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28" + "\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00" + "\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x63\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04" + "\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00" + "\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28" + "\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x92\x63\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00" + "\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04" + "\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00" + "\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28" + "\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x92\x63\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00" + "\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92" + "\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00" + "\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x63\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00" + "\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80" + "\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00" + "\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92" + "\x63\x00\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00" + "\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04" + "\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00\x20" + "\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x00\xea\x04\x48\x00\x20\x80\x28" + "\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1a\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00" + "\xea\x04\x48\x00\x20\x80\x28\x00\x00\x11\x00\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b" + "\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x1b\x92\x63\x00\x04\xea\x48\x00\x20" + "\x80\x28\x00\x00\x11\x1b\x1b\x1b\x1b\x92\x63\x00\xea\x04\x48\x00" + "\x20\x80\x28\x00\x00\x11\x00\x00\x01\x04\x00\x3f\x00\x00\x00\x00" + "\x28\xf7\xff\x00\xff\xff\xff\xff\x00\x00"; + +int +tmain(int argc, tchar *argv[]) +{ + u8 in[4096]; + u8 out[10000]; + u64 t, tz; + + begin_program(argv); + + begin_performance_test(); + + /* static huffman case */ + generate_empty_static_huffman_blocks(in, sizeof(in)); + t = do_test_libdeflate("static huffman", in, sizeof(in), + out, sizeof(out)); + tz = do_test_zlib("static huffman", in, sizeof(in), out, sizeof(out)); + /* + * libdeflate is faster than zlib in this case, e.g. + * [static huffman, libdeflate]: 215861 KB/s + * [static huffman, zlib ]: 73651 KB/s + */ + putchar('\n'); + ASSERT(t < tz); + + /* dynamic huffman case */ + generate_empty_dynamic_huffman_blocks(in, sizeof(in)); + t = do_test_libdeflate("dynamic huffman", in, sizeof(in), + out, sizeof(out)); + tz = do_test_zlib("dynamic huffman", in, sizeof(in), out, sizeof(out)); + /* + * libdeflate is slower than zlib in this case, though not super bad. + * [dynamic huffman, libdeflate]: 6277 KB/s + * [dynamic huffman, zlib ]: 10419 KB/s + * FIXME: make it faster. + */ + putchar('\n'); + ASSERT(t < 4 * tz); + + /* original reproducer */ + t = do_test_libdeflate("original repro", orig_repro, sizeof(orig_repro), + out, sizeof(out)); + tz = do_test_zlib("original repro", orig_repro, sizeof(orig_repro), + out, sizeof(out)); + ASSERT(t < tz); + + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/programs/test_trailing_bytes.c b/tools/z64compress/src/enc/libdeflate/programs/test_trailing_bytes.c new file mode 100644 index 000000000..e37e97b9c --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/test_trailing_bytes.c @@ -0,0 +1,151 @@ +/* + * test_trailing_bytes.c + * + * Test that decompression correctly stops at the end of the first DEFLATE, + * zlib, or gzip stream, and doesn't process any additional trailing bytes. + */ + +#include "test_util.h" + +static const struct { + size_t (*compress)(struct libdeflate_compressor *compressor, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail); + enum libdeflate_result (*decompress)( + struct libdeflate_decompressor *decompressor, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_out_nbytes_ret); + enum libdeflate_result (*decompress_ex)( + struct libdeflate_decompressor *decompressor, + const void *in, size_t in_nbytes, + void *out, size_t out_nbytes_avail, + size_t *actual_in_nbytes_ret, + size_t *actual_out_nbytes_ret); +} codecs[] = { + { + .compress = libdeflate_deflate_compress, + .decompress = libdeflate_deflate_decompress, + .decompress_ex = libdeflate_deflate_decompress_ex, + }, { + .compress = libdeflate_zlib_compress, + .decompress = libdeflate_zlib_decompress, + .decompress_ex = libdeflate_zlib_decompress_ex, + }, { + .compress = libdeflate_gzip_compress, + .decompress = libdeflate_gzip_decompress, + .decompress_ex = libdeflate_gzip_decompress_ex, + } +}; + +int +tmain(int argc, tchar *argv[]) +{ + const size_t original_nbytes = 32768; + const size_t compressed_nbytes_total = 32768; + /* + * Don't use the full buffer for compressed data, because we want to + * test whether decompression can deal with additional trailing bytes. + * + * Note: we can't use a guarded buffer (i.e. a buffer where the byte + * after compressed_nbytes is unmapped) because the decompressor may + * read a few bytes beyond the end of the stream (but ultimately not + * actually use those bytes) as long as they are within the buffer. + */ + const size_t compressed_nbytes_avail = 30000; + size_t i; + u8 *original; + u8 *compressed; + u8 *decompressed; + struct libdeflate_compressor *c; + struct libdeflate_decompressor *d; + size_t compressed_nbytes; + enum libdeflate_result res; + size_t actual_compressed_nbytes; + size_t actual_decompressed_nbytes; + + begin_program(argv); + + ASSERT(compressed_nbytes_avail < compressed_nbytes_total); + + /* Prepare some dummy data to compress */ + original = xmalloc(original_nbytes); + ASSERT(original != NULL); + for (i = 0; i < original_nbytes; i++) + original[i] = (i % 123) + (i % 1023); + + compressed = xmalloc(compressed_nbytes_total); + ASSERT(compressed != NULL); + memset(compressed, 0, compressed_nbytes_total); + + decompressed = xmalloc(original_nbytes); + ASSERT(decompressed != NULL); + + c = libdeflate_alloc_compressor(6); + ASSERT(c != NULL); + + d = libdeflate_alloc_decompressor(); + ASSERT(d != NULL); + + for (i = 0; i < ARRAY_LEN(codecs); i++) { + compressed_nbytes = codecs[i].compress(c, original, + original_nbytes, + compressed, + compressed_nbytes_avail); + ASSERT(compressed_nbytes > 0); + ASSERT(compressed_nbytes <= compressed_nbytes_avail); + + /* Test decompress() of stream that fills the whole buffer */ + actual_decompressed_nbytes = 0; + memset(decompressed, 0, original_nbytes); + res = codecs[i].decompress(d, compressed, compressed_nbytes, + decompressed, original_nbytes, + &actual_decompressed_nbytes); + ASSERT(res == LIBDEFLATE_SUCCESS); + ASSERT(actual_decompressed_nbytes == original_nbytes); + ASSERT(memcmp(decompressed, original, original_nbytes) == 0); + + /* Test decompress_ex() of stream that fills the whole buffer */ + actual_compressed_nbytes = actual_decompressed_nbytes = 0; + memset(decompressed, 0, original_nbytes); + res = codecs[i].decompress_ex(d, compressed, compressed_nbytes, + decompressed, original_nbytes, + &actual_compressed_nbytes, + &actual_decompressed_nbytes); + ASSERT(res == LIBDEFLATE_SUCCESS); + ASSERT(actual_compressed_nbytes == compressed_nbytes); + ASSERT(actual_decompressed_nbytes == original_nbytes); + ASSERT(memcmp(decompressed, original, original_nbytes) == 0); + + /* Test decompress() of stream with trailing bytes */ + actual_decompressed_nbytes = 0; + memset(decompressed, 0, original_nbytes); + res = codecs[i].decompress(d, compressed, + compressed_nbytes_total, + decompressed, original_nbytes, + &actual_decompressed_nbytes); + ASSERT(res == LIBDEFLATE_SUCCESS); + ASSERT(actual_decompressed_nbytes == original_nbytes); + ASSERT(memcmp(decompressed, original, original_nbytes) == 0); + + /* Test decompress_ex() of stream with trailing bytes */ + actual_compressed_nbytes = actual_decompressed_nbytes = 0; + memset(decompressed, 0, original_nbytes); + res = codecs[i].decompress_ex(d, compressed, + compressed_nbytes_total, + decompressed, original_nbytes, + &actual_compressed_nbytes, + &actual_decompressed_nbytes); + ASSERT(res == LIBDEFLATE_SUCCESS); + ASSERT(actual_compressed_nbytes == compressed_nbytes); + ASSERT(actual_decompressed_nbytes == original_nbytes); + ASSERT(memcmp(decompressed, original, original_nbytes) == 0); + } + + free(original); + free(compressed); + free(decompressed); + libdeflate_free_compressor(c); + libdeflate_free_decompressor(d); + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/programs/test_util.c b/tools/z64compress/src/enc/libdeflate/programs/test_util.c new file mode 100644 index 000000000..20e7c217f --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/test_util.c @@ -0,0 +1,243 @@ +/* + * test_util.c - utility functions for test programs + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _WIN32 +/* for MAP_ANONYMOUS or MAP_ANON, which unfortunately aren't part of POSIX... */ +# undef _POSIX_C_SOURCE +# ifdef __APPLE__ +# define _DARWIN_C_SOURCE +# elif defined(__linux__) +# define _GNU_SOURCE +# endif +#endif + +#include "test_util.h" + +#include +#include +#ifdef _WIN32 +# include +#else +# include +# include +# include +#endif + +#ifndef MAP_ANONYMOUS +# define MAP_ANONYMOUS MAP_ANON +#endif + +/* Abort with an error message */ +_noreturn void +assertion_failed(const char *expr, const char *file, int line) +{ + msg("Assertion failed: %s at %s:%d", expr, file, line); + abort(); +} + +void +begin_performance_test(void) +{ + /* Skip performance tests by default, since they can be flaky. */ + if (getenv("INCLUDE_PERF_TESTS") == NULL) + exit(0); +} + +static size_t +get_page_size(void) +{ +#ifdef _WIN32 + SYSTEM_INFO info; + + GetSystemInfo(&info); + return info.dwPageSize; +#else + return sysconf(_SC_PAGESIZE); +#endif +} + +/* Allocate a buffer with guard pages */ +void +alloc_guarded_buffer(size_t size, u8 **start_ret, u8 **end_ret) +{ + const size_t pagesize = get_page_size(); + const size_t nr_pages = (size + pagesize - 1) / pagesize; + u8 *base_addr; + u8 *start, *end; +#ifdef _WIN32 + DWORD oldProtect; +#endif + + *start_ret = NULL; + *end_ret = NULL; + +#ifdef _WIN32 + /* Allocate buffer and guard pages with no access. */ + base_addr = VirtualAlloc(NULL, (nr_pages + 2) * pagesize, + MEM_COMMIT | MEM_RESERVE, PAGE_NOACCESS); + if (!base_addr) { + msg("Unable to allocate memory (VirtualAlloc): Windows error %u", + (unsigned int)GetLastError()); + ASSERT(0); + } + start = base_addr + pagesize; + end = start + (nr_pages * pagesize); + + /* Grant read+write access to just the buffer. */ + if (!VirtualProtect(start, end - start, PAGE_READWRITE, &oldProtect)) { + msg("Unable to protect memory (VirtualProtect): Windows error %u", + (unsigned int)GetLastError()); + VirtualFree(base_addr, 0, MEM_RELEASE); + ASSERT(0); + } +#else + /* Allocate buffer and guard pages. */ + base_addr = mmap(NULL, (nr_pages + 2) * pagesize, PROT_READ|PROT_WRITE, + MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); + if (base_addr == (u8 *)MAP_FAILED) { + msg_errno("Unable to allocate memory (anonymous mmap)"); + ASSERT(0); + } + start = base_addr + pagesize; + end = start + (nr_pages * pagesize); + + /* Unmap the guard pages. */ + munmap(base_addr, pagesize); + munmap(end, pagesize); +#endif + *start_ret = start; + *end_ret = end; +} + +/* Free a buffer that was allocated by alloc_guarded_buffer() */ +void +free_guarded_buffer(u8 *start, u8 *end) +{ + if (!start) + return; +#ifdef _WIN32 + VirtualFree(start - get_page_size(), 0, MEM_RELEASE); +#else + munmap(start, end - start); +#endif +} + +/* + * Return the number of timer ticks that have elapsed since some unspecified + * point fixed at the start of program execution + */ +u64 +timer_ticks(void) +{ +#ifdef _WIN32 + LARGE_INTEGER count; + + QueryPerformanceCounter(&count); + return count.QuadPart; +#elif defined(HAVE_CLOCK_GETTIME) + struct timespec ts; + + clock_gettime(CLOCK_MONOTONIC, &ts); + return (1000000000 * (u64)ts.tv_sec) + ts.tv_nsec; +#else + struct timeval tv; + + gettimeofday(&tv, NULL); + return (1000000 * (u64)tv.tv_sec) + tv.tv_usec; +#endif +} + +/* + * Return the number of timer ticks per second + */ +static u64 +timer_frequency(void) +{ +#ifdef _WIN32 + LARGE_INTEGER freq; + + QueryPerformanceFrequency(&freq); + return freq.QuadPart; +#elif defined(HAVE_CLOCK_GETTIME) + return 1000000000; +#else + return 1000000; +#endif +} + +/* + * Convert a number of elapsed timer ticks to milliseconds + */ +u64 timer_ticks_to_ms(u64 ticks) +{ + return ticks * 1000 / timer_frequency(); +} + +/* + * Convert a byte count and a number of elapsed timer ticks to MB/s + */ +u64 timer_MB_per_s(u64 bytes, u64 ticks) +{ + return bytes * timer_frequency() / ticks / 1000000; +} + +/* + * Convert a byte count and a number of elapsed timer ticks to KB/s + */ +u64 timer_KB_per_s(u64 bytes, u64 ticks) +{ + return bytes * timer_frequency() / ticks / 1000; +} + +bool +put_bits(struct output_bitstream *os, machine_word_t bits, int num_bits) +{ + os->bitbuf |= bits << os->bitcount; + os->bitcount += num_bits; + while (os->bitcount >= 8) { + if (os->next == os->end) + return false; + *os->next++ = os->bitbuf; + os->bitcount -= 8; + os->bitbuf >>= 8; + } + return true; +} + +bool +flush_bits(struct output_bitstream *os) +{ + while (os->bitcount > 0) { + if (os->next == os->end) + return false; + *os->next++ = os->bitbuf; + os->bitcount -= 8; + os->bitbuf >>= 8; + } + os->bitcount = 0; + return true; +} diff --git a/tools/z64compress/src/enc/libdeflate/programs/test_util.h b/tools/z64compress/src/enc/libdeflate/programs/test_util.h new file mode 100644 index 000000000..4fb9688f6 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/test_util.h @@ -0,0 +1,67 @@ +/* + * test_util.h - utility functions for test programs + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef PROGRAMS_TEST_UTIL_H +#define PROGRAMS_TEST_UTIL_H + +#include "prog_util.h" + +#include /* for comparison purposes */ + +#if defined(__GNUC__) || __has_attribute(noreturn) +# define _noreturn __attribute__((noreturn)) +#else +# define _noreturn +#endif + +void _noreturn +assertion_failed(const char *expr, const char *file, int line); + +#define ASSERT(expr) { if (unlikely(!(expr))) \ + assertion_failed(#expr, __FILE__, __LINE__); } + +void begin_performance_test(void); + +void alloc_guarded_buffer(size_t size, u8 **start_ret, u8 **end_ret); +void free_guarded_buffer(u8 *start, u8 *end); + +u64 timer_ticks(void); +u64 timer_ticks_to_ms(u64 ticks); +u64 timer_MB_per_s(u64 bytes, u64 ticks); +u64 timer_KB_per_s(u64 bytes, u64 ticks); + +struct output_bitstream { + machine_word_t bitbuf; + int bitcount; + u8 *next; + u8 *end; +}; + +bool put_bits(struct output_bitstream *os, machine_word_t bits, int num_bits); +bool flush_bits(struct output_bitstream *os); + +#endif /* PROGRAMS_TEST_UTIL_H */ diff --git a/tools/z64compress/src/enc/libdeflate/programs/tgetopt.c b/tools/z64compress/src/enc/libdeflate/programs/tgetopt.c new file mode 100644 index 000000000..868600d97 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/programs/tgetopt.c @@ -0,0 +1,118 @@ +/* + * tgetopt.c - portable replacement for GNU getopt() + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "prog_util.h" + +tchar *toptarg; +int toptind = 1, topterr = 1, toptopt; + +/* + * This is a simple implementation of getopt(). It can be compiled with either + * 'char' or 'wchar_t' as the character type. + * + * Do *not* use this implementation if you need any of the following features, + * as they are not supported: + * - Long options + * - Option-related arguments retained in argv, not nulled out + * - '+' and '-' characters in optstring + */ +int +tgetopt(int argc, tchar *argv[], const tchar *optstring) +{ + static tchar empty[1]; + static tchar *nextchar; + static bool done; + + if (toptind == 1) { + /* Starting to scan a new argument vector */ + nextchar = NULL; + done = false; + } + + while (!done && (nextchar != NULL || toptind < argc)) { + if (nextchar == NULL) { + /* Scanning a new argument */ + tchar *arg = argv[toptind++]; + if (arg[0] == '-' && arg[1] != '\0') { + if (arg[1] == '-' && arg[2] == '\0') { + /* All args after "--" are nonoptions */ + argv[toptind - 1] = NULL; + done = true; + } else { + /* Start of short option characters */ + nextchar = &arg[1]; + } + } + } else { + /* More short options in previous arg */ + tchar opt = *nextchar; + tchar *p = tstrchr(optstring, opt); + if (p == NULL) { + if (topterr) + msg("invalid option -- '%"TC"'", opt); + toptopt = opt; + return '?'; + } + /* 'opt' is a valid short option character */ + nextchar++; + toptarg = NULL; + if (*(p + 1) == ':') { + /* 'opt' can take an argument */ + if (*nextchar != '\0') { + /* Optarg is in same argv argument */ + toptarg = nextchar; + nextchar = empty; + } else if (toptind < argc && *(p + 2) != ':') { + /* Optarg is next argv argument */ + argv[toptind - 1] = NULL; + toptarg = argv[toptind++]; + } else if (*(p + 2) != ':') { + if (topterr && *optstring != ':') { + msg("option requires an " + "argument -- '%"TC"'", opt); + } + toptopt = opt; + opt = (*optstring == ':') ? ':' : '?'; + } + } + if (*nextchar == '\0') { + argv[toptind - 1] = NULL; + nextchar = NULL; + } + return opt; + } + } + + /* Done scanning. Move all nonoptions to the end, set optind to the + * index of the first nonoption, and return -1. */ + toptind = argc; + while (--argc > 0) + if (argv[argc] != NULL) + argv[--toptind] = argv[argc]; + done = true; + return -1; +} diff --git a/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/deflate_compress/fuzz.c b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/deflate_compress/fuzz.c new file mode 100644 index 000000000..420a7db67 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/deflate_compress/fuzz.c @@ -0,0 +1,56 @@ +#include +#include +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + struct libdeflate_decompressor *d; + struct libdeflate_compressor *c; + int ret; + int fd = open(argv[1], O_RDONLY); + struct stat stbuf; + unsigned char level; + unsigned char use_bound; + + assert(fd >= 0); + ret = fstat(fd, &stbuf); + assert(!ret); + + if (stbuf.st_size < 2) + return 0; + ret = read(fd, &level, 1); + assert(ret == 1); + level %= 13; + + ret = read(fd, &use_bound, 1); + assert(ret == 1); + use_bound %= 2; + + char in[stbuf.st_size - 2]; + ret = read(fd, in, sizeof in); + assert(ret == sizeof in); + + c = libdeflate_alloc_compressor(level); + d = libdeflate_alloc_decompressor(); + + size_t outsize = use_bound ? libdeflate_deflate_compress_bound(c, sizeof(in)) : sizeof(in); + char out[outsize]; + char checkarray[sizeof(in)]; + + size_t csize = libdeflate_deflate_compress(c, in,sizeof in, out, outsize); + if (csize != 0) { + enum libdeflate_result res; + res = libdeflate_deflate_decompress(d, out, csize, checkarray, sizeof in, NULL); + assert(!res); + assert(!memcmp(in, checkarray, sizeof in)); + } else { + assert(!use_bound); + } + + libdeflate_free_compressor(c); + libdeflate_free_decompressor(d); + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/deflate_compress/inputs/0 b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/deflate_compress/inputs/0 new file mode 100644 index 000000000..875bce73a Binary files /dev/null and b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/deflate_compress/inputs/0 differ diff --git a/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/deflate_decompress/fuzz.c b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/deflate_decompress/fuzz.c new file mode 100644 index 000000000..8cc4ce55c --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/deflate_decompress/fuzz.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + struct libdeflate_decompressor *d; + int ret; + int fd = open(argv[1], O_RDONLY); + struct stat stbuf; + assert(fd >= 0); + ret = fstat(fd, &stbuf); + assert(!ret); + + char in[stbuf.st_size]; + ret = read(fd, in, sizeof in); + assert(ret == sizeof in); + + char out[sizeof(in) * 3]; + + d = libdeflate_alloc_decompressor(); + + libdeflate_deflate_decompress(d, in, sizeof in, out, sizeof out, NULL); + libdeflate_free_decompressor(d); + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/deflate_decompress/inputs/0 b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/deflate_decompress/inputs/0 new file mode 100644 index 000000000..19e3a346e --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/deflate_decompress/inputs/0 @@ -0,0 +1,3 @@ +uŽ1 +Â@EgÅBl5 +‚°VÅÒè6j—«X{i=•èl=€àΟ¬Ñlóßü™?tíÐç½D í¨ò=¯GÑ% ¾©—2xÔ‡7eðD½ÓÐs[ÔиUkÅ÷q¹ |R/åêµùë®°*F¢Mzš¼v°•`ÐÇórÐ1ªóB÷,lDuYj#0<ÅÕž2È0hE`¹øI°ÿìW \ No newline at end of file diff --git a/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/fuzz.sh b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/fuzz.sh new file mode 100644 index 000000000..c78a2ca05 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/fuzz.sh @@ -0,0 +1,154 @@ +#!/bin/bash + +set -e -u -o pipefail + +cd "$(dirname "$0")" + +read -r -a AVAILABLE_TARGETS < <(echo */fuzz.c | sed 's@/fuzz.c@@g') + +usage() +{ + cat << EOF +Usage: $0 [OPTION]... [TARGET]... + +Fuzz libdeflate with afl-fuzz. + +Options: + --asan Enable AddressSanitizer + --no-resume Don't resume existing afl-fuzz session; start a new one + --ubsan Enable UndefinedBehaviorSanitizer + +Available targets: ${AVAILABLE_TARGETS[*]} +EOF +} + +die() +{ + echo "$*" 1>&2 + exit 1 +} + +asan=false +ubsan=false +may_resume=true + +longopts_array=( +asan +help +no-resume +ubsan +) +longopts=$(echo "${longopts_array[@]}" | tr ' ' ',') + +if ! options=$(getopt -o "" -l "$longopts" -- "$@"); then + usage 1>&2 + exit 1 +fi +eval set -- "$options" +while (( $# >= 0 )); do + case "$1" in + --asan) + asan=true + ;; + --help) + usage + exit 0 + ;; + --no-resume) + may_resume=false + ;; + --ubsan) + ubsan=true + ;; + --) + shift + break + ;; + *) + echo 1>&2 "Invalid option: \"$1\"" + usage 1>&2 + exit 1 + esac + shift +done + +if $asan && $ubsan; then + die "--asan and --ubsan are mutually exclusive" +fi + +if ! type -P afl-fuzz > /dev/null; then + die "afl-fuzz is not installed" +fi + +if (( $# == 0 )); then + targets=("${AVAILABLE_TARGETS[@]}") +else + for target; do + found=false + for t in "${AVAILABLE_TARGETS[@]}"; do + if [ "$target" = "$t" ]; then + found=true + fi + done + if ! $found; then + echo 1>&2 "Unknown target '$target'" + echo 1>&2 "Available targets: ${AVAILABLE_TARGETS[*]}" + exit 1 + fi + done + targets=("$@") +fi +if (( ${#targets[@]} > 1 )) && ! type -P urxvt > /dev/null; then + die "urxvt is not installed" +fi + +afl_opts="" +if $asan; then + export AFL_USE_ASAN=1 + export CFLAGS="-O2 -m32" + export CC=afl-clang + afl_opts+=" -m 800" +elif $ubsan; then + export CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined" + export CC=afl-gcc +else + export AFL_HARDEN=1 + export CFLAGS="-O2" + export CC=afl-gcc +fi +CFLAGS+=" -DLIBDEFLATE_ENABLE_ASSERTIONS" + +sudo sh -c "echo core > /proc/sys/kernel/core_pattern" +if [ -e /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then + sudo sh -c "echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" +fi + +srcdir=../.. +builddir=$srcdir/build +$srcdir/scripts/cmake-helper.sh -G Ninja +cmake --build $builddir + +for dir in "${targets[@]}"; do + cp -vaT "$dir" "/tmp/$dir" + # shellcheck disable=SC2086 # Intended word splitting of $CFLAGS + $CC $CFLAGS -Wall -I$srcdir "$dir"/fuzz.c $builddir/libdeflate.a \ + -o "/tmp/$dir/fuzz" + indir=/tmp/$dir/inputs + outdir=/tmp/$dir/outputs + if [ -e "$outdir" ]; then + if $may_resume; then + indir="-" + else + rm -rf "${outdir:?}"/* + fi + else + mkdir "$outdir" + fi + cmd="afl-fuzz -i $indir -o $outdir -T $dir $afl_opts -- /tmp/$dir/fuzz @@" + if (( ${#targets[@]} > 1 )); then + urxvt -e bash -c "$cmd" & + else + $cmd + fi +done +wait diff --git a/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/gzip_decompress/fuzz.c b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/gzip_decompress/fuzz.c new file mode 100644 index 000000000..aec50804c --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/gzip_decompress/fuzz.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + struct libdeflate_decompressor *d; + int ret; + int fd = open(argv[1], O_RDONLY); + struct stat stbuf; + assert(fd >= 0); + ret = fstat(fd, &stbuf); + assert(!ret); + + char in[stbuf.st_size]; + ret = read(fd, in, sizeof in); + assert(ret == sizeof in); + + char out[sizeof(in) * 3]; + + d = libdeflate_alloc_decompressor(); + + libdeflate_gzip_decompress(d, in, sizeof in, out, sizeof out, NULL); + libdeflate_free_decompressor(d); + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/gzip_decompress/inputs/0 b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/gzip_decompress/inputs/0 new file mode 100644 index 000000000..813c75359 Binary files /dev/null and b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/gzip_decompress/inputs/0 differ diff --git a/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/zlib_decompress/fuzz.c b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/zlib_decompress/fuzz.c new file mode 100644 index 000000000..797343bbf --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/zlib_decompress/fuzz.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + struct libdeflate_decompressor *d; + int ret; + int fd = open(argv[1], O_RDONLY); + struct stat stbuf; + assert(fd >= 0); + ret = fstat(fd, &stbuf); + assert(!ret); + + char in[stbuf.st_size]; + ret = read(fd, in, sizeof in); + assert(ret == sizeof in); + + char out[sizeof(in) * 3]; + + d = libdeflate_alloc_decompressor(); + + libdeflate_zlib_decompress(d, in, sizeof in, out, sizeof out, NULL); + libdeflate_free_decompressor(d); + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/zlib_decompress/inputs/0 b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/zlib_decompress/inputs/0 new file mode 100644 index 000000000..292e9726d --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/afl-fuzz/zlib_decompress/inputs/0 @@ -0,0 +1,3 @@ +xœuŽ1 +Â@EgÅBl5 +‚°VÅÒè6j—«X{i=•èl=€àΟ¬Ñlóßü™?tíÐç½D í¨ò=¯GÑ% ¾©—2xÔ‡7eðD½ÓÐs[ÔиUkÅ÷q¹ |R/åêµùë®°*F¢Mzš¼v°•`ÐÇórÐ1ªóB÷,lDuYj#0<ÅÕž2È0hE`¹øI°ÿìWÂ-© \ No newline at end of file diff --git a/tools/z64compress/src/enc/libdeflate/scripts/android_build.sh b/tools/z64compress/src/enc/libdeflate/scripts/android_build.sh new file mode 100644 index 000000000..ae0b4bc0e --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/android_build.sh @@ -0,0 +1,117 @@ +#!/bin/bash + +set -eu -o pipefail + +SCRIPTDIR="$(dirname "$0")" +BUILDDIR="$SCRIPTDIR/../build" +API_LEVEL=28 +ARCH=arm64 +export CFLAGS=${CFLAGS:-} +ENABLE_CRC=false +ENABLE_CRYPTO=false +NDKDIR=$HOME/android-ndk-r23b + +usage() { + cat << EOF +Usage: $0 [OPTION]... +Build libdeflate for Android. + + --api-level=LEVEL Android API level to target (default: $API_LEVEL) + --arch=ARCH Architecture: arm32|arm64|x86|x86_64 (default: $ARCH) + --enable-crc Enable crc instructions + --enable-crypto Enable crypto instructions + --ndkdir=NDKDIR Android NDK directory (default: $NDKDIR) +EOF +} +if ! options=$(getopt -o '' \ + -l 'api-level:,arch:,enable-crc,enable-crypto,help,ndkdir:' -- "$@"); then + usage 1>&2 + exit 1 +fi + +eval set -- "$options" + +while [ $# -gt 0 ]; do + case "$1" in + --api-level) + API_LEVEL="$2" + shift + ;; + --arch) + ARCH="$2" + shift + ;; + --enable-crc) + ENABLE_CRC=true + ;; + --enable-crypto) + ENABLE_CRYPTO=true + ;; + --help) + usage + exit 0 + ;; + --ndkdir) + NDKDIR="$2" + shift + ;; + --) + shift + break + ;; + *) + echo 1>&2 "Unknown option \"$1\"" + usage 1>&2 + exit 1 + esac + shift +done + +case "$ARCH" in +arm|arm32|aarch32|armeabi-v7a) + ANDROID_ABI=armeabi-v7a + if $ENABLE_CRC || $ENABLE_CRYPTO; then + CFLAGS+=" -march=armv8-a" + if $ENABLE_CRC; then + CFLAGS+=" -mcrc" + else + CFLAGS+=" -mnocrc" + fi + if $ENABLE_CRYPTO; then + CFLAGS+=" -mfpu=crypto-neon-fp-armv8" + else + CFLAGS+=" -mfpu=neon" + fi + fi + ;; +arm64|aarch64|arm64-v8a) + ANDROID_ABI=arm64-v8a + features="" + if $ENABLE_CRC; then + features+="+crc" + fi + if $ENABLE_CRYPTO; then + features+="+crypto" + fi + if [ -n "$features" ]; then + CFLAGS+=" -march=armv8-a$features" + fi + ;; +x86) + ANDROID_ABI=x86 + ;; +x86_64) + ANDROID_ABI=x86_64 + ;; +*) + echo 1>&2 "Unknown architecture: \"$ARCH\"" + usage 1>&2 + exit 1 +esac + +"$SCRIPTDIR"/cmake-helper.sh -G Ninja \ + -DCMAKE_TOOLCHAIN_FILE="$NDKDIR"/build/cmake/android.toolchain.cmake \ + -DANDROID_ABI="$ANDROID_ABI" \ + -DANDROID_PLATFORM="$API_LEVEL" \ + -DLIBDEFLATE_BUILD_TESTS=1 +cmake --build "$BUILDDIR" diff --git a/tools/z64compress/src/enc/libdeflate/scripts/android_tests.sh b/tools/z64compress/src/enc/libdeflate/scripts/android_tests.sh new file mode 100644 index 000000000..3ec1007ba --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/android_tests.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# +# Test libdeflate on a connected arm64 Android device. +# Requires the Android NDK (release 19 or later) and adb. + +set -eu -o pipefail +cd "$(dirname "$0")/.." + +if [ $# -ne 0 ]; then + echo 1>&2 "Usage: $0" + exit 2 +fi + +# Use NDKDIR if specified in environment, else use default value. +: "${NDKDIR:=$HOME/android-ndk-r23b}" +if [ ! -e "$NDKDIR" ]; then + cat 1>&2 << EOF +Android NDK was not found in NDKDIR=$NDKDIR! Set the +environmental variable NDKDIR to the location of your Android NDK installation. +EOF + exit 1 +fi + +CLEANUP_CMDS=() +cleanup() { + for cmd in "${CLEANUP_CMDS[@]}"; do + eval "$cmd" + done +} +trap cleanup EXIT + +# Use TESTDATA if specified in environment, else generate it. +if [ -z "${TESTDATA:-}" ]; then + # Generate default TESTDATA file. + TESTDATA=$(mktemp -t libdeflate_testdata.XXXXXXXXXX) + export TESTDATA + CLEANUP_CMDS+=("rm -f '$TESTDATA'") + find . '(' -name '*.c' -o -name '*.h' -o -name '*.sh' ')' \ + -exec cat '{}' ';' | head -c 1000000 > "$TESTDATA" +fi + +TMPDIR=$(mktemp -d -t libdeflate_test.XXXXXXXXX) +CLEANUP_CMDS+=("rm -r '$TMPDIR'") + +android_build_and_test() { + echo "Running Android tests with $*" + + ./scripts/android_build.sh --ndkdir="$NDKDIR" "$@" > /dev/null + adb push "$TESTDATA" ./scripts/exec_tests.sh \ + ./build/programs/{benchmark,test_*} /data/local/tmp/ > /dev/null + + # Note: adb shell always returns 0, even if the shell command fails... + adb shell "cd /data/local/tmp && WRAPPER= TESTDATA=$(basename "$TESTDATA") sh exec_tests.sh" \ + > "$TMPDIR/adb.out" + if ! grep -q "exec_tests finished successfully" "$TMPDIR/adb.out"; then + echo 1>&2 "Android test failure! adb shell output:" + cat "$TMPDIR/adb.out" + exit 1 + fi +} + +android_build_and_test --arch=arm32 +android_build_and_test --arch=arm32 --enable-crc +android_build_and_test --arch=arm64 +android_build_and_test --arch=arm64 --enable-crc +android_build_and_test --arch=arm64 --enable-crypto +android_build_and_test --arch=arm64 --enable-crc --enable-crypto + +echo "Android tests passed" diff --git a/tools/z64compress/src/enc/libdeflate/scripts/benchmark.sh b/tools/z64compress/src/enc/libdeflate/scripts/benchmark.sh new file mode 100644 index 000000000..e7275926d --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/benchmark.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +SCRIPTDIR="$(dirname "$0")" +BUILDDIR="$SCRIPTDIR/../build" + +"$SCRIPTDIR"/cmake-helper.sh -DLIBDEFLATE_BUILD_TESTS=1 -G Ninja > /dev/null +ninja -C "$BUILDDIR" --quiet benchmark +"$BUILDDIR"/programs/benchmark "$@" diff --git a/tools/z64compress/src/enc/libdeflate/scripts/checksum.sh b/tools/z64compress/src/enc/libdeflate/scripts/checksum.sh new file mode 100644 index 000000000..c7350d756 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/checksum.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +SCRIPTDIR="$(dirname "$0")" +BUILDDIR="$SCRIPTDIR/../build" + +"$SCRIPTDIR"/cmake-helper.sh -DLIBDEFLATE_BUILD_TESTS=1 -G Ninja > /dev/null +ninja -C "$BUILDDIR" --quiet checksum +"$BUILDDIR"/programs/checksum "$@" diff --git a/tools/z64compress/src/enc/libdeflate/scripts/checksum_benchmarks.sh b/tools/z64compress/src/enc/libdeflate/scripts/checksum_benchmarks.sh new file mode 100644 index 000000000..836676084 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/checksum_benchmarks.sh @@ -0,0 +1,167 @@ +#!/bin/bash + +set -eu -o pipefail + +have_cpu_feature() { + local feature="$1" + local tag + case $ARCH in + arm*|aarch*) + tag="Features" + ;; + *) + tag="flags" + ;; + esac + grep -q "^$tag"$'[ \t]'"*:.*\<$feature\>" /proc/cpuinfo +} + +make_and_test() { + # Build the checksum program and tests. Set the special test support + # flag to get support for LIBDEFLATE_DISABLE_CPU_FEATURES. + rm -rf build + CFLAGS="$CFLAGS -DTEST_SUPPORT__DO_NOT_USE=1" \ + cmake -B build -G Ninja -DLIBDEFLATE_BUILD_TESTS=1 > /dev/null + cmake --build build > /dev/null + + # Run the checksum tests, for good measure. (This isn't actually part + # of the benchmarking.) + ./build/programs/test_checksums > /dev/null +} + +__do_benchmark() { + local impl="$1" speed + shift + local flags=("$@") + + speed=$(./build/programs/checksum "${CKSUM_FLAGS[@]}" \ + "${flags[@]}" -t "$FILE" | \ + grep -o '[0-9]\+ MB/s' | grep -o '[0-9]\+') + printf "%-45s%-10s\n" "$CKSUM_NAME ($impl)" "$speed" +} + +do_benchmark() { + local impl="$1" + + if [ "$impl" = zlib ]; then + __do_benchmark "$impl" "-Z" + else + CFLAGS="${EXTRA_CFLAGS[*]}" make_and_test + __do_benchmark "libdeflate, $impl" + if [ "$ARCH" = x86_64 ]; then + CFLAGS="-m32 ${EXTRA_CFLAGS[*]}" make_and_test + __do_benchmark "libdeflate, $impl, 32-bit" + fi + fi +} + +sort_by_speed() { + awk '{print $NF, $0}' | sort -nr | cut -f2- -d' ' +} + +disable_cpu_feature() { + local name="$1" + shift + local extra_cflags=("$@") + + LIBDEFLATE_DISABLE_CPU_FEATURES+=",$name" + EXTRA_CFLAGS+=("${extra_cflags[@]}") +} + +cleanup() { + if $USING_TMPFILE; then + rm "$FILE" + fi +} + +ARCH="$(uname -m)" +USING_TMPFILE=false + +if (( $# > 1 )); then + echo "Usage: $0 [FILE]" 1>&2 + exit 1 +fi + +trap cleanup EXIT + +if (( $# == 0 )); then + # Generate default test data file. + FILE=$(mktemp -t checksum_testdata.XXXXXXXXXX) + USING_TMPFILE=true + echo "Generating 100 MB test file: $FILE" + head -c 100000000 /dev/urandom > "$FILE" +else + FILE="$1" +fi + +cat << EOF +Method Speed (MB/s) +------ ------------ +EOF + +# CRC-32 +CKSUM_NAME="CRC-32" +CKSUM_FLAGS=() +EXTRA_CFLAGS=() +export LIBDEFLATE_DISABLE_CPU_FEATURES="" +{ +case $ARCH in +i386|x86_64) + if have_cpu_feature pclmulqdq && have_cpu_feature avx; then + do_benchmark "PCLMUL/AVX" + disable_cpu_feature "avx" "-mno-avx" + fi + if have_cpu_feature pclmulqdq; then + do_benchmark "PCLMUL" + disable_cpu_feature "pclmul" "-mno-pclmul" + fi + ;; +arm*|aarch*) + if have_cpu_feature crc32; then + do_benchmark "ARM" + disable_cpu_feature "crc32" "-march=armv8-a+nocrc" + fi + if have_cpu_feature pmull; then + do_benchmark "PMULL" + disable_cpu_feature "pmull" "-march=armv8-a+nocrc+nocrypto" + fi + ;; +esac +do_benchmark "generic" +do_benchmark "zlib" +} | sort_by_speed + +# Adler-32 +CKSUM_NAME="Adler-32" +CKSUM_FLAGS=(-A) +EXTRA_CFLAGS=() +export LIBDEFLATE_DISABLE_CPU_FEATURES="" +echo +{ +case $ARCH in +i386|x86_64) + if have_cpu_feature avx2; then + do_benchmark "AVX2" + disable_cpu_feature "avx2" "-mno-avx2" + fi + if have_cpu_feature sse2; then + do_benchmark "SSE2" + disable_cpu_feature "sse2" "-mno-sse2" + fi + ;; +arm*) + if have_cpu_feature neon; then + do_benchmark "NEON" + disable_cpu_feature "neon" "-mfpu=vfpv3" + fi + ;; +aarch*) + if have_cpu_feature asimd; then + do_benchmark "NEON" + disable_cpu_feature "neon" "-march=armv8-a+nosimd" + fi + ;; +esac +do_benchmark "generic" +do_benchmark "zlib" +} | sort_by_speed diff --git a/tools/z64compress/src/enc/libdeflate/scripts/cmake-helper.sh b/tools/z64compress/src/enc/libdeflate/scripts/cmake-helper.sh new file mode 100644 index 000000000..0c67930ba --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/cmake-helper.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# This script ensures that the 'build' directory has been created and configured +# with the given CMake options and environment. + +TOPDIR="$(dirname "$0")"/.. +BUILDDIR="$TOPDIR"/build + +flags=$(env; echo "@CMAKEOPTS@=$*") +if [ "$flags" != "$(cat "$BUILDDIR"/.flags 2>/dev/null)" ]; then + rm -rf "$BUILDDIR"/CMakeCache.txt "$BUILDDIR"/CMakeFiles + mkdir -p "$BUILDDIR" + cmake -S "$TOPDIR" -B "$BUILDDIR" "$@" + echo "$flags" > "$BUILDDIR"/.flags +fi diff --git a/tools/z64compress/src/enc/libdeflate/scripts/deflate_benchmarks.sh b/tools/z64compress/src/enc/libdeflate/scripts/deflate_benchmarks.sh new file mode 100644 index 000000000..5321cdc3a --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/deflate_benchmarks.sh @@ -0,0 +1,119 @@ +#!/bin/bash + +set -eu -o pipefail +topdir="$(dirname "$0")/.." +tmpfile=$(mktemp) +trap 'rm -f $tmpfile' EXIT + +run_benchmark() +{ + local best_ctime=1000000000 + local i + + for i in $(seq "$NUM_ITERATIONS"); do + "$@" > "$tmpfile" + csize=$(awk '/Compressed/{print $4}' "$tmpfile") + ctime=$(awk '/Compression time/{print $3}' "$tmpfile") + if (( ctime < best_ctime )); then + best_ctime=$ctime + fi + : "$i" # make shellcheck happy + done + CSIZE=$csize + CTIME=$best_ctime +} + +multifile() +{ + local file results cmd best em + + NUM_ITERATIONS=1 + + echo "File | zlib -6 | zlib -9 | libdeflate -6 | libdeflate -9 | libdeflate -12" + echo "-----|---------|---------|---------------|---------------|---------------" + + for file in "$@"; do + echo -n "$(basename "$file")" + results=() + cmd=("$topdir/build/programs/benchmark" + -s"$(stat -c "%s" "$file")" "$file") + run_benchmark "${cmd[@]}" -Y -6 + results+=("$CSIZE") + run_benchmark "${cmd[@]}" -Y -6 + results+=("$CSIZE") + run_benchmark "${cmd[@]}" -6 + results+=("$CSIZE") + run_benchmark "${cmd[@]}" -9 + results+=("$CSIZE") + run_benchmark "${cmd[@]}" -12 + results+=("$CSIZE") + best=2000000000 + for result in "${results[@]}"; do + if (( result < best)); then + best=$result + fi + done + for result in "${results[@]}"; do + if (( result == best )); then + em="**" + else + em="" + fi + echo -n " | ${em}${result}${em}" + done + echo + done +} + +single_file() +{ + local file=$1 + local usize args + local include_old=false + + usize=$(stat -c "%s" "$file") + : ${NUM_ITERATIONS:=3} + + if [ -e "$topdir/benchmark-old" ]; then + include_old=true + fi + echo -n "Level | libdeflate (new) " + if $include_old; then + echo -n "| libdeflate (old) " + fi + echo "| zlib" + echo -n "------|------------------" + if $include_old; then + echo -n "|------------------" + fi + echo "|-----" + for level in {1..12}; do + echo -n "$level" + args=("$file" -s "$usize" "-$level") + + run_benchmark "$topdir/build/programs/benchmark" "${args[@]}" + echo -n " | $CSIZE / $CTIME" + + if $include_old; then + run_benchmark "$topdir/benchmark-old" "${args[@]}" + echo -n " | $CSIZE / $CTIME" + fi + + if (( level > 9 )); then + echo -n " | N/A" + else + run_benchmark "$topdir/build/programs/benchmark" \ + "${args[@]}" -Y + echo -n " | $CSIZE / $CTIME" + fi + echo + done +} + +if (( $# > 1 )); then + multifile "$@" +elif (( $# == 1 )); then + single_file "$@" +else + echo 1>&2 "Usage: $0 FILE..." +fi diff --git a/tools/z64compress/src/enc/libdeflate/scripts/exec_tests.sh b/tools/z64compress/src/enc/libdeflate/scripts/exec_tests.sh new file mode 100644 index 000000000..b4ad2d5b0 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/exec_tests.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# +# Helper script used by run_tests.sh and android_tests.sh, +# not intended to be run directly +# + +set -eu + +DIR=${1:-.} + +cd "$DIR" + +run_cmd() { + echo "$WRAPPER $*" + $WRAPPER "$@" > /dev/null +} + +for prog in ./test_*; do + run_cmd "$prog" +done + +for format in '' '-g' '-z'; do + for ref_impl in '' '-Y' '-Z'; do + run_cmd ./benchmark $format $ref_impl "$TESTDATA" + done +done +for level in 0 1 3 7 9; do + for ref_impl in '' '-Y'; do + run_cmd ./benchmark -$level $ref_impl "$TESTDATA" + done +done +for level in 0 1 3 7 9 12; do + for ref_impl in '' '-Z'; do + run_cmd ./benchmark -$level $ref_impl "$TESTDATA" + done +done + +echo "exec_tests finished successfully" # Needed for 'adb shell' diff --git a/tools/z64compress/src/enc/libdeflate/scripts/gen_bitreverse_tab.py b/tools/z64compress/src/enc/libdeflate/scripts/gen_bitreverse_tab.py new file mode 100644 index 000000000..3695742a3 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/gen_bitreverse_tab.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +# +# This script computes a table that maps each byte to its bitwise reverse. + +def reverse_byte(v): + return sum(1 << (7 - bit) for bit in range(8) if (v & (1 << bit)) != 0) + +tab = [reverse_byte(v) for v in range(256)] + +print('static const u8 bitreverse_tab[256] = {') +for i in range(0, len(tab), 8): + print('\t', end='') + for j, v in enumerate(tab[i:i+8]): + print(f'0x{v:02x},', end='') + if j == 7: + print('') + else: + print(' ', end='') +print('};') diff --git a/tools/z64compress/src/enc/libdeflate/scripts/gen_crc32_multipliers.c b/tools/z64compress/src/enc/libdeflate/scripts/gen_crc32_multipliers.c new file mode 100644 index 000000000..5ef9bacaf --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/gen_crc32_multipliers.c @@ -0,0 +1,203 @@ +/* + * gen_crc32_multipliers.c + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * This program computes the constant multipliers needed for "folding" over + * various distances with the gzip CRC-32. Each such multiplier is x^D mod G(x) + * for some distance D, in bits, over which the folding is occurring. + * + * Folding works as follows: let A(x) be a polynomial (possibly reduced + * partially or fully mod G(x)) for part of the message, and let B(x) be a + * polynomial (possibly reduced partially or fully mod G(x)) for a later part of + * the message. The unreduced combined polynomial is A(x)*x^D + B(x), where D + * is the number of bits separating the two parts of the message plus len(B(x)). + * Since mod G(x) can be applied at any point, x^D mod G(x) can be precomputed + * and used instead of x^D unreduced. That allows the combined polynomial to be + * computed relatively easily in a partially-reduced form A(x)*(x^D mod G(x)) + + * B(x), with length max(len(A(x)) + 31, len(B(x))). This does require doing a + * polynomial multiplication (carryless multiplication). + * + * "Folding" in this way can be used for the entire CRC computation except the + * final reduction to 32 bits; this works well when CPU support for carryless + * multiplication is available. It can also be used to combine CRCs of + * different parts of the message that were computed using a different method. + * + * Note that the gzip CRC-32 uses bit-reversed polynomials. I.e., the low order + * bits are really the high order polynomial coefficients. + */ + +#include +#include + +#include "../common_defs.h" + +/* The generator polynomial G(x) for the gzip CRC-32 */ +#define CRCPOLY 0xEDB88320 /* G(x) without x^32 term */ +#define CRCPOLY_FULL (((u64)CRCPOLY << 1) | 1) /* G(x) */ + +/* Compute x^D mod G(x) */ +static u32 +compute_xD_modG(size_t D) +{ + /* Start with x^0 mod G(x) */ + u32 remainder = 0x80000000; + + /* Each iteration, 'remainder' becomes x^i mod G(x) */ + for (size_t i = 1; i <= D; i++) + remainder = (remainder >> 1) ^ ((remainder & 1) ? CRCPOLY : 0); + + /* Now 'remainder' is x^D mod G(x) */ + return remainder; +} + +/* Compute floor(x^64 / G(x)) */ +static u64 +compute_x64_div_G(void) +{ + u64 quotient = 0; + u64 dividend = 0x1; + + for (int i = 0; i < 64 - 32 + 1; i++) { + if ((dividend >> i) & 1) { + quotient |= (u64)1 << i; + dividend ^= CRCPOLY_FULL << i; + } + } + + return quotient; +} + +static void +gen_vec_folding_constants(void) +{ + /* + * Compute the multipliers needed for CRC-32 folding with carryless + * multiplication instructions that operate on the 64-bit halves of + * 128-bit vectors. Using the terminology from earlier, for each 64-bit + * fold len(A(x)) = 64, and len(B(x)) = 95 since a 64-bit polynomial + * multiplied by a 32-bit one produces a 95-bit one. When A(x) is the + * low order polynomial half of a 128-bit vector (high order physical + * half), the separation between the message parts is the total length + * of the 128-bit vectors separating the values. When A(x) is the high + * order polynomial half, the separation is 64 bits greater. + */ + for (int num_vecs = 1; num_vecs <= 12; num_vecs++) { + const int sep_lo = 128 * (num_vecs - 1); + const int sep_hi = sep_lo + 64; + const int len_B = 95; + int D; + + /* A(x) = high 64 polynomial bits (low 64 physical bits) */ + D = sep_hi + len_B; + printf("#define CRC32_%dVECS_MULT_1 0x%08"PRIx32" /* x^%d mod G(x) */\n", + num_vecs, compute_xD_modG(D), D); + + /* A(x) = low 64 polynomial bits (high 64 physical bits) */ + D = sep_lo + len_B; + printf("#define CRC32_%dVECS_MULT_2 0x%08"PRIx32" /* x^%d mod G(x) */\n", + num_vecs, compute_xD_modG(D), D); + + printf("#define CRC32_%dVECS_MULTS { CRC32_%dVECS_MULT_1, CRC32_%dVECS_MULT_2 }\n", + num_vecs, num_vecs, num_vecs); + printf("\n"); + } + + /* Multiplier for final 96 => 64 bit fold */ + printf("#define CRC32_FINAL_MULT 0x%08"PRIx32" /* x^63 mod G(x) */\n", + compute_xD_modG(63)); + + /* + * Constants for final 64 => 32 bit reduction. These constants are the + * odd ones out, as this final reduction step can't use the regular CRC + * folding described above. It uses Barrett reduction instead. + */ + printf("#define CRC32_BARRETT_CONSTANT_1 0x%016"PRIx64"ULL /* floor(x^64 / G(x)) */\n", + compute_x64_div_G()); + printf("#define CRC32_BARRETT_CONSTANT_2 0x%016"PRIx64"ULL /* G(x) */\n", + CRCPOLY_FULL); + printf("#define CRC32_BARRETT_CONSTANTS { CRC32_BARRETT_CONSTANT_1, CRC32_BARRETT_CONSTANT_2 }\n"); +} + +/* Multipliers for combining the CRCs of separate chunks */ +static void +gen_chunk_constants(void) +{ + const size_t num_chunks = 4; + const size_t table_len = 129; + const size_t min_chunk_len = 128; + + printf("#define CRC32_NUM_CHUNKS %zu\n", num_chunks); + printf("#define CRC32_MIN_VARIABLE_CHUNK_LEN %zuUL\n", min_chunk_len); + printf("#define CRC32_MAX_VARIABLE_CHUNK_LEN %zuUL\n", + (table_len - 1) * min_chunk_len); + printf("\n"); + printf("/* Multipliers for implementations that use a variable chunk length */\n"); + printf("static const u32 crc32_mults_for_chunklen[][CRC32_NUM_CHUNKS - 1] MAYBE_UNUSED = {\n", + num_chunks - 1); + printf("\t{ 0 /* unused row */ },\n"); + for (size_t i = 1; i < table_len; i++) { + const size_t chunk_len = i*min_chunk_len; + + printf("\t/* chunk_len=%zu */\n", chunk_len); + printf("\t{ "); + for (size_t j = num_chunks - 1; j >= 1; j--) { + const size_t D = (j * 8 * chunk_len) - 33; + + printf("0x%08"PRIx32" /* x^%zu mod G(x) */, ", + compute_xD_modG(D), D); + } + printf("},\n"); + } + printf("};\n"); + printf("\n"); + + printf("/* Multipliers for implementations that use a large fixed chunk length */\n"); + const size_t fixed_chunk_len = 32768; + printf("#define CRC32_FIXED_CHUNK_LEN %zuUL\n", fixed_chunk_len); + for (int j = 1; j < num_chunks; j++) { + const size_t D = (j * 8 * fixed_chunk_len) - 33; + + printf("#define CRC32_FIXED_CHUNK_MULT_%d 0x%08"PRIx32" /* x^%zu mod G(x) */\n", + j, compute_xD_modG(D), D); + } +} + +int +main(void) +{ + printf("/*\n" + " * crc32_multipliers.h - constants for CRC-32 folding\n" + " *\n" + " * THIS FILE WAS GENERATED BY gen_crc32_multipliers.c. DO NOT EDIT.\n" + " */\n" + "\n"); + + gen_vec_folding_constants(); + printf("\n"); + gen_chunk_constants(); + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/scripts/gen_crc32_tables.c b/tools/z64compress/src/enc/libdeflate/scripts/gen_crc32_tables.c new file mode 100644 index 000000000..b13fc5c49 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/gen_crc32_tables.c @@ -0,0 +1,105 @@ +/* + * gen_crc32_tables.c - a program for CRC-32 table generation + * + * Copyright 2016 Eric Biggers + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include + +#include "../common_defs.h" + +#define CRCPOLY 0xEDB88320 /* G(x) without x^32 term */ + +static u32 +crc32_update_bit(u32 remainder, u8 next_bit) +{ + return (remainder >> 1) ^ (((remainder ^ next_bit) & 1) ? CRCPOLY : 0); +} + +static u32 +crc32_update_byte(u32 remainder, u8 next_byte) +{ + for (int j = 0; j < 8; j++, next_byte >>= 1) + remainder = crc32_update_bit(remainder, next_byte & 1); + return remainder; +} + +static void +print_256_entries(const u32 *entries) +{ + for (size_t i = 0; i < 256 / 4; i++) { + printf("\t"); + for (size_t j = 0; j < 4; j++) { + printf("0x%08x,", entries[i * 4 + j]); + if (j != 3) + printf(" "); + } + printf("\n"); + } +} + +int +main(void) +{ + u32 crc32_table[0x800]; + + /* crc32_table[i] for 0 <= i < 0x100 is the CRC-32 of byte i. */ + for (int i = 0; i < 0x100; i++) + crc32_table[i] = crc32_update_byte(0, i); + + /* + * crc32_table[i] for 0x100 <= i < 0x800 is the CRC-32 of byte i % 0x100 + * followed by i / 0x100 zero bytes. + */ + for (int i = 0x100; i < 0x800; i++) + crc32_table[i] = crc32_update_byte(crc32_table[i - 0x100], 0); + + printf("/*\n"); + printf(" * crc32_tables.h - data tables for CRC-32 computation\n"); + printf(" *\n"); + printf(" * THIS FILE WAS GENERATED BY gen_crc32_tables.c. DO NOT EDIT.\n"); + printf(" */\n"); + printf("\n"); + /* + * Although crc32_slice1_table is the same as the first 256 entries of + * crc32_slice8_table, we output these tables separately because any + * combo of (slice1, slice8, slice1 && slice8, nothing) might be needed, + * and it's simplest to let the compiler optimize out any unused tables. + */ + printf("static const u32 crc32_slice1_table[] MAYBE_UNUSED = {\n"); + print_256_entries(&crc32_table[0x000]); + printf("};\n"); + printf("\n"); + printf("static const u32 crc32_slice8_table[] MAYBE_UNUSED = {\n"); + print_256_entries(&crc32_table[0x000]); + print_256_entries(&crc32_table[0x100]); + print_256_entries(&crc32_table[0x200]); + print_256_entries(&crc32_table[0x300]); + print_256_entries(&crc32_table[0x400]); + print_256_entries(&crc32_table[0x500]); + print_256_entries(&crc32_table[0x600]); + print_256_entries(&crc32_table[0x700]); + printf("};\n"); + return 0; +} diff --git a/tools/z64compress/src/enc/libdeflate/scripts/gen_default_litlen_costs.py b/tools/z64compress/src/enc/libdeflate/scripts/gen_default_litlen_costs.py new file mode 100644 index 000000000..26b8d9ccb --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/gen_default_litlen_costs.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +# +# This script computes the default litlen symbol costs for the near-optimal +# parser. + +from math import log2 + +BIT_COST = 16 # Must match BIT_COST in deflate_compress.c +NUM_LEN_SLOTS = 29 + +print("""static const struct { + u8 used_lits_to_lit_cost[257]; + u8 len_sym_cost; +} default_litlen_costs[] = {""") +MATCH_PROBS = [0.25, 0.50, 0.75] +for i, match_prob in enumerate(MATCH_PROBS): + len_prob = match_prob / NUM_LEN_SLOTS + len_sym_cost = int(-log2(len_prob) * BIT_COST) + if i == 0: + print('\t{', end='') + print(f' /* match_prob = {match_prob} */') + print('\t\t.used_lits_to_lit_cost = {') + + j = 0 + for num_used_literals in range(0, 257): + if num_used_literals == 0: + num_used_literals = 1 + lit_prob = (1 - match_prob) / num_used_literals + lit_cost = int(-log2(lit_prob) * BIT_COST) + if j == 0: + print('\t\t\t', end='') + if j == 7 or num_used_literals == 256: + print(f'{lit_cost},') + j = 0 + else: + print(f'{lit_cost}, ', end='') + j += 1 + print('\t\t},') + print(f'\t\t.len_sym_cost = {len_sym_cost},') + if i < len(MATCH_PROBS) - 1: + print('\t}, {', end='') + else: + print('\t},') +print('};') diff --git a/tools/z64compress/src/enc/libdeflate/scripts/gen_offset_slot_map.py b/tools/z64compress/src/enc/libdeflate/scripts/gen_offset_slot_map.py new file mode 100644 index 000000000..500332cfb --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/gen_offset_slot_map.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +# +# This script generates the deflate_offset_slot[] array, which is a condensed +# map from offsets to offset slots. + +DEFLATE_OFFSET_SLOT_BASE = [ + 1 , 2 , 3 , 4 , 5 , 7 , 9 , 13 , + 17 , 25 , 33 , 49 , 65 , 97 , 129 , 193 , + 257 , 385 , 513 , 769 , 1025 , 1537 , 2049 , 3073 , + 4097 , 6145 , 8193 , 12289 , 16385 , 24577 , +] + +DEFLATE_EXTRA_OFFSET_BITS = [ + 0 , 0 , 0 , 0 , 1 , 1 , 2 , 2 , + 3 , 3 , 4 , 4 , 5 , 5 , 6 , 6 , + 7 , 7 , 8 , 8 , 9 , 9 , 10 , 10 , + 11 , 11 , 12 , 12 , 13 , 13 , +] + +offset_slot_map = [0] * 512 + +for offset_slot, offset_base in enumerate(DEFLATE_OFFSET_SLOT_BASE): + num_extra_bits = DEFLATE_EXTRA_OFFSET_BITS[offset_slot] + offset_end = offset_base + (1 << num_extra_bits) + if offset_base <= 256: + for offset in range(offset_base, offset_end): + offset_slot_map[offset] = offset_slot + else: + for offset in range(offset_base, offset_end, 128): + offset_slot_map[256 + ((offset - 1) >> 7)] = offset_slot + +print('static const u8 deflate_offset_slot_map[512] = {') +for i in range(0, len(offset_slot_map), 16): + print('\t', end='') + for j, v in enumerate(offset_slot_map[i:i+16]): + print(f'{v},', end='') + if j == 15: + print('') + else: + print(' ', end='') +print('};') diff --git a/tools/z64compress/src/enc/libdeflate/scripts/gzip_tests.sh b/tools/z64compress/src/enc/libdeflate/scripts/gzip_tests.sh new file mode 100644 index 000000000..9b15cd1af --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/gzip_tests.sh @@ -0,0 +1,523 @@ +#!/bin/bash +# +# Test script for libdeflate's gzip and gunzip programs. +# +# To run, you must set GZIP and GUNZIP in the environment to the absolute paths +# to the gzip and gunzip programs to test. All tests should pass regardless of +# whether the GNU versions or the libdeflate versions, or a combination, of +# these programs are used. +# +# The environmental variable TESTDATA must also be set to a file containing +# test data. +# + +set -eu -o pipefail + +export -n GZIP GUNZIP TESTDATA + +ORIG_PWD=$PWD +TMPDIR="$(mktemp -d)" +CURRENT_TEST= + +BSD_STAT=false +if ! stat --version 2>&1 | grep -q coreutils; then + BSD_STAT=true +fi + +cleanup() { + if [ -n "$CURRENT_TEST" ]; then + echo "TEST FAILED: \"$CURRENT_TEST\"" + fi + rm -rf -- "$TMPDIR" +} + +trap cleanup EXIT + +begin_test() { + CURRENT_TEST="$1" + rm -rf -- "${TMPDIR:?}"/* + cd "$ORIG_PWD" + cp "$TESTDATA" "$TMPDIR/file" + chmod +w "$TMPDIR/file" + cd "$TMPDIR" +} + +gzip() { + $GZIP "$@" +} + +gunzip() { + $GUNZIP "$@" +} + +get_filesize() { + local file=$1 + + if $BSD_STAT; then + stat -f %z "$file" + else + stat -c %s "$file" + fi +} + +get_linkcount() { + local file=$1 + + if $BSD_STAT; then + stat -f %l "$file" + else + stat -c %h "$file" + fi +} + +get_modeandtimestamps() { + local file=$1 + + if $BSD_STAT; then + stat -f "%p;%a;%m" "$file" + elif [ "$(uname -m)" = s390x ]; then + # Use seconds precision instead of nanoseconds. + # TODO: why is this needed? QEMU user mode emulation bug? + stat -c "%a;%X;%Y" "$file" + else + stat -c "%a;%x;%y" "$file" + fi +} + +assert_status() { + local expected_status="$1" + local expected_msg="$2" + shift 2 + ( + set +e + { eval "$*" > /dev/null; } 2>&1 + local actual_status=$? + if [ "$actual_status" != "$expected_status" ]; then + echo 1>&2 "Command '$*' exited with status" \ + "$actual_status but expected status" \ + "$expected_status" + exit 1 + fi + exit 0 + ) > command_output + if ! grep -E -q "$expected_msg" command_output; then + echo 1>&2 "Expected output of command '$*' to match regex" \ + "'$expected_msg'" + echo 1>&2 "Actual output was:" + echo 1>&2 "---------------------------------------------------" + cat 1>&2 command_output + echo 1>&2 "---------------------------------------------------" + return 1 + fi +} + +assert_error() { + assert_status 1 "$@" +} + +assert_warning() { + assert_status 2 "$@" +} + +assert_skipped() { + assert_warning '\<(ignored|skipping|unchanged)\>' "$@" +} + +assert_equals() { + local expected="$1" + local actual="$2" + + if [ "$expected" != "$actual" ]; then + echo 1>&2 "Expected '$expected', but got '$actual'" + return 1 + fi +} + + +begin_test 'Basic compression and decompression works' +cp file orig +gzip file +[ ! -e file ] && [ -e file.gz ] +gunzip file.gz +[ -e file ] && [ ! -e file.gz ] +cmp file orig + + +begin_test 'gzip -d is gunzip' +cp file orig +gzip file +gzip -d file.gz +cmp file orig + + +begin_test '-k (keep original file) works' +cp file orig +gzip -k file +cmp file orig +rm file +cp file.gz orig.gz +gunzip -k file.gz +cmp file.gz orig.gz + + +begin_test '-c (write to stdout) works' +cp file orig +gzip -k file +gzip -c file > 2.gz +cmp file orig +cmp file.gz 2.gz +gunzip -c 2.gz > file +cmp file.gz 2.gz +cmp file orig + + +# Note: in some of the commands below, we intentionally use 'cat file | gzip' +# rather than 'gzip < file', in order to test the use of a pipe. This produces +# a shellcheck warning about 'cat' being unnecessary. Suppress that warning by +# using { cat file; true; }. +begin_test 'Reading from stdin works' +gzip < file > 1.gz +gzip - < file > 2.gz +{ cat file; true; } | gzip > 3.gz +{ cat file; true; } | gzip - > 4.gz +cmp file <(gunzip < 1.gz) +cmp file <(gunzip - < 2.gz) +cmp file <({ cat 3.gz; true; } | gunzip) +cmp file <({ cat 4.gz; true; } | gunzip -) + + +begin_test '-n option is accepted' +gzip -n file +gunzip -n file.gz + + +begin_test 'can specify multiple options' +gzip -fk1 file +cmp <(gzip -c -1 file) file.gz +gunzip -kfd file.gz + + +begin_test 'Compression levels' +if [ "$GZIP" = /bin/gzip ] || [ "$GZIP" = /usr/bin/gzip ]; then + assert_error '\' gzip -10 + max_level=9 +else + for level in 13 99999 1a; do + assert_error '\' gzip -$level + done + max_level=12 +fi +for level in $(seq 1 $max_level); do + gzip -c "-$level" file > "file$level" + cmp file <(gunzip -c "file$level") +done +rm file command_output + + +begin_test 'Overwriting output file requires -f' +cp file orig +echo -n > file.gz +gzip -c file > 2.gz +assert_warning 'already exists' gzip file file +assert_warning 'already exists' gunzip file.gz c.gz +gzip file.gz 2>&1 >/dev/null | grep -q 'already has .gz suffix' +[ -e file.gz ] && [ ! -e file.gz.gz ] +gzip -f file.gz +[ ! -e file.gz ] && [ -e file.gz.gz ] +cmp file.gz.gz c.gz + + +begin_test 'gunzip -f -c passes through non-gzip data' +echo hello > file +cp file orig +gunzip -f -c file > foo +cmp file foo +gzip file +gunzip -f -c file.gz > foo +cmp foo orig + + +begin_test 'gunzip -f (without -c) does *not* pass through non-gzip data' +echo hello > file.gz +assert_error '\' gunzip -f file.gz + + +begin_test 'Decompressing unsuffixed file only works with -c' +gzip file && mv file.gz file +assert_skipped gunzip file +assert_skipped gunzip -f file +gunzip -c file > orig +mv file file.gz && gunzip file.gz && cmp file orig + + +begin_test '... unless there is a corresponding suffixed file' +cp file orig +gzip file +[ ! -e file ] && [ -e file.gz ] +gunzip -c file > tmp +cmp tmp orig +rm tmp +ln -s NONEXISTENT file +gunzip -c file > tmp +cmp tmp orig +rm tmp file +gunzip file +[ -e file ] && [ ! -e file.gz ] +cmp file orig + + +begin_test 'Directory is skipped, even with -f' +mkdir dir +mkdir dir.gz +for opt in '' '-f' '-c'; do + assert_skipped gzip $opt dir +done +#assert_skipped gzip dir.gz # XXX: GNU gzip warns, libdeflate gzip no-ops +for opt in '' '-f' '-c'; do + for name in dir dir.gz; do + assert_skipped gunzip $opt $name + done +done + + +begin_test '(gzip) symlink is rejected without -f or -c' +ln -s file symlink1 +ln -s file symlink2 +assert_error 'Too many levels of symbolic links' gzip symlink1 +[ -e file ] && [ -e symlink1 ] && [ ! -e symlink1.gz ] +gzip -f symlink1 +[ -e file ] && [ ! -e symlink1 ] && [ -e symlink1.gz ] +gzip -c symlink2 > /dev/null + + +begin_test '(gunzip) symlink is rejected without -f or -c' +gzip file +ln -s file.gz symlink1.gz +ln -s file.gz symlink2.gz +assert_error 'Too many levels of symbolic links' gunzip symlink1 +[ -e file.gz ] && [ -e symlink1.gz ] && [ ! -e symlink1 ] +gunzip -f symlink1.gz +[ -e file.gz ] && [ ! -e symlink1.gz ] && [ -e symlink1 ] +gunzip -c symlink2.gz > /dev/null + + +begin_test 'FIFO is skipped, even with -f' +mkfifo foo +mkfifo foo.gz +assert_skipped gzip foo +assert_skipped gzip -f foo +#assert_skipped gzip -c foo # XXX: works with GNU gzip, not libdeflate's +assert_skipped gunzip foo.gz +assert_skipped gunzip -f foo.gz +#assert_skipped gunzip -c foo.gz # XXX: works with GNU gzip, not libdeflate's + + +begin_test '(gzip) overwriting symlink does not follow symlink' +echo a > a +echo b > b +gzip a +ln -s a.gz b.gz +gzip -f b +gunzip a.gz +cmp <(echo a) a + + +begin_test '(gunzip) overwriting symlink does not follow symlink' +echo a > a +echo b > b +gzip b +ln -s a b +gunzip -f b.gz +cmp <(echo a) a +cmp <(echo b) b + + +begin_test '(gzip) hard linked file skipped without -f or -c' +cp file orig +ln file link +assert_equals 2 "$(get_linkcount file)" +assert_skipped gzip file +gzip -c file > /dev/null +assert_equals 2 "$(get_linkcount file)" +gzip -f file +assert_equals 1 "$(get_linkcount link)" +assert_equals 1 "$(get_linkcount file.gz)" +cmp link orig +# XXX: GNU gzip skips hard linked files with -k, libdeflate's doesn't + + +begin_test '(gunzip) hard linked file skipped without -f or -c' +gzip file +ln file.gz link.gz +cp file.gz orig.gz +assert_equals 2 "$(get_linkcount file.gz)" +assert_skipped gunzip file.gz +gunzip -c file.gz > /dev/null +assert_equals 2 "$(get_linkcount file.gz)" +gunzip -f file +assert_equals 1 "$(get_linkcount link.gz)" +assert_equals 1 "$(get_linkcount file)" +cmp link.gz orig.gz + + +begin_test 'Multiple files' +cp file file2 +gzip file file2 +[ ! -e file ] && [ ! -e file2 ] && [ -e file.gz ] && [ -e file2.gz ] +gunzip file.gz file2.gz +[ -e file ] && [ -e file2 ] && [ ! -e file.gz ] && [ ! -e file2.gz ] + + +begin_test 'Multiple files, continue on warning' +mkdir 1 +cp file 2 +assert_skipped gzip 1 2 +[ ! -e 1.gz ] +cmp file <(gunzip -c 2.gz) +rmdir 1 +mkdir 1.gz +assert_skipped gunzip 1.gz 2.gz +[ ! -e 1 ] +cmp 2 file + + +if (( $(id -u) != 0 )); then + begin_test 'Multiple files, continue on error' + cp file 1 + cp file 2 + chmod a-r 1 + assert_error 'Permission denied' gzip 1 2 + [ ! -e 1.gz ] + cmp file <(gunzip -c 2.gz) + rm -f 1 + cp 2.gz 1.gz + chmod a-r 1.gz + assert_error 'Permission denied' gunzip 1.gz 2.gz + [ ! -e 1 ] + cmp 2 file +fi + + +begin_test 'Compressing empty file' +echo -n > empty +gzip empty +gunzip empty.gz +cmp /dev/null empty + + +begin_test 'Decompressing malformed file' +echo -n > foo.gz +assert_error '\<(not in gzip format|unexpected end of file)\>' \ + gunzip foo.gz +echo 1 > foo.gz +assert_error '\' gunzip foo.gz +echo abcdefgh > foo.gz +assert_error '\' gunzip foo.gz +echo -ne '\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x4b\x4c\x4a\x4e\x49\x24\x16\x73\x01\x00\x6c\x5b\xa2\x62\x2e\x00\x00\x00' \ + > foo.gz +assert_error '\<(not in gzip format|crc error)\>' gunzip foo.gz + + +for suf in .foo foo .blaaaaaaaaaaaaaaaargh; do + begin_test "Custom suffix: $suf" + gzip -S $suf file + [ ! -e file ] && [ ! -e file.gz ] && [ -e file$suf ] + assert_skipped gunzip file$suf + gunzip -S $suf file$suf + [ -e file ] && [ ! -e file.gz ] && [ ! -e file$suf ] +done +# DIFFERENCE: GNU gzip lower cases suffix, we don't + + +begin_test 'Empty suffix is rejected' +assert_error '\' gzip -S '""' file +assert_error '\' gunzip -S '""' file + + +begin_test 'Timestamps and mode are preserved' +chmod 777 file +orig_stat=$(get_modeandtimestamps file) +gzip file +sleep 1 +gunzip file.gz +assert_equals "$orig_stat" "$(get_modeandtimestamps file)" + + +begin_test 'Decompressing multi-member gzip file' +cat file file > orig +gzip -c file > file.gz +gzip -c file >> file.gz +gunzip -f file.gz +cmp file orig + + +begin_test 'Decompressing multi-member gzip file (final member smaller)' +echo 'hello world' > hello +cat file hello > orig +gzip -c file > file.gz +gzip -c hello >> file.gz +gunzip -f file.gz +cmp file orig + + +begin_test 'Help option' +gzip -h 2>&1 | grep -q 'Usage' +gunzip -h 2>&1 | grep -q 'Usage' + + +begin_test 'Incorrect usage' +for prog in gzip gunzip; do + for opt in '--invalid-option' '-0'; do + assert_error '\<(unrecognized|invalid) option\>' $prog $opt + done +done + + +begin_test '-t (test) option works' +good_files=( +'H4sIAAAAAAAAA3PMSVTITVTIzi9JVABTIJ5jzpGZelwAX+86ehsAAAA=' +'H4sIAAAAAAAAAwvJSFUoLM1MzlZIKsovz1NIy69QyCrNLShWyC9LLVIoAUrnJFZVKqTkp+txAQBqzFDrLQAAAA==') +bad_files=( +'H4sIAO1YYmAAA3PMSVTITVTIzi9JVABTIJ5jzpGZelwAX+46ehsAAAA=' +'H4sIAO1YYmAAA3PMSVTITVTIzi85VABTIJ5jzpGZelwAX+86ehsAAAA=' +'H4sIAAAAAAAAA3PMSVTITVTIzi9JVABTIJ5jzpGZelwAX+86ehsBAAA=' +'H4sIAAAAAAAAAwvJSFUoLM1MzlZIKsovz1NIy69QyCrNLShWyC9LLVIogUrnJFZVKqTkp+txAQBqzFDrLQAAAA==' +'H4sIAAAAAAAAAwvJSFUoLM1MzlZIKsovz1NIy69QyCrNLShWyC9L') +for contents in "${good_files[@]}"; do + echo "$contents" | base64 -d | gzip -t +done +for contents in "${bad_files[@]}"; do + echo "$contents" | base64 -d > file + assert_error '\' \ + gzip -t file +done + + +begin_test '-q (quiet) option works' +mkdir dir +gunzip -q dir &> output || true +[ ! -s output ] + + +begin_test 'Version information' +gzip -V | grep -q Copyright +gunzip -V | grep -q Copyright + +CURRENT_TEST= diff --git a/tools/z64compress/src/enc/libdeflate/scripts/make-windows-releases.sh b/tools/z64compress/src/enc/libdeflate/scripts/make-windows-releases.sh new file mode 100644 index 000000000..332f42c51 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/make-windows-releases.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -eu -o pipefail + +for arch in 'i686' 'x86_64'; do + dir=libdeflate-$(git describe --tags | tr -d v)-windows-${arch}-bin + rm -rf build "$dir" "$dir.zip" + CFLAGS="-Werror" ${arch}-w64-mingw32-cmake -B build -G Ninja \ + -DLIBDEFLATE_BUILD_TESTS=1 + cmake --build build + mkdir "$dir" + cp libdeflate.h build/libdeflate.{dll,dll.a,a} \ + build/programs/{benchmark,checksum}.exe "$dir" + cp build/programs/libdeflate-gzip.exe "$dir"/gzip.exe + cp build/programs/libdeflate-gzip.exe "$dir"/gunzip.exe + ${arch}-w64-mingw32-strip "$dir"/libdeflate.dll "$dir"/*.exe + for file in COPYING NEWS.md README.md; do + sed < $file > "$dir/${file}.txt" -e 's/$/\r/g' + done + (cd "$dir" && zip -r "../${dir}.zip" .) +done diff --git a/tools/z64compress/src/enc/libdeflate/scripts/msc_test.bat b/tools/z64compress/src/enc/libdeflate/scripts/msc_test.bat new file mode 100644 index 000000000..e8a150fa0 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/msc_test.bat @@ -0,0 +1,3 @@ +nmake /f Makefile.msc clean +nmake /f Makefile.msc +copy /y *.exe j:\exe\ diff --git a/tools/z64compress/src/enc/libdeflate/scripts/run_tests.sh b/tools/z64compress/src/enc/libdeflate/scripts/run_tests.sh new file mode 100644 index 000000000..44d3b9e25 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/run_tests.sh @@ -0,0 +1,415 @@ +#!/bin/bash +# +# Test script for libdeflate +# +# Usage: +# Run all tests: +# ./run_tests.sh +# Run only the given tests: +# ./run_tests.sh asan valgrind +# Run all tests other than the given ones: +# ./run_tests.sh ^asan ^valgrind +# +# See TEST_FUNCS for the available tests. + +set -eu -o pipefail +cd "$(dirname "$0")/.." + +# Use CC if specified in environment, else default to "cc". +: "${CC:=cc}" + +export CFLAGS="-Werror -DLIBDEFLATE_ENABLE_ASSERTIONS" + +# No wrapper by default; overridden by valgrind tests +export WRAPPER= + +TEST_FUNCS=() + +CLEANUP_CMDS=() +cleanup() { + for cmd in "${CLEANUP_CMDS[@]}"; do + eval "$cmd" + done +} +trap cleanup EXIT + +CLEANUP_CMDS+=("rm -rf build") + +# Use TESTDATA if specified in environment, else generate it. +if [ -z "${TESTDATA:-}" ]; then + # Generate default TESTDATA file. + TESTDATA=$(mktemp -t libdeflate_testdata.XXXXXXXXXX) + export TESTDATA + CLEANUP_CMDS+=("rm -f '$TESTDATA'") + find . '(' -name '*.c' -o -name '*.h' -o -name '*.sh' ')' \ + -exec cat '{}' ';' | head -c 1000000 > "$TESTDATA" +fi + +TMPDIR=$(mktemp -d -t libdeflate_test.XXXXXXXXX) +CLEANUP_CMDS+=("rm -r '$TMPDIR'") + +MAKE="make -j$(getconf _NPROCESSORS_ONLN)" + +UNAME=$(uname) +ARCH=$(uname -m) + +SHLIB=build/libdeflate.so +if [ "$UNAME" = Darwin ]; then + SHLIB=build/libdeflate.dylib +fi + +############################################################################### + +INDENT=0 + +log() +{ + echo -n "[$(date)] " + if (( INDENT != 0 )); then + head -c $(( INDENT * 4 )) /dev/zero | tr '\0' ' ' + fi + echo "$@" +} + +begin() +{ + log "$@" + (( INDENT++ )) || true +} + +end() +{ + (( INDENT-- )) || true +} + +run_cmd() +{ + log "$@" + "$@" > /dev/null +} + +fail() +{ + echo 1>&2 "$@" + exit 1 +} + +file_count() +{ + local dir=$1 + + find "$dir" -type f -o -type l | wc -l +} + +cflags_supported() +{ + # -Werror is needed here in order for old versions of clang to reject + # invalid options. + echo 'int main(void){ return 0; }' \ + | $CC "$@" -Werror -x c - -o /dev/null 2>/dev/null +} + +# Build libdeflate, including the test programs. Set the special test support +# flag to get support for LIBDEFLATE_DISABLE_CPU_FEATURES. +build() +{ + CFLAGS="$CFLAGS -DTEST_SUPPORT__DO_NOT_USE=1" scripts/cmake-helper.sh \ + -DLIBDEFLATE_BUILD_TESTS=1 "$@" > /dev/null + $MAKE -C build > /dev/null +} + +build_and_run_tests() +{ + local quick=false + if [ "${1:-}" = "--quick" ]; then + quick=true + shift + fi + + begin "CC=$CC CFLAGS=\"$CFLAGS\" WRAPPER=\"$WRAPPER\" $*" + + build "$@" + + # When not using -march=native, run the tests multiple times with + # different combinations of CPU features disabled. This is needed to + # test all variants of dynamically-dispatched code. + # + # For now, we aren't super exhausive in which combinations of features + # we test disabling. We just disable the features roughly in order from + # newest to oldest for each architecture, cumulatively. In practice, + # that's good enough to cover all the code. + local features=('') + if ! [[ "$CFLAGS" =~ "-march=native" ]] && ! $quick; then + case "$ARCH" in + i386|x86_64) + features+=(avx2 avx bmi2 pclmul sse2) + ;; + arm*|aarch*) + features+=(dotprod sha3 crc32 pmull neon) + ;; + esac + fi + local disable_str="" + local feature + for feature in "${features[@]}"; do + if [ -n "$feature" ]; then + if [ -n "$disable_str" ]; then + disable_str+="," + fi + disable_str+="$feature" + fi + log "Using LIBDEFLATE_DISABLE_CPU_FEATURES=$disable_str" + LIBDEFLATE_DISABLE_CPU_FEATURES="$disable_str" \ + sh ./scripts/exec_tests.sh build/programs/ > /dev/null + done + end +} + +is_compatible_system_gzip() +{ + local prog=$1 + + # Needs to exist. + if ! [ -e "$prog" ]; then + return 1 + fi + # Needs to be GNU gzip. + if ! "$prog" -V 2>&1 | grep -q 'Free Software Foundation'; then + return 1 + fi + # Needs to support the -k option, i.e. be v1.6 or later. + if echo | { "$prog" -k 2>&1 >/dev/null || true; } \ + | grep -q 'invalid option'; then + return 1 + fi + return 0 +} + +gzip_tests() +{ + local gzips=("$PWD/build/programs/libdeflate-gzip") + local gunzips=("$PWD/build/programs/libdeflate-gzip -d") + if [ "${1:-}" != "--quick" ]; then + if is_compatible_system_gzip /bin/gzip; then + gzips+=(/bin/gzip) + gunzips+=(/bin/gunzip) + elif is_compatible_system_gzip /usr/bin/gzip; then + gzips+=(/usr/bin/gzip) + gunzips+=(/usr/bin/gunzip) + else + log "Unsupported system gzip; skipping comparison with system gzip" + fi + fi + local gzip gunzip + + begin "Running gzip program tests with CC=\"$CC\" CFLAGS=\"$CFLAGS\"" + build + for gzip in "${gzips[@]}"; do + for gunzip in "${gunzips[@]}"; do + log "GZIP=$gzip, GUNZIP=$gunzip" + GZIP="$gzip" GUNZIP="$gunzip" TESTDATA="$TESTDATA" \ + ./scripts/gzip_tests.sh + done + done + end +} + +do_run_tests() +{ + build_and_run_tests "$@" + gzip_tests "$@" +} + +################################################################################ + +regular_test() +{ + do_run_tests +} +TEST_FUNCS+=(regular_test) + +O3_test() +{ + CFLAGS="$CFLAGS -O3" do_run_tests +} +TEST_FUNCS+=(O3_test) + +march_native_test() +{ + if ! cflags_supported "-march=native"; then + log "Compiler doesn't support -march=native; skipping test" + return + fi + CFLAGS="$CFLAGS -march=native" do_run_tests +} +TEST_FUNCS+=(march_native_test) + +valgrind_version_at_least() +{ + local want_vers=$1 + local vers + + if ! type -P valgrind &> /dev/null; then + return 1 + fi + + vers=$(valgrind --version | grep -E -o '[0-9\.]+' | head -1) + + [ "$want_vers" = "$(echo -e "$vers\n$want_vers" | sort -V | head -1)" ] +} + +valgrind_test() +{ + # Need valgrind 3.9.0 for '--errors-for-leak-kinds=all' + # Need valgrind 3.12.0 for armv8 crypto and crc instructions + if ! valgrind_version_at_least 3.12.0; then + log "valgrind not found; skipping test" + return + fi + WRAPPER="valgrind --quiet --error-exitcode=100 --leak-check=full --errors-for-leak-kinds=all" \ + do_run_tests --quick +} +TEST_FUNCS+=(valgrind_test) + +ubsan_test() +{ + local cflags=("-fsanitize=undefined" "-fno-sanitize-recover=undefined") + if ! cflags_supported "${cflags[@]}"; then + log "Compiler doesn't support UBSAN; skipping test" + return + fi + CFLAGS="$CFLAGS ${cflags[*]}" do_run_tests --quick +} +TEST_FUNCS+=(ubsan_test) + +asan_test() +{ + local cflags=("-fsanitize=address" "-fno-sanitize-recover=address") + if ! cflags_supported "${cflags[@]}"; then + log "Compiler doesn't support ASAN; skipping test" + return + fi + CFLAGS="$CFLAGS ${cflags[*]}" do_run_tests --quick +} +TEST_FUNCS+=(asan_test) + +cfi_test() +{ + local cflags=("-fsanitize=cfi" "-fno-sanitize-recover=cfi" "-flto" + "-fvisibility=hidden") + if ! cflags_supported "${cflags[@]}"; then + log "Compiler doesn't support CFI; skipping test" + return + fi + CFLAGS="$CFLAGS ${cflags[*]}" AR=llvm-ar do_run_tests --quick +} +TEST_FUNCS+=(cfi_test) + +install_test() +{ + build + $MAKE -C build install DESTDIR=inst > /dev/null +} +TEST_FUNCS+=(install_test) + +symbol_prefix_test() +{ + build + log "Checking that all global symbols are prefixed with \"libdeflate_\"" + if nm build/libdeflate.a | grep ' T ' | grep -E -v " _?libdeflate_" + then + fail "Some global symbols aren't prefixed with \"libdeflate_\"" + fi + log "Checking that all exported symbols are prefixed with \"libdeflate\"" + if nm $SHLIB | grep ' T ' \ + | grep -E -v " _?(libdeflate_|_init\>|_fini\>)"; then + fail "Some exported symbols aren't prefixed with \"libdeflate_\"" + fi +} +TEST_FUNCS+=(symbol_prefix_test) + +is_dynamically_linked() +{ + local prog=$1 + + if [ "$UNAME" = Darwin ]; then + otool -L "$prog" | grep -q libdeflate + else + ldd "$prog" | grep -q libdeflate + fi +} + +use_shared_lib_test() +{ + log "Testing USE_SHARED_LIB=1" + build + if is_dynamically_linked build/programs/libdeflate-gzip; then + fail "Binary should be statically linked by default" + fi + build -DLIBDEFLATE_USE_SHARED_LIB=1 > /dev/null + if ! is_dynamically_linked build/programs/libdeflate-gzip; then + fail "Binary isn't dynamically linked" + fi +} +TEST_FUNCS+=(use_shared_lib_test) + +freestanding_test() +{ + if [ "$UNAME" = Darwin ]; then + log "Skipping freestanding build tests due to unsupported OS" + return + fi + build_and_run_tests --quick -DLIBDEFLATE_FREESTANDING=1 + if nm $SHLIB | grep -v '\<__stack_chk_fail\>' | grep -q ' U '; then + echo 1>&2 "Freestanding lib links to external functions!:" + nm $SHLIB | grep ' U ' + return 1 + fi + if ldd $SHLIB | grep -q -v '\'; then + echo 1>&2 "Freestanding lib links to external libraries!:" + ldd $SHLIB + return 1 + fi +} +TEST_FUNCS+=(freestanding_test) + +############################################################################### + +declare -A all_tests +for test_func in "${TEST_FUNCS[@]}"; do + all_tests["${test_func%_test}"]=true +done +declare -A tests_to_run + +# Determine the set of tests to run by applying any inclusions and exclusions +# given on the command line. If no inclusions were given, then default to all +# tests (subject to exclusions). +all=true +for arg; do + if [[ $arg != ^* ]]; then + all=false + fi +done +if $all; then + for t in "${!all_tests[@]}"; do + tests_to_run[$t]=true + done +fi +for arg; do + if [[ $arg == ^* ]]; then + unset "tests_to_run[${arg#^}]" + elif [[ -z ${all_tests["$arg"]:-} ]]; then + fail "Unknown test '$arg'. Options are: ${!all_tests[*]}" + else + tests_to_run["$arg"]=true + fi +done + +# Actually run the tests. +log "Running libdeflate tests: ${!tests_to_run[*]}" +for t in "${!tests_to_run[@]}"; do + begin "Running ${t}_test" + eval "${t}_test" + end +done +log "All tests passed!" diff --git a/tools/z64compress/src/enc/libdeflate/scripts/toolchain-i686-w64-mingw32.cmake b/tools/z64compress/src/enc/libdeflate/scripts/toolchain-i686-w64-mingw32.cmake new file mode 100644 index 000000000..0b8063648 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/toolchain-i686-w64-mingw32.cmake @@ -0,0 +1,8 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR i686) +set(CMAKE_C_COMPILER i686-w64-mingw32-gcc) +set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/tools/z64compress/src/enc/libdeflate/scripts/toolchain-x86_64-w64-mingw32.cmake b/tools/z64compress/src/enc/libdeflate/scripts/toolchain-x86_64-w64-mingw32.cmake new file mode 100644 index 000000000..f9d6e37f2 --- /dev/null +++ b/tools/z64compress/src/enc/libdeflate/scripts/toolchain-x86_64-w64-mingw32.cmake @@ -0,0 +1,8 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_SYSTEM_PROCESSOR x86_64) +set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) diff --git a/tools/z64compress/src/enc/lzo.c b/tools/z64compress/src/enc/lzo.c new file mode 100644 index 000000000..a6f9b3b26 --- /dev/null +++ b/tools/z64compress/src/enc/lzo.c @@ -0,0 +1,55 @@ +#include +#include +#include +#include "lzo/lzoconf.h" +#include "lzo/lzo1x.h" + +void +lzoCtx_free(void *_ctx) +{ + if (!_ctx) + return; + + free(_ctx); +} + +void * +lzoCtx_new(void) +{ + return malloc(LZO1X_999_MEM_COMPRESS); +} + +int +lzoenc( + void *_src + , unsigned src_sz + , void *_dst + , unsigned *dst_sz + , void *_ctx +) +{ + unsigned char *src = _src; + unsigned char *dst = _dst; + unsigned char *wrkmem = _ctx; + lzo_uint result_sz = 0; + + extern int g_hlen; /* header length */ + memset(dst, 0, g_hlen); + memcpy(dst, "LZO0", 4); + dst[4] = (src_sz >> 24); + dst[5] = (src_sz >> 16); + dst[6] = (src_sz >> 8); + dst[7] = (src_sz >> 0); + + if (!wrkmem) + return 1; + + memset(wrkmem, 0, LZO1X_999_MEM_COMPRESS); + + lzo1x_999_compress(src, src_sz, dst + g_hlen, &result_sz, wrkmem); + + *dst_sz = result_sz + g_hlen; + + return 0; +} + diff --git a/tools/z64compress/src/enc/lzo/config1x.h b/tools/z64compress/src/enc/lzo/config1x.h new file mode 100644 index 000000000..f85cb6548 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/config1x.h @@ -0,0 +1,106 @@ +/* config1x.h -- configuration for the LZO1X algorithm + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the library and is subject + to change. + */ + + +#ifndef __LZO_CONFIG1X_H +#define __LZO_CONFIG1X_H 1 + +#if !defined(LZO1X) && !defined(LZO1Y) && !defined(LZO1Z) +# define LZO1X 1 +#endif + +#include "lzo_conf.h" +#if !defined(__LZO_IN_MINILZO) +#include "lzo1x.h" +#endif + + +/*********************************************************************** +// +************************************************************************/ + +#ifndef LZO_EOF_CODE +#define LZO_EOF_CODE 1 +#endif +#undef LZO_DETERMINISTIC + +#define M1_MAX_OFFSET 0x0400 +#ifndef M2_MAX_OFFSET +#define M2_MAX_OFFSET 0x0800 +#endif +#define M3_MAX_OFFSET 0x4000 +#define M4_MAX_OFFSET 0xbfff + +#define MX_MAX_OFFSET (M1_MAX_OFFSET + M2_MAX_OFFSET) + +#define M1_MIN_LEN 2 +#define M1_MAX_LEN 2 +#define M2_MIN_LEN 3 +#ifndef M2_MAX_LEN +#define M2_MAX_LEN 8 +#endif +#define M3_MIN_LEN 3 +#define M3_MAX_LEN 33 +#define M4_MIN_LEN 3 +#define M4_MAX_LEN 9 + +#define M1_MARKER 0 +#define M2_MARKER 64 +#define M3_MARKER 32 +#define M4_MARKER 16 + + +/*********************************************************************** +// +************************************************************************/ + +#ifndef MIN_LOOKAHEAD +#define MIN_LOOKAHEAD (M2_MAX_LEN + 1) +#endif + +#if defined(LZO_NEED_DICT_H) + +#ifndef LZO_HASH +#define LZO_HASH LZO_HASH_LZO_INCREMENTAL_B +#endif +#define DL_MIN_LEN M2_MIN_LEN +#include "lzo_dict.h" + +#endif + + + +#endif /* already included */ + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo1_d.ch b/tools/z64compress/src/enc/lzo/lzo1_d.ch new file mode 100644 index 000000000..bedc7ce8c --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo1_d.ch @@ -0,0 +1,156 @@ +/* lzo1_d.ch -- common decompression stuff + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + + +#if defined(LZO_TEST_OVERRUN) +# if !defined(LZO_TEST_OVERRUN_INPUT) +# define LZO_TEST_OVERRUN_INPUT 2 +# endif +# if !defined(LZO_TEST_OVERRUN_OUTPUT) +# define LZO_TEST_OVERRUN_OUTPUT 2 +# endif +# if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) +# define LZO_TEST_OVERRUN_LOOKBEHIND 1 +# endif +#endif + + +/*********************************************************************** +// Overrun detection is internally handled by these macros: +// +// TEST_IP test input overrun at loop begin +// NEED_IP test input overrun at every input byte +// +// TEST_OP test output overrun at loop begin +// NEED_OP test output overrun at every output byte +// +// TEST_LB test match position +// +// The fastest decompressor results when testing for no overruns +// and using LZO_EOF_CODE. +************************************************************************/ + +#undef TEST_IP +#undef TEST_OP +#undef TEST_IP_AND_TEST_OP +#undef TEST_LB +#undef TEST_LBO +#undef NEED_IP +#undef NEED_OP +#undef TEST_IV +#undef TEST_OV +#undef HAVE_TEST_IP +#undef HAVE_TEST_OP +#undef HAVE_NEED_IP +#undef HAVE_NEED_OP +#undef HAVE_ANY_IP +#undef HAVE_ANY_OP + + +#if defined(LZO_TEST_OVERRUN_INPUT) +# if (LZO_TEST_OVERRUN_INPUT >= 1) +# define TEST_IP (ip < ip_end) +# endif +# if (LZO_TEST_OVERRUN_INPUT >= 2) +# define NEED_IP(x) \ + if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun +# define TEST_IV(x) if ((x) > (lzo_uint)0 - (511)) goto input_overrun +# endif +#endif + +#if defined(LZO_TEST_OVERRUN_OUTPUT) +# if (LZO_TEST_OVERRUN_OUTPUT >= 1) +# define TEST_OP (op <= op_end) +# endif +# if (LZO_TEST_OVERRUN_OUTPUT >= 2) +# undef TEST_OP /* don't need both of the tests here */ +# define NEED_OP(x) \ + if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun +# define TEST_OV(x) if ((x) > (lzo_uint)0 - (511)) goto output_overrun +# endif +#endif + +#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) +# define TEST_LB(m_pos) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op)) goto lookbehind_overrun +# define TEST_LBO(m_pos,o) if (PTR_LT(m_pos,out) || PTR_GE(m_pos,op-(o))) goto lookbehind_overrun +#else +# define TEST_LB(m_pos) ((void) 0) +# define TEST_LBO(m_pos,o) ((void) 0) +#endif + + +#if !defined(LZO_EOF_CODE) && !defined(TEST_IP) + /* if we have no EOF code, we have to test for the end of the input */ +# define TEST_IP (ip < ip_end) +#endif + + +#if defined(TEST_IP) +# define HAVE_TEST_IP 1 +#else +# define TEST_IP 1 +#endif +#if defined(TEST_OP) +# define HAVE_TEST_OP 1 +#else +# define TEST_OP 1 +#endif + +#if defined(HAVE_TEST_IP) && defined(HAVE_TEST_OP) +# define TEST_IP_AND_TEST_OP (TEST_IP && TEST_OP) +#elif defined(HAVE_TEST_IP) +# define TEST_IP_AND_TEST_OP TEST_IP +#elif defined(HAVE_TEST_OP) +# define TEST_IP_AND_TEST_OP TEST_OP +#else +# define TEST_IP_AND_TEST_OP 1 +#endif + +#if defined(NEED_IP) +# define HAVE_NEED_IP 1 +#else +# define NEED_IP(x) ((void) 0) +# define TEST_IV(x) ((void) 0) +#endif +#if defined(NEED_OP) +# define HAVE_NEED_OP 1 +#else +# define NEED_OP(x) ((void) 0) +# define TEST_OV(x) ((void) 0) +#endif + + +#if defined(HAVE_TEST_IP) || defined(HAVE_NEED_IP) +# define HAVE_ANY_IP 1 +#endif +#if defined(HAVE_TEST_OP) || defined(HAVE_NEED_OP) +# define HAVE_ANY_OP 1 +#endif + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo1x.h b/tools/z64compress/src/enc/lzo/lzo1x.h new file mode 100644 index 000000000..a11151407 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo1x.h @@ -0,0 +1,165 @@ +/* lzo1x.h -- public interface of the LZO1X compression algorithm + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +#ifndef __LZO1X_H_INCLUDED +#define __LZO1X_H_INCLUDED 1 + +#ifndef __LZOCONF_H_INCLUDED +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +/*********************************************************************** +// +************************************************************************/ + +/* Memory required for the wrkmem parameter. + * When the required size is 0, you can also pass a NULL pointer. + */ + +#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS +#define LZO1X_MEM_DECOMPRESS (0) +#define LZO1X_MEM_OPTIMIZE (0) + + +/* decompression */ +LZO_EXTERN(int) +lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem /* NOT USED */ ); + +/* safe decompression with overrun testing */ +LZO_EXTERN(int) +lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem /* NOT USED */ ); + + +/*********************************************************************** +// +************************************************************************/ + +#define LZO1X_1_MEM_COMPRESS ((lzo_uint32_t) (16384L * lzo_sizeof_dict_t)) + +LZO_EXTERN(int) +lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem ); + + +/*********************************************************************** +// special compressor versions +************************************************************************/ + +/* this version needs only 8 KiB work memory */ +#define LZO1X_1_11_MEM_COMPRESS ((lzo_uint32_t) (2048L * lzo_sizeof_dict_t)) + +LZO_EXTERN(int) +lzo1x_1_11_compress ( const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem ); + + +/* this version needs 16 KiB work memory */ +#define LZO1X_1_12_MEM_COMPRESS ((lzo_uint32_t) (4096L * lzo_sizeof_dict_t)) + +LZO_EXTERN(int) +lzo1x_1_12_compress ( const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem ); + + +/* use this version if you need a little more compression speed */ +#define LZO1X_1_15_MEM_COMPRESS ((lzo_uint32_t) (32768L * lzo_sizeof_dict_t)) + +LZO_EXTERN(int) +lzo1x_1_15_compress ( const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem ); + + +/*********************************************************************** +// better compression ratio at the cost of more memory and time +************************************************************************/ + +#define LZO1X_999_MEM_COMPRESS ((lzo_uint32_t) (14 * 16384L * sizeof(short))) + +LZO_EXTERN(int) +lzo1x_999_compress ( const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem ); + + +/*********************************************************************** +// +************************************************************************/ + +LZO_EXTERN(int) +lzo1x_999_compress_dict ( const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem, + const lzo_bytep dict, lzo_uint dict_len ); + +LZO_EXTERN(int) +lzo1x_999_compress_level ( const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem, + const lzo_bytep dict, lzo_uint dict_len, + lzo_callback_p cb, + int compression_level ); + +LZO_EXTERN(int) +lzo1x_decompress_dict_safe ( const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem /* NOT USED */, + const lzo_bytep dict, lzo_uint dict_len ); + + +/*********************************************************************** +// optimize a compressed data block +************************************************************************/ + +LZO_EXTERN(int) +lzo1x_optimize ( lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem /* NOT USED */ ); + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* already included */ + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo1x_1.c b/tools/z64compress/src/enc/lzo/lzo1x_1.c new file mode 100644 index 000000000..a659393f2 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo1x_1.c @@ -0,0 +1,57 @@ +/* lzo1x_1.c -- LZO1X-1 compression + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +#include "lzo_conf.h" +#if 1 && defined(UA_GET_LE32) +#undef LZO_DICT_USE_PTR +#define LZO_DICT_USE_PTR 0 +#undef lzo_dict_t +#define lzo_dict_t lzo_uint16_t +#endif + +#define LZO_NEED_DICT_H 1 +#ifndef D_BITS +#define D_BITS 14 +#endif +#define D_INDEX1(d,p) d = DM(DMUL(0x21,DX3(p,5,5,6)) >> 5) +#define D_INDEX2(d,p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f) +#if 1 +#define DINDEX(dv,p) DM(((DMUL(0x1824429d,dv)) >> (32-D_BITS))) +#else +#define DINDEX(dv,p) DM((dv) + ((dv) >> (32-D_BITS))) +#endif +#include "config1x.h" +#define LZO_DETERMINISTIC !(LZO_DICT_USE_PTR) + +#ifndef DO_COMPRESS +#define DO_COMPRESS lzo1x_1_compress +#endif + +#include "lzo1x_c.ch" + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo1x_9x.c b/tools/z64compress/src/enc/lzo/lzo1x_9x.c new file mode 100644 index 000000000..39a211e54 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo1x_9x.c @@ -0,0 +1,867 @@ +/* lzo1x_9x.c -- implementation of the LZO1X-999 compression algorithm + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +#if !defined(LZO1X) && !defined(LZO1Y) && !defined(LZO1Z) +# define LZO1X 1 +#endif + +#if defined(LZO1X) +# include "config1x.h" +#elif defined(LZO1Y) +# include "config1y.h" +#elif defined(LZO1Z) +# include "config1z.h" +#else +# error +#endif + + +/*********************************************************************** +// +************************************************************************/ + +#define SWD_N M4_MAX_OFFSET /* size of ring buffer */ +#define SWD_THRESHOLD 1 /* lower limit for match length */ +#define SWD_F 2048 /* upper limit for match length */ + +#define SWD_BEST_OFF (LZO_MAX3( M2_MAX_LEN, M3_MAX_LEN, M4_MAX_LEN ) + 1) + +#if defined(LZO1X) +# define LZO_COMPRESS_T lzo1x_999_t +# define lzo_swd_t lzo1x_999_swd_t +#elif defined(LZO1Y) +# define LZO_COMPRESS_T lzo1y_999_t +# define lzo_swd_t lzo1y_999_swd_t +# define lzo1x_999_compress_internal lzo1y_999_compress_internal +# define lzo1x_999_compress_dict lzo1y_999_compress_dict +# define lzo1x_999_compress_level lzo1y_999_compress_level +# define lzo1x_999_compress lzo1y_999_compress +#elif defined(LZO1Z) +# define LZO_COMPRESS_T lzo1z_999_t +# define lzo_swd_t lzo1z_999_swd_t +# define lzo1x_999_compress_internal lzo1z_999_compress_internal +# define lzo1x_999_compress_dict lzo1z_999_compress_dict +# define lzo1x_999_compress_level lzo1z_999_compress_level +# define lzo1x_999_compress lzo1z_999_compress +#else +# error +#endif + +#if 0 +# define HEAD3(b,p) \ + ((((((lzo_xint)b[p]<<3)^b[p+1])<<3)^b[p+2]) & (SWD_HSIZE-1)) +#endif +#if 0 && (LZO_OPT_UNALIGNED32) && (LZO_ABI_LITTLE_ENDIAN) +# define HEAD3(b,p) \ + (((* (lzo_uint32_tp) &b[p]) ^ ((* (lzo_uint32_tp) &b[p])>>10)) & (SWD_HSIZE-1)) +#endif + +#include "lzo_mchw.ch" + + +/* this is a public functions, but there is no prototype in a header file */ +LZO_EXTERN(int) +lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len, + lzo_bytep out, lzo_uintp out_len, + lzo_voidp wrkmem, + const lzo_bytep dict, lzo_uint dict_len, + lzo_callback_p cb, + int try_lazy_parm, + lzo_uint good_length, + lzo_uint max_lazy, + lzo_uint nice_length, + lzo_uint max_chain, + lzo_uint32_t flags ); + + +/*********************************************************************** +// +************************************************************************/ + +static lzo_bytep +code_match ( LZO_COMPRESS_T *c, lzo_bytep op, lzo_uint m_len, lzo_uint m_off ) +{ + lzo_uint x_len = m_len; + lzo_uint x_off = m_off; + + c->match_bytes += m_len; + +#if 0 +/* + static lzo_uint last_m_len = 0, last_m_off = 0; + static lzo_uint prev_m_off[4]; + static unsigned prev_m_off_ptr = 0; + unsigned i; + + //if (m_len >= 3 && m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET) + if (m_len >= 3 && m_len <= M2_MAX_LEN) + { + //if (m_len == last_m_len && m_off == last_m_off) + //printf("last_m_len + last_m_off\n"); + //else + if (m_off == last_m_off) + printf("last_m_off\n"); + else + { + for (i = 0; i < 4; i++) + if (m_off == prev_m_off[i]) + printf("prev_m_off %u: %5ld\n",i,(long)m_off); + } + } + last_m_len = m_len; + last_m_off = prev_m_off[prev_m_off_ptr] = m_off; + prev_m_off_ptr = (prev_m_off_ptr + 1) & 3; +*/ +#endif + + assert(op > c->out); + if (m_len == 2) + { + assert(m_off <= M1_MAX_OFFSET); + assert(c->r1_lit > 0); assert(c->r1_lit < 4); + m_off -= 1; +#if defined(LZO1Z) + *op++ = LZO_BYTE(M1_MARKER | (m_off >> 6)); + *op++ = LZO_BYTE(m_off << 2); +#else + *op++ = LZO_BYTE(M1_MARKER | ((m_off & 3) << 2)); + *op++ = LZO_BYTE(m_off >> 2); +#endif + c->m1a_m++; + } +#if defined(LZO1Z) + else if (m_len <= M2_MAX_LEN && (m_off <= M2_MAX_OFFSET || m_off == c->last_m_off)) +#else + else if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET) +#endif + { + assert(m_len >= 3); +#if defined(LZO1X) + m_off -= 1; + *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2)); + *op++ = LZO_BYTE(m_off >> 3); + assert(op[-2] >= M2_MARKER); +#elif defined(LZO1Y) + m_off -= 1; + *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2)); + *op++ = LZO_BYTE(m_off >> 2); + assert(op[-2] >= M2_MARKER); +#elif defined(LZO1Z) + if (m_off == c->last_m_off) + *op++ = LZO_BYTE(((m_len - 1) << 5) | (0x700 >> 6)); + else + { + m_off -= 1; + *op++ = LZO_BYTE(((m_len - 1) << 5) | (m_off >> 6)); + *op++ = LZO_BYTE(m_off << 2); + } +#endif + c->m2_m++; + } + else if (m_len == M2_MIN_LEN && m_off <= MX_MAX_OFFSET && c->r1_lit >= 4) + { + assert(m_len == 3); + assert(m_off > M2_MAX_OFFSET); + m_off -= 1 + M2_MAX_OFFSET; +#if defined(LZO1Z) + *op++ = LZO_BYTE(M1_MARKER | (m_off >> 6)); + *op++ = LZO_BYTE(m_off << 2); +#else + *op++ = LZO_BYTE(M1_MARKER | ((m_off & 3) << 2)); + *op++ = LZO_BYTE(m_off >> 2); +#endif + c->m1b_m++; + } + else if (m_off <= M3_MAX_OFFSET) + { + assert(m_len >= 3); + m_off -= 1; + if (m_len <= M3_MAX_LEN) + *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); + else + { + m_len -= M3_MAX_LEN; + *op++ = M3_MARKER | 0; + while (m_len > 255) + { + m_len -= 255; + *op++ = 0; + } + assert(m_len > 0); + *op++ = LZO_BYTE(m_len); + } +#if defined(LZO1Z) + *op++ = LZO_BYTE(m_off >> 6); + *op++ = LZO_BYTE(m_off << 2); +#else + *op++ = LZO_BYTE(m_off << 2); + *op++ = LZO_BYTE(m_off >> 6); +#endif + c->m3_m++; + } + else + { + lzo_uint k; + + assert(m_len >= 3); + assert(m_off > 0x4000); assert(m_off <= 0xbfff); + m_off -= 0x4000; + k = (m_off & 0x4000) >> 11; + if (m_len <= M4_MAX_LEN) + *op++ = LZO_BYTE(M4_MARKER | k | (m_len - 2)); + else + { + m_len -= M4_MAX_LEN; + *op++ = LZO_BYTE(M4_MARKER | k | 0); + while (m_len > 255) + { + m_len -= 255; + *op++ = 0; + } + assert(m_len > 0); + *op++ = LZO_BYTE(m_len); + } +#if defined(LZO1Z) + *op++ = LZO_BYTE(m_off >> 6); + *op++ = LZO_BYTE(m_off << 2); +#else + *op++ = LZO_BYTE(m_off << 2); + *op++ = LZO_BYTE(m_off >> 6); +#endif + c->m4_m++; + } + + c->last_m_len = x_len; + c->last_m_off = x_off; + return op; +} + + +static lzo_bytep +STORE_RUN ( LZO_COMPRESS_T *c, lzo_bytep op, const lzo_bytep ii, lzo_uint t ) +{ + c->lit_bytes += t; + + if (op == c->out && t <= 238) + { + *op++ = LZO_BYTE(17 + t); + } + else if (t <= 3) + { +#if defined(LZO1Z) + op[-1] = LZO_BYTE(op[-1] | t); +#else + op[-2] = LZO_BYTE(op[-2] | t); +#endif + c->lit1_r++; + } + else if (t <= 18) + { + *op++ = LZO_BYTE(t - 3); + c->lit2_r++; + } + else + { + lzo_uint tt = t - 18; + + *op++ = 0; + while (tt > 255) + { + tt -= 255; + *op++ = 0; + } + assert(tt > 0); + *op++ = LZO_BYTE(tt); + c->lit3_r++; + } + do *op++ = *ii++; while (--t > 0); + + return op; +} + + +static lzo_bytep +code_run ( LZO_COMPRESS_T *c, lzo_bytep op, const lzo_bytep ii, + lzo_uint lit, lzo_uint m_len ) +{ + if (lit > 0) + { + assert(m_len >= 2); + op = STORE_RUN(c,op,ii,lit); + c->r1_m_len = m_len; + c->r1_lit = lit; + } + else + { + assert(m_len >= 3); + c->r1_m_len = 0; + c->r1_lit = 0; + } + + return op; +} + + +/*********************************************************************** +// +************************************************************************/ + +static lzo_uint +len_of_coded_match ( lzo_uint m_len, lzo_uint m_off, lzo_uint lit ) +{ + lzo_uint n = 4; + + if (m_len < 2) + return 0; + if (m_len == 2) + return (m_off <= M1_MAX_OFFSET && lit > 0 && lit < 4) ? 2 : 0; + if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET) + return 2; + if (m_len == M2_MIN_LEN && m_off <= MX_MAX_OFFSET && lit >= 4) + return 2; + if (m_off <= M3_MAX_OFFSET) + { + if (m_len <= M3_MAX_LEN) + return 3; + m_len -= M3_MAX_LEN; + while (m_len > 255) + { + m_len -= 255; + n++; + } + return n; + } + if (m_off <= M4_MAX_OFFSET) + { + if (m_len <= M4_MAX_LEN) + return 3; + m_len -= M4_MAX_LEN; + while (m_len > 255) + { + m_len -= 255; + n++; + } + return n; + } + return 0; +} + + +static lzo_uint +min_gain(lzo_uint ahead, lzo_uint lit1, lzo_uint lit2, lzo_uint l1, lzo_uint l2, lzo_uint l3) +{ + lzo_uint lazy_match_min_gain; + + assert (ahead >= 1); + lazy_match_min_gain = ahead; + +#if 0 + if (l3) + lit2 -= ahead; +#endif + + if (lit1 <= 3) + lazy_match_min_gain += (lit2 <= 3) ? 0 : 2; + else if (lit1 <= 18) + lazy_match_min_gain += (lit2 <= 18) ? 0 : 1; + + lazy_match_min_gain += (l2 - l1) * 2; + if (l3) + lazy_match_min_gain -= (ahead - l3) * 2; + + if ((lzo_int) lazy_match_min_gain < 0) + lazy_match_min_gain = 0; + +#if 0 + if (l1 == 2) + if (lazy_match_min_gain == 0) + lazy_match_min_gain = 1; +#endif + + return lazy_match_min_gain; +} + + +/*********************************************************************** +// +************************************************************************/ + +#if !defined(NDEBUG) +static +void assert_match( const lzo_swd_p swd, lzo_uint m_len, lzo_uint m_off ) +{ + const LZO_COMPRESS_T *c = swd->c; + lzo_uint d_off; + + assert(m_len >= 2); + if (m_off <= (lzo_uint) (c->bp - c->in)) + { + assert(c->bp - m_off + m_len < c->ip); + assert(lzo_memcmp(c->bp, c->bp - m_off, m_len) == 0); + } + else + { + assert(swd->dict != NULL); + d_off = m_off - (lzo_uint) (c->bp - c->in); + assert(d_off <= swd->dict_len); + if (m_len > d_off) + { + assert(lzo_memcmp(c->bp, swd->dict_end - d_off, d_off) == 0); + assert(c->in + m_len - d_off < c->ip); + assert(lzo_memcmp(c->bp + d_off, c->in, m_len - d_off) == 0); + } + else + { + assert(lzo_memcmp(c->bp, swd->dict_end - d_off, m_len) == 0); + } + } +} +#else +# define assert_match(a,b,c) ((void)0) +#endif + + +#if defined(SWD_BEST_OFF) + +static void +better_match ( const lzo_swd_p swd, lzo_uint *m_len, lzo_uint *m_off ) +{ +#if defined(LZO1Z) + const LZO_COMPRESS_T *c = swd->c; +#endif + + if (*m_len <= M2_MIN_LEN) + return; +#if defined(LZO1Z) + if (*m_off == c->last_m_off && *m_len <= M2_MAX_LEN) + return; +#if 1 + if (*m_len >= M2_MIN_LEN + 1 && *m_len <= M2_MAX_LEN + 1 && + c->last_m_off && swd->best_off[*m_len-1] == c->last_m_off) + { + *m_len = *m_len - 1; + *m_off = swd->best_off[*m_len]; + return; + } +#endif +#endif + + if (*m_off <= M2_MAX_OFFSET) + return; + +#if 1 + /* M3/M4 -> M2 */ + if (*m_off > M2_MAX_OFFSET && + *m_len >= M2_MIN_LEN + 1 && *m_len <= M2_MAX_LEN + 1 && + swd->best_off[*m_len-1] && swd->best_off[*m_len-1] <= M2_MAX_OFFSET) + { + *m_len = *m_len - 1; + *m_off = swd->best_off[*m_len]; + return; + } +#endif + +#if 1 + /* M4 -> M2 */ + if (*m_off > M3_MAX_OFFSET && + *m_len >= M4_MAX_LEN + 1 && *m_len <= M2_MAX_LEN + 2 && + swd->best_off[*m_len-2] && swd->best_off[*m_len-2] <= M2_MAX_OFFSET) + { + *m_len = *m_len - 2; + *m_off = swd->best_off[*m_len]; + return; + } +#endif + +#if 1 + /* M4 -> M3 */ + if (*m_off > M3_MAX_OFFSET && + *m_len >= M4_MAX_LEN + 1 && *m_len <= M3_MAX_LEN + 1 && + swd->best_off[*m_len-1] && swd->best_off[*m_len-1] <= M3_MAX_OFFSET) + { + *m_len = *m_len - 1; + *m_off = swd->best_off[*m_len]; + } +#endif +} + +#endif + + +/*********************************************************************** +// +************************************************************************/ + +LZO_PUBLIC(int) +lzo1x_999_compress_internal ( const lzo_bytep in , lzo_uint in_len, + lzo_bytep out, lzo_uintp out_len, + lzo_voidp wrkmem, + const lzo_bytep dict, lzo_uint dict_len, + lzo_callback_p cb, + int try_lazy_parm, + lzo_uint good_length, + lzo_uint max_lazy, + lzo_uint nice_length, + lzo_uint max_chain, + lzo_uint32_t flags ) +{ + lzo_bytep op; + const lzo_bytep ii; + lzo_uint lit; + lzo_uint m_len, m_off; + LZO_COMPRESS_T cc; + LZO_COMPRESS_T * const c = &cc; + lzo_swd_p const swd = (lzo_swd_p) wrkmem; + lzo_uint try_lazy; + int r; + + /* sanity check */ +#if defined(LZO1X) + LZO_COMPILE_TIME_ASSERT(LZO1X_999_MEM_COMPRESS >= SIZEOF_LZO_SWD_T) +#elif defined(LZO1Y) + LZO_COMPILE_TIME_ASSERT(LZO1Y_999_MEM_COMPRESS >= SIZEOF_LZO_SWD_T) +#elif defined(LZO1Z) + LZO_COMPILE_TIME_ASSERT(LZO1Z_999_MEM_COMPRESS >= SIZEOF_LZO_SWD_T) +#else +# error +#endif + +/* setup parameter defaults */ + /* number of lazy match tries */ + try_lazy = (lzo_uint) try_lazy_parm; + if (try_lazy_parm < 0) + try_lazy = 1; + /* reduce lazy match search if we already have a match with this length */ + if (good_length == 0) + good_length = 32; + /* do not try a lazy match if we already have a match with this length */ + if (max_lazy == 0) + max_lazy = 32; + /* stop searching for longer matches than this one */ + if (nice_length == 0) + nice_length = 0; + /* don't search more positions than this */ + if (max_chain == 0) + max_chain = SWD_MAX_CHAIN; + + c->init = 0; + c->ip = c->in = in; + c->in_end = in + in_len; + c->out = out; + c->cb = cb; + c->m1a_m = c->m1b_m = c->m2_m = c->m3_m = c->m4_m = 0; + c->lit1_r = c->lit2_r = c->lit3_r = 0; + + op = out; + ii = c->ip; /* point to start of literal run */ + lit = 0; + c->r1_lit = c->r1_m_len = 0; + + r = init_match(c,swd,dict,dict_len,flags); + if (r != 0) + return r; + if (max_chain > 0) + swd->max_chain = max_chain; + if (nice_length > 0) + swd->nice_length = nice_length; + + r = find_match(c,swd,0,0); + if (r != 0) + return r; + while (c->look > 0) + { + lzo_uint ahead; + lzo_uint max_ahead; + lzo_uint l1, l2, l3; + + c->codesize = pd(op, out); + + m_len = c->m_len; + m_off = c->m_off; + + assert(c->bp == c->ip - c->look); + assert(c->bp >= in); + if (lit == 0) + ii = c->bp; + assert(ii + lit == c->bp); + assert(swd->b_char == *(c->bp)); + + if ( m_len < 2 || + (m_len == 2 && (m_off > M1_MAX_OFFSET || lit == 0 || lit >= 4)) || +#if 1 + /* Do not accept this match for compressed-data compatibility + * with LZO v1.01 and before + * [ might be a problem for decompress() and optimize() ] + */ + (m_len == 2 && op == out) || +#endif + (op == out && lit == 0)) + { + /* a literal */ + m_len = 0; + } + else if (m_len == M2_MIN_LEN) + { + /* compression ratio improves if we code a literal in some cases */ + if (m_off > MX_MAX_OFFSET && lit >= 4) + m_len = 0; + } + + if (m_len == 0) + { + /* a literal */ + lit++; + swd->max_chain = max_chain; + r = find_match(c,swd,1,0); + assert(r == 0); LZO_UNUSED(r); + continue; + } + + /* a match */ +#if defined(SWD_BEST_OFF) + if (swd->use_best_off) + better_match(swd,&m_len,&m_off); +#endif + assert_match(swd,m_len,m_off); + + + /* shall we try a lazy match ? */ + ahead = 0; + if (try_lazy == 0 || m_len >= max_lazy) + { + /* no */ + l1 = 0; + max_ahead = 0; + } + else + { + /* yes, try a lazy match */ + l1 = len_of_coded_match(m_len,m_off,lit); + assert(l1 > 0); +#if 1 + max_ahead = LZO_MIN(try_lazy, l1 - 1); +#else + max_ahead = LZO_MIN3(try_lazy, l1, m_len - 1); +#endif + } + + + while (ahead < max_ahead && c->look > m_len) + { + lzo_uint lazy_match_min_gain; + + if (m_len >= good_length) + swd->max_chain = max_chain >> 2; + else + swd->max_chain = max_chain; + r = find_match(c,swd,1,0); + ahead++; + + assert(r == 0); LZO_UNUSED(r); + assert(c->look > 0); + assert(ii + lit + ahead == c->bp); + +#if defined(LZO1Z) + if (m_off == c->last_m_off && c->m_off != c->last_m_off) + if (m_len >= M2_MIN_LEN && m_len <= M2_MAX_LEN) + c->m_len = 0; +#endif + if (c->m_len < m_len) + continue; +#if 1 + if (c->m_len == m_len && c->m_off >= m_off) + continue; +#endif +#if defined(SWD_BEST_OFF) + if (swd->use_best_off) + better_match(swd,&c->m_len,&c->m_off); +#endif + l2 = len_of_coded_match(c->m_len,c->m_off,lit+ahead); + if (l2 == 0) + continue; +#if 0 + if (c->m_len == m_len && l2 >= l1) + continue; +#endif + + +#if 1 + /* compressed-data compatibility [see above] */ + l3 = (op == out) ? 0 : len_of_coded_match(ahead,m_off,lit); +#else + l3 = len_of_coded_match(ahead,m_off,lit); +#endif + + lazy_match_min_gain = min_gain(ahead,lit,lit+ahead,l1,l2,l3); + if (c->m_len >= m_len + lazy_match_min_gain) + { + c->lazy++; + assert_match(swd,c->m_len,c->m_off); + + if (l3) + { + /* code previous run */ + op = code_run(c,op,ii,lit,ahead); + lit = 0; + /* code shortened match */ + op = code_match(c,op,ahead,m_off); + } + else + { + lit += ahead; + assert(ii + lit == c->bp); + } + goto lazy_match_done; + } + } + + + assert(ii + lit + ahead == c->bp); + + /* 1 - code run */ + op = code_run(c,op,ii,lit,m_len); + lit = 0; + + /* 2 - code match */ + op = code_match(c,op,m_len,m_off); + swd->max_chain = max_chain; + r = find_match(c,swd,m_len,1+ahead); + assert(r == 0); LZO_UNUSED(r); + +lazy_match_done: ; + } + + + /* store final run */ + if (lit > 0) + op = STORE_RUN(c,op,ii,lit); + +#if defined(LZO_EOF_CODE) + *op++ = M4_MARKER | 1; + *op++ = 0; + *op++ = 0; +#endif + + c->codesize = pd(op, out); + assert(c->textsize == in_len); + + *out_len = pd(op, out); + + if (c->cb && c->cb->nprogress) + (*c->cb->nprogress)(c->cb, c->textsize, c->codesize, 0); + +#if 0 + printf("%ld %ld -> %ld %ld: %ld %ld %ld %ld %ld %ld: %ld %ld %ld %ld\n", + (long) c->textsize, (long) in_len, (long) c->codesize, + c->match_bytes, c->m1a_m, c->m1b_m, c->m2_m, c->m3_m, c->m4_m, + c->lit_bytes, c->lit1_r, c->lit2_r, c->lit3_r, c->lazy); +#endif + assert(c->lit_bytes + c->match_bytes == in_len); + + return LZO_E_OK; +} + + +/*********************************************************************** +// +************************************************************************/ + +LZO_PUBLIC(int) +lzo1x_999_compress_level ( const lzo_bytep in , lzo_uint in_len, + lzo_bytep out, lzo_uintp out_len, + lzo_voidp wrkmem, + const lzo_bytep dict, lzo_uint dict_len, + lzo_callback_p cb, + int compression_level ) +{ + static const struct + { + int try_lazy_parm; + lzo_uint good_length; + lzo_uint max_lazy; + lzo_uint nice_length; + lzo_uint max_chain; + lzo_uint32_t flags; + } c[9] = { + /* faster compression */ + { 0, 0, 0, 8, 4, 0 }, + { 0, 0, 0, 16, 8, 0 }, + { 0, 0, 0, 32, 16, 0 }, + { 1, 4, 4, 16, 16, 0 }, + { 1, 8, 16, 32, 32, 0 }, + { 1, 8, 16, 128, 128, 0 }, + { 2, 8, 32, 128, 256, 0 }, + { 2, 32, 128, SWD_F, 2048, 1 }, + { 2, SWD_F, SWD_F, SWD_F, 4096, 1 } + /* max. compression */ + }; + + if (compression_level < 1 || compression_level > 9) + return LZO_E_ERROR; + + compression_level -= 1; + return lzo1x_999_compress_internal(in, in_len, out, out_len, wrkmem, + dict, dict_len, cb, + c[compression_level].try_lazy_parm, + c[compression_level].good_length, + c[compression_level].max_lazy, +#if 0 + c[compression_level].nice_length, +#else + 0, +#endif + c[compression_level].max_chain, + c[compression_level].flags); +} + + +/*********************************************************************** +// +************************************************************************/ + +LZO_PUBLIC(int) +lzo1x_999_compress_dict ( const lzo_bytep in , lzo_uint in_len, + lzo_bytep out, lzo_uintp out_len, + lzo_voidp wrkmem, + const lzo_bytep dict, lzo_uint dict_len ) +{ + return lzo1x_999_compress_level(in, in_len, out, out_len, wrkmem, + dict, dict_len, 0, 8); +} + +LZO_PUBLIC(int) +lzo1x_999_compress ( const lzo_bytep in , lzo_uint in_len, + lzo_bytep out, lzo_uintp out_len, + lzo_voidp wrkmem ) +{ + return lzo1x_999_compress_level(in, in_len, out, out_len, wrkmem, + NULL, 0, (lzo_callback_p) 0, 9/*ootntsc10: 9 saves 2580 bytes over 8*/); +} + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo1x_c.ch b/tools/z64compress/src/enc/lzo/lzo1x_c.ch new file mode 100644 index 000000000..be19b2b74 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo1x_c.ch @@ -0,0 +1,403 @@ +/* lzo1x_c.ch -- implementation of the LZO1[XY]-1 compression algorithm + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + + +#if 1 && defined(DO_COMPRESS) && !defined(do_compress) + /* choose a unique name to better help PGO optimizations */ +# define do_compress LZO_PP_ECONCAT2(DO_COMPRESS,_core) +#endif + + +/*********************************************************************** +// compress a block of data. +************************************************************************/ + +static __lzo_noinline lzo_uint +do_compress ( const lzo_bytep in , lzo_uint in_len, + lzo_bytep out, lzo_uintp out_len, + lzo_uint ti, lzo_voidp wrkmem) +{ + const lzo_bytep ip; + lzo_bytep op; + const lzo_bytep const in_end = in + in_len; + const lzo_bytep const ip_end = in + in_len - 20; + const lzo_bytep ii; + lzo_dict_p const dict = (lzo_dict_p) wrkmem; + + op = out; + ip = in; + ii = ip; + + ip += ti < 4 ? 4 - ti : 0; + for (;;) + { + const lzo_bytep m_pos; +#if !(LZO_DETERMINISTIC) + LZO_DEFINE_UNINITIALIZED_VAR(lzo_uint, m_off, 0); + lzo_uint m_len; + lzo_uint dindex; +next: + if __lzo_unlikely(ip >= ip_end) + break; + DINDEX1(dindex,ip); + GINDEX(m_pos,m_off,dict,dindex,in); + if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) + goto literal; +#if 1 + if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) + goto try_match; + DINDEX2(dindex,ip); +#endif + GINDEX(m_pos,m_off,dict,dindex,in); + if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) + goto literal; + if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) + goto try_match; + goto literal; + +try_match: +#if (LZO_OPT_UNALIGNED32) + if (UA_GET_NE32(m_pos) != UA_GET_NE32(ip)) +#else + if (m_pos[0] != ip[0] || m_pos[1] != ip[1] || m_pos[2] != ip[2] || m_pos[3] != ip[3]) +#endif + { + /* a literal */ +literal: + UPDATE_I(dict,0,dindex,ip,in); + ip += 1 + ((ip - ii) >> 5); + continue; + } +/*match:*/ + UPDATE_I(dict,0,dindex,ip,in); +#else + lzo_uint m_off; + lzo_uint m_len; + { + lzo_uint32_t dv; + lzo_uint dindex; +literal: + ip += 1 + ((ip - ii) >> 5); +next: + if __lzo_unlikely(ip >= ip_end) + break; + dv = UA_GET_LE32(ip); + dindex = DINDEX(dv,ip); + GINDEX(m_off,m_pos,in+dict,dindex,in); + UPDATE_I(dict,0,dindex,ip,in); + if __lzo_unlikely(dv != UA_GET_LE32(m_pos)) + goto literal; + } +#endif + + /* a match */ + + ii -= ti; ti = 0; + { + lzo_uint t = pd(ip,ii); + if (t != 0) + { + if (t <= 3) + { + op[-2] = LZO_BYTE(op[-2] | t); +#if (LZO_OPT_UNALIGNED32) + UA_COPY4(op, ii); + op += t; +#else + { do *op++ = *ii++; while (--t > 0); } +#endif + } +#if (LZO_OPT_UNALIGNED32) || (LZO_OPT_UNALIGNED64) + else if (t <= 16) + { + *op++ = LZO_BYTE(t - 3); + UA_COPY8(op, ii); + UA_COPY8(op+8, ii+8); + op += t; + } +#endif + else + { + if (t <= 18) + *op++ = LZO_BYTE(t - 3); + else + { + lzo_uint tt = t - 18; + *op++ = 0; + while __lzo_unlikely(tt > 255) + { + tt -= 255; + UA_SET1(op, 0); + op++; + } + assert(tt > 0); + *op++ = LZO_BYTE(tt); + } +#if (LZO_OPT_UNALIGNED32) || (LZO_OPT_UNALIGNED64) + do { + UA_COPY8(op, ii); + UA_COPY8(op+8, ii+8); + op += 16; ii += 16; t -= 16; + } while (t >= 16); if (t > 0) +#endif + { do *op++ = *ii++; while (--t > 0); } + } + } + } + m_len = 4; + { +#if (LZO_OPT_UNALIGNED64) + lzo_uint64_t v; + v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len); + if __lzo_unlikely(v == 0) { + do { + m_len += 8; + v = UA_GET_NE64(ip + m_len) ^ UA_GET_NE64(m_pos + m_len); + if __lzo_unlikely(ip + m_len >= ip_end) + goto m_len_done; + } while (v == 0); + } +#if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_ctlz64) + m_len += lzo_bitops_ctlz64(v) / CHAR_BIT; +#elif (LZO_ABI_BIG_ENDIAN) + if ((v >> (64 - CHAR_BIT)) == 0) do { + v <<= CHAR_BIT; + m_len += 1; + } while ((v >> (64 - CHAR_BIT)) == 0); +#elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_cttz64) + m_len += lzo_bitops_cttz64(v) / CHAR_BIT; +#elif (LZO_ABI_LITTLE_ENDIAN) + if ((v & UCHAR_MAX) == 0) do { + v >>= CHAR_BIT; + m_len += 1; + } while ((v & UCHAR_MAX) == 0); +#else + if (ip[m_len] == m_pos[m_len]) do { + m_len += 1; + } while (ip[m_len] == m_pos[m_len]); +#endif +#elif (LZO_OPT_UNALIGNED32) + lzo_uint32_t v; + v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len); + if __lzo_unlikely(v == 0) { + do { + m_len += 4; + v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len); + if (v != 0) + break; + m_len += 4; + v = UA_GET_NE32(ip + m_len) ^ UA_GET_NE32(m_pos + m_len); + if __lzo_unlikely(ip + m_len >= ip_end) + goto m_len_done; + } while (v == 0); + } +#if (LZO_ABI_BIG_ENDIAN) && defined(lzo_bitops_ctlz32) + m_len += lzo_bitops_ctlz32(v) / CHAR_BIT; +#elif (LZO_ABI_BIG_ENDIAN) + if ((v >> (32 - CHAR_BIT)) == 0) do { + v <<= CHAR_BIT; + m_len += 1; + } while ((v >> (32 - CHAR_BIT)) == 0); +#elif (LZO_ABI_LITTLE_ENDIAN) && defined(lzo_bitops_cttz32) + m_len += lzo_bitops_cttz32(v) / CHAR_BIT; +#elif (LZO_ABI_LITTLE_ENDIAN) + if ((v & UCHAR_MAX) == 0) do { + v >>= CHAR_BIT; + m_len += 1; + } while ((v & UCHAR_MAX) == 0); +#else + if (ip[m_len] == m_pos[m_len]) do { + m_len += 1; + } while (ip[m_len] == m_pos[m_len]); +#endif +#else + if __lzo_unlikely(ip[m_len] == m_pos[m_len]) { + do { + m_len += 1; + if (ip[m_len] != m_pos[m_len]) + break; + m_len += 1; + if (ip[m_len] != m_pos[m_len]) + break; + m_len += 1; + if (ip[m_len] != m_pos[m_len]) + break; + m_len += 1; + if (ip[m_len] != m_pos[m_len]) + break; + m_len += 1; + if (ip[m_len] != m_pos[m_len]) + break; + m_len += 1; + if (ip[m_len] != m_pos[m_len]) + break; + m_len += 1; + if (ip[m_len] != m_pos[m_len]) + break; + m_len += 1; + if __lzo_unlikely(ip + m_len >= ip_end) + goto m_len_done; + } while (ip[m_len] == m_pos[m_len]); + } +#endif + } +m_len_done: + m_off = pd(ip,m_pos); + ip += m_len; + ii = ip; + if (m_len <= M2_MAX_LEN && m_off <= M2_MAX_OFFSET) + { + m_off -= 1; +#if defined(LZO1X) + *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2)); + *op++ = LZO_BYTE(m_off >> 3); +#elif defined(LZO1Y) + *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2)); + *op++ = LZO_BYTE(m_off >> 2); +#endif + } + else if (m_off <= M3_MAX_OFFSET) + { + m_off -= 1; + if (m_len <= M3_MAX_LEN) + *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); + else + { + m_len -= M3_MAX_LEN; + *op++ = M3_MARKER | 0; + while __lzo_unlikely(m_len > 255) + { + m_len -= 255; + UA_SET1(op, 0); + op++; + } + *op++ = LZO_BYTE(m_len); + } + *op++ = LZO_BYTE(m_off << 2); + *op++ = LZO_BYTE(m_off >> 6); + } + else + { + m_off -= 0x4000; + if (m_len <= M4_MAX_LEN) + *op++ = LZO_BYTE(M4_MARKER | ((m_off >> 11) & 8) | (m_len - 2)); + else + { + m_len -= M4_MAX_LEN; + *op++ = LZO_BYTE(M4_MARKER | ((m_off >> 11) & 8)); + while __lzo_unlikely(m_len > 255) + { + m_len -= 255; + UA_SET1(op, 0); + op++; + } + *op++ = LZO_BYTE(m_len); + } + *op++ = LZO_BYTE(m_off << 2); + *op++ = LZO_BYTE(m_off >> 6); + } + goto next; + } + + *out_len = pd(op, out); + return pd(in_end,ii-ti); +} + + +/*********************************************************************** +// public entry point +************************************************************************/ + +LZO_PUBLIC(int) +DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, + lzo_bytep out, lzo_uintp out_len, + lzo_voidp wrkmem ) +{ + const lzo_bytep ip = in; + lzo_bytep op = out; + lzo_uint l = in_len; + lzo_uint t = 0; + + while (l > 20) + { + lzo_uint ll = l; + lzo_uintptr_t ll_end; +#if 0 || (LZO_DETERMINISTIC) + ll = LZO_MIN(ll, 49152); +#endif + ll_end = (lzo_uintptr_t)ip + ll; + if ((ll_end + ((t + ll) >> 5)) <= ll_end || (const lzo_bytep)(ll_end + ((t + ll) >> 5)) <= ip + ll) + break; +#if (LZO_DETERMINISTIC) + lzo_memset(wrkmem, 0, ((lzo_uint)1 << D_BITS) * sizeof(lzo_dict_t)); +#endif + t = do_compress(ip,ll,op,out_len,t,wrkmem); + ip += ll; + op += *out_len; + l -= ll; + } + t += l; + + if (t > 0) + { + const lzo_bytep ii = in + in_len - t; + + if (op == out && t <= 238) + *op++ = LZO_BYTE(17 + t); + else if (t <= 3) + op[-2] = LZO_BYTE(op[-2] | t); + else if (t <= 18) + *op++ = LZO_BYTE(t - 3); + else + { + lzo_uint tt = t - 18; + + *op++ = 0; + while (tt > 255) + { + tt -= 255; + UA_SET1(op, 0); + op++; + } + assert(tt > 0); + *op++ = LZO_BYTE(tt); + } + UA_COPYN(op, ii, t); + op += t; + } + + *op++ = M4_MARKER | 1; + *op++ = 0; + *op++ = 0; + + *out_len = pd(op, out); + return LZO_E_OK; +} + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo1x_d.ch b/tools/z64compress/src/enc/lzo/lzo1x_d.ch new file mode 100644 index 000000000..b6c6d9947 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo1x_d.ch @@ -0,0 +1,475 @@ +/* lzo1x_d.ch -- implementation of the LZO1X decompression algorithm + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +#include "lzo1_d.ch" + + +/*********************************************************************** +// decompress a block of data. +************************************************************************/ + +#if defined(DO_DECOMPRESS) +LZO_PUBLIC(int) +DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, + lzo_bytep out, lzo_uintp out_len, + lzo_voidp wrkmem ) +#endif +{ + lzo_bytep op; + const lzo_bytep ip; + lzo_uint t; +#if defined(COPY_DICT) + lzo_uint m_off; + const lzo_bytep dict_end; +#else + const lzo_bytep m_pos; +#endif + + const lzo_bytep const ip_end = in + in_len; +#if defined(HAVE_ANY_OP) + lzo_bytep const op_end = out + *out_len; +#endif +#if defined(LZO1Z) + lzo_uint last_m_off = 0; +#endif + + LZO_UNUSED(wrkmem); + +#if defined(COPY_DICT) + if (dict) + { + if (dict_len > M4_MAX_OFFSET) + { + dict += dict_len - M4_MAX_OFFSET; + dict_len = M4_MAX_OFFSET; + } + dict_end = dict + dict_len; + } + else + { + dict_len = 0; + dict_end = NULL; + } +#endif /* COPY_DICT */ + + *out_len = 0; + + op = out; + ip = in; + + NEED_IP(1); + if (*ip > 17) + { + t = *ip++ - 17; + if (t < 4) + goto match_next; + assert(t > 0); NEED_OP(t); NEED_IP(t+3); + do *op++ = *ip++; while (--t > 0); + goto first_literal_run; + } + + for (;;) + { + NEED_IP(3); + t = *ip++; + if (t >= 16) + goto match; + /* a literal run */ + if (t == 0) + { + while (*ip == 0) + { + t += 255; + ip++; + TEST_IV(t); + NEED_IP(1); + } + t += 15 + *ip++; + } + /* copy literals */ + assert(t > 0); NEED_OP(t+3); NEED_IP(t+6); +#if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32) + t += 3; + if (t >= 8) do + { + UA_COPY8(op,ip); + op += 8; ip += 8; t -= 8; + } while (t >= 8); + if (t >= 4) + { + UA_COPY4(op,ip); + op += 4; ip += 4; t -= 4; + } + if (t > 0) + { + *op++ = *ip++; + if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } + } +#elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4) +#if !(LZO_OPT_UNALIGNED32) + if (PTR_ALIGNED2_4(op,ip)) + { +#endif + UA_COPY4(op,ip); + op += 4; ip += 4; + if (--t > 0) + { + if (t >= 4) + { + do { + UA_COPY4(op,ip); + op += 4; ip += 4; t -= 4; + } while (t >= 4); + if (t > 0) do *op++ = *ip++; while (--t > 0); + } + else + do *op++ = *ip++; while (--t > 0); + } +#if !(LZO_OPT_UNALIGNED32) + } + else +#endif +#endif +#if !(LZO_OPT_UNALIGNED32) + { + *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; + do *op++ = *ip++; while (--t > 0); + } +#endif + + +first_literal_run: + + + t = *ip++; + if (t >= 16) + goto match; +#if defined(COPY_DICT) +#if defined(LZO1Z) + m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); + last_m_off = m_off; +#else + m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); +#endif + NEED_OP(3); + t = 3; COPY_DICT(t,m_off) +#else /* !COPY_DICT */ +#if defined(LZO1Z) + t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); + m_pos = op - t; + last_m_off = t; +#else + m_pos = op - (1 + M2_MAX_OFFSET); + m_pos -= t >> 2; + m_pos -= *ip++ << 2; +#endif + TEST_LB(m_pos); NEED_OP(3); + *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; +#endif /* COPY_DICT */ + goto match_done; + + + /* handle matches */ + for (;;) { +match: + if (t >= 64) /* a M2 match */ + { +#if defined(COPY_DICT) +#if defined(LZO1X) + m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); + t = (t >> 5) - 1; +#elif defined(LZO1Y) + m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); + t = (t >> 4) - 3; +#elif defined(LZO1Z) + m_off = t & 0x1f; + if (m_off >= 0x1c) + m_off = last_m_off; + else + { + m_off = 1 + (m_off << 6) + (*ip++ >> 2); + last_m_off = m_off; + } + t = (t >> 5) - 1; +#endif +#else /* !COPY_DICT */ +#if defined(LZO1X) + m_pos = op - 1; + m_pos -= (t >> 2) & 7; + m_pos -= *ip++ << 3; + t = (t >> 5) - 1; +#elif defined(LZO1Y) + m_pos = op - 1; + m_pos -= (t >> 2) & 3; + m_pos -= *ip++ << 2; + t = (t >> 4) - 3; +#elif defined(LZO1Z) + { + lzo_uint off = t & 0x1f; + m_pos = op; + if (off >= 0x1c) + { + assert(last_m_off > 0); + m_pos -= last_m_off; + } + else + { + off = 1 + (off << 6) + (*ip++ >> 2); + m_pos -= off; + last_m_off = off; + } + } + t = (t >> 5) - 1; +#endif + TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); + goto copy_match; +#endif /* COPY_DICT */ + } + else if (t >= 32) /* a M3 match */ + { + t &= 31; + if (t == 0) + { + while (*ip == 0) + { + t += 255; + ip++; + TEST_OV(t); + NEED_IP(1); + } + t += 31 + *ip++; + NEED_IP(2); + } +#if defined(COPY_DICT) +#if defined(LZO1Z) + m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); + last_m_off = m_off; +#else + m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); +#endif +#else /* !COPY_DICT */ +#if defined(LZO1Z) + { + lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); + m_pos = op - off; + last_m_off = off; + } +#elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) + m_pos = op - 1; + m_pos -= UA_GET_LE16(ip) >> 2; +#else + m_pos = op - 1; + m_pos -= (ip[0] >> 2) + (ip[1] << 6); +#endif +#endif /* COPY_DICT */ + ip += 2; + } + else if (t >= 16) /* a M4 match */ + { +#if defined(COPY_DICT) + m_off = (t & 8) << 11; +#else /* !COPY_DICT */ + m_pos = op; + m_pos -= (t & 8) << 11; +#endif /* COPY_DICT */ + t &= 7; + if (t == 0) + { + while (*ip == 0) + { + t += 255; + ip++; + TEST_OV(t); + NEED_IP(1); + } + t += 7 + *ip++; + NEED_IP(2); + } +#if defined(COPY_DICT) +#if defined(LZO1Z) + m_off += (ip[0] << 6) + (ip[1] >> 2); +#else + m_off += (ip[0] >> 2) + (ip[1] << 6); +#endif + ip += 2; + if (m_off == 0) + goto eof_found; + m_off += 0x4000; +#if defined(LZO1Z) + last_m_off = m_off; +#endif +#else /* !COPY_DICT */ +#if defined(LZO1Z) + m_pos -= (ip[0] << 6) + (ip[1] >> 2); +#elif (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) + m_pos -= UA_GET_LE16(ip) >> 2; +#else + m_pos -= (ip[0] >> 2) + (ip[1] << 6); +#endif + ip += 2; + if (m_pos == op) + goto eof_found; + m_pos -= 0x4000; +#if defined(LZO1Z) + last_m_off = pd((const lzo_bytep)op, m_pos); +#endif +#endif /* COPY_DICT */ + } + else /* a M1 match */ + { +#if defined(COPY_DICT) +#if defined(LZO1Z) + m_off = 1 + (t << 6) + (*ip++ >> 2); + last_m_off = m_off; +#else + m_off = 1 + (t >> 2) + (*ip++ << 2); +#endif + NEED_OP(2); + t = 2; COPY_DICT(t,m_off) +#else /* !COPY_DICT */ +#if defined(LZO1Z) + t = 1 + (t << 6) + (*ip++ >> 2); + m_pos = op - t; + last_m_off = t; +#else + m_pos = op - 1; + m_pos -= t >> 2; + m_pos -= *ip++ << 2; +#endif + TEST_LB(m_pos); NEED_OP(2); + *op++ = *m_pos++; *op++ = *m_pos; +#endif /* COPY_DICT */ + goto match_done; + } + + /* copy match */ +#if defined(COPY_DICT) + + NEED_OP(t+3-1); + t += 3-1; COPY_DICT(t,m_off) + +#else /* !COPY_DICT */ + + TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); +#if (LZO_OPT_UNALIGNED64) && (LZO_OPT_UNALIGNED32) + if (op - m_pos >= 8) + { + t += (3 - 1); + if (t >= 8) do + { + UA_COPY8(op,m_pos); + op += 8; m_pos += 8; t -= 8; + } while (t >= 8); + if (t >= 4) + { + UA_COPY4(op,m_pos); + op += 4; m_pos += 4; t -= 4; + } + if (t > 0) + { + *op++ = m_pos[0]; + if (t > 1) { *op++ = m_pos[1]; if (t > 2) { *op++ = m_pos[2]; } } + } + } + else +#elif (LZO_OPT_UNALIGNED32) || (LZO_ALIGNED_OK_4) +#if !(LZO_OPT_UNALIGNED32) + if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) + { + assert((op - m_pos) >= 4); /* both pointers are aligned */ +#else + if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) + { +#endif + UA_COPY4(op,m_pos); + op += 4; m_pos += 4; t -= 4 - (3 - 1); + do { + UA_COPY4(op,m_pos); + op += 4; m_pos += 4; t -= 4; + } while (t >= 4); + if (t > 0) do *op++ = *m_pos++; while (--t > 0); + } + else +#endif + { +copy_match: + *op++ = *m_pos++; *op++ = *m_pos++; + do *op++ = *m_pos++; while (--t > 0); + } + +#endif /* COPY_DICT */ + +match_done: +#if defined(LZO1Z) + t = ip[-1] & 3; +#else + t = ip[-2] & 3; +#endif + if (t == 0) + break; + + /* copy literals */ +match_next: + assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+3); +#if 0 + do *op++ = *ip++; while (--t > 0); +#else + *op++ = *ip++; + if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } +#endif + t = *ip++; + } + } + +eof_found: + *out_len = pd(op, out); + return (ip == ip_end ? LZO_E_OK : + (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); + + +#if defined(HAVE_NEED_IP) +input_overrun: + *out_len = pd(op, out); + return LZO_E_INPUT_OVERRUN; +#endif + +#if defined(HAVE_NEED_OP) +output_overrun: + *out_len = pd(op, out); + return LZO_E_OUTPUT_OVERRUN; +#endif + +#if defined(LZO_TEST_OVERRUN_LOOKBEHIND) +lookbehind_overrun: + *out_len = pd(op, out); + return LZO_E_LOOKBEHIND_OVERRUN; +#endif +} + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo1x_d1.c b/tools/z64compress/src/enc/lzo/lzo1x_d1.c new file mode 100644 index 000000000..68faf48e8 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo1x_d1.c @@ -0,0 +1,36 @@ +/* lzo1x_d1.c -- LZO1X decompression + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +#include "config1x.h" + +#undef LZO_TEST_OVERRUN +#define DO_DECOMPRESS lzo1x_decompress + +#include "lzo1x_d.ch" + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo1x_d2.c b/tools/z64compress/src/enc/lzo/lzo1x_d2.c new file mode 100644 index 000000000..8b7c316af --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo1x_d2.c @@ -0,0 +1,61 @@ +/* lzo1x_d2.c -- LZO1X decompression with overrun testing + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +#include "config1x.h" + +#define LZO_TEST_OVERRUN 1 +#define DO_DECOMPRESS lzo1x_decompress_safe + +#include "lzo1x_d.ch" + +#if defined(LZO_ARCH_I386) && defined(LZO_USE_ASM) +LZO_EXTERN(int) lzo1x_decompress_asm_safe + (const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem); +LZO_PUBLIC(int) lzo1x_decompress_asm_safe + (const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem) +{ + return lzo1x_decompress_safe(src, src_len, dst, dst_len, wrkmem); +} +LZO_EXTERN(int) lzo1x_decompress_asm_fast_safe + (const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem); +LZO_PUBLIC(int) lzo1x_decompress_asm_fast_safe + (const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem) +{ + return lzo1x_decompress_safe(src, src_len, dst, dst_len, wrkmem); +} +#endif + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo1x_d3.c b/tools/z64compress/src/enc/lzo/lzo1x_d3.c new file mode 100644 index 000000000..b3d430f85 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo1x_d3.c @@ -0,0 +1,93 @@ +/* lzo1x_d3.c -- LZO1X decompression with preset dictionary + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +#include "config1x.h" + +#define LZO_TEST_OVERRUN 1 + + +#define SLOW_MEMCPY(a,b,l) { do *a++ = *b++; while (--l > 0); } +#define FAST_MEMCPY(a,b,l) { lzo_memcpy(a,b,l); a += l; } + +#if 1 && defined(FAST_MEMCPY) +# define DICT_MEMMOVE(op,m_pos,m_len,m_off) \ + if (m_off >= (m_len)) \ + FAST_MEMCPY(op,m_pos,m_len) \ + else \ + SLOW_MEMCPY(op,m_pos,m_len) +#else +# define DICT_MEMMOVE(op,m_pos,m_len,m_off) \ + SLOW_MEMCPY(op,m_pos,m_len) +#endif + +#if !defined(FAST_MEMCPY) +# define FAST_MEMCPY SLOW_MEMCPY +#endif + + +#define COPY_DICT_DICT(m_len,m_off) \ + { \ + const lzo_bytep m_pos; \ + m_off -= pd(op, out); assert(m_off > 0); \ + if (m_off > dict_len) goto lookbehind_overrun; \ + m_pos = dict_end - m_off; \ + if (m_len > m_off) \ + { \ + m_len -= m_off; \ + FAST_MEMCPY(op,m_pos,m_off) \ + m_pos = out; \ + SLOW_MEMCPY(op,m_pos,m_len) \ + } \ + else \ + FAST_MEMCPY(op,m_pos,m_len) \ + } + +#define COPY_DICT(m_len,m_off) \ + assert(m_len >= 2); assert(m_off > 0); assert(op > out); \ + if (m_off <= pd(op, out)) \ + { \ + const lzo_bytep m_pos = op - m_off; \ + DICT_MEMMOVE(op,m_pos,m_len,m_off) \ + } \ + else \ + COPY_DICT_DICT(m_len,m_off) + + + + +LZO_PUBLIC(int) +lzo1x_decompress_dict_safe ( const lzo_bytep in, lzo_uint in_len, + lzo_bytep out, lzo_uintp out_len, + lzo_voidp wrkmem /* NOT USED */, + const lzo_bytep dict, lzo_uint dict_len) + + +#include "lzo1x_d.ch" + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo_conf.h b/tools/z64compress/src/enc/lzo/lzo_conf.h new file mode 100644 index 000000000..fff021d1a --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo_conf.h @@ -0,0 +1,436 @@ +/* lzo_conf.h -- main internal configuration file for the the LZO library + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the library and is subject + to change. + */ + + +#ifndef __LZO_CONF_H +#define __LZO_CONF_H 1 + +#if !defined(__LZO_IN_MINILZO) +#if defined(LZO_CFG_FREESTANDING) && (LZO_CFG_FREESTANDING) +# define LZO_LIBC_FREESTANDING 1 +# define LZO_OS_FREESTANDING 1 +#endif +#if defined(LZO_CFG_EXTRA_CONFIG_HEADER) +# include LZO_CFG_EXTRA_CONFIG_HEADER +#endif +#if defined(__LZOCONF_H) || defined(__LZOCONF_H_INCLUDED) +# error "include this file first" +#endif +#if defined(LZO_CFG_BUILD_DLL) && (LZO_CFG_BUILD_DLL+0) && !defined(__LZO_EXPORT1) && !defined(__LZO_EXPORT2) && 0 + /* idea: we could auto-define __LZO_EXPORT1 for DLL exports */ +#ifndef __LZODEFS_H_INCLUDED +#if defined(LZO_HAVE_CONFIG_H) +# include +#endif +#include +#include +#include "lzodefs.h" +#endif + /* #define __LZO_EXPORT1 __attribute__((__visibility__("default"))) */ + /* #define __LZO_EXPORT1 __declspec(dllexport) */ +#endif +#include "lzoconf.h" +#if defined(LZO_CFG_EXTRA_CONFIG_HEADER2) +# include LZO_CFG_EXTRA_CONFIG_HEADER2 +#endif +#endif /* !defined(__LZO_IN_MINILZO) */ + +#if !defined(__LZOCONF_H_INCLUDED) || (LZO_VERSION+0 != 0x20a0) +# error "version mismatch" +#endif + + +/*********************************************************************** +// pragmas +************************************************************************/ + +#if (LZO_CC_MSC && (_MSC_VER >= 1000 && _MSC_VER < 1100)) + /* disable bogus "unreachable code" warnings */ +# pragma warning(disable: 4702) +#endif +#if (LZO_CC_MSC && (_MSC_VER >= 1000)) +# pragma warning(disable: 4127 4701) + /* disable warnings about inlining */ +# pragma warning(disable: 4514 4710 4711) +#endif +#if (LZO_CC_MSC && (_MSC_VER >= 1300)) + /* disable '-Wall' warnings in system header files */ +# pragma warning(disable: 4820) +#endif +#if (LZO_CC_MSC && (_MSC_VER >= 1800)) + /* disable '-Wall' warnings in system header files */ +# pragma warning(disable: 4746) +#endif +#if (LZO_CC_INTELC && (__INTEL_COMPILER >= 900)) + /* disable pedantic warnings in system header files */ +# pragma warning(disable: 1684) +#endif + +#if (LZO_CC_SUNPROC) +#if !defined(__cplusplus) +# pragma error_messages(off,E_END_OF_LOOP_CODE_NOT_REACHED) +# pragma error_messages(off,E_LOOP_NOT_ENTERED_AT_TOP) +# pragma error_messages(off,E_STATEMENT_NOT_REACHED) +#endif +#endif + + +/*********************************************************************** +// function types +************************************************************************/ + +#if !defined(__LZO_NOEXPORT1) +# define __LZO_NOEXPORT1 /*empty*/ +#endif +#if !defined(__LZO_NOEXPORT2) +# define __LZO_NOEXPORT2 /*empty*/ +#endif + +#if 1 +# define LZO_PUBLIC_DECL(r) LZO_EXTERN(r) +#endif +#if 1 +# define LZO_PUBLIC_IMPL(r) LZO_PUBLIC(r) +#endif +#if !defined(LZO_LOCAL_DECL) +# define LZO_LOCAL_DECL(r) __LZO_EXTERN_C LZO_LOCAL_IMPL(r) +#endif +#if !defined(LZO_LOCAL_IMPL) +# define LZO_LOCAL_IMPL(r) __LZO_NOEXPORT1 r __LZO_NOEXPORT2 __LZO_CDECL +#endif +#if 1 +# define LZO_STATIC_DECL(r) LZO_PRIVATE(r) +#endif +#if 1 +# define LZO_STATIC_IMPL(r) LZO_PRIVATE(r) +#endif + + +/*********************************************************************** +// +************************************************************************/ + +#if defined(__LZO_IN_MINILZO) || (LZO_CFG_FREESTANDING) +#elif 1 +# include +#else +# define LZO_WANT_ACC_INCD_H 1 +#endif +#if defined(LZO_HAVE_CONFIG_H) +# define LZO_CFG_NO_CONFIG_HEADER 1 +#endif +#include "lzo_supp.h" + +/* Integral types */ +#if 1 || defined(lzo_int8_t) || defined(lzo_uint8_t) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint8_t) == 1) +#endif +#if 1 || defined(lzo_int16_t) || defined(lzo_uint16_t) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint16_t) == 2) +#endif +#if 1 || defined(lzo_int32_t) || defined(lzo_uint32_t) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32_t) == 4) +#endif +#if defined(lzo_int64_t) || defined(lzo_uint64_t) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint64_t) == 8) +#endif + +#if (LZO_CFG_FREESTANDING) +# undef HAVE_MEMCMP +# undef HAVE_MEMCPY +# undef HAVE_MEMMOVE +# undef HAVE_MEMSET +#endif + +#if !(HAVE_MEMCMP) +# undef memcmp +# define memcmp(a,b,c) lzo_memcmp(a,b,c) +#else +# undef lzo_memcmp +# define lzo_memcmp(a,b,c) memcmp(a,b,c) +#endif +#if !(HAVE_MEMCPY) +# undef memcpy +# define memcpy(a,b,c) lzo_memcpy(a,b,c) +#else +# undef lzo_memcpy +# define lzo_memcpy(a,b,c) memcpy(a,b,c) +#endif +#if !(HAVE_MEMMOVE) +# undef memmove +# define memmove(a,b,c) lzo_memmove(a,b,c) +#else +# undef lzo_memmove +# define lzo_memmove(a,b,c) memmove(a,b,c) +#endif +#if !(HAVE_MEMSET) +# undef memset +# define memset(a,b,c) lzo_memset(a,b,c) +#else +# undef lzo_memset +# define lzo_memset(a,b,c) memset(a,b,c) +#endif + +#undef NDEBUG +#if (LZO_CFG_FREESTANDING) +# undef LZO_DEBUG +# define NDEBUG 1 +# undef assert +# define assert(e) ((void)0) +#else +# if !defined(LZO_DEBUG) +# define NDEBUG 1 +# endif +# include +#endif + +#if 0 && defined(__BOUNDS_CHECKING_ON) +# include +#else +# define BOUNDS_CHECKING_OFF_DURING(stmt) stmt +# define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr) +#endif + +#if (LZO_CFG_PGO) +# undef __lzo_likely +# undef __lzo_unlikely +# define __lzo_likely(e) (e) +# define __lzo_unlikely(e) (e) +#endif + +#undef _ +#undef __ +#undef ___ +#undef ____ +#undef _p0 +#undef _p1 +#undef _p2 +#undef _p3 +#undef _p4 +#undef _s0 +#undef _s1 +#undef _s2 +#undef _s3 +#undef _s4 +#undef _ww + + +/*********************************************************************** +// +************************************************************************/ + +#if 1 +# define LZO_BYTE(x) ((unsigned char) (x)) +#else +# define LZO_BYTE(x) ((unsigned char) ((x) & 0xff)) +#endif + +#define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b)) +#define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b)) +#define LZO_MAX3(a,b,c) ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c)) +#define LZO_MIN3(a,b,c) ((a) <= (b) ? LZO_MIN(a,c) : LZO_MIN(b,c)) + +#define lzo_sizeof(type) ((lzo_uint) (sizeof(type))) + +#define LZO_HIGH(array) ((lzo_uint) (sizeof(array)/sizeof(*(array)))) + +/* this always fits into 32 bits */ +#define LZO_SIZE(bits) (1u << (bits)) +#define LZO_MASK(bits) (LZO_SIZE(bits) - 1) + +#define LZO_USIZE(bits) ((lzo_uint) 1 << (bits)) +#define LZO_UMASK(bits) (LZO_USIZE(bits) - 1) + +#if !defined(DMUL) +#if 0 + /* 32*32 multiplies may be faster than 64*64 on some 64-bit machines, + * but then we need extra casts from unsigned<->size_t */ +# define DMUL(a,b) ((lzo_xint) ((lzo_uint32_t)(a) * (lzo_uint32_t)(b))) +#else +# define DMUL(a,b) ((lzo_xint) ((a) * (b))) +#endif +#endif + + +/*********************************************************************** +// compiler and architecture specific stuff +************************************************************************/ + +/* Some defines that indicate if memory can be accessed at unaligned + * memory addresses. You should also test that this is actually faster + * even if it is allowed by your system. + */ + +#include "lzo_func.h" + +#ifndef UA_SET1 +#define UA_SET1 LZO_MEMOPS_SET1 +#endif +#ifndef UA_SET2 +#define UA_SET2 LZO_MEMOPS_SET2 +#endif +#ifndef UA_SET3 +#define UA_SET3 LZO_MEMOPS_SET3 +#endif +#ifndef UA_SET4 +#define UA_SET4 LZO_MEMOPS_SET4 +#endif +#ifndef UA_MOVE1 +#define UA_MOVE1 LZO_MEMOPS_MOVE1 +#endif +#ifndef UA_MOVE2 +#define UA_MOVE2 LZO_MEMOPS_MOVE2 +#endif +#ifndef UA_MOVE3 +#define UA_MOVE3 LZO_MEMOPS_MOVE3 +#endif +#ifndef UA_MOVE4 +#define UA_MOVE4 LZO_MEMOPS_MOVE4 +#endif +#ifndef UA_MOVE8 +#define UA_MOVE8 LZO_MEMOPS_MOVE8 +#endif +#ifndef UA_COPY1 +#define UA_COPY1 LZO_MEMOPS_COPY1 +#endif +#ifndef UA_COPY2 +#define UA_COPY2 LZO_MEMOPS_COPY2 +#endif +#ifndef UA_COPY3 +#define UA_COPY3 LZO_MEMOPS_COPY3 +#endif +#ifndef UA_COPY4 +#define UA_COPY4 LZO_MEMOPS_COPY4 +#endif +#ifndef UA_COPY8 +#define UA_COPY8 LZO_MEMOPS_COPY8 +#endif +#ifndef UA_COPYN +#define UA_COPYN LZO_MEMOPS_COPYN +#endif +#ifndef UA_COPYN_X +#define UA_COPYN_X LZO_MEMOPS_COPYN +#endif +#ifndef UA_GET_LE16 +#define UA_GET_LE16 LZO_MEMOPS_GET_LE16 +#endif +#ifndef UA_GET_LE32 +#define UA_GET_LE32 LZO_MEMOPS_GET_LE32 +#endif +#ifdef LZO_MEMOPS_GET_LE64 +#ifndef UA_GET_LE64 +#define UA_GET_LE64 LZO_MEMOPS_GET_LE64 +#endif +#endif +#ifndef UA_GET_NE16 +#define UA_GET_NE16 LZO_MEMOPS_GET_NE16 +#endif +#ifndef UA_GET_NE32 +#define UA_GET_NE32 LZO_MEMOPS_GET_NE32 +#endif +#ifdef LZO_MEMOPS_GET_NE64 +#ifndef UA_GET_NE64 +#define UA_GET_NE64 LZO_MEMOPS_GET_NE64 +#endif +#endif +#ifndef UA_PUT_LE16 +#define UA_PUT_LE16 LZO_MEMOPS_PUT_LE16 +#endif +#ifndef UA_PUT_LE32 +#define UA_PUT_LE32 LZO_MEMOPS_PUT_LE32 +#endif +#ifndef UA_PUT_NE16 +#define UA_PUT_NE16 LZO_MEMOPS_PUT_NE16 +#endif +#ifndef UA_PUT_NE32 +#define UA_PUT_NE32 LZO_MEMOPS_PUT_NE32 +#endif + + +/* Fast memcpy that copies multiples of 8 byte chunks. + * len is the number of bytes. + * note: all parameters must be lvalues, len >= 8 + * dest and src advance, len is undefined afterwards + */ + +#define MEMCPY8_DS(dest,src,len) \ + lzo_memcpy(dest,src,len); dest += len; src += len + +#define BZERO8_PTR(s,l,n) \ + lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n)) + +#define MEMCPY_DS(dest,src,len) \ + do *dest++ = *src++; while (--len > 0) + + +/*********************************************************************** +// +************************************************************************/ + +LZO_EXTERN(const lzo_bytep) lzo_copyright(void); + +#include "lzo_ptr.h" + +/* Generate compressed data in a deterministic way. + * This is fully portable, and compression can be faster as well. + * A reason NOT to be deterministic is when the block size is + * very small (e.g. 8kB) or the dictionary is big, because + * then the initialization of the dictionary becomes a relevant + * magnitude for compression speed. + */ +#ifndef LZO_DETERMINISTIC +#define LZO_DETERMINISTIC 1 +#endif + + +#ifndef LZO_DICT_USE_PTR +#define LZO_DICT_USE_PTR 1 +#endif + +#if (LZO_DICT_USE_PTR) +# define lzo_dict_t const lzo_bytep +# define lzo_dict_p lzo_dict_t * +#else +# define lzo_dict_t lzo_uint +# define lzo_dict_p lzo_dict_t * +#endif + + +#endif /* already included */ + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo_dict.h b/tools/z64compress/src/enc/lzo/lzo_dict.h new file mode 100644 index 000000000..e48addb17 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo_dict.h @@ -0,0 +1,307 @@ +/* lzo_dict.h -- dictionary definitions for the the LZO library + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the library and is subject + to change. + */ + + +#ifndef __LZO_DICT_H +#define __LZO_DICT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + + + +/*********************************************************************** +// dictionary size +************************************************************************/ + +/* dictionary needed for compression */ +#if !defined(D_BITS) && defined(DBITS) +# define D_BITS DBITS +#endif +#if !defined(D_BITS) +# error "D_BITS is not defined" +#endif +#if (D_BITS < 16) +# define D_SIZE LZO_SIZE(D_BITS) +# define D_MASK LZO_MASK(D_BITS) +#else +# define D_SIZE LZO_USIZE(D_BITS) +# define D_MASK LZO_UMASK(D_BITS) +#endif +#define D_HIGH ((D_MASK >> 1) + 1) + + +/* dictionary depth */ +#if !defined(DD_BITS) +# define DD_BITS 0 +#endif +#define DD_SIZE LZO_SIZE(DD_BITS) +#define DD_MASK LZO_MASK(DD_BITS) + +/* dictionary length */ +#if !defined(DL_BITS) +# define DL_BITS (D_BITS - DD_BITS) +#endif +#if (DL_BITS < 16) +# define DL_SIZE LZO_SIZE(DL_BITS) +# define DL_MASK LZO_MASK(DL_BITS) +#else +# define DL_SIZE LZO_USIZE(DL_BITS) +# define DL_MASK LZO_UMASK(DL_BITS) +#endif + + +#if (D_BITS != DL_BITS + DD_BITS) +# error "D_BITS does not match" +#endif +#if (D_BITS < 6 || D_BITS > 18) +# error "invalid D_BITS" +#endif +#if (DL_BITS < 6 || DL_BITS > 20) +# error "invalid DL_BITS" +#endif +#if (DD_BITS < 0 || DD_BITS > 6) +# error "invalid DD_BITS" +#endif + + +#if !defined(DL_MIN_LEN) +# define DL_MIN_LEN 3 +#endif +#if !defined(DL_SHIFT) +# define DL_SHIFT ((DL_BITS + (DL_MIN_LEN - 1)) / DL_MIN_LEN) +#endif + + + +/*********************************************************************** +// dictionary access +************************************************************************/ + +#define LZO_HASH_GZIP 1 +#define LZO_HASH_GZIP_INCREMENTAL 2 +#define LZO_HASH_LZO_INCREMENTAL_A 3 +#define LZO_HASH_LZO_INCREMENTAL_B 4 + +#if !defined(LZO_HASH) +# error "choose a hashing strategy" +#endif + +#undef DM +#undef DX + +#if (DL_MIN_LEN == 3) +# define _DV2_A(p,shift1,shift2) \ + (((( (lzo_xint)((p)[0]) << shift1) ^ (p)[1]) << shift2) ^ (p)[2]) +# define _DV2_B(p,shift1,shift2) \ + (((( (lzo_xint)((p)[2]) << shift1) ^ (p)[1]) << shift2) ^ (p)[0]) +# define _DV3_B(p,shift1,shift2,shift3) \ + ((_DV2_B((p)+1,shift1,shift2) << (shift3)) ^ (p)[0]) +#elif (DL_MIN_LEN == 2) +# define _DV2_A(p,shift1,shift2) \ + (( (lzo_xint)(p[0]) << shift1) ^ p[1]) +# define _DV2_B(p,shift1,shift2) \ + (( (lzo_xint)(p[1]) << shift1) ^ p[2]) +#else +# error "invalid DL_MIN_LEN" +#endif +#define _DV_A(p,shift) _DV2_A(p,shift,shift) +#define _DV_B(p,shift) _DV2_B(p,shift,shift) +#define DA2(p,s1,s2) \ + (((((lzo_xint)((p)[2]) << (s2)) + (p)[1]) << (s1)) + (p)[0]) +#define DS2(p,s1,s2) \ + (((((lzo_xint)((p)[2]) << (s2)) - (p)[1]) << (s1)) - (p)[0]) +#define DX2(p,s1,s2) \ + (((((lzo_xint)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0]) +#define DA3(p,s1,s2,s3) ((DA2((p)+1,s2,s3) << (s1)) + (p)[0]) +#define DS3(p,s1,s2,s3) ((DS2((p)+1,s2,s3) << (s1)) - (p)[0]) +#define DX3(p,s1,s2,s3) ((DX2((p)+1,s2,s3) << (s1)) ^ (p)[0]) +#define DMS(v,s) ((lzo_uint) (((v) & (D_MASK >> (s))) << (s))) +#define DM(v) DMS(v,0) + + +#if (LZO_HASH == LZO_HASH_GZIP) + /* hash function like in gzip/zlib (deflate) */ +# define _DINDEX(dv,p) (_DV_A((p),DL_SHIFT)) + +#elif (LZO_HASH == LZO_HASH_GZIP_INCREMENTAL) + /* incremental hash like in gzip/zlib (deflate) */ +# define __LZO_HASH_INCREMENTAL 1 +# define DVAL_FIRST(dv,p) dv = _DV_A((p),DL_SHIFT) +# define DVAL_NEXT(dv,p) dv = (((dv) << DL_SHIFT) ^ p[2]) +# define _DINDEX(dv,p) (dv) +# define DVAL_LOOKAHEAD DL_MIN_LEN + +#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_A) + /* incremental LZO hash version A */ +# define __LZO_HASH_INCREMENTAL 1 +# define DVAL_FIRST(dv,p) dv = _DV_A((p),5) +# define DVAL_NEXT(dv,p) \ + dv ^= (lzo_xint)(p[-1]) << (2*5); dv = (((dv) << 5) ^ p[2]) +# define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5) +# define DVAL_LOOKAHEAD DL_MIN_LEN + +#elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_B) + /* incremental LZO hash version B */ +# define __LZO_HASH_INCREMENTAL 1 +# define DVAL_FIRST(dv,p) dv = _DV_B((p),5) +# define DVAL_NEXT(dv,p) \ + dv ^= p[-1]; dv = (((dv) >> 5) ^ ((lzo_xint)(p[2]) << (2*5))) +# define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5) +# define DVAL_LOOKAHEAD DL_MIN_LEN + +#else +# error "choose a hashing strategy" +#endif + + +#ifndef DINDEX +#define DINDEX(dv,p) ((lzo_uint)((_DINDEX(dv,p)) & DL_MASK) << DD_BITS) +#endif +#if !defined(DINDEX1) && defined(D_INDEX1) +#define DINDEX1 D_INDEX1 +#endif +#if !defined(DINDEX2) && defined(D_INDEX2) +#define DINDEX2 D_INDEX2 +#endif + + + +#if !defined(__LZO_HASH_INCREMENTAL) +# define DVAL_FIRST(dv,p) ((void) 0) +# define DVAL_NEXT(dv,p) ((void) 0) +# define DVAL_LOOKAHEAD 0 +#endif + + +#if !defined(DVAL_ASSERT) +#if defined(__LZO_HASH_INCREMENTAL) && !defined(NDEBUG) +#if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) +static void __attribute__((__unused__)) +#else +static void +#endif +DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) +{ + lzo_xint df; + DVAL_FIRST(df,(p)); + assert(DINDEX(dv,p) == DINDEX(df,p)); +} +#else +# define DVAL_ASSERT(dv,p) ((void) 0) +#endif +#endif + + + +/*********************************************************************** +// dictionary updating +************************************************************************/ + +#if (LZO_DICT_USE_PTR) +# define DENTRY(p,in) (p) +# define GINDEX(m_pos,m_off,dict,dindex,in) m_pos = dict[dindex] +#else +# define DENTRY(p,in) ((lzo_dict_t) pd(p, in)) +# define GINDEX(m_pos,m_off,dict,dindex,in) m_off = dict[dindex] +#endif + + +#if (DD_BITS == 0) + +# define UPDATE_D(dict,drun,dv,p,in) dict[ DINDEX(dv,p) ] = DENTRY(p,in) +# define UPDATE_I(dict,drun,index,p,in) dict[index] = DENTRY(p,in) +# define UPDATE_P(ptr,drun,p,in) (ptr)[0] = DENTRY(p,in) + +#else + +# define UPDATE_D(dict,drun,dv,p,in) \ + dict[ DINDEX(dv,p) + drun++ ] = DENTRY(p,in); drun &= DD_MASK +# define UPDATE_I(dict,drun,index,p,in) \ + dict[ (index) + drun++ ] = DENTRY(p,in); drun &= DD_MASK +# define UPDATE_P(ptr,drun,p,in) \ + (ptr) [ drun++ ] = DENTRY(p,in); drun &= DD_MASK + +#endif + + +/*********************************************************************** +// test for a match +************************************************************************/ + +#if (LZO_DICT_USE_PTR) + +/* m_pos is either NULL or a valid pointer */ +#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ + (m_pos == NULL || (m_off = pd(ip, m_pos)) > max_offset) + +/* m_pos may point anywhere... */ +#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ + (BOUNDS_CHECKING_OFF_IN_EXPR(( \ + m_pos = ip - (lzo_uint) PTR_DIFF(ip,m_pos), \ + PTR_LT(m_pos,in) || \ + (m_off = (lzo_uint) PTR_DIFF(ip,m_pos)) == 0 || \ + m_off > max_offset ))) + +#else + +#define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ + (m_off == 0 || \ + ((m_off = pd(ip, in) - m_off) > max_offset) || \ + (m_pos = (ip) - (m_off), 0) ) + +#define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ + (pd(ip, in) <= m_off || \ + ((m_off = pd(ip, in) - m_off) > max_offset) || \ + (m_pos = (ip) - (m_off), 0) ) + +#endif + + +#if (LZO_DETERMINISTIC) +# define LZO_CHECK_MPOS LZO_CHECK_MPOS_DET +#else +# define LZO_CHECK_MPOS LZO_CHECK_MPOS_NON_DET +#endif + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* already included */ + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo_func.h b/tools/z64compress/src/enc/lzo/lzo_func.h new file mode 100644 index 000000000..f3ac8e344 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo_func.h @@ -0,0 +1,491 @@ +/* lzo_func.h -- functions + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the library and is subject + to change. + */ + + +#ifndef __LZO_FUNC_H +#define __LZO_FUNC_H 1 + + +/*********************************************************************** +// bitops +************************************************************************/ + +#if !defined(LZO_BITOPS_USE_ASM_BITSCAN) && !defined(LZO_BITOPS_USE_GNUC_BITSCAN) && !defined(LZO_BITOPS_USE_MSC_BITSCAN) +#if 1 && (LZO_ARCH_AMD64) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_ASM_SYNTAX_GNUC) +#define LZO_BITOPS_USE_ASM_BITSCAN 1 +#elif (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x030400ul) || (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1000)) || (LZO_CC_LLVM && (!defined(__llvm_tools_version__) || (__llvm_tools_version__+0 >= 0x010500ul)))) +#define LZO_BITOPS_USE_GNUC_BITSCAN 1 +#elif (LZO_OS_WIN32 || LZO_OS_WIN64) && ((LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 1010)) || (LZO_CC_MSC && (_MSC_VER >= 1400))) +#define LZO_BITOPS_USE_MSC_BITSCAN 1 +#if (LZO_CC_MSC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) +#include +#endif +#if (LZO_CC_MSC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) +#pragma intrinsic(_BitScanReverse) +#pragma intrinsic(_BitScanForward) +#endif +#if (LZO_CC_MSC) && (LZO_ARCH_AMD64) +#pragma intrinsic(_BitScanReverse64) +#pragma intrinsic(_BitScanForward64) +#endif +#endif +#endif + +__lzo_static_forceinline unsigned lzo_bitops_ctlz32_func(lzo_uint32_t v) +{ +#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) + unsigned long r; (void) _BitScanReverse(&r, v); return (unsigned) r ^ 31; +#define lzo_bitops_ctlz32(v) lzo_bitops_ctlz32_func(v) +#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC) + lzo_uint32_t r; + __asm__("bsr %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC); + return (unsigned) r ^ 31; +#define lzo_bitops_ctlz32(v) lzo_bitops_ctlz32_func(v) +#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_INT == 4) + unsigned r; r = (unsigned) __builtin_clz(v); return r; +#define lzo_bitops_ctlz32(v) ((unsigned) __builtin_clz(v)) +#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG == 8) && (LZO_WORDSIZE >= 8) + unsigned r; r = (unsigned) __builtin_clzl(v); return r ^ 32; +#define lzo_bitops_ctlz32(v) (((unsigned) __builtin_clzl(v)) ^ 32) +#else + LZO_UNUSED(v); return 0; +#endif +} + +#if defined(lzo_uint64_t) +__lzo_static_forceinline unsigned lzo_bitops_ctlz64_func(lzo_uint64_t v) +{ +#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64) + unsigned long r; (void) _BitScanReverse64(&r, v); return (unsigned) r ^ 63; +#define lzo_bitops_ctlz64(v) lzo_bitops_ctlz64_func(v) +#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC) + lzo_uint64_t r; + __asm__("bsr %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC); + return (unsigned) r ^ 63; +#define lzo_bitops_ctlz64(v) lzo_bitops_ctlz64_func(v) +#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG == 8) && (LZO_WORDSIZE >= 8) + unsigned r; r = (unsigned) __builtin_clzl(v); return r; +#define lzo_bitops_ctlz64(v) ((unsigned) __builtin_clzl(v)) +#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG_LONG == 8) && (LZO_WORDSIZE >= 8) + unsigned r; r = (unsigned) __builtin_clzll(v); return r; +#define lzo_bitops_ctlz64(v) ((unsigned) __builtin_clzll(v)) +#else + LZO_UNUSED(v); return 0; +#endif +} +#endif + +__lzo_static_forceinline unsigned lzo_bitops_cttz32_func(lzo_uint32_t v) +{ +#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) + unsigned long r; (void) _BitScanForward(&r, v); return (unsigned) r; +#define lzo_bitops_cttz32(v) lzo_bitops_cttz32_func(v) +#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC) + lzo_uint32_t r; + __asm__("bsf %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC); + return (unsigned) r; +#define lzo_bitops_cttz32(v) lzo_bitops_cttz32_func(v) +#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_INT >= 4) + unsigned r; r = (unsigned) __builtin_ctz(v); return r; +#define lzo_bitops_cttz32(v) ((unsigned) __builtin_ctz(v)) +#else + LZO_UNUSED(v); return 0; +#endif +} + +#if defined(lzo_uint64_t) +__lzo_static_forceinline unsigned lzo_bitops_cttz64_func(lzo_uint64_t v) +{ +#if (LZO_BITOPS_USE_MSC_BITSCAN) && (LZO_ARCH_AMD64) + unsigned long r; (void) _BitScanForward64(&r, v); return (unsigned) r; +#define lzo_bitops_cttz64(v) lzo_bitops_cttz64_func(v) +#elif (LZO_BITOPS_USE_ASM_BITSCAN) && (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC) + lzo_uint64_t r; + __asm__("bsf %1,%0" : "=r" (r) : "rm" (v) __LZO_ASM_CLOBBER_LIST_CC); + return (unsigned) r; +#define lzo_bitops_cttz64(v) lzo_bitops_cttz64_func(v) +#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG >= 8) && (LZO_WORDSIZE >= 8) + unsigned r; r = (unsigned) __builtin_ctzl(v); return r; +#define lzo_bitops_cttz64(v) ((unsigned) __builtin_ctzl(v)) +#elif (LZO_BITOPS_USE_GNUC_BITSCAN) && (LZO_SIZEOF_LONG_LONG >= 8) && (LZO_WORDSIZE >= 8) + unsigned r; r = (unsigned) __builtin_ctzll(v); return r; +#define lzo_bitops_cttz64(v) ((unsigned) __builtin_ctzll(v)) +#else + LZO_UNUSED(v); return 0; +#endif +} +#endif + +lzo_unused_funcs_impl(void, lzo_bitops_unused_funcs)(void) +{ + LZO_UNUSED_FUNC(lzo_bitops_unused_funcs); + LZO_UNUSED_FUNC(lzo_bitops_ctlz32_func); + LZO_UNUSED_FUNC(lzo_bitops_cttz32_func); +#if defined(lzo_uint64_t) + LZO_UNUSED_FUNC(lzo_bitops_ctlz64_func); + LZO_UNUSED_FUNC(lzo_bitops_cttz64_func); +#endif +} + + +/*********************************************************************** +// memops +************************************************************************/ + +#if defined(__lzo_alignof) && !(LZO_CFG_NO_UNALIGNED) +/* CBUG: disabled because of gcc bug 64516 */ +#if !defined(lzo_memops_tcheck__) && 0 +#define lzo_memops_tcheck__(t,a,b) ((void)0, sizeof(t) == (a) && __lzo_alignof(t) == (b)) +#endif +#endif +#ifndef lzo_memops_TU0p +#define lzo_memops_TU0p void __LZO_MMODEL * +#endif +#ifndef lzo_memops_TU1p +#define lzo_memops_TU1p unsigned char __LZO_MMODEL * +#endif +#ifndef lzo_memops_TU2p +#if (LZO_OPT_UNALIGNED16) +typedef lzo_uint16_t __lzo_may_alias lzo_memops_TU2; +#define lzo_memops_TU2p volatile lzo_memops_TU2 * +#elif defined(__lzo_byte_struct) +__lzo_byte_struct(lzo_memops_TU2_struct,2) +typedef struct lzo_memops_TU2_struct lzo_memops_TU2; +#else +struct lzo_memops_TU2_struct { unsigned char a[2]; } __lzo_may_alias; +typedef struct lzo_memops_TU2_struct lzo_memops_TU2; +#endif +#ifndef lzo_memops_TU2p +#define lzo_memops_TU2p lzo_memops_TU2 * +#endif +#endif +#ifndef lzo_memops_TU4p +#if (LZO_OPT_UNALIGNED32) +typedef lzo_uint32_t __lzo_may_alias lzo_memops_TU4; +#define lzo_memops_TU4p volatile lzo_memops_TU4 __LZO_MMODEL * +#elif defined(__lzo_byte_struct) +__lzo_byte_struct(lzo_memops_TU4_struct,4) +typedef struct lzo_memops_TU4_struct lzo_memops_TU4; +#else +struct lzo_memops_TU4_struct { unsigned char a[4]; } __lzo_may_alias; +typedef struct lzo_memops_TU4_struct lzo_memops_TU4; +#endif +#ifndef lzo_memops_TU4p +#define lzo_memops_TU4p lzo_memops_TU4 __LZO_MMODEL * +#endif +#endif +#ifndef lzo_memops_TU8p +#if (LZO_OPT_UNALIGNED64) +typedef lzo_uint64_t __lzo_may_alias lzo_memops_TU8; +#define lzo_memops_TU8p volatile lzo_memops_TU8 __LZO_MMODEL * +#elif defined(__lzo_byte_struct) +__lzo_byte_struct(lzo_memops_TU8_struct,8) +typedef struct lzo_memops_TU8_struct lzo_memops_TU8; +#else +struct lzo_memops_TU8_struct { unsigned char a[8]; } __lzo_may_alias; +typedef struct lzo_memops_TU8_struct lzo_memops_TU8; +#endif +#ifndef lzo_memops_TU8p +#define lzo_memops_TU8p lzo_memops_TU8 __LZO_MMODEL * +#endif +#endif +#ifndef lzo_memops_set_TU1p +#define lzo_memops_set_TU1p volatile lzo_memops_TU1p +#endif +#ifndef lzo_memops_move_TU1p +#define lzo_memops_move_TU1p lzo_memops_TU1p +#endif +#define LZO_MEMOPS_SET1(dd,cc) \ + LZO_BLOCK_BEGIN \ + lzo_memops_set_TU1p d__1 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \ + d__1[0] = LZO_BYTE(cc); \ + LZO_BLOCK_END +#define LZO_MEMOPS_SET2(dd,cc) \ + LZO_BLOCK_BEGIN \ + lzo_memops_set_TU1p d__2 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \ + d__2[0] = LZO_BYTE(cc); d__2[1] = LZO_BYTE(cc); \ + LZO_BLOCK_END +#define LZO_MEMOPS_SET3(dd,cc) \ + LZO_BLOCK_BEGIN \ + lzo_memops_set_TU1p d__3 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \ + d__3[0] = LZO_BYTE(cc); d__3[1] = LZO_BYTE(cc); d__3[2] = LZO_BYTE(cc); \ + LZO_BLOCK_END +#define LZO_MEMOPS_SET4(dd,cc) \ + LZO_BLOCK_BEGIN \ + lzo_memops_set_TU1p d__4 = (lzo_memops_set_TU1p) (lzo_memops_TU0p) (dd); \ + d__4[0] = LZO_BYTE(cc); d__4[1] = LZO_BYTE(cc); d__4[2] = LZO_BYTE(cc); d__4[3] = LZO_BYTE(cc); \ + LZO_BLOCK_END +#define LZO_MEMOPS_MOVE1(dd,ss) \ + LZO_BLOCK_BEGIN \ + lzo_memops_move_TU1p d__1 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ + const lzo_memops_move_TU1p s__1 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ + d__1[0] = s__1[0]; \ + LZO_BLOCK_END +#define LZO_MEMOPS_MOVE2(dd,ss) \ + LZO_BLOCK_BEGIN \ + lzo_memops_move_TU1p d__2 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ + const lzo_memops_move_TU1p s__2 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ + d__2[0] = s__2[0]; d__2[1] = s__2[1]; \ + LZO_BLOCK_END +#define LZO_MEMOPS_MOVE3(dd,ss) \ + LZO_BLOCK_BEGIN \ + lzo_memops_move_TU1p d__3 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ + const lzo_memops_move_TU1p s__3 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ + d__3[0] = s__3[0]; d__3[1] = s__3[1]; d__3[2] = s__3[2]; \ + LZO_BLOCK_END +#define LZO_MEMOPS_MOVE4(dd,ss) \ + LZO_BLOCK_BEGIN \ + lzo_memops_move_TU1p d__4 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ + const lzo_memops_move_TU1p s__4 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ + d__4[0] = s__4[0]; d__4[1] = s__4[1]; d__4[2] = s__4[2]; d__4[3] = s__4[3]; \ + LZO_BLOCK_END +#define LZO_MEMOPS_MOVE8(dd,ss) \ + LZO_BLOCK_BEGIN \ + lzo_memops_move_TU1p d__8 = (lzo_memops_move_TU1p) (lzo_memops_TU0p) (dd); \ + const lzo_memops_move_TU1p s__8 = (const lzo_memops_move_TU1p) (const lzo_memops_TU0p) (ss); \ + d__8[0] = s__8[0]; d__8[1] = s__8[1]; d__8[2] = s__8[2]; d__8[3] = s__8[3]; \ + d__8[4] = s__8[4]; d__8[5] = s__8[5]; d__8[6] = s__8[6]; d__8[7] = s__8[7]; \ + LZO_BLOCK_END +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU1p)0)==1) +#define LZO_MEMOPS_COPY1(dd,ss) LZO_MEMOPS_MOVE1(dd,ss) +#if (LZO_OPT_UNALIGNED16) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0)==2) +#define LZO_MEMOPS_COPY2(dd,ss) \ + * (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss) +#elif defined(lzo_memops_tcheck__) +#define LZO_MEMOPS_COPY2(dd,ss) \ + LZO_BLOCK_BEGIN if (lzo_memops_tcheck__(lzo_memops_TU2,2,1)) { \ + * (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss); \ + } else { LZO_MEMOPS_MOVE2(dd,ss); } LZO_BLOCK_END +#else +#define LZO_MEMOPS_COPY2(dd,ss) LZO_MEMOPS_MOVE2(dd,ss) +#endif +#if (LZO_OPT_UNALIGNED32) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0)==4) +#define LZO_MEMOPS_COPY4(dd,ss) \ + * (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss) +#elif defined(lzo_memops_tcheck__) +#define LZO_MEMOPS_COPY4(dd,ss) \ + LZO_BLOCK_BEGIN if (lzo_memops_tcheck__(lzo_memops_TU4,4,1)) { \ + * (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss); \ + } else { LZO_MEMOPS_MOVE4(dd,ss); } LZO_BLOCK_END +#else +#define LZO_MEMOPS_COPY4(dd,ss) LZO_MEMOPS_MOVE4(dd,ss) +#endif +#if (LZO_WORDSIZE != 8) +#define LZO_MEMOPS_COPY8(dd,ss) \ + LZO_BLOCK_BEGIN LZO_MEMOPS_COPY4(dd,ss); LZO_MEMOPS_COPY4((lzo_memops_TU1p)(lzo_memops_TU0p)(dd)+4,(const lzo_memops_TU1p)(const lzo_memops_TU0p)(ss)+4); LZO_BLOCK_END +#else +#if (LZO_OPT_UNALIGNED64) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0)==8) +#define LZO_MEMOPS_COPY8(dd,ss) \ + * (lzo_memops_TU8p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss) +#elif (LZO_OPT_UNALIGNED32) +#define LZO_MEMOPS_COPY8(dd,ss) \ + LZO_BLOCK_BEGIN LZO_MEMOPS_COPY4(dd,ss); LZO_MEMOPS_COPY4((lzo_memops_TU1p)(lzo_memops_TU0p)(dd)+4,(const lzo_memops_TU1p)(const lzo_memops_TU0p)(ss)+4); LZO_BLOCK_END +#elif defined(lzo_memops_tcheck__) +#define LZO_MEMOPS_COPY8(dd,ss) \ + LZO_BLOCK_BEGIN if (lzo_memops_tcheck__(lzo_memops_TU8,8,1)) { \ + * (lzo_memops_TU8p) (lzo_memops_TU0p) (dd) = * (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss); \ + } else { LZO_MEMOPS_MOVE8(dd,ss); } LZO_BLOCK_END +#else +#define LZO_MEMOPS_COPY8(dd,ss) LZO_MEMOPS_MOVE8(dd,ss) +#endif +#endif +#define LZO_MEMOPS_COPYN(dd,ss,nn) \ + LZO_BLOCK_BEGIN \ + lzo_memops_TU1p d__n = (lzo_memops_TU1p) (lzo_memops_TU0p) (dd); \ + const lzo_memops_TU1p s__n = (const lzo_memops_TU1p) (const lzo_memops_TU0p) (ss); \ + lzo_uint n__n = (nn); \ + while ((void)0, n__n >= 8) { LZO_MEMOPS_COPY8(d__n, s__n); d__n += 8; s__n += 8; n__n -= 8; } \ + if ((void)0, n__n >= 4) { LZO_MEMOPS_COPY4(d__n, s__n); d__n += 4; s__n += 4; n__n -= 4; } \ + if ((void)0, n__n > 0) do { *d__n++ = *s__n++; } while (--n__n > 0); \ + LZO_BLOCK_END + +__lzo_static_forceinline lzo_uint16_t lzo_memops_get_le16(const lzo_voidp ss) +{ + lzo_uint16_t v; +#if (LZO_ABI_LITTLE_ENDIAN) + LZO_MEMOPS_COPY2(&v, ss); +#elif (LZO_OPT_UNALIGNED16 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC) + const lzo_memops_TU2p s = (const lzo_memops_TU2p) ss; + unsigned long vv; + __asm__("lhbrx %0,0,%1" : "=r" (vv) : "r" (s), "m" (*s)); + v = (lzo_uint16_t) vv; +#else + const lzo_memops_TU1p s = (const lzo_memops_TU1p) ss; + v = (lzo_uint16_t) (((lzo_uint16_t)s[0]) | ((lzo_uint16_t)s[1] << 8)); +#endif + return v; +} +#if (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) +#define LZO_MEMOPS_GET_LE16(ss) (* (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss)) +#else +#define LZO_MEMOPS_GET_LE16(ss) lzo_memops_get_le16(ss) +#endif + +__lzo_static_forceinline lzo_uint32_t lzo_memops_get_le32(const lzo_voidp ss) +{ + lzo_uint32_t v; +#if (LZO_ABI_LITTLE_ENDIAN) + LZO_MEMOPS_COPY4(&v, ss); +#elif (LZO_OPT_UNALIGNED32 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC) + const lzo_memops_TU4p s = (const lzo_memops_TU4p) ss; + unsigned long vv; + __asm__("lwbrx %0,0,%1" : "=r" (vv) : "r" (s), "m" (*s)); + v = (lzo_uint32_t) vv; +#else + const lzo_memops_TU1p s = (const lzo_memops_TU1p) ss; + v = (lzo_uint32_t) (((lzo_uint32_t)s[0]) | ((lzo_uint32_t)s[1] << 8) | ((lzo_uint32_t)s[2] << 16) | ((lzo_uint32_t)s[3] << 24)); +#endif + return v; +} +#if (LZO_OPT_UNALIGNED32) && (LZO_ABI_LITTLE_ENDIAN) +#define LZO_MEMOPS_GET_LE32(ss) (* (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss)) +#else +#define LZO_MEMOPS_GET_LE32(ss) lzo_memops_get_le32(ss) +#endif + +#if (LZO_OPT_UNALIGNED64) && (LZO_ABI_LITTLE_ENDIAN) +#define LZO_MEMOPS_GET_LE64(ss) (* (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss)) +#endif + +__lzo_static_forceinline lzo_uint16_t lzo_memops_get_ne16(const lzo_voidp ss) +{ + lzo_uint16_t v; + LZO_MEMOPS_COPY2(&v, ss); + return v; +} +#if (LZO_OPT_UNALIGNED16) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU2p)0)==2) +#define LZO_MEMOPS_GET_NE16(ss) (* (const lzo_memops_TU2p) (const lzo_memops_TU0p) (ss)) +#else +#define LZO_MEMOPS_GET_NE16(ss) lzo_memops_get_ne16(ss) +#endif + +__lzo_static_forceinline lzo_uint32_t lzo_memops_get_ne32(const lzo_voidp ss) +{ + lzo_uint32_t v; + LZO_MEMOPS_COPY4(&v, ss); + return v; +} +#if (LZO_OPT_UNALIGNED32) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU4p)0)==4) +#define LZO_MEMOPS_GET_NE32(ss) (* (const lzo_memops_TU4p) (const lzo_memops_TU0p) (ss)) +#else +#define LZO_MEMOPS_GET_NE32(ss) lzo_memops_get_ne32(ss) +#endif + +#if (LZO_OPT_UNALIGNED64) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(*(lzo_memops_TU8p)0)==8) +#define LZO_MEMOPS_GET_NE64(ss) (* (const lzo_memops_TU8p) (const lzo_memops_TU0p) (ss)) +#endif + +__lzo_static_forceinline void lzo_memops_put_le16(lzo_voidp dd, lzo_uint16_t vv) +{ +#if (LZO_ABI_LITTLE_ENDIAN) + LZO_MEMOPS_COPY2(dd, &vv); +#elif (LZO_OPT_UNALIGNED16 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC) + lzo_memops_TU2p d = (lzo_memops_TU2p) dd; + unsigned long v = vv; + __asm__("sthbrx %2,0,%1" : "=m" (*d) : "r" (d), "r" (v)); +#else + lzo_memops_TU1p d = (lzo_memops_TU1p) dd; + d[0] = LZO_BYTE((vv ) & 0xff); + d[1] = LZO_BYTE((vv >> 8) & 0xff); +#endif +} +#if (LZO_OPT_UNALIGNED16) && (LZO_ABI_LITTLE_ENDIAN) +#define LZO_MEMOPS_PUT_LE16(dd,vv) (* (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = (vv)) +#else +#define LZO_MEMOPS_PUT_LE16(dd,vv) lzo_memops_put_le16(dd,vv) +#endif + +__lzo_static_forceinline void lzo_memops_put_le32(lzo_voidp dd, lzo_uint32_t vv) +{ +#if (LZO_ABI_LITTLE_ENDIAN) + LZO_MEMOPS_COPY4(dd, &vv); +#elif (LZO_OPT_UNALIGNED32 && LZO_ARCH_POWERPC && LZO_ABI_BIG_ENDIAN) && (LZO_ASM_SYNTAX_GNUC) + lzo_memops_TU4p d = (lzo_memops_TU4p) dd; + unsigned long v = vv; + __asm__("stwbrx %2,0,%1" : "=m" (*d) : "r" (d), "r" (v)); +#else + lzo_memops_TU1p d = (lzo_memops_TU1p) dd; + d[0] = LZO_BYTE((vv ) & 0xff); + d[1] = LZO_BYTE((vv >> 8) & 0xff); + d[2] = LZO_BYTE((vv >> 16) & 0xff); + d[3] = LZO_BYTE((vv >> 24) & 0xff); +#endif +} +#if (LZO_OPT_UNALIGNED32) && (LZO_ABI_LITTLE_ENDIAN) +#define LZO_MEMOPS_PUT_LE32(dd,vv) (* (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = (vv)) +#else +#define LZO_MEMOPS_PUT_LE32(dd,vv) lzo_memops_put_le32(dd,vv) +#endif + +__lzo_static_forceinline void lzo_memops_put_ne16(lzo_voidp dd, lzo_uint16_t vv) +{ + LZO_MEMOPS_COPY2(dd, &vv); +} +#if (LZO_OPT_UNALIGNED16) +#define LZO_MEMOPS_PUT_NE16(dd,vv) (* (lzo_memops_TU2p) (lzo_memops_TU0p) (dd) = (vv)) +#else +#define LZO_MEMOPS_PUT_NE16(dd,vv) lzo_memops_put_ne16(dd,vv) +#endif + +__lzo_static_forceinline void lzo_memops_put_ne32(lzo_voidp dd, lzo_uint32_t vv) +{ + LZO_MEMOPS_COPY4(dd, &vv); +} +#if (LZO_OPT_UNALIGNED32) +#define LZO_MEMOPS_PUT_NE32(dd,vv) (* (lzo_memops_TU4p) (lzo_memops_TU0p) (dd) = (vv)) +#else +#define LZO_MEMOPS_PUT_NE32(dd,vv) lzo_memops_put_ne32(dd,vv) +#endif + +lzo_unused_funcs_impl(void, lzo_memops_unused_funcs)(void) +{ + LZO_UNUSED_FUNC(lzo_memops_unused_funcs); + LZO_UNUSED_FUNC(lzo_memops_get_le16); + LZO_UNUSED_FUNC(lzo_memops_get_le32); + LZO_UNUSED_FUNC(lzo_memops_get_ne16); + LZO_UNUSED_FUNC(lzo_memops_get_ne32); + LZO_UNUSED_FUNC(lzo_memops_put_le16); + LZO_UNUSED_FUNC(lzo_memops_put_le32); + LZO_UNUSED_FUNC(lzo_memops_put_ne16); + LZO_UNUSED_FUNC(lzo_memops_put_ne32); +} + +#endif /* already included */ + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo_mchw.ch b/tools/z64compress/src/enc/lzo/lzo_mchw.ch new file mode 100644 index 000000000..94bedc3d9 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo_mchw.ch @@ -0,0 +1,222 @@ +/* lzo_mchw.ch -- matching functions using a window + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +/*********************************************************************** +// +************************************************************************/ + +typedef struct +{ + unsigned init; + + lzo_uint look; /* bytes in lookahead buffer */ + + lzo_uint m_len; + lzo_uint m_off; + + lzo_uint last_m_len; + lzo_uint last_m_off; + + const lzo_bytep bp; + const lzo_bytep ip; + const lzo_bytep in; + const lzo_bytep in_end; + lzo_bytep out; + + lzo_callback_p cb; + + lzo_uint textsize; /* text size counter */ + lzo_uint codesize; /* code size counter */ + lzo_uint printcount; /* counter for reporting progress every 1K bytes */ + + /* some stats */ + lzo_uint lit_bytes; + lzo_uint match_bytes; + lzo_uint rep_bytes; + lzo_uint lazy; + +#if defined(LZO1B) + lzo_uint r1_m_len; + + /* some stats */ + lzo_uint r1_r, m3_r, m2_m, m3_m; +#endif + +#if defined(LZO1C) + lzo_uint r1_m_len; + lzo_bytep m3; + + /* some stats */ + lzo_uint r1_r, m3_r, m2_m, m3_m; +#endif + +#if defined(LZO1F) + lzo_uint r1_lit; + lzo_uint r1_m_len; + + /* some stats */ + lzo_uint r1_r, m2_m, m3_m; +#endif + +#if defined(LZO1X) || defined(LZO1Y) || defined(LZO1Z) + lzo_uint r1_lit; + lzo_uint r1_m_len; + + /* some stats */ + lzo_uint m1a_m, m1b_m, m2_m, m3_m, m4_m; + lzo_uint lit1_r, lit2_r, lit3_r; +#endif + +#if defined(LZO2A) + /* some stats */ + lzo_uint m1, m2, m3, m4; +#endif +} +LZO_COMPRESS_T; + + +#define getbyte(c) ((c).ip < (c).in_end ? *((c).ip)++ : (-1)) + +#include "lzo_swd.ch" + + +/*********************************************************************** +// +************************************************************************/ + +static int +init_match ( LZO_COMPRESS_T *c, lzo_swd_p s, + const lzo_bytep dict, lzo_uint dict_len, + lzo_uint32_t flags ) +{ + int r; + + assert(!c->init); + c->init = 1; + + s->c = c; + + c->last_m_len = c->last_m_off = 0; + + c->textsize = c->codesize = c->printcount = 0; + c->lit_bytes = c->match_bytes = c->rep_bytes = 0; + c->lazy = 0; + + r = swd_init(s,dict,dict_len); + if (r != LZO_E_OK) + { + swd_exit(s); + return r; + } + + s->use_best_off = (flags & 1) ? 1 : 0; + return LZO_E_OK; +} + + +/*********************************************************************** +// +************************************************************************/ + +static int +find_match ( LZO_COMPRESS_T *c, lzo_swd_p s, + lzo_uint this_len, lzo_uint skip ) +{ + assert(c->init); + + if (skip > 0) + { + assert(this_len >= skip); + swd_accept(s, this_len - skip); + c->textsize += this_len - skip + 1; + } + else + { + assert(this_len <= 1); + c->textsize += this_len - skip; + } + + s->m_len = SWD_THRESHOLD; + s->m_off = 0; +#ifdef SWD_BEST_OFF + if (s->use_best_off) + lzo_memset(s->best_pos,0,sizeof(s->best_pos)); +#endif + swd_findbest(s); + c->m_len = s->m_len; + c->m_off = s->m_off; + + swd_getbyte(s); + + if (s->b_char < 0) + { + c->look = 0; + c->m_len = 0; + swd_exit(s); + } + else + { + c->look = s->look + 1; + } + c->bp = c->ip - c->look; + +#if 0 + /* brute force match search */ + if (c->m_len > SWD_THRESHOLD && c->m_len + 1 <= c->look) + { + const lzo_bytep ip = c->bp; + const lzo_bytep m = c->bp - c->m_off; + const lzo_bytep in = c->in; + + if (ip - in > s->swd_n) + in = ip - s->swd_n; + for (;;) + { + while (*in != *ip) + in++; + if (in == ip) + break; + if (in != m) + if (lzo_memcmp(in,ip,c->m_len+1) == 0) + printf("%p %p %p %5d\n",in,ip,m,c->m_len); + in++; + } + } +#endif + + if (c->cb && c->cb->nprogress && c->textsize > c->printcount) + { + (*c->cb->nprogress)(c->cb, c->textsize, c->codesize, 0); + c->printcount += 1024; + } + + return LZO_E_OK; +} + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo_ptr.c b/tools/z64compress/src/enc/lzo/lzo_ptr.c new file mode 100644 index 000000000..d2def7f63 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo_ptr.c @@ -0,0 +1,80 @@ +/* lzo_ptr.c -- low-level pointer constructs + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +#include "lzo_conf.h" + + +/*********************************************************************** +// +************************************************************************/ + +LZO_PUBLIC(lzo_uintptr_t) +__lzo_ptr_linear(const lzo_voidp ptr) +{ + lzo_uintptr_t p; + +#if (LZO_ARCH_I086) +#error "LZO_ARCH_I086 is unsupported" +#elif (LZO_MM_PVP) +#error "LZO_MM_PVP is unsupported" +#else + p = (lzo_uintptr_t) PTR_LINEAR(ptr); +#endif + + return p; +} + + +/*********************************************************************** +// +************************************************************************/ + +LZO_PUBLIC(unsigned) +__lzo_align_gap(const lzo_voidp ptr, lzo_uint size) +{ +#if (__LZO_UINTPTR_T_IS_POINTER) +#error "__LZO_UINTPTR_T_IS_POINTER is unsupported" +#else + lzo_uintptr_t p, n; + if (size < 2) return 0; + p = __lzo_ptr_linear(ptr); +#if 0 + n = (((p + size - 1) / size) * size) - p; +#else + if ((size & (size - 1)) != 0) + return 0; + n = size; n = ((p + n - 1) & ~(n - 1)) - p; +#endif +#endif + assert((long)n >= 0); + assert(n <= size); + return (unsigned)n; +} + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo_ptr.h b/tools/z64compress/src/enc/lzo/lzo_ptr.h new file mode 100644 index 000000000..8d7ee4483 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo_ptr.h @@ -0,0 +1,123 @@ +/* lzo_ptr.h -- low-level pointer constructs + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the library and is subject + to change. + */ + + +#ifndef __LZO_PTR_H +#define __LZO_PTR_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + + +/*********************************************************************** +// +************************************************************************/ + +/* Always use the safe (=integral) version for pointer-comparisons. + * The compiler should optimize away the additional casts anyway. + * + * Note that this only works if the representation and ordering + * of the pointer and the integral is the same (at bit level). + */ + +#if (LZO_ARCH_I086) +#error "LZO_ARCH_I086 is unsupported" +#elif (LZO_MM_PVP) +#error "LZO_MM_PVP is unsupported" +#else +#define PTR(a) ((lzo_uintptr_t) (a)) +#define PTR_LINEAR(a) PTR(a) +#define PTR_ALIGNED_4(a) ((PTR_LINEAR(a) & 3) == 0) +#define PTR_ALIGNED_8(a) ((PTR_LINEAR(a) & 7) == 0) +#define PTR_ALIGNED2_4(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 3) == 0) +#define PTR_ALIGNED2_8(a,b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 7) == 0) +#endif + +#define PTR_LT(a,b) (PTR(a) < PTR(b)) +#define PTR_GE(a,b) (PTR(a) >= PTR(b)) +#define PTR_DIFF(a,b) (PTR(a) - PTR(b)) +#define pd(a,b) ((lzo_uint) ((a)-(b))) + + +LZO_EXTERN(lzo_uintptr_t) +__lzo_ptr_linear(const lzo_voidp ptr); + + +typedef union +{ + char a_char; + unsigned char a_uchar; + short a_short; + unsigned short a_ushort; + int a_int; + unsigned int a_uint; + long a_long; + unsigned long a_ulong; + lzo_int a_lzo_int; + lzo_uint a_lzo_uint; + lzo_xint a_lzo_xint; + lzo_int16_t a_lzo_int16_t; + lzo_uint16_t a_lzo_uint16_t; + lzo_int32_t a_lzo_int32_t; + lzo_uint32_t a_lzo_uint32_t; +#if defined(lzo_uint64_t) + lzo_int64_t a_lzo_int64_t; + lzo_uint64_t a_lzo_uint64_t; +#endif + size_t a_size_t; + ptrdiff_t a_ptrdiff_t; + lzo_uintptr_t a_lzo_uintptr_t; + void * a_void_p; + char * a_char_p; + unsigned char * a_uchar_p; + const void * a_c_void_p; + const char * a_c_char_p; + const unsigned char * a_c_uchar_p; + lzo_voidp a_lzo_voidp; + lzo_bytep a_lzo_bytep; + const lzo_voidp a_c_lzo_voidp; + const lzo_bytep a_c_lzo_bytep; +} +lzo_full_align_t; + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* already included */ + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo_supp.h b/tools/z64compress/src/enc/lzo/lzo_supp.h new file mode 100644 index 000000000..a2c90210d --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo_supp.h @@ -0,0 +1,3678 @@ +/* lzo_supp.h -- architecture, OS and compiler specific defines + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +#ifndef __LZO_SUPP_H_INCLUDED +#define __LZO_SUPP_H_INCLUDED 1 +#if (LZO_CFG_NO_CONFIG_HEADER) +#elif defined(LZO_CFG_CONFIG_HEADER) +#else +#if !(LZO_CFG_AUTO_NO_HEADERS) +#if (LZO_LIBC_NAKED) +#elif (LZO_LIBC_FREESTANDING) +# define HAVE_LIMITS_H 1 +# define HAVE_STDARG_H 1 +# define HAVE_STDDEF_H 1 +#elif (LZO_LIBC_MOSTLY_FREESTANDING) +# define HAVE_LIMITS_H 1 +# define HAVE_SETJMP_H 1 +# define HAVE_STDARG_H 1 +# define HAVE_STDDEF_H 1 +# define HAVE_STDIO_H 1 +# define HAVE_STRING_H 1 +#else +#define STDC_HEADERS 1 +#define HAVE_ASSERT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_DIRENT_H 1 +#define HAVE_ERRNO_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_SETJMP_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_TIME_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UTIME_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#if (LZO_OS_POSIX) +# if (LZO_OS_POSIX_AIX) +# define HAVE_SYS_RESOURCE_H 1 +# elif (LZO_OS_POSIX_DARWIN || LZO_OS_POSIX_FREEBSD || LZO_OS_POSIX_NETBSD || LZO_OS_POSIX_OPENBSD) +# define HAVE_STRINGS_H 1 +# undef HAVE_MALLOC_H +# elif (LZO_OS_POSIX_HPUX || LZO_OS_POSIX_INTERIX) +# define HAVE_ALLOCA_H 1 +# elif (LZO_OS_POSIX_DARWIN && LZO_LIBC_MSL) +# undef HAVE_SYS_TIME_H +# undef HAVE_SYS_TYPES_H +# elif (LZO_OS_POSIX_SOLARIS || LZO_OS_POSIX_SUNOS) +# define HAVE_ALLOCA_H 1 +# endif +# if (LZO_LIBC_DIETLIBC || LZO_LIBC_GLIBC || LZO_LIBC_UCLIBC) +# define HAVE_STRINGS_H 1 +# define HAVE_SYS_MMAN_H 1 +# define HAVE_SYS_RESOURCE_H 1 +# define HAVE_SYS_WAIT_H 1 +# endif +# if (LZO_LIBC_NEWLIB) +# undef HAVE_STRINGS_H +# endif +#elif (LZO_OS_CYGWIN) +# define HAVE_IO_H 1 +#elif (LZO_OS_EMX) +# define HAVE_ALLOCA_H 1 +# define HAVE_IO_H 1 +#elif (LZO_ARCH_M68K && LZO_OS_TOS && LZO_CC_GNUC) +# if !defined(__MINT__) +# undef HAVE_MALLOC_H +# endif +#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) +# undef HAVE_DIRENT_H +# undef HAVE_FCNTL_H +# undef HAVE_MALLOC_H +# undef HAVE_MEMORY_H +# undef HAVE_UNISTD_H +# undef HAVE_UTIME_H +# undef HAVE_SYS_STAT_H +# undef HAVE_SYS_TIME_H +# undef HAVE_SYS_TYPES_H +#endif +#if (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) +#define HAVE_CONIO_H 1 +#define HAVE_DIRECT_H 1 +#define HAVE_DOS_H 1 +#define HAVE_IO_H 1 +#define HAVE_SHARE_H 1 +#if (LZO_CC_AZTECC) +# undef HAVE_CONIO_H +# undef HAVE_DIRECT_H +# undef HAVE_DIRENT_H +# undef HAVE_MALLOC_H +# undef HAVE_SHARE_H +# undef HAVE_UNISTD_H +# undef HAVE_UTIME_H +# undef HAVE_SYS_STAT_H +# undef HAVE_SYS_TIME_H +# undef HAVE_SYS_TYPES_H +#elif (LZO_CC_BORLANDC) +# undef HAVE_UNISTD_H +# undef HAVE_SYS_TIME_H +# if (LZO_OS_WIN32 || LZO_OS_WIN64) +# undef HAVE_DIRENT_H +# endif +# if (__BORLANDC__ < 0x0400) +# undef HAVE_DIRENT_H +# undef HAVE_UTIME_H +# endif +#elif (LZO_CC_DMC) +# undef HAVE_DIRENT_H +# undef HAVE_UNISTD_H +# define HAVE_SYS_DIRENT_H 1 +#elif (LZO_OS_DOS32 && LZO_CC_GNUC) && defined(__DJGPP__) +#elif (LZO_OS_DOS32 && LZO_CC_HIGHC) +# define HAVE_ALLOCA_H 1 +# undef HAVE_DIRENT_H +# undef HAVE_UNISTD_H +#elif (LZO_CC_IBMC && LZO_OS_OS2) +# undef HAVE_DOS_H +# undef HAVE_DIRENT_H +# undef HAVE_UNISTD_H +# undef HAVE_UTIME_H +# undef HAVE_SYS_TIME_H +# define HAVE_SYS_UTIME_H 1 +#elif (LZO_CC_CLANG_C2 || LZO_CC_CLANG_MSC || LZO_CC_GHS || LZO_CC_INTELC_MSC || LZO_CC_MSC) +# undef HAVE_DIRENT_H +# undef HAVE_UNISTD_H +# undef HAVE_UTIME_H +# undef HAVE_SYS_TIME_H +# define HAVE_SYS_UTIME_H 1 +#elif (LZO_CC_LCCWIN32) +# undef HAVE_DIRENT_H +# undef HAVE_DOS_H +# undef HAVE_UNISTD_H +# undef HAVE_SYS_TIME_H +#elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__MINGW32__) +# undef HAVE_UTIME_H +# define HAVE_SYS_UTIME_H 1 +#elif (LZO_OS_WIN32 && LZO_LIBC_MSL) +# define HAVE_ALLOCA_H 1 +# undef HAVE_DOS_H +# undef HAVE_SHARE_H +# undef HAVE_SYS_TIME_H +#elif (LZO_CC_NDPC) +# undef HAVE_DIRENT_H +# undef HAVE_DOS_H +# undef HAVE_UNISTD_H +# undef HAVE_UTIME_H +# undef HAVE_SYS_TIME_H +#elif (LZO_CC_PACIFICC) +# undef HAVE_DIRECT_H +# undef HAVE_DIRENT_H +# undef HAVE_FCNTL_H +# undef HAVE_IO_H +# undef HAVE_MALLOC_H +# undef HAVE_MEMORY_H +# undef HAVE_SHARE_H +# undef HAVE_UNISTD_H +# undef HAVE_UTIME_H +# undef HAVE_SYS_STAT_H +# undef HAVE_SYS_TIME_H +# undef HAVE_SYS_TYPES_H +#elif (LZO_OS_WIN32 && LZO_CC_PELLESC) +# undef HAVE_DIRENT_H +# undef HAVE_DOS_H +# undef HAVE_MALLOC_H +# undef HAVE_SHARE_H +# undef HAVE_UNISTD_H +# undef HAVE_UTIME_H +# undef HAVE_SYS_TIME_H +# if (__POCC__ < 280) +# else +# define HAVE_SYS_UTIME_H 1 +# endif +#elif (LZO_OS_WIN32 && LZO_CC_PGI) && defined(__MINGW32__) +# undef HAVE_UTIME_H +# define HAVE_SYS_UTIME_H 1 +#elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) +#elif (LZO_CC_SYMANTECC) +# undef HAVE_DIRENT_H +# undef HAVE_UNISTD_H +# if (__SC__ < 0x700) +# undef HAVE_UTIME_H +# undef HAVE_SYS_TIME_H +# endif +#elif (LZO_CC_TOPSPEEDC) +# undef HAVE_DIRENT_H +# undef HAVE_UNISTD_H +# undef HAVE_UTIME_H +# undef HAVE_SYS_STAT_H +# undef HAVE_SYS_TIME_H +# undef HAVE_SYS_TYPES_H +#elif (LZO_CC_TURBOC) +# undef HAVE_UNISTD_H +# undef HAVE_SYS_TIME_H +# undef HAVE_SYS_TYPES_H +# if (LZO_OS_WIN32 || LZO_OS_WIN64) +# undef HAVE_DIRENT_H +# endif +# if (__TURBOC__ < 0x0200) +# undef HAVE_SIGNAL_H +# endif +# if (__TURBOC__ < 0x0400) +# undef HAVE_DIRECT_H +# undef HAVE_DIRENT_H +# undef HAVE_MALLOC_H +# undef HAVE_MEMORY_H +# undef HAVE_UTIME_H +# endif +#elif (LZO_CC_WATCOMC) +# undef HAVE_DIRENT_H +# undef HAVE_UTIME_H +# undef HAVE_SYS_TIME_H +# define HAVE_SYS_UTIME_H 1 +# if (__WATCOMC__ < 950) +# undef HAVE_UNISTD_H +# endif +#elif (LZO_CC_ZORTECHC) +# undef HAVE_DIRENT_H +# undef HAVE_MEMORY_H +# undef HAVE_UNISTD_H +# undef HAVE_UTIME_H +# undef HAVE_SYS_TIME_H +#endif +#endif +#if (LZO_OS_CONSOLE) +# undef HAVE_DIRENT_H +#endif +#if (LZO_OS_EMBEDDED) +# undef HAVE_DIRENT_H +#endif +#if (LZO_LIBC_ISOC90 || LZO_LIBC_ISOC99) +# undef HAVE_DIRENT_H +# undef HAVE_FCNTL_H +# undef HAVE_MALLOC_H +# undef HAVE_UNISTD_H +# undef HAVE_UTIME_H +# undef HAVE_SYS_STAT_H +# undef HAVE_SYS_TIME_H +# undef HAVE_SYS_TYPES_H +#endif +#if (LZO_LIBC_GLIBC >= 0x020100ul) +# define HAVE_STDINT_H 1 +#elif (LZO_LIBC_DIETLIBC) +# undef HAVE_STDINT_H +#elif (LZO_LIBC_UCLIBC) +# define HAVE_STDINT_H 1 +#elif (LZO_CC_BORLANDC) && (__BORLANDC__ >= 0x560) +# undef HAVE_STDINT_H +#elif (LZO_CC_DMC) && (__DMC__ >= 0x825) +# define HAVE_STDINT_H 1 +#endif +#if (HAVE_SYS_TIME_H && HAVE_TIME_H) +# define TIME_WITH_SYS_TIME 1 +#endif +#endif +#endif +#if !(LZO_CFG_AUTO_NO_FUNCTIONS) +#if (LZO_LIBC_NAKED) +#elif (LZO_LIBC_FREESTANDING) +#elif (LZO_LIBC_MOSTLY_FREESTANDING) +# define HAVE_LONGJMP 1 +# define HAVE_MEMCMP 1 +# define HAVE_MEMCPY 1 +# define HAVE_MEMMOVE 1 +# define HAVE_MEMSET 1 +# define HAVE_SETJMP 1 +#else +#define HAVE_ACCESS 1 +#define HAVE_ALLOCA 1 +#define HAVE_ATEXIT 1 +#define HAVE_ATOI 1 +#define HAVE_ATOL 1 +#define HAVE_CHMOD 1 +#define HAVE_CHOWN 1 +#define HAVE_CTIME 1 +#define HAVE_DIFFTIME 1 +#define HAVE_FILENO 1 +#define HAVE_FSTAT 1 +#define HAVE_GETENV 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_GMTIME 1 +#define HAVE_ISATTY 1 +#define HAVE_LOCALTIME 1 +#define HAVE_LONGJMP 1 +#define HAVE_LSTAT 1 +#define HAVE_MEMCMP 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMSET 1 +#define HAVE_MKDIR 1 +#define HAVE_MKTIME 1 +#define HAVE_QSORT 1 +#define HAVE_RAISE 1 +#define HAVE_RMDIR 1 +#define HAVE_SETJMP 1 +#define HAVE_SIGNAL 1 +#define HAVE_SNPRINTF 1 +#define HAVE_STAT 1 +#define HAVE_STRCHR 1 +#define HAVE_STRDUP 1 +#define HAVE_STRERROR 1 +#define HAVE_STRFTIME 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_TIME 1 +#define HAVE_UMASK 1 +#define HAVE_UTIME 1 +#define HAVE_VSNPRINTF 1 +#if (LZO_OS_BEOS || LZO_OS_CYGWIN || LZO_OS_POSIX || LZO_OS_QNX || LZO_OS_VMS) +# define HAVE_STRCASECMP 1 +# define HAVE_STRNCASECMP 1 +#elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) +# define HAVE_STRCASECMP 1 +# define HAVE_STRNCASECMP 1 +#else +# define HAVE_STRICMP 1 +# define HAVE_STRNICMP 1 +#endif +#if (LZO_OS_POSIX) +# if (LZO_OS_POSIX_AIX) +# define HAVE_GETRUSAGE 1 +# elif (LZO_OS_POSIX_DARWIN && LZO_LIBC_MSL) +# undef HAVE_CHOWN +# undef HAVE_LSTAT +# elif (LZO_OS_POSIX_UNICOS) +# undef HAVE_ALLOCA +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +# endif +# if (LZO_CC_TINYC) +# undef HAVE_ALLOCA +# endif +# if (LZO_LIBC_DIETLIBC || LZO_LIBC_GLIBC || LZO_LIBC_UCLIBC) +# define HAVE_GETRUSAGE 1 +# define HAVE_GETPAGESIZE 1 +# define HAVE_MMAP 1 +# define HAVE_MPROTECT 1 +# define HAVE_MUNMAP 1 +# endif +#elif (LZO_OS_CYGWIN) +# if (LZO_CC_GNUC < 0x025a00ul) +# undef HAVE_GETTIMEOFDAY +# undef HAVE_LSTAT +# endif +# if (LZO_CC_GNUC < 0x025f00ul) +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +# endif +#elif (LZO_OS_EMX) +# undef HAVE_CHOWN +# undef HAVE_LSTAT +#elif (LZO_ARCH_M68K && LZO_OS_TOS && LZO_CC_GNUC) +# if !defined(__MINT__) +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +# endif +#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) +# undef HAVE_ALLOCA +# undef HAVE_ACCESS +# undef HAVE_CHMOD +# undef HAVE_CHOWN +# undef HAVE_FSTAT +# undef HAVE_GETTIMEOFDAY +# undef HAVE_LSTAT +# undef HAVE_SNPRINTF +# undef HAVE_UMASK +# undef HAVE_UTIME +# undef HAVE_VSNPRINTF +#endif +#if (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) +#undef HAVE_CHOWN +#undef HAVE_GETTIMEOFDAY +#undef HAVE_LSTAT +#undef HAVE_UMASK +#if (LZO_CC_AZTECC) +# undef HAVE_ALLOCA +# undef HAVE_DIFFTIME +# undef HAVE_FSTAT +# undef HAVE_STRDUP +# undef HAVE_SNPRINTF +# undef HAVE_UTIME +# undef HAVE_VSNPRINTF +#elif (LZO_CC_BORLANDC) +# if (__BORLANDC__ < 0x0400) +# undef HAVE_ALLOCA +# undef HAVE_UTIME +# endif +# if ((__BORLANDC__ < 0x0410) && LZO_OS_WIN16) +# undef HAVE_ALLOCA +# endif +# if (__BORLANDC__ < 0x0550) +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +# endif +#elif (LZO_CC_DMC) +# if (LZO_OS_WIN16) +# undef HAVE_ALLOCA +# endif +# define snprintf _snprintf +# define vsnprintf _vsnprintf +#elif (LZO_OS_DOS32 && LZO_CC_GNUC) && defined(__DJGPP__) +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +#elif (LZO_OS_DOS32 && LZO_CC_HIGHC) +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +#elif (LZO_CC_GHS) +# undef HAVE_ALLOCA +# ifndef snprintf +# define snprintf _snprintf +# endif +# ifndef vsnprintf +# define vsnprintf _vsnprintf +# endif +#elif (LZO_CC_IBMC) +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +#elif (LZO_CC_CLANG_MSC || LZO_CC_INTELC_MSC) +# ifndef snprintf +# define snprintf _snprintf +# endif +# ifndef vsnprintf +# define vsnprintf _vsnprintf +# endif +#elif (LZO_CC_LCCWIN32) +# define utime _utime +#elif (LZO_CC_CLANG_C2 || LZO_CC_MSC) +# if (_MSC_VER < 600) +# undef HAVE_STRFTIME +# endif +# if (_MSC_VER < 700) +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +# elif (_MSC_VER < 1500) +# ifndef snprintf +# define snprintf _snprintf +# endif +# ifndef vsnprintf +# define vsnprintf _vsnprintf +# endif +# elif (_MSC_VER < 1900) +# ifndef snprintf +# define snprintf _snprintf +# endif +# endif +# if ((_MSC_VER < 800) && LZO_OS_WIN16) +# undef HAVE_ALLOCA +# endif +# if (LZO_ARCH_I086) && defined(__cplusplus) +# undef HAVE_LONGJMP +# undef HAVE_SETJMP +# endif +#elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__MINGW32__) +# if (LZO_CC_GNUC < 0x025f00ul) +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +# else +# define snprintf _snprintf +# define vsnprintf _vsnprintf +# endif +#elif (LZO_OS_WIN32 && LZO_LIBC_MSL) +# if (__MSL__ < 0x8000ul) +# undef HAVE_CHMOD +# endif +#elif (LZO_CC_NDPC) +# undef HAVE_ALLOCA +# undef HAVE_SNPRINTF +# undef HAVE_STRNICMP +# undef HAVE_UTIME +# undef HAVE_VSNPRINTF +# if defined(__cplusplus) +# undef HAVE_STAT +# endif +#elif (LZO_CC_PACIFICC) +# undef HAVE_ACCESS +# undef HAVE_ALLOCA +# undef HAVE_CHMOD +# undef HAVE_DIFFTIME +# undef HAVE_FSTAT +# undef HAVE_MKTIME +# undef HAVE_RAISE +# undef HAVE_SNPRINTF +# undef HAVE_STRFTIME +# undef HAVE_UTIME +# undef HAVE_VSNPRINTF +#elif (LZO_OS_WIN32 && LZO_CC_PELLESC) +# if (__POCC__ < 280) +# define alloca _alloca +# undef HAVE_UTIME +# endif +#elif (LZO_OS_WIN32 && LZO_CC_PGI) && defined(__MINGW32__) +# define snprintf _snprintf +# define vsnprintf _vsnprintf +#elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +#elif (LZO_CC_SYMANTECC) +# if (LZO_OS_WIN16 && (LZO_MM_MEDIUM || LZO_MM_LARGE || LZO_MM_HUGE)) +# undef HAVE_ALLOCA +# endif +# if (__SC__ < 0x600) +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +# else +# define snprintf _snprintf +# define vsnprintf _vsnprintf +# endif +# if (__SC__ < 0x700) +# undef HAVE_DIFFTIME +# undef HAVE_UTIME +# endif +#elif (LZO_CC_TOPSPEEDC) +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +#elif (LZO_CC_TURBOC) +# undef HAVE_ALLOCA +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +# if (__TURBOC__ < 0x0200) +# undef HAVE_RAISE +# undef HAVE_SIGNAL +# endif +# if (__TURBOC__ < 0x0295) +# undef HAVE_MKTIME +# undef HAVE_STRFTIME +# endif +# if (__TURBOC__ < 0x0400) +# undef HAVE_UTIME +# endif +#elif (LZO_CC_WATCOMC) +# if (__WATCOMC__ < 1100) +# undef HAVE_SNPRINTF +# undef HAVE_VSNPRINTF +# elif (__WATCOMC__ < 1200) +# define snprintf _snprintf +# define vsnprintf _vsnprintf +# endif +#elif (LZO_CC_ZORTECHC) +# if (LZO_OS_WIN16 && (LZO_MM_MEDIUM || LZO_MM_LARGE || LZO_MM_HUGE)) +# undef HAVE_ALLOCA +# endif +# undef HAVE_DIFFTIME +# undef HAVE_SNPRINTF +# undef HAVE_UTIME +# undef HAVE_VSNPRINTF +#endif +#endif +#if (LZO_OS_CONSOLE) +# undef HAVE_ACCESS +# undef HAVE_CHMOD +# undef HAVE_CHOWN +# undef HAVE_GETTIMEOFDAY +# undef HAVE_LSTAT +# undef HAVE_TIME +# undef HAVE_UMASK +# undef HAVE_UTIME +#endif +#if (LZO_LIBC_ISOC90 || LZO_LIBC_ISOC99) +# undef HAVE_ACCESS +# undef HAVE_CHMOD +# undef HAVE_CHOWN +# undef HAVE_FILENO +# undef HAVE_FSTAT +# undef HAVE_GETTIMEOFDAY +# undef HAVE_LSTAT +# undef HAVE_STAT +# undef HAVE_UMASK +# undef HAVE_UTIME +# if 1 +# undef HAVE_ALLOCA +# undef HAVE_ISATTY +# undef HAVE_MKDIR +# undef HAVE_RMDIR +# undef HAVE_STRDUP +# undef HAVE_STRICMP +# undef HAVE_STRNICMP +# endif +#endif +#endif +#endif +#if !(LZO_CFG_AUTO_NO_SIZES) +#if !defined(SIZEOF_SHORT) && defined(LZO_SIZEOF_SHORT) +# define SIZEOF_SHORT LZO_SIZEOF_SHORT +#endif +#if !defined(SIZEOF_INT) && defined(LZO_SIZEOF_INT) +# define SIZEOF_INT LZO_SIZEOF_INT +#endif +#if !defined(SIZEOF_LONG) && defined(LZO_SIZEOF_LONG) +# define SIZEOF_LONG LZO_SIZEOF_LONG +#endif +#if !defined(SIZEOF_LONG_LONG) && defined(LZO_SIZEOF_LONG_LONG) +# define SIZEOF_LONG_LONG LZO_SIZEOF_LONG_LONG +#endif +#if !defined(SIZEOF___INT32) && defined(LZO_SIZEOF___INT32) +# define SIZEOF___INT32 LZO_SIZEOF___INT32 +#endif +#if !defined(SIZEOF___INT64) && defined(LZO_SIZEOF___INT64) +# define SIZEOF___INT64 LZO_SIZEOF___INT64 +#endif +#if !defined(SIZEOF_VOID_P) && defined(LZO_SIZEOF_VOID_P) +# define SIZEOF_VOID_P LZO_SIZEOF_VOID_P +#endif +#if !defined(SIZEOF_SIZE_T) && defined(LZO_SIZEOF_SIZE_T) +# define SIZEOF_SIZE_T LZO_SIZEOF_SIZE_T +#endif +#if !defined(SIZEOF_PTRDIFF_T) && defined(LZO_SIZEOF_PTRDIFF_T) +# define SIZEOF_PTRDIFF_T LZO_SIZEOF_PTRDIFF_T +#endif +#endif +#if (HAVE_SIGNAL) && !defined(RETSIGTYPE) +# define RETSIGTYPE void +#endif +#endif +#if !(LZO_CFG_SKIP_LZO_TYPES) +#if 1 && !defined(lzo_signo_t) && defined(__linux__) && defined(__dietlibc__) && (LZO_SIZEOF_INT != 4) +# define lzo_signo_t lzo_int32e_t +#endif +#if !defined(lzo_signo_t) +# define lzo_signo_t int +#endif +#if defined(__cplusplus) +extern "C" { +#endif +#if (LZO_BROKEN_CDECL_ALT_SYNTAX) +typedef void __lzo_cdecl_sighandler (*lzo_sighandler_t)(lzo_signo_t); +#else +typedef void (__lzo_cdecl_sighandler *lzo_sighandler_t)(lzo_signo_t); +#endif +#if defined(__cplusplus) +} +#endif +#endif +#endif +#if defined(LZO_WANT_ACC_INCD_H) +# undef LZO_WANT_ACC_INCD_H +#ifndef __LZO_INCD_H_INCLUDED +#define __LZO_INCD_H_INCLUDED 1 +#if (LZO_LIBC_NAKED) +#ifndef __LZO_FALLBACK_STDDEF_H_INCLUDED +#define __LZO_FALLBACK_STDDEF_H_INCLUDED 1 +#if defined(__PTRDIFF_TYPE__) +typedef __PTRDIFF_TYPE__ lzo_fallback_ptrdiff_t; +#elif defined(__MIPS_PSX2__) +typedef int lzo_fallback_ptrdiff_t; +#else +typedef long lzo_fallback_ptrdiff_t; +#endif +#if defined(__SIZE_TYPE__) +typedef __SIZE_TYPE__ lzo_fallback_size_t; +#elif defined(__MIPS_PSX2__) +typedef unsigned int lzo_fallback_size_t; +#else +typedef unsigned long lzo_fallback_size_t; +#endif +#if !defined(ptrdiff_t) +typedef lzo_fallback_ptrdiff_t ptrdiff_t; +#ifndef _PTRDIFF_T_DEFINED +#define _PTRDIFF_T_DEFINED 1 +#endif +#endif +#if !defined(size_t) +typedef lzo_fallback_size_t size_t; +#ifndef _SIZE_T_DEFINED +#define _SIZE_T_DEFINED 1 +#endif +#endif +#if !defined(__cplusplus) && !defined(wchar_t) +typedef unsigned short wchar_t; +#ifndef _WCHAR_T_DEFINED +#define _WCHAR_T_DEFINED 1 +#endif +#endif +#ifndef NULL +#if defined(__cplusplus) && defined(__GNUC__) && (__GNUC__ >= 4) +#define NULL __null +#elif defined(__cplusplus) +#define NULL 0 +#else +#define NULL ((void*)0) +#endif +#endif +#ifndef offsetof +#define offsetof(s,m) ((size_t)((ptrdiff_t)&(((s*)0)->m))) +#endif +#endif +#elif (LZO_LIBC_FREESTANDING) +# if defined(HAVE_STDDEF_H) && (HAVE_STDDEF_H+0) +# include +# endif +# if defined(HAVE_STDINT_H) && (HAVE_STDINT_H+0) +# include +# endif +#elif (LZO_LIBC_MOSTLY_FREESTANDING) +# if defined(HAVE_STDIO_H) && (HAVE_STDIO_H+0) +# include +# endif +# if defined(HAVE_STDDEF_H) && (HAVE_STDDEF_H+0) +# include +# endif +# if defined(HAVE_STDINT_H) && (HAVE_STDINT_H+0) +# include +# endif +#else +#include +#if defined(HAVE_TIME_H) && (HAVE_TIME_H+0) && defined(__MSL__) && defined(__cplusplus) +# include +#endif +#if defined(HAVE_SYS_TYPES_H) && (HAVE_SYS_TYPES_H+0) +# include +#endif +#if defined(HAVE_SYS_STAT_H) && (HAVE_SYS_STAT_H+0) +# include +#endif +#if defined(STDC_HEADERS) && (STDC_HEADERS+0) +# include +#elif defined(HAVE_STDLIB_H) && (HAVE_STDLIB_H+0) +# include +#endif +#include +#if defined(HAVE_STRING_H) && (HAVE_STRING_H+0) +# if defined(STDC_HEADERS) && (STDC_HEADERS+0) +# elif defined(HAVE_MEMORY_H) && (HAVE_MEMORY_H+0) +# include +# endif +# include +#endif +#if defined(HAVE_STRINGS_H) && (HAVE_STRINGS_H+0) +# include +#endif +#if defined(HAVE_INTTYPES_H) && (HAVE_INTTYPES_H+0) +# include +#endif +#if defined(HAVE_STDINT_H) && (HAVE_STDINT_H+0) +# include +#endif +#if defined(HAVE_UNISTD_H) && (HAVE_UNISTD_H+0) +# include +#endif +#endif +#endif +#endif +#if defined(LZO_WANT_ACC_INCE_H) +# undef LZO_WANT_ACC_INCE_H +#ifndef __LZO_INCE_H_INCLUDED +#define __LZO_INCE_H_INCLUDED 1 +#if (LZO_LIBC_NAKED) +#elif (LZO_LIBC_FREESTANDING) +#elif (LZO_LIBC_MOSTLY_FREESTANDING) +# if (HAVE_SETJMP_H) +# include +# endif +#else +#if (HAVE_STDARG_H) +# include +#endif +#if (HAVE_CTYPE_H) +# include +#endif +#if (HAVE_ERRNO_H) +# include +#endif +#if (HAVE_MALLOC_H) +# include +#endif +#if (HAVE_ALLOCA_H) +# include +#endif +#if (HAVE_FCNTL_H) +# include +#endif +#if (HAVE_DIRENT_H) +# include +#endif +#if (HAVE_SETJMP_H) +# include +#endif +#if (HAVE_SIGNAL_H) +# include +#endif +#if (HAVE_SYS_TIME_H && HAVE_TIME_H) +# include +# include +#elif (HAVE_TIME_H) +# include +#endif +#if (HAVE_UTIME_H) +# include +#elif (HAVE_SYS_UTIME_H) +# include +#endif +#if (HAVE_IO_H) +# include +#endif +#if (HAVE_DOS_H) +# include +#endif +#if (HAVE_DIRECT_H) +# include +#endif +#if (HAVE_SHARE_H) +# include +#endif +#if (LZO_CC_NDPC) +# include +#endif +#if defined(__TOS__) && (defined(__PUREC__) || defined(__TURBOC__)) +# include +#endif +#endif +#endif +#endif +#if defined(LZO_WANT_ACC_INCI_H) +# undef LZO_WANT_ACC_INCI_H +#ifndef __LZO_INCI_H_INCLUDED +#define __LZO_INCI_H_INCLUDED 1 +#if (LZO_LIBC_NAKED) +#elif (LZO_LIBC_FREESTANDING) +#elif (LZO_LIBC_MOSTLY_FREESTANDING) +#else +#if (LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) +# include +#elif (LZO_HAVE_WINDOWS_H) +# if 1 && !defined(WIN32_LEAN_AND_MEAN) +# define WIN32_LEAN_AND_MEAN 1 +# endif +# if 1 && !defined(_WIN32_WINNT) +# define _WIN32_WINNT 0x0400 +# endif +# include +# if (LZO_CC_BORLANDC || LZO_CC_TURBOC) +# include +# endif +#elif (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_WIN16) +# if (LZO_CC_AZTECC) +# include +# include +# elif (LZO_CC_BORLANDC || LZO_CC_TURBOC) +# include +# include +# elif (LZO_OS_DOS32 && LZO_CC_GNUC) && defined(__DJGPP__) +# include +# elif (LZO_CC_PACIFICC) +# include +# include +# include +# elif (LZO_CC_WATCOMC) +# include +# endif +#elif (LZO_OS_OS216) +# if (LZO_CC_WATCOMC) +# include +# endif +#endif +#if (HAVE_SYS_MMAN_H) +# include +#endif +#if (HAVE_SYS_RESOURCE_H) +# include +#endif +#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) +# if defined(FP_OFF) +# define LZO_PTR_FP_OFF(x) FP_OFF(x) +# elif defined(_FP_OFF) +# define LZO_PTR_FP_OFF(x) _FP_OFF(x) +# else +# define LZO_PTR_FP_OFF(x) (((const unsigned __far*)&(x))[0]) +# endif +# if defined(FP_SEG) +# define LZO_PTR_FP_SEG(x) FP_SEG(x) +# elif defined(_FP_SEG) +# define LZO_PTR_FP_SEG(x) _FP_SEG(x) +# else +# define LZO_PTR_FP_SEG(x) (((const unsigned __far*)&(x))[1]) +# endif +# if defined(MK_FP) +# define LZO_PTR_MK_FP(s,o) MK_FP(s,o) +# elif defined(_MK_FP) +# define LZO_PTR_MK_FP(s,o) _MK_FP(s,o) +# else +# define LZO_PTR_MK_FP(s,o) ((void __far*)(((unsigned long)(s)<<16)+(unsigned)(o))) +# endif +# if 0 +# undef LZO_PTR_FP_OFF +# undef LZO_PTR_FP_SEG +# undef LZO_PTR_MK_FP +# define LZO_PTR_FP_OFF(x) (((const unsigned __far*)&(x))[0]) +# define LZO_PTR_FP_SEG(x) (((const unsigned __far*)&(x))[1]) +# define LZO_PTR_MK_FP(s,o) ((void __far*)(((unsigned long)(s)<<16)+(unsigned)(o))) +# endif +#endif +#endif +#endif +#endif +#if defined(LZO_WANT_ACC_LIB_H) +# undef LZO_WANT_ACC_LIB_H +#ifndef __LZO_LIB_H_INCLUDED +#define __LZO_LIB_H_INCLUDED 1 +#if !defined(__LZOLIB_FUNCNAME) +# define __LZOLIB_FUNCNAME(f) f +#endif +#if !defined(LZOLIB_EXTERN) +# define LZOLIB_EXTERN(r,f) extern r __LZOLIB_FUNCNAME(f) +#endif +#if !defined(LZOLIB_EXTERN_NOINLINE) +# if defined(__lzo_noinline) +# define LZOLIB_EXTERN_NOINLINE(r,f) extern __lzo_noinline r __LZOLIB_FUNCNAME(f) +# else +# define LZOLIB_EXTERN_NOINLINE(r,f) extern r __LZOLIB_FUNCNAME(f) +# endif +#endif +#if (LZO_SIZEOF_LONG > LZO_SIZEOF_VOID_P) +# define lzolib_handle_t long +#else +# define lzolib_handle_t lzo_intptr_t +#endif +#if 0 +LZOLIB_EXTERN(int, lzo_ascii_digit) (int); +LZOLIB_EXTERN(int, lzo_ascii_islower) (int); +LZOLIB_EXTERN(int, lzo_ascii_isupper) (int); +LZOLIB_EXTERN(int, lzo_ascii_tolower) (int); +LZOLIB_EXTERN(int, lzo_ascii_toupper) (int); +LZOLIB_EXTERN(int, lzo_ascii_utolower) (int); +LZOLIB_EXTERN(int, lzo_ascii_utoupper) (int); +#endif +#define lzo_ascii_isdigit(c) ((LZO_ICAST(unsigned, c) - 48) < 10) +#define lzo_ascii_islower(c) ((LZO_ICAST(unsigned, c) - 97) < 26) +#define lzo_ascii_isupper(c) ((LZO_ICAST(unsigned, c) - 65) < 26) +#define lzo_ascii_tolower(c) (LZO_ICAST(int, c) + (lzo_ascii_isupper(c) << 5)) +#define lzo_ascii_toupper(c) (LZO_ICAST(int, c) - (lzo_ascii_islower(c) << 5)) +#define lzo_ascii_utolower(c) lzo_ascii_tolower(LZO_ITRUNC(unsigned char, c)) +#define lzo_ascii_utoupper(c) lzo_ascii_toupper(LZO_ITRUNC(unsigned char, c)) +#ifndef lzo_hsize_t +#if (LZO_HAVE_MM_HUGE_PTR) +# define lzo_hsize_t unsigned long +# define lzo_hvoid_p void __huge * +# define lzo_hchar_p char __huge * +# define lzo_hchar_pp char __huge * __huge * +# define lzo_hbyte_p unsigned char __huge * +#else +# define lzo_hsize_t size_t +# define lzo_hvoid_p void * +# define lzo_hchar_p char * +# define lzo_hchar_pp char ** +# define lzo_hbyte_p unsigned char * +#endif +#endif +LZOLIB_EXTERN(lzo_hvoid_p, lzo_halloc) (lzo_hsize_t); +LZOLIB_EXTERN(void, lzo_hfree) (lzo_hvoid_p); +#if (LZO_OS_DOS16 || LZO_OS_OS216) +LZOLIB_EXTERN(void __far*, lzo_dos_alloc) (unsigned long); +LZOLIB_EXTERN(int, lzo_dos_free) (void __far*); +#endif +LZOLIB_EXTERN(int, lzo_hmemcmp) (const lzo_hvoid_p, const lzo_hvoid_p, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p, const lzo_hvoid_p, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p, const lzo_hvoid_p, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p, int, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hsize_t, lzo_hstrlen) (const lzo_hchar_p); +LZOLIB_EXTERN(int, lzo_hstrcmp) (const lzo_hchar_p, const lzo_hchar_p); +LZOLIB_EXTERN(int, lzo_hstrncmp)(const lzo_hchar_p, const lzo_hchar_p, lzo_hsize_t); +LZOLIB_EXTERN(int, lzo_ascii_hstricmp) (const lzo_hchar_p, const lzo_hchar_p); +LZOLIB_EXTERN(int, lzo_ascii_hstrnicmp)(const lzo_hchar_p, const lzo_hchar_p, lzo_hsize_t); +LZOLIB_EXTERN(int, lzo_ascii_hmemicmp) (const lzo_hvoid_p, const lzo_hvoid_p, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hchar_p, lzo_hstrstr) (const lzo_hchar_p, const lzo_hchar_p); +LZOLIB_EXTERN(lzo_hchar_p, lzo_ascii_hstristr) (const lzo_hchar_p, const lzo_hchar_p); +LZOLIB_EXTERN(lzo_hvoid_p, lzo_hmemmem) (const lzo_hvoid_p, lzo_hsize_t, const lzo_hvoid_p, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hvoid_p, lzo_ascii_hmemimem) (const lzo_hvoid_p, lzo_hsize_t, const lzo_hvoid_p, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hchar_p, lzo_hstrcpy) (lzo_hchar_p, const lzo_hchar_p); +LZOLIB_EXTERN(lzo_hchar_p, lzo_hstrcat) (lzo_hchar_p, const lzo_hchar_p); +LZOLIB_EXTERN(lzo_hsize_t, lzo_hstrlcpy) (lzo_hchar_p, const lzo_hchar_p, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hsize_t, lzo_hstrlcat) (lzo_hchar_p, const lzo_hchar_p, lzo_hsize_t); +LZOLIB_EXTERN(int, lzo_hstrscpy) (lzo_hchar_p, const lzo_hchar_p, lzo_hsize_t); +LZOLIB_EXTERN(int, lzo_hstrscat) (lzo_hchar_p, const lzo_hchar_p, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hchar_p, lzo_hstrccpy) (lzo_hchar_p, const lzo_hchar_p, int); +LZOLIB_EXTERN(lzo_hvoid_p, lzo_hmemccpy) (lzo_hvoid_p, const lzo_hvoid_p, int, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hchar_p, lzo_hstrchr) (const lzo_hchar_p, int); +LZOLIB_EXTERN(lzo_hchar_p, lzo_hstrrchr) (const lzo_hchar_p, int); +LZOLIB_EXTERN(lzo_hchar_p, lzo_ascii_hstrichr) (const lzo_hchar_p, int); +LZOLIB_EXTERN(lzo_hchar_p, lzo_ascii_hstrrichr) (const lzo_hchar_p, int); +LZOLIB_EXTERN(lzo_hvoid_p, lzo_hmemchr) (const lzo_hvoid_p, int, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hvoid_p, lzo_hmemrchr) (const lzo_hvoid_p, int, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hvoid_p, lzo_ascii_hmemichr) (const lzo_hvoid_p, int, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hvoid_p, lzo_ascii_hmemrichr) (const lzo_hvoid_p, int, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hsize_t, lzo_hstrspn) (const lzo_hchar_p, const lzo_hchar_p); +LZOLIB_EXTERN(lzo_hsize_t, lzo_hstrrspn) (const lzo_hchar_p, const lzo_hchar_p); +LZOLIB_EXTERN(lzo_hsize_t, lzo_hstrcspn) (const lzo_hchar_p, const lzo_hchar_p); +LZOLIB_EXTERN(lzo_hsize_t, lzo_hstrrcspn) (const lzo_hchar_p, const lzo_hchar_p); +LZOLIB_EXTERN(lzo_hchar_p, lzo_hstrpbrk) (const lzo_hchar_p, const lzo_hchar_p); +LZOLIB_EXTERN(lzo_hchar_p, lzo_hstrrpbrk) (const lzo_hchar_p, const lzo_hchar_p); +LZOLIB_EXTERN(lzo_hchar_p, lzo_hstrsep) (lzo_hchar_pp, const lzo_hchar_p); +LZOLIB_EXTERN(lzo_hchar_p, lzo_hstrrsep) (lzo_hchar_pp, const lzo_hchar_p); +LZOLIB_EXTERN(lzo_hchar_p, lzo_ascii_hstrlwr) (lzo_hchar_p); +LZOLIB_EXTERN(lzo_hchar_p, lzo_ascii_hstrupr) (lzo_hchar_p); +LZOLIB_EXTERN(lzo_hvoid_p, lzo_ascii_hmemlwr) (lzo_hvoid_p, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hvoid_p, lzo_ascii_hmemupr) (lzo_hvoid_p, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hsize_t, lzo_hfread) (void *, lzo_hvoid_p, lzo_hsize_t); +LZOLIB_EXTERN(lzo_hsize_t, lzo_hfwrite) (void *, const lzo_hvoid_p, lzo_hsize_t); +#if (LZO_HAVE_MM_HUGE_PTR) +LZOLIB_EXTERN(long, lzo_hread) (int, lzo_hvoid_p, long); +LZOLIB_EXTERN(long, lzo_hwrite) (int, const lzo_hvoid_p, long); +#endif +LZOLIB_EXTERN(long, lzo_safe_hread) (int, lzo_hvoid_p, long); +LZOLIB_EXTERN(long, lzo_safe_hwrite) (int, const lzo_hvoid_p, long); +LZOLIB_EXTERN(unsigned, lzo_ua_get_be16) (const lzo_hvoid_p); +LZOLIB_EXTERN(lzo_uint32l_t, lzo_ua_get_be24) (const lzo_hvoid_p); +LZOLIB_EXTERN(lzo_uint32l_t, lzo_ua_get_be32) (const lzo_hvoid_p); +LZOLIB_EXTERN(void, lzo_ua_set_be16) (lzo_hvoid_p, unsigned); +LZOLIB_EXTERN(void, lzo_ua_set_be24) (lzo_hvoid_p, lzo_uint32l_t); +LZOLIB_EXTERN(void, lzo_ua_set_be32) (lzo_hvoid_p, lzo_uint32l_t); +LZOLIB_EXTERN(unsigned, lzo_ua_get_le16) (const lzo_hvoid_p); +LZOLIB_EXTERN(lzo_uint32l_t, lzo_ua_get_le24) (const lzo_hvoid_p); +LZOLIB_EXTERN(lzo_uint32l_t, lzo_ua_get_le32) (const lzo_hvoid_p); +LZOLIB_EXTERN(void, lzo_ua_set_le16) (lzo_hvoid_p, unsigned); +LZOLIB_EXTERN(void, lzo_ua_set_le24) (lzo_hvoid_p, lzo_uint32l_t); +LZOLIB_EXTERN(void, lzo_ua_set_le32) (lzo_hvoid_p, lzo_uint32l_t); +#if defined(lzo_int64l_t) +LZOLIB_EXTERN(lzo_uint64l_t, lzo_ua_get_be64) (const lzo_hvoid_p); +LZOLIB_EXTERN(void, lzo_ua_set_be64) (lzo_hvoid_p, lzo_uint64l_t); +LZOLIB_EXTERN(lzo_uint64l_t, lzo_ua_get_le64) (const lzo_hvoid_p); +LZOLIB_EXTERN(void, lzo_ua_set_le64) (lzo_hvoid_p, lzo_uint64l_t); +#endif +LZOLIB_EXTERN_NOINLINE(short, lzo_vget_short) (short, int); +LZOLIB_EXTERN_NOINLINE(int, lzo_vget_int) (int, int); +LZOLIB_EXTERN_NOINLINE(long, lzo_vget_long) (long, int); +#if defined(lzo_int64l_t) +LZOLIB_EXTERN_NOINLINE(lzo_int64l_t, lzo_vget_lzo_int64l_t) (lzo_int64l_t, int); +#endif +LZOLIB_EXTERN_NOINLINE(lzo_hsize_t, lzo_vget_lzo_hsize_t) (lzo_hsize_t, int); +#if !(LZO_CFG_NO_FLOAT) +LZOLIB_EXTERN_NOINLINE(float, lzo_vget_float) (float, int); +#endif +#if !(LZO_CFG_NO_DOUBLE) +LZOLIB_EXTERN_NOINLINE(double, lzo_vget_double) (double, int); +#endif +LZOLIB_EXTERN_NOINLINE(lzo_hvoid_p, lzo_vget_lzo_hvoid_p) (lzo_hvoid_p, int); +LZOLIB_EXTERN_NOINLINE(const lzo_hvoid_p, lzo_vget_lzo_hvoid_cp) (const lzo_hvoid_p, int); +#if !defined(LZO_FN_PATH_MAX) +#if (LZO_OS_DOS16 || LZO_OS_WIN16) +# define LZO_FN_PATH_MAX 143 +#elif (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN32 || LZO_OS_WIN64) +# define LZO_FN_PATH_MAX 259 +#elif (LZO_OS_TOS) +# define LZO_FN_PATH_MAX 259 +#endif +#endif +#if !defined(LZO_FN_PATH_MAX) +# define LZO_FN_PATH_MAX 1023 +#endif +#if !defined(LZO_FN_NAME_MAX) +#if (LZO_OS_DOS16 || LZO_OS_WIN16) +# define LZO_FN_NAME_MAX 12 +#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) +# define LZO_FN_NAME_MAX 12 +#elif (LZO_OS_DOS32 && LZO_CC_GNUC) && defined(__DJGPP__) +#elif (LZO_OS_DOS32) +# define LZO_FN_NAME_MAX 12 +#endif +#endif +#if !defined(LZO_FN_NAME_MAX) +# define LZO_FN_NAME_MAX LZO_FN_PATH_MAX +#endif +#define LZO_FNMATCH_NOESCAPE 1 +#define LZO_FNMATCH_PATHNAME 2 +#define LZO_FNMATCH_PATHSTAR 4 +#define LZO_FNMATCH_PERIOD 8 +#define LZO_FNMATCH_ASCII_CASEFOLD 16 +LZOLIB_EXTERN(int, lzo_fnmatch) (const lzo_hchar_p, const lzo_hchar_p, int); +#undef __LZOLIB_USE_OPENDIR +#if (HAVE_DIRENT_H || LZO_CC_WATCOMC) +# define __LZOLIB_USE_OPENDIR 1 +# if (LZO_OS_DOS32 && defined(__BORLANDC__)) +# elif (LZO_OS_DOS32 && LZO_CC_GNUC) && defined(__DJGPP__) +# elif (LZO_OS_OS2 || LZO_OS_OS216) +# elif (LZO_ARCH_M68K && LZO_OS_TOS && LZO_CC_GNUC) +# elif (LZO_OS_WIN32 && !(LZO_HAVE_WINDOWS_H)) +# elif (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_TOS || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) +# undef __LZOLIB_USE_OPENDIR +# endif +#endif +typedef struct +{ +#if defined(__LZOLIB_USE_OPENDIR) + void* u_dirp; +# if (LZO_CC_WATCOMC) + unsigned short f_time; + unsigned short f_date; + unsigned long f_size; +# endif + char f_name[LZO_FN_NAME_MAX+1]; +#elif (LZO_OS_WIN32 || LZO_OS_WIN64) + lzolib_handle_t u_handle; + unsigned f_attr; + unsigned f_size_low; + unsigned f_size_high; + char f_name[LZO_FN_NAME_MAX+1]; +#elif (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_TOS || LZO_OS_WIN16) + char u_dta[21]; + unsigned char f_attr; + unsigned short f_time; + unsigned short f_date; + unsigned short f_size_low; + unsigned short f_size_high; + char f_name[LZO_FN_NAME_MAX+1]; + char u_dirp; +#else + void* u_dirp; + char f_name[LZO_FN_NAME_MAX+1]; +#endif +} lzo_dir_t; +#ifndef lzo_dir_p +#define lzo_dir_p lzo_dir_t * +#endif +LZOLIB_EXTERN(int, lzo_opendir) (lzo_dir_p, const char*); +LZOLIB_EXTERN(int, lzo_readdir) (lzo_dir_p); +LZOLIB_EXTERN(int, lzo_closedir) (lzo_dir_p); +#if (LZO_CC_GNUC) && (defined(__CYGWIN__) || defined(__MINGW32__)) +# define lzo_alloca(x) __builtin_alloca((x)) +#elif (LZO_CC_GNUC) && (LZO_OS_CONSOLE_PS2) +# define lzo_alloca(x) __builtin_alloca((x)) +#elif (LZO_CC_BORLANDC || LZO_CC_LCC) && defined(__linux__) +#elif (HAVE_ALLOCA) +# define lzo_alloca(x) LZO_STATIC_CAST(void *, alloca((x))) +#endif +#if (LZO_OS_DOS32 && LZO_CC_GNUC) && defined(__DJGPP__) +# define lzo_stackavail() stackavail() +#elif (LZO_ARCH_I086 && LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0410)) +# define lzo_stackavail() stackavail() +#elif (LZO_ARCH_I086 && LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0400)) +# if (LZO_OS_WIN16) && (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) +# else +# define lzo_stackavail() stackavail() +# endif +#elif ((LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_CC_DMC || LZO_CC_SYMANTECC)) +# define lzo_stackavail() stackavail() +#elif ((LZO_ARCH_I086) && LZO_CC_MSC && (_MSC_VER >= 700)) +# define lzo_stackavail() _stackavail() +#elif ((LZO_ARCH_I086) && LZO_CC_MSC) +# define lzo_stackavail() stackavail() +#elif ((LZO_ARCH_I086 || LZO_ARCH_I386) && LZO_CC_TURBOC && (__TURBOC__ >= 0x0450)) +# define lzo_stackavail() stackavail() +#elif (LZO_ARCH_I086 && LZO_CC_TURBOC && (__TURBOC__ >= 0x0400)) + LZO_EXTERN_C size_t __cdecl stackavail(void); +# define lzo_stackavail() stackavail() +#elif ((LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_CC_WATCOMC)) +# define lzo_stackavail() stackavail() +#elif (LZO_ARCH_I086 && LZO_CC_ZORTECHC) +# define lzo_stackavail() _chkstack() +#endif +LZOLIB_EXTERN(lzo_intptr_t, lzo_get_osfhandle) (int); +LZOLIB_EXTERN(const char *, lzo_getenv) (const char *); +LZOLIB_EXTERN(int, lzo_isatty) (int); +LZOLIB_EXTERN(int, lzo_mkdir) (const char*, unsigned); +LZOLIB_EXTERN(int, lzo_rmdir) (const char*); +LZOLIB_EXTERN(int, lzo_response) (int*, char***); +LZOLIB_EXTERN(int, lzo_set_binmode) (int, int); +#if defined(lzo_int32e_t) +LZOLIB_EXTERN(lzo_int32e_t, lzo_muldiv32s) (lzo_int32e_t, lzo_int32e_t, lzo_int32e_t); +LZOLIB_EXTERN(lzo_uint32e_t, lzo_muldiv32u) (lzo_uint32e_t, lzo_uint32e_t, lzo_uint32e_t); +#endif +LZOLIB_EXTERN(void, lzo_wildargv) (int*, char***); +LZOLIB_EXTERN_NOINLINE(void, lzo_debug_break) (void); +LZOLIB_EXTERN_NOINLINE(void, lzo_debug_nop) (void); +LZOLIB_EXTERN_NOINLINE(int, lzo_debug_align_check_query) (void); +LZOLIB_EXTERN_NOINLINE(int, lzo_debug_align_check_enable) (int); +LZOLIB_EXTERN_NOINLINE(unsigned, lzo_debug_running_on_qemu) (void); +LZOLIB_EXTERN_NOINLINE(unsigned, lzo_debug_running_on_valgrind) (void); +#if defined(lzo_int32e_t) +LZOLIB_EXTERN(int, lzo_tsc_read) (lzo_uint32e_t*); +#endif +struct lzo_pclock_handle_t; +struct lzo_pclock_t; +typedef struct lzo_pclock_handle_t lzo_pclock_handle_t; +typedef struct lzo_pclock_t lzo_pclock_t; +#ifndef lzo_pclock_handle_p +#define lzo_pclock_handle_p lzo_pclock_handle_t * +#endif +#ifndef lzo_pclock_p +#define lzo_pclock_p lzo_pclock_t * +#endif +#define LZO_PCLOCK_REALTIME 0 +#define LZO_PCLOCK_MONOTONIC 1 +#define LZO_PCLOCK_PROCESS_CPUTIME_ID 2 +#define LZO_PCLOCK_THREAD_CPUTIME_ID 3 +typedef int (*lzo_pclock_gettime_t) (lzo_pclock_handle_p, lzo_pclock_p); +struct lzo_pclock_handle_t { + lzolib_handle_t h; + int mode; + int read_error; + const char* name; + lzo_pclock_gettime_t gettime; +#if defined(lzo_int64l_t) + lzo_uint64l_t ticks_base; +#endif +}; +struct lzo_pclock_t { +#if defined(lzo_int64l_t) + lzo_int64l_t tv_sec; +#else + lzo_int32l_t tv_sec_high; + lzo_uint32l_t tv_sec_low; +#endif + lzo_uint32l_t tv_nsec; +}; +LZOLIB_EXTERN(int, lzo_pclock_open) (lzo_pclock_handle_p, int); +LZOLIB_EXTERN(int, lzo_pclock_open_default) (lzo_pclock_handle_p); +LZOLIB_EXTERN(int, lzo_pclock_close) (lzo_pclock_handle_p); +LZOLIB_EXTERN(void, lzo_pclock_read) (lzo_pclock_handle_p, lzo_pclock_p); +#if !(LZO_CFG_NO_DOUBLE) +LZOLIB_EXTERN(double, lzo_pclock_get_elapsed) (lzo_pclock_handle_p, const lzo_pclock_p, const lzo_pclock_p); +#endif +LZOLIB_EXTERN(int, lzo_pclock_flush_cpu_cache) (lzo_pclock_handle_p, unsigned); +struct lzo_getopt_t; +typedef struct lzo_getopt_t lzo_getopt_t; +#ifndef lzo_getopt_p +#define lzo_getopt_p lzo_getopt_t * +#endif +struct lzo_getopt_longopt_t; +typedef struct lzo_getopt_longopt_t lzo_getopt_longopt_t; +#ifndef lzo_getopt_longopt_p +#define lzo_getopt_longopt_p lzo_getopt_longopt_t * +#endif +struct lzo_getopt_longopt_t { + const char* name; + int has_arg; + int* flag; + int val; +}; +typedef void (*lzo_getopt_opterr_t)(lzo_getopt_p, const char*, void *); +struct lzo_getopt_t { + void *user; + const char *progname; + int bad_option; + char *optarg; + lzo_getopt_opterr_t opterr; + int optind; + int optopt; + int errcount; + int argc; char** argv; + int eof; int shortpos; + int pending_rotate_first, pending_rotate_middle; +}; +enum { LZO_GETOPT_NO_ARG, LZO_GETOPT_REQUIRED_ARG, LZO_GETOPT_OPTIONAL_ARG, LZO_GETOPT_EXACT_ARG = 0x10 }; +enum { LZO_GETOPT_PERMUTE, LZO_GETOPT_RETURN_IN_ORDER, LZO_GETOPT_REQUIRE_ORDER }; +LZOLIB_EXTERN(void, lzo_getopt_init) (lzo_getopt_p g, + int start_argc, int argc, char** argv); +LZOLIB_EXTERN(int, lzo_getopt) (lzo_getopt_p g, + const char* shortopts, + const lzo_getopt_longopt_p longopts, + int* longind); +typedef struct { + lzo_uint32l_t seed; +} lzo_rand31_t; +#ifndef lzo_rand31_p +#define lzo_rand31_p lzo_rand31_t * +#endif +LZOLIB_EXTERN(void, lzo_srand31) (lzo_rand31_p, lzo_uint32l_t); +LZOLIB_EXTERN(lzo_uint32l_t, lzo_rand31) (lzo_rand31_p); +#if defined(lzo_int64l_t) +typedef struct { + lzo_uint64l_t seed; +} lzo_rand48_t; +#ifndef lzo_rand48_p +#define lzo_rand48_p lzo_rand48_t * +#endif +LZOLIB_EXTERN(void, lzo_srand48) (lzo_rand48_p, lzo_uint32l_t); +LZOLIB_EXTERN(lzo_uint32l_t, lzo_rand48) (lzo_rand48_p); +LZOLIB_EXTERN(lzo_uint32l_t, lzo_rand48_r32) (lzo_rand48_p); +#endif +#if defined(lzo_int64l_t) +typedef struct { + lzo_uint64l_t seed; +} lzo_rand64_t; +#ifndef lzo_rand64_p +#define lzo_rand64_p lzo_rand64_t * +#endif +LZOLIB_EXTERN(void, lzo_srand64) (lzo_rand64_p, lzo_uint64l_t); +LZOLIB_EXTERN(lzo_uint32l_t, lzo_rand64) (lzo_rand64_p); +LZOLIB_EXTERN(lzo_uint32l_t, lzo_rand64_r32) (lzo_rand64_p); +#endif +typedef struct { + unsigned n; + lzo_uint32l_t s[624]; +} lzo_randmt_t; +#ifndef lzo_randmt_p +#define lzo_randmt_p lzo_randmt_t * +#endif +LZOLIB_EXTERN(void, lzo_srandmt) (lzo_randmt_p, lzo_uint32l_t); +LZOLIB_EXTERN(lzo_uint32l_t, lzo_randmt) (lzo_randmt_p); +LZOLIB_EXTERN(lzo_uint32l_t, lzo_randmt_r32) (lzo_randmt_p); +#if defined(lzo_int64l_t) +typedef struct { + unsigned n; + lzo_uint64l_t s[312]; +} lzo_randmt64_t; +#ifndef lzo_randmt64_p +#define lzo_randmt64_p lzo_randmt64_t * +#endif +LZOLIB_EXTERN(void, lzo_srandmt64) (lzo_randmt64_p, lzo_uint64l_t); +LZOLIB_EXTERN(lzo_uint64l_t, lzo_randmt64_r64) (lzo_randmt64_p); +#endif +#define LZO_SPAWN_P_WAIT 0 +#define LZO_SPAWN_P_NOWAIT 1 +LZOLIB_EXTERN(int, lzo_spawnv) (int mode, const char* fn, const char* const * argv); +LZOLIB_EXTERN(int, lzo_spawnvp) (int mode, const char* fn, const char* const * argv); +LZOLIB_EXTERN(int, lzo_spawnve) (int mode, const char* fn, const char* const * argv, const char * const envp); +#endif +#endif +#if defined(LZO_WANT_ACC_CXX_H) +# undef LZO_WANT_ACC_CXX_H +#ifndef __LZO_CXX_H_INCLUDED +#define __LZO_CXX_H_INCLUDED 1 +#if defined(__cplusplus) +#if defined(LZO_CXX_NOTHROW) +#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) +#elif (LZO_CC_BORLANDC && (__BORLANDC__ < 0x0450)) +#elif (LZO_CC_GHS && !defined(__EXCEPTIONS)) +#elif (LZO_CC_HIGHC) +#elif (LZO_CC_MSC && (_MSC_VER < 1100)) +#elif (LZO_CC_NDPC) +#elif (LZO_CC_TURBOC) +#elif (LZO_CC_WATCOMC && !defined(_CPPUNWIND)) +#elif (LZO_CC_ZORTECHC) +#else +# define LZO_CXX_NOTHROW throw() +#endif +#if !defined(LZO_CXX_NOTHROW) +# define LZO_CXX_NOTHROW /*empty*/ +#endif +#if defined(__LZO_CXX_DO_NEW) +#elif (LZO_CC_GHS || LZO_CC_NDPC || LZO_CC_PGI) +# define __LZO_CXX_DO_NEW { return 0; } +#elif ((LZO_CC_BORLANDC || LZO_CC_TURBOC) && LZO_ARCH_I086) +# define __LZO_CXX_DO_NEW { return 0; } +#else +# define __LZO_CXX_DO_NEW ; +#endif +#if defined(__LZO_CXX_DO_DELETE) +#elif (LZO_CC_BORLANDC || LZO_CC_TURBOC) +# define __LZO_CXX_DO_DELETE { } +#else +# define __LZO_CXX_DO_DELETE LZO_CXX_NOTHROW { } +#endif +#if (LZO_CC_BORLANDC && (__BORLANDC__ < 0x0450)) +#elif (LZO_CC_MSC && LZO_MM_HUGE) +# define LZO_CXX_DISABLE_NEW_DELETE private: +#elif (LZO_CC_MSC && (_MSC_VER < 1100)) +#elif (LZO_CC_NDPC) +#elif (LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) +#elif (LZO_CC_TURBOC) +#elif (LZO_CC_WATCOMC && (__WATCOMC__ < 1100)) +#else +# define __LZO_CXX_HAVE_ARRAY_NEW 1 +#endif +#if (__LZO_CXX_HAVE_ARRAY_NEW) +# define __LZO_CXX_HAVE_PLACEMENT_NEW 1 +#endif +#if (__LZO_CXX_HAVE_PLACEMENT_NEW) +# if (LZO_CC_GNUC >= 0x030000ul) +# define __LZO_CXX_HAVE_PLACEMENT_DELETE 1 +# elif (LZO_CC_INTELC) +# define __LZO_CXX_HAVE_PLACEMENT_DELETE 1 +# elif (LZO_CC_MSC && (_MSC_VER >= 1200)) +# define __LZO_CXX_HAVE_PLACEMENT_DELETE 1 +# elif (LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define __LZO_CXX_HAVE_PLACEMENT_DELETE 1 +# elif (LZO_CC_PGI) +# define __LZO_CXX_HAVE_PLACEMENT_DELETE 1 +# endif +#endif +#if defined(LZO_CXX_DISABLE_NEW_DELETE) +#elif defined(new) || defined(delete) +# define LZO_CXX_DISABLE_NEW_DELETE private: +#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025b00ul)) +# define LZO_CXX_DISABLE_NEW_DELETE private: +#elif (LZO_CC_HIGHC) +# define LZO_CXX_DISABLE_NEW_DELETE private: +#elif !(__LZO_CXX_HAVE_ARRAY_NEW) +# define LZO_CXX_DISABLE_NEW_DELETE \ + protected: static void operator delete(void*) __LZO_CXX_DO_DELETE \ + protected: static void* operator new(size_t) __LZO_CXX_DO_NEW \ + private: +#else +# define LZO_CXX_DISABLE_NEW_DELETE \ + protected: static void operator delete(void*) __LZO_CXX_DO_DELETE \ + static void operator delete[](void*) __LZO_CXX_DO_DELETE \ + private: static void* operator new(size_t) __LZO_CXX_DO_NEW \ + static void* operator new[](size_t) __LZO_CXX_DO_NEW +#endif +#if defined(LZO_CXX_TRIGGER_FUNCTION) +#else +# define LZO_CXX_TRIGGER_FUNCTION \ + protected: virtual const void* lzo_cxx_trigger_function() const; \ + private: +#endif +#if defined(LZO_CXX_TRIGGER_FUNCTION_IMPL) +#else +# define LZO_CXX_TRIGGER_FUNCTION_IMPL(klass) \ + const void* klass::lzo_cxx_trigger_function() const { return LZO_STATIC_CAST(const void *, 0); } +#endif +#endif +#endif +#endif +#if defined(LZO_WANT_ACC_CHK_CH) +# undef LZO_WANT_ACC_CHK_CH +#if !defined(LZOCHK_ASSERT) +# define LZOCHK_ASSERT(expr) LZO_COMPILE_TIME_ASSERT_HEADER(expr) +#endif +#if !defined(LZOCHK_ASSERT_SIGN_T) +# define LZOCHK_ASSERT_SIGN_T(type,relop) \ + LZOCHK_ASSERT( LZO_STATIC_CAST(type, -1) relop LZO_STATIC_CAST(type, 0)) \ + LZOCHK_ASSERT( LZO_STATIC_CAST(type, ~LZO_STATIC_CAST(type, 0)) relop LZO_STATIC_CAST(type, 0)) \ + LZOCHK_ASSERT( LZO_STATIC_CAST(type, ~LZO_STATIC_CAST(type, 0)) == LZO_STATIC_CAST(type, -1)) +#endif +#if !defined(LZOCHK_ASSERT_IS_SIGNED_T) +# define LZOCHK_ASSERT_IS_SIGNED_T(type) LZOCHK_ASSERT_SIGN_T(type,<) +#endif +#if !defined(LZOCHK_ASSERT_IS_UNSIGNED_T) +# if (LZO_BROKEN_INTEGRAL_PROMOTION) +# define LZOCHK_ASSERT_IS_UNSIGNED_T(type) \ + LZOCHK_ASSERT( LZO_STATIC_CAST(type, -1) > LZO_STATIC_CAST(type, 0) ) +# else +# define LZOCHK_ASSERT_IS_UNSIGNED_T(type) LZOCHK_ASSERT_SIGN_T(type,>) +# endif +#endif +#if defined(LZOCHK_CFG_PEDANTIC) +#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550) && (__BORLANDC__ < 0x0560)) +# pragma option push -w-8055 +#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0530) && (__BORLANDC__ < 0x0550)) +# pragma option push -w-osh +#endif +#endif +#if (LZO_0xffffffffL - LZO_UINT32_C(4294967294) != 1) +# error "preprocessor error" +#endif +#if (LZO_0xffffffffL - LZO_UINT32_C(0xfffffffd) != 2) +# error "preprocessor error" +#endif +#if +0 +# error "preprocessor error" +#endif +#if -0 +# error "preprocessor error" +#endif +#if +0 != 0 +# error "preprocessor error" +#endif +#if -0 != 0 +# error "preprocessor error" +#endif +#define LZOCHK_VAL 1 +#define LZOCHK_TMP1 LZOCHK_VAL +#undef LZOCHK_VAL +#define LZOCHK_VAL 2 +#define LZOCHK_TMP2 LZOCHK_VAL +#if (LZOCHK_TMP1 != 2) +# error "preprocessor error 3a" +#endif +#if (LZOCHK_TMP2 != 2) +# error "preprocessor error 3b" +#endif +#undef LZOCHK_VAL +#if (LZOCHK_TMP2) +# error "preprocessor error 3c" +#endif +#if (LZOCHK_TMP2 + 0 != 0) +# error "preprocessor error 3d" +#endif +#undef LZOCHK_TMP1 +#undef LZOCHK_TMP2 +#if 0 || defined(LZOCHK_CFG_PEDANTIC) +# if (LZO_ARCH_MIPS) && defined(_MIPS_SZINT) + LZOCHK_ASSERT((_MIPS_SZINT) == 8 * sizeof(int)) +# endif +# if (LZO_ARCH_MIPS) && defined(_MIPS_SZLONG) + LZOCHK_ASSERT((_MIPS_SZLONG) == 8 * sizeof(long)) +# endif +# if (LZO_ARCH_MIPS) && defined(_MIPS_SZPTR) + LZOCHK_ASSERT((_MIPS_SZPTR) == 8 * sizeof(void *)) +# endif +#endif + LZOCHK_ASSERT(1 == 1) + LZOCHK_ASSERT(__LZO_MASK_GEN(1u,1) == 1u) + LZOCHK_ASSERT(__LZO_MASK_GEN(1u,2) == 3u) + LZOCHK_ASSERT(__LZO_MASK_GEN(1u,3) == 7u) + LZOCHK_ASSERT(__LZO_MASK_GEN(1u,8) == 255u) +#if (LZO_SIZEOF_INT >= 2) + LZOCHK_ASSERT(__LZO_MASK_GEN(1,15) == 32767) + LZOCHK_ASSERT(__LZO_MASK_GEN(1u,16) == 0xffffU) + LZOCHK_ASSERT(__LZO_MASK_GEN(0u,16) == 0u) +#endif + LZOCHK_ASSERT(__LZO_MASK_GEN(1ul,16) == 0xffffUL) + LZOCHK_ASSERT(__LZO_MASK_GEN(0ul,16) == 0ul) +#if (LZO_SIZEOF_INT >= 4) + LZOCHK_ASSERT(__LZO_MASK_GEN(1,31) == 2147483647) + LZOCHK_ASSERT(__LZO_MASK_GEN(1u,32) == 0xffffffffU) + LZOCHK_ASSERT(__LZO_MASK_GEN(0u,32) == 0u) +#endif +#if (LZO_SIZEOF_LONG >= 4) + LZOCHK_ASSERT(__LZO_MASK_GEN(1ul,32) == 0xffffffffUL) + LZOCHK_ASSERT(__LZO_MASK_GEN(0ul,32) == 0ul) +#endif +#if (LZO_SIZEOF_LONG >= 8) + LZOCHK_ASSERT(__LZO_MASK_GEN(1ul,64) == 0xffffffffffffffffUL) + LZOCHK_ASSERT(__LZO_MASK_GEN(0ul,64) == 0ul) +#endif +#if !(LZO_BROKEN_INTEGRAL_PROMOTION) + LZOCHK_ASSERT(__LZO_MASK_GEN(1u,LZO_SIZEOF_INT*8) == ~0u) + LZOCHK_ASSERT(__LZO_MASK_GEN(1ul,LZO_SIZEOF_LONG*8) == ~0ul) +#endif +#if 1 + LZOCHK_ASSERT(__LZO_MASK_GEN(0,0) == 0) + LZOCHK_ASSERT(__LZO_MASK_GEN(1,0) == 0) + LZOCHK_ASSERT(__LZO_MASK_GEN(2,0) == 0) + LZOCHK_ASSERT(__LZO_MASK_GEN(4,0) == 0) +#endif +#if 1 + LZOCHK_ASSERT(__LZO_MASK_GEN(2,1) == 2) + LZOCHK_ASSERT(__LZO_MASK_GEN(4,1) == 4) + LZOCHK_ASSERT(__LZO_MASK_GEN(8,1) == 8) + LZOCHK_ASSERT(__LZO_MASK_GEN(2,2) == 2+4) + LZOCHK_ASSERT(__LZO_MASK_GEN(4,2) == 4+8) + LZOCHK_ASSERT(__LZO_MASK_GEN(8,2) == 8+16) + LZOCHK_ASSERT(__LZO_MASK_GEN(2,3) == 2+4+8) + LZOCHK_ASSERT(__LZO_MASK_GEN(4,3) == 4+8+16) + LZOCHK_ASSERT(__LZO_MASK_GEN(8,3) == 8+16+32) + LZOCHK_ASSERT(__LZO_MASK_GEN(7,1) == 7) + LZOCHK_ASSERT(__LZO_MASK_GEN(7,2) == 7+14) + LZOCHK_ASSERT(__LZO_MASK_GEN(7,3) == 7+14+28) +#endif +#if !(LZO_BROKEN_SIGNED_RIGHT_SHIFT) + LZOCHK_ASSERT(((-1) >> 7) == -1) +#endif + LZOCHK_ASSERT(((1) >> 7) == 0) +#if (LZO_CC_INTELC && (__INTEL_COMPILER >= 900)) +# pragma warning(push) +# pragma warning(disable: 1025) +#endif + LZOCHK_ASSERT((~0l & ~0) == ~0l) + LZOCHK_ASSERT((~0l & ~0u) == ~0u) + LZOCHK_ASSERT((~0ul & ~0) == ~0ul) + LZOCHK_ASSERT((~0ul & ~0u) == ~0u) +#if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0150) +#elif (LZO_SIZEOF_INT == 2) + LZOCHK_ASSERT((~0l & ~0u) == 0xffffU) + LZOCHK_ASSERT((~0ul & ~0u) == 0xffffU) +#elif (LZO_SIZEOF_INT == 4) + LZOCHK_ASSERT((~0l & ~0u) == 0xffffffffU) + LZOCHK_ASSERT((~0ul & ~0u) == 0xffffffffU) +#endif +#if (LZO_CC_INTELC && (__INTEL_COMPILER >= 900)) +# pragma warning(pop) +#endif + LZOCHK_ASSERT_IS_SIGNED_T(signed char) + LZOCHK_ASSERT_IS_UNSIGNED_T(unsigned char) + LZOCHK_ASSERT(sizeof(signed char) == sizeof(char)) + LZOCHK_ASSERT(sizeof(unsigned char) == sizeof(char)) + LZOCHK_ASSERT(sizeof(char) == 1) +#if (LZO_CC_CILLY) && (!defined(__CILLY__) || (__CILLY__ < 0x010302L)) +#else + LZOCHK_ASSERT(sizeof(char) == sizeof(LZO_STATIC_CAST(char, 0))) +#endif +#if defined(__cplusplus) + LZOCHK_ASSERT(sizeof('\0') == sizeof(char)) +#else +# if (LZO_CC_DMC) +# else + LZOCHK_ASSERT(sizeof('\0') == sizeof(int)) +# endif +#endif +#if defined(__lzo_alignof) + LZOCHK_ASSERT(__lzo_alignof(char) == 1) + LZOCHK_ASSERT(__lzo_alignof(signed char) == 1) + LZOCHK_ASSERT(__lzo_alignof(unsigned char) == 1) +#if defined(lzo_int16e_t) + LZOCHK_ASSERT(__lzo_alignof(lzo_int16e_t) >= 1) + LZOCHK_ASSERT(__lzo_alignof(lzo_int16e_t) <= 2) +#endif +#if defined(lzo_int32e_t) + LZOCHK_ASSERT(__lzo_alignof(lzo_int32e_t) >= 1) + LZOCHK_ASSERT(__lzo_alignof(lzo_int32e_t) <= 4) +#endif +#endif + LZOCHK_ASSERT_IS_SIGNED_T(short) + LZOCHK_ASSERT_IS_UNSIGNED_T(unsigned short) + LZOCHK_ASSERT(sizeof(short) == sizeof(unsigned short)) +#if !(LZO_ABI_I8LP16) + LZOCHK_ASSERT(sizeof(short) >= 2) +#endif + LZOCHK_ASSERT(sizeof(short) >= sizeof(char)) +#if (LZO_CC_CILLY) && (!defined(__CILLY__) || (__CILLY__ < 0x010302L)) +#else + LZOCHK_ASSERT(sizeof(short) == sizeof(LZO_STATIC_CAST(short, 0))) +#endif +#if (LZO_SIZEOF_SHORT > 0) + LZOCHK_ASSERT(sizeof(short) == LZO_SIZEOF_SHORT) +#endif + LZOCHK_ASSERT_IS_SIGNED_T(int) + LZOCHK_ASSERT_IS_UNSIGNED_T(unsigned int) + LZOCHK_ASSERT(sizeof(int) == sizeof(unsigned int)) +#if !(LZO_ABI_I8LP16) + LZOCHK_ASSERT(sizeof(int) >= 2) +#endif + LZOCHK_ASSERT(sizeof(int) >= sizeof(short)) + LZOCHK_ASSERT(sizeof(int) == sizeof(0)) + LZOCHK_ASSERT(sizeof(int) == sizeof(LZO_STATIC_CAST(int, 0))) +#if (LZO_SIZEOF_INT > 0) + LZOCHK_ASSERT(sizeof(int) == LZO_SIZEOF_INT) +#endif + LZOCHK_ASSERT(sizeof(0) == sizeof(int)) + LZOCHK_ASSERT_IS_SIGNED_T(long) + LZOCHK_ASSERT_IS_UNSIGNED_T(unsigned long) + LZOCHK_ASSERT(sizeof(long) == sizeof(unsigned long)) +#if !(LZO_ABI_I8LP16) + LZOCHK_ASSERT(sizeof(long) >= 4) +#endif + LZOCHK_ASSERT(sizeof(long) >= sizeof(int)) + LZOCHK_ASSERT(sizeof(long) == sizeof(0L)) + LZOCHK_ASSERT(sizeof(long) == sizeof(LZO_STATIC_CAST(long, 0))) +#if (LZO_SIZEOF_LONG > 0) + LZOCHK_ASSERT(sizeof(long) == LZO_SIZEOF_LONG) +#endif + LZOCHK_ASSERT(sizeof(0L) == sizeof(long)) + LZOCHK_ASSERT_IS_UNSIGNED_T(size_t) + LZOCHK_ASSERT(sizeof(size_t) >= sizeof(int)) + LZOCHK_ASSERT(sizeof(size_t) == sizeof(sizeof(0))) +#if (LZO_SIZEOF_SIZE_T > 0) + LZOCHK_ASSERT(sizeof(size_t) == LZO_SIZEOF_SIZE_T) +#endif + LZOCHK_ASSERT_IS_SIGNED_T(ptrdiff_t) + LZOCHK_ASSERT(sizeof(ptrdiff_t) >= sizeof(int)) + LZOCHK_ASSERT(sizeof(ptrdiff_t) >= sizeof(size_t)) +#if !(LZO_BROKEN_SIZEOF) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == sizeof(LZO_STATIC_CAST(char*, 0) - LZO_STATIC_CAST(char*, 0))) +# if (LZO_HAVE_MM_HUGE_PTR) + LZOCHK_ASSERT(4 == sizeof(LZO_STATIC_CAST(char __huge*, 0) - LZO_STATIC_CAST(char __huge*, 0))) +# endif +#endif +#if (LZO_SIZEOF_PTRDIFF_T > 0) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == LZO_SIZEOF_PTRDIFF_T) +#endif + LZOCHK_ASSERT(sizeof(void*) >= sizeof(char*)) +#if (LZO_SIZEOF_VOID_P > 0) + LZOCHK_ASSERT(sizeof(void*) == LZO_SIZEOF_VOID_P) + LZOCHK_ASSERT(sizeof(char*) == LZO_SIZEOF_VOID_P) +#endif +#if (LZO_HAVE_MM_HUGE_PTR) + LZOCHK_ASSERT(4 == sizeof(void __huge*)) + LZOCHK_ASSERT(4 == sizeof(char __huge*)) +#endif +#if (LZO_ABI_I8LP16) + LZOCHK_ASSERT((((1u << 7) + 1) >> 7) == 1) + LZOCHK_ASSERT((((1ul << 15) + 1) >> 15) == 1) +#else + LZOCHK_ASSERT((((1u << 15) + 1) >> 15) == 1) + LZOCHK_ASSERT((((1ul << 31) + 1) >> 31) == 1) +#endif +#if defined(LZOCHK_CFG_PEDANTIC) +#if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0150) +#else + LZOCHK_ASSERT((1 << (8*LZO_SIZEOF_INT-1)) < 0) +#endif +#endif + LZOCHK_ASSERT((1u << (8*LZO_SIZEOF_INT-1)) > 0) +#if defined(LZOCHK_CFG_PEDANTIC) + LZOCHK_ASSERT((1l << (8*LZO_SIZEOF_LONG-1)) < 0) +#endif + LZOCHK_ASSERT((1ul << (8*LZO_SIZEOF_LONG-1)) > 0) +#if defined(lzo_int16e_t) + LZOCHK_ASSERT(sizeof(lzo_int16e_t) == 2) + LZOCHK_ASSERT(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T) + LZOCHK_ASSERT(sizeof(lzo_uint16e_t) == 2) + LZOCHK_ASSERT(sizeof(lzo_int16e_t) == sizeof(lzo_uint16e_t)) + LZOCHK_ASSERT_IS_SIGNED_T(lzo_int16e_t) + LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint16e_t) +#if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0150) +#else + LZOCHK_ASSERT((LZO_STATIC_CAST(lzo_uint16e_t, (~LZO_STATIC_CAST(lzo_uint16e_t,0ul))) >> 15) == 1) +#endif + LZOCHK_ASSERT( LZO_STATIC_CAST(lzo_int16e_t, (1 + ~LZO_STATIC_CAST(lzo_int16e_t, 0))) == 0) +#if defined(LZOCHK_CFG_PEDANTIC) + LZOCHK_ASSERT( LZO_STATIC_CAST(lzo_uint16e_t, (1 + ~LZO_STATIC_CAST(lzo_uint16e_t, 0))) == 0) +#endif +#endif +#if defined(lzo_int32e_t) + LZOCHK_ASSERT(sizeof(lzo_int32e_t) == 4) + LZOCHK_ASSERT(sizeof(lzo_int32e_t) == LZO_SIZEOF_LZO_INT32E_T) + LZOCHK_ASSERT(sizeof(lzo_uint32e_t) == 4) + LZOCHK_ASSERT(sizeof(lzo_int32e_t) == sizeof(lzo_uint32e_t)) + LZOCHK_ASSERT_IS_SIGNED_T(lzo_int32e_t) + LZOCHK_ASSERT(((( LZO_STATIC_CAST(lzo_int32e_t, 1) << 30) + 1) >> 30) == 1) + LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint32e_t) + LZOCHK_ASSERT(((( LZO_STATIC_CAST(lzo_uint32e_t, 1) << 31) + 1) >> 31) == 1) + LZOCHK_ASSERT((LZO_STATIC_CAST(lzo_uint32e_t, (~LZO_STATIC_CAST(lzo_uint32e_t, 0ul))) >> 31) == 1) + LZOCHK_ASSERT( LZO_STATIC_CAST(lzo_int32e_t, (1 + ~LZO_STATIC_CAST(lzo_int32e_t, 0))) == 0) +#if defined(LZOCHK_CFG_PEDANTIC) + LZOCHK_ASSERT( LZO_STATIC_CAST(lzo_uint32e_t, (1 + ~LZO_STATIC_CAST(lzo_uint32e_t, 0))) == 0) +#endif +#endif +#if defined(lzo_int32e_t) + LZOCHK_ASSERT(sizeof(lzo_int32l_t) >= sizeof(lzo_int32e_t)) +#endif + LZOCHK_ASSERT(sizeof(lzo_int32l_t) >= 4) + LZOCHK_ASSERT(sizeof(lzo_int32l_t) == LZO_SIZEOF_LZO_INT32L_T) + LZOCHK_ASSERT(sizeof(lzo_uint32l_t) >= 4) + LZOCHK_ASSERT(sizeof(lzo_int32l_t) == sizeof(lzo_uint32l_t)) + LZOCHK_ASSERT_IS_SIGNED_T(lzo_int32l_t) + LZOCHK_ASSERT(((( LZO_STATIC_CAST(lzo_int32l_t, 1) << 30) + 1) >> 30) == 1) + LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint32l_t) + LZOCHK_ASSERT(((( LZO_STATIC_CAST(lzo_uint32l_t, 1) << 31) + 1) >> 31) == 1) + LZOCHK_ASSERT(sizeof(lzo_int32f_t) >= sizeof(int)) +#if defined(lzo_int32e_t) + LZOCHK_ASSERT(sizeof(lzo_int32f_t) >= sizeof(lzo_int32e_t)) +#endif + LZOCHK_ASSERT(sizeof(lzo_int32f_t) >= sizeof(lzo_int32l_t)) + LZOCHK_ASSERT(sizeof(lzo_int32f_t) >= 4) + LZOCHK_ASSERT(sizeof(lzo_int32f_t) >= sizeof(lzo_int32l_t)) + LZOCHK_ASSERT(sizeof(lzo_int32f_t) == LZO_SIZEOF_LZO_INT32F_T) + LZOCHK_ASSERT(sizeof(lzo_uint32f_t) >= 4) + LZOCHK_ASSERT(sizeof(lzo_uint32f_t) >= sizeof(lzo_uint32l_t)) + LZOCHK_ASSERT(sizeof(lzo_int32f_t) == sizeof(lzo_uint32f_t)) + LZOCHK_ASSERT_IS_SIGNED_T(lzo_int32f_t) + LZOCHK_ASSERT(((( LZO_STATIC_CAST(lzo_int32f_t, 1) << 30) + 1) >> 30) == 1) + LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint32f_t) + LZOCHK_ASSERT(((( LZO_STATIC_CAST(lzo_uint32f_t, 1) << 31) + 1) >> 31) == 1) +#if defined(lzo_int64e_t) + LZOCHK_ASSERT(sizeof(lzo_int64e_t) == 8) + LZOCHK_ASSERT(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T) + LZOCHK_ASSERT(sizeof(lzo_uint64e_t) == 8) + LZOCHK_ASSERT(sizeof(lzo_int64e_t) == sizeof(lzo_uint64e_t)) + LZOCHK_ASSERT_IS_SIGNED_T(lzo_int64e_t) +#if (LZO_CC_BORLANDC && (__BORLANDC__ < 0x0530)) +#else + LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint64e_t) +#endif +#endif +#if defined(lzo_int64l_t) +#if defined(lzo_int64e_t) + LZOCHK_ASSERT(sizeof(lzo_int64l_t) >= sizeof(lzo_int64e_t)) +#endif + LZOCHK_ASSERT(sizeof(lzo_int64l_t) >= 8) + LZOCHK_ASSERT(sizeof(lzo_int64l_t) == LZO_SIZEOF_LZO_INT64L_T) + LZOCHK_ASSERT(sizeof(lzo_uint64l_t) >= 8) + LZOCHK_ASSERT(sizeof(lzo_int64l_t) == sizeof(lzo_uint64l_t)) + LZOCHK_ASSERT_IS_SIGNED_T(lzo_int64l_t) + LZOCHK_ASSERT(((( LZO_STATIC_CAST(lzo_int64l_t, 1) << 62) + 1) >> 62) == 1) + LZOCHK_ASSERT(((( LZO_INT64_C(1) << 62) + 1) >> 62) == 1) +#if (LZO_CC_BORLANDC && (__BORLANDC__ < 0x0530)) +#else + LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint64l_t) + LZOCHK_ASSERT(LZO_UINT64_C(18446744073709551615) > 0) +#endif + LZOCHK_ASSERT(((( LZO_STATIC_CAST(lzo_uint64l_t, 1) << 63) + 1) >> 63) == 1) + LZOCHK_ASSERT(((( LZO_UINT64_C(1) << 63) + 1) >> 63) == 1) +#if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020600ul)) + LZOCHK_ASSERT(LZO_INT64_C(9223372036854775807) > LZO_INT64_C(0)) +#else + LZOCHK_ASSERT(LZO_INT64_C(9223372036854775807) > 0) +#endif + LZOCHK_ASSERT(LZO_INT64_C(-9223372036854775807) - 1 < 0) + LZOCHK_ASSERT( LZO_INT64_C(9223372036854775807) % LZO_INT32_C(2147483629) == 721) + LZOCHK_ASSERT( LZO_INT64_C(9223372036854775807) % LZO_INT32_C(2147483647) == 1) + LZOCHK_ASSERT(LZO_UINT64_C(9223372036854775807) % LZO_UINT32_C(2147483629) == 721) + LZOCHK_ASSERT(LZO_UINT64_C(9223372036854775807) % LZO_UINT32_C(2147483647) == 1) +#endif +#if defined(lzo_int64f_t) +#if defined(lzo_int64e_t) + LZOCHK_ASSERT(sizeof(lzo_int64f_t) >= sizeof(lzo_int64e_t)) +#endif + LZOCHK_ASSERT(sizeof(lzo_int64f_t) >= sizeof(lzo_int64l_t)) + LZOCHK_ASSERT(sizeof(lzo_int64f_t) >= 8) + LZOCHK_ASSERT(sizeof(lzo_int64f_t) >= sizeof(lzo_int64l_t)) + LZOCHK_ASSERT(sizeof(lzo_int64f_t) == LZO_SIZEOF_LZO_INT64F_T) + LZOCHK_ASSERT(sizeof(lzo_uint64f_t) >= 8) + LZOCHK_ASSERT(sizeof(lzo_uint64f_t) >= sizeof(lzo_uint64l_t)) + LZOCHK_ASSERT(sizeof(lzo_int64f_t) == sizeof(lzo_uint64f_t)) + LZOCHK_ASSERT_IS_SIGNED_T(lzo_int64f_t) +#if (LZO_CC_BORLANDC && (__BORLANDC__ < 0x0530)) +#else + LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint64f_t) +#endif +#endif +#if !defined(__LZO_INTPTR_T_IS_POINTER) + LZOCHK_ASSERT_IS_SIGNED_T(lzo_intptr_t) + LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t) +#endif + LZOCHK_ASSERT(sizeof(lzo_intptr_t) >= sizeof(void *)) + LZOCHK_ASSERT(sizeof(lzo_intptr_t) == LZO_SIZEOF_LZO_INTPTR_T) + LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(lzo_uintptr_t)) +#if defined(lzo_word_t) + LZOCHK_ASSERT(LZO_WORDSIZE == LZO_SIZEOF_LZO_WORD_T) + LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_word_t) + LZOCHK_ASSERT_IS_SIGNED_T(lzo_sword_t) + LZOCHK_ASSERT(sizeof(lzo_word_t) == LZO_SIZEOF_LZO_WORD_T) + LZOCHK_ASSERT(sizeof(lzo_word_t) == sizeof(lzo_sword_t)) +#endif + LZOCHK_ASSERT(sizeof(lzo_int8_t) == 1) + LZOCHK_ASSERT(sizeof(lzo_uint8_t) == 1) + LZOCHK_ASSERT(sizeof(lzo_int8_t) == sizeof(lzo_uint8_t)) + LZOCHK_ASSERT_IS_SIGNED_T(lzo_int8_t) + LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint8_t) +#if defined(LZO_INT16_C) + LZOCHK_ASSERT(sizeof(LZO_INT16_C(0)) >= 2) + LZOCHK_ASSERT(sizeof(LZO_UINT16_C(0)) >= 2) + LZOCHK_ASSERT((LZO_UINT16_C(0xffff) >> 15) == 1) +#endif +#if defined(LZO_INT32_C) + LZOCHK_ASSERT(sizeof(LZO_INT32_C(0)) >= 4) + LZOCHK_ASSERT(sizeof(LZO_UINT32_C(0)) >= 4) + LZOCHK_ASSERT((LZO_UINT32_C(0xffffffff) >> 31) == 1) +#endif +#if defined(LZO_INT64_C) +#if (LZO_CC_BORLANDC && (__BORLANDC__ < 0x0560)) +#else + LZOCHK_ASSERT(sizeof(LZO_INT64_C(0)) >= 8) + LZOCHK_ASSERT(sizeof(LZO_UINT64_C(0)) >= 8) +#endif + LZOCHK_ASSERT((LZO_UINT64_C(0xffffffffffffffff) >> 63) == 1) + LZOCHK_ASSERT((LZO_UINT64_C(0xffffffffffffffff) & ~0) == LZO_UINT64_C(0xffffffffffffffff)) + LZOCHK_ASSERT((LZO_UINT64_C(0xffffffffffffffff) & ~0l) == LZO_UINT64_C(0xffffffffffffffff)) +#if (LZO_SIZEOF_INT == 4) +# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) +# else + LZOCHK_ASSERT((LZO_UINT64_C(0xffffffffffffffff) & (~0u+0u)) == 0xffffffffu) +# endif +#endif +#if (LZO_SIZEOF_LONG == 4) +# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) +# else + LZOCHK_ASSERT((LZO_UINT64_C(0xffffffffffffffff) & (~0ul+0ul)) == 0xfffffffful) +# endif +#endif +#endif +#if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) + LZOCHK_ASSERT(sizeof(void*) == 2) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == 2) +#elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) + LZOCHK_ASSERT(sizeof(void*) == 4) +#endif +#if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_COMPACT) + LZOCHK_ASSERT(sizeof(void (*)(void)) == 2) +#elif (LZO_MM_MEDIUM || LZO_MM_LARGE || LZO_MM_HUGE) + LZOCHK_ASSERT(sizeof(void (*)(void)) == 4) +#endif +#if (LZO_ABI_ILP32) + LZOCHK_ASSERT(sizeof(int) == 4) + LZOCHK_ASSERT(sizeof(long) == 4) + LZOCHK_ASSERT(sizeof(void*) == 4) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(size_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(void *)) +#endif +#if (LZO_ABI_ILP64) + LZOCHK_ASSERT(sizeof(int) == 8) + LZOCHK_ASSERT(sizeof(long) == 8) + LZOCHK_ASSERT(sizeof(void*) == 8) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(size_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(void *)) +#endif +#if (LZO_ABI_IP32L64) + LZOCHK_ASSERT(sizeof(int) == 4) + LZOCHK_ASSERT(sizeof(long) == 8) + LZOCHK_ASSERT(sizeof(void*) == 4) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(size_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(void *)) +#endif +#if (LZO_ABI_LLP64) + LZOCHK_ASSERT(sizeof(int) == 4) + LZOCHK_ASSERT(sizeof(long) == 4) + LZOCHK_ASSERT(sizeof(void*) == 8) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(size_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(void *)) +#endif +#if (LZO_ABI_LP32) + LZOCHK_ASSERT(sizeof(int) == 2) + LZOCHK_ASSERT(sizeof(long) == 4) + LZOCHK_ASSERT(sizeof(void*) == 4) + LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(void *)) +#endif +#if (LZO_ABI_LP64) + LZOCHK_ASSERT(sizeof(int) == 4) + LZOCHK_ASSERT(sizeof(long) == 8) + LZOCHK_ASSERT(sizeof(void*) == 8) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(size_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(void *)) +#endif +#if (LZO_ABI_IP32W64) + LZOCHK_ASSERT(sizeof(int) == 4) + LZOCHK_ASSERT(sizeof(void*) == 4) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(size_t) == sizeof(void*)) + LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(void *)) + LZOCHK_ASSERT(LZO_WORDSIZE == 8) +#endif +#if (LZO_ARCH_I086) + LZOCHK_ASSERT(sizeof(size_t) == 2) + LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(void *)) +#elif (LZO_ARCH_I386 || LZO_ARCH_M68K) + LZOCHK_ASSERT(sizeof(size_t) == 4) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == 4) + LZOCHK_ASSERT(sizeof(lzo_intptr_t) == sizeof(void *)) +#endif +#if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32) + LZOCHK_ASSERT(sizeof(size_t) == 4) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == 4) + LZOCHK_ASSERT(sizeof(void (*)(void)) == 4) +#elif (LZO_OS_WIN64) + LZOCHK_ASSERT(sizeof(size_t) == 8) + LZOCHK_ASSERT(sizeof(ptrdiff_t) == 8) + LZOCHK_ASSERT(sizeof(void (*)(void)) == 8) +#endif +#if (LZO_CC_NDPC) +#elif (LZO_SIZEOF_INT > 1) + LZOCHK_ASSERT( LZO_STATIC_CAST(int, LZO_STATIC_CAST(unsigned char, LZO_STATIC_CAST(signed char, -1))) == 255) +#endif +#if defined(LZOCHK_CFG_PEDANTIC) +#if (LZO_CC_KEILC) +#elif (LZO_CC_NDPC) +#elif !(LZO_BROKEN_INTEGRAL_PROMOTION) && (LZO_SIZEOF_INT > 1) + LZOCHK_ASSERT( ((LZO_STATIC_CAST(unsigned char, 128)) << LZO_STATIC_CAST(int, (8*sizeof(int)-8))) < 0) +#endif +#endif +#if defined(LZOCHK_CFG_PEDANTIC) +#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0530) && (__BORLANDC__ < 0x0560)) +# pragma option pop +#endif +#endif +#endif +#if defined(LZO_WANT_ACCLIB_VGET) +# undef LZO_WANT_ACCLIB_VGET +#define __LZOLIB_VGET_CH_INCLUDED 1 +#if !defined(LZOLIB_PUBLIC) +# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) +#endif +#if !defined(LZOLIB_PUBLIC_NOINLINE) +# if !defined(__lzo_noinline) +# define LZOLIB_PUBLIC_NOINLINE(r,f) r __LZOLIB_FUNCNAME(f) +# elif (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x030400ul) || LZO_CC_LLVM) +# define LZOLIB_PUBLIC_NOINLINE(r,f) __lzo_noinline __attribute__((__used__)) r __LZOLIB_FUNCNAME(f) +# else +# define LZOLIB_PUBLIC_NOINLINE(r,f) __lzo_noinline r __LZOLIB_FUNCNAME(f) +# endif +#endif +extern void* volatile lzo_vget_ptr__; +#if (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x030400ul) || LZO_CC_LLVM) +void* volatile __attribute__((__used__)) lzo_vget_ptr__ = LZO_STATIC_CAST(void *, 0); +#else +void* volatile lzo_vget_ptr__ = LZO_STATIC_CAST(void *, 0); +#endif +#ifndef __LZOLIB_VGET_BODY +#define __LZOLIB_VGET_BODY(T) \ + if __lzo_unlikely(lzo_vget_ptr__) { \ + typedef T __lzo_may_alias TT; \ + unsigned char e; expr &= 255; e = LZO_STATIC_CAST(unsigned char, expr); \ + * LZO_STATIC_CAST(TT *, lzo_vget_ptr__) = v; \ + * LZO_STATIC_CAST(unsigned char *, lzo_vget_ptr__) = e; \ + v = * LZO_STATIC_CAST(TT *, lzo_vget_ptr__); \ + } \ + return v; +#endif +LZOLIB_PUBLIC_NOINLINE(short, lzo_vget_short) (short v, int expr) +{ + __LZOLIB_VGET_BODY(short) +} +LZOLIB_PUBLIC_NOINLINE(int, lzo_vget_int) (int v, int expr) +{ + __LZOLIB_VGET_BODY(int) +} +LZOLIB_PUBLIC_NOINLINE(long, lzo_vget_long) (long v, int expr) +{ + __LZOLIB_VGET_BODY(long) +} +#if defined(lzo_int64l_t) +LZOLIB_PUBLIC_NOINLINE(lzo_int64l_t, lzo_vget_lzo_int64l_t) (lzo_int64l_t v, int expr) +{ + __LZOLIB_VGET_BODY(lzo_int64l_t) +} +#endif +LZOLIB_PUBLIC_NOINLINE(lzo_hsize_t, lzo_vget_lzo_hsize_t) (lzo_hsize_t v, int expr) +{ + __LZOLIB_VGET_BODY(lzo_hsize_t) +} +#if !(LZO_CFG_NO_DOUBLE) +LZOLIB_PUBLIC_NOINLINE(double, lzo_vget_double) (double v, int expr) +{ + __LZOLIB_VGET_BODY(double) +} +#endif +LZOLIB_PUBLIC_NOINLINE(lzo_hvoid_p, lzo_vget_lzo_hvoid_p) (lzo_hvoid_p v, int expr) +{ + __LZOLIB_VGET_BODY(lzo_hvoid_p) +} +#if (LZO_ARCH_I086 && LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) && !defined(__cplusplus) +LZOLIB_PUBLIC_NOINLINE(lzo_hvoid_p, lzo_vget_lzo_hvoid_cp) (const lzo_hvoid_p vv, int expr) +{ + lzo_hvoid_p v = (lzo_hvoid_p) vv; + __LZOLIB_VGET_BODY(lzo_hvoid_p) +} +#else +LZOLIB_PUBLIC_NOINLINE(const lzo_hvoid_p, lzo_vget_lzo_hvoid_cp) (const lzo_hvoid_p v, int expr) +{ + __LZOLIB_VGET_BODY(const lzo_hvoid_p) +} +#endif +#endif +#if defined(LZO_WANT_ACCLIB_HMEMCPY) +# undef LZO_WANT_ACCLIB_HMEMCPY +#define __LZOLIB_HMEMCPY_CH_INCLUDED 1 +#if !defined(LZOLIB_PUBLIC) +# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) +#endif +LZOLIB_PUBLIC(int, lzo_hmemcmp) (const lzo_hvoid_p s1, const lzo_hvoid_p s2, lzo_hsize_t len) +{ +#if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMCMP) + const lzo_hbyte_p p1 = LZO_STATIC_CAST(const lzo_hbyte_p, s1); + const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, s2); + if __lzo_likely(len > 0) do + { + int d = *p1 - *p2; + if (d != 0) + return d; + p1++; p2++; + } while __lzo_likely(--len > 0); + return 0; +#else + return memcmp(s1, s2, len); +#endif +} +LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) +{ +#if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMCPY) + lzo_hbyte_p p1 = LZO_STATIC_CAST(lzo_hbyte_p, dest); + const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, src); + if (!(len > 0) || p1 == p2) + return dest; + do + *p1++ = *p2++; + while __lzo_likely(--len > 0); + return dest; +#else + return memcpy(dest, src, len); +#endif +} +LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) +{ +#if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMMOVE) + lzo_hbyte_p p1 = LZO_STATIC_CAST(lzo_hbyte_p, dest); + const lzo_hbyte_p p2 = LZO_STATIC_CAST(const lzo_hbyte_p, src); + if (!(len > 0) || p1 == p2) + return dest; + if (p1 < p2) + { + do + *p1++ = *p2++; + while __lzo_likely(--len > 0); + } + else + { + p1 += len; + p2 += len; + do + *--p1 = *--p2; + while __lzo_likely(--len > 0); + } + return dest; +#else + return memmove(dest, src, len); +#endif +} +LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int cc, lzo_hsize_t len) +{ +#if (LZO_HAVE_MM_HUGE_PTR) || !(HAVE_MEMSET) + lzo_hbyte_p p = LZO_STATIC_CAST(lzo_hbyte_p, s); + unsigned char c = LZO_ITRUNC(unsigned char, cc); + if __lzo_likely(len > 0) do + *p++ = c; + while __lzo_likely(--len > 0); + return s; +#else + return memset(s, cc, len); +#endif +} +#endif +#if defined(LZO_WANT_ACCLIB_RAND) +# undef LZO_WANT_ACCLIB_RAND +#define __LZOLIB_RAND_CH_INCLUDED 1 +#if !defined(LZOLIB_PUBLIC) +# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) +#endif +LZOLIB_PUBLIC(void, lzo_srand31) (lzo_rand31_p r, lzo_uint32l_t seed) +{ + r->seed = seed & LZO_UINT32_C(0xffffffff); +} +LZOLIB_PUBLIC(lzo_uint32l_t, lzo_rand31) (lzo_rand31_p r) +{ + r->seed = r->seed * LZO_UINT32_C(1103515245) + 12345; + r->seed &= LZO_UINT32_C(0x7fffffff); + return r->seed; +} +#if defined(lzo_int64l_t) +LZOLIB_PUBLIC(void, lzo_srand48) (lzo_rand48_p r, lzo_uint32l_t seed) +{ + r->seed = seed & LZO_UINT32_C(0xffffffff); + r->seed <<= 16; r->seed |= 0x330e; +} +LZOLIB_PUBLIC(lzo_uint32l_t, lzo_rand48) (lzo_rand48_p r) +{ + lzo_uint64l_t a; + r->seed = r->seed * LZO_UINT64_C(25214903917) + 11; + r->seed &= LZO_UINT64_C(0xffffffffffff); + a = r->seed >> 17; + return LZO_STATIC_CAST(lzo_uint32l_t, a); +} +LZOLIB_PUBLIC(lzo_uint32l_t, lzo_rand48_r32) (lzo_rand48_p r) +{ + lzo_uint64l_t a; + r->seed = r->seed * LZO_UINT64_C(25214903917) + 11; + r->seed &= LZO_UINT64_C(0xffffffffffff); + a = r->seed >> 16; + return LZO_STATIC_CAST(lzo_uint32l_t, a); +} +#endif +#if defined(lzo_int64l_t) +LZOLIB_PUBLIC(void, lzo_srand64) (lzo_rand64_p r, lzo_uint64l_t seed) +{ + r->seed = seed & LZO_UINT64_C(0xffffffffffffffff); +} +LZOLIB_PUBLIC(lzo_uint32l_t, lzo_rand64) (lzo_rand64_p r) +{ + lzo_uint64l_t a; + r->seed = r->seed * LZO_UINT64_C(6364136223846793005) + 1; +#if (LZO_SIZEOF_LZO_INT64L_T > 8) + r->seed &= LZO_UINT64_C(0xffffffffffffffff); +#endif + a = r->seed >> 33; + return LZO_STATIC_CAST(lzo_uint32l_t, a); +} +LZOLIB_PUBLIC(lzo_uint32l_t, lzo_rand64_r32) (lzo_rand64_p r) +{ + lzo_uint64l_t a; + r->seed = r->seed * LZO_UINT64_C(6364136223846793005) + 1; +#if (LZO_SIZEOF_LZO_INT64L_T > 8) + r->seed &= LZO_UINT64_C(0xffffffffffffffff); +#endif + a = r->seed >> 32; + return LZO_STATIC_CAST(lzo_uint32l_t, a); +} +#endif +LZOLIB_PUBLIC(void, lzo_srandmt) (lzo_randmt_p r, lzo_uint32l_t seed) +{ + unsigned i = 0; + do { + r->s[i++] = (seed &= LZO_UINT32_C(0xffffffff)); + seed ^= seed >> 30; + seed = seed * LZO_UINT32_C(0x6c078965) + i; + } while (i != 624); + r->n = i; +} +LZOLIB_PUBLIC(lzo_uint32l_t, lzo_randmt) (lzo_randmt_p r) +{ + return (__LZOLIB_FUNCNAME(lzo_randmt_r32)(r)) >> 1; +} +LZOLIB_PUBLIC(lzo_uint32l_t, lzo_randmt_r32) (lzo_randmt_p r) +{ + lzo_uint32l_t v; + if __lzo_unlikely(r->n == 624) { + unsigned i = 0, j; + r->n = 0; + do { + j = i - 623; if (LZO_STATIC_CAST(int, j) < 0) j += 624; + v = (r->s[i] & LZO_UINT32_C(0x80000000)) ^ (r->s[j] & LZO_UINT32_C(0x7fffffff)); + j = i - 227; if (LZO_STATIC_CAST(int, j) < 0) j += 624; + r->s[i] = r->s[j] ^ (v >> 1); + if (v & 1) r->s[i] ^= LZO_UINT32_C(0x9908b0df); + } while (++i != 624); + } + { unsigned i = r->n++; v = r->s[i]; } + v ^= v >> 11; v ^= (v & LZO_UINT32_C(0x013a58ad)) << 7; + v ^= (v & LZO_UINT32_C(0x0001df8c)) << 15; v ^= v >> 18; + return v; +} +#if defined(lzo_int64l_t) +LZOLIB_PUBLIC(void, lzo_srandmt64) (lzo_randmt64_p r, lzo_uint64l_t seed) +{ + unsigned i = 0; + do { + r->s[i++] = (seed &= LZO_UINT64_C(0xffffffffffffffff)); + seed ^= seed >> 62; + seed = seed * LZO_UINT64_C(0x5851f42d4c957f2d) + i; + } while (i != 312); + r->n = i; +} +#if 0 +LZOLIB_PUBLIC(lzo_uint32l_t, lzo_randmt64) (lzo_randmt64_p r) +{ + lzo_uint64l_t v; + v = (__LZOLIB_FUNCNAME(lzo_randmt64_r64)(r)) >> 33; + return LZO_STATIC_CAST(lzo_uint32l_t, v); +} +#endif +LZOLIB_PUBLIC(lzo_uint64l_t, lzo_randmt64_r64) (lzo_randmt64_p r) +{ + lzo_uint64l_t v; + if __lzo_unlikely(r->n == 312) { + unsigned i = 0, j; + r->n = 0; + do { + j = i - 311; if (LZO_STATIC_CAST(int, j) < 0) j += 312; + v = (r->s[i] & LZO_UINT64_C(0xffffffff80000000)) ^ (r->s[j] & LZO_UINT64_C(0x7fffffff)); + j = i - 156; if (LZO_STATIC_CAST(int, j) < 0) j += 312; + r->s[i] = r->s[j] ^ (v >> 1); + if (v & 1) r->s[i] ^= LZO_UINT64_C(0xb5026f5aa96619e9); + } while (++i != 312); + } + { unsigned i = r->n++; v = r->s[i]; } + v ^= (v & LZO_UINT64_C(0xaaaaaaaaa0000000)) >> 29; + v ^= (v & LZO_UINT64_C(0x38eb3ffff6d3)) << 17; + v ^= (v & LZO_UINT64_C(0x7ffbf77)) << 37; + return v ^ (v >> 43); +} +#endif +#endif +#if defined(LZO_WANT_ACCLIB_RDTSC) +# undef LZO_WANT_ACCLIB_RDTSC +#define __LZOLIB_RDTSC_CH_INCLUDED 1 +#if !defined(LZOLIB_PUBLIC) +# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) +#endif +#if defined(lzo_int32e_t) +#if (LZO_OS_WIN32 && LZO_CC_PELLESC && (__POCC__ >= 290)) +# pragma warn(push) +# pragma warn(disable:2007) +#endif +#if (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC) +#if (LZO_ARCH_AMD64 && LZO_CC_INTELC) +# define __LZOLIB_RDTSC_REGS : : "c" (t) : "memory", "rax", "rdx" +#elif (LZO_ARCH_AMD64) +# define __LZOLIB_RDTSC_REGS : : "c" (t) : "cc", "memory", "rax", "rdx" +#elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) +# define __LZOLIB_RDTSC_REGS : : "c" (t) : "ax", "dx" +#elif (LZO_ARCH_I386 && LZO_CC_INTELC) +# define __LZOLIB_RDTSC_REGS : : "c" (t) : "memory", "eax", "edx" +#else +# define __LZOLIB_RDTSC_REGS : : "c" (t) : "cc", "memory", "eax", "edx" +#endif +#endif +LZOLIB_PUBLIC(int, lzo_tsc_read) (lzo_uint32e_t* t) +{ +#if (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC) + __asm__ __volatile__( + "clc \n" ".byte 0x0f,0x31\n" + "movl %%eax,(%0)\n" "movl %%edx,4(%0)\n" + __LZOLIB_RDTSC_REGS + ); + return 0; +#elif (LZO_ARCH_I386) && (LZO_ASM_SYNTAX_MSC) + LZO_UNUSED(t); + __asm { + mov ecx, t + clc +# if (LZO_CC_MSC && (_MSC_VER < 1200)) + _emit 0x0f + _emit 0x31 +# else + rdtsc +# endif + mov [ecx], eax + mov [ecx+4], edx + } + return 0; +#else + t[0] = t[1] = 0; return -1; +#endif +} +#if (LZO_OS_WIN32 && LZO_CC_PELLESC && (__POCC__ >= 290)) +# pragma warn(pop) +#endif +#endif +#endif +#if defined(LZO_WANT_ACCLIB_DOSALLOC) +# undef LZO_WANT_ACCLIB_DOSALLOC +#define __LZOLIB_DOSALLOC_CH_INCLUDED 1 +#if !defined(LZOLIB_PUBLIC) +# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) +#endif +#if (LZO_OS_OS216) +LZO_EXTERN_C unsigned short __far __pascal DosAllocHuge(unsigned short, unsigned short, unsigned short __far *, unsigned short, unsigned short); +LZO_EXTERN_C unsigned short __far __pascal DosFreeSeg(unsigned short); +#endif +#if (LZO_OS_DOS16 || LZO_OS_WIN16) +#if !(LZO_CC_AZTECC) +LZOLIB_PUBLIC(void __far*, lzo_dos_alloc) (unsigned long size) +{ + void __far* p = 0; + union REGS ri, ro; + if ((long)size <= 0) + return p; + size = (size + 15) >> 4; + if (size > 0xffffu) + return p; + ri.x.ax = 0x4800; + ri.x.bx = (unsigned short) size; + int86(0x21, &ri, &ro); + if ((ro.x.cflag & 1) == 0) + p = (void __far*) LZO_PTR_MK_FP(ro.x.ax, 0); + return p; +} +LZOLIB_PUBLIC(int, lzo_dos_free) (void __far* p) +{ + union REGS ri, ro; + struct SREGS rs; + if (!p) + return 0; + if (LZO_PTR_FP_OFF(p) != 0) + return -1; + segread(&rs); + ri.x.ax = 0x4900; + rs.es = LZO_PTR_FP_SEG(p); + int86x(0x21, &ri, &ro, &rs); + if (ro.x.cflag & 1) + return -1; + return 0; +} +#endif +#endif +#if (LZO_OS_OS216) +LZOLIB_PUBLIC(void __far*, lzo_dos_alloc) (unsigned long size) +{ + void __far* p = 0; + unsigned short sel = 0; + if ((long)size <= 0) + return p; + if (DosAllocHuge((unsigned short)(size >> 16), (unsigned short)size, &sel, 0, 0) == 0) + p = (void __far*) LZO_PTR_MK_FP(sel, 0); + return p; +} +LZOLIB_PUBLIC(int, lzo_dos_free) (void __far* p) +{ + if (!p) + return 0; + if (LZO_PTR_FP_OFF(p) != 0) + return -1; + if (DosFreeSeg(LZO_PTR_FP_SEG(p)) != 0) + return -1; + return 0; +} +#endif +#endif +#if defined(LZO_WANT_ACCLIB_GETOPT) +# undef LZO_WANT_ACCLIB_GETOPT +#define __LZOLIB_GETOPT_CH_INCLUDED 1 +#if !defined(LZOLIB_PUBLIC) +# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) +#endif +LZOLIB_PUBLIC(void, lzo_getopt_init) (lzo_getopt_p g, + int start_argc, int argc, char** argv) +{ + memset(g, 0, sizeof(*g)); + g->optind = start_argc; + g->argc = argc; g->argv = argv; + g->optopt = -1; +} +static int __LZOLIB_FUNCNAME(lzo_getopt_rotate) (char** p, int first, int middle, int last) +{ + int i = middle, n = middle - first; + if (first >= middle || middle >= last) return 0; + for (;;) + { + char* t = p[first]; p[first] = p[i]; p[i] = t; + if (++first == middle) + { + if (++i == last) break; + middle = i; + } + else if (++i == last) + i = middle; + } + return n; +} +static int __LZOLIB_FUNCNAME(lzo_getopt_perror) (lzo_getopt_p g, int ret, const char* f, ...) +{ + if (g->opterr) + { +#if (HAVE_STDARG_H) + struct { va_list ap; } s; + va_start(s.ap, f); + g->opterr(g, f, &s); + va_end(s.ap); +#else + g->opterr(g, f, NULL); +#endif + } + ++g->errcount; + return ret; +} +LZOLIB_PUBLIC(int, lzo_getopt) (lzo_getopt_p g, + const char* shortopts, + const lzo_getopt_longopt_p longopts, + int* longind) +{ +#define pe __LZOLIB_FUNCNAME(lzo_getopt_perror) + int ordering = LZO_GETOPT_PERMUTE; + int missing_arg_ret = g->bad_option; + char* a; + if (shortopts) + { + if (*shortopts == '-' || *shortopts == '+') + ordering = *shortopts++ == '-' ? LZO_GETOPT_RETURN_IN_ORDER : LZO_GETOPT_REQUIRE_ORDER; + if (*shortopts == ':') + missing_arg_ret = *shortopts++; + } + g->optarg = NULL; + if (g->optopt == -1) + g->optopt = g->bad_option; + if (longind) + *longind = -1; + if (g->eof) + return -1; + if (g->shortpos) + goto lzo_label_next_shortopt; + g->optind -= __LZOLIB_FUNCNAME(lzo_getopt_rotate)(g->argv, g->pending_rotate_first, g->pending_rotate_middle, g->optind); + g->pending_rotate_first = g->pending_rotate_middle = g->optind; + if (ordering == LZO_GETOPT_PERMUTE) + { + while (g->optind < g->argc && !(g->argv[g->optind][0] == '-' && g->argv[g->optind][1])) + ++g->optind; + g->pending_rotate_middle = g->optind; + } + if (g->optind >= g->argc) + { + g->optind = g->pending_rotate_first; + goto lzo_label_eof; + } + a = g->argv[g->optind]; + if (a[0] == '-' && a[1] == '-') + { + size_t l = 0; + const lzo_getopt_longopt_p o; + const lzo_getopt_longopt_p o1 = NULL; + const lzo_getopt_longopt_p o2 = NULL; + int need_exact = 0; + ++g->optind; + if (!a[2]) + goto lzo_label_eof; + for (a += 2; a[l] && a[l] != '=' && a[l] != '#'; ) + ++l; + for (o = longopts; l && o && o->name; ++o) + { + if (strncmp(a, o->name, l) != 0) + continue; + if (!o->name[l]) + goto lzo_label_found_o; + need_exact |= o->has_arg & LZO_GETOPT_EXACT_ARG; + if (o1) o2 = o; + else o1 = o; + } + if (!o1 || need_exact) + return pe(g, g->bad_option, "unrecognized option '--%s'", a); + if (o2) + return pe(g, g->bad_option, "option '--%s' is ambiguous (could be '--%s' or '--%s')", a, o1->name, o2->name); + o = o1; + lzo_label_found_o: + a += l; + switch (o->has_arg & 0x2f) + { + case LZO_GETOPT_OPTIONAL_ARG: + if (a[0]) + g->optarg = a + 1; + break; + case LZO_GETOPT_REQUIRED_ARG: + if (a[0]) + g->optarg = a + 1; + else if (g->optind < g->argc) + g->optarg = g->argv[g->optind++]; + if (!g->optarg) + return pe(g, missing_arg_ret, "option '--%s' requires an argument", o->name); + break; + case LZO_GETOPT_REQUIRED_ARG | 0x20: + if (a[0] && a[1]) + g->optarg = a + 1; + if (!g->optarg) + return pe(g, missing_arg_ret, "option '--%s=' requires an argument", o->name); + break; + default: + if (a[0]) + return pe(g, g->bad_option, "option '--%s' doesn't allow an argument", o->name); + break; + } + if (longind) + *longind = (int) (o - longopts); + if (o->flag) + { + *o->flag = o->val; + return 0; + } + return o->val; + } + if (a[0] == '-' && a[1]) + { + unsigned char c; + const char* s; + lzo_label_next_shortopt: + a = g->argv[g->optind] + ++g->shortpos; + c = (unsigned char) *a++; s = NULL; + if (c != ':' && shortopts) + s = strchr(shortopts, c); + if (!s || s[1] != ':') + { + if (!a[0]) + { ++g->optind; g->shortpos = 0; } + if (!s) + { + g->optopt = c; + return pe(g, g->bad_option, "invalid option '-%c'", c); + } + } + else + { + ++g->optind; g->shortpos = 0; + if (a[0]) + g->optarg = a; + else if (s[2] != ':') + { + if (g->optind < g->argc) + g->optarg = g->argv[g->optind++]; + else + { + g->optopt = c; + return pe(g, missing_arg_ret, "option '-%c' requires an argument", c); + } + } + } + return c; + } + if (ordering == LZO_GETOPT_RETURN_IN_ORDER) + { + ++g->optind; + g->optarg = a; + return 1; + } +lzo_label_eof: + g->optind -= __LZOLIB_FUNCNAME(lzo_getopt_rotate)(g->argv, g->pending_rotate_first, g->pending_rotate_middle, g->optind); + g->pending_rotate_first = g->pending_rotate_middle = g->optind; + g->eof = 1; + return -1; +#undef pe +} +#endif +#if defined(LZO_WANT_ACCLIB_HALLOC) +# undef LZO_WANT_ACCLIB_HALLOC +#define __LZOLIB_HALLOC_CH_INCLUDED 1 +#if !defined(LZOLIB_PUBLIC) +# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) +#endif +#if (LZO_HAVE_MM_HUGE_PTR) +#if 1 && (LZO_OS_DOS16 && defined(BLX286)) +# define __LZOLIB_HALLOC_USE_DAH 1 +#elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) +# define __LZOLIB_HALLOC_USE_DAH 1 +#elif 1 && (LZO_OS_OS216) +# define __LZOLIB_HALLOC_USE_DAH 1 +#elif 1 && (LZO_OS_WIN16) +# define __LZOLIB_HALLOC_USE_GA 1 +#elif 1 && (LZO_OS_DOS16) && (LZO_CC_BORLANDC) && defined(__DPMI16__) +# define __LZOLIB_HALLOC_USE_GA 1 +#endif +#endif +#if (__LZOLIB_HALLOC_USE_DAH) +#if 0 && (LZO_OS_OS216) +#include +#else +LZO_EXTERN_C unsigned short __far __pascal DosAllocHuge(unsigned short, unsigned short, unsigned short __far *, unsigned short, unsigned short); +LZO_EXTERN_C unsigned short __far __pascal DosFreeSeg(unsigned short); +#endif +#endif +#if (__LZOLIB_HALLOC_USE_GA) +#if 0 +#define STRICT 1 +#include +#else +LZO_EXTERN_C const void __near* __far __pascal GlobalAlloc(unsigned, unsigned long); +LZO_EXTERN_C const void __near* __far __pascal GlobalFree(const void __near*); +LZO_EXTERN_C unsigned long __far __pascal GlobalHandle(unsigned); +LZO_EXTERN_C void __far* __far __pascal GlobalLock(const void __near*); +LZO_EXTERN_C int __far __pascal GlobalUnlock(const void __near*); +#endif +#endif +LZOLIB_PUBLIC(lzo_hvoid_p, lzo_halloc) (lzo_hsize_t size) +{ + lzo_hvoid_p p = LZO_STATIC_CAST(lzo_hvoid_p, 0); + if (!(size > 0)) + return p; +#if 0 && defined(__palmos__) + p = MemPtrNew(size); +#elif !(LZO_HAVE_MM_HUGE_PTR) + if (size < LZO_STATIC_CAST(size_t, -1)) + p = malloc(LZO_STATIC_CAST(size_t, size)); +#else + if (LZO_STATIC_CAST(long, size) <= 0) + return p; +{ +#if (__LZOLIB_HALLOC_USE_DAH) + unsigned short sel = 0; + if (DosAllocHuge((unsigned short)(size >> 16), (unsigned short)size, &sel, 0, 0) == 0) + p = (lzo_hvoid_p) LZO_PTR_MK_FP(sel, 0); +#elif (__LZOLIB_HALLOC_USE_GA) + const void __near* h = GlobalAlloc(2, size); + if (h) { + p = GlobalLock(h); + if (p && LZO_PTR_FP_OFF(p) != 0) { + GlobalUnlock(h); + p = 0; + } + if (!p) + GlobalFree(h); + } +#elif (LZO_CC_MSC && (_MSC_VER >= 700)) + p = _halloc(size, 1); +#elif (LZO_CC_MSC || LZO_CC_WATCOMC) + p = halloc(size, 1); +#elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) + p = farmalloc(size); +#elif (LZO_CC_BORLANDC || LZO_CC_TURBOC) + p = farmalloc(size); +#elif (LZO_CC_AZTECC) + p = lmalloc(size); +#else + if (size < LZO_STATIC_CAST(size_t, -1)) + p = malloc(LZO_STATIC_CAST(size_t, size)); +#endif +} +#endif + return p; +} +LZOLIB_PUBLIC(void, lzo_hfree) (lzo_hvoid_p p) +{ + if (!p) + return; +#if 0 && defined(__palmos__) + MemPtrFree(p); +#elif !(LZO_HAVE_MM_HUGE_PTR) + free(p); +#else +#if (__LZOLIB_HALLOC_USE_DAH) + if (LZO_PTR_FP_OFF(p) == 0) + DosFreeSeg((unsigned short) LZO_PTR_FP_SEG(p)); +#elif (__LZOLIB_HALLOC_USE_GA) + if (LZO_PTR_FP_OFF(p) == 0) { + const void __near* h = (const void __near*) (unsigned) GlobalHandle(LZO_PTR_FP_SEG(p)); + if (h) { + GlobalUnlock(h); + GlobalFree(h); + } + } +#elif (LZO_CC_MSC && (_MSC_VER >= 700)) + _hfree(p); +#elif (LZO_CC_MSC || LZO_CC_WATCOMC) + hfree(p); +#elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) + farfree((void __far*) p); +#elif (LZO_CC_BORLANDC || LZO_CC_TURBOC) + farfree((void __far*) p); +#elif (LZO_CC_AZTECC) + lfree(p); +#else + free(p); +#endif +#endif +} +#endif +#if defined(LZO_WANT_ACCLIB_HFREAD) +# undef LZO_WANT_ACCLIB_HFREAD +#define __LZOLIB_HFREAD_CH_INCLUDED 1 +#if !defined(LZOLIB_PUBLIC) +# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) +#endif +LZOLIB_PUBLIC(lzo_hsize_t, lzo_hfread) (void* vfp, lzo_hvoid_p buf, lzo_hsize_t size) +{ + FILE* fp = LZO_STATIC_CAST(FILE *, vfp); +#if (LZO_HAVE_MM_HUGE_PTR) +#if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) +#define __LZOLIB_REQUIRE_HMEMCPY_CH 1 + unsigned char tmp[512]; + lzo_hsize_t l = 0; + while (l < size) + { + size_t n = size - l > sizeof(tmp) ? sizeof(tmp) : (size_t) (size - l); + n = fread(tmp, 1, n, fp); + if (n == 0) + break; + __LZOLIB_FUNCNAME(lzo_hmemcpy)((lzo_hbyte_p)buf + l, tmp, (lzo_hsize_t)n); + l += n; + } + return l; +#elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) + lzo_hbyte_p b = (lzo_hbyte_p) buf; + lzo_hsize_t l = 0; + while (l < size) + { + size_t n; + n = LZO_PTR_FP_OFF(b); n = (n <= 1) ? 0x8000u : (0u - n); + if ((lzo_hsize_t) n > size - l) + n = (size_t) (size - l); + n = fread((void __far*)b, 1, n, fp); + if (n == 0) + break; + b += n; l += n; + } + return l; +#else +# error "unknown memory model" +#endif +#else + return fread(buf, 1, size, fp); +#endif +} +LZOLIB_PUBLIC(lzo_hsize_t, lzo_hfwrite) (void* vfp, const lzo_hvoid_p buf, lzo_hsize_t size) +{ + FILE* fp = LZO_STATIC_CAST(FILE *, vfp); +#if (LZO_HAVE_MM_HUGE_PTR) +#if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) +#define __LZOLIB_REQUIRE_HMEMCPY_CH 1 + unsigned char tmp[512]; + lzo_hsize_t l = 0; + while (l < size) + { + size_t n = size - l > sizeof(tmp) ? sizeof(tmp) : (size_t) (size - l); + __LZOLIB_FUNCNAME(lzo_hmemcpy)(tmp, (const lzo_hbyte_p)buf + l, (lzo_hsize_t)n); + n = fwrite(tmp, 1, n, fp); + if (n == 0) + break; + l += n; + } + return l; +#elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) + const lzo_hbyte_p b = (const lzo_hbyte_p) buf; + lzo_hsize_t l = 0; + while (l < size) + { + size_t n; + n = LZO_PTR_FP_OFF(b); n = (n <= 1) ? 0x8000u : (0u - n); + if ((lzo_hsize_t) n > size - l) + n = (size_t) (size - l); + n = fwrite((void __far*)b, 1, n, fp); + if (n == 0) + break; + b += n; l += n; + } + return l; +#else +# error "unknown memory model" +#endif +#else + return fwrite(buf, 1, size, fp); +#endif +} +#endif +#if defined(LZO_WANT_ACCLIB_HSREAD) +# undef LZO_WANT_ACCLIB_HSREAD +#define __LZOLIB_HSREAD_CH_INCLUDED 1 +#if !defined(LZOLIB_PUBLIC) +# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) +#endif +LZOLIB_PUBLIC(long, lzo_safe_hread) (int fd, lzo_hvoid_p buf, long size) +{ + lzo_hbyte_p b = (lzo_hbyte_p) buf; + long l = 0; + int saved_errno; + saved_errno = errno; + while (l < size) + { + long n = size - l; +#if (LZO_HAVE_MM_HUGE_PTR) +# define __LZOLIB_REQUIRE_HREAD_CH 1 + errno = 0; n = lzo_hread(fd, b, n); +#elif (LZO_OS_DOS32) && defined(__DJGPP__) + errno = 0; n = _read(fd, b, n); +#else + errno = 0; n = read(fd, b, n); +#endif + if (n == 0) + break; + if (n < 0) { +#if defined(EAGAIN) + if (errno == (EAGAIN)) continue; +#endif +#if defined(EINTR) + if (errno == (EINTR)) continue; +#endif + if (errno == 0) errno = 1; + return l; + } + b += n; l += n; + } + errno = saved_errno; + return l; +} +LZOLIB_PUBLIC(long, lzo_safe_hwrite) (int fd, const lzo_hvoid_p buf, long size) +{ + const lzo_hbyte_p b = (const lzo_hbyte_p) buf; + long l = 0; + int saved_errno; + saved_errno = errno; + while (l < size) + { + long n = size - l; +#if (LZO_HAVE_MM_HUGE_PTR) +# define __LZOLIB_REQUIRE_HREAD_CH 1 + errno = 0; n = lzo_hwrite(fd, b, n); +#elif (LZO_OS_DOS32) && defined(__DJGPP__) + errno = 0; n = _write(fd, b, n); +#else + errno = 0; n = write(fd, b, n); +#endif + if (n == 0) + break; + if (n < 0) { +#if defined(EAGAIN) + if (errno == (EAGAIN)) continue; +#endif +#if defined(EINTR) + if (errno == (EINTR)) continue; +#endif + if (errno == 0) errno = 1; + return l; + } + b += n; l += n; + } + errno = saved_errno; + return l; +} +#endif +#if defined(LZO_WANT_ACCLIB_PCLOCK) +# undef LZO_WANT_ACCLIB_PCLOCK +#define __LZOLIB_PCLOCK_CH_INCLUDED 1 +#if !defined(LZOLIB_PUBLIC) +# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) +#endif +#if 1 && (LZO_OS_POSIX_LINUX && LZO_ARCH_AMD64 && LZO_ASM_SYNTAX_GNUC && !LZO_CFG_NO_SYSCALL) +#ifndef lzo_pclock_syscall_clock_gettime +#define lzo_pclock_syscall_clock_gettime lzo_pclock_syscall_clock_gettime +#endif +__lzo_static_noinline long lzo_pclock_syscall_clock_gettime(long clockid, struct timespec *ts) +{ + unsigned long r = 228; + __asm__ __volatile__("syscall\n" : "=a" (r), "=m" (*ts) : "0" (r), "D" (clockid), "S" (ts) __LZO_ASM_CLOBBER_LIST_CC); + return LZO_ICAST(long, r); +} +#endif +#if 1 && (LZO_OS_POSIX_LINUX && LZO_ARCH_I386 && LZO_ASM_SYNTAX_GNUC && !LZO_CFG_NO_SYSCALL) && defined(lzo_int64l_t) +#ifndef lzo_pclock_syscall_clock_gettime +#define lzo_pclock_syscall_clock_gettime lzo_pclock_syscall_clock_gettime +#endif +__lzo_static_noinline long lzo_pclock_syscall_clock_gettime(long clockid, struct timespec *ts) +{ + unsigned long r = 265; + __asm__ __volatile__("pushl %%ebx\n pushl %%edx\n popl %%ebx\n int $0x80\n popl %%ebx\n": "=a" (r), "=m" (*ts) : "0" (r), "d" (clockid), "c" (ts) __LZO_ASM_CLOBBER_LIST_CC); + return LZO_ICAST(long, r); +} +#endif +#if 0 && defined(lzo_pclock_syscall_clock_gettime) +#ifndef lzo_pclock_read_clock_gettime_r_syscall +#define lzo_pclock_read_clock_gettime_r_syscall lzo_pclock_read_clock_gettime_r_syscall +#endif +static int lzo_pclock_read_clock_gettime_r_syscall(lzo_pclock_handle_p h, lzo_pclock_p c) +{ + struct timespec ts; + if (lzo_pclock_syscall_clock_gettime(0, &ts) != 0) + return -1; + c->tv_sec = ts.tv_sec; + c->tv_nsec = LZO_STATIC_CAST(lzo_uint32l_t, ts.tv_nsec); + LZO_UNUSED(h); return 0; +} +#endif +#if (HAVE_GETTIMEOFDAY) +#ifndef lzo_pclock_read_gettimeofday +#define lzo_pclock_read_gettimeofday lzo_pclock_read_gettimeofday +#endif +static int lzo_pclock_read_gettimeofday(lzo_pclock_handle_p h, lzo_pclock_p c) +{ + struct timeval tv; + if (gettimeofday(&tv, NULL) != 0) + return -1; +#if defined(lzo_int64l_t) + c->tv_sec = tv.tv_sec; +#else + c->tv_sec_high = 0; + c->tv_sec_low = tv.tv_sec; +#endif + c->tv_nsec = LZO_STATIC_CAST(lzo_uint32l_t, (tv.tv_usec * 1000u)); + LZO_UNUSED(h); return 0; +} +#endif +#if defined(CLOCKS_PER_SEC) && !(LZO_CFG_NO_DOUBLE) +#ifndef lzo_pclock_read_clock +#define lzo_pclock_read_clock lzo_pclock_read_clock +#endif +static int lzo_pclock_read_clock(lzo_pclock_handle_p h, lzo_pclock_p c) +{ + clock_t ticks; + double secs; +#if defined(lzo_int64l_t) + lzo_uint64l_t nsecs; + ticks = clock(); + secs = LZO_STATIC_CAST(double, ticks) / (CLOCKS_PER_SEC); + nsecs = LZO_STATIC_CAST(lzo_uint64l_t, (secs * 1000000000.0)); + c->tv_sec = LZO_STATIC_CAST(lzo_int64l_t, (nsecs / 1000000000ul)); + nsecs = (nsecs % 1000000000ul); + c->tv_nsec = LZO_STATIC_CAST(lzo_uint32l_t, nsecs); +#else + ticks = clock(); + secs = LZO_STATIC_CAST(double, ticks) / (CLOCKS_PER_SEC); + c->tv_sec_high = 0; + c->tv_sec_low = LZO_STATIC_CAST(lzo_uint32l_t, (secs + 0.5)); + c->tv_nsec = 0; +#endif + LZO_UNUSED(h); return 0; +} +#endif +#if 1 && defined(lzo_pclock_syscall_clock_gettime) +#ifndef lzo_pclock_read_clock_gettime_m_syscall +#define lzo_pclock_read_clock_gettime_m_syscall lzo_pclock_read_clock_gettime_m_syscall +#endif +static int lzo_pclock_read_clock_gettime_m_syscall(lzo_pclock_handle_p h, lzo_pclock_p c) +{ + struct timespec ts; + if (lzo_pclock_syscall_clock_gettime(1, &ts) != 0) + return -1; + c->tv_sec = ts.tv_sec; + c->tv_nsec = LZO_STATIC_CAST(lzo_uint32l_t, ts.tv_nsec); + LZO_UNUSED(h); return 0; +} +#endif +#if (LZO_OS_DOS32 && LZO_CC_GNUC) && defined(__DJGPP__) && defined(UCLOCKS_PER_SEC) && !(LZO_CFG_NO_DOUBLE) +#ifndef lzo_pclock_read_uclock +#define lzo_pclock_read_uclock lzo_pclock_read_uclock +#endif +static int lzo_pclock_read_uclock(lzo_pclock_handle_p h, lzo_pclock_p c) +{ + lzo_uint64l_t ticks; + double secs; + lzo_uint64l_t nsecs; + ticks = uclock(); + secs = LZO_STATIC_CAST(double, ticks) / (UCLOCKS_PER_SEC); + nsecs = LZO_STATIC_CAST(lzo_uint64l_t, (secs * 1000000000.0)); + c->tv_sec = nsecs / 1000000000ul; + c->tv_nsec = LZO_STATIC_CAST(lzo_uint32l_t, (nsecs % 1000000000ul)); + LZO_UNUSED(h); return 0; +} +#endif +#if 1 && (HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID) && defined(lzo_int64l_t) +#ifndef lzo_pclock_read_clock_gettime_p_libc +#define lzo_pclock_read_clock_gettime_p_libc lzo_pclock_read_clock_gettime_p_libc +#endif +static int lzo_pclock_read_clock_gettime_p_libc(lzo_pclock_handle_p h, lzo_pclock_p c) +{ + struct timespec ts; + if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts) != 0) + return -1; + c->tv_sec = ts.tv_sec; + c->tv_nsec = LZO_STATIC_CAST(lzo_uint32l_t, ts.tv_nsec); + LZO_UNUSED(h); return 0; +} +#endif +#if 1 && defined(lzo_pclock_syscall_clock_gettime) +#ifndef lzo_pclock_read_clock_gettime_p_syscall +#define lzo_pclock_read_clock_gettime_p_syscall lzo_pclock_read_clock_gettime_p_syscall +#endif +static int lzo_pclock_read_clock_gettime_p_syscall(lzo_pclock_handle_p h, lzo_pclock_p c) +{ + struct timespec ts; + if (lzo_pclock_syscall_clock_gettime(2, &ts) != 0) + return -1; + c->tv_sec = ts.tv_sec; + c->tv_nsec = LZO_STATIC_CAST(lzo_uint32l_t, ts.tv_nsec); + LZO_UNUSED(h); return 0; +} +#endif +#if (LZO_OS_CYGWIN || LZO_OS_WIN32 || LZO_OS_WIN64) && (LZO_HAVE_WINDOWS_H) && defined(lzo_int64l_t) +#ifndef lzo_pclock_read_getprocesstimes +#define lzo_pclock_read_getprocesstimes lzo_pclock_read_getprocesstimes +#endif +static int lzo_pclock_read_getprocesstimes(lzo_pclock_handle_p h, lzo_pclock_p c) +{ + FILETIME ct, et, kt, ut; + lzo_uint64l_t ticks; + if (GetProcessTimes(GetCurrentProcess(), &ct, &et, &kt, &ut) == 0) + return -1; + ticks = (LZO_STATIC_CAST(lzo_uint64l_t, ut.dwHighDateTime) << 32) | ut.dwLowDateTime; + if __lzo_unlikely(h->ticks_base == 0) + h->ticks_base = ticks; + else + ticks -= h->ticks_base; + c->tv_sec = LZO_STATIC_CAST(lzo_int64l_t, (ticks / 10000000ul)); + ticks = (ticks % 10000000ul) * 100u; + c->tv_nsec = LZO_STATIC_CAST(lzo_uint32l_t, ticks); + LZO_UNUSED(h); return 0; +} +#endif +#if (HAVE_GETRUSAGE) && defined(RUSAGE_SELF) +#ifndef lzo_pclock_read_getrusage +#define lzo_pclock_read_getrusage lzo_pclock_read_getrusage +#endif +static int lzo_pclock_read_getrusage(lzo_pclock_handle_p h, lzo_pclock_p c) +{ + struct rusage ru; + if (getrusage(RUSAGE_SELF, &ru) != 0) + return -1; +#if defined(lzo_int64l_t) + c->tv_sec = ru.ru_utime.tv_sec; +#else + c->tv_sec_high = 0; + c->tv_sec_low = ru.ru_utime.tv_sec; +#endif + c->tv_nsec = LZO_STATIC_CAST(lzo_uint32l_t, (ru.ru_utime.tv_usec * 1000u)); + LZO_UNUSED(h); return 0; +} +#endif +#if 1 && (HAVE_CLOCK_GETTIME) && defined(CLOCK_THREAD_CPUTIME_ID) && defined(lzo_int64l_t) +#ifndef lzo_pclock_read_clock_gettime_t_libc +#define lzo_pclock_read_clock_gettime_t_libc lzo_pclock_read_clock_gettime_t_libc +#endif +static int lzo_pclock_read_clock_gettime_t_libc(lzo_pclock_handle_p h, lzo_pclock_p c) +{ + struct timespec ts; + if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0) + return -1; + c->tv_sec = ts.tv_sec; + c->tv_nsec = (lzo_uint32l_t) ts.tv_nsec; + LZO_UNUSED(h); return 0; +} +#endif +#if 1 && defined(lzo_pclock_syscall_clock_gettime) +#ifndef lzo_pclock_read_clock_gettime_t_syscall +#define lzo_pclock_read_clock_gettime_t_syscall lzo_pclock_read_clock_gettime_t_syscall +#endif +static int lzo_pclock_read_clock_gettime_t_syscall(lzo_pclock_handle_p h, lzo_pclock_p c) +{ + struct timespec ts; + if (lzo_pclock_syscall_clock_gettime(3, &ts) != 0) + return -1; + c->tv_sec = ts.tv_sec; + c->tv_nsec = LZO_STATIC_CAST(lzo_uint32l_t, ts.tv_nsec); + LZO_UNUSED(h); return 0; +} +#endif +#if (LZO_OS_CYGWIN || LZO_OS_WIN32 || LZO_OS_WIN64) && (LZO_HAVE_WINDOWS_H) && defined(lzo_int64l_t) +#ifndef lzo_pclock_read_getthreadtimes +#define lzo_pclock_read_getthreadtimes lzo_pclock_read_getthreadtimes +#endif +static int lzo_pclock_read_getthreadtimes(lzo_pclock_handle_p h, lzo_pclock_p c) +{ + FILETIME ct, et, kt, ut; + lzo_uint64l_t ticks; + if (GetThreadTimes(GetCurrentThread(), &ct, &et, &kt, &ut) == 0) + return -1; + ticks = (LZO_STATIC_CAST(lzo_uint64l_t, ut.dwHighDateTime) << 32) | ut.dwLowDateTime; + if __lzo_unlikely(h->ticks_base == 0) + h->ticks_base = ticks; + else + ticks -= h->ticks_base; + c->tv_sec = LZO_STATIC_CAST(lzo_int64l_t, (ticks / 10000000ul)); + ticks = (ticks % 10000000ul) * 100u; + c->tv_nsec = LZO_STATIC_CAST(lzo_uint32l_t, ticks); + LZO_UNUSED(h); return 0; +} +#endif +LZOLIB_PUBLIC(int, lzo_pclock_open) (lzo_pclock_handle_p h, int mode) +{ + lzo_pclock_t c; + int i; + h->h = LZO_STATIC_CAST(lzolib_handle_t, 0); + h->mode = -1; + h->read_error = 2; + h->name = NULL; + h->gettime = LZO_STATIC_CAST(lzo_pclock_gettime_t, 0); +#if defined(lzo_int64l_t) + h->ticks_base = 0; +#endif + switch (mode) + { + case LZO_PCLOCK_REALTIME: +# if defined(lzo_pclock_read_clock_gettime_r_syscall) + if (lzo_pclock_read_clock_gettime_r_syscall(h, &c) == 0) { + h->gettime = lzo_pclock_read_clock_gettime_r_syscall; + h->name = "CLOCK_REALTIME/syscall"; + break; + } +# endif +# if defined(lzo_pclock_read_gettimeofday) + if (lzo_pclock_read_gettimeofday(h, &c) == 0) { + h->gettime = lzo_pclock_read_gettimeofday; + h->name = "gettimeofday"; + break; + } +# endif + break; + case LZO_PCLOCK_MONOTONIC: +# if defined(lzo_pclock_read_clock_gettime_m_syscall) + if (lzo_pclock_read_clock_gettime_m_syscall(h, &c) == 0) { + h->gettime = lzo_pclock_read_clock_gettime_m_syscall; + h->name = "CLOCK_MONOTONIC/syscall"; + break; + } +# endif +# if defined(lzo_pclock_read_uclock) + if (lzo_pclock_read_uclock(h, &c) == 0) { + h->gettime = lzo_pclock_read_uclock; + h->name = "uclock"; + break; + } +# endif +# if defined(lzo_pclock_read_clock) + if (lzo_pclock_read_clock(h, &c) == 0) { + h->gettime = lzo_pclock_read_clock; + h->name = "clock"; + break; + } +# endif + break; + case LZO_PCLOCK_PROCESS_CPUTIME_ID: +# if defined(lzo_pclock_read_getprocesstimes) + if (lzo_pclock_read_getprocesstimes(h, &c) == 0) { + h->gettime = lzo_pclock_read_getprocesstimes; + h->name = "GetProcessTimes"; + break; + } +# endif +# if defined(lzo_pclock_read_clock_gettime_p_syscall) + if (lzo_pclock_read_clock_gettime_p_syscall(h, &c) == 0) { + h->gettime = lzo_pclock_read_clock_gettime_p_syscall; + h->name = "CLOCK_PROCESS_CPUTIME_ID/syscall"; + break; + } +# endif +# if defined(lzo_pclock_read_clock_gettime_p_libc) + if (lzo_pclock_read_clock_gettime_p_libc(h, &c) == 0) { + h->gettime = lzo_pclock_read_clock_gettime_p_libc; + h->name = "CLOCK_PROCESS_CPUTIME_ID/libc"; + break; + } +# endif +# if defined(lzo_pclock_read_getrusage) + if (lzo_pclock_read_getrusage(h, &c) == 0) { + h->gettime = lzo_pclock_read_getrusage; + h->name = "getrusage"; + break; + } +# endif + break; + case LZO_PCLOCK_THREAD_CPUTIME_ID: +# if defined(lzo_pclock_read_getthreadtimes) + if (lzo_pclock_read_getthreadtimes(h, &c) == 0) { + h->gettime = lzo_pclock_read_getthreadtimes; + h->name = "GetThreadTimes"; + } +# endif +# if defined(lzo_pclock_read_clock_gettime_t_syscall) + if (lzo_pclock_read_clock_gettime_t_syscall(h, &c) == 0) { + h->gettime = lzo_pclock_read_clock_gettime_t_syscall; + h->name = "CLOCK_THREAD_CPUTIME_ID/syscall"; + break; + } +# endif +# if defined(lzo_pclock_read_clock_gettime_t_libc) + if (lzo_pclock_read_clock_gettime_t_libc(h, &c) == 0) { + h->gettime = lzo_pclock_read_clock_gettime_t_libc; + h->name = "CLOCK_THREAD_CPUTIME_ID/libc"; + break; + } +# endif + break; + } + if (!h->gettime) + return -1; + if (!h->h) + h->h = LZO_STATIC_CAST(lzolib_handle_t, 1); + h->mode = mode; + h->read_error = 0; + if (!h->name) + h->name = "unknown"; + for (i = 0; i < 10; i++) { + __LZOLIB_FUNCNAME(lzo_pclock_read)(h, &c); + } + return 0; +} +LZOLIB_PUBLIC(int, lzo_pclock_open_default) (lzo_pclock_handle_p h) +{ + if (__LZOLIB_FUNCNAME(lzo_pclock_open)(h, LZO_PCLOCK_PROCESS_CPUTIME_ID) == 0) + return 0; + if (__LZOLIB_FUNCNAME(lzo_pclock_open)(h, LZO_PCLOCK_MONOTONIC) == 0) + return 0; + if (__LZOLIB_FUNCNAME(lzo_pclock_open)(h, LZO_PCLOCK_REALTIME) == 0) + return 0; + if (__LZOLIB_FUNCNAME(lzo_pclock_open)(h, LZO_PCLOCK_THREAD_CPUTIME_ID) == 0) + return 0; + return -1; +} +LZOLIB_PUBLIC(int, lzo_pclock_close) (lzo_pclock_handle_p h) +{ + h->h = LZO_STATIC_CAST(lzolib_handle_t, 0); + h->mode = -1; + h->name = NULL; + h->gettime = LZO_STATIC_CAST(lzo_pclock_gettime_t, 0); + return 0; +} +LZOLIB_PUBLIC(void, lzo_pclock_read) (lzo_pclock_handle_p h, lzo_pclock_p c) +{ + if (h->gettime) { + if (h->gettime(h, c) == 0) + return; + } + h->read_error = 1; +#if defined(lzo_int64l_t) + c->tv_sec = 0; +#else + c->tv_sec_high = 0; + c->tv_sec_low = 0; +#endif + c->tv_nsec = 0; +} +#if !(LZO_CFG_NO_DOUBLE) +LZOLIB_PUBLIC(double, lzo_pclock_get_elapsed) (lzo_pclock_handle_p h, const lzo_pclock_p start, const lzo_pclock_p stop) +{ + if (!h->h) { h->mode = -1; return 0.0; } + { +#if 1 && (LZO_ARCH_I386 && LZO_CC_GNUC) && defined(__STRICT_ALIGNMENT__) + float tstop, tstart; + tstop = LZO_STATIC_CAST(float, (stop->tv_sec + stop->tv_nsec / 1000000000.0)); + tstart = LZO_STATIC_CAST(float, (start->tv_sec + start->tv_nsec / 1000000000.0)); +#elif defined(lzo_int64l_t) + double tstop, tstart; +#if 1 && (LZO_CC_INTELC) + { lzo_int64l_t a = stop->tv_sec; lzo_uint32l_t b = stop->tv_nsec; + tstop = a + b / 1000000000.0; } + { lzo_int64l_t a = start->tv_sec; lzo_uint32l_t b = start->tv_nsec; + tstart = a + b / 1000000000.0; } +#else + tstop = stop->tv_sec + stop->tv_nsec / 1000000000.0; + tstart = start->tv_sec + start->tv_nsec / 1000000000.0; +#endif +#else + double tstop, tstart; + tstop = stop->tv_sec_low + stop->tv_nsec / 1000000000.0; + tstart = start->tv_sec_low + start->tv_nsec / 1000000000.0; +#endif + return tstop - tstart; + } +} +#endif +LZOLIB_PUBLIC(int, lzo_pclock_flush_cpu_cache) (lzo_pclock_handle_p h, unsigned flags) +{ + LZO_UNUSED(h); LZO_UNUSED(flags); + return -1; +} +#endif +#if defined(LZO_WANT_ACCLIB_MISC) +# undef LZO_WANT_ACCLIB_MISC +#define __LZOLIB_MISC_CH_INCLUDED 1 +#if !defined(LZOLIB_PUBLIC) +# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) +#endif +#if !defined(LZOLIB_PUBLIC_NOINLINE) +# if !defined(__lzo_noinline) +# define LZOLIB_PUBLIC_NOINLINE(r,f) r __LZOLIB_FUNCNAME(f) +# elif (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x030400ul) || LZO_CC_LLVM) +# define LZOLIB_PUBLIC_NOINLINE(r,f) __lzo_noinline __attribute__((__used__)) r __LZOLIB_FUNCNAME(f) +# else +# define LZOLIB_PUBLIC_NOINLINE(r,f) __lzo_noinline r __LZOLIB_FUNCNAME(f) +# endif +#endif +#if (LZO_OS_WIN32 && LZO_CC_PELLESC && (__POCC__ >= 290)) +# pragma warn(push) +# pragma warn(disable:2007) +#endif +LZOLIB_PUBLIC(const char *, lzo_getenv) (const char *s) +{ +#if (HAVE_GETENV) + return getenv(s); +#else + LZO_UNUSED(s); return LZO_STATIC_CAST(const char *, 0); +#endif +} +LZOLIB_PUBLIC(lzo_intptr_t, lzo_get_osfhandle) (int fd) +{ + if (fd < 0) + return -1; +#if (LZO_OS_CYGWIN) + return get_osfhandle(fd); +#elif (LZO_OS_EMX && defined(__RSXNT__)) + return -1; +#elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) + return -1; +#elif (LZO_OS_WIN32 || LZO_OS_WIN64) +# if (LZO_CC_PELLESC && (__POCC__ < 280)) + return -1; +# elif (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) + return -1; +# elif (LZO_CC_WATCOMC && (__WATCOMC__ < 1100)) + return _os_handle(fd); +# else + return _get_osfhandle(fd); +# endif +#else + return fd; +#endif +} +LZOLIB_PUBLIC(int, lzo_set_binmode) (int fd, int binary) +{ +#if (LZO_ARCH_M68K && LZO_OS_TOS && LZO_CC_GNUC) && defined(__MINT__) + FILE* fp; int old_binary; + if (fd == STDIN_FILENO) fp = stdin; + else if (fd == STDOUT_FILENO) fp = stdout; + else if (fd == STDERR_FILENO) fp = stderr; + else return -1; + old_binary = fp->__mode.__binary; + __set_binmode(fp, binary ? 1 : 0); + return old_binary ? 1 : 0; +#elif (LZO_ARCH_M68K && LZO_OS_TOS) + LZO_UNUSED(fd); LZO_UNUSED(binary); + return -1; +#elif (LZO_OS_DOS16 && (LZO_CC_AZTECC || LZO_CC_PACIFICC)) + LZO_UNUSED(fd); LZO_UNUSED(binary); + return -1; +#elif (LZO_OS_DOS32 && LZO_CC_GNUC) && defined(__DJGPP__) + int r; unsigned old_flags = __djgpp_hwint_flags; + LZO_COMPILE_TIME_ASSERT(O_BINARY > 0) + LZO_COMPILE_TIME_ASSERT(O_TEXT > 0) + if (fd < 0) return -1; + r = setmode(fd, binary ? O_BINARY : O_TEXT); + if ((old_flags & 1u) != (__djgpp_hwint_flags & 1u)) + __djgpp_set_ctrl_c(!(old_flags & 1)); + if (r == -1) return -1; + return (r & O_TEXT) ? 0 : 1; +#elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) + if (fd < 0) return -1; + LZO_UNUSED(binary); + return 1; +#elif (LZO_OS_DOS32 && LZO_CC_HIGHC) + FILE* fp; int r; + if (fd == fileno(stdin)) fp = stdin; + else if (fd == fileno(stdout)) fp = stdout; + else if (fd == fileno(stderr)) fp = stderr; + else return -1; + r = _setmode(fp, binary ? _BINARY : _TEXT); + if (r == -1) return -1; + return (r & _BINARY) ? 1 : 0; +#elif (LZO_OS_WIN32 && LZO_CC_MWERKS) && defined(__MSL__) + LZO_UNUSED(fd); LZO_UNUSED(binary); + return -1; +#elif (LZO_OS_CYGWIN && (LZO_CC_GNUC < 0x025a00ul)) + LZO_UNUSED(fd); LZO_UNUSED(binary); + return -1; +#elif (LZO_OS_CYGWIN || LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_EMX || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) + int r; +#if !(LZO_CC_ZORTECHC) + LZO_COMPILE_TIME_ASSERT(O_BINARY > 0) +#endif + LZO_COMPILE_TIME_ASSERT(O_TEXT > 0) + if (fd < 0) return -1; + r = setmode(fd, binary ? O_BINARY : O_TEXT); + if (r == -1) return -1; + return (r & O_TEXT) ? 0 : 1; +#else + if (fd < 0) return -1; + LZO_UNUSED(binary); + return 1; +#endif +} +LZOLIB_PUBLIC(int, lzo_isatty) (int fd) +{ + if (fd < 0) + return 0; +#if (LZO_OS_DOS16 && !(LZO_CC_AZTECC)) + { + union REGS ri, ro; + ri.x.ax = 0x4400; ri.x.bx = fd; + int86(0x21, &ri, &ro); + if ((ro.x.cflag & 1) == 0) + if ((ro.x.ax & 0x83) != 0x83) + return 0; + } +#elif (LZO_OS_DOS32 && LZO_CC_WATCOMC) + { + union REGS ri, ro; + ri.w.ax = 0x4400; ri.w.bx = LZO_STATIC_CAST(unsigned short, fd); + int386(0x21, &ri, &ro); + if ((ro.w.cflag & 1) == 0) + if ((ro.w.ax & 0x83) != 0x83) + return 0; + } +#elif (LZO_HAVE_WINDOWS_H) + { + lzo_intptr_t h = __LZOLIB_FUNCNAME(lzo_get_osfhandle)(fd); + LZO_COMPILE_TIME_ASSERT(sizeof(h) == sizeof(HANDLE)) + if (h != -1) + { + DWORD d = 0; + if (GetConsoleMode(LZO_REINTERPRET_CAST(HANDLE, h), &d) == 0) + return 0; + } + } +#endif +#if (HAVE_ISATTY) + return (isatty(fd)) ? 1 : 0; +#else + return 0; +#endif +} +LZOLIB_PUBLIC(int, lzo_mkdir) (const char* name, unsigned mode) +{ +#if !(HAVE_MKDIR) + LZO_UNUSED(name); LZO_UNUSED(mode); + return -1; +#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) + LZO_UNUSED(mode); + return Dcreate(name); +#elif (LZO_OS_DOS32 && LZO_CC_GNUC) && defined(__DJGPP__) + return mkdir(name, mode); +#elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) + return mkdir(name, mode); +#elif ((LZO_OS_DOS16 || LZO_OS_DOS32) && (LZO_CC_HIGHC || LZO_CC_PACIFICC)) + LZO_UNUSED(mode); + return mkdir(LZO_UNCONST_CAST(char *, name)); +#elif (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) + LZO_UNUSED(mode); + return mkdir(name); +#elif (LZO_CC_WATCOMC) + return mkdir(name, LZO_STATIC_CAST(mode_t, mode)); +#else + return mkdir(name, mode); +#endif +} +LZOLIB_PUBLIC(int, lzo_rmdir) (const char* name) +{ +#if !(HAVE_RMDIR) + LZO_UNUSED(name); + return -1; +#elif ((LZO_OS_DOS16 || LZO_OS_DOS32) && (LZO_CC_HIGHC || LZO_CC_PACIFICC)) + return rmdir(LZO_UNCONST_CAST(char *, name)); +#else + return rmdir(name); +#endif +} +#if defined(lzo_int32e_t) +LZOLIB_PUBLIC(lzo_int32e_t, lzo_muldiv32s) (lzo_int32e_t a, lzo_int32e_t b, lzo_int32e_t x) +{ + lzo_int32e_t r = 0; + if __lzo_likely(x != 0) + { +#if defined(lzo_int64l_t) + lzo_int64l_t rr = (LZO_ICONV(lzo_int64l_t, a) * b) / x; + r = LZO_ITRUNC(lzo_int32e_t, rr); +#else + LZO_UNUSED(a); LZO_UNUSED(b); +#endif + } + return r; +} +LZOLIB_PUBLIC(lzo_uint32e_t, lzo_muldiv32u) (lzo_uint32e_t a, lzo_uint32e_t b, lzo_uint32e_t x) +{ + lzo_uint32e_t r = 0; + if __lzo_likely(x != 0) + { +#if defined(lzo_int64l_t) + lzo_uint64l_t rr = (LZO_ICONV(lzo_uint64l_t, a) * b) / x; + r = LZO_ITRUNC(lzo_uint32e_t, rr); +#else + LZO_UNUSED(a); LZO_UNUSED(b); +#endif + } + return r; +} +#endif +#if (LZO_OS_WIN16) +LZO_EXTERN_C void __far __pascal DebugBreak(void); +#endif +LZOLIB_PUBLIC_NOINLINE(void, lzo_debug_break) (void) +{ +#if (LZO_OS_WIN16) + DebugBreak(); +#elif (LZO_ARCH_I086) +#elif (LZO_OS_WIN64) && (LZO_HAVE_WINDOWS_H) + DebugBreak(); +#elif (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC) + __asm__ __volatile__("int $3\n" : : __LZO_ASM_CLOBBER_LIST_CC_MEMORY); +#elif (LZO_ARCH_I386) && (LZO_ASM_SYNTAX_MSC) + __asm { int 3 } +#elif (LZO_OS_WIN32) && (LZO_HAVE_WINDOWS_H) + DebugBreak(); +#else + volatile lzo_intptr_t a = -1; + * LZO_STATIC_CAST(volatile unsigned long *, LZO_REINTERPRET_CAST(volatile void *, a)) = ~0ul; +#endif +} +LZOLIB_PUBLIC_NOINLINE(void, lzo_debug_nop) (void) +{ +} +LZOLIB_PUBLIC_NOINLINE(int, lzo_debug_align_check_query) (void) +{ +#if (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC) +# if (LZO_ARCH_AMD64) + lzo_uint64e_t r = 0; +# else + size_t r = 0; +# endif + __asm__ __volatile__("pushf\n pop %0\n" : "=a" (r) : __LZO_ASM_CLOBBER_LIST_CC_MEMORY); + return LZO_ICONV(int, (r >> 18) & 1); +#elif (LZO_ARCH_I386) && (LZO_ASM_SYNTAX_MSC) + unsigned long r; + __asm { + pushf + pop eax + mov r,eax + } + return LZO_ICONV(int, (r >> 18) & 1); +#else + return -1; +#endif +} +LZOLIB_PUBLIC_NOINLINE(int, lzo_debug_align_check_enable) (int v) +{ +#if (LZO_ARCH_AMD64) && (LZO_ASM_SYNTAX_GNUC) + if (v) { + __asm__ __volatile__("pushf\n orl $262144,(%%rsp)\n popf\n" : : __LZO_ASM_CLOBBER_LIST_CC_MEMORY); + } else { + __asm__ __volatile__("pushf\n andl $-262145,(%%rsp)\n popf\n" : : __LZO_ASM_CLOBBER_LIST_CC_MEMORY); + } + return 0; +#elif (LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC) + if (v) { + __asm__ __volatile__("pushf\n orl $262144,(%%esp)\n popf\n" : : __LZO_ASM_CLOBBER_LIST_CC_MEMORY); + } else { + __asm__ __volatile__("pushf\n andl $-262145,(%%esp)\n popf\n" : : __LZO_ASM_CLOBBER_LIST_CC_MEMORY); + } + return 0; +#elif (LZO_ARCH_I386) && (LZO_ASM_SYNTAX_MSC) + if (v) { __asm { + pushf + or dword ptr [esp],262144 + popf + }} else { __asm { + pushf + and dword ptr [esp],-262145 + popf + }} + return 0; +#else + LZO_UNUSED(v); return -1; +#endif +} +LZOLIB_PUBLIC_NOINLINE(unsigned, lzo_debug_running_on_qemu) (void) +{ + unsigned r = 0; +#if (LZO_OS_POSIX_LINUX || LZO_OS_WIN32 || LZO_OS_WIN64) + const char* p; + p = __LZOLIB_FUNCNAME(lzo_getenv)(LZO_PP_STRINGIZE(LZO_ENV_RUNNING_ON_QEMU)); + if (p) { + if (p[0] == 0) r = 0; + else if ((p[0] >= '0' && p[0] <= '9') && p[1] == 0) r = LZO_ICAST(unsigned, p[0]) - '0'; + else r = 1; + } +#endif + return r; +} +LZOLIB_PUBLIC_NOINLINE(unsigned, lzo_debug_running_on_valgrind) (void) +{ +#if (LZO_ARCH_AMD64 && LZO_ABI_ILP32) + return 0; +#elif (LZO_ARCH_AMD64 || LZO_ARCH_I386) && (LZO_ASM_SYNTAX_GNUC) + volatile size_t a[6]; + size_t r = 0; + a[0] = 0x1001; a[1] = 0; a[2] = 0; a[3] = 0; a[4] = 0; a[5] = 0; +# if (LZO_ARCH_AMD64) + __asm__ __volatile__(".byte 0x48,0xc1,0xc7,0x03,0x48,0xc1,0xc7,0x0d,0x48,0xc1,0xc7,0x3d,0x48,0xc1,0xc7,0x33,0x48,0x87,0xdb\n" : "=d" (r) : "a" (&a[0]), "d" (r) __LZO_ASM_CLOBBER_LIST_CC_MEMORY); +# elif (LZO_ARCH_I386) + __asm__ __volatile__(".byte 0xc1,0xc7,0x03,0xc1,0xc7,0x0d,0xc1,0xc7,0x1d,0xc1,0xc7,0x13,0x87,0xdb\n" : "=d" (r) : "a" (&a[0]), "d" (r) __LZO_ASM_CLOBBER_LIST_CC_MEMORY); +# endif + return LZO_ITRUNC(unsigned, r); +#else + return 0; +#endif +} +#if (LZO_OS_WIN32 && LZO_CC_PELLESC && (__POCC__ >= 290)) +# pragma warn(pop) +#endif +#endif +#if defined(LZO_WANT_ACCLIB_WILDARGV) +# undef LZO_WANT_ACCLIB_WILDARGV +#define __LZOLIB_WILDARGV_CH_INCLUDED 1 +#if !defined(LZOLIB_PUBLIC) +# define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) +#endif +#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) +#if 0 && (LZO_CC_MSC) +LZO_EXTERN_C int __lzo_cdecl __setargv(void); +LZO_EXTERN_C int __lzo_cdecl _setargv(void); +LZO_EXTERN_C int __lzo_cdecl _setargv(void) { return __setargv(); } +#endif +#endif +#if (LZO_OS_WIN32 || LZO_OS_WIN64) +#if (LZO_CC_MSC && (_MSC_VER >= 1900)) +#elif (LZO_CC_INTELC || LZO_CC_MSC) +LZO_EXTERN_C int __lzo_cdecl __setargv(void); +LZO_EXTERN_C int __lzo_cdecl _setargv(void); +LZO_EXTERN_C int __lzo_cdecl _setargv(void) { return __setargv(); } +#endif +#endif +#if (LZO_OS_EMX) +#define __LZOLIB_HAVE_LZO_WILDARGV 1 +LZOLIB_PUBLIC(void, lzo_wildargv) (int* argc, char*** argv) +{ + if (argc && argv) { + _response(argc, argv); + _wildcard(argc, argv); + } +} +#endif +#if (LZO_OS_CONSOLE_PSP) && defined(__PSPSDK_DEBUG__) +#define __LZOLIB_HAVE_LZO_WILDARGV 1 +LZO_EXTERN_C int lzo_psp_init_module(int*, char***, int); +LZOLIB_PUBLIC(void, lzo_wildargv) (int* argc, char*** argv) +{ + lzo_psp_init_module(argc, argv, -1); +} +#endif +#if !(__LZOLIB_HAVE_LZO_WILDARGV) +#define __LZOLIB_HAVE_LZO_WILDARGV 1 +LZOLIB_PUBLIC(void, lzo_wildargv) (int* argc, char*** argv) +{ +#if 1 && (LZO_ARCH_I086PM) + if (LZO_MM_AHSHIFT != 3) { exit(1); } +#elif 1 && (LZO_ARCH_M68K && LZO_OS_TOS && LZO_CC_GNUC) && defined(__MINT__) + __binmode(1); + if (isatty(1)) __set_binmode(stdout, 0); + if (isatty(2)) __set_binmode(stderr, 0); +#endif + LZO_UNUSED(argc); LZO_UNUSED(argv); +} +#endif +#endif + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzo_swd.ch b/tools/z64compress/src/enc/lzo/lzo_swd.ch new file mode 100644 index 000000000..20bc46175 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzo_swd.ch @@ -0,0 +1,700 @@ +/* lzo_swd.ch -- sliding window dictionary + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +#if (LZO_UINT_MAX < LZO_0xffffffffL) +# error "LZO_UINT_MAX" +#endif +#if defined(LZO_DEBUG) +# include +#endif +#if defined(__LZO_CHECKER) +# include +#endif + + +/*********************************************************************** +// +************************************************************************/ + +/* unsigned type for dictionary access - don't waste memory here */ +#if (0UL + SWD_N + SWD_F + SWD_F < 65535UL) + typedef lzo_uint16_t swd_uint; +# define SWD_UINT_MAX 0xffffu +#else + typedef lzo_uint32_t swd_uint; +# define SWD_UINT_MAX 0xffffffffu +#endif +#define swd_uintp swd_uint * +#define SWD_UINT(x) ((swd_uint)(x)) + + +#ifndef SWD_HSIZE +# define SWD_HSIZE 16384 +#endif +#ifndef SWD_MAX_CHAIN +# define SWD_MAX_CHAIN 2048 +#endif + +#if !defined(HEAD3) +#if 1 +# define HEAD3(b,p) \ + ((DMUL(0x9f5f,(((((lzo_xint)b[p]<<5)^b[p+1])<<5)^b[p+2]))>>5) & (SWD_HSIZE-1)) +#else +# define HEAD3(b,p) \ + ((DMUL(0x9f5f,(((((lzo_xint)b[p+2]<<5)^b[p+1])<<5)^b[p]))>>5) & (SWD_HSIZE-1)) +#endif +#endif + +#if !(SWD_NO_HEAD2) && (SWD_THRESHOLD == 1) && !defined(HEAD2) +# if 1 && (LZO_OPT_UNALIGNED16) +# define HEAD2(b,p) UA_GET_NE16((b)+(p)) +# else +# define HEAD2(b,p) (b[p] ^ ((unsigned)b[(p)+1]<<8)) +# endif +# define NIL2 SWD_UINT_MAX +#endif +#ifndef IF_HEAD2 +#define IF_HEAD2(s) /*empty*/ +#endif + + +typedef struct +{ +/* public - "built-in" */ + lzo_uint swd_n; + lzo_uint swd_f; + lzo_uint swd_threshold; + +/* public - configuration */ + lzo_uint max_chain; + lzo_uint nice_length; + lzo_bool use_best_off; + lzo_uint lazy_insert; + +/* public - output */ + lzo_uint m_len; + lzo_uint m_off; + lzo_uint look; + int b_char; +#if defined(SWD_BEST_OFF) + lzo_uint best_off[ SWD_BEST_OFF ]; +#endif + +/* semi public */ + LZO_COMPRESS_T *c; + lzo_uint m_pos; +#if defined(SWD_BEST_OFF) + lzo_uint best_pos[ SWD_BEST_OFF ]; +#endif + +/* private */ + const lzo_bytep dict; + const lzo_bytep dict_end; + lzo_uint dict_len; + +/* private */ + lzo_uint ip; /* input pointer (lookahead) */ + lzo_uint bp; /* buffer pointer */ + lzo_uint rp; /* remove pointer */ + lzo_uint b_size; + + lzo_bytep b_wrap; + + lzo_uint node_count; + lzo_uint first_rp; + +#if defined(__LZO_CHECKER) + /* malloc arrays of the exact size to detect any overrun */ + unsigned char *b; + swd_uint *head3; + swd_uint *succ3; + swd_uint *best3; + swd_uint *llen3; +# ifdef HEAD2 + swd_uint *head2; +# endif + +#else + unsigned char b [ SWD_N + SWD_F + SWD_F ]; + swd_uint head3 [ SWD_HSIZE ]; + swd_uint succ3 [ SWD_N + SWD_F ]; + swd_uint best3 [ SWD_N + SWD_F ]; + swd_uint llen3 [ SWD_HSIZE ]; +# ifdef HEAD2 + swd_uint head2 [ 65536L ]; +# endif +#endif +} +lzo_swd_t; +#define lzo_swd_p lzo_swd_t * + + +#define s_b(s) s->b +#define s_head3(s) s->head3 +#define s_succ3(s) s->succ3 +#define s_best3(s) s->best3 +#define s_llen3(s) s->llen3 +#ifdef HEAD2 +#define s_head2(s) s->head2 +#endif +#define SIZEOF_LZO_SWD_T (sizeof(lzo_swd_t)) + + +/* Access macro for head3. + * head3[key] may be uninitialized if the list is emtpy, + * but then its value will never be used. + */ +#if 1 || defined(__LZO_CHECKER) +# define s_get_head3(s,key) \ + ((swd_uint)((s_llen3(s)[key] == 0) ? SWD_UINT_MAX : s_head3(s)[key])) +#else +# define s_get_head3(s,key) (s_head3(s)[key]) +#endif + + +/*********************************************************************** +// +************************************************************************/ + +static +void swd_initdict(lzo_swd_p s, const lzo_bytep dict, lzo_uint dict_len) +{ + s->dict = s->dict_end = NULL; + s->dict_len = 0; + + if (!dict || dict_len == 0) + return; + if (dict_len > s->swd_n) + { + dict += dict_len - s->swd_n; + dict_len = s->swd_n; + } + + s->dict = dict; + s->dict_len = dict_len; + s->dict_end = dict + dict_len; + lzo_memcpy(s_b(s),dict,dict_len); + s->ip = dict_len; +} + + +static +void swd_insertdict(lzo_swd_p s, lzo_uint node, lzo_uint len) +{ + lzo_uint key; + + s->node_count = s->swd_n - len; + s->first_rp = node; + + if (len) do + { + key = HEAD3(s_b(s),node); + s_succ3(s)[node] = s_get_head3(s,key); + s_head3(s)[key] = SWD_UINT(node); + s_best3(s)[node] = SWD_UINT(s->swd_f + 1); + s_llen3(s)[key]++; + assert(s_llen3(s)[key] <= s->swd_n); + +#ifdef HEAD2 + IF_HEAD2(s) { + key = HEAD2(s_b(s),node); + s_head2(s)[key] = SWD_UINT(node); + } +#endif + + node++; + } + while (--len != 0); +} + + +/*********************************************************************** +// +************************************************************************/ + +static void swd_exit(lzo_swd_p s); + +static +int swd_init(lzo_swd_p s, const lzo_bytep dict, lzo_uint dict_len) +{ +#if defined(__LZO_CHECKER) + unsigned r = 1; + s->b = (lzo_bytep) malloc(SWD_N + SWD_F + SWD_F); + s->head3 = (swd_uintp) malloc(sizeof(swd_uint) * SWD_HSIZE); + s->succ3 = (swd_uintp) malloc(sizeof(swd_uint) * (SWD_N + SWD_F)); + s->best3 = (swd_uintp) malloc(sizeof(swd_uint) * (SWD_N + SWD_F)); + s->llen3 = (swd_uintp) malloc(sizeof(swd_uint) * SWD_HSIZE); + r &= s->b != NULL; + r &= s->head3 != NULL; + r &= s->succ3 != NULL; + r &= s->best3 != NULL; + r &= s->llen3 != NULL; +#ifdef HEAD2 + IF_HEAD2(s) { + s->head2 = (swd_uintp) malloc(sizeof(swd_uint) * 65536L); + r &= s->head2 != NULL; + } +#endif + if (r != 1) { + swd_exit(s); + return LZO_E_OUT_OF_MEMORY; + } +#endif + + s->m_len = 0; + s->m_off = 0; +#if defined(SWD_BEST_OFF) + { + unsigned i; + for (i = 0; i < SWD_BEST_OFF; i++) + s->best_off[i] = s->best_pos[i] = 0; + } +#endif + + s->swd_n = SWD_N; + s->swd_f = SWD_F; + s->swd_threshold = SWD_THRESHOLD; + + /* defaults */ + s->max_chain = SWD_MAX_CHAIN; + s->nice_length = s->swd_f; + s->use_best_off = 0; + s->lazy_insert = 0; + + s->b_size = s->swd_n + s->swd_f; +#if 0 + if (2 * s->swd_f >= s->swd_n || s->b_size + s->swd_f >= SWD_UINT_MAX) + return LZO_E_ERROR; +#else + LZO_COMPILE_TIME_ASSERT(!(0ul + 2 * SWD_F >= SWD_N)) + LZO_COMPILE_TIME_ASSERT(!(0ul + SWD_N + SWD_F + SWD_F >= SWD_UINT_MAX)) +#endif + s->b_wrap = s_b(s) + s->b_size; + s->node_count = s->swd_n; + + lzo_memset(s_llen3(s), 0, (lzo_uint)sizeof(s_llen3(s)[0]) * (lzo_uint)SWD_HSIZE); +#ifdef HEAD2 + IF_HEAD2(s) { +#if 1 + lzo_memset(s_head2(s), 0xff, (lzo_uint)sizeof(s_head2(s)[0]) * 65536L); + assert(s_head2(s)[0] == NIL2); +#else + lzo_xint i; + for (i = 0; i < 65536L; i++) + s_head2(s)[i] = NIL2; +#endif + } +#endif + + s->ip = 0; + swd_initdict(s,dict,dict_len); + s->bp = s->ip; + s->first_rp = s->ip; + + assert(s->ip + s->swd_f <= s->b_size); +#if 1 + s->look = (lzo_uint) (s->c->in_end - s->c->ip); + if (s->look > 0) + { + if (s->look > s->swd_f) + s->look = s->swd_f; + lzo_memcpy(&s_b(s)[s->ip],s->c->ip,s->look); + s->c->ip += s->look; + s->ip += s->look; + } +#else + s->look = 0; + while (s->look < s->swd_f) + { + int c; + if ((c = getbyte(*(s->c))) < 0) + break; + s_b(s)[s->ip] = LZO_BYTE(c); + s->ip++; + s->look++; + } +#endif + if (s->ip == s->b_size) + s->ip = 0; + + if (s->look >= 2 && s->dict_len > 0) + swd_insertdict(s,0,s->dict_len); + + s->rp = s->first_rp; + if (s->rp >= s->node_count) + s->rp -= s->node_count; + else + s->rp += s->b_size - s->node_count; + +#if 1 || defined(__LZO_CHECKER) + /* initialize memory for the first few HEAD3 (if s->ip is not far + * enough ahead to do this job for us). The value doesn't matter. */ + if (s->look < 3) { + lzo_bytep p = &s_b(s)[s->bp+s->look]; + p[0] = p[1] = p[2] = 0; + } +#endif + + return LZO_E_OK; +} + + +static +void swd_exit(lzo_swd_p s) +{ +#if defined(__LZO_CHECKER) + /* free in reverse order of allocations */ +#ifdef HEAD2 + free(s->head2); s->head2 = NULL; +#endif + free(s->llen3); s->llen3 = NULL; + free(s->best3); s->best3 = NULL; + free(s->succ3); s->succ3 = NULL; + free(s->head3); s->head3 = NULL; + free(s->b); s->b = NULL; +#else + LZO_UNUSED(s); +#endif +} + + +#define swd_pos2off(s,pos) \ + (s->bp > (pos) ? s->bp - (pos) : s->b_size - ((pos) - s->bp)) + + +/*********************************************************************** +// +************************************************************************/ + +static __lzo_inline +void swd_getbyte(lzo_swd_p s) +{ + int c; + + if ((c = getbyte(*(s->c))) < 0) + { + if (s->look > 0) + --s->look; +#if 1 || defined(__LZO_CHECKER) + /* initialize memory - value doesn't matter */ + s_b(s)[s->ip] = 0; + if (s->ip < s->swd_f) + s->b_wrap[s->ip] = 0; +#endif + } + else + { + s_b(s)[s->ip] = LZO_BYTE(c); + if (s->ip < s->swd_f) + s->b_wrap[s->ip] = LZO_BYTE(c); + } + if (++s->ip == s->b_size) + s->ip = 0; + if (++s->bp == s->b_size) + s->bp = 0; + if (++s->rp == s->b_size) + s->rp = 0; +} + + +/*********************************************************************** +// remove node from lists +************************************************************************/ + +static __lzo_inline +void swd_remove_node(lzo_swd_p s, lzo_uint node) +{ + if (s->node_count == 0) + { + lzo_uint key; + +#ifdef LZO_DEBUG + if (s->first_rp != LZO_UINT_MAX) + { + if (node != s->first_rp) + printf("Remove %5ld: %5ld %5ld %5ld %5ld %6ld %6ld\n", + (long)node, (long)s->rp, (long)s->ip, (long)s->bp, + (long)s->first_rp, (long)(s->ip - node), + (long)(s->ip - s->bp)); + assert(node == s->first_rp); + s->first_rp = LZO_UINT_MAX; + } +#endif + + key = HEAD3(s_b(s),node); + assert(s_llen3(s)[key] > 0); + --s_llen3(s)[key]; + +#ifdef HEAD2 + IF_HEAD2(s) { + key = HEAD2(s_b(s),node); + assert(s_head2(s)[key] != NIL2); + if ((lzo_uint) s_head2(s)[key] == node) + s_head2(s)[key] = NIL2; + } +#endif + } + else + --s->node_count; +} + + +/*********************************************************************** +// +************************************************************************/ + +static +void swd_accept(lzo_swd_p s, lzo_uint n) +{ + assert(n <= s->look); + + if (n) do + { + lzo_uint key; + + swd_remove_node(s,s->rp); + + /* add bp into HEAD3 */ + key = HEAD3(s_b(s),s->bp); + s_succ3(s)[s->bp] = s_get_head3(s,key); + s_head3(s)[key] = SWD_UINT(s->bp); + s_best3(s)[s->bp] = SWD_UINT(s->swd_f + 1); + s_llen3(s)[key]++; + assert(s_llen3(s)[key] <= s->swd_n); + +#ifdef HEAD2 + /* add bp into HEAD2 */ + IF_HEAD2(s) { + key = HEAD2(s_b(s),s->bp); + s_head2(s)[key] = SWD_UINT(s->bp); + } +#endif + + swd_getbyte(s); + } while (--n != 0); +} + + +/*********************************************************************** +// +************************************************************************/ + +static +void swd_search(lzo_swd_p s, lzo_uint node, lzo_uint cnt) +{ + const lzo_bytep p1; + const lzo_bytep p2; + const lzo_bytep px; + lzo_uint m_len = s->m_len; + const lzo_bytep b = s_b(s); + const lzo_bytep bp = s_b(s) + s->bp; + const lzo_bytep bx = s_b(s) + s->bp + s->look; + swd_uintp succ3 = s_succ3(s); + unsigned char scan_end1; + + assert(s->m_len > 0); + + scan_end1 = bp[m_len - 1]; + for ( ; cnt-- > 0; node = succ3[node]) + { + p1 = bp; + p2 = b + node; + px = bx; + + assert(m_len < s->look); + + if ( +#if 1 + p2[m_len - 1] == scan_end1 && + p2[m_len] == p1[m_len] && +#endif + p2[0] == p1[0] && + p2[1] == p1[1]) + { + lzo_uint i; + assert(lzo_memcmp(bp,&b[node],3) == 0); + +#if 0 && (LZO_OPT_UNALIGNED32) + p1 += 3; p2 += 3; + while (p1 + 4 <= px && UA_GET_NE32(p1) == UA_GET_NE32(p2)) + p1 += 4, p2 += 4; + while (p1 < px && *p1 == *p2) + p1 += 1, p2 += 1; +#else + p1 += 2; p2 += 2; + do {} while (++p1 < px && *p1 == *++p2); +#endif + i = pd(p1, bp); + +#ifdef LZO_DEBUG + if (lzo_memcmp(bp,&b[node],i) != 0) + printf("%5ld %5ld %5ld %02x/%02x %02x/%02x\n", + (long)s->bp, (long) node, (long) i, + bp[0], bp[1], b[node], b[node+1]); +#endif + assert(lzo_memcmp(bp,&b[node],i) == 0); + +#if defined(SWD_BEST_OFF) + if (i < SWD_BEST_OFF) + { + if (s->best_pos[i] == 0) + s->best_pos[i] = node + 1; + } +#endif + if (i > m_len) + { + s->m_len = m_len = i; + s->m_pos = node; + if (m_len == s->look) + return; + if (m_len >= s->nice_length) + return; + if (m_len > (lzo_uint) s_best3(s)[node]) + return; + scan_end1 = bp[m_len - 1]; + } + } + } +} + + +/*********************************************************************** +// +************************************************************************/ + +#ifdef HEAD2 + +static +lzo_bool swd_search2(lzo_swd_p s) +{ + lzo_uint key; + + assert(s->look >= 2); + assert(s->m_len > 0); + + key = s_head2(s)[ HEAD2(s_b(s),s->bp) ]; + if (key == NIL2) + return 0; +#ifdef LZO_DEBUG + if (lzo_memcmp(&s_b(s)[s->bp],&s_b(s)[key],2) != 0) + printf("%5ld %5ld %02x/%02x %02x/%02x\n", (long)s->bp, (long)key, + s_b(s)[s->bp], s_b(s)[s->bp+1], s_b(s)[key], s_b(s)[key+1]); +#endif + assert(lzo_memcmp(&s_b(s)[s->bp],&s_b(s)[key],2) == 0); +#if defined(SWD_BEST_OFF) + if (s->best_pos[2] == 0) + s->best_pos[2] = key + 1; +#endif + + if (s->m_len < 2) + { + s->m_len = 2; + s->m_pos = key; + } + return 1; +} + +#endif + + +/*********************************************************************** +// +************************************************************************/ + +static +void swd_findbest(lzo_swd_p s) +{ + lzo_uint key; + lzo_uint cnt, node; + lzo_uint len; + + assert(s->m_len > 0); + + /* get current head, add bp into HEAD3 */ + key = HEAD3(s_b(s),s->bp); + node = s_succ3(s)[s->bp] = s_get_head3(s,key); + cnt = s_llen3(s)[key]++; + assert(s_llen3(s)[key] <= s->swd_n + s->swd_f); + if (cnt > s->max_chain && s->max_chain > 0) + cnt = s->max_chain; + s_head3(s)[key] = SWD_UINT(s->bp); + + s->b_char = s_b(s)[s->bp]; + len = s->m_len; + if (s->m_len >= s->look) + { + if (s->look == 0) + s->b_char = -1; + s->m_off = 0; + s_best3(s)[s->bp] = SWD_UINT(s->swd_f + 1); + } + else + { +#if defined(HEAD2) + if (swd_search2(s) && s->look >= 3) + swd_search(s,node,cnt); +#else + if (s->look >= 3) + swd_search(s,node,cnt); +#endif + if (s->m_len > len) + s->m_off = swd_pos2off(s,s->m_pos); + s_best3(s)[s->bp] = SWD_UINT(s->m_len); + +#if defined(SWD_BEST_OFF) + if (s->use_best_off) + { + unsigned i; + for (i = 2; i < SWD_BEST_OFF; i++) + if (s->best_pos[i] > 0) + s->best_off[i] = swd_pos2off(s,s->best_pos[i]-1); + else + s->best_off[i] = 0; + } +#endif + } + + swd_remove_node(s,s->rp); + +#ifdef HEAD2 + /* add bp into HEAD2 */ + IF_HEAD2(s) { + key = HEAD2(s_b(s),s->bp); + s_head2(s)[key] = SWD_UINT(s->bp); + } +#endif +} + + +#undef HEAD3 +#undef HEAD2 +#undef IF_HEAD2 +#undef s_get_head3 + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzoconf.h b/tools/z64compress/src/enc/lzo/lzoconf.h new file mode 100644 index 000000000..1a1dd98c2 --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzoconf.h @@ -0,0 +1,453 @@ +/* lzoconf.h -- configuration of the LZO data compression library + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +#ifndef __LZOCONF_H_INCLUDED +#define __LZOCONF_H_INCLUDED 1 + +#define LZO_VERSION 0x20a0 /* 2.10 */ +#define LZO_VERSION_STRING "2.10" +#define LZO_VERSION_DATE "Mar 01 2017" + +/* internal Autoconf configuration file - only used when building LZO */ +#if defined(LZO_HAVE_CONFIG_H) +# include +#endif +#include +#include + + +/*********************************************************************** +// LZO requires a conforming +************************************************************************/ + +#if !defined(CHAR_BIT) || (CHAR_BIT != 8) +# error "invalid CHAR_BIT" +#endif +#if !defined(UCHAR_MAX) || !defined(USHRT_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) +# error "check your compiler installation" +#endif +#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1) +# error "your limits.h macros are broken" +#endif + +/* get OS and architecture defines */ +#ifndef __LZODEFS_H_INCLUDED +#include "lzodefs.h" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +/*********************************************************************** +// some core defines +************************************************************************/ + +/* memory checkers */ +#if !defined(__LZO_CHECKER) +# if defined(__BOUNDS_CHECKING_ON) +# define __LZO_CHECKER 1 +# elif defined(__CHECKER__) +# define __LZO_CHECKER 1 +# elif defined(__INSURE__) +# define __LZO_CHECKER 1 +# elif defined(__PURIFY__) +# define __LZO_CHECKER 1 +# endif +#endif + + +/*********************************************************************** +// integral and pointer types +************************************************************************/ + +/* lzo_uint must match size_t */ +#if !defined(LZO_UINT_MAX) +# if (LZO_ABI_LLP64) +# if (LZO_OS_WIN64) + typedef unsigned __int64 lzo_uint; + typedef __int64 lzo_int; +# define LZO_TYPEOF_LZO_INT LZO_TYPEOF___INT64 +# else + typedef lzo_ullong_t lzo_uint; + typedef lzo_llong_t lzo_int; +# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG_LONG +# endif +# define LZO_SIZEOF_LZO_INT 8 +# define LZO_UINT_MAX 0xffffffffffffffffull +# define LZO_INT_MAX 9223372036854775807LL +# define LZO_INT_MIN (-1LL - LZO_INT_MAX) +# elif (LZO_ABI_IP32L64) /* MIPS R5900 */ + typedef unsigned int lzo_uint; + typedef int lzo_int; +# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_INT +# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_INT +# define LZO_UINT_MAX UINT_MAX +# define LZO_INT_MAX INT_MAX +# define LZO_INT_MIN INT_MIN +# elif (ULONG_MAX >= LZO_0xffffffffL) + typedef unsigned long lzo_uint; + typedef long lzo_int; +# define LZO_SIZEOF_LZO_INT LZO_SIZEOF_LONG +# define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG +# define LZO_UINT_MAX ULONG_MAX +# define LZO_INT_MAX LONG_MAX +# define LZO_INT_MIN LONG_MIN +# else +# error "lzo_uint" +# endif +#endif + +/* The larger type of lzo_uint and lzo_uint32_t. */ +#if (LZO_SIZEOF_LZO_INT >= 4) +# define lzo_xint lzo_uint +#else +# define lzo_xint lzo_uint32_t +#endif + +typedef int lzo_bool; + +/* sanity checks */ +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int) == LZO_SIZEOF_LZO_INT) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == LZO_SIZEOF_LZO_INT) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint)) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint32_t)) + +#ifndef __LZO_MMODEL +#define __LZO_MMODEL /*empty*/ +#endif + +/* no typedef here because of const-pointer issues */ +#define lzo_bytep unsigned char __LZO_MMODEL * +#define lzo_charp char __LZO_MMODEL * +#define lzo_voidp void __LZO_MMODEL * +#define lzo_shortp short __LZO_MMODEL * +#define lzo_ushortp unsigned short __LZO_MMODEL * +#define lzo_intp lzo_int __LZO_MMODEL * +#define lzo_uintp lzo_uint __LZO_MMODEL * +#define lzo_xintp lzo_xint __LZO_MMODEL * +#define lzo_voidpp lzo_voidp __LZO_MMODEL * +#define lzo_bytepp lzo_bytep __LZO_MMODEL * + +#define lzo_int8_tp lzo_int8_t __LZO_MMODEL * +#define lzo_uint8_tp lzo_uint8_t __LZO_MMODEL * +#define lzo_int16_tp lzo_int16_t __LZO_MMODEL * +#define lzo_uint16_tp lzo_uint16_t __LZO_MMODEL * +#define lzo_int32_tp lzo_int32_t __LZO_MMODEL * +#define lzo_uint32_tp lzo_uint32_t __LZO_MMODEL * +#if defined(lzo_int64_t) +#define lzo_int64_tp lzo_int64_t __LZO_MMODEL * +#define lzo_uint64_tp lzo_uint64_t __LZO_MMODEL * +#endif + +/* Older LZO versions used to support ancient systems and memory models + * such as 16-bit MSDOS with __huge pointers or Cray PVP, but these + * obsolete configurations are not supported any longer. + */ +#if defined(__LZO_MMODEL_HUGE) +#error "__LZO_MMODEL_HUGE memory model is unsupported" +#endif +#if (LZO_MM_PVP) +#error "LZO_MM_PVP memory model is unsupported" +#endif +#if (LZO_SIZEOF_INT < 4) +#error "LZO_SIZEOF_INT < 4 is unsupported" +#endif +#if (__LZO_UINTPTR_T_IS_POINTER) +#error "__LZO_UINTPTR_T_IS_POINTER is unsupported" +#endif +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) >= 4) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) >= 4) +/* Strange configurations where sizeof(lzo_uint) != sizeof(size_t) should + * work but have not received much testing lately, so be strict here. + */ +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(size_t)) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(ptrdiff_t)) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(lzo_uintptr_t)) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_uintptr_t)) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_uintptr_t)) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long *) == sizeof(lzo_uintptr_t)) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_voidp)) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_bytep)) + + +/*********************************************************************** +// function types +************************************************************************/ + +/* name mangling */ +#if !defined(__LZO_EXTERN_C) +# ifdef __cplusplus +# define __LZO_EXTERN_C extern "C" +# else +# define __LZO_EXTERN_C extern +# endif +#endif + +/* calling convention */ +#if !defined(__LZO_CDECL) +# define __LZO_CDECL __lzo_cdecl +#endif + +/* DLL export information */ +#if !defined(__LZO_EXPORT1) +# define __LZO_EXPORT1 /*empty*/ +#endif +#if !defined(__LZO_EXPORT2) +# define __LZO_EXPORT2 /*empty*/ +#endif + +/* __cdecl calling convention for public C and assembly functions */ +#if !defined(LZO_PUBLIC) +# define LZO_PUBLIC(r) __LZO_EXPORT1 r __LZO_EXPORT2 __LZO_CDECL +#endif +#if !defined(LZO_EXTERN) +# define LZO_EXTERN(r) __LZO_EXTERN_C LZO_PUBLIC(r) +#endif +#if !defined(LZO_PRIVATE) +# define LZO_PRIVATE(r) static r __LZO_CDECL +#endif + +/* function types */ +typedef int +(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem ); + +typedef int +(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem ); + +typedef int +(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem ); + +typedef int +(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem, + const lzo_bytep dict, lzo_uint dict_len ); + +typedef int +(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len, + lzo_bytep dst, lzo_uintp dst_len, + lzo_voidp wrkmem, + const lzo_bytep dict, lzo_uint dict_len ); + + +/* Callback interface. Currently only the progress indicator ("nprogress") + * is used, but this may change in a future release. */ + +struct lzo_callback_t; +typedef struct lzo_callback_t lzo_callback_t; +#define lzo_callback_p lzo_callback_t __LZO_MMODEL * + +/* malloc & free function types */ +typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t) + (lzo_callback_p self, lzo_uint items, lzo_uint size); +typedef void (__LZO_CDECL *lzo_free_func_t) + (lzo_callback_p self, lzo_voidp ptr); + +/* a progress indicator callback function */ +typedef void (__LZO_CDECL *lzo_progress_func_t) + (lzo_callback_p, lzo_uint, lzo_uint, int); + +struct lzo_callback_t +{ + /* custom allocators (set to 0 to disable) */ + lzo_alloc_func_t nalloc; /* [not used right now] */ + lzo_free_func_t nfree; /* [not used right now] */ + + /* a progress indicator callback function (set to 0 to disable) */ + lzo_progress_func_t nprogress; + + /* INFO: the first parameter "self" of the nalloc/nfree/nprogress + * callbacks points back to this struct, so you are free to store + * some extra info in the following variables. */ + lzo_voidp user1; + lzo_xint user2; + lzo_xint user3; +}; + + +/*********************************************************************** +// error codes and prototypes +************************************************************************/ + +/* Error codes for the compression/decompression functions. Negative + * values are errors, positive values will be used for special but + * normal events. + */ +#define LZO_E_OK 0 +#define LZO_E_ERROR (-1) +#define LZO_E_OUT_OF_MEMORY (-2) /* [lzo_alloc_func_t failure] */ +#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */ +#define LZO_E_INPUT_OVERRUN (-4) +#define LZO_E_OUTPUT_OVERRUN (-5) +#define LZO_E_LOOKBEHIND_OVERRUN (-6) +#define LZO_E_EOF_NOT_FOUND (-7) +#define LZO_E_INPUT_NOT_CONSUMED (-8) +#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ +#define LZO_E_INVALID_ARGUMENT (-10) +#define LZO_E_INVALID_ALIGNMENT (-11) /* pointer argument is not properly aligned */ +#define LZO_E_OUTPUT_NOT_CONSUMED (-12) +#define LZO_E_INTERNAL_ERROR (-99) + + +#ifndef lzo_sizeof_dict_t +# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep)) +#endif + +/* lzo_init() should be the first function you call. + * Check the return code ! + * + * lzo_init() is a macro to allow checking that the library and the + * compiler's view of various types are consistent. + */ +#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\ + (int)sizeof(long),(int)sizeof(lzo_uint32_t),(int)sizeof(lzo_uint),\ + (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\ + (int)sizeof(lzo_callback_t)) +LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int); + +/* version functions (useful for shared libraries) */ +LZO_EXTERN(unsigned) lzo_version(void); +LZO_EXTERN(const char *) lzo_version_string(void); +LZO_EXTERN(const char *) lzo_version_date(void); +LZO_EXTERN(const lzo_charp) _lzo_version_string(void); +LZO_EXTERN(const lzo_charp) _lzo_version_date(void); + +/* string functions */ +LZO_EXTERN(int) + lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len); +LZO_EXTERN(lzo_voidp) + lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len); +LZO_EXTERN(lzo_voidp) + lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len); +LZO_EXTERN(lzo_voidp) + lzo_memset(lzo_voidp buf, int c, lzo_uint len); + +/* checksum functions */ +LZO_EXTERN(lzo_uint32_t) + lzo_adler32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len); +LZO_EXTERN(lzo_uint32_t) + lzo_crc32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len); +LZO_EXTERN(const lzo_uint32_tp) + lzo_get_crc32_table(void); + +/* misc. */ +LZO_EXTERN(int) _lzo_config_check(void); +typedef union { + lzo_voidp a00; lzo_bytep a01; lzo_uint a02; lzo_xint a03; lzo_uintptr_t a04; + void *a05; unsigned char *a06; unsigned long a07; size_t a08; ptrdiff_t a09; +#if defined(lzo_int64_t) + lzo_uint64_t a10; +#endif +} lzo_align_t; + +/* align a char pointer on a boundary that is a multiple of 'size' */ +LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size); +#define LZO_PTR_ALIGN_UP(p,size) \ + ((p) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(p),(lzo_uint)(size))) + + +/*********************************************************************** +// deprecated macros - only for backward compatibility +************************************************************************/ + +/* deprecated - use 'lzo_bytep' instead of 'lzo_byte *' */ +#define lzo_byte unsigned char +/* deprecated type names */ +#define lzo_int32 lzo_int32_t +#define lzo_uint32 lzo_uint32_t +#define lzo_int32p lzo_int32_t __LZO_MMODEL * +#define lzo_uint32p lzo_uint32_t __LZO_MMODEL * +#define LZO_INT32_MAX LZO_INT32_C(2147483647) +#define LZO_UINT32_MAX LZO_UINT32_C(4294967295) +#if defined(lzo_int64_t) +#define lzo_int64 lzo_int64_t +#define lzo_uint64 lzo_uint64_t +#define lzo_int64p lzo_int64_t __LZO_MMODEL * +#define lzo_uint64p lzo_uint64_t __LZO_MMODEL * +#define LZO_INT64_MAX LZO_INT64_C(9223372036854775807) +#define LZO_UINT64_MAX LZO_UINT64_C(18446744073709551615) +#endif +/* deprecated types */ +typedef union { lzo_bytep a; lzo_uint b; } __lzo_pu_u; +typedef union { lzo_bytep a; lzo_uint32_t b; } __lzo_pu32_u; +/* deprecated defines */ +#if !defined(LZO_SIZEOF_LZO_UINT) +# define LZO_SIZEOF_LZO_UINT LZO_SIZEOF_LZO_INT +#endif + +#if defined(LZO_CFG_COMPAT) + +#define __LZOCONF_H 1 + +#if defined(LZO_ARCH_I086) +# define __LZO_i386 1 +#elif defined(LZO_ARCH_I386) +# define __LZO_i386 1 +#endif + +#if defined(LZO_OS_DOS16) +# define __LZO_DOS 1 +# define __LZO_DOS16 1 +#elif defined(LZO_OS_DOS32) +# define __LZO_DOS 1 +#elif defined(LZO_OS_WIN16) +# define __LZO_WIN 1 +# define __LZO_WIN16 1 +#elif defined(LZO_OS_WIN32) +# define __LZO_WIN 1 +#endif + +#define __LZO_CMODEL /*empty*/ +#define __LZO_DMODEL /*empty*/ +#define __LZO_ENTRY __LZO_CDECL +#define LZO_EXTERN_CDECL LZO_EXTERN +#define LZO_ALIGN LZO_PTR_ALIGN_UP + +#define lzo_compress_asm_t lzo_compress_t +#define lzo_decompress_asm_t lzo_decompress_t + +#endif /* LZO_CFG_COMPAT */ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* already included */ + + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/lzo/lzodefs.h b/tools/z64compress/src/enc/lzo/lzodefs.h new file mode 100644 index 000000000..c3e2bcf5d --- /dev/null +++ b/tools/z64compress/src/enc/lzo/lzodefs.h @@ -0,0 +1,3268 @@ +/* lzodefs.h -- architecture, OS and compiler specific defines + + This file is part of the LZO real-time data compression library. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The LZO library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/lzo/ + */ + + +#ifndef __LZODEFS_H_INCLUDED +#define __LZODEFS_H_INCLUDED 1 + +#if defined(__CYGWIN32__) && !defined(__CYGWIN__) +# define __CYGWIN__ __CYGWIN32__ +#endif +#if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) +# define _ALL_SOURCE 1 +#endif +#if defined(__mips__) && defined(__R5900__) +# if !defined(__LONG_MAX__) +# define __LONG_MAX__ 9223372036854775807L +# endif +#endif +#if 0 +#elif !defined(__LZO_LANG_OVERRIDE) +#if (defined(__clang__) || defined(__GNUC__)) && defined(__ASSEMBLER__) +# if (__ASSEMBLER__+0) <= 0 +# error "__ASSEMBLER__" +# else +# define LZO_LANG_ASSEMBLER 1 +# endif +#elif defined(__cplusplus) +# if (__cplusplus+0) <= 0 +# error "__cplusplus" +# elif (__cplusplus < 199711L) +# define LZO_LANG_CXX 1 +# elif defined(_MSC_VER) && defined(_MSVC_LANG) && (_MSVC_LANG+0 >= 201402L) && 1 +# define LZO_LANG_CXX _MSVC_LANG +# else +# define LZO_LANG_CXX __cplusplus +# endif +# define LZO_LANG_CPLUSPLUS LZO_LANG_CXX +#else +# if defined(__STDC_VERSION__) && (__STDC_VERSION__+0 >= 199409L) +# define LZO_LANG_C __STDC_VERSION__ +# else +# define LZO_LANG_C 1 +# endif +#endif +#endif +#if !defined(LZO_CFG_NO_DISABLE_WUNDEF) +#if defined(__ARMCC_VERSION) +# pragma diag_suppress 193 +#elif defined(__clang__) && defined(__clang_minor__) +# pragma clang diagnostic ignored "-Wundef" +#elif defined(__INTEL_COMPILER) +# pragma warning(disable: 193) +#elif defined(__KEIL__) && defined(__C166__) +# pragma warning disable = 322 +#elif defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__PATHSCALE__) +# if ((__GNUC__-0) >= 5 || ((__GNUC__-0) == 4 && (__GNUC_MINOR__-0) >= 2)) +# pragma GCC diagnostic ignored "-Wundef" +# endif +#elif defined(_MSC_VER) && !defined(__clang__) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) +# if ((_MSC_VER-0) >= 1300) +# pragma warning(disable: 4668) +# endif +#endif +#endif +#if 0 && defined(__POCC__) && defined(_WIN32) +# if (__POCC__ >= 400) +# pragma warn(disable: 2216) +# endif +#endif +#if 0 && defined(__WATCOMC__) +# if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) +# pragma warning 203 9 +# endif +#endif +#if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) +# pragma option -h +#endif +#if !(LZO_CFG_NO_DISABLE_WCRTNONSTDC) +#ifndef _CRT_NONSTDC_NO_DEPRECATE +#define _CRT_NONSTDC_NO_DEPRECATE 1 +#endif +#ifndef _CRT_NONSTDC_NO_WARNINGS +#define _CRT_NONSTDC_NO_WARNINGS 1 +#endif +#ifndef _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS 1 +#endif +#endif +#if 0 +#define LZO_0xffffUL 0xfffful +#define LZO_0xffffffffUL 0xfffffffful +#else +#define LZO_0xffffUL 65535ul +#define LZO_0xffffffffUL 4294967295ul +#endif +#define LZO_0xffffL LZO_0xffffUL +#define LZO_0xffffffffL LZO_0xffffffffUL +#if (LZO_0xffffL == LZO_0xffffffffL) +# error "your preprocessor is broken 1" +#endif +#if (16ul * 16384ul != 262144ul) +# error "your preprocessor is broken 2" +#endif +#if 0 +#if (32767 >= 4294967295ul) +# error "your preprocessor is broken 3" +#endif +#if (65535u >= 4294967295ul) +# error "your preprocessor is broken 4" +#endif +#endif +#if defined(__COUNTER__) +# ifndef LZO_CFG_USE_COUNTER +# define LZO_CFG_USE_COUNTER 1 +# endif +#else +# undef LZO_CFG_USE_COUNTER +#endif +#if (UINT_MAX == LZO_0xffffL) +#if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) +# if !defined(MSDOS) +# define MSDOS 1 +# endif +# if !defined(_MSDOS) +# define _MSDOS 1 +# endif +#elif 0 && defined(__VERSION) && defined(MB_LEN_MAX) +# if (__VERSION == 520) && (MB_LEN_MAX == 1) +# if !defined(__AZTEC_C__) +# define __AZTEC_C__ __VERSION +# endif +# if !defined(__DOS__) +# define __DOS__ 1 +# endif +# endif +#endif +#endif +#if (UINT_MAX == LZO_0xffffL) +#if defined(_MSC_VER) && defined(M_I86HM) +# define ptrdiff_t long +# define _PTRDIFF_T_DEFINED 1 +#endif +#endif +#if (UINT_MAX == LZO_0xffffL) +# undef __LZO_RENAME_A +# undef __LZO_RENAME_B +# if defined(__AZTEC_C__) && defined(__DOS__) +# define __LZO_RENAME_A 1 +# elif defined(_MSC_VER) && defined(MSDOS) +# if (_MSC_VER < 600) +# define __LZO_RENAME_A 1 +# elif (_MSC_VER < 700) +# define __LZO_RENAME_B 1 +# endif +# elif defined(__TSC__) && defined(__OS2__) +# define __LZO_RENAME_A 1 +# elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) +# define __LZO_RENAME_A 1 +# elif defined(__PACIFIC__) && defined(DOS) +# if !defined(__far) +# define __far far +# endif +# if !defined(__near) +# define __near near +# endif +# endif +# if defined(__LZO_RENAME_A) +# if !defined(__cdecl) +# define __cdecl cdecl +# endif +# if !defined(__far) +# define __far far +# endif +# if !defined(__huge) +# define __huge huge +# endif +# if !defined(__near) +# define __near near +# endif +# if !defined(__pascal) +# define __pascal pascal +# endif +# if !defined(__huge) +# define __huge huge +# endif +# elif defined(__LZO_RENAME_B) +# if !defined(__cdecl) +# define __cdecl _cdecl +# endif +# if !defined(__far) +# define __far _far +# endif +# if !defined(__huge) +# define __huge _huge +# endif +# if !defined(__near) +# define __near _near +# endif +# if !defined(__pascal) +# define __pascal _pascal +# endif +# elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) +# if !defined(__cdecl) +# define __cdecl cdecl +# endif +# if !defined(__pascal) +# define __pascal pascal +# endif +# endif +# undef __LZO_RENAME_A +# undef __LZO_RENAME_B +#endif +#if (UINT_MAX == LZO_0xffffL) +#if defined(__AZTEC_C__) && defined(__DOS__) +# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 +#elif defined(_MSC_VER) && defined(MSDOS) +# if (_MSC_VER < 600) +# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 +# endif +# if (_MSC_VER < 700) +# define LZO_BROKEN_INTEGRAL_PROMOTION 1 +# define LZO_BROKEN_SIZEOF 1 +# endif +#elif defined(__PACIFIC__) && defined(DOS) +# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 +#elif defined(__TURBOC__) && defined(__MSDOS__) +# if (__TURBOC__ < 0x0150) +# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 +# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 +# define LZO_BROKEN_INTEGRAL_PROMOTION 1 +# endif +# if (__TURBOC__ < 0x0200) +# define LZO_BROKEN_SIZEOF 1 +# endif +# if (__TURBOC__ < 0x0400) && defined(__cplusplus) +# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 +# endif +#elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) +# define LZO_BROKEN_CDECL_ALT_SYNTAX 1 +# define LZO_BROKEN_SIZEOF 1 +#endif +#endif +#if defined(__WATCOMC__) && (__WATCOMC__ < 900) +# define LZO_BROKEN_INTEGRAL_CONSTANTS 1 +#endif +#if defined(_CRAY) && defined(_CRAY1) +# define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1 +#endif +#define LZO_PP_STRINGIZE(x) #x +#define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) +#define LZO_PP_CONCAT0() /*empty*/ +#define LZO_PP_CONCAT1(a) a +#define LZO_PP_CONCAT2(a,b) a ## b +#define LZO_PP_CONCAT3(a,b,c) a ## b ## c +#define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d +#define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e +#define LZO_PP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f +#define LZO_PP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g +#define LZO_PP_ECONCAT0() LZO_PP_CONCAT0() +#define LZO_PP_ECONCAT1(a) LZO_PP_CONCAT1(a) +#define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) +#define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) +#define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) +#define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) +#define LZO_PP_ECONCAT6(a,b,c,d,e,f) LZO_PP_CONCAT6(a,b,c,d,e,f) +#define LZO_PP_ECONCAT7(a,b,c,d,e,f,g) LZO_PP_CONCAT7(a,b,c,d,e,f,g) +#define LZO_PP_EMPTY /*empty*/ +#define LZO_PP_EMPTY0() /*empty*/ +#define LZO_PP_EMPTY1(a) /*empty*/ +#define LZO_PP_EMPTY2(a,b) /*empty*/ +#define LZO_PP_EMPTY3(a,b,c) /*empty*/ +#define LZO_PP_EMPTY4(a,b,c,d) /*empty*/ +#define LZO_PP_EMPTY5(a,b,c,d,e) /*empty*/ +#define LZO_PP_EMPTY6(a,b,c,d,e,f) /*empty*/ +#define LZO_PP_EMPTY7(a,b,c,d,e,f,g) /*empty*/ +#if 1 +#define LZO_CPP_STRINGIZE(x) #x +#define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) +#define LZO_CPP_CONCAT2(a,b) a ## b +#define LZO_CPP_CONCAT3(a,b,c) a ## b ## c +#define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d +#define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e +#define LZO_CPP_CONCAT6(a,b,c,d,e,f) a ## b ## c ## d ## e ## f +#define LZO_CPP_CONCAT7(a,b,c,d,e,f,g) a ## b ## c ## d ## e ## f ## g +#define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) +#define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) +#define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) +#define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) +#define LZO_CPP_ECONCAT6(a,b,c,d,e,f) LZO_CPP_CONCAT6(a,b,c,d,e,f) +#define LZO_CPP_ECONCAT7(a,b,c,d,e,f,g) LZO_CPP_CONCAT7(a,b,c,d,e,f,g) +#endif +#define __LZO_MASK_GEN(o,b) (((((o) << ((b)-((b)!=0))) - (o)) << 1) + (o)*((b)!=0)) +#if 1 && defined(__cplusplus) +# if !defined(__STDC_CONSTANT_MACROS) +# define __STDC_CONSTANT_MACROS 1 +# endif +# if !defined(__STDC_LIMIT_MACROS) +# define __STDC_LIMIT_MACROS 1 +# endif +#endif +#if defined(__cplusplus) +# define LZO_EXTERN_C extern "C" +# define LZO_EXTERN_C_BEGIN extern "C" { +# define LZO_EXTERN_C_END } +#else +# define LZO_EXTERN_C extern +# define LZO_EXTERN_C_BEGIN /*empty*/ +# define LZO_EXTERN_C_END /*empty*/ +#endif +#if !defined(__LZO_OS_OVERRIDE) +#if (LZO_OS_FREESTANDING) +# define LZO_INFO_OS "freestanding" +#elif (LZO_OS_EMBEDDED) +# define LZO_INFO_OS "embedded" +#elif 1 && defined(__IAR_SYSTEMS_ICC__) +# define LZO_OS_EMBEDDED 1 +# define LZO_INFO_OS "embedded" +#elif defined(__CYGWIN__) && defined(__GNUC__) +# define LZO_OS_CYGWIN 1 +# define LZO_INFO_OS "cygwin" +#elif defined(__EMX__) && defined(__GNUC__) +# define LZO_OS_EMX 1 +# define LZO_INFO_OS "emx" +#elif defined(__BEOS__) +# define LZO_OS_BEOS 1 +# define LZO_INFO_OS "beos" +#elif defined(__Lynx__) +# define LZO_OS_LYNXOS 1 +# define LZO_INFO_OS "lynxos" +#elif defined(__OS400__) +# define LZO_OS_OS400 1 +# define LZO_INFO_OS "os400" +#elif defined(__QNX__) +# define LZO_OS_QNX 1 +# define LZO_INFO_OS "qnx" +#elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) +# define LZO_OS_DOS32 1 +# define LZO_INFO_OS "dos32" +#elif defined(__BORLANDC__) && defined(__DPMI16__) +# define LZO_OS_DOS16 1 +# define LZO_INFO_OS "dos16" +#elif defined(__ZTC__) && defined(DOS386) +# define LZO_OS_DOS32 1 +# define LZO_INFO_OS "dos32" +#elif defined(__OS2__) || defined(__OS2V2__) +# if (UINT_MAX == LZO_0xffffL) +# define LZO_OS_OS216 1 +# define LZO_INFO_OS "os216" +# elif (UINT_MAX == LZO_0xffffffffL) +# define LZO_OS_OS2 1 +# define LZO_INFO_OS "os2" +# else +# error "check your limits.h header" +# endif +#elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) +# define LZO_OS_WIN64 1 +# define LZO_INFO_OS "win64" +#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) +# define LZO_OS_WIN32 1 +# define LZO_INFO_OS "win32" +#elif defined(__MWERKS__) && defined(__INTEL__) +# define LZO_OS_WIN32 1 +# define LZO_INFO_OS "win32" +#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) +# if (UINT_MAX == LZO_0xffffL) +# define LZO_OS_WIN16 1 +# define LZO_INFO_OS "win16" +# elif (UINT_MAX == LZO_0xffffffffL) +# define LZO_OS_WIN32 1 +# define LZO_INFO_OS "win32" +# else +# error "check your limits.h header" +# endif +#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) +# if (UINT_MAX == LZO_0xffffL) +# define LZO_OS_DOS16 1 +# define LZO_INFO_OS "dos16" +# elif (UINT_MAX == LZO_0xffffffffL) +# define LZO_OS_DOS32 1 +# define LZO_INFO_OS "dos32" +# else +# error "check your limits.h header" +# endif +#elif defined(__WATCOMC__) +# if defined(__NT__) && (UINT_MAX == LZO_0xffffL) +# define LZO_OS_DOS16 1 +# define LZO_INFO_OS "dos16" +# elif defined(__NT__) && (__WATCOMC__ < 1100) +# define LZO_OS_WIN32 1 +# define LZO_INFO_OS "win32" +# elif defined(__linux__) || defined(__LINUX__) +# define LZO_OS_POSIX 1 +# define LZO_INFO_OS "posix" +# else +# error "please specify a target using the -bt compiler option" +# endif +#elif defined(__palmos__) +# define LZO_OS_PALMOS 1 +# define LZO_INFO_OS "palmos" +#elif defined(__TOS__) || defined(__atarist__) +# define LZO_OS_TOS 1 +# define LZO_INFO_OS "tos" +#elif defined(macintosh) && !defined(__arm__) && !defined(__i386__) && !defined(__ppc__) && !defined(__x64_64__) +# define LZO_OS_MACCLASSIC 1 +# define LZO_INFO_OS "macclassic" +#elif defined(__VMS) +# define LZO_OS_VMS 1 +# define LZO_INFO_OS "vms" +#elif (defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__) +# define LZO_OS_CONSOLE 1 +# define LZO_OS_CONSOLE_PS2 1 +# define LZO_INFO_OS "console" +# define LZO_INFO_OS_CONSOLE "ps2" +#elif defined(__mips__) && defined(__psp__) +# define LZO_OS_CONSOLE 1 +# define LZO_OS_CONSOLE_PSP 1 +# define LZO_INFO_OS "console" +# define LZO_INFO_OS_CONSOLE "psp" +#else +# define LZO_OS_POSIX 1 +# define LZO_INFO_OS "posix" +#endif +#if (LZO_OS_POSIX) +# if defined(_AIX) || defined(__AIX__) || defined(__aix__) +# define LZO_OS_POSIX_AIX 1 +# define LZO_INFO_OS_POSIX "aix" +# elif defined(__FreeBSD__) +# define LZO_OS_POSIX_FREEBSD 1 +# define LZO_INFO_OS_POSIX "freebsd" +# elif defined(__hpux__) || defined(__hpux) +# define LZO_OS_POSIX_HPUX 1 +# define LZO_INFO_OS_POSIX "hpux" +# elif defined(__INTERIX) +# define LZO_OS_POSIX_INTERIX 1 +# define LZO_INFO_OS_POSIX "interix" +# elif defined(__IRIX__) || defined(__irix__) +# define LZO_OS_POSIX_IRIX 1 +# define LZO_INFO_OS_POSIX "irix" +# elif defined(__linux__) || defined(__linux) || defined(__LINUX__) +# define LZO_OS_POSIX_LINUX 1 +# define LZO_INFO_OS_POSIX "linux" +# elif defined(__APPLE__) && defined(__MACH__) +# if ((__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__-0) >= 20000) +# define LZO_OS_POSIX_DARWIN 1040 +# define LZO_INFO_OS_POSIX "darwin_iphone" +# elif ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) >= 1040) +# define LZO_OS_POSIX_DARWIN __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ +# define LZO_INFO_OS_POSIX "darwin" +# else +# define LZO_OS_POSIX_DARWIN 1 +# define LZO_INFO_OS_POSIX "darwin" +# endif +# define LZO_OS_POSIX_MACOSX LZO_OS_POSIX_DARWIN +# elif defined(__minix__) || defined(__minix) +# define LZO_OS_POSIX_MINIX 1 +# define LZO_INFO_OS_POSIX "minix" +# elif defined(__NetBSD__) +# define LZO_OS_POSIX_NETBSD 1 +# define LZO_INFO_OS_POSIX "netbsd" +# elif defined(__OpenBSD__) +# define LZO_OS_POSIX_OPENBSD 1 +# define LZO_INFO_OS_POSIX "openbsd" +# elif defined(__osf__) +# define LZO_OS_POSIX_OSF 1 +# define LZO_INFO_OS_POSIX "osf" +# elif defined(__solaris__) || defined(__sun) +# if defined(__SVR4) || defined(__svr4__) +# define LZO_OS_POSIX_SOLARIS 1 +# define LZO_INFO_OS_POSIX "solaris" +# else +# define LZO_OS_POSIX_SUNOS 1 +# define LZO_INFO_OS_POSIX "sunos" +# endif +# elif defined(__ultrix__) || defined(__ultrix) +# define LZO_OS_POSIX_ULTRIX 1 +# define LZO_INFO_OS_POSIX "ultrix" +# elif defined(_UNICOS) +# define LZO_OS_POSIX_UNICOS 1 +# define LZO_INFO_OS_POSIX "unicos" +# else +# define LZO_OS_POSIX_UNKNOWN 1 +# define LZO_INFO_OS_POSIX "unknown" +# endif +#endif +#endif +#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) +# if (UINT_MAX != LZO_0xffffL) +# error "unexpected configuration - check your compiler defines" +# endif +# if (ULONG_MAX != LZO_0xffffffffL) +# error "unexpected configuration - check your compiler defines" +# endif +#endif +#if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) +# if (UINT_MAX != LZO_0xffffffffL) +# error "unexpected configuration - check your compiler defines" +# endif +# if (ULONG_MAX != LZO_0xffffffffL) +# error "unexpected configuration - check your compiler defines" +# endif +#endif +#if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) +# define LZO_CC_CILLY 1 +# define LZO_INFO_CC "Cilly" +# if defined(__CILLY__) +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__) +# else +# define LZO_INFO_CCVER "unknown" +# endif +#elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__) +# define LZO_CC_SDCC 1 +# define LZO_INFO_CC "sdcc" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) +#elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) +# define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + (__PATHCC_MINOR__-0) * 0x100 + (__PATHCC_PATCHLEVEL__-0)) +# define LZO_INFO_CC "Pathscale C" +# define LZO_INFO_CCVER __PATHSCALE__ +# if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) +# define LZO_CC_PATHSCALE_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) +# endif +#elif defined(__INTEL_COMPILER) && ((__INTEL_COMPILER-0) > 0) +# define LZO_CC_INTELC __INTEL_COMPILER +# define LZO_INFO_CC "Intel C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) +# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) +# define LZO_CC_INTELC_MSC _MSC_VER +# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) +# define LZO_CC_INTELC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) +# endif +#elif defined(__POCC__) && defined(_WIN32) +# define LZO_CC_PELLESC 1 +# define LZO_INFO_CC "Pelles C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) +#elif defined(__ARMCC_VERSION) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) +# if defined(__GNUC_PATCHLEVEL__) +# define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) +# else +# define LZO_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) +# endif +# define LZO_CC_ARMCC __ARMCC_VERSION +# define LZO_INFO_CC "ARM C Compiler" +# define LZO_INFO_CCVER __VERSION__ +#elif defined(__clang__) && defined(__c2__) && defined(__c2_version__) && defined(_MSC_VER) +# define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0)) +# define LZO_CC_CLANG_C2 _MSC_VER +# define LZO_CC_CLANG_VENDOR_MICROSOFT 1 +# define LZO_INFO_CC "clang/c2" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__c2_version__) +#elif defined(__clang__) && defined(__llvm__) && defined(__VERSION__) +# if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__) +# define LZO_CC_CLANG (__clang_major__ * 0x10000L + (__clang_minor__-0) * 0x100 + (__clang_patchlevel__-0)) +# else +# define LZO_CC_CLANG 0x010000L +# endif +# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) +# define LZO_CC_CLANG_MSC _MSC_VER +# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) +# define LZO_CC_CLANG_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) +# endif +# if defined(__APPLE_CC__) +# define LZO_CC_CLANG_VENDOR_APPLE 1 +# define LZO_INFO_CC "clang/apple" +# else +# define LZO_CC_CLANG_VENDOR_LLVM 1 +# define LZO_INFO_CC "clang" +# endif +# if defined(__clang_version__) +# define LZO_INFO_CCVER __clang_version__ +# else +# define LZO_INFO_CCVER __VERSION__ +# endif +#elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) +# if defined(__GNUC_PATCHLEVEL__) +# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) +# else +# define LZO_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) +# endif +# define LZO_CC_LLVM LZO_CC_LLVM_GNUC +# define LZO_INFO_CC "llvm-gcc" +# define LZO_INFO_CCVER __VERSION__ +#elif defined(__ACK__) && defined(_ACK) +# define LZO_CC_ACK 1 +# define LZO_INFO_CC "Amsterdam Compiler Kit C" +# define LZO_INFO_CCVER "unknown" +#elif defined(__ARMCC_VERSION) && !defined(__GNUC__) +# define LZO_CC_ARMCC __ARMCC_VERSION +# define LZO_CC_ARMCC_ARMCC __ARMCC_VERSION +# define LZO_INFO_CC "ARM C Compiler" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ARMCC_VERSION) +#elif defined(__AZTEC_C__) +# define LZO_CC_AZTECC 1 +# define LZO_INFO_CC "Aztec C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) +#elif defined(__CODEGEARC__) +# define LZO_CC_CODEGEARC 1 +# define LZO_INFO_CC "CodeGear C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CODEGEARC__) +#elif defined(__BORLANDC__) +# define LZO_CC_BORLANDC 1 +# define LZO_INFO_CC "Borland C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__) +#elif defined(_CRAYC) && defined(_RELEASE) +# define LZO_CC_CRAYC 1 +# define LZO_INFO_CC "Cray C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE) +#elif defined(__DMC__) && defined(__SC__) +# define LZO_CC_DMC 1 +# define LZO_INFO_CC "Digital Mars C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__) +#elif defined(__DECC) +# define LZO_CC_DECC 1 +# define LZO_INFO_CC "DEC C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) +#elif (defined(__ghs) || defined(__ghs__)) && defined(__GHS_VERSION_NUMBER) && ((__GHS_VERSION_NUMBER-0) > 0) +# define LZO_CC_GHS 1 +# define LZO_INFO_CC "Green Hills C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__GHS_VERSION_NUMBER) +# if defined(_MSC_VER) && ((_MSC_VER-0) > 0) +# define LZO_CC_GHS_MSC _MSC_VER +# elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__) +# define LZO_CC_GHS_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) +# endif +#elif defined(__HIGHC__) +# define LZO_CC_HIGHC 1 +# define LZO_INFO_CC "MetaWare High C" +# define LZO_INFO_CCVER "unknown" +#elif defined(__HP_aCC) && ((__HP_aCC-0) > 0) +# define LZO_CC_HPACC __HP_aCC +# define LZO_INFO_CC "HP aCC" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__HP_aCC) +#elif defined(__IAR_SYSTEMS_ICC__) +# define LZO_CC_IARC 1 +# define LZO_INFO_CC "IAR C" +# if defined(__VER__) +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__) +# else +# define LZO_INFO_CCVER "unknown" +# endif +#elif defined(__IBMC__) && ((__IBMC__-0) > 0) +# define LZO_CC_IBMC __IBMC__ +# define LZO_INFO_CC "IBM C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) +#elif defined(__IBMCPP__) && ((__IBMCPP__-0) > 0) +# define LZO_CC_IBMC __IBMCPP__ +# define LZO_INFO_CC "IBM C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMCPP__) +#elif defined(__KEIL__) && defined(__C166__) +# define LZO_CC_KEILC 1 +# define LZO_INFO_CC "Keil C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__) +#elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL) +# define LZO_CC_LCCWIN32 1 +# define LZO_INFO_CC "lcc-win32" +# define LZO_INFO_CCVER "unknown" +#elif defined(__LCC__) +# define LZO_CC_LCC 1 +# define LZO_INFO_CC "lcc" +# if defined(__LCC_VERSION__) +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__) +# else +# define LZO_INFO_CCVER "unknown" +# endif +#elif defined(__MWERKS__) && ((__MWERKS__-0) > 0) +# define LZO_CC_MWERKS __MWERKS__ +# define LZO_INFO_CC "Metrowerks C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) +#elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) +# define LZO_CC_NDPC 1 +# define LZO_INFO_CC "Microway NDP C" +# define LZO_INFO_CCVER "unknown" +#elif defined(__PACIFIC__) +# define LZO_CC_PACIFICC 1 +# define LZO_INFO_CC "Pacific C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) +#elif defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100 + (__PGIC_PATCHLEVEL__-0)) +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) "." LZO_PP_MACRO_EXPAND(__PGIC_PATCHLEVEL__) +# else +# define LZO_CC_PGI (__PGIC__ * 0x10000L + (__PGIC_MINOR__-0) * 0x100) +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PGIC__) "." LZO_PP_MACRO_EXPAND(__PGIC_MINOR__) ".0" +# endif +# define LZO_INFO_CC "Portland Group PGI C" +#elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) +# define LZO_CC_PGI 1 +# define LZO_INFO_CC "Portland Group PGI C" +# define LZO_INFO_CCVER "unknown" +#elif defined(__PUREC__) && defined(__TOS__) +# define LZO_CC_PUREC 1 +# define LZO_INFO_CC "Pure C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__) +#elif defined(__SC__) && defined(__ZTC__) +# define LZO_CC_SYMANTECC 1 +# define LZO_INFO_CC "Symantec C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) +#elif defined(__SUNPRO_C) +# define LZO_INFO_CC "SunPro C" +# if ((__SUNPRO_C-0) > 0) +# define LZO_CC_SUNPROC __SUNPRO_C +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) +# else +# define LZO_CC_SUNPROC 1 +# define LZO_INFO_CCVER "unknown" +# endif +#elif defined(__SUNPRO_CC) +# define LZO_INFO_CC "SunPro C" +# if ((__SUNPRO_CC-0) > 0) +# define LZO_CC_SUNPROC __SUNPRO_CC +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) +# else +# define LZO_CC_SUNPROC 1 +# define LZO_INFO_CCVER "unknown" +# endif +#elif defined(__TINYC__) +# define LZO_CC_TINYC 1 +# define LZO_INFO_CC "Tiny C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__) +#elif defined(__TSC__) +# define LZO_CC_TOPSPEEDC 1 +# define LZO_INFO_CC "TopSpeed C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__) +#elif defined(__WATCOMC__) +# define LZO_CC_WATCOMC 1 +# define LZO_INFO_CC "Watcom C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__) +#elif defined(__TURBOC__) +# define LZO_CC_TURBOC 1 +# define LZO_INFO_CC "Turbo C" +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__) +#elif defined(__ZTC__) +# define LZO_CC_ZORTECHC 1 +# define LZO_INFO_CC "Zortech C" +# if ((__ZTC__-0) == 0x310) +# define LZO_INFO_CCVER "0x310" +# else +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) +# endif +#elif defined(__GNUC__) && defined(__VERSION__) +# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) +# define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100 + (__GNUC_PATCHLEVEL__-0)) +# elif defined(__GNUC_MINOR__) +# define LZO_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__-0) * 0x100) +# else +# define LZO_CC_GNUC (__GNUC__ * 0x10000L) +# endif +# define LZO_INFO_CC "gcc" +# define LZO_INFO_CCVER __VERSION__ +#elif defined(_MSC_VER) && ((_MSC_VER-0) > 0) +# define LZO_CC_MSC _MSC_VER +# define LZO_INFO_CC "Microsoft C" +# if defined(_MSC_FULL_VER) +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) +# else +# define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) +# endif +#else +# define LZO_CC_UNKNOWN 1 +# define LZO_INFO_CC "unknown" +# define LZO_INFO_CCVER "unknown" +#endif +#if (LZO_CC_GNUC) && defined(__OPEN64__) +# if defined(__OPENCC__) && defined(__OPENCC_MINOR__) && defined(__OPENCC_PATCHLEVEL__) +# define LZO_CC_OPEN64 (__OPENCC__ * 0x10000L + (__OPENCC_MINOR__-0) * 0x100 + (__OPENCC_PATCHLEVEL__-0)) +# define LZO_CC_OPEN64_GNUC LZO_CC_GNUC +# endif +#endif +#if (LZO_CC_GNUC) && defined(__PCC__) +# if defined(__PCC__) && defined(__PCC_MINOR__) && defined(__PCC_MINORMINOR__) +# define LZO_CC_PCC (__PCC__ * 0x10000L + (__PCC_MINOR__-0) * 0x100 + (__PCC_MINORMINOR__-0)) +# define LZO_CC_PCC_GNUC LZO_CC_GNUC +# endif +#endif +#if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) +# error "LZO_CC_MSC: _MSC_FULL_VER is not defined" +#endif +#if !defined(__LZO_ARCH_OVERRIDE) && !(LZO_ARCH_GENERIC) && defined(_CRAY) +# if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) +# if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) +# define LZO_ARCH_CRAY_MPP 1 +# elif defined(_CRAY1) +# define LZO_ARCH_CRAY_PVP 1 +# endif +# endif +#endif +#if !defined(__LZO_ARCH_OVERRIDE) +#if (LZO_ARCH_GENERIC) +# define LZO_INFO_ARCH "generic" +#elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) +# define LZO_ARCH_I086 1 +# define LZO_INFO_ARCH "i086" +#elif defined(__aarch64__) || defined(_M_ARM64) +# define LZO_ARCH_ARM64 1 +# define LZO_INFO_ARCH "arm64" +#elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) +# define LZO_ARCH_ALPHA 1 +# define LZO_INFO_ARCH "alpha" +#elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E)) +# define LZO_ARCH_ALPHA 1 +# define LZO_INFO_ARCH "alpha" +#elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) +# define LZO_ARCH_AMD64 1 +# define LZO_INFO_ARCH "amd64" +#elif defined(__arm__) || defined(_M_ARM) +# define LZO_ARCH_ARM 1 +# define LZO_INFO_ARCH "arm" +#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) +# define LZO_ARCH_ARM 1 +# define LZO_INFO_ARCH "arm" +#elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) +# define LZO_ARCH_AVR 1 +# define LZO_INFO_ARCH "avr" +#elif defined(__avr32__) || defined(__AVR32__) +# define LZO_ARCH_AVR32 1 +# define LZO_INFO_ARCH "avr32" +#elif defined(__bfin__) +# define LZO_ARCH_BLACKFIN 1 +# define LZO_INFO_ARCH "blackfin" +#elif (UINT_MAX == LZO_0xffffL) && defined(__C166__) +# define LZO_ARCH_C166 1 +# define LZO_INFO_ARCH "c166" +#elif defined(__cris__) +# define LZO_ARCH_CRIS 1 +# define LZO_INFO_ARCH "cris" +#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__) +# define LZO_ARCH_EZ80 1 +# define LZO_INFO_ARCH "ez80" +#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) +# define LZO_ARCH_H8300 1 +# define LZO_INFO_ARCH "h8300" +#elif defined(__hppa__) || defined(__hppa) +# define LZO_ARCH_HPPA 1 +# define LZO_INFO_ARCH "hppa" +#elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) +# define LZO_ARCH_I386 1 +# define LZO_ARCH_IA32 1 +# define LZO_INFO_ARCH "i386" +#elif (LZO_CC_ZORTECHC && defined(__I86__)) +# define LZO_ARCH_I386 1 +# define LZO_ARCH_IA32 1 +# define LZO_INFO_ARCH "i386" +#elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386) +# define LZO_ARCH_I386 1 +# define LZO_ARCH_IA32 1 +# define LZO_INFO_ARCH "i386" +#elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64) +# define LZO_ARCH_IA64 1 +# define LZO_INFO_ARCH "ia64" +#elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__) +# define LZO_ARCH_M16C 1 +# define LZO_INFO_ARCH "m16c" +#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__) +# define LZO_ARCH_M16C 1 +# define LZO_INFO_ARCH "m16c" +#elif defined(__m32r__) +# define LZO_ARCH_M32R 1 +# define LZO_INFO_ARCH "m32r" +#elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K) +# define LZO_ARCH_M68K 1 +# define LZO_INFO_ARCH "m68k" +#elif (UINT_MAX == LZO_0xffffL) && defined(__C251__) +# define LZO_ARCH_MCS251 1 +# define LZO_INFO_ARCH "mcs251" +#elif (UINT_MAX == LZO_0xffffL) && defined(__C51__) +# define LZO_ARCH_MCS51 1 +# define LZO_INFO_ARCH "mcs51" +#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__) +# define LZO_ARCH_MCS51 1 +# define LZO_INFO_ARCH "mcs51" +#elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000) +# define LZO_ARCH_MIPS 1 +# define LZO_INFO_ARCH "mips" +#elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__) +# define LZO_ARCH_MSP430 1 +# define LZO_INFO_ARCH "msp430" +#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__) +# define LZO_ARCH_MSP430 1 +# define LZO_INFO_ARCH "msp430" +#elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR) +# define LZO_ARCH_POWERPC 1 +# define LZO_INFO_ARCH "powerpc" +#elif defined(__powerpc64__) || defined(__powerpc64) || defined(__ppc64__) || defined(__PPC64__) +# define LZO_ARCH_POWERPC 1 +# define LZO_INFO_ARCH "powerpc" +#elif defined(__powerpc64le__) || defined(__powerpc64le) || defined(__ppc64le__) || defined(__PPC64LE__) +# define LZO_ARCH_POWERPC 1 +# define LZO_INFO_ARCH "powerpc" +#elif defined(__riscv) +# define LZO_ARCH_RISCV 1 +# define LZO_INFO_ARCH "riscv" +#elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x) +# define LZO_ARCH_S390 1 +# define LZO_INFO_ARCH "s390" +#elif defined(__sh__) || defined(_M_SH) +# define LZO_ARCH_SH 1 +# define LZO_INFO_ARCH "sh" +#elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) +# define LZO_ARCH_SPARC 1 +# define LZO_INFO_ARCH "sparc" +#elif defined(__SPU__) +# define LZO_ARCH_SPU 1 +# define LZO_INFO_ARCH "spu" +#elif (UINT_MAX == LZO_0xffffL) && defined(__z80) +# define LZO_ARCH_Z80 1 +# define LZO_INFO_ARCH "z80" +#elif (LZO_ARCH_CRAY_PVP) +# if defined(_CRAYSV1) +# define LZO_ARCH_CRAY_SV1 1 +# define LZO_INFO_ARCH "cray_sv1" +# elif (_ADDR64) +# define LZO_ARCH_CRAY_T90 1 +# define LZO_INFO_ARCH "cray_t90" +# elif (_ADDR32) +# define LZO_ARCH_CRAY_YMP 1 +# define LZO_INFO_ARCH "cray_ymp" +# else +# define LZO_ARCH_CRAY_XMP 1 +# define LZO_INFO_ARCH "cray_xmp" +# endif +#else +# define LZO_ARCH_UNKNOWN 1 +# define LZO_INFO_ARCH "unknown" +#endif +#endif +#if !defined(LZO_ARCH_ARM_THUMB2) +#if (LZO_ARCH_ARM) +# if defined(__thumb__) || defined(__thumb) || defined(_M_THUMB) +# if defined(__thumb2__) +# define LZO_ARCH_ARM_THUMB2 1 +# elif 1 && defined(__TARGET_ARCH_THUMB) && ((__TARGET_ARCH_THUMB)+0 >= 4) +# define LZO_ARCH_ARM_THUMB2 1 +# elif 1 && defined(_MSC_VER) && defined(_M_THUMB) && ((_M_THUMB)+0 >= 7) +# define LZO_ARCH_ARM_THUMB2 1 +# endif +# endif +#endif +#endif +#if (LZO_ARCH_ARM_THUMB2) +# undef LZO_INFO_ARCH +# define LZO_INFO_ARCH "arm_thumb2" +#endif +#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2) +# error "FIXME - missing define for CPU architecture" +#endif +#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) +# error "FIXME - missing LZO_OS_WIN32 define for CPU architecture" +#endif +#if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) +# error "FIXME - missing LZO_OS_WIN64 define for CPU architecture" +#endif +#if (LZO_OS_OS216 || LZO_OS_WIN16) +# define LZO_ARCH_I086PM 1 +#elif 1 && (LZO_OS_DOS16 && defined(BLX286)) +# define LZO_ARCH_I086PM 1 +#elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) +# define LZO_ARCH_I086PM 1 +#elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) +# define LZO_ARCH_I086PM 1 +#endif +#if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) +# define LZO_ARCH_X64 1 +#elif (!LZO_ARCH_AMD64 && LZO_ARCH_X64) && defined(__LZO_ARCH_OVERRIDE) +# define LZO_ARCH_AMD64 1 +#endif +#if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) +# define LZO_ARCH_AARCH64 1 +#elif (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) && defined(__LZO_ARCH_OVERRIDE) +# define LZO_ARCH_ARM64 1 +#endif +#if (LZO_ARCH_I386 && !LZO_ARCH_X86) +# define LZO_ARCH_X86 1 +#elif (!LZO_ARCH_I386 && LZO_ARCH_X86) && defined(__LZO_ARCH_OVERRIDE) +# define LZO_ARCH_I386 1 +#endif +#if (LZO_ARCH_AMD64 && !LZO_ARCH_X64) || (!LZO_ARCH_AMD64 && LZO_ARCH_X64) +# error "unexpected configuration - check your compiler defines" +#endif +#if (LZO_ARCH_ARM64 && !LZO_ARCH_AARCH64) || (!LZO_ARCH_ARM64 && LZO_ARCH_AARCH64) +# error "unexpected configuration - check your compiler defines" +#endif +#if (LZO_ARCH_I386 && !LZO_ARCH_X86) || (!LZO_ARCH_I386 && LZO_ARCH_X86) +# error "unexpected configuration - check your compiler defines" +#endif +#if (LZO_ARCH_ARM_THUMB1 && !LZO_ARCH_ARM) +# error "unexpected configuration - check your compiler defines" +#endif +#if (LZO_ARCH_ARM_THUMB2 && !LZO_ARCH_ARM) +# error "unexpected configuration - check your compiler defines" +#endif +#if (LZO_ARCH_ARM_THUMB1 && LZO_ARCH_ARM_THUMB2) +# error "unexpected configuration - check your compiler defines" +#endif +#if (LZO_ARCH_I086PM && !LZO_ARCH_I086) +# error "unexpected configuration - check your compiler defines" +#endif +#if (LZO_ARCH_I086) +# if (UINT_MAX != LZO_0xffffL) +# error "unexpected configuration - check your compiler defines" +# endif +# if (ULONG_MAX != LZO_0xffffffffL) +# error "unexpected configuration - check your compiler defines" +# endif +#endif +#if (LZO_ARCH_I386) +# if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) +# error "unexpected configuration - check your compiler defines" +# endif +# if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) +# error "unexpected configuration - check your compiler defines" +# endif +# if (ULONG_MAX != LZO_0xffffffffL) +# error "unexpected configuration - check your compiler defines" +# endif +#endif +#if (LZO_ARCH_AMD64 || LZO_ARCH_I386) +# if !defined(LZO_TARGET_FEATURE_SSE2) +# if defined(__SSE2__) +# define LZO_TARGET_FEATURE_SSE2 1 +# elif defined(_MSC_VER) && (defined(_M_IX86_FP) && ((_M_IX86_FP)+0 >= 2)) +# define LZO_TARGET_FEATURE_SSE2 1 +# elif (LZO_CC_INTELC_MSC || LZO_CC_MSC) && defined(_M_AMD64) +# define LZO_TARGET_FEATURE_SSE2 1 +# endif +# endif +# if !defined(LZO_TARGET_FEATURE_SSSE3) +# if (LZO_TARGET_FEATURE_SSE2) +# if defined(__SSSE3__) +# define LZO_TARGET_FEATURE_SSSE3 1 +# elif defined(_MSC_VER) && defined(__AVX__) +# define LZO_TARGET_FEATURE_SSSE3 1 +# endif +# endif +# endif +# if !defined(LZO_TARGET_FEATURE_SSE4_2) +# if (LZO_TARGET_FEATURE_SSSE3) +# if defined(__SSE4_2__) +# define LZO_TARGET_FEATURE_SSE4_2 1 +# endif +# endif +# endif +# if !defined(LZO_TARGET_FEATURE_AVX) +# if (LZO_TARGET_FEATURE_SSSE3) +# if defined(__AVX__) +# define LZO_TARGET_FEATURE_AVX 1 +# endif +# endif +# endif +# if !defined(LZO_TARGET_FEATURE_AVX2) +# if (LZO_TARGET_FEATURE_AVX) +# if defined(__AVX2__) +# define LZO_TARGET_FEATURE_AVX2 1 +# endif +# endif +# endif +#endif +#if (LZO_TARGET_FEATURE_SSSE3 && !(LZO_TARGET_FEATURE_SSE2)) +# error "unexpected configuration - check your compiler defines" +#endif +#if (LZO_TARGET_FEATURE_SSE4_2 && !(LZO_TARGET_FEATURE_SSSE3)) +# error "unexpected configuration - check your compiler defines" +#endif +#if (LZO_TARGET_FEATURE_AVX && !(LZO_TARGET_FEATURE_SSSE3)) +# error "unexpected configuration - check your compiler defines" +#endif +#if (LZO_TARGET_FEATURE_AVX2 && !(LZO_TARGET_FEATURE_AVX)) +# error "unexpected configuration - check your compiler defines" +#endif +#if (LZO_ARCH_ARM) +# if !defined(LZO_TARGET_FEATURE_NEON) +# if defined(__ARM_NEON) && ((__ARM_NEON)+0) +# define LZO_TARGET_FEATURE_NEON 1 +# elif 1 && defined(__ARM_NEON__) && ((__ARM_NEON__)+0) +# define LZO_TARGET_FEATURE_NEON 1 +# elif 1 && defined(__TARGET_FEATURE_NEON) && ((__TARGET_FEATURE_NEON)+0) +# define LZO_TARGET_FEATURE_NEON 1 +# endif +# endif +#elif (LZO_ARCH_ARM64) +# if !defined(LZO_TARGET_FEATURE_NEON) +# if 1 +# define LZO_TARGET_FEATURE_NEON 1 +# endif +# endif +#endif +#if 0 +#elif !defined(__LZO_MM_OVERRIDE) +#if (LZO_ARCH_I086) +#if (UINT_MAX != LZO_0xffffL) +# error "unexpected configuration - check your compiler defines" +#endif +#if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) +# define LZO_MM_TINY 1 +#elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM) +# define LZO_MM_HUGE 1 +#elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL) +# define LZO_MM_SMALL 1 +#elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM) +# define LZO_MM_MEDIUM 1 +#elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM) +# define LZO_MM_COMPACT 1 +#elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL) +# define LZO_MM_LARGE 1 +#elif (LZO_CC_AZTECC) +# if defined(_LARGE_CODE) && defined(_LARGE_DATA) +# define LZO_MM_LARGE 1 +# elif defined(_LARGE_CODE) +# define LZO_MM_MEDIUM 1 +# elif defined(_LARGE_DATA) +# define LZO_MM_COMPACT 1 +# else +# define LZO_MM_SMALL 1 +# endif +#elif (LZO_CC_ZORTECHC && defined(__VCM__)) +# define LZO_MM_LARGE 1 +#else +# error "unknown LZO_ARCH_I086 memory model" +#endif +#if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) +#define LZO_HAVE_MM_HUGE_PTR 1 +#define LZO_HAVE_MM_HUGE_ARRAY 1 +#if (LZO_MM_TINY) +# undef LZO_HAVE_MM_HUGE_ARRAY +#endif +#if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC) +# undef LZO_HAVE_MM_HUGE_PTR +# undef LZO_HAVE_MM_HUGE_ARRAY +#elif (LZO_CC_DMC || LZO_CC_SYMANTECC) +# undef LZO_HAVE_MM_HUGE_ARRAY +#elif (LZO_CC_MSC && defined(_QC)) +# undef LZO_HAVE_MM_HUGE_ARRAY +# if (_MSC_VER < 600) +# undef LZO_HAVE_MM_HUGE_PTR +# endif +#elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) +# undef LZO_HAVE_MM_HUGE_ARRAY +#endif +#if (LZO_ARCH_I086PM) && !(LZO_HAVE_MM_HUGE_PTR) +# if (LZO_OS_DOS16) +# error "unexpected configuration - check your compiler defines" +# elif (LZO_CC_ZORTECHC) +# else +# error "unexpected configuration - check your compiler defines" +# endif +#endif +#if defined(__cplusplus) +extern "C" { +#endif +#if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200)) + extern void __near __cdecl _AHSHIFT(void); +# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) +#elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) + extern void __near __cdecl _AHSHIFT(void); +# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) +#elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC) + extern void __near __cdecl _AHSHIFT(void); +# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) +#elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295)) + extern void __near __cdecl _AHSHIFT(void); +# define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) +#elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16) +# define LZO_MM_AHSHIFT 12 +#elif (LZO_CC_WATCOMC) + extern unsigned char _HShift; +# define LZO_MM_AHSHIFT ((unsigned) _HShift) +#else +# error "FIXME - implement LZO_MM_AHSHIFT" +#endif +#if defined(__cplusplus) +} +#endif +#endif +#elif (LZO_ARCH_C166) +#if !defined(__MODEL__) +# error "FIXME - LZO_ARCH_C166 __MODEL__" +#elif ((__MODEL__) == 0) +# define LZO_MM_SMALL 1 +#elif ((__MODEL__) == 1) +# define LZO_MM_SMALL 1 +#elif ((__MODEL__) == 2) +# define LZO_MM_LARGE 1 +#elif ((__MODEL__) == 3) +# define LZO_MM_TINY 1 +#elif ((__MODEL__) == 4) +# define LZO_MM_XTINY 1 +#elif ((__MODEL__) == 5) +# define LZO_MM_XSMALL 1 +#else +# error "FIXME - LZO_ARCH_C166 __MODEL__" +#endif +#elif (LZO_ARCH_MCS251) +#if !defined(__MODEL__) +# error "FIXME - LZO_ARCH_MCS251 __MODEL__" +#elif ((__MODEL__) == 0) +# define LZO_MM_SMALL 1 +#elif ((__MODEL__) == 2) +# define LZO_MM_LARGE 1 +#elif ((__MODEL__) == 3) +# define LZO_MM_TINY 1 +#elif ((__MODEL__) == 4) +# define LZO_MM_XTINY 1 +#elif ((__MODEL__) == 5) +# define LZO_MM_XSMALL 1 +#else +# error "FIXME - LZO_ARCH_MCS251 __MODEL__" +#endif +#elif (LZO_ARCH_MCS51) +#if !defined(__MODEL__) +# error "FIXME - LZO_ARCH_MCS51 __MODEL__" +#elif ((__MODEL__) == 1) +# define LZO_MM_SMALL 1 +#elif ((__MODEL__) == 2) +# define LZO_MM_LARGE 1 +#elif ((__MODEL__) == 3) +# define LZO_MM_TINY 1 +#elif ((__MODEL__) == 4) +# define LZO_MM_XTINY 1 +#elif ((__MODEL__) == 5) +# define LZO_MM_XSMALL 1 +#else +# error "FIXME - LZO_ARCH_MCS51 __MODEL__" +#endif +#elif (LZO_ARCH_CRAY_PVP) +# define LZO_MM_PVP 1 +#else +# define LZO_MM_FLAT 1 +#endif +#if (LZO_MM_COMPACT) +# define LZO_INFO_MM "compact" +#elif (LZO_MM_FLAT) +# define LZO_INFO_MM "flat" +#elif (LZO_MM_HUGE) +# define LZO_INFO_MM "huge" +#elif (LZO_MM_LARGE) +# define LZO_INFO_MM "large" +#elif (LZO_MM_MEDIUM) +# define LZO_INFO_MM "medium" +#elif (LZO_MM_PVP) +# define LZO_INFO_MM "pvp" +#elif (LZO_MM_SMALL) +# define LZO_INFO_MM "small" +#elif (LZO_MM_TINY) +# define LZO_INFO_MM "tiny" +#else +# error "unknown memory model" +#endif +#endif +#if !defined(__lzo_gnuc_extension__) +#if (LZO_CC_GNUC >= 0x020800ul) +# define __lzo_gnuc_extension__ __extension__ +#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define __lzo_gnuc_extension__ __extension__ +#elif (LZO_CC_IBMC >= 600) +# define __lzo_gnuc_extension__ __extension__ +#endif +#endif +#if !defined(__lzo_gnuc_extension__) +# define __lzo_gnuc_extension__ /*empty*/ +#endif +#if !defined(lzo_has_builtin) +#if (LZO_CC_CLANG) && defined(__has_builtin) +# define lzo_has_builtin __has_builtin +#endif +#endif +#if !defined(lzo_has_builtin) +# define lzo_has_builtin(x) 0 +#endif +#if !defined(lzo_has_attribute) +#if (LZO_CC_CLANG) && defined(__has_attribute) +# define lzo_has_attribute __has_attribute +#endif +#endif +#if !defined(lzo_has_attribute) +# define lzo_has_attribute(x) 0 +#endif +#if !defined(lzo_has_declspec_attribute) +#if (LZO_CC_CLANG) && defined(__has_declspec_attribute) +# define lzo_has_declspec_attribute __has_declspec_attribute +#endif +#endif +#if !defined(lzo_has_declspec_attribute) +# define lzo_has_declspec_attribute(x) 0 +#endif +#if !defined(lzo_has_feature) +#if (LZO_CC_CLANG) && defined(__has_feature) +# define lzo_has_feature __has_feature +#endif +#endif +#if !defined(lzo_has_feature) +# define lzo_has_feature(x) 0 +#endif +#if !defined(lzo_has_extension) +#if (LZO_CC_CLANG) && defined(__has_extension) +# define lzo_has_extension __has_extension +#elif (LZO_CC_CLANG) && defined(__has_feature) +# define lzo_has_extension __has_feature +#endif +#endif +#if !defined(lzo_has_extension) +# define lzo_has_extension(x) 0 +#endif +#if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) && defined(__cplusplus) && 0 +# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) +# define LZO_CFG_USE_NEW_STYLE_CASTS 0 +# elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1200)) +# define LZO_CFG_USE_NEW_STYLE_CASTS 0 +# else +# define LZO_CFG_USE_NEW_STYLE_CASTS 1 +# endif +#endif +#if !defined(LZO_CFG_USE_NEW_STYLE_CASTS) +# define LZO_CFG_USE_NEW_STYLE_CASTS 0 +#endif +#if !defined(__cplusplus) +# if defined(LZO_CFG_USE_NEW_STYLE_CASTS) +# undef LZO_CFG_USE_NEW_STYLE_CASTS +# endif +# define LZO_CFG_USE_NEW_STYLE_CASTS 0 +#endif +#if !defined(LZO_REINTERPRET_CAST) +# if (LZO_CFG_USE_NEW_STYLE_CASTS) +# define LZO_REINTERPRET_CAST(t,e) (reinterpret_cast (e)) +# endif +#endif +#if !defined(LZO_REINTERPRET_CAST) +# define LZO_REINTERPRET_CAST(t,e) ((t) (e)) +#endif +#if !defined(LZO_STATIC_CAST) +# if (LZO_CFG_USE_NEW_STYLE_CASTS) +# define LZO_STATIC_CAST(t,e) (static_cast (e)) +# endif +#endif +#if !defined(LZO_STATIC_CAST) +# define LZO_STATIC_CAST(t,e) ((t) (e)) +#endif +#if !defined(LZO_STATIC_CAST2) +# define LZO_STATIC_CAST2(t1,t2,e) LZO_STATIC_CAST(t1, LZO_STATIC_CAST(t2, e)) +#endif +#if !defined(LZO_UNCONST_CAST) +# if (LZO_CFG_USE_NEW_STYLE_CASTS) +# define LZO_UNCONST_CAST(t,e) (const_cast (e)) +# elif (LZO_HAVE_MM_HUGE_PTR) +# define LZO_UNCONST_CAST(t,e) ((t) (e)) +# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((const void *) (e))))) +# endif +#endif +#if !defined(LZO_UNCONST_CAST) +# define LZO_UNCONST_CAST(t,e) ((t) ((void *) ((const void *) (e)))) +#endif +#if !defined(LZO_UNCONST_VOLATILE_CAST) +# if (LZO_CFG_USE_NEW_STYLE_CASTS) +# define LZO_UNCONST_VOLATILE_CAST(t,e) (const_cast (e)) +# elif (LZO_HAVE_MM_HUGE_PTR) +# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) (e)) +# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((lzo_uintptr_t) ((volatile const void *) (e))))) +# endif +#endif +#if !defined(LZO_UNCONST_VOLATILE_CAST) +# define LZO_UNCONST_VOLATILE_CAST(t,e) ((t) ((volatile void *) ((volatile const void *) (e)))) +#endif +#if !defined(LZO_UNVOLATILE_CAST) +# if (LZO_CFG_USE_NEW_STYLE_CASTS) +# define LZO_UNVOLATILE_CAST(t,e) (const_cast (e)) +# elif (LZO_HAVE_MM_HUGE_PTR) +# define LZO_UNVOLATILE_CAST(t,e) ((t) (e)) +# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((lzo_uintptr_t) ((volatile void *) (e))))) +# endif +#endif +#if !defined(LZO_UNVOLATILE_CAST) +# define LZO_UNVOLATILE_CAST(t,e) ((t) ((void *) ((volatile void *) (e)))) +#endif +#if !defined(LZO_UNVOLATILE_CONST_CAST) +# if (LZO_CFG_USE_NEW_STYLE_CASTS) +# define LZO_UNVOLATILE_CONST_CAST(t,e) (const_cast (e)) +# elif (LZO_HAVE_MM_HUGE_PTR) +# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) (e)) +# elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((lzo_uintptr_t) ((volatile const void *) (e))))) +# endif +#endif +#if !defined(LZO_UNVOLATILE_CONST_CAST) +# define LZO_UNVOLATILE_CONST_CAST(t,e) ((t) ((const void *) ((volatile const void *) (e)))) +#endif +#if !defined(LZO_PCAST) +# if (LZO_HAVE_MM_HUGE_PTR) +# define LZO_PCAST(t,e) ((t) (e)) +# endif +#endif +#if !defined(LZO_PCAST) +# define LZO_PCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(void *, e)) +#endif +#if !defined(LZO_CCAST) +# if (LZO_HAVE_MM_HUGE_PTR) +# define LZO_CCAST(t,e) ((t) (e)) +# endif +#endif +#if !defined(LZO_CCAST) +# define LZO_CCAST(t,e) LZO_STATIC_CAST(t, LZO_STATIC_CAST(const void *, e)) +#endif +#if !defined(LZO_ICONV) +# define LZO_ICONV(t,e) LZO_STATIC_CAST(t, e) +#endif +#if !defined(LZO_ICAST) +# define LZO_ICAST(t,e) LZO_STATIC_CAST(t, e) +#endif +#if !defined(LZO_ITRUNC) +# define LZO_ITRUNC(t,e) LZO_STATIC_CAST(t, e) +#endif +#if !defined(__lzo_cte) +# if (LZO_CC_MSC || LZO_CC_WATCOMC) +# define __lzo_cte(e) ((void)0,(e)) +# elif 1 +# define __lzo_cte(e) ((void)0,(e)) +# endif +#endif +#if !defined(__lzo_cte) +# define __lzo_cte(e) (e) +#endif +#if !defined(LZO_BLOCK_BEGIN) +# define LZO_BLOCK_BEGIN do { +# define LZO_BLOCK_END } while __lzo_cte(0) +#endif +#if !defined(LZO_UNUSED) +# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) +# define LZO_UNUSED(var) ((void) &var) +# elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) +# define LZO_UNUSED(var) if (&var) ; else +# elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030200ul)) +# define LZO_UNUSED(var) ((void) &var) +# elif (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define LZO_UNUSED(var) ((void) var) +# elif (LZO_CC_MSC && (_MSC_VER < 900)) +# define LZO_UNUSED(var) if (&var) ; else +# elif (LZO_CC_KEILC) +# define LZO_UNUSED(var) {extern int lzo_unused__[1-2*!(sizeof(var)>0)]; (void)lzo_unused__;} +# elif (LZO_CC_PACIFICC) +# define LZO_UNUSED(var) ((void) sizeof(var)) +# elif (LZO_CC_WATCOMC) && defined(__cplusplus) +# define LZO_UNUSED(var) ((void) var) +# else +# define LZO_UNUSED(var) ((void) &var) +# endif +#endif +#if !defined(LZO_UNUSED_RESULT) +# define LZO_UNUSED_RESULT(var) LZO_UNUSED(var) +#endif +#if !defined(LZO_UNUSED_FUNC) +# if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) +# define LZO_UNUSED_FUNC(func) ((void) func) +# elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) +# define LZO_UNUSED_FUNC(func) if (func) ; else +# elif (LZO_CC_CLANG || LZO_CC_LLVM) +# define LZO_UNUSED_FUNC(func) ((void) &func) +# elif (LZO_CC_MSC && (_MSC_VER < 900)) +# define LZO_UNUSED_FUNC(func) if (func) ; else +# elif (LZO_CC_MSC) +# define LZO_UNUSED_FUNC(func) ((void) &func) +# elif (LZO_CC_KEILC || LZO_CC_PELLESC) +# define LZO_UNUSED_FUNC(func) {extern int lzo_unused__[1-2*!(sizeof((int)func)>0)]; (void)lzo_unused__;} +# else +# define LZO_UNUSED_FUNC(func) ((void) func) +# endif +#endif +#if !defined(LZO_UNUSED_LABEL) +# if (LZO_CC_CLANG >= 0x020800ul) +# define LZO_UNUSED_LABEL(l) (__lzo_gnuc_extension__ ((void) ((const void *) &&l))) +# elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_INTELC || LZO_CC_WATCOMC) +# define LZO_UNUSED_LABEL(l) if __lzo_cte(0) goto l +# else +# define LZO_UNUSED_LABEL(l) switch (0) case 1:goto l +# endif +#endif +#if !defined(LZO_DEFINE_UNINITIALIZED_VAR) +# if 0 +# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var +# elif 0 && (LZO_CC_GNUC) +# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var +# else +# define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init +# endif +#endif +#if !defined(__lzo_inline) +#if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) +#elif defined(__cplusplus) +# define __lzo_inline inline +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L) +# define __lzo_inline inline +#elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) +# define __lzo_inline __inline +#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) +# define __lzo_inline __inline__ +#elif (LZO_CC_DMC) +# define __lzo_inline __inline +#elif (LZO_CC_GHS) +# define __lzo_inline __inline__ +#elif (LZO_CC_IBMC >= 600) +# define __lzo_inline __inline__ +#elif (LZO_CC_INTELC) +# define __lzo_inline __inline +#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) +# define __lzo_inline __inline +#elif (LZO_CC_MSC && (_MSC_VER >= 900)) +# define __lzo_inline __inline +#elif (LZO_CC_SUNPROC >= 0x5100) +# define __lzo_inline __inline__ +#endif +#endif +#if defined(__lzo_inline) +# ifndef __lzo_HAVE_inline +# define __lzo_HAVE_inline 1 +# endif +#else +# define __lzo_inline /*empty*/ +#endif +#if !defined(__lzo_forceinline) +#if (LZO_CC_GNUC >= 0x030200ul) +# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) +#elif (LZO_CC_IBMC >= 700) +# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) +#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) +# define __lzo_forceinline __forceinline +#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) +# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) +#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) +#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) +# define __lzo_forceinline __forceinline +#elif (LZO_CC_PGI >= 0x0d0a00ul) +# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) +#elif (LZO_CC_SUNPROC >= 0x5100) +# define __lzo_forceinline __inline__ __attribute__((__always_inline__)) +#endif +#endif +#if defined(__lzo_forceinline) +# ifndef __lzo_HAVE_forceinline +# define __lzo_HAVE_forceinline 1 +# endif +#else +# define __lzo_forceinline __lzo_inline +#endif +#if !defined(__lzo_noinline) +#if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) +# define __lzo_noinline __attribute__((__noinline__,__used__)) +#elif (LZO_CC_GNUC >= 0x030200ul) +# define __lzo_noinline __attribute__((__noinline__)) +#elif (LZO_CC_IBMC >= 700) +# define __lzo_noinline __attribute__((__noinline__)) +#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600)) +# define __lzo_noinline __declspec(noinline) +#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) +# define __lzo_noinline __attribute__((__noinline__)) +#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define __lzo_noinline __attribute__((__noinline__)) +#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) +# define __lzo_noinline __declspec(noinline) +#elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) +# if defined(__cplusplus) +# else +# define __lzo_noinline __declspec(noinline) +# endif +#elif (LZO_CC_PGI >= 0x0d0a00ul) +# define __lzo_noinline __attribute__((__noinline__)) +#elif (LZO_CC_SUNPROC >= 0x5100) +# define __lzo_noinline __attribute__((__noinline__)) +#endif +#endif +#if defined(__lzo_noinline) +# ifndef __lzo_HAVE_noinline +# define __lzo_HAVE_noinline 1 +# endif +#else +# define __lzo_noinline /*empty*/ +#endif +#if (__lzo_HAVE_forceinline || __lzo_HAVE_noinline) && !(__lzo_HAVE_inline) +# error "unexpected configuration - check your compiler defines" +#endif +#if !defined(__lzo_static_inline) +#if (LZO_CC_IBMC) +# define __lzo_static_inline __lzo_gnuc_extension__ static __lzo_inline +#endif +#endif +#if !defined(__lzo_static_inline) +# define __lzo_static_inline static __lzo_inline +#endif +#if !defined(__lzo_static_forceinline) +#if (LZO_CC_IBMC) +# define __lzo_static_forceinline __lzo_gnuc_extension__ static __lzo_forceinline +#endif +#endif +#if !defined(__lzo_static_forceinline) +# define __lzo_static_forceinline static __lzo_forceinline +#endif +#if !defined(__lzo_static_noinline) +#if (LZO_CC_IBMC) +# define __lzo_static_noinline __lzo_gnuc_extension__ static __lzo_noinline +#endif +#endif +#if !defined(__lzo_static_noinline) +# define __lzo_static_noinline static __lzo_noinline +#endif +#if !defined(__lzo_c99_extern_inline) +#if defined(__GNUC_GNU_INLINE__) +# define __lzo_c99_extern_inline __lzo_inline +#elif defined(__GNUC_STDC_INLINE__) +# define __lzo_c99_extern_inline extern __lzo_inline +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__-0 >= 199901L) +# define __lzo_c99_extern_inline extern __lzo_inline +#endif +#if !defined(__lzo_c99_extern_inline) && (__lzo_HAVE_inline) +# define __lzo_c99_extern_inline __lzo_inline +#endif +#endif +#if defined(__lzo_c99_extern_inline) +# ifndef __lzo_HAVE_c99_extern_inline +# define __lzo_HAVE_c99_extern_inline 1 +# endif +#else +# define __lzo_c99_extern_inline /*empty*/ +#endif +#if !defined(__lzo_may_alias) +#if (LZO_CC_GNUC >= 0x030400ul) +# define __lzo_may_alias __attribute__((__may_alias__)) +#elif (LZO_CC_CLANG >= 0x020900ul) +# define __lzo_may_alias __attribute__((__may_alias__)) +#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1210)) && 0 +# define __lzo_may_alias __attribute__((__may_alias__)) +#elif (LZO_CC_PGI >= 0x0d0a00ul) && 0 +# define __lzo_may_alias __attribute__((__may_alias__)) +#endif +#endif +#if defined(__lzo_may_alias) +# ifndef __lzo_HAVE_may_alias +# define __lzo_HAVE_may_alias 1 +# endif +#else +# define __lzo_may_alias /*empty*/ +#endif +#if !defined(__lzo_noreturn) +#if (LZO_CC_GNUC >= 0x020700ul) +# define __lzo_noreturn __attribute__((__noreturn__)) +#elif (LZO_CC_IBMC >= 700) +# define __lzo_noreturn __attribute__((__noreturn__)) +#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) +# define __lzo_noreturn __declspec(noreturn) +#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600)) +# define __lzo_noreturn __attribute__((__noreturn__)) +#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define __lzo_noreturn __attribute__((__noreturn__)) +#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) +# define __lzo_noreturn __declspec(noreturn) +#elif (LZO_CC_PGI >= 0x0d0a00ul) +# define __lzo_noreturn __attribute__((__noreturn__)) +#endif +#endif +#if defined(__lzo_noreturn) +# ifndef __lzo_HAVE_noreturn +# define __lzo_HAVE_noreturn 1 +# endif +#else +# define __lzo_noreturn /*empty*/ +#endif +#if !defined(__lzo_nothrow) +#if (LZO_CC_GNUC >= 0x030300ul) +# define __lzo_nothrow __attribute__((__nothrow__)) +#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 450)) && defined(__cplusplus) +# define __lzo_nothrow __declspec(nothrow) +#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 900)) +# define __lzo_nothrow __attribute__((__nothrow__)) +#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define __lzo_nothrow __attribute__((__nothrow__)) +#elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) +# define __lzo_nothrow __declspec(nothrow) +#endif +#endif +#if defined(__lzo_nothrow) +# ifndef __lzo_HAVE_nothrow +# define __lzo_HAVE_nothrow 1 +# endif +#else +# define __lzo_nothrow /*empty*/ +#endif +#if !defined(__lzo_restrict) +#if (LZO_CC_GNUC >= 0x030400ul) +# define __lzo_restrict __restrict__ +#elif (LZO_CC_IBMC >= 800) && !defined(__cplusplus) +# define __lzo_restrict __restrict__ +#elif (LZO_CC_IBMC >= 1210) +# define __lzo_restrict __restrict__ +#elif (LZO_CC_INTELC_MSC && (__INTEL_COMPILER >= 600)) +#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 600)) +# define __lzo_restrict __restrict__ +#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM) +# define __lzo_restrict __restrict__ +#elif (LZO_CC_MSC && (_MSC_VER >= 1400)) +# define __lzo_restrict __restrict +#elif (LZO_CC_PGI >= 0x0d0a00ul) +# define __lzo_restrict __restrict__ +#endif +#endif +#if defined(__lzo_restrict) +# ifndef __lzo_HAVE_restrict +# define __lzo_HAVE_restrict 1 +# endif +#else +# define __lzo_restrict /*empty*/ +#endif +#if !defined(__lzo_alignof) +#if (LZO_CC_ARMCC || LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) +# define __lzo_alignof(e) __alignof__(e) +#elif (LZO_CC_GHS) && !defined(__cplusplus) +# define __lzo_alignof(e) __alignof__(e) +#elif (LZO_CC_IBMC >= 600) +# define __lzo_alignof(e) (__lzo_gnuc_extension__ __alignof__(e)) +#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) +# define __lzo_alignof(e) __alignof__(e) +#elif (LZO_CC_MSC && (_MSC_VER >= 1300)) +# define __lzo_alignof(e) __alignof(e) +#elif (LZO_CC_SUNPROC >= 0x5100) +# define __lzo_alignof(e) __alignof__(e) +#endif +#endif +#if defined(__lzo_alignof) +# ifndef __lzo_HAVE_alignof +# define __lzo_HAVE_alignof 1 +# endif +#endif +#if !defined(__lzo_struct_packed) +#if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) +#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul)) +#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus) +#elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul)) +#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus) +#elif (LZO_CC_GNUC >= 0x030400ul) && !(LZO_CC_PCC_GNUC) && (LZO_ARCH_AMD64 || LZO_ARCH_I386) +# define __lzo_struct_packed(s) struct s { +# define __lzo_struct_packed_end() } __attribute__((__gcc_struct__,__packed__)); +# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__gcc_struct__,__packed__)); +#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100)) +# define __lzo_struct_packed(s) struct s { +# define __lzo_struct_packed_end() } __attribute__((__packed__)); +# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__)); +#elif (LZO_CC_IBMC >= 700) +# define __lzo_struct_packed(s) __lzo_gnuc_extension__ struct s { +# define __lzo_struct_packed_end() } __attribute__((__packed__)); +# define __lzo_struct_packed_ma_end() } __lzo_may_alias __attribute__((__packed__)); +#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) +# define __lzo_struct_packed(s) __pragma(pack(push,1)) struct s { +# define __lzo_struct_packed_end() } __pragma(pack(pop)); +#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900)) +# define __lzo_struct_packed(s) _Packed struct s { +# define __lzo_struct_packed_end() }; +#endif +#endif +#if defined(__lzo_struct_packed) && !defined(__lzo_struct_packed_ma) +# define __lzo_struct_packed_ma(s) __lzo_struct_packed(s) +#endif +#if defined(__lzo_struct_packed_end) && !defined(__lzo_struct_packed_ma_end) +# define __lzo_struct_packed_ma_end() __lzo_struct_packed_end() +#endif +#if !defined(__lzo_byte_struct) +#if defined(__lzo_struct_packed) +# define __lzo_byte_struct(s,n) __lzo_struct_packed(s) unsigned char a[n]; __lzo_struct_packed_end() +# define __lzo_byte_struct_ma(s,n) __lzo_struct_packed_ma(s) unsigned char a[n]; __lzo_struct_packed_ma_end() +#elif (LZO_CC_CILLY || LZO_CC_CLANG || LZO_CC_PGI || (LZO_CC_SUNPROC >= 0x5100)) +# define __lzo_byte_struct(s,n) struct s { unsigned char a[n]; } __attribute__((__packed__)); +# define __lzo_byte_struct_ma(s,n) struct s { unsigned char a[n]; } __lzo_may_alias __attribute__((__packed__)); +#endif +#endif +#if defined(__lzo_byte_struct) && !defined(__lzo_byte_struct_ma) +# define __lzo_byte_struct_ma(s,n) __lzo_byte_struct(s,n) +#endif +#if !defined(__lzo_struct_align16) && (__lzo_HAVE_alignof) +#if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul)) +#elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) +#elif (LZO_CC_CILLY || LZO_CC_PCC) +#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) +# define __lzo_struct_align16(s) struct __declspec(align(16)) s { +# define __lzo_struct_align16_end() }; +# define __lzo_struct_align32(s) struct __declspec(align(32)) s { +# define __lzo_struct_align32_end() }; +# define __lzo_struct_align64(s) struct __declspec(align(64)) s { +# define __lzo_struct_align64_end() }; +#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || (LZO_CC_IBMC >= 700) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define __lzo_struct_align16(s) struct s { +# define __lzo_struct_align16_end() } __attribute__((__aligned__(16))); +# define __lzo_struct_align32(s) struct s { +# define __lzo_struct_align32_end() } __attribute__((__aligned__(32))); +# define __lzo_struct_align64(s) struct s { +# define __lzo_struct_align64_end() } __attribute__((__aligned__(64))); +#endif +#endif +#if !defined(__lzo_union_um) +#if (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020800ul)) && defined(__cplusplus) +#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020700ul)) +#elif (LZO_CC_GNUC && (LZO_CC_GNUC < 0x020800ul)) && defined(__cplusplus) +#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER < 810)) +#elif (LZO_CC_PCC && (LZO_CC_PCC < 0x010100ul)) +#elif (LZO_CC_SUNPROC && (LZO_CC_SUNPROC < 0x5110)) && !defined(__cplusplus) +#elif (LZO_CC_ARMCC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || (LZO_CC_PGI >= 0x0d0a00ul) || (LZO_CC_SUNPROC >= 0x5100)) +# define __lzo_union_am(s) union s { +# define __lzo_union_am_end() } __lzo_may_alias; +# define __lzo_union_um(s) union s { +# define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__)); +#elif (LZO_CC_IBMC >= 700) +# define __lzo_union_am(s) __lzo_gnuc_extension__ union s { +# define __lzo_union_am_end() } __lzo_may_alias; +# define __lzo_union_um(s) __lzo_gnuc_extension__ union s { +# define __lzo_union_um_end() } __lzo_may_alias __attribute__((__packed__)); +#elif (LZO_CC_INTELC_MSC) || (LZO_CC_MSC && (_MSC_VER >= 1300)) +# define __lzo_union_um(s) __pragma(pack(push,1)) union s { +# define __lzo_union_um_end() } __pragma(pack(pop)); +#elif (LZO_CC_WATCOMC && (__WATCOMC__ >= 900)) +# define __lzo_union_um(s) _Packed union s { +# define __lzo_union_um_end() }; +#endif +#endif +#if !defined(__lzo_union_am) +# define __lzo_union_am(s) union s { +# define __lzo_union_am_end() }; +#endif +#if !defined(__lzo_constructor) +#if (LZO_CC_GNUC >= 0x030400ul) +# define __lzo_constructor __attribute__((__constructor__,__used__)) +#elif (LZO_CC_GNUC >= 0x020700ul) +# define __lzo_constructor __attribute__((__constructor__)) +#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) +# define __lzo_constructor __attribute__((__constructor__,__used__)) +#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define __lzo_constructor __attribute__((__constructor__)) +#endif +#endif +#if defined(__lzo_constructor) +# ifndef __lzo_HAVE_constructor +# define __lzo_HAVE_constructor 1 +# endif +#endif +#if !defined(__lzo_destructor) +#if (LZO_CC_GNUC >= 0x030400ul) +# define __lzo_destructor __attribute__((__destructor__,__used__)) +#elif (LZO_CC_GNUC >= 0x020700ul) +# define __lzo_destructor __attribute__((__destructor__)) +#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 800)) +# define __lzo_destructor __attribute__((__destructor__,__used__)) +#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define __lzo_destructor __attribute__((__destructor__)) +#endif +#endif +#if defined(__lzo_destructor) +# ifndef __lzo_HAVE_destructor +# define __lzo_HAVE_destructor 1 +# endif +#endif +#if (__lzo_HAVE_destructor) && !(__lzo_HAVE_constructor) +# error "unexpected configuration - check your compiler defines" +#endif +#if !defined(__lzo_likely) && !defined(__lzo_unlikely) +#if (LZO_CC_GNUC >= 0x030200ul) +# define __lzo_likely(e) (__builtin_expect(!!(e),1)) +# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) +#elif (LZO_CC_IBMC >= 1010) +# define __lzo_likely(e) (__builtin_expect(!!(e),1)) +# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) +#elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) +# define __lzo_likely(e) (__builtin_expect(!!(e),1)) +# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) +#elif (LZO_CC_CLANG && LZO_CC_CLANG_C2) +#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define __lzo_likely(e) (__builtin_expect(!!(e),1)) +# define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) +#endif +#endif +#if defined(__lzo_likely) +# ifndef __lzo_HAVE_likely +# define __lzo_HAVE_likely 1 +# endif +#else +# define __lzo_likely(e) (e) +#endif +#if defined(__lzo_very_likely) +# ifndef __lzo_HAVE_very_likely +# define __lzo_HAVE_very_likely 1 +# endif +#else +# define __lzo_very_likely(e) __lzo_likely(e) +#endif +#if defined(__lzo_unlikely) +# ifndef __lzo_HAVE_unlikely +# define __lzo_HAVE_unlikely 1 +# endif +#else +# define __lzo_unlikely(e) (e) +#endif +#if defined(__lzo_very_unlikely) +# ifndef __lzo_HAVE_very_unlikely +# define __lzo_HAVE_very_unlikely 1 +# endif +#else +# define __lzo_very_unlikely(e) __lzo_unlikely(e) +#endif +#if !defined(__lzo_loop_forever) +# if (LZO_CC_IBMC) +# define __lzo_loop_forever() LZO_BLOCK_BEGIN for (;;) { ; } LZO_BLOCK_END +# else +# define __lzo_loop_forever() do { ; } while __lzo_cte(1) +# endif +#endif +#if !defined(__lzo_unreachable) +#if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x020800ul)) && lzo_has_builtin(__builtin_unreachable) +# define __lzo_unreachable() __builtin_unreachable(); +#elif (LZO_CC_GNUC >= 0x040500ul) +# define __lzo_unreachable() __builtin_unreachable(); +#elif (LZO_CC_INTELC_GNUC && (__INTEL_COMPILER >= 1300)) && 1 +# define __lzo_unreachable() __builtin_unreachable(); +#endif +#endif +#if defined(__lzo_unreachable) +# ifndef __lzo_HAVE_unreachable +# define __lzo_HAVE_unreachable 1 +# endif +#else +# if 0 +# define __lzo_unreachable() ((void)0); +# else +# define __lzo_unreachable() __lzo_loop_forever(); +# endif +#endif +#if !defined(lzo_unused_funcs_impl) +# if 1 && (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || (LZO_CC_GNUC >= 0x020700ul) || LZO_CC_INTELC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) +# define lzo_unused_funcs_impl(r,f) static r __attribute__((__unused__)) f +# elif 1 && (LZO_CC_BORLANDC || LZO_CC_GNUC) +# define lzo_unused_funcs_impl(r,f) static r f +# else +# define lzo_unused_funcs_impl(r,f) __lzo_static_forceinline r f +# endif +#endif +#ifndef __LZO_CTA_NAME +#if (LZO_CFG_USE_COUNTER) +# define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__COUNTER__) +#else +# define __LZO_CTA_NAME(a) LZO_PP_ECONCAT2(a,__LINE__) +#endif +#endif +#if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) +# if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) +# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END +# elif (LZO_CC_DMC || LZO_CC_SYMANTECC) +# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1u-2*!(e)]; LZO_EXTERN_C_END +# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) +# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-!(e)]; LZO_EXTERN_C_END +# elif (LZO_CC_CLANG && (LZO_CC_CLANG < 0x020900ul)) && defined(__cplusplus) +# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN int __LZO_CTA_NAME(lzo_cta_f__)(int [1-2*!(e)]); LZO_EXTERN_C_END +# elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__) +# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__)); LZO_EXTERN_C_END +# else +# define LZO_COMPILE_TIME_ASSERT_HEADER(e) LZO_EXTERN_C_BEGIN extern int __LZO_CTA_NAME(lzo_cta__)[1-2*!(e)]; LZO_EXTERN_C_END +# endif +#endif +#if !defined(LZO_COMPILE_TIME_ASSERT) +# if (LZO_CC_AZTECC) +# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-!(e)];} +# elif (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030000ul)) +# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));} +# elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) +# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; +# elif (LZO_CC_GNUC) && defined(__CHECKER__) && defined(__SPARSE_CHECKER__) +# define LZO_COMPILE_TIME_ASSERT(e) {(void) (0/!!(e));} +# elif (LZO_CC_GNUC >= 0x040700ul) && (LZO_CFG_USE_COUNTER) && defined(__cplusplus) +# define LZO_COMPILE_TIME_ASSERT(e) {enum {__LZO_CTA_NAME(lzo_cta_e__)=1/!!(e)} __attribute__((__unused__));} +# elif (LZO_CC_GNUC >= 0x040700ul) +# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)] __attribute__((__unused__));} +# elif (LZO_CC_MSC && (_MSC_VER < 900)) +# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; +# elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) +# define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; +# else +# define LZO_COMPILE_TIME_ASSERT(e) {typedef int __LZO_CTA_NAME(lzo_cta_t__)[1-2*!(e)];} +# endif +#endif +#if (LZO_LANG_ASSEMBLER) +# undef LZO_COMPILE_TIME_ASSERT_HEADER +# define LZO_COMPILE_TIME_ASSERT_HEADER(e) /*empty*/ +#else +LZO_COMPILE_TIME_ASSERT_HEADER(1 == 1) +#if defined(__cplusplus) +extern "C" { LZO_COMPILE_TIME_ASSERT_HEADER(2 == 2) } +#endif +LZO_COMPILE_TIME_ASSERT_HEADER(3 == 3) +#endif +#if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) +# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) +# elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) +# define __lzo_cdecl __cdecl +# define __lzo_cdecl_atexit /*empty*/ +# define __lzo_cdecl_main __cdecl +# if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) +# define __lzo_cdecl_qsort __pascal +# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) +# define __lzo_cdecl_qsort _stdcall +# else +# define __lzo_cdecl_qsort __cdecl +# endif +# elif (LZO_CC_WATCOMC) +# define __lzo_cdecl __cdecl +# else +# define __lzo_cdecl __cdecl +# define __lzo_cdecl_atexit __cdecl +# define __lzo_cdecl_main __cdecl +# define __lzo_cdecl_qsort __cdecl +# endif +# if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) +# elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) +# define __lzo_cdecl_sighandler __pascal +# elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) +# define __lzo_cdecl_sighandler _stdcall +# elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) +# define __lzo_cdecl_sighandler __clrcall +# elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) +# if defined(_DLL) +# define __lzo_cdecl_sighandler _far _cdecl _loadds +# elif defined(_MT) +# define __lzo_cdecl_sighandler _far _cdecl +# else +# define __lzo_cdecl_sighandler _cdecl +# endif +# else +# define __lzo_cdecl_sighandler __cdecl +# endif +#elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) +# define __lzo_cdecl __cdecl +#elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) +# define __lzo_cdecl cdecl +#endif +#if !defined(__lzo_cdecl) +# define __lzo_cdecl /*empty*/ +#endif +#if !defined(__lzo_cdecl_atexit) +# define __lzo_cdecl_atexit /*empty*/ +#endif +#if !defined(__lzo_cdecl_main) +# define __lzo_cdecl_main /*empty*/ +#endif +#if !defined(__lzo_cdecl_qsort) +# define __lzo_cdecl_qsort /*empty*/ +#endif +#if !defined(__lzo_cdecl_sighandler) +# define __lzo_cdecl_sighandler /*empty*/ +#endif +#if !defined(__lzo_cdecl_va) +# define __lzo_cdecl_va __lzo_cdecl +#endif +#if !(LZO_CFG_NO_WINDOWS_H) +#if !defined(LZO_HAVE_WINDOWS_H) +#if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) +# if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) +# elif ((LZO_OS_WIN32 && defined(__PW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x030000ul))) +# elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) +# else +# define LZO_HAVE_WINDOWS_H 1 +# endif +#endif +#endif +#endif +#define LZO_SIZEOF_CHAR 1 +#ifndef LZO_SIZEOF_SHORT +#if defined(SIZEOF_SHORT) +# define LZO_SIZEOF_SHORT (SIZEOF_SHORT) +#elif defined(__SIZEOF_SHORT__) +# define LZO_SIZEOF_SHORT (__SIZEOF_SHORT__) +#endif +#endif +#ifndef LZO_SIZEOF_INT +#if defined(SIZEOF_INT) +# define LZO_SIZEOF_INT (SIZEOF_INT) +#elif defined(__SIZEOF_INT__) +# define LZO_SIZEOF_INT (__SIZEOF_INT__) +#endif +#endif +#ifndef LZO_SIZEOF_LONG +#if defined(SIZEOF_LONG) +# define LZO_SIZEOF_LONG (SIZEOF_LONG) +#elif defined(__SIZEOF_LONG__) +# define LZO_SIZEOF_LONG (__SIZEOF_LONG__) +#endif +#endif +#ifndef LZO_SIZEOF_LONG_LONG +#if defined(SIZEOF_LONG_LONG) +# define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) +#elif defined(__SIZEOF_LONG_LONG__) +# define LZO_SIZEOF_LONG_LONG (__SIZEOF_LONG_LONG__) +#endif +#endif +#ifndef LZO_SIZEOF___INT16 +#if defined(SIZEOF___INT16) +# define LZO_SIZEOF___INT16 (SIZEOF___INT16) +#endif +#endif +#ifndef LZO_SIZEOF___INT32 +#if defined(SIZEOF___INT32) +# define LZO_SIZEOF___INT32 (SIZEOF___INT32) +#endif +#endif +#ifndef LZO_SIZEOF___INT64 +#if defined(SIZEOF___INT64) +# define LZO_SIZEOF___INT64 (SIZEOF___INT64) +#endif +#endif +#ifndef LZO_SIZEOF_VOID_P +#if defined(SIZEOF_VOID_P) +# define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) +#elif defined(__SIZEOF_POINTER__) +# define LZO_SIZEOF_VOID_P (__SIZEOF_POINTER__) +#endif +#endif +#ifndef LZO_SIZEOF_SIZE_T +#if defined(SIZEOF_SIZE_T) +# define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) +#elif defined(__SIZEOF_SIZE_T__) +# define LZO_SIZEOF_SIZE_T (__SIZEOF_SIZE_T__) +#endif +#endif +#ifndef LZO_SIZEOF_PTRDIFF_T +#if defined(SIZEOF_PTRDIFF_T) +# define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) +#elif defined(__SIZEOF_PTRDIFF_T__) +# define LZO_SIZEOF_PTRDIFF_T (__SIZEOF_PTRDIFF_T__) +#endif +#endif +#define __LZO_LSR(x,b) (((x)+0ul) >> (b)) +#if !defined(LZO_SIZEOF_SHORT) +# if (LZO_ARCH_CRAY_PVP) +# define LZO_SIZEOF_SHORT 8 +# elif (USHRT_MAX == LZO_0xffffL) +# define LZO_SIZEOF_SHORT 2 +# elif (__LZO_LSR(USHRT_MAX,7) == 1) +# define LZO_SIZEOF_SHORT 1 +# elif (__LZO_LSR(USHRT_MAX,15) == 1) +# define LZO_SIZEOF_SHORT 2 +# elif (__LZO_LSR(USHRT_MAX,31) == 1) +# define LZO_SIZEOF_SHORT 4 +# elif (__LZO_LSR(USHRT_MAX,63) == 1) +# define LZO_SIZEOF_SHORT 8 +# elif (__LZO_LSR(USHRT_MAX,127) == 1) +# define LZO_SIZEOF_SHORT 16 +# else +# error "LZO_SIZEOF_SHORT" +# endif +#endif +LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SHORT == sizeof(short)) +#if !defined(LZO_SIZEOF_INT) +# if (LZO_ARCH_CRAY_PVP) +# define LZO_SIZEOF_INT 8 +# elif (UINT_MAX == LZO_0xffffL) +# define LZO_SIZEOF_INT 2 +# elif (UINT_MAX == LZO_0xffffffffL) +# define LZO_SIZEOF_INT 4 +# elif (__LZO_LSR(UINT_MAX,7) == 1) +# define LZO_SIZEOF_INT 1 +# elif (__LZO_LSR(UINT_MAX,15) == 1) +# define LZO_SIZEOF_INT 2 +# elif (__LZO_LSR(UINT_MAX,31) == 1) +# define LZO_SIZEOF_INT 4 +# elif (__LZO_LSR(UINT_MAX,63) == 1) +# define LZO_SIZEOF_INT 8 +# elif (__LZO_LSR(UINT_MAX,127) == 1) +# define LZO_SIZEOF_INT 16 +# else +# error "LZO_SIZEOF_INT" +# endif +#endif +LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_INT == sizeof(int)) +#if !defined(LZO_SIZEOF_LONG) +# if (ULONG_MAX == LZO_0xffffffffL) +# define LZO_SIZEOF_LONG 4 +# elif (__LZO_LSR(ULONG_MAX,7) == 1) +# define LZO_SIZEOF_LONG 1 +# elif (__LZO_LSR(ULONG_MAX,15) == 1) +# define LZO_SIZEOF_LONG 2 +# elif (__LZO_LSR(ULONG_MAX,31) == 1) +# define LZO_SIZEOF_LONG 4 +# elif (__LZO_LSR(ULONG_MAX,39) == 1) +# define LZO_SIZEOF_LONG 5 +# elif (__LZO_LSR(ULONG_MAX,63) == 1) +# define LZO_SIZEOF_LONG 8 +# elif (__LZO_LSR(ULONG_MAX,127) == 1) +# define LZO_SIZEOF_LONG 16 +# else +# error "LZO_SIZEOF_LONG" +# endif +#endif +LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_LONG == sizeof(long)) +#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) +#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) +# if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) +# if (LZO_CC_GNUC >= 0x030300ul) +# if ((__LONG_MAX__-0) == (__LONG_LONG_MAX__-0)) +# define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG +# elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) +# define LZO_SIZEOF_LONG_LONG 4 +# endif +# endif +# endif +#endif +#endif +#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) +#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) +#if (LZO_ARCH_I086 && LZO_CC_DMC) +#elif (LZO_CC_CILLY) && defined(__GNUC__) +# define LZO_SIZEOF_LONG_LONG 8 +#elif (LZO_CC_ARMCC_GNUC || LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) +# define LZO_SIZEOF_LONG_LONG 8 +#elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) +# define LZO_SIZEOF_LONG_LONG 8 +#elif (LZO_OS_WIN64 || defined(_WIN64)) +# define LZO_SIZEOF___INT64 8 +#elif (LZO_ARCH_I386 && (LZO_CC_DMC)) +# define LZO_SIZEOF_LONG_LONG 8 +#elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700))) +# define LZO_SIZEOF_LONG_LONG 8 +#elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__))) +# define LZO_SIZEOF_LONG_LONG 8 +#elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC)) +# define LZO_SIZEOF_LONG_LONG 8 +#elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC)) +# define LZO_SIZEOF___INT64 8 +#elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC)) +# define LZO_SIZEOF___INT64 8 +#elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520))) +# define LZO_SIZEOF___INT64 8 +#elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) +# define LZO_SIZEOF___INT64 8 +#elif (LZO_CC_GHS && defined(__LLONG_BIT) && ((__LLONG_BIT-0) == 64)) +# define LZO_SIZEOF_LONG_LONG 8 +#elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && ((_INTEGRAL_MAX_BITS-0) == 64)) +# define LZO_SIZEOF___INT64 8 +#elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) +# define LZO_SIZEOF_LONG_LONG 8 +#elif (defined(__vms) || defined(__VMS)) && ((__INITIAL_POINTER_SIZE-0) == 64) +# define LZO_SIZEOF_LONG_LONG 8 +#elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) +#elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +# define LZO_SIZEOF_LONG_LONG 8 +#endif +#endif +#endif +#if defined(__cplusplus) && (LZO_CC_GNUC) +# if (LZO_CC_GNUC < 0x020800ul) +# undef LZO_SIZEOF_LONG_LONG +# endif +#endif +#if (LZO_CFG_NO_LONG_LONG) +# undef LZO_SIZEOF_LONG_LONG +#elif defined(__NO_LONG_LONG) +# undef LZO_SIZEOF_LONG_LONG +#elif defined(_NO_LONGLONG) +# undef LZO_SIZEOF_LONG_LONG +#endif +#if !defined(LZO_WORDSIZE) +#if (LZO_ARCH_ALPHA) +# define LZO_WORDSIZE 8 +#elif (LZO_ARCH_AMD64) +# define LZO_WORDSIZE 8 +#elif (LZO_ARCH_ARM64) +# define LZO_WORDSIZE 8 +#elif (LZO_ARCH_AVR) +# define LZO_WORDSIZE 1 +#elif (LZO_ARCH_H8300) +# if defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) +# define LZO_WORDSIZE 4 +# else +# define LZO_WORDSIZE 2 +# endif +#elif (LZO_ARCH_I086) +# define LZO_WORDSIZE 2 +#elif (LZO_ARCH_IA64) +# define LZO_WORDSIZE 8 +#elif (LZO_ARCH_M16C) +# define LZO_WORDSIZE 2 +#elif (LZO_ARCH_SPU) +# define LZO_WORDSIZE 4 +#elif (LZO_ARCH_Z80) +# define LZO_WORDSIZE 1 +#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) +# define LZO_WORDSIZE 8 +#elif (LZO_OS_OS400 || defined(__OS400__)) +# define LZO_WORDSIZE 8 +#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) +# define LZO_WORDSIZE 8 +#endif +#endif +#if !defined(LZO_SIZEOF_VOID_P) +#if defined(__ILP32__) || defined(__ILP32) || defined(_ILP32) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 4) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4) +# define LZO_SIZEOF_VOID_P 4 +#elif defined(__ILP64__) || defined(__ILP64) || defined(_ILP64) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 8) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8) +# define LZO_SIZEOF_VOID_P 8 +#elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 4) +# define LZO_SIZEOF_VOID_P 8 +#elif defined(__LP64__) || defined(__LP64) || defined(_LP64) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8) +# define LZO_SIZEOF_VOID_P 8 +#elif (LZO_ARCH_AVR) +# define LZO_SIZEOF_VOID_P 2 +#elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) +# define LZO_SIZEOF_VOID_P 2 +#elif (LZO_ARCH_H8300) +# if defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) + LZO_COMPILE_TIME_ASSERT_HEADER(LZO_WORDSIZE == 4) +# if defined(__NORMAL_MODE__) +# define LZO_SIZEOF_VOID_P 2 +# else +# define LZO_SIZEOF_VOID_P 4 +# endif +# else + LZO_COMPILE_TIME_ASSERT_HEADER(LZO_WORDSIZE == 2) +# define LZO_SIZEOF_VOID_P 2 +# endif +# if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) +# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT +# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT +# endif +#elif (LZO_ARCH_I086) +# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) +# define LZO_SIZEOF_VOID_P 2 +# elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) +# define LZO_SIZEOF_VOID_P 4 +# else +# error "invalid LZO_ARCH_I086 memory model" +# endif +#elif (LZO_ARCH_M16C) +# if defined(__m32c_cpu__) || defined(__m32cm_cpu__) +# define LZO_SIZEOF_VOID_P 4 +# else +# define LZO_SIZEOF_VOID_P 2 +# endif +#elif (LZO_ARCH_SPU) +# define LZO_SIZEOF_VOID_P 4 +#elif (LZO_ARCH_Z80) +# define LZO_SIZEOF_VOID_P 2 +#elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) +# define LZO_SIZEOF_VOID_P 4 +#elif (LZO_OS_OS400 || defined(__OS400__)) +# if defined(__LLP64_IFC__) +# define LZO_SIZEOF_VOID_P 8 +# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG +# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG +# else +# define LZO_SIZEOF_VOID_P 16 +# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG +# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG +# endif +#elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) +# define LZO_SIZEOF_VOID_P 8 +# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG +# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG +#endif +#endif +#if !defined(LZO_SIZEOF_VOID_P) +# define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG +#endif +LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_VOID_P == sizeof(void *)) +#if !defined(LZO_SIZEOF_SIZE_T) +#if (LZO_ARCH_I086 || LZO_ARCH_M16C) +# define LZO_SIZEOF_SIZE_T 2 +#endif +#endif +#if !defined(LZO_SIZEOF_SIZE_T) +# define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P +#endif +#if defined(offsetof) +LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_SIZE_T == sizeof(size_t)) +#endif +#if !defined(LZO_SIZEOF_PTRDIFF_T) +#if (LZO_ARCH_I086) +# if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE) +# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P +# elif (LZO_MM_COMPACT || LZO_MM_LARGE) +# if (LZO_CC_BORLANDC || LZO_CC_TURBOC) +# define LZO_SIZEOF_PTRDIFF_T 4 +# else +# define LZO_SIZEOF_PTRDIFF_T 2 +# endif +# else +# error "invalid LZO_ARCH_I086 memory model" +# endif +#endif +#endif +#if !defined(LZO_SIZEOF_PTRDIFF_T) +# define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T +#endif +#if defined(offsetof) +LZO_COMPILE_TIME_ASSERT_HEADER(LZO_SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t)) +#endif +#if !defined(LZO_WORDSIZE) +# define LZO_WORDSIZE LZO_SIZEOF_VOID_P +#endif +#if (LZO_ABI_NEUTRAL_ENDIAN) +# undef LZO_ABI_BIG_ENDIAN +# undef LZO_ABI_LITTLE_ENDIAN +#elif !(LZO_ABI_BIG_ENDIAN) && !(LZO_ABI_LITTLE_ENDIAN) +#if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) +# define LZO_ABI_BIG_ENDIAN 1 +#elif (LZO_ARCH_IA64) && (LZO_OS_POSIX_LINUX || LZO_OS_WIN64) +# define LZO_ABI_LITTLE_ENDIAN 1 +#elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430 || LZO_ARCH_RISCV) +# define LZO_ABI_LITTLE_ENDIAN 1 +#elif (LZO_ARCH_AVR32 || LZO_ARCH_M68K || LZO_ARCH_S390 || LZO_ARCH_SPU) +# define LZO_ABI_BIG_ENDIAN 1 +#elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) +# if (__LITTLE_ENDIAN__ == 1) +# define LZO_ABI_LITTLE_ENDIAN 1 +# else +# define LZO_ABI_BIG_ENDIAN 1 +# endif +#elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) +# define LZO_ABI_BIG_ENDIAN 1 +#elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) +# define LZO_ABI_LITTLE_ENDIAN 1 +#elif 1 && (LZO_ARCH_ARM) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0) +# define LZO_ABI_BIG_ENDIAN 1 +#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) +# define LZO_ABI_BIG_ENDIAN 1 +#elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) +# define LZO_ABI_LITTLE_ENDIAN 1 +#elif 1 && (LZO_ARCH_ARM) && defined(_MSC_VER) && defined(_WIN32) +# define LZO_ABI_LITTLE_ENDIAN 1 +#elif 1 && (LZO_ARCH_ARM && LZO_CC_ARMCC_ARMCC) +# if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) +# error "unexpected configuration - check your compiler defines" +# elif defined(__BIG_ENDIAN) +# define LZO_ABI_BIG_ENDIAN 1 +# else +# define LZO_ABI_LITTLE_ENDIAN 1 +# endif +# define LZO_ABI_LITTLE_ENDIAN 1 +#elif 1 && (LZO_ARCH_ARM64) && defined(__ARM_BIG_ENDIAN) && ((__ARM_BIG_ENDIAN)+0) +# define LZO_ABI_BIG_ENDIAN 1 +#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EB__) && !defined(__AARCH64EL__) +# define LZO_ABI_BIG_ENDIAN 1 +#elif 1 && (LZO_ARCH_ARM64) && defined(__AARCH64EL__) && !defined(__AARCH64EB__) +# define LZO_ABI_LITTLE_ENDIAN 1 +#elif 1 && (LZO_ARCH_ARM64) && defined(_MSC_VER) && defined(_WIN32) +# define LZO_ABI_LITTLE_ENDIAN 1 +#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) +# define LZO_ABI_BIG_ENDIAN 1 +#elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) +# define LZO_ABI_LITTLE_ENDIAN 1 +#endif +#endif +#if (LZO_ABI_BIG_ENDIAN) && (LZO_ABI_LITTLE_ENDIAN) +# error "unexpected configuration - check your compiler defines" +#endif +#if (LZO_ABI_BIG_ENDIAN) +# define LZO_INFO_ABI_ENDIAN "be" +#elif (LZO_ABI_LITTLE_ENDIAN) +# define LZO_INFO_ABI_ENDIAN "le" +#elif (LZO_ABI_NEUTRAL_ENDIAN) +# define LZO_INFO_ABI_ENDIAN "neutral" +#endif +#if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) +# define LZO_ABI_I8LP16 1 +# define LZO_INFO_ABI_PM "i8lp16" +#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) +# define LZO_ABI_ILP16 1 +# define LZO_INFO_ABI_PM "ilp16" +#elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) +# define LZO_ABI_LP32 1 +# define LZO_INFO_ABI_PM "lp32" +#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) +# define LZO_ABI_ILP32 1 +# define LZO_INFO_ABI_PM "ilp32" +#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8) +# define LZO_ABI_LLP64 1 +# define LZO_INFO_ABI_PM "llp64" +#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) +# define LZO_ABI_LP64 1 +# define LZO_INFO_ABI_PM "lp64" +#elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) +# define LZO_ABI_ILP64 1 +# define LZO_INFO_ABI_PM "ilp64" +#elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4) +# define LZO_ABI_IP32L64 1 +# define LZO_INFO_ABI_PM "ip32l64" +#endif +#if (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_VOID_P == 4 && LZO_WORDSIZE == 8) +# define LZO_ABI_IP32W64 1 +# ifndef LZO_INFO_ABI_PM +# define LZO_INFO_ABI_PM "ip32w64" +# endif +#endif +#if 0 +#elif !defined(__LZO_LIBC_OVERRIDE) +#if (LZO_LIBC_NAKED) +# define LZO_INFO_LIBC "naked" +#elif (LZO_LIBC_FREESTANDING) +# define LZO_INFO_LIBC "freestanding" +#elif (LZO_LIBC_MOSTLY_FREESTANDING) +# define LZO_INFO_LIBC "mfreestanding" +#elif (LZO_LIBC_ISOC90) +# define LZO_INFO_LIBC "isoc90" +#elif (LZO_LIBC_ISOC99) +# define LZO_INFO_LIBC "isoc99" +#elif (LZO_CC_ARMCC_ARMCC) && defined(__ARMCLIB_VERSION) +# define LZO_LIBC_ISOC90 1 +# define LZO_INFO_LIBC "isoc90" +#elif defined(__dietlibc__) +# define LZO_LIBC_DIETLIBC 1 +# define LZO_INFO_LIBC "dietlibc" +#elif defined(_NEWLIB_VERSION) +# define LZO_LIBC_NEWLIB 1 +# define LZO_INFO_LIBC "newlib" +#elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) +# if defined(__UCLIBC_SUBLEVEL__) +# define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + (__UCLIBC_MINOR__-0) * 0x100 + (__UCLIBC_SUBLEVEL__-0)) +# else +# define LZO_LIBC_UCLIBC 0x00090bL +# endif +# define LZO_INFO_LIBC "uc" "libc" +#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) +# define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + (__GLIBC_MINOR__-0) * 0x100) +# define LZO_INFO_LIBC "glibc" +#elif (LZO_CC_MWERKS) && defined(__MSL__) +# define LZO_LIBC_MSL __MSL__ +# define LZO_INFO_LIBC "msl" +#elif 1 && defined(__IAR_SYSTEMS_ICC__) +# define LZO_LIBC_ISOC90 1 +# define LZO_INFO_LIBC "isoc90" +#else +# define LZO_LIBC_DEFAULT 1 +# define LZO_INFO_LIBC "default" +#endif +#endif +#if (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) +# define LZO_ASM_SYNTAX_MSC 1 +#elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) +#elif (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC == 0x011f00ul)) +#elif (LZO_ARCH_I386 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) +# define LZO_ASM_SYNTAX_GNUC 1 +#elif (LZO_ARCH_AMD64 && (LZO_CC_CLANG || LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) +# define LZO_ASM_SYNTAX_GNUC 1 +#elif (LZO_CC_GNUC) +# define LZO_ASM_SYNTAX_GNUC 1 +#endif +#if (LZO_ASM_SYNTAX_GNUC) +#if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) +# define __LZO_ASM_CLOBBER "ax" +# define __LZO_ASM_CLOBBER_LIST_CC /*empty*/ +# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY /*empty*/ +# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ +#elif (LZO_CC_INTELC && (__INTEL_COMPILER < 1000)) +# define __LZO_ASM_CLOBBER "memory" +# define __LZO_ASM_CLOBBER_LIST_CC /*empty*/ +# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "memory" +# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ +#else +# define __LZO_ASM_CLOBBER "cc", "memory" +# define __LZO_ASM_CLOBBER_LIST_CC : "cc" +# define __LZO_ASM_CLOBBER_LIST_CC_MEMORY : "cc", "memory" +# define __LZO_ASM_CLOBBER_LIST_EMPTY /*empty*/ +#endif +#endif +#if (LZO_ARCH_ALPHA) +# define LZO_OPT_AVOID_UINT_INDEX 1 +#elif (LZO_ARCH_AMD64) +# define LZO_OPT_AVOID_INT_INDEX 1 +# define LZO_OPT_AVOID_UINT_INDEX 1 +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +# ifndef LZO_OPT_UNALIGNED64 +# define LZO_OPT_UNALIGNED64 1 +# endif +#elif (LZO_ARCH_ARM) +# if defined(__ARM_FEATURE_UNALIGNED) +# if ((__ARM_FEATURE_UNALIGNED)+0) +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +# endif +# elif 1 && (LZO_ARCH_ARM_THUMB2) +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +# elif 1 && defined(__ARM_ARCH) && ((__ARM_ARCH)+0 >= 7) +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +# elif 1 && defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM)+0 >= 7) +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +# elif 1 && defined(__TARGET_ARCH_ARM) && ((__TARGET_ARCH_ARM)+0 >= 6) && (defined(__TARGET_PROFILE_A) || defined(__TARGET_PROFILE_R)) +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +# elif 1 && defined(_MSC_VER) && defined(_M_ARM) && ((_M_ARM)+0 >= 7) +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +# endif +#elif (LZO_ARCH_ARM64) +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +# ifndef LZO_OPT_UNALIGNED64 +# define LZO_OPT_UNALIGNED64 1 +# endif +#elif (LZO_ARCH_CRIS) +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +#elif (LZO_ARCH_I386) +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +#elif (LZO_ARCH_IA64) +# define LZO_OPT_AVOID_INT_INDEX 1 +# define LZO_OPT_AVOID_UINT_INDEX 1 +# define LZO_OPT_PREFER_POSTINC 1 +#elif (LZO_ARCH_M68K) +# define LZO_OPT_PREFER_POSTINC 1 +# define LZO_OPT_PREFER_PREDEC 1 +# if defined(__mc68020__) && !defined(__mcoldfire__) +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +# endif +#elif (LZO_ARCH_MIPS) +# define LZO_OPT_AVOID_UINT_INDEX 1 +#elif (LZO_ARCH_POWERPC) +# define LZO_OPT_PREFER_PREINC 1 +# define LZO_OPT_PREFER_PREDEC 1 +# if (LZO_ABI_BIG_ENDIAN) || (LZO_WORDSIZE == 8) +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +# if (LZO_WORDSIZE == 8) +# ifndef LZO_OPT_UNALIGNED64 +# define LZO_OPT_UNALIGNED64 1 +# endif +# endif +# endif +#elif (LZO_ARCH_RISCV) +# define LZO_OPT_AVOID_UINT_INDEX 1 +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +# if (LZO_WORDSIZE == 8) +# ifndef LZO_OPT_UNALIGNED64 +# define LZO_OPT_UNALIGNED64 1 +# endif +# endif +#elif (LZO_ARCH_S390) +# ifndef LZO_OPT_UNALIGNED16 +# define LZO_OPT_UNALIGNED16 1 +# endif +# ifndef LZO_OPT_UNALIGNED32 +# define LZO_OPT_UNALIGNED32 1 +# endif +# if (LZO_WORDSIZE == 8) +# ifndef LZO_OPT_UNALIGNED64 +# define LZO_OPT_UNALIGNED64 1 +# endif +# endif +#elif (LZO_ARCH_SH) +# define LZO_OPT_PREFER_POSTINC 1 +# define LZO_OPT_PREFER_PREDEC 1 +#endif +#ifndef LZO_CFG_NO_INLINE_ASM +#if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) +# define LZO_CFG_NO_INLINE_ASM 1 +#elif (LZO_CC_LLVM) +# define LZO_CFG_NO_INLINE_ASM 1 +#endif +#endif +#if (LZO_CFG_NO_INLINE_ASM) +# undef LZO_ASM_SYNTAX_MSC +# undef LZO_ASM_SYNTAX_GNUC +# undef __LZO_ASM_CLOBBER +# undef __LZO_ASM_CLOBBER_LIST_CC +# undef __LZO_ASM_CLOBBER_LIST_CC_MEMORY +# undef __LZO_ASM_CLOBBER_LIST_EMPTY +#endif +#ifndef LZO_CFG_NO_UNALIGNED +#if (LZO_ABI_NEUTRAL_ENDIAN) || (LZO_ARCH_GENERIC) +# define LZO_CFG_NO_UNALIGNED 1 +#endif +#endif +#if (LZO_CFG_NO_UNALIGNED) +# undef LZO_OPT_UNALIGNED16 +# undef LZO_OPT_UNALIGNED32 +# undef LZO_OPT_UNALIGNED64 +#endif +#if defined(__LZO_INFOSTR_MM) +#elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) +# define __LZO_INFOSTR_MM "" +#elif defined(LZO_INFO_MM) +# define __LZO_INFOSTR_MM "." LZO_INFO_MM +#else +# define __LZO_INFOSTR_MM "" +#endif +#if defined(__LZO_INFOSTR_PM) +#elif defined(LZO_INFO_ABI_PM) +# define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM +#else +# define __LZO_INFOSTR_PM "" +#endif +#if defined(__LZO_INFOSTR_ENDIAN) +#elif defined(LZO_INFO_ABI_ENDIAN) +# define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN +#else +# define __LZO_INFOSTR_ENDIAN "" +#endif +#if defined(__LZO_INFOSTR_OSNAME) +#elif defined(LZO_INFO_OS_CONSOLE) +# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE +#elif defined(LZO_INFO_OS_POSIX) +# define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX +#else +# define __LZO_INFOSTR_OSNAME LZO_INFO_OS +#endif +#if defined(__LZO_INFOSTR_LIBC) +#elif defined(LZO_INFO_LIBC) +# define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC +#else +# define __LZO_INFOSTR_LIBC "" +#endif +#if defined(__LZO_INFOSTR_CCVER) +#elif defined(LZO_INFO_CCVER) +# define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER +#else +# define __LZO_INFOSTR_CCVER "" +#endif +#define LZO_INFO_STRING \ + LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ + " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER +#if !(LZO_CFG_SKIP_LZO_TYPES) +#if (!(LZO_SIZEOF_SHORT+0 > 0 && LZO_SIZEOF_INT+0 > 0 && LZO_SIZEOF_LONG+0 > 0)) +# error "missing defines for sizes" +#endif +#if (!(LZO_SIZEOF_PTRDIFF_T+0 > 0 && LZO_SIZEOF_SIZE_T+0 > 0 && LZO_SIZEOF_VOID_P+0 > 0)) +# error "missing defines for sizes" +#endif +#define LZO_TYPEOF_CHAR 1u +#define LZO_TYPEOF_SHORT 2u +#define LZO_TYPEOF_INT 3u +#define LZO_TYPEOF_LONG 4u +#define LZO_TYPEOF_LONG_LONG 5u +#define LZO_TYPEOF___INT8 17u +#define LZO_TYPEOF___INT16 18u +#define LZO_TYPEOF___INT32 19u +#define LZO_TYPEOF___INT64 20u +#define LZO_TYPEOF___INT128 21u +#define LZO_TYPEOF___INT256 22u +#define LZO_TYPEOF___MODE_QI 33u +#define LZO_TYPEOF___MODE_HI 34u +#define LZO_TYPEOF___MODE_SI 35u +#define LZO_TYPEOF___MODE_DI 36u +#define LZO_TYPEOF___MODE_TI 37u +#define LZO_TYPEOF_CHAR_P 129u +#if !defined(lzo_llong_t) +#if (LZO_SIZEOF_LONG_LONG+0 > 0) +# if !(LZO_LANG_ASSEMBLER) + __lzo_gnuc_extension__ typedef long long lzo_llong_t__; + __lzo_gnuc_extension__ typedef unsigned long long lzo_ullong_t__; +# endif +# define lzo_llong_t lzo_llong_t__ +# define lzo_ullong_t lzo_ullong_t__ +#endif +#endif +#if !defined(lzo_int16e_t) +#if (LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) && (LZO_SIZEOF_SHORT != 2) +# undef LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T +#endif +#if (LZO_SIZEOF_LONG == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) +# define lzo_int16e_t long +# define lzo_uint16e_t unsigned long +# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_LONG +#elif (LZO_SIZEOF_INT == 2) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT16E_T == LZO_TYPEOF_SHORT) +# define lzo_int16e_t int +# define lzo_uint16e_t unsigned int +# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_INT +#elif (LZO_SIZEOF_SHORT == 2) +# define lzo_int16e_t short int +# define lzo_uint16e_t unsigned short int +# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF_SHORT +#elif 1 && !(LZO_CFG_TYPE_NO_MODE_HI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) +# if !(LZO_LANG_ASSEMBLER) + typedef int lzo_int16e_hi_t__ __attribute__((__mode__(__HI__))); + typedef unsigned int lzo_uint16e_hi_t__ __attribute__((__mode__(__HI__))); +# endif +# define lzo_int16e_t lzo_int16e_hi_t__ +# define lzo_uint16e_t lzo_uint16e_hi_t__ +# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___MODE_HI +#elif (LZO_SIZEOF___INT16 == 2) +# define lzo_int16e_t __int16 +# define lzo_uint16e_t unsigned __int16 +# define LZO_TYPEOF_LZO_INT16E_T LZO_TYPEOF___INT16 +#else +#endif +#endif +#if defined(lzo_int16e_t) +# define LZO_SIZEOF_LZO_INT16E_T 2 + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == 2) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16e_t) == LZO_SIZEOF_LZO_INT16E_T) +#endif +#if !defined(lzo_int32e_t) +#if (LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T == LZO_TYPEOF_INT) && (LZO_SIZEOF_INT != 4) +# undef LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T +#endif +#if (LZO_SIZEOF_LONG == 4) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT32E_T == LZO_TYPEOF_INT) +# define lzo_int32e_t long int +# define lzo_uint32e_t unsigned long int +# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG +#elif (LZO_SIZEOF_INT == 4) +# define lzo_int32e_t int +# define lzo_uint32e_t unsigned int +# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_INT +#elif (LZO_SIZEOF_SHORT == 4) +# define lzo_int32e_t short int +# define lzo_uint32e_t unsigned short int +# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_SHORT +#elif (LZO_SIZEOF_LONG_LONG == 4) +# define lzo_int32e_t lzo_llong_t +# define lzo_uint32e_t lzo_ullong_t +# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF_LONG_LONG +#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_CLANG || (LZO_CC_GNUC >= 0x025f00ul) || LZO_CC_LLVM) && (__INT_MAX__+0 > 2147483647L) +# if !(LZO_LANG_ASSEMBLER) + typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__))); + typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__))); +# endif +# define lzo_int32e_t lzo_int32e_si_t__ +# define lzo_uint32e_t lzo_uint32e_si_t__ +# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI +#elif 1 && !(LZO_CFG_TYPE_NO_MODE_SI) && (LZO_CC_GNUC >= 0x025f00ul) && defined(__AVR__) && (__LONG_MAX__+0 == 32767L) +# if !(LZO_LANG_ASSEMBLER) + typedef int lzo_int32e_si_t__ __attribute__((__mode__(__SI__))); + typedef unsigned int lzo_uint32e_si_t__ __attribute__((__mode__(__SI__))); +# endif +# define lzo_int32e_t lzo_int32e_si_t__ +# define lzo_uint32e_t lzo_uint32e_si_t__ +# define LZO_INT32_C(c) (c##LL) +# define LZO_UINT32_C(c) (c##ULL) +# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___MODE_SI +#elif (LZO_SIZEOF___INT32 == 4) +# define lzo_int32e_t __int32 +# define lzo_uint32e_t unsigned __int32 +# define LZO_TYPEOF_LZO_INT32E_T LZO_TYPEOF___INT32 +#else +#endif +#endif +#if defined(lzo_int32e_t) +# define LZO_SIZEOF_LZO_INT32E_T 4 + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == 4) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32e_t) == LZO_SIZEOF_LZO_INT32E_T) +#endif +#if !defined(lzo_int64e_t) +#if (LZO_SIZEOF___INT64 == 8) +# if (LZO_CC_BORLANDC) && !defined(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T) +# define LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T LZO_TYPEOF___INT64 +# endif +#endif +#if (LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && (LZO_SIZEOF_LONG_LONG != 8) +# undef LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T +#endif +#if (LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) && (LZO_SIZEOF___INT64 != 8) +# undef LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T +#endif +#if (LZO_SIZEOF_INT == 8) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) +# define lzo_int64e_t int +# define lzo_uint64e_t unsigned int +# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_INT +#elif (LZO_SIZEOF_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF_LONG_LONG) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) +# define lzo_int64e_t long int +# define lzo_uint64e_t unsigned long int +# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_LONG +#elif (LZO_SIZEOF_LONG_LONG == 8) && !(LZO_CFG_PREFER_TYPEOF_ACC_INT64E_T == LZO_TYPEOF___INT64) +# define lzo_int64e_t lzo_llong_t +# define lzo_uint64e_t lzo_ullong_t +# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF_LONG_LONG +# if (LZO_CC_BORLANDC) +# define LZO_INT64_C(c) ((c) + 0ll) +# define LZO_UINT64_C(c) ((c) + 0ull) +# elif 0 +# define LZO_INT64_C(c) (__lzo_gnuc_extension__ (c##LL)) +# define LZO_UINT64_C(c) (__lzo_gnuc_extension__ (c##ULL)) +# else +# define LZO_INT64_C(c) (c##LL) +# define LZO_UINT64_C(c) (c##ULL) +# endif +#elif (LZO_SIZEOF___INT64 == 8) +# define lzo_int64e_t __int64 +# define lzo_uint64e_t unsigned __int64 +# define LZO_TYPEOF_LZO_INT64E_T LZO_TYPEOF___INT64 +# if (LZO_CC_BORLANDC) +# define LZO_INT64_C(c) ((c) + 0i64) +# define LZO_UINT64_C(c) ((c) + 0ui64) +# else +# define LZO_INT64_C(c) (c##i64) +# define LZO_UINT64_C(c) (c##ui64) +# endif +#else +#endif +#endif +#if defined(lzo_int64e_t) +# define LZO_SIZEOF_LZO_INT64E_T 8 + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == 8) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64e_t) == LZO_SIZEOF_LZO_INT64E_T) +#endif +#if !defined(lzo_int32l_t) +#if defined(lzo_int32e_t) +# define lzo_int32l_t lzo_int32e_t +# define lzo_uint32l_t lzo_uint32e_t +# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LZO_INT32E_T +# define LZO_TYPEOF_LZO_INT32L_T LZO_TYPEOF_LZO_INT32E_T +#elif (LZO_SIZEOF_INT >= 4) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) +# define lzo_int32l_t int +# define lzo_uint32l_t unsigned int +# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_INT +# define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_INT +#elif (LZO_SIZEOF_LONG >= 4) +# define lzo_int32l_t long int +# define lzo_uint32l_t unsigned long int +# define LZO_SIZEOF_LZO_INT32L_T LZO_SIZEOF_LONG +# define LZO_TYPEOF_LZO_INT32L_T LZO_SIZEOF_LONG +#else +# error "lzo_int32l_t" +#endif +#endif +#if 1 + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) >= 4) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32l_t) == LZO_SIZEOF_LZO_INT32L_T) +#endif +#if !defined(lzo_int64l_t) +#if defined(lzo_int64e_t) +# define lzo_int64l_t lzo_int64e_t +# define lzo_uint64l_t lzo_uint64e_t +# define LZO_SIZEOF_LZO_INT64L_T LZO_SIZEOF_LZO_INT64E_T +# define LZO_TYPEOF_LZO_INT64L_T LZO_TYPEOF_LZO_INT64E_T +#else +#endif +#endif +#if defined(lzo_int64l_t) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) >= 8) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64l_t) == LZO_SIZEOF_LZO_INT64L_T) +#endif +#if !defined(lzo_int32f_t) +#if (LZO_SIZEOF_SIZE_T >= 8) +# define lzo_int32f_t lzo_int64l_t +# define lzo_uint32f_t lzo_uint64l_t +# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT64L_T +# define LZO_TYPEOF_LZO_INT32F_T LZO_TYPEOF_LZO_INT64L_T +#else +# define lzo_int32f_t lzo_int32l_t +# define lzo_uint32f_t lzo_uint32l_t +# define LZO_SIZEOF_LZO_INT32F_T LZO_SIZEOF_LZO_INT32L_T +# define LZO_TYPEOF_LZO_INT32F_T LZO_TYPEOF_LZO_INT32L_T +#endif +#endif +#if 1 + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) >= 4) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32f_t) == LZO_SIZEOF_LZO_INT32F_T) +#endif +#if !defined(lzo_int64f_t) +#if defined(lzo_int64l_t) +# define lzo_int64f_t lzo_int64l_t +# define lzo_uint64f_t lzo_uint64l_t +# define LZO_SIZEOF_LZO_INT64F_T LZO_SIZEOF_LZO_INT64L_T +# define LZO_TYPEOF_LZO_INT64F_T LZO_TYPEOF_LZO_INT64L_T +#else +#endif +#endif +#if defined(lzo_int64f_t) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) >= 8) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64f_t) == LZO_SIZEOF_LZO_INT64F_T) +#endif +#if !defined(lzo_intptr_t) +#if 1 && (LZO_OS_OS400 && (LZO_SIZEOF_VOID_P == 16)) +# define __LZO_INTPTR_T_IS_POINTER 1 +# if !(LZO_LANG_ASSEMBLER) + typedef char * lzo_intptr_t; + typedef char * lzo_uintptr_t; +# endif +# define lzo_intptr_t lzo_intptr_t +# define lzo_uintptr_t lzo_uintptr_t +# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_VOID_P +# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_CHAR_P +#elif (LZO_CC_MSC && (_MSC_VER >= 1300) && (LZO_SIZEOF_VOID_P == 4) && (LZO_SIZEOF_INT == 4)) +# if !(LZO_LANG_ASSEMBLER) + typedef __w64 int lzo_intptr_t; + typedef __w64 unsigned int lzo_uintptr_t; +# endif +# define lzo_intptr_t lzo_intptr_t +# define lzo_uintptr_t lzo_uintptr_t +# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT +# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT +#elif (LZO_SIZEOF_SHORT == LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT > LZO_SIZEOF_VOID_P) +# define lzo_intptr_t short +# define lzo_uintptr_t unsigned short +# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_SHORT +# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_SHORT +#elif (LZO_SIZEOF_INT >= LZO_SIZEOF_VOID_P) && (LZO_SIZEOF_INT < LZO_SIZEOF_LONG) +# define lzo_intptr_t int +# define lzo_uintptr_t unsigned int +# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_INT +# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_INT +#elif (LZO_SIZEOF_LONG >= LZO_SIZEOF_VOID_P) +# define lzo_intptr_t long +# define lzo_uintptr_t unsigned long +# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LONG +# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_LONG +#elif (LZO_SIZEOF_LZO_INT64L_T >= LZO_SIZEOF_VOID_P) +# define lzo_intptr_t lzo_int64l_t +# define lzo_uintptr_t lzo_uint64l_t +# define LZO_SIZEOF_LZO_INTPTR_T LZO_SIZEOF_LZO_INT64L_T +# define LZO_TYPEOF_LZO_INTPTR_T LZO_TYPEOF_LZO_INT64L_T +#else +# error "lzo_intptr_t" +#endif +#endif +#if 1 + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) >= sizeof(void *)) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_intptr_t) == sizeof(lzo_uintptr_t)) +#endif +#if !defined(lzo_word_t) +#if defined(LZO_WORDSIZE) && (LZO_WORDSIZE+0 > 0) +#if (LZO_WORDSIZE == LZO_SIZEOF_LZO_INTPTR_T) && !(__LZO_INTPTR_T_IS_POINTER) +# define lzo_word_t lzo_uintptr_t +# define lzo_sword_t lzo_intptr_t +# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INTPTR_T +# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LZO_INTPTR_T +#elif (LZO_WORDSIZE == LZO_SIZEOF_LONG) +# define lzo_word_t unsigned long +# define lzo_sword_t long +# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LONG +# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_LONG +#elif (LZO_WORDSIZE == LZO_SIZEOF_INT) +# define lzo_word_t unsigned int +# define lzo_sword_t int +# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_INT +# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_INT +#elif (LZO_WORDSIZE == LZO_SIZEOF_SHORT) +# define lzo_word_t unsigned short +# define lzo_sword_t short +# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_SHORT +# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_SHORT +#elif (LZO_WORDSIZE == 1) +# define lzo_word_t unsigned char +# define lzo_sword_t signed char +# define LZO_SIZEOF_LZO_WORD_T 1 +# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF_CHAR +#elif (LZO_WORDSIZE == LZO_SIZEOF_LZO_INT64L_T) +# define lzo_word_t lzo_uint64l_t +# define lzo_sword_t lzo_int64l_t +# define LZO_SIZEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T +# define LZO_TYPEOF_LZO_WORD_T LZO_SIZEOF_LZO_INT64L_T +#elif (LZO_ARCH_SPU) && (LZO_CC_GNUC) +#if 0 +# if !(LZO_LANG_ASSEMBLER) + typedef unsigned lzo_word_t __attribute__((__mode__(__V16QI__))); + typedef int lzo_sword_t __attribute__((__mode__(__V16QI__))); +# endif +# define lzo_word_t lzo_word_t +# define lzo_sword_t lzo_sword_t +# define LZO_SIZEOF_LZO_WORD_T 16 +# define LZO_TYPEOF_LZO_WORD_T LZO_TYPEOF___MODE_V16QI +#endif +#else +# error "lzo_word_t" +#endif +#endif +#endif +#if 1 && defined(lzo_word_t) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_word_t) == LZO_WORDSIZE) + LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_sword_t) == LZO_WORDSIZE) +#endif +#if 1 +#define lzo_int8_t signed char +#define lzo_uint8_t unsigned char +#define LZO_SIZEOF_LZO_INT8_T 1 +#define LZO_TYPEOF_LZO_INT8_T LZO_TYPEOF_CHAR +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == 1) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int8_t) == sizeof(lzo_uint8_t)) +#endif +#if defined(lzo_int16e_t) +#define lzo_int16_t lzo_int16e_t +#define lzo_uint16_t lzo_uint16e_t +#define LZO_SIZEOF_LZO_INT16_T LZO_SIZEOF_LZO_INT16E_T +#define LZO_TYPEOF_LZO_INT16_T LZO_TYPEOF_LZO_INT16E_T +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == 2) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int16_t) == sizeof(lzo_uint16_t)) +#endif +#if defined(lzo_int32e_t) +#define lzo_int32_t lzo_int32e_t +#define lzo_uint32_t lzo_uint32e_t +#define LZO_SIZEOF_LZO_INT32_T LZO_SIZEOF_LZO_INT32E_T +#define LZO_TYPEOF_LZO_INT32_T LZO_TYPEOF_LZO_INT32E_T +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == 4) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int32_t) == sizeof(lzo_uint32_t)) +#endif +#if defined(lzo_int64e_t) +#define lzo_int64_t lzo_int64e_t +#define lzo_uint64_t lzo_uint64e_t +#define LZO_SIZEOF_LZO_INT64_T LZO_SIZEOF_LZO_INT64E_T +#define LZO_TYPEOF_LZO_INT64_T LZO_TYPEOF_LZO_INT64E_T +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == 8) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int64_t) == sizeof(lzo_uint64_t)) +#endif +#if 1 +#define lzo_int_least32_t lzo_int32l_t +#define lzo_uint_least32_t lzo_uint32l_t +#define LZO_SIZEOF_LZO_INT_LEAST32_T LZO_SIZEOF_LZO_INT32L_T +#define LZO_TYPEOF_LZO_INT_LEAST32_T LZO_TYPEOF_LZO_INT32L_T +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) >= 4) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least32_t) == sizeof(lzo_uint_least32_t)) +#endif +#if defined(lzo_int64l_t) +#define lzo_int_least64_t lzo_int64l_t +#define lzo_uint_least64_t lzo_uint64l_t +#define LZO_SIZEOF_LZO_INT_LEAST64_T LZO_SIZEOF_LZO_INT64L_T +#define LZO_TYPEOF_LZO_INT_LEAST64_T LZO_TYPEOF_LZO_INT64L_T +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) >= 8) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_least64_t) == sizeof(lzo_uint_least64_t)) +#endif +#if 1 +#define lzo_int_fast32_t lzo_int32f_t +#define lzo_uint_fast32_t lzo_uint32f_t +#define LZO_SIZEOF_LZO_INT_FAST32_T LZO_SIZEOF_LZO_INT32F_T +#define LZO_TYPEOF_LZO_INT_FAST32_T LZO_TYPEOF_LZO_INT32F_T +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) >= 4) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast32_t) == sizeof(lzo_uint_fast32_t)) +#endif +#if defined(lzo_int64f_t) +#define lzo_int_fast64_t lzo_int64f_t +#define lzo_uint_fast64_t lzo_uint64f_t +#define LZO_SIZEOF_LZO_INT_FAST64_T LZO_SIZEOF_LZO_INT64F_T +#define LZO_TYPEOF_LZO_INT_FAST64_T LZO_TYPEOF_LZO_INT64F_T +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) >= 8) +LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int_fast64_t) == sizeof(lzo_uint_fast64_t)) +#endif +#if !defined(LZO_INT16_C) +# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 2) +# define LZO_INT16_C(c) ((c) + 0) +# define LZO_UINT16_C(c) ((c) + 0U) +# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 2) +# define LZO_INT16_C(c) ((c) + 0L) +# define LZO_UINT16_C(c) ((c) + 0UL) +# elif (LZO_SIZEOF_INT >= 2) +# define LZO_INT16_C(c) (c) +# define LZO_UINT16_C(c) (c##U) +# elif (LZO_SIZEOF_LONG >= 2) +# define LZO_INT16_C(c) (c##L) +# define LZO_UINT16_C(c) (c##UL) +# else +# error "LZO_INT16_C" +# endif +#endif +#if !defined(LZO_INT32_C) +# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 4) +# define LZO_INT32_C(c) ((c) + 0) +# define LZO_UINT32_C(c) ((c) + 0U) +# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 4) +# define LZO_INT32_C(c) ((c) + 0L) +# define LZO_UINT32_C(c) ((c) + 0UL) +# elif (LZO_SIZEOF_INT >= 4) +# define LZO_INT32_C(c) (c) +# define LZO_UINT32_C(c) (c##U) +# elif (LZO_SIZEOF_LONG >= 4) +# define LZO_INT32_C(c) (c##L) +# define LZO_UINT32_C(c) (c##UL) +# elif (LZO_SIZEOF_LONG_LONG >= 4) +# define LZO_INT32_C(c) (c##LL) +# define LZO_UINT32_C(c) (c##ULL) +# else +# error "LZO_INT32_C" +# endif +#endif +#if !defined(LZO_INT64_C) && defined(lzo_int64l_t) +# if (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_INT >= 8) +# define LZO_INT64_C(c) ((c) + 0) +# define LZO_UINT64_C(c) ((c) + 0U) +# elif (LZO_BROKEN_INTEGRAL_CONSTANTS) && (LZO_SIZEOF_LONG >= 8) +# define LZO_INT64_C(c) ((c) + 0L) +# define LZO_UINT64_C(c) ((c) + 0UL) +# elif (LZO_SIZEOF_INT >= 8) +# define LZO_INT64_C(c) (c) +# define LZO_UINT64_C(c) (c##U) +# elif (LZO_SIZEOF_LONG >= 8) +# define LZO_INT64_C(c) (c##L) +# define LZO_UINT64_C(c) (c##UL) +# else +# error "LZO_INT64_C" +# endif +#endif +#endif + +#endif /* already included */ + +/* vim:set ts=4 sw=4 et: */ diff --git a/tools/z64compress/src/enc/stretchy_buffer.h b/tools/z64compress/src/enc/stretchy_buffer.h new file mode 100644 index 000000000..cbd48a300 --- /dev/null +++ b/tools/z64compress/src/enc/stretchy_buffer.h @@ -0,0 +1,262 @@ +// stretchy_buffer.h - v1.03 - public domain - nothings.org/stb +// a vector<>-like dynamic array for C +// +// version history: +// 1.03 - compile as C++ maybe +// 1.02 - tweaks to syntax for no good reason +// 1.01 - added a "common uses" documentation section +// 1.0 - fixed bug in the version I posted prematurely +// 0.9 - rewrite to try to avoid strict-aliasing optimization +// issues, but won't compile as C++ +// +// Will probably not work correctly with strict-aliasing optimizations. +// +// The idea: +// +// This implements an approximation to C++ vector<> for C, in that it +// provides a generic definition for dynamic arrays which you can +// still access in a typesafe way using arr[i] or *(arr+i). However, +// it is simply a convenience wrapper around the common idiom of +// of keeping a set of variables (in a struct or globals) which store +// - pointer to array +// - the length of the "in-use" part of the array +// - the current size of the allocated array +// +// I find it to be the single most useful non-built-in-structure when +// programming in C (hash tables a close second), but to be clear +// it lacks many of the capabilities of C++ vector<>: there is no +// range checking, the object address isn't stable (see next section +// for details), the set of methods available is small (although +// the file stb.h has another implementation of stretchy buffers +// called 'stb_arr' which provides more methods, e.g. for insertion +// and deletion). +// +// How to use: +// +// Unlike other stb header file libraries, there is no need to +// define an _IMPLEMENTATION symbol. Every #include creates as +// much implementation is needed. +// +// stretchy_buffer.h does not define any types, so you do not +// need to #include it to before defining data types that are +// stretchy buffers, only in files that *manipulate* stretchy +// buffers. +// +// If you want a stretchy buffer aka dynamic array containing +// objects of TYPE, declare such an array as: +// +// TYPE *myarray = NULL; +// +// (There is no typesafe way to distinguish between stretchy +// buffers and regular arrays/pointers; this is necessary to +// make ordinary array indexing work on these objects.) +// +// Unlike C++ vector<>, the stretchy_buffer has the same +// semantics as an object that you manually malloc and realloc. +// The pointer may relocate every time you add a new object +// to it, so you: +// +// 1. can't take long-term pointers to elements of the array +// 2. have to return the pointer from functions which might expand it +// (either as a return value or by storing it to a ptr-to-ptr) +// +// Now you can do the following things with this array: +// +// sb_free(TYPE *a) free the array +// sb_count(TYPE *a) the number of elements in the array +// sb_push(TYPE *a, TYPE v) adds v on the end of the array, a la push_back +// sb_add(TYPE *a, int n) adds n uninitialized elements at end of array & returns pointer to first added +// sb_last(TYPE *a) returns an lvalue of the last item in the array +// a[n] access the nth (counting from 0) element of the array +// +// #define STRETCHY_BUFFER_NO_SHORT_NAMES to only export +// names of the form 'stb_sb_' if you have a name that would +// otherwise collide. +// +// Note that these are all macros and many of them evaluate +// their arguments more than once, so the arguments should +// be side-effect-free. +// +// Note that 'TYPE *a' in sb_push and sb_add must be lvalues +// so that the library can overwrite the existing pointer if +// the object has to be reallocated. +// +// In an out-of-memory condition, the code will try to +// set up a null-pointer or otherwise-invalid-pointer +// exception to happen later. It's possible optimizing +// compilers could detect this write-to-null statically +// and optimize away some of the code, but it should only +// be along the failure path. Nevertheless, for more security +// in the face of such compilers, #define STRETCHY_BUFFER_OUT_OF_MEMORY +// to a statement such as assert(0) or exit(1) or something +// to force a failure when out-of-memory occurs. +// +// Common use: +// +// The main application for this is when building a list of +// things with an unknown quantity, either due to loading from +// a file or through a process which produces an unpredictable +// number. +// +// My most common idiom is something like: +// +// SomeStruct *arr = NULL; +// while (something) +// { +// SomeStruct new_one; +// new_one.whatever = whatever; +// new_one.whatup = whatup; +// new_one.foobar = barfoo; +// sb_push(arr, new_one); +// } +// +// and various closely-related factorings of that. For example, +// you might have several functions to create/init new SomeStructs, +// and if you use the above idiom, you might prefer to make them +// return structs rather than take non-const-pointers-to-structs, +// so you can do things like: +// +// SomeStruct *arr = NULL; +// while (something) +// { +// if (case_A) { +// sb_push(arr, some_func1()); +// } else if (case_B) { +// sb_push(arr, some_func2()); +// } else { +// sb_push(arr, some_func3()); +// } +// } +// +// Note that the above relies on the fact that sb_push doesn't +// evaluate its second argument more than once. The macros do +// evaluate the *array* argument multiple times, and numeric +// arguments may be evaluated multiple times, but you can rely +// on the second argument of sb_push being evaluated only once. +// +// Of course, you don't have to store bare objects in the array; +// if you need the objects to have stable pointers, store an array +// of pointers instead: +// +// SomeStruct **arr = NULL; +// while (something) +// { +// SomeStruct *new_one = malloc(sizeof(*new_one)); +// new_one->whatever = whatever; +// new_one->whatup = whatup; +// new_one->foobar = barfoo; +// sb_push(arr, new_one); +// } +// +// How it works: +// +// A long-standing tradition in things like malloc implementations +// is to store extra data before the beginning of the block returned +// to the user. The stretchy buffer implementation here uses the +// same trick; the current-count and current-allocation-size are +// stored before the beginning of the array returned to the user. +// (This means you can't directly free() the pointer, because the +// allocated pointer is different from the type-safe pointer provided +// to the user.) +// +// The details are trivial and implementation is straightforward; +// the main trick is in realizing in the first place that it's +// possible to do this in a generic, type-safe way in C. +// +// Contributors: +// +// Timothy Wright (github:ZenToad) +// +// LICENSE +// +// See end of file for license information. + +#ifndef STB_STRETCHY_BUFFER_H_INCLUDED +#define STB_STRETCHY_BUFFER_H_INCLUDED + +#ifndef NO_STRETCHY_BUFFER_SHORT_NAMES +#define sb_free stb_sb_free +#define sb_push stb_sb_push +#define sb_count stb_sb_count +#define sb_add stb_sb_add +#define sb_last stb_sb_last +#endif + +#define stb_sb_free(a) ((a) ? free(stb__sbraw(a)),0 : 0) +#define stb_sb_push(a,v) (stb__sbmaybegrow(a,1), (a)[stb__sbn(a)++] = (v)) +#define stb_sb_count(a) ((a) ? stb__sbn(a) : 0) +#define stb_sb_add(a,n) (stb__sbmaybegrow(a,n), stb__sbn(a)+=(n), &(a)[stb__sbn(a)-(n)]) +#define stb_sb_last(a) ((a)[stb__sbn(a)-1]) + +#define stb__sbraw(a) ((int *) (a) - 2) +#define stb__sbm(a) stb__sbraw(a)[0] +#define stb__sbn(a) stb__sbraw(a)[1] + +#define stb__sbneedgrow(a,n) ((a)==0 || stb__sbn(a)+(n) >= stb__sbm(a)) +#define stb__sbmaybegrow(a,n) (stb__sbneedgrow(a,(n)) ? stb__sbgrow(a,n) : 0) +#define stb__sbgrow(a,n) (*((void **)&(a)) = stb__sbgrowf((a), (n), sizeof(*(a)))) + +#include + +static void * stb__sbgrowf(void *arr, int increment, int itemsize) +{ + int dbl_cur = arr ? 2*stb__sbm(arr) : 0; + int min_needed = stb_sb_count(arr) + increment; + int m = dbl_cur > min_needed ? dbl_cur : min_needed; + int *p = (int *) realloc(arr ? stb__sbraw(arr) : 0, itemsize * m + sizeof(int)*2); + if (p) { + if (!arr) + p[1] = 0; + p[0] = m; + return p+2; + } else { + #ifdef STRETCHY_BUFFER_OUT_OF_MEMORY + STRETCHY_BUFFER_OUT_OF_MEMORY ; + #endif + return (void *) (2*sizeof(int)); // try to force a NULL pointer exception later + } +} +#endif // STB_STRETCHY_BUFFER_H_INCLUDED + + +/* +------------------------------------------------------------------------------ +This software is available under 2 licenses -- choose whichever you prefer. +------------------------------------------------------------------------------ +ALTERNATIVE A - MIT License +Copyright (c) 2017 Sean Barrett +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +------------------------------------------------------------------------------ +ALTERNATIVE B - Public Domain (www.unlicense.org) +This is free and unencumbered software released into the public domain. +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +software, either in source code form or as a compiled binary, for any purpose, +commercial or non-commercial, and by any means. +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and to +the detriment of our heirs and successors. We intend this dedication to be an +overt act of relinquishment in perpetuity of all present and future rights to +this software under copyright law. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +------------------------------------------------------------------------------ +*/ diff --git a/tools/z64compress/src/enc/ucl.c b/tools/z64compress/src/enc/ucl.c new file mode 100644 index 000000000..49474af25 --- /dev/null +++ b/tools/z64compress/src/enc/ucl.c @@ -0,0 +1,50 @@ +#include +#include +#include +#include "ucl/ucl.h" + +int +uclenc( + void *_src + , unsigned src_sz + , void *_dst + , unsigned *dst_sz + , void *_ctx +) +{ + unsigned char *src = _src; + unsigned char *dst = _dst; + int r; + int level = 10; + ucl_uint result_sz; + + extern int g_hlen; /* header length */ + memset(dst, 0, g_hlen); + memcpy(dst, "UCL0", 4); + dst[4] = (src_sz >> 24); + dst[5] = (src_sz >> 16); + dst[6] = (src_sz >> 8); + dst[7] = (src_sz >> 0); + + r = ucl_nrv2b_99_compress( + src /* in */ + , src_sz /* in size */ + , dst + g_hlen /* out */ + , &result_sz /* out size */ + , NULL /* callback */ + , level /* level */ + , NULL /* conf */ + , NULL /* result */ + ); + + if (r != UCL_E_OK) + { + fprintf(stderr, "[!] fatal compression error %d\n", r); + exit(EXIT_FAILURE); + } + + *dst_sz = result_sz + g_hlen; + + return 0; +} + diff --git a/tools/z64compress/src/enc/ucl/comp/n2_99.ch b/tools/z64compress/src/enc/ucl/comp/n2_99.ch new file mode 100644 index 000000000..06c5c6467 --- /dev/null +++ b/tools/z64compress/src/enc/ucl/comp/n2_99.ch @@ -0,0 +1,651 @@ +/* n2_99.ch -- implementation of the NRV2[BDE]-99 compression algorithms + + This file is part of the UCL data compression library. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The UCL library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The UCL library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the UCL library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/ucl/ + */ + + + +#define HAVE_MEMCMP 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMSET 1 + + +#include "../ucl_conf.h" +#include "../ucl.h" + +#include +#include +#include +#include + + +/*********************************************************************** +// +************************************************************************/ + +#define SWD_USE_MALLOC 1 +#if (ACC_OS_DOS16) +#define SWD_HMASK (s->hmask) +#define HEAD2_VAR +#define IF_HEAD2(s) if (s->use_head2) +#else +#define SWD_HMASK (UCL_UINT32_C(65535)) +#define IF_HEAD2(s) +#endif +#define SWD_N (8*1024*1024ul) /* max. size of ring buffer */ +#define SWD_F 2048 /* upper limit for match length */ +#define SWD_THRESHOLD 1 /* lower limit for match length */ + +#if defined(NRV2B) +# define UCL_COMPRESS_T ucl_nrv2b_t +# define ucl_swd_t ucl_nrv2b_swd_t +# define ucl_nrv_99_compress ucl_nrv2b_99_compress +# define M2_MAX_OFFSET 0xd00 +#elif defined(NRV2D) +# define UCL_COMPRESS_T ucl_nrv2d_t +# define ucl_swd_t ucl_nrv2d_swd_t +# define ucl_nrv_99_compress ucl_nrv2d_99_compress +# define M2_MAX_OFFSET 0x500 +#elif defined(NRV2E) +# define UCL_COMPRESS_T ucl_nrv2e_t +# define ucl_swd_t ucl_nrv2e_swd_t +# define ucl_nrv_99_compress ucl_nrv2e_99_compress +# define M2_MAX_OFFSET 0x500 +#else +# error +#endif +#define ucl_swd_p ucl_swd_t * __UCL_MMODEL + +#include "ucl_mchw.ch" + + +/*********************************************************************** +// start-step-stop prefix coding +************************************************************************/ + +static void code_prefix_ss11(UCL_COMPRESS_T *c, ucl_uint32 i) +{ + if (i >= 2) + { + ucl_uint32 t = 4; + i += 2; + do { + t <<= 1; + } while (i >= t); + t >>= 1; + do { + t >>= 1; + bbPutBit(c, (i & t) ? 1 : 0); + bbPutBit(c, 0); + } while (t > 2); + } + bbPutBit(c, (unsigned)i & 1); + bbPutBit(c, 1); +} + + +#if defined(NRV2D) || defined(NRV2E) +static void code_prefix_ss12(UCL_COMPRESS_T *c, ucl_uint32 i) +{ + if (i >= 2) + { + ucl_uint32 t = 2; + do { + i -= t; + t <<= 2; + } while (i >= t); + do { + t >>= 1; + bbPutBit(c, (i & t) ? 1 : 0); + bbPutBit(c, 0); + t >>= 1; + bbPutBit(c, (i & t) ? 1 : 0); + } while (t > 2); + } + bbPutBit(c, (unsigned)i & 1); + bbPutBit(c, 1); +} +#endif + + +static void +code_match(UCL_COMPRESS_T *c, ucl_uint m_len, const ucl_uint m_off) +{ + unsigned m_low = 0; + + while (m_len > c->conf.max_match) + { + code_match(c, c->conf.max_match - 3, m_off); + m_len -= c->conf.max_match - 3; + } + + c->match_bytes += m_len; + if (m_len > c->result[3]) + c->result[3] = m_len; + if (m_off > c->result[1]) + c->result[1] = m_off; + + bbPutBit(c, 0); + +#if defined(NRV2B) + if (m_off == c->last_m_off) + { + bbPutBit(c, 0); + bbPutBit(c, 1); + } + else + { + code_prefix_ss11(c, 1 + ((m_off - 1) >> 8)); + bbPutByte(c, (unsigned)m_off - 1); + } + m_len = m_len - 1 - (m_off > M2_MAX_OFFSET); + if (m_len >= 4) + { + bbPutBit(c,0); + bbPutBit(c,0); + code_prefix_ss11(c, m_len - 4); + } + else + { + bbPutBit(c, m_len > 1); + bbPutBit(c, (unsigned)m_len & 1); + } +#elif defined(NRV2D) + m_len = m_len - 1 - (m_off > M2_MAX_OFFSET); + assert(m_len > 0); + m_low = (m_len >= 4) ? 0u : (unsigned) m_len; + if (m_off == c->last_m_off) + { + bbPutBit(c, 0); + bbPutBit(c, 1); + bbPutBit(c, m_low > 1); + bbPutBit(c, m_low & 1); + } + else + { + code_prefix_ss12(c, 1 + ((m_off - 1) >> 7)); + bbPutByte(c, ((((unsigned)m_off - 1) & 0x7f) << 1) | ((m_low > 1) ? 0 : 1)); + bbPutBit(c, m_low & 1); + } + if (m_len >= 4) + code_prefix_ss11(c, m_len - 4); +#elif defined(NRV2E) + m_len = m_len - 1 - (m_off > M2_MAX_OFFSET); + assert(m_len > 0); + m_low = (m_len <= 2); + if (m_off == c->last_m_off) + { + bbPutBit(c, 0); + bbPutBit(c, 1); + bbPutBit(c, m_low); + } + else + { + code_prefix_ss12(c, 1 + ((m_off - 1) >> 7)); + bbPutByte(c, ((((unsigned)m_off - 1) & 0x7f) << 1) | (m_low ^ 1)); + } + if (m_low) + bbPutBit(c, (unsigned)m_len - 1); + else if (m_len <= 4) + { + bbPutBit(c, 1); + bbPutBit(c, (unsigned)m_len - 3); + } + else + { + bbPutBit(c, 0); + code_prefix_ss11(c, m_len - 5); + } +#else +# error +#endif + + c->last_m_off = m_off; + (void)m_low; +} + + +static void +code_run(UCL_COMPRESS_T *c, const ucl_bytep ii, ucl_uint lit) +{ + if (lit == 0) + return; + c->lit_bytes += lit; + if (lit > c->result[5]) + c->result[5] = lit; + do { + bbPutBit(c, 1); + bbPutByte(c, *ii++); + } while (--lit > 0); +} + + +/*********************************************************************** +// +************************************************************************/ + +static int +len_of_coded_match(UCL_COMPRESS_T *c, ucl_uint m_len, ucl_uint m_off) +{ + int b; + if (m_len < 2 || (m_len == 2 && (m_off > M2_MAX_OFFSET)) + || m_off > c->conf.max_offset) + return -1; + assert(m_off > 0); + + m_len = m_len - 2 - (m_off > M2_MAX_OFFSET); + + if (m_off == c->last_m_off) + b = 1 + 2; + else + { +#if defined(NRV2B) + b = 1 + 10; + m_off = (m_off - 1) >> 8; + while (m_off > 0) + { + b += 2; + m_off >>= 1; + } +#elif defined(NRV2D) || defined(NRV2E) + b = 1 + 9; + m_off = (m_off - 1) >> 7; + while (m_off > 0) + { + b += 3; + m_off >>= 2; + } +#else +# error +#endif + } + +#if defined(NRV2B) || defined(NRV2D) + b += 2; + if (m_len < 3) + return b; + m_len -= 3; +#elif defined(NRV2E) + b += 2; + if (m_len < 2) + return b; + if (m_len < 4) + return b + 1; + m_len -= 4; +#else +# error +#endif + do { + b += 2; + m_len >>= 1; + } while (m_len > 0); + + return b; +} + + +/*********************************************************************** +// +************************************************************************/ + +#if !defined(NDEBUG) +static +void assert_match( const ucl_swd_p swd, ucl_uint m_len, ucl_uint m_off ) +{ + const UCL_COMPRESS_T *c = swd->c; + ucl_uint d_off; + + assert(m_len >= 2); + if (m_off <= (ucl_uint) (c->bp - c->in)) + { + assert(c->bp - m_off + m_len < c->ip); + assert(ucl_memcmp(c->bp, c->bp - m_off, m_len) == 0); + } + else + { + assert(swd->dict != NULL); + d_off = m_off - (ucl_uint) (c->bp - c->in); + assert(d_off <= swd->dict_len); + if (m_len > d_off) + { + assert(ucl_memcmp(c->bp, swd->dict_end - d_off, d_off) == 0); + assert(c->in + m_len - d_off < c->ip); + assert(ucl_memcmp(c->bp + d_off, c->in, m_len - d_off) == 0); + } + else + { + assert(ucl_memcmp(c->bp, swd->dict_end - d_off, m_len) == 0); + } + } +} +#else +# define assert_match(a,b,c) ((void)0) +#endif + + +#if defined(SWD_BEST_OFF) + +static void +better_match ( const ucl_swd_p swd, ucl_uint *m_len, ucl_uint *m_off ) +{ +} + +#endif + + +/*********************************************************************** +// +************************************************************************/ + +UCL_PUBLIC(int) +ucl_nrv_99_compress ( const ucl_bytep in, ucl_uint in_len, + ucl_bytep out, ucl_uintp out_len, + ucl_progress_callback_p cb, + int level, + const struct ucl_compress_config_p conf, + ucl_uintp result) +{ + const ucl_bytep ii; + ucl_uint lit; + ucl_uint m_len, m_off; + UCL_COMPRESS_T c_buffer; + UCL_COMPRESS_T * const c = &c_buffer; +#undef s +#if defined(SWD_USE_MALLOC) + ucl_swd_t the_swd = {0}; +# define s (&the_swd) +#else +// static ucl_swd_p s = 0; +#endif + ucl_uint result_buffer[16]; + int r; + + struct swd_config_t + { + unsigned try_lazy; + ucl_uint good_length; + ucl_uint max_lazy; + ucl_uint nice_length; + ucl_uint max_chain; + ucl_uint32 flags; + ucl_uint32 max_offset; + }; + const struct swd_config_t *sc; + static const struct swd_config_t swd_config[10] = { +#define F SWD_F + /* faster compression */ + { 0, 0, 0, 8, 4, 0, 48*1024L }, + { 0, 0, 0, 16, 8, 0, 48*1024L }, + { 0, 0, 0, 32, 16, 0, 48*1024L }, + { 1, 4, 4, 16, 16, 0, 48*1024L }, + { 1, 8, 16, 32, 32, 0, 48*1024L }, + { 1, 8, 16, 128, 128, 0, 48*1024L }, + { 2, 8, 32, 128, 256, 0, 128*1024L }, + { 2, 32, 128, F, 2048, 1, 128*1024L }, + { 2, 32, 128, F, 2048, 1, 256*1024L }, + { 2, F, F, F, 4096, 1, SWD_N } + /* max. compression */ +#undef F + }; + + if (level < 1 || level > 10) + return UCL_E_INVALID_ARGUMENT; + sc = &swd_config[level - 1]; + + memset(c, 0, sizeof(*c)); + memset(&c->conf, 0xff, sizeof(c->conf)); + c->ip = c->in = in; + c->in_end = in + in_len; + c->out = out; + if (cb && cb->callback) + c->cb = cb; + cb = NULL; + c->result = result ? result : (ucl_uintp) result_buffer; + result = NULL; + ucl_memset(c->result, 0, 16*sizeof(*c->result)); + c->result[0] = c->result[2] = c->result[4] = UCL_UINT_MAX; + if (conf) + ucl_memcpy(&c->conf, conf, sizeof(c->conf)); + conf = NULL; + r = bbConfig(c, 0, 8); + if (r == 0) + r = bbConfig(c, c->conf.bb_endian, c->conf.bb_size); + if (r != 0) + return UCL_E_INVALID_ARGUMENT; + c->bb_op = out; + + ii = c->ip; /* point to start of literal run */ + lit = 0; + +#if !defined(s) + if (!s) + s = (ucl_swd_p) ucl_malloc(ucl_sizeof(*s)); + if (!s) + return UCL_E_OUT_OF_MEMORY; + memset(s, 0, ucl_sizeof(*s)); +#endif + s->f = UCL_MIN((ucl_uint)SWD_F, c->conf.max_match); + s->n = UCL_MIN((ucl_uint)SWD_N, sc->max_offset); + s->hmask = UCL_UINT32_C(65535); +#ifdef HEAD2_VAR + s->use_head2 = 1; +#if defined(ACC_MM_AHSHIFT) + if (ACC_MM_AHSHIFT != 3) { + s->hmask = 16 * 1024 - 1; + s->use_head2 = 0; + } +#endif +#endif + if (c->conf.max_offset != UCL_UINT_MAX) + s->n = UCL_MIN(SWD_N, c->conf.max_offset); + if (in_len < s->n) + s->n = UCL_MAX(in_len, 256); + if (s->f < 8 || s->n < 256) + return UCL_E_INVALID_ARGUMENT; + r = init_match(c,s,NULL,0,sc->flags); + if (r == UCL_E_OK && (SWD_HSIZE - 1 != s->hmask)) + r = UCL_E_ERROR; + if (r != UCL_E_OK) + { +#if !defined(s) + ucl_free(s); +#endif + return r; + } + if (sc->max_chain > 0) + s->max_chain = sc->max_chain; + if (sc->nice_length > 0) + s->nice_length = sc->nice_length; + if (c->conf.max_match < s->nice_length) + s->nice_length = c->conf.max_match; + + if (c->cb) + (*c->cb->callback)(0,0,-1,c->cb->user); + + c->last_m_off = 1; + r = find_match(c,s,0,0); + if (r != UCL_E_OK) + return r; + while (c->look > 0) + { + ucl_uint ahead; + ucl_uint max_ahead; + int l1, l2; + + c->codesize = (ucl_uint) (c->bb_op - out); + + m_len = c->m_len; + m_off = c->m_off; + + assert(c->bp == c->ip - c->look); + assert(c->bp >= in); + if (lit == 0) + ii = c->bp; + assert(ii + lit == c->bp); + assert(s->b_char == *(c->bp)); + + if (m_len < 2 || (m_len == 2 && (m_off > M2_MAX_OFFSET)) + || m_off > c->conf.max_offset) + { + /* a literal */ + lit++; + s->max_chain = sc->max_chain; + r = find_match(c,s,1,0); + assert(r == 0); + continue; + } + + /* a match */ +#if defined(SWD_BEST_OFF) + if (s->use_best_off) + better_match(s,&m_len,&m_off); +#endif + assert_match(s,m_len,m_off); + + /* shall we try a lazy match ? */ + ahead = 0; + if (sc->try_lazy <= 0 || m_len >= sc->max_lazy || m_off == c->last_m_off) + { + /* no */ + l1 = 0; + max_ahead = 0; + } + else + { + /* yes, try a lazy match */ + l1 = len_of_coded_match(c,m_len,m_off); + assert(l1 > 0); + max_ahead = UCL_MIN((ucl_uint)sc->try_lazy, m_len - 1); + } + + while (ahead < max_ahead && c->look > m_len) + { + if (m_len >= sc->good_length) + s->max_chain = sc->max_chain >> 2; + else + s->max_chain = sc->max_chain; + r = find_match(c,s,1,0); + ahead++; + + assert(r == 0); + assert(c->look > 0); + assert(ii + lit + ahead == c->bp); + + if (c->m_len < 2) + continue; +#if defined(SWD_BEST_OFF) + if (s->use_best_off) + better_match(s,&c->m_len,&c->m_off); +#endif + l2 = len_of_coded_match(c,c->m_len,c->m_off); + if (l2 < 0) + continue; +#if 1 + if (l1 + (int)(ahead + c->m_len - m_len) * 5 > l2 + (int)(ahead) * 9) +#else + if (l1 > l2) +#endif + { + c->lazy++; + assert_match(s,c->m_len,c->m_off); + +#if 0 + if (l3 > 0) + { + /* code previous run */ + code_run(c,ii,lit); + lit = 0; + /* code shortened match */ + code_match(c,ahead,m_off); + } + else +#endif + { + lit += ahead; + assert(ii + lit == c->bp); + } + goto lazy_match_done; + } + } + + assert(ii + lit + ahead == c->bp); + + /* 1 - code run */ + code_run(c,ii,lit); + lit = 0; + + /* 2 - code match */ + code_match(c,m_len,m_off); + s->max_chain = sc->max_chain; + r = find_match(c,s,m_len,1+ahead); + assert(r == 0); + +lazy_match_done: ; + } + + /* store final run */ + code_run(c,ii,lit); + + /* EOF */ + bbPutBit(c, 0); +#if defined(NRV2B) + code_prefix_ss11(c, UCL_UINT32_C(0x1000000)); + bbPutByte(c, 0xff); +#elif defined(NRV2D) || defined(NRV2E) + code_prefix_ss12(c, UCL_UINT32_C(0x1000000)); + bbPutByte(c, 0xff); +#else +# error +#endif + bbFlushBits(c, 0); + + assert(c->textsize == in_len); + c->codesize = (ucl_uint) (c->bb_op - out); + *out_len = (ucl_uint) (c->bb_op - out); + if (c->cb) + (*c->cb->callback)(c->textsize,c->codesize,4,c->cb->user); + +#if 0 + printf("%7ld %7ld -> %7ld %7ld %7ld %ld (max: %d %d %d)\n", + (long) c->textsize, (long) in_len, (long) c->codesize, + c->match_bytes, c->lit_bytes, c->lazy, + c->result[1], c->result[3], c->result[5]); +#endif + assert(c->lit_bytes + c->match_bytes == in_len); + + swd_exit(s); +#if !defined(s) + ucl_free(s); +#endif + return UCL_E_OK; +#undef s +} + + +/* +vi:ts=4:et +*/ + diff --git a/tools/z64compress/src/enc/ucl/comp/n2b_99.c b/tools/z64compress/src/enc/ucl/comp/n2b_99.c new file mode 100644 index 000000000..e3b11cc16 --- /dev/null +++ b/tools/z64compress/src/enc/ucl/comp/n2b_99.c @@ -0,0 +1,38 @@ +/* n2b_99.c -- implementation of the NRV2B-99 compression algorithm + + This file is part of the UCL data compression library. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The UCL library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The UCL library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the UCL library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/ucl/ + */ + + + +#define NRV2B +#include "n2_99.ch" +#undef NRV2B + + +/* +vi:ts=4:et +*/ + diff --git a/tools/z64compress/src/enc/ucl/comp/ucl_mchw.ch b/tools/z64compress/src/enc/ucl/comp/ucl_mchw.ch new file mode 100644 index 000000000..c462576d8 --- /dev/null +++ b/tools/z64compress/src/enc/ucl/comp/ucl_mchw.ch @@ -0,0 +1,312 @@ +/* ucl_mchw.ch -- matching functions using a window + + This file is part of the UCL data compression library. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The UCL library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The UCL library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the UCL library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/ucl/ + */ + + +/*********************************************************************** +// +************************************************************************/ + +typedef struct +{ + int init; + + ucl_uint look; /* bytes in lookahead buffer */ + + ucl_uint m_len; + ucl_uint m_off; + + ucl_uint last_m_len; + ucl_uint last_m_off; + + const ucl_bytep bp; + const ucl_bytep ip; + const ucl_bytep in; + const ucl_bytep in_end; + ucl_bytep out; + + ucl_uint32 bb_b; + unsigned bb_k; + unsigned bb_c_endian; + unsigned bb_c_s; + unsigned bb_c_s8; + ucl_bytep bb_p; + ucl_bytep bb_op; + + struct ucl_compress_config_t conf; + ucl_uintp result; + + ucl_progress_callback_p cb; + + ucl_uint textsize; /* text size counter */ + ucl_uint codesize; /* code size counter */ + ucl_uint printcount; /* counter for reporting progress every 1K bytes */ + + /* some stats */ + unsigned long lit_bytes; + unsigned long match_bytes; + unsigned long rep_bytes; + unsigned long lazy; +} +UCL_COMPRESS_T; + + + +#if (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC)) +/* the cast is needed to work around a code generation bug */ +#define getbyte(c) ((c).ip < (c).in_end ? (int) (unsigned) *((c).ip)++ : (-1)) +#else +#define getbyte(c) ((c).ip < (c).in_end ? *((c).ip)++ : (-1)) +#endif + +#include "ucl_swd.ch" + + + +/*********************************************************************** +// +************************************************************************/ + +static int +init_match ( UCL_COMPRESS_T *c, ucl_swd_t *s, + const ucl_bytep dict, ucl_uint dict_len, + ucl_uint32 flags ) +{ + int r; + + assert(!c->init); + c->init = 1; + + s->c = c; + + c->last_m_len = c->last_m_off = 0; + + c->textsize = c->codesize = c->printcount = 0; + c->lit_bytes = c->match_bytes = c->rep_bytes = 0; + c->lazy = 0; + + r = swd_init(s,dict,dict_len); + if (r != UCL_E_OK) + { + swd_exit(s); + return r; + } + + s->use_best_off = (flags & 1) ? 1 : 0; + return UCL_E_OK; +} + + +/*********************************************************************** +// +************************************************************************/ + +static int +find_match ( UCL_COMPRESS_T *c, ucl_swd_t *s, + ucl_uint this_len, ucl_uint skip ) +{ + assert(c->init); + + if (skip > 0) + { + assert(this_len >= skip); + swd_accept(s, this_len - skip); + c->textsize += this_len - skip + 1; + } + else + { + assert(this_len <= 1); + c->textsize += this_len - skip; + } + + s->m_len = SWD_THRESHOLD; +#ifdef SWD_BEST_OFF + if (s->use_best_off) + memset(s->best_pos,0,sizeof(s->best_pos)); +#endif + swd_findbest(s); + c->m_len = s->m_len; +#if defined(__UCL_CHECKER) + /* s->m_off may be uninitialized if we didn't find a match, + * but then its value will never be used. + */ + c->m_off = (s->m_len == SWD_THRESHOLD) ? 0 : s->m_off; +#else + c->m_off = s->m_off; +#endif + + swd_getbyte(s); + + if (s->b_char < 0) + { + c->look = 0; + c->m_len = 0; + swd_exit(s); + } + else + { + c->look = s->look + 1; + } + c->bp = c->ip - c->look; + +#if 0 + /* brute force match search */ + if (c->m_len > SWD_THRESHOLD && c->m_len + 1 <= c->look) + { + const ucl_bytep ip = c->bp; + const ucl_bytep m = c->bp - c->m_off; + const ucl_bytep in = c->in; + + if (ip - in > s->n) + in = ip - s->n; + for (;;) + { + while (*in != *ip) + in++; + if (in == ip) + break; + if (in != m) + if (memcmp(in,ip,c->m_len+1) == 0) + printf("%p %p %p %5d\n",in,ip,m,c->m_len); + in++; + } + } +#endif + + if (c->cb && c->textsize > c->printcount) + { + (*c->cb->callback)(c->textsize,c->codesize,3,c->cb->user); + c->printcount += 1024; + } + + return UCL_E_OK; +} + + +/*********************************************************************** +// bit buffer +************************************************************************/ + +static int bbConfig(UCL_COMPRESS_T *c, int endian, int bitsize) +{ + if (endian != -1) + { + if (endian != 0) + return UCL_E_ERROR; + c->bb_c_endian = endian; + } + if (bitsize != -1) + { + if (bitsize != 8 && bitsize != 16 && bitsize != 32) + return UCL_E_ERROR; + c->bb_c_s = bitsize; + c->bb_c_s8 = bitsize / 8; + } + c->bb_b = 0; c->bb_k = 0; + c->bb_p = NULL; + c->bb_op = NULL; + return UCL_E_OK; +} + + +static void bbWriteBits(UCL_COMPRESS_T *c) +{ + ucl_bytep p = c->bb_p; + ucl_uint32 b = c->bb_b; + + p[0] = UCL_BYTE(b >> 0); + if (c->bb_c_s >= 16) + { + p[1] = UCL_BYTE(b >> 8); + if (c->bb_c_s == 32) + { + p[2] = UCL_BYTE(b >> 16); + p[3] = UCL_BYTE(b >> 24); + } + } +} + + +static void bbPutBit(UCL_COMPRESS_T *c, unsigned bit) +{ + assert(bit == 0 || bit == 1); + assert(c->bb_k <= c->bb_c_s); + + if (c->bb_k < c->bb_c_s) + { + if (c->bb_k == 0) + { + assert(c->bb_p == NULL); + c->bb_p = c->bb_op; + c->bb_op += c->bb_c_s8; + } + assert(c->bb_p != NULL); + assert(c->bb_p + c->bb_c_s8 <= c->bb_op); + + c->bb_b = (c->bb_b << 1) + bit; + c->bb_k++; + } + else + { + assert(c->bb_p != NULL); + assert(c->bb_p + c->bb_c_s8 <= c->bb_op); + + bbWriteBits(c); + c->bb_p = c->bb_op; + c->bb_op += c->bb_c_s8; + c->bb_b = bit; + c->bb_k = 1; + } +} + + +static void bbPutByte(UCL_COMPRESS_T *c, unsigned b) +{ + /**printf("putbyte %p %p %x (%d)\n", op, bb_p, x, bb_k);*/ + assert(c->bb_p == NULL || c->bb_p + c->bb_c_s8 <= c->bb_op); + *c->bb_op++ = UCL_BYTE(b); +} + + +static void bbFlushBits(UCL_COMPRESS_T *c, unsigned filler_bit) +{ + if (c->bb_k > 0) + { + assert(c->bb_k <= c->bb_c_s); + while (c->bb_k != c->bb_c_s) + bbPutBit(c, filler_bit); + bbWriteBits(c); + c->bb_k = 0; + } + c->bb_p = NULL; +} + + + +/* +vi:ts=4:et +*/ + diff --git a/tools/z64compress/src/enc/ucl/comp/ucl_swd.ch b/tools/z64compress/src/enc/ucl/comp/ucl_swd.ch new file mode 100644 index 000000000..8b829415b --- /dev/null +++ b/tools/z64compress/src/enc/ucl/comp/ucl_swd.ch @@ -0,0 +1,686 @@ +/* ucl_swd.c -- sliding window dictionary + + This file is part of the UCL data compression library. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The UCL library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The UCL library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the UCL library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/ucl/ + */ + + +#if (UCL_UINT_MAX < UCL_0xffffffffL) +# error "UCL_UINT_MAX" +#endif + + +/*********************************************************************** +// +************************************************************************/ + +/* unsigned type for dictionary access - don't waste memory here */ +#if (0UL + SWD_N + SWD_F + SWD_F < 0UL + USHRT_MAX) + typedef unsigned short swd_uint; +# define SWD_UINT_MAX USHRT_MAX +#else + typedef ucl_uint swd_uint; +# define SWD_UINT_MAX UCL_UINT_MAX +#endif +#define swd_uintp swd_uint __UCL_MMODEL * +#define SWD_UINT(x) ((swd_uint)(x)) + + +#ifndef SWD_MAX_CHAIN +# define SWD_MAX_CHAIN 2048 +#endif +#define SWD_HSIZE (SWD_HMASK + 1) + +#if !defined(HEAD3) +#if 1 +# define HEAD3(b,p) \ + (((0x9f5f*(((((ucl_uint32)b[p]<<5)^b[p+1])<<5)^b[p+2]))>>5) & SWD_HMASK) +#else +# define HEAD3(b,p) \ + (((0x9f5f*(((((ucl_uint32)b[p+2]<<5)^b[p+1])<<5)^b[p]))>>5) & SWD_HMASK) +#endif +#endif + +#if !defined(HEAD2) +#if (SWD_THRESHOLD == 1) +# if 1 && defined(UA_GET2) +# define HEAD2(b,p) UA_GET2(&(b[p])) +# else +# define HEAD2(b,p) (b[p] ^ ((unsigned)b[p+1]<<8)) +# endif +# define NIL2 SWD_UINT_MAX +#endif +#endif + + +#if defined(__UCL_CHECKER) + /* malloc arrays of the exact size to detect any overrun */ +# ifndef SWD_USE_MALLOC +# define SWD_USE_MALLOC +# endif +#endif + + +typedef struct +{ +/* public - "built-in" */ + ucl_uint n; + ucl_uint f; + ucl_uint threshold; + ucl_uint hmask; + +/* public - configuration */ + ucl_uint max_chain; + ucl_uint nice_length; + ucl_bool use_best_off; + ucl_uint lazy_insert; + +/* public - output */ + ucl_uint m_len; + ucl_uint m_off; + ucl_uint look; + int b_char; +#if defined(SWD_BEST_OFF) + ucl_uint best_off[ SWD_BEST_OFF ]; +#endif + +/* semi public */ + UCL_COMPRESS_T *c; + ucl_uint m_pos; +#if defined(SWD_BEST_OFF) + ucl_uint best_pos[ SWD_BEST_OFF ]; +#endif + +/* private */ + const ucl_bytep dict; + const ucl_bytep dict_end; + ucl_uint dict_len; + +/* private */ + ucl_uint ip; /* input pointer (lookahead) */ + ucl_uint bp; /* buffer pointer */ + ucl_uint rp; /* remove pointer */ + ucl_uint b_size; + + ucl_bytep b_wrap; + + ucl_uint node_count; + ucl_uint first_rp; + +#if defined(SWD_USE_MALLOC) + ucl_bytep b; + swd_uintp head3; + swd_uintp succ3; + swd_uintp best3; + swd_uintp llen3; +#ifdef HEAD2 + swd_uintp head2; +#ifdef HEAD2_VAR + int use_head2; +#endif +#endif +#else + unsigned char b [ SWD_N + SWD_F + SWD_F ]; + swd_uint head3 [ SWD_HSIZE ]; + swd_uint succ3 [ SWD_N + SWD_F ]; + swd_uint best3 [ SWD_N + SWD_F ]; + swd_uint llen3 [ SWD_HSIZE ]; +#ifdef HEAD2 + swd_uint head2 [ UCL_UINT32_C(65536) ]; +#endif +#endif +} +ucl_swd_t; + + +/* Access macro for head3. + * head3[key] may be uninitialized if the list is emtpy, + * but then its value will never be used. + */ +#if defined(__UCL_CHECKER) +# define s_get_head3(s,key) \ + ((s->llen3[key] == 0) ? SWD_UINT_MAX : s->head3[key]) +#else +# define s_get_head3(s,key) s->head3[key] +#endif + + +/*********************************************************************** +// +************************************************************************/ + +static +void swd_initdict(ucl_swd_t *s, const ucl_bytep dict, ucl_uint dict_len) +{ + s->dict = s->dict_end = NULL; + s->dict_len = 0; + + if (!dict || dict_len <= 0) + return; + if (dict_len > s->n) + { + dict += dict_len - s->n; + dict_len = s->n; + } + + s->dict = dict; + s->dict_len = dict_len; + s->dict_end = dict + dict_len; + ucl_memcpy(s->b,dict,dict_len); + s->ip = dict_len; +} + + +static +void swd_insertdict(ucl_swd_t *s, ucl_uint node, ucl_uint len) +{ + ucl_uint key; + + s->node_count = s->n - len; + s->first_rp = node; + + while (len-- > 0) + { + key = HEAD3(s->b,node); + s->succ3[node] = s_get_head3(s,key); + s->head3[key] = SWD_UINT(node); + s->best3[node] = SWD_UINT(s->f + 1); + s->llen3[key]++; + assert(s->llen3[key] <= s->n); + +#ifdef HEAD2 + IF_HEAD2(s) { + key = HEAD2(s->b,node); + s->head2[key] = SWD_UINT(node); + } +#endif + + node++; + } +} + + +/*********************************************************************** +// +************************************************************************/ + +static +int swd_init(ucl_swd_t *s, const ucl_bytep dict, ucl_uint dict_len) +{ +#if defined(SWD_USE_MALLOC) + s->b = NULL; + s->head3 = NULL; + s->succ3 = NULL; + s->best3 = NULL; + s->llen3 = NULL; +#ifdef HEAD2 + s->head2 = NULL; +#endif +#endif + + if (s->n == 0) + s->n = SWD_N; + if (s->f == 0) + s->f = SWD_F; + s->threshold = SWD_THRESHOLD; + if (s->n > SWD_N || s->f > SWD_F) + return UCL_E_INVALID_ARGUMENT; + +#if defined(SWD_USE_MALLOC) + s->b = (ucl_bytep) ucl_alloc(1, s->n + s->f + s->f); + s->head3 = (swd_uintp) ucl_alloc(SWD_HSIZE, sizeof(*s->head3)); + s->succ3 = (swd_uintp) ucl_alloc(s->n + s->f, sizeof(*s->succ3)); + s->best3 = (swd_uintp) ucl_alloc(s->n + s->f, sizeof(*s->best3)); + s->llen3 = (swd_uintp) ucl_alloc(SWD_HSIZE, sizeof(*s->llen3)); + if (!s->b || !s->head3 || !s->succ3 || !s->best3 || !s->llen3) + return UCL_E_OUT_OF_MEMORY; +#ifdef HEAD2 + IF_HEAD2(s) { + s->head2 = (swd_uintp) ucl_alloc(UCL_UINT32_C(65536), sizeof(*s->head2)); + if (!s->head2) + return UCL_E_OUT_OF_MEMORY; + } +#endif +#endif + + /* defaults */ + s->max_chain = SWD_MAX_CHAIN; + s->nice_length = s->f; + s->use_best_off = 0; + s->lazy_insert = 0; + + s->b_size = s->n + s->f; + if (s->b_size + s->f >= SWD_UINT_MAX) + return UCL_E_ERROR; + s->b_wrap = s->b + s->b_size; + s->node_count = s->n; + + ucl_memset(s->llen3, 0, (ucl_uint)sizeof(s->llen3[0]) * SWD_HSIZE); +#ifdef HEAD2 + IF_HEAD2(s) { +#if 1 + ucl_memset(s->head2, 0xff, (ucl_uint)sizeof(s->head2[0]) * UCL_UINT32_C(65536)); + assert(s->head2[0] == NIL2); +#else + ucl_uint32 i; + for (i = 0; i < UCL_UINT32_C(65536); i++) + s->head2[i] = NIL2; +#endif + } +#endif + + s->ip = 0; + swd_initdict(s,dict,dict_len); + s->bp = s->ip; + s->first_rp = s->ip; + + assert(s->ip + s->f <= s->b_size); +#if 1 + s->look = (ucl_uint) (s->c->in_end - s->c->ip); + if (s->look > 0) + { + if (s->look > s->f) + s->look = s->f; + ucl_memcpy(&s->b[s->ip],s->c->ip,s->look); + s->c->ip += s->look; + s->ip += s->look; + } +#else + s->look = 0; + while (s->look < s->f) + { + int c; + if ((c = getbyte(*(s->c))) < 0) + break; + s->b[s->ip] = UCL_BYTE(c); + s->ip++; + s->look++; + } +#endif + if (s->ip == s->b_size) + s->ip = 0; + + if (s->look >= 2 && s->dict_len > 0) + swd_insertdict(s,0,s->dict_len); + + s->rp = s->first_rp; + if (s->rp >= s->node_count) + s->rp -= s->node_count; + else + s->rp += s->b_size - s->node_count; + +#if defined(__UCL_CHECKER) + /* initialize memory for the first few HEAD3 (if s->ip is not far + * enough ahead to do this job for us). The value doesn't matter. */ + if (s->look < 3) + ucl_memset(&s->b[s->bp+s->look],0,3); +#endif + + return UCL_E_OK; +} + + +static +void swd_exit(ucl_swd_t *s) +{ +#if defined(SWD_USE_MALLOC) + /* free in reverse order of allocations */ +# ifdef HEAD2 + ucl_free(s->head2); s->head2 = NULL; +#endif + ucl_free(s->llen3); s->llen3 = NULL; + ucl_free(s->best3); s->best3 = NULL; + ucl_free(s->succ3); s->succ3 = NULL; + ucl_free(s->head3); s->head3 = NULL; + ucl_free(s->b); s->b = NULL; +#else + //ACC_UNUSED(s); +#endif +} + + +#define swd_pos2off(s,pos) \ + (s->bp > (pos) ? s->bp - (pos) : s->b_size - ((pos) - s->bp)) + + +/*********************************************************************** +// +************************************************************************/ + +static +void swd_getbyte(ucl_swd_t *s) +{ + int c; + + if ((c = getbyte(*(s->c))) < 0) + { + if (s->look > 0) + --s->look; +#if defined(__UCL_CHECKER) + /* initialize memory - value doesn't matter */ + s->b[s->ip] = 0; + if (s->ip < s->f) + s->b_wrap[s->ip] = 0; +#endif + } + else + { + s->b[s->ip] = UCL_BYTE(c); + if (s->ip < s->f) + s->b_wrap[s->ip] = UCL_BYTE(c); + } + if (++s->ip == s->b_size) + s->ip = 0; + if (++s->bp == s->b_size) + s->bp = 0; + if (++s->rp == s->b_size) + s->rp = 0; +} + + +/*********************************************************************** +// remove node from lists +************************************************************************/ + +static +void swd_remove_node(ucl_swd_t *s, ucl_uint node) +{ + if (s->node_count == 0) + { + ucl_uint key; + +#ifdef UCL_DEBUG + if (s->first_rp != UCL_UINT_MAX) + { + if (node != s->first_rp) + printf("Remove %5u: %5u %5u %5u %5u %6u %6u\n", + node, s->rp, s->ip, s->bp, s->first_rp, + s->ip - node, s->ip - s->bp); + assert(node == s->first_rp); + s->first_rp = UCL_UINT_MAX; + } +#endif + + key = HEAD3(s->b,node); + assert(s->llen3[key] > 0); + --s->llen3[key]; + +#ifdef HEAD2 + IF_HEAD2(s) { + key = HEAD2(s->b,node); + assert(s->head2[key] != NIL2); + if ((ucl_uint) s->head2[key] == node) + s->head2[key] = NIL2; + } +#endif + } + else + --s->node_count; +} + + +/*********************************************************************** +// +************************************************************************/ + +static +void swd_accept(ucl_swd_t *s, ucl_uint n) +{ + assert(n <= s->look); + + if (n > 0) do + { + ucl_uint key; + + swd_remove_node(s,s->rp); + + /* add bp into HEAD3 */ + key = HEAD3(s->b,s->bp); + s->succ3[s->bp] = s_get_head3(s,key); + s->head3[key] = SWD_UINT(s->bp); + s->best3[s->bp] = SWD_UINT(s->f + 1); + s->llen3[key]++; + assert(s->llen3[key] <= s->n); + +#ifdef HEAD2 + IF_HEAD2(s) { + /* add bp into HEAD2 */ + key = HEAD2(s->b,s->bp); + s->head2[key] = SWD_UINT(s->bp); + } +#endif + + swd_getbyte(s); + } while (--n > 0); +} + + +/*********************************************************************** +// +************************************************************************/ + +static +void swd_search(ucl_swd_t *s, ucl_uint node, ucl_uint cnt) +{ + const ucl_bytep p1; + const ucl_bytep p2; + const ucl_bytep px; + ucl_uint m_len = s->m_len; + const ucl_bytep b = s->b; + const ucl_bytep bp = s->b + s->bp; + const ucl_bytep bx = s->b + s->bp + s->look; + unsigned char scan_end1; + + assert(s->m_len > 0); + + scan_end1 = bp[m_len - 1]; + for ( ; cnt-- > 0; node = s->succ3[node]) + { + p1 = bp; + p2 = b + node; + px = bx; + + assert(m_len < s->look); + + if ( +#if 1 + p2[m_len - 1] == scan_end1 && + p2[m_len] == p1[m_len] && +#endif + p2[0] == p1[0] && + p2[1] == p1[1]) + { + ucl_uint i; + assert(ucl_memcmp(bp,&b[node],3) == 0); + +#if 0 && defined(UA_GET4) + p1 += 3; p2 += 3; + while (p1 < px && UA_GET4(p1) == UA_GET4(p2)) + p1 += 4, p2 += 4; + while (p1 < px && *p1 == *p2) + p1 += 1, p2 += 1; +#else + p1 += 2; p2 += 2; + do {} while (++p1 < px && *p1 == *++p2); +#endif + i = (ucl_uint) (p1 - bp); + +#ifdef UCL_DEBUG + if (ucl_memcmp(bp,&b[node],i) != 0) + printf("%5ld %5ld %02x%02x %02x%02x\n", + (long)s->bp, (long) node, + bp[0], bp[1], b[node], b[node+1]); +#endif + assert(ucl_memcmp(bp,&b[node],i) == 0); + +#if defined(SWD_BEST_OFF) + if (i < SWD_BEST_OFF) + { + if (s->best_pos[i] == 0) + s->best_pos[i] = node + 1; + } +#endif + if (i > m_len) + { + s->m_len = m_len = i; + s->m_pos = node; + if (m_len == s->look) + return; + if (m_len >= s->nice_length) + return; + if (m_len > (ucl_uint) s->best3[node]) + return; + scan_end1 = bp[m_len - 1]; + } + } + } +} + + +/*********************************************************************** +// +************************************************************************/ + +#ifdef HEAD2 + +static +ucl_bool swd_search2(ucl_swd_t *s) +{ + ucl_uint key; + + assert(s->look >= 2); + assert(s->m_len > 0); + + key = s->head2[ HEAD2(s->b,s->bp) ]; + if (key == NIL2) + return 0; +#ifdef UCL_DEBUG + if (ucl_memcmp(&s->b[s->bp],&s->b[key],2) != 0) + printf("%5ld %5ld %02x%02x %02x%02x\n", (long)s->bp, (long)key, + s->b[s->bp], s->b[s->bp+1], s->b[key], s->b[key+1]); +#endif + assert(ucl_memcmp(&s->b[s->bp],&s->b[key],2) == 0); +#if defined(SWD_BEST_OFF) + if (s->best_pos[2] == 0) + s->best_pos[2] = key + 1; +#endif + + if (s->m_len < 2) + { + s->m_len = 2; + s->m_pos = key; + } + return 1; +} + +#endif + + +/*********************************************************************** +// +************************************************************************/ + +static +void swd_findbest(ucl_swd_t *s) +{ + ucl_uint key; + ucl_uint cnt, node; + ucl_uint len; + + assert(s->m_len > 0); + + /* get current head, add bp into HEAD3 */ + key = HEAD3(s->b,s->bp); + node = s->succ3[s->bp] = s_get_head3(s,key); + cnt = s->llen3[key]++; + assert(s->llen3[key] <= s->n + s->f); + if (cnt > s->max_chain && s->max_chain > 0) + cnt = s->max_chain; + s->head3[key] = SWD_UINT(s->bp); + + s->b_char = s->b[s->bp]; + len = s->m_len; + if (s->m_len >= s->look) + { + if (s->look == 0) + s->b_char = -1; + s->m_off = 0; + s->best3[s->bp] = SWD_UINT(s->f + 1); + } + else + { +#if defined(HEAD2_VAR) + if (s->use_head2) { + if (swd_search2(s) && s->look >= 3) + swd_search(s,node,cnt); + } else { + if (s->look >= 3) + swd_search(s,node,cnt); + } +#elif defined(HEAD2) + if (swd_search2(s) && s->look >= 3) + swd_search(s,node,cnt); +#else + if (s->look >= 3) + swd_search(s,node,cnt); +#endif + if (s->m_len > len) + s->m_off = swd_pos2off(s,s->m_pos); + s->best3[s->bp] = SWD_UINT(s->m_len); + +#if defined(SWD_BEST_OFF) + if (s->use_best_off) + { + int i; + for (i = 2; i < SWD_BEST_OFF; i++) + if (s->best_pos[i] > 0) + s->best_off[i] = swd_pos2off(s,s->best_pos[i]-1); + else + s->best_off[i] = 0; + } +#endif + } + + swd_remove_node(s,s->rp); + +#ifdef HEAD2 + /* add bp into HEAD2 */ + IF_HEAD2(s) { + key = HEAD2(s->b,s->bp); + s->head2[key] = SWD_UINT(s->bp); + } +#endif +} + + +#undef HEAD3 +#undef HEAD2 +#undef IF_HEAD2 +#undef s_get_head3 + + +/* +vi:ts=4:et +*/ + diff --git a/tools/z64compress/src/enc/ucl/getbit.h b/tools/z64compress/src/enc/ucl/getbit.h new file mode 100644 index 000000000..36ef48c99 --- /dev/null +++ b/tools/z64compress/src/enc/ucl/getbit.h @@ -0,0 +1,64 @@ +/* getbit.h -- bit-buffer access + + This file is part of the UCL data compression library. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The UCL library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The UCL library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the UCL library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/ucl/ + */ + + +/*********************************************************************** +// +************************************************************************/ + +#if 1 +#define getbit_8(bb, src, ilen) \ + (((bb = bb & 0x7f ? bb*2 : ((unsigned)src[ilen++]*2+1)) >> 8) & 1) +#elif 1 +#define getbit_8(bb, src, ilen) \ + (bb*=2,bb&0xff ? (bb>>8)&1 : ((bb=src[ilen++]*2+1)>>8)&1) +#else +#define getbit_8(bb, src, ilen) \ + (((bb*=2, (bb&0xff ? bb : (bb=src[ilen++]*2+1,bb))) >> 8) & 1) +#endif + + +#define getbit_le16(bb, src, ilen) \ + (bb*=2,bb&0xffff ? (bb>>16)&1 : (ilen+=2,((bb=(src[ilen-2]+src[ilen-1]*256u)*2+1)>>16)&1)) + + +#if 1 && (ACC_ENDIAN_LITTLE_ENDIAN) && defined(UA_GET4) +#define getbit_le32(bb, bc, src, ilen) \ + (bc > 0 ? ((bb>>--bc)&1) : (bc=31,\ + bb=UA_GET4((src)+ilen),ilen+=4,(bb>>31)&1)) +#else +#define getbit_le32(bb, bc, src, ilen) \ + (bc > 0 ? ((bb>>--bc)&1) : (bc=31,\ + bb=src[ilen]+src[ilen+1]*0x100+src[ilen+2]*UCL_UINT32_C(0x10000)+src[ilen+3]*UCL_UINT32_C(0x1000000),\ + ilen+=4,(bb>>31)&1)) +#endif + + +/* +vi:ts=4:et +*/ + diff --git a/tools/z64compress/src/enc/ucl/n2b_d.c b/tools/z64compress/src/enc/ucl/n2b_d.c new file mode 100644 index 000000000..0dc359068 --- /dev/null +++ b/tools/z64compress/src/enc/ucl/n2b_d.c @@ -0,0 +1,179 @@ +/* n2b_d.c -- implementation of the NRV2B decompression algorithm + + This file is part of the UCL data compression library. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The UCL library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The UCL library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the UCL library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/ucl/ + */ + + +/*********************************************************************** +// actual implementation used by a recursive #include +************************************************************************/ + +#ifdef getbit + +#ifdef SAFE +#define fail(x,r) if (x) { *dst_len = olen; return r; } +#else +#define fail(x,r) +#endif + +{ + ucl_uint32 bb = 0; +#ifdef TEST_OVERLAP + ucl_uint ilen = src_off, olen = 0, last_m_off = 1; +#else + ucl_uint ilen = 0, olen = 0, last_m_off = 1; +#endif +#ifdef SAFE + const ucl_uint oend = *dst_len; +#endif + //ACC_UNUSED(wrkmem); + +#ifdef TEST_OVERLAP + src_len += src_off; + fail(oend >= src_len, UCL_E_OVERLAP_OVERRUN); +#endif + + for (;;) + { + ucl_uint m_off, m_len; + + while (getbit(bb)) + { + fail(ilen >= src_len, UCL_E_INPUT_OVERRUN); + fail(olen >= oend, UCL_E_OUTPUT_OVERRUN); +#ifdef TEST_OVERLAP + fail(olen > ilen, UCL_E_OVERLAP_OVERRUN); + olen++; ilen++; +#else + dst[olen++] = src[ilen++]; +#endif + } + m_off = 1; + do { + m_off = m_off*2 + getbit(bb); + fail(ilen >= src_len, UCL_E_INPUT_OVERRUN); + fail(m_off > UCL_UINT32_C(0xffffff) + 3, UCL_E_LOOKBEHIND_OVERRUN); + } while (!getbit(bb)); + if (m_off == 2) + { + m_off = last_m_off; + } + else + { + fail(ilen >= src_len, UCL_E_INPUT_OVERRUN); + m_off = (m_off-3)*256 + src[ilen++]; + if (m_off == UCL_UINT32_C(0xffffffff)) + break; + last_m_off = ++m_off; + } + m_len = getbit(bb); + m_len = m_len*2 + getbit(bb); + if (m_len == 0) + { + m_len++; + do { + m_len = m_len*2 + getbit(bb); + fail(ilen >= src_len, UCL_E_INPUT_OVERRUN); + fail(m_len >= oend, UCL_E_OUTPUT_OVERRUN); + } while (!getbit(bb)); + m_len += 2; + } + m_len += (m_off > 0xd00); + fail(olen + m_len > oend, UCL_E_OUTPUT_OVERRUN); + fail(m_off > olen, UCL_E_LOOKBEHIND_OVERRUN); +#ifdef TEST_OVERLAP + olen += m_len + 1; + fail(olen > ilen, UCL_E_OVERLAP_OVERRUN); +#else + { + const ucl_bytep m_pos; + m_pos = dst + olen - m_off; + dst[olen++] = *m_pos++; + do dst[olen++] = *m_pos++; while (--m_len > 0); + } +#endif + } + *dst_len = olen; + return ilen == src_len ? UCL_E_OK : (ilen < src_len ? UCL_E_INPUT_NOT_CONSUMED : UCL_E_INPUT_OVERRUN); +} + +#undef fail + +#endif /* getbit */ + + +/*********************************************************************** +// decompressor entries for the different bit-buffer sizes +************************************************************************/ + +#ifndef getbit + +#include "ucl_conf.h" +#include "ucl.h" +#include "getbit.h" + + +UCL_PUBLIC(int) +ucl_nrv2b_decompress_8 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ) +{ +#define getbit(bb) getbit_8(bb,src,ilen) +#include "n2b_d.c" +#undef getbit +} + +#if 0 +UCL_PUBLIC(int) +ucl_nrv2b_decompress_le16 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ) +{ +#define getbit(bb) getbit_le16(bb,src,ilen) +#include "n2b_d.c" +#undef getbit +} + + +UCL_PUBLIC(int) +ucl_nrv2b_decompress_le32 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ) +{ + unsigned bc = 0; +#define getbit(bb) getbit_le32(bb,bc,src,ilen) +#include "n2b_d.c" +#undef getbit +} +#endif /* 0 */ + + +#endif /* !getbit */ + + +/* +vi:ts=4:et +*/ + diff --git a/tools/z64compress/src/enc/ucl/ucl.h b/tools/z64compress/src/enc/ucl/ucl.h new file mode 100644 index 000000000..f136d4a2d --- /dev/null +++ b/tools/z64compress/src/enc/ucl/ucl.h @@ -0,0 +1,249 @@ +/* ucl.h -- prototypes for the UCL data compression library + + This file is part of the UCL data compression library. + + Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The UCL library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The UCL library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the UCL library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/ucl/ + */ + + +#ifndef __UCL_H_INCLUDED +#define __UCL_H_INCLUDED + +#ifndef __UCLCONF_H_INCLUDED +#include "uclconf.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +/*********************************************************************** +// Compression fine-tuning configuration. +// +// Pass a NULL pointer to the compression functions for default values. +// Otherwise set all values to -1 [i.e. initialize the struct by a +// `memset(x,0xff,sizeof(x))'] and then set the required values. +************************************************************************/ + +struct ucl_compress_config_t +{ + int bb_endian; + int bb_size; + ucl_uint max_offset; + ucl_uint max_match; + int s_level; + int h_level; + int p_level; + int c_flags; + ucl_uint m_size; +}; + +#define ucl_compress_config_p ucl_compress_config_t __UCL_MMODEL * + + +/*********************************************************************** +// compressors +// +// Pass NULL for `cb' (no progress callback), `conf' (default compression +// configuration) and `result' (no statistical result). +************************************************************************/ + +UCL_EXTERN(int) +ucl_nrv2b_99_compress ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_progress_callback_p cb, + int level, + const struct ucl_compress_config_p conf, + ucl_uintp result ); + +UCL_EXTERN(int) +ucl_nrv2d_99_compress ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_progress_callback_p cb, + int level, + const struct ucl_compress_config_p conf, + ucl_uintp result ); + +UCL_EXTERN(int) +ucl_nrv2e_99_compress ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_progress_callback_p cb, + int level, + const struct ucl_compress_config_p conf, + ucl_uintp result ); + + +/*********************************************************************** +// decompressors +// +// Always pass NULL for `wrkmem'. This parameter is for symetry +// with my other compression libaries and is not used in UCL - +// UCL does not need any additional memory (or even local stack space) +// for decompression. +************************************************************************/ + +UCL_EXTERN(int) +ucl_nrv2b_decompress_8 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2b_decompress_le16 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2b_decompress_le32 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2b_decompress_safe_8 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2b_decompress_safe_le16 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2b_decompress_safe_le32 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); + +UCL_EXTERN(int) +ucl_nrv2d_decompress_8 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2d_decompress_le16 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2d_decompress_le32 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2d_decompress_safe_8 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2d_decompress_safe_le16 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2d_decompress_safe_le32 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); + +UCL_EXTERN(int) +ucl_nrv2e_decompress_8 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2e_decompress_le16 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2e_decompress_le32 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2e_decompress_safe_8 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2e_decompress_safe_le16 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2e_decompress_safe_le32 ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); + + +/*********************************************************************** +// assembler decompressors [TO BE ADDED] +************************************************************************/ + + +/*********************************************************************** +// test an overlapping in-place decompression within a buffer: +// - try a virtual decompression from &buf[src_off] -> &buf[0] +// - no data is actually written +// - only the bytes at buf[src_off..src_off+src_len-1] will get accessed +// +// NOTE: always pass NULL for `wrkmem' - see above. +************************************************************************/ + +UCL_EXTERN(int) +ucl_nrv2b_test_overlap_8 ( const ucl_bytep buf, ucl_uint src_off, + ucl_uint src_len, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2b_test_overlap_le16 ( const ucl_bytep buf, ucl_uint src_off, + ucl_uint src_len, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2b_test_overlap_le32 ( const ucl_bytep buf, ucl_uint src_off, + ucl_uint src_len, ucl_uintp dst_len, + ucl_voidp wrkmem ); + +UCL_EXTERN(int) +ucl_nrv2d_test_overlap_8 ( const ucl_bytep buf, ucl_uint src_off, + ucl_uint src_len, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2d_test_overlap_le16 ( const ucl_bytep buf, ucl_uint src_off, + ucl_uint src_len, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2d_test_overlap_le32 ( const ucl_bytep buf, ucl_uint src_off, + ucl_uint src_len, ucl_uintp dst_len, + ucl_voidp wrkmem ); + +UCL_EXTERN(int) +ucl_nrv2e_test_overlap_8 ( const ucl_bytep buf, ucl_uint src_off, + ucl_uint src_len, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2e_test_overlap_le16 ( const ucl_bytep buf, ucl_uint src_off, + ucl_uint src_len, ucl_uintp dst_len, + ucl_voidp wrkmem ); +UCL_EXTERN(int) +ucl_nrv2e_test_overlap_le32 ( const ucl_bytep buf, ucl_uint src_off, + ucl_uint src_len, ucl_uintp dst_len, + ucl_voidp wrkmem ); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* already included */ + diff --git a/tools/z64compress/src/enc/ucl/ucl_conf.h b/tools/z64compress/src/enc/ucl/ucl_conf.h new file mode 100644 index 000000000..79f5c6b61 --- /dev/null +++ b/tools/z64compress/src/enc/ucl/ucl_conf.h @@ -0,0 +1,220 @@ +/* ucl_conf.h -- main internal configuration file for the the UCL library + + This file is part of the UCL data compression library. + + Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The UCL library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The UCL library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the UCL library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/ucl/ + */ + + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the library and is subject + to change. + */ + + +#ifndef __UCL_CONF_H +#define __UCL_CONF_H + + +/*********************************************************************** +// +************************************************************************/ + +#if defined(__UCLCONF_H_INCLUDED) +# error "include this file first" +#endif +#include "uclconf.h" + +#if !defined(__UCL_MMODEL_HUGE) && defined(HAVE_MEMCMP) +# define ucl_memcmp(a,b,c) memcmp(a,b,c) +#endif +#if !defined(__UCL_MMODEL_HUGE) && defined(HAVE_MEMCPY) +# define ucl_memcpy(a,b,c) memcpy(a,b,c) +#endif +#if !defined(__UCL_MMODEL_HUGE) && defined(HAVE_MEMMOVE) +# define ucl_memmove(a,b,c) memmove(a,b,c) +#endif +#if !defined(__UCL_MMODEL_HUGE) && defined(HAVE_MEMSET) +# define ucl_memset(a,b,c) memset(a,b,c) +#endif +#if 0 /* WANT_ACC */ +#if defined(UCL_HAVE_CONFIG_H) +# define ACC_CONFIG_NO_HEADER 1 +#endif +#define __ACCLIB_FUNCNAME(f) error_do_not_use_acclib +#include "acc/acc.h" + +#if (ACC_CC_MSC && (_MSC_VER >= 1300)) + /* avoid `-Wall' warnings in system header files */ +# pragma warning(disable: 4820) + /* avoid warnings about inlining */ +# pragma warning(disable: 4710 4711) +#endif + +#if defined(__UCL_MMODEL_HUGE) && (!ACC_HAVE_MM_HUGE_PTR) +# error "this should not happen - check defines for __huge" +#endif + +#if (ACC_OS_DOS16 + 0 != UCL_OS_DOS16 + 0) +# error "DOS16" +#endif +#if (ACC_OS_OS216 + 0 != UCL_OS_OS216 + 0) +# error "OS216" +#endif +#if (ACC_OS_WIN16 + 0 != UCL_OS_WIN16 + 0) +# error "WIN16" +#endif +#if (ACC_OS_DOS32 + 0 != UCL_OS_DOS32 + 0) +# error "DOS32" +#endif +#if (ACC_OS_OS2 + 0 != UCL_OS_OS2 + 0) +# error "DOS32" +#endif +#if (ACC_OS_WIN32 + 0 != UCL_OS_WIN32 + 0) +# error "WIN32" +#endif +#if (ACC_OS_WIN64 + 0 != UCL_OS_WIN64 + 0) +# error "WIN64" +#endif + + +#include "acc/acc_incd.h" +#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16) +# include "acc/acc_ince.h" +# include "acc/acc_inci.h" +#endif + +#undef NDEBUG +#if !defined(UCL_DEBUG) +# define NDEBUG 1 +#endif +#include + + +#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16) && (ACC_CC_BORLANDC) +# if (__BORLANDC__ >= 0x0450) /* v4.00 */ +# pragma option -h /* enable fast huge pointers */ +# else +# pragma option -h- /* disable fast huge pointers - compiler bug */ +# endif +#endif +#endif /* WANT_ACC */ + + +/*********************************************************************** +// +************************************************************************/ + +#if 1 +# define UCL_BYTE(x) ((unsigned char) (x)) +#else +# define UCL_BYTE(x) ((unsigned char) ((x) & 0xff)) +#endif +#if 0 +# define UCL_USHORT(x) ((unsigned short) (x)) +#else +# define UCL_USHORT(x) ((unsigned short) ((x) & 0xffff)) +#endif + +#define UCL_MAX(a,b) ((a) >= (b) ? (a) : (b)) +#define UCL_MIN(a,b) ((a) <= (b) ? (a) : (b)) +#define UCL_MAX3(a,b,c) ((a) >= (b) ? UCL_MAX(a,c) : UCL_MAX(b,c)) +#define UCL_MIN3(a,b,c) ((a) <= (b) ? UCL_MIN(a,c) : UCL_MIN(b,c)) + +#define ucl_sizeof(type) ((ucl_uint) (sizeof(type))) + +#define UCL_HIGH(array) ((ucl_uint) (sizeof(array)/sizeof(*(array)))) + +/* this always fits into 16 bits */ +#define UCL_SIZE(bits) (1u << (bits)) +#define UCL_MASK(bits) (UCL_SIZE(bits) - 1) + +#define UCL_LSIZE(bits) (1ul << (bits)) +#define UCL_LMASK(bits) (UCL_LSIZE(bits) - 1) + +#define UCL_USIZE(bits) ((ucl_uint) 1 << (bits)) +#define UCL_UMASK(bits) (UCL_USIZE(bits) - 1) + +/* Maximum value of a signed/unsigned type. + Do not use casts, avoid overflows ! */ +#define UCL_STYPE_MAX(b) (((1l << (8*(b)-2)) - 1l) + (1l << (8*(b)-2))) +#define UCL_UTYPE_MAX(b) (((1ul << (8*(b)-1)) - 1ul) + (1ul << (8*(b)-1))) + + +/*********************************************************************** +// compiler and architecture specific stuff +************************************************************************/ + +/* Some defines that indicate if memory can be accessed at unaligned + * memory addresses. You should also test that this is actually faster + * even if it is allowed by your system. + */ + +#undef UA_GET2 +#undef UA_SET2 +#undef UA_GET4 +#undef UA_SET4 +#if 1 && (ACC_ARCH_AMD64 || ACC_ARCH_IA32) +# define UA_GET2(p) (* (const ucl_ushortp) (p)) +# define UA_SET2(p) (* (ucl_ushortp) (p)) +# define UA_GET4(p) (* (const acc_uint32e_t *) (p)) +# define UA_SET4(p) (* (acc_uint32e_t *) (p)) +#elif 0 && (ACC_ARCH_M68K) && (ACC_CC_GNUC >= 0x020900ul) + typedef struct { unsigned short v; } __ucl_ua2_t __attribute__((__aligned__(1))); + typedef struct { unsigned long v; } __ucl_ua4_t __attribute__((__aligned__(1))); +# define UA_GET2(p) (((const __ucl_ua2_t *)(p))->v) +# define UA_SET2(p) (((__ucl_ua2_t *)(p))->v) +# define UA_GET4(p) (((const __ucl_ua4_t *)(p))->v) +# define UA_SET4(p) (((__ucl_ua4_t *)(p))->v) +#endif + + +/*********************************************************************** +// some globals +************************************************************************/ + +__UCL_EXTERN_C int __ucl_init_done; +UCL_EXTERN(const ucl_bytep) ucl_copyright(void); + + +/*********************************************************************** +// ANSI C preprocessor macros +************************************************************************/ + +#define _UCL_STRINGIZE(x) #x +#define _UCL_MEXPAND(x) _UCL_STRINGIZE(x) + + +/*********************************************************************** +// +************************************************************************/ + +//#include "ucl_ptr.h" + + +#endif /* already included */ + +/* +vi:ts=4:et +*/ + diff --git a/tools/z64compress/src/enc/ucl/uclconf.h b/tools/z64compress/src/enc/ucl/uclconf.h new file mode 100644 index 000000000..ab18ca173 --- /dev/null +++ b/tools/z64compress/src/enc/ucl/uclconf.h @@ -0,0 +1,490 @@ +/* uclconf.h -- configuration for the UCL data compression library + + This file is part of the UCL data compression library. + + Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The UCL library is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + The UCL library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the UCL library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Markus F.X.J. Oberhumer + + http://www.oberhumer.com/opensource/ucl/ + */ + + +#ifndef __UCLCONF_H_INCLUDED +#define __UCLCONF_H_INCLUDED + +#define UCL_VERSION 0x010300L +#define UCL_VERSION_STRING "1.03" +#define UCL_VERSION_DATE "Jul 20 2004" + +/* internal Autoconf configuration file - only used when building UCL */ +#if defined(UCL_HAVE_CONFIG_H) +# include +#endif +#include + +#ifdef __cplusplus +extern "C" { +#endif + + + +/*********************************************************************** +// UCL requires a conforming +************************************************************************/ + +#if !defined(CHAR_BIT) || (CHAR_BIT != 8) +# error "invalid CHAR_BIT" +#endif +#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX) +# error "check your compiler installation" +#endif +#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1) +# error "your limits.h macros are broken" +#endif + +/* workaround a compiler bug under hpux 10.20 */ +#define UCL_0xffffL 65535ul +#define UCL_0xffffffffL 4294967295ul + +#if !defined(UCL_UINT32_C) +# if (UINT_MAX < UCL_0xffffffffL) +# define UCL_UINT32_C(c) c ## UL +# else +# define UCL_UINT32_C(c) ((c) + 0U) +# endif +#endif + + +/*********************************************************************** +// architecture defines +************************************************************************/ + +#if (defined(__CYGWIN__) || defined(__CYGWIN32__)) && defined(__GNUC__) +# define UCL_OS_CYGWIN 1 +#elif defined(__EMX__) && defined(__GNUC__) +# define UCL_OS_EMX 1 +#elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) +# define UCL_OS_DOS32 1 +#elif defined(__BORLANDC__) && defined(__DPMI16__) +# define UCL_OS_DOS16 1 +#elif defined(__ZTC__) && defined(DOS386) +# define UCL_OS_DOS32 1 +#elif defined(__OS2__) || defined(__OS2V2__) +# if (UINT_MAX == UCL_0xffffL) +# define UCL_OS_OS216 1 +# elif (UINT_MAX == UCL_0xffffffffL) +# define UCL_OS_OS2 1 +# else +# error "check your limits.h header" +# endif +#elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) +# define UCL_OS_WIN64 1 +#elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) +# define UCL_OS_WIN32 1 +#elif defined(__MWERKS__) && defined(__INTEL__) +# define UCL_OS_WIN32 1 +#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) +# if (UINT_MAX == UCL_0xffffL) +# define UCL_OS_WIN16 1 +# elif (UINT_MAX == UCL_0xffffffffL) +# define UCL_OS_WIN32 1 +# else +# error "check your limits.h header" +# endif +#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) +# if (UINT_MAX == UCL_0xffffL) +# define UCL_OS_DOS16 1 +# elif (UINT_MAX == UCL_0xffffffffL) +# define UCL_OS_DOS32 1 +# else +# error "check your limits.h header" +# endif +#elif defined(__WATCOMC__) +# if defined(__NT__) && (UINT_MAX == UCL_0xffffL) + /* wcl: NT host defaults to DOS target */ +# define UCL_OS_DOS16 1 +# elif defined(__NT__) && (__WATCOMC__ < 1100) + /* wcl386: Watcom C 11 defines _WIN32 */ +# define UCL_OS_WIN32 1 +# else +# error "please specify a target using the -bt compiler option" +# endif +#elif defined(__palmos__) +# if (UINT_MAX == UCL_0xffffL) +# define UCL_OS_PALMOS 1 +# else +# error "check your limits.h header" +# endif +#elif defined(__TOS__) || defined(__atarist__) +# define UCL_OS_TOS 1 +#elif defined(macintosh) +# define UCL_OS_MACCLASSIC 1 +#elif defined(__VMS) +# define UCL_OS_VMS 1 +#else +# define UCL_OS_POSIX 1 +#endif + +/* memory checkers */ +#if !defined(__UCL_CHECKER) +# if defined(__BOUNDS_CHECKING_ON) +# define __UCL_CHECKER 1 +# elif defined(__CHECKER__) +# define __UCL_CHECKER 1 +# elif defined(__INSURE__) +# define __UCL_CHECKER 1 +# elif defined(__PURIFY__) +# define __UCL_CHECKER 1 +# endif +#endif + +/* fix ancient compiler versions */ +#if (UINT_MAX == UCL_0xffffL) +#if (defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410)) || (defined(MSDOS) && defined(_MSC_VER) && (_MSC_VER < 700)) +# if !defined(__cdecl) +# define __cdecl cdecl +# endif +# if !defined(__far) +# define __far far +# endif +# if !defined(__huge) +# define __huge huge +# endif +# if !defined(__near) +# define __near near +# endif +#endif +#endif + + +/*********************************************************************** +// integral and pointer types +************************************************************************/ + +/* Integral types with 32 bits or more */ +#if !defined(UCL_UINT32_MAX) +# if (UINT_MAX >= UCL_0xffffffffL) + typedef unsigned int ucl_uint32; + typedef int ucl_int32; +# define UCL_UINT32_MAX UINT_MAX +# define UCL_INT32_MAX INT_MAX +# define UCL_INT32_MIN INT_MIN +# elif (ULONG_MAX >= UCL_0xffffffffL) + typedef unsigned long ucl_uint32; + typedef long ucl_int32; +# define UCL_UINT32_MAX ULONG_MAX +# define UCL_INT32_MAX LONG_MAX +# define UCL_INT32_MIN LONG_MIN +# else +# error "ucl_uint32" +# endif +#endif + +/* ucl_uint is used like size_t */ +#if !defined(UCL_UINT_MAX) +# if (UINT_MAX >= UCL_0xffffffffL) + typedef unsigned int ucl_uint; + typedef int ucl_int; +# define UCL_UINT_MAX UINT_MAX +# define UCL_INT_MAX INT_MAX +# define UCL_INT_MIN INT_MIN +# elif (ULONG_MAX >= UCL_0xffffffffL) + typedef unsigned long ucl_uint; + typedef long ucl_int; +# define UCL_UINT_MAX ULONG_MAX +# define UCL_INT_MAX LONG_MAX +# define UCL_INT_MIN LONG_MIN +# else +# error "ucl_uint" +# endif +#endif + +/* Memory model that allows to access memory at offsets of ucl_uint. */ +#if !defined(__UCL_MMODEL) +# if (UCL_UINT_MAX <= UINT_MAX) +# define __UCL_MMODEL +# elif defined(UCL_OS_DOS16) || defined(UCL_OS_OS216) || defined(UCL_OS_WIN16) +# define __UCL_MMODEL_HUGE 1 +# define __UCL_MMODEL __huge +# define ucl_uintptr_t unsigned long +# else +# define __UCL_MMODEL +# endif +#endif + +/* no typedef here because of const-pointer issues */ +#define ucl_bytep unsigned char __UCL_MMODEL * +#define ucl_charp char __UCL_MMODEL * +#define ucl_voidp void __UCL_MMODEL * +#define ucl_shortp short __UCL_MMODEL * +#define ucl_ushortp unsigned short __UCL_MMODEL * +#define ucl_uint32p ucl_uint32 __UCL_MMODEL * +#define ucl_int32p ucl_int32 __UCL_MMODEL * +#define ucl_uintp ucl_uint __UCL_MMODEL * +#define ucl_intp ucl_int __UCL_MMODEL * +#define ucl_voidpp ucl_voidp __UCL_MMODEL * +#define ucl_bytepp ucl_bytep __UCL_MMODEL * +/* deprecated - use `ucl_bytep' instead of `ucl_byte *' */ +#define ucl_byte unsigned char __UCL_MMODEL + +typedef int ucl_bool; + + +/*********************************************************************** +// function types +************************************************************************/ + +/* name mangling */ +#if !defined(__UCL_EXTERN_C) +# ifdef __cplusplus +# define __UCL_EXTERN_C extern "C" +# else +# define __UCL_EXTERN_C extern +# endif +#endif + +/* calling convention */ +#if !defined(__UCL_CDECL) +# if defined(__GNUC__) || defined(__HIGHC__) || defined(__NDPC__) +# define __UCL_CDECL +# elif defined(UCL_OS_DOS16) || defined(UCL_OS_OS216) || defined(UCL_OS_WIN16) +# define __UCL_CDECL __far __cdecl +# elif defined(UCL_OS_DOS32) || defined(UCL_OS_OS2) || defined(UCL_OS_WIN32) || defined(UCL_OS_WIN64) +# define __UCL_CDECL __cdecl +# else +# define __UCL_CDECL +# endif +#endif + +/* DLL export information */ +#if !defined(__UCL_EXPORT1) +# define __UCL_EXPORT1 +#endif +#if !defined(__UCL_EXPORT2) +# define __UCL_EXPORT2 +#endif + +/* __cdecl calling convention for public C and assembly functions */ +#if !defined(UCL_PUBLIC) +# define UCL_PUBLIC(_rettype) __UCL_EXPORT1 _rettype __UCL_EXPORT2 __UCL_CDECL +#endif +#if !defined(UCL_EXTERN) +# define UCL_EXTERN(_rettype) __UCL_EXTERN_C UCL_PUBLIC(_rettype) +#endif +#if !defined(UCL_PRIVATE) +# define UCL_PRIVATE(_rettype) static _rettype __UCL_CDECL +#endif + +/* C++ exception specification for extern "C" function types */ +#if !defined(__cplusplus) +# undef UCL_NOTHROW +# define UCL_NOTHROW +#elif !defined(UCL_NOTHROW) +# define UCL_NOTHROW +#endif + +/* function types */ +typedef int +(__UCL_CDECL *ucl_compress_t) ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); + +typedef int +(__UCL_CDECL *ucl_decompress_t) ( const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); + +typedef int +(__UCL_CDECL *ucl_optimize_t) ( ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem ); + +typedef int +(__UCL_CDECL *ucl_compress_dict_t)(const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem, + const ucl_bytep dict, ucl_uint dict_len ); + +typedef int +(__UCL_CDECL *ucl_decompress_dict_t)(const ucl_bytep src, ucl_uint src_len, + ucl_bytep dst, ucl_uintp dst_len, + ucl_voidp wrkmem, + const ucl_bytep dict, ucl_uint dict_len ); + +/* a progress indicator callback function */ +typedef struct +{ + void (__UCL_CDECL *callback) (ucl_uint, ucl_uint, int, ucl_voidp); + ucl_voidp user; +} +ucl_progress_callback_t; +#define ucl_progress_callback_p ucl_progress_callback_t __UCL_MMODEL * + + +/*********************************************************************** +// error codes and prototypes +************************************************************************/ + +/* Error codes for the compression/decompression functions. Negative + * values are errors, positive values will be used for special but + * normal events. + */ +#define UCL_E_OK 0 +#define UCL_E_ERROR (-1) +#define UCL_E_INVALID_ARGUMENT (-2) +#define UCL_E_OUT_OF_MEMORY (-3) +/* compression errors */ +#define UCL_E_NOT_COMPRESSIBLE (-101) +/* decompression errors */ +#define UCL_E_INPUT_OVERRUN (-201) +#define UCL_E_OUTPUT_OVERRUN (-202) +#define UCL_E_LOOKBEHIND_OVERRUN (-203) +#define UCL_E_EOF_NOT_FOUND (-204) +#define UCL_E_INPUT_NOT_CONSUMED (-205) +#define UCL_E_OVERLAP_OVERRUN (-206) + + +/* ucl_init() should be the first function you call. + * Check the return code ! + * + * ucl_init() is a macro to allow checking that the library and the + * compiler's view of various types are consistent. + */ +#define ucl_init() __ucl_init2(UCL_VERSION,(int)sizeof(short),(int)sizeof(int),\ + (int)sizeof(long),(int)sizeof(ucl_uint32),(int)sizeof(ucl_uint),\ + (int)-1,(int)sizeof(char *),(int)sizeof(ucl_voidp),\ + (int)sizeof(ucl_compress_t)) +UCL_EXTERN(int) __ucl_init2(ucl_uint32,int,int,int,int,int,int,int,int,int); + +/* version functions (useful for shared libraries) */ +UCL_EXTERN(ucl_uint32) ucl_version(void); +UCL_EXTERN(const char *) ucl_version_string(void); +UCL_EXTERN(const char *) ucl_version_date(void); +UCL_EXTERN(const ucl_charp) _ucl_version_string(void); +UCL_EXTERN(const ucl_charp) _ucl_version_date(void); + +/* string functions */ +UCL_EXTERN(int) +ucl_memcmp(const ucl_voidp _s1, const ucl_voidp _s2, ucl_uint _len); +UCL_EXTERN(ucl_voidp) +ucl_memcpy(ucl_voidp _dest, const ucl_voidp _src, ucl_uint _len); +UCL_EXTERN(ucl_voidp) +ucl_memmove(ucl_voidp _dest, const ucl_voidp _src, ucl_uint _len); +UCL_EXTERN(ucl_voidp) +ucl_memset(ucl_voidp _s, int _c, ucl_uint _len); + +/* checksum functions */ +UCL_EXTERN(ucl_uint32) +ucl_adler32(ucl_uint32 _adler, const ucl_bytep _buf, ucl_uint _len); +UCL_EXTERN(ucl_uint32) +ucl_crc32(ucl_uint32 _c, const ucl_bytep _buf, ucl_uint _len); +UCL_EXTERN(const ucl_uint32p) +ucl_get_crc32_table(void); + +/* memory allocation hooks */ +typedef ucl_voidp (__UCL_CDECL *ucl_malloc_hook_t) (ucl_uint); +typedef void (__UCL_CDECL *ucl_free_hook_t) (ucl_voidp); +UCL_EXTERN(void) +ucl_set_malloc_hooks(ucl_malloc_hook_t, ucl_free_hook_t); +UCL_EXTERN(void) +ucl_get_malloc_hooks(ucl_malloc_hook_t*, ucl_free_hook_t*); + +#ifndef UCL_SAFE_ALLOC +#define UCL_SAFE_ALLOC 1 +#include +#include + +/* safe calloc */ +static +inline +void * +calloc_safe(size_t nmemb, size_t size) +{ + void *result; + + result = calloc(nmemb, size); + + if (!result) + { + fprintf(stderr, "[!] memory error\n"); + exit(EXIT_FAILURE); + } + + return result; +} + +/* safe malloc */ +static +inline +void * +malloc_safe(size_t size) +{ + void *result; + + result = malloc(size); + + if (!result) + { + fprintf(stderr, "[!] memory error\n"); + exit(EXIT_FAILURE); + } + + return result; +} +#endif /* UCL_SAFE_ALLOC */ + +/* memory allocation functions */ +#if 0 +UCL_EXTERN(ucl_voidp) ucl_malloc(ucl_uint); +UCL_EXTERN(ucl_voidp) ucl_alloc(ucl_uint, ucl_uint); +UCL_EXTERN(void) ucl_free(ucl_voidp); +#else +# define ucl_malloc(a) (malloc_safe(a)) +# define ucl_alloc(a, b) (calloc_safe(a, b)) +# define ucl_free(a) (free(a)) +#endif + + +/* misc. */ +UCL_EXTERN(ucl_bool) ucl_assert(int _expr); +UCL_EXTERN(int) _ucl_config_check(void); +typedef union { ucl_bytep p; ucl_uint u; } __ucl_pu_u; +typedef union { ucl_bytep p; ucl_uint32 u32; } __ucl_pu32_u; + +/* align a char pointer on a boundary that is a multiple of `size' */ +UCL_EXTERN(unsigned) __ucl_align_gap(const ucl_voidp _ptr, ucl_uint _size); +#define UCL_PTR_ALIGN_UP(_ptr,_size) \ + ((_ptr) + (ucl_uint) __ucl_align_gap((const ucl_voidp)(_ptr),(ucl_uint)(_size))) + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* already included */ + diff --git a/tools/z64compress/src/enc/yar.c b/tools/z64compress/src/enc/yar.c new file mode 100644 index 000000000..dfdd012c2 --- /dev/null +++ b/tools/z64compress/src/enc/yar.c @@ -0,0 +1,491 @@ +/* yar.c: decode and encode MM yaz archives */ + +/* + * this file can also be compiled as a standalone program for + * decompressing the contents of a MM yaz archive like so: + * gcc -o unyar -Wall -Wextra -std=c99 -pedantic -DYAR_MAIN_TEST=1 yar.c + * + */ + +#include +#include +#include +#include + +#define FERR(x) { \ + fprintf(stderr, x); \ + fprintf(stderr, "\n"); \ + exit(EXIT_FAILURE); \ +} + +/* surely an archive won't exceed 64 MB */ +#define YAR_MAX (1024 * 1024 * 64) + +/* align out address before writing compressed file */ +#define FILE_ALIGN \ + while ((outSz % align)) \ + { \ + out[outSz] = 0; \ + outSz += 1; \ + } + +struct yarFile +{ + int idx; /* original index in list */ + int ofs; /* global offset of file */ +}; + +static +unsigned int +u32b(void *src) +{ + unsigned char *arr = src; + + return (arr[0] << 24) | (arr[1] << 16) | (arr[2] << 8) | arr[3]; +} + +static +void +u32wr(void *dst, unsigned int src) +{ + unsigned char *arr = dst; + + arr[0] = src >> 24; + arr[1] = src >> 16; + arr[2] = src >> 8; + arr[3] = src; +} + +static +void +progress(const char *name, int progress, int end) +{ + fprintf( + stderr + , "\r""repacking '%s' %d/%d: " + , name + , progress + , end + ); +} + +/* reencode yar archive */ +/* returns 0 on success, pointer to error message otherwise */ +char * +yar_reencode( + unsigned char *src /* source archive */ + , unsigned int sz /* source archive size */ + , unsigned char *dst /* destination archive */ + , unsigned int *dst_sz /* destination archive size */ + , int align /* compressed file alignment */ + + , const char *name /* name of archive (0 = hide progress) */ + , const char *codec /* the expected encoding header "Yaz0" */ + , void *imm /* intermediate buffer for conversion */ + , void *ctx /* compression context (if applicable) */ + + /* decompresses file; return non-zero on fail; optional + * if files are already decompressed (up to user to know) + */ + , int decode(void *src, void *dst, unsigned dstSz, unsigned *srcSz) + + /* compress file; returns non-zero on fail; optional if + * files are desired to be left decompressed + */ + , int encode(void *src, unsigned srcSz, void *dst, unsigned *dstSz, void *ctx) + + /* test if file has been previously encoded; optional */ + , int exist(void *src, unsigned srcSz, void *dst, unsigned *dstSz) +) +{ + unsigned char *ss; + unsigned char *out; + unsigned int end; + unsigned int end_out; + unsigned int outSz = 0; + int progress_end; + struct yarFile *list = 0; + struct yarFile *item; + int list_num; + + assert(src); + assert(sz); + assert(dst_sz); + assert(dst); + assert(align >= 0); + assert((align & 3) == 0); /* cannot have alignment smaller than 4 */ + + out = dst; + + end = 0; + + ss = src; + item = list; + do + { + unsigned ofs; + unsigned uncompSz; + unsigned OG_encSz; + unsigned char *b; + + ofs = u32b(ss) + end; + + /* first entry points to end of list, and first file */ + if (!end) + { + end = ofs; + outSz = end; + + /* allocate file list */ + list_num = (end / 4) + 1; + list = calloc(list_num, sizeof(*list)); + if (!list) + return "memory error"; + item = list; + + FILE_ALIGN + + /* output file may be aligned differently */ + end_out = outSz; + + progress_end = end / 4; + } + + /* b now points to compressed file */ + b = src + ofs; + + /* update progress display */ + if (name) + progress(name, (ss - src) / 4, progress_end); + + /* there should be room for 4-byte codec and 4-byte size */ + if (b + 4 >= src + sz) + break; + + /* decompressed file size is second word */ + uncompSz = u32b(b + 4); + + /* yaz-encoded file */ + if (!memcmp(b, codec, 4)) + { + unsigned char *fout = out + outSz; + unsigned encSz; + + /* user doesn't want encoded data */ + if (!encode) + { + imm = fout; + encSz = uncompSz; + } + + /* decode 'b' only if user provided decoder */ + if (decode) + { + if (decode(b, imm, uncompSz, &OG_encSz)) + return "decoder error"; + } + /* if no decoder is provided, direct copy */ + else + memcpy(imm, b + 0x10, uncompSz); + + /* encode only if user wants that */ + if (encode) + { + /* if no exist function has been provided, or + * if it hasn't been encoded yet, encode it + */ + if (!exist || !exist(imm, uncompSz, fout, &encSz)) + { + if (encode(imm, uncompSz, fout, &encSz, ctx)) + return "encoder error"; + } + } + + /* point current entry to new file location */ + if (ss > src) + u32wr(out + (ss - src), outSz - end_out); + + /* first entry follows different rules */ + else + u32wr(out + (ss - src), end_out); + + /* advance out_sz to immediately after current file */ + outSz += encSz; + + /* align output */ + FILE_ALIGN + } + + /* end of list */ + else if (u32b(b) == 0) + break; + + /* unknown codec */ + else + { + char *errmsg = (char*)out; + char srep[16]; + sprintf(srep, "%08x", u32b(b)); + sprintf( + errmsg + , "unknown codec 0x%s encountered at %08X!\n" + , srep + , ofs + ); + return errmsg; + } + + ss += 4; + item += 1; + + } while ((unsigned)(ss - src) < end); + + /* update progress display */ + if (name) + progress(name, progress_end, progress_end); + + /* point final entry to end (four 00 bytes) */ + u32wr(out + (ss - src), outSz - end_out); + memset(out + outSz, 0, 16); + outSz += 4; + + /* in case list end changed due to padding, make multiple * + * end-of-list markers throughout the alignment space */ + if (end_out > end) + { + unsigned i; + unsigned last = u32b(out + (end - 4)); + for (i = 0; i < (end_out - end) / 4; ++i) + { + u32wr(out + end + i * 4, last); + } + } + + /* align final output size to 16 */ + if (outSz & 15) + outSz += 16 - (outSz & 15); + + /* if new file was constructed, note its size */ + *dst_sz = outSz; + + /* cleanup */ + free(list); + + /* success */ + return 0; +} + +#ifdef YAR_MAIN_TEST +/* + * + * usage example (writes decompressed archive) + * + */ + +/* yaz decoder, courtesy of spinout182 */ +static +int spinout_yaz_dec(void *_src, void *_dst, unsigned dstSz, unsigned *srcSz) +{ + unsigned char *src = _src; + unsigned char *dst = _dst; + + int srcPlace = 0, dstPlace = 0; /*current read/write positions*/ + + unsigned int validBitCount = 0; /*number of valid bits left in "code" byte*/ + unsigned char currCodeByte = 0; + + int uncompressedSize = dstSz; + + src += 0x10; + + while(dstPlace < uncompressedSize) + { + /*read new "code" byte if the current one is used up*/ + if(!validBitCount) + { + currCodeByte = src[srcPlace]; + ++srcPlace; + validBitCount = 8; + } + + if(currCodeByte & 0x80) + { + /*direct copy*/ + dst[dstPlace] = src[srcPlace]; + dstPlace++; + srcPlace++; + } + else + { + /*RLE part*/ + unsigned char byte1 = src[srcPlace]; + unsigned char byte2 = src[srcPlace + 1]; + srcPlace += 2; + + unsigned int dist = ((byte1 & 0xF) << 8) | byte2; + unsigned int copySource = dstPlace - (dist + 1); + + unsigned int numBytes = byte1 >> 4; + if(numBytes) + numBytes += 2; + else + { + numBytes = src[srcPlace] + 0x12; + srcPlace++; + } + + /*copy run*/ + unsigned int i; + for(i = 0; i < numBytes; ++i) + { + dst[dstPlace] = dst[copySource]; + copySource++; + dstPlace++; + } + } + + /*use next bit from "code" byte*/ + currCodeByte <<= 1; + validBitCount-=1; + } + + return 0; + + (void)srcSz; +} + + +/* encodes decompressed data, storing result in dst */ +static +int encode(void *src, unsigned srcSz, void *_dst, unsigned *dstSz, void *ctx) +{ + unsigned char *dst = _dst; + +/* header */ + /* codec */ + memcpy(dst, "raw0", 4); + + /* decompressed size */ + u32wr(dst + 4, srcSz); + + /* 8 more bytes of padding */ + memset(dst + 8, 0, 8); + +/* contents */ + /* direct copy (data left unencoded; you could encode here though) */ + memcpy(dst + 0x10, src, srcSz); + *dstSz = srcSz + 0x10; + + return 0; + + (void)ctx; +} + +/* checks if data has already been encoded */ +/* if it does, dst is filled with that data and 1 is returned */ +/* 0 is returned otherwise */ +static +int exist(void *src, unsigned srcSz, void *dst, unsigned *dstSz) +{ + return 0; + + (void)src; + (void)srcSz; + (void)dst; + (void)dstSz; +} + +/* unsafe but it's a test program so it's fine */ +static +unsigned char * +file_read(char *fn, unsigned *sz) +{ + FILE *fp; + unsigned char *raw; + + assert(fn); + assert(sz); + + fp = fopen(fn, "rb"); + if (!fp) + FERR("failed to open file for reading"); + + fseek(fp, 0, SEEK_END); + *sz = ftell(fp); + + if (!sz) + FERR("read file size == 0"); + + fseek(fp, 0, SEEK_SET); + raw = malloc(*sz); + if (!raw) + FERR("memory error"); + + if (fread(raw, 1, *sz, fp) != *sz) + FERR("file read error"); + + fclose(fp); + return raw; +} + +/* minimal file writer + * returns 0 on failure + * returns non-zero on success + */ +int savefile(const char *fn, const void *dat, const size_t sz) +{ + FILE *fp; + + /* rudimentary error checking returns 0 on any error */ + if ( + !fn + || !sz + || !dat + || !(fp = fopen(fn, "wb")) + || fwrite(dat, 1, sz, fp) != sz + || fclose(fp) + ) + return 0; + + return 1; +} + +int main(int argc, char *argv[]) +{ + void *raw; + unsigned int raw_sz; + + void *out; + void *imm; + unsigned int out_sz = 0; + + if (argc != 3) + FERR("args: unyar in.yar out.yar"); + + raw = file_read(argv[1], &raw_sz); + fprintf(stderr, "input file %s:\n", argv[1]); + + /* surely an archive won't exceed 64 MB */ + out = malloc(1024 * 1024 * 64); + imm = malloc(1024 * 1024 * 64); + + yar_reencode( + raw, raw_sz, out, &out_sz, 16, argv[1], "Yaz0", imm, 0 + , spinout_yaz_dec + , encode + , exist + ); + + /* write output file */ + if (!savefile(argv[2], out, out_sz)) + FERR("failed to write output file"); + + free(raw); + free(out); + free(imm); + + return 0; +} + +#endif /* YAR_MAIN_TEST */ + diff --git a/tools/z64compress/src/enc/yar.h b/tools/z64compress/src/enc/yar.h new file mode 100644 index 000000000..08890949e --- /dev/null +++ b/tools/z64compress/src/enc/yar.h @@ -0,0 +1,36 @@ +/* yar.c: decode and encode MM yaz archives */ + +#ifndef Z64YAR_H_INCLUDED +#define Z64YAR_H_INCLUDED + +/* reencode yar archive */ +/* returns 0 on success, pointer to error message otherwise */ +char * +yar_reencode( + unsigned char *src /* source archive */ + , unsigned int sz /* source archive size */ + , unsigned char *dst /* destination archive */ + , unsigned int *dst_sz /* destination archive size */ + , int align /* compressed file alignment */ + + , const char *name /* name of archive (0 = hide progress) */ + , const char *codec /* the expected encoding header "Yaz0" */ + , void *imm /* intermediate buffer for conversion */ + , void *ctx /* compression context (if applicable) */ + + /* decompresses file; return non-zero on fail; optional + * if files are already decompressed (up to user to know) + */ + , int decode(void *src, void *dst, unsigned dstSz, unsigned *srcSz) + + /* compress file; returns non-zero on fail; optional if + * files are desired to be left decompressed + */ + , int encode(void *src, unsigned srcSz, void *dst, unsigned *dstSz, void *ctx) + + /* test if file has been previously encoded; optional */ + , int exist(void *src, unsigned srcSz, void *dst, unsigned *dstSz) +); + +#endif /* Z64YAR_H_INCLUDED */ + diff --git a/tools/z64compress/src/enc/yaz.c b/tools/z64compress/src/enc/yaz.c new file mode 100644 index 000000000..1cd9b6892 --- /dev/null +++ b/tools/z64compress/src/enc/yaz.c @@ -0,0 +1,470 @@ +#include +#include +#include +#include +#include "stretchy_buffer.h" + +struct yazCtx +{ + uint16_t *c; + uint32_t *cmds; + uint16_t *ctrl; + uint8_t *raws; + uint8_t *ctl; + uint8_t *back; + int *return_data; +}; + +void yazCtx_free(void *_ctx) +{ + struct yazCtx *ctx = _ctx; + + if (!ctx) + return; + + free(ctx->return_data); + sb_free(ctx->c); + sb_free(ctx->raws); + sb_free(ctx->ctrl); + sb_free(ctx->cmds); + sb_free(ctx->ctl); + sb_free(ctx->back); +} + +void *yazCtx_new(void) +{ + struct yazCtx *ctx = calloc(1, sizeof(*ctx)); + + if (!ctx) + return 0; + + /* allocate everything */ + ctx->c = sb_add(ctx->c, 32); + ctx->return_data = malloc(2 * sizeof(*ctx->return_data)); + ctx->raws = sb_add(ctx->raws, 32); + ctx->ctrl = sb_add(ctx->ctrl, 32); + ctx->cmds = sb_add(ctx->cmds, 32); + ctx->ctl = sb_add(ctx->ctl , 32); + ctx->back = sb_add(ctx->back, 32); + + return ctx; +} + +// MIO0 encoding +#define MIx 0 + +#define min(MINA, MINB) ( ( (MINA)<(MINB) ) ? (MINA) : (MINB) ) +#define max(MAXA, MAXB) ( ( (MAXA)>(MAXB) ) ? (MAXA) : (MAXB) ) + +#define U32b(u32X) ((u32X)[0]<<24|(u32X)[1]<<16|(u32X)[2]<<8|(u32X)[3]) +#define U16b(u32X) ((u32X)[0]<<8|(u32X)[1]) +#define U32wr(u32DST,u32SRC) (*(u32DST+0))=((u32SRC)>>24)&0xFF,\ + (*(u32DST+1))=((u32SRC)>>16)&0xFF,\ + (*(u32DST+2))=((u32SRC)>>8)&0xFF,\ + (*(u32DST+3))=((u32SRC)>>0)&0xFF +#define U16wr(u16DST,u16SRC) (*(u16DST+0))=((u16SRC)>>8)&0xFF,\ + (*(u16DST+1))=((u16SRC)>>0)&0xFF + +static uint16_t *_enc_next_cpy(struct yazCtx *ctx, uint8_t *back) { + stb__sbn(ctx->c)=0; // initialize count to 0 + int x; + for (x=0; x < (sb_count(back) & (0xFFFFFFFE)); x += 2) { + sb_push(ctx->c, (back[x]<<8) | back[x+1]); + } + return ctx->c; +} + +static uint32_t _enc_z_from_tables(struct yazCtx *ctx, uint8_t *ctl, uint8_t *back, uint8_t *values, uint8_t *output, int dec_s, const char *mode) { + //_enc_next_cpy(NULL); + uint8_t *b=ctl, *v=values; + uint16_t *c = _enc_next_cpy(ctx, back); + uint32_t bit=0x10000, output_position=0; + // if dec_s declared, will keep accurate track + while (dec_s > 0) { + // get next bit + if (bit > 0xFFFF) { + bit = b[0]; + b++; + output[output_position++] = bit & 0xFF; + bit |= 0x100; + } + // catch end of control commands + if (bit & 0x80) { + output[output_position++] = v[0]; + v++; + dec_s--; + } else { + uint16_t val=c[0]; + c++; + output[output_position++] = ((val>>8)&0xFF); + output[output_position++] = ((val)&0xFF); + + // decrement dec_s accurately with length + val>>=12; + val&=0xF; + if(MIx) + dec_s--; + else if(val==0) { + val = v[0]; + v++; + output[output_position++]=val; + val+=16; + } + dec_s -= val+2; + } + bit <<= 1; + } + return output_position; +} + +static int _enc_find(struct yazCtx *ctx, uint8_t *array, uint8_t *needle, int needle_len, int start_index, int source_length) { + while(start_index < (source_length - needle_len + 1)) { + int r, index = -1; + for(r=start_index; r < (source_length - needle_len + 1); r++) { + if(array[r]==needle[0]) { + index=r; + break; + } + } + + // if we did not find even the first element, the search has failed + if (index == -1) + return -1; + + int i, p; + // check for needle + for (i = 0, p = index; i < needle_len; i++, p++) { + if (array[p] != needle[i]) + break; + } + if(i==needle_len) { + // needle was found + return index; + } + // continue to search for needle + start_index = index + 1; + } + return -1; +} + +static int *_enc_search(struct yazCtx *ctx, uint8_t *data, uint32_t pos, uint32_t sz, uint32_t cap/*=0x111*/) { + int *return_data = ctx->return_data; + // this is necessary unless pos is signed, so let's play it safe + int mp = (pos>0x1000)?(pos-0x1000):0; + int ml = min(cap, sz - pos); + if(ml<3) { + return_data[0]=return_data[1]=0; + return return_data; + } + int + hitp = 0, + hitl = 3, + hl = -1 + ; + + if (mp < pos) { + hl = _enc_find(ctx, data+mp, data+pos, hitl, 0, pos + hitl - mp); + while (hl < (pos - mp)) { + while ((hitl < ml) && (data[pos + hitl] == data[mp + hl + hitl]) ) { + hitl += 1; + } + mp += hl; + hitp = mp; + if (hitl == ml) { + return_data[0] = hitp; + return_data[1] = hitl; + return return_data; + } + mp += 1; + hitl += 1; + if (mp >= pos) + break; + hl = _enc_find(ctx, data+mp, data+pos, hitl, 0, pos + hitl - mp); + } + } + + // if length < 4, return miss + if (hitl < 4) + hitl = 1; + + return_data[0] = hitp; + return_data[1] = hitl-1; + return return_data; +} + +static +uint32_t encode(struct yazCtx *ctx, uint8_t *data, uint32_t data_size, uint8_t *output, const char *mode) { + uint32_t + cap=0x111, + sz=data_size, + pos=0, + flag=0x80000000 + ; + // initialize count of each to 0 + stb__sbn(ctx->raws)=0; + stb__sbn(ctx->ctrl)=0; + stb__sbn(ctx->cmds)=0; + + sb_push(ctx->cmds, 0); + + if(data_size==0) { + memcpy(output, mode, 4); + int i; + for(i=4; i<16; i++) + output[i]=0x00; + return 16; + } + while(posraws, data[pos]); + ctx->cmds[sb_count(ctx->cmds)-1] |= flag; + pos += 1; + } else { + search_return = _enc_search(ctx, data, pos+1, sz, cap); + int tstp = search_return[0]; + int tstl = search_return[1]; + + if ((hitl + 1) < tstl) { + sb_push(ctx->raws, data[pos]); + ctx->cmds[sb_count(ctx->cmds)-1] |= flag; + pos += 1; + flag >>= 1; + if (flag == 0) { + flag = 0x80000000; + sb_push(ctx->cmds, 0); + } + hitl = tstl; + hitp = tstp; + } + int e = pos - hitp - 1; + pos += hitl; + // handle MIx first, then Yax conditions + if (cap == 0x12) { + hitl -= 3; + sb_push(ctx->ctrl, (hitl<<12) | e); + } else if (hitl < 0x12) { + hitl -= 2; + sb_push(ctx->ctrl, (hitl<<12)|e); + } else { + sb_push(ctx->ctrl, e); + sb_push(ctx->raws, hitl - 0x12); + } + } + // advance the flag and refill if required + flag >>= 1; + if (flag == 0) { + flag = 0x80000000; + sb_push(ctx->cmds, 0);//cmds.push_back(0); + } + } + + // if no cmds in final word, delete it + if (flag == 0x80000000) { + stb__sbn(ctx->cmds) -= 1;//cmds.erase(cmds.end()-1); + } + + // block and stream differentiation + // Yay is block, Yaz is stream + int mode_block=1, mode_stream=1; // temporary, for testing +#ifdef YAZ_MAIN_TEST + int g_hlen = 8; +#else + extern int g_hlen; +#endif + mode_block=!strcmp(mode,"Yay0"); + if (g_hlen) { + memcpy(output, mode, 4); + U32wr(output+4, sz); + } else + output -= 8; /* headerless */ + if (mode_block) { + uint32_t l = (sb_count(ctx->cmds) << 2) + 16; + uint32_t o = (sb_count(ctx->ctrl) << 1) + l; + U32wr(output+8, l); + U32wr(output+12, o); + + uint32_t output_position = g_hlen + 8; + uint32_t x; + for (x=0; xcmds); x++) { + U32wr(output+output_position, ctx->cmds[x]); + output_position+=4; + } + for (x=0; xctrl); x++) { + U16wr(output+output_position, ctx->ctrl[x]); + output_position+=2; + } + for (x=0; xraws); x++) { + output[output_position++] = ctx->raws[x]; + } + return output_position; + } else if(mode_stream) { + U32wr(output+8, 0); + U32wr(output+12, 0); + + uint32_t output_position = 0; + stb__sbn(ctx->ctl)=0; // initialize count to 0 + stb__sbn(ctx->back)=0; // initialize count to 0 + uint32_t x; + for (x=0; x < sb_count(ctx->cmds); x++) { + sb_push(ctx->ctl, (ctx->cmds[x]>>24)&0xFF); + sb_push(ctx->ctl, (ctx->cmds[x]>>16)&0xFF); + sb_push(ctx->ctl, (ctx->cmds[x]>>8)&0xFF); + sb_push(ctx->ctl, (ctx->cmds[x])&0xFF); + } + for (x=0; x < sb_count(ctx->ctrl); x++) { + sb_push(ctx->back, (ctx->ctrl[x]>>8)&0xFF); + sb_push(ctx->back, (ctx->ctrl[x])&0xFF); + } + output_position = _enc_z_from_tables(ctx, ctx->ctl, ctx->back, ctx->raws, output+g_hlen+8, data_size, mode); + return output_position + g_hlen + 8; + } + return 0; +} + + +int +yazenc( + void *_src + , unsigned src_sz + , void *_dst + , unsigned *dst_sz + , void *_ctx +) +{ + unsigned char *src = _src; + unsigned char *dst = _dst; + if (!_ctx) + return 1; + *dst_sz = encode(_ctx, src, src_sz, dst, "Yaz0"); + return 0; +} + +/* yaz decoder, courtesy of spinout182 */ +int +yazdec(void *_src, void *_dst, unsigned dstSz, unsigned *srcSz) +{ + unsigned char *src = _src; + unsigned char *dst = _dst; + + int srcPlace = 0, dstPlace = 0; /*current read/write positions*/ + + unsigned int validBitCount = 0; /*number of valid bits left in "code" byte*/ + unsigned char currCodeByte = 0; + + int uncompressedSize = dstSz; + + src += 0x10; + + while(dstPlace < uncompressedSize) + { + /*read new "code" byte if the current one is used up*/ + if(!validBitCount) + { + currCodeByte = src[srcPlace]; + ++srcPlace; + validBitCount = 8; + } + + if(currCodeByte & 0x80) + { + /*direct copy*/ + dst[dstPlace] = src[srcPlace]; + dstPlace++; + srcPlace++; + } + else + { + /*RLE part*/ + unsigned char byte1 = src[srcPlace]; + unsigned char byte2 = src[srcPlace + 1]; + srcPlace += 2; + + unsigned int dist = ((byte1 & 0xF) << 8) | byte2; + unsigned int copySource = dstPlace - (dist + 1); + + unsigned int numBytes = byte1 >> 4; + if(numBytes) + numBytes += 2; + else + { + numBytes = src[srcPlace] + 0x12; + srcPlace++; + } + + /*copy run*/ + int i; + for(i = 0; i < numBytes; ++i) + { + dst[dstPlace] = dst[copySource]; + copySource++; + dstPlace++; + } + } + + /*use next bit from "code" byte*/ + currCodeByte <<= 1; + validBitCount-=1; + } + + if (srcSz) + *srcSz = srcPlace; + + return 0; +} + +#ifdef YAZ_MAIN_TEST + +#define FERR(x) { \ + fprintf(stderr, x); \ + fprintf(stderr, "\n"); \ + exit(EXIT_FAILURE); \ +} + +int main(int argc, char* argv[]) +{ + FILE *fp; + struct yazCtx *ctx; + unsigned size; + + if(argc < 2) + FERR("args: yazenc in.raw > out.yaz"); + + fp = fopen(argv[1], "rb"); + if(fp == NULL) + FERR("failed to open file"); + + fseek(fp, 0, SEEK_END); + size = ftell(fp); + fseek(fp, 0, SEEK_SET); + + fprintf(stderr, "input file size: %d\n", size); + + void *buf = malloc(size); + void *outbuf = malloc( (size + 64) * 2); + + if (fread(buf, 1, size, fp) != size) + FERR("failed to read file"); + + fclose(fp); + + ctx = yazCtx_new(); + if (yazenc(buf, size, outbuf, &size, ctx)) + FERR("encoding error"); + + if (fwrite(outbuf, 1, size, stdout) != size) + FERR("failed to write stdout"); + + yazCtx_free(ctx); + free(buf); + free(outbuf); + return EXIT_SUCCESS; +} +#endif /* YAZ_MAIN_TEST */ + + diff --git a/tools/z64compress/src/enc/zlib.c b/tools/z64compress/src/enc/zlib.c new file mode 100644 index 000000000..28b7fd756 --- /dev/null +++ b/tools/z64compress/src/enc/zlib.c @@ -0,0 +1,103 @@ +#include +#include +#include +#include +#include "libdeflate/libdeflate.h" + +#define CAPACITY (1024 * 1024 * 4) /* output buffer max (4 mb) */ + +int +zlibenc( + void *_src + , unsigned src_sz + , void *_dst + , unsigned *dst_sz + , void *_ctx +) +{ + unsigned char *src = _src; + unsigned char *dst = _dst; + unsigned result_sz; + + extern int g_hlen; /* header length */ + memset(dst, 0, g_hlen); + memcpy(dst, "ZLIB", 4); + dst[4] = (src_sz >> 24); + dst[5] = (src_sz >> 16); + dst[6] = (src_sz >> 8); + dst[7] = (src_sz >> 0); + + /* zlib and gzip have different header lengths + * https://stackoverflow.com/a/68538037 + */ +#if 1 + + #if 0 /* zlib */ + z_stream stream = {0}; + int r; + stream.avail_in = src_sz; + stream.next_in = src; + stream.avail_out = CAPACITY; + stream.next_out = dst + g_hlen; + #define HEADER_LEN 2 + if ((r = deflateInit(&stream, Z_BEST_COMPRESSION)) != Z_OK) + { + fprintf(stderr, "[!] fatal compression error %d\n", r); + exit(EXIT_FAILURE); + } + if ((r = deflate(&stream, Z_FINISH)) == Z_STREAM_ERROR) + { + fprintf(stderr, "[!] Z_STREAM_ERROR\n"); + exit(EXIT_FAILURE); + } + deflateEnd(&stream); + + result_sz = CAPACITY - stream.avail_out; + #else /* libdeflate */ + #define HEADER_LEN 0 + int level = 12; + struct libdeflate_compressor *compressor; + compressor = libdeflate_alloc_compressor(level); + result_sz = libdeflate_deflate_compress( + compressor + , src, src_sz + , dst + g_hlen + , CAPACITY + ); + libdeflate_free_compressor(compressor); + #endif +#else + /* this gzip code was left in for testing purposes; it may + * be useful if matching ique recompression is ever revisited; + * ique matches (except for one byte...) when compressed using + * gzip 1.2.4 or 1.2.4a (they produce identical results), + * available here: https://ftp.gnu.org/gnu/gzip/ + * this is not a compression error, because decompressing the + * recompressed rom produces a rom identical to the original + * decompressed ique rom; + * TODO: find out why that byte doesn't match on recompression; + * TODO: once that's working, add --codec ique for those wanting + * matching ique recompression; otherwise, modern zlib works great! + */ + #define HEADER_LEN 10 + FILE *fp = fopen("tmp.bin", "wb"); + fwrite(src, 1, src_sz, fp); + fclose(fp); + system("./gzip -c -9 -n tmp.bin > tmp.bin.gzip"); + fp = fopen("tmp.bin.gzip", "rb"); + fseek(fp, 0, SEEK_END); + result_sz = ftell(fp); + fseek(fp, 0, SEEK_SET); + fread(dst, 1, result_sz, fp); + fclose(fp); +#endif + *dst_sz = result_sz + g_hlen; + + /* trim zlib/gzip header */ + memmove(dst + g_hlen, dst + g_hlen + HEADER_LEN, result_sz); + *dst_sz -= HEADER_LEN; + + return 0; + (void)_ctx; /* -Wunused-parameter */ +} + diff --git a/tools/z64compress/src/enc/zx7.c b/tools/z64compress/src/enc/zx7.c new file mode 100644 index 000000000..a2e898233 --- /dev/null +++ b/tools/z64compress/src/enc/zx7.c @@ -0,0 +1,37 @@ +#if 0 +#include "zx7/zx7.h" +#include "zx7/optimize.c" +#include "zx7/compress.c" +#include "zx7/zx7.c" + +int +zx7enc( + void *_src + , unsigned src_sz + , void *_dst + , unsigned *dst_sz + , void *_ctx +) +{ + unsigned char *src = _src; + unsigned char *dst = _dst; + + extern int g_hlen; /* header length */ + memset(dst, 0, g_hlen); + memcpy(dst, "ZX70", 4); + dst[4] = (src_sz >> 24); + dst[5] = (src_sz >> 16); + dst[6] = (src_sz >> 8); + dst[7] = (src_sz >> 0); + + *dst_sz = ZX7Compress(src, src_sz, dst + g_hlen); + + if (!*dst_sz) + return 1; + + *dst_sz += g_hlen; + + return 0; +} +#endif + diff --git a/tools/z64compress/src/enc/zx7/compress.c b/tools/z64compress/src/enc/zx7/compress.c new file mode 100644 index 000000000..1df625e3d --- /dev/null +++ b/tools/z64compress/src/enc/zx7/compress.c @@ -0,0 +1,160 @@ +/* + * (c) Copyright 2012-2016 by Einar Saukas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * The name of its author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "zx7.h" + +#if !TARGET_PRIZM + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +static unsigned char* c_output_data; +static unsigned int c_output_index; +static unsigned int c_bit_index; +static int c_bit_mask; + +static inline void c_write_byte(int value) { + c_output_data[c_output_index++] = value; +} + +static void c_write_bit(int value) { + if (c_bit_mask == 0) { + c_bit_mask = 128; + c_bit_index = c_output_index; + c_write_byte(0); + } + if (value > 0) { + c_output_data[c_bit_index] |= c_bit_mask; + } + c_bit_mask >>= 1; +} + +static void write_elias_gamma(int value) { + int i; + + for (i = 2; i <= value; i <<= 1) { + c_write_bit(0); + } + while ((i >>= 1) > 0) { + c_write_bit(value & i); + } +} + +unsigned char *compress( + Optimal *optimal + , unsigned char *input_data + , unsigned int input_size + , long skip + , unsigned int *output_size + , unsigned char *dst +) +{ + unsigned int input_index; + unsigned int input_prev; + int offset1; + int mask; + int i; + + /* calculate and allocate output buffer */ + input_index = input_size-1; + *output_size = (optimal[input_index].bits+18+7)/8 + 3; + unsigned char *ret = dst; + if (!ret) { + return 0; + } + + c_output_data = ret + 3; + + /* un-reverse optimal sequence */ + optimal[input_index].bits = 0; + while (input_index != skip) { + input_prev = input_index - (optimal[input_index].len > 0 ? optimal[input_index].len : 1); + optimal[input_prev].bits = input_index; + input_index = input_prev; + } + + c_output_index = 0; + c_bit_mask = 0; + + /* first byte is always literal */ + c_write_byte(input_data[input_index]); + + /* process remaining bytes */ + while ((input_index = optimal[input_index].bits) > 0) { + if (optimal[input_index].len == 0) { + + /* literal indicator */ + c_write_bit(0); + + /* literal value */ + c_write_byte(input_data[input_index]); + + } else { + + /* sequence indicator */ + c_write_bit(1); + + /* sequence length */ + write_elias_gamma(optimal[input_index].len-1); + + /* sequence offset */ + offset1 = optimal[input_index].offset-1; + if (offset1 < 128) { + c_write_byte(offset1); + } else { + offset1 -= 128; + c_write_byte((offset1 & 127) | 128); + for (mask = 1024; mask > 127; mask >>= 1) { + c_write_bit(offset1 & mask); + } + } + } + } + + /* sequence indicator */ + c_write_bit(1); + + /* end marker > MAX_LEN */ + for (i = 0; i < 16; i++) { + c_write_bit(0); + } + c_write_bit(1); + + // decompressed size is first three bytes + ret[0] = (input_size & 0xFF0000) >> 16; + ret[1] = (input_size & 0x00FF00) >> 8; + ret[2] = (input_size & 0x0000FF); + + return ret; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/z64compress/src/enc/zx7/dzx7.c b/tools/z64compress/src/enc/zx7/dzx7.c new file mode 100644 index 000000000..5909f31f7 --- /dev/null +++ b/tools/z64compress/src/enc/zx7/dzx7.c @@ -0,0 +1,138 @@ +/* + * (c) Copyright 2015 by Einar Saukas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * The name of its author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "zx7.h" + +#ifdef __cplusplus +extern "C" { +#endif + +static unsigned char *d_input_data; +static unsigned char *d_output_data; +static unsigned int d_input_index; +static unsigned int d_output_index; +static unsigned int d_input_size; +static int bit_mask; +static int bit_value; + +static +int d_read_byte(void) { + return d_input_data[d_input_index++]; +} + +static +int d_read_bit(void) { + bit_mask >>= 1; + if (bit_mask == 0) { + bit_mask = 128; + bit_value = d_read_byte(); + } + return bit_value & bit_mask ? 1 : 0; +} + +static +int read_elias_gamma(void) { + int i; + int value; + + i = 0; + while (!d_read_bit()) { + i++; + } + if (i > 15) { + return -1; + } + value = 1; + while (i--) { + value = value << 1 | d_read_bit(); + } + return value; +} + +int read_offset(void) { + int value; + int i; + + value = d_read_byte(); + if (value < 128) { + return value; + } else { + i = d_read_bit(); + i = i << 1 | d_read_bit(); + i = i << 1 | d_read_bit(); + i = i << 1 | d_read_bit(); + return ((value & 127) | (i << 7)) + 128; + } +} + +static +void d_write_byte(int value) { + d_output_data[d_output_index++] = value; +} + +void d_write_bytes(int offset, int length) { + int i; + while (length-- > 0) { + i = d_output_index-offset; + d_write_byte(d_output_data[i]); + } +} + +unsigned int ZX7GetDecompressedSize(unsigned char* compressedData) { + return compressedData[0] * 65536 + compressedData[1] * 256 + compressedData[2]; +} + +int ZX7Decompress(unsigned char* srcData, unsigned char* destData, unsigned int destLength) { + if (destLength < ZX7GetDecompressedSize(srcData) || !srcData || !destData) { + return -1; + } + + int length; + + d_input_data = srcData + 3; + d_output_data = destData; + + d_input_size = 0; + d_input_index = 0; + d_output_index = 0; + bit_mask = 0; + + d_write_byte(d_read_byte()); + while (1) { + if (!d_read_bit()) { + d_write_byte(d_read_byte()); + } else { + length = read_elias_gamma()+1; + if (length == 0) { + return 0; + } + d_write_bytes(read_offset()+1, length); + } + } +} + +#ifdef __cplusplus +} +#endif diff --git a/tools/z64compress/src/enc/zx7/optimize.c b/tools/z64compress/src/enc/zx7/optimize.c new file mode 100644 index 000000000..e0d59396d --- /dev/null +++ b/tools/z64compress/src/enc/zx7/optimize.c @@ -0,0 +1,167 @@ +/* + * (c) Copyright 2012-2016 by Einar Saukas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * The name of its author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "zx7.h" + +#if !TARGET_PRIZM + +#ifdef __cplusplus +extern "C" { +#endif + + +#include +#include /* memset */ + +/* reusable memory (free using zx7_shutdown()) */ +static unsigned int *min = 0; +static unsigned int *max = 0; +static unsigned int *matches = 0; +static unsigned int *match_slots = 0; +static Optimal *optimal = 0; + +void +zx7_shutdown(void) +{ + if (min) + free(min); + if (max) + free(max); + if (matches) + free(matches); + if (match_slots) + free(match_slots); + if (optimal) + free(optimal); +} + +static int elias_gamma_bits(int value) { + int bits; + + bits = 1; + while (value > 1) { + bits += 2; + value >>= 1; + } + return bits; +} + +static int count_bits(int offset, int len) { + return 1 + (offset > 128 ? 12 : 8) + elias_gamma_bits(len-1); +} + +Optimal *optimize( + unsigned char *input_data + , unsigned int input_size + , unsigned long skip +) { + + unsigned int *match; + int match_index; + int offset; + unsigned int len; + unsigned int best_len; + unsigned int bits; + unsigned int i; + + /* allocate all data structures at once */ + if (!min) + min = malloc((MAX_OFFSET+1) * sizeof(*min)); + if (!max) + max = malloc((MAX_OFFSET+1) * sizeof(*max)); + if (!matches) + matches = malloc(256 * 256 * sizeof(*matches)); + if (!match_slots) + match_slots = malloc(input_size * sizeof(*match_slots)); + if (!optimal) + optimal = malloc(input_size * sizeof(*optimal)); + + if (!min || !max || !matches || !match_slots || !optimal) + return 0; + + memset(min, 0, (MAX_OFFSET+1) * sizeof(*min)); + memset(max, 0, (MAX_OFFSET+1) * sizeof(*max)); + memset(matches, 0, 256 * 256 * sizeof(*matches)); + memset(match_slots, 0, input_size * sizeof(*match_slots)); + memset(optimal, 0, input_size * sizeof(*optimal)); + + /* index skipped bytes */ + for (i = 1; i <= skip; i++) { + match_index = input_data[i-1] << 8 | input_data[i]; + match_slots[i] = matches[match_index]; + matches[match_index] = i; + } + + /* first byte is always literal */ + optimal[skip].bits = 8; + + /* process remaining bytes */ + for (; i < input_size; i++) { + + optimal[i].bits = optimal[i-1].bits + 9; + match_index = input_data[i-1] << 8 | input_data[i]; + best_len = 1; + for (match = &matches[match_index]; *match != 0 && best_len < MAX_LEN; match = &match_slots[*match]) { + offset = i - *match; + if (offset > MAX_OFFSET) { + *match = 0; + break; + } + + for (len = 2; len <= MAX_LEN && i >= skip+len; len++) { + if (len > best_len) { + best_len = len; + bits = optimal[i-len].bits + count_bits(offset, len); + if (optimal[i].bits > bits) { + optimal[i].bits = bits; + optimal[i].offset = offset; + optimal[i].len = len; + } + } else if (max[offset] != 0 && i+1 == max[offset]+len) { + len = i-min[offset]; + if (len > best_len) { + len = best_len; + } + } + if (i < offset+len || input_data[i-len] != input_data[i-len-offset]) { + break; + } + } + min[offset] = i+1-len; + max[offset] = i; + } + match_slots[i] = matches[match_index]; + matches[match_index] = i; + } + + return optimal; +} + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/z64compress/src/enc/zx7/zx7.c b/tools/z64compress/src/enc/zx7/zx7.c new file mode 100644 index 000000000..06f65d374 --- /dev/null +++ b/tools/z64compress/src/enc/zx7/zx7.c @@ -0,0 +1,46 @@ +/* + * (c) Copyright 2012-2016 by Einar Saukas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * The name of its author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "zx7.h" + +#if !TARGET_PRIZM + +#ifdef __cplusplus +extern "C" { +#endif + +// ZX7 Compress the given data, outData is malloc'd and the return value is the length (first 3 bytes of data will be 24-bit size result for convenience) +unsigned int ZX7Compress(unsigned char *srcData, unsigned int inLength, unsigned char *outData) { + unsigned int output_size; + compress(optimize(srcData, inLength, 0), srcData, inLength, 0, &output_size, outData); + + return output_size; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tools/z64compress/src/enc/zx7/zx7.h b/tools/z64compress/src/enc/zx7/zx7.h new file mode 100644 index 000000000..a3a4e6cda --- /dev/null +++ b/tools/z64compress/src/enc/zx7/zx7.h @@ -0,0 +1,66 @@ +/* + * (c) Copyright 2012-2016 by Einar Saukas. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * The name of its author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#if !TARGET_PRIZM + +typedef struct optimal_t { + unsigned int bits; + int offset; + int len; +} Optimal; + +#define MAX_OFFSET 2176 /* range 1..2176 */ +#define MAX_LEN 65536 /* range 2..65536 */ + +Optimal *optimize(unsigned char *input_data, unsigned int input_size, unsigned long skip); + +unsigned char *compress(Optimal *optimal, unsigned char *input_data, unsigned int input_size, long skip, unsigned int *output_size, unsigned char *dst); + +// THOMAS : added these for my use: + +// ZX7 Compress the given data, outData is malloc'd and the return value is the length (first 3 bytes of data will be 24-bit size result for convenience) +unsigned int ZX7Compress(unsigned char *srcData, unsigned int inLength, unsigned char *outData); + +#endif + +// Get decompressed size of ZX7Compress'd data +unsigned int ZX7GetDecompressedSize(unsigned char* compressedData); + +// Decompress the given data. Returns 0 with no errors +int ZX7Decompress(unsigned char* srcData, unsigned char* destData, unsigned int destLength); + +/* free reusable buffers */ +void +zx7_shutdown(void); + +#ifdef __cplusplus +} +#endif diff --git a/tools/z64compress/src/main.c b/tools/z64compress/src/main.c new file mode 100644 index 000000000..104be2262 --- /dev/null +++ b/tools/z64compress/src/main.c @@ -0,0 +1,393 @@ +#include +#include +#include +#include +#include + +#include "wow.h" +#include "rom.h" + +FILE* printer; +int g_hlen = 8; + +static void compress(struct rom *rom, int start, int end) +{ + rom_dma_compress(rom, start, end, 1); +} + +static void skip(struct rom *rom, int start, int end) +{ + rom_dma_compress(rom, start, end, 0); +} + +static void repack(struct rom *rom, int start, int end) +{ + rom_dma_repack( + rom + , start + , end + , "yaz" /* old codec */ + , 0 /* new codec */ + ); +} + +static void do_pattern( + struct rom *rom + , const char *str + , void func(struct rom *rom, int start, int end) +) +{ + const char *Ostr = str; + int last_int = -1; + int last_op = 0; + int cur; + int len; + + while (*str) + { + if (*str == '\'' || *str == '"') + { + ++str; + continue; + } + + /* calculate length of current token */ + len = strspn(str, "0123456789xXaAbBcCdDeEfF"); /* allow hex */ + if (!len) /* no len, assume it's an operator */ + len = 1; + + /* is a number or variable */ + if (isdigit(*str) || !strncmp(str, "END", 3)) + { + /* 'END' is shorthand for last entry */ + if (!strncmp(str, "END", 3)) + { + cur = rom_dma_num(rom); + str += 2; + } + + /* otherwise, it's a number */ + else + sscanf(str, "%i", &cur); + + if (cur < last_int) + die( + "invalid pattern '%s'; " + "values are not in ascending order" + , Ostr + ); + + /* apply operations on item(s) */ + if (last_op == '-') + func(rom, last_int, cur); + else + func(rom, cur, cur); + + /* prevents processing this item + * again when 'through' is used + */ + cur += 1; + } + + /* 'through' or 'single item', respectively */ + else if (*str == '-' || *str == ',') + { + if (last_int < 0) + die( + "invalid pattern '%s'; " + "pattern does not begin with number" + , Ostr + ); + last_op = *str; + } + + /* unknown character encountered */ + else + { + die( + "invalid pattern '%s'; " + "encountered unknown operator '%c'" + , Ostr + , *str + ); + } + + /* advance */ + str += len; + last_int = cur; + } +} + +static void usage(void) +{ + /* compression examples for users to adapt to their needs */ + fprintf(printer, "\n"); + fprintf(printer, " compressing oot debug\n"); + fprintf(printer, " --in \"path/to/in.z64\"\n"); + fprintf(printer, " --out \"path/to/out.z64\"\n"); + fprintf(printer, " --mb 32\n"); + fprintf(printer, " --codec yaz\n"); + fprintf(printer, " --cache \"path/to/cache\"\n"); + fprintf(printer, " --dma \"0x12F70,1548\"\n"); + fprintf(printer, " --compress \"9-14,28-END\"\n"); + fprintf(printer, " --threads 4\n"); + fprintf(printer, "\n"); + fprintf(printer, " compressing oot ntsc 1.0\n"); + fprintf(printer, " --in \"path/to/in.z64\"\n"); + fprintf(printer, " --out \"path/to/out.z64\"\n"); + fprintf(printer, " --mb 32\n"); + fprintf(printer, " --codec yaz\n"); + fprintf(printer, " --cache \"path/to/cache\"\n"); + fprintf(printer, " --dma \"0x7430,1526\"\n"); + fprintf(printer, " --compress \"10-14,27-END\"\n"); + fprintf(printer, " --threads 4\n"); + fprintf(printer, "\n"); + fprintf(printer, " compressing mm usa\n"); + fprintf(printer, " --in \"path/to/in.z64\"\n"); + fprintf(printer, " --out \"path/to/out.z64\"\n"); + fprintf(printer, " --mb 32\n"); + fprintf(printer, " --codec yaz\n"); + fprintf(printer, " --cache \"path/to/cache\"\n"); + fprintf(printer, " --dma \"0x1A500,1568\"\n"); + fprintf(printer, " --compress \"10-14,23,24,31-END\"\n"); + fprintf(printer, " --skip \"1127\"\n"); + fprintf(printer, " --repack \"15-20,22\"\n"); + fprintf(printer, " --threads 4\n"); + fprintf(printer, "\n"); + fprintf(printer, " arguments\n"); + fprintf(printer, " --in uncompressed input rom\n"); + fprintf(printer, "\n"); + fprintf(printer, " --out compressed output rom\n"); + fprintf(printer, "\n"); + fprintf(printer, " --matching attempt matching compression at the cost of\n"); + fprintf(printer, " some optimizations and reduced performance\n"); + fprintf(printer, "\n"); + fprintf(printer, " --mb how many mb the compressed rom should be\n"); + fprintf(printer, "\n"); + fprintf(printer, " --codec currently supported codecs\n"); + fprintf(printer, " yaz\n"); + fprintf(printer, " ucl\n"); + fprintf(printer, " lzo\n"); + fprintf(printer, " zlib\n"); + fprintf(printer, " aplib\n"); + fprintf(printer, " * to use non-yaz codecs, find patches\n"); + fprintf(printer, " and code on my z64enc repo\n"); + fprintf(printer, "\n"); + fprintf(printer, " --cache is optional and won't be created if\n"); + fprintf(printer, " no path is specified (having a cache\n"); + fprintf(printer, " makes subsequent compressions faster)\n"); + fprintf(printer, " * pro-tip: linux users who don't want a\n"); + fprintf(printer, " cache to persist across power cycles\n"); + fprintf(printer, " can use the path \"/tmp/z64compress\"\n"); + fprintf(printer, "\n"); + fprintf(printer, " --dma specify dmadata address and count\n"); + fprintf(printer, "\n"); + fprintf(printer, " --compress enable compression on specified files\n"); + fprintf(printer, "\n"); + fprintf(printer, " --skip disable compression on specified files\n"); + fprintf(printer, "\n"); + fprintf(printer, " --headerless don't write file headers (for iQue)\n"); + fprintf(printer, "\n"); + fprintf(printer, " --repack handles Majora's Mask archives\n"); + fprintf(printer, "\n"); + fprintf(printer, " --threads optional multithreading;\n"); + fprintf(printer, " exclude this argument to disable it\n"); + fprintf(printer, "\n"); + fprintf(printer, " --only-stdout reserve stderr for errors and print\n"); + fprintf(printer, " everything else to stdout\n"); + fprintf(printer, "\n"); + fprintf(printer, " arguments are executed as they\n"); + fprintf(printer, " are parsed, so order matters!\n"); + fprintf(printer, "\n"); +} + +wow_main +{ + struct rom *rom = 0; + const char *Ain = 0; + const char *Aout = 0; + const char *Adma = 0; + const char *Acodec = 0; + const char *Acache = 0; + int Amb = 0; + int Athreads = 0; + bool Amatching = false; + bool Aonly_stdout = false; + bool Aheaderless = false; + wow_main_argv; + + printer = stderr; + for (int i = 1; i < argc; ++i) + { + if (!strcmp(argv[i], "--only-stdout")) + { + setvbuf(stdout, NULL, _IONBF, 0); + printer = stdout; + } + } + + fprintf(printer, "welcome to z64compress 1.0.2 \n"); + + if (argc <= 1) + { + usage(); + return EXIT_FAILURE; + } + + /* hacky argument handling */ + for (int i = 1; i < argc; i += 2) + { + const char *arg = argv[i]; + + /* arguments that do not require additional parameters */ + + if(!strcmp(arg, "--only-stdout")) + { + if (Aonly_stdout) + die("--only-stdout arg provided more than once"); + // handled above + Aonly_stdout = true; + i--; + continue; + } + else if (!strcmp(arg, "--matching")) + { + if (Amatching) + die("--matching arg provided more than once"); + Amatching = true; + i--; + continue; + } + else if (!strcmp(arg, "--headerless")) + { + if (Aheaderless) + die("--headerless arg provided more than once"); + Aheaderless = true; + g_hlen = 0; + i--; + continue; + } + + /* arguments with additional parameters */ + + const char *next = argv[i + 1]; + + if (!next) + die("%s missing parameter", arg); + + if (!strcmp(arg, "--in")) + { + if (Ain) + die("--in arg provided more than once"); + Ain = next; + rom = rom_new(Ain); + } + else if (!strcmp(arg, "--out")) + { + if (Aout) + die("--out arg provided more than once"); + Aout = next; + } + else if (!strcmp(arg, "--cache")) + { + if (Acache) + die("--cache arg provided more than once"); + Acache = next; + rom_set_cache(rom, Acache); + } + else if (!strcmp(arg, "--codec")) + { + if (Acodec) + die("--codec arg provided more than once"); + if (!Ain) + die("--dma arg provided before --in arg"); + Acodec = next; + rom_set_codec(rom, Acodec); + } + else if (!strcmp(arg, "--dma")) + { + int num; + int start = 0; + + if (!Acodec) + die("--dma arg provided before --codec arg"); + if (!Ain) + die("--dma arg provided before --in arg"); + if (Adma) + die("--dma arg provided more than once"); + Adma = next; + if (sscanf(Adma, "%i,%i", &start, &num) != 2) + die("--dma bad formatting '%s'", Adma); + rom_dma(rom, start, num, Amatching); + } + else if (!strcmp(arg, "--mb")) + { + if (Amb) + die("--mb arg provided more than once"); + if (sscanf(next, "%i", &Amb) != 1) + die("--mb could not get value from string '%s'", next); + if (Amb <= 0) + die("--mb invalid value %d", Amb); + } + else if (!strcmp(arg, "--compress")) + { + if (!Adma) + die("--compress arg provided before --dma arg"); + do_pattern(rom, next, compress); + } + else if (!strcmp(arg, "--skip")) + { + if (!Adma) + die("--skip arg provided before --dma arg"); + do_pattern(rom, next, skip); + } + else if (!strcmp(arg, "--repack")) + { + if (!Adma) + die("--repack arg provided before --dma arg"); + if (!Acodec) + die("--repack arg provided before --codec arg"); + do_pattern(rom, next, repack); + } + else if(!strcmp(arg, "--threads")) + { + if (Athreads) + die("--threads arg provided more than once"); + if (sscanf(next, "%i", &Athreads) != 1) + die("--threads could not get value from string '%s'", next); + if (Athreads < 0) + die("--threads invalid value %d", Athreads); + } + else + { + die("unknown argument '%s'", arg); + } + } + + #define ARG_ZERO_TEST(TEST, NAME) \ + if (!(TEST)) \ + die("no " NAME " arg provided") + + ARG_ZERO_TEST(Ain , "--in" ); + ARG_ZERO_TEST(Aout , "--out" ); + ARG_ZERO_TEST(Acodec, "--codec"); + + #undef ARG_ZERO_TEST + + /* finished initializing dma settings */ + rom_dma_ready(rom, Amatching); + + /* compress rom */ + rom_compress(rom, Amb, Athreads, Amatching); + fprintf(printer, "rom compressed successfully!\n"); + + /* write compressed rom */ + rom_save(rom, Aout); + fprintf(printer, "compressed rom written successfully!\n"); + + /* cleanup */ + rom_free(rom); + + return EXIT_SUCCESS; +} + diff --git a/tools/z64compress/src/n64crc.c b/tools/z64compress/src/n64crc.c new file mode 100644 index 000000000..a34d646ea --- /dev/null +++ b/tools/z64compress/src/n64crc.c @@ -0,0 +1,197 @@ +/* snesrc - SNES Recompiler + * + * Mar 23, 2010: addition by spinout to actually fix CRC if it is incorrect + * + * Copyright notice for this file: + * Copyright (C) 2005 Parasyte + * + * Based on uCON64's N64 checksum algorithm by Andreas Sterbenz + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include + +#define ROL(i, b) (((i) << (b)) | ((i) >> (32 - (b)))) +#define BYTES2LONG(b) ( (b)[0] << 24 | \ + (b)[1] << 16 | \ + (b)[2] << 8 | \ + (b)[3] ) + +#define N64_HEADER_SIZE 0x40 +#define N64_BC_SIZE (0x1000 - N64_HEADER_SIZE) + +#define N64_CRC1 0x10 +#define N64_CRC2 0x14 + +#define CHECKSUM_START 0x00001000 +#define CHECKSUM_LENGTH 0x00100000 +#define CHECKSUM_CIC6102 0xF8CA4DDC +#define CHECKSUM_CIC6103 0xA3886759 +#define CHECKSUM_CIC6105 0xDF26F436 +#define CHECKSUM_CIC6106 0x1FEA617A + + +static void gen_table(unsigned int crc_table[256]) +{ + unsigned int crc, poly; + int i, j; + + poly = 0xEDB88320; + for (i = 0; i < 256; i++) { + crc = i; + for (j = 8; j > 0; j--) { + if (crc & 1) crc = (crc >> 1) ^ poly; + else crc >>= 1; + } + crc_table[i] = crc; + } +} + + +static unsigned int crc32( + unsigned int crc_table[256] + , unsigned char *data + , int len +) +{ + unsigned int crc = ~0; + int i; + + for (i = 0; i < len; i++) { + crc = (crc >> 8) ^ crc_table[(crc ^ data[i]) & 0xFF]; + } + + return ~crc; +} + + +static int N64GetCIC(unsigned int crc_table[256], unsigned char *data) +{ + switch (crc32(crc_table, &data[N64_HEADER_SIZE], N64_BC_SIZE)) { + case 0x6170A4A1: return 6101; + case 0x90BB6CB5: return 6102; + case 0x0B050EE0: return 6103; + case 0x98BC2C86: return 6105; + case 0xACC8580A: return 6106; + } + + return 0; +} + + +static int N64CalcCRC( + unsigned int crc_table[256] + , unsigned int *crc + , unsigned char *data +) +{ + int bootcode, i; + unsigned int seed; + unsigned int t1, t2, t3; + unsigned int t4, t5, t6; + unsigned int r, d; + + switch ((bootcode = N64GetCIC(crc_table, data))) { + case 6101: + case 6102: + seed = CHECKSUM_CIC6102; + break; + case 6103: + seed = CHECKSUM_CIC6103; + break; + case 6105: + seed = CHECKSUM_CIC6105; + break; + case 6106: + seed = CHECKSUM_CIC6106; + break; + default: + return 1; + } + + t1 = t2 = t3 = t4 = t5 = t6 = seed; + + i = CHECKSUM_START; + while (i < (CHECKSUM_START + CHECKSUM_LENGTH)) { + d = BYTES2LONG(&data[i]); + if ((t6 + d) < t6) + t4++; + t6 += d; + t3 ^= d; + r = ROL(d, (d & 0x1F)); + t5 += r; + if (t2 > d) + t2 ^= r; + else + t2 ^= t6 ^ d; + + if (bootcode == 6105) + t1 += BYTES2LONG(&data[N64_HEADER_SIZE + 0x0710 + (i & 0xFF)]) ^ d; + else + t1 += t5 ^ d; + + i += 4; + } + if (bootcode == 6103) { + crc[0] = (t6 ^ t4) + t3; + crc[1] = (t5 ^ t2) + t1; + } + else if (bootcode == 6106) { + crc[0] = (t6 * t4) + t3; + crc[1] = (t5 * t2) + t1; + } + else { + crc[0] = t6 ^ t4 ^ t3; + crc[1] = t5 ^ t2 ^ t1; + } + + return 0; +} + + +/* recalculate rom crc */ +void n64crc(void *rom) +{ + unsigned int crc_table[256]; + unsigned char CRC1[4]; + unsigned char CRC2[4]; + unsigned int crc[2]; + unsigned char *rom8 = rom; + + assert(rom); + + gen_table(crc_table); + + if (!N64CalcCRC(crc_table, crc, rom)) + { + unsigned int kk1 = crc[0]; + unsigned int kk2 = crc[1]; + int i; + + for (i = 0; i < 4; ++i) + { + CRC1[i] = (kk1 >> (24-8*i))&0xFF; + CRC2[i] = (kk2 >> (24-8*i))&0xFF; + } + + for (i = 0; i < 4; ++i) + *(rom8 + N64_CRC1 + i) = CRC1[i]; + + for (i = 0; i < 4; ++i) + *(rom8 + N64_CRC2 + i) = CRC2[i]; + } +} + diff --git a/tools/z64compress/src/n64crc.h b/tools/z64compress/src/n64crc.h new file mode 100644 index 000000000..b5342dac6 --- /dev/null +++ b/tools/z64compress/src/n64crc.h @@ -0,0 +1,32 @@ +/* snesrc - SNES Recompiler + * + * Mar 23, 2010: addition by spinout to actually fix CRC if it is incorrect + * + * Copyright notice for this file: + * Copyright (C) 2005 Parasyte + * + * Based on uCON64's N64 checksum algorithm by Andreas Sterbenz + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef N64CRC_H_INCLUDED +#define N64CRC_H_INCLUDED + +/* recalculate rom crc */ +void n64crc(void *rom); + +#endif /* N64CRC_H_INCLUDED */ + diff --git a/tools/z64compress/src/rom.c b/tools/z64compress/src/rom.c new file mode 100644 index 000000000..50a7a4914 --- /dev/null +++ b/tools/z64compress/src/rom.c @@ -0,0 +1,1714 @@ +/* + * rom.c + * + * functions for compression magic reside herein + * + * z64me + * + */ + +#include +#include +#include +#include +#include +#include +#include + +/* POSIX dependencies */ +#include +#include +#include + +/* threading */ +#include + +#include "enc/enc.h" /* file compression */ +#include "enc/yar.h" /* MM archive tools */ + +#include "sha1.h" /* sha1 helpers */ +#include "n64crc.h" /* n64crc() */ + +#include "wow.h" +#include "wow_dirent.h" /* XXX always #include after dirent.h */ +#undef fopen +#undef fread +#undef fwrite +#undef remove +#define fopen wow_fopen +#define fread wow_fread +#define fwrite wow_fwrite +#define remove wow_remove + +extern FILE* printer; + +#define SIZE_16MB (1024 * 1024 * 16) +#define SIZE_4MB (1024 * 1024 * 4) + +#define DMA_DELETED 0xffffffff /* aka UINT32_MAX */ + +#define DMASORT(ROM, FUNC) \ + qsort( \ + ROM->dma \ + , ROM->dma_num \ + , sizeof(*(ROM->dma)) \ + , FUNC \ + ) + +#define DMASORT_N(ROM, FUNC, NUM) \ + qsort( \ + ROM->dma \ + , NUM \ + , sizeof(*(ROM->dma)) \ + , FUNC \ + ) + +#define DMA_FOR_EACH \ +for (dma = rom->dma; (unsigned)(dma - rom->dma) < rom->dma_num; ++dma) + +#define PROGRESS_A_B (int)(dma - rom->dma), rom->dma_num + +#define ALIGN(x, n) (((x) + ((n)-1)) & ~((n)-1)) +#define ALIGN16(x) ALIGN(x, 16) +#define ALIGN8MB(x) ALIGN(x, 8 * 0x100000) + +/* + * + * private types + * + */ + + +struct encoder +{ + int (*encfunc)( + void *src + , unsigned src_sz + , void *dst + , unsigned *dst_sz + , void *_ctx + ); + void *(*ctx_new)(void); + void (*ctx_free)(void *); +}; + + +struct dma +{ + char *compname; /* name of compressed file */ + void *compbuf; /* cache-less compressed data */ + unsigned int index; /* original index location */ + int compress; /* entry can be compressed */ + int deleted; /* points to deleted file */ + unsigned compSz; /* cache-less compressed size */ + unsigned int start; /* start offset */ + unsigned int end; /* end offset */ + unsigned int Pstart; /* start of physical (P) data */ + unsigned int Pend; /* end of physical (P) data */ + unsigned int Ostart; /* original (O) start */ + unsigned int Oend; /* original (O) end */ +}; + + +struct rom +{ + char *fn; /* filename of loaded rom */ + char *codec; /* compression codec */ + char *cache; /* compression cache */ + unsigned char *data; /* raw rom data */ + unsigned int data_sz; /* size of rom data */ + unsigned int ofs; /* offset where rom_write() writes */ + int is_comp; /* non-0 if rom has been compressed */ + struct dma *dma; /* dma array */ + unsigned int dma_num; /* number of entries in dma array */ + unsigned char *dma_raw; /* pointer to raw dmadata */ + int dma_ready; /* non-zero after dma_ready() */ + + /* memory pools for things like compression */ + struct + { + void *mb16; /* 16 mb */ + void *mb4; /* 4 mb */ + } mem; +}; + + +struct fldr_item +{ + char *name; /* name */ + void *udata; /* udata */ +}; + + +struct folder +{ + struct fldr_item *item; /* item array */ + int num; /* number of items in array */ + struct fldr_item *active; /* active item */ +}; + + +struct compThread +{ + struct rom *rom; + void *data; + int (*encfunc)( + void *src + , unsigned src_sz + , void *dst + , unsigned *dst_sz + , void *_ctx + ); + const char *codec; + char *dot_codec; + struct folder *list; + int stride; /* number of entries to advance each time */ + int ofs; /* starting entry in list */ + int report; /* report progress to stderr (last thread only) */ + void *ctx; /* compression context */ + bool matching; + pthread_t pt; /* pthread */ +}; + +/* + * + * private functions + * + */ + + +/* get 32-bit value from raw data */ +static int get32(void *_data) +{ + unsigned char *data = _data; + + return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; +} + + +/* get size of a file; returns 0 if fopen fails */ +static unsigned int file_size(const char *fn) +{ + FILE *fp; + unsigned int sz; + + fp = fopen(fn, "rb"); + if (!fp) + return 0; + + fseek(fp, 0, SEEK_END); + sz = ftell(fp); + fclose(fp); + + return sz; +} + +/* load a file into an existing buffer */ +static void *file_load_into( + const char *dir + , const char *fn + , unsigned int *sz + , void *dst +) +{ + FILE *fp; + + assert(fn); + assert(sz); + assert(dst); + + if (!dir) + dir = ""; + + *sz = 0; + + fp = fopen(fn, "rb"); + if (!fp) + die("failed to open '%s%s' for reading", dir, fn); + + fseek(fp, 0, SEEK_END); + *sz = ftell(fp); + + if (!*sz) + die("size of file '%s%s' is zero", dir, fn); + + fseek(fp, 0, SEEK_SET); + + if (fread(dst, 1, *sz, fp) != *sz) + die("failed to read contents of '%s%s'", dir, fn); + + fclose(fp); + + return dst; +} + +/* load a file */ +static void *file_load(const char *fn, unsigned int *sz) +{ + unsigned char *dst; + + assert(fn); + assert(sz); + + *sz = file_size(fn); + if (!*sz) + die("failed to get size of file '%s'", fn); + + dst = malloc_safe(*sz); + + return file_load_into(0, fn, sz, dst); +} + +/* write file */ +static unsigned int file_write( + const char *fn + , void *data + , unsigned int data_sz +) +{ + FILE *fp; + + assert(fn); + assert(data); + assert(data_sz); + + fp = fopen(fn, "wb"); + if (!fp) + return 0; + + data_sz = fwrite(data, 1, data_sz, fp); + + fclose(fp); + + return data_sz; +} + + +/* allocate a folder structure and parse current working directory */ +static struct folder *folder_new(void) +{ + wow_DIR *dir; + struct wow_dirent *ep; + struct fldr_item *item; + struct folder *folder; + char cwd[4096]; + int count = 0; + int recount = 0; + + /* allocate a folder */ + folder = calloc_safe(1, sizeof(*folder)); + + /* get current working directory for error reporting */ + wow_getcwd_safe(cwd, sizeof(cwd)); + + /* first pass: count the contents */ + dir = wow_opendir("."); + if (!dir) + die("failed to parse directory '%s'", cwd); + while ((ep = wow_readdir(dir))) + count += 1; + wow_closedir(dir); + + /* folder is empty */ + if (!count) + die("folder '%s' is empty", cwd); + + /* allocate item array */ + item = calloc_safe(count, sizeof(*item)); + folder->item = item; + folder->num = count; + + /* second pass: retrieve requested contents */ + dir = wow_opendir("."); + if (!dir) + die("failed to parse directory '%s'", cwd); + for ( + recount = 0 + ; (ep = wow_readdir(dir)) && recount < count + ; ++recount, ++item + ) + { + const char *dn; + + dn = (const char*)ep->d_name; + + /* skip names starting with '.' (covers both "." and "..") */ + if (*dn == '.') + continue; + + /* skip directories */ + if (wow_is_dir(dn)) + continue; + + /* make a copy of the string */ + item->name = strdup_safe(dn); + } + + if (recount != count) + die("contents of '%s' changed during read, try again", cwd); + wow_closedir(dir); + + return folder; +} + + +/* free a folder structure */ +static void folder_free(struct folder *folder) +{ + if (!folder) + return; + + /* folder contains items */ + if (folder->item) + { + struct fldr_item *item; + + /* walk item list, freeing resources owned by each */ + for ( + item = folder->item + ; item - folder->item < folder->num + ; ++item + ) + { + if (item->name) + free(item->name); + } + + /* free item list */ + free(folder->item); + } + + /* free folder */ + free(folder); +} + + +/* locate folder item by name, ignoring extension (such as '.raw') */ +static struct fldr_item *folder_findNameNoExt( + struct folder *folder + , char *name +) +{ + struct fldr_item *item; + + assert(folder); + assert(name); + + for ( + item = folder->item + ; item - folder->item < folder->num + ; ++item + ) + { + char *period; + int nchar; + + /* item has no name */ + if (!item->name) + continue; + + /* doesn't contain a period */ + if (!(period = strrchr(item->name, '.'))) + continue; + + /* number of bytes to compare */ + nchar = period - item->name; + + /* names match */ + if (!memcmp(item->name, name, nchar)) + return item; + } + + return 0; +} + + +/* retrieve encoder from name */ +static const struct encoder *encoder(const char *name) +{ + if (!strcmp(name, "yaz")) + { + static const struct encoder yaz = { + .encfunc = yazenc + , .ctx_new = yazCtx_new + , .ctx_free = yazCtx_free + }; + + return &yaz; + } + else if (!strcmp(name, "lzo")) + { + static const struct encoder lzo = { + .encfunc = lzoenc + , .ctx_new = lzoCtx_new + , .ctx_free = lzoCtx_free + }; + + return &lzo; + } + else if (!strcmp(name, "ucl")) + { + static const struct encoder ucl = { + .encfunc = uclenc + }; + + return &ucl; + } + /*else if (!strcmp(name, "zx7")) + { + static const struct encoder zx7 = { + .encfunc = zx7enc + }; + + return &zx7; + }*/ + else if (!strcmp(name, "zlib")) + { + static const struct encoder zlib = { + .encfunc = zlibenc + }; + + return &zlib; + } + else if (!strcmp(name, "aplib")) + { + static const struct encoder aplib = { + .encfunc = aplenc + }; + + return &aplib; + } + else + die("unknown compression codec '%s'", name); + + return 0; +} + + +/* sort dma array by start, ascending */ +static int sortfunc_dma_start_ascend(const void *_a, const void *_b) +{ + const struct dma *a = _a; + const struct dma *b = _b; + + if (a->start < b->start) + return -1; + + else if (a->start > b->start) + return 1; + + return 0; +} + + +/* sort dma array by size, descending */ +static int sortfunc_dma_size_descend(const void *_a, const void *_b) +{ + const struct dma *a = _a; + const struct dma *b = _b; + + unsigned int a_len = a->end - a->start; + unsigned int b_len = b->end - b->start; + + if (a_len < b_len) + return 1; + + else if (a_len > b_len) + return -1; + + return 0; +} + + +/* enter a directory (will be created if it doesn't exist) */ +static void dir_enter(const char *dir) +{ + /* unable to enter directory */ + if (wow_chdir(dir)) + { + /* attempt to create directory */ + if (wow_mkdir(dir)) + die("failed to create directory '%s'", dir); + + if (wow_chdir(dir)) + die("failed to enter directory '%s'", dir); + } +} + + +static void report_progress( + struct rom *rom + , const char *codec + , int v + , int total +) +{ + /* caching enabled */ + if (rom->cache) + fprintf( + printer + , "\r""updating '%s/%s' %d/%d: " + , rom->cache + , codec + , v + , total + ); + + else + fprintf( + printer + , "\r""compressing file %d/%d: " + , v + , total + ); +} + +/* compress a list of files */ +static void dma_compress( + struct rom *rom + , void *compbuf + , int encfunc( + void *src + , unsigned src_sz + , void *dst + , unsigned *dst_sz + , void *_ctx + ) + , const char *codec + , char *dot_codec + , struct folder *list + , int stride /* number of entries to advance each time */ + , int ofs /* starting entry in list */ + , int report /* report progress to stderr (last thread only) */ + , void *ctx /* compression context */ + , bool matching +) +{ + struct dma *dma; + struct fldr_item *item; + + for (dma = rom->dma + ofs + ; (unsigned)(dma - rom->dma) < rom->dma_num + ; dma += stride + ) + { + char *iname = 0; + unsigned char *data = rom->data + dma->start; + unsigned char checksum[64]; + char readable[64]; + int len = dma->end - dma->start; + + /* report the progress */ + if (report) + report_progress(rom, codec, PROGRESS_A_B); + + /* skip files that have a size of 0 */ + if (dma->start == dma->end) + continue; + + /* caching is disabled, just compress */ + if (!rom->cache) + { + int err; + dma->compbuf = compbuf; + + /* don't compress this file */ + if (!dma->compress) + { + dma->compSz = dma->end - dma->start; + dma->compbuf = memdup_safe( + rom->data + dma->start + , dma->compSz + ); + continue; + } + + err = + encfunc( + rom->data + dma->start + , dma->end - dma->start + , dma->compbuf + , &dma->compSz + , ctx + ); + + /* file doesn't benefit from compression */ + if (!matching && dma->compSz >= dma->end - dma->start) + { + dma->compSz = dma->end - dma->start; + dma->compbuf = memdup_safe( + rom->data + dma->start + , dma->compSz + ); + dma->compress = 0; + } + else + dma->compbuf = memdup_safe(dma->compbuf, dma->compSz); + + if (err) + die("compression error"); + + /* the rest of the loop applies only to caches */ + continue; + } + + /* get readable checksum name */ + stb_sha1(checksum, data, len); + stb_sha1_readable(readable, checksum); + + /* see if item already exists in folder */ + item = folder_findNameNoExt(list, readable); + if (item) + { + /* use full file name, including extension */ + iname = item->name; + + /* it exists, so use udata to mark the file as used */ + item->udata = dot_codec; + dma->compSz = file_size(iname); + + /* uncompressed file */ + if (strstr(iname, ".raw")) + dma->compress = 0; + } + /* item doesn't exist, so create it */ + else + { + void *out = compbuf; + unsigned out_sz; + int err; + + /* file not marked for compression */ + if (!dma->compress) + { + out = rom->data + dma->start; + out_sz = dma->end - dma->start; + dma->compress = 0; + strcat(readable, ".raw"); + + /* write file */ + if (file_write(readable, out, out_sz) != out_sz) + die("error writing file 'cache/%s/%s'", codec, readable); + + dma->compSz = out_sz; + dma->compname = strdup_safe(readable); + + /* the remaining block applies only to compressed files */ + continue; + } + + err = + encfunc( + rom->data + dma->start + , dma->end - dma->start + , out + , &out_sz + , ctx + ); + + if (err) + die("compression error"); + + /* file doesn't benefit from compression */ + if (!matching && out_sz >= dma->end - dma->start) + { + out = rom->data + dma->start; + out_sz = dma->end - dma->start; + dma->compress = 0; + strcat(readable, ".raw"); + } + /* file benefits from compression */ + else + /* add encoding as extension, ex '.yaz' */ + strcat(readable, dot_codec); + + /* write file */ + if (file_write(readable, out, out_sz) != out_sz) + die("error writing file 'cache/%s/%s'", codec, readable); + + dma->compSz = out_sz; + iname = readable; + } + + /* back up compressed filename to + * avoid having to re-checksum later + */ + dma->compname = strdup_safe(iname); + } +} + + +static void *dma_compress_threadfunc(void *_CT) +{ + struct compThread *CT = _CT; + + dma_compress( + CT->rom + , CT->data + , CT->encfunc + , CT->codec + , CT->dot_codec + , CT->list + , CT->stride + , CT->ofs + , CT->report + , CT->ctx + , CT->matching + ); + + return 0; +} + + +static void dma_compress_thread( + struct compThread *CT + , struct rom *rom + , void *compbuf + , int encfunc( + void *src + , unsigned src_sz + , void *dst + , unsigned *dst_sz + , void *_ctx + ) + , const char *codec + , char *dot_codec + , struct folder *list + , int stride /* number of entries to advance each time */ + , int ofs /* starting entry in list */ + , int report /* report progress to stderr (last thread only) */ + , void *ctx /* compression context */ + , bool matching +) +{ + CT->rom = rom; + CT->data = compbuf; + CT->encfunc = encfunc; + CT->codec = codec; + CT->dot_codec = dot_codec; + CT->list = list; + CT->stride = stride; + CT->ofs = ofs; + CT->report = report; + CT->ctx = ctx; + CT->matching = matching; + + if (pthread_create(&CT->pt, 0, dma_compress_threadfunc, CT)) + die("threading error"); +} + + +/* get dma entry by original index (useful after reordering) */ +static struct dma *dma_get_idx(struct rom *rom, unsigned idx) +{ + struct dma *dma; + + assert(idx < rom->dma_num && "dma index too high"); + + /* walk dma list for matching index */ + DMA_FOR_EACH + { + if (dma->index == idx) + break; + } + + return dma; +} + + +/* write 'num' bytes to rom and advance */ +static void rom_write(struct rom *rom, void *data, int sz) +{ + unsigned char *raw; + + assert(rom); + assert(rom->data); + assert(data); + assert(sz); + + if (rom->ofs + sz > rom->data_sz) + die( + "can't write %d bytes at 0x%X b/c it exceeds rom size" + , sz, rom->ofs + ); + + raw = rom->data + rom->ofs; + + memcpy(raw, data, sz); + + rom->ofs += sz; +} + + +/* write 32 bit value to rom and advance */ +static void rom_write32(struct rom *rom, unsigned int value) +{ + unsigned char raw[4]; + + raw[0] = value >> 24; + raw[1] = value >> 16; + raw[2] = value >> 8; + raw[3] = value; + + rom_write(rom, raw, 4); +} + + +/* write dma table into rom */ +static void rom_write_dmadata(struct rom *rom) +{ + struct dma *dma; + int num; + int numUsed; + + assert(rom); + assert(rom->dma); + assert(rom->dma_raw); + + dma = rom->dma; + num = rom->dma_num; + + /* sort all entries by size, descending */ + DMASORT(rom, sortfunc_dma_size_descend); + + /* find first entry where size == 0 (aka first unused entry) */ + for (dma = rom->dma; dma - rom->dma < num; ++dma) + if (dma->start == dma->end) + break; + numUsed = dma - rom->dma; + + /* sort all used entries by start address, ascending */ + DMASORT_N(rom, sortfunc_dma_start_ascend, numUsed); + + /* + * at this point, unused entries have been moved to the end + */ + + /* zero the table */ + memset(rom->dma_raw, 0, num * 16); + + /* write every entry */ + rom->ofs = rom->dma_raw - rom->data; + for (dma = rom->dma; dma - rom->dma < num; ++dma) + { + rom_write32(rom, dma->start); + rom_write32(rom, dma->end); + rom_write32(rom, dma->Pstart); + rom_write32(rom, dma->Pend); + + /* early end condition: all entries have been written */ + if (!dma->end) + break; + } +} + + +/* + * + * public functions + * + */ + +/* compress rom using specified algorithm */ +void rom_compress(struct rom *rom, int mb, int numThreads, bool matching) +{ + struct dma *dma; + struct folder *list = 0; + struct fldr_item *item; + char *dot_codec = 0; + const char *codec; + char cwd[4096] = {0}; + char cache_codec[4096] = {0}; + const char *cache; + const struct encoder *enc = 0; + unsigned int compsz = mb * 0x100000; + unsigned int comp_total = 0; + unsigned int largest_compress = 1024; + float total_compressed = 0; + float total_decompressed = 0; + struct compThread *compThread = 0; + int dma_num = rom->dma_num; + int i; + + assert(rom); + assert(rom->dma); + assert(rom->dma_ready); + assert(rom->is_comp == 0 && "rom_compressed called more than once"); + + rom->is_comp = 1; + + if (numThreads <= 0) + numThreads = 1; + + /* default codec = yaz */ + if (!(codec = rom->codec)) + codec = "yaz"; + + cache = rom->cache; + + if (compsz > rom->data_sz || mb < 0) + die("invalid mb argument %d", mb); + + /* get encoding functions */ + enc = encoder(codec); + + /* restore original start/end for nonexistent files */ + DMA_FOR_EACH + { + if (dma->deleted) + { + dma->start = dma->Ostart; + dma->end = dma->Oend; + dma->compress = 0; /* deleted files don't compress */ + } + } + + /* sort dma entries by size, descending */ + DMASORT(rom, sortfunc_dma_size_descend); + + /* locate largest file that will be compressed */ + DMA_FOR_EACH + { + if (dma->compress && dma->end - dma->start > largest_compress) + largest_compress = dma->end - dma->start; + } + + /* no file should compress to over 2x its uncompressed size */ + largest_compress *= 2; + + /* allocate compression buffer for each thread */ + compThread = calloc_safe(numThreads, sizeof(*compThread)); + for (i = 0; i < numThreads; ++i) + { + compThread[i].data = malloc_safe(largest_compress); + + /* allocate compression contexts (if applicable) */ + if (enc->ctx_new) + { + compThread[i].ctx = enc->ctx_new(); + if (!compThread[i].ctx) + die("memory error"); + } + } + + /* if using compression cache */ + if (cache) + { + sprintf(cache_codec, "%s/%s/", cache, codec); + + /* store current working directory for later */ + wow_getcwd_safe(cwd, sizeof(cwd)); + + /* create and enter cache folder */ + dir_enter(cache); + + /* create and enter directory for the encoding algorithm */ + dir_enter(codec); + + /* make a '.yaz' string from 'yaz' */ + dot_codec = malloc_safe(strlen(codec) + 1/*'.'*/ + 1/*'\0'*/); + strcpy(dot_codec, "."); + strcat(dot_codec, codec); + + /* get list of all files in current working directory */ + list = folder_new(); + } + + /* now compress every compressible file */ + if (numThreads <= 1) + { + dma_compress( + rom + , compThread[0].data + , enc->encfunc + , codec + , dot_codec + , list + , 1 /* stride */ + , 0 /* ofs */ + , 1 /* report */ + , compThread[0].ctx + , matching + ); + } + else + { + /* spawn threads */ + for (i = 0; i < numThreads; ++i) + { + dma_compress_thread( + &compThread[i] + , rom + , compThread[i].data + , enc->encfunc + , codec + , dot_codec + , list + , numThreads /* stride */ + , i /* ofs */ + , (i+1)==numThreads /* report */ + , compThread[i].ctx + , matching + ); + } + + /* wait for all threads to complete */ + for (i = 0; i < numThreads; ++i) + { + if (pthread_join(compThread[i].pt, NULL)) + die("threading error"); + } + } + + /* all files now compressed */ + report_progress(rom, codec, PROGRESS_A_B); + fprintf(printer, "success!\n"); + + /* sort by original start, ascending */ + DMASORT(rom, sortfunc_dma_start_ascend); + + /* determine physical addresses for each segment */ + comp_total = 0; + DMA_FOR_EACH + { + char *fn = dma->compname; + unsigned int sz; + unsigned int sz16; + + if (dma->deleted) + continue; + + /* cached file logic */ + if (cache) + { + /* skip entries that don't reference compressed files */ + if (!fn) + continue; + + sz = dma->compSz; + + /* sz == 0 */ + if (!sz) + die("'%s/%s/%s' file size == 0", cache, codec, fn); + } + + /* in-memory file logic */ + else + { + /* skip entries that don't reference compressed data */ + sz = dma->compSz; + if (!sz) + continue; + } + + /* ensure we remain 16-byte-aligned after advancing */ + sz16 = sz; + if (sz16 & 15) + sz16 += 16 - (sz16 & 15); + + dma->Pstart = comp_total; + if (dma->compress) + { + dma->Pend = dma->Pstart + sz16; + + /* compressed file ratio variables */ + total_compressed += sz16; + total_decompressed += dma->end - dma->start; + } + else + dma->Pend = 0; + comp_total += sz16; + + if (mb != 0 && dma->Pend > compsz) + die("ran out of compressed rom space (try increasing --mb)"); + } + + /* adaptive final size */ + if (mb == 0) + compsz = ALIGN8MB(comp_total); + + if (matching) + { + /* fill the entire (compressed) rom space with 00010203...FF... + in order to match retail rom padding */ + unsigned char n = 0; /* will intentionally overflow */ + for (unsigned int j = 0; j < compsz; j++, n++) + { + rom->data[j] = n; + } + } + else + { + /* zero the entire (compressed) rom space */ + memset(rom->data, 0, compsz); + } + + /* inject compressed files */ + comp_total = 0; + DMA_FOR_EACH + { + unsigned char *dst; + char *fn = dma->compname; + unsigned int sz; + fprintf(printer, "\r""injecting file %d/%d: ", PROGRESS_A_B); + + if (dma->deleted) + continue; + + dst = rom->data + dma->Pstart; + + /* external cached file logic */ + if (cache) + { + /* skip entries that don't reference compressed files */ + if (!fn) + continue; + + /* load file into rom at offset */ + dst = file_load_into(cache_codec, fn, &sz, dst); + } + /* otherwise, a simple memcpy */ + else + { + memcpy(dst, dma->compbuf, dma->compSz); + sz = dma->compSz; + } + + if (matching) + { + /* since matching rom padding is not zero but file padding is zero, + fill file padding space with zeros */ + memset(dst + sz, 0, ALIGN16(sz) - sz); + } + } + fprintf(printer, "\r""injecting file %d/%d: ", dma_num, dma_num); + fprintf(printer, "success!\n"); + + fprintf( + printer + , "compression ratio: %.02f%%\n" + , (total_compressed / total_decompressed) * 100.0f + ); + + /* now free compressed file names */ + DMA_FOR_EACH + { + if (dma->compname) + free(dma->compname); + } + + /* remove unused cache files */ + if (list) + { + for (item = list->item; item - list->item < list->num; ++item) + { + /* udata hasn't been marked, so file is unused */ + if (item->name && !item->udata) + { + if (remove(item->name)) + die("failed to remove '%s/%s/%s'" + , cache, codec, item->name + ); + } + } + } + + /* update rom size for when rom_save() is used */ + rom->data_sz = compsz; + + /* cleanup */ + DMA_FOR_EACH + { + /* zero starts/ends of deleted files */ + if (!matching && dma->deleted) + { + dma->start = 0; + dma->end = 0; + dma->Pstart = 0; + dma->Pend = 0; + } + + /* free any compbufs */ + if (dma->compbuf) + free(dma->compbuf); + dma->compSz = 0; + dma->compbuf = 0; + } + if (list) + folder_free(list); + if (dot_codec) + free(dot_codec); + for (i = 0; i < numThreads; ++i) + { + free(compThread[i].data); + + /* free compression contexts (if applicable) */ + if (enc->ctx_free) + { + assert(compThread[i].ctx); + enc->ctx_free(compThread[i].ctx); + } + } + free(compThread); + + /* return to prior working directory */ + if (*cwd) + wow_chdir(cwd); +} + + +/* specify start of dmadata and number of entries */ +void rom_dma(struct rom *rom, unsigned int offset, int num_entries, bool matching) +{ + struct dma *dma; + unsigned char *raw; + + assert(rom); + assert(rom->data); + assert(rom->dma == 0 && "called rom_dma() more than once"); + + if (num_entries <= 0) + die("invalid number of dma entries %d", num_entries); + + dma = calloc_safe(num_entries, sizeof(*dma)); + rom->dma = dma; + rom->dma_num = num_entries; + + raw = rom->data + offset; + rom->dma_raw = raw; + + /* initialize every entry */ + while (dma - rom->dma < num_entries) + { + /* propagate defaults */ + dma->index = dma - rom->dma; + dma->start = get32(raw); + dma->end = get32(raw + 4); + dma->Pstart = get32(raw + 8); + dma->Pend = get32(raw + 12); + dma->Ostart = dma->start; + dma->Oend = dma->end; + dma->compress = 0; /* compression off by default */ + + /* nonexistent file */ + if (dma->Pstart == DMA_DELETED && dma->Pend == DMA_DELETED) + { + dma->deleted = 1; + + if (!matching) + { + dma->start = 0; + dma->end = 0; + dma->Ostart = 0; + dma->Oend = 0; + dma->Pstart = 0; + dma->Pend = 0; + } + } + + /* invalid dma conditions */ + else if ( + (dma->Pend & 3) /* not 4-byte aligned */ + || (dma->Pstart & 3) + || (dma->start & 3) + || (dma->end & 3) + || dma->start > dma->end + || (dma->Pstart > dma->Pend && dma->Pend) + || dma->Pend > rom->data_sz + ) + { + die( + "invalid dma entry encountered: %08X %08X %08X %08X" + , dma->start, dma->end, dma->Pstart, dma->Pend + ); + } + + /* rom is compressed */ + if (dma->Pend && dma->Pend != DMA_DELETED) + { + die( + "encountered dma entry %08X %08X %08X %08X" + ", which suggests the rom is already compressed...\n" + "now exiting..." + , dma->start, dma->end, dma->Pstart, dma->Pend + ); + } + + /* advance to next entry */ + raw += 16; + dma += 1; + } +} + +/* call this once dma settings are finalized */ +void rom_dma_ready(struct rom *rom, bool matching) +{ + struct dma *dma; + int num; + unsigned int lowest = 0; + unsigned int highest_end = 0; /* highest end dma offset */ + + assert(rom); + assert(rom->data); + assert(rom->dma); + assert(rom->dma_ready == 0 && "dma_ready called more than once"); + + dma = rom->dma; + num = rom->dma_num; + + /* sort by start offset, ascending */ + DMASORT(rom, sortfunc_dma_start_ascend); + + /* confirm no entries overlap */ + for (dma = rom->dma ; dma - rom->dma < num; ++dma) + { + /* skip blank entries */ + if (!dma->start && !dma->end) + continue; + + /* warn on empty files */ + if (dma->end == dma->start) + { + fprintf( + printer + , "warning: dma entry %d is empty file (%08X == %08X)\n" + , dma->index, dma->start, dma->end + ); + dma->Pstart = dma->Pend = DMA_DELETED; + } + + /* nonexistent file */ + if (dma->Pstart == DMA_DELETED && dma->Pend == DMA_DELETED) + { + dma->deleted = 1; + + if (!matching) + { + dma->Ostart = 0; + dma->Oend = 0; + dma->start = 0; + dma->end = 0; + dma->compress = 0; + } + continue; + } + + /* fatal error on entries where end < start */ + if (dma->end < dma->start) + die( + "dma invalid entry %d (%08X < %08X)" + , dma->index, dma->end, dma->start + ); + + /* fatal error on unaligned entries */ + if ((dma->start & 3) || (dma->end & 3)) + die( + "dma unaligned pointer (%08X %08X)" + , dma->start + , dma->end + ); + + /* fatal error on entries exceeding rom size */ + if (dma->end > rom->data_sz) + die( + "dma entry %d (%08X - %08X) exceeds rom size (%08X)" + , dma->index, dma->start, dma->end, rom->data_sz + ); + + /* if at least one entry has been processed, and its + * start is lower than any of the previous ends + */ + if (dma > rom->dma && dma->start < lowest) + die( + "dma table entry %d (%08X - %08X) " + "overlaps entry %d (%08X - %08X)" + , dma->index, dma->start, dma->end + , (dma-1)->index, (dma-1)->start, (dma-1)->end + ); + + /* store highest dma end offset */ + if (dma->end > highest_end) + highest_end = dma->end; + + /* lowest acceptable start for next entry is end of current */ + lowest = dma->end; + } + + /* note dma_ready() has been called */ + rom->dma_ready = 1; +} + +/* reencode existing archives within rom + * NOTE: must be used before dma_ready() + */ +/* TODO optimization opportunities: threading, caching */ +void rom_dma_repack( + struct rom *rom + , unsigned start + , unsigned end + , const char *from /* old codec */ + , const char *to /* new codec */ +) +{ + const struct encoder *enc = 0; + int (*decfunc)( + void *src, void *dst, unsigned dstSz, unsigned *srcSz + ) = 0; + void *ctx = 0; + + assert(rom); + assert(rom->data); + assert(rom->dma); + assert(rom->dma_ready == 0 && "dma_repack must precede dma_ready"); + + /* default codec = yaz */ + if (!from) + from = "yaz"; + if (!(to = rom->codec)) + to = "yaz"; + + /* swap start and end if they are not in ascending order */ + if (end < start) + { + int t = end; + end = start; + start = t; + } + + /* allocate compression buffers, 16 mb */ + if (!rom->mem.mb16) + rom->mem.mb16 = malloc_safe(SIZE_16MB); + if (!rom->mem.mb4) + rom->mem.mb4 = malloc_safe(SIZE_4MB); + + /* no need to reencode when the codec is the same */ + if (!strcmp(from, to)) + return; + + /* get decoding function */ + if (!strcmp(from, "yaz")) + { + from = "Yaz0"; + decfunc = yazdec; + } + else if (!strcmp(from, "raw")) + { + from = "raw0"; + } + else + die("dma_repack from='%s' unsupported", from); + + /* get encoding function */ + enc = encoder(to); + + /* allocate compression context (if applicable) */ + if (enc->ctx_new) + { + ctx = enc->ctx_new(); + if (!ctx) + die("memory error"); + } + + /* start <= idx <= end */ + while (start <= end && start < rom->dma_num) + { + struct dma *dma = dma_get_idx(rom, start); + + unsigned char *dst = rom->data + dma->start; + const char *errstr; + unsigned int Osz = dma->end - dma->start; + unsigned int Nsz; + char name[32]; + + dma->compress = 0; + + sprintf(name, "%08X", dma->start); + + errstr = + yar_reencode( + dst + , Osz + , rom->mem.mb16 + , &Nsz + , 4 + + , name + , from + , rom->mem.mb4 + , ctx + + , decfunc + , enc->encfunc + , 0 + ); + + /* fatal error */ + if (errstr) + die("%s", errstr); + + /* repacked archive won't fit in place of original archive */ + if (Nsz > Osz) + die("repacking failed, new archive 0x%X bytes too big" + , Nsz - Osz + ); + + /* copy encoded file into rom */ + memcpy(dst, rom->mem.mb16, Nsz); + + /* file sizes changed */ + fprintf(printer, "%.2f kb saved!\n", ((float)(Osz-Nsz))/1000.0f); + + dma->end = dma->start + Nsz; + + start += 1; + } + + /* free compression context (if applicable) */ + if (enc->ctx_free) + { + assert(ctx); + enc->ctx_free(ctx); + } +} + + +/* set compression flag on indices start <= idx <= end */ +void rom_dma_compress( + struct rom *rom + , unsigned start + , unsigned end + , int comp +) +{ + assert(rom); + assert(rom->data); + assert(rom->dma); + assert(rom->dma_ready == 0 && "dma_compress must precede dma_ready"); + + /* swap start and end if they are not in ascending order */ + if (end < start) + { + int t = end; + end = start; + start = t; + } + + /* start <= idx <= end */ + while (start <= end && start < rom->dma_num) + { + struct dma *dma = rom->dma + start; + + dma->compress = comp; + start += 1; + } +} + + +/* set rom compressed file cache directory */ +void rom_set_cache(struct rom *rom, const char *cache) +{ + assert(rom); + assert(cache); + + if (rom->cache) + free(rom->cache); + + rom->cache = strdup_safe(cache); +} + +/* get number of dma entries */ +int rom_dma_num(struct rom *rom) +{ + assert(rom); + + return rom->dma_num; +} + +/* set rom compression codec + * valid options: "yaz", "lzo", "ucl", "aplib" + * NOTE: to use codecs besides yaz, get patches from the z64enc repo + */ +void rom_set_codec(struct rom *rom, const char *codec) +{ + assert(rom); + assert(codec); + + if (rom->codec) + free(rom->codec); + + rom->codec = strdup_safe(codec); +} + +/* save rom to disk using specified filename */ +void rom_save(struct rom *rom, const char *fn) +{ + assert(rom); + assert(rom->data); + + /* updates dmadata */ + rom_write_dmadata(rom); + + /* recalculate crc */ + n64crc(rom->data); + + if (file_write(fn, rom->data, rom->data_sz) != rom->data_sz) + die("failed to write file '%s'", fn); +} + +/* allocate a rom structure */ +struct rom *rom_new(const char *fn) +{ + struct rom *dst; + + assert(fn); + + /* allocate destination rom structure */ + dst = calloc_safe(1, sizeof(*dst)); + + /* propagate rom file */ + dst->data = file_load(fn, &dst->data_sz); + + /* double its bounds just in case compressed rom is larger + * (this can happen if, say, a 23mb rom is provided, + * gets compressed to 17mb, and is rounded up to 24mb) + * (retail rom sizes always use increments of 8) + */ + dst->data_sz *= 2; + dst->data = realloc(dst->data, dst->data_sz); + + /* back up load file name */ + dst->fn = strdup_safe(fn); + + return dst; +} + +/* free a rom structure */ +void rom_free(struct rom *rom) +{ + if (!rom) + return; + + if (rom->codec) + free(rom->codec); + + if (rom->data) + free(rom->data); + + if (rom->dma) + free(rom->dma); + + if (rom->cache) + free(rom->cache); + + if (rom->fn) + free(rom->fn); + + /* free any memory pools that were allocated */ + if (rom->mem.mb16) + free(rom->mem.mb16); + if (rom->mem.mb4) + free(rom->mem.mb4); + + free(rom); +} + diff --git a/tools/z64compress/src/rom.h b/tools/z64compress/src/rom.h new file mode 100644 index 000000000..dbc6eaa43 --- /dev/null +++ b/tools/z64compress/src/rom.h @@ -0,0 +1,62 @@ +/* + * rom.h + * + * functions for compression magic reside herein + * + * z64me + * + */ + +#ifndef Z64COMPRESS_ROM_H_INCLUDED +#define Z64COMPRESS_ROM_H_INCLUDED + +/* opaque definition */ +struct rom; + +/* allocate a rom structure and load rom file */ +struct rom *rom_new(const char *fn); + +/* free a rom structure */ +void rom_free(struct rom *rom); + +/* save rom to disk using specified filename */ +void rom_save(struct rom *rom, const char *fn); + +/* compress rom using specified algorithm */ +void rom_compress(struct rom *rom, int mb, int numThreads, bool matching); + +/* specify start of dmadata and number of entries */ +void rom_dma(struct rom *rom, unsigned int offset, int num_entries, bool matching); + +/* call this once dma settings are finalized */ +void rom_dma_ready(struct rom *rom, bool matching); + +/* set compression flag on indices start <= idx <= end */ +void +rom_dma_compress(struct rom *rom, unsigned start, unsigned end, int comp); + +/* reencode existing archives within rom + * NOTE: must be used before dma_ready() + */ +void rom_dma_repack( + struct rom *rom + , unsigned start + , unsigned end + , const char *from /* old codec */ + , const char *to /* new codec */ +); + +/* get number of dma entries */ +int rom_dma_num(struct rom *rom); + +/* set rom compression codec + * valid options: "yaz", "lzo", "ucl", "aplib" + * NOTE: to use codecs besides yaz, get patches from the z64enc repo + */ +void rom_set_codec(struct rom *rom, const char *codec); + +/* set rom compressed file cache directory */ +void rom_set_cache(struct rom *rom, const char *cache); + +#endif /* Z64COMPRESS_ROM_H_INCLUDED */ + diff --git a/tools/z64compress/src/sha1.c b/tools/z64compress/src/sha1.c new file mode 100644 index 000000000..07b068dd6 --- /dev/null +++ b/tools/z64compress/src/sha1.c @@ -0,0 +1,141 @@ +#include +#include +#include + +#define stb_big32(c) (((c)[0]<<24) + (c)[1]*65536 + (c)[2]*256 + (c)[3]) + +static void stb__sha1(unsigned char *chunk, unsigned h[5]) +{ + int i; + unsigned a,b,c,d,e; + unsigned w[80]; + + for (i=0; i < 16; ++i) + w[i] = stb_big32(&chunk[i*4]); + for (i=16; i < 80; ++i) { + unsigned t; + t = w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16]; + w[i] = (t + t) | (t >> 31); + } + + a = h[0]; + b = h[1]; + c = h[2]; + d = h[3]; + e = h[4]; + + #define STB__SHA1(k,f) \ + { \ + unsigned temp = (a << 5) + (a >> 27) + (f) + e + (k) + w[i]; \ + e = d; \ + d = c; \ + c = (b << 30) + (b >> 2); \ + b = a; \ + a = temp; \ + } + + i=0; + for (; i < 20; ++i) STB__SHA1(0x5a827999, d ^ (b & (c ^ d)) ); + for (; i < 40; ++i) STB__SHA1(0x6ed9eba1, b ^ c ^ d ); + for (; i < 60; ++i) STB__SHA1(0x8f1bbcdc, (b & c) + (d & (b ^ c)) ); + for (; i < 80; ++i) STB__SHA1(0xca62c1d6, b ^ c ^ d ); + + #undef STB__SHA1 + + h[0] += a; + h[1] += b; + h[2] += c; + h[3] += d; + h[4] += e; +} + +void stb_sha1(unsigned char output[20], unsigned char *buffer, unsigned len) +{ + unsigned char final_block[128]; + unsigned end_start, final_len, j; + int i; + + unsigned h[5]; + + h[0] = 0x67452301; + h[1] = 0xefcdab89; + h[2] = 0x98badcfe; + h[3] = 0x10325476; + h[4] = 0xc3d2e1f0; + + // we need to write padding to the last one or two + // blocks, so build those first into 'final_block' + + // we have to write one special byte, plus the 8-byte length + + // compute the block where the data runs out + end_start = len & ~63; + + // compute the earliest we can encode the length + if (((len+9) & ~63) == end_start) { + // it all fits in one block, so fill a second-to-last block + end_start -= 64; + } + + final_len = end_start + 128; + + // now we need to copy the data in + assert(end_start + 128 >= len+9); + assert(end_start < len || len < 64-9); + + j = 0; + if (end_start > len) + j = (unsigned) - (int) end_start; + + for (; end_start + j < len; ++j) + final_block[j] = buffer[end_start + j]; + final_block[j++] = 0x80; + while (j < 128-5) // 5 byte length, so write 4 extra padding bytes + final_block[j++] = 0; + // big-endian size + final_block[j++] = len >> 29; + final_block[j++] = len >> 21; + final_block[j++] = len >> 13; + final_block[j++] = len >> 5; + final_block[j++] = len << 3; + assert(j == 128 && end_start + j == final_len); + + for (j=0; j < final_len; j += 64) { // 512-bit chunks + if (j+64 >= end_start+64) + stb__sha1(&final_block[j - end_start], h); + else + stb__sha1(&buffer[j], h); + } + + for (i=0; i < 5; ++i) { + output[i*4 + 0] = h[i] >> 24; + output[i*4 + 1] = h[i] >> 16; + output[i*4 + 2] = h[i] >> 8; + output[i*4 + 3] = h[i] >> 0; + } +} + +// client can truncate this wherever they like +void stb_sha1_readable(char display[30], unsigned char sha[20]) +{ + char encoding[65] = "0123456789abcdefghijklmnopqrstuv" + "wxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#$"; + int num_bits = 0, acc=0; + int i=0,o=0; + while (o < 26) { + int v; + // expand the accumulator + if (num_bits < 6) { + assert(i != 20); + acc += sha[i++] << num_bits; + num_bits += 8; + } + v = acc & ((1 << 6) - 1); + display[o++] = encoding[v]; + acc >>= 6; + num_bits -= 6; + } + assert(num_bits == 20*8 - 26*6); + display[o++] = '\0'; +} + diff --git a/tools/z64compress/src/sha1.h b/tools/z64compress/src/sha1.h new file mode 100644 index 000000000..3c7e0dc23 --- /dev/null +++ b/tools/z64compress/src/sha1.h @@ -0,0 +1,8 @@ +#ifndef STB_SHA1_H_INCLUDED +#define STB_SHA1_H_INCLUDED + +void stb_sha1(unsigned char output[20], unsigned char *buffer, unsigned len); +void stb_sha1_readable(char display[30], unsigned char sha[20]); + +#endif /* STB_SHA1_H_INCLUDED */ + diff --git a/tools/z64compress/src/wow.c b/tools/z64compress/src/wow.c new file mode 100644 index 000000000..21b2c671d --- /dev/null +++ b/tools/z64compress/src/wow.c @@ -0,0 +1,3 @@ +#define WOW_IMPLEMENTATION +#include "wow.h" + diff --git a/tools/z64compress/src/wow.h b/tools/z64compress/src/wow.h new file mode 100644 index 000000000..cc2d88cd3 --- /dev/null +++ b/tools/z64compress/src/wow.h @@ -0,0 +1,769 @@ +/* + * wow.h + * + * a small collection of functions + * to make writing software easier + * + * z64me + * + */ + +#ifndef WOW_H_INCLUDED +#define WOW_H_INCLUDED + +#include /* size_t */ +#include /* file ops */ +#include /* alloc */ +#include /* stat */ +#include /* strdup */ +#include /* chdir, getcwd */ +#include +#include + +#ifdef _WIN32 + #include + #undef near + #undef far +#endif + + +#if (_WIN32 && UNICODE) + #define wow_main int wmain(int argc, wchar_t *Wargv[]) + #define wow_main_argv char **argv = wow_conv_args(argc, (void*)Wargv) +#else + #define wow_main int main(int argc, char *argv[]) + #define wow_main_argv do{}while(0) +#endif + + +#ifndef WOW_API_PREFIX + #define WOW_API_PREFIX +#endif + +WOW_API_PREFIX +void * +wow_utf8_to_wchar(const char *str); + +WOW_API_PREFIX +char * +wow_wchar_to_utf8(void *wstr); + + +/* converts argv[] from wchar to char win32, in place */ +WOW_API_PREFIX +void * +wow_conv_args(int argc, void *argv[]); + + +/* returns non-zero if path is a directory */ +WOW_API_PREFIX +int +wow_is_dir_w(void const *path); + + +/* returns non-zero if path is a directory */ +WOW_API_PREFIX +int +wow_is_dir(char const *path); + + +/* fread abstraction that falls back to buffer-based fread * + * if a big fread fails; if that still fails, returns 0 */ +WOW_API_PREFIX +size_t +wow_fread_bytes(void *ptr, size_t bytes, FILE *stream); + + +/* fwrite abstraction that falls back to buffer-based fwrite * + * if a big fwrite fails; if that still fails, returns 0 */ +WOW_API_PREFIX +size_t +wow_fwrite_bytes(const void *ptr, size_t bytes, FILE *stream); + + +/* fread abstraction that falls back to buffer-based fread * + * if a big fread fails; if that still fails, returns 0 */ +WOW_API_PREFIX +size_t +wow_fread(void *ptr, size_t size, size_t nmemb, FILE *stream); + + +/* fwrite abstraction that falls back to buffer-based fwrite * + * if a big fwrite fails; if that still fails, returns 0 */ +WOW_API_PREFIX +size_t +wow_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); + + +/* fopen abstraction for utf8 support on windows win32 */ +WOW_API_PREFIX +FILE * +wow_fopen(char const *name, char const *mode); + + +/* remove abstraction for utf8 support on windows win32 */ +WOW_API_PREFIX +int +wow_remove(char const *path); + + +/* mkdir */ +WOW_API_PREFIX +int +wow_mkdir(char const *path); + + +/* chdir */ +WOW_API_PREFIX +int +wow_chdir(char const *path); + + +/* getcwd */ +WOW_API_PREFIX +char * +wow_getcwd(char *buf, size_t size); + + +/* getcwd_safe */ +WOW_API_PREFIX +char * +wow_getcwd_safe(char *buf, size_t size); + + +/* system */ +WOW_API_PREFIX +int +wow_system(char const *path); + +WOW_API_PREFIX void die(const char *fmt, ...) + __attribute__ ((format (printf, 1, 2))) +; +WOW_API_PREFIX void *calloc_safe(size_t nmemb, size_t size); +WOW_API_PREFIX void *malloc_safe(size_t size); +WOW_API_PREFIX void *realloc_safe(void *ptr, size_t size); +WOW_API_PREFIX char *strdup_safe(const char *s); +WOW_API_PREFIX void *memdup_safe(void *ptr, size_t size); + +#ifdef WOW_IMPLEMENTATION + +WOW_API_PREFIX void die(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); +#ifdef UNICODE + char buf[4096]; + vsprintf(buf, fmt, args); + wchar_t *wc = wow_utf8_to_wchar(buf); + setlocale(LC_ALL, ""); + fwprintf(stderr, L"%ls", wc); + free(wc); +#else + vfprintf(stderr, fmt, args); +#endif + va_end(args); + fprintf(stderr, "\n"); + exit(EXIT_FAILURE); +} + +WOW_API_PREFIX void *calloc_safe(size_t nmemb, size_t size) +{ + void *result = calloc(nmemb, size); + + if (!result) + die("memory error"); + + return result; +} + +WOW_API_PREFIX void *malloc_safe(size_t size) +{ + void *result = malloc(size); + + if (!result) + die("memory error"); + + return result; +} + +WOW_API_PREFIX void *realloc_safe(void *ptr, size_t size) +{ + void *result = realloc(ptr, size); + + if (!result) + die("memory error"); + + return result; +} + +WOW_API_PREFIX char *strdup_safe(const char *s) +{ + char *result; + int n; + + if (!s) + return 0; + + n = strlen(s) + 1; + + result = malloc_safe(n); + + strcpy(result, s); + + return result; +} + +WOW_API_PREFIX void *memdup_safe(void *ptr, size_t size) +{ + void *result; + + if (!ptr || !size) + return 0; + + result = malloc_safe(size); + + memcpy(result, ptr, size); + + return result; +} + + +WOW_API_PREFIX +void * +wow_utf8_to_wchar(const char *str) +{ +#ifdef UNICODE +extern __declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int cp, unsigned long flags, const char *str, int cbmb, wchar_t *widestr, int cchwide); + wchar_t *wstr; + int wstr_sz = (strlen(str) + 1) * 16;//sizeof(*wstr); + wstr = calloc_safe(1, wstr_sz); + MultiByteToWideChar(65001/*utf8*/, 0, str, -1, wstr, wstr_sz); + return wstr; +#else + return strdup(str); +#endif +} + +WOW_API_PREFIX +char * +wow_wchar_to_utf8_buf(void *wstr, void *dst, int dst_max) +{ +#ifdef UNICODE +extern __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default); + WideCharToMultiByte(65001/*utf8*/, 0, wstr, -1, dst, dst_max, NULL, NULL); + return dst; +#else + (void)dst_max; /* unused parameter */ + return strcpy(dst, wstr); +#endif +} + +WOW_API_PREFIX +char * +wow_wchar_to_utf8(void *wstr) +{ +#ifdef UNICODE +extern __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default); + char *str; + int str_sz = (wcslen(wstr) + 1) * sizeof(*str); + str = calloc_safe(1, str_sz); + WideCharToMultiByte(65001/*utf8*/, 0, wstr, -1, str, str_sz, NULL, NULL); + return str; +#else + return strdup(wstr); +#endif +} + +WOW_API_PREFIX +char * +wow_wchar_to_utf8_inplace(void *wstr) +{ +#ifdef UNICODE +extern __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default); + char buf[4096]; + char *str; + int wstr_len = wcslen(wstr); + unsigned str_sz = (wstr_len + 1) * sizeof(*str); + if (str_sz >= sizeof(buf)) + str = malloc_safe(str_sz); + else + str = buf; + WideCharToMultiByte(65001/*utf8*/, 0, wstr, -1, str, str_sz, NULL, NULL); + memcpy(wstr, str, wstr_len + 1); + ((char*)wstr)[wstr_len+1] = '\0'; + if (str != buf) + free(str); + return wstr; +#else + return wstr; +#endif +} + + +/* argument abstraction: converts argv[] from wchar to char win32 */ +WOW_API_PREFIX +void * +wow_conv_args(int argc, void *argv[]) +{ +#ifdef UNICODE + int i; + for (i=0; i < argc; ++i) + { + //fprintf(stderr, "[%d]: %s\n", i, argv[i]); + //fwprintf(stderr, L"[%d]: %s\n", i, (wchar_t*)argv[i]); + argv[i] = wow_wchar_to_utf8_inplace(argv[i]); + //fwprintf(stderr, L"[%d]: %s\n", i, wow_utf8_to_wchar(argv[i])); + } +#else + (void)argc; /* unused parameter */ +#endif + return argv; +} + +/* returns non-zero if path is a directory */ +WOW_API_PREFIX +int +wow_is_dir_w(void const *path) +{ + struct stat s; +#if (_WIN32 && UNICODE) + if (wstat(path, &s) == 0) +#else + if (stat(path, &s) == 0) +#endif + { + if (s.st_mode & S_IFDIR) + return 1; + } + + return 0; +} + + +/* returns non-zero if path is a directory */ +WOW_API_PREFIX +int +wow_is_dir(char const *path) +{ + int rv; + void *wpath = 0; + +#if (_WIN32 && UNICODE) + wpath = wow_utf8_to_wchar(path); + rv = wow_is_dir_w(wpath); +#else + rv = wow_is_dir_w(path); +#endif + if (wpath) + free(wpath); + + return rv; +} + + +/* fread abstraction that falls back to buffer-based fread * + * if a big fread fails; if that still fails, returns 0 */ +WOW_API_PREFIX +size_t +wow_fread_bytes(void *ptr, size_t bytes, FILE *stream) +{ + if (!stream || !ptr || !bytes) + return 0; + + unsigned char *ptr8 = ptr; + size_t Oofs = ftell(stream); + size_t bufsz = 1024 * 1024; /* 1 mb at a time */ + size_t Obytes = bytes; + size_t rem; + + fseek(stream, 0, SEEK_END); + rem = ftell(stream) - Oofs; + fseek(stream, Oofs, SEEK_SET); + + if (bytes > rem) + bytes = rem; + + /* everything worked */ + if (fread(ptr, 1, bytes, stream) == bytes) + return Obytes; + + /* failed: try falling back to slower buffered read */ + fseek(stream, Oofs, SEEK_SET); + while (bytes) + { + /* don't read past end */ + if (bytes < bufsz) + bufsz = bytes; + if (bufsz > rem) + { + bytes = rem; + bufsz = rem; + } + + /* still failed */ + if (fread(ptr8, 1, bufsz, stream) != bufsz) + return 0; + + /* advance */ + ptr8 += bufsz; + bytes -= bufsz; + rem -= bufsz; + } + + /* success */ + return Obytes; +} + + +/* fwrite abstraction that falls back to buffer-based fwrite * + * if a big fwrite fails; if that still fails, returns 0 */ +WOW_API_PREFIX +size_t +wow_fwrite_bytes(const void *ptr, size_t bytes, FILE *stream) +{ + if (!stream || !ptr || !bytes) + return 0; + + const unsigned char *ptr8 = ptr; + size_t bufsz = 1024 * 1024; /* 1 mb at a time */ + size_t Obytes = bytes; + + /* everything worked */ + if (fwrite(ptr, 1, bytes, stream) == bytes) + return bytes; + + /* failed: try falling back to slower buffered read */ + while (bytes) + { + /* don't read past end */ + if (bytes < bufsz) + bufsz = bytes; + + /* still failed */ + if (fwrite(ptr8, 1, bufsz, stream) != bufsz) + return 0; + + /* advance */ + ptr8 += bufsz; + bytes -= bufsz; + } + + /* success */ + return Obytes; +} + + +/* fread abstraction that falls back to buffer-based fread * + * if a big fread fails; if that still fails, returns 0 */ +WOW_API_PREFIX +size_t +wow_fread(void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + if (!stream || !ptr || !size || !nmemb) + return 0; + + if (wow_fread_bytes(ptr, size * nmemb, stream) == size * nmemb) + return nmemb; + + return 0; +} + + +/* fwrite abstraction that falls back to buffer-based fwrite * + * if a big fwrite fails; if that still fails, returns 0 */ +WOW_API_PREFIX +size_t +wow_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + if (!stream || !ptr || !size || !nmemb) + return 0; + + if (wow_fwrite_bytes(ptr, size * nmemb, stream) == size * nmemb) + return nmemb; + + return 0; +} + + +/* fopen abstraction for utf8 support on windows win32 */ +WOW_API_PREFIX +FILE * +wow_fopen(char const *name, char const *mode) +{ +#ifdef UNICODE + void *wname = 0; + void *wmode = 0; + FILE *fp = 0; + + wname = wow_utf8_to_wchar(name); + if (!wname) + goto L_cleanup; + + /* TODO eventually, an error message would be cool */ + if (wow_is_dir_w(wname)) + goto L_cleanup; + + wmode = wow_utf8_to_wchar(mode); + if (!wmode) + goto L_cleanup; + + fp = _wfopen(wname, wmode); + +L_cleanup: + if (wname) free(wname); + if (wmode) free(wmode); + if (fp) + return fp; + return 0; +#else + /* TODO eventually, an error message would be cool */ + if (wow_is_dir_w(name)) + return 0; + return fopen(name, mode); +#endif +} + + +/* remove abstraction for utf8 support on windows win32 */ +WOW_API_PREFIX +int +wow_remove(char const *path) +{ +#ifdef UNICODE + void *wpath = 0; + int rval; + + wpath = wow_utf8_to_wchar(path); + if (!wpath) + return -1; + + rval = _wremove(wpath); + free(wpath); + return rval; +#else + return remove(path); +#endif +} + + +/* mkdir */ +WOW_API_PREFIX +int +wow_mkdir(char const *path) +{ +#if defined(_WIN32) && defined(UNICODE) +extern int _wmkdir(const wchar_t *); + void *wname = 0; + int rval; + + wname = wow_utf8_to_wchar(path); + if (!wname) + return -1; + + rval = _wmkdir(wname); + + if (wname) + free(wname); + + return rval; +#elif defined(_WIN32) /* win32 no unicode */ +extern int _mkdir(const char *); + return _mkdir(path); +#else /* ! _WIN32 */ + return mkdir(path, 0777); +#endif +} + + +/* chdir */ +WOW_API_PREFIX +int +wow_chdir(char const *path) +{ +#if defined(_WIN32) && defined(UNICODE) +extern int _wchdir(const wchar_t *); + void *wname = 0; + int rval; + + wname = wow_utf8_to_wchar(path); + if (!wname) + return -1; + + rval = _wchdir(wname); + + if (wname) + free(wname); + + return rval; +#elif defined(_WIN32) /* win32 no unicode */ +extern int _chdir(const char *); + return _chdir(path); +#else /* ! _WIN32 */ + return chdir(path); +#endif +} + + +/* getcwd */ +WOW_API_PREFIX +char * +wow_getcwd(char *buf, size_t size) +{ +#if defined(_WIN32) && defined(UNICODE) +//extern int _wgetcwd(const wchar_t *, int); +extern _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords); + wchar_t wname[4096]; + + if (!buf || !size) + return 0; + + if (!_wgetcwd(wname, sizeof(wname) / sizeof(wname[0]))) + return 0; + + return wow_wchar_to_utf8_buf(wname, buf, size); +#elif defined(_WIN32) /* win32 no unicode */ +//extern char *_getcwd(char *, int); + return _getcwd(buf, size); +#else /* ! _WIN32 */ + return getcwd(buf, size); +#endif +} + + +/* getcwd_safe */ +WOW_API_PREFIX +char * +wow_getcwd_safe(char *buf, size_t size) +{ + char *result = wow_getcwd(buf, size); + + if (!result) + die("failed to get current working directory"); + + return result; +} + + +/* system */ +WOW_API_PREFIX +int +wow_system(char const *path) +{ +#if defined(_WIN32) && defined(UNICODE) + void *wname = 0; + int rval; + + wname = wow_utf8_to_wchar(path); + if (!wname) + return -1; + + rval = _wsystem(wname); + + if (wname) + free(wname); + + return rval; +#else /* not win32 unicode */ + return system(path); +#endif +} + + +/* system_gui */ +WOW_API_PREFIX +int +wow_system_gui(char const *name, const char *param) +{ +#if defined(_WIN32) + STARTUPINFOW si; + PROCESS_INFORMATION pi; + + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + ZeroMemory(&pi, sizeof(pi)); + int rval = 0 /*success */; +//extern int ShellExecuteA(void *hwnd, void *op, void *file, void *param, void *dir, int cmd); +//extern int ShellExecuteW(void *hwnd, void *op, void *file, void *param, void *dir, int cmd); +//const int SW_SHOWNORMAL = 1; + #if defined(UNICODE) + void *wname = 0; + void *wparam = 0; + + wname = wow_utf8_to_wchar(name); + if (!wname) + { + return -1; + } + wparam = wow_utf8_to_wchar(param); + if (!wparam) + { + free(wname); + return -1; + } + +#if 0 + if (CreateProcessW( + wname, wparam + , NULL, NULL + , FALSE + , CREATE_NO_WINDOW + , NULL + , NULL + , &si, &pi) + ) + { + //WaitForSingleObject(pi.hProcess, INFINITE); + //CloseHandle(pi.hProcess); + //CloseHandle(pi.hThread); + } + else + rval = 1; +#else + rval = (int)ShellExecuteW(NULL, L"open", wname, wparam, L".", SW_SHOWNORMAL); + rval = rval <= 32; +#endif + + free(wname); + free(wparam); + #else /* win32 non-unicode */ +#if 0 + if (CreateProcessA( + name, x + , NULL, NULL + , FALSE + , CREATE_NO_WINDOW + , NULL + , NULL + , &si, &pi) + ) + { + //WaitForSingleObject(pi.hProcess, INFINITE); + //CloseHandle(pi.hProcess); + //CloseHandle(pi.hThread); + } + else + rval = 1; +#else + rval = (int)ShellExecuteA(NULL, "open", name, param, ".", SW_SHOWNORMAL); + rval = rval <= 32; +#endif + #endif + return rval;//rval <= 32; +#else /* not win32 unicode */ + char *x = malloc_safe(strlen(name) + strlen(param) + 128); + if (!x) + return -1; + strcpy(x, "\""); + strcat(x, name); + strcat(x, "\" "); + strcat(x, param); + int rval = system(x); + free(x); + return rval; +#endif +} + +#endif /* WOW_IMPLEMENTATION */ + +#endif /* WOW_H_INCLUDED */ + diff --git a/tools/z64compress/src/wow_dirent.h b/tools/z64compress/src/wow_dirent.h new file mode 100644 index 000000000..e9db5ca0b --- /dev/null +++ b/tools/z64compress/src/wow_dirent.h @@ -0,0 +1,61 @@ +/* + * wow_dirent.h + * + * dirent wrapper that abstracts unicode/utf8 platforms + * + * must be #include'd after dirent.h + * + * z64me + * + */ + +#ifndef WOW_DIRENT_INCLUDED +#define WOW_DIRENT_INCLUDED +#include "wow.h" + +#if defined(_WIN32) && defined(UNICODE) +# define wow_DIR _WDIR +# define wow_dirent _wdirent +static +wow_DIR * +wow_opendir(const char *path) +{ + void *wpath = wow_utf8_to_wchar(path); + if (!wpath) + return NULL; + + wow_DIR *rv = _wopendir(wpath); + + free(wpath); + + return rv; +} +static +struct wow_dirent * +wow_readdir(wow_DIR *dir) +{ + struct wow_dirent *ep = _wreaddir(dir); + if (!ep) + return 0; + + /* convert d_name to utf8 for working on them directly */ + char *str = wow_wchar_to_utf8(ep->d_name); + memcpy(ep->d_name, str, strlen(str) + 1); + free(str); + + return ep; +} +# define wow_closedir _wclosedir +# define wow_dirent_char wchar_t + +#else /* not win32 unicode */ +# define wow_DIR DIR +# define wow_dirent dirent +# define wow_opendir opendir +# define wow_readdir readdir +# define wow_closedir closedir +# define wow_dirent_char char +#endif + +#endif /* WOW_DIRENT_INCLUDED */ + diff --git a/tools/z64compress_wrapper.py b/tools/z64compress_wrapper.py new file mode 100644 index 000000000..df7779302 --- /dev/null +++ b/tools/z64compress_wrapper.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python3 +# +# z64compress wrapper for decomp projects +# Arguments: [cache directory] [num threads] +# + +import argparse, itertools, subprocess + +from elftools.elf.elffile import ELFFile +from elftools.elf.sections import SymbolTableSection + +# Args from command line +parser = argparse.ArgumentParser(description="Compress rom produced by the OoT Decomp project") + +parser.add_argument("in_rom", help="uncompressed input rom filename") +parser.add_argument("out_rom", help="compressed output rom filename") +parser.add_argument("elf", help="path to the uncompressed rom elf file") +parser.add_argument("spec", help="path to processed spec file") +parser.add_argument("--cache", help="cache directory") +parser.add_argument("--threads", help="number of threads to run compression on, 0 disables multithreading") +parser.add_argument("--codec", help="z64compress algorithm (yaz, lzo, ucl, aplib)", default="yaz") + +args = parser.parse_args() + +IN_ROM = args.in_rom +OUT_ROM = args.out_rom + +elf_path = args.elf + +CACHE_DIR = args.cache +N_THREADS = int(args.threads or 0) + +CODEC = args.codec +print(f"Using algorithm: {CODEC}") + +# Get segments to compress + +spec = "" +with open(args.spec, "r") as infile: + spec = infile.read() + +def ranges(i): + for _, b in itertools.groupby(enumerate(i), lambda pair: pair[1] - pair[0]): + b = list(b) + yield b[0][1], b[-1][1] + +compress_segments = [] + +shift = 0 +for i,segment in enumerate(spec.split("beginseg\n")[1:],0): + directives = segment.split("endseg")[0].split("\n") + + for directive in directives: + directive = directive.strip() + if directive.startswith("flags") and "NOLOAD" in directive: + shift += 1 + elif directive.startswith("compress"): + compress_segments.append(i - shift) + +compress_segments = list(ranges(compress_segments)) +COMPRESS_INDICES = ",".join([f"{start}-{end}" if start != end else f"{start}" for start,end in compress_segments]) + +# Find dmadata + +def get_dmadata_start_len(): + dmadata_start = -1 + dmadata_end = -1 + + with open(elf_path, "rb") as elf_file: + elf = ELFFile(elf_file) + + for section in elf.iter_sections(): + if not isinstance(section, SymbolTableSection): + continue + + for sym in section.iter_symbols(): + if sym.name == "_dmadataSegmentRomStart": + dmadata_start = sym['st_value'] + elif sym.name == "_dmadataSegmentRomEnd": + dmadata_end = sym['st_value'] + if dmadata_start != -1 and dmadata_end != -1: + break + + assert dmadata_start != -1 + assert dmadata_end != -1 + + return dmadata_start, (dmadata_end - dmadata_start)//0x10 + +DMADATA_ADDR, DMADATA_COUNT = get_dmadata_start_len() + +# Run + +cmd = " ".join( + ( + f"./tools/z64compress/z64compress --in {IN_ROM} --out {OUT_ROM}", + f"--codec {CODEC}", + f"--cache {CACHE_DIR}" if CACHE_DIR is not None else "", + f"--dma 0x{DMADATA_ADDR:X},{DMADATA_COUNT}", + f"--compress {COMPRESS_INDICES}", + f"--threads {N_THREADS}" if N_THREADS > 0 else "" + ) +) + +print(cmd) +subprocess.run(cmd, shell=True)