ReverseBox 0.35.1__tar.gz → 0.35.2__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.35.1 → reversebox-0.35.2}/PKG-INFO +1 -1
- {reversebox-0.35.1 → reversebox-0.35.2}/ReverseBox.egg-info/PKG-INFO +1 -1
- {reversebox-0.35.1 → reversebox-0.35.2}/ReverseBox.egg-info/SOURCES.txt +1 -0
- reversebox-0.35.2/reversebox/image/byte_swap.py +71 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_x360.py +5 -14
- {reversebox-0.35.1 → reversebox-0.35.2}/setup.py +1 -1
- {reversebox-0.35.1 → reversebox-0.35.2}/LICENSE +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/README.md +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/ReverseBox.egg-info/dependency_links.txt +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/ReverseBox.egg-info/requires.txt +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/ReverseBox.egg-info/top_level.txt +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/checksum/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/checksum/checksum_adler32.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/checksum/checksum_cocos2d_pvr.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/checksum/checksum_fletcher16.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/checksum/checksum_fletcher32.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/checksum/checksum_internet_ipv4_header.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/checksum/checksum_sum8.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/checksum/checksum_sum8_2s_complement.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/checksum/checksum_unix_sum_bsd16.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/checksum/checksum_unix_sum_sysv.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/checksum/checksum_xor8.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/common/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/common/common.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/common/logger.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/common/numpy_helper_functions.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/compression/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/compression/compression_jcalg1.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/compression/compression_lzo.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/compression/compression_mio0.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/compression/compression_re_tiyoruga_dat.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/compression/compression_refpack.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/compression/compression_zlib.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc16_arc.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc16_ccitt.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc16_dnp.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc16_ea_crcf.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc16_kermit.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc16_modbus.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc16_sick.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc32_asobo.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc32_iso_hdlc.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc64_asobo.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc64_go_iso.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc8.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/crc/crc_unix_cksum.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/encryption/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/encryption/encryption_hatch_engine.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/encryption/encryption_rot13.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/encryption/encryption_xor_basic.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/encryption/encryption_xor_basic_key_guesser.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/encryption/encryption_xor_gianas_return_zda.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/encryption/encryption_xor_retro64_eco.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/hash_additive.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/hash_ap.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/hash_djb2.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/hash_fnv.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/hash_jenkins_one_at_a_time.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/hash_md2.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/hash_md5.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/hash_murmur3.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/hash_pivotal_games_dat.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/hash_sdbm.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/hash_sha1.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/hash/hash_sha2.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/common.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/compression/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/compression/compression_gst.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/compression/compression_lzw.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/compression/compression_packbits.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/compression/compression_rle_executioners.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/compression/compression_rle_tga.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/compression/compression_zlib.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/decoders/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/decoders/bumpmap_decoder.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/decoders/compressed_decoder.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/decoders/gst_decoder.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/decoders/n64_decoder.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/decoders/yuv_decoder.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/encoders/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/encoders/gst_encoder.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/file_formats/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/file_formats/image_dds.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/image_decoder.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/image_encoder.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/image_formats.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/palettes/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/palettes/palette_random.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/palettes/palette_vga.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/pillow_wrapper.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_3ds.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_bc.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_cmpr.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_gamecube.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_gst.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_morton.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_morton_ps4.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_ps2.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_ps2_4bit.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_ps2_suba.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_psp.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_psvita_dreamcast.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_switch.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/image/swizzling/swizzle_wii_u.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/io_files/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/io_files/bytes_handler.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/io_files/bytes_helper_functions.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/io_files/check_file.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/io_files/file_handler.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/io_files/mod_handler.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/io_files/translation_text_handler.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/libs/DirectXTex.dll +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/libs/__init__.py +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/reversebox/libs/refpack.dll +0 -0
- {reversebox-0.35.1 → reversebox-0.35.2}/setup.cfg +0 -0
@@ -0,0 +1,71 @@
|
|
1
|
+
"""
|
2
|
+
Copyright © 2025 Bartłomiej Duda
|
3
|
+
License: GPL-3.0 License
|
4
|
+
"""
|
5
|
+
|
6
|
+
# fmt: off
|
7
|
+
|
8
|
+
# Byte swapping functions
|
9
|
+
|
10
|
+
|
11
|
+
def swap_byte_order_x360(image_data: bytes) -> bytes:
|
12
|
+
if len(image_data) % 2 != 0:
|
13
|
+
raise Exception("Data size must be a multiple of 2 bytes!")
|
14
|
+
|
15
|
+
swapped_data: bytearray = bytearray()
|
16
|
+
for i in range(0, len(image_data), 2):
|
17
|
+
group = image_data[i: i + 2]
|
18
|
+
swapped_data.extend(group[::-1])
|
19
|
+
return swapped_data
|
20
|
+
|
21
|
+
|
22
|
+
def swap_byte_order_gamecube(image_data: bytes, img_width: int, img_height: int) -> bytes:
|
23
|
+
if len(image_data) % 8 != 0:
|
24
|
+
raise ValueError("The data must be a multiple of 8 bytes (the size of one BC block)")
|
25
|
+
|
26
|
+
bw: int = img_width // 4
|
27
|
+
bh: int = img_height // 4
|
28
|
+
block_size: int = 8
|
29
|
+
tile_w: int = bw // 2
|
30
|
+
tile_h: int = bh // 2
|
31
|
+
tile_index: int = 0
|
32
|
+
|
33
|
+
swapped_data: bytearray = bytearray(len(image_data))
|
34
|
+
|
35
|
+
for ty in range(tile_h):
|
36
|
+
for tx in range(tile_w):
|
37
|
+
for by in range(2):
|
38
|
+
for bx in range(2):
|
39
|
+
# Calculate destination position
|
40
|
+
dst_x = tx * 2 + bx
|
41
|
+
dst_y = ty * 2 + by
|
42
|
+
dst_index = (dst_y * bw + dst_x) * block_size
|
43
|
+
|
44
|
+
# Get source block and convert endianness
|
45
|
+
src_index = tile_index * block_size
|
46
|
+
block = image_data[src_index:src_index + block_size]
|
47
|
+
|
48
|
+
# Convert GameCube DXT1 to little-endian DXT1
|
49
|
+
# Swap color0 and color1 endianness
|
50
|
+
color0 = (block[0] << 8) | block[1]
|
51
|
+
color1 = (block[2] << 8) | block[3]
|
52
|
+
|
53
|
+
# Reorder 2-bit indices (bit reversal within each byte)
|
54
|
+
indices = bytearray(4)
|
55
|
+
for i in range(4):
|
56
|
+
b = block[4 + i]
|
57
|
+
indices[i] = ((b & 0b00000011) << 6) | \
|
58
|
+
((b & 0b00001100) << 2) | \
|
59
|
+
((b & 0b00110000) >> 2) | \
|
60
|
+
((b & 0b11000000) >> 6)
|
61
|
+
|
62
|
+
# Write converted block to output
|
63
|
+
swapped_data[dst_index] = color0 & 0xff
|
64
|
+
swapped_data[dst_index + 1] = color0 >> 8
|
65
|
+
swapped_data[dst_index + 2] = color1 & 0xff
|
66
|
+
swapped_data[dst_index + 3] = color1 >> 8
|
67
|
+
swapped_data[dst_index + 4:dst_index + 8] = indices
|
68
|
+
|
69
|
+
tile_index += 1
|
70
|
+
|
71
|
+
return bytes(swapped_data)
|
@@ -1,24 +1,15 @@
|
|
1
1
|
"""
|
2
|
-
Copyright © 2024 Bartłomiej Duda
|
2
|
+
Copyright © 2024-2025 Bartłomiej Duda
|
3
3
|
License: GPL-3.0 License
|
4
4
|
"""
|
5
5
|
|
6
|
+
from reversebox.image.byte_swap import swap_byte_order_x360
|
7
|
+
|
6
8
|
# Xbox 360 Texture Swizzling
|
7
9
|
|
8
10
|
# fmt: off
|
9
11
|
|
10
12
|
|
11
|
-
def _swap_byte_order(image_data: bytes) -> bytes:
|
12
|
-
if len(image_data) % 2 != 0:
|
13
|
-
raise Exception("Data size must be a multiple of 2 bytes!")
|
14
|
-
|
15
|
-
swapped_data: bytearray = bytearray()
|
16
|
-
for i in range(0, len(image_data), 2):
|
17
|
-
group = image_data[i: i + 2]
|
18
|
-
swapped_data.extend(group[::-1])
|
19
|
-
return swapped_data
|
20
|
-
|
21
|
-
|
22
13
|
def _xg_address_2d_tiled_x(block_offset: int, width_in_blocks: int, texel_byte_pitch: int) -> int:
|
23
14
|
aligned_width: int = (width_in_blocks + 31) & ~31
|
24
15
|
log_bpp: int = (texel_byte_pitch >> 2) + ((texel_byte_pitch >> 1) >> (texel_byte_pitch >> 2))
|
@@ -74,12 +65,12 @@ def _convert_x360_image_data(image_data: bytes, image_width: int, image_height:
|
|
74
65
|
|
75
66
|
|
76
67
|
def unswizzle_x360(image_data: bytes, img_width: int, img_height: int, block_pixel_size: int = 4, texel_byte_pitch: int = 8) -> bytes:
|
77
|
-
swapped_data: bytes =
|
68
|
+
swapped_data: bytes = swap_byte_order_x360(image_data)
|
78
69
|
unswizzled_data: bytes = _convert_x360_image_data(swapped_data, img_width, img_height, block_pixel_size, texel_byte_pitch, False)
|
79
70
|
return unswizzled_data
|
80
71
|
|
81
72
|
|
82
73
|
def swizzle_x360(image_data: bytes, img_width: int, img_height: int, block_pixel_size: int = 4, texel_byte_pitch: int = 8) -> bytes:
|
83
|
-
swapped_data: bytes =
|
74
|
+
swapped_data: bytes = swap_byte_order_x360(image_data)
|
84
75
|
swizzled_data: bytes = _convert_x360_image_data(swapped_data, img_width, img_height, block_pixel_size, texel_byte_pitch, True)
|
85
76
|
return swizzled_data
|
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.35.1 → reversebox-0.35.2}/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.35.1 → reversebox-0.35.2}/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.35.1 → reversebox-0.35.2}/reversebox/encryption/encryption_xor_basic_key_guesser.py
RENAMED
File without changes
|
{reversebox-0.35.1 → reversebox-0.35.2}/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.35.1 → reversebox-0.35.2}/reversebox/image/compression/compression_packbits.py
RENAMED
File without changes
|
{reversebox-0.35.1 → reversebox-0.35.2}/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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{reversebox-0.35.1 → reversebox-0.35.2}/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
|