diff --git a/README.md b/README.md index ce05685..0626f65 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ To see what features are supported, I would recommend checking out the list of f ## Requirements -libWiiPy has been tested on both Python 3.11 and 3.12, and works as expected in both places. libWiiPy *should* support Python 3.10, however this is not verified. WiiPy only relies on libWiiPy, so it supports the same Python versions. +libWiiPy has been tested on both Python 3.11 and 3.12, and works as expected in both places. WiiPy relies only on libWiiPy, so generally any version supported by libWiiPy should be supported by WiiPy. To make sure you have libWiiPy and all of its dependencies, you can simply run: ```shell @@ -20,7 +20,7 @@ Basic usage for WiiPy is very simple. ```shell python3 wiipy.py ``` -You can use `--help` to see a list of all subcommands, or use ` --help` to see usage instructions for that subcommand. +You can use `--help` to see a list of all commands, or use ` --help` to see usage instructions for that command. This also applies to subcommands, with the syntax ` --help`. Available subcommands will expand as support for more features are added into libWiiPy. WiiPy is designed around libWiiPy's `main` branch, so any features that have been merged into main are likely to be supported here within a short period of time. This also means that any updates to the library will be addressed here quickly, so breaking changes in libWiiPy shouldn't cause issues. @@ -44,3 +44,6 @@ Then, run the install command with `sudo` (or your favorite alternative): ```shell sudo make linux-install ``` + +### A Note About Scripts +WiiPy's source includes a directory named `scripts`, which is currently where miscellaneous libWiiPy-based scripts live. Note that they are not part of WiiPy releases, and are not tested the same way the WiiPy is. They are simply here for those who may find them useful. diff --git a/scripts/content-checker.py b/scripts/content-checker.py new file mode 100644 index 0000000..29ad2c1 --- /dev/null +++ b/scripts/content-checker.py @@ -0,0 +1,27 @@ +import pathlib +import sys + +import libWiiPy + +target_hash = sys.argv[1].lower().encode() +print(target_hash) + +for content in range(3, 81): + try: + tmd = libWiiPy.title.download_tmd(f"00000007000000{content:02X}") + open(f"00000007000000{content:02X}.tmd", "wb").write(tmd) + except ValueError: + pass + +workdir = pathlib.Path(".") + +tmd_files = list(workdir.glob("*.tmd")) + +for tmd in tmd_files: + new_tmd = libWiiPy.title.TMD() + new_tmd.load(open(tmd, "rb").read()) + hash_list = [] + for content in new_tmd.content_records: + hash_list.append(content.content_hash) + if target_hash in hash_list: + print(f"Found match in {tmd}\n") diff --git a/scripts/nus-scraper.py b/scripts/nus-scraper.py new file mode 100644 index 0000000..1504cc0 --- /dev/null +++ b/scripts/nus-scraper.py @@ -0,0 +1,28 @@ +import os + +import libWiiPy + +tid_high = ["00010000", "00010001", "00010005"] +types = ["43", "44", "45", "46", "47", "48", "4A", "4C", "4D", "4E", "50", "51", "52", "53", "57", "58"] +regions = ["45", "4A", "4B", "50"] + + +for tid in tid_high: + print(f"Starting scrape for TID high {tid}...") + + if os.path.exists(f"{tid}.log"): + os.remove(f"{tid}.log") + log = open(f"{tid}.log", "a") + + for ttype in types: + print(f"Scraping titles of type: {ttype}") + for title in range(0, 65536): + for region in regions: + try: + tmd = libWiiPy.title.download_tmd(f"{tid}{ttype}{title:04X}{region}") + print(f"Found valid TID: {tid}{ttype}{title:04X}{region}") + log.write(f"{tid}{ttype}{title:02X}{region}") + except ValueError: + print(f"Invalid TID: {tid}{ttype}{title:04X}{region}") + pass + log.close()