ReverseBox 0.43.2__tar.gz → 0.44.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.
Files changed (123) hide show
  1. {reversebox-0.43.2 → reversebox-0.44.0}/PKG-INFO +2 -1
  2. {reversebox-0.43.2 → reversebox-0.44.0}/README.md +1 -0
  3. {reversebox-0.43.2 → reversebox-0.44.0}/ReverseBox.egg-info/PKG-INFO +2 -1
  4. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/image_encoder.py +28 -7
  5. {reversebox-0.43.2 → reversebox-0.44.0}/setup.py +1 -1
  6. {reversebox-0.43.2 → reversebox-0.44.0}/LICENSE +0 -0
  7. {reversebox-0.43.2 → reversebox-0.44.0}/ReverseBox.egg-info/SOURCES.txt +0 -0
  8. {reversebox-0.43.2 → reversebox-0.44.0}/ReverseBox.egg-info/dependency_links.txt +0 -0
  9. {reversebox-0.43.2 → reversebox-0.44.0}/ReverseBox.egg-info/requires.txt +0 -0
  10. {reversebox-0.43.2 → reversebox-0.44.0}/ReverseBox.egg-info/top_level.txt +0 -0
  11. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/__init__.py +0 -0
  12. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/checksum/__init__.py +0 -0
  13. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/checksum/checksum_adler32.py +0 -0
  14. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/checksum/checksum_cocos2d_pvr.py +0 -0
  15. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/checksum/checksum_fletcher16.py +0 -0
  16. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/checksum/checksum_fletcher32.py +0 -0
  17. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/checksum/checksum_internet_ipv4_header.py +0 -0
  18. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/checksum/checksum_sum8.py +0 -0
  19. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/checksum/checksum_sum8_2s_complement.py +0 -0
  20. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/checksum/checksum_unix_sum_bsd16.py +0 -0
  21. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/checksum/checksum_unix_sum_sysv.py +0 -0
  22. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/checksum/checksum_xor8.py +0 -0
  23. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/common/__init__.py +0 -0
  24. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/common/common.py +0 -0
  25. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/common/logger.py +0 -0
  26. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/common/numpy_helper_functions.py +0 -0
  27. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/compression/__init__.py +0 -0
  28. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/compression/compression_jcalg1.py +0 -0
  29. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/compression/compression_lzo.py +0 -0
  30. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/compression/compression_mio0.py +0 -0
  31. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/compression/compression_re_tiyoruga_dat.py +0 -0
  32. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/compression/compression_refpack.py +0 -0
  33. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/compression/compression_zlib.py +0 -0
  34. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/__init__.py +0 -0
  35. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc16_arc.py +0 -0
  36. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc16_ccitt.py +0 -0
  37. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc16_dnp.py +0 -0
  38. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc16_ea_crcf.py +0 -0
  39. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc16_kermit.py +0 -0
  40. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc16_modbus.py +0 -0
  41. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc16_sick.py +0 -0
  42. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc32_asobo.py +0 -0
  43. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc32_iso_hdlc.py +0 -0
  44. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc64_asobo.py +0 -0
  45. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc64_go_iso.py +0 -0
  46. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc8.py +0 -0
  47. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/crc/crc_unix_cksum.py +0 -0
  48. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/encryption/__init__.py +0 -0
  49. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/encryption/encryption_hatch_engine.py +0 -0
  50. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/encryption/encryption_rot13.py +0 -0
  51. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/encryption/encryption_xor_basic.py +0 -0
  52. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/encryption/encryption_xor_basic_key_guesser.py +0 -0
  53. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/encryption/encryption_xor_gianas_return_zda.py +0 -0
  54. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/encryption/encryption_xor_retro64_eco.py +0 -0
  55. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/__init__.py +0 -0
  56. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/hash_additive.py +0 -0
  57. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/hash_ap.py +0 -0
  58. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/hash_djb2.py +0 -0
  59. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/hash_fnv.py +0 -0
  60. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/hash_jenkins_one_at_a_time.py +0 -0
  61. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/hash_md2.py +0 -0
  62. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/hash_md5.py +0 -0
  63. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/hash_murmur3.py +0 -0
  64. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/hash_pivotal_games_dat.py +0 -0
  65. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/hash_sdbm.py +0 -0
  66. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/hash_sha1.py +0 -0
  67. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/hash/hash_sha2.py +0 -0
  68. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/__init__.py +0 -0
  69. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/byte_swap.py +0 -0
  70. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/common.py +0 -0
  71. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/compression/__init__.py +0 -0
  72. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/compression/compression_gst.py +0 -0
  73. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/compression/compression_lzw.py +0 -0
  74. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/compression/compression_packbits.py +0 -0
  75. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/compression/compression_rle_executioners.py +0 -0
  76. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/compression/compression_rle_tga.py +0 -0
  77. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/compression/compression_zlib.py +0 -0
  78. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/decoders/__init__.py +0 -0
  79. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/decoders/bumpmap_decoder.py +0 -0
  80. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/decoders/compressed_decoder_encoder.py +0 -0
  81. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/decoders/gst_decoder.py +0 -0
  82. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/decoders/n64_decoder.py +0 -0
  83. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/decoders/pvrtexlib_decoder_encoder.py +0 -0
  84. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/decoders/yuv_decoder.py +0 -0
  85. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/encoders/__init__.py +0 -0
  86. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/encoders/gst_encoder.py +0 -0
  87. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/file_formats/__init__.py +0 -0
  88. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/file_formats/image_dds.py +0 -0
  89. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/image_decoder.py +0 -0
  90. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/image_formats.py +0 -0
  91. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/palettes/__init__.py +0 -0
  92. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/palettes/palette_random.py +0 -0
  93. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/palettes/palette_vga.py +0 -0
  94. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/pillow_wrapper.py +0 -0
  95. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/__init__.py +0 -0
  96. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_3ds.py +0 -0
  97. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_bc.py +0 -0
  98. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_cmpr.py +0 -0
  99. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_gamecube.py +0 -0
  100. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_gst.py +0 -0
  101. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_morton.py +0 -0
  102. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_morton_ps4.py +0 -0
  103. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_ps2.py +0 -0
  104. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_ps2_4bit.py +0 -0
  105. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_ps2_suba.py +0 -0
  106. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_psp.py +0 -0
  107. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_psvita_dreamcast.py +0 -0
  108. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_switch.py +0 -0
  109. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_wii_u.py +0 -0
  110. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/image/swizzling/swizzle_x360.py +0 -0
  111. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/io_files/__init__.py +0 -0
  112. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/io_files/bytes_handler.py +0 -0
  113. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/io_files/bytes_helper_functions.py +0 -0
  114. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/io_files/check_file.py +0 -0
  115. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/io_files/file_handler.py +0 -0
  116. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/io_files/mod_handler.py +0 -0
  117. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/io_files/translation_text_handler.py +0 -0
  118. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/libs/DirectXTex.dll +0 -0
  119. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/libs/PVRTexLib.dll +0 -0
  120. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/libs/PVRTexLibWrapper.dll +0 -0
  121. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/libs/__init__.py +0 -0
  122. {reversebox-0.43.2 → reversebox-0.44.0}/reversebox/libs/refpack.dll +0 -0
  123. {reversebox-0.43.2 → reversebox-0.44.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ReverseBox
3
- Version: 0.43.2
3
+ Version: 0.44.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
@@ -296,6 +296,7 @@ or software researchers).
296
296
  - RLE TGA compression ✔️
