https://github.com/henriquegemignani/py-nod
Python bindings for NOD, a library for GameCube/Wii optical discs
https://github.com/henriquegemignani/py-nod
cython game-modding metroid-prime python python3
Last synced: 9 months ago
JSON representation
Python bindings for NOD, a library for GameCube/Wii optical discs
- Host: GitHub
- URL: https://github.com/henriquegemignani/py-nod
- Owner: henriquegemignani
- License: mit
- Created: 2017-10-21T16:54:14.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2024-12-23T22:20:44.000Z (over 1 year ago)
- Last Synced: 2024-12-23T23:25:15.041Z (over 1 year ago)
- Topics: cython, game-modding, metroid-prime, python, python3
- Language: Cython
- Homepage:
- Size: 296 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-nod
Python 3.8 bindings for the [NOD](https://gitlab.axiodl.com/AxioDL/nod), a library for traversing, dumping, and authoring
GameCube and Wii optical disc images.
## Usage
### Unpacking
```python
import nod
def progress_callback(path, progress):
if args.verbose:
print("Extraction {:.0%} Complete; Current node: {}".format(progress, path))
context = nod.ExtractionContext()
context.set_progress_callback(progress_callback)
try:
disc, is_wii = nod.open_disc_from_image("game.iso")
data_partition = disc.get_data_partition()
if not data_partition:
raise RuntimeError("Could not find a data partition in the disc.")
data_partition.extract_to_directory("dir_out", context)
except RuntimeError as e:
raise Exception("Could not extract disc at 'game.iso' to 'dir_out': {}".format(e))
```
### Packing
```python
import nod
if nod.DiscBuilderGCN.calculate_total_size_required("dir_out") is None:
raise Exception("Image built with given directory would pass the maximum size.")
def fprogress_callback(progress: float, name: str, bytes: int):
print("\r" + " " * 100, end="")
print("\r{:.0%} {} {} B".format(progress, name, bytes), flush=True)
disc_builder = nod.DiscBuilderGCN("game.iso", fprogress_callback)
try:
disc_builder.build_from_directory("dir_out")
except RuntimeError as e:
raise Exception("Failure building the image: {}".format(e))
```