├── .clang-format ├── .clang-tidy ├── .gitignore ├── .gitmodules ├── Makefile ├── README.md ├── blastcorps.us.v10.sha1 ├── blastcorps.us.v10.yaml ├── blastcorps.us.v11.assets.yaml ├── blastcorps.us.v11.sha1 ├── blastcorps.us.v11.yaml ├── blastcorps ├── Makefile ├── diff_settings.py ├── hd_code.us.v10.sha1 ├── hd_code.us.v10.yaml ├── hd_code.us.v11.sha1 ├── hd_code.us.v11.yaml ├── hd_front_end.us.v11.yaml ├── include │ ├── 2.0I │ │ ├── PR │ │ │ ├── PRimage.h │ │ │ ├── R4300.h │ │ │ ├── abi.h │ │ │ ├── gbi.h │ │ │ ├── gs2dex.h │ │ │ ├── gt.h │ │ │ ├── gu.h │ │ │ ├── libaudio.h │ │ │ ├── mbi.h │ │ │ ├── os.h │ │ │ ├── os_internal.h │ │ │ ├── ramrom.h │ │ │ ├── rcp.h │ │ │ ├── rdb.h │ │ │ ├── region.h │ │ │ ├── rmon.h │ │ │ ├── sched.h │ │ │ ├── sp.h │ │ │ ├── sptask.h │ │ │ ├── ucode.h │ │ │ ├── ultraerror.h │ │ │ ├── ultralog.h │ │ │ ├── ultratypes.h │ │ │ └── uportals.h │ │ ├── assert.h │ │ ├── bstring.h │ │ ├── make │ │ │ └── PRdefs │ │ ├── regdef.h │ │ ├── sgidefs.h │ │ ├── stdarg.h │ │ ├── stdlib.h │ │ ├── string.h │ │ ├── sys │ │ │ ├── asm.h │ │ │ ├── regdef.h │ │ │ ├── u64driver.h │ │ │ └── u64gio.h │ │ ├── tinymon.h │ │ ├── ultra64.h │ │ └── ultrahost.h │ ├── common.h │ └── macro.inc ├── init.us.v10.sha1 ├── init.us.v10.yaml ├── init.us.v11.sha1 ├── init.us.v11.yaml ├── src.us.v11 │ └── init │ │ └── 1660.c ├── symbol_addrs.init.us.v11.txt ├── undefined_syms.hd_code.us.v10.txt ├── undefined_syms.hd_code.us.v11.txt ├── undefined_syms.init.us.v10.txt └── undefined_syms.init.us.v11.txt ├── docs ├── blast_corps_docs.txt ├── blast_corps_levels.txt ├── blast_corps_rom_extending.txt ├── blast_corps_textures.txt ├── blast_corps_vehicles.txt ├── chimp.plot ├── level_stats.csv └── sm64tools-configs │ ├── blast_corps.e.code.yaml │ ├── blast_corps.e.yaml │ ├── blast_corps.u.1.0.code.yaml │ ├── blast_corps.u.1.0.yaml │ ├── blast_corps.u.1.1.code.yaml │ ├── blast_corps.u.1.1.yaml │ ├── blast_dozer.code.yaml │ └── blast_dozer.yaml ├── meson.build └── tools ├── gzip ├── ido5.3_recomp ├── Makefile ├── README.md ├── acpp ├── as1 ├── cc ├── cc_c.c ├── cfe ├── copt ├── elf.h ├── err.english.cc ├── header.h ├── helpers.h ├── libc_impl.c ├── libc_impl.h ├── libc_impl.o ├── recomp ├── recomp.cpp ├── ugen ├── ugen_c.c ├── ujoin ├── uld ├── umerge ├── uopt └── usplit ├── rarezip.py ├── sm64config2splat.py ├── splat_ext ├── __init__.py ├── blast.py └── rzip.py └── src ├── blast.c ├── blast.h ├── gen_level_table.c ├── gen_splat_yaml.c ├── meson.build ├── n64graphics.c ├── n64graphics.h ├── stb.c ├── stb └── stb_image_write.h ├── unblast.c ├── unblast_rom.c ├── utils.c └── utils.h /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Mozilla 2 | BreakBeforeBraces: Allman 3 | ColumnLimit: 80 4 | -------------------------------------------------------------------------------- /.clang-tidy: -------------------------------------------------------------------------------- 1 | Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling' 2 | WarningsAsErrors: '' 3 | HeaderFilterRegex: '' 4 | AnalyzeTemporaryDtors: false 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # files 2 | *.bin 3 | *.ext 4 | *.ld 5 | *.ok 6 | *.z64 7 | *auto*.txt 8 | 9 | # directories 10 | __pycache__/ 11 | asm/ 12 | assets/ 13 | build/ 14 | expected/ 15 | junk/ 16 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tools/splat"] 2 | path = tools/splat 3 | url = https://github.com/retroplastic/splat.git 4 | [submodule "tools/asm-differ"] 5 | path = tools/asm-differ 6 | url = https://github.com/simonlindholm/asm-differ.git 7 | [submodule "tools/asm-processor"] 8 | path = tools/asm-processor 9 | url = https://github.com/simonlindholm/asm-processor.git 10 | [submodule "tools/mips_to_c"] 11 | path = tools/mips_to_c 12 | url = https://github.com/matt-kempster/mips_to_c.git 13 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | BASENAME = blastcorps 2 | VERSION := us.v10 3 | 4 | BUILD_DIR = build 5 | ASM_DIRS = asm 6 | BIN_DIRS = assets 7 | 8 | TOOLS_DIR := tools 9 | 10 | S_FILES = $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/*.s)) 11 | BIN_FILES = $(foreach dir,$(BIN_DIRS),$(wildcard $(dir)/*.bin)) 12 | 13 | O_FILES := $(foreach file,$(S_FILES),$(BUILD_DIR)/$(file).o) \ 14 | $(foreach file,$(BIN_FILES),$(BUILD_DIR)/$(file).o) 15 | 16 | BLASTCORP_EXTRACTED := blastcorps/init.$(VERSION).bin blastcorps/hd_code.$(VERSION).bin blastcorps/hd_front_end.$(VERSION).bin 17 | 18 | TARGET = $(BUILD_DIR)/$(BASENAME).$(VERSION) 19 | LD_SCRIPT = $(BASENAME).$(VERSION).ld 20 | 21 | CROSS = mips-linux-gnu- 22 | AS = $(CROSS)as 23 | CPP = cpp 24 | LD = $(CROSS)ld 25 | OBJDUMP = $(CROSS)objdump 26 | OBJCOPY = $(CROSS)objcopy 27 | PYTHON = python3 28 | GZIP = gzip 29 | 30 | OBJCOPYFLAGS = -O binary 31 | 32 | ASFLAGS = -EB -mtune=vr4300 -march=vr4300 -mabi=32 -I include 33 | 34 | LDFLAGS = -T $(LD_SCRIPT) -Map $(TARGET).map --no-check-sections 35 | 36 | ### Optimisation Overrides 37 | 38 | ### Targets 39 | 40 | default: all 41 | 42 | all: dirs $(TARGET).z64 verify 43 | 44 | dirs: 45 | $(foreach dir,$(SRC_DIRS) $(ASM_DIRS) $(BIN_DIRS),$(shell mkdir -p $(BUILD_DIR)/$(dir))) 46 | 47 | check: .baserom.$(VERSION).ok 48 | 49 | verify: $(TARGET).z64 50 | @echo "$$(cat $(BASENAME).$(VERSION).sha1) $(TARGET).z64" | sha1sum --check 51 | 52 | extract: check assets/init.$(VERSION).bin 53 | 54 | clean: 55 | rm -rf asm 56 | rm -rf assets 57 | rm -rf build 58 | rm -f *auto.txt 59 | rm -rf $(BLASTCORP_EXTRACTED) 60 | 61 | decompress: $(BLASTCORP_EXTRACTED) 62 | 63 | ### Recipes 64 | 65 | # decompression 66 | assets/%.$(VERSION).ext: assets/%.$(VERSION).bin 67 | $(GZIP) -d -S ".bin" $< -c > $@ 68 | 69 | blastcorps/hd_code.$(VERSION).bin: assets/hd_code_text.$(VERSION).ext assets/hd_code_data.$(VERSION).ext 70 | cat assets/hd_code_text.$(VERSION).ext assets/hd_code_data.$(VERSION).ext > $@ 71 | 72 | blastcorps/hd_front_end.$(VERSION).bin: assets/hd_front_end_text.$(VERSION).ext assets/hd_front_end_data.$(VERSION).ext 73 | cat assets/hd_front_end_text.$(VERSION).ext assets/hd_front_end_data.$(VERSION).ext > $@ 74 | 75 | blastcorps/init.$(VERSION).bin: assets/init.$(VERSION).bin 76 | cp assets/init.$(VERSION).bin $@ 77 | 78 | assets/init.$(VERSION).bin: 79 | $(PYTHON) $(TOOLS_DIR)/splat/split.py $(BASENAME).$(VERSION).yaml 80 | 81 | .baserom.$(VERSION).ok: baserom.$(VERSION).z64 82 | @echo "$$(cat $(BASENAME).$(VERSION).sha1) $<" | sha1sum --check 83 | @touch $@ 84 | 85 | $(TARGET).elf: $(O_FILES) 86 | @$(LD) $(LDFLAGS) -o $@ 87 | 88 | $(BUILD_DIR)/%.s.o: %.s 89 | $(AS) $(ASFLAGS) -o $@ $< 90 | 91 | $(BUILD_DIR)/%.bin.o: %.bin 92 | $(LD) -r -b binary -o $@ $< 93 | 94 | $(TARGET).bin: $(TARGET).elf 95 | $(OBJCOPY) $(OBJCOPYFLAGS) $< $@ 96 | 97 | $(TARGET).z64: $(TARGET).bin 98 | @cp $< $@ 99 | 100 | ### Settings 101 | .SECONDARY: 102 | .PHONY: all clean default 103 | SHELL = /bin/bash -e -o pipefail 104 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Blast Corps 2 | 3 | - This repo is about to contain a full decompilation of Blast Corps `(Japan)`, `(USA)`, `(USA) (Rev 1)` and `(Europe) (En,De)`. 4 | - Naming and documentation of the source code and data structures are in progress. 5 | 6 | It uses the following ROMs: 7 | 8 | | no-intro | Location | sha1 | 9 | | --- | --- | --- | 10 | | `Blast Corps (USA)` | `baserom.us.v10.z64` | `185a6ef7ba1adb243278062c81a7d4e119bda58c` | 11 | | `Blast Corps (USA) (Rev 1)` | `baserom.us.v11.z64` | `483f7161aea39de8b45c9fbc70a2c3883c4dea8c` | 12 | | `Blastdozer (Japan)` | `baserom.jp.z64` | `b147fdbeb661c89107c440b00dc4810508f58636` | 13 | | `Blast Corps (Europe) (En,De)` | `baserom.eu.z64` | `460212600f8b9f0da95219c4c7330f2e626d9a7e` | 14 | 15 | This repo does not include all assets necessary for compiling the ROMs. 16 | A prior copy of the game is required to extract the assets. 17 | 18 | # Clone the repo 19 | 20 | Clone recursivley to initialize the splat submodule. 21 | 22 | ``` 23 | git clone https://github.com/retroplastic/blastcorps.git --recursive 24 | ``` 25 | 26 | If you cloned it without `--recursive`, you can initialize the submodule later. 27 | 28 | ``` 29 | git submodule init 30 | git submodule update 31 | ``` 32 | 33 | # Build 34 | 35 | This is a two-stage build; first stage is to extract the compressed section from the ROM, second stage is to extract/compile them. 36 | 37 | Place a US Rev 1.0 ROM at the base of this repo. 38 | 39 | ## Set up Python for splat 40 | 41 | ``` 42 | virtualenv .env 43 | . .env/bin/activate 44 | pip install -r tools/splat/requirements.txt 45 | ``` 46 | 47 | ## Stage 1 48 | 49 | **Extract init, hd_code and hd_front_end code from ROM** 50 | ``` 51 | make VERSION=us.v11 extract 52 | ``` 53 | **Decompress hd_code and hd_front_end .text and .data sections** 54 | ``` 55 | make VERSION=us.v11 decompress 56 | ``` 57 | **Build ROM** 58 | ``` 59 | make VERSION=us.v11 60 | ``` 61 | 62 | ## Stage 2 (Optional) 63 | 64 | **Extract `init` + `hd_code` (TODO: `hd_front_end`):** 65 | ``` 66 | make VERSION=us.v11 -C blastcorps extract 67 | ``` 68 | **Compile ASM/C** 69 | ``` 70 | make VERSION=us.v11 -C blastcorps 71 | ``` 72 | **Compress compiled code and replace** 73 | ``` 74 | make VERSION=us.v11 -C blastcorps compress 75 | ``` 76 | **(re)Build ROM** 77 | ``` 78 | make VERSION=us.v11 79 | ``` 80 | 81 | ## C tools 82 | 83 | C tools from queueRAM's `blast_corps_docs`, `sm64tools` and other places. 84 | They can be found in the `tools/src` subdirectory of this repo. 85 | 86 | ### Build the tools 87 | 88 | ``` 89 | meson build-tools 90 | ninja -C build-tools 91 | ``` 92 | 93 | ### Run the tools 94 | 95 | ``` 96 | ./build-tools/tools/src/blast_textures 97 | ./build-tools/tools/src/gen_level_table 98 | ``` 99 | 100 | # Related 101 | 102 | * mkst's [blastcorps](https://github.com/mkst/blastcorps) 103 | 104 | Initial set up of splat and Makefile build this repo is based on. 105 | 106 | * queueRAM's [blast_corps_docs](https://github.com/queueRAM/blast_corps_docs) 107 | 108 | The original repository this is based upon. The content can be found in `docs` and `tools`. 109 | 110 | * queueRAM's [BlastCorpsEditor](https://github.com/queueRAM/BlastCorpsEditor) 111 | 112 | A C# level editor for blast corps. 113 | 114 | * queueRAM's [sm64tools](https://github.com/queueRAM/sm64tools) 115 | 116 | A N64 rom manipulation tool silimar to splat, written in C. 117 | 118 | * mkst's [gzip](https://github.com/mkst/gzip) branch 119 | 120 | Backport of the pre-1.5 bug behaviour of gzip to support the rare gzip format. 121 | 122 | * ethteck's [splat](https://github.com/ethteck/splat) 123 | 124 | A binary splitting tool, used as subrepository in this project. 125 | 126 | * [n64decomp](https://github.com/n64decomp) 127 | 128 | A collection of N64 decompilation projects. 129 | 130 | * queueRAM's [Texture](https://github.com/queueRAM/Texture64) 131 | 132 | Can be used to view raw textures extracted from gzip. Works with mono. 133 | 134 | -------------------------------------------------------------------------------- /blastcorps.us.v10.sha1: -------------------------------------------------------------------------------- 1 | 185a6ef7ba1adb243278062c81a7d4e119bda58c -------------------------------------------------------------------------------- /blastcorps.us.v11.sha1: -------------------------------------------------------------------------------- 1 | 483f7161aea39de8b45c9fbc70a2c3883c4dea8c -------------------------------------------------------------------------------- /blastcorps/Makefile: -------------------------------------------------------------------------------- 1 | VERSION := us.v10 2 | 3 | BUILD_DIR = build 4 | 5 | TOOLS_DIR := ../tools 6 | ASM_PROCESSOR_DIR := $(TOOLS_DIR)/asm-processor 7 | 8 | SRC_DIR = src.$(VERSION) 9 | 10 | # timestamps 11 | ifeq ($(VERSION),us.v10) 12 | HD_CODE_TEXT_TIMESTAMP = 855502464 13 | HD_CODE_DATA_TIMESTAMP = 855502465 14 | HD_FRONT_END_TEXT_TIMESTAMP = 855502466 15 | HD_FRONT_END_DATA_TIMESTAMP = 855502466 16 | else 17 | # US v1.1 18 | HD_CODE_TEXT_TIMESTAMP = 855919890 19 | HD_CODE_DATA_TIMESTAMP = 855919891 20 | HD_FRONT_END_TEXT_TIMESTAMP = 855919891 21 | HD_FRONT_END_DATA_TIMESTAMP = 855919891 22 | endif 23 | 24 | # init 25 | INIT_ASM_DIRS = asm/init 26 | INIT_BIN_DIRS = assets/init 27 | INIT_SRC_DIR = $(SRC_DIR)/init 28 | INIT_SRC_DIRS = $(INIT_SRC_DIR) 29 | 30 | INIT_S_FILES = $(foreach dir,$(INIT_ASM_DIRS),$(wildcard $(dir)/*.s)) 31 | INIT_C_FILES = $(foreach dir,$(INIT_SRC_DIRS),$(wildcard $(dir)/*.c)) 32 | INIT_BIN_FILES = $(foreach dir,$(INIT_BIN_DIRS),$(wildcard $(dir)/*.bin)) 33 | 34 | INIT_O_FILES := $(foreach file,$(INIT_S_FILES),$(BUILD_DIR)/$(file).o) \ 35 | $(foreach file,$(INIT_C_FILES),$(BUILD_DIR)/$(file).o) \ 36 | $(foreach file,$(INIT_BIN_FILES),$(BUILD_DIR)/$(file).o) 37 | 38 | #asm/hd_code asm/hd_front_end 39 | HD_CODE_ASM_DIRS = asm/hd_code 40 | HD_CODE_BIN_DIRS = assets/hd_code 41 | HD_CODE_SRC_DIR = $(SRC_DIR)/hd_code 42 | HD_CODE_SRC_DIRS = $(HD_CODE_SRC_DIR) 43 | 44 | HD_CODE_S_FILES = $(foreach dir,$(HD_CODE_ASM_DIRS),$(wildcard $(dir)/*.s)) 45 | HD_CODE_C_FILES = $(foreach dir,$(HD_CODE_SRC_DIRS),$(wildcard $(dir)/*.c)) 46 | HD_CODE_BIN_FILES = $(foreach dir,$(HD_CODE_BIN_DIRS),$(wildcard $(dir)/*.bin)) 47 | 48 | HD_CODE_O_FILES := $(foreach file,$(HD_CODE_S_FILES),$(BUILD_DIR)/$(file).o) \ 49 | $(foreach file,$(HD_CODE_C_FILES),$(BUILD_DIR)/$(file).o) \ 50 | $(foreach file,$(HD_CODE_BIN_FILES),$(BUILD_DIR)/$(file).o) 51 | 52 | 53 | # Files requiring pre/post-processing 54 | GREP = grep -rl 55 | GLOBAL_ASM_INIT_C_FILES := $(shell $(GREP) GLOBAL_ASM $(INIT_SRC_DIR) /dev/null) 56 | GLOBAL_ASM_INIT_O_FILES := $(foreach file,$(GLOBAL_ASM_INIT_C_FILES),$(BUILD_DIR)/$(file).o) 57 | 58 | GLOBAL_ASM_HD_CODE_C_FILES := $(shell $(GREP) GLOBAL_ASM $(HD_CODE_SRC_DIR) /dev/null) 59 | GLOBAL_ASM_HD_CODE_O_FILES := $(foreach file,$(GLOBAL_ASM_HD_CODE_C_FILES),$(BUILD_DIR)/$(file).o) 60 | 61 | 62 | # Tooling 63 | CROSS = mips-linux-gnu- 64 | AS = $(CROSS)as 65 | CPP = cpp 66 | LD = $(CROSS)ld 67 | OBJDUMP = $(CROSS)objdump 68 | OBJCOPY = $(CROSS)objcopy 69 | PYTHON = python3 70 | GZIP = gzip 71 | 72 | 73 | CC = $(TOOLS_DIR)/ido5.3_recomp/cc 74 | 75 | OBJCOPYFLAGS = -O binary 76 | 77 | OPT_FLAGS := -O1 78 | MIPSISET := -mips2 -o32 79 | 80 | INCLUDE_CFLAGS := -I . -I include -I include/2.0I -I include/2.0I/PR 81 | 82 | ASFLAGS = -EB -mtune=vr4300 -march=vr4300 -mabi=32 -I include 83 | 84 | CFLAGS := -G 0 -Xfullwarn -Xcpluscomm -signed -nostdinc -non_shared -Wab,-r4300_mul 85 | CFLAGS += -D_LANGUAGE_C -D_FINALROM 86 | # ignore compiler warnings about anonymous structs 87 | CFLAGS += -woff 649,838 88 | CFLAGS += $(INCLUDE_CFLAGS) 89 | 90 | # Linker config 91 | INIT_TARGET = $(BUILD_DIR)/init.$(VERSION) 92 | INIT_LD_SCRIPT = init.$(VERSION).ld 93 | 94 | HD_CODE_TARGET = $(BUILD_DIR)/hd_code.$(VERSION) 95 | HD_CODE_LD_SCRIPT = hd_code.$(VERSION).ld 96 | 97 | INIT_LDFLAGS = -T $(INIT_LD_SCRIPT) -Map $(INIT_TARGET).map -T undefined_syms_auto.init.$(VERSION).txt -T undefined_funcs_auto.init.$(VERSION).txt -T undefined_syms.init.$(VERSION).txt --no-check-sections 98 | HD_CODE_LDFLAGS = -T $(HD_CODE_LD_SCRIPT) -Map $(HD_CODE_TARGET).map -T undefined_syms_auto.hd_code.$(VERSION).txt -T undefined_funcs_auto.hd_code.$(VERSION).txt -T undefined_syms.hd_code.$(VERSION).txt --no-check-sections 99 | 100 | 101 | ### Optimisation Overrides 102 | 103 | 104 | ### Targets 105 | 106 | default: all 107 | 108 | all: verify_init verify_hd_code 109 | 110 | dirs: 111 | $(foreach dir,$(INIT_SRC_DIR) $(INIT_ASM_DIRS) $(INIT_BIN_DIRS) $(HD_CODE_SRC_DIR) $(HD_CODE_ASM_DIRS) $(HD_CODE_BIN_DIRS),$(shell mkdir -p $(BUILD_DIR)/$(dir))) 112 | 113 | 114 | init: dirs $(INIT_TARGET).bin 115 | 116 | hd_code: dirs $(HD_CODE_TARGET).bin 117 | 118 | verify_init: init 119 | @echo "$$(cat init.$(VERSION).sha1) $(INIT_TARGET).bin" | sha1sum --check 120 | 121 | verify_hd_code: hd_code 122 | @echo "$$(cat hd_code.$(VERSION).sha1) $(HD_CODE_TARGET).bin" | sha1sum --check 123 | 124 | extract: 125 | $(PYTHON) $(TOOLS_DIR)/splat/split.py init.$(VERSION).yaml 126 | $(PYTHON) $(TOOLS_DIR)/splat/split.py hd_code.$(VERSION).yaml 127 | 128 | compress: $(BUILD_DIR)/hd_code_text.$(VERSION).gz $(BUILD_DIR)/hd_code_data.$(VERSION).gz 129 | @echo "Replacing extracted hd_code..." 130 | cp $(BUILD_DIR)/hd_code_text.$(VERSION).gz ../assets/hd_code_text.$(VERSION).bin 131 | cp $(BUILD_DIR)/hd_code_data.$(VERSION).gz ../assets/hd_code_data.$(VERSION).bin 132 | 133 | clean: 134 | rm -rf asm 135 | rm -rf assets 136 | rm -rf build 137 | rm -f *auto.txt 138 | 139 | 140 | ### Recipes 141 | 142 | $(BUILD_DIR)/init.$(VERSION).elf: $(INIT_O_FILES) 143 | @$(LD) $(INIT_LDFLAGS) -o $@ 144 | 145 | $(BUILD_DIR)/hd_code.$(VERSION).elf: $(HD_CODE_O_FILES) 146 | @$(LD) $(HD_CODE_LDFLAGS) -o $@ 147 | 148 | ifndef PERMUTER 149 | $(GLOBAL_ASM_INIT_O_FILES): $(BUILD_DIR)/%.c.o: %.c 150 | $(PYTHON) $(ASM_PROCESSOR_DIR)/asm_processor.py $(OPT_FLAGS) $< > $(BUILD_DIR)/$< 151 | $(CC) -c -32 $(CFLAGS) $(OPT_FLAGS) $(MIPSISET) -o $@ $(BUILD_DIR)/$< 152 | $(PYTHON) $(ASM_PROCESSOR_DIR)/asm_processor.py $(OPT_FLAGS) $< --post-process $@ \ 153 | --assembler "$(AS) $(ASFLAGS)" --asm-prelude $(ASM_PROCESSOR_DIR)/prelude.s 154 | 155 | $(GLOBAL_ASM_O_HD_CODE_FILES): $(BUILD_DIR)/%.c.o: %.c 156 | $(PYTHON) $(ASM_PROCESSOR_DIR)/asm_processor.py $(OPT_FLAGS) $< > $(BUILD_DIR)/$< 157 | $(CC) -c -32 $(CFLAGS) $(OPT_FLAGS) $(MIPSISET) -o $@ $(BUILD_DIR)/$< 158 | $(PYTHON) $(ASM_PROCESSOR_DIR)/asm_processor.py $(OPT_FLAGS) $< --post-process $@ \ 159 | --assembler "$(AS) $(ASFLAGS)" --asm-prelude $(ASM_PROCESSOR_DIR)/prelude.s 160 | endif 161 | 162 | # non asm-processor recipe 163 | $(BUILD_DIR)/%.c.o: %.c 164 | $(CC) -c $(CFLAGS) $(OPT_FLAGS) $(MIPSISET) -o $@ $< 165 | 166 | $(BUILD_DIR)/%.s.o: %.s 167 | $(AS) $(ASFLAGS) -o $@ $< 168 | 169 | $(BUILD_DIR)/%.bin.o: %.bin 170 | $(LD) -r -b binary -o $@ $< 171 | 172 | %.bin: %.elf 173 | $(OBJCOPY) $(OBJCOPYFLAGS) $< $@ 174 | 175 | # compression 176 | 177 | $(BUILD_DIR)/hd_code_text.$(VERSION).gz: $(BUILD_DIR)/hd_code_text.$(VERSION).bin 178 | $(PYTHON) $(TOOLS_DIR)/rarezip.py $< $@ --name hd_code_text.raw --time $(HD_CODE_TEXT_TIMESTAMP) --level 6 179 | 180 | $(BUILD_DIR)/hd_code_data.$(VERSION).gz: $(BUILD_DIR)/hd_code_data.$(VERSION).bin 181 | $(PYTHON) $(TOOLS_DIR)/rarezip.py $< $@ --name hd_code_data.raw --time $(HD_CODE_DATA_TIMESTAMP) --level 6 182 | 183 | $(BUILD_DIR)/hd_front_end_text.$(VERSION).gz: $(BUILD_DIR)/hd_front_end_text.$(VERSION).bin 184 | $(PYTHON) $(TOOLS_DIR)/rarezip.py $< $@ --name hd_front_end_text.raw --time $(HD_FRONT_END_TEXT_TIMESTAMP) --level 6 185 | 186 | $(BUILD_DIR)/hd_front_end_data.$(VERSION).gz: $(BUILD_DIR)/hd_front_end_data.$(VERSION).bin 187 | $(PYTHON) $(TOOLS_DIR)/rarezip.py $< $@ --name hd_front_end_data.raw --time $(HD_FRONT_END_DATA_TIMESTAMP) --level 6 188 | 189 | # split out sections 190 | $(BUILD_DIR)/hd_code_text.$(VERSION).bin: $(BUILD_DIR)/hd_code.$(VERSION).elf 191 | $(OBJCOPY) -O binary --only-section .hd_code $< $@ 192 | 193 | $(BUILD_DIR)/hd_code_data.$(VERSION).bin: $(BUILD_DIR)/hd_code.$(VERSION).elf 194 | $(OBJCOPY) -O binary --only-section .hd_code_data $< $@ 195 | 196 | $(BUILD_DIR)/hd_front_end_text.$(VERSION).bin: $(BUILD_DIR)/hd_code.$(VERSION).elf 197 | $(OBJCOPY) -O binary --only-section .hd_front_end $< $@ 198 | 199 | $(BUILD_DIR)/hd_front_end_data.$(VERSION).bin: $(BUILD_DIR)/hd_code.$(VERSION).elf 200 | $(OBJCOPY) -O binary --only-section .hd_front_end_data $< $@ 201 | 202 | 203 | ### Settings 204 | .SECONDARY: 205 | .PHONY: all clean default 206 | SHELL = /bin/bash -e -o pipefail 207 | 208 | 209 | # 210 | # import datetime 211 | # d = datetime.datetime.strptime("1997-02-14 11:31:31", '%Y-%m-%d %H:%M:%S') 212 | # d.timestamp() 213 | -------------------------------------------------------------------------------- /blastcorps/diff_settings.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | def apply(config, args): 4 | basename = 'init' 5 | if os.path.exists(f'build/{basename}.us.v10.bin'): 6 | version = 'us.v10' 7 | elif os.path.exists(f'build/{basename}.us.v11.bin'): 8 | version = 'us.v11' 9 | else: 10 | version = 'eu' 11 | 12 | config['baseimg'] = f'init.{version}.bin' 13 | config['myimg'] = f'build/{basename}.{version}.bin' 14 | config['mapfile'] = f'build/{basename}.{version}.map' 15 | config['source_directories'] = ['src', f'src.{version}', 'include'] 16 | -------------------------------------------------------------------------------- /blastcorps/hd_code.us.v10.sha1: -------------------------------------------------------------------------------- 1 | cfe03fe2935ea3a9b7e3dc66953aa6d51f2ff2af -------------------------------------------------------------------------------- /blastcorps/hd_code.us.v10.yaml: -------------------------------------------------------------------------------- 1 | options: 2 | base_path: . 3 | basename: hd_code.us.v10 4 | compiler: IDO 5 | create_detected_syms: yes 6 | find_file_boundaries: yes 7 | target_path: hd_code.us.v10.bin 8 | undefined_funcs_auto_path: undefined_funcs_auto.hd_code.us.v10.txt 9 | undefined_syms_auto_path: undefined_syms_auto.hd_code.us.v10.txt 10 | src_path: src.us.v10 11 | segments: 12 | - name: hd_code 13 | type: code 14 | vram: 0x802447C0 15 | start: 0x00000000 16 | subsegments: 17 | - [0x0000, asm, hd_code/0000] 18 | - [0x12D80, asm, hd_code/12D80] 19 | - [0x13A70, asm, hd_code/13A70] 20 | - [0x14B30, asm, hd_code/14B30] 21 | - [0x168B0, asm, hd_code/168B0] 22 | - [0x17A70, asm, hd_code/17A70] 23 | - [0x17E10, asm, hd_code/17E10] 24 | - [0x1C460, asm, hd_code/1C460] 25 | - [0x1D990, asm, hd_code/1D990] 26 | - [0x20460, asm, hd_code/20460] 27 | - [0x23C20, asm, hd_code/23C20] 28 | - [0x26570, asm, hd_code/26570] 29 | - [0x2E490, asm, hd_code/2E490] 30 | - [0x30430, asm, hd_code/30430] 31 | - [0x30C70, asm, hd_code/30C70] 32 | - [0x34430, asm, hd_code/34430] 33 | - [0x37530, asm, hd_code/37530] 34 | - [0x39050, asm, hd_code/39050] 35 | - [0x3E4C0, asm, hd_code/3E4C0] 36 | - [0x405F0, asm, hd_code/405F0] 37 | - [0x409D0, asm, hd_code/409D0] 38 | - [0x41930, asm, hd_code/41930] 39 | - [0x42240, asm, hd_code/42240] 40 | - [0x43A60, asm, hd_code/43A60] 41 | - [0x45BB0, asm, hd_code/45BB0] 42 | - [0x46C20, asm, hd_code/46C20] 43 | - [0x46F60, asm, hd_code/46F60] 44 | - [0x479D0, asm, hd_code/479D0] 45 | - [0x48D00, asm, hd_code/48D00] 46 | - [0x4B5E0, asm, hd_code/4B5E0] 47 | - [0x4DA80, asm, hd_code/4DA80] 48 | - [0x4EBE0, asm, hd_code/4EBE0] 49 | - [0x51690, asm, hd_code/51690] 50 | - [0x52D70, asm, hd_code/52D70] 51 | - [0x53220, asm, hd_code/53220] 52 | - [0x54E30, asm, hd_code/54E30] 53 | - [0x55970, asm, hd_code/55970] 54 | - [0x55D40, asm, hd_code/55D40] 55 | - [0x56010, asm, hd_code/56010] 56 | - [0x56040, asm, hd_code/56040] 57 | - [0x5BF40, asm, hd_code/5BF40] 58 | - [0x5CB60, asm, hd_code/5CB60] 59 | - [0x5FD40, asm, hd_code/5FD40] 60 | - [0x60D40, asm, hd_code/60D40] 61 | - [0x60F50, asm, hd_code/60F50] 62 | - [0x62730, asm, hd_code/62730] 63 | - [0x68790, bin, hd_code/68790] # handwritten? 64 | - [0x69920, asm, hd_code/69920] 65 | - [0x69B30, asm, hd_code/69B30] 66 | - [0x6C540, asm, hd_code/6C540] 67 | - [0x6E160, asm, hd_code/6E160] 68 | - [0x710A0, asm, hd_code/710A0] 69 | - [0x72AE0, asm, hd_code/72AE0] 70 | - [0x753F0, asm, hd_code/753F0] 71 | - [0x77200, asm, hd_code/77200] 72 | - [0x77D80, asm, hd_code/77D80] 73 | - [0x7D920, bin, hd_code/7D920] # data? 74 | - [0x7F800, asm, hd_code/7F800] 75 | - [0x80030, bin, hd_code/80030] # ? 76 | - [0x801D0, asm, hd_code/801D0] 77 | - [0x83860, asm, hd_code/83860] 78 | - [0x85320, asm, hd_code/85320] 79 | - [0x86E20, asm, hd_code/86E20] 80 | - [0x86EB0, asm, hd_code/86EB0] 81 | - [0x880B0, asm, hd_code/880B0] 82 | - [0x891A0, asm, hd_code/891A0] 83 | - [0x89FD0, asm, hd_code/89FD0] 84 | - [0x8A230, asm, hd_code/8A230] 85 | - [0x8AE30, asm, hd_code/8AE30] 86 | - [0x8DD00, asm, hd_code/8DD00] 87 | - [0x8E860, bin, hd_code/8E860] # data 88 | - [0x8F7B0, asm, hd_code/8F7B0] 89 | - [0x8FA40, asm, hd_code/8FA40] 90 | - [0x8FB90, asm, hd_code/8FB90] 91 | - [0x8FCF0, asm, hd_code/8FCF0] 92 | - [0x8FE70, asm, hd_code/8FE70] 93 | - [0x900A0, asm, hd_code/900A0] 94 | - [0x901E0, asm, hd_code/901E0] 95 | - [0x902E0, asm, hd_code/902E0] 96 | - [0x905B0, asm, hd_code/905B0] 97 | - [0x90630, asm, hd_code/90630] 98 | - [0x906B0, asm, hd_code/906B0] 99 | - [0x90750, asm, hd_code/90750] 100 | - [0x90910, asm, hd_code/90910] 101 | - [0x90BA0, asm, hd_code/90BA0] 102 | - [0x90D90, asm, hd_code/90D90] 103 | - [0x90FA0, asm, hd_code/90FA0] 104 | - [0x91210, asm, hd_code/91210] 105 | - [0x912B0, asm, hd_code/912B0] 106 | - [0x91770, asm, hd_code/91770] 107 | - [0x91780, asm, hd_code/91780] 108 | - [0x91CE0, asm, hd_code/91CE0] 109 | - [0x91EA0, asm, hd_code/91EA0] 110 | - [0x91ED0, asm, hd_code/91ED0] 111 | - [0x91F80, asm, hd_code/91F80] 112 | - [0x92080, asm, hd_code/92080] 113 | - [0x921F0, asm, hd_code/921F0] 114 | - [0x922A0, asm, hd_code/922A0] 115 | - [0x92300, asm, hd_code/92300] 116 | - [0x92980, asm, hd_code/92980] 117 | - [0x92A20, asm, hd_code/92A20] 118 | - [0x92AB0, asm, hd_code/92AB0] 119 | - [0x92B40, asm, hd_code/92B40] 120 | - [0x92BD0, asm, hd_code/92BD0] 121 | - [0x92C70, asm, hd_code/92C70] 122 | - [0x92CF0, asm, hd_code/92CF0] 123 | - [0x93940, asm, hd_code/93940] 124 | - [0x93980, asm, hd_code/93980] 125 | - [0x939F0, asm, hd_code/939F0] 126 | - [0x93AA0, asm, hd_code/93AA0] 127 | - [0x93AB0, asm, hd_code/93AB0] 128 | - [0x93AF0, asm, hd_code/93AF0] 129 | - [0x93D40, asm, hd_code/93D40] 130 | - [0x94F70, asm, hd_code/94F70] 131 | - [0x94FB0, asm, hd_code/94FB0] 132 | - [0x94FC0, asm, hd_code/94FC0] 133 | - [0x95190, asm, hd_code/95190] 134 | - [0x953A0, asm, hd_code/953A0] 135 | - [0x953B0, asm, hd_code/953B0] 136 | - [0x95B90, asm, hd_code/95B90] 137 | - [0x95DA0, asm, hd_code/95DA0] 138 | - [0x96100, asm, hd_code/96100] 139 | - [0x96170, asm, hd_code/96170] 140 | - [0x961E0, asm, hd_code/961E0] 141 | - [0x96250, asm, hd_code/96250] 142 | - [0x96260, asm, hd_code/96260] 143 | - [0x96410, asm, hd_code/96410] 144 | - [0x96750, asm, hd_code/96750] 145 | - [0x96830, asm, hd_code/96830] 146 | - [0x96C60, asm, hd_code/96C60] 147 | - [0x96EC0, asm, hd_code/96EC0] 148 | - [0x96F40, asm, hd_code/96F40] 149 | - [0x96FE0, asm, hd_code/96FE0] 150 | - [0x97090, asm, hd_code/97090] 151 | - [0x97120, asm, hd_code/97120] 152 | - [0x97140, asm, hd_code/97140] 153 | - [0x971F0, asm, hd_code/971F0] 154 | - [0x97AC0, asm, hd_code/97AC0] 155 | - [0x97B00, asm, hd_code/97B00] 156 | - [0x97C20, asm, hd_code/97C20] 157 | - [0x97E80, asm, hd_code/97E80] 158 | - [0x98340, asm, hd_code/98340] 159 | - [0x994D0, asm, hd_code/994D0] 160 | - [0x99570, asm, hd_code/99570] 161 | - [0x995F0, asm, hd_code/995F0] 162 | - [0x99600, asm, hd_code/99600] 163 | - [0x9AF40, asm, hd_code/9AF40] 164 | - [0x9B030, asm, hd_code/9B030] 165 | - [0x9B390, asm, hd_code/9B390] 166 | - [0x9BB40, asm, hd_code/9BB40] 167 | - [0x9BBE0, asm, hd_code/9BBE0] 168 | - [0x9C880, asm, hd_code/9C880] 169 | - [0x9CB80, asm, hd_code/9CB80] 170 | - [0x9D760, asm, hd_code/9D760] 171 | - [0x9D870, asm, hd_code/9D870] 172 | - [0x9DAB0, asm, hd_code/9DAB0] 173 | - [0x9DAC0, asm, hd_code/9DAC0] 174 | - [0x9DAD0, asm, hd_code/9DAD0] 175 | - [0x9DDF0, asm, hd_code/9DDF0] 176 | - [0x9DE30, asm, hd_code/9DE30] 177 | - [0x9DEC0, asm, hd_code/9DEC0] 178 | - [0x9DEF0, asm, hd_code/9DEF0] 179 | - [0x9DFA0, asm, hd_code/9DFA0] 180 | - [0x9E090, asm, hd_code/9E090] 181 | - [0x9E510, asm, hd_code/9E510] 182 | - [0x9E640, asm, hd_code/9E640] 183 | - [0x9E650, asm, hd_code/9E650] 184 | - [0x9FD70, asm, hd_code/9FD70] 185 | - [0xA0980, asm, hd_code/A0980] 186 | - [0xA0990, asm, hd_code/A0990] 187 | - [0xA09F0, asm, hd_code/A09F0] 188 | - [0xA0AF0, bin, hd_code/A0AF0] # data 189 | - [0xA4360, linker, data] 190 | - [0xA4360, bin, hd_code/hd_code_data] 191 | - [0xCADF0] 192 | -------------------------------------------------------------------------------- /blastcorps/hd_code.us.v11.sha1: -------------------------------------------------------------------------------- 1 | 923eb2e280eb5fb25e27120ae15d7862d68a732a -------------------------------------------------------------------------------- /blastcorps/hd_code.us.v11.yaml: -------------------------------------------------------------------------------- 1 | options: 2 | base_path: . 3 | basename: hd_code.us.v11 4 | compiler: IDO 5 | create_detected_syms: yes 6 | find_file_boundaries: yes 7 | target_path: hd_code.us.v11.bin 8 | undefined_funcs_auto_path: undefined_funcs_auto.hd_code.us.v11.txt 9 | undefined_syms_auto_path: undefined_syms_auto.hd_code.us.v11.txt 10 | src_path: src.us.v11 11 | segments: 12 | - name: hd_code 13 | type: code 14 | vram: 0x802447C0 15 | start: 0x00000000 16 | subsegments: 17 | - [0x00000, asm, hd_code/00000] 18 | - [0x12D80, asm, hd_code/12D80] 19 | - [0x13A70, asm, hd_code/13A70] 20 | - [0x14B30, asm, hd_code/14B30] 21 | - [0x168B0, asm, hd_code/168B0] 22 | - [0x17A70, asm, hd_code/17A70] 23 | - [0x17E10, asm, hd_code/17E10] 24 | - [0x1C460, asm, hd_code/1C460] 25 | - [0x1D990, asm, hd_code/1D990] 26 | - [0x20460, asm, hd_code/20460] 27 | - [0x23C20, asm, hd_code/23C20] 28 | - [0x26570, asm, hd_code/26570] 29 | - [0x2E490, asm, hd_code/2E490] 30 | - [0x30430, asm, hd_code/30430] 31 | - [0x30C70, asm, hd_code/30C70] 32 | - [0x34430, asm, hd_code/34430] 33 | - [0x37530, asm, hd_code/37530] 34 | - [0x39050, asm, hd_code/39050] 35 | - [0x3E4C0, asm, hd_code/3E4C0] 36 | - [0x405F0, asm, hd_code/405F0] 37 | - [0x409D0, asm, hd_code/409D0] 38 | - [0x41930, asm, hd_code/41930] 39 | - [0x42240, asm, hd_code/42240] 40 | - [0x43A60, asm, hd_code/43A60] 41 | - [0x45BB0, asm, hd_code/45BB0] 42 | - [0x46C20, asm, hd_code/46C20] 43 | - [0x46F60, asm, hd_code/46F60] 44 | - [0x479D0, asm, hd_code/479D0] 45 | - [0x48D00, asm, hd_code/48D00] 46 | - [0x4B5E0, asm, hd_code/4B5E0] 47 | - [0x4DA80, asm, hd_code/4DA80] 48 | - [0x4EBE0, asm, hd_code/4EBE0] 49 | - [0x51690, asm, hd_code/51690] 50 | - [0x52D70, asm, hd_code/52D70] 51 | - [0x53220, asm, hd_code/53220] 52 | - [0x54E30, asm, hd_code/54E30] 53 | - [0x55970, asm, hd_code/55970] 54 | - [0x55D40, asm, hd_code/55D40] 55 | - [0x56010, asm, hd_code/56010] 56 | - [0x56040, asm, hd_code/56040] 57 | - [0x5BF40, asm, hd_code/5BF40] 58 | - [0x5CB60, asm, hd_code/5CB60] 59 | - [0x5FD50, asm, hd_code/5FD50] 60 | - [0x60D50, asm, hd_code/60D50] 61 | - [0x60F60, asm, hd_code/60F60] 62 | - [0x62740, asm, hd_code/62740] 63 | - [0x679E0, asm, hd_code/679E0] 64 | - [0x68810, bin, hd_code/68810] 65 | - [0x69BB0, asm, hd_code/69BB0] 66 | - [0x6B4A0, asm, hd_code/6B4A0] 67 | - [0x6C5E0, asm, hd_code/6C5E0] 68 | - [0x6E200, asm, hd_code/6E200] 69 | - [0x71140, asm, hd_code/71140] 70 | - [0x72B80, asm, hd_code/72B80] 71 | - [0x75490, asm, hd_code/75490] 72 | - [0x772A0, asm, hd_code/772A0] 73 | - [0x77E20, asm, hd_code/77E20] 74 | - [0x7D9D0, bin, hd_code/7D9D0_data] # ?? handwritten or a mix of .text+.data? 75 | - [0x80280, asm, hd_code/7FB50] 76 | - [0x83910, asm, hd_code/83910] 77 | - [0x853D0, asm, hd_code/853D0] 78 | - [0x86ED0, asm, hd_code/86ED0] 79 | - [0x86F60, asm, hd_code/86F60] 80 | - [0x88160, asm, hd_code/88160] 81 | - [0x89250, asm, hd_code/89250] 82 | - [0x8A080, asm, hd_code/8A080] 83 | - [0x8A2E0, asm, hd_code/8A2E0] 84 | - [0x8AEE0, asm, hd_code/8AEE0] 85 | - [0x8DDB0, asm, hd_code/8DDB0] 86 | - [0x8E910, bin, hd_code/8E910] # more data? 87 | - [0x8F860, asm, hd_code/8F860] 88 | - [0x8FAF0, asm, hd_code/8FAF0] 89 | - [0x8FC40, asm, hd_code/8FC40] 90 | - [0x8FDA0, asm, hd_code/8FDA0] 91 | - [0x8FF20, asm, hd_code/8FF20] 92 | - [0x90150, asm, hd_code/90150] 93 | - [0x90290, asm, hd_code/90290] 94 | - [0x90390, asm, hd_code/90390] 95 | - [0x90660, asm, hd_code/90660] 96 | - [0x906E0, asm, hd_code/906E0] 97 | - [0x90760, asm, hd_code/90760] 98 | - [0x90800, asm, hd_code/90800] 99 | - [0x909C0, asm, hd_code/909C0] 100 | - [0x90C50, asm, hd_code/90C50] 101 | - [0x90E40, asm, hd_code/90E40] 102 | - [0x91050, asm, hd_code/91050] 103 | - [0x912C0, asm, hd_code/912C0] 104 | - [0x91360, asm, hd_code/91360] 105 | - [0x91820, asm, hd_code/91820] 106 | - [0x91830, asm, hd_code/91830] 107 | - [0x91D90, asm, hd_code/91D90] 108 | - [0x91F50, asm, hd_code/91F50] 109 | - [0x91F80, asm, hd_code/91F80] 110 | - [0x92030, asm, hd_code/92030] 111 | - [0x92130, asm, hd_code/92130] 112 | - [0x922A0, asm, hd_code/922A0] 113 | - [0x92350, asm, hd_code/92350] 114 | - [0x923B0, asm, hd_code/923B0] 115 | - [0x92A30, asm, hd_code/92A30] 116 | - [0x92AD0, asm, hd_code/92AD0] 117 | - [0x92B60, asm, hd_code/92B60] 118 | - [0x92BF0, asm, hd_code/92BF0] 119 | - [0x92C80, asm, hd_code/92C80] 120 | - [0x92D20, asm, hd_code/92D20] 121 | - [0x92DA0, asm, hd_code/92DA0] 122 | - [0x939F0, asm, hd_code/939F0] 123 | - [0x93A30, asm, hd_code/93A30] 124 | - [0x93AA0, asm, hd_code/93AA0] 125 | - [0x93B50, asm, hd_code/93B50] 126 | - [0x93B60, asm, hd_code/93B60] 127 | - [0x93BA0, asm, hd_code/93BA0] 128 | - [0x93DF0, asm, hd_code/93DF0] 129 | - [0x95020, asm, hd_code/95020] 130 | - [0x95060, asm, hd_code/95060] 131 | - [0x95070, asm, hd_code/95070] 132 | - [0x95240, asm, hd_code/95240] 133 | - [0x95450, asm, hd_code/95450] 134 | - [0x95460, asm, hd_code/95460] 135 | - [0x95C40, asm, hd_code/95C40] 136 | - [0x95E50, asm, hd_code/95E50] 137 | - [0x961B0, asm, hd_code/961B0] 138 | - [0x96220, asm, hd_code/96220] 139 | - [0x96290, asm, hd_code/96290] 140 | - [0x96300, asm, hd_code/96300] 141 | - [0x96310, asm, hd_code/96310] 142 | - [0x964C0, asm, hd_code/964C0] 143 | - [0x96800, asm, hd_code/96800] 144 | - [0x968E0, asm, hd_code/968E0] 145 | - [0x96D10, asm, hd_code/96D10] 146 | - [0x96F70, asm, hd_code/96F70] 147 | - [0x96FF0, asm, hd_code/96FF0] 148 | - [0x97090, asm, hd_code/97090] 149 | - [0x97140, asm, hd_code/97140] 150 | - [0x971D0, asm, hd_code/971D0] 151 | - [0x971F0, asm, hd_code/971F0] 152 | - [0x972A0, asm, hd_code/972A0] 153 | - [0x97B70, asm, hd_code/97B70] 154 | - [0x97BB0, asm, hd_code/97BB0] 155 | - [0x97CD0, asm, hd_code/97CD0] 156 | - [0x97F30, asm, hd_code/97F30] 157 | - [0x983F0, asm, hd_code/983F0] 158 | - [0x99580, asm, hd_code/99580] 159 | - [0x99620, asm, hd_code/99620] 160 | - [0x996A0, asm, hd_code/996A0] 161 | - [0x996B0, asm, hd_code/996B0] 162 | - [0x9AFF0, asm, hd_code/9AFF0] 163 | - [0x9B0E0, asm, hd_code/9B0E0] 164 | - [0x9B440, asm, hd_code/9B440] 165 | - [0x9BBF0, asm, hd_code/9BBF0] 166 | - [0x9BC90, asm, hd_code/9BC90] 167 | - [0x9C930, asm, hd_code/9C930] 168 | - [0x9CC30, asm, hd_code/9CC30] 169 | - [0x9D810, asm, hd_code/9D810] 170 | - [0x9D920, asm, hd_code/9D920] 171 | - [0x9DB60, asm, hd_code/9DB60] 172 | - [0x9DB70, asm, hd_code/9DB70] 173 | - [0x9DB80, asm, hd_code/9DB80] 174 | - [0x9DEA0, asm, hd_code/9DEA0] 175 | - [0x9DEE0, asm, hd_code/9DEE0] 176 | - [0x9DF70, asm, hd_code/9DF70] 177 | - [0x9DFA0, asm, hd_code/9DFA0] 178 | - [0x9E050, asm, hd_code/9E050] 179 | - [0x9E140, asm, hd_code/9E140] 180 | - [0x9E5C0, asm, hd_code/9E5C0] 181 | - [0x9E6F0, asm, hd_code/9E6F0] 182 | - [0x9E700, asm, hd_code/9E700] 183 | - [0x9FE20, asm, hd_code/9FE20] 184 | - [0xA0A30, asm, hd_code/A0A30] 185 | - [0xA0A40, asm, hd_code/A0A40] 186 | - [0xA0AA0, asm, hd_code/A0AA0] 187 | - [0xA0BA0, bin, hd_code/A0BA0] # more data 188 | - [0xA4410, linker, data] 189 | - [0xA4410, bin, hd_code/hd_code_data] # .data 190 | - [0xCAEA0] 191 | -------------------------------------------------------------------------------- /blastcorps/hd_front_end.us.v11.yaml: -------------------------------------------------------------------------------- 1 | options: 2 | base_path: . 3 | basename: hd_front_end.us.v11 4 | compiler: IDO 5 | create_detected_syms: yes 6 | find_file_boundaries: yes 7 | target_path: hd_front_end.us.v11.bin 8 | src_path: src.us.v11 9 | segments: 10 | - name: hd_front_end 11 | type: code 12 | vram: 0x802447C0 # TBD 13 | start: 0x00000000 14 | subsegments: 15 | - [0x0, asm] 16 | - [0x21040, bin, hd_front_end_data] # data 17 | - [0x29E90] # EOF 18 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/PRimage.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * 3 | * $Revision: 1.4 $ 4 | * $Date: 1997/11/26 00:30:50 $ 5 | * $Source: /disk6/Master/cvsmdev2/PR/include/PRimage.h,v $ 6 | * 7 | **************************************************************************/ 8 | 9 | #ifndef __GL_IMAGE_H__ 10 | #define __GL_IMAGE_H__ 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | 16 | /* 17 | * Defines for image files . . . . 18 | * 19 | * Paul Haeberli - 1984 20 | * Look in /usr/people/4Dgifts/iristools/imgtools for example code! 21 | * 22 | */ 23 | 24 | 25 | #define IMAGIC 0732 26 | 27 | /* colormap of images */ 28 | #define CM_NORMAL 0 /* file contains rows of values which 29 | * are either RGB values (zsize == 3) 30 | * or greyramp values (zsize == 1) */ 31 | #define CM_DITHERED 1 32 | #define CM_SCREEN 2 /* file contains data which is a screen 33 | * image; getrow returns buffer which 34 | * can be displayed directly with 35 | * writepixels */ 36 | #define CM_COLORMAP 3 /* a colormap file */ 37 | 38 | #define TYPEMASK 0xff00 39 | #define BPPMASK 0x00ff 40 | #define ITYPE_VERBATIM 0x0000 41 | #define ITYPE_RLE 0x0100 42 | #define ISRLE(type) (((type) & 0xff00) == ITYPE_RLE) 43 | #define ISVERBATIM(type) (((type) & 0xff00) == ITYPE_VERBATIM) 44 | #define BPP(type) ((type) & BPPMASK) 45 | #define RLE(bpp) (ITYPE_RLE | (bpp)) 46 | #define VERBATIM(bpp) (ITYPE_VERBATIM | (bpp)) 47 | #define IBUFSIZE(pixels) (((pixels)+((pixels)>>6))<<2) 48 | #define RLE_NOP 0x00 49 | 50 | #define ierror(p) (((p)->flags&_IOERR)!=0) 51 | #define ifileno(p) ((p)->file) 52 | #define getpix(p) (--(p)->cnt>=0 ? *(p)->ptr++ : ifilbuf(p)) 53 | #define putpix(p,x) (--(p)->cnt>=0 \ 54 | ? ((int)(*(p)->ptr++=(unsigned)(x))) \ 55 | : iflsbuf(p,(unsigned)(x))) 56 | 57 | typedef struct { 58 | unsigned short imagic; /* stuff saved on disk . . */ 59 | unsigned short type; 60 | unsigned short dim; 61 | unsigned short xsize; 62 | unsigned short ysize; 63 | unsigned short zsize; 64 | unsigned long min; 65 | unsigned long max; 66 | unsigned long wastebytes; 67 | char name[80]; 68 | unsigned long colormap; 69 | 70 | long file; /* stuff used in core only */ 71 | unsigned short flags; 72 | short dorev; 73 | short x; 74 | short y; 75 | short z; 76 | short cnt; 77 | unsigned short *ptr; 78 | unsigned short *base; 79 | unsigned short *tmpbuf; 80 | unsigned long offset; 81 | unsigned long rleend; /* for rle images */ 82 | unsigned long *rowstart; /* for rle images */ 83 | long *rowsize; /* for rle images */ 84 | } IMAGE; 85 | 86 | IMAGE *icreate(); 87 | /* 88 | * IMAGE *iopen(char *file, char *mode, unsigned int type, unsigned int dim, 89 | * unsigned int xsize, unsigned int ysize, unsigned int zsize); 90 | * IMAGE *fiopen(int f, char *mode, unsigned int type, unsigned int dim, 91 | * unsigned int xsize, unsigned int ysize, unsigned int zsize); 92 | * 93 | * ...while iopen and fiopen can take an extended set of parameters, the 94 | * last five are optional, so a more correct prototype would be: 95 | * 96 | */ 97 | IMAGE *iopen(char *file, char *mode, ...); 98 | IMAGE *fiopen(int f, char *mode, ...); 99 | 100 | /* 101 | * 102 | * unsigned short *ibufalloc(IMAGE *image); 103 | * int ifilbuf(IMAGE *image); 104 | * int iflush(IMAGE *image); 105 | * unsigned int iflsbuf(IMAGE *image, unsigned int c); 106 | * void isetname(IMAGE *image, char *name); 107 | * void isetcolormap(IMAGE *image, int colormap); 108 | */ 109 | 110 | int iclose(IMAGE *image); 111 | int putrow(IMAGE *image, unsigned short *buffer, unsigned int y, unsigned int z); 112 | int getrow(IMAGE *image, unsigned short *buffer, unsigned int y, unsigned int z); 113 | 114 | /* 115 | IMAGE *iopen(); 116 | IMAGE *icreate(); 117 | */ 118 | 119 | unsigned short *ibufalloc(); 120 | 121 | #define IMAGEDEF /* for backwards compatibility */ 122 | #ifdef __cplusplus 123 | } 124 | #endif 125 | #endif /* !__GL_IMAGE_H__ */ 126 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/mbi.h: -------------------------------------------------------------------------------- 1 | #ifndef _MBI_H_ 2 | #define _MBI_H_ 3 | 4 | /************************************************************************** 5 | * * 6 | * Copyright (C) 1994, Silicon Graphics, Inc. * 7 | * * 8 | * These coded instructions, statements, and computer programs contain * 9 | * unpublished proprietary information of Silicon Graphics, Inc., and * 10 | * are protected by Federal copyright law. They may not be disclosed * 11 | * to third parties or copied or duplicated in any form, in whole or * 12 | * in part, without the prior written consent of Silicon Graphics, Inc. * 13 | * * 14 | **************************************************************************/ 15 | 16 | /************************************************************************** 17 | * 18 | * $Revision: 1.135 $ 19 | * $Date: 1997/11/26 00:30:54 $ 20 | * $Source: /disk6/Master/cvsmdev2/PR/include/mbi.h,v $ 21 | * 22 | **************************************************************************/ 23 | 24 | /* 25 | * Header file for the Media Binary Interface 26 | * 27 | * NOTE: This file is included by the RSP microcode, so any C-specific 28 | * constructs must be bracketed by #ifdef _LANGUAGE_C 29 | * 30 | */ 31 | 32 | 33 | /* 34 | * the SHIFT macros are used to build display list commands, inserting 35 | * bit-fields into a 32-bit word. They take a value, a shift amount, 36 | * and a width. 37 | * 38 | * For the left shift, the lower bits of the value are masked, 39 | * then shifted left. 40 | * 41 | * For the right shift, the value is shifted right, then the lower bits 42 | * are masked. 43 | * 44 | * (NOTE: _SHIFTL(v, 0, 32) won't work, just use an assignment) 45 | * 46 | */ 47 | #define _SHIFTL(v, s, w) \ 48 | ((unsigned int) (((unsigned int)(v) & ((0x01 << (w)) - 1)) << (s))) 49 | #define _SHIFTR(v, s, w) \ 50 | ((unsigned int)(((unsigned int)(v) >> (s)) & ((0x01 << (w)) - 1))) 51 | 52 | #define _SHIFT _SHIFTL /* old, for compatibility only */ 53 | 54 | #define G_ON (1) 55 | #define G_OFF (0) 56 | 57 | /************************************************************************** 58 | * 59 | * Graphics Binary Interface 60 | * 61 | **************************************************************************/ 62 | 63 | #include 64 | 65 | /************************************************************************** 66 | * 67 | * Audio Binary Interface 68 | * 69 | **************************************************************************/ 70 | 71 | #include 72 | 73 | /************************************************************************** 74 | * 75 | * Task list 76 | * 77 | **************************************************************************/ 78 | 79 | #define M_GFXTASK 1 80 | #define M_AUDTASK 2 81 | #define M_VIDTASK 3 82 | 83 | /************************************************************************** 84 | * 85 | * Segment macros and definitions 86 | * 87 | **************************************************************************/ 88 | 89 | #define NUM_SEGMENTS (16) 90 | #define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00ffffff) 91 | #define SEGMENT_NUMBER(a) (((unsigned int)(a) << 4) >> 28) 92 | #define SEGMENT_ADDR(num, off) (((num) << 24) + (off)) 93 | 94 | #ifndef NULL 95 | #define NULL 0 96 | #endif 97 | 98 | #endif /* !_MBI_H_ */ 99 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/os_internal.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /************************************************************************** 14 | * 15 | * $Revision: 1.18 $ 16 | * $Date: 1997/02/11 08:26:14 $ 17 | * $Source: /disk6/Master/cvsmdev2/PR/include/os_internal.h,v $ 18 | * 19 | **************************************************************************/ 20 | 21 | #ifndef _OS_INTERNAL_H_ 22 | #define _OS_INTERNAL_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 31 | 32 | /* Routines to get/fetch coprocessor 0 registers */ 33 | 34 | extern u32 __osGetCause(void); 35 | extern void __osSetCause(u32); 36 | extern u32 __osGetCompare(void); 37 | extern void __osSetCompare(u32); 38 | extern u32 __osGetConfig(void); 39 | extern void __osSetConfig(u32); 40 | extern void __osSetCount(u32); 41 | extern u32 __osGetSR(void); 42 | extern void __osSetSR(u32); 43 | extern u32 __osDisableInt(void); 44 | extern void __osRestoreInt(u32); 45 | 46 | /* Routines to get/set floating-point control and status register */ 47 | extern u32 __osSetFpcCsr(u32); 48 | extern u32 __osGetFpcCsr(void); 49 | 50 | /* Routine for HW interrupt "handler" */ 51 | extern void __osSetHWIntrRoutine(OSHWIntr, s32 (*handler)(void)); 52 | 53 | /* Routine for global interrupt mask */ 54 | extern void __osSetGlobalIntMask(OSHWIntr); 55 | extern void __osResetGlobalIntMask(OSHWIntr); 56 | 57 | /* Routine for global interrupt mask */ 58 | extern s32 __osLeoInterrupt(void); 59 | 60 | /* Routines for fetch TLB info */ 61 | 62 | extern u32 __osGetTLBASID(void); 63 | extern u32 __osGetTLBPageMask(s32); 64 | extern u32 __osGetTLBHi(s32); 65 | extern u32 __osGetTLBLo0(s32); 66 | extern u32 __osGetTLBLo1(s32); 67 | 68 | /* Serial interface (Si) */ 69 | 70 | extern u32 __osSiGetStatus(void); 71 | extern s32 __osSiRawWriteIo(u32, u32); 72 | extern s32 __osSiRawReadIo(u32, u32 *); 73 | extern s32 __osSiRawStartDma(s32, void *); 74 | 75 | /* Signal processor interface (Sp) */ 76 | 77 | extern u32 __osSpGetStatus(void); 78 | extern void __osSpSetStatus(u32); 79 | extern s32 __osSpSetPc(u32); 80 | extern s32 __osSpRawWriteIo(u32, u32); 81 | extern s32 __osSpRawReadIo(u32, u32 *); 82 | extern s32 __osSpRawStartDma(s32, u32, void *, u32); 83 | 84 | /* Error handling */ 85 | 86 | extern void __osError(s16, s16, ...); 87 | extern OSThread * __osGetCurrFaultedThread(void); 88 | extern OSThread * __osGetNextFaultedThread(OSThread *); 89 | 90 | /* Development board functions */ 91 | 92 | extern void __osGIOInit(s32); 93 | extern void __osGIOInterrupt(s32); 94 | extern void __osGIORawInterrupt(s32); 95 | 96 | /* For debugger use */ 97 | 98 | extern OSThread * __osGetActiveQueue(void); 99 | 100 | /* Debug port */ 101 | extern void __osSyncPutChars(int, int, const char *); 102 | extern int __osSyncGetChars(char *); 103 | extern void __osAsyncPutChars(int, int, const char *); 104 | extern int __osAsyncGetChars(char *); 105 | extern int __osAtomicInc(unsigned int *p); 106 | extern int __osAtomicDec(unsigned int *p); 107 | 108 | /* routine for rdb port */ 109 | extern u32 __osRdbSend(u8 *buf, u32 size, u32 type); 110 | 111 | 112 | #endif /* _LANGUAGE_C */ 113 | 114 | #ifdef _LANGUAGE_C_PLUS_PLUS 115 | } 116 | #endif 117 | 118 | #endif /* !_OS_INTERNAL_H */ 119 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/ramrom.h: -------------------------------------------------------------------------------- 1 | #ifndef _RAMROM_H 2 | #define _RAMROM_H 3 | 4 | /************************************************************************** 5 | * * 6 | * Copyright (C) 1994, Silicon Graphics, Inc. * 7 | * * 8 | * These coded instructions, statements, and computer programs contain * 9 | * unpublished proprietary information of Silicon Graphics, Inc., and * 10 | * are protected by Federal copyright law. They may not be disclosed * 11 | * to third parties or copied or duplicated in any form, in whole or * 12 | * in part, without the prior written consent of Silicon Graphics, Inc. * 13 | * * 14 | **************************************************************************/ 15 | 16 | /************************************************************************** 17 | * 18 | * $Revision: 1.20 $ 19 | * $Date: 1997/02/11 08:26:47 $ 20 | * $Source: /disk6/Master/cvsmdev2/PR/include/ramrom.h,v $ 21 | * 22 | **************************************************************************/ 23 | 24 | /* 25 | * Defines for the GIO card in the Nintendo Development Station 26 | * 27 | * The RAM on the GIO card acts as ROM for the game 28 | * Interrupts available between the game and the Indy host 29 | * 30 | * The last part of the ramrom is used for communication between 31 | * game and host. There are 6 4K buffers defined: 32 | * log, printf, rmon to indy, rmon from indy, app to indy, app from indy 33 | * The last 8 bytes of the buffer are used in the emulator environment 34 | */ 35 | 36 | #define RAMROM_SIZE (0x1000000) 37 | 38 | #define RAMROM_BUF_SIZE (4096) 39 | #define RAMROM_MSG_SIZE (RAMROM_BUF_SIZE*6) 40 | #define RAMROM_MSG_ADDR (RAMROM_SIZE - RAMROM_MSG_SIZE) 41 | #define RAMROM_MSG_HDR_SIZE (3*sizeof(long)) 42 | #define RAMROM_USER_DATA_SIZE (RAMROM_MSG_SIZE-RAMROM_MSG_HDR_SIZE) 43 | 44 | #define RAMROM_APP_READ_ADDR (RAMROM_MSG_ADDR + (0*RAMROM_BUF_SIZE)) 45 | #define RAMROM_APP_WRITE_ADDR (RAMROM_MSG_ADDR + (1*RAMROM_BUF_SIZE)) 46 | #define RAMROM_RMON_READ_ADDR (RAMROM_MSG_ADDR + (2*RAMROM_BUF_SIZE)) 47 | #define RAMROM_RMON_WRITE_ADDR (RAMROM_MSG_ADDR + (3*RAMROM_BUF_SIZE)) 48 | #define RAMROM_PRINTF_ADDR (RAMROM_MSG_ADDR + (4*RAMROM_BUF_SIZE)) 49 | #define RAMROM_LOG_ADDR (RAMROM_MSG_ADDR + (5*RAMROM_BUF_SIZE)) 50 | 51 | /*#define RAMROM_GIO_INTERRUPT (RAMROM_MSG_ADDR + RAMROM_MSG_SIZE - 4)*/ 52 | 53 | /* 54 | * For the initial round of PIF bringup, we will load in a bootstrap loader 55 | * 0x400 bytes into the ramrom, and the rom will be loaded at 0x2000 56 | */ 57 | #ifndef _HW_VERSION_1 58 | #define RAMROM_BOOTSTRAP_OFFSET 0x40 59 | #define RAMROM_GAME_OFFSET 0x1000 60 | #define RAMROM_FONTDATA_OFFSET 0xb70 61 | #define RAMROM_FONTDATA_SIZE 1152 62 | #else 63 | #define RAMROM_BOOTSTRAP_OFFSET 0x400 64 | #define RAMROM_GAME_OFFSET 0x2000 65 | #endif 66 | #define RAMROM_CLOCKRATE_OFFSET 0x4 67 | #define RAMROM_CLOCKRATE_MASK 0xfffffff0 68 | #define RAMROM_BOOTADDR_OFFSET 0x8 69 | #define RAMROM_RELEASE_OFFSET 0xc 70 | /* 71 | * Second version of the PIF jumps to location 0x1000, and we'll put a jump to 72 | * location 0x400 into the ramrom (for backwards compatibility). 73 | */ 74 | #define RAMROM_PIF2BOOTSTRAP_OFFSET 0x1000 75 | 76 | typedef struct { 77 | long type; 78 | long length; /* in bytes of userdata */ 79 | long magic; 80 | char userdata[RAMROM_USER_DATA_SIZE]; 81 | } RamRomBuffer; 82 | 83 | /* 84 | * Interrupt values (must fit in 6 bits!) 85 | * values are used for both request & response 86 | * Transactions initiated by the host start with HOST 87 | * and those initiated by the target start with GAME. 88 | */ 89 | 90 | #define HOST_PIACCESS_REQ 1 91 | #define HOST_DBG_CMD_READY 2 92 | #define GAME_DBG_DATA_SEND 3 93 | #define HOST_DBG_DATA_ACK 4 94 | #define GAME_PRINTF_SEND 5 95 | #define HOST_PRINTF_ACK 6 96 | #define GAME_LOG_SEND 7 97 | #define HOST_LOG_ACK 8 98 | #define HOST_APP_CMD_READY 9 99 | #define GAME_APP_DATA_READY 10 100 | #define HOST_PROF_REQ 11 101 | #define GAME_PROF_SEND 12 102 | #define HOST_PROF_ACK 13 103 | #define GAME_FAULT_SEND 14 104 | #define HOST_FAULT_ACK 15 105 | #define GAME_EXIT 16 106 | #define HOST_DATA_ACK 17 107 | 108 | #ifdef _EMULATOR 109 | void __RamRomInit(int key, void *romaddr); 110 | void __RamRomDestroy(int key); 111 | #endif /* _EMULATOR */ 112 | 113 | #endif /* !_RAMROM_H */ 114 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/rdb.h: -------------------------------------------------------------------------------- 1 | 2 | /************************************************************************** 3 | * 4 | * $Revision: 1.6 $ 5 | * $Date: 1997/02/11 08:29:31 $ 6 | * $Source: /disk6/Master/cvsmdev2/PR/include/rdb.h,v $ 7 | * 8 | **************************************************************************/ 9 | 10 | #ifndef _RDB_H 11 | #define _RDB_H 12 | 13 | /* U64 side address */ 14 | #define RDB_BASE_REG 0xc0000000 15 | #define RDB_WRITE_INTR_REG (RDB_BASE_REG + 0x8) 16 | #define RDB_READ_INTR_REG (RDB_BASE_REG + 0xc) 17 | #define RDB_BASE_VIRTUAL_ADDR 0x80000000 18 | 19 | /* packet type Have six bits, so can have up to 63 types */ 20 | #define RDB_TYPE_INVALID 0 21 | #define RDB_TYPE_GtoH_PRINT 1 22 | #define RDB_TYPE_GtoH_FAULT 2 23 | #define RDB_TYPE_GtoH_LOG_CT 3 24 | #define RDB_TYPE_GtoH_LOG 4 25 | #define RDB_TYPE_GtoH_READY_FOR_DATA 5 26 | #define RDB_TYPE_GtoH_DATA_CT 6 27 | #define RDB_TYPE_GtoH_DATA 7 28 | #define RDB_TYPE_GtoH_DEBUG 8 29 | #define RDB_TYPE_GtoH_RAMROM 9 30 | #define RDB_TYPE_GtoH_DEBUG_DONE 10 31 | #define RDB_TYPE_GtoH_DEBUG_READY 11 32 | #define RDB_TYPE_GtoH_KDEBUG 12 33 | #define RDB_TYPE_GtoH_PROF_DATA 22 34 | 35 | 36 | #define RDB_TYPE_HtoG_LOG_DONE 13 37 | #define RDB_TYPE_HtoG_DEBUG 14 38 | #define RDB_TYPE_HtoG_DEBUG_CT 15 39 | #define RDB_TYPE_HtoG_DATA 16 40 | #define RDB_TYPE_HtoG_DATA_DONE 17 41 | #define RDB_TYPE_HtoG_REQ_RAMROM 18 42 | #define RDB_TYPE_HtoG_FREE_RAMROM 19 43 | #define RDB_TYPE_HtoG_KDEBUG 20 44 | #define RDB_TYPE_HtoG_PROF_SIGNAL 21 45 | 46 | 47 | #define RDB_PROF_ACK_SIG 1 48 | #define RDB_PROF_FLUSH_SIG 2 49 | #define PROF_BLOCK_SIZE 2048 50 | 51 | #define RDB_LOG_MAX_BLOCK_SIZE 0x8000 52 | #define RDB_DATA_MAX_BLOCK_SIZE 0x8000 53 | 54 | 55 | /* GIO side address */ 56 | #define GIO_RDB_BASE_REG 0xbf480000 57 | #define GIO_RDB_WRITE_INTR_REG (GIO_RDB_BASE_REG + 0x8) 58 | #define GIO_RDB_READ_INTR_REG (GIO_RDB_BASE_REG + 0xc) 59 | 60 | /* minor device number */ 61 | #define GIO_RDB_PRINT_MINOR 1 62 | #define GIO_RDB_DEBUG_MINOR 2 63 | 64 | /* interrupt bit */ 65 | #define GIO_RDB_WRITE_INTR_BIT 0x80000000 66 | #define GIO_RDB_READ_INTR_BIT 0x40000000 67 | 68 | /* debug command */ 69 | #define DEBUG_COMMAND_NULL 0 70 | #define DEBUG_COMMAND_MEMORY 1 71 | #define DEBUG_COMMAND_REGISTER 2 72 | #define DEBUG_COMMAND_INVALID 255 73 | 74 | /* debug state */ 75 | #define DEBUG_STATE_NULL 0 76 | #define DEBUG_STATE_RECEIVE 1 77 | #define DEBUG_STATE_INVALID 255 78 | 79 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 80 | 81 | /* Structure for debug port */ 82 | typedef struct { 83 | unsigned type : 6; /* 0: invalid, 1: print, 2: debug */ 84 | unsigned length : 2; /* 1, 2, or 3 */ 85 | char buf[3]; /* character buffer */ 86 | } rdbPacket; 87 | 88 | extern unsigned int __osRdbWriteOK; 89 | extern unsigned int __osRdbSendMessage; 90 | 91 | #endif /* _LANGUAGE_C */ 92 | 93 | #endif /* !_RDB_H */ 94 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/region.h: -------------------------------------------------------------------------------- 1 | 2 | /************************************************************************** 3 | * * 4 | * Copyright (C) 1994, Silicon Graphics, Inc. * 5 | * * 6 | * These coded instructions, statements, and computer programs contain * 7 | * unpublished proprietary information of Silicon Graphics, Inc., and * 8 | * are protected by Federal copyright law. They may not be disclosed * 9 | * to third parties or copied or duplicated in any form, in whole or * 10 | * in part, without the prior written consent of Silicon Graphics, Inc. * 11 | * * 12 | **************************************************************************/ 13 | 14 | /************************************************************************** 15 | * 16 | * Module: region.h 17 | * 18 | * $Revision: 1.8 $ 19 | * $Date: 1997/11/26 00:30:56 $ 20 | * $Author: mitu $ 21 | * $Source: /disk6/Master/cvsmdev2/PR/include/region.h,v $ 22 | * 23 | * Description: 24 | * This file contains macros and structure definitions for the region 25 | * library. 26 | * 27 | **************************************************************************/ 28 | 29 | 30 | #ifndef _REGION_H_ 31 | #define _REGION_H_ 32 | 33 | 34 | #ifdef _LANGUAGE_C_PLUS_PLUS 35 | extern "C" { 36 | #endif 37 | 38 | #include 39 | 40 | 41 | /*************************************** 42 | * 43 | * Global defines 44 | * 45 | */ 46 | /* Alignment sizes */ 47 | #define ALIGNSZ (sizeof(long long)) /* 8 bytes */ 48 | #define ALIGNOFFST (ALIGNSZ-1) 49 | 50 | /* size for storing index to free buffer */ 51 | #define BUF_CTRL_SIZE ALIGNSZ 52 | 53 | /* Max bufcount = 32K */ 54 | #define MAX_BUFCOUNT 0x8000 55 | /* code for last free buffer */ 56 | #define BUF_FREE_WO_NEXT 0x8000 57 | 58 | /* 59 | * Global defines for alignment size (default is 8-byte alignment) 60 | */ 61 | #define OS_RG_ALIGN_2B 2 /* 2 bytes = 16-bit alignment */ 62 | #define OS_RG_ALIGN_4B 4 /* 4 bytes = 32-bit alignment */ 63 | #define OS_RG_ALIGN_8B 8 /* 8 bytes = 64-bit alignment */ 64 | #define OS_RG_ALIGN_16B 16 /* 16 bytes = 128-bit alignment */ 65 | 66 | #define OS_RG_ALIGN_DEFAULT OS_RG_ALIGN_8B 67 | 68 | 69 | /*************************************** 70 | * 71 | * Macro definitions 72 | * 73 | */ 74 | 75 | /* Perform alignment on input 's' */ 76 | #define ALIGN(s, align) (((u32)(s) + ((align)-1)) & ~((align)-1)) 77 | 78 | 79 | /*************************************** 80 | * 81 | * Typedefs & structure definitions 82 | * 83 | */ 84 | /* 85 | * Structure for region header/control area 86 | */ 87 | typedef struct _Region_s { 88 | u8 *r_startBufferAddress; /* start address to data buffer */ 89 | u8 *r_endAddress; /* end address of region */ 90 | s32 r_bufferSize; /* size of buffers for this region */ 91 | s32 r_bufferCount; /* up to 32K entries; MSB is used for 92 | setting end-of-list/used */ 93 | u16 r_freeList; /* point to array index of first 94 | available memory buffer */ 95 | u16 r_alignSize; /* alignment size (# of bytes) */ 96 | } OSRegion; 97 | 98 | /* 99 | * Macro to simplify accessing region header structure 100 | */ 101 | #define RP(x) rp->r_##x 102 | 103 | 104 | /*************************************** 105 | * 106 | * Function prototypes 107 | * 108 | */ 109 | extern void *osCreateRegion(void *, u32, u32, u32); 110 | extern void *osMalloc(void *); 111 | extern void osFree(void *, void *); 112 | extern s32 osGetRegionBufCount(void *); 113 | extern s32 osGetRegionBufSize(void *); 114 | 115 | 116 | #ifdef _LANGUAGE_C_PLUS_PLUS 117 | } 118 | #endif 119 | 120 | 121 | #endif /* _REGION_H_ */ 122 | 123 | 124 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/rmon.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /************************************************************************** 14 | * 15 | * $Revision: 1.6 $ 16 | * $Date: 1997/02/11 08:30:08 $ 17 | * $Source: /disk6/Master/cvsmdev2/PR/include/rmon.h,v $ 18 | * 19 | **************************************************************************/ 20 | 21 | #ifndef _RMON_H_ 22 | #define _RMON_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | #define RMON_DBG_BUF_SIZE 2048 30 | #define RMON_STACKSIZE 0x1000 31 | 32 | extern void rmonMain( void * ); 33 | extern void rmonPrintf( const char *, ... ); 34 | 35 | #ifdef _LANGUAGE_C_PLUS_PLUS 36 | } 37 | #endif 38 | 39 | #endif /* !_OS_H */ 40 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/sched.h: -------------------------------------------------------------------------------- 1 | /*==================================================================== 2 | * sched.h 3 | * 4 | * Synopsis: 5 | * 6 | * Copyright 1993, Silicon Graphics, Inc. 7 | * All Rights Reserved. 8 | * 9 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 10 | * Inc.; the contents of this file may not be disclosed to third 11 | * parties, copied or duplicated in any form, in whole or in part, 12 | * without the prior written permission of Silicon Graphics, Inc. 13 | * 14 | * RESTRICTED RIGHTS LEGEND: 15 | * Use, duplication or disclosure by the Government is subject to 16 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 17 | * in Technical Data and Computer Software clause at DFARS 18 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 19 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 20 | * Copyright Laws of the United States. 21 | *====================================================================*/ 22 | 23 | /************************************************************************** 24 | * 25 | * $Revision: 1.7 $ 26 | * $Date: 1997/02/11 08:32:02 $ 27 | * $Source: /disk6/Master/cvsmdev2/PR/include/sched.h,v $ 28 | * 29 | **************************************************************************/ 30 | 31 | #ifndef __sched__ 32 | #define __sched__ 33 | 34 | #include 35 | 36 | #define OS_SC_STACKSIZE 0x2000 37 | 38 | #define OS_SC_RETRACE_MSG 1 39 | #define OS_SC_DONE_MSG 2 40 | #define OS_SC_RDP_DONE_MSG 3 41 | #define OS_SC_PRE_NMI_MSG 4 42 | #define OS_SC_LAST_MSG 4 /* this should have highest number */ 43 | #define OS_SC_MAX_MESGS 8 44 | 45 | typedef struct { 46 | short type; 47 | char misc[30]; 48 | } OSScMsg; 49 | 50 | typedef struct OSScTask_s { 51 | struct OSScTask_s *next; /* note: this must be first */ 52 | u32 state; 53 | u32 flags; 54 | void *framebuffer; /* used by graphics tasks */ 55 | 56 | OSTask list; 57 | OSMesgQueue *msgQ; 58 | OSMesg msg; 59 | #ifndef _FINALROM /* all #ifdef items should */ 60 | OSTime startTime; /* remain at the end!!, or */ 61 | OSTime totalTime; /* possible conflict if */ 62 | #endif /* FINALROM library used with */ 63 | } OSScTask; /* non FINALROM code */ 64 | 65 | /* 66 | * OSScTask flags: 67 | */ 68 | #define OS_SC_NEEDS_RDP 0x0001 /* uses the RDP */ 69 | #define OS_SC_NEEDS_RSP 0x0002 /* uses the RSP */ 70 | #define OS_SC_DRAM_DLIST 0x0004 /* SP & DP communicate through DRAM */ 71 | #define OS_SC_PARALLEL_TASK 0x0010 /* must be first gfx task on list */ 72 | #define OS_SC_LAST_TASK 0x0020 /* last task in queue for frame */ 73 | #define OS_SC_SWAPBUFFER 0x0040 /* swapbuffers when gfx task done */ 74 | 75 | #define OS_SC_RCP_MASK 0x0003 /* mask for needs bits */ 76 | #define OS_SC_TYPE_MASK 0x0007 /* complete type mask */ 77 | /* 78 | * OSScClient: 79 | * 80 | * Data structure used by threads that wish to communicate to the 81 | * scheduling thread 82 | * 83 | */ 84 | typedef struct SCClient_s { 85 | struct SCClient_s *next; /* next client in the list */ 86 | OSMesgQueue *msgQ; /* where to send the frame msg */ 87 | } OSScClient; 88 | 89 | typedef struct { 90 | OSScMsg retraceMsg; 91 | OSScMsg prenmiMsg; 92 | OSMesgQueue interruptQ; 93 | OSMesg intBuf[OS_SC_MAX_MESGS]; 94 | OSMesgQueue cmdQ; 95 | OSMesg cmdMsgBuf[OS_SC_MAX_MESGS]; 96 | OSThread thread; 97 | OSScClient *clientList; 98 | OSScTask *audioListHead; 99 | OSScTask *gfxListHead; 100 | OSScTask *audioListTail; 101 | OSScTask *gfxListTail; 102 | OSScTask *curRSPTask; 103 | OSScTask *curRDPTask; 104 | u32 frameCount; 105 | s32 doAudio; 106 | } OSSched; 107 | 108 | void osCreateScheduler(OSSched *s, void *stack, OSPri priority, 109 | u8 mode, u8 numFields); 110 | void osScAddClient(OSSched *s, OSScClient *c, OSMesgQueue *msgQ); 111 | void osScRemoveClient(OSSched *s, OSScClient *c); 112 | OSMesgQueue *osScGetCmdQ(OSSched *s); 113 | 114 | #endif 115 | 116 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/sp.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1994, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /************************************************************************** 14 | * 15 | * Sprite library include file 16 | * 17 | * $Revision: 1.15 $ 18 | * $Date: 1997/02/11 08:33:02 $ 19 | * $Source: /disk6/Master/cvsmdev2/PR/include/sp.h,v $ 20 | * 21 | **************************************************************************/ 22 | 23 | #ifndef _SP_H_ 24 | #define _SP_H_ 25 | 26 | #ifdef _LANGUAGE_C_PLUS_PLUS 27 | extern "C" { 28 | #endif 29 | 30 | #include 31 | #include 32 | 33 | struct bitmap { 34 | s16 width; /* Size across to draw in texels */ 35 | /* Done if width = 0 */ 36 | 37 | s16 width_img; /* Size across of bitmap in texels */ 38 | /* Done if width = 0 */ 39 | 40 | s16 s; /* Horizontal offset into bitmap */ 41 | /* if (s > width), then load only! */ 42 | 43 | s16 t; /* Vertical offset into base */ 44 | 45 | void *buf; /* Pointer to bitmap data */ 46 | /* Don't re-load if new buf */ 47 | /* is the same as the old one */ 48 | /* Skip if NULL */ 49 | 50 | s16 actualHeight; /* True Height of this bitmap piece */ 51 | 52 | s16 LUToffset; /* LUT base index */ 53 | }; 54 | 55 | typedef struct bitmap Bitmap; 56 | 57 | struct sprite { 58 | s16 x,y; /* Target position */ 59 | 60 | s16 width, height; /* Target size */ 61 | 62 | f32 scalex, scaley; /* Texel to Pixel scale factor */ 63 | 64 | s16 expx, expy; /* Explosion spacing */ 65 | 66 | u16 attr; /* Attribute Flags */ 67 | s16 zdepth; /* Z Depth */ 68 | 69 | u8 red; /* Red component */ 70 | u8 green; /* Green component */ 71 | u8 blue; /* Blue component */ 72 | u8 alpha; /* Alpha component */ 73 | 74 | s16 startTLUT; /* Lookup Table Entry Starting index */ 75 | s16 nTLUT; /* Total number of Lookup Table Entries */ 76 | 77 | int *LUT; /* Pointer to Lookup Table */ 78 | 79 | s16 istart; /* Starting bitmap index */ 80 | s16 istep; /* Bitmaps index step (see SP_INCY) */ 81 | /* if 0, then variable width bitmaps */ 82 | 83 | s16 nbitmaps; /* Total number of bitmaps */ 84 | s16 ndisplist; /* Total number of display-list words */ 85 | 86 | s16 bmheight; /* Bitmap Texel height (Used) */ 87 | s16 bmHreal; /* Bitmap Texel height (Real) */ 88 | u8 bmfmt; /* Bitmap Format */ 89 | u8 bmsiz; /* Bitmap Texel Size */ 90 | 91 | Bitmap *bitmap; /* Pointer to first bitmap */ 92 | 93 | Gfx *rsp_dl; /* Pointer to RSP display list */ 94 | 95 | Gfx *rsp_dl_next; /* Pointer to next RSP display entry */ 96 | 97 | s16 frac_s, /* Fractional Texture offsets */ 98 | frac_t; /* These have 5 fraction bits */ 99 | }; 100 | 101 | typedef struct sprite Sprite; 102 | 103 | /* 104 | * DANGER! 105 | * This is bad programming. Where the *heck* do these numbers come 106 | * from? 107 | * 108 | * They are obviously 'maximums' from the sprite library, but since 109 | * the sprite library is built on top of gbi.h, which includes macros 110 | * that decode into multiple macros, etc., it is nearly impossible to 111 | * know what these maximums should be. 112 | * 113 | * Worse, there are some gbi macros (texture alignment mostly) that 114 | * decode into *many* macros, so if we choose that as a maximum, we 115 | * are wasting TONS of space... 116 | * 117 | * These numbers work for "reasonable" sprite library usage, and 118 | * there is an assert() in the library to detect when they aren't 119 | * enough. (use the debug version) 120 | */ 121 | #define DL_BM_OVERHEAD (12) 122 | #define DL_SPRITE_OVERHEAD (24) 123 | 124 | #define NUM_DL(nb) ((nb)*DL_BM_OVERHEAD +DL_SPRITE_OVERHEAD) 125 | 126 | /* 127 | * Misc constants 128 | */ 129 | 130 | #ifndef NULL 131 | #define NULL 0 132 | #endif 133 | 134 | #ifndef TRUE 135 | #define TRUE 1 136 | #endif 137 | 138 | #ifndef FALSE 139 | #define FALSE 0 140 | #endif 141 | 142 | /* 143 | * For sprite->attr 144 | */ 145 | 146 | #define SP_TRANSPARENT 0x00000001 147 | #define SP_CUTOUT 0x00000002 148 | #define SP_HIDDEN 0x00000004 149 | #define SP_Z 0x00000008 150 | #define SP_SCALE 0x00000010 151 | #define SP_FASTCOPY 0x00000020 152 | #define SP_OVERLAP 0x00000040 153 | #define SP_TEXSHIFT 0x00000080 154 | #define SP_FRACPOS 0x00000100 155 | #define SP_TEXSHUF 0x00000200 156 | #define SP_EXTERN 0x00000400 157 | 158 | /* 159 | * Function prototypes 160 | */ 161 | 162 | void spSetAttribute (Sprite *sp, s32 attr); 163 | void spClearAttribute (Sprite *sp, s32 attr); 164 | void spMove (Sprite *sp, s32 x, s32 y); 165 | void spScale (Sprite *sp, f32 sx, f32 sy); 166 | void spSetZ (Sprite *sp, s32 z ); 167 | void spColor (Sprite *sp, u8 red, u8 green, u8 blue, u8 alpha); 168 | Gfx *spDraw (Sprite *sp); 169 | void spInit( Gfx **glistp ); 170 | void spScissor( s32 xmin, s32 xmax, s32 ymin, s32 ymax ); 171 | void spFinish( Gfx **glistp ); 172 | 173 | #ifdef _LANGUAGE_C_PLUS_PLUS 174 | } 175 | #endif 176 | 177 | #endif /* _SP_H_ */ 178 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/sptask.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | 13 | /************************************************************************** 14 | * 15 | * $Revision: 1.8 $ 16 | * $Date: 1997/11/10 10:48:35 $ 17 | * $Source: /disk6/Master/cvsmdev2/PR/include/sptask.h,v $ 18 | * 19 | **************************************************************************/ 20 | 21 | #ifndef _SPTASK_H_ 22 | #define _SPTASK_H_ 23 | 24 | #ifdef _LANGUAGE_C_PLUS_PLUS 25 | extern "C" { 26 | #endif 27 | 28 | #include 29 | 30 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 31 | 32 | /************************************************************************** 33 | * 34 | * Type definitions 35 | * 36 | */ 37 | 38 | /* 39 | * Task List Structure. 40 | * 41 | * Things an app might pass to the SP via the task list. 42 | * Not every task ucode would need/use every field, but 43 | * 44 | * - type (audio, gfx, video, ...) 45 | * - flags 46 | * - wait for DP to drain before running new task 47 | * - SEE BIT DEFINITIONS UNDER "Task Flags field" 48 | * - pointer to boot ucode 49 | * - size of boot ucode 50 | * - pointer to ucode 51 | * - size of ucode 52 | * - pointer to initial DMEM data 53 | * - size of initial DMEM data 54 | * - pointer to DRAM stack 55 | * - size of DRAM stack (max) 56 | * - pointer to output buffer 57 | * - pointer to store output buffer length 58 | * - generic data pointer (for display list, etc.) 59 | * - generic data length (for display list, etc.) 60 | * - pointer to buffer where to store saved DMEM (in yield case) 61 | * - size of buffer to store saved DMEM. 62 | * 63 | * IMPORTANT!!! Watch alignment issues. 64 | * 65 | * IMPORTANT!!! Watch data cache issues. The RCP may write data into the 66 | * dram_stack, output_buff, output_buff_size, and the yield_data_ptr areas. 67 | * These buffers should be cache aligned and use the entire line (16 bytes) to 68 | * avoid corruption by writebacks by the CPU (cache tearing). 69 | * 70 | * IMPORTANT!!! all addresses are virtual addresses. Library does 71 | * any necessary translation. 72 | * 73 | */ 74 | typedef struct { 75 | u32 type; 76 | u32 flags; 77 | 78 | u64 *ucode_boot; 79 | u32 ucode_boot_size; 80 | 81 | u64 *ucode; 82 | u32 ucode_size; 83 | 84 | u64 *ucode_data; 85 | u32 ucode_data_size; 86 | 87 | u64 *dram_stack; 88 | u32 dram_stack_size; 89 | 90 | u64 *output_buff; 91 | u64 *output_buff_size; 92 | 93 | u64 *data_ptr; 94 | u32 data_size; 95 | 96 | u64 *yield_data_ptr; 97 | u32 yield_data_size; 98 | 99 | } OSTask_t; 100 | 101 | typedef union { 102 | OSTask_t t; 103 | long long int force_structure_alignment; 104 | } OSTask; 105 | 106 | typedef u32 OSYieldResult; 107 | 108 | #endif /* _LANGUAGE_C */ 109 | 110 | #ifdef _LANGUAGE_ASSEMBLY 111 | 112 | /* 113 | * For the RSP ucode: 114 | * offsets into the task structure 115 | */ 116 | 117 | #include 118 | 119 | #endif 120 | 121 | /* 122 | * Task Flags field 123 | */ 124 | #define OS_TASK_YIELDED 0x0001 125 | #define OS_TASK_DP_WAIT 0x0002 126 | #define OS_TASK_LOADABLE 0x0004 127 | #define OS_TASK_SP_ONLY 0x0008 128 | #define OS_TASK_USR0 0x0010 129 | #define OS_TASK_USR1 0x0020 130 | #define OS_TASK_USR2 0x0040 131 | #define OS_TASK_USR3 0x0080 132 | 133 | /* 134 | * Size of Yield buffer. The taskHdrPtr->t.yield_data_ptr must point to a 135 | * buffer of this size. (The size is in bytes). ONLY If the task will NEVER 136 | * yield it may be a null pointer. The buffer must be aligned to a 64 bit 137 | * boundary. The taskHdrPtr->t.yield_data_ptr must be set to point to the 138 | * buffer BEFORE the task is started. 139 | */ 140 | #if (defined(F3DEX_GBI)||defined(F3DLP_GBI)) 141 | #define OS_YIELD_DATA_SIZE 0xc00 142 | #else 143 | #define OS_YIELD_DATA_SIZE 0x900 144 | #endif 145 | #define OS_YIELD_AUDIO_SIZE 0x400 146 | 147 | /************************************************************************** 148 | * 149 | * Global definitions 150 | * 151 | */ 152 | 153 | 154 | 155 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 156 | 157 | /************************************************************************** 158 | * 159 | * Macro definitions 160 | * 161 | */ 162 | 163 | /* 164 | * this macro simulates atomic action. 165 | */ 166 | #define osSpTaskStart(tp) \ 167 | { \ 168 | osSpTaskLoad((tp)); \ 169 | osSpTaskStartGo((tp)); \ 170 | } 171 | 172 | 173 | /************************************************************************** 174 | * 175 | * Extern variables 176 | * 177 | */ 178 | 179 | 180 | /************************************************************************** 181 | * 182 | * Function prototypes 183 | * 184 | */ 185 | 186 | /* 187 | * break this up into two steps for debugging. 188 | */ 189 | extern void osSpTaskLoad(OSTask *tp); 190 | extern void osSpTaskStartGo(OSTask *tp); 191 | 192 | extern void osSpTaskYield(void); 193 | extern OSYieldResult osSpTaskYielded(OSTask *tp); 194 | 195 | #endif /* _LANGUAGE_C */ 196 | 197 | #ifdef _LANGUAGE_C_PLUS_PLUS 198 | } 199 | #endif 200 | 201 | #endif /* !_SPTASK_H */ 202 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/ultraerror.h: -------------------------------------------------------------------------------- 1 | /*==================================================================== 2 | * ultraerror.h 3 | * 4 | * Copyright 1995, Silicon Graphics, Inc. 5 | * All Rights Reserved. 6 | * 7 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 8 | * Inc.; the contents of this file may not be disclosed to third 9 | * parties, copied or duplicated in any form, in whole or in part, 10 | * without the prior written permission of Silicon Graphics, Inc. 11 | * 12 | * RESTRICTED RIGHTS LEGEND: 13 | * Use, duplication or disclosure by the Government is subject to 14 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 15 | * in Technical Data and Computer Software clause at DFARS 16 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 17 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 18 | * Copyright Laws of the United States. 19 | *====================================================================*/ 20 | 21 | /************************************************************************** 22 | * 23 | * $Revision: 1.23 $ 24 | * $Date: 1997/02/11 08:38:08 $ 25 | * $Source: /disk6/Master/cvsmdev2/PR/include/ultraerror.h,v $ 26 | * 27 | **************************************************************************/ 28 | 29 | #ifndef __ULTRAERROR_H__ 30 | #define __ULTRAERROR_H__ 31 | 32 | #ifdef _LANGUAGE_C_PLUS_PLUS 33 | extern "C" { 34 | #endif 35 | 36 | #include 37 | 38 | #define OS_ERROR_FMT "/usr/lib/PR/error.fmt" 39 | #define OS_ERROR_MAGIC 0x6b617479 40 | 41 | /* OS error codes */ 42 | 43 | #define ERR_OSCREATETHREAD_SP 1 44 | #define ERR_OSCREATETHREAD_PRI 2 45 | #define ERR_OSSTARTTHREAD 3 46 | #define ERR_OSSETTHREADPRI 4 47 | #define ERR_OSCREATEMESGQUEUE 5 48 | #define ERR_OSSENDMESG 6 49 | #define ERR_OSJAMMESG 7 50 | #define ERR_OSRECVMESG 8 51 | #define ERR_OSSETEVENTMESG 9 52 | #define ERR_OSMAPTLB_INDEX 10 53 | #define ERR_OSMAPTLB_ASID 11 54 | #define ERR_OSUNMAPTLB 12 55 | #define ERR_OSSETTLBASID 13 56 | #define ERR_OSAISETFREQUENCY 14 57 | #define ERR_OSAISETNEXTBUFFER_ADDR 15 58 | #define ERR_OSAISETNEXTBUFFER_SIZE 16 59 | #define ERR_OSDPSETNEXTBUFFER_ADDR 17 60 | #define ERR_OSDPSETNEXTBUFFER_SIZE 18 61 | #define ERR_OSPIRAWREADIO 19 62 | #define ERR_OSPIRAWWRITEIO 20 63 | #define ERR_OSPIRAWSTARTDMA_DIR 21 64 | #define ERR_OSPIRAWSTARTDMA_DEVADDR 22 65 | #define ERR_OSPIRAWSTARTDMA_ADDR 23 66 | #define ERR_OSPIRAWSTARTDMA_SIZE 24 67 | #define ERR_OSPIRAWSTARTDMA_RANGE 25 68 | #define ERR_OSPIREADIO 26 69 | #define ERR_OSPIWRITEIO 27 70 | #define ERR_OSPISTARTDMA_PIMGR 28 71 | #define ERR_OSPISTARTDMA_PRI 29 72 | #define ERR_OSPISTARTDMA_DIR 30 73 | #define ERR_OSPISTARTDMA_DEVADDR 31 74 | #define ERR_OSPISTARTDMA_ADDR 32 75 | #define ERR_OSPISTARTDMA_SIZE 33 76 | #define ERR_OSPISTARTDMA_RANGE 34 77 | #define ERR_OSCREATEPIMANAGER 35 78 | #define ERR_OSVIGETCURRENTMODE 36 79 | #define ERR_OSVIGETCURRENTFRAMEBUFFER 37 80 | #define ERR_OSVIGETNEXTFRAMEBUFFER 38 81 | #define ERR_OSVISETXSCALE_VALUE 39 82 | #define ERR_OSVISETXSCALE_VIMGR 40 83 | #define ERR_OSVISETYSCALE_VALUE 41 84 | #define ERR_OSVISETYSCALE_VIMGR 42 85 | #define ERR_OSVISETSPECIAL_VALUE 43 86 | #define ERR_OSVISETSPECIAL_VIMGR 44 87 | #define ERR_OSVISETMODE 45 88 | #define ERR_OSVISETEVENT 46 89 | #define ERR_OSVISWAPBUFFER_ADDR 47 90 | #define ERR_OSVISWAPBUFFER_VIMGR 48 91 | #define ERR_OSCREATEVIMANAGER 49 92 | #define ERR_OSCREATEREGION_ALIGN 50 93 | #define ERR_OSCREATEREGION_SIZE 51 94 | #define ERR_OSMALLOC 52 95 | #define ERR_OSFREE_REGION 53 96 | #define ERR_OSFREE_ADDR 54 97 | #define ERR_OSGETREGIONBUFCOUNT 55 98 | #define ERR_OSGETREGIONBUFSIZE 56 99 | #define ERR_OSSPTASKLOAD_DRAM 57 100 | #define ERR_OSSPTASKLOAD_OUT 58 101 | #define ERR_OSSPTASKLOAD_OUTSIZE 59 102 | #define ERR_OSSPTASKLOAD_YIELD 60 103 | #define ERR_OSPROFILEINIT_STR 61 104 | #define ERR_OSPROFILEINIT_CNT 62 105 | #define ERR_OSPROFILEINIT_ALN 63 106 | #define ERR_OSPROFILEINIT_ORD 64 107 | #define ERR_OSPROFILEINIT_SIZ 65 108 | #define ERR_OSPROFILESTART_TIME 66 109 | #define ERR_OSPROFILESTART_FLAG 67 110 | #define ERR_OSPROFILESTOP_FLAG 68 111 | #define ERR_OSPROFILESTOP_TIMER 69 112 | #define ERR_OSREADHOST_ADDR 70 113 | #define ERR_OSREADHOST_SIZE 71 114 | #define ERR_OSWRITEHOST_ADDR 72 115 | #define ERR_OSWRITEHOST_SIZE 73 116 | #define ERR_OSGETTIME 74 117 | #define ERR_OSSETTIME 75 118 | #define ERR_OSSETTIMER 76 119 | #define ERR_OSSTOPTIMER 77 120 | #define ERR_ALSEQP_NO_SOUND 100 121 | #define ERR_ALSEQP_NO_VOICE 101 122 | #define ERR_ALSEQP_MAP_VOICE 102 123 | #define ERR_ALSEQP_OFF_VOICE 103 124 | #define ERR_ALSEQP_POLY_VOICE 104 125 | #define ERR_ALSNDP_NO_VOICE 105 126 | #define ERR_ALSYN_NO_UPDATE 106 127 | #define ERR_ALSNDPDEALLOCATE 107 128 | #define ERR_ALSNDPDELETE 108 129 | #define ERR_ALSNDPPLAY 109 130 | #define ERR_ALSNDPSETSOUND 110 131 | #define ERR_ALSNDPSETPRIORITY 111 132 | #define ERR_ALSNDPSETPAR 112 133 | #define ERR_ALBNKFNEW 113 134 | #define ERR_ALSEQNOTMIDI 114 135 | #define ERR_ALSEQNOTMIDI0 115 136 | #define ERR_ALSEQNUMTRACKS 116 137 | #define ERR_ALSEQTIME 117 138 | #define ERR_ALSEQTRACKHDR 118 139 | #define ERR_ALSEQSYSEX 119 140 | #define ERR_ALSEQMETA 120 141 | #define ERR_ALSEQPINVALIDPROG 121 142 | #define ERR_ALSEQPUNKNOWNMIDI 122 143 | #define ERR_ALSEQPUNMAP 123 144 | #define ERR_ALEVENTNOFREE 124 145 | #define ERR_ALHEAPNOFREE 125 146 | #define ERR_ALHEAPCORRUPT 126 147 | #define ERR_ALHEAPFIRSTBLOCK 127 148 | #define ERR_ALCSEQZEROSTATUS 128 149 | #define ERR_ALCSEQZEROVEL 129 150 | #define ERR_ALCSPVNOTFREE 130 151 | #define ERR_ALSEQOVERRUN 131 152 | #define ERR_OSAISETNEXTBUFFER_ENDADDR 132 153 | #define ERR_ALMODDELAYOVERFLOW 133 154 | 155 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 156 | typedef void (*OSErrorHandler)(s16, s16, ...); 157 | 158 | OSErrorHandler osSetErrorHandler(OSErrorHandler); 159 | #endif 160 | 161 | #ifdef _LANGUAGE_C_PLUS_PLUS 162 | } 163 | #endif 164 | 165 | #endif /* __ULTRAERROR_H__ */ 166 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/ultralog.h: -------------------------------------------------------------------------------- 1 | /*==================================================================== 2 | * ultralog.h 3 | * 4 | * Copyright 1995, Silicon Graphics, Inc. 5 | * All Rights Reserved. 6 | * 7 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 8 | * Inc.; the contents of this file may not be disclosed to third 9 | * parties, copied or duplicated in any form, in whole or in part, 10 | * without the prior written permission of Silicon Graphics, Inc. 11 | * 12 | * RESTRICTED RIGHTS LEGEND: 13 | * Use, duplication or disclosure by the Government is subject to 14 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 15 | * in Technical Data and Computer Software clause at DFARS 16 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 17 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 18 | * Copyright Laws of the United States. 19 | *====================================================================*/ 20 | 21 | /************************************************************************** 22 | * 23 | * $Revision: 1.6 $ 24 | * $Date: 1997/02/11 08:39:05 $ 25 | * $Source: /disk6/Master/cvsmdev2/PR/include/ultralog.h,v $ 26 | * 27 | **************************************************************************/ 28 | 29 | #ifndef __log__ 30 | #define __log__ 31 | 32 | #ifdef _LANGUAGE_C_PLUS_PLUS 33 | extern "C" { 34 | #endif 35 | 36 | #include 37 | 38 | #define OS_LOG_MAX_ARGS 16 39 | #define OS_LOG_MAGIC 0x20736a73 40 | #define OS_LOG_FLOAT(x) (*(int *) &(x)) 41 | #define OS_LOG_VERSION 1 42 | 43 | typedef struct { 44 | u32 magic; /* log identifier */ 45 | u32 len; /* length of log data + log structure */ 46 | u32 *base; /* starting addr array */ 47 | s32 startCount; /* read offset from dataBase */ 48 | s32 writeOffset; /* write offset from dataBase */ 49 | } OSLog; 50 | 51 | typedef struct { 52 | u32 magic; 53 | u32 timeStamp; 54 | u16 argCount; 55 | u16 eventID; 56 | } OSLogItem; 57 | 58 | typedef struct { 59 | u32 magic; /* log identifier */ 60 | u32 version; /* 1 */ 61 | } OSLogFileHdr; 62 | 63 | void osCreateLog(OSLog *log, u32 *base, s32 len); 64 | void osLogEvent(OSLog *log, s16 code, s16 numArgs, ...); 65 | void osFlushLog(OSLog *log); 66 | u32 osLogFloat(f32); 67 | 68 | extern void osDelay(int count); 69 | 70 | #ifdef _LANGUAGE_C_PLUS_PLUS 71 | } 72 | #endif 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/ultratypes.h: -------------------------------------------------------------------------------- 1 | #ifndef _ULTRATYPES_H_ 2 | #define _ULTRATYPES_H_ 3 | 4 | 5 | /************************************************************************** 6 | * * 7 | * Copyright (C) 1995, Silicon Graphics, Inc. * 8 | * * 9 | * These coded instructions, statements, and computer programs contain * 10 | * unpublished proprietary information of Silicon Graphics, Inc., and * 11 | * are protected by Federal copyright law. They may not be disclosed * 12 | * to third parties or copied or duplicated in any form, in whole or * 13 | * in part, without the prior written consent of Silicon Graphics, Inc. * 14 | * * 15 | **************************************************************************/ 16 | 17 | 18 | /************************************************************************* 19 | * 20 | * File: ultratypes.h 21 | * 22 | * This file contains various types used in Ultra64 interfaces. 23 | * 24 | * $Revision: 1.6 $ 25 | * $Date: 1997/12/17 04:02:06 $ 26 | * $Source: /disk6/Master/cvsmdev2/PR/include/ultratypes.h,v $ 27 | * 28 | **************************************************************************/ 29 | 30 | 31 | 32 | /********************************************************************** 33 | * General data types for R4300 34 | */ 35 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 36 | 37 | typedef unsigned char u8; /* unsigned 8-bit */ 38 | typedef unsigned short u16; /* unsigned 16-bit */ 39 | typedef unsigned long u32; /* unsigned 32-bit */ 40 | typedef unsigned long long u64; /* unsigned 64-bit */ 41 | 42 | typedef signed char s8; /* signed 8-bit */ 43 | typedef short s16; /* signed 16-bit */ 44 | typedef long s32; /* signed 32-bit */ 45 | typedef long long s64; /* signed 64-bit */ 46 | 47 | typedef volatile unsigned char vu8; /* unsigned 8-bit */ 48 | typedef volatile unsigned short vu16; /* unsigned 16-bit */ 49 | typedef volatile unsigned long vu32; /* unsigned 32-bit */ 50 | typedef volatile unsigned long long vu64; /* unsigned 64-bit */ 51 | 52 | typedef volatile signed char vs8; /* signed 8-bit */ 53 | typedef volatile short vs16; /* signed 16-bit */ 54 | typedef volatile long vs32; /* signed 32-bit */ 55 | typedef volatile long long vs64; /* signed 64-bit */ 56 | 57 | typedef float f32; /* single prec floating point */ 58 | typedef double f64; /* double prec floating point */ 59 | 60 | #if !defined(_SIZE_T) && !defined(_SIZE_T_) && !defined(_SIZE_T_DEF) 61 | #define _SIZE_T 62 | #define _SIZE_T_DEF /* exeGCC size_t define label */ 63 | #if (_MIPS_SZLONG == 32) 64 | typedef unsigned int size_t; 65 | #endif 66 | #if (_MIPS_SZLONG == 64) 67 | typedef unsigned long size_t; 68 | #endif 69 | #endif 70 | 71 | #endif /* _LANGUAGE_C */ 72 | 73 | 74 | /************************************************************************* 75 | * Common definitions 76 | */ 77 | #ifndef TRUE 78 | #define TRUE 1 79 | #endif 80 | 81 | #ifndef FALSE 82 | #define FALSE 0 83 | #endif 84 | 85 | #ifndef NULL 86 | #define NULL 0 87 | #endif 88 | 89 | #endif /* _ULTRATYPES_H_ */ 90 | 91 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/PR/uportals.h: -------------------------------------------------------------------------------- 1 | /*==================================================================== 2 | * uportals.h 3 | * 4 | * Copyright 1995, Silicon Graphics, Inc. 5 | * All Rights Reserved. 6 | * 7 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, 8 | * Inc.; the contents of this file may not be disclosed to third 9 | * parties, copied or duplicated in any form, in whole or in part, 10 | * without the prior written permission of Silicon Graphics, Inc. 11 | * 12 | * RESTRICTED RIGHTS LEGEND: 13 | * Use, duplication or disclosure by the Government is subject to 14 | * restrictions as set forth in subdivision (c)(1)(ii) of the Rights 15 | * in Technical Data and Computer Software clause at DFARS 16 | * 252.227-7013, and/or in similar or successor clauses in the FAR, 17 | * DOD or NASA FAR Supplement. Unpublished - rights reserved under the 18 | * Copyright Laws of the United States. 19 | *====================================================================*/ 20 | 21 | /************************************************************************** 22 | * 23 | * uportals.h - header file for the ultraportals library 24 | * 25 | * $Revision: 1.12 $ 26 | * $Date: 1997/02/11 08:40:49 $ 27 | * $Source: /disk6/Master/cvsmdev2/PR/include/uportals.h,v $ 28 | * 29 | **************************************************************************/ 30 | 31 | 32 | 33 | #ifndef __ULTRAPORTALS_H__ 34 | #define __ULTRAPORTALS_H__ 35 | 36 | #include 37 | #include "matrix.h" 38 | #include "vector.h" 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | #ifndef ENABLEPORTALS 45 | #define ENABLEPORTALS 46 | #endif 47 | 48 | #define UP_MAXPVERTS 16 /* max number of portal verts */ 49 | #define UP_MAXCELLS 50 /* max number of cells */ 50 | #define UP_CELLNL 32 /* max length of cell names */ 51 | #define UP_OBNL 32 /* max length of obejct names */ 52 | 53 | typedef struct 54 | { 55 | vec3 min, max; /* min and max pts of the box */ 56 | } upBox; 57 | 58 | typedef struct _upPortalData * _portalptr; 59 | typedef struct _upCellData * _cellptr; 60 | typedef struct _upObjectData * _objectptr; 61 | 62 | typedef struct _upPortalData 63 | { 64 | int numverts; /* number of verts in the portal*/ 65 | _cellptr attached_cell; /* cell on the 'other side' */ 66 | vec3 verts[UP_MAXPVERTS]; /* the actual vertices */ 67 | #ifdef MVTVIEW 68 | int mvt_id; /* if has mvt, this is the id */ 69 | #endif 70 | } upPortalData; 71 | 72 | typedef struct _upCellData 73 | { 74 | int numportals; /* number of portals */ 75 | int numobjects; /* number of objects */ 76 | int rendered; /* last frame number rendered */ 77 | _portalptr *portals; /* array for the actual portals */ 78 | _objectptr *objects; /* array for 'detail' objects */ 79 | upBox bbox; /* bounding box of the cell */ 80 | Gfx *dlist; /* associated display list */ 81 | char name[UP_CELLNL]; /* name of the cell */ 82 | float eyeheight; /* height to constrain eyept to */ 83 | int zone; /* current zone number */ 84 | } upCellData; 85 | 86 | typedef struct _upObjectData 87 | { 88 | int rendered; /* last frame number rendered */ 89 | upBox bbox; /* bounding box for the object */ 90 | Gfx *dlist; /* associated display list */ 91 | char name[UP_OBNL]; /* name of the object */ 92 | } upObjectData; 93 | 94 | typedef struct 95 | { 96 | int numcells; /* how many cells are there? */ 97 | upCellData cells[UP_MAXCELLS]; /* the actual cells */ 98 | Gfx *rootdlist; /* display list for all cells */ 99 | vec2 portalmin, portalmax; /* XY bbox used by upCheckCells */ 100 | float near, far; /* near, far clipping planes */ 101 | FMatrix viewmat; /* viewing matrix (world->eye) */ 102 | FMatrix projmat; /* proj matrix (eye->screen) */ 103 | FMatrix compmat; /* view * proj (world->screen) */ 104 | int portaldepth; /* depth of the portal stack */ 105 | int framecount; /* current frame number */ 106 | } upLocateData; 107 | 108 | /* 109 | * Functions: 110 | */ 111 | extern void upInit(); /* generated automatically by flt2walk */ 112 | extern Gfx *upAddVisibleCells(Gfx * glistp, vec3 eyept); 113 | extern void upTogglePortalBounds(); 114 | extern void upToggleScissorBox(); 115 | 116 | /* 117 | * Globals: 118 | */ 119 | extern upLocateData upLocator; /* also extern by test_portals.h */ 120 | 121 | /* 122 | * Macros: 123 | */ 124 | #define UP_HUGEVAL 3.40282347e+37 125 | #define PT_IN_BOX(p,box) ((p)[0] > (box).min[0] && (p)[0] < (box).max[0] &&\ 126 | (p)[1] > (box).min[1] && (p)[1] < (box).max[1] &&\ 127 | (p)[2] > (box).min[2] && (p)[2] < (box).max[2]) 128 | 129 | 130 | #ifdef __Cplusplus 131 | } 132 | #endif 133 | 134 | #endif 135 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/assert.h: -------------------------------------------------------------------------------- 1 | #ifndef __ASSERT_H__ 2 | #define __ASSERT_H__ 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | /************************************************************************** 7 | * * 8 | * Copyright (C) 1984, Silicon Graphics, Inc. * 9 | * * 10 | * These coded instructions, statements, and computer programs contain * 11 | * unpublished proprietary information of Silicon Graphics, Inc., and * 12 | * are protected by Federal copyright law. They may not be disclosed * 13 | * to third parties or copied or duplicated in any form, in whole or * 14 | * in part, without the prior written consent of Silicon Graphics, Inc. * 15 | * * 16 | **************************************************************************/ 17 | /* Copyright (c) 1984 AT&T */ 18 | /* All Rights Reserved */ 19 | 20 | /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ 21 | /* The copyright notice above does not evidence any */ 22 | /* actual or intended publication of such source code. */ 23 | 24 | #ident "$Revision: 1.17 $" 25 | 26 | /* ANSI C Notes: 27 | * 28 | * - THE IDENTIFIERS APPEARING OUTSIDE OF #ifdef __EXTENSIONS__ IN THIS 29 | * standard header ARE SPECIFIED BY ANSI! CONFORMANCE WILL BE ALTERED 30 | * IF ANY NEW IDENTIFIERS ARE ADDED TO THIS AREA UNLESS THEY ARE IN ANSI's 31 | * RESERVED NAMESPACE. (i.e., unless they are prefixed by __[a-z] or 32 | * _[A-Z]. For external objects, identifiers with the prefix _[a-z] 33 | * are also reserved.) 34 | */ 35 | 36 | #ifdef NDEBUG 37 | #undef assert 38 | #define assert(EX) ((void)0) 39 | 40 | #else 41 | 42 | extern void __assert(const char *, const char *, int); 43 | #ifdef __ANSI_CPP__ 44 | #define assert(EX) ((EX)?((void)0):__assert( # EX , __FILE__, __LINE__)) 45 | #else 46 | #define assert(EX) ((EX)?((void)0):__assert("EX", __FILE__, __LINE__)) 47 | #endif 48 | #endif /* NDEBUG */ 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* !__ASSERT_H__ */ 55 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/bstring.h: -------------------------------------------------------------------------------- 1 | #ifndef __BSTRING_H__ 2 | #define __BSTRING_H__ 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | /* 8 | * bstring(3C) -- byte string operations 9 | * 10 | * Copyright 1990, Silicon Graphics, Inc. 11 | * All Rights Reserved. 12 | * 13 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; 14 | * the contents of this file may not be disclosed to third parties, copied or 15 | * duplicated in any form, in whole or in part, without the prior written 16 | * permission of Silicon Graphics, Inc. 17 | * 18 | * RESTRICTED RIGHTS LEGEND: 19 | * Use, duplication or disclosure by the Government is subject to restrictions 20 | * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data 21 | * and Computer Software clause at DFARS 252.227-7013, and/or in similar or 22 | * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - 23 | * rights reserved under the Copyright Laws of the United States. 24 | */ 25 | 26 | #ident "$Revision: 1.4 $" 27 | 28 | extern void bcopy(const void *, void *, int); 29 | extern int bcmp(const void *, const void *, int); 30 | extern void bzero(void *, int); 31 | extern void blkclr(void *, int); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | #endif /* !__BSTRING_H__ */ 37 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/make/PRdefs: -------------------------------------------------------------------------------- 1 | # 2 | # Commondefs for Project Reality source tree 3 | # 4 | # Makefiles which include this should first define PRDEPTH to be the relative 5 | # path from their parent directory. 6 | 7 | include $(ROOT)/usr/include/make/commondefs 8 | 9 | # 10 | # Use $(MAKE) $(MAKEARGS) instead of $(MAKEF) so that make -n works 11 | # This gets around the fact that $(MAKE) works and $(MAKEF) does not. 12 | # MAKEARGS is based directly on $(MAKEF) in commondefs. 13 | # 14 | MAKEARGS = VCFLAGS="$(VCFLAGS)" VFFLAGS="$(VFFLAGS)" \ 15 | VPFLAGS="$(VPFLAGS)" VMKDEPFLAGS="$(VMKDEPFLAGS)" 16 | 17 | # make sure 'default' does not hit these rules 18 | defaultrule: default 19 | 20 | # 21 | # Compile tree for RCP 1.0 or RCP 2.0 22 | # 23 | #GCDEFS = $(HW_FLAGS) 24 | #GCDEFS = $(HW_FLAGS) -B -Wab,-r4300_mul 25 | #ifdef __GCC__ 26 | GCDEFS = 27 | #else 28 | GCDEFS = $(HW_FLAGS) -Wab,-r4300_mul 29 | #endif 30 | 31 | # 32 | # VCS compiler options 33 | # 34 | VCSOPTS = $(GVCSOPTS) $(LVCSOPTS) $(VVCSOPTS) 35 | GVCSOPTS = +acc -V -M -Mupdate -Mmakep=pmake \ 36 | -CC "-mips2 -Wab,-big_got -Wab,-dwalign" -lgl -limage \ 37 | -P $(PRDEPTH)/rdpsim/pli/pli.tab $(ROOT)/usr/lib/PR/libpli.a 38 | 39 | SHELL = /bin/sh 40 | 41 | FLT2C = $(ROOT)/usr/sbin/flt2c 42 | IC = $(ROOT)/usr/sbin/ic 43 | #ifdef __GCC__ 44 | MAKEROM = $(GCCDIR)/mipse/bin/mild 45 | #else 46 | MAKEROM = $(ROOT)/usr/sbin/makerom 47 | #endif 48 | MIDIPARSE = $(ROOT)/usr/sbin/midiparse 49 | MIDICVT = $(ROOT)/usr/sbin/midicvt 50 | MIDICOMP = $(ROOT)/usr/sbin/midicomp 51 | SBC = $(ROOT)/usr/sbin/sbc 52 | NLD = $(ROOT)/usr/sbin/nld 53 | RGB2C = $(ROOT)/usr/sbin/rgb2c 54 | MKSPRITE = $(ROOT)/usr/sbin/mksprite 55 | MKISPRITE = $(ROOT)/usr/sbin/mkisprite 56 | TABLEDESIGN = $(ROOT)/usr/sbin/tabledesign 57 | VADPCM_ENC = $(ROOT)/usr/sbin/vadpcm_enc 58 | RSPASM = $(ROOT)/usr/sbin/rspasm 59 | BUILDTASK = $(ROOT)/usr/sbin/buildtask 60 | RSP2ELF = $(ROOT)/usr/sbin/rsp2elf 61 | 62 | DATA2RDRAM = $(PRDEPTH)/tools/data/data2rdram 63 | RDRAM2DATA = $(PRDEPTH)/tools/data/rdram2data 64 | TMEMFMT = $(PRDEPTH)/tools/tmemfmt/tmemfmt 65 | 66 | ECS2VL = $(PRDEPTH)/rdpsim/tools/ecs2vl 67 | ECSGEN = $(PRDEPTH)/rdpsim/tools/ecs_gen 68 | MERRG = $(PRDEPTH)/rdpsim/tools/merrg 69 | RMVCOM = $(PRDEPTH)/rdpsim/tools/remove_comments 70 | TAB2VMEM= $(PRDEPTH)/rdpsim/tools/tab2vmem 71 | TAB2WVS = $(PRDEPTH)/rdpsim/tools/tab2wvs 72 | VSIG = $(PRDEPTH)/rdpsim/tools/vsig 73 | XNET = $(PRDEPTH)/rdpsim/tools/xnet 74 | 75 | ASYIN = /ecad/ecs/ecs_2.4/bin/asyin 76 | MAKEINI = /ecad/ecs/ecs_2.4/bin/makeini 77 | 78 | VCSDIR = /ecad/vcs/vcs_2.2/sgi 79 | VCS = $(VCSDIR)/bin/vcs 80 | 81 | LOG_RESULT = \ 82 | @echo -n "!!! $(*:T) of" `basename \`pwd\``": "; \ 83 | grep "number of errors" $*.out 84 | 85 | LOG_ERROR = $(LOG_RESULT) 86 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/regdef.h: -------------------------------------------------------------------------------- 1 | #ifndef __REGDEF_H__ 2 | #define __REGDEF_H__ 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | /* 7 | * 8 | * Copyright 1992, Silicon Graphics, Inc. 9 | * All Rights Reserved. 10 | * 11 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; 12 | * the contents of this file may not be disclosed to third parties, copied or 13 | * duplicated in any form, in whole or in part, without the prior written 14 | * permission of Silicon Graphics, Inc. 15 | * 16 | * RESTRICTED RIGHTS LEGEND: 17 | * Use, duplication or disclosure by the Government is subject to restrictions 18 | * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data 19 | * and Computer Software clause at DFARS 252.227-7013, and/or in similar or 20 | * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - 21 | * rights reserved under the Copyright Laws of the United States. 22 | */ 23 | /* ------------------------------------------------------------------ */ 24 | /* | Copyright Unpublished, MIPS Computer Systems, Inc. All Rights | */ 25 | /* | Reserved. This software contains proprietary and confidential | */ 26 | /* | information of MIPS and its suppliers. Use, disclosure or | */ 27 | /* | reproduction is prohibited without the prior express written | */ 28 | /* | consent of MIPS. | */ 29 | /* ------------------------------------------------------------------ */ 30 | #ident "$Revision: 1.9 $" 31 | /* regdef.h 1.2 */ 32 | 33 | /* 34 | * Mips register definitions. 35 | */ 36 | 37 | #ifdef mips 38 | #include 39 | /*#include */ 40 | #endif /* mips */ 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif /* !__REGDEF_H__ */ 46 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/sgidefs.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1991-1992 Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | #ifndef __SGIDEFS_H__ 13 | #define __SGIDEFS_H__ 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #ident "$Revision: 1.5 $" 20 | 21 | /* 22 | * sgidefs.h - SGI/MIPS basic software generation system constants & types 23 | * 24 | * This file MUST be includable in any language 25 | * and in the 'C' case must be ANSI compliant 26 | * In particular this means NO long long ... 27 | * 28 | * Constants and types defined here are to support 29 | * multi-isa (instruction set architecture) coding 30 | * 31 | * Each catagory has a define that the compilation system will set 32 | * based on the environment the compile is initiated in. Programs 33 | * can test the define using the manifest constants defined here. 34 | * (e.g. #if (_MIPS_FPSET == 16) ) 35 | */ 36 | 37 | /* 38 | * Floating Point register set 39 | * Define: 40 | * _MIPS_FPSET 41 | * Can take on the values 16 or 32 42 | */ 43 | 44 | /* 45 | * Instruction Set Architecture 46 | * Define: 47 | * _MIPS_ISA 48 | */ 49 | #define _MIPS_ISA_MIPS1 1 /* R2/3K */ 50 | #define _MIPS_ISA_MIPS2 2 /* R4K/6K */ 51 | #define _MIPS_ISA_MIPS3 3 /* R4K */ 52 | #define _MIPS_ISA_MIPS4 4 /* TFP */ 53 | 54 | /* 55 | * Subprogram Interface Model 56 | * Define: 57 | * _MIPS_SIM 58 | */ 59 | #define _MIPS_SIM_ABI32 1 /* MIPS MSIG calling convention */ 60 | #define _MIPS_SIM_NABI32 2 /* MIPS new 32-bit abi */ 61 | /* NABI32 is 64bit calling convention but 32bit type sizes) */ 62 | #define _MIPS_SIM_ABI64 3 /* MIPS 64 calling convention */ 63 | 64 | /* 65 | * Data Types Sizes (C and C++) 66 | * Defines: 67 | * _MIPS_SZINT 68 | * _MIPS_SZLONG 69 | * _MIPS_SZPTR 70 | * 71 | * These can take on the values: 32, 64, 128 72 | */ 73 | 74 | /* 75 | * Compilation Environments 76 | * various compilers may offer a set of different compilation environments 77 | * each one will pre-define the above defines appropriately. 78 | * The MIPS ABI environment will pre-define the following: 79 | * (cc -systype=XXX) 80 | * 81 | * -D_MIPS_FPSET=16 -D_MIPS_ISA=_MIPS_ISA_MIPS1 82 | * -D_MIPS_SIM=_MIPS_SIM_ABI32 -D_MIPS_SZINT=32 83 | * -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32 84 | * 85 | * The new MIPS 32-bit ABI environment will pre-define the following 86 | * (cc -systype=XXX) 87 | * -D_MIPS_FPSET=32 -D_MIPS_ISA=_MIPS_ISA_MIPS3 88 | * -D_MIPS_SIM=_MIPS_SIM_NABI32 -D_MIPS_SZINT=32 89 | * -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32 90 | * 91 | * The MIPS 64 bit environment will pre-define the following 92 | * (cc -systype=XXX) 93 | * -D_MIPS_FPSET=32 -D_MIPS_ISA=_MIPS_ISA_MIPS3 94 | * -D_MIPS_SIM=_MIPS_SIM_ABI64 -D_MIPS_SZINT=32 95 | * -D_MIPS_SZLONG=64 -D_MIPS_SZPTR=64 96 | * 97 | */ 98 | 99 | /* 100 | * Language Specific 101 | * Type __psint_t - a pointer sized int - this can be used: 102 | * a) when casting a pointer so can perform e.g. a bit operation 103 | * b) as a return code for functions incorrectly typed as int but 104 | * return a pointer. 105 | * User level code can also use the ANSI std ptrdiff_t, defined in stddef.h 106 | * in place of __psint_t 107 | * Type __scint_t - a 'scaling' int - used when in fact one wants an 'int' 108 | * that scales when moving to say 64 bit. (e.g. byte counts, bit lens) 109 | */ 110 | 111 | #if (defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)) 112 | 113 | /* 114 | * assumes int is 32 - 115 | * otherwise there must be some other compiler basic type 116 | */ 117 | #if (_MIPS_SZINT != 32) 118 | #ifdef _MIPS_SZINT 119 | ERROR -- the macro "_MIPS_SZINT" is set to _MIPS_SZINT -- should be 32 120 | #else 121 | ERROR -- the macro "_MIPS_SZINT" is unset (currently, must be set to 32) 122 | #endif 123 | #endif 124 | 125 | typedef int __int32_t; 126 | typedef unsigned __uint32_t; 127 | 128 | #if (_MIPS_SZLONG == 64) 129 | 130 | typedef long __int64_t; 131 | typedef unsigned long __uint64_t; 132 | 133 | #else 134 | 135 | #if defined(_LONGLONG) 136 | 137 | typedef long long __int64_t; 138 | typedef unsigned long long __uint64_t; 139 | 140 | #else 141 | 142 | typedef struct { 143 | int hi32; 144 | int lo32; 145 | } __int64_t; 146 | typedef struct { 147 | unsigned int hi32; 148 | unsigned int lo32; 149 | } __uint64_t; 150 | 151 | #endif /* _LONGLONG */ 152 | 153 | #endif /* _MIPS_SZLONG */ 154 | 155 | #if (_MIPS_SZPTR == 32) 156 | typedef __int32_t __psint_t; 157 | typedef __uint32_t __psunsigned_t; 158 | #endif 159 | 160 | #if (_MIPS_SZPTR == 64) 161 | typedef __int64_t __psint_t; 162 | typedef __uint64_t __psunsigned_t; 163 | #endif 164 | 165 | /* 166 | * If any fundamental type is 64 bit, then set the scaling type 167 | * to 64 bit 168 | */ 169 | #if (_MIPS_SZPTR == 64) || (_MIPS_SZLONG == 64) || (_MIPS_SZINT == 64) 170 | 171 | /* there exists some large fundamental type */ 172 | typedef __int64_t __scint_t; 173 | typedef __uint64_t __scunsigned_t; 174 | 175 | #else 176 | 177 | /* a 32 bit world */ 178 | typedef __int32_t __scint_t; 179 | typedef __uint32_t __scunsigned_t; 180 | 181 | #endif 182 | 183 | #endif /* C || C++ */ 184 | 185 | #ifdef __cplusplus 186 | } 187 | #endif 188 | 189 | #endif /* !__SGIDEFS_H__ */ 190 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef STDARG_H 2 | #define STDARG_H 3 | 4 | // When not building with IDO, use the builtin vaarg macros for portability. 5 | #ifndef __sgi 6 | #define va_list __builtin_va_list 7 | #define va_start __builtin_va_start 8 | #define va_arg __builtin_va_arg 9 | #define va_end __builtin_va_end 10 | #else 11 | 12 | typedef char *va_list; 13 | #define _FP 1 14 | #define _INT 0 15 | #define _STRUCT 2 16 | 17 | #define _VA_FP_SAVE_AREA 0x10 18 | #define _VA_ALIGN(p, a) (((unsigned int)(((char *)p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4)) 19 | #define va_start(vp, parmN) (vp = ((va_list)&parmN + sizeof(parmN))) 20 | 21 | #define __va_stack_arg(list, mode) \ 22 | ( \ 23 | ((list) = (char *)_VA_ALIGN(list, __builtin_alignof(mode)) + \ 24 | _VA_ALIGN(sizeof(mode), 4)), \ 25 | (((char *)list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode)))) 26 | 27 | #define __va_double_arg(list, mode) \ 28 | ( \ 29 | (((long)list & 0x1) /* 1 byte aligned? */ \ 30 | ? (list = (char *)((long)list + 7), (char *)((long)list - 6 - _VA_FP_SAVE_AREA)) \ 31 | : (((long)list & 0x2) /* 2 byte aligned? */ \ 32 | ? (list = (char *)((long)list + 10), (char *)((long)list - 24 - _VA_FP_SAVE_AREA)) \ 33 | : __va_stack_arg(list, mode)))) 34 | 35 | #define va_arg(list, mode) ((mode *)(((__builtin_classof(mode) == _FP && \ 36 | __builtin_alignof(mode) == sizeof(double)) \ 37 | ? __va_double_arg(list, mode) \ 38 | : __va_stack_arg(list, mode))))[-1] 39 | #define va_end(__list) 40 | 41 | #endif 42 | #endif 43 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/stdlib.h: -------------------------------------------------------------------------------- 1 | #ifndef __STDLIB_H__ 2 | #define __STDLIB_H__ 3 | 4 | #ifndef NULL 5 | #define NULL 0 6 | #endif 7 | typedef struct lldiv_t 8 | { 9 | long long quot; 10 | long long rem; 11 | } lldiv_t; 12 | 13 | typedef struct ldiv_t 14 | { 15 | long quot; 16 | long rem; 17 | } ldiv_t; 18 | 19 | lldiv_t lldiv(long long num, long long denom); 20 | ldiv_t ldiv(long num, long denom); 21 | #endif /* !__STDLIB_H__ */ 22 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/string.h: -------------------------------------------------------------------------------- 1 | #ifndef __STRING_H__ 2 | #define __STRING_H__ 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | #ident "$Revision: 1.23 $" 7 | /* 8 | * 9 | * Copyright 1992, Silicon Graphics, Inc. 10 | * All Rights Reserved. 11 | * 12 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; 13 | * the contents of this file may not be disclosed to third parties, copied or 14 | * duplicated in any form, in whole or in part, without the prior written 15 | * permission of Silicon Graphics, Inc. 16 | * 17 | * RESTRICTED RIGHTS LEGEND: 18 | * Use, duplication or disclosure by the Government is subject to restrictions 19 | * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data 20 | * and Computer Software clause at DFARS 252.227-7013, and/or in similar or 21 | * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - 22 | * rights reserved under the Copyright Laws of the United States. 23 | */ 24 | /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 25 | /* Copyright (c) 1988 AT&T */ 26 | /* All Rights Reserved */ 27 | 28 | /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ 29 | /* UNIX System Laboratories, Inc. */ 30 | /* The copyright notice above does not evidence any */ 31 | /* actual or intended publication of such source code. */ 32 | 33 | 34 | #if !defined(_SIZE_T) && !defined(_SIZE_T_) 35 | #define _SIZE_T 36 | #if (_MIPS_SZLONG == 32) 37 | typedef unsigned int size_t; 38 | #endif 39 | #if (_MIPS_SZLONG == 64) 40 | typedef unsigned long size_t; 41 | #endif 42 | #endif 43 | 44 | #ifndef NULL 45 | #define NULL 0 46 | #endif 47 | 48 | extern void *memcpy(void *, const void *, size_t); 49 | extern char *strchr(const char *, int); 50 | extern size_t strlen(const char *); 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif /* !__STRING_H__ */ 56 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/sys/regdef.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1990-1992, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | **************************************************************************/ 12 | /* 13 | * Copyright 1985 by MIPS Computer Systems, Inc. 14 | */ 15 | #ifndef __SYS_REGDEF_H__ 16 | #define __SYS_REGDEF_H__ 17 | 18 | #ident "$Revision: 3.7 $" 19 | 20 | #include "sgidefs.h" 21 | 22 | #if (_MIPS_SIM == _MIPS_SIM_ABI32) 23 | #define zero $0 /* wired zero */ 24 | #define AT $at /* assembler temp */ 25 | #define v0 $2 /* return value */ 26 | #define v1 $3 27 | #define a0 $4 /* argument registers */ 28 | #define a1 $5 29 | #define a2 $6 30 | #define a3 $7 31 | #define t0 $8 /* caller saved */ 32 | #define t1 $9 33 | #define t2 $10 34 | #define t3 $11 35 | #define t4 $12 /* caller saved - 32 bit env arg reg 64 bit */ 36 | #define ta0 $12 /* caller saved in 32 bit - arg regs in 64 bit */ 37 | #define t5 $13 38 | #define ta1 $13 39 | #define t6 $14 40 | #define ta2 $14 41 | #define t7 $15 42 | #define ta3 $15 43 | #define s0 $16 /* callee saved */ 44 | #define s1 $17 45 | #define s2 $18 46 | #define s3 $19 47 | #define s4 $20 48 | #define s5 $21 49 | #define s6 $22 50 | #define s7 $23 51 | #define t8 $24 /* code generator */ 52 | #define t9 $25 53 | #define jp $25 /* PIC jump register */ 54 | #define k0 $26 /* kernel temporary */ 55 | #define k1 $27 56 | #define gp $28 /* global pointer */ 57 | #define sp $29 /* stack pointer */ 58 | #define fp $30 /* frame pointer */ 59 | #define s8 $30 /* calle saved */ 60 | #define ra $31 /* return address */ 61 | #endif 62 | 63 | #if (_MIPS_SIM == _MIPS_SIM_ABI64) 64 | #define zero $0 /* wired zero */ 65 | #define AT $at /* assembler temp */ 66 | #define v0 $2 /* return value - caller saved */ 67 | #define v1 $3 68 | #define a0 $4 /* argument registers */ 69 | #define a1 $5 70 | #define a2 $6 71 | #define a3 $7 72 | #define a4 $8 /* arg reg 64 bit; caller saved in 32 bit */ 73 | #define ta0 $8 74 | #define a5 $9 75 | #define ta1 $9 76 | #define a6 $10 77 | #define ta2 $10 78 | #define a7 $11 79 | #define ta3 $11 80 | #define t0 $12 /* caller saved */ 81 | #define t1 $13 82 | #define t2 $14 83 | #define t3 $15 84 | #define s0 $16 /* callee saved */ 85 | #define s1 $17 86 | #define s2 $18 87 | #define s3 $19 88 | #define s4 $20 89 | #define s5 $21 90 | #define s6 $22 91 | #define s7 $23 92 | #define t8 $24 /* caller saved */ 93 | #define t9 $25 /* callee address for PIC/temp */ 94 | #define jp $25 /* PIC jump register */ 95 | #define k0 $26 /* kernel temporary */ 96 | #define k1 $27 97 | #define gp $28 /* global pointer - caller saved for PIC */ 98 | #define sp $29 /* stack pointer */ 99 | #define fp $30 /* frame pointer */ 100 | #define s8 $30 /* callee saved */ 101 | #define ra $31 /* return address */ 102 | #endif 103 | 104 | #endif /* __SYS_REGDEF_H__ */ 105 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/sys/u64driver.h: -------------------------------------------------------------------------------- 1 | #ifndef __SYS_U64DRIVER_H__ 2 | #define __SYS_U64DRIVER_H__ 3 | 4 | /* 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; 9 | * the contents of this file may not be disclosed to third parties, copied or 10 | * duplicated in any form, in whole or in part, without the prior written 11 | * permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to restrictions 15 | * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data 16 | * and Computer Software clause at DFARS 252.227-7013, and/or in similar or 17 | * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - 18 | * rights reserved under the Copyright Laws of the United States. 19 | * 20 | */ 21 | 22 | #include 23 | #include 24 | #include "u64gio.h" 25 | 26 | 27 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 28 | 29 | 30 | #define U64_MINOR_PRINT 1 31 | #define U64_MINOR_DEBUG 2 32 | #define U64_MINOR_LOGGING 3 33 | #define U64_MINOR_DATA 4 34 | #define U64_MINOR_FAULT 5 35 | #define U64_MINOR_KDEBUG 6 36 | #define U64_MINOR_PROFILE 7 37 | #define NUMBER_MINORS 8 /* don't use minor zero , but must count 0-7 */ 38 | 39 | #define U64_MINOR_PRINT_BUF_SIZE 0x80000 /* buffer used by incoming printf data */ 40 | #define U64_MINOR_DEBUG_BUF_SIZE 0x4000 41 | #define U64_MINOR_LOGGING_BUF_SIZE RDB_LOG_MAX_BLOCK_SIZE /* buffer used by incoming logging data */ 42 | #define U64_MINOR_DATA_BUF_SIZE RDB_DATA_MAX_BLOCK_SIZE /* buffer used by incoming data */ 43 | #define U64_MINOR_FAULT_BUF_SIZE 1024 /* buffer used for incoming fault data */ 44 | #define U64_MINOR_KDEBUG_BUF_SIZE 1024 /* buffer used for incoming kdebug data */ 45 | #define U64_MINOR_PROFILE_BUF_SIZE 2048 /* buffer used for incoming profile data */ 46 | #define U64_MINOR_PROFILE_SEND_BUF_SIZE 16 /* only send one byte messages */ 47 | #define U64_INTERNAL_WRITE_BUF_SIZE 0x8000 /* buffer used to store packets waiting to go out */ 48 | 49 | 50 | 51 | #define u64_increment_Qptr(x) { ((x) = ((x) + 1) & 0xff) ; } 52 | 53 | 54 | typedef struct { 55 | sema_t minor_sema; /* used to allow only one app to open the minor */ 56 | sema_t read_sema; /* used to block while waiting for data */ 57 | sema_t write_sema; /* only allow one entry to write at a time */ 58 | int read_count; /* the number of bytes waiting to be read */ 59 | int write_count; /* the number of bytes waiting to be written */ 60 | int read_cur_write; 61 | int write_cur_write; 62 | int read_cur_read; 63 | int write_cur_read; 64 | unsigned char *read_buf; 65 | unsigned char *write_buf; 66 | int read_buf_size; /* measured in unsigned char's */ 67 | int write_buf_size; /* measured in unsigned char's */ 68 | int incoming_ct; /* used by minors that receive data from game */ 69 | /* indicates how many bytes left in block */ 70 | /* before signaling game that transfer is done */ 71 | /* used by logging and game to host data stuff */ 72 | int message; /* when not zero, send this message to game to */ 73 | /* indicate that data or log data has been read */ 74 | struct pollhead *phead; 75 | } u64_minor; 76 | 77 | /* 78 | * Our private one-per-board data structure 79 | * The user can't get at any of this 80 | */ 81 | struct u64_data { 82 | 83 | volatile struct u64_board *board; 84 | unsigned char *memaddr; /* 16/32 bit access R/W */ 85 | 86 | /* 87 | * Only one client may be in the kernel at a time; this semaphore is used 88 | * to prevent multiple clients from overrunning each other's interactions 89 | * with the hardware. 90 | */ 91 | sema_t ioctl_sema; 92 | 93 | /* 94 | * The ramrom_sema is used by the driver so that it can arbitrate for the 95 | * control of ramrom with the game, and sleep while waiting for the game 96 | * to respond. 97 | */ 98 | sema_t ramrom_sema; 99 | 100 | /* 101 | * Allocate a megabyte buffer which we can use when reading/writing data 102 | * to or from the board (we can't copyin/copyout directly from the user's 103 | * buffer, because those routines use 64 bit transfers). 104 | */ 105 | unsigned int *oneMeg; 106 | 107 | union { 108 | u64_write_arg_t u64_write; /* WRITE, SAFE_WRITE */ 109 | u64_read_arg_t u64_read; /* READ, SAFE_READ */ 110 | } args; 111 | 112 | /* rdb port */ 113 | unsigned int *write_buf; 114 | unsigned int write_buf_cur_write; 115 | unsigned int write_buf_cur_read; 116 | unsigned int write_buf_ct; /* number of packets waiting for transmission */ 117 | unsigned int write_buf_size; /* measured in rdbPackets */ 118 | sema_t write_buf_sema; 119 | u64_minor minors[NUMBER_MINORS]; 120 | 121 | }; 122 | 123 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 124 | 125 | #endif /* __SYS_U64DRIVER_H__ */ 126 | 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/sys/u64gio.h: -------------------------------------------------------------------------------- 1 | #ifndef __SYS_U64GIO_H__ 2 | #define __SYS_U64GIO_H__ 3 | 4 | /* 5 | * Copyright 1995, Silicon Graphics, Inc. 6 | * All Rights Reserved. 7 | * 8 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; 9 | * the contents of this file may not be disclosed to third parties, copied or 10 | * duplicated in any form, in whole or in part, without the prior written 11 | * permission of Silicon Graphics, Inc. 12 | * 13 | * RESTRICTED RIGHTS LEGEND: 14 | * Use, duplication or disclosure by the Government is subject to restrictions 15 | * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data 16 | * and Computer Software clause at DFARS 252.227-7013, and/or in similar or 17 | * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - 18 | * rights reserved under the Copyright Laws of the United States. 19 | * 20 | */ 21 | 22 | #define DEV_U64 "/dev/u64" 23 | #define DEV_U64_PRINT "/dev/u64_print" 24 | #define DEV_U64_DEBUG "/dev/u64_debug" 25 | #define DEV_U64_LOG "/dev/u64_logging" 26 | #define DEV_U64_DATA "/dev/u64_data" 27 | #define DEV_U64_FAULT "/dev/u64_fault" 28 | #define DEV_U64_KDEBUG "/dev/u64_kdebug" 29 | #define DEV_U64_PROFILE "/dev/u64_profile" 30 | /* 31 | * ioctls 32 | */ 33 | #define U64IOC ('u'<<24|'6'<<16) 34 | #define U64IOCTL(x) (U64IOC|x) 35 | 36 | #define U64_RESET U64IOCTL(1) /* arg: 0 - deassert, 1 - assert */ 37 | #define U64_WRITE U64IOCTL(2) 38 | #define U64_READ U64IOCTL(3) 39 | #define U64_SAFE_WRITE U64IOCTL(4) 40 | #define U64_SAFE_READ U64IOCTL(5) 41 | #define U64_LISTEN U64IOCTL(6) /* arg is register value for listen */ 42 | #define U64_SIGNAL U64IOCTL(7) /* arg is register value for signal */ 43 | 44 | #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) 45 | 46 | /* structure for WRITE & SAFE_WRITE*/ 47 | typedef struct u64_write_arg { 48 | void *buffer; 49 | long ramrom_addr; 50 | int nbytes; 51 | } u64_write_arg_t; 52 | 53 | /* structure for READ & SAFE_READ */ 54 | typedef struct u64_read_arg { 55 | void *buffer; 56 | long ramrom_addr; 57 | int nbytes; 58 | } u64_read_arg_t; 59 | 60 | /* NOTE: if game is in reset, don't interrupt the game */ 61 | 62 | struct u64_board { 63 | volatile unsigned int product_id_reg; /* bf400000, read only */ 64 | unsigned char fill_0[0x3fc]; 65 | volatile unsigned int reset_control; /* bf400400, write only */ 66 | unsigned char fill_1[0x3fc]; 67 | volatile unsigned int cart_interrupt; /* bf400800, read/write */ 68 | unsigned char fill_3[0x1fc]; 69 | volatile unsigned int dram_page_cntrl;/* bf400a00, read/write */ 70 | unsigned char fill_2[0x1fc]; 71 | volatile unsigned int gio_interrupt; /* bf400c00, read only */ 72 | unsigned char fill_4[0x1fc]; 73 | volatile unsigned int gio_sync; /* bf400e00, read only */ 74 | }; 75 | 76 | #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ 77 | 78 | /* 79 | * _U64_PRODUCT_ID_REG - GIO bus Product ID register 80 | */ 81 | #define _U64_PRODUCT_ID_MASK 0x0000007f 82 | #define _U64_PRODUCT_ID_VALUE 0x00000015 83 | 84 | /* 85 | * reset control register has two bits defined 86 | */ 87 | #define _U64_RESET_CONTROL_NMI 0x4 88 | #define _U64_RESET_CONTROL_RESET 0x2 89 | 90 | /* 91 | * Only look at the least significant 5 bits of the sync and interrupt 92 | * registers. Future revs of the firmware may provide more. 93 | */ 94 | 95 | #define _U64_REGMASK 0x1f 96 | 97 | /* 98 | * 16MB available, one meg at a time, selected by the 4 bit 99 | * dram_page_cntrl register setting. 100 | */ 101 | #define U64_MEM_SIZE 0x100000 102 | 103 | /* 104 | * Declare size of gio-addressable memory to mmap, and provide the base 105 | * physical address so that clients who want to mmap() may do so. 106 | */ 107 | #define U64_GIOBUS_SIZE 0x200000 /* 2 MB */ 108 | #define U64_GIOBUS_BASE 0x1f400000 109 | 110 | #endif /* __SYS_U64GIO_H__ */ 111 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/tinymon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995, Silicon Graphics, Inc. All Rights Reserved. 3 | * 4 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; 5 | * the contents of this file may not be disclosed to third parties, copied 6 | * or duplicated in any form, in whole or in part, without the prior written 7 | * permission of Silicon Graphics, Inc. 8 | * 9 | * RESTRICTED RIGHTS LEGEND: 10 | * Use, duplication or disclosure by the Government is subject to restrictions 11 | * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data 12 | * and Computer Software clause at DFARS 252.227-7013, and/or in similar or 13 | * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished 14 | * rights reserved under the Copyright Laws of the United States. 15 | * 16 | * Module: tinymon.h: constants for use with the tinymon family of debug servers 17 | */ 18 | 19 | #define GIO_BASE_REG_UPPER 0x1800 20 | #define GIO_BASE_REG_UPPER_K1 0xb800 21 | #define GIO_INTR_REG_OFFSET 0x0 22 | #define GIO_SYNC_REG_OFFSET 0x400 23 | #define CART_INTR_REG_OFFSET 0x800 24 | 25 | #define RAMROM_BASE_UPPER 0x1000 26 | #define RAMROM_BASE_UPPER_K1 0xb000 27 | 28 | /* 29 | * jal will or in the upper four bits of 0xb0000000 whenever we invoke these 30 | * routines. 31 | */ 32 | #define PIFMON_WRITE_ADDR 0xfc00030 33 | 34 | #define PI_BASE_REG_UPPER 0x0460 35 | #define PI_BASE_REG_UPPER_K1 0xa460 36 | #define PI_STATUS_REG_OFFSET 0x10 37 | 38 | /* 39 | * PI status register has 3 bits active when read from (PI_STATUS_REG - read) 40 | * Bit 0: DMA busy - set when DMA is in progress 41 | * Bit 1: IO busy - set when IO is in progress 42 | * Bit 2: Error - set when R4300 issues IO request while DMA is busy 43 | */ 44 | #define PI_STATUS_ERROR 0x04 45 | #define PI_STATUS_IO_BUSY 0x02 46 | #define PI_STATUS_DMA_BUSY 0x01 47 | 48 | /* 49 | * Host to R4300 protocol definitions. 50 | * 51 | * Host writes DG_RAMROM_REQUEST, DG_RAMROM_CMD_READY to the cartridge 52 | * interrupt register (which the R4300 can poll), 53 | * 54 | * R4300 writes DG_RAMROM_GRANT, DG_RAMROM_CMD_DONE to the gio sync register 55 | * (which the host can poll). 56 | */ 57 | 58 | #define DG_CARTREG_MASK 0x3f 59 | 60 | #define DG_RAMROM_REQUEST 1 61 | #define DG_RAMROM_GRANT 2 62 | #define DG_RAMROM_CMD_READY 3 63 | #define DG_RAMROM_CMD_DONE 4 64 | 65 | #define DG_TINYMON_READ_OP 1 66 | #define DG_TINYMON_WRITE_OP 2 67 | #define DG_TINYMON_DMA_READ_OP 3 68 | #define DG_TINYMON_DMA_WRITE_OP 4 69 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/ultra64.h: -------------------------------------------------------------------------------- 1 | 2 | /************************************************************************** 3 | * * 4 | * Copyright (C) 1994, Silicon Graphics, Inc. * 5 | * * 6 | * These coded instructions, statements, and computer programs contain * 7 | * unpublished proprietary information of Silicon Graphics, Inc., and * 8 | * are protected by Federal copyright law. They may not be disclosed * 9 | * to third parties or copied or duplicated in any form, in whole or * 10 | * in part, without the prior written consent of Silicon Graphics, Inc. * 11 | * * 12 | *************************************************************************/ 13 | 14 | /************************************************************************** 15 | * 16 | * $Revision: 1.10 $ 17 | * $Date: 1997/02/11 08:37:33 $ 18 | * $Source: /disk6/Master/cvsmdev2/PR/include/ultra64.h,v $ 19 | * 20 | **************************************************************************/ 21 | 22 | #ifndef _ULTRA64_H_ 23 | #define _ULTRA64_H_ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /blastcorps/include/2.0I/ultrahost.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | * * 3 | * Copyright (C) 1995, Silicon Graphics, Inc. * 4 | * * 5 | * These coded instructions, statements, and computer programs contain * 6 | * unpublished proprietary information of Silicon Graphics, Inc., and * 7 | * are protected by Federal copyright law. They may not be disclosed * 8 | * to third parties or copied or duplicated in any form, in whole or * 9 | * in part, without the prior written consent of Silicon Graphics, Inc. * 10 | * * 11 | *************************************************************************/ 12 | 13 | /************************************************************************** 14 | * 15 | * $Revision: 1.8 $ 16 | * $Date: 1997/07/02 02:35:06 $ 17 | * $Source: /disk6/Master/cvsmdev2/PR/include/ultrahost.h,v $ 18 | * 19 | **************************************************************************/ 20 | 21 | #ifndef _ULTRAHOST_H_ 22 | #define _ULTRAHOST_H_ 23 | 24 | #ifdef PTN64 /* { */ 25 | 26 | #define execl execl_pt 27 | 28 | #define uhOpenGame uhOpenGame_pt 29 | #define uhCloseGame uhCloseGame_pt 30 | 31 | #define uhReadGame uhReadGame_pt 32 | #define uhWriteGame uhWriteGame_pt 33 | #define uhReadRamrom uhReadRamrom_pt 34 | #define uhWriteRamrom uhWriteRamrom_pt 35 | #define uhPartnerCmd uhPartnerCmd_pt 36 | #define uhGload uhGload_pt 37 | 38 | int uhPartnerCmd(int,char *); 39 | int uhGload(int,char *); 40 | 41 | #endif /* } */ 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | int uhOpenGame(const char *); 47 | int uhCloseGame(int); 48 | 49 | int uhReadGame(int, void *, int); 50 | int uhWriteGame(int, void *, int); 51 | int uhWriteRamrom(int, void *, void*, int); 52 | int uhReadRamrom(int, void *, void*, int); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* ULTRAHOST */ 59 | -------------------------------------------------------------------------------- /blastcorps/include/common.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/blastcorps/include/common.h -------------------------------------------------------------------------------- /blastcorps/include/macro.inc: -------------------------------------------------------------------------------- 1 | # Assembly Macros 2 | 3 | .set K0BASE, 0x80000000 4 | .set K1BASE, 0xA0000000 5 | .set K2BASE, 0xC0000000 6 | 7 | .macro glabel label 8 | .global \label 9 | .balign 4 10 | \label: 11 | .endm 12 | 13 | .macro .word32 x 14 | .word \x 15 | .endm 16 | -------------------------------------------------------------------------------- /blastcorps/init.us.v10.sha1: -------------------------------------------------------------------------------- 1 | ff624d31107bab14f3aa84846804e08c8cdf042e -------------------------------------------------------------------------------- /blastcorps/init.us.v10.yaml: -------------------------------------------------------------------------------- 1 | options: 2 | base_path: . 3 | basename: init.us.v10 4 | compiler: IDO 5 | create_detected_syms: yes 6 | find_file_boundaries: yes 7 | target_path: init.us.v10.bin 8 | symbol_addrs_path: symbol_addrs.init.us.v10.txt 9 | undefined_funcs_auto_path: undefined_funcs_auto.init.us.v10.txt 10 | undefined_syms_auto_path: undefined_syms_auto.init.us.v10.txt 11 | src_path: src.us.v10 12 | segments: 13 | - name: init 14 | type: code 15 | vram: 0x8021ED00 16 | start: 0x00000000 17 | subsegments: 18 | - [0x0000, asm, init/0000] 19 | - [0x0050, asm, init/0050] 20 | - [0x1660, asm, init/1660] 21 | - [0x1A00, asm, init/1A00] 22 | - [0x1A30, asm, init/1A30] 23 | - [0x1F40, asm, init/1F40] 24 | - [0x2260, asm, init/2260] 25 | - [0x2280, asm, init/2280] 26 | - [0x2330, asm, init/2330] 27 | - [0x2C20, asm, init/2C20] 28 | - [0x2CA0, asm, init/2CA0] 29 | - [0x2D00, asm, init/2D00] 30 | - [0x2D60, asm, init/2D60] 31 | - [0x3060, asm, init/3060] 32 | - [0x30E0, asm, init/30E0] 33 | - [0x3110, asm, init/3110] 34 | - [0x3590, asm, init/3590] 35 | - [0x3700, asm, init/3700] 36 | - [0x3770, asm, init/3770] 37 | - [0x38D0, asm, init/38D0] 38 | - [0x3990, asm, init/3990] 39 | - [0x39A0, asm, init/39A0] 40 | - [0x3A00, asm, init/3A00] 41 | - [0x3A40, bin, init/3A40] # .data? 42 | - [0x3CE0] 43 | -------------------------------------------------------------------------------- /blastcorps/init.us.v11.sha1: -------------------------------------------------------------------------------- 1 | 827e7c39f1e8710402f6a1458b3e11e6f5d28a75 -------------------------------------------------------------------------------- /blastcorps/init.us.v11.yaml: -------------------------------------------------------------------------------- 1 | options: 2 | base_path: . 3 | basename: init.us.v11 4 | compiler: IDO 5 | create_detected_syms: yes 6 | find_file_boundaries: yes 7 | target_path: init.us.v11.bin 8 | symbol_addrs_path: symbol_addrs.init.us.v11.txt 9 | undefined_funcs_auto_path: undefined_funcs_auto.init.us.v11.txt 10 | undefined_syms_auto_path: undefined_syms_auto.init.us.v11.txt 11 | src_path: src.us.v11 12 | segments: 13 | - name: init 14 | type: code 15 | vram: 0x8021ED00 16 | start: 0x00000000 17 | subsegments: 18 | - [0x0000, asm, init/0000] 19 | - [0x0050, asm, init/0050] 20 | - [0x1660, c, init/1660] # Proof of concept 21 | - [0x1A00, asm, init/1A00] 22 | - [0x1A30, asm, init/1A30] 23 | - [0x1F40, asm, init/1F40] 24 | - [0x2260, asm, init/2260] 25 | - [0x2280, asm, init/2280] 26 | - [0x2330, asm, init/2330] 27 | - [0x2C20, asm, init/2C20] 28 | - [0x2CA0, asm, init/2CA0] 29 | - [0x2D00, asm, init/2D00] 30 | - [0x2D60, asm, init/2D60] 31 | - [0x3060, asm, init/3060] 32 | - [0x30E0, asm, init/30E0] 33 | - [0x3110, asm, init/3110] 34 | - [0x3590, asm, init/3590] 35 | - [0x3700, asm, init/3700] 36 | - [0x3770, asm, init/3770] 37 | - [0x38D0, asm, init/38D0] 38 | - [0x3990, asm, init/3990] 39 | - [0x39A0, asm, init/39A0] 40 | - [0x3A00, asm, init/3A00] 41 | - [0x3A40, bin, init/3A40] # .data? 42 | - [0x3CE0] 43 | -------------------------------------------------------------------------------- /blastcorps/src.us.v11/init/1660.c: -------------------------------------------------------------------------------- 1 | #include "common.h" 2 | #include 3 | 4 | extern s32 D_80222840; 5 | extern s32 D_802229E0; 6 | extern u8 *D_802229F0; 7 | extern s32 D_802229F4; 8 | extern s32 D_80222A08; 9 | extern s32 D_80222A0C; 10 | extern s32 D_80222A18; 11 | extern s32 D_80222A1C; 12 | extern s32 D_80222A20; 13 | 14 | void func_802206D0(void); 15 | s32 func_8022043C(void); 16 | 17 | 18 | void func_80220360(s32 *arg0, s32 *arg1, s32 arg2) { 19 | D_802229F0 = *arg0; 20 | D_802229F4 = *arg1; 21 | D_802229E0 = arg2; 22 | 23 | func_802206D0(); 24 | 25 | if (*(D_802229F0 + D_80222A1C) != 0x1F) { 26 | D_80222A1C += 1; 27 | } 28 | D_80222840 = func_8022043C(); 29 | if (D_80222840 >= 0) { 30 | func_80220268(); 31 | *arg0 += D_80222A1C; 32 | *arg1 += D_80222A20; 33 | } 34 | } 35 | 36 | #pragma GLOBAL_ASM("asm/nonmatchings/init/1660/func_8022043C.s") 37 | 38 | #pragma GLOBAL_ASM("asm/nonmatchings/init/1660/func_8022069C.s") 39 | // u32 func_8022069C(u32 arg0, s32 arg1) { 40 | // s32 temp_a1; 41 | // u32 temp_t8; 42 | // u32 phi_a2; 43 | // 44 | // phi_a2 = 0U; 45 | // loop_1: 46 | // temp_t8 = (phi_a2 | (arg0 & 1)) << 1; 47 | // phi_a2 = temp_t8; 48 | // arg1 = arg1 - 1; 49 | // arg0 = arg0 >> 1; 50 | // if (arg1 > 0) { 51 | // goto loop_1; 52 | // } 53 | // return temp_t8 >> 1; 54 | // } 55 | 56 | void func_802206D0(void) { 57 | D_80222A20 = 0; 58 | D_80222A1C = 0; 59 | D_80222A18 = 0; 60 | D_80222A0C = 0; 61 | D_80222A08 = 0; 62 | } 63 | -------------------------------------------------------------------------------- /blastcorps/symbol_addrs.init.us.v11.txt: -------------------------------------------------------------------------------- 1 | func_8022043C = 0x8022043C; 2 | -------------------------------------------------------------------------------- /blastcorps/undefined_syms.hd_code.us.v10.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/blastcorps/undefined_syms.hd_code.us.v10.txt -------------------------------------------------------------------------------- /blastcorps/undefined_syms.hd_code.us.v11.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/blastcorps/undefined_syms.hd_code.us.v11.txt -------------------------------------------------------------------------------- /blastcorps/undefined_syms.init.us.v10.txt: -------------------------------------------------------------------------------- 1 | .L802447C0 = 0x802447C0; 2 | -------------------------------------------------------------------------------- /blastcorps/undefined_syms.init.us.v11.txt: -------------------------------------------------------------------------------- 1 | .L802447C0 = 0x802447C0; 2 | -------------------------------------------------------------------------------- /docs/blast_corps_rom_extending.txt: -------------------------------------------------------------------------------- 1 | Blast Corps (U) (V1.1) ROM Extending 2 | Updated: 2016 Feb 03 3 | By: queueRAM 4 | 5 | This doc describes the process used to extend the Blast Corps (U) (V1.1) ROM 6 | to facilitate hacking and modifying levels. The vanilla ROM isn't suitable 7 | for modifying because the offsets of the level and vehicle data are stored in 8 | code and data blocks that are gzip compressed. Changing these offsets would 9 | involve inflating the gzip code, changing the offsets in code, and compressing 10 | as gzip and hoping the new file size isn't larger than the current one. 11 | 12 | A better approach is to store the level offsets in the ROM and modify the 13 | lookup code to reference this new table. This also has the benefit of 14 | reducing the code size. Below are the steps needed to extend the Blast 15 | Corps (U) (V1.1) ROM. 16 | 17 | 1. Store Level Offsets at 0x7FA000 in ROM 18 | 0x7FA000 is somewhat arbitrarily chosen as the first address with three zeros 19 | in the unused block from 0x7FA1E0-0x7FFFFF 20 | 21 | Default table data: 22 | 004ACC10 004B8960 23 | 004A5660 004ACC10 24 | 004B8960 004BFD60 25 | 004BFD60 004C3AC0 26 | 004C3AC0 004D5F90 27 | 004D5F90 004E2F70 28 | 004E2F70 004E4E80 29 | 004E4E80 004E7C00 30 | 004E7C00 004E8F70 31 | 004E8F70 004F5C10 32 | 004F5C10 00500520 33 | 00500520 00507E80 34 | 00507E80 00511340 35 | 00511340 00523080 36 | 00523080 0052CD00 37 | 0052CD00 00532700 38 | 00532700 0053E9B0 39 | 0053E9B0 0054A820 40 | 0054A820 00552DE0 41 | 00552DE0 00555000 42 | 00555000 00560E90 43 | 00560E90 005652D0 44 | 005652D0 0056F3F0 45 | 0056F3F0 005721E0 46 | 005721E0 005736E0 47 | 005736E0 0057A2C0 48 | 0057A2C0 00580B60 49 | 00580B60 00588CE0 50 | 00588CE0 0058BE80 51 | 0058BE80 00597B80 52 | 00597B80 0059B7D0 53 | 0059B7D0 005A5840 54 | 005A5840 005B0B10 55 | 005B0B10 005B5A30 56 | 005B5A30 005B8BB0 57 | 005B8BB0 005C4C80 58 | 005C4C80 005CA9C0 59 | 005CA9C0 005CCF50 60 | 005CCF50 005D1060 61 | 005D1060 005DC830 62 | 005DC830 005E6EE0 63 | 005E6EE0 005EC800 64 | 005EC800 005F3A80 65 | 005F3A80 006014B0 66 | 006014B0 0060A710 67 | 0060A710 00613AA0 68 | 00613AA0 0061DD70 69 | 0061DD70 00621AF0 70 | 00621AF0 006269E0 71 | 006269E0 00630C30 72 | 00630C30 00635700 73 | 00635700 0063CA10 74 | 0063CA10 00641F30 75 | 00641F30 00644810 76 | 00644810 00646080 77 | 00646080 00647550 78 | 00647550 00654FC0 79 | 00654FC0 00660950 80 | 00660950 00665F80 81 | 00665F80 0066C900 82 | 83 | 2. Inflate the hd_code_text.raw and hd_code_data.raw and level gzip blocks: 84 | 787FD0-7D73B4 hd_code_text.raw  main asm code 85 | 7D73B4-7E3AD0 hd_code_data.raw  data for main asm 86 | 4ACC10-4B71AB chimp.raw Simian Acres 87 | 4B71AB-4B8960 chimp_dl.raw Simian Acres display list 88 | 89 | hd_code_data.raw.gz is not modified, but it needs to be reinserted immediately 90 | after hd_code_text.raw.gz for the inflate methods to work correctly. 91 | 92 | 3. Patch code at 0x01199C in hd_code_text.raw 93 | This is done with bass MIPS assembler: 94 | > bass -o hd_code_text.raw hd_code_text.asm 95 | 96 | Description of code changes: 97 | proc_8025615C: # begin 8025615C (01199C), T6 = Level ID 98 | // existing code 99 | addiu $sp, $sp, -0x28 100 | sw $a0, 0x28($sp) 101 | lw $t6, 0x28($sp) 102 | sw $ra, 0x1c($sp) 103 | sw $a1, 0x2c($sp) 104 | sltiu $at, $t6, 0x3c 105 | beqz $at, .Lproc_8025615C_8A4 106 | sw $a2, 0x30($sp) 107 | // new code starting at 119BC/8025617C 108 | sll t6, t6, 0x3 // each entry is two words 109 | lui at, 0xB080 // %hi(0xB07FA000), 0xB0000000 = ROM 110 | addu at, at, t6 // 111 | lw t6, 0xA000(at) // %lo(0xB07FA000) 112 | sw t6, 0x24(sp) // 113 | lw t7, 0xA004(at) // %lo(0xB07FA004) 114 | sub t7, t7, t6 // compute length 115 | lw t4, 0x30(sp) // 116 | sw t7, 0x0(t4) // 117 | b 0x12240 // skip over old code 118 | 119 | // replace this with nops 120 | 121 | .Lproc_8025615C_8A4: // offset 0x12240 122 | addiu $t7, $zero, 0xa 123 | addiu $t8, $zero, 1 124 | sw $t8, 0x14($sp) 125 | sw $t7, 0x10($sp) 126 | lw $a0, 0x24($sp) 127 | lw $a1, 0x2c($sp) 128 | lw $a2, 0x30($sp) 129 | jal proc_8028B4C4 130 | addiu $a3, $zero, 0xc 131 | lw $ra, 0x1c($sp) 132 | addiu $sp, $sp, 0x28 133 | jr $ra 134 | nop 135 | 136 | 4. Compress patched hd_code_text.raw in gzip: 137 | > gzip -c hd_code_text.raw > hd_code_text.raw.gz 138 | 139 | 5. Insert the hd_code_text.raw.gz and hd_code_data.raw.gz back-to-back in the 140 | Blast Corps ROM at offset 787FD0 and Simian Acres level at 0x0x800000. 141 | Also update the Simian Acres offset in the level lookup table. This is 142 | done with bass MIPS assembler bass. 143 | > bass -o "Blast Corps (U) (V1.1).z64" blast_corps_rom.asm 144 | -------------------------------------------------------------------------------- /docs/blast_corps_vehicles.txt: -------------------------------------------------------------------------------- 1 | Blast Corps (U) (V1.1) Vehicle Data 2 | Updated: 2016 Feb 03 3 | By: queueRAM 4 | 5 | proc_802C4108 - gzip decompress 6 | 7 | Thread3/proc_80285814 -> proc_80256A34 -> proc_802A1674 -> proc_802A1D54 -> proc_802A396C 8 | 9 | // load object 10 | // T3 = vehicle type 11 | proc_802A396C(T3) 12 | { 13 | switch (T3) { 14 | // no 12, 17-0x95, 0x97, 0x99-0xFC 15 | case 0x00: // 491E00-4929D0 - driver / Player 16 | case 0x01: // 4929D0-494390 - sideswipe 17 | case 0x02: // 494390-496AD0 - magoo / Thunderfist 18 | case 0x10: // 4A1690-4A4120 - minimagoo / Cyclone Suit 19 | case 0x03: // 490AC0-491E00 - buggy / Skyfall 20 | case 0x04: // 496AD0-497AF0 - bulldozer / Ramdozer 21 | case 0x05: // 497AF0-4989E0 - truck / Backlash 22 | case 0x06: // 49AD20-49B630 - crane 23 | case 0x07: // 49B630-49BCE0 - train 24 | case 0x08: // 49BCE0-49C480 - hotrod / American Dream 25 | case 0x09: // 49C480-49E8E0 - jetpack / J-Bomb 26 | case 0x0A: // 49E8E0-49F7A0 - bike / Ballista 27 | 28 | case 0x0B: // 49F7A0-49FF70 - barge 29 | case 0x11: // 49F7A0-49FF70 - barge 30 | case 0x12: // 49F7A0-49FF70 - barge 31 | 32 | case 0x0D: // 49FF70-4A0720 - police 33 | case 0x0E: // 4A0720-4A1000 - ateam / A-Team Van 34 | case 0x0F: // 4A1000-4A1690 - starski / Hotrod 35 | case 0xFE: // 4989E0-499690 - chopper / BCT Chopper 36 | case 0xFF: // 499690-49AD20 - cmo / Missile Carrier 37 | case 0xFD: // 4A4120-4A5660 - shuttle 38 | case 0x96: // 4903C0-490AC0 - commpoint / Communication Point Satellite 39 | case 0x98: // 48FE90-4903C0 - scientist 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /docs/chimp.plot: -------------------------------------------------------------------------------- 1 | set term png size 1024,1024 2 | set output "chimp.png" 3 | #set term dumb 4 | set xrange [3200:700] 5 | set yrange [1700:5200] 6 | set title "Simian Acres / chimp.raw" 7 | #unset xtics 8 | #unset ytics 9 | set key box 3 10 | set grid 11 | 12 | set style line 1 lc rgb 'orange' lt 1 lw 2 pt 3 ps 1.5 13 | set style line 2 lc rgb 'black' lt 1 lw 2 pt 5 ps 1.5 14 | set style line 3 lc rgb 'blue' lt 1 lw 2 pt 7 ps 1.5 15 | set style line 4 lc rgb 'red' lt 1 lw 2 pt 7 ps 2.0 16 | set style line 5 lc rgb 'brown' lt 1 lw 2 pt 5 ps 2.0 17 | set style line 6 lc rgb '#0060ad' lt 1 lw 2 pt 7 ps 1.5 18 | set style line 7 lc rgb '#FF6060' lt 1 lw 2 pt 7 ps 1.5 19 | 20 | # level bounds from 0x4C 21 | #set object 1 rect from 0x009E, 0x011B to 0x10B9, 0x1FA8 fc rgb "green" fs pattern 1 bo -1 22 | 23 | # bounding boxes from 0x40 24 | #set object 1 rect from 0x00D2, 0x041A to 0x1072, 0x1B8A fc rgb "cyan" fs pattern 1 bo -1 25 | #set object 2 rect from 0x00D2, 0x041A to 0x1072, 0x1B8A fc rgb "red" fs pattern 4 bo -1 26 | 27 | #set object 3 rect from 0x07DA, 0x0ABE to 0x096A, 0x0B86 fc rgb "red" fs pattern 1 bo -1 28 | #set object 4 rect from 0x064A, 0x0ABE to 0x0776, 0x0C4E fc rgb "red" fs pattern 1 bo -1 29 | #set object 5 rect from 0x0456, 0x0ABE to 0x051E, 0x0BEA fc rgb "red" fs pattern 1 bo -1 30 | #set object 6 rect from 0x07DA, 0x0C4E to 0x083E, 0x0D16 fc rgb "red" fs pattern 1 bo -1 31 | #set object 7 rect from 0x064A, 0x0CB2 to 0x0712, 0x0E42 fc rgb "red" fs pattern 1 bo -1 32 | #set object 8 rect from 0x0712, 0x0DDE to 0x096A, 0x0EA6 fc rgb "red" fs pattern 1 bo -1 33 | #set object 9 rect from 0x0776, 0x0D16 to 0x083E, 0x0DDE fc rgb "red" fs pattern 1 bo -1 34 | #set object 10 rect from 0x07DA, 0x0C4E to 0x08A2, 0x0D16 fc rgb "red" fs pattern 1 bo -1 35 | #set object 11 rect from 0x05E6, 0x0EA6 to 0x06AE, 0x1036 fc rgb "red" fs pattern 1 bo -1 36 | #set object 12 rect from 0x051E, 0x1036 to 0x064A, 0x10FE fc rgb "red" fs pattern 1 bo -1 37 | #set object 13 rect from 0x0712, 0x0F6E to 0x08A2, 0x0FD2 fc rgb "red" fs pattern 1 bo -1 38 | #set object 14 rect from 0x096A, 0x0E42 to 0x0A32, 0x0F0A fc rgb "red" fs pattern 1 bo -1 39 | #set object 15 rect from 0x09CE, 0x0F6E to 0x0A96, 0x109A fc rgb "red" fs pattern 1 bo -1 40 | #set object 16 rect from 0x0906, 0x109A to 0x09CE, 0x1162 fc rgb "red" fs pattern 1 bo -1 41 | #set object 17 rect from 0x083E, 0x10FE to 0x0906, 0x122A fc rgb "red" fs pattern 1 bo -1 42 | #set object 18 rect from 0x0712, 0x1162 to 0x07DA, 0x12F2 fc rgb "red" fs pattern 1 bo -1 43 | #set object 19 rect from 0x08A2, 0x0F6E to 0x096A, 0x1036 fc rgb "red" fs pattern 1 bo -1 44 | #set object 20 rect from 0x0A32, 0x0DDE to 0x0AFA, 0x0EA6 fc rgb "red" fs pattern 1 bo -1 45 | #set object 21 rect from 0x0712, 0x109A to 0x083E, 0x10FE fc rgb "red" fs pattern 1 bo -1 46 | #set object 22 rect from 0x0712, 0x0FD2 to 0x0776, 0x109A fc rgb "red" fs pattern 1 bo -1 47 | #set object 23 rect from 0x09CE, 0x0CB2 to 0x0A96, 0x0DDE fc rgb "red" fs pattern 1 bo -1 48 | 49 | #set object 24 rect from 0x0C8A, 0x041A to 0x1072, 0x1B8A fc rgb "yellow" fs pattern 2 bo -1 50 | #set object 25 rect from 0x0AFA, 0x041A to 0x0C8A, 0x0C4E fc rgb "yellow" fs pattern 2 bo -1 51 | 52 | # bounding boxes from 0x44 53 | #set object 26 rect from 0x00D2, 0x0AD5 to 0x1072, 0x1B8A fc rgb "black" fs pattern 4 bo -1 54 | #set object 27 rect from 0x01FE, 0x0B22 to 0x051E, 0x18CE fc rgb "black" fs pattern 4 bo -1 55 | #set object 28 rect from 0x051E, 0x128E to 0x0776, 0x18CE fc rgb "black" fs pattern 2 bo -1 56 | #set object 29 rect from 0x08A2, 0x0CB2 to 0x0E1A, 0x18CE fc rgb "black" fs pattern 2 bo -1 57 | #set object 30 rect from 0x00D2, 0x0305 to 0x1072, 0x0AD5 fc rgb "black" fs pattern 2 bo -1 58 | 59 | # RDUs: offsets 0x34-0x38: 01B6B4-01B90C 60 | # TNTs: offsets 0x38-0x3C: 01B90C-01B924 61 | # to read from chimp.raw: skip=0x01B6B4 62 | plot 'chimp.raw.34rdus.bin' binary endian=big format="%int16%int16%int16" using 1:3 with points ls 1 title "RDUs", \ 63 | 'chimp.raw.38tnts.bin' binary endian=big format="%int16%int16%int16%int16%int16%int16" using 1:3 with points ls 2 title "TNT", \ 64 | 'chimp.raw.50vehicles.bin' binary endian=big format="%uchar%int16%int16%int16%int16" using 2:4 with points ls 3 title "Vehicles", \ 65 | 'chimp.raw.54.txt' using 1:2:3:4 with vectors filled ls 4 title "Missile", \ 66 | 'chimp.raw.5C.bin' binary endian=big format="%int16%int16%int16%int16%uchar%uchar%int16%int16" using 1:3 with points ls 5 title "Structures", \ 67 | 'chimp.raw.68.1.txt' using 1:3 with lines ls 6 title "Train Platform", \ 68 | 'chimp.raw.68.2.txt' using 1:3 with lines ls 6 notitle, \ 69 | 'chimp.raw.68.3.txt' using 1:3 with lines ls 6 notitle, \ 70 | 'chimp.raw.68.4.txt' using 1:3 with lines ls 6 notitle, \ 71 | 'chimp.raw.68.01.txt' using 1:2 with lines ls 6 notitle, \ 72 | 'chimp.raw.68.02.txt' using 1:2 with lines ls 6 notitle 73 | 74 | 75 | -------------------------------------------------------------------------------- /docs/sm64tools-configs/blast_corps.e.code.yaml: -------------------------------------------------------------------------------- 1 | # ROM splitter configuration file 2 | name: "Blast Corps (E) hd_code_text.raw" 3 | 4 | # checksums from ROM header offsets 0x10 and 0x14 5 | # used for auto configuration detection 6 | checksum1: 0x3C0E00FF 7 | checksum2: 0x35CEB000 8 | 9 | # base filename used for outputs (please, no spaces) 10 | basename: "blast_corps.e.code" 11 | 12 | # ranges to split the ROM into 13 | # types: 14 | # asm - MIPS assembly block. Symbol names are in 'labels' list below 15 | ranges: 16 | # start, end, type, label 17 | - [0x000000, 0x0A4410, "asm", "main", 0x802447C0] 18 | 19 | # Labels for functions or data memory addresses 20 | # All label addresses are RAM addresses 21 | # Order does not matter 22 | labels: 23 | - [0x802447C0, "MainJump"] 24 | - [0x80244870, "Thread1"] 25 | - [0x80244930, "Thread3"] 26 | - [0x80257594, "LoadLevel"] 27 | - [0x80269258, "Thread4"] 28 | - [0x80271640, "LoadLevelRdus"] 29 | - [0x802729F8, "Thread5"] 30 | - [0x8028D1E4, "InitiateDma"] 31 | - [0x8028DEB0, "LoadLevelAmmo"] 32 | - [0x8028F1E0, "LoadLevelTnt"] 33 | - [0x80291AD0, "LoadLevelSquareBlocks"] 34 | - [0x802A440C, "LoadLevelTodo74"] 35 | - [0x802A4590, "LoadLevelTodo2C"] 36 | - [0x802A46C4, "LoadLevelBuildings"] 37 | - [0x802A5520, "CopyBuildingTableToRam"] 38 | - [0x802A5408, "InflateBuildingData"] 39 | - [0x802A55C4, "LoadLevelTodo60"] 40 | - [0x802A56D8, "LoadLevelTodo4C"] 41 | - [0x802A5978, "LoadLevelTodo78"] 42 | - [0x802A5E7C, "LoadLevelVehicles"] 43 | - [0x802A59AC, "LoadLevelMissileCarrier"] 44 | - [0x802A66C4, "LoadLevelCollisionXZ"] 45 | - [0x802A6768, "LoadLevelTodo70"] 46 | - [0x802A680C, "LoadLevelTodo64"] 47 | - [0x802A68F0, "LoadLevelTrainPlatform"] 48 | - [0x802A6DD4, "LoadLevelTerrain"] 49 | - [0x802A6E54, "AlignTo8Bytes"] 50 | - [0x802A7E80, "LoadLevelTodo40"] 51 | - [0x802A7F74, "LoadLevelTodo44"] 52 | - [0x802A814C, "DecodeTexture"] 53 | - [0x802A82C8, "DecodeTexture6"] 54 | - [0x802A839C, "DecodeTexture3"] 55 | - [0x802A8450, "DecodeTexture1"] 56 | - [0x802A8500, "DecodeTexture2"] 57 | - [0x802A85CC, "DecodeTexture4"] 58 | - [0x802A86A4, "DecodeTexture5"] 59 | - [0x802A8780, "DecodeTexture0"] 60 | - [0x802C6A78, "GzipInflate"] 61 | - [0x802D1410, "LoadLevelCommPoint"] 62 | - [0x802D6990, "osInitialize"] 63 | - [0x802D6BC0, "osEPiRawReadIo"] 64 | - [0x802D6C20, "osCreateThread"] 65 | - [0x802D6D70, "osStartThread"] 66 | - [0x802D6ED0, "osCreatePiManager"] 67 | - [0x802D7050, "osSetThreadPri"] 68 | - [0x802D7130, "osSendMesg"] 69 | - [0x802D7280, "osRecvMesg"] 70 | - [0x802D73C0, "osViBlack"] 71 | - [0x802D7430, "osGetTime"] 72 | - [0x802D74C0, "__ull_rshift"] 73 | - [0x802D74EC, "__ull_rem"] 74 | - [0x802D7528, "__ull_div"] 75 | - [0x802D7564, "__ll_lshift"] 76 | - [0x802D7590, "__ll_rem"] 77 | - [0x802D75CC, "__ll_div"] 78 | - [0x802D7628, "__ll_mul"] 79 | - [0x802D7658, "__ull_divremi"] 80 | - [0x802D76B8, "__ll_mod"] 81 | - [0x802D7754, "__ll_rshift"] 82 | - [0x802D7790, "osVirtualToPhysical"] 83 | - [0x802D7810, "osWriteBackDCache"] 84 | - [0x802D7A40, "guOrthoF"] 85 | - [0x802D7B94, "guFrustum"] 86 | - [0x802D7C00, "guPerspectiveF"] 87 | - [0x802D7E30, "guPerspective"] 88 | - [0x802D8290, "guMtxF2L"] 89 | - [0x802D8390, "guMtxIdentF"] 90 | - [0x802D8500, "guRotateRPYF"] 91 | - [0x802D8554, "guRotateRPY"] 92 | - [0x802D8A60, "sqrtf"] 93 | - [0x802D8DA0, "sinf"] 94 | - [0x802D8F60, "osCreateMesgQueue"] 95 | - [0x802D8FD0, "osViSetSpecialFeatures"] 96 | - [0x802D9190, "osWriteBackDCacheAll"] 97 | - [0x802D91C0, "osInvalDCache"] 98 | - [0x802D9270, "osDestroyThread"] 99 | - [0x802D9370, "cosf"] 100 | - [0x802D78F0, "proutSprintf"] 101 | - [0x802D795C, "sprintf"] 102 | - [0x802D7890, "osSetIntMask"] 103 | - [0x802DADD4, "alBnkfNew"] 104 | - [0x802DAED8, "alSetFileNew"] 105 | - [0x802DC190, "osGetCount"] 106 | - [0x802DC240, "__osViInit"] 107 | - [0x802DC380, "osAiSetFrequency"] 108 | - [0x802DC4E0, "osAiSetNextBuffer"] 109 | - [0x802DC590, "osAiGetLength"] 110 | - [0x802DCC70, "osPiStartDma"] 111 | - [0x802DCF90, "osCreateViManager"] 112 | - [0x802DD114, "__osViDevMgrMain"] 113 | - [0x802DD2F0, "osViSetMode"] 114 | - [0x802DD360, "osSetEventMsg"] 115 | - [0x802DD3D0, "osViSetEventMsg"] 116 | - [0x802DD840, "osViSwapBuffer"] 117 | - [0x802DD890, "osSetTimer"] 118 | - [0x802DD9F0, "osSpTaskDunno"] 119 | - [0x802DDB0C, "osSpTaskLoad"] 120 | - [0x802DDC6C, "osSpTaskStartGo"] 121 | - [0x802DDCAC, "osSpTaskYield"] 122 | - [0x802DDD90, "osContInit"] 123 | - [0x802DDF8C, "__osContGetInitData"] 124 | - [0x802DE05C, "__osPackRequestData"] 125 | - [0x802DE1C0, "osContStartReadData"] 126 | - [0x802DE284, "osContGetReadData"] 127 | - [0x802DE420, "osInvalCache"] 128 | - [0x802DE4A0, "bzero"] 129 | - [0x802DE690, "__osGetSR"] 130 | - [0x802DE6A0, "__osSetFpcCsr"] 131 | - [0x802DE6B0, "__osSiRawReadIo"] 132 | - [0x802DE700, "__osSiRawWriteIo"] 133 | - [0x802DE750, "__osExceptionPreamble"] 134 | - [0x802DE760, "__osExceptionHandler"] 135 | - [0x802DED90, "__osEnqueueAndYield"] 136 | - [0x802DEE20, "__osEnqueueThread"] 137 | - [0x802DEE68, "__osPopThread"] 138 | - [0x802DEE78, "__osDispatchThread"] 139 | - [0x802DEFB8, "__osCleanupThread"] 140 | - [0x802DF020, "__osDisableInt"] 141 | - [0x802DF040, "__osRestoreInt"] 142 | - [0x802DF0A0, "__osPiCreateAccessQueue"] 143 | - [0x802DF0F0, "__osPiGetAccess"] 144 | - [0x802DF134, "__osPiRelAccess"] 145 | - [0x802DF160, "osGetThreadPri"] 146 | - [0x802DF180, "osPiRawStartDma"] 147 | - [0x802DF260, "__osDevMgrMain"] 148 | - [0x802DF3E0, "__osTimerServicesInit"] 149 | - [0x802DF46C, "__osTimerInterrupt"] 150 | - [0x802DF5E4, "__osSetTimerIntr"] 151 | - [0x802DF658, "__osInsertTimer"] 152 | - [0x802DF7E0, "__osProbeTLB"] 153 | - [0x802DF8A0, "_Printf"] 154 | - [0x802E0A30, "memcpy"] 155 | - [0x802E28F0, "__osAiDeviceBusy"] 156 | - [0x802E42B0, "osJamMesg"] 157 | - [0x802E4440, "__osSpGetStatus"] 158 | - [0x802DD440, "bcopy"] 159 | - [0x802E4450, "__osSpSetStatus"] 160 | - [0x802E4460, "__osSpSetPc"] 161 | - [0x802E44A0, "__osSpRawStartDma"] 162 | - [0x802E4530, "__osSpDeviceBusy"] 163 | - [0x802E4560, "__osSiRawStartDma"] 164 | - [0x802E4610, "__osSiCreateAccessQueue"] 165 | - [0x802E4660, "__osSiGetAccess"] 166 | - [0x802E46A4, "__osSiRelAccess"] 167 | - [0x802E46D0, "__osSiDeviceBusy"] 168 | - [0x802E4B80, "__osSyncPutChars"] 169 | - [0x802E4CB0, "__osSetCompare"] 170 | - [0x802E7000, "__osAtomicDec"] 171 | 172 | -------------------------------------------------------------------------------- /docs/sm64tools-configs/blast_corps.e.yaml: -------------------------------------------------------------------------------- 1 | # ROM splitter configuration file 2 | name: "Blast Corps (E)" 3 | 4 | # checksums from ROM header offsets 0x10 and 0x14 5 | # used for auto configuration detection 6 | checksum1: 0x7C64E6DB 7 | checksum2: 0x55B924DB 8 | 9 | # base filename used for outputs (please, no spaces) 10 | basename: "blast_corps.e" 11 | 12 | # ranges to split the ROM into 13 | # types: 14 | # asm - MIPS assembly block. Symbol names are in 'labels' list below 15 | # behavior - behavior script 16 | # bin - raw binary, usually data 17 | # blast - Blast Corps compressed blocks 18 | # gzip - gzip compressed blocks 19 | # header - ROM header block 20 | # instrset - instrument set 21 | # level - level commands 22 | # m64 - M64 music sequence bank 23 | # mio0 - MIO0 compressed data block. may have texture breakdown 24 | # ptr - RAM address or ROM offset pointer 25 | # 26 | # textures types: 27 | # rgba - 32/16 bit RGBA (5-5-5-1/8-8-8-8) 28 | # ia - 16/8/4/1-bit greyscale 29 | # skybox - grid of 32x32 16-bit RGBA 30 | ranges: 31 | # start, end, type, label 32 | - [0x000000, 0x000040, "header", "header"] 33 | - [0x000040, 0x001000, "bin", "boot"] 34 | - [0x001000, 0x004A3C, "asm", "main", 0x8021ED00] 35 | # hd_code_text is copied to 0x80000400 and then inflated to 0x802447C0 by proc_80220998 36 | - [0x788120, 0x7D845C, "gzip", "hd_code_text.raw"] 37 | - [0x7D845C, 0x7E4940, "gzip", "hd_code_data.raw"]: 38 | # TODO: many of these are just guesses 39 | - [0x10E30, "tex.rgba", 32, 16, 16] 40 | - [0x11230, "tex.rgba", 32, 16, 16] 41 | - [0x12180, "tex.rgba", 32, 32, 30] 42 | - [0x142E0, "tex.rgba", 16, 32, 32] 43 | - [0x16B68, "tex.ia", 16, 32, 32] 44 | - [0x7E4940, 0x7F75A4, "gzip", "hd_front_end_text.raw"] 45 | - [0x7F75A4, 0x7FB7C0, "gzip", "hd_front_end_data.raw"] 46 | 47 | # Labels for functions or data memory addresses 48 | # All label addresses are RAM addresses 49 | # Order does not matter 50 | labels: 51 | - [0x8021ED00, "EntryPoint"] 52 | - [0x80220730, "Main"] 53 | - [0x80220BA0, "bzero"] 54 | - [0x80220C40, "osInitialize"] 55 | - [0x80220E70, "DmaCopy"] 56 | - [0x80220F50, "GetDmaStatus"] 57 | - [0x80220F70, "__osGetSR"] 58 | - [0x80220F80, "__osSetFpcCsr"] 59 | - [0x80220F90, "__osSiRawReadIo"] 60 | - [0x80220FE0, "__osSiRawWriteIo"] 61 | - [0x802218A0, "osWriteBackDCache"] 62 | - [0x80221920, "osInvalCache"] 63 | - [0x80221A00, "osEPiRawReadIo"] 64 | - [0x80221AC8, "__ull_div"] 65 | - [0x80221BC8, "__ll_mul"] 66 | - [0x80221DE0, "__osSiDeviceBusy"] 67 | - [0x802447C0, "MainJump"] 68 | 69 | -------------------------------------------------------------------------------- /docs/sm64tools-configs/blast_corps.u.1.0.code.yaml: -------------------------------------------------------------------------------- 1 | # ROM splitter configuration file 2 | name: "Blast Corps (U) (V1.0) hd_code_text.raw" 3 | 4 | # checksums from ROM header offsets 0x10 and 0x14 5 | # used for auto configuration detection 6 | checksum1: 0x3C0E00FF 7 | checksum2: 0x35CEB000 8 | 9 | # base filename used for outputs (please, no spaces) 10 | basename: "blast_corps.u.1.0.hd_code_text" 11 | 12 | # ranges to split the ROM into 13 | # types: 14 | # asm - MIPS assembly block. Symbol names are in 'labels' list below 15 | ranges: 16 | # start, end, type, label 17 | - [0x000000, 0x0A4360, "asm", 0x802447C0] 18 | 19 | # Labels for functions or data memory addresses 20 | # All label addresses are RAM addresses 21 | # Order does not matter 22 | labels: 23 | - [0x802447C0, "MainJump"] 24 | - [0x80244870, "Thread1"] 25 | - [0x80244930, "Thread3"] 26 | - [0x8025615C, "LoadLevel"] 27 | - [0x80267A9C, "Thread4"] 28 | - [0x8026FBB0, "LoadLevelRdus"] 29 | - [0x80270F7C, "Thread5"] 30 | - [0x8028B4C4, "InitiateDma"] 31 | - [0x8028C190, "LoadLevelAmmo"] 32 | - [0x8028D4C0, "LoadLevelTnt"] 33 | - [0x8028FDA0, "LoadLevelSquareBlocks"] 34 | - [0x802A1A9C, "LoadLevelTodo74"] 35 | - [0x802A1C20, "LoadLevelTodo2C"] 36 | - [0x802A1D54, "LoadLevelBuildings"] 37 | - [0x802A2BB0, "CopyBuildingTableToRam"] 38 | - [0x802A2A98, "InflateBuildingData"] 39 | - [0x802A2C54, "LoadLevelTodo60"] 40 | - [0x802A2D68, "LoadLevelTodo4C"] 41 | - [0x802A3000, "LoadLevelTodo78"] 42 | - [0x802A3504, "LoadLevelVehicles"] 43 | - [0x802A3034, "LoadLevelMissileCarrier"] 44 | - [0x802A3D4C, "LoadLevelCollisionXZ"] 45 | - [0x802A3DF0, "LoadLevelTodo70"] 46 | - [0x802A3E94, "LoadLevelTodo64"] 47 | - [0x802A3F78, "LoadLevelTrainPlatform"] 48 | - [0x802A445C, "LoadLevelTerrain"] 49 | - [0x802A44DC, "AlignTo8Bytes"] 50 | - [0x802A5500, "LoadLevelTodo40"] 51 | - [0x802A55F4, "LoadLevelTodo44"] 52 | - [0x802A57CC, "DecodeTexture"] 53 | - [0x802A5948, "DecodeTexture6"] 54 | - [0x802A5A1C, "DecodeTexture3"] 55 | - [0x802A5AD0, "DecodeTexture1"] 56 | - [0x802A5B80, "DecodeTexture2"] 57 | - [0x802A5C4C, "DecodeTexture4"] 58 | - [0x802A5D24, "DecodeTexture5"] 59 | - [0x802A5E00, "DecodeTexture0"] 60 | - [0x802C4058, "GzipInflate"] 61 | - [0x802CE9F0, "LoadLevelCommPoint"] 62 | - [0x802D3F70, "osInitialize"] 63 | - [0x802D41A0, "osEPiRawReadIo"] 64 | - [0x802D4200, "osCreateThread"] 65 | - [0x802D4350, "osStartThread"] 66 | - [0x802D44B0, "osCreatePiManager"] 67 | - [0x802D4630, "osSetThreadPri"] 68 | - [0x802D4710, "osSendMesg"] 69 | - [0x802D4860, "osRecvMesg"] 70 | - [0x802D49A0, "osViBlack"] 71 | - [0x802D4A10, "osGetTime"] 72 | - [0x802D4AA0, "__ull_rshift"] 73 | - [0x802D4ACC, "__ull_rem"] 74 | - [0x802D4B08, "__ull_div"] 75 | - [0x802D4B44, "__ll_lshift"] 76 | - [0x802D4B70, "__ll_rem"] 77 | - [0x802D4BAC, "__ll_div"] 78 | - [0x802D4C08, "__ll_mul"] 79 | - [0x802D4C38, "__ull_divremi"] 80 | - [0x802D4C98, "__ll_mod"] 81 | - [0x802D4D34, "__ll_rshift"] 82 | - [0x802D4D70, "osVirtualToPhysical"] 83 | - [0x802D4DF0, "osWriteBackDCache"] 84 | - [0x802D4F10, "guOrthoF"] 85 | - [0x802D5064, "guFrustum"] 86 | - [0x802D50D0, "guPerspectiveF"] 87 | - [0x802D5300, "guPerspective"] 88 | - [0x802D5760, "guMtxF2L"] 89 | - [0x802D5860, "guMtxIdentF"] 90 | - [0x802D59D0, "guRotateRPYF"] 91 | - [0x802D5A24, "guRotateRPY"] 92 | - [0x802D5F30, "sqrtf"] 93 | - [0x802D6270, "sinf"] 94 | - [0x802D6430, "osCreateMesgQueue"] 95 | - [0x802D64A0, "osViSetSpecialFeatures"] 96 | - [0x802D6660, "osWriteBackDCacheAll"] 97 | - [0x802D6690, "osInvalDCache"] 98 | - [0x802D6740, "osDestroyThread"] 99 | - [0x802D6840, "cosf"] 100 | - [0x802D69B0, "proutSprintf"] 101 | - [0x802D6A1C, "sprintf"] 102 | - [0x802D75B0, "osSetIntMask"] 103 | - [0x802D83B4, "alBnkfNew"] 104 | - [0x802D84B8, "alSetFileNew"] 105 | - [0x802D9770, "osGetCount"] 106 | - [0x802D9820, "__osViInit"] 107 | - [0x802D9950, "osAiSetFrequency"] 108 | - [0x802D9AB0, "osAiSetNextBuffer"] 109 | - [0x802D9B60, "osAiGetLength"] 110 | - [0x802DA240, "osPiStartDma"] 111 | - [0x802DA560, "osCreateViManager"] 112 | - [0x802DA6E4, "__osViDevMgrMain"] 113 | - [0x802DA8C0, "osViSetMode"] 114 | - [0x802DA930, "osSetEventMsg"] 115 | - [0x802DA9A0, "osViSetEventMsg"] 116 | - [0x802DAAA0, "osViSwapBuffer"] 117 | - [0x802DAAF0, "osSetTimer"] 118 | - [0x802DAC50, "osSpTaskDunno"] 119 | - [0x802DAD6C, "osSpTaskLoad"] 120 | - [0x802DAECC, "osSpTaskStartGo"] 121 | - [0x802DAF10, "osSpTaskYield"] 122 | - [0x802DAFF0, "osContInit"] 123 | - [0x802DB1EC, "__osContGetInitData"] 124 | - [0x802DB2BC, "__osPackRequestData"] 125 | - [0x802DB420, "osContStartReadData"] 126 | - [0x802DB4E4, "osContGetReadData"] 127 | - [0x802DB680, "osInvalCache"] 128 | - [0x802DB700, "bzero"] 129 | - [0x802DB8F0, "__osGetSR"] 130 | - [0x802DB900, "__osSetFpcCsr"] 131 | - [0x802DB910, "__osSiRawReadIo"] 132 | - [0x802DB960, "__osSiRawWriteIo"] 133 | - [0x802DB9B0, "__osExceptionPreamble"] 134 | - [0x802DB9C0, "__osExceptionHandler"] 135 | - [0x802DBFF0, "__osEnqueueAndYield"] 136 | - [0x802DC080, "__osEnqueueThread"] 137 | - [0x802DC0C8, "__osPopThread"] 138 | - [0x802DC0D8, "__osDispatchThread"] 139 | - [0x802DC218, "__osCleanupThread"] 140 | - [0x802DC280, "__osDisableInt"] 141 | - [0x802DC2A0, "__osRestoreInt"] 142 | - [0x802DC300, "__osPiCreateAccessQueue"] 143 | - [0x802DC350, "__osPiGetAccess"] 144 | - [0x802DC394, "__osPiRelAccess"] 145 | - [0x802DC3C0, "osGetThreadPri"] 146 | - [0x802DC3E0, "osPiRawStartDma"] 147 | - [0x802DC4C0, "__osDevMgrMain"] 148 | - [0x802DC640, "__osTimerServicesInit"] 149 | - [0x802DC6CC, "__osTimerInterrupt"] 150 | - [0x802DC844, "__osSetTimerIntr"] 151 | - [0x802DC8B8, "__osInsertTimer"] 152 | - [0x802DCA40, "__osProbeTLB"] 153 | - [0x802DCB00, "_Printf"] 154 | - [0x802DDC90, "memcpy"] 155 | - [0x802DFB50, "__osAiDeviceBusy"] 156 | - [0x802E20F0, "osJamMesg"] 157 | - [0x802E2280, "__osSpGetStatus"] 158 | - [0x802E2290, "bcopy"] 159 | - [0x802E25A0, "__osSpSetStatus"] 160 | - [0x802E25B0, "__osSpSetPc"] 161 | - [0x802E25F0, "__osSpRawStartDma"] 162 | - [0x802E2680, "__osSpDeviceBusy"] 163 | - [0x802E26B0, "__osSiRawStartDma"] 164 | - [0x802E2760, "__osSiCreateAccessQueue"] 165 | - [0x802E27B0, "__osSiGetAccess"] 166 | - [0x802E27F4, "__osSiRelAccess"] 167 | - [0x802E2820, "__osSiDeviceBusy"] 168 | - [0x802E2CD0, "__osSyncPutChars"] 169 | - [0x802E2E00, "__osSetCompare"] 170 | - [0x802E5150, "__osAtomicDec"] 171 | -------------------------------------------------------------------------------- /docs/sm64tools-configs/blast_corps.u.1.1.code.yaml: -------------------------------------------------------------------------------- 1 | # ROM splitter configuration file 2 | name: "Blast Corps (U) (V1.1) hd_code_text.raw" 3 | 4 | # checksums from ROM header offsets 0x10 and 0x14 5 | # used for auto configuration detection 6 | checksum1: 0x3C0E00FF 7 | checksum2: 0x35CEB000 8 | 9 | # base filename used for outputs (please, no spaces) 10 | basename: "blast_corps.u.1.1.hd_code_text" 11 | 12 | # ranges to split the ROM into 13 | # types: 14 | # asm - MIPS assembly block. Symbol names are in 'labels' list below 15 | ranges: 16 | # start, end, type, label 17 | - [0x000000, 0x0A4410, "asm", "main", 0x802447C0] 18 | 19 | # Labels for functions or data memory addresses 20 | # All label addresses are RAM addresses 21 | # Order does not matter 22 | labels: 23 | - [0x802447C0, "MainJump"] 24 | - [0x80244870, "Thread1"] 25 | - [0x80244930, "Thread3"] 26 | - [0x8025615C, "LoadLevel"] 27 | - [0x80267A9C, "Thread4"] 28 | - [0x8026FBB0, "LoadLevelRdus"] 29 | - [0x80270F7C, "Thread5"] 30 | - [0x8028B4C4, "InitiateDma"] 31 | - [0x8028C190, "LoadLevelAmmo"] 32 | - [0x8028D4C0, "LoadLevelTnt"] 33 | - [0x8028FDA0, "LoadLevelSquareBlocks"] 34 | - [0x802A1A9C, "LoadLevelTodo74"] 35 | - [0x802A1C20, "LoadLevelTodo2C"] 36 | - [0x802A1D54, "LoadLevelBuildings"] 37 | - [0x802A2BB0, "CopyBuildingTableToRam"] 38 | - [0x802A2A98, "InflateBuildingData"] 39 | - [0x802A2C54, "LoadLevelTodo60"] 40 | - [0x802A2D68, "LoadLevelTodo4C"] 41 | - [0x802A3008, "LoadLevelTodo78"] 42 | - [0x802A350C, "LoadLevelVehicles"] 43 | - [0x802A303C, "LoadLevelMissileCarrier"] 44 | - [0x802A3D54, "LoadLevelCollisionXZ"] 45 | - [0x802A3DF8, "LoadLevelTodo70"] 46 | - [0x802A3E9C, "LoadLevelTodo64"] 47 | - [0x802A3F80, "LoadLevelTrainPlatform"] 48 | - [0x802A4464, "LoadLevelTerrain"] 49 | - [0x802A44E4, "AlignTo8Bytes"] 50 | - [0x802A5510, "LoadLevelTodo40"] 51 | - [0x802A5604, "LoadLevelTodo44"] 52 | - [0x802A57DC, "DecodeTexture"] 53 | - [0x802A5958, "DecodeTexture6"] 54 | - [0x802A5A2C, "DecodeTexture3"] 55 | - [0x802A5AE0, "DecodeTexture1"] 56 | - [0x802A5B90, "DecodeTexture2"] 57 | - [0x802A5C5C, "DecodeTexture4"] 58 | - [0x802A5D34, "DecodeTexture5"] 59 | - [0x802A5E10, "DecodeTexture0"] 60 | - [0x802C4108, "GzipInflate"] 61 | - [0x802CEAA0, "LoadLevelCommPoint"] 62 | - [0x802D4020, "osInitialize"] 63 | - [0x802D4250, "osEPiRawReadIo"] 64 | - [0x802D42B0, "osCreateThread"] 65 | - [0x802D4400, "osStartThread"] 66 | - [0x802D4560, "osCreatePiManager"] 67 | - [0x802D46E0, "osSetThreadPri"] 68 | - [0x802D47C0, "osSendMesg"] 69 | - [0x802D4910, "osRecvMesg"] 70 | - [0x802D4A50, "osViBlack"] 71 | - [0x802D4AC0, "osGetTime"] 72 | - [0x802D4B50, "__ull_rshift"] 73 | - [0x802D4B7C, "__ull_rem"] 74 | - [0x802D4BB8, "__ull_div"] 75 | - [0x802D4BF4, "__ll_lshift"] 76 | - [0x802D4C20, "__ll_rem"] 77 | - [0x802D4C5C, "__ll_div"] 78 | - [0x802D4CB8, "__ll_mul"] 79 | - [0x802D4CE8, "__ull_divremi"] 80 | - [0x802D4D48, "__ll_mod"] 81 | - [0x802D4DE4, "__ll_rshift"] 82 | - [0x802D4E20, "osVirtualToPhysical"] 83 | - [0x802D4EA0, "osWriteBackDCache"] 84 | - [0x802D4FC0, "guOrthoF"] 85 | - [0x802D5114, "guFrustum"] 86 | - [0x802D5180, "guPerspectiveF"] 87 | - [0x802D53B0, "guPerspective"] 88 | - [0x802D5810, "guMtxF2L"] 89 | - [0x802D5910, "guMtxIdentF"] 90 | - [0x802D5A80, "guRotateRPYF"] 91 | - [0x802D5AD4, "guRotateRPY"] 92 | - [0x802D5FE0, "sqrtf"] 93 | - [0x802D6320, "sinf"] 94 | - [0x802D64E0, "osCreateMesgQueue"] 95 | - [0x802D6550, "osViSetSpecialFeatures"] 96 | - [0x802D6710, "osWriteBackDCacheAll"] 97 | - [0x802D6740, "osInvalDCache"] 98 | - [0x802D67F0, "osDestroyThread"] 99 | - [0x802D68F0, "cosf"] 100 | - [0x802D6A60, "proutSprintf"] 101 | - [0x802D6ACC, "sprintf"] 102 | - [0x802D7660, "osSetIntMask"] 103 | - [0x802D8464, "alBnkfNew"] 104 | - [0x802D8568, "alSetFileNew"] 105 | - [0x802D9820, "osGetCount"] 106 | - [0x802D98D0, "__osViInit"] 107 | - [0x802D9A00, "osAiSetFrequency"] 108 | - [0x802D9B60, "osAiSetNextBuffer"] 109 | - [0x802D9C10, "osAiGetLength"] 110 | - [0x802DA2F0, "osPiStartDma"] 111 | - [0x802DA610, "osCreateViManager"] 112 | - [0x802DA794, "__osViDevMgrMain"] 113 | - [0x802DA970, "osViSetMode"] 114 | - [0x802DA9E0, "osSetEventMsg"] 115 | - [0x802DAA50, "osViSetEventMsg"] 116 | - [0x802DAB50, "osViSwapBuffer"] 117 | - [0x802DABA0, "osSetTimer"] 118 | - [0x802DAD00, "osSpTaskDunno"] 119 | - [0x802DAE1C, "osSpTaskLoad"] 120 | - [0x802DAF7C, "osSpTaskStartGo"] 121 | - [0x802DAFC0, "osSpTaskYield"] 122 | - [0x802DB0A0, "osContInit"] 123 | - [0x802DB29C, "__osContGetInitData"] 124 | - [0x802DB36C, "__osPackRequestData"] 125 | - [0x802DB4D0, "osContStartReadData"] 126 | - [0x802DB594, "osContGetReadData"] 127 | - [0x802DB730, "osInvalCache"] 128 | - [0x802DB7B0, "bzero"] 129 | - [0x802DB9A0, "__osGetSR"] 130 | - [0x802DB9B0, "__osSetFpcCsr"] 131 | - [0x802DB9C0, "__osSiRawReadIo"] 132 | - [0x802DBA10, "__osSiRawWriteIo"] 133 | - [0x802DBA60, "__osExceptionPreamble"] 134 | - [0x802DBA70, "__osExceptionHandler"] 135 | - [0x802DC0A0, "__osEnqueueAndYield"] 136 | - [0x802DC130, "__osEnqueueThread"] 137 | - [0x802DC178, "__osPopThread"] 138 | - [0x802DC188, "__osDispatchThread"] 139 | - [0x802DC2C8, "__osCleanupThread"] 140 | - [0x802DC330, "__osDisableInt"] 141 | - [0x802DC350, "__osRestoreInt"] 142 | - [0x802DC3B0, "__osPiCreateAccessQueue"] 143 | - [0x802DC400, "__osPiGetAccess"] 144 | - [0x802DC444, "__osPiRelAccess"] 145 | - [0x802DC470, "osGetThreadPri"] 146 | - [0x802DC490, "osPiRawStartDma"] 147 | - [0x802DC570, "__osDevMgrMain"] 148 | - [0x802DC6F0, "__osTimerServicesInit"] 149 | - [0x802DC77C, "__osTimerInterrupt"] 150 | - [0x802DC8F4, "__osSetTimerIntr"] 151 | - [0x802DC968, "__osInsertTimer"] 152 | - [0x802DCAF0, "__osProbeTLB"] 153 | - [0x802DCBB0, "_Printf"] 154 | - [0x802DDD40, "memcpy"] 155 | - [0x802DFC00, "__osAiDeviceBusy"] 156 | - [0x802E21A0, "osJamMesg"] 157 | - [0x802E2330, "__osSpGetStatus"] 158 | - [0x802E2340, "bcopy"] 159 | - [0x802E2650, "__osSpSetStatus"] 160 | - [0x802E2660, "__osSpSetPc"] 161 | - [0x802E26A0, "__osSpRawStartDma"] 162 | - [0x802E2730, "__osSpDeviceBusy"] 163 | - [0x802E2760, "__osSiRawStartDma"] 164 | - [0x802E2810, "__osSiCreateAccessQueue"] 165 | - [0x802E2860, "__osSiGetAccess"] 166 | - [0x802E28A4, "__osSiRelAccess"] 167 | - [0x802E28D0, "__osSiDeviceBusy"] 168 | - [0x802E2D80, "__osSyncPutChars"] 169 | - [0x802E2EB0, "__osSetCompare"] 170 | - [0x802E5200, "__osAtomicDec"] 171 | -------------------------------------------------------------------------------- /docs/sm64tools-configs/blast_dozer.code.yaml: -------------------------------------------------------------------------------- 1 | # ROM splitter configuration file 2 | name: "Blast Dozer (J) hd_code_text.raw" 3 | 4 | # checksums from ROM header offsets 0x10 and 0x14 5 | # used for auto configuration detection 6 | checksum1: 0x3C0E00FF 7 | checksum2: 0x35CEB000 8 | 9 | # base filename used for outputs (please, no spaces) 10 | basename: "blast_dozer.hd_code_text" 11 | 12 | # ranges to split the ROM into 13 | # types: 14 | # asm - MIPS assembly block. Symbol names are in 'labels' list below 15 | ranges: 16 | # start, end, type, label 17 | - [0x000000, 0x0A4360, "asm", "main", 0x802447C0] 18 | 19 | # Labels for functions or data memory addresses 20 | # All label addresses are RAM addresses 21 | # Order does not matter 22 | labels: 23 | - [0x802447C0, "MainJump"] 24 | - [0x80244870, "Thread1"] 25 | - [0x80244930, "Thread3"] 26 | - [0x8025615C, "LoadLevel"] 27 | - [0x80267C5C, "Thread4"] 28 | - [0x8026FEB0, "LoadLevelRdus"] 29 | - [0x8027127C, "Thread5"] 30 | - [0x8028B824, "InitiateDma"] 31 | - [0x8028C4F0, "LoadLevelAmmo"] 32 | - [0x8028D820, "LoadLevelTnt"] 33 | - [0x80290100, "LoadLevelSquareBlocks"] 34 | - [0x802A1E0C, "LoadLevelTodo74"] 35 | - [0x802A1F90, "LoadLevelTodo2C"] 36 | - [0x802A20C4, "LoadLevelBuildings"] 37 | - [0x802A2F20, "CopyBuildingTableToRam"] 38 | - [0x802A2E08, "InflateBuildingData"] 39 | - [0x802A2FC4, "LoadLevelTodo60"] 40 | - [0x802A30D8, "LoadLevelTodo4C"] 41 | - [0x802A3378, "LoadLevelTodo78"] 42 | - [0x802A387C, "LoadLevelVehicles"] 43 | - [0x802A33AC, "LoadLevelMissileCarrier"] 44 | - [0x802A40C4, "LoadLevelCollisionXZ"] 45 | - [0x802A4168, "LoadLevelTodo70"] 46 | - [0x802A420C, "LoadLevelTodo64"] 47 | - [0x802A42F0, "LoadLevelTrainPlatform"] 48 | - [0x802A47D4, "LoadLevelTerrain"] 49 | - [0x802A4854, "AlignTo8Bytes"] 50 | - [0x802A5880, "LoadLevelTodo40"] 51 | - [0x802A5974, "LoadLevelTodo44"] 52 | - [0x802A5B4C, "DecodeTexture"] 53 | - [0x802A5CC8, "DecodeTexture6"] 54 | - [0x802A5D9C, "DecodeTexture3"] 55 | - [0x802A5E50, "DecodeTexture1"] 56 | - [0x802A5F00, "DecodeTexture2"] 57 | - [0x802A5FCC, "DecodeTexture4"] 58 | - [0x802A60A4, "DecodeTexture5"] 59 | - [0x802A6180, "DecodeTexture0"] 60 | - [0x802C44D8, "GzipInflate"] 61 | - [0x802CEE70, "LoadLevelCommPoint"] 62 | - [0x802D43F0, "osInitialize"] 63 | - [0x802D4620, "osEPiRawReadIo"] 64 | - [0x802D4680, "osCreateThread"] 65 | - [0x802D47D0, "osStartThread"] 66 | - [0x802D4930, "osCreatePiManager"] 67 | - [0x802D4AB0, "osSetThreadPri"] 68 | - [0x802D4B90, "osSendMesg"] 69 | - [0x802D4CE0, "osRecvMesg"] 70 | - [0x802D4E20, "osViBlack"] 71 | - [0x802D4E90, "osGetTime"] 72 | - [0x802D4F20, "__ull_rshift"] 73 | - [0x802D4F4C, "__ull_rem"] 74 | - [0x802D4F88, "__ull_div"] 75 | - [0x802D4FC4, "__ll_lshift"] 76 | - [0x802D4FF0, "__ll_rem"] 77 | - [0x802D502C, "__ll_div"] 78 | - [0x802D5088, "__ll_mul"] 79 | - [0x802D50B8, "__ull_divremi"] 80 | - [0x802D5118, "__ll_mod"] 81 | - [0x802D51B4, "__ll_rshift"] 82 | - [0x802D51F0, "osVirtualToPhysical"] 83 | - [0x802D5270, "osWriteBackDCache"] 84 | - [0x802D5390, "guOrthoF"] 85 | - [0x802D54E4, "guFrustum"] 86 | - [0x802D5550, "guPerspectiveF"] 87 | - [0x802D5780, "guPerspective"] 88 | - [0x802D5BE0, "guMtxF2L"] 89 | - [0x802D5CE0, "guMtxIdentF"] 90 | - [0x802D5E50, "guRotateRPYF"] 91 | - [0x802D5EA4, "guRotateRPY"] 92 | - [0x802D63B0, "sqrtf"] 93 | - [0x802D66F0, "sinf"] 94 | - [0x802D68B0, "osCreateMesgQueue"] 95 | - [0x802D6920, "osViSetSpecialFeatures"] 96 | - [0x802D6AE0, "osWriteBackDCacheAll"] 97 | - [0x802D6B10, "osInvalDCache"] 98 | - [0x802D6BC0, "osDestroyThread"] 99 | - [0x802D6CC0, "cosf"] 100 | - [0x802D6E30, "proutSprintf"] 101 | - [0x802D6E9C, "sprintf"] 102 | - [0x802D7A30, "osSetIntMask"] 103 | - [0x802D8834, "alBnkfNew"] 104 | - [0x802D8938, "alSetFileNew"] 105 | - [0x802D9BF0, "osGetCount"] 106 | - [0x802D9CA0, "__osViInit"] 107 | - [0x802D9DD0, "osAiSetFrequency"] 108 | - [0x802D9F30, "osAiSetNextBuffer"] 109 | - [0x802D9FE0, "osAiGetLength"] 110 | - [0x802DA6C0, "osPiStartDma"] 111 | - [0x802DA9E0, "osCreateViManager"] 112 | - [0x802DAB64, "__osViDevMgrMain"] 113 | - [0x802DAD40, "osViSetMode"] 114 | - [0x802DADB0, "osSetEventMsg"] 115 | - [0x802DAE20, "osViSetEventMsg"] 116 | - [0x802DAF20, "osViSwapBuffer"] 117 | - [0x802DAF70, "osSetTimer"] 118 | - [0x802DB0D0, "osSpTaskDunno"] 119 | - [0x802DB1EC, "osSpTaskLoad"] 120 | - [0x802DB34C, "osSpTaskStartGo"] 121 | - [0x802DB390, "osSpTaskYield"] 122 | - [0x802DB470, "osContInit"] 123 | - [0x802DB66C, "__osContGetInitData"] 124 | - [0x802DB73C, "__osPackRequestData"] 125 | - [0x802DB8A0, "osContStartReadData"] 126 | - [0x802DB964, "osContGetReadData"] 127 | - [0x802DBB00, "osInvalCache"] 128 | - [0x802DBB80, "bzero"] 129 | # [0x802DBD60, "__osSetSR"] 130 | - [0x802DBD70, "__osGetSR"] 131 | - [0x802DBD80, "__osSetFpcCsr"] 132 | - [0x802DBD90, "__osSiRawReadIo"] 133 | - [0x802DBDE0, "__osSiRawWriteIo"] 134 | - [0x802DBE30, "__osExceptionPreamble"] 135 | - [0x802DBE40, "__osExceptionHandler"] 136 | - [0x802DC470, "__osEnqueueAndYield"] 137 | - [0x802DC500, "__osEnqueueThread"] 138 | - [0x802DC548, "__osPopThread"] 139 | - [0x802DC558, "__osDispatchThread"] 140 | - [0x802DC698, "__osCleanupThread", 0x802DC6A0] 141 | - [0x802DC700, "__osDisableInt"] 142 | - [0x802DC720, "__osRestoreInt"] 143 | - [0x802DC780, "__osPiCreateAccessQueue"] 144 | - [0x802DC7D0, "__osPiGetAccess"] 145 | - [0x802DC814, "__osPiRelAccess"] 146 | - [0x802DC840, "osGetThreadPri"] 147 | - [0x802DC860, "osPiRawStartDma"] 148 | - [0x802DC940, "__osDevMgrMain"] 149 | - [0x802DCAC0, "__osTimerServicesInit"] 150 | - [0x802DCB4C, "__osTimerInterrupt"] 151 | - [0x802DCCC4, "__osSetTimerIntr"] 152 | - [0x802DCD38, "__osInsertTimer"] 153 | - [0x802DCEC0, "__osProbeTLB"] 154 | - [0x802DCF80, "_Printf"] 155 | - [0x802DE110, "memcpy"] 156 | - [0x802DFFD0, "__osAiDeviceBusy"] 157 | - [0x802E2570, "osJamMesg"] 158 | - [0x802E2700, "__osSpGetStatus"] 159 | - [0x802E2710, "bcopy"] 160 | - [0x802E2A20, "__osSpSetStatus"] 161 | - [0x802E2A30, "__osSpSetPc"] 162 | - [0x802E2A70, "__osSpRawStartDma"] 163 | - [0x802E2B00, "__osSpDeviceBusy"] 164 | - [0x802E2B30, "__osSiRawStartDma"] 165 | - [0x802E2BE0, "__osSiCreateAccessQueue"] 166 | - [0x802E2C30, "__osSiGetAccess"] 167 | - [0x802E2C74, "__osSiRelAccess"] 168 | - [0x802E2CA0, "__osSiDeviceBusy"] 169 | - [0x802E3150, "__osSyncPutChars"] 170 | - [0x802E3280, "__osSetCompare"] 171 | - [0x802E55D0, "__osAtomicDec"] 172 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project('blastcorps', 'c', 2 | version : '0.1', 3 | default_options : [ 4 | 'c_std=c2x', 5 | 'warning_level=3', 6 | 'buildtype=release', 7 | ], 8 | ) 9 | 10 | subdir('tools/src') 11 | 12 | run_target('format', command : ['clang-format', '-i', all_sources]) 13 | 14 | run_target('tidy', command : ['clang-tidy', '-p=' + meson.build_root(), 15 | all_sources]) 16 | 17 | -------------------------------------------------------------------------------- /tools/gzip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/gzip -------------------------------------------------------------------------------- /tools/ido5.3_recomp/Makefile: -------------------------------------------------------------------------------- 1 | IRIX_ROOT := ../ido5.3_compiler 2 | 3 | cc: OPT_CFLAGS := -O2 4 | cfe: OPT_CFLAGS := -O2 5 | uopt: OPT_CFLAGS := -O2 6 | ugen: OPT_CFLAGS := -O2 7 | as1: OPT_CFLAGS := -O2 8 | acpp: OPT_CFLAGS := -O2 9 | 10 | RECOMP := recomp 11 | 12 | ugen_c.c: RECOMP_FLAGS := --conservative 13 | 14 | all: cc cfe uopt ugen as1 acpp copt ujoin uld umerge usplit err.english.cc 15 | 16 | clean: 17 | $(RM) cc* cfe* uopt* ugen* as1* acpp* copt* ujoin* uld* umerge* usplit* err.english.cc $(RECOMP) libc_impl.o 18 | 19 | $(RECOMP): recomp.cpp 20 | $(CXX) $^ -o $@ -std=c++11 -O2 -Wno-switch `pkg-config --cflags --libs capstone` 21 | 22 | libc_impl.o: libc_impl.c libc_impl.h 23 | $(CC) $< -c -fno-strict-aliasing -O2 -DIDO53 24 | 25 | err.english.cc: $(IRIX_ROOT)/usr/lib/err.english.cc 26 | cp $^ $@ 27 | 28 | cc_c.c: $(IRIX_ROOT)/usr/bin/cc $(RECOMP) 29 | ./$(RECOMP) $(RECOMP_FLAGS) $< > $@ 30 | 31 | %_c.c: $(IRIX_ROOT)/usr/lib/% $(RECOMP) 32 | ./$(RECOMP) $(RECOMP_FLAGS) $< > $@ 33 | 34 | %: %_c.c libc_impl.o 35 | $(CC) libc_impl.o $< -o $@ $(OPT_CFLAGS) -fno-strict-aliasing -lm -no-pie 36 | 37 | .PHONY: all clean 38 | -------------------------------------------------------------------------------- /tools/ido5.3_recomp/README.md: -------------------------------------------------------------------------------- 1 | To reproduce this directory: 2 | 3 | ```sh 4 | cd 5 | git clone https://github.com/n64decomp/sm64.git 6 | cd sm64/tools/ido5.3_recomp 7 | make all --jobs 8 | # copy everything 9 | cp ./* ../../../conker/ido/ido5.3_recomp/ 10 | ``` 11 | -------------------------------------------------------------------------------- /tools/ido5.3_recomp/acpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/acpp -------------------------------------------------------------------------------- /tools/ido5.3_recomp/as1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/as1 -------------------------------------------------------------------------------- /tools/ido5.3_recomp/cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/cc -------------------------------------------------------------------------------- /tools/ido5.3_recomp/cfe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/cfe -------------------------------------------------------------------------------- /tools/ido5.3_recomp/copt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/copt -------------------------------------------------------------------------------- /tools/ido5.3_recomp/elf.h: -------------------------------------------------------------------------------- 1 | #ifndef ELF_H 2 | #define ELF_H 3 | 4 | #include 5 | 6 | #define EI_DATA 5 7 | #define EI_NIDENT 16 8 | #define SHT_SYMTAB 2 9 | #define SHT_DYNAMIC 6 10 | #define SHT_REL 9 11 | #define SHT_DYNSYM 11 12 | #define SHT_MIPS_REGINFO 0x70000006 13 | #define STN_UNDEF 0 14 | #define STT_OBJECT 1 15 | #define STT_FUNC 2 16 | #define DT_PLTGOT 3 17 | #define DT_MIPS_LOCAL_GOTNO 0x7000000a 18 | #define DT_MIPS_SYMTABNO 0x70000011 19 | #define DT_MIPS_GOTSYM 0x70000013 20 | 21 | #define ELF32_R_SYM(info) ((info) >> 8) 22 | #define ELF32_R_TYPE(info) ((info) & 0xff) 23 | 24 | #define ELF32_ST_TYPE(info) ((info) & 0xf) 25 | 26 | #define R_MIPS_26 4 27 | #define R_MIPS_HI16 5 28 | #define R_MIPS_LO16 6 29 | 30 | #define SHN_UNDEF 0 31 | #define SHN_COMMON 0xfff2 32 | #define SHN_MIPS_ACOMMON 0xff00 33 | #define SHN_MIPS_TEXT 0xff01 34 | #define SHN_MIPS_DATA 0xff02 35 | 36 | typedef uint32_t Elf32_Addr; 37 | typedef uint32_t Elf32_Off; 38 | 39 | typedef struct { 40 | uint8_t e_ident[EI_NIDENT]; 41 | uint16_t e_type; 42 | uint16_t e_machine; 43 | uint32_t e_version; 44 | Elf32_Addr e_entry; 45 | Elf32_Off e_phoff; 46 | Elf32_Off e_shoff; 47 | uint32_t e_flags; 48 | uint16_t e_ehsize; 49 | uint16_t e_phentsize; 50 | uint16_t e_phnum; 51 | uint16_t e_shentsize; 52 | uint16_t e_shnum; 53 | uint16_t e_shstrndx; 54 | } Elf32_Ehdr; 55 | 56 | typedef struct { 57 | uint32_t sh_name; 58 | uint32_t sh_type; 59 | uint32_t sh_flags; 60 | Elf32_Addr sh_addr; 61 | Elf32_Off sh_offset; 62 | uint32_t sh_size; 63 | uint32_t sh_link; 64 | uint32_t sh_info; 65 | uint32_t sh_addralign; 66 | uint32_t sh_entsize; 67 | } Elf32_Shdr; 68 | 69 | typedef struct { 70 | uint32_t st_name; 71 | Elf32_Addr st_value; 72 | uint32_t st_size; 73 | uint8_t st_info; 74 | uint8_t st_other; 75 | uint16_t st_shndx; 76 | } Elf32_Sym; 77 | 78 | typedef struct { 79 | Elf32_Addr r_offset; 80 | uint32_t r_info; 81 | } Elf32_Rel; 82 | 83 | typedef struct 84 | { 85 | uint32_t ri_gprmask; /* General registers used. */ 86 | uint32_t ri_cprmask[4]; /* Coprocessor registers used. */ 87 | int32_t ri_gp_value; /* $gp register value. */ 88 | } Elf32_RegInfo; 89 | 90 | typedef struct 91 | { 92 | int32_t d_tag; /* Dynamic entry type */ 93 | union { 94 | uint32_t d_val; /* Integer value */ 95 | Elf32_Addr d_ptr; /* Address value */ 96 | } d_un; 97 | } Elf32_Dyn; 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /tools/ido5.3_recomp/header.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "libc_impl.h" 9 | #include "helpers.h" 10 | 11 | #define RM_RN 0 12 | #define RM_RZ 1 13 | #define RM_RP 2 14 | #define RM_RM 3 15 | 16 | union FloatReg { 17 | float f[2]; 18 | uint32_t w[2]; 19 | double d; 20 | }; 21 | 22 | #define cvt_w_d(f) \ 23 | ((fcsr & RM_RZ) ? ((isnan(f) || f <= -2147483649.0 || f >= 2147483648.0) ? (fcsr |= 0x40, 2147483647) : (int)f) : (assert(0), 0)) 24 | 25 | #define cvt_w_s(f) cvt_w_d((double)f) 26 | 27 | static union FloatReg f0 = {{0, 0}}, f2 = {{0, 0}}, f4 = {{0, 0}}, f6 = {{0, 0}}, f8 = {{0, 0}}, 28 | f10 = {{0, 0}}, f12 = {{0, 0}}, f14 = {{0, 0}}, f16 = {{0, 0}}, f18 = {{0, 0}}, f20 = {{0, 0}}, 29 | f22 = {{0, 0}}, f24 = {{0, 0}}, f26 = {{0, 0}}, f28 = {{0, 0}}, f30 = {{0, 0}}; 30 | static uint32_t fcsr = 1; 31 | -------------------------------------------------------------------------------- /tools/ido5.3_recomp/helpers.h: -------------------------------------------------------------------------------- 1 | #ifndef HELPERS_H 2 | #define HELPERS_H 3 | 4 | #include 5 | 6 | #define MEM_U32(a) (*(uint32_t *)(mem + a)) 7 | #define MEM_S32(a) (*(int32_t *)(mem + a)) 8 | #define MEM_U16(a) (*(uint16_t *)(mem + ((a) ^ 2))) 9 | #define MEM_S16(a) (*(int16_t *)(mem + ((a) ^ 2))) 10 | #define MEM_U8(a) (*(uint8_t *)(mem + ((a) ^ 3))) 11 | #define MEM_S8(a) (*(int8_t *)(mem + ((a) ^ 3))) 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /tools/ido5.3_recomp/libc_impl.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/libc_impl.o -------------------------------------------------------------------------------- /tools/ido5.3_recomp/recomp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/recomp -------------------------------------------------------------------------------- /tools/ido5.3_recomp/ugen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/ugen -------------------------------------------------------------------------------- /tools/ido5.3_recomp/ujoin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/ujoin -------------------------------------------------------------------------------- /tools/ido5.3_recomp/uld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/uld -------------------------------------------------------------------------------- /tools/ido5.3_recomp/umerge: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/umerge -------------------------------------------------------------------------------- /tools/ido5.3_recomp/uopt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/uopt -------------------------------------------------------------------------------- /tools/ido5.3_recomp/usplit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/ido5.3_recomp/usplit -------------------------------------------------------------------------------- /tools/rarezip.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import os 3 | import re 4 | import struct 5 | import subprocess 6 | import sys 7 | 8 | 9 | # BlastCorps gzip header 10 | # 0x1f8b # GZIP magic 11 | # 0x08 # DEFLATE 12 | # 0x08 # FLG.FNAME 13 | # 0x???????? # MTIME, seconds since epoch (1st Jan 1970) 14 | # 0x00 # No extra flags 15 | # 0x03 # Unix OS 16 | # 0x??..??00 # variable length, NUL-terminated, filename 17 | 18 | 19 | def compress_file(filepath, name=None, time=None, level=6): 20 | # force use of the gzip that sits along this file 21 | gzip = os.path.join(os.path.dirname(os.path.realpath(__file__)), "gzip") 22 | args = [gzip, f"-{level}", "--no-name", "-c", filepath] 23 | res = subprocess.run(args, capture_output=True) 24 | if res.returncode != 0: 25 | return None 26 | return (b'\x1f\x8b' + 27 | b'\x08' + 28 | b'\x08' + 29 | struct.pack("") 9 | 10 | 11 | def blast_get_format(blast_type: int) -> str: 12 | match blast_type: 13 | case 1: 14 | return "rgba16" 15 | case (2 | 5): 16 | return "rgba32" 17 | case (3 | 6): 18 | return "ia8" 19 | case 4: 20 | return "ia16" 21 | case _: 22 | return "" 23 | 24 | 25 | def main(): 26 | if len(sys.argv) != 2: 27 | print_usage() 28 | return 29 | 30 | with open(sys.argv[1], "r") as f: 31 | sm64_yaml = f.read().splitlines() 32 | 33 | range_lines = [] 34 | is_range_line = False 35 | for line in sm64_yaml: 36 | stripped = line.strip() 37 | if line == "ranges:": 38 | is_range_line = True 39 | elif stripped and not line.startswith(" "): 40 | is_range_line = False 41 | elif stripped and is_range_line and not stripped.startswith("#"): 42 | range_lines.append(line) 43 | 44 | segments = [] 45 | for line in range_lines: 46 | if line.startswith(" "): 47 | is_sub_segment = True 48 | elif line.startswith(" "): 49 | is_sub_segment = False 50 | else: 51 | raise Exception(f"Unexpected indent in '{line}'") 52 | 53 | if line.endswith(":"): 54 | assert not is_sub_segment 55 | 56 | split_line = line.\ 57 | split("#")[0].\ 58 | replace(":", "").\ 59 | replace("- [", "").\ 60 | replace("]", "").\ 61 | strip().\ 62 | split(",") 63 | 64 | clean_line = [] 65 | for element in split_line: 66 | clean_line.append(element.replace('"', "").strip()) 67 | 68 | if not is_sub_segment: 69 | match clean_line[2]: 70 | case "gzip": 71 | segment = { 72 | "start": clean_line[0], 73 | "end": clean_line[1], 74 | "type": "rzip", 75 | "name": clean_line[3].replace(".raw", ""), 76 | "subsegments": [] 77 | } 78 | case "blast": 79 | segment = { 80 | "start": clean_line[0], 81 | "end": clean_line[1], 82 | "type": "blast", 83 | "blast": int(clean_line[3]), 84 | "subsegments": [] 85 | } 86 | case _: 87 | segment = { 88 | "start": clean_line[0], 89 | "end": clean_line[1], 90 | "type": "bin" 91 | } 92 | segments.append(segment) 93 | else: 94 | assert len(clean_line) == 5 95 | subsegment = { 96 | "start": clean_line[0], 97 | "type": clean_line[1].replace("tex.", "") + clean_line[2], 98 | "width": int(clean_line[3]), 99 | "height": int(clean_line[4]) 100 | } 101 | segments[-1]["subsegments"].append(subsegment) 102 | 103 | last_end = "" 104 | 105 | for segment in segments: 106 | if last_end and last_end != segment["start"]: 107 | unknown_size = int(segment["start"], 16) - int(last_end, 16) 108 | print(f" - [{last_end}] # {unknown_size} bytes") 109 | last_end = segment["end"] 110 | 111 | if segment["type"] == "rzip": 112 | if len(segment["subsegments"]) == 0: 113 | print(f" - [{segment['start']}, rzip, {segment['name']}]") 114 | elif len(segment["subsegments"]) == 1: 115 | t = segment['subsegments'][0]['type'] 116 | w = segment['subsegments'][0]['width'] 117 | h = segment['subsegments'][0]['height'] 118 | seg_str = f" - [{segment['start']}, rzip, {segment['name']}, {t}, {w}, {h}]" 119 | print(seg_str) 120 | elif len(segment["subsegments"]) > 1: 121 | print(f" - name: {segment['name']}") 122 | print(f" type: rzip") 123 | print(f" start: {segment['start']}") 124 | print(f" subsegments:") 125 | for subsegment in segment["subsegments"]: 126 | s = subsegment['start'] 127 | t = subsegment['type'] 128 | w = subsegment['width'] 129 | h = subsegment['height'] 130 | print(f" - [{s}, {t}, {w}, {h}]") 131 | elif segment["type"] == "blast": 132 | assert len(segment["subsegments"]) > 0 133 | 134 | if len(segment["subsegments"]) == 1: 135 | 136 | short_address = "%06X" % int(segment['start'], 16) 137 | file_name = f"{short_address}.blast{segment['blast']}" 138 | 139 | if segment['blast'] == 0: 140 | segment_size = int(segment["end"], 16) - int(segment["start"], 16) 141 | match segment_size: 142 | case 128: 143 | print(f" - [{segment['start']}, bin, {short_address}.lut128]") 144 | case 256: 145 | print(f" - [{segment['start']}, bin, {short_address}.lut256]") 146 | case _: 147 | print(f" - [{segment['start']}, blast, {file_name}, {segment['blast']}] # {segment_size} bytes") 148 | else: 149 | w = segment['subsegments'][0]['width'] 150 | h = segment['subsegments'][0]['height'] 151 | print(f" - [{segment['start']}, blast, {file_name}, {segment['blast']}, {w}, {h}]") 152 | elif len(segment["subsegments"]) > 1: 153 | assert segment["blast"] != 0 154 | 155 | short_address = "%06X" % int(segment['start'], 16) 156 | file_name = f"{short_address}.blast{segment['blast']}" 157 | 158 | print(f" - name: {file_name}") 159 | print(f" type: blast") 160 | print(f" start: {segment['start']}") 161 | print(f" blast: {segment['blast']}") 162 | print(f" subsegments:") 163 | for subsegment in segment["subsegments"]: 164 | assert subsegment['type'] == blast_get_format(segment['blast']) 165 | print(f" - [{subsegment['start']}, {subsegment['width']}, {subsegment['height']}]") 166 | elif segment["type"] == "bin": 167 | short_address = "%06X" % int(segment['start'], 16) 168 | print(f" - [{segment['start']}, bin, {short_address}.bin]") 169 | 170 | 171 | main() 172 | -------------------------------------------------------------------------------- /tools/splat_ext/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retroplastic/blastcorps/baa807e502c0b8d608aea4e26fe58752d2797f01/tools/splat_ext/__init__.py -------------------------------------------------------------------------------- /tools/splat_ext/rzip.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from segtypes.n64.rgba16 import N64SegRgba16 4 | from segtypes.n64.rgba32 import N64SegRgba32 5 | from segtypes.n64.ia8 import N64SegIa8 6 | from segtypes.n64.ia16 import N64SegIa16 7 | from segtypes.n64.img import N64SegImg 8 | from segtypes.n64.segment import N64Segment 9 | from util import options 10 | import subprocess 11 | 12 | 13 | def split_segment_bytes(subsegments, decoded_bytes: bytes): 14 | segment_bytes = [] 15 | separators = [] 16 | for segment in subsegments: 17 | separators.append(segment[0]) 18 | separators.append(len(decoded_bytes)) 19 | 20 | for i in range(len(subsegments)): 21 | from_slice = separators[i] 22 | to_slice = separators[i + 1] 23 | segment_bytes.append(decoded_bytes[from_slice:to_slice]) 24 | 25 | return segment_bytes 26 | 27 | 28 | def get_png_writer(file_type: str) -> N64SegImg: 29 | match file_type: 30 | case "rgba16": 31 | return N64SegRgba16 32 | case "rgba32": 33 | return N64SegRgba32 34 | case "ia8": 35 | return N64SegIa8 36 | case "ia16": 37 | return N64SegIa16 38 | case _: 39 | return None 40 | 41 | 42 | class N64SegRzip(N64Segment): 43 | def write_png(self, type_str: str, width: int, height: int, decompressed_file_name: str, image_bytes: bytes): 44 | writer_class = get_png_writer(type_str) 45 | png_writer = writer_class.get_writer(width, height) 46 | 47 | png_name = decompressed_file_name.replace("raw", "png") 48 | png_dir_path = options.get_asset_path() / self.dir / "png" / "rzip" 49 | png_dir_path.mkdir(exist_ok=True, parents=True) 50 | png_file_path = png_dir_path / png_name 51 | 52 | with open(png_file_path, "wb") as f: 53 | match type_str: 54 | case "ia16": 55 | png_writer.write_array(f, image_bytes) 56 | case _: 57 | png_writer.write_array(f, writer_class.parse_image(image_bytes, width, height, False, False)) 58 | 59 | def write_png_segments(self, decompressed_file_name: str, segment_bytes: list[bytes], subsegments): 60 | assert len(segment_bytes) == len(subsegments) 61 | 62 | for i in range(len(segment_bytes)): 63 | 64 | assert len(subsegments[i]) == 4 65 | 66 | type_str = subsegments[i][1] 67 | width = subsegments[i][2] 68 | height = subsegments[i][3] 69 | 70 | writer_class = get_png_writer(type_str) 71 | png_writer = writer_class.get_writer(width, height) 72 | 73 | png_name = decompressed_file_name.replace("raw", f"{i}.png") 74 | png_dir_path = options.get_asset_path() / self.dir / "png" / "rzip" 75 | png_dir_path.mkdir(exist_ok=True, parents=True) 76 | png_file_path = png_dir_path / png_name 77 | 78 | with open(png_file_path, "wb") as f: 79 | match type_str: 80 | case "ia16": 81 | png_writer.write_array(f, segment_bytes[i]) 82 | case _: 83 | png_writer.write_array(f, writer_class.parse_image(segment_bytes[i], 84 | width, height, False, False)) 85 | 86 | def split(self, rom_bytes): 87 | split_dir_path = options.get_asset_path() / self.dir / "split" 88 | split_dir_path.mkdir(exist_ok=True, parents=True) 89 | gz_file_path = split_dir_path / f"{self.name}.gz" 90 | 91 | # Write compressed 92 | compressed_bytes = rom_bytes[self.rom_start: self.rom_end] 93 | with open(gz_file_path, "wb") as f: 94 | f.write(compressed_bytes) 95 | 96 | # Decompressed 97 | subprocess.call(["gzip", "-d", "-k", "-N", "-f", gz_file_path]) 98 | 99 | gzip_info = subprocess.check_output(["gzip", "-N", "-l", gz_file_path]) 100 | decompressed_file_name = gzip_info.decode().splitlines()[-1].split()[-1].split("/")[-1] 101 | decompressed_file_path = options.get_asset_path() / self.dir / "split" / decompressed_file_name 102 | 103 | decoded_dir_path = options.get_asset_path() / self.dir / "uncompressed" 104 | decoded_dir_path.mkdir(exist_ok=True, parents=True) 105 | 106 | new_decompressed_file_path = decoded_dir_path / decompressed_file_name 107 | 108 | # Move result to uncompressed folder 109 | os.rename(decompressed_file_path, new_decompressed_file_path) 110 | 111 | # Write PNG 112 | if len(self.yaml) == 6 or isinstance(self.yaml, dict): 113 | 114 | with open(new_decompressed_file_path, "rb") as f: 115 | image_bytes = f.read() 116 | 117 | if isinstance(self.yaml, list): 118 | # Single segment 119 | type_str = self.yaml[3] 120 | width = self.yaml[4] 121 | height = self.yaml[5] 122 | self.write_png(type_str, width, height, decompressed_file_name, image_bytes) 123 | elif isinstance(self.yaml, dict): 124 | subsegments = self.yaml["subsegments"] 125 | segment_bytes = split_segment_bytes(subsegments, image_bytes) 126 | self.write_png_segments(decompressed_file_name, segment_bytes, subsegments) 127 | -------------------------------------------------------------------------------- /tools/src/blast.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | typedef enum 7 | { 8 | BLAST0 = 0, 9 | BLAST1_RGBA16, 10 | BLAST2_RGBA32, 11 | BLAST3_IA8, 12 | BLAST4_IA16, 13 | BLAST5_RGBA32, 14 | BLAST6_IA8 15 | } blast_t; 16 | 17 | typedef struct 18 | { 19 | uint32_t w; 20 | uint32_t h; 21 | } res_t; 22 | 23 | int32_t 24 | decode_blast(uint8_t* src, uint32_t size, blast_t type, uint8_t* result_bytes); 25 | 26 | int32_t 27 | decode_blast_lookup(uint8_t* src, 28 | uint32_t size, 29 | blast_t type, 30 | uint8_t* result_bytes, 31 | uint8_t* lut); 32 | 33 | // This cannot be reliably determined by the data and needs to be 34 | // tracked manually in the splat yaml. 35 | res_t 36 | guess_resolution(blast_t type, int32_t size); 37 | 38 | const char* 39 | get_type_format_name(blast_t type); 40 | 41 | int32_t 42 | get_type_depth(blast_t type); 43 | 44 | bool 45 | convert_to_png(char* fname, uint16_t len, blast_t type); 46 | -------------------------------------------------------------------------------- /tools/src/gen_splat_yaml.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier:Unlicense 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "blast.h" 9 | #include "utils.h" 10 | 11 | // list_gzips is based on SubDrag's GEDecompressor. 12 | // It looks for zip signatures in a ROM and print results in splat yaml syntax. 13 | void 14 | list_gzips(uint8_t* bytes, size_t size) 15 | { 16 | for (uint64_t address = 0x0; address < size; address++) 17 | { 18 | // clang-format off 19 | if (bytes[address] == 0x1F && 20 | bytes[address + 1] == 0x8B && 21 | bytes[address + 2] == 0x08 && 22 | bytes[address + 3] == 0x08) 23 | // clang-format on 24 | { 25 | char name[300]; 26 | 27 | for (uint32_t pos = 0; bytes[address + 0xA + pos - 1] != 0; pos++) 28 | { 29 | name[pos] = bytes[address + 0xA + pos]; 30 | } 31 | 32 | printf(" - [0x%06lX, bin, %s]\n", address, name); 33 | } 34 | } 35 | } 36 | 37 | #define ROM_OFFSET 0x4CE0 38 | #define END_OFFSET 0xCCE0 39 | 40 | void 41 | list_blasts(uint8_t* bytes, size_t size) 42 | { 43 | uint32_t last_to = 0; 44 | 45 | // loop through from 0x4CE0 to 0xCCE0 46 | for (uint32_t address = ROM_OFFSET; address < END_OFFSET; address += 8) 47 | { 48 | uint32_t start = read_u32_be(&bytes[address]); 49 | uint16_t compressed_size = read_u16_be(&bytes[address + 4]); 50 | blast_t type = read_u16_be(&bytes[address + 6]); 51 | 52 | assert(size >= start); 53 | 54 | // TODO: there are large sections of len=0, possibly LUTs for 4 & 5? 55 | if (compressed_size == 0) 56 | { 57 | continue; 58 | } 59 | 60 | // TODO: Figure out why 0x318CA0 has multiple entries 61 | // Skip all entries for 0x318CA0, but the last one 62 | if (start + ROM_OFFSET == 0x318CA0 && compressed_size != 256) 63 | { 64 | continue; 65 | } 66 | 67 | uint32_t from = start + ROM_OFFSET; 68 | 69 | if (last_to != 0 && last_to != from) 70 | { 71 | uint32_t space_size = from - last_to; 72 | printf(" - [0x%06X] # %d bytes\n", last_to, space_size); 73 | } 74 | 75 | if (type != BLAST0) 76 | { 77 | int32_t decompressed_size = 0; 78 | uint8_t* decompressed_bytes = malloc(100 * compressed_size); 79 | res_t res = { 0, 0 }; 80 | if (type == BLAST4_IA16 || type == BLAST5_RGBA32) 81 | { 82 | // TODO: need to figure out where last param is set for decoders 4 and 5 83 | uint8_t* lut; 84 | switch (type) 85 | { 86 | case BLAST4_IA16: 87 | lut = &bytes[0x047480]; 88 | break; 89 | case BLAST5_RGBA32: 90 | // 0x0998E0 91 | // 0x1E2C00 92 | lut = &bytes[0x152970]; 93 | break; 94 | default: 95 | lut = NULL; 96 | } 97 | decompressed_size = decode_blast_lookup(&bytes[start + ROM_OFFSET], 98 | compressed_size, 99 | type, 100 | decompressed_bytes, 101 | lut); 102 | } 103 | else 104 | { 105 | decompressed_size = decode_blast(&bytes[start + ROM_OFFSET], 106 | compressed_size, 107 | type, 108 | decompressed_bytes); 109 | } 110 | 111 | res = guess_resolution(type, decompressed_size); 112 | 113 | printf(" - [0x%06X, blast, %06X.blast%d, %d, %d, %d]\n", 114 | from, 115 | from, 116 | type, 117 | type, 118 | res.w, 119 | res.h); 120 | } 121 | else if (compressed_size == 128) 122 | { 123 | // Portential lookup table for blast4. 124 | printf(" - [0x%06X, bin, %06X.lut128]\n", from, from); 125 | } 126 | else if (compressed_size == 256) 127 | { 128 | // Potential lookup table for blast5. 129 | printf(" - [0x%06X, bin, %06X.lut256]\n", from, from); 130 | } 131 | else 132 | { 133 | printf(" - [0x%06X, blast, %06X.blast0, 0]\n", from, from); 134 | } 135 | 136 | last_to = start + ROM_OFFSET + compressed_size; 137 | } 138 | 139 | // Print last to 140 | printf(" - [0x%06X]\n", last_to); 141 | } 142 | 143 | int 144 | main(int argc, char** argv) 145 | { 146 | if (argc != 2) 147 | { 148 | printf("Usage:\n"); 149 | printf("%s \n", argv[0]); 150 | return EXIT_FAILURE; 151 | } 152 | 153 | uint8_t* bytes; 154 | size_t size = read_file(argv[1], &bytes); 155 | 156 | list_blasts(bytes, size); 157 | list_gzips(bytes, size); 158 | 159 | free(bytes); 160 | 161 | return EXIT_SUCCESS; 162 | } 163 | -------------------------------------------------------------------------------- /tools/src/meson.build: -------------------------------------------------------------------------------- 1 | blast_sources = files([ 2 | 'blast.h', 3 | 'blast.c', 4 | 'n64graphics.h', 5 | 'n64graphics.c', 6 | 'utils.h', 7 | 'utils.c' 8 | ]) 9 | 10 | stb_includes = include_directories('stb', is_system: true) 11 | 12 | lib = static_library('blast', [blast_sources, 'stb.c'], 13 | include_directories: [stb_includes]) 14 | 15 | gen_level_table_sources = files([ 16 | 'gen_level_table.c' 17 | ]) 18 | executable('gen_level_table', gen_level_table_sources, link_whole: lib) 19 | 20 | gen_splat_yaml_sources = files([ 21 | 'gen_splat_yaml.c' 22 | ]) 23 | executable('gen_splat_yaml', gen_splat_yaml_sources, link_whole: lib) 24 | 25 | unblast_rom_sources = files([ 26 | 'unblast_rom.c' 27 | ]) 28 | executable('unblast_rom', unblast_rom_sources, link_whole: lib) 29 | 30 | unblast_sources = files([ 31 | 'unblast.c' 32 | ]) 33 | executable('unblast', unblast_sources, link_whole: lib) 34 | 35 | all_sources = [ 36 | blast_sources, gen_level_table_sources, gen_splat_yaml_sources, 37 | unblast_rom_sources, unblast_sources 38 | ] 39 | -------------------------------------------------------------------------------- /tools/src/n64graphics.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "n64graphics.h" 7 | #include "utils.h" 8 | 9 | // upscale 5-bit integer to 8-bit 10 | #define SCALE_5_8(VAL_) (((VAL_)*0xFF) / 0x1F) 11 | #define SCALE_8_5(VAL_) ((((VAL_) + 4) * 0x1F) / 0xFF) 12 | #define SCALE_4_8(VAL_) ((VAL_)*0x11) 13 | #define SCALE_8_4(VAL_) ((VAL_) / 0x11) 14 | #define SCALE_3_8(VAL_) ((VAL_)*0x24) 15 | #define SCALE_8_3(VAL_) ((VAL_) / 0x24) 16 | 17 | typedef enum 18 | { 19 | IMG_FORMAT_RGBA, 20 | IMG_FORMAT_IA, 21 | IMG_FORMAT_I, 22 | IMG_FORMAT_CI, 23 | IMG_FORMAT_SKYBOX, 24 | } img_format; 25 | 26 | rgba* 27 | raw2rgba(char* raw, int width, int height, int depth) 28 | { 29 | rgba* img = NULL; 30 | unsigned img_size; 31 | int i; 32 | 33 | img_size = width * height * sizeof(*img); 34 | img = malloc(img_size); 35 | if (!img) 36 | { 37 | ERROR("Error allocating %u bytes\n", img_size); 38 | return NULL; 39 | } 40 | 41 | if (depth == 16) 42 | { 43 | for (i = 0; i < width * height; i++) 44 | { 45 | img[i].red = SCALE_5_8((raw[i * 2] & 0xF8) >> 3); 46 | img[i].green = 47 | SCALE_5_8(((raw[i * 2] & 0x07) << 2) | ((raw[i * 2 + 1] & 0xC0) >> 6)); 48 | img[i].blue = SCALE_5_8((raw[i * 2 + 1] & 0x3E) >> 1); 49 | img[i].alpha = (raw[i * 2 + 1] & 0x01) ? 0xFF : 0x00; 50 | } 51 | } 52 | else if (depth == 32) 53 | { 54 | for (i = 0; i < width * height; i++) 55 | { 56 | img[i].red = raw[i * 4]; 57 | img[i].green = raw[i * 4 + 1]; 58 | img[i].blue = raw[i * 4 + 2]; 59 | img[i].alpha = raw[i * 4 + 3]; 60 | } 61 | } 62 | 63 | return img; 64 | } 65 | 66 | ia* 67 | raw2ia(char* raw, int width, int height, int depth) 68 | { 69 | ia* img = NULL; 70 | unsigned img_size; 71 | int i; 72 | 73 | img_size = width * height * sizeof(*img); 74 | img = malloc(img_size); 75 | if (!img) 76 | { 77 | ERROR("Error allocating %u bytes\n", img_size); 78 | return NULL; 79 | } 80 | 81 | switch (depth) 82 | { 83 | case 16: 84 | for (i = 0; i < width * height; i++) 85 | { 86 | img[i].intensity = raw[i * 2]; 87 | img[i].alpha = raw[i * 2 + 1]; 88 | } 89 | break; 90 | case 8: 91 | for (i = 0; i < width * height; i++) 92 | { 93 | img[i].intensity = SCALE_4_8((raw[i] & 0xF0) >> 4); 94 | img[i].alpha = SCALE_4_8(raw[i] & 0x0F); 95 | } 96 | break; 97 | case 4: 98 | for (i = 0; i < width * height; i++) 99 | { 100 | unsigned char bits; 101 | bits = raw[i / 2]; 102 | if (i % 2) 103 | { 104 | bits &= 0xF; 105 | } 106 | else 107 | { 108 | bits >>= 4; 109 | } 110 | img[i].intensity = SCALE_3_8((bits >> 1) & 0x07); 111 | img[i].alpha = (bits & 0x01) ? 0xFF : 0x00; 112 | } 113 | break; 114 | case 1: 115 | for (i = 0; i < width * height; i++) 116 | { 117 | unsigned char bits; 118 | unsigned char mask; 119 | bits = raw[i / 8]; 120 | mask = 1 << (7 - (i % 8)); // MSb->LSb 121 | bits = (bits & mask) ? 0xFF : 0x00; 122 | img[i].intensity = bits; 123 | img[i].alpha = bits; 124 | } 125 | break; 126 | default: 127 | ERROR("Error invalid depth %d\n", depth); 128 | break; 129 | } 130 | 131 | return img; 132 | } 133 | 134 | rgba* 135 | file2rgba(char* filename, int offset, int width, int height, int depth) 136 | { 137 | FILE* fp; 138 | rgba* img = NULL; 139 | char* raw; 140 | unsigned size; 141 | 142 | fp = fopen(filename, "rb"); 143 | if (!fp) 144 | { 145 | return NULL; 146 | } 147 | 148 | if (fseek(fp, offset, SEEK_SET)) 149 | { 150 | ERROR("Error seeking to 0x%X in file '%s'\n", offset, filename); 151 | goto file2rgba_close; 152 | } 153 | 154 | size = width * height * depth / 8; 155 | raw = malloc(size); 156 | if (!raw) 157 | { 158 | ERROR("Error allocating %u bytes\n", size); 159 | goto file2rgba_close; 160 | } 161 | if (fread(raw, 1, size, fp) != size) 162 | { 163 | ERROR( 164 | "Error reading 0x%X bytes at 0x%X from '%s'\n", size, offset, filename); 165 | goto file2rgba_free; 166 | } 167 | 168 | img = raw2rgba(raw, width, height, depth); 169 | 170 | file2rgba_free: 171 | free(raw); 172 | file2rgba_close: 173 | fclose(fp); 174 | 175 | return img; 176 | } 177 | 178 | ia* 179 | file2ia(char* filename, int offset, int width, int height, int depth) 180 | { 181 | FILE* fp; 182 | ia* img = NULL; 183 | char* raw; 184 | unsigned size; 185 | unsigned img_size; 186 | 187 | fp = fopen(filename, "rb"); 188 | if (!fp) 189 | { 190 | return NULL; 191 | } 192 | 193 | if (fseek(fp, offset, SEEK_SET)) 194 | { 195 | ERROR("Error seeking to 0x%X in file '%s'\n", offset, filename); 196 | goto file2ia_close; 197 | } 198 | 199 | size = width * height * depth / 8; 200 | raw = malloc(size); 201 | if (!raw) 202 | { 203 | ERROR("Error allocating %u bytes\n", size); 204 | goto file2ia_close; 205 | } 206 | if (fread(raw, 1, size, fp) != size) 207 | { 208 | ERROR( 209 | "Error reading 0x%X bytes at 0x%X from '%s'\n", size, offset, filename); 210 | goto file2ia_free; 211 | } 212 | 213 | img_size = width * height * sizeof(*img); 214 | img = malloc(img_size); 215 | if (!img) 216 | { 217 | ERROR("Error allocating %u bytes\n", img_size); 218 | goto file2ia_free; 219 | } 220 | 221 | img = raw2ia(raw, width, height, depth); 222 | 223 | file2ia_free: 224 | free(raw); 225 | file2ia_close: 226 | fclose(fp); 227 | 228 | return img; 229 | } 230 | 231 | int 232 | rgba2png(rgba* img, int width, int height, char* pngname) 233 | { 234 | int ret = 0; 235 | unsigned char* data = malloc(4 * width * height); 236 | 237 | if (data) 238 | { 239 | for (int j = 0; j < height; j++) 240 | { 241 | for (int i = 0; i < width; i++) 242 | { 243 | int idx = j * width + i; 244 | data[4 * idx] = img[idx].red; 245 | data[4 * idx + 1] = img[idx].green; 246 | data[4 * idx + 2] = img[idx].blue; 247 | data[4 * idx + 3] = img[idx].alpha; 248 | } 249 | } 250 | 251 | // write the image data 252 | ret = stbi_write_png(pngname, width, height, 4, data, 0); 253 | 254 | free(data); 255 | } 256 | 257 | return ret; 258 | } 259 | 260 | int 261 | ia2png(ia* img, int width, int height, char* pngname) 262 | { 263 | int ret = 0; 264 | unsigned char* data = malloc(2 * width * height); 265 | 266 | if (data) 267 | { 268 | for (int j = 0; j < height; j++) 269 | { 270 | for (int i = 0; i < width; i++) 271 | { 272 | int idx = j * width + i; 273 | data[2 * idx] = img[idx].intensity; 274 | data[2 * idx + 1] = img[idx].alpha; 275 | } 276 | } 277 | 278 | // write the image data 279 | ret = stbi_write_png(pngname, width, height, 2, data, 0); 280 | 281 | free(data); 282 | } 283 | 284 | return ret; 285 | } 286 | -------------------------------------------------------------------------------- /tools/src/n64graphics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef struct _rgba 4 | { 5 | unsigned char red; 6 | unsigned char green; 7 | unsigned char blue; 8 | unsigned char alpha; 9 | } rgba; 10 | 11 | typedef struct _ia 12 | { 13 | unsigned char intensity; 14 | unsigned char alpha; 15 | } ia; 16 | 17 | // extract RGBA image from file at offset to RGBA data 18 | rgba* 19 | file2rgba(char* filename, int offset, int width, int height, int depth); 20 | 21 | // extract IA image from file at offset to RGBA data 22 | ia* 23 | file2ia(char* filename, int offset, int width, int height, int depth); 24 | 25 | // save RGBA data to PNG file 26 | int 27 | rgba2png(rgba* img, int width, int height, char* pngname); 28 | 29 | // save IA data to grayscale PNG file 30 | int 31 | ia2png(ia* img, int width, int height, char* pngname); 32 | -------------------------------------------------------------------------------- /tools/src/stb.c: -------------------------------------------------------------------------------- 1 | #define STB_IMAGE_WRITE_IMPLEMENTATION 2 | #include 3 | -------------------------------------------------------------------------------- /tools/src/unblast.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "utils.h" 10 | 11 | #include "blast.h" 12 | 13 | void 14 | print_usage() 15 | { 16 | printf("Usage:\n"); 17 | printf("Decode blast encoded file:\n"); 18 | printf("./blast \n"); 19 | printf("Decode blast encoded file. With LUT for blast 4 and 5:\n"); 20 | printf("./blast \n"); 21 | } 22 | 23 | int 24 | main(int argc, char* argv[]) 25 | { 26 | if (argc < 3 || argc > 4) 27 | { 28 | print_usage(); 29 | return EXIT_FAILURE; 30 | } 31 | 32 | // read in Blast Corps ROM 33 | uint8_t* rom_bytes; 34 | size_t size = read_file(argv[1], &rom_bytes); 35 | 36 | blast_t type = atoi(argv[2]); 37 | printf("Opening %s\n", argv[1]); 38 | 39 | if (argc != 4 && (type == BLAST4_IA16 || type == BLAST5_RGBA32)) 40 | { 41 | printf( 42 | "ERROR: You need to provide a LUT file for blast4 and blast5 files.\n"); 43 | print_usage(); 44 | return EXIT_FAILURE; 45 | } 46 | 47 | int32_t decompressed_size = 0; 48 | uint8_t* decompressed_bytes = malloc(100 * size); 49 | 50 | if (argc == 4) 51 | { 52 | uint8_t* lut_bytes = NULL; 53 | printf("Opening LUT at %s\n", argv[3]); 54 | size_t lut_size = read_file(argv[3], &lut_bytes); 55 | if (type == BLAST4_IA16 && lut_size != 128) 56 | { 57 | printf("WARNING: Lookup table for blast4 is %ld bytes instead of 128.\n", 58 | lut_size); 59 | } 60 | else if (type == BLAST5_RGBA32 && lut_size != 256) 61 | { 62 | printf("WARNING: Lookup table for blast5 is %ld bytes instead of 256.\n", 63 | lut_size); 64 | } 65 | decompressed_size = 66 | decode_blast_lookup(rom_bytes, size, type, decompressed_bytes, lut_bytes); 67 | } 68 | else 69 | { 70 | 71 | decompressed_size = decode_blast(rom_bytes, size, type, decompressed_bytes); 72 | } 73 | 74 | // Write decompressed file 75 | char out_path_decompressed[512]; 76 | 77 | if (type == BLAST0) 78 | { 79 | sprintf(out_path_decompressed, "%s.unblast0", argv[1]); 80 | } 81 | else 82 | { 83 | int32_t depth = get_type_depth(type); 84 | const char* format_name = get_type_format_name(type); 85 | sprintf(out_path_decompressed, "%s.%s%d", argv[1], format_name, depth); 86 | } 87 | 88 | printf("Writing %s\n", out_path_decompressed); 89 | 90 | write_file(out_path_decompressed, decompressed_bytes, decompressed_size); 91 | 92 | free(rom_bytes); 93 | 94 | return EXIT_SUCCESS; 95 | } 96 | -------------------------------------------------------------------------------- /tools/src/unblast_rom.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "utils.h" 10 | 11 | #include "blast.h" 12 | 13 | #define ROM_OFFSET 0x4CE0 14 | #define END_OFFSET 0xCCE0 15 | 16 | void 17 | decompress_rom(const char* rom_path, uint8_t* rom_bytes, size_t rom_size) 18 | { 19 | char rom_dir_path[300]; 20 | 21 | strcpy(rom_dir_path,rom_path); 22 | dirname(rom_dir_path); 23 | 24 | // loop through from 0x4CE0 to 0xCCE0 25 | for (uint32_t address = ROM_OFFSET; address < END_OFFSET; address += 8) 26 | { 27 | uint32_t start = read_u32_be(&rom_bytes[address]); 28 | uint16_t compressed_size = read_u16_be(&rom_bytes[address + 4]); 29 | blast_t type = read_u16_be(&rom_bytes[address + 6]); 30 | 31 | assert(rom_size >= start); 32 | 33 | // TODO: there are large sections of len=0, possibly LUTs for 4 & 5? 34 | if (compressed_size == 0) 35 | { 36 | continue; 37 | } 38 | 39 | // Write compressed file 40 | char out_path_compressed[512]; 41 | sprintf(out_path_compressed, 42 | "%s/%06X.blast%d", 43 | rom_dir_path, 44 | start + ROM_OFFSET, 45 | type); 46 | write_file( 47 | out_path_compressed, &rom_bytes[start + ROM_OFFSET], compressed_size); 48 | 49 | int32_t decompressed_size = 0; 50 | uint8_t* decompressed_bytes = malloc(100 * compressed_size); 51 | if (type == BLAST4_IA16 || type == BLAST5_RGBA32) 52 | { 53 | // TODO: need to figure out where last param is set for decoders 4 and 5 54 | uint8_t* lut; 55 | switch (type) 56 | { 57 | case BLAST4_IA16: 58 | lut = &rom_bytes[0x047480]; 59 | break; 60 | case BLAST5_RGBA32: 61 | // 0x0998E0 62 | // 0x1E2C00 63 | lut = &rom_bytes[0x152970]; 64 | break; 65 | default: 66 | lut = NULL; 67 | } 68 | decompressed_size = decode_blast_lookup(&rom_bytes[start + ROM_OFFSET], 69 | compressed_size, 70 | type, 71 | decompressed_bytes, 72 | lut); 73 | } 74 | else 75 | { 76 | decompressed_size = decode_blast(&rom_bytes[start + ROM_OFFSET], 77 | compressed_size, 78 | type, 79 | decompressed_bytes); 80 | } 81 | 82 | // Write decompressed file 83 | char out_path_decompressed[512]; 84 | 85 | if (type == BLAST0) 86 | { 87 | sprintf(out_path_decompressed, 88 | "%s/%06X.unblast0", 89 | rom_dir_path, 90 | start + ROM_OFFSET); 91 | 92 | write_file(out_path_decompressed, decompressed_bytes, decompressed_size); 93 | 94 | printf("[0x%06X, 0x%06X] blast0 %5d bytes\n", 95 | start + ROM_OFFSET, 96 | start + ROM_OFFSET + compressed_size, 97 | compressed_size); 98 | continue; 99 | } 100 | 101 | int32_t depth = get_type_depth(type); 102 | const char* format_name = get_type_format_name(type); 103 | 104 | sprintf(out_path_decompressed, 105 | "%s/%06X.%s%d", 106 | rom_dir_path, 107 | start + ROM_OFFSET, 108 | format_name, 109 | depth); 110 | 111 | write_file(out_path_decompressed, decompressed_bytes, decompressed_size); 112 | 113 | res_t res = guess_resolution(type, decompressed_size); 114 | 115 | char format_str[16]; 116 | sprintf(format_str, "(%s%d)", format_name, depth); 117 | 118 | printf("[0x%06X, 0x%06X] blast%d %8s %2dx%2d %4d -> %4d bytes\n", 119 | start + ROM_OFFSET, 120 | start + ROM_OFFSET + compressed_size, 121 | type, 122 | format_str, 123 | res.w, 124 | res.h, 125 | compressed_size, 126 | decompressed_size); 127 | 128 | // Write PNG 129 | convert_to_png(out_path_decompressed, decompressed_size, type); 130 | } 131 | } 132 | 133 | void 134 | print_usage(const char* exe_name) 135 | { 136 | printf("Usage:\n"); 137 | printf("Unpack whole rom:\n"); 138 | printf("%s \n", exe_name); 139 | } 140 | 141 | int 142 | main(int argc, char* argv[]) 143 | { 144 | if (argc != 2) 145 | { 146 | print_usage(argv[0]); 147 | return EXIT_FAILURE; 148 | } 149 | 150 | // read in Blast Corps ROM 151 | uint8_t* rom_bytes; 152 | size_t size = read_file(argv[1], &rom_bytes); 153 | 154 | decompress_rom(argv[1], rom_bytes, size); 155 | 156 | free(rom_bytes); 157 | 158 | return EXIT_SUCCESS; 159 | } 160 | -------------------------------------------------------------------------------- /tools/src/utils.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "utils.h" 11 | 12 | size_t 13 | read_file(const char* file_name, unsigned char** data) 14 | { 15 | FILE* in; 16 | unsigned char* in_buf = NULL; 17 | size_t file_size; 18 | size_t bytes_read; 19 | in = fopen(file_name, "rb"); 20 | if (in == NULL) 21 | { 22 | return -1; 23 | } 24 | 25 | // allocate buffer to read from offset to end of file 26 | fseek(in, 0, SEEK_END); 27 | file_size = ftell(in); 28 | 29 | // sanity check 30 | if (file_size > 256 * MB) 31 | { 32 | return -2; 33 | } 34 | 35 | in_buf = malloc(file_size); 36 | fseek(in, 0, SEEK_SET); 37 | 38 | // read bytes 39 | bytes_read = fread(in_buf, 1, file_size, in); 40 | if (bytes_read != file_size) 41 | { 42 | return -3; 43 | } 44 | 45 | fclose(in); 46 | *data = in_buf; 47 | return bytes_read; 48 | } 49 | 50 | size_t 51 | write_file(const char* file_name, unsigned char* data, size_t length) 52 | { 53 | FILE* out; 54 | size_t bytes_written; 55 | // open output file 56 | out = fopen(file_name, "wb"); 57 | if (out == NULL) 58 | { 59 | perror(file_name); 60 | return -1; 61 | } 62 | bytes_written = fwrite(data, 1, length, out); 63 | fclose(out); 64 | return bytes_written; 65 | } 66 | 67 | void 68 | generate_filename(const char* in_name, char* out_name, char* extension) 69 | { 70 | char tmp_name[FILENAME_MAX]; 71 | int len; 72 | int i; 73 | strcpy(tmp_name, in_name); 74 | len = strlen(tmp_name); 75 | for (i = len - 1; i > 0; i--) 76 | { 77 | if (tmp_name[i] == '.') 78 | { 79 | break; 80 | } 81 | } 82 | if (i <= 0) 83 | { 84 | i = len; 85 | } 86 | tmp_name[i] = '\0'; 87 | sprintf(out_name, "%s.%s", tmp_name, extension); 88 | } 89 | -------------------------------------------------------------------------------- /tools/src/utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | // defines 6 | 7 | #define KB 1024 8 | #define MB (1024 * KB) 9 | 10 | // number of elements in statically declared array 11 | #define DIM(S_ARR_) (sizeof(S_ARR_) / sizeof(S_ARR_[0])) 12 | 13 | // read/write u32/16 big/little endian 14 | #define read_u32_be(buf) \ 15 | (unsigned int)(((buf)[0] << 24) + ((buf)[1] << 16) + ((buf)[2] << 8) + \ 16 | ((buf)[3])) 17 | #define read_u32_le(buf) \ 18 | (unsigned int)(((buf)[1] << 24) + ((buf)[0] << 16) + ((buf)[3] << 8) + \ 19 | ((buf)[2])) 20 | #define write_u32_be(buf, val) \ 21 | do \ 22 | { \ 23 | (buf)[0] = ((val) >> 24) & 0xFF; \ 24 | (buf)[1] = ((val) >> 16) & 0xFF; \ 25 | (buf)[2] = ((val) >> 8) & 0xFF; \ 26 | (buf)[3] = (val)&0xFF; \ 27 | } while (0) 28 | #define read_u16_be(buf) (((buf)[0] << 8) + ((buf)[1])) 29 | #define write_u16_be(buf, val) \ 30 | do \ 31 | { \ 32 | (buf)[0] = ((val) >> 8) & 0xFF; \ 33 | (buf)[1] = ((val)) & 0xFF; \ 34 | } while (0) 35 | 36 | #define ERROR(...) fprintf(stderr, __VA_ARGS__) 37 | 38 | // functions 39 | 40 | // read entire contents of file into buffer 41 | // returns file size or negative on error 42 | size_t 43 | read_file(const char* file_name, unsigned char** data); 44 | 45 | // write buffer to file 46 | // returns number of bytes written out or -1 on failure 47 | size_t 48 | write_file(const char* file_name, unsigned char* data, size_t length); 49 | 50 | // generate an output file name from input name by replacing file extension 51 | // in_name: input file name 52 | // out_name: buffer to write output name in 53 | // extension: new file extension to use 54 | void 55 | generate_filename(const char* in_name, char* out_name, char* extension); 56 | --------------------------------------------------------------------------------