ifstools 2.1__tar.gz → 2.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.
Files changed (27) hide show
  1. {ifstools-2.1 → ifstools-2.2}/PKG-INFO +7 -5
  2. {ifstools-2.1 → ifstools-2.2}/README.md +6 -4
  3. {ifstools-2.1 → ifstools-2.2}/pyproject.toml +1 -1
  4. {ifstools-2.1 → ifstools-2.2}/src/ifstools/handlers/generic_file.py +7 -1
  5. {ifstools-2.1 → ifstools-2.2}/src/ifstools/handlers/md5_folder.py +12 -2
  6. {ifstools-2.1 → ifstools-2.2}/.github/workflows/maturin.yml +0 -0
  7. {ifstools-2.1 → ifstools-2.2}/.gitignore +0 -0
  8. {ifstools-2.1 → ifstools-2.2}/Cargo.lock +0 -0
  9. {ifstools-2.1 → ifstools-2.2}/Cargo.toml +0 -0
  10. {ifstools-2.1 → ifstools-2.2}/LICENSE +0 -0
  11. {ifstools-2.1 → ifstools-2.2}/ifstools_bin.py +0 -0
  12. {ifstools-2.1 → ifstools-2.2}/rust/dxt.rs +0 -0
  13. {ifstools-2.1 → ifstools-2.2}/rust/lib.rs +0 -0
  14. {ifstools-2.1 → ifstools-2.2}/rust/lz77.rs +0 -0
  15. {ifstools-2.1 → ifstools-2.2}/rust/png_enc.rs +0 -0
  16. {ifstools-2.1 → ifstools-2.2}/src/ifstools/__init__.py +0 -0
  17. {ifstools-2.1 → ifstools-2.2}/src/ifstools/handlers/_lz77_py.py +0 -0
  18. {ifstools-2.1 → ifstools-2.2}/src/ifstools/handlers/afp_folder.py +0 -0
  19. {ifstools-2.1 → ifstools-2.2}/src/ifstools/handlers/generic_folder.py +0 -0
  20. {ifstools-2.1 → ifstools-2.2}/src/ifstools/handlers/image_decoders.py +0 -0
  21. {ifstools-2.1 → ifstools-2.2}/src/ifstools/handlers/image_file.py +0 -0
  22. {ifstools-2.1 → ifstools-2.2}/src/ifstools/handlers/lz77.py +0 -0
  23. {ifstools-2.1 → ifstools-2.2}/src/ifstools/handlers/node.py +0 -0
  24. {ifstools-2.1 → ifstools-2.2}/src/ifstools/handlers/tex_folder.py +0 -0
  25. {ifstools-2.1 → ifstools-2.2}/src/ifstools/ifs.py +0 -0
  26. {ifstools-2.1 → ifstools-2.2}/src/ifstools/ifstools.py +0 -0
  27. {ifstools-2.1 → ifstools-2.2}/src/ifstools/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ifstools
3
- Version: 2.1
3
+ Version: 2.2
4
4
  Requires-Dist: kbinxml>=1.5
5
5
  Requires-Dist: lxml
6
6
  Requires-Dist: pillow
@@ -79,12 +79,14 @@ optional arguments:
79
79
  ```
80
80
 
81
81
  ## Build an exe
82
- `pip install pyinstaller`
83
- `pyinstaller ifstools_bin.py --onefile -n ifstools`
84
- Recommend doing this in a fresh venv so the module finder doesn't include more than required.
82
+ ```shell
83
+ uv venv --clear
84
+ uv pip install . pyinstaller==6.19.0
85
+ uv run pyinstaller --onefile --name ifstools ifstools_bin.py
86
+ ```
85
87
 
86
88
  Notes:
87
- - dxt5 texture repacking is not fully supported - they will silently be converted to argb8888rev
89
+ - argb8888rev and dxt5 can be repacked. Other formats will silently be converted to argb8888rev
88
90
 
89
91
  Todo:
90
92
  - Recursive repacking for ifs inside ifs
@@ -65,12 +65,14 @@ optional arguments:
65
65
  ```
