1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 21:40:03 +00:00

Move baserom segments to extracted/ (#1916)

* Move baserom segments to extracted/

* Add old baserom segments dir back to .gitignore

* Rename segments/ -> baserom/
This commit is contained in:
cadmic 2024-03-04 16:06:26 -08:00 committed by GitHub
parent 9a5b4f3845
commit bf37ad1368
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 15 additions and 17 deletions

View file

@ -208,8 +208,7 @@ ASSET_FILES_OUT := $(foreach f,$(ASSET_FILES_XML:.xml=.c),$f) \
UNDECOMPILED_DATA_DIRS := $(shell find data -type d)
BASEROM_SEGMENTS_DIR := $(BASEROM_DIR)/segments
BASEROM_BIN_FILES := $(wildcard $(BASEROM_SEGMENTS_DIR)/*)
BASEROM_BIN_FILES := $(wildcard $(EXTRACTED_DIR)/baserom/*)
# source files
C_FILES := $(filter-out %.inc.c,$(foreach dir,$(SRC_DIRS) $(ASSET_BIN_DIRS),$(wildcard $(dir)/*.c)))
@ -351,7 +350,6 @@ assetclean:
$(RM) -r .extracted-assets.json
distclean: assetclean
$(RM) -r baseroms/*/segments
$(RM) -r extracted/
$(RM) -r build/
$(MAKE) -C tools distclean
@ -366,7 +364,7 @@ venv:
setup: venv
$(MAKE) -C tools
$(PYTHON) tools/decompress_baserom.py $(VERSION)
$(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 -o $(BASEROM_SEGMENTS_DIR) --dmadata-start `cat $(BASEROM_DIR)/dmadata_start.txt` --dmadata-names $(BASEROM_DIR)/dmadata_names.txt
$(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 -o $(EXTRACTED_DIR)/baserom --dmadata-start `cat $(BASEROM_DIR)/dmadata_start.txt` --dmadata-names $(BASEROM_DIR)/dmadata_names.txt
$(PYTHON) tools/msgdis.py --oot-version $(VERSION) --text-out $(EXTRACTED_DIR)/text/message_data.h --staff-text-out $(EXTRACTED_DIR)/text/message_data_staff.h
# TODO: for now, we only extract assets from the Debug ROM
ifeq ($(VERSION),gc-eu-mq-dbg)
@ -420,7 +418,7 @@ $(LDSCRIPT): $(BUILD_DIR)/$(SPEC)
$(BUILD_DIR)/undefined_syms.txt: undefined_syms.txt
$(CPP) $(CPPFLAGS) $< > $@
$(BUILD_DIR)/baserom/%.o: $(BASEROM_SEGMENTS_DIR)/%
$(BUILD_DIR)/baserom/%.o: $(EXTRACTED_DIR)/baserom/%
$(OBJCOPY) -I binary -O elf32-big $< $@
$(BUILD_DIR)/data/%.o: data/%.s

View file

@ -28,7 +28,7 @@ def ExtractFile(xmlPath, outputPath, outputSourcePath):
Path(outputPath).mkdir(parents=True, exist_ok=True)
Path(outputSourcePath).mkdir(parents=True, exist_ok=True)
execStr = f"{zapdPath} e -eh -i {xmlPath} -b baseroms/gc-eu-mq-dbg/segments -o {outputPath} -osf {outputSourcePath} -gsf 1 -rconf {configPath} --cs-float both {ZAPDArgs}"
execStr = f"{zapdPath} e -eh -i {xmlPath} -b extracted/gc-eu-mq-dbg/baserom -o {outputPath} -osf {outputSourcePath} -gsf 1 -rconf {configPath} --cs-float both {ZAPDArgs}"
if "overlays" in xmlPath:
execStr += " --static"

View file

@ -781,7 +781,7 @@ def main():
script_dir = os.path.dirname(os.path.realpath(__file__))
cs_data = None
with open(script_dir + "/../baseroms/gc-eu-mq-dbg/segments/" + file_result.name, "rb") as ovl_file:
with open(script_dir + "/../extracted/gc-eu-mq-dbg/baserom/" + file_result.name, "rb") as ovl_file:
ovl_file.seek(file_result.offset)
cs_data = [i[0] for i in struct.iter_unpack(">I", bytearray(ovl_file.read()))]
if cs_data is not None:

View file

@ -20,7 +20,7 @@ from overlayhelpers import filemap
SRC_ENCODING = "UTF-8"
MAPFILE_P = Path("build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.map")
BASEROM_SEGMENTS_P = Path("baseroms/gc-eu-mq-dbg/segments/")
BASEROM_SEGMENTS_P = Path("extracted/gc-eu-mq-dbg/baserom/")
HARDCODED_SYM_ROM = {
"D_8096C1A4": 0xD25834,

View file

@ -329,7 +329,7 @@ def dump_all_text():
nes_offset = segmented_to_physical(entry[3])
nes_length = next_entry[3] - entry[3]
nes_text = ""
with open(f"baseroms/{version}/segments/nes_message_data_static","rb") as infile:
with open(f"extracted/{version}/baserom/nes_message_data_static","rb") as infile:
infile.seek(nes_offset)
nes_text = fixup_message(decode(infile.read(nes_length), entry[1]).replace("\x00","",-1))
@ -340,13 +340,13 @@ def dump_all_text():
next_entry = combined_message_entry_table[i+2]
ger_offset = segmented_to_physical(entry[4])
ger_length = next_entry[4] - entry[4]
with open(f"baseroms/{version}/segments/ger_message_data_static","rb") as infile:
with open(f"extracted/{version}/baserom/ger_message_data_static","rb") as infile:
infile.seek(ger_offset)
ger_text = fixup_message(decode(infile.read(ger_length), entry[1]).replace("\x00","",-1))
fra_offset = segmented_to_physical(entry[5])
fra_length = next_entry[5] - entry[5]
with open(f"baseroms/{version}/segments/fra_message_data_static","rb") as infile:
with open(f"extracted/{version}/baserom/fra_message_data_static","rb") as infile:
infile.seek(fra_offset)
fra_text = fixup_message(decode(infile.read(fra_length), entry[1]).replace("\x00","",-1))
@ -355,7 +355,7 @@ def dump_all_text():
return messages
def dump_staff_text():
staff_message_data_static_size = path.getsize(f"baseroms/{version}/segments/staff_message_data_static")
staff_message_data_static_size = path.getsize(f"extracted/{version}/baserom/staff_message_data_static")
# text id, ypos, type, staff
messages = []
for i,entry in enumerate(staff_message_entry_table,0):
@ -364,7 +364,7 @@ def dump_staff_text():
staff_offset = segmented_to_physical(entry[3])
# hacky way to ensure the staff message entry table is read all the way to the end
staff_length = (staff_message_data_static_size if entry[0] == 0x052F else segmented_to_physical(next_entry[3])) - segmented_to_physical(entry[3])
with open(f"baseroms/{version}/segments/staff_message_data_static","rb") as infile:
with open(f"extracted/{version}/baserom/staff_message_data_static","rb") as infile:
infile.seek(staff_offset)
messages.append((entry[0], entry[1], entry[2], fixup_message(decode(infile.read(staff_length), entry[1]).replace("\x00","",-1))))
else:

View file

@ -387,7 +387,7 @@ def GetColliderInit(address, type, num, path):
else:
return("ItemInit type must specify number of elements")
ovlFile = open(path + "/baseroms/gc-eu-mq-dbg/segments/" + fileResult.name, "rb")
ovlFile = open(path + "/extracted/gc-eu-mq-dbg/baserom/" + fileResult.name, "rb")
ovlData = bytearray(ovlFile.read())
ovlFile.close()

View file

@ -132,7 +132,7 @@ def get_damage_bytes(address, repo):
print(file_result)
with open(repo + os.sep + "baseroms/gc-eu-mq-dbg/segments" + os.sep + file_result.name, "rb") as ovl_file:
with open(repo + os.sep + "extracted/gc-eu-mq-dbg/baserom" + os.sep + file_result.name, "rb") as ovl_file:
ovl_data = bytearray(ovl_file.read())
damage_data = ovl_data[file_result.offset:file_result.offset+0x20]

View file

@ -72,7 +72,7 @@ repo = scriptDir + os.sep + ".." + os.sep + ".."
kaleido_scope_data = []
with open(repo + "/baseroms/gc-eu-mq-dbg/segments/ovl_kaleido_scope", "rb") as file:
with open(repo + "/extracted/gc-eu-mq-dbg/baserom/ovl_kaleido_scope", "rb") as file:
kaleido_scope_data = bytearray(file.read())
scenemaps = []

View file

@ -97,7 +97,7 @@ repo = scriptDir + os.sep + ".." + os.sep + ".."
map_mark_data = []
with open(repo + "/baseroms/gc-eu-mq-dbg/segments/ovl_map_mark_data", "rb") as file:
with open(repo + "/extracted/gc-eu-mq-dbg/baserom/ovl_map_mark_data", "rb") as file:
map_mark_data = bytearray(file.read())
scenemaps = []