Fix build for new contributors (#1994)

* Add pyyaml to Python dependencies

* Add Jetbrains IDE dir to gitignore

* Check magic number on the ISO file
This commit is contained in:
Keith Lazuka 2023-12-01 12:22:38 -05:00 committed by GitHub
parent c85689c5da
commit eda795addf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

1
.gitignore vendored
View File

@ -25,6 +25,7 @@ docs/doxygen/
# IDE
.vscode/
.idea/
# Python
__pycache__/

View File

@ -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)

View File

@ -10,4 +10,5 @@ cxxfilt
pyelftools
requests
GitPython
clang
clang
pyyaml