66
66
 
67
67
  ## Build an exe
68
- `pip install pyinstaller`
69
- `pyinstaller ifstools_bin.py --onefile -n ifstools`
70
- Recommend doing this in a fresh venv so the module finder doesn't include more than required.
68
+ ```shell
69
+ uv venv --clear
70
+ uv pip install . pyinstaller==6.19.0
71
+ uv run pyinstaller --onefile --name ifstools ifstools_bin.py
72
+ ```
71
73
 
72
74
  Notes:
73
- - dxt5 texture repacking is not fully supported - they will silently be converted to argb8888rev
75
+ - argb8888rev and dxt5 can be repacked. Other formats will silently be converted to argb8888rev
74
76
 
75
77
  Todo:
76
78
  - Recursive repacking for ifs inside ifs
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "ifstools"
7
- version = "2.1"
7
+ version = "2.2"
8
8
  description = "Extractor/repacker for Konmai IFS files"
9
9
  readme = "README.md"
10
10
  authors = [
@@ -2,6 +2,7 @@ import os
2
2
 
3
3
  import lxml.etree as etree
4
4
  from kbinxml import KBinXML
5
+ from kbinxml.kbinxml import KBinException
5
6
 
6
7
  from .. import utils
7
8
  from .node import Node
@@ -37,7 +38,12 @@ class GenericFile(Node):
37
38
  data = self.ifs_data.get(self.start, self.size)
38
39
 
39
40
  if convert_kbin and self.name.endswith('.xml') and KBinXML.is_binary_xml(data):
40
- data = KBinXML(data).to_text().encode('utf8')
41
+ try:
42
+ data = KBinXML(data).to_text().encode('utf8')
43
+ except KBinException as e:
44
+ if 'convert_illegal_things' in e.args[0]:
45
+ print("Corrupt xml found, trying to decode as utf8")
46
+ data = KBinXML(data, convert_illegal_things=True).to_text().encode('utf8')
41
47
  return data
42
48
 
43
49
  def _load_from_filesystem(self, **kwargs):
@@ -1,6 +1,7 @@
1
1
  from hashlib import md5
2
2
 
3
3
  from kbinxml import KBinXML
4
+ from kbinxml.kbinxml import KBinException
4
5
 
5
6
  from .generic_folder import GenericFolder
6
7
 
@@ -20,6 +21,7 @@ class MD5Folder(GenericFolder):
20
21
 
21
22
  self.info_kbin = None
22
23
  self.info_file = None
24
+ self.encoding_override = None
23
25
  for filename, file in self.files.items():
24
26
  if filename.endswith('.xml'):
25
27
  self.info_file = file
@@ -29,7 +31,15 @@ class MD5Folder(GenericFolder):
29
31
  # _super_ references to info XML breaks things - just extract what we can
30
32
  return
31
33
 
32
- self.info_kbin = KBinXML(self.info_file.load(convert_kbin = False))
34
+ kbin_raw = self.info_file.load(convert_kbin = False)
35
+ try:
36
+ self.info_kbin = KBinXML(kbin_raw)
37
+ except KBinException as e:
38
+ if 'convert_illegal_things' in e.args[0]:
39
+ print("Corrupt texturelist xml found, trying to decode as utf8")
40
+ self.info_kbin = KBinXML(kbin_raw, convert_illegal_things=True)
41
+ self.encoding_override = 'utf8'
42
+
33
43
  self._apply_md5()
34
44
 
35
45
  def _apply_md5(self):
@@ -39,7 +49,7 @@ class MD5Folder(GenericFolder):
39
49
 
40
50
  def _apply_md5_folder(self, plain_list, folder):
41
51
  for plain in plain_list:
42
- hashed = md5(plain.encode(self.info_kbin.encoding)).hexdigest()
52
+ hashed = md5(plain.encode(self.encoding_override or self.info_kbin.encoding)).hexdigest()
43
53
 
44
54
  if self.extension:
45
55
  plain += self.extension
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