diff --git a/.gitignore b/.gitignore index 2e726e1323..61f6368094 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ settings.mk /img /msg /sprite + +tools/Yay0compress diff --git a/Makefile b/Makefile index b9332343be..2c55403d01 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,19 @@ CPP := cpp LD := $(CROSS)ld OBJCOPY := $(CROSS)objcopy +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + OS=linux + ICONV := iconv --from UTF-8 --to SHIFT-JIS +endif +ifeq ($(UNAME_S),Darwin) + OS=mac + ICONV := tools/iconv.py UTF-8 SHIFT-JIS +endif + +OLD_AS=tools/$(OS)/mips-nintendo-nu64-as +CC=tools/$(OS)/cc1 + CPPFLAGS := -Iinclude -Isrc -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2 -D_MIPS_SZLONG=32 -Wundef -Wcomment ASFLAGS := -EB -Iinclude -march=vr4300 -mtune=vr4300 OLDASFLAGS := -EB -Iinclude -G 0 @@ -138,12 +151,12 @@ $(BUILD_DIR)/%.Yay0.o: $(BUILD_DIR)/%.bin.Yay0 # Compile C files $(BUILD_DIR)/%.c.o: %.c $(MDEPS) | $(GENERATED_HEADERS) @mkdir -p $(shell dirname $@) - $(CPP) $(CPPFLAGS) -o - $(CPPMFLAGS) $< | iconv --from UTF-8 --to SHIFT-JIS | $(CC) $(CFLAGS) -o - | $(OLD_AS) $(OLDASFLAGS) -o $@ - + $(CPP) $(CPPFLAGS) -o - $(CPPMFLAGS) $< | $(ICONV) | $(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 $(MDEPS) tools/compile_dsl_macros.py | $(GENERATED_HEADERS) @mkdir -p $(shell dirname $@) - $(CPP) $(CPPFLAGS) -o - $< $(CPPMFLAGS) | $(PYTHON) tools/compile_dsl_macros.py | iconv --from UTF-8 --to SHIFT-JIS | $(CC) $(CFLAGS) -o - | $(OLD_AS) $(OLDASFLAGS) -o $@ - + $(CPP) $(CPPFLAGS) -o - $< $(CPPMFLAGS) | $(PYTHON) tools/compile_dsl_macros.py | $(ICONV) | $(CC) $(CFLAGS) -o - | $(OLD_AS) $(OLDASFLAGS) -o $@ - # Assemble handwritten ASM $(BUILD_DIR)/%.s.o: %.s diff --git a/tools/Yay0compress b/tools/Yay0compress deleted file mode 100755 index 10b3c1c0c6..0000000000 Binary files a/tools/Yay0compress and /dev/null differ diff --git a/tools/iconv.py b/tools/iconv.py new file mode 100755 index 0000000000..9575a57043 --- /dev/null +++ b/tools/iconv.py @@ -0,0 +1,23 @@ +#!/usr/bin/python3 + +import argparse +import sys + +parser = argparse.ArgumentParser(description='Convert a file from one encoding to another') +parser.add_argument("f") +parser.add_argument("t") +parser.add_argument('infile', nargs='?', type=argparse.FileType('r'), default=sys.stdin) +parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'), default=sys.stdout) + +args = parser.parse_args() + + +def main(args): + sys.stdin.reconfigure(encoding=args.f) + in_data = args.infile.read() + sys.stdout.reconfigure(encoding=args.t) + args.outfile.write(in_data) + + +if __name__ == "__main__": + main(parser.parse_args()) diff --git a/tools/cc1 b/tools/linux/cc1 similarity index 100% rename from tools/cc1 rename to tools/linux/cc1 diff --git a/tools/mips-nintendo-nu64-as b/tools/linux/mips-nintendo-nu64-as similarity index 100% rename from tools/mips-nintendo-nu64-as rename to tools/linux/mips-nintendo-nu64-as diff --git a/tools/mac/cc1 b/tools/mac/cc1 new file mode 100755 index 0000000000..1b8038eecc Binary files /dev/null and b/tools/mac/cc1 differ diff --git a/tools/mac/mips-nintendo-nu64-as b/tools/mac/mips-nintendo-nu64-as new file mode 100755 index 0000000000..8955737d84 Binary files /dev/null and b/tools/mac/mips-nintendo-nu64-as differ diff --git a/tools/n64splat b/tools/n64splat index 25ef3afa26..e0262202ef 160000 --- a/tools/n64splat +++ b/tools/n64splat @@ -1 +1 @@ -Subproject commit 25ef3afa263dc83bf1c6f9534a5da28b86c46a99 +Subproject commit e0262202ef931e0a0d09a144fcded281d0dc1656 diff --git a/tools/splat.yaml b/tools/splat.yaml index df9ba53af0..583634680c 100644 --- a/tools/splat.yaml +++ b/tools/splat.yaml @@ -26,6 +26,7 @@ segments: - type: code start: 0x1000 vram: 0x80025C00 + subalign: 8 files: - [0x1000, c, code_1000_len_60] - [0x1060, c, code_1060_len_310]