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

VC crash screen + load progress #2153

Merged
merged 6 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
43 changes: 42 additions & 1 deletion Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,49 @@ def generate_wad(wad_file: str, rom_file: str, output_file: str, channel_title:
if not os.path.isfile(wad_file):
raise Exception("Cannot open base WAD file.")

try:
with open(wad_file, 'rb') as wad_stream:
wad_buffer = bytearray(wad_stream.read(0xFC0))
except FileNotFoundError as ex:
raise FileNotFoundError(f'Invalid path to Base WAD: "{input_file}"')

wad_app1_sha1_usa = [
[0x76, 0x3D, 0x4D, 0x3D, 0x07, 0x13, 0xE4, 0xD1, 0x0E, 0x44, 0x54, 0x0C, 0xCF, 0xA3, 0x25, 0x5E, 0x19, 0xF2, 0x8A, 0xF7], # US Wad App1
]

wad_app1_sha1_jpn = [
[0x47, 0x54, 0x6E, 0x48, 0x46, 0x7A, 0xE1, 0x4D, 0x71, 0x2B, 0x8C, 0x20, 0x7E, 0x91, 0x18, 0x21, 0x58, 0x6D, 0x10, 0x43], # JP Wad App1
]

wad_app5_sha1_usa = [
[0x7C, 0x94, 0x77, 0x69, 0x68, 0xA7, 0xE1, 0xF5, 0xFD, 0x5D, 0xC5, 0xE2, 0xB6, 0xF8, 0x32, 0xEE, 0xF4, 0x55, 0x35, 0xA0], # US Wad App5
]

wad_app5_sha1_jpn = [
[0xD1, 0x4D, 0xEF, 0x1E, 0xCE, 0xB0, 0x6D, 0xE2, 0x05, 0xA3, 0x53, 0xC4, 0xB5, 0x66, 0xFD, 0x55, 0x9C, 0x25, 0x4F, 0x1F], # JP Wad App5
]

wad_patch_name = ""
wad_app1_sha1 = list(wad_buffer[0xF18:0xF2C])
wad_app5_sha1 = list(wad_buffer[0xFA8:0xFBC])

is_usa_app1 = wad_app1_sha1 in wad_app1_sha1_usa
is_usa_app5 = wad_app5_sha1 in wad_app5_sha1_usa
is_jpn_app1 = wad_app1_sha1 in wad_app1_sha1_jpn
is_jpn_app5 = wad_app5_sha1 in wad_app5_sha1_jpn

is_usa_wad = is_usa_app1 and is_usa_app5
is_jpn_wad = is_jpn_app1 and is_jpn_app5

if is_usa_wad:
wad_patch_name = "ootr_usa.gzi"
elif is_jpn_wad:
wad_patch_name = "ootr_jpn.gzi"
else:
raise RuntimeError('Base WAD file is not a valid OoT USA or JPN wad.')

gzinject_path = "./" if is_bundled() else "bin/gzinject/"
gzinject_patch_path = gzinject_path + "ootr.gzi"
gzinject_patch_path = gzinject_path + wad_patch_name
if platform.system() == 'Windows':
if platform.machine() == 'AMD64':
gzinject_path += "gzinject.exe"
Expand Down
Loading
Loading