diff options
| author | Keith Lazuka <klazuka@gmail.com> | 2023-12-01 12:22:38 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-01 10:22:38 -0700 |
| commit | eda795addf638e3a5434f86bc562da1bfde28221 (patch) | |
| tree | c66e9e99b1cb6060978c099ecd55482594400830 /tools | |
| parent | c85689c5da8b01831d39fa89d6dd6ee22c6153d9 (diff) | |
Fix build for new contributors (#1994)
* Add pyyaml to Python dependencies
* Add Jetbrains IDE dir to gitignore
* Check magic number on the ISO file
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/extract_game_assets.py | 8 | ||||
| -rw-r--r-- | tools/requirements.txt | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/tools/extract_game_assets.py b/tools/extract_game_assets.py index 1cfdf6ee30..9ae1777c95 100644 --- a/tools/extract_game_assets.py +++ b/tools/extract_game_assets.py @@ -9,6 +9,7 @@ Extracts the game assets and stores them in the game folder Usage: `python tools/extract_game_assets.py` """ +fileMagicNumber = b"GZ2E01" fstInfoPosition = 0x424 bootPosition = 0x0 bootSize = 0x440 @@ -243,6 +244,13 @@ def extract(isoPath: Path, gamePath: Path, yaz0Encoder): cwd = os.getcwd() os.chdir(gamePath) with open(isoPath, "rb") as f: + magic = f.read(len(fileMagicNumber)) + if magic != fileMagicNumber: + if magic.startswith(b"CISO"): + raise RuntimeError("Compressed ISO files are not supported.") + else: + raise RuntimeError(f"Invalid ISO magic number: expected {fileMagicNumber}, got {magic}") + # Seek to fst offset information and retrieve it f.seek(fstInfoPosition) fstOffset, fstSize = getFstInfo(f, fstInfoPosition) diff --git a/tools/requirements.txt b/tools/requirements.txt index d271775394..fc6011a52a 100644 --- a/tools/requirements.txt +++ b/tools/requirements.txt @@ -10,4 +10,5 @@ cxxfilt pyelftools requests GitPython -clang
\ No newline at end of file +clang +pyyaml |
