mirror of
https://github.com/NinjaCheetah/WiiPy.git
synced 2025-04-26 13:21:01 -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/
|
wheels/
|
||||||
share/python-wheels/
|
share/python-wheels/
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
main.build/
|
*.build/
|
||||||
main.dist/
|
*.dist/
|
||||||
|
*.onefile-build/
|
||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
*.bin
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# 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
|
# Allows me to keep TMD files in my repository folder for testing without accidentally publishing them
|
||||||
*.tmd
|
*.tmd
|
||||||
*.wad
|
*.wad
|
||||||
|
*.app
|
||||||
|
*.arc
|
||||||
|
*.ash
|
||||||
out_prod/
|
out_prod/
|
||||||
remakewad.pl
|
remakewad.pl
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
# libWiiPy-cli
|
# WiiPy
|
||||||
A simple CLI tool that serves as a reference implementation of libWiiPy.
|
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
|
# "nus.py" from WiiPy by NinjaCheetah
|
||||||
# https://github.com/NinjaCheetah/libWiiPy-cli
|
# https://github.com/NinjaCheetah/WiiPy
|
||||||
|
|
||||||
import libWiiPy
|
import libWiiPy
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# "u8.py" from libWiiPy-cli by NinjaCheetah
|
# "u8.py" from WiiPy by NinjaCheetah
|
||||||
# https://github.com/NinjaCheetah/libWiiPy-cli
|
# https://github.com/NinjaCheetah/WiiPy
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import libWiiPy
|
import libWiiPy
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# "wad.py" from libWiiPy-cli by NinjaCheetah
|
# "wad.py" from WiiPy by NinjaCheetah
|
||||||
# https://github.com/NinjaCheetah/libWiiPy-cli
|
# https://github.com/NinjaCheetah/WiiPy
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
|
@ -1 +1,2 @@
|
|||||||
git+https://github.com/NinjaCheetah/libWiiPy
|
git+https://github.com/NinjaCheetah/libWiiPy
|
||||||
|
nuitka
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
# "main.py" from libWiiPy-cli by NinjaCheetah
|
# "wiipy.py" from WiiPy by NinjaCheetah
|
||||||
# https://github.com/NinjaCheetah/libWiiPy-cli
|
# https://github.com/NinjaCheetah/WiiPy
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from modules.wad import *
|
from modules.wad import *
|
||||||
from modules.nus import *
|
from modules.nus import *
|
||||||
from modules.u8 import *
|
from modules.u8 import *
|
||||||
|
from modules.ash import *
|
||||||
|
|
||||||
opts = [opt for opt in sys.argv[1:] if opt.startswith("-")]
|
opts = [opt for opt in sys.argv[1:] if opt.startswith("-")]
|
||||||
args = [arg for arg in sys.argv[1:] if not arg.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 "-u" in opts:
|
||||||
if len(args) == 3:
|
if len(args) == 3:
|
||||||
extract_wad_to_folder(args[1], args[2])
|
extract_wad_to_folder(args[1], args[2])
|
||||||
exit(0)
|
print("Success!")
|
||||||
|
sys.exit(0)
|
||||||
if "-p" in opts:
|
if "-p" in opts:
|
||||||
if len(args) == 3:
|
if len(args) == 3:
|
||||||
pack_wad_from_folder(args[1], args[2])
|
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>")
|
raise SystemExit(f"Usage: {sys.argv[0]} WAD (-u | -p) <input> <output>")
|
||||||
elif "NUS" in args:
|
elif "NUS" in args:
|
||||||
if "-d" in opts:
|
if "-d" in opts:
|
||||||
if len(args) == 2:
|
if len(args) == 2:
|
||||||
download_title(args[1])
|
download_title(args[1])
|
||||||
exit(0)
|
print("Success!")
|
||||||
|
sys.exit(0)
|
||||||
elif len(args) == 3:
|
elif len(args) == 3:
|
||||||
download_title(args[1], args[2])
|
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)>")
|
raise SystemExit(f"Usage: {sys.argv[0]} NUS -d <Title ID> <Title Version (Optional)>")
|
||||||
elif "U8" in args:
|
elif "U8" in args:
|
||||||
if "-u" in opts:
|
if "-u" in opts:
|
||||||
if len(args) == 3:
|
if len(args) == 3:
|
||||||
extract_u8_to_folder(args[1], args[2])
|
extract_u8_to_folder(args[1], args[2])
|
||||||
exit(0)
|
print("Success!")
|
||||||
|
sys.exit(0)
|
||||||
elif "-p" in opts:
|
elif "-p" in opts:
|
||||||
if len(args) == 3:
|
if len(args) == 3:
|
||||||
pack_u8_from_folder(args[1], args[2])
|
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>")
|
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:
|
else:
|
||||||
raise SystemExit(f"Usage: {sys.argv[0]} WAD (-u | -p) <input> <output>")
|
raise SystemExit(f"Usage: {sys.argv[0]} WAD (-u | -p) <input> <output>")
|
Loading…
x
Reference in New Issue
Block a user