mirror of https://github.com/zeldaret/tp.git
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:
parent
c85689c5da
commit
eda795addf
|
@ -25,6 +25,7 @@ docs/doxygen/
|
||||||
|
|
||||||
# IDE
|
# IDE
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
|
||||||
# Python
|
# Python
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
|
@ -9,6 +9,7 @@ Extracts the game assets and stores them in the game folder
|
||||||
Usage: `python tools/extract_game_assets.py`
|
Usage: `python tools/extract_game_assets.py`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
fileMagicNumber = b"GZ2E01"
|
||||||
fstInfoPosition = 0x424
|
fstInfoPosition = 0x424
|
||||||
bootPosition = 0x0
|
bootPosition = 0x0
|
||||||
bootSize = 0x440
|
bootSize = 0x440
|
||||||
|
@ -243,6 +244,13 @@ def extract(isoPath: Path, gamePath: Path, yaz0Encoder):
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
os.chdir(gamePath)
|
os.chdir(gamePath)
|
||||||
with open(isoPath, "rb") as f:
|
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
|
# Seek to fst offset information and retrieve it
|
||||||
f.seek(fstInfoPosition)
|
f.seek(fstInfoPosition)
|
||||||
fstOffset, fstSize = getFstInfo(f, fstInfoPosition)
|
fstOffset, fstSize = getFstInfo(f, fstInfoPosition)
|
||||||
|
|
|
@ -10,4 +10,5 @@ cxxfilt
|
||||||
pyelftools
|
pyelftools
|
||||||
requests
|
requests
|
||||||
GitPython
|
GitPython
|
||||||
clang
|
clang
|
||||||
|
pyyaml
|
||||||
|
|
Loading…
Reference in New Issue