297
297
  - PackBits (Macintosh RLE) compression ✔️
298
298
  - Executioners RLE compression ✔️
299
+ - Generating mipmaps ✔️
299
300
 
300
301
  * IO
301
302
  - File Reader ✔️
@@ -259,6 +259,7 @@ or software researchers).
259
259
  - RLE TGA compression ✔️
260
260
  - PackBits (Macintosh RLE) compression ✔️
261
261
  - Executioners RLE compression ✔️
262
+ - Generating mipmaps ✔️
262
263
 
263
264
  * IO
264
265
  - File Reader ✔️
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ReverseBox
3
- Version: 0.43.2
3
+ Version: 0.44.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
@@ -296,6 +296,7 @@ or software researchers).
296
296
  - RLE TGA compression ✔️
297
297
  - PackBits (Macintosh RLE) compression ✔️
298
298
  - Executioners RLE compression ✔️
299
+ - Generating mipmaps ✔️
299
300
 
300
301
  * IO
301
302
  - File Reader ✔️
@@ -282,7 +282,7 @@ class ImageEncoder:
282
282
  raise Exception("Wrong endianess!")
283
283
  return endianess_format
284
284
 
285
- def _encode_generic(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats, image_endianess: str) -> bytes:
285
+ def _encode_generic_image(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats, image_endianess: str) -> bytes:
286
286
  encode_function, bits_per_pixel, _, _ = self.generic_data_formats[image_format]
287
287
  image_handler = BytesHandler(image_data)
288
288
  source_image_bytes_per_pixel = 4 # always 4 for RGBA8888
