mirror of
https://github.com/Virtual-World-RE/NeoGF.git
synced 2024-11-15 13:55:35 +01:00
Update pzztool.py
MDT handling added
This commit is contained in:
parent
f4dda77324
commit
cdb78bde56
12
pzztool.py
12
pzztool.py
|
@ -6,7 +6,7 @@ from struct import unpack
|
||||||
from os import listdir
|
from os import listdir
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
__version__ = "0.14.4"
|
__version__ = "0.14.5"
|
||||||
__author__ = "rigodron, algoflash, GGLinnk"
|
__author__ = "rigodron, algoflash, GGLinnk"
|
||||||
__OriginalAutor__ = "infval"
|
__OriginalAutor__ = "infval"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
|
@ -208,8 +208,8 @@ def pzz_compress(uncompressed_bytes: bytes):
|
||||||
|
|
||||||
|
|
||||||
def pzz_unpack(pzz_path: Path, dest_folder: Path, auto_decompress: bool = False):
|
def pzz_unpack(pzz_path: Path, dest_folder: Path, auto_decompress: bool = False):
|
||||||
if pzz_path.suffix != ".pzz":
|
if pzz_path.suffix != ".pzz" and pzz_path.suffix != ".mdt":
|
||||||
logging.warning(f"Invalid file format '{pzz_path.suffix}'; it should be .pzz file format")
|
logging.warning(f"Invalid file format '{pzz_path.suffix}'; it should be .pzz or .mdt file format")
|
||||||
|
|
||||||
if dest_folder != Path('.'):
|
if dest_folder != Path('.'):
|
||||||
unpacked_pzz_path = dest_folder
|
unpacked_pzz_path = dest_folder
|
||||||
|
@ -287,8 +287,8 @@ def pzz_unpack(pzz_path: Path, dest_folder: Path, auto_decompress: bool = False)
|
||||||
def pzz_pack(src_path: Path, dest_file: Path, auto_compress: bool = False):
|
def pzz_pack(src_path: Path, dest_file: Path, auto_compress: bool = False):
|
||||||
if dest_file == Path('.'):
|
if dest_file == Path('.'):
|
||||||
dest_file = src_path.with_suffix(".pzz")
|
dest_file = src_path.with_suffix(".pzz")
|
||||||
if dest_file.suffix != ".pzz":
|
if dest_file.suffix != ".pzz" and pzz_path.suffix != ".mdt":
|
||||||
logging.warning(f"Invalid file format '{dest_file.suffix}' : dest must be a pzz")
|
logging.warning(f"Invalid file format '{dest_file.suffix}' : dest must be a pzz or mdt")
|
||||||
|
|
||||||
# On récupère les fichiers du dossier à compresser
|
# On récupère les fichiers du dossier à compresser
|
||||||
src_files = listdir(src_path)
|
src_files = listdir(src_path)
|
||||||
|
@ -352,7 +352,7 @@ def pzz(src_path: Path, dest_file: Path):
|
||||||
|
|
||||||
def get_argparser():
|
def get_argparser():
|
||||||
import argparse
|
import argparse
|
||||||
parser = argparse.ArgumentParser(description='PZZ (de)compressor & unpacker - [GameCube] Gotcha Force v' + __version__)
|
parser = argparse.ArgumentParser(description='PZZ / MDT (de)compressor & unpacker - [GameCube] Gotcha Force v' + __version__)
|
||||||
parser.add_argument('--version', action='version', version='%(prog)s ' + __version__)
|
parser.add_argument('--version', action='version', version='%(prog)s ' + __version__)
|
||||||
parser.add_argument('-v', '--verbose', action='store_true', help='verbose mode')
|
parser.add_argument('-v', '--verbose', action='store_true', help='verbose mode')
|
||||||
parser.add_argument('-di', '--disable-ignore', action='store_true', help="Disable .pzzp or .pzz file extension verification.")
|
parser.add_argument('-di', '--disable-ignore', action='store_true', help="Disable .pzzp or .pzz file extension verification.")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user