mirror of
https://github.com/encounter/dtk-template.git
synced 2025-12-18 17:35:24 +00:00
Assembly modding support & objdiff + decomp.me integration (#15)
* Add initial asm build support * WIP decomp.me and links
This commit is contained in:
31
tools/download_tool.py
Executable file → Normal file
31
tools/download_tool.py
Executable file → Normal file
@@ -22,6 +22,24 @@ from typing import Callable, Dict
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def binutils_url(tag):
|
||||
uname = platform.uname()
|
||||
system = uname.system.lower()
|
||||
arch = uname.machine.lower()
|
||||
if system == "darwin":
|
||||
system = "macos"
|
||||
arch = "universal"
|
||||
elif arch == "amd64":
|
||||
arch = "x86_64"
|
||||
|
||||
repo = "https://github.com/encounter/gc-wii-binutils"
|
||||
return f"{repo}/releases/download/{tag}/{system}-{arch}.zip"
|
||||
|
||||
|
||||
def compilers_url(tag: str) -> str:
|
||||
return f"https://files.decomp.dev/compilers_{tag}.zip"
|
||||
|
||||
|
||||
def dtk_url(tag: str) -> str:
|
||||
uname = platform.uname()
|
||||
suffix = ""
|
||||
@@ -48,15 +66,12 @@ def wibo_url(tag: str) -> str:
|
||||
return f"{repo}/releases/download/{tag}/wibo"
|
||||
|
||||
|
||||
def compilers_url(tag: str) -> str:
|
||||
return f"https://files.decomp.dev/compilers_{tag}.zip"
|
||||
|
||||
|
||||
TOOLS: Dict[str, Callable[[str], str]] = {
|
||||
"binutils": binutils_url,
|
||||
"compilers": compilers_url,
|
||||
"dtk": dtk_url,
|
||||
"sjiswrap": sjiswrap_url,
|
||||
"wibo": wibo_url,
|
||||
"compilers": compilers_url,
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +92,11 @@ def main() -> None:
|
||||
data = io.BytesIO(response.read())
|
||||
with zipfile.ZipFile(data) as f:
|
||||
f.extractall(output)
|
||||
output.touch(mode=0o755)
|
||||
# Make all files executable
|
||||
for root, _, files in os.walk(output):
|
||||
for name in files:
|
||||
os.chmod(os.path.join(root, name), 0o755)
|
||||
output.touch(mode=0o755) # Update dir modtime
|
||||
else:
|
||||
with open(output, "wb") as f:
|
||||
shutil.copyfileobj(response, f)
|
||||
|
||||
Reference in New Issue
Block a user