mirror of
https://github.com/NinjaCheetah/WiiPy.git
synced 2025-04-26 13:21:01 -04:00
This does change a large amount of the syntax for using the CLI, but I think that's for the better. This new system also allows for having help pages for each sub command, making the tool a lot easier to use. It also allows for having more arguments available for each subcommand, which is especially necessary for the ASH module.
34 lines
926 B
Python
34 lines
926 B
Python
# "ash.py" from WiiPy by NinjaCheetah
|
|
# https://github.com/NinjaCheetah/WiiPy
|
|
|
|
import pathlib
|
|
import libWiiPy
|
|
|
|
|
|
def handle_ash(args):
|
|
input_path = pathlib.Path(args.input)
|
|
output_path = pathlib.Path(args.output)
|
|
|
|
if args.compress:
|
|
print("Compression is not implemented yet.")
|
|
|
|
elif args.decompress:
|
|
sym_tree_bits = args.sym_bits
|
|
dist_tree_bits = args.dist_bits
|
|
|
|
if not input_path.exists():
|
|
raise FileNotFoundError(input_path)
|
|
|
|
ash_file = open(input_path, "rb")
|
|
ash_data = ash_file.read()
|
|
ash_file.close()
|
|
|
|
ash_decompressed = libWiiPy.archive.decompress_ash(ash_data, sym_tree_bits=sym_tree_bits,
|
|
dist_tree_bits=dist_tree_bits)
|
|
|
|
ash_out = open(output_path, "wb")
|
|
ash_out.write(ash_decompressed)
|
|
ash_out.close()
|
|
|
|
print("ASH file decompressed!")
|