Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move baserom segments to extracted/ #1916

Merged
merged 3 commits into from
Mar 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rename segments/ -> baserom/
cadmic committed Mar 4, 2024
commit a80e39f073fa581e9ce3fc595d6cd717c14f99a8
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 := $(EXTRACTED_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)))
@@ -365,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)
@@ -419,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
2 changes: 1 addition & 1 deletion extract_assets.py
Original file line number Diff line number Diff line change
@@ -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 extracted/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"
2 changes: 1 addition & 1 deletion tools/csdis.py
Original file line number Diff line number Diff line change
@@ -781,7 +781,7 @@ def main():

script_dir = os.path.dirname(os.path.realpath(__file__))
cs_data = None
with open(script_dir + "/../extracted/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:
2 changes: 1 addition & 1 deletion tools/csdis_re.py
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
SRC_ENCODING = "UTF-8"

MAPFILE_P = Path("build/gc-eu-mq-dbg/oot-gc-eu-mq-dbg.map")
BASEROM_SEGMENTS_P = Path("extracted/gc-eu-mq-dbg/segments/")
BASEROM_SEGMENTS_P = Path("extracted/gc-eu-mq-dbg/baserom/")

HARDCODED_SYM_ROM = {
"D_8096C1A4": 0xD25834,
10 changes: 5 additions & 5 deletions tools/msgdis.py
Original file line number Diff line number Diff line change
@@ -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"extracted/{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"extracted/{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"extracted/{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"extracted/{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"extracted/{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:
2 changes: 1 addition & 1 deletion tools/overlayhelpers/colliderinit.py
Original file line number Diff line number Diff line change
@@ -387,7 +387,7 @@ def GetColliderInit(address, type, num, path):
else:
return("ItemInit type must specify number of elements")

ovlFile = open(path + "/extracted/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()

2 changes: 1 addition & 1 deletion tools/overlayhelpers/damage_table.py
Original file line number Diff line number Diff line change
@@ -132,7 +132,7 @@ def get_damage_bytes(address, repo):

print(file_result)

with open(repo + os.sep + "extracted/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]
2 changes: 1 addition & 1 deletion tools/overlayhelpers/lmapmark.py
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ def IND(n):


kaleido_scope_data = []
with open(repo + "/extracted/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 = []
2 changes: 1 addition & 1 deletion tools/overlayhelpers/mapmark.py
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ def IND(n):


map_mark_data = []
with open(repo + "/extracted/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 = []