mirror of
https://github.com/zeldaret/tp
synced 2026-08-10 19:17:28 -04:00
Clean up and improvements to tools (#163)
* moved elf2dol * removed postprocess.py * removed vtables.py * find_unused_asm.py * removed section2cpp.py * removed splitter/* * fixed symbol names due to iconv file rename * fixed problem building RELs caused by #160 * improved performance of a few python tools * added new tool for finding conflict when not OK * added ./tp setup * don't install dol2asm dependecies with requirements.txt * format and check for imports * remove unused tools/difftools.py * fixed ignore to include elf2dol * fix compiler patcher * ok-check now creates the patched compiler at mwcceppc_patched.exe * Add new command to copy the build folder to the expected folder * 'make clean' will now only clean main.dol stuff. (added clean_rels and clean_all) * './tp pull-request' and './tp check' now doesn't include RELs by default. Use '--rels' to include them in the process. * './tp remove-unused-asm --check' added, exitcode 0==no files, 1==exists files Co-authored-by: Julgodis <>
This commit is contained in:
+113
-21
@@ -5,33 +5,125 @@ dol2asm.py - Script for splitting .dol and .rel binaries into C++ and .s code.
|
||||
This script only calls the underlaying libdol2asm code that does the heavy-lifting.
|
||||
|
||||
"""
|
||||
|
||||
import click
|
||||
import libdol2asm
|
||||
import sys
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
try:
|
||||
import click
|
||||
import libdol2asm
|
||||
except ImportError as e:
|
||||
MISSING_PREREQUISITES = (
|
||||
f"Missing prerequisite python module {e}.\n"
|
||||
f"Run `python3 -m pip install --user -r tools/requirements.txt` to install prerequisites."
|
||||
)
|
||||
|
||||
print(MISSING_PREREQUISITES, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.version_option(libdol2asm.VERSION)
|
||||
@click.option('--debug/--no-debug', help="enable/disable debug logging", default=False)
|
||||
@click.option('--game', 'game_path', help=f"Path to extracted game files. (same directory as 'main.dol' is in)", required=False, type=libdol2asm.util.PathPath(file_okay=False, dir_okay=True), default="game/")
|
||||
@click.option('--lib-path', 'lib_path', help="Where to put generated library source files.", required=False, type=libdol2asm.util.PathPath(file_okay=False, dir_okay=True), default="libs/")
|
||||
@click.option('--src-path', 'src_path', help="Where to put generated source files.", required=False, type=libdol2asm.util.PathPath(file_okay=False, dir_okay=True), default="src/")
|
||||
@click.option('--asm-path', 'asm_path', help="Where to put generated asm files.", required=False, type=libdol2asm.util.PathPath(file_okay=False, dir_okay=True), default="asm/")
|
||||
@click.option('--rel-path', 'rel_path', help="Where to put generated rel source files.", required=False, type=libdol2asm.util.PathPath(file_okay=False, dir_okay=True), default="rel/")
|
||||
@click.option('--include-path', 'inc_path', help="Where to put generated include files.", required=False, type=libdol2asm.util.PathPath(file_okay=False, dir_okay=True), default="include/")
|
||||
@click.option('--cpp/--no-cpp', 'cpp_gen', default=True)
|
||||
@click.option('--asm/--no-asm', 'asm_gen', default=True)
|
||||
@click.option('--makefile/--no-makefile', 'mk_gen', default=True)
|
||||
@click.option('--symbols/--no-symbols', 'sym_gen', default=True)
|
||||
@click.option('--rels/--no-rels', 'rel_gen', default=True)
|
||||
@click.option('--threads', '-j', 'process_count', default=8)
|
||||
@click.option('--select-module', '-g', 'select_modules', help="Select what modules to generate. Default is everything.", multiple=True)
|
||||
@click.option('--select-asm', '-n', 'select_asm', multiple=True)
|
||||
@click.option('--select-tu', '-t', 'select_tu', multiple=True)
|
||||
def main(debug, game_path, asm_path, lib_path, src_path, rel_path, inc_path, mk_gen, cpp_gen, asm_gen, sym_gen, rel_gen, process_count, select_modules, select_tu, select_asm):
|
||||
return libdol2asm.split(debug, game_path, lib_path, src_path, asm_path, rel_path, inc_path, mk_gen, cpp_gen, asm_gen, sym_gen, rel_gen, process_count, select_modules, select_tu, select_asm)
|
||||
@click.option("--debug/--no-debug", help="enable/disable debug logging", default=False)
|
||||
@click.option(
|
||||
"--game",
|
||||
"game_path",
|
||||
help=f"Path to extracted game files. (same directory as 'main.dol' is in)",
|
||||
required=False,
|
||||
type=libdol2asm.util.PathPath(file_okay=False, dir_okay=True),
|
||||
default="game/",
|
||||
)
|
||||
@click.option(
|
||||
"--lib-path",
|
||||
"lib_path",
|
||||
help="Where to put generated library source files.",
|
||||
required=False,
|
||||
type=libdol2asm.util.PathPath(file_okay=False, dir_okay=True),
|
||||
default="libs/",
|
||||
)
|
||||
@click.option(
|
||||
"--src-path",
|
||||
"src_path",
|
||||
help="Where to put generated source files.",
|
||||
required=False,
|
||||
type=libdol2asm.util.PathPath(file_okay=False, dir_okay=True),
|
||||
default="src/",
|
||||
)
|
||||
@click.option(
|
||||
"--asm-path",
|
||||
"asm_path",
|
||||
help="Where to put generated asm files.",
|
||||
required=False,
|
||||
type=libdol2asm.util.PathPath(file_okay=False, dir_okay=True),
|
||||
default="asm/",
|
||||
)
|
||||
@click.option(
|
||||
"--rel-path",
|
||||
"rel_path",
|
||||
help="Where to put generated rel source files.",
|
||||
required=False,
|
||||
type=libdol2asm.util.PathPath(file_okay=False, dir_okay=True),
|
||||
default="rel/",
|
||||
)
|
||||
@click.option(
|
||||
"--include-path",
|
||||
"inc_path",
|
||||
help="Where to put generated include files.",
|
||||
required=False,
|
||||
type=libdol2asm.util.PathPath(file_okay=False, dir_okay=True),
|
||||
default="include/",
|
||||
)
|
||||
@click.option("--cpp/--no-cpp", "cpp_gen", default=True)
|
||||
@click.option("--asm/--no-asm", "asm_gen", default=True)
|
||||
@click.option("--makefile/--no-makefile", "mk_gen", default=True)
|
||||
@click.option("--symbols/--no-symbols", "sym_gen", default=True)
|
||||
@click.option("--rels/--no-rels", "rel_gen", default=True)
|
||||
@click.option("--threads", "-j", "process_count", default=8)
|
||||
@click.option(
|
||||
"--select-module",
|
||||
"-g",
|
||||
"select_modules",
|
||||
help="Select what modules to generate. Default is everything.",
|
||||
multiple=True,
|
||||
)
|
||||
@click.option("--select-asm", "-n", "select_asm", multiple=True)
|
||||
@click.option("--select-tu", "-t", "select_tu", multiple=True)
|
||||
def main(
|
||||
debug,
|
||||
game_path,
|
||||
asm_path,
|
||||
lib_path,
|
||||
src_path,
|
||||
rel_path,
|
||||
inc_path,
|
||||
mk_gen,
|
||||
cpp_gen,
|
||||
asm_gen,
|
||||
sym_gen,
|
||||
rel_gen,
|
||||
process_count,
|
||||
select_modules,
|
||||
select_tu,
|
||||
select_asm,
|
||||
):
|
||||
return libdol2asm.split(
|
||||
debug,
|
||||
game_path,
|
||||
lib_path,
|
||||
src_path,
|
||||
asm_path,
|
||||
rel_path,
|
||||
inc_path,
|
||||
mk_gen,
|
||||
cpp_gen,
|
||||
asm_gen,
|
||||
sym_gen,
|
||||
rel_gen,
|
||||
process_count,
|
||||
select_modules,
|
||||
select_tu,
|
||||
select_asm,
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user