ReverseBox 0.36.0__tar.gz → 0.38.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {reversebox-0.36.0 → reversebox-0.38.0}/PKG-INFO +5 -2
- {reversebox-0.36.0 → reversebox-0.38.0}/README.md +3 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/ReverseBox.egg-info/PKG-INFO +5 -2
- {reversebox-0.36.0 → reversebox-0.38.0}/ReverseBox.egg-info/SOURCES.txt +5 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/common.py +4 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/decoders/compressed_decoder_encoder.py +9 -5
- reversebox-0.38.0/reversebox/image/decoders/pvrtexlib_decoder_encoder.py +96 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/image_decoder.py +6 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/image_encoder.py +6 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/image_formats.py +3 -0
- reversebox-0.38.0/reversebox/libs/PVRTexLib.dll +0 -0
- reversebox-0.38.0/reversebox/libs/TexWrapper.dll +0 -0
- reversebox-0.38.0/reversebox/libs/crnlib.dll +0 -0
- reversebox-0.38.0/reversebox/libs/ispc_texcomp.dll +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/setup.py +2 -2
- {reversebox-0.36.0 → reversebox-0.38.0}/LICENSE +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/ReverseBox.egg-info/dependency_links.txt +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/ReverseBox.egg-info/requires.txt +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/ReverseBox.egg-info/top_level.txt +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/checksum/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/checksum/checksum_adler32.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/checksum/checksum_cocos2d_pvr.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/checksum/checksum_fletcher16.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/checksum/checksum_fletcher32.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/checksum/checksum_internet_ipv4_header.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/checksum/checksum_sum8.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/checksum/checksum_sum8_2s_complement.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/checksum/checksum_unix_sum_bsd16.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/checksum/checksum_unix_sum_sysv.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/checksum/checksum_xor8.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/common/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/common/common.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/common/logger.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/common/numpy_helper_functions.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/compression/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/compression/compression_jcalg1.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/compression/compression_lzo.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/compression/compression_mio0.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/compression/compression_re_tiyoruga_dat.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/compression/compression_refpack.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/compression/compression_zlib.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc16_arc.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc16_ccitt.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc16_dnp.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc16_ea_crcf.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc16_kermit.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc16_modbus.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc16_sick.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc32_asobo.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc32_iso_hdlc.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc64_asobo.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc64_go_iso.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc8.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/crc/crc_unix_cksum.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/encryption/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/encryption/encryption_hatch_engine.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/encryption/encryption_rot13.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/encryption/encryption_xor_basic.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/encryption/encryption_xor_basic_key_guesser.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/encryption/encryption_xor_gianas_return_zda.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/encryption/encryption_xor_retro64_eco.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/hash_additive.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/hash_ap.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/hash_djb2.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/hash_fnv.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/hash_jenkins_one_at_a_time.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/hash_md2.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/hash_md5.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/hash_murmur3.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/hash_pivotal_games_dat.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/hash_sdbm.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/hash_sha1.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/hash/hash_sha2.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/byte_swap.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/compression/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/compression/compression_gst.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/compression/compression_lzw.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/compression/compression_packbits.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/compression/compression_rle_executioners.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/compression/compression_rle_tga.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/compression/compression_zlib.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/decoders/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/decoders/bumpmap_decoder.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/decoders/gst_decoder.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/decoders/n64_decoder.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/decoders/yuv_decoder.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/encoders/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/encoders/gst_encoder.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/file_formats/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/file_formats/image_dds.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/palettes/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/palettes/palette_random.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/palettes/palette_vga.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/pillow_wrapper.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_3ds.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_bc.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_cmpr.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_gamecube.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_gst.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_morton.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_morton_ps4.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_ps2.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_ps2_4bit.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_ps2_suba.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_psp.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_psvita_dreamcast.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_switch.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_wii_u.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_x360.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/io_files/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/io_files/bytes_handler.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/io_files/bytes_helper_functions.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/io_files/check_file.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/io_files/file_handler.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/io_files/mod_handler.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/io_files/translation_text_handler.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/libs/DirectXTex.dll +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/libs/__init__.py +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/reversebox/libs/refpack.dll +0 -0
- {reversebox-0.36.0 → reversebox-0.38.0}/setup.cfg +0 -0
@@ -1,11 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ReverseBox
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.38.0
|
4
4
|
Summary: A set of functions useful in reverse engineering.
|
5
5
|
Home-page: https://github.com/bartlomiejduda/ReverseBox
|
6
6
|
Author: Bartlomiej Duda
|
7
7
|
Author-email: ikskoks@gmail.com
|
8
|
-
Keywords: ReverseBox,reverse engineering,RE,CRC,Hash,Encryption,Compression,Checksum,Python,image,decode,decoding,RGB,swizzle,swizzling,morton,twiddle,twiddling,texture,UYVY,YUY2,NV21,NV12,RGBA,RGBA8888,RGB565,RGBA8,BGR,grayscale,graphics,color,pixel,convert,converting,YUV,RAW,PSP,PS1,PS2,PS3,PS4,XBOX,X360,gamecube,dreamcast,BC,BC1,BC2,BC3,BC4,BC5,BC6,BC7,DXT1,DXT2,DXT3,PackBits,RLE,Macintosh,Jenkins,murmur,murmur3,one-at-a-time,additive
|
8
|
+
Keywords: ReverseBox,reverse engineering,RE,CRC,Hash,Encryption,Compression,Checksum,Python,image,decode,decoding,RGB,swizzle,swizzling,morton,twiddle,twiddling,texture,UYVY,YUY2,NV21,NV12,RGBA,RGBA8888,RGB565,RGBA8,BGR,grayscale,graphics,color,pixel,convert,converting,YUV,RAW,PSP,PS1,PS2,PS3,PS4,XBOX,X360,gamecube,dreamcast,BC,BC1,BC2,BC3,BC4,BC5,BC6,BC7,DXT1,DXT2,DXT3,PackBits,RLE,Macintosh,Jenkins,murmur,murmur3,one-at-a-time,additive,ASTC,ETC1,ETC2
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
10
10
|
Classifier: Programming Language :: Python :: 3.6
|
11
11
|
Classifier: Programming Language :: Python :: 3.7
|
@@ -193,6 +193,9 @@ or software researchers).
|
|
193
193
|
- Decode/Encode BC5 ✔️
|
194
194
|
- Decode/Encode BC6 ✔️
|
195
195
|
- Decode/Encode BC7 ✔️
|
196
|
+
- Decode/Encode ASTC_4x4
|
197
|
+
- Decode/Encode ASTC_5x4
|
198
|
+
- Decode/Encode ASTC_5x5
|
196
199
|
- Decode GST121 ✔️
|
197
200
|
- Decode GST221 ✔️
|
198
201
|
- Decode GST421 ✔️
|
@@ -156,6 +156,9 @@ or software researchers).
|
|
156
156
|
- Decode/Encode BC5 ✔️
|
157
157
|
- Decode/Encode BC6 ✔️
|
158
158
|
- Decode/Encode BC7 ✔️
|
159
|
+
- Decode/Encode ASTC_4x4
|
160
|
+
- Decode/Encode ASTC_5x4
|
161
|
+
- Decode/Encode ASTC_5x5
|
159
162
|
- Decode GST121 ✔️
|
160
163
|
- Decode GST221 ✔️
|
161
164
|
- Decode GST421 ✔️
|
@@ -1,11 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ReverseBox
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.38.0
|
4
4
|
Summary: A set of functions useful in reverse engineering.
|
5
5
|
Home-page: https://github.com/bartlomiejduda/ReverseBox
|
6
6
|
Author: Bartlomiej Duda
|
7
7
|
Author-email: ikskoks@gmail.com
|
8
|
-
Keywords: ReverseBox,reverse engineering,RE,CRC,Hash,Encryption,Compression,Checksum,Python,image,decode,decoding,RGB,swizzle,swizzling,morton,twiddle,twiddling,texture,UYVY,YUY2,NV21,NV12,RGBA,RGBA8888,RGB565,RGBA8,BGR,grayscale,graphics,color,pixel,convert,converting,YUV,RAW,PSP,PS1,PS2,PS3,PS4,XBOX,X360,gamecube,dreamcast,BC,BC1,BC2,BC3,BC4,BC5,BC6,BC7,DXT1,DXT2,DXT3,PackBits,RLE,Macintosh,Jenkins,murmur,murmur3,one-at-a-time,additive
|
8
|
+
Keywords: ReverseBox,reverse engineering,RE,CRC,Hash,Encryption,Compression,Checksum,Python,image,decode,decoding,RGB,swizzle,swizzling,morton,twiddle,twiddling,texture,UYVY,YUY2,NV21,NV12,RGBA,RGBA8888,RGB565,RGBA8,BGR,grayscale,graphics,color,pixel,convert,converting,YUV,RAW,PSP,PS1,PS2,PS3,PS4,XBOX,X360,gamecube,dreamcast,BC,BC1,BC2,BC3,BC4,BC5,BC6,BC7,DXT1,DXT2,DXT3,PackBits,RLE,Macintosh,Jenkins,murmur,murmur3,one-at-a-time,additive,ASTC,ETC1,ETC2
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
10
10
|
Classifier: Programming Language :: Python :: 3.6
|
11
11
|
Classifier: Programming Language :: Python :: 3.7
|
@@ -193,6 +193,9 @@ or software researchers).
|
|
193
193
|
- Decode/Encode BC5 ✔️
|
194
194
|
- Decode/Encode BC6 ✔️
|
195
195
|
- Decode/Encode BC7 ✔️
|
196
|
+
- Decode/Encode ASTC_4x4
|
197
|
+
- Decode/Encode ASTC_5x4
|
198
|
+
- Decode/Encode ASTC_5x5
|
196
199
|
- Decode GST121 ✔️
|
197
200
|
- Decode GST221 ✔️
|
198
201
|
- Decode GST421 ✔️
|
@@ -82,6 +82,7 @@ reversebox/image/decoders/bumpmap_decoder.py
|
|
82
82
|
reversebox/image/decoders/compressed_decoder_encoder.py
|
83
83
|
reversebox/image/decoders/gst_decoder.py
|
84
84
|
reversebox/image/decoders/n64_decoder.py
|
85
|
+
reversebox/image/decoders/pvrtexlib_decoder_encoder.py
|
85
86
|
reversebox/image/decoders/yuv_decoder.py
|
86
87
|
reversebox/image/encoders/__init__.py
|
87
88
|
reversebox/image/encoders/gst_encoder.py
|
@@ -114,5 +115,9 @@ reversebox/io_files/file_handler.py
|
|
114
115
|
reversebox/io_files/mod_handler.py
|
115
116
|
reversebox/io_files/translation_text_handler.py
|
116
117
|
reversebox/libs/DirectXTex.dll
|
118
|
+
reversebox/libs/PVRTexLib.dll
|
119
|
+
reversebox/libs/TexWrapper.dll
|
117
120
|
reversebox/libs/__init__.py
|
121
|
+
reversebox/libs/crnlib.dll
|
122
|
+
reversebox/libs/ispc_texcomp.dll
|
118
123
|
reversebox/libs/refpack.dll
|
@@ -223,6 +223,10 @@ def get_block_data_size(img_format: ImageFormats) -> int:
|
|
223
223
|
return 1
|
224
224
|
|
225
225
|
|
226
|
+
def get_bc_image_data_size(image_height: int, image_width: int, image_format: ImageFormats) -> int:
|
227
|
+
return ((image_height + 3) // 4) * ((image_width + 3) // 4) * get_block_data_size(image_format)
|
228
|
+
|
229
|
+
|
226
230
|
def calculate_aligned_value(value: int, multiple: int) -> int:
|
227
231
|
return ((value + multiple - 1) // multiple) * multiple
|
228
232
|
|
{reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/decoders/compressed_decoder_encoder.py
RENAMED
@@ -17,6 +17,7 @@ from ctypes import (
|
|
17
17
|
|
18
18
|
from reversebox.common.common import get_dll_path
|
19
19
|
from reversebox.common.logger import get_logger
|
20
|
+
from reversebox.image.common import get_bc_image_data_size
|
20
21
|
from reversebox.image.image_formats import ImageFormats
|
21
22
|
|
22
23
|
logger = get_logger(__name__)
|
@@ -41,7 +42,7 @@ class DXGIImage(Structure):
|
|
41
42
|
|
42
43
|
class CompressedImageDecoderEncoder:
|
43
44
|
"""
|
44
|
-
Decoder for any compressed images like BC1/DXT1, BC2/DXT2 etc.
|
45
|
+
Decoder/Encoder for any compressed images like BC1/DXT1, BC2/DXT2 etc.
|
45
46
|
"""
|
46
47
|
|
47
48
|
def __init__(self):
|
@@ -94,7 +95,7 @@ class CompressedImageDecoderEncoder:
|
|
94
95
|
|
95
96
|
def _convert_directxtex_image(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats, encode_flag: bool) -> bytes:
|
96
97
|
"""
|
97
|
-
Function used for decoding compressed BC formats
|
98
|
+
Function used for decoding/encoding compressed BC formats
|
98
99
|
"""
|
99
100
|
dll_path: str = get_dll_path("DirectXTex.dll")
|
100
101
|
if encode_flag:
|
@@ -147,9 +148,12 @@ class CompressedImageDecoderEncoder:
|
|
147
148
|
if h_result != 0:
|
148
149
|
raise Exception(f"DLL decompression failed! H_result: {h_result}")
|
149
150
|
|
150
|
-
|
151
|
-
|
152
|
-
|
151
|
+
if encode_flag:
|
152
|
+
converted_data_size: int = get_bc_image_data_size(img_height, img_width, image_format)
|
153
|
+
else:
|
154
|
+
converted_data_size: int = img_height * img_width * 4
|
155
|
+
converted_data = bytearray((c_uint8 * converted_data_size).from_address(ctypes.addressof(output_dxgi_image.pixels.contents)))
|
156
|
+
return converted_data
|
153
157
|
|
154
158
|
def decode_compressed_image_main(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats) -> bytes:
|
155
159
|
return self._convert_directxtex_image(image_data, img_width, img_height, image_format, False)
|
@@ -0,0 +1,96 @@
|
|
1
|
+
"""
|
2
|
+
Copyright © 2025 Bartłomiej Duda
|
3
|
+
License: GPL-3.0 License
|
4
|
+
"""
|
5
|
+
|
6
|
+
import ctypes
|
7
|
+
from ctypes import POINTER, c_int, c_uint8, cast, create_string_buffer
|
8
|
+
|
9
|
+
from reversebox.common.common import get_dll_path
|
10
|
+
from reversebox.common.logger import get_logger
|
11
|
+
from reversebox.image.image_formats import ImageFormats
|
12
|
+
|
13
|
+
logger = get_logger(__name__)
|
14
|
+
|
15
|
+
# fmt: off
|
16
|
+
# mypy: ignore-errors
|
17
|
+
|
18
|
+
|
19
|
+
pvrtexlib_format_mapping: dict[ImageFormats, int] = {
|
20
|
+
ImageFormats.RGB565: 7,
|
21
|
+
ImageFormats.ASTC_4x4: 48,
|
22
|
+
ImageFormats.ASTC_5x4: 70,
|
23
|
+
ImageFormats.ASTC_5x5: 49,
|
24
|
+
}
|
25
|
+
|
26
|
+
|
27
|
+
class PvrTexlibImageDecoderEncoder:
|
28
|
+
"""
|
29
|
+
Decoder/Encoder for any compressed images like ASTC, ETC1 etc.
|
30
|
+
"""
|
31
|
+
|
32
|
+
def __init__(self):
|
33
|
+
pass
|
34
|
+
|
35
|
+
def _get_pvrtexlib_format_number(self, image_format: ImageFormats) -> int:
|
36
|
+
"""
|
37
|
+
Mapping ReverseBox formats to PvrTexLib formats
|
38
|
+
"""
|
39
|
+
|
40
|
+
try:
|
41
|
+
return pvrtexlib_format_mapping[image_format]
|
42
|
+
except KeyError:
|
43
|
+
raise Exception(f"Not supported image format! Image_format: {image_format}")
|
44
|
+
|
45
|
+
def _convert_pvrtexlib_image(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats, encode_flag: bool) -> bytes:
|
46
|
+
"""
|
47
|
+
Function used for decoding/encoding compressed PvrTexlib formats
|
48
|
+
"""
|
49
|
+
dll_path: str = get_dll_path("TexWrapper.dll")
|
50
|
+
|
51
|
+
input_format_number: int = self._get_pvrtexlib_format_number(image_format)
|
52
|
+
output_buffer_size: int = img_height * img_width * 4
|
53
|
+
|
54
|
+
c_format_number = c_int(input_format_number)
|
55
|
+
c_image_width = c_int(img_width)
|
56
|
+
c_image_height = c_int(img_height)
|
57
|
+
c_comp_level = c_int(1)
|
58
|
+
|
59
|
+
input_buffer = create_string_buffer(bytes(image_data))
|
60
|
+
c_input_buffer = cast(input_buffer, POINTER(c_uint8)) # buffer with input image data
|
61
|
+
c_output_buffer = (c_uint8 * output_buffer_size)() # empty buffer for output image data
|
62
|
+
|
63
|
+
try:
|
64
|
+
dll_file = ctypes.CDLL(dll_path)
|
65
|
+
|
66
|
+
if encode_flag:
|
67
|
+
output_size: int = dll_file.EncodeByPVRTexLib(
|
68
|
+
c_input_buffer,
|
69
|
+
c_output_buffer,
|
70
|
+
c_format_number,
|
71
|
+
c_comp_level,
|
72
|
+
c_image_width,
|
73
|
+
c_image_height
|
74
|
+
)
|
75
|
+
else:
|
76
|
+
output_size: int = dll_file.DecodeByPVRTexLib(
|
77
|
+
c_input_buffer,
|
78
|
+
c_output_buffer,
|
79
|
+
c_format_number,
|
80
|
+
c_image_width,
|
81
|
+
c_image_height
|
82
|
+
)
|
83
|
+
except Exception as error:
|
84
|
+
raise Exception(f"Error! Error: {error}")
|
85
|
+
|
86
|
+
if output_size == 0:
|
87
|
+
raise Exception("Output texture is empty!")
|
88
|
+
|
89
|
+
converted_data = bytearray((c_uint8 * output_size).from_address(ctypes.addressof(c_output_buffer)))
|
90
|
+
return converted_data
|
91
|
+
|
92
|
+
def decode_compressed_image_main(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats) -> bytes:
|
93
|
+
return self._convert_pvrtexlib_image(image_data, img_width, img_height, image_format, False)
|
94
|
+
|
95
|
+
def encode_compressed_image_main(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats) -> bytes:
|
96
|
+
return self._convert_pvrtexlib_image(image_data, img_width, img_height, image_format, True)
|
@@ -13,6 +13,9 @@ from reversebox.image.decoders.compressed_decoder_encoder import (
|
|
13
13
|
)
|
14
14
|
from reversebox.image.decoders.gst_decoder import GSTImageDecoder
|
15
15
|
from reversebox.image.decoders.n64_decoder import N64Decoder
|
16
|
+
from reversebox.image.decoders.pvrtexlib_decoder_encoder import (
|
17
|
+
PvrTexlibImageDecoderEncoder,
|
18
|
+
)
|
16
19
|
from reversebox.image.decoders.yuv_decoder import YUVDecoder
|
17
20
|
from reversebox.image.image_formats import ImageFormats
|
18
21
|
from reversebox.image.pillow_wrapper import PillowWrapper
|
@@ -796,6 +799,9 @@ class ImageDecoder:
|
|
796
799
|
def decode_compressed_image(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats) -> bytes:
|
797
800
|
return CompressedImageDecoderEncoder().decode_compressed_image_main(image_data, img_width, img_height, image_format)
|
798
801
|
|
802
|
+
def decode_pvrtexlib_image(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats) -> bytes:
|
803
|
+
return PvrTexlibImageDecoderEncoder().decode_compressed_image_main(image_data, img_width, img_height, image_format)
|
804
|
+
|
799
805
|
def decode_gst_image(self, image_data: bytes, palette_data: bytes, img_width: int, img_height: int, image_format: ImageFormats, convert_format: ImageFormats, convert_pal_format: ImageFormats, is_swizzled: bool = True) -> bytes:
|
800
806
|
gst_decoder = GSTImageDecoder()
|
801
807
|
decoded_gst_data: bytes = gst_decoder.decode_gst_image_main(image_data, img_width, img_height, image_format, is_swizzled)
|
@@ -15,6 +15,9 @@ from reversebox.image.common import (
|
|
15
15
|
from reversebox.image.decoders.compressed_decoder_encoder import (
|
16
16
|
CompressedImageDecoderEncoder,
|
17
17
|
)
|
18
|
+
from reversebox.image.decoders.pvrtexlib_decoder_encoder import (
|
19
|
+
PvrTexlibImageDecoderEncoder,
|
20
|
+
)
|
18
21
|
from reversebox.image.image_formats import ImageFormats
|
19
22
|
from reversebox.image.pillow_wrapper import PillowWrapper
|
20
23
|
from reversebox.io_files.bytes_handler import BytesHandler
|
@@ -437,3 +440,6 @@ class ImageEncoder:
|
|
437
440
|
|
438
441
|
def encode_compressed_image(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats) -> bytes:
|
439
442
|
return CompressedImageDecoderEncoder().encode_compressed_image_main(image_data, img_width, img_height, image_format)
|
443
|
+
|
444
|
+
def encode_pvrtexlib_image(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats) -> bytes:
|
445
|
+
return PvrTexlibImageDecoderEncoder().encode_compressed_image_main(image_data, img_width, img_height, image_format)
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -8,7 +8,7 @@ from typing import Final
|
|
8
8
|
|
9
9
|
import setuptools
|
10
10
|
|
11
|
-
VERSION_NUM: Final[str] = "0.
|
11
|
+
VERSION_NUM: Final[str] = "0.38.0"
|
12
12
|
|
13
13
|
|
14
14
|
def get_long_description() -> str:
|
@@ -54,7 +54,7 @@ setuptools.setup(
|
|
54
54
|
"RGB, swizzle, swizzling, morton, twiddle, twiddling, texture, UYVY, YUY2, NV21, NV12, RGBA, RGBA8888, RGB565, RGBA8, BGR, "
|
55
55
|
"grayscale, graphics, color, pixel, convert, converting, YUV, RAW, PSP, PS1, PS2, PS3, PS4, XBOX, X360, gamecube, dreamcast, "
|
56
56
|
"BC, BC1, BC2, BC3, BC4, BC5, BC6, BC7, DXT1, DXT2, DXT3, PackBits, RLE, Macintosh, Jenkins, murmur, murmur3, one-at-a-time, "
|
57
|
-
"additive",
|
57
|
+
"additive, ASTC, ETC1, ETC2",
|
58
58
|
python_requires=">=3.6",
|
59
59
|
install_requires=[
|
60
60
|
"lzokay",
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{reversebox-0.36.0 → reversebox-0.38.0}/reversebox/checksum/checksum_internet_ipv4_header.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{reversebox-0.36.0 → reversebox-0.38.0}/reversebox/compression/compression_re_tiyoruga_dat.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{reversebox-0.36.0 → reversebox-0.38.0}/reversebox/encryption/encryption_xor_basic_key_guesser.py
RENAMED
File without changes
|
{reversebox-0.36.0 → reversebox-0.38.0}/reversebox/encryption/encryption_xor_gianas_return_zda.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/compression/compression_packbits.py
RENAMED
File without changes
|
{reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/compression/compression_rle_executioners.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{reversebox-0.36.0 → reversebox-0.38.0}/reversebox/image/swizzling/swizzle_psvita_dreamcast.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|