Skip to content

Commit

Permalink
release v8.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TreZc0 committed Sep 29, 2024
2 parents d53f30f + fd57adf commit 56d08e8
Show file tree
Hide file tree
Showing 204 changed files with 49,488 additions and 37,471 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/release.yml

This file was deleted.

20 changes: 18 additions & 2 deletions ASM/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CC = mips64-gcc
LD = mips64-ld
OBJDUMP = mips64-objdump
OBJCOPY = mips64-objcopy

CFLAGS = -O1 -G0 -fno-reorder-blocks -march=vr4300 -mtune=vr4300 -mabi=32 -mno-gpopt -mdivide-breaks \
-mexplicit-relocs
Expand All @@ -11,8 +12,12 @@ OBJDIR := build/bin
SRCDIR := c
vpath %.c c
vpath %.h c
RESOURCEDIR := resources

UC = $(shell echo '$1' | tr '[:lower:]' '[:upper:]')

OBJECTS = $(patsubst $(SRCDIR)/%.c,$(OBJDIR)/%.o,$(sort $(wildcard $(SRCDIR)/*.c)))
RESOURCES = $(patsubst $(RESOURCEDIR)/%.bin,$(OBJDIR)/%_bin.o,$(sort $(wildcard $(RESOURCEDIR)/*.bin)))

.PHONY: all clean bundle symbols

Expand All @@ -28,10 +33,21 @@ endif
$(OBJDIR):
mkdir -p $@

$(OBJDIR)/%_bin.o: $(RESOURCEDIR)/%.bin
$(OBJCOPY) -I binary -O elf32-bigmips --rename-section .data=.rodata,alloc,load,readonly,data,contents $< $@
$(OBJCOPY) --redefine-sym _binary_resources_$*_bin_start=$(call UC,$*)_RESOURCE $@
$(OBJCOPY) --redefine-sym _binary_resources_$*_bin_end=$(call UC,$*)_RESOURCE_END $@
$(OBJCOPY) --redefine-sym _binary_resources_$*_bin_size=$(call UC,$*)_RESOURCE_SIZE $@

$(RESOURCEDIR):
mkdir -p $@

$(OBJECTS): | $(OBJDIR)

bundle: $(OBJECTS)
$(LD) -T linker_script.ld -o $(OUTDIR)/bundle.o -i -L. $(patsubst %.o,-l:%.o,$(OBJECTS))
$(RESOURCES): | $(OBJDIR) $(RESOURCEDIR)

bundle: $(RESOURCES) $(OBJECTS)
$(LD) -T linker_script.ld -T ootSymbols.ld -o $(OUTDIR)/bundle.o -i -L. $(patsubst %.o,-l:%.o,$(OBJECTS) $(RESOURCES))

symbols: bundle
$(OBJDUMP) -t $(OUTDIR)/bundle.o | tr -d '\015' > $(OUTDIR)/c_symbols.txt
Expand Down
4 changes: 2 additions & 2 deletions ASM/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Advanced modifications to the Randomzier source require a bit more software than
- On other platforms you'll need either `clang` or `gcc`, `cmake`, and either `ninja` or `make` installed. All of these should be available in the package repositories of every major Linux distribution and Homebrew on macOS. After, follow the [building from source instructions](https://github.com/Kingcom/armips#22-building-from-source).
- Put the armips executable in the `tools` directory, or somewhere in your PATH.
- Put the ROM you want to patch at `roms/base.z64`. This needs to be an uncompressed ROM; OoTRandomizer will produce one at ZOOTDEC.z64 when you run it with a compressed ROM.
- Run `python build.py`, which will:
- Run `python build.py --no-compile-c`, which will:
- create `roms/patched.z64`
- update some `txt` files in `build/` and in `../data/generated/`. Check `git status` to see which ones have changed. Make sure you submit them all together!

Expand Down Expand Up @@ -45,7 +45,7 @@ Recompiling the C code for randomizer requires the N64 development tools to be i

You can substitute using the `tools` folder with adding the `n64/bin` folder to your environment PATH if you need an advanced setup.
### Running
To recompile the C modules, use `python build.py --compile-c` in this directory, or adjust the path to `build.py` relative to your terminal's working directory.
To recompile the C modules, use `python build.py` in this directory, or adjust the path to `build.py` relative to your terminal's working directory.

## Debugging Symbols for Project64
To generate symbols for the Project64 debugger, use the `--pj64sym` option:
Expand Down
29 changes: 24 additions & 5 deletions ASM/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@

parser = argparse.ArgumentParser()
parser.add_argument('--pj64sym', help="Output path for Project64 debugging symbols")
parser.add_argument('--compile-c', action='store_true', help="Recompile C modules")
parser.add_argument('--dump-obj', action='store_true', help="Dumps extra object info for debugging purposes. Does nothing without --compile-c")
parser.add_argument('--compile-c', action='store_true', help="Recompile C modules. This is the default")
parser.add_argument('--no-compile-c', action='store_true', help="Do not recompile C modules")
parser.add_argument('--dump-obj', action='store_true', help="Dumps extra object info for debugging purposes. Does nothing with --no-compile-c")
parser.add_argument('--diff-only', action='store_true', help="Creates diff output without running armips")

args = parser.parse_args()
pj64_sym_path = args.pj64sym
compile_c = args.compile_c
compile_c = not args.no_compile_c
dump_obj = args.dump_obj
diff_only = args.diff_only

Expand Down Expand Up @@ -66,7 +67,7 @@

with open('build/c_symbols.txt', 'r') as f:
for line in f:
m = re.match('''
m = re.match(r'''
^
[0-9a-fA-F]+
.*
Expand Down Expand Up @@ -101,6 +102,21 @@
'address': address,
}

# Loop through a second time, add lengths to each data symbol
# This could probably be optimized to run in a single pass :)
with open('build/asm_symbols.txt', 'r') as f:
for line in f:
parts = line.strip().split(' ')
if len(parts) < 2:
continue
address, sym_name = parts
if sym_name.startswith('.'):
# split on the ':' to get the length, in hex
type, hex_length = sym_name.split(':')
for symbol, sym_data in symbols.items():
if sym_data['address'] == address and sym_data['type'] == 'data':
sym_data['length'] = int(hex_length, 16)

# Output symbols

os.chdir(run_dir)
Expand All @@ -115,7 +131,10 @@
addr = addr - 0x80400000 + 0x03480000
else:
continue
data_symbols[name] = '{0:08X}'.format(addr)
data_symbols[name] = {
'address': f'{addr:08X}',
'length': sym.get('length', 0),
}
with open('../data/generated/symbols.json', 'w') as f:
json.dump(data_symbols, f, indent=4, sort_keys=True)

Expand Down
Loading

0 comments on commit 56d08e8

Please sign in to comment.