Skip to content

Commit d64e1f7

Browse files
Merge pull request #16 from xcoder-tool/dev
feat(KTX): support for KTX file format and special texture tag
2 parents e5966cf + db359ee commit d64e1f7

26 files changed

+300
-56
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
/updates/
77
/logs/
88
/CSV/
9+
/TEX/
910
/SC/
1011

1112
# Configuration files
1213
system/config.json
1314

1415
# Python compiled files
1516
*.pyc
17+
18+
# PVRTexToolCLI
19+
PVRTexToolCLI*

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
rev: 22.12.0
1313
hooks:
1414
- id: black
15-
language_version: python3.10
15+
language_version: python3.11
1616
- repo: https://github.com/charliermarsh/ruff-pre-commit
1717
rev: 'v0.0.261'
1818
hooks:

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ Work with Supercell\`s files on **any** os! SC and CSV are supported for all Sup
3232
- Install loguru using pip;
3333
- In PyDroid open and execute "main.py" file.
3434

35+
### How to enable KTX section
36+
37+
![KTX section demo](docs/KTX section.png)
38+
39+
**Supercell also uses KTX textures in new versions of the games, so it is advisable to perform this step.**
40+
41+
To enable the KTX module, you need to get the "PVRTexToolCLI" binary from the official site: https://developer.imaginationtech.com/pvrtextool/.
42+
43+
Then it is necessary to put CLI in "system/bin/" folder in the main script folder.
44+
3545
### In the plans:
3646
- CSV updating.
3747

docs/KTX section.png

5.53 KB
Loading

system/exceptions/__init__.py

Whitespace-only changes.

system/exceptions/tool_not_found.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ToolNotFoundException(Exception):
2+
pass

system/languages/en-EU.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
"decompress_csv_description": "Decompresses spreadsheet file",
3535
"compress_csv_description": "Compresses spreadsheet file",
3636

37+
"ktx_label": "KTX",
38+
"ktx_from_png_label": "PNG2KTX",
39+
"png_from_ktx_label": "KTX2PNG",
40+
"ktx_from_png_description": "Converts PNG to KTX",
41+
"png_from_ktx_description": "Converts KTX to PNG",
42+
3743
"other_features_label": "OTHER",
3844
"check_update": "Check for updates",
3945
"check_for_outdated": "Check for outdated packages",

system/languages/ru-RU.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
"decompress_csv_description": "Разжимает файл таблиц",
3535
"compress_csv_description": "Сжимает файл таблиц",
3636

37+
"ktx_label": "KTX",
38+
"ktx_from_png_label": "PNG2KTX",
39+
"png_from_ktx_label": "KTX2PNG",
40+
"ktx_from_png_description": "Конвертирует PNG в KTX",
41+
"png_from_ktx_description": "Конвертирует KTX в PNG",
42+
3743
"other_features_label": "ПРОЧЕЕ",
3844
"check_update": "Проверить обновления",
3945
"check_for_outdated": "Проверка устаревших модулей",

system/languages/ua-UA.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
"decompress_csv_description": "Розпакувати файл таблиці",
3535
"compress_csv_description": "Запакувати файл таблиці",
3636

37+
"ktx_label": "KTX",
38+
"ktx_from_png_label": "PNG2KTX",
39+
"png_from_ktx_label": "KTX2PNG",
40+
"ktx_from_png_description": "Конвертує PNG у KTX",
41+
"png_from_ktx_description": "Конвертує KTX у PNG",
42+
3743
"other_features_label": "ІНШЕ",
3844
"check_update": "Шукати оновлення",
3945
"check_for_outdated": "Шукати застарілі пакети",

system/lib/__init__.py

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ def check_files_updated():
6060
def refill_menu():
6161
menu.categories.clear()
6262

63+
sc_category = Menu.Category(0, locale.sc_label)
64+
ktx_category = Menu.Category(1, locale.ktx_label)
65+
csv_category = Menu.Category(2, locale.csv_label)
66+
other = Menu.Category(10, locale.other_features_label)
67+
68+
menu.add_category(sc_category)
69+
menu.add_category(ktx_category)
70+
menu.add_category(csv_category)
71+
menu.add_category(other)
72+
6373
try:
6474
import sc_compression
6575

@@ -86,7 +96,6 @@ def refill_menu():
8696
encode_textures_only,
8797
)
8898

89-
sc_category = Menu.Category(0, locale.sc_label)
9099
sc_category.add(
91100
Menu.Item(
92101
name=locale.decode_sc,
@@ -122,9 +131,29 @@ def refill_menu():
122131
handler=lambda: collect_objects_and_encode(True),
123132
)
124133
)
125-
menu.add_category(sc_category)
126134

127-
csv_category = Menu.Category(1, locale.csv_label)
135+
from system.lib.features.ktx import (
136+
convert_ktx_textures_to_png,
137+
convert_png_textures_to_ktx,
138+
)
139+
from system.lib.pvr_tex_tool import can_use_pvr_tex_tool
140+
141+
if can_use_pvr_tex_tool():
142+
ktx_category.add(
143+
Menu.Item(
144+
name=locale.ktx_from_png_label,
145+
description=locale.ktx_from_png_description,
146+
handler=convert_png_textures_to_ktx,
147+
)
148+
)
149+
ktx_category.add(
150+
Menu.Item(
151+
name=locale.png_from_ktx_label,
152+
description=locale.png_from_ktx_description,
153+
handler=convert_ktx_textures_to_png,
154+
)
155+
)
156+
128157
csv_category.add(
129158
Menu.Item(
130159
name=locale.decompress_csv,
@@ -139,9 +168,7 @@ def refill_menu():
139168
handler=compress_csv,
140169
)
141170
)
142-
menu.add_category(csv_category)
143171

144-
other = Menu.Category(10, locale.other_features_label)
145172
other.add(
146173
Menu.Item(
147174
name=locale.check_update,
@@ -181,4 +208,3 @@ def refill_menu():
181208
)
182209
)
183210
other.add(Menu.Item(name=locale.exit, handler=lambda: (clear(), exit())))
184-
menu.add_category(other)

0 commit comments

Comments
 (0)