Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

154 changes: 0 additions & 154 deletions .gitignore

This file was deleted.

23 changes: 21 additions & 2 deletions export_import.py → Lib/export_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,27 @@
import os
from binary_reader import BinaryReader
from cv2 import exp
from tkinter import Tk, messagebox


apti_tex_magic = bytes.fromhex('6D 32 F3 C3')
DDS_Header = b'DDS |\x00\x00\x00\x07\x10\x08\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x01\x00\x00\x00GIMP-DDS\\\t\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x04\x00\x00\x00DXT5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
apti_tex_header = b'm2\xf3\xc3\xd1\x9ce\xe9\x9a\xbc\x0f\r"\xdb\xdaO\x00Q5!k\xc7\xd8\x01;\x00\x04\x007\x00\x00\x00\x04\x00\x04\x00\x0c\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9a\xbc\x0f\r"\xdb\xdaO\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x04\x00\xc5\x04\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1d\x02\x00\x00\x00\x00\xff\x00'
zeros = b'\x00'*4

def notify(msg):
root = Tk()
root.withdraw()
messagebox.showinfo("Info", msg)
root.destroy()

def error(msg):
root = Tk()
root.withdraw()
messagebox.showerror("Error", msg)
root.destroy()


def export_command(file_path, dirname):
try:
file_name = os.path.basename(file_path)
Expand All @@ -26,14 +41,16 @@ def export_command(file_path, dirname):
out_file.write(DDS_Header + dosya)
out_file.seek(-4, io.SEEK_END)
out_file.truncate()
notify("Done!")
return 'Done!'
except:
error('Something went wrong.')
return 'Something went wrong.'

def import_command(file_path, dirname):
try:
file_name = os.path.basename(file_path)
outputfile = dirname + '\\' + file_name[:-4] + '.APTI_TEX'
outputfile = dirname + '\\' + file_name[:-4] + '.apti_tex_NEW'
file_stats = os.stat(file_path)
f = open(file_path, "rb")

Expand All @@ -54,6 +71,8 @@ def import_command(file_path, dirname):
size_dosya = reader_for_dds.size()

out_file.write(apti_tex_header + reader_for_dds.read_bytes(size_dosya) + zeros)
notify("Done!")
return 'Done!'
except:
return 'Something went wrong'
error('Something went wrong.')
return 'Something went wrong.'
6 changes: 3 additions & 3 deletions ui.py → Lib/ui.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import tkinter as tk
import tkinter.font as tkFont
from tkinter import filedialog
import export_import
from Lib import export_import

class App:

def __init__(self, root):
#setting title
root.title("undefined")
root.title("apti_tex Tool")
#setting window size
width=600
height=500
Expand Down Expand Up @@ -49,7 +49,7 @@ def __init__(self, root):
import_button["font"] = ft
import_button["fg"] = "#000000"
import_button["justify"] = "center"
import_button["text"] = "Import"
import_button["text"] = "Import!"
import_button.place(x=380,y=160,width=160,height=53)
import_button["command"] = self.import_button_command

Expand Down
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,32 @@ You need to edit this DDS or at least make sure to convert it through GIMP "BC3/
Other compression support will add soon.

After your editing is done, you can use the Import button to import your DDS file to the *.apti_tex file. Simple enough.

# apti_tex Tool

A lightweight GUI utility for exporting and importing `*.apti_tex` texture files.
The tool converts `*.apti_tex` files into `*.DDS` (BC3/DXT5) for editing in applications such as GIMP, and then repacks edited DDS files back into the apti_tex format.

## Features
- Export `.apti_tex` files to `.DDS`
- Supports editing DDS files in BC3/DXT5 format
- Import edited `.DDS` files back into `.apti_tex`
- Simple Tkinter-based interface
- Error and status notifications via message boxes

## How It Works
- **Export:** Reads the custom header, extracts raw texture data, and builds a valid DDS output file.
- **Import:** Validates the DDS header, rebuilds the apti_tex structure, and writes a new `.apti_tex_NEW` file.

## Requirements
- Python 3.x
- `binary-reader`
- `tkinter`
- `opencv-python`

## Usage
Run the main script:
**python apti_texTool.py**


Then use the GUI buttons to export or import textures.
7 changes: 7 additions & 0 deletions apti_texTool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from Lib import ui

try:
if __name__ == "__main__":
ui()
except Exception as e:
pass
4 changes: 0 additions & 4 deletions main.py

This file was deleted.