@@ -323,8 +323,29 @@ class ImageEncoder:
323
323
 
324
324
  return texture_data
325
325
 
326
+ def _encode_generic(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats, image_endianess: str, number_of_mipmaps: int) -> bytes:
327
+ # main image logic
328
+ encoded_texture_data: bytes = self._encode_generic_image(image_data, img_width, img_height, image_format, image_endianess)
329
+
330
+ # mipmaps logic
331
+ if number_of_mipmaps > 0:
332
+ base_img: Image = PillowWrapper().get_pillow_image_from_rgba8888_data(
333
+ image_data, img_width, img_height
334
+ )
335
+ mip_width: int = img_width
336
+ mip_height: int = img_height
337
+ for i in range(number_of_mipmaps):
338
+ mip_width //= 2
339
+ mip_height //= 2
340
+ mip_pillow_img: Image = base_img.resize((mip_width, mip_height))
341
+ mip_rgba_data: bytes = PillowWrapper().get_image_data_from_pillow_image(mip_pillow_img)
342
+ encoded_mipmap_data: bytes = self._encode_generic_image(mip_rgba_data, mip_width, mip_height, image_format, image_endianess)
343
+ encoded_texture_data += encoded_mipmap_data
344
+
345
+ return encoded_texture_data
346
+
326
347
  def _encode_indexed(self, image_data: bytes, img_width: int,
327
- img_height: int, image_format: ImageFormats, palette_format: ImageFormats, image_endianess: str, palette_endianess: str, max_colors_count: int) -> Tuple[bytes, bytes]:
348
+ img_height: int, image_format: ImageFormats, palette_format: ImageFormats, image_endianess: str, palette_endianess: str, max_colors_count: int, number_of_mipmaps: int) -> Tuple[bytes, bytes]:
328
349
  encode_function, palette_bpp, read_function, write_function = self.generic_data_formats[palette_format]
329
350
  image_bpp: int = get_bpp_for_image_format(image_format)
330
351
  palette_bpp: int = get_bpp_for_image_format(palette_format)
@@ -356,7 +377,7 @@ class ImageEncoder:
356
377
  image_data = pillow_img.tobytes()
357
378
 
358
379
  # encode to intermediate image (e.g. RGBA8888 -> RGB565)
359
- encoded_intermediate_image: bytes = self._encode_generic(image_data, img_width, img_height, palette_format, image_endianess)
380
+ encoded_intermediate_image: bytes = self._encode_generic(image_data, img_width, img_height, palette_format, image_endianess, 0)
360
381
 
361
382
  # get pixels from intermediate image
362
383
  pixel_int_values: list[int] = []
@@ -432,11 +453,11 @@ class ImageEncoder:
432
453
 
433
454
  return texture_data, palette_data
434
455
 
435
- def encode_image(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats, image_endianess: str = "little") -> bytes:
436
- return self._encode_generic(image_data, img_width, img_height, image_format, image_endianess)
456
+ def encode_image(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats, image_endianess: str = "little", number_of_mipmaps: int = 0) -> bytes:
457
+ return self._encode_generic(image_data, img_width, img_height, image_format, image_endianess, number_of_mipmaps)
437
458
 
438
- def encode_indexed_image(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats, palette_format: ImageFormats, max_color_count: int, image_endianess: str = "little", palette_endianess: str = "little") -> Tuple[bytes, bytes]:
439
- return self._encode_indexed(image_data, img_width, img_height, image_format, palette_format, image_endianess, palette_endianess, max_color_count)
459
+ def encode_indexed_image(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats, palette_format: ImageFormats, max_color_count: int, image_endianess: str = "little", palette_endianess: str = "little", number_of_mipmaps: int = 0) -> Tuple[bytes, bytes]:
460
+ return self._encode_indexed(image_data, img_width, img_height, image_format, palette_format, image_endianess, palette_endianess, max_color_count, number_of_mipmaps)
440
461
 
441
462
  def encode_compressed_image(self, image_data: bytes, img_width: int, img_height: int, image_format: ImageFormats) -> bytes:
442
463
  return CompressedImageDecoderEncoder().encode_compressed_image_main(image_data, img_width, img_height, image_format)
@@ -8,7 +8,7 @@ from typing import Final
8
8
 
9
9
  import setuptools
10
10
 
11
- VERSION_NUM: Final[str] = "0.43.2"
11
+ VERSION_NUM: Final[str] = "0.44.0"
12
12
 
13
13
 
14
14
  def get_long_description() -> str:
File without changes
File without changes