mirror of
https://github.com/Virtual-World-RE/NeoGF.git
synced 2024-12-24 18:31:35 +01:00
Update pzztool.py
Bug fixes
This commit is contained in:
parent
665096dd87
commit
99da6dab1b
|
@ -6,7 +6,7 @@ from struct import unpack
|
|||
from os import listdir
|
||||
import logging
|
||||
|
||||
__version__ = "0.14.5"
|
||||
__version__ = "0.14.6"
|
||||
__author__ = "rigodron, algoflash, GGLinnk"
|
||||
__OriginalAutor__ = "infval"
|
||||
__license__ = "MIT"
|
||||
|
@ -75,8 +75,8 @@ def remove_padding(file_content: bytearray):
|
|||
|
||||
def bytes_align_compress(bout: bytes):
|
||||
# Comme le montre le fichier pl080d/006C_pl080d.pzzp, on ajoute 0x800 si c'est aligné sur un multiple
|
||||
if len(bout) % CHUNK_SIZE == 0:
|
||||
return bout.ljust(CHUNK_SIZE * (len(bout) / CHUNK_SIZE + 1), b"\x00")
|
||||
#if len(bout) % CHUNK_SIZE == 0:
|
||||
# return bout.ljust(CHUNK_SIZE * int(len(bout) / CHUNK_SIZE + 1), b"\x00")
|
||||
return bout.ljust(CHUNK_SIZE * ceil(len(bout) / CHUNK_SIZE), b"\x00")
|
||||
|
||||
|
||||
|
@ -132,6 +132,7 @@ def pzz_decompress(compressed_bytes: bytes):
|
|||
|
||||
|
||||
def pzz_compress(uncompressed_bytes: bytes):
|
||||
uncompressed_bytes += b"\x00"
|
||||
compressed_bytes = bytearray(2)
|
||||
size_uncompressed_bytes = len(uncompressed_bytes) // 2 * 2
|
||||
|
||||
|
@ -287,7 +288,7 @@ 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):
|
||||
if dest_file == Path('.'):
|
||||
dest_file = src_path.with_suffix(".pzz")
|
||||
if dest_file.suffix != ".pzz" and pzz_path.suffix != ".mdt":
|
||||
if dest_file.suffix != ".pzz" and dest_file.suffix != ".mdt":
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user