mirror of
https://github.com/HackerN64/HackerOoT.git
synced 2026-01-21 10:37:37 -08:00
initial F3DEX3 setup
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -33,7 +33,9 @@ build/*/cache/
|
||||
*.wad
|
||||
out.txt
|
||||
*.ram
|
||||
common-key.bin
|
||||
*.bin
|
||||
F3DEX3/*.code
|
||||
F3DEX3/*.data
|
||||
|
||||
# Tool artifacts
|
||||
tools/mipspro7.2_compiler/
|
||||
|
||||
BIN
F3DEX3/F3DEX3.code.bps
Normal file
BIN
F3DEX3/F3DEX3.code.bps
Normal file
Binary file not shown.
BIN
F3DEX3/F3DEX3.data.bps
Normal file
BIN
F3DEX3/F3DEX3.data.bps
Normal file
Binary file not shown.
16
Makefile
16
Makefile
@@ -92,7 +92,7 @@ endif
|
||||
$(shell touch src/boot/build.c)
|
||||
|
||||
ifeq ($(VERSION),hackeroot-mq)
|
||||
SEGMENT_VERSION := hackeroot-mq
|
||||
BASEROM_VERSION := hackeroot-mq
|
||||
CFLAGS += -DENABLE_HACKEROOT=1
|
||||
CPPFLAGS += -DENABLE_HACKEROOT=1
|
||||
OPTFLAGS := -Os
|
||||
@@ -115,7 +115,7 @@ else
|
||||
OPTFLAGS := -O2 -g3
|
||||
endif
|
||||
|
||||
SEGMENT_VERSION := gc-eu-mq-dbg
|
||||
BASEROM_VERSION := gc-eu-mq-dbg
|
||||
CFLAGS += -DENABLE_HACKEROOT=0
|
||||
CPPFLAGS += -DENABLE_HACKEROOT=0
|
||||
endif
|
||||
@@ -227,7 +227,7 @@ ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_XML:.xml=.c),$f) \
|
||||
UNDECOMPILED_DATA_DIRS := $(shell find data -type d)
|
||||
|
||||
# TODO: for now, ROM segments are still taken from the Debug ROM even when building other versions
|
||||
BASEROM_SEGMENTS_DIR := baseroms/$(SEGMENT_VERSION)/segments
|
||||
BASEROM_SEGMENTS_DIR := baseroms/$(BASEROM_VERSION)/segments
|
||||
BASEROM_BIN_FILES := $(wildcard $(BASEROM_SEGMENTS_DIR)/*)
|
||||
|
||||
# source files
|
||||
@@ -313,6 +313,7 @@ ifeq ($(VERSION),hackeroot-mq)
|
||||
cp baseroms/hackeroot-mq/baserom-decompressed.z64 baseroms/gc-eu-mq-dbg/
|
||||
endif
|
||||
endif
|
||||
$(MAKE) f3dex3
|
||||
|
||||
run: $(ROM)
|
||||
ifeq ($(N64_EMULATOR),)
|
||||
@@ -323,7 +324,14 @@ endif
|
||||
patch:
|
||||
$(FLIPS) --create --bps $(BASEROM_PATCH) $(ROM) $(BPS)
|
||||
|
||||
.PHONY: all rom compress clean assetclean distclean venv setup run wad patch
|
||||
f3dex3:
|
||||
$(PYTHON) tools/data_extractor.py --start 0xBCD0F0 --size 0x1630 --input baseroms/$(BASEROM_VERSION)/baserom-decompressed.z64 --output F3DEX3/f3dzex2.code
|
||||
$(PYTHON) tools/data_extractor.py --start 0xBCE720 --size 0x420 --input baseroms/$(BASEROM_VERSION)/baserom-decompressed.z64 --output F3DEX3/f3dzex2.data
|
||||
$(FLIPS) --apply F3DEX3/F3DEX3.code.bps F3DEX3/f3dzex2.code F3DEX3/F3DEX3.code
|
||||
$(FLIPS) --apply F3DEX3/F3DEX3.data.bps F3DEX3/f3dzex2.data F3DEX3/F3DEX3.data
|
||||
rm -r F3DEX3/f3dzex2.code F3DEX3/f3dzex2.data
|
||||
|
||||
.PHONY: all rom compress clean assetclean distclean venv setup run wad patch f3dex3
|
||||
.DEFAULT_GOAL := rom
|
||||
|
||||
#### Various Recipes ####
|
||||
|
||||
61
tools/data_extractor.py
Normal file
61
tools/data_extractor.py
Normal file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import argparse
|
||||
|
||||
|
||||
def extract(start: int, size: int, input: str, output: str):
|
||||
"""Extracts ``size`` bytes from ``input``, at offset ``start``, and writes it to ``output``
|
||||
|
||||
Parameters:
|
||||
- ``start``: int, defines where to start reading the file
|
||||
- ``size``: int, how many bytes to read from the file
|
||||
- ``input``: str, path to the file to read
|
||||
- ``output``: str, path to the file to write
|
||||
"""
|
||||
|
||||
with open(input, "rb") as file:
|
||||
file.seek(start)
|
||||
data = file.read(size)
|
||||
|
||||
with open(output, "wb") as file:
|
||||
file.write(data)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Extracts data from a file for HackerOoT.")
|
||||
|
||||
parser.add_argument(
|
||||
"--start",
|
||||
dest="start",
|
||||
help="Offset to the data (uses hex)",
|
||||
required=True,
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--size",
|
||||
dest="size",
|
||||
help="How much to read (uses hex)",
|
||||
required=True,
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--input",
|
||||
dest="input",
|
||||
help="Input file",
|
||||
required=True,
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--output",
|
||||
dest="output",
|
||||
help="Output file",
|
||||
required=True,
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
extract(int(args.start, 16), int(args.size, 16), args.input, args.output)
|
||||
print("Data extracted successfully!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user