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
Show file tree
Hide file tree
Changes from 2 commits
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
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +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_SEGMENTS_DIR := $(EXTRACTED_DIR)/segments
BASEROM_BIN_FILES := $(wildcard $(BASEROM_SEGMENTS_DIR)/*)

# source files
Expand Down Expand Up @@ -351,7 +351,6 @@ assetclean:
$(RM) -r .extracted-assets.json

distclean: assetclean
$(RM) -r baseroms/*/segments
$(RM) -r extracted/
$(RM) -r build/
$(MAKE) -C tools distclean
Expand Down
2 changes: 1 addition & 1 deletion extract_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/segments -o {outputPath} -osf {outputSourcePath} -gsf 1 -rconf {configPath} --cs-float both {ZAPDArgs}"

if "overlays" in xmlPath:
execStr += " --static"
Expand Down
2 changes: 1 addition & 1 deletion tools/csdis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/segments/" + 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:
Expand Down
2 changes: 1 addition & 1 deletion tools/csdis_re.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("baseroms/gc-eu-mq-dbg/segments/")
BASEROM_SEGMENTS_P = Path("extracted/gc-eu-mq-dbg/segments/")

HARDCODED_SYM_ROM = {
"D_8096C1A4": 0xD25834,
Expand Down
10 changes: 5 additions & 5 deletions tools/msgdis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}/segments/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))

Expand All @@ -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}/segments/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}/segments/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))

Expand All @@ -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}/segments/staff_message_data_static")
# text id, ypos, type, staff
messages = []
for i,entry in enumerate(staff_message_entry_table,0):
Expand All @@ -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}/segments/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:
Expand Down
2 changes: 1 addition & 1 deletion tools/overlayhelpers/colliderinit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/segments/" + fileResult.name, "rb")
ovlData = bytearray(ovlFile.read())
ovlFile.close()

Expand Down
2 changes: 1 addition & 1 deletion tools/overlayhelpers/damage_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/segments" + 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]
Expand Down
2 changes: 1 addition & 1 deletion tools/overlayhelpers/lmapmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def IND(n):


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/segments/ovl_kaleido_scope", "rb") as file:
kaleido_scope_data = bytearray(file.read())

scenemaps = []
Expand Down
2 changes: 1 addition & 1 deletion tools/overlayhelpers/mapmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def IND(n):


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/segments/ovl_map_mark_data", "rb") as file:
map_mark_data = bytearray(file.read())

scenemaps = []
Expand Down