Skip to content

Instantly share code, notes, and snippets.

@Dragorn421
Last active October 30, 2021 11:03
Show Gist options
  • Save Dragorn421/7d8e00e44d4c40957410b1b15b338718 to your computer and use it in GitHub Desktop.
Save Dragorn421/7d8e00e44d4c40957410b1b15b338718 to your computer and use it in GitHub Desktop.
oot decomp progress
53 not decompiled in ./src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c
(file not decompiled)
Card not found or doesn't exist
asm/non_matchings/overlays/gamestates/ovl_file_choose/
func_80803D40.s, func_80803ED8.s, func_80804248.s, func_808043D8.s, func_808044A0.s, func_80804858.s, func_80804924.s, func_80804A50.s, func_80804C74.s, func_80804CD0.s, func_80804ED8.s, func_8080510C.s, func_808051C8.s, func_80805318.s, func_80805434.s, func_80805524.s, func_80805824.s, func_8080595C.s, func_80805B2C.s, func_80805EB8.s, func_80806180.s, func_8080625C.s, func_80806444.s, func_808064F4.s, func_80806710.s, func_808068F0.s, func_808069B4.s, func_80806C20.s, func_80806DB0.s, func_80806F34.s, func_8080723C.s, func_80807DCC.s, func_80808000.s, func_80808F84.s, func_80809038.s, func_8080960C.s, func_8080969C.s, func_808099C8.s, func_8080AF30.s, func_8080AF50.s, func_8080AFD0.s, func_8080B1A8.s, func_8080B22C.s, func_8080B394.s, func_8080B40C.s, func_8080B494.s, func_8080B52C.s, func_8080BE30.s, func_8080BE84.s, func_8080BEF8.s, func_8080BF6C.s, func_8080BFE4.s, func_8080C2F4.s
19 not decompiled in ./src/overlays/gamestates/ovl_file_choose/z_file_choose.c
(file not decompiled)
Reserved by fig
asm/non_matchings/overlays/gamestates/ovl_file_choose/
func_8080C330.s, func_8080C60C.s, func_8080D8CC.s, func_8080E074.s, func_8080F560.s, func_8080FE2C.s, func_8080FF98.s, func_8081009C.s, func_8081017C.s, func_80810354.s, func_80810440.s, func_80810698.s, func_808106F4.s, func_8081097C.s, func_808109B8.s, func_80810DAC.s, func_808113A8.s, func_80811A18.s, func_80811A20.s
56 not decompiled in ./src/overlays/actors/ovl_En_Zf/z_en_zf.c
Reserved by Elliptic Ellipsis
asm/non_matchings/overlays/actors/ovl_En_Zf/
func_80B44050.s, func_80B44058.s, func_80B441C4.s, EnZf_Init.s, EnZf_Destroy.s, func_80B446A8.s, func_80B44870.s, func_80B44B14.s, func_80B44CF0.s, func_80B44DC4.s, func_80B44E8C.s, func_80B450AC.s, func_80B45174.s, func_80B45384.s, func_80B4543C.s, func_80B456B4.s, func_80B45748.s, func_80B45E30.s, func_80B45EF0.s, func_80B4604C.s, func_80B46098.s, func_80B462E4.s, func_80B463E4.s, func_80B46A24.s, func_80B46AE0.s, func_80B46D64.s, func_80B46DD4.s, func_80B46E8C.s, func_80B46F2C.s, func_80B47050.s, func_80B47120.s, func_80B47360.s, func_80B4743C.s, func_80B474E4.s, func_80B47544.s, func_80B4779C.s, func_80B4781C.s, func_80B47C64.s, func_80B47CF8.s, func_80B47DA8.s, func_80B47EB4.s, func_80B48210.s, func_80B482B8.s, func_80B483E4.s, func_80B48578.s, func_80B48CEC.s, func_80B48E50.s, func_80B48F90.s, func_80B490B4.s, EnZf_Update.s, func_80B495FC.s, func_80B49688.s, EnZf_Draw.s, func_80B49B60.s, func_80B49C2C.s, func_80B49E4C.s
62 not decompiled in ./src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c
Reserved by fig
asm/non_matchings/overlays/actors/ovl_Boss_Ganon/
func_808D6870.s, func_808D69B0.s, func_808D6AAC.s, func_808D6BF0.s, func_808D6CBC.s, func_808D6D60.s, func_808D6E54.s, func_808D6F3C.s, func_808D7034.s, func_808D70F0.s, func_808D712C.s, BossGanon_Init.s, BossGanon_Destroy.s, func_808D779C.s, func_808D787C.s, func_808D7918.s, func_808D9018.s, func_808D90F8.s, func_808D91F8.s, func_808D933C.s, func_808DACE8.s, func_808DAD20.s, func_808DB278.s, func_808DB2E8.s, func_808DBAF0.s, func_808DBB78.s, func_808DBEC4.s, func_808DBF30.s, func_808DC0E8.s, func_808DC14C.s, func_808DC420.s, func_808DC4DC.s, func_808DC66C.s, func_808DC75C.s, func_808DC9B4.s, func_808DCB7C.s, func_808DD0E8.s, func_808DD14C.s, func_808DD20C.s, BossGanon_Update.s, func_808DE734.s, func_808DE988.s, func_808DED30.s, func_808DED4C.s, func_808DEE70.s, func_808DF25C.s, func_808DF4F0.s, func_808DFBD0.s, func_808DFFC8.s, func_808E0254.s, func_808E06FC.s, func_808E0A3C.s, BossGanon_Draw.s, func_808E0F4C.s, func_808E1034.s, func_808E1B54.s, func_808E1EB4.s, func_808E229C.s, func_808E2544.s, func_808E324C.s, func_808E3564.s, func_808E3D84.s
32 not decompiled in ./src/code/z_message_PAL.c
Reserved by tharo_
asm/non_matchings/code/z_message_PAL/
func_801069B0.s, func_80106AA8.s, func_80106BC8.s, func_80106C88.s, func_80106CCC.s, func_80106D40.s, func_80106F1C.s, func_80107244.s, func_80107448.s, func_80107628.s, func_801076CC.s, func_80107980.s, func_801080B4.s, func_801083F8.s, func_801086B0.s, func_80109968.s, func_80109B3C.s, func_8010B0C0.s, func_8010B680.s, func_8010B720.s, func_8010B820.s, func_8010BD58.s, func_8010BD88.s, func_8010BDBC.s, func_8010BED8.s, func_8010C358.s, func_8010C39C.s, func_8010F2CC.s, func_8010F494.s, func_8010F58C.s, func_8010F6F0.s, func_8011040C.s
4 not decompiled in ./src/code/ucode_disas.c
Card exists but not reserved
asm/non_matchings/code/ucode_disas/
UCodeDisas_Disassemble.rodata.s, UCodeDisas_Disassemble.rodata2.s, UCodeDisas_Disassemble.s, pad_800DACB0.s
Non matching:
import os
import sys
import subprocess
def wget(url):
subprocess.run(["wget", "-O", "wgettempfile", url], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
with open("wgettempfile") as f:
return f.read()
trello_board_html = None
def get_trello_board_html():
global trello_board_html
if trello_board_html is None:
trello_board_html = wget("https://trello.com/b/qUqnUkWY/ocarina-of-time-decompilation")
return trello_board_html
def trello_search(string):
trello_board_html = get_trello_board_html()
resI = trello_board_html.lower().find(string.lower())
if resI < 0:
"""
print(string)
print(trello_board_html)
print(string)
sys.exit()
"""
return None
if string.lower() in trello_board_html.lower()[resI+1:]:
raise ValueError("found several matches")
cardLinkI = trello_board_html.rfind('<a itemprop="url" href="', 0, resI)
if cardLinkI < 0:
raise ValueError("didn't find a href start")
cardLinkStartI = cardLinkI + len('<a itemprop="url" href="')
if "href" in trello_board_html[cardLinkStartI:resI]:
raise ValueError("possibly found the wrong href")
cardLinkEndI = trello_board_html.find('"', cardLinkStartI)
if cardLinkEndI < 0:
raise ValueError("didn't find a href end")
cardLink = trello_board_html[cardLinkStartI:cardLinkEndI]
card_html = wget(f"https://trello.com{cardLink}")
membersPartStartI = card_html.find('<h2 itemprop="name">Members</h2>')
if membersPartStartI < 0:
return "no one assigned probably"
raise ValueError("cant find start of members part in card html")
membersPartEndI = card_html.find('</ul>', membersPartStartI)
if membersPartEndI < 0:
raise ValueError("cant find end of members part in card html")
memberParts_html = card_html[membersPartStartI:membersPartEndI]
nameSpanInnerStartI = 0
names = []
#print(memberParts_html)
while True:
nameSpanStartI = memberParts_html.find('<span itemprop="name">', nameSpanInnerStartI)
if nameSpanStartI < 0:
break
#print(nameSpanStartI, memberParts_html[nameSpanStartI:])
nameSpanInnerStartI = nameSpanStartI + len('<span itemprop="name">')
nameSpanInnerEndI = memberParts_html.find('</span>', nameSpanInnerStartI)
if nameSpanInnerEndI < 0:
raise ValueError("couldnt find closing span tag")
name = memberParts_html[nameSpanInnerStartI:nameSpanInnerEndI]
names.append(name)
return names
"""
print(trello_search("800bb0a0C"))
sys.exit()
"""
notDecompiled = {}
nonMatching = {}
for root, dirs, files in os.walk('.'):
for name in files:
if not name.endswith(".c"):
continue
"""
if name != "z_actor.c":
continue
"""
notDecompiledFile = []
nonMatchingFile = []
filepath = os.path.join(root, name)
with open(filepath) as f:
contents = f.read()
globalAsmI = contents.find("GLOBAL_ASM")
if globalAsmI < 0:
continue
while globalAsmI >= 0:
globalAsmLineEndI = contents.find("\n", globalAsmI)
if globalAsmLineEndI < 0:
globalAsmLineEndI = len(contents)
asm = contents[(globalAsmI+len("GLOBAL_ASM")):globalAsmLineEndI].strip()[1:-1].strip()[1:-1]
#print(asm)
dirElseI = contents.rfind("#else", 0, globalAsmI)
dirEndifI = contents.find("#endif", globalAsmI)
decompiled = True
if dirElseI < 0 or dirEndifI < 0:
decompiled = False
#print(decompiled, contents[dirElseI:globalAsmI])
if "GLOBAL_ASM" in contents[dirElseI:globalAsmI]:
decompiled = False
#print(decompiled, contents[globalAsmLineEndI:dirEndifI])
if "GLOBAL_ASM" in contents[globalAsmLineEndI:dirEndifI]:
decompiled = False
if decompiled:
nonMatchingFile.append(asm)
else:
notDecompiledFile.append(asm)
globalAsmI = contents.find("GLOBAL_ASM", globalAsmI + 1)
if notDecompiledFile:
notDecompiled[filepath] = notDecompiledFile
if nonMatchingFile:
nonMatching[filepath] = nonMatchingFile
for file, asms in notDecompiled.items():
if file in nonMatching:
nonMatchingAsms = nonMatching[file]
del nonMatching[file]
else:
nonMatchingAsms = None
print(f"\n{len(asms)} not decompiled " + (f"and {len(nonMatchingAsms)} non matchings " if nonMatchingAsms else "") + f"in {file}")
with open(file) as f:
lines = f.readlines()
if all((line.strip() == "" or "GLOBAL_ASM" in line) for line in lines):
print("(file not decompiled)")
search = os.path.basename(file)
if search.startswith("z_"):
search = search[2:]
if search.endswith(".c"):
search = search[:-2]
# hardcoded stuff
if search.lower() == "boss_ganon":
search += "\n"
if file.endswith("z_kankyo.c"):
search = "z_kankyo.c"
if file.endswith("z_vr_box.c"):
search = "z_vr_box.c"
# end
names = trello_search(search)
if names == "no one assigned probably":
print("Card exists but not reserved")
elif names is None:
print("Card not found or doesn't exist")
else:
print("Reserved by", ", ".join(names))
if nonMatchingAsms:
print("Not decompiled:")
commonPath = ""
tryCommonPath = ""
while all(asm.startswith(tryCommonPath) for asm in asms):
commonPath = tryCommonPath
tryCommonPath = asms[0][:(len(commonPath)+1)]
if commonPath == tryCommonPath:
break
while commonPath and not commonPath.endswith(os.path.sep):
commonPath = commonPath[:-1]
print(commonPath)
print("\t", ", ".join(asm[len(commonPath):] for asm in asms))
if nonMatchingAsms:
asms = nonMatchingAsms
print("Non matching:")
commonPath = ""
tryCommonPath = ""
while all(asm.startswith(tryCommonPath) for asm in asms):
commonPath = tryCommonPath
tryCommonPath = asms[0][:(len(commonPath)+1)]
if commonPath == tryCommonPath:
break
while commonPath and not commonPath.endswith(os.path.sep):
commonPath = commonPath[:-1]
print(commonPath)
print("\t", ", ".join(asm[len(commonPath):] for asm in asms))
print("\n\n")
print("Non matching:")
for file, asms in nonMatching.items():
commonPath = ""
tryCommonPath = ""
while all(asm.startswith(tryCommonPath) for asm in asms):
commonPath = tryCommonPath
tryCommonPath = asms[0][:(len(commonPath)+1)]
if commonPath == tryCommonPath:
break
while commonPath and not commonPath.endswith(os.path.sep):
commonPath = commonPath[:-1]
print(f"\n{len(asms)} in {file}")
print(commonPath)
print("\t", ", ".join(asm[len(commonPath):] for asm in asms))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment