mirror of
https://github.com/NohamR/pyzule-rw.git
synced 2026-10-11 02:49:40 +00:00
perf: optimize checks
This commit is contained in:
@@ -102,11 +102,11 @@ class Executable:
|
|||||||
# CydiaSubstrate.framework, libsubstrate.dylib, CydiaSubstrate.dylib
|
# CydiaSubstrate.framework, libsubstrate.dylib, CydiaSubstrate.dylib
|
||||||
# and probably even more. it's crazy.
|
# and probably even more. it's crazy.
|
||||||
|
|
||||||
"ubstrate.": "CydiaSubstrate",
|
"substrate.": "CydiaSubstrate.framework",
|
||||||
"Orion.framework": "Orion",
|
"Orion.framework": "Orion.framework",
|
||||||
"Cephei.framework": "Cephei",
|
"Cephei.framework": "Cephei.framework",
|
||||||
"CepheiUI.framework": "CepheiUI",
|
"CepheiUI.framework": "CepheiUI.framework",
|
||||||
"CepheiPrefs.framework": "CepheiPrefs"
|
"CepheiPrefs.framework": "CepheiPrefs.framework"
|
||||||
}
|
}
|
||||||
|
|
||||||
# another loop for fixing dylib dependencies
|
# another loop for fixing dylib dependencies
|
||||||
@@ -119,39 +119,34 @@ class Executable:
|
|||||||
|
|
||||||
# fix dependencies
|
# fix dependencies
|
||||||
for dep in dylib.get_dependencies():
|
for dep in dylib.get_dependencies():
|
||||||
for cname in (common | tweaks):
|
for cname in (tweaks | common):
|
||||||
if cname in dep:
|
if cname in dep:
|
||||||
|
# i wonder if there's a better way to do this?
|
||||||
if cname.endswith(".framework"):
|
if cname.endswith(".framework"):
|
||||||
npath = f"@rpath/{cname}/{cname[:-10]}"
|
npath = f"@rpath/{cname}/{cname[:-10]}"
|
||||||
else:
|
else:
|
||||||
npath = f"@rpath/{cname}"
|
npath = f"@rpath/{cname}"
|
||||||
|
|
||||||
dylib.change_dependency(dep, npath)
|
|
||||||
if cname in common:
|
if cname in common:
|
||||||
needed.add(cname)
|
needed.add(cname)
|
||||||
|
|
||||||
# avoid printing that we "fixed" something to itself lol
|
|
||||||
if dep != npath:
|
if dep != npath:
|
||||||
|
dylib.change_dependency(dep, npath)
|
||||||
print(f"[*] fixed dependency in {dbn}: {dep} -> {npath}")
|
print(f"[*] fixed dependency in {dbn}: {dep} -> {npath}")
|
||||||
|
|
||||||
## "sub"-loop, just adding the needed common deps
|
# orion has a *weak* dependency to substrate,
|
||||||
if "ubstrate." in needed:
|
# but will still crash without it. nice !!!!!!!!!!!
|
||||||
del common["ubstrate."] # lol rip
|
|
||||||
common["CydiaSubstrate.framework"] = "CydiaSubstrate"
|
|
||||||
|
|
||||||
needed.remove("ubstrate.")
|
|
||||||
needed.add("CydiaSubstrate.framework")
|
|
||||||
|
|
||||||
if "Orion.framework" in needed:
|
if "Orion.framework" in needed:
|
||||||
needed.add("CydiaSubstrate.framework")
|
needed.add("substrate.")
|
||||||
|
|
||||||
for missing in needed:
|
for missing in needed:
|
||||||
ip = f"{FRAMEWORKS_DIR}/{missing}"
|
real = common[missing] # "real" name, thanks substrate!
|
||||||
existed = tbhutils.delete_if_exists(ip, missing)
|
ip = f"{FRAMEWORKS_DIR}/{real}"
|
||||||
shutil.copytree(f"{self.install_dir}/extras/{missing}", ip)
|
existed = tbhutils.delete_if_exists(ip, real)
|
||||||
|
shutil.copytree(f"{self.install_dir}/extras/{real}", ip)
|
||||||
|
|
||||||
if not existed:
|
if not existed:
|
||||||
print(f"[*] auto-injected {missing}")
|
print(f"[*] auto-injected {real}")
|
||||||
|
|
||||||
# and FINALLY, one for actually injecting
|
# and FINALLY, one for actually injecting
|
||||||
for bn, path in tweaks.items():
|
for bn, path in tweaks.items():
|
||||||
|
|||||||
Reference in New Issue
Block a user