mirror of
https://github.com/NinjaCheetah/WiiPy.git
synced 2025-04-26 05:11:02 -04:00
Add new ASH module based on libWiiPy main
This commit is contained in:
parent
83d55ec189
commit
35b0af56d7
9
.gitignore
vendored
9
.gitignore
vendored
@ -22,11 +22,13 @@ var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
main.build/
|
||||
main.dist/
|
||||
*.build/
|
||||
*.dist/
|
||||
*.onefile-build/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
*.bin
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
@ -164,6 +166,9 @@ cython_debug/
|
||||
# Allows me to keep TMD files in my repository folder for testing without accidentally publishing them
|
||||
*.tmd
|
||||
*.wad
|
||||
*.app
|
||||
*.arc
|
||||
*.ash
|
||||
out_prod/
|
||||
remakewad.pl
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
# libWiiPy-cli
|
||||
# WiiPy
|
||||
A simple CLI tool that serves as a reference implementation of libWiiPy.
|
||||
|
23
modules/ash.py
Normal file
23
modules/ash.py
Normal file
@ -0,0 +1,23 @@
|
||||
# "ash.py" from WiiPy by NinjaCheetah
|
||||
# https://github.com/NinjaCheetah/WiiPy
|
||||
|
||||
import os
|
||||
import libWiiPy
|
||||
|
||||
|
||||
def decompress_ash(in_file: str, out_file: str = None):
|
||||
if not os.path.isfile(in_file):
|
||||
raise FileNotFoundError(in_file)
|
||||
|
||||
ash_file = open(in_file, "rb")
|
||||
ash_data = ash_file.read()
|
||||
ash_file.close()
|
||||
|
||||
ash_decompressed = libWiiPy.archive.decompress_ash(ash_data)
|
||||
|
||||
if out_file is None:
|
||||
out_file = in_file + ".arc"
|
||||
|
||||
ash_out = open(out_file, "wb")
|
||||
ash_out.write(ash_decompressed)
|
||||
ash_out.close()
|
@ -1,5 +1,5 @@
|
||||
# "nus.py" from libWiiPy-cli by NinjaCheetah
|
||||
# https://github.com/NinjaCheetah/libWiiPy-cli
|
||||
# "nus.py" from WiiPy by NinjaCheetah
|
||||
# https://github.com/NinjaCheetah/WiiPy
|
||||
|
||||
import libWiiPy
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# "u8.py" from libWiiPy-cli by NinjaCheetah
|
||||
# https://github.com/NinjaCheetah/libWiiPy-cli
|
||||
# "u8.py" from WiiPy by NinjaCheetah
|
||||
# https://github.com/NinjaCheetah/WiiPy
|
||||
|
||||
import os
|
||||
import libWiiPy
|
||||
|
@ -1,5 +1,5 @@
|
||||
# "wad.py" from libWiiPy-cli by NinjaCheetah
|
||||
# https://github.com/NinjaCheetah/libWiiPy-cli
|
||||
# "wad.py" from WiiPy by NinjaCheetah
|
||||
# https://github.com/NinjaCheetah/WiiPy
|
||||
|
||||
import os
|
||||
import pathlib
|
||||
|
@ -1 +1,2 @@
|
||||
git+https://github.com/NinjaCheetah/libWiiPy
|
||||
nuitka
|
||||
|
@ -1,10 +1,11 @@
|
||||
# "main.py" from libWiiPy-cli by NinjaCheetah
|
||||
# https://github.com/NinjaCheetah/libWiiPy-cli
|
||||
# "wiipy.py" from WiiPy by NinjaCheetah
|
||||
# https://github.com/NinjaCheetah/WiiPy
|
||||
|
||||
import sys
|
||||
from modules.wad import *
|
||||
from modules.nus import *
|
||||
from modules.u8 import *
|
||||
from modules.ash import *
|
||||
|
||||
opts = [opt for opt in sys.argv[1:] if opt.startswith("-")]
|
||||
args = [arg for arg in sys.argv[1:] if not arg.startswith("-")]
|
||||
@ -14,30 +15,47 @@ if __name__ == "__main__":
|
||||
if "-u" in opts:
|
||||
if len(args) == 3:
|
||||
extract_wad_to_folder(args[1], args[2])
|
||||
exit(0)
|
||||
print("Success!")
|
||||
sys.exit(0)
|
||||
if "-p" in opts:
|
||||
if len(args) == 3:
|
||||
pack_wad_from_folder(args[1], args[2])
|
||||
exit(0)
|
||||
print("Success!")
|
||||
sys.exit(0)
|
||||
raise SystemExit(f"Usage: {sys.argv[0]} WAD (-u | -p) <input> <output>")
|
||||
elif "NUS" in args:
|
||||
if "-d" in opts:
|
||||
if len(args) == 2:
|
||||
download_title(args[1])
|
||||
exit(0)
|
||||
print("Success!")
|
||||
sys.exit(0)
|
||||
elif len(args) == 3:
|
||||
download_title(args[1], args[2])
|
||||
exit(0)
|
||||
print("Success!")
|
||||
sys.exit(0)
|
||||
raise SystemExit(f"Usage: {sys.argv[0]} NUS -d <Title ID> <Title Version (Optional)>")
|
||||
elif "U8" in args:
|
||||
if "-u" in opts:
|
||||
if len(args) == 3:
|
||||
extract_u8_to_folder(args[1], args[2])
|
||||
exit(0)
|
||||
print("Success!")
|
||||
sys.exit(0)
|
||||
elif "-p" in opts:
|
||||
if len(args) == 3:
|
||||
pack_u8_from_folder(args[1], args[2])
|
||||
exit(0)
|
||||
print("Success!")
|
||||
sys.exit(0)
|
||||
raise SystemExit(f"Usage: {sys.argv[0]} U8 (-u | -p) <input> <output>")
|
||||
elif "ASH" in args:
|
||||
if "-d" in opts:
|
||||
if len(args) == 2:
|
||||
decompress_ash(args[1])
|
||||
print("Success!")
|
||||
sys.exit(0)
|
||||
elif len(args) == 3:
|
||||
decompress_ash(args[1], args[2])
|
||||
print("Success!")
|
||||
sys.exit(0)
|
||||
raise SystemExit(f"Usage: {sys.argv[0]} ASH -d <input> <output (Optional)>")
|
||||
else:
|
||||
raise SystemExit(f"Usage: {sys.argv[0]} WAD (-u | -p) <input> <output>")
|
Loading…
x
Reference in New Issue
Block a user