improve ld script & asset building

makefile go brrrr
This commit is contained in:
Alex Bates 2020-10-28 20:57:00 +00:00
parent 0e554072d1
commit 5ddfce7824
No known key found for this signature in database
GPG Key ID: 5E11C2DB78877706
10 changed files with 355 additions and 452 deletions

6
.gitignore vendored
View File

@ -9,15 +9,15 @@ venv/
ctx.c ctx.c
expected/ expected/
# Assets
assets
# Build artifacts # Build artifacts
*.ld *.ld
*.z64 *.z64
*.bin *.bin
*.i
*.Yay0
bin/ bin/
build/ build/
docs/doxygen/ docs/doxygen/
include/ld_addrs.h
.vscode/launch.json .vscode/launch.json

View File

@ -3,6 +3,13 @@
"configurations": [ "configurations": [
{ {
"name": "papermario", "name": "papermario",
"browse": {
"limitSymbolsToIncludedHeaders": true,
"path": [
"${workspaceFolder}/include",
"${workspaceFolder}/src"
]
},
"includePath": [ "includePath": [
"${workspaceFolder}/include", "${workspaceFolder}/include",
"${workspaceFolder}/src" "${workspaceFolder}/src"

View File

@ -12,4 +12,8 @@
], ],
"python.pythonPath": "/usr/bin/python3", "python.pythonPath": "/usr/bin/python3",
"git.ignoreLimitWarning": true, "git.ignoreLimitWarning": true,
"search.exclude": {
"build": true,
"docs/doxygen": true,
},
} }

180
Makefile
View File

@ -14,33 +14,29 @@ ifeq ($(wildcard $(BASEROM)),)
$(error Baserom `$(BASEROM)' not found.) $(error Baserom `$(BASEROM)' not found.)
endif endif
# NON_MATCHING=1 implies COMPARE=0
### Sources ### ifeq ($(NON_MATCHING),1)
override COMPARE=0
include sources.mk endif
### Output ### ### Output ###
BUILD_DIR = build BUILD_DIR := build
ROM = $(TARGET).z64 ROM := $(TARGET).z64
ELF = $(BUILD_DIR)/$(TARGET).elf ELF := $(BUILD_DIR)/$(TARGET).elf
LD_SCRIPT = $(TARGET).ld LD_SCRIPT := $(TARGET).ld
LD_MAP = $(BUILD_DIR)/$(TARGET).map LD_MAP := $(BUILD_DIR)/$(TARGET).map
ASSETS_BIN := $(BUILD_DIR)/bin/assets/assets.bin
ifdef ASSETS_FS
ASSETS_FS_OBJ = $(BUILD_DIR)/$(ASSETS_FS).o
endif
### Tools ### ### Tools ###
PYTHON = python3 PYTHON := python3
N64CKSUM = tools/n64crc N64CKSUM := tools/n64crc
SPLAT_YAML = tools/splat.yaml SPLAT_YAML := tools/splat.yaml
SPLAT = $(PYTHON) tools/n64splat/split.py $(BASEROM) $(SPLAT_YAML) . SPLAT = $(PYTHON) tools/n64splat/split.py $(BASEROM) $(SPLAT_YAML) .
YAY0COMPRESS = tools/Yay0compress YAY0COMPRESS = tools/Yay0compress
BUILD_ASSETS_FS := $(PYTHON) tools/build_assets_fs.py $(ASSETS_FS) $(BUILD_DIR)/$(ASSETS_FS)
ifndef EMULATOR ifndef EMULATOR
ifneq ($(shell which mupen64plus-gui),) ifneq ($(shell which mupen64plus-gui),)
@ -53,25 +49,30 @@ endif
### Compiler Options ### ### Compiler Options ###
CROSS = mips-linux-gnu- CROSS := mips-linux-gnu-
AS = $(CROSS)as AS := $(CROSS)as
OLD_AS = tools/mips-nintendo-nu64-as OLD_AS := tools/mips-nintendo-nu64-as
CC = tools/cc1 CC := tools/cc1
CPP = cpp CPP := cpp
LD = $(CROSS)ld LD := $(CROSS)ld
OBJCOPY = $(CROSS)objcopy OBJCOPY := $(CROSS)objcopy
CPPFLAGS = -Iinclude -Isrc -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2 CPPFLAGS := -Iinclude -Isrc -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2 -D_MIPS_SZLONG=0 -Wundef -Wcomment
ASFLAGS = -EB -Iinclude -march=vr4300 -mtune=vr4300 ASFLAGS := -EB -Iinclude -march=vr4300 -mtune=vr4300
OLDASFLAGS = -EB -Iinclude -G 0 OLDASFLAGS := -EB -Iinclude -G 0
CFLAGS = -O2 -quiet -G 0 -mcpu=vr4300 -mfix4300 -mips3 -mgp32 -mfp32 -Wimplicit -Wuninitialized -Wshadow CFLAGS := -O2 -quiet -G 0 -mcpu=vr4300 -mfix4300 -mips3 -mgp32 -mfp32 -Wimplicit -Wuninitialized -Wshadow
LDFLAGS = -T undefined_syms.txt -T undefined_funcs.txt -T $(LD_SCRIPT) -Map $(LD_MAP) --no-check-sections LDFLAGS := -T undefined_syms.txt -T undefined_funcs.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -Map $(LD_MAP) --no-check-sections
ifeq ($(NON_MATCHING),1) ifeq ($(NON_MATCHING),1)
CPPFLAGS += -DNON_MATCHING CPPFLAGS += -DNON_MATCHING
endif endif
### Sources ###
include sources.mk
### Targets ### ### Targets ###
clean: clean:
@ -87,11 +88,14 @@ submodules:
git submodule update --init --recursive git submodule update --init --recursive
split: split:
rm -rf bin assets rm -rf bin
$(SPLAT) --modes ld bin Yay0 PaperMarioMapFS $(SPLAT) --modes ld bin Yay0 PaperMarioMapFS
split-bin:
$(SPLAT) --modes ld bin
split-all: split-all:
rm -rf bin assets rm -rf bin
$(SPLAT) --modes all $(SPLAT) --modes all
test: $(ROM) test: $(ROM)
@ -101,9 +105,61 @@ else
@echo "N64 emulator not detected." && false @echo "N64 emulator not detected." && false
endif endif
# Compressed files
%.Yay0: %
@mkdir -p $(shell dirname $@)
$(YAY0COMPRESS) $< $@
$(BUILD_DIR)/%.bin.Yay0: %.bin
@mkdir -p $(shell dirname $@)
$(YAY0COMPRESS) $< $@
# Data objects
$(BUILD_DIR)/%.bin.o: %.bin
@mkdir -p $(shell dirname $@)
$(LD) -r -b binary -o $@ $<
# Compressed data objects
$(BUILD_DIR)/%.Yay0.o: $(BUILD_DIR)/%.bin.Yay0
@mkdir -p $(shell dirname $@)
$(LD) -r -b binary -o $@ $<
# Compile C files
$(BUILD_DIR)/%.c.o: %.c
@mkdir -p $(shell dirname $@)
$(CPP) $(CPPFLAGS) -o - $< | $(CC) $(CFLAGS) -o - - | $(OLD_AS) $(OLDASFLAGS) -o $@ -
# Compile C files (with DSL macros)
$(foreach cfile, $(DSL_C_FILES), $(BUILD_DIR)/$(cfile).o): $(BUILD_DIR)/%.c.o: %.c
@mkdir -p $(shell dirname $@)
$(CPP) $(CPPFLAGS) -o - $< | tools/compile_dsl_macros.py | $(CC) $(CFLAGS) -o - - | $(OLD_AS) $(OLDASFLAGS) -o $@ -
# Assemble handwritten ASM
$(BUILD_DIR)/%.s.o: %.s
@mkdir -p $(shell dirname $@)
$(AS) $(ASFLAGS) -o $@ $<
ASSET_FILES := $(foreach asset, $(ASSETS), $(BUILD_DIR)/bin/assets/$(asset))
YAY0_ASSET_FILES := $(foreach asset, $(filter-out %_tex, $(ASSET_FILES)), $(asset).Yay0)
$(BUILD_DIR)/bin/assets/%: bin/assets/%.bin
@mkdir -p $(shell dirname $@)
@cp $< $@
$(ASSETS_BIN): $(ASSET_FILES) $(YAY0_ASSET_FILES)
@mkdir -p $(shell dirname $@)
@echo "building $@"
@$(PYTHON) tools/build_assets_bin.py $@ $(ASSET_FILES)
$(ASSETS_BIN:.bin=.o): $(ASSETS_BIN)
$(LD) -r -b binary -o $@ $<
$(LD_SCRIPT): $(SPLAT_YAML) $(LD_SCRIPT): $(SPLAT_YAML)
$(SPLAT) --modes ld $(SPLAT) --modes ld
$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT)
@mkdir -p $(shell dirname $@)
$(CPP) -P -DBUILD_DIR=$(BUILD_DIR) -o $@ $<
$(ROM): $(BUILD_DIR)/$(TARGET).bin $(ROM): $(BUILD_DIR)/$(TARGET).bin
@cp $< $@ @cp $< $@
ifeq ($(COMPARE),1) ifeq ($(COMPARE),1)
@ -113,70 +169,16 @@ endif
$(BUILD_DIR)/$(TARGET).bin: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).bin: $(BUILD_DIR)/$(TARGET).elf
$(OBJCOPY) $< $@ -O binary $(OBJCOPY) $< $@ -O binary
$(BUILD_DIR)/$(TARGET).elf: $(LD_SCRIPT) $(OBJECTS) $(ASSETS_FS_OBJ) $(BUILD_DIR)/$(TARGET).elf: $(BUILD_DIR)/$(LD_SCRIPT) $(OBJECTS)
$(LD) $(LDFLAGS) -o $@ $(LD) $(LDFLAGS) -o $@
# `make print-VARNAME' to print the value of $(VARNAME)
print-%: ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true
### Object Targets (see sources.mk) ###
ifndef OBJECTS
$(warning OBJECTS is not defined by `sources.mk'.)
else
# C
$(filter %.c.o,$(OBJECTS)): $(BUILD_DIR)/%.c.o: %.c
@mkdir -p $(shell dirname $@)
cpp $(CPPFLAGS) $< > $(BUILD_DIR)/$*.i
@grep -cF "SCRIPT(" $(BUILD_DIR)/$*.i | tools/compile_dsl_macros.py $(BUILD_DIR)/$*.i
$(CC) $(CFLAGS) -o - $(BUILD_DIR)/$*.i | $(OLD_AS) $(OLDASFLAGS) - -o $@
# Assembly
$(filter %.s.o,$(OBJECTS)): $(BUILD_DIR)/%.s.o: %.s
@mkdir -p $(shell dirname $@)
$(AS) $(ASFLAGS) -o $@ $<
# Uncompressed data
$(filter %.bin.o,$(OBJECTS)): $(BUILD_DIR)/%.bin.o: %.bin
@mkdir -p $(shell dirname $@)
$(LD) -r -b binary -o $@ $<
# Compressed data
$(filter %.Yay0.o,$(OBJECTS)): $(BUILD_DIR)/%.Yay0.o: %.bin
@mkdir -p $(shell dirname $@)
$(YAY0COMPRESS) $< $(BUILD_DIR)/$*.Yay0
$(LD) -r -b binary -o $@ $(BUILD_DIR)/$*.Yay0
endif
### Asset Filesystem (see sources.mk) ###
# Complain if ASSETS_FS_SOURCES is undefined but ASSETS_FS is.
ifndef ASSETS_FS_SOURCES
ifdef ASSETS_FS
$(warning ASSETS_FS_SOURCES is not defined by `sources.mk' but ASSETS_FS is.)
endif
else
$(BUILD_DIR)/$(ASSETS_FS)/%: $(ASSETS_FS)/%
@mkdir -p $(shell dirname $@)
@rm -f $@
$(BUILD_ASSETS_FS) $*
$(ASSETS_FS_OBJ): $(ASSETS_FS).json $(foreach file,$(ASSETS_FS_SOURCES),$(BUILD_DIR)/$(file))
$(BUILD_ASSETS_FS)
$(LD) -r -b binary -o $@ $(BUILD_DIR)/$(ASSETS_FS).bin
endif
### Make Settings ### ### Make Settings ###
.PHONY: clean test setup submodules split $(ROM) .PHONY: clean test setup submodules split $(ROM)
.DELETE_ON_ERROR:
.SECONDARY:
.PRECIOUS: $(ROM) %.Yay0
.DEFAULT_GOAL := $(ROM) .DEFAULT_GOAL := $(ROM)
# Remove built-in implicit rules to improve performance # Remove built-in implicit rules to improve performance

View File

@ -5,3 +5,4 @@ def apply(config, args):
config['myimg'] = 'papermario.z64' config['myimg'] = 'papermario.z64'
config['mapfile'] = 'build/papermario.map' config['mapfile'] = 'build/papermario.map'
config['source_directories'] = ['.'] config['source_directories'] = ['.']
config['makeflags'] = ['COMPARE=0']

View File

@ -1,35 +1,57 @@
### ASSETS_FS and ASSETS_FS_SOURCES ### OBJECTS := $(subst BUILD_DIR, $(BUILD_DIR), $(shell grep -E 'BUILD_DIR.+\.o' papermario.ld -o))
# The asset filesystem path. DSL_C_FILES := $(shell grep -lrF "SCRIPT" src)
ASSETS_FS = assets/fs
# Source files to build the asset filesystem with. Each of these must be configured in `assets/fs.json'. MAPS := \
ASSETS_FS_SOURCES = $(wildcard $(ASSETS_FS)/*.bin) dro_01 dro_02 \
hos_00 hos_01 hos_02 hos_03 hos_04 hos_05 hos_06 hos_10 hos_20 \
isk_01 isk_02 isk_03 isk_04 isk_05 isk_06 isk_07 isk_08 isk_09 isk_10 isk_11 isk_12 isk_13 isk_14 isk_16 isk_18 isk_19 \
iwa_00 iwa_01 iwa_02 iwa_03 iwa_04 iwa_10 iwa_11 \
osr_00 osr_01 osr_02 osr_03 kkj_00 kkj_01 kkj_02 kkj_03 kkj_10 kkj_11 kkj_12 kkj_13 kkj_14 kkj_15 kkj_16 kkj_17 kkj_18 kkj_19 kkj_20 kkj_21 kkj_22 kkj_23 kkj_24 kkj_25 kkj_26 kkj_27 kkj_28 kkj_29 \
kmr_00 kmr_02 kmr_03 kmr_04 kmr_05 kmr_06 kmr_07 kmr_09 kmr_10 kmr_11 kmr_12 kmr_20 kmr_30 \
kpa_01 kpa_03 kpa_04 kpa_08 kpa_09 kpa_10 kpa_11 kpa_12 kpa_13 kpa_14 kpa_15 kpa_16 kpa_17 kpa_32 kpa_33 kpa_40 kpa_41 kpa_50 kpa_52 kpa_60 kpa_61 kpa_62 kpa_63 kpa_70 kpa_80 kpa_90 kpa_91 kpa_94 kpa_95 kpa_96 kpa_102 kpa_111 kpa_112 kpa_113 kpa_115 kpa_116 kpa_117 kpa_118 kpa_119 kpa_121 kpa_130 kpa_133 kpa_134 \
machi mac_00 mac_01 mac_02 mac_03 mac_04 mac_05 mac_06 \
tik_01 tik_02 tik_03 tik_04 tik_05 tik_06 tik_07 tik_08 tik_09 tik_10 tik_12 tik_14 tik_15 tik_17 tik_18 tik_19 tik_20 tik_21 tik_22 tik_23 tik_25 \
kgr_01 kgr_02 \
nok_01 nok_02 nok_03 nok_04 nok_11 nok_12 nok_13 nok_14 nok_15 \
sbk_00 sbk_01 sbk_02 sbk_03 sbk_04 sbk_05 sbk_06 sbk_10 sbk_11 sbk_12 sbk_13 sbk_14 sbk_15 sbk_16 sbk_20 sbk_21 sbk_22 sbk_23 sbk_24 sbk_25 sbk_26 sbk_30 sbk_31 sbk_32 sbk_33 sbk_34 sbk_35 sbk_36 sbk_40 sbk_41 sbk_42 sbk_43 sbk_44 sbk_45 sbk_46 sbk_50 sbk_51 sbk_52 sbk_53 sbk_54 sbk_55 sbk_56 sbk_60 sbk_61 sbk_62 sbk_63 sbk_64 sbk_65 sbk_66 sbk_99 \
trd_00 trd_01 trd_02 trd_03 trd_04 trd_05 trd_06 trd_07 trd_08 trd_09 trd_10 \
tst_01 tst_02 tst_03 tst_04 tst_10 tst_11 tst_12 tst_13 tst_20 \
jan_00 jan_01 jan_02 jan_03 jan_04 jan_05 jan_06 jan_07 jan_08 jan_09 jan_10 jan_11 jan_12 jan_13 jan_14 jan_15 jan_16 jan_17 jan_18 jan_19 jan_22 jan_23 \
mim_01 mim_02 mim_03 mim_04 mim_05 mim_06 mim_07 mim_08 mim_09 mim_10 mim_11 mim_12 \
obk_01 obk_02 obk_03 obk_04 obk_05 obk_06 obk_07 obk_08 obk_09 \
arn_02 arn_03 arn_04 arn_05 arn_07 arn_08 arn_09 arn_10 arn_11 arn_12 arn_13 arn_20 \
dgb_01 dgb_02 dgb_03 dgb_04 dgb_05 dgb_06 dgb_07 dgb_08 dgb_09 dgb_10 dgb_11 dgb_12 dgb_13 dgb_14 dgb_15 dgb_16 dgb_17 dgb_18 \
kzn_01 kzn_02 kzn_03 kzn_04 kzn_05 kzn_06 kzn_07 kzn_08 kzn_09 kzn_10 kzn_11 kzn_17 kzn_18 kzn_19 kzn_20 kzn_22 kzn_23 \
flo_00 flo_03 flo_07 flo_08 flo_09 flo_10 flo_11 flo_12 flo_13 flo_14 flo_15 flo_16 flo_17 flo_18 flo_19 flo_21 flo_22 flo_23 flo_24 flo_25 \
sam_01 sam_02 sam_03 sam_04 sam_05 sam_06 sam_07 sam_08 sam_09 sam_10 sam_11 sam_12 \
pra_01 pra_02 pra_03 pra_04 pra_05 pra_09 pra_10 pra_11 pra_13 pra_14 pra_15 pra_16 pra_18 pra_19 pra_20 pra_21 pra_22 pra_29 pra_31 pra_32 pra_33 pra_34 pra_35 pra_40 \
omo_01 omo_02 omo_03 omo_04 omo_05 omo_06 omo_07 omo_08 omo_09 omo_10 omo_11 omo_12 omo_13 omo_14 omo_15 omo_16 omo_17 \
end_00 end_01 \
mgm_00 mgm_01 mgm_02 mgm_03 \
gv_01 \
kmr_bt03 kmr_bt04 kmr_bt05 kmr_bt06 \
nok_bt01 nok_bt02 nok_bt03 nok_bt04 \
trd_bt00 trd_bt01 trd_bt02 trd_bt03 trd_bt04 trd_bt05 \
iwa_bt01 iwa_bt02 \
sbk_bt02 \
isk_bt01 isk_bt02 isk_bt03 isk_bt04 isk_bt05 isk_bt06 isk_bt07 isk_bt08 \
arn_bt01 arn_bt02 arn_bt03 arn_bt04 arn_bt05 arn_bt06 \
dgb_bt01 dgb_bt02 dgb_bt03 dgb_bt04 dgb_bt05 \
mim_bt01 \
omo_bt01 omo_bt02 omo_bt03 omo_bt04 omo_bt05 omo_bt06 omo_bt07 \
kgr_bt01 flo_bt01 flo_bt02 flo_bt03 flo_bt04 flo_bt05 flo_bt06 \
jan_bt00 jan_bt01 jan_bt02 jan_bt03 jan_bt04 \
kzn_bt01 kzn_bt02 kzn_bt04 kzn_bt05 sam_bt01 sam_bt02 sam_bt03 sam_bt04 \
tik_bt01 tik_bt02 tik_bt03 tik_bt04 tik_bt05 \
pra_bt01 pra_bt02 pra_bt03 pra_bt04 mac_bt01 mac_bt02 \
kpa_bt01 kpa_bt02 kpa_bt03 kpa_bt04 kpa_bt05 kpa_bt07 kpa_bt08 kpa_bt09 kpa_bt11 kpa_bt13 kpa_bt14 \
hos_bt01 hos_bt02 \
kkj_bt01 kkj_bt02
ASSETS := \
### OBJECTS ### $(foreach map, $(MAPS), $(map)_shape $(map)_hit) \
mac_tex tik_tex kgr_tex kmr_tex iwa_tex sbk_tex dro_tex isk_tex trd_tex nok_tex hos_tex kpa_tex osr_tex kkj_tex tst_tex jan_tex mim_tex obk_tex arn_tex dgb_tex kzn_tex flo_tex sam_tex pra_tex omo_tex end_tex mgm_tex gv__tex \
C_FILES = $(shell find src -type f -name "*.c" -not -name "*.inc.c") kmr_bg nok_bg sbk_bg sbk3_bg iwa_bg hos_bg arn_bg obk_bg omo_bg yos_bg jan_bg fla_bg flb_bg sra_bg yki_bg sam_bg kpa_bg title_bg \
S_FILES = $(wildcard asm/*.s asm/os/*.s) title_data \
party_kurio party_kameki party_pinki party_pareta party_resa party_akari party_opuku party_pokopi
BIN_FILES = $(foreach dir, $(shell mkdir -p bin && find bin -type d -not -name Yay0), $(wildcard $(dir)/*.bin))
COMPRESSED_BIN_FILES = $(wildcard bin/Yay0/*.bin)
# The OBJECTS variable holds the filenames of all object files to be linked.
# Each of these objects should appear in `papermario.ld' (generated by n64splat).
#
# The extension of each object file specifies its source type (and, therefore, how it should be built):
#
# Object ext | Source ext | Description
# ------------+------------+-------------
# .o | | Special; must have build steps declared here
# .c.o | .c | C sourcecode
# .s.o | .s | Assembly (built with modern assembler)
# .bin.o | .bin | Uncompressed data
# .Yay0.o | .bin | Compressed data
#
# Note that ASSETS_FS is linked implicitly and does not need to be listed here.
OBJECTS = \
$(foreach file, $(C_FILES) $(S_FILES) $(BIN_FILES), $(BUILD_DIR)/$(file).o) \
$(foreach file, $(COMPRESSED_BIN_FILES), $(BUILD_DIR)/$(file:.bin=.Yay0.o))

View File

@ -1,43 +1,40 @@
#! /usr/bin/python3 #! /usr/bin/python3
import os import os
import json from sys import argv
import sys
from subprocess import call
from pathlib import Path from pathlib import Path
import shutil
tools_dir = Path(__file__).parent.absolute()
def next_multiple(pos, multiple): def next_multiple(pos, multiple):
return pos + pos % multiple return pos + pos % multiple
def build_mapfs(src_dir, build_dir, out_bin): def build_mapfs(out_bin, assets):
with open(src_dir + ".json", "r") as f:
config = json.loads(f.read())
# every TOC entry's name field has data after the null terminator made up from all the previous name fields. # every TOC entry's name field has data after the null terminator made up from all the previous name fields.
# we probably don't have to do this for the game to read the data properly (it doesn't read past the null terminator # we probably don't have to do this for the game to read the data properly (it doesn't read past the null terminator
# of `string`), but the original devs' equivalent to build_assets_fs.py had this bug so we need to replicate it to match. # of `string`), but the original devs' equivalent to build_assets_fs.py had this bug so we need to replicate it to match.
written_names = [] written_names = []
with open(out_bin, "wb") as f: with open(out_bin, "wb") as f:
f.write(config["title"].encode("ascii")) f.write("Map Ver.00/11/07 15:36".encode("ascii"))
next_data_pos = (len(config["assets"]) + 1) * 0x1C next_data_pos = (len(assets) + 1) * 0x1C
asset_idx = 0 asset_idx = 0
for asset in config["assets"]: for decompressed in assets:
toc_entry_pos = 0x20 + asset_idx * 0x1C toc_entry_pos = 0x20 + asset_idx * 0x1C
src_path = Path(src_dir, asset["path"]) decompressed = Path(decompressed)
build_path = Path(build_dir, asset["path"]) compressed = decompressed.with_suffix(".Yay0")
# non-texture assets should be compressed
if not decompressed.stem.endswith("_tex") and not compressed.exists():
print(f"uncompressed asset: {decompressed} (expected {compressed} to exist)")
exit(1)
# data for TOC entry # data for TOC entry
name = asset["name"] + "\0" name = decompressed.stem + "\0"
offset = next_data_pos offset = next_data_pos
size = next_multiple(build_path.stat().st_size, 2) decompressed_size = decompressed.stat().st_size
decompressed_size = src_path.stat().st_size size = next_multiple(compressed.stat().st_size, 2) if compressed.exists() else decompressed_size
#print(f"{name} {offset:08X} {size:08X} {decompressed_size:08X}") #print(f"{name} {offset:08X} {size:08X} {decompressed_size:08X}")
@ -55,7 +52,7 @@ def build_mapfs(src_dir, build_dir, out_bin):
# write data. # write data.
f.seek(0x20 + next_data_pos) f.seek(0x20 + next_data_pos)
f.write(build_path.read_bytes()) f.write(compressed.read_bytes() if compressed.exists() else decompressed.read_bytes())
next_data_pos += size next_data_pos += size
asset_idx += 1 asset_idx += 1
@ -71,36 +68,8 @@ def build_mapfs(src_dir, build_dir, out_bin):
f.seek(toc_entry_pos + 0x18) f.seek(toc_entry_pos + 0x18)
f.write((0x903F0000).to_bytes(4, byteorder="big")) # TODO: figure out purpose f.write((0x903F0000).to_bytes(4, byteorder="big")) # TODO: figure out purpose
def build_file(src_dir, out_dir, filename):
with open(src_dir + ".json", "r") as f:
config = json.loads(f.read())
asset = None
for a in config["assets"]:
if (a["path"] == filename):
asset = a
if not asset:
print("asset not configured in {}.json".format(src_dir))
exit(1)
src_path = Path(src_dir, filename)
out_path = Path(out_dir, filename)
if asset["compress"]:
call([f"{tools_dir}/Yay0compress", src_path, out_path])
else:
shutil.copy(src_path, out_path)
if __name__ == "__main__": if __name__ == "__main__":
sys.argv.pop(0) argv.pop(0) # python3
src = sys.argv.pop(0) out = argv.pop(0)
dest = sys.argv.pop(0)
if len(sys.argv) > 0: build_mapfs(out, argv)
# copy (and compress if required) the given file(s)
while len(sys.argv) > 0:
build_file(src, dest, sys.argv.pop())
else:
# build the aggregate file
build_mapfs(src, dest, dest + ".bin")

View File

@ -8,11 +8,11 @@ import traceback
def eprint(*args, **kwargs): def eprint(*args, **kwargs):
print(*args, file=stderr, **kwargs) print(*args, file=stderr, **kwargs)
write_buf = "" #write_buf = ""
def write(s): def write(s):
global write_buf #global write_buf
write_buf += s #write_buf += s
#print(s, end="") print(s, end="")
ANSI_RED = "\033[1;31;40m" ANSI_RED = "\033[1;31;40m"
ANSI_RESET = "\u001b[0m" ANSI_RESET = "\u001b[0m"
@ -436,7 +436,7 @@ def read_until_closing_paren(depth=1, lex_strings=False):
string_escape = False string_escape = False
while True: while True:
char = f.read(1) char = stdin.read(1)
if len(char) == 0: if len(char) == 0:
# EOF # EOF
@ -463,7 +463,7 @@ def read_line():
line = "" line = ""
while True: while True:
char = f.read(1) char = stdin.read(1)
if len(char) == 0: if len(char) == 0:
# EOF # EOF
@ -501,115 +501,107 @@ if __name__ == "__main__":
file_info = [] file_info = []
error = False error = False
num_scripts = int(stdin.read()) macro_name = "" # captures recent UPPER_CASE identifier
if num_scripts == 0: prev_char = ""
exit(0) while True:
print(f"compiling {num_scripts} scripts") char = stdin.read(1)
with open(argv[1], 'r') as f: if len(char) == 0:
macro_name = "" # captures recent UPPER_CASE identifier # EOF
prev_char = "" write(macro_name)
while True: break
char = f.read(1)
if len(char) == 0: if char == "#" and (prev_char == "\n" or prev_char == ""):
# EOF # cpp line/file marker
write(macro_name) line = read_line()
break line_split = line[1:].split(" ")
if char == "#" and (prev_char == "\n" or prev_char == ""): line_no = int(line_split[0])
# cpp line/file marker file_info = line_split[1:]
line = read_line()
line_split = line[1:].split(" ")
line_no = int(line_split[0]) write("#" + line + "\n")
file_info = line_split[1:] elif char == "(":
filename = file_info[0][1:-1]
write("#" + line + "\n") # SCRIPT(...)
elif char == "(": if macro_name == "SCRIPT":
filename = file_info[0][1:-1] script_source, line_map = gen_line_map(read_until_closing_paren(lex_strings=True), source_line_no=line_no)
# SCRIPT(...) try:
if macro_name == "SCRIPT": commands = compile_script(script_source)
script_source, line_map = gen_line_map(read_until_closing_paren(lex_strings=True), source_line_no=line_no)
try: write("{\n")
commands = compile_script(script_source) for command in commands:
if command.meta:
write(f"# {line_map[command.meta.line]} {file_info[0]}\n")
write(" ")
for word in command.to_bytecode():
if type(word) == str:
write(word)
elif type(word) == int:
write(f"0x{word & 0xFFFFFFFF:X}")
else:
raise Exception(f"{command}.to_bytecode() gave {type(word)} {word}")
write(", ")
write("\n")
write("}")
except exceptions.UnexpectedEOF as e:
eprint(f"{filename}:{line_no}: {ANSI_RED}error{ANSI_RESET}: unterminated SCRIPT(...) macro")
error = True
except exceptions.UnexpectedCharacters as e:
line = line_map[e.line]
char = script_source[e.pos_in_stream]
allowed = e.allowed
write("{\n") eprint(f"{filename}:{line}: {ANSI_RED}script parse error{ANSI_RESET}: unexpected `{char}', expected {' or '.join(allowed)}")
for command in commands: eprint(e.get_context(script_source))
if command.meta:
write(f"# {line_map[command.meta.line]} {file_info[0]}\n")
write(" ")
for word in command.to_bytecode():
if type(word) == str:
write(word)
elif type(word) == int:
write(f"0x{word & 0xFFFFFFFF:X}")
else:
raise Exception(f"{command}.to_bytecode() gave {type(word)} {word}")
write(", ")
write("\n")
write("}")
except exceptions.UnexpectedEOF as e:
eprint(f"{filename}:{line_no}: {ANSI_RED}error{ANSI_RESET}: unterminated SCRIPT(...) macro")
error = True
except exceptions.UnexpectedCharacters as e:
line = line_map[e.line]
char = script_source[e.pos_in_stream]
allowed = e.allowed
eprint(f"{filename}:{line}: {ANSI_RED}script parse error{ANSI_RESET}: unexpected `{char}', expected {' or '.join(allowed)}") error = True
eprint(e.get_context(script_source)) except exceptions.UnexpectedToken as e:
line = line_map[e.line]
error = True eprint(f"{filename}:{line}: {ANSI_RED}script parse error{ANSI_RESET}: unexpected `{e.token}'")
except exceptions.UnexpectedToken as e: eprint(e.get_context(script_source))
line = line_map[e.line]
eprint(f"{filename}:{line}: {ANSI_RED}script parse error{ANSI_RESET}: unexpected `{e.token}'") error = True
eprint(e.get_context(script_source)) except exceptions.VisitError as e:
if type(e.orig_exc) == CompileError:
error = True line = line_map[e.orig_exc.meta.line]
except exceptions.VisitError as e: eprint(f"{filename}:{line}: {ANSI_RED}script compile error{ANSI_RESET}: {e.orig_exc}")
if type(e.orig_exc) == CompileError: else:
line = line_map[e.orig_exc.meta.line] eprint(f"{filename}:{line_no}: {ANSI_RED}internal script transform error{ANSI_RESET}")
eprint(f"{filename}:{line}: {ANSI_RED}script compile error{ANSI_RESET}: {e.orig_exc}")
else:
eprint(f"{filename}:{line_no}: {ANSI_RED}internal script transform error{ANSI_RESET}")
traceback.print_exc()
error = True
except CompileError as e:
line = line_map[e.meta.line]
eprint(f"{filename}:{line}: {ANSI_RED}script compile error{ANSI_RESET}: {e}")
error = True
except Exception as e:
eprint(f"{filename}:{line_no}: {ANSI_RED}internal script compilation error{ANSI_RESET}")
traceback.print_exc() traceback.print_exc()
error = True error = True
except CompileError as e:
line = line_map[e.meta.line]
eprint(f"{filename}:{line}: {ANSI_RED}script compile error{ANSI_RESET}: {e}")
error = True
except Exception as e:
eprint(f"{filename}:{line_no}: {ANSI_RED}internal script compilation error{ANSI_RESET}")
traceback.print_exc()
error = True
line_no += script_source.count("\n") line_no += script_source.count("\n")
write(f"\n# {line_no} {file_info[0]}\n") write(f"\n# {line_no} {file_info[0]}\n")
else:
# leave non-macro in source
write(macro_name + char)
macro_name = ""
elif char == "_" or (char >= 'A' and char <= 'Z'):
macro_name += char
else: else:
# leave non-macro in source
write(macro_name + char) write(macro_name + char)
macro_name = ""
if char == "\n": macro_name = ""
char_no = 0 elif char == "_" or (char >= 'A' and char <= 'Z'):
line_no += 1 macro_name += char
else:
write(macro_name + char)
macro_name = ""
char_no += 1 if char == "\n":
prev_char = char char_no = 0
line_no += 1
char_no += 1
prev_char = char
if error: if error:
exit(1) exit(1)
else: else:
with open(argv[1], "w") as f:
f.write(write_buf)
exit(0) exit(0)

@ -1 +1 @@
Subproject commit 895abeff31cc0bd5de3a05a55715d3457f8425eb Subproject commit 2e2ba8632c604aadb8055905340962c0182f844e

View File

@ -4,7 +4,8 @@ options:
find-file-boundaries: True find-file-boundaries: True
compiler: "GCC" compiler: "GCC"
mnemonic_ljust: 10 mnemonic_ljust: 10
ld_o_replace_extension: no ld_o_replace_extension: False
ld_addrs_header: include/ld_addrs.h
segments: segments:
- name: header - name: header
type: header type: header
@ -19,8 +20,7 @@ segments:
files: files:
- [0x0040, "asm", "boot"] - [0x0040, "asm", "boot"]
- [0x0B70, "bin", "bootcode_font"] - [0x0B70, "bin", "bootcode_font"]
- name: code - type: code
type: code
start: 0x1000 start: 0x1000
vram: 0x80025C00 vram: 0x80025C00
files: files:
@ -198,8 +198,7 @@ segments:
- [0x4ac90, "c", "os/code_4ac90_len_3910"] - [0x4ac90, "c", "os/code_4ac90_len_3910"]
- [0x4E5A0, "bin"] - [0x4E5A0, "bin"]
- [0x6E8F0, "bin", "world/area_table"] - [0x6E8F0, "bin", "world/area_table"]
- name: code - type: code
type: code
start: 0x759B0 start: 0x759B0
vram: 0x800DC500 vram: 0x800DC500
files: files:
@ -213,8 +212,7 @@ segments:
- [0x8a860, "c", "code_8a860_len_3f30"] - [0x8a860, "c", "code_8a860_len_3f30"]
- [0x8e790, "c", "code_8e790_len_2850"] - [0x8e790, "c", "code_8e790_len_2850"]
- [0x90fe0, "bin"] - [0x90fe0, "bin"]
- name: code - type: code
type: code
start: 0xA5DD0 start: 0xA5DD0
vram: 0x8010F6D0 vram: 0x8010F6D0
files: files:
@ -233,8 +231,7 @@ segments:
- [0xe16b0, "bin"] - [0xe16b0, "bin"]
- [0xE5820, ".data", "code_dc470_len_14c0"] - [0xE5820, ".data", "code_dc470_len_14c0"]
- [0xE5830, "bin"] - [0xE5830, "bin"]
- name: code - type: code
type: code
start: 0xE79B0 start: 0xE79B0
vram: 0x802C3000 vram: 0x802C3000
files: files:
@ -253,16 +250,14 @@ segments:
- [0xFE660, "bin"] - [0xFE660, "bin"]
- [0xFE730, ".rodata", "code_e79b0_len_1920"] - [0xFE730, ".rodata", "code_e79b0_len_1920"]
- [0xFE748, "bin"] # rodata chunk for above overlay; here to avoid the 0x10 alignment - [0xFE748, "bin"] # rodata chunk for above overlay; here to avoid the 0x10 alignment
- name: code - type: code
type: code
start: 0xFEE30 start: 0xFEE30
vram: 0x802DBD40 vram: 0x802DBD40
files: files:
- [0xfee30, "c", "code_fee30_len_2d60"] - [0xfee30, "c", "code_fee30_len_2d60"]
- [0x101b90, "c", "code_101b90_len_8f0"] - [0x101b90, "c", "code_101b90_len_8f0"]
- [0x102480, "bin"] - [0x102480, "bin"]
- name: code - type: code
type: code
start: 0x102610 start: 0x102610
vram: 0x802E0D90 vram: 0x802E0D90
files: files:
@ -275,8 +270,7 @@ segments:
- [0x10A8D0, "c", "code_10A8D0"] - [0x10A8D0, "c", "code_10A8D0"]
- [0x10A9F0, "bin"] # todo split this further - [0x10A9F0, "bin"] # todo split this further
- [0x131340, "bin"] # 0x8023E000 - [0x131340, "bin"] # 0x8023E000
- name: code - type: code
type: code
start: 0x135EE0 start: 0x135EE0
vram: 0x80242BA0 vram: 0x80242BA0
files: files:
@ -286,8 +280,7 @@ segments:
- [0x140C70, "c"] - [0x140C70, "c"]
- [0x1421C0, "c"] - [0x1421C0, "c"]
- [0x1422A0, "bin"] - [0x1422A0, "bin"]
- name: code - type: code
type: code
start: 0x163400 start: 0x163400
vram: 0x80242BA0 vram: 0x80242BA0
files: files:
@ -297,8 +290,7 @@ segments:
- [0x168590, "c"] - [0x168590, "c"]
- [0x169BE0, "c"] - [0x169BE0, "c"]
- [0x16A3E0, "bin"] - [0x16A3E0, "bin"]
- name: code - type: code
type: code
start: 0x16C8E0 start: 0x16C8E0
vram: 0x8023E000 vram: 0x8023E000
files: files:
@ -321,112 +313,96 @@ segments:
- [0x1AF230, "c"] - [0x1AF230, "c"]
- [0x1AF2D0, "bin"] - [0x1AF2D0, "bin"]
- [0x1CC310, "bin"] # icon images and palettes, vram unknown - [0x1CC310, "bin"] # icon images and palettes, vram unknown
- name: code - type: code
type: code
start: 0x3169F0 start: 0x3169F0
vram: 0x80200000 vram: 0x80200000
files: files:
- [0x3169f0, "c", "code_3169f0"] - [0x3169f0, "c", "code_3169f0"]
- [0x316a70, "c", "code_316a70"] - [0x316a70, "c", "code_316a70"]
- [0x316c00, "bin"] # 0x802AE000 - [0x316c00, "bin"] # 0x802AE000
- name: code - type: code
type: code
start: 0x316D90 start: 0x316D90
vram: 0x802AE000 vram: 0x802AE000
files: files:
- [0x316d90, "c", "code_316d90"] - [0x316d90, "c", "code_316d90"]
- name: code - type: code
type: code
start: 0x316f30 start: 0x316f30
vram: 0x802B2000 vram: 0x802B2000
files: files:
- [0x316f30, "c", "code_316f30"] - [0x316f30, "c", "code_316f30"]
- name: code - type: code
type: code
start: 0x317020 start: 0x317020
vram: 0x802BD100 vram: 0x802BD100
files: files:
- [0x317020, "c"] - [0x317020, "c"]
- [0x317b60, "bin"] - [0x317b60, "bin"]
- name: code - type: code
type: code
start: 0x317e50 start: 0x317e50
vram: 0x802BD100 vram: 0x802BD100
files: files:
- [0x317e50, "c"] - [0x317e50, "c"]
- [0x3195d0, "bin"] - [0x3195d0, "bin"]
- name: code - type: code
type: code
start: 0x319670 start: 0x319670
vram: 0x802BD100 vram: 0x802BD100
files: files:
- [0x319670, "c"] - [0x319670, "c"]
- [0x31b000, "bin"] - [0x31b000, "bin"]
- name: code - type: code
type: code
start: 0x31b120 start: 0x31b120
vram: 0x802BD100 vram: 0x802BD100
files: files:
- [0x31b120, "c"] - [0x31b120, "c"]
- [0x31cb60, "bin"] - [0x31cb60, "bin"]
- name: code - type: code
type: code
start: 0x31cc70 start: 0x31cc70
vram: 0x802BD100 vram: 0x802BD100
files: files:
- [0x31cc70, "c"] - [0x31cc70, "c"]
- [0x31ddc0, "bin"] - [0x31ddc0, "bin"]
- name: code - type: code
type: code
start: 0x31de70 start: 0x31de70
vram: 0x802BD100 vram: 0x802BD100
files: files:
- [0x31de70, "c"] - [0x31de70, "c"]
- [0x320b20, "bin"] - [0x320b20, "bin"]
- name: code - type: code
type: code
start: 0x320c50 start: 0x320c50
vram: 0x802BD100 vram: 0x802BD100
files: files:
- [0x320c50, "c"] - [0x320c50, "c"]
- [0x3239b0, "bin"] - [0x3239b0, "bin"]
- name: code - type: code
type: code
start: 0x323A50 start: 0x323A50
vram: 0x802BD100 vram: 0x802BD100
files: files:
- [0x323A50, "c"] - [0x323A50, "c"]
- [0x324930, "bin"] - [0x324930, "bin"]
- name: code - type: code
type: code
start: 0x324a10 start: 0x324a10
vram: 0x802BD100 vram: 0x802BD100
files: files:
- [0x324a10, "c", "world_goompa"] - [0x324a10, "c", "world_goompa"]
- [0x324e80, "bin"] - [0x324e80, "bin"]
- name: code - type: code
type: code
start: 0x324f10 start: 0x324f10
vram: 0x802BD100 vram: 0x802BD100
files: files:
- [0x324f10, "c", "world_goombaria"] - [0x324f10, "c", "world_goombaria"]
- [0x325000, "bin"] - [0x325000, "bin"]
- name: code - type: code
type: code
start: 0x325070 start: 0x325070
vram: 0x802BD100 vram: 0x802BD100
files: files:
- [0x325070, "c", "world_twink"] - [0x325070, "c", "world_twink"]
- [0x325160, "bin"] - [0x325160, "bin"]
- name: code - type: code
type: code
start: 0x3251d0 start: 0x3251d0
vram: 0x802BD100 vram: 0x802BD100
files: files:
- [0x3251d0, "c"] - [0x3251d0, "c"]
- [0x3255e0, "bin"] - [0x3255e0, "bin"]
- name: code - type: code
type: code
start: 0x325ad0 start: 0x325ad0
vram: 0xE0200000 vram: 0xE0200000
files: files:
@ -434,23 +410,20 @@ segments:
- [0x325ee0, "c"] - [0x325ee0, "c"]
- [0x326160, "bin"] - [0x326160, "bin"]
- [0x326410, "bin"] - [0x326410, "bin"]
- name: code - type: code
type: code
start: 0x3278f0 start: 0x3278f0
vram: 0xE0002000 vram: 0xE0002000
files: files:
- [0x3278f0, "c"] - [0x3278f0, "c"]
- [0x328050, "bin"] - [0x328050, "bin"]
- name: code - type: code
type: code
start: 0x328110 start: 0x328110
vram: 0xE000C000 vram: 0xE000C000
files: files:
- [0x328110, "c"] - [0x328110, "c"]
- [0x328d20, "bin"] - [0x328d20, "bin"]
- [0x328EA0, "bin"] - [0x328EA0, "bin"]
- name: code - type: code
type: code
start: 0x32C110 start: 0x32C110
vram: 0xE000E000 vram: 0xE000E000
files: files:
@ -468,179 +441,156 @@ segments:
- [0x330440, "bin"] # data/rodata section for above. - [0x330440, "bin"] # data/rodata section for above.
- [0x330910, "bin"] # code, unknown VRAM addr. Leaving as bin for now. - [0x330910, "bin"] # code, unknown VRAM addr. Leaving as bin for now.
- [0x330ef0, "bin"] # data/rodata section for above. - [0x330ef0, "bin"] # data/rodata section for above.
- name: code - type: code
type: code
start: 0x331940 start: 0x331940
vram: 0xE001E000 vram: 0xE001E000
files: files:
- [0x331940, "c"] - [0x331940, "c"]
- [0x332690, "bin"] - [0x332690, "bin"]
- [0x3326A0, "bin"] - [0x3326A0, "bin"]
- name: code - type: code
type: code
start: 0x333ec0 start: 0x333ec0
vram: 0xE0020000 vram: 0xE0020000
files: files:
- [0x333ec0, "c"] - [0x333ec0, "c"]
- [0x334b50, "bin"] - [0x334b50, "bin"]
- [0x334C70, "bin"] - [0x334C70, "bin"]
- name: code - type: code
type: code
start: 0x337240 start: 0x337240
vram: 0xE0022000 vram: 0xE0022000
files: files:
- [0x337240, "c"] - [0x337240, "c"]
- [0x337f10, "bin"] - [0x337f10, "bin"]
- [0x337FC0, "bin"] - [0x337FC0, "bin"]
- name: code - type: code
type: code
start: 0x339250 start: 0x339250
vram: 0xE0024000 vram: 0xE0024000
files: files:
- [0x339250, "c"] - [0x339250, "c"]
- [0x339f10, "bin"] - [0x339f10, "bin"]
- [0x339F60, "bin"] - [0x339F60, "bin"]
- name: code - type: code
type: code
start: 0x33B180 start: 0x33B180
vram: 0xE0026000 vram: 0xE0026000
files: files:
- [0x33B180, "c"] - [0x33B180, "c"]
- [0x33bb70, "bin"] - [0x33bb70, "bin"]
- [0x33BBD0, "bin"] - [0x33BBD0, "bin"]
- name: code - type: code
type: code
start: 0x33CDF0 start: 0x33CDF0
vram: 0xE0028000 vram: 0xE0028000
files: files:
- [0x33CDF0, "c"] - [0x33CDF0, "c"]
- [0x33d5d0, "bin"] - [0x33d5d0, "bin"]
- name: code - type: code
type: code
start: 0x33E8C0 start: 0x33E8C0
vram: 0xE002A000 vram: 0xE002A000
files: files:
- [0x33E8C0, "c"] - [0x33E8C0, "c"]
- [0x33efe0, "bin"] - [0x33efe0, "bin"]
- [0x33D610, "bin"] - [0x33D610, "bin"]
- name: code - type: code
type: code
start: 0x33FE80 start: 0x33FE80
vram: 0xE002C000 vram: 0xE002C000
files: files:
- [0x33FE80, "c"] - [0x33FE80, "c"]
- [0x3407c0, "bin"] - [0x3407c0, "bin"]
- [0x340880, "bin"] - [0x340880, "bin"]
- name: code - type: code
type: code
start: 0x3419E0 start: 0x3419E0
vram: 0xE002E000 vram: 0xE002E000
files: files:
- [0x3419E0, "c"] - [0x3419E0, "c"]
- [0x342120, "bin"] - [0x342120, "bin"]
- name: code - type: code
type: code
start: 0x342140 start: 0x342140
vram: 0xE0030000 vram: 0xE0030000
files: files:
- [0x342140, "c"] - [0x342140, "c"]
- [0x342fd0, "bin"] - [0x342fd0, "bin"]
- [0x343040, "bin"] - [0x343040, "bin"]
- name: code - type: code
type: code
start: 0x343680 start: 0x343680
vram: 0xE0032000 vram: 0xE0032000
files: files:
- [0x343680, "c"] - [0x343680, "c"]
- [0x343f30, "bin"] - [0x343f30, "bin"]
- [0x343F70, "bin"] - [0x343F70, "bin"]
- name: code - type: code
type: code
start: 0x344a10 start: 0x344a10
vram: 0xE0034000 vram: 0xE0034000
files: files:
- [0x344a10, "c"] - [0x344a10, "c"]
- [0x345190, "bin"] - [0x345190, "bin"]
- [0x3451E0, "bin"] - [0x3451E0, "bin"]
- name: code - type: code
type: code
start: 0x3454E0 start: 0x3454E0
vram: 0xE0036000 vram: 0xE0036000
files: files:
- [0x3454E0, "c"] - [0x3454E0, "c"]
- [0x345b10, "bin"] - [0x345b10, "bin"]
- [0x345B40, "bin"] - [0x345B40, "bin"]
- name: code - type: code
type: code
start: 0x34EC80 start: 0x34EC80
vram: 0xE003A000 vram: 0xE003A000
files: files:
- [0x34EC80, "c"] - [0x34EC80, "c"]
- [0x34f480, "bin"] - [0x34f480, "bin"]
- name: code - type: code
type: code
start: 0x34F4C0 start: 0x34F4C0
vram: 0xE003C000 vram: 0xE003C000
files: files:
- [0x34F4C0, "c"] - [0x34F4C0, "c"]
- [0x350160, "bin"] - [0x350160, "bin"]
- [0x350220, "bin"] - [0x350220, "bin"]
- name: code - type: code
type: code
start: 0x352440 start: 0x352440
vram: 0xE003E000 vram: 0xE003E000
files: files:
- [0x352440, "c"] - [0x352440, "c"]
- [0x352cb0, "bin"] - [0x352cb0, "bin"]
- [0x352CE0, "bin"] - [0x352CE0, "bin"]
- name: code - type: code
type: code
start: 0x354F60 start: 0x354F60
vram: 0xE0044000 vram: 0xE0044000
files: files:
- [0x354F60, "c"] - [0x354F60, "c"]
- [0x355d10, "bin"] - [0x355d10, "bin"]
- name: code - type: code
type: code
start: 0x355EE0 start: 0x355EE0
vram: 0xE0046000 vram: 0xE0046000
files: files:
- [0x355EE0, "c"] - [0x355EE0, "c"]
- [0x3564e0, "bin"] - [0x3564e0, "bin"]
- [0x356530, "bin"] - [0x356530, "bin"]
- name: code - type: code
type: code
start: 0x356980 start: 0x356980
vram: 0xE0048000 vram: 0xE0048000
files: files:
- [0x356980, "c"] - [0x356980, "c"]
- [0x357380, "bin"] - [0x357380, "bin"]
- [0x3573A0, "bin"] - [0x3573A0, "bin"]
- name: code - type: code
type: code
start: 0x3584C0 start: 0x3584C0
vram: 0xE004A000 vram: 0xE004A000
files: files:
- [0x3584C0, "c"] - [0x3584C0, "c"]
- [0x359320, "bin"] - [0x359320, "bin"]
- [0x3593B0, "bin"] - [0x3593B0, "bin"]
- name: code - type: code
type: code
start: 0x35B9D0 start: 0x35B9D0
vram: 0xE004E000 vram: 0xE004E000
files: files:
- [0x35B9D0, "c"] - [0x35B9D0, "c"]
- [0x35bfb0, "bin"] - [0x35bfb0, "bin"]
- name: code - type: code
type: code
start: 0x35BFD0 start: 0x35BFD0
vram: 0xE0050000 vram: 0xE0050000
files: files:
- [0x35BFD0, "c"] - [0x35BFD0, "c"]
- [0x35c530, "bin"] - [0x35c530, "bin"]
- [0x35C550, "bin"] - [0x35C550, "bin"]
- name: code - type: code
type: code
start: 0x3602C0 start: 0x3602C0
vram: 0xE005A000 vram: 0xE005A000
files: files:
@ -657,78 +607,68 @@ segments:
- [0x364bc0, "bin"] # data/rodata for the above, and some extra unknown data. - [0x364bc0, "bin"] # data/rodata for the above, and some extra unknown data.
- [0x364f10, "bin"] # code, unknown VRAM addr. Leaving as bin for now. - [0x364f10, "bin"] # code, unknown VRAM addr. Leaving as bin for now.
- [0x365970, "bin"] # data/rodata for the above, and some extra unknown data. - [0x365970, "bin"] # data/rodata for the above, and some extra unknown data.
- name: code - type: code
type: code
start: 0x366030 start: 0x366030
vram: 0xE0066000 vram: 0xE0066000
files: files:
- [0x366030, "c"] - [0x366030, "c"]
- [0x366c80, "bin"] - [0x366c80, "bin"]
- [0x366D60, "bin"] - [0x366D60, "bin"]
- name: code - type: code
type: code
start: 0x36A8D0 start: 0x36A8D0
vram: 0xE0068000 vram: 0xE0068000
files: files:
- [0x36A8D0, "c"] - [0x36A8D0, "c"]
- [0x36ae80, "bin"] - [0x36ae80, "bin"]
- [0x36AEE0, "bin"] - [0x36AEE0, "bin"]
- name: code - type: code
type: code
start: 0x36D020 start: 0x36D020
vram: 0xE006A000 vram: 0xE006A000
files: files:
- [0x36D020, "c"] - [0x36D020, "c"]
- [0x36de10, "bin"] - [0x36de10, "bin"]
- [0x36DF90, "bin"] - [0x36DF90, "bin"]
- name: code - type: code
type: code
start: 0x36E1D0 start: 0x36E1D0
vram: 0xE006C000 vram: 0xE006C000
files: files:
- [0x36E1D0, "c"] - [0x36E1D0, "c"]
- [0x36ed30, "bin"] - [0x36ed30, "bin"]
- [0x36ED60, "bin"] - [0x36ED60, "bin"]
- name: code - type: code
type: code
start: 0x372790 start: 0x372790
vram: 0xE006E000 vram: 0xE006E000
files: files:
- [0x372790, "c"] - [0x372790, "c"]
- [0x373390, "bin"] - [0x373390, "bin"]
- [0x3733E0, "bin"] - [0x3733E0, "bin"]
- name: code - type: code
type: code
start: 0x3740B0 start: 0x3740B0
vram: 0xE0070000 vram: 0xE0070000
files: files:
- [0x3740B0, "c"] - [0x3740B0, "c"]
- [0x374d80, "bin"] - [0x374d80, "bin"]
- name: code - type: code
type: code
start: 0x374E50 start: 0x374E50
vram: 0xE0072000 vram: 0xE0072000
files: files:
- [0x374E50, "c"] - [0x374E50, "c"]
- [0x375500, "bin"] - [0x375500, "bin"]
- [0x375510, "bin"] - [0x375510, "bin"]
- name: code - type: code
type: code
start: 0x376460 start: 0x376460
vram: 0xE0074000 vram: 0xE0074000
files: files:
- [0x376460, "c"] - [0x376460, "c"]
- [0x376fc0, "bin"] - [0x376fc0, "bin"]
- name: code - type: code
type: code
start: 0x377070 start: 0x377070
vram: 0xE0076000 vram: 0xE0076000
files: files:
- [0x377070, "c"] - [0x377070, "c"]
- [0x377f00, "bin"] - [0x377f00, "bin"]
- [0x377F80, "bin"] - [0x377F80, "bin"]
- name: code - type: code
type: code
start: 0x37A3F0 start: 0x37A3F0
vram: 0xE0078000 vram: 0xE0078000
files: files:
@ -736,79 +676,69 @@ segments:
- [0x37acf0, "bin"] - [0x37acf0, "bin"]
- [0x37ADD0, "bin"] - [0x37ADD0, "bin"]
- [0x37D9D0, "bin"] - [0x37D9D0, "bin"]
- name: code - type: code
type: code
start: 0x37F720 start: 0x37F720
vram: 0xE007E000 vram: 0xE007E000
files: files:
- [0x37F720, "c"] - [0x37F720, "c"]
- [0x380350, "bin"] - [0x380350, "bin"]
- [0x3803A0, "bin"] - [0x3803A0, "bin"]
- name: code - type: code
type: code
start: 0x3812C0 start: 0x3812C0
vram: 0xE0080000 vram: 0xE0080000
files: files:
- [0x3812C0, "c"] - [0x3812C0, "c"]
- [0x381d80, "bin"] - [0x381d80, "bin"]
- [0x381E00, "bin"] - [0x381E00, "bin"]
- name: code - type: code
type: code
start: 0x385640 start: 0x385640
vram: 0xE0082000 vram: 0xE0082000
files: files:
- [0x385640, "c"] - [0x385640, "c"]
- [0x386340, "bin"] - [0x386340, "bin"]
- [0x3863B0, "bin"] - [0x3863B0, "bin"]
- name: code - type: code
type: code
start: 0x3889D0 start: 0x3889D0
vram: 0xE0084000 vram: 0xE0084000
files: files:
- [0x3889D0, "c"] - [0x3889D0, "c"]
- [0x3897e0, "bin"] - [0x3897e0, "bin"]
- name: code - type: code
type: code
start: 0x389850 start: 0x389850
vram: 0xE0086000 vram: 0xE0086000
files: files:
- [0x389850, "c"] - [0x389850, "c"]
- [0x38a2f0, "bin"] - [0x38a2f0, "bin"]
- [0x38A350, "bin"] - [0x38A350, "bin"]
- name: code - type: code
type: code
start: 0x38ADF0 start: 0x38ADF0
vram: 0xE0088000 vram: 0xE0088000
files: files:
- [0x38ADF0, "c"] - [0x38ADF0, "c"]
- [0x38bab0, "bin"] - [0x38bab0, "bin"]
- [0x38BBA0, "bin"] - [0x38BBA0, "bin"]
- name: code - type: code
type: code
start: 0x38EE60 start: 0x38EE60
vram: 0xE008E000 vram: 0xE008E000
files: files:
- [0x38EE60, "c"] - [0x38EE60, "c"]
- [0x38f6f0, "bin"] - [0x38f6f0, "bin"]
- [0x38F710, "bin"] - [0x38F710, "bin"]
- name: code - type: code
type: code
start: 0x38F900 start: 0x38F900
vram: 0xE0090000 vram: 0xE0090000
files: files:
- [0x38F900, "c"] - [0x38F900, "c"]
- [0x390340, "bin"] - [0x390340, "bin"]
- [0x3903D0, "bin"] - [0x3903D0, "bin"]
- name: code - type: code
type: code
start: 0x391D30 start: 0x391D30
vram: 0xE0092000 vram: 0xE0092000
files: files:
- [0x391D30, "c"] - [0x391D30, "c"]
- [0x3923c0, "bin"] - [0x3923c0, "bin"]
- [0x392440, "bin"] - [0x392440, "bin"]
- name: code - type: code
type: code
start: 0x3928D0 start: 0x3928D0
vram: 0xE0094000 vram: 0xE0094000
files: files:
@ -829,78 +759,68 @@ segments:
- [0x3a2440, "bin"] # data/rodata for the above, and some extra unknown data. - [0x3a2440, "bin"] # data/rodata for the above, and some extra unknown data.
- [0x3a2990, "bin"] # code, unknown VRAM addr. Leaving as bin for now. - [0x3a2990, "bin"] # code, unknown VRAM addr. Leaving as bin for now.
- [0x3a3360, "bin"] # data/rodata for the above, and some extra unknown data. - [0x3a3360, "bin"] # data/rodata for the above, and some extra unknown data.
- name: code - type: code
type: code
start: 0x3A37E0 start: 0x3A37E0
vram: 0xE00A4000 vram: 0xE00A4000
files: files:
- [0x3A37E0, "c"] - [0x3A37E0, "c"]
- [0x3a42b0, "bin"] - [0x3a42b0, "bin"]
- [0x3A4320, "bin"] - [0x3A4320, "bin"]
- name: code - type: code
type: code
start: 0x3A70F0 start: 0x3A70F0
vram: 0xE00A8000 vram: 0xE00A8000
files: files:
- [0x3A70F0, "c"] - [0x3A70F0, "c"]
- [0x3A7710, "bin"] - [0x3A7710, "bin"]
- [0x3A77A0, "bin"] # split further - [0x3A77A0, "bin"] # split further
- name: code - type: code
type: code
start: 0x3AA920 start: 0x3AA920
vram: 0xE00AA000 vram: 0xE00AA000
files: files:
- [0x3AA920, "c"] - [0x3AA920, "c"]
- [0x3AAFE0, "bin"] - [0x3AAFE0, "bin"]
- [0x3AB030, "bin"] # todo split this further - [0x3AB030, "bin"] # todo split this further
- name: code - type: code
type: code
start: 0x3AEE20 start: 0x3AEE20
vram: 0xE00AC000 vram: 0xE00AC000
files: files:
- [0x3AEE20, "c"] - [0x3AEE20, "c"]
- [0x3AF5D0, "bin"] - [0x3AF5D0, "bin"]
- [0x3AF700, "bin"] # todo split this further - [0x3AF700, "bin"] # todo split this further
- name: code - type: code
type: code
start: 0x3B2350 start: 0x3B2350
vram: 0xE00AE000 vram: 0xE00AE000
files: files:
- [0x3B2350, "c"] - [0x3B2350, "c"]
- [0x3B2D90, "bin"] # todo split this further - [0x3B2D90, "bin"] # todo split this further
- name: code - type: code
type: code
start: 0x3B3EB0 start: 0x3B3EB0
vram: 0xE00B0000 vram: 0xE00B0000
files: files:
- [0x3B3EB0, "c"] - [0x3B3EB0, "c"]
- [0x3B4690, "bin"] - [0x3B4690, "bin"]
- [0x3B46A0, "bin"] # todo split this further - [0x3B46A0, "bin"] # todo split this further
- name: code - type: code
type: code
start: 0x3B7B80 start: 0x3B7B80
vram: 0xE00B8000 vram: 0xE00B8000
files: files:
- [0x3B7B80, "c"] - [0x3B7B80, "c"]
- [0x3B8470, "bin"] - [0x3B8470, "bin"]
- [0x3B8860, "bin"] # todo split this further - [0x3B8860, "bin"] # todo split this further
- name: code - type: code
type: code
start: 0x3BA030 start: 0x3BA030
vram: 0xE00BC000 vram: 0xE00BC000
files: files:
- [0x3BA030, "c"] - [0x3BA030, "c"]
- [0x3BAC60, "bin"] - [0x3BAC60, "bin"]
- [0x3BAEA0, "bin"] # todo split this further ADD STUFF AFTER HERE - [0x3BAEA0, "bin"] # todo split this further ADD STUFF AFTER HERE
- name: code - type: code
type: code
start: 0x415D90 start: 0x415D90
vram: 0x802A1000 vram: 0x802A1000
files: files:
- [0x415D90, "c"] - [0x415D90, "c"]
- [0x4200C0, "bin"] # todo split this further - [0x4200C0, "bin"] # todo split this further
- name: code - type: code
type: code
start: 0x7E0E80 start: 0x7E0E80
vram: 0x80280000 vram: 0x80280000
files: files:
@ -909,6 +829,7 @@ segments:
- [0x7E3700, "c"] - [0x7E3700, "c"]
- [0x7e4d00, "bin"] - [0x7e4d00, "bin"]
- name: world/area_mac/machi/ - name: world/area_mac/machi/
ld_name: machi
type: code type: code
overlay: True overlay: True
start: 0x7E73A0 start: 0x7E73A0
@ -4031,17 +3952,6 @@ segments:
- [0xB13500, "bin"] - [0xB13500, "bin"]
- [0xB13A40, "bin"] - [0xB13A40, "bin"]
- [0xB13D50, "bin"] # rodata - [0xB13D50, "bin"] # rodata
- name: world/area_kkj/kkj_26/
type: code
overlay: True
start: 0xB13120
vram: 0x80240000
files:
- [0xB13120, "c"]
- [0xB13150, "bin"]
- [0xB13500, "bin"]
- [0xB13A40, "bin"]
- [0xB13D50, "bin"] # rodata
- name: world/area_kkj/kkj_27/ - name: world/area_kkj/kkj_27/
type: code type: code
overlay: True overlay: True
@ -6590,16 +6500,14 @@ segments:
- [0xE1E460, "c"] - [0xE1E460, "c"]
- [0xE1EC20, "bin"] - [0xE1EC20, "bin"]
- [0xE20110, "bin"] - [0xE20110, "bin"]
- name: code - type: code
type: code
overlay: True overlay: True
start: 0xE20EB0 start: 0xE20EB0
vram: 0x802B7000 vram: 0x802B7000
files: files:
- [0xe20eb0, "c", "code_e20eb0"] - [0xe20eb0, "c", "code_e20eb0"]
- [0xE215C0, "bin"] - [0xE215C0, "bin"]
- name: code - type: code
type: code
overlay: True overlay: True
start: 0xE21870 start: 0xE21870
vram: 0x802B7000 vram: 0x802B7000
@ -6999,8 +6907,6 @@ segments:
- [0x1B81E88, "Yay0"] - [0x1B81E88, "Yay0"]
- [0x1B82058, "Yay0"] - [0x1B82058, "Yay0"]
- [0x1B82202, "bin"] - [0x1B82202, "bin"]
- name: assets/fs - [0x1E40000, "PaperMarioMapFS"]
type: PaperMarioMapFS
start: 0x1E40000
- [0x27FEE22, "bin"] - [0x27FEE22, "bin"]
- [0x2800000] - [0x2800000]