mirror of
https://github.com/zeldaret/ss.git
synced 2024-11-26 23:10:26 +00:00
ACTUALLY sync with dtk-template
This commit is contained in:
parent
46ac9cba11
commit
66bb58e7fc
77
configure.py
77
configure.py
@ -12,10 +12,10 @@
|
||||
# Append --help to see available options.
|
||||
###
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from tools.project import (
|
||||
Object,
|
||||
ProjectConfig,
|
||||
@ -31,109 +31,130 @@ VERSIONS = [
|
||||
"SOUP01", # 1
|
||||
]
|
||||
|
||||
if len(VERSIONS) > 1:
|
||||
versions_str = ", ".join(VERSIONS[:-1]) + f" or {VERSIONS[-1]}"
|
||||
else:
|
||||
versions_str = VERSIONS[0]
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"mode",
|
||||
choices=["configure", "progress"],
|
||||
default="configure",
|
||||
help="configure or progress (default: configure)",
|
||||
help="script mode (default: configure)",
|
||||
nargs="?",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-v",
|
||||
"--version",
|
||||
dest="version",
|
||||
choices=VERSIONS,
|
||||
type=str.upper,
|
||||
default=VERSIONS[DEFAULT_VERSION],
|
||||
help=f"version to build ({versions_str})",
|
||||
help="version to build",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--build-dir",
|
||||
dest="build_dir",
|
||||
metavar="DIR",
|
||||
type=Path,
|
||||
default=Path("build"),
|
||||
help="base build directory (default: build)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--binutils",
|
||||
metavar="BINARY",
|
||||
type=Path,
|
||||
help="path to binutils (optional)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--compilers",
|
||||
dest="compilers",
|
||||
metavar="DIR",
|
||||
type=Path,
|
||||
help="path to compilers (optional)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--map",
|
||||
dest="map",
|
||||
action="store_true",
|
||||
help="generate map file(s)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--no-asm",
|
||||
action="store_true",
|
||||
help="don't incorporate .s files from asm directory",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--debug",
|
||||
dest="debug",
|
||||
action="store_true",
|
||||
help="build with debug info (non-matching)",
|
||||
)
|
||||
if not is_windows():
|
||||
parser.add_argument(
|
||||
"--wrapper",
|
||||
dest="wrapper",
|
||||
metavar="BINARY",
|
||||
type=Path,
|
||||
help="path to wibo or wine (optional)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--build-dtk",
|
||||
dest="build_dtk",
|
||||
"--dtk",
|
||||
metavar="BINARY | DIR",
|
||||
type=Path,
|
||||
help="path to decomp-toolkit source (optional)",
|
||||
help="path to decomp-toolkit binary or source (optional)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--sjiswrap",
|
||||
dest="sjiswrap",
|
||||
metavar="EXE",
|
||||
type=Path,
|
||||
help="path to sjiswrap.exe (optional)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--verbose",
|
||||
dest="verbose",
|
||||
action="store_true",
|
||||
help="print verbose output",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--non-matching",
|
||||
dest="non_matching",
|
||||
action="store_true",
|
||||
help="builds equivalent (but non-matching) or modded objects",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
config = ProjectConfig()
|
||||
config.version = args.version.upper()
|
||||
if config.version not in VERSIONS:
|
||||
sys.exit(f"Invalid version '{config.version}', expected {versions_str}")
|
||||
config.version = str(args.version)
|
||||
version_num = VERSIONS.index(config.version)
|
||||
config.build_rels = True
|
||||
|
||||
# Apply arguments
|
||||
config.build_dir = args.build_dir
|
||||
config.build_dtk_path = args.build_dtk
|
||||
config.dtk_path = args.dtk
|
||||
config.binutils_path = args.binutils
|
||||
config.compilers_path = args.compilers
|
||||
config.debug = args.debug
|
||||
config.generate_map = args.map
|
||||
config.non_matching = args.non_matching
|
||||
config.sjiswrap_path = args.sjiswrap
|
||||
if not is_windows():
|
||||
config.wrapper = args.wrapper
|
||||
if args.no_asm:
|
||||
config.asm_dir = None
|
||||
|
||||
# Tool versions
|
||||
config.binutils_tag = "2.42-1"
|
||||
config.compilers_tag = "20231018"
|
||||
config.dtk_tag = "v0.9.0"
|
||||
config.sjiswrap_tag = "v1.1.1"
|
||||
config.wibo_tag = "0.6.11"
|
||||
config.wibo_tag = "0.6.14"
|
||||
|
||||
# Project
|
||||
config.config_path = Path("config") / config.version / "config.yml"
|
||||
config.check_sha_path = Path("config") / config.version / "build.sha1"
|
||||
config.linker_version = "Wii/1.6"
|
||||
config.asflags = [
|
||||
"-mgekko",
|
||||
"--strip-local-absolute",
|
||||
"-I include",
|
||||
f"-I build/{config.version}/include",
|
||||
f"--defsym version={version_num}",
|
||||
]
|
||||
config.ldflags = [
|
||||
"-fp hardware",
|
||||
"-nodefaults",
|
||||
"-listclosure", # Uncomment for Wii linkers
|
||||
"-listclosure", # Uncomment for Wii linkers
|
||||
]
|
||||
# Use for any additional files that should cause a re-configure when modified
|
||||
config.reconfig_deps = []
|
||||
|
||||
# Base flags, common to most GC/Wii games.
|
||||
# Generally leave untouched, with overrides added below.
|
||||
|
0
tools/__init__.py
Normal file
0
tools/__init__.py
Normal file
@ -1030,20 +1030,20 @@ def generate_objdiff_config(
|
||||
"GC/2.5": "mwcc_247_105",
|
||||
"GC/2.6": "mwcc_247_107",
|
||||
"GC/2.7": "mwcc_247_108",
|
||||
"GC/3.0": "mwcc_41_60831",
|
||||
# "GC/3.0a3": "mwcc_41_51213",
|
||||
"GC/3.0a3": "mwcc_41_51213",
|
||||
"GC/3.0a3.2": "mwcc_41_60126",
|
||||
# "GC/3.0a3.3": "mwcc_41_60209",
|
||||
# "GC/3.0a3.4": "mwcc_42_60308",
|
||||
# "GC/3.0a5": "mwcc_42_60422",
|
||||
"GC/3.0a3.3": "mwcc_41_60209",
|
||||
"GC/3.0a3.4": "mwcc_42_60308",
|
||||
"GC/3.0a5": "mwcc_42_60422",
|
||||
"GC/3.0a5.2": "mwcc_41_60831",
|
||||
"GC/3.0": "mwcc_41_60831",
|
||||
"Wii/1.0RC1": "mwcc_42_140",
|
||||
"Wii/0x4201_127": "mwcc_42_142",
|
||||
# "Wii/1.0": "mwcc_43_145",
|
||||
# "Wii/1.0RC1": "mwcc_42_140",
|
||||
"Wii/1.0a": "mwcc_42_142",
|
||||
"Wii/1.0": "mwcc_43_145",
|
||||
"Wii/1.1": "mwcc_43_151",
|
||||
"Wii/1.3": "mwcc_43_172",
|
||||
# "Wii/1.5": "mwcc_43_188",
|
||||
"Wii/1.5": "mwcc_43_188",
|
||||
"Wii/1.6": "mwcc_43_202",
|
||||
"Wii/1.7": "mwcc_43_213",
|
||||
}
|
||||
@ -1235,7 +1235,7 @@ def calculate_progress(config: ProjectConfig) -> None:
|
||||
print(f" Data: {unit.data_progress} / {unit.data_total} bytes")
|
||||
if config.progress_use_fancy:
|
||||
print(
|
||||
"\nYou have {} out of {} {} and collected {} out of {} {}.".format(
|
||||
"\nYou have {} out of {} {} and {} out of {} {}.".format(
|
||||
math.floor(code_frac * unit.code_fancy_frac),
|
||||
unit.code_fancy_frac,
|
||||
unit.code_fancy_item,
|
||||
|
79
tools/upload_progress.py
Normal file
79
tools/upload_progress.py
Normal file
@ -0,0 +1,79 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
###
|
||||
# Uploads progress information to https://github.com/decompals/frogress.
|
||||
#
|
||||
# Usage:
|
||||
# python3 tools/upload_progress.py -b https://progress.decomp.club/ -p [project] -v [version] build/[version]/progress.json
|
||||
#
|
||||
# If changes are made, please submit a PR to
|
||||
# https://github.com/encounter/dtk-template
|
||||
###
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import requests
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def get_git_commit_timestamp() -> int:
|
||||
return int(
|
||||
subprocess.check_output(["git", "show", "-s", "--format=%ct"])
|
||||
.decode("ascii")
|
||||
.rstrip()
|
||||
)
|
||||
|
||||
|
||||
def get_git_commit_sha() -> str:
|
||||
return subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("ascii").strip()
|
||||
|
||||
|
||||
def generate_url(args: argparse.Namespace) -> str:
|
||||
url_components = [args.base_url.rstrip("/"), "data"]
|
||||
|
||||
for arg in [args.project, args.version]:
|
||||
if arg != "":
|
||||
url_components.append(arg)
|
||||
|
||||
return str.join("/", url_components) + "/"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Upload progress information.")
|
||||
parser.add_argument("-b", "--base_url", help="API base URL", required=True)
|
||||
parser.add_argument("-a", "--api_key", help="API key (env var PROGRESS_API_KEY)")
|
||||
parser.add_argument("-p", "--project", help="Project slug", required=True)
|
||||
parser.add_argument("-v", "--version", help="Version slug", required=True)
|
||||
parser.add_argument("input", help="Progress JSON input")
|
||||
|
||||
args = parser.parse_args()
|
||||
api_key = args.api_key or os.environ.get("PROGRESS_API_KEY")
|
||||
if not api_key:
|
||||
raise KeyError("API key required")
|
||||
url = generate_url(args)
|
||||
|
||||
entries = []
|
||||
with open(args.input, "r") as f:
|
||||
data = json.load(f)
|
||||
entries.append(
|
||||
{
|
||||
"timestamp": get_git_commit_timestamp(),
|
||||
"git_hash": get_git_commit_sha(),
|
||||
"categories": data,
|
||||
}
|
||||
)
|
||||
|
||||
print("Publishing entry to", url)
|
||||
json.dump(entries[0], sys.stdout, indent=4)
|
||||
print()
|
||||
r = requests.post(
|
||||
url,
|
||||
json={
|
||||
"api_key": api_key,
|
||||
"entries": entries,
|
||||
},
|
||||
)
|
||||
r.raise_for_status()
|
||||
print("Done!")
|
Loading…
Reference in New Issue
Block a user