Mark of the Ninja *.tex

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
shadow_lonely
Posts: 216
Joined: Mon Oct 06, 2014 3:30 am

Mark of the Ninja *.tex

Post by shadow_lonely »

Hi! Anyone can take and look this archive? Could you write a script to convert .tex to .png and comeback .tex? Here is some information, i found:
first 4 bytes - KTEX.
next 4 bytes - ???
2 bytes - width
2 bytes - height


Image

Example file:
texture.rar
MerlinSVK
Posts: 165
Joined: Wed Aug 13, 2014 10:00 am

Re: Mark of the Ninja *.tex

Post by MerlinSVK »

You can use scripts for Shank 2.

Code: Select all

# Game: Shank 2 (PC)
# TEX to DDS converter
# by MerlinSVK    Feb 2012
# script for QuickBMS    http://aluigi.org/papers.htm#quickbms

set MEMORY_FILE binary "\x44\x44\x53\x20\x7C\x00\x00\x00\x07\x10\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\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\x20\x00\x00\x00\x04\x00\x00\x00\x44\x58\x54\x35\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"
get NAME basename
string DNAME = NAME
string DNAME += ".dds"
string KNAME = NAME
string KNAME += ".ktex"

get ASIZE asize
getdstring KTEX 0x8
get WIDTH short
get HEIGHT short
getDString UNK 0x6        # get that 6 unknown values
log KNAME 0xC 0x6         # save them to .ktex file

math DATASIZE = ASIZE
math DATASIZE -= 0x12     # 0x12 = size of KTEX header
savepos START

putVarChr MEMORY_FILE 0XC HEIGHT short
putVarChr MEMORY_FILE 0x10 WIDTH short

append
log MEMORY_FILE START DATASIZE
append

get DDSSIZE asize MEMORY_FILE
log DNAME 0 DDSSIZE MEMORY_FILE


and

Code: Select all

# Game: Shank 2 (PC)
# DDS to TEX converter
# by MerlinSVK    Feb 2012
# script for QuickBMS    http://aluigi.org/papers.htm#quickbms

set MEMORY_FILE binary "\x4B\x54\x45\x58\x00\x00\x01\x02\xAA\xAA\xBB\xBB\xCC\xCC\xDD\xDD\xEE\xEE"

open FDDE DDS 0
open FDDE KTEX 1

get NAME basename
string NAME = NAME
string NAME += ".tex_NEW"

get ASIZE asize 0
goto 0xC 0
get HEIGHT short 0
get DUMMY short 0
get WIDTH short 0
goto 0x80 0

savepos START 0
math DATASIZE = ASIZE
math DATASIZE -= 0x80     # 0x80 = size of DDS header

putVarChr MEMORY_FILE 0x8 WIDTH short
putVarChr MEMORY_FILE 0xA HEIGHT short
# korekcia
set KOREKCIA short 0x0201
putVarChr MEMORY_FILE 0x6 KOREKCIA short
# korekcia

get UNK1 short 1
get UNK2 short 1
get UNK3 short 1

putVarChr MEMORY_FILE 0xC UNK1 short
putVarChr MEMORY_FILE 0xE UNK2 short
putVarChr MEMORY_FILE 0x10 UNK3 short


append
log MEMORY_FILE START DATASIZE
append


get TEXSIZE asize MEMORY_FILE
log NAME 0 TEXSIZE MEMORY_FILE
shadow_lonely
Posts: 216
Joined: Mon Oct 06, 2014 3:30 am

Re: Mark of the Ninja *.tex

Post by shadow_lonely »

Thanks! Working great!
puggsoy
Posts: 161
Joined: Sat Dec 13, 2014 1:01 am

Re: Mark of the Ninja *.tex

Post by puggsoy »

I'd just like to point out that this also works for Don't Starve. I think this format is used in most Klei Entertainment games.
shadow_lonely
Posts: 216
Joined: Mon Oct 06, 2014 3:30 am

Re: Mark of the Ninja *.tex

Post by shadow_lonely »

puggsoy wrote:I'd just like to point out that this also works for Don't Starve. I think this format is used in most Klei Entertainment games.


You can use Klei Textool, works for Don't Starve.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Mark of the Ninja *.tex

Post by aluigi »

Is the following the official updated modding tool?
https://github.com/kleientertainment/ds_mod_tools

Last commit is 3 days ago so it's updated for sure :)
No binary included so you have to compile it.
shadow_lonely
Posts: 216
Joined: Mon Oct 06, 2014 3:30 am

Re: Mark of the Ninja *.tex

Post by shadow_lonely »

MerlinSVK wrote:You can use scripts for Shank 2.

Code: Select all

# Game: Shank 2 (PC)
# TEX to DDS converter
# by MerlinSVK    Feb 2012
# script for QuickBMS    http://aluigi.org/papers.htm#quickbms

set MEMORY_FILE binary "\x44\x44\x53\x20\x7C\x00\x00\x00\x07\x10\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\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\x20\x00\x00\x00\x04\x00\x00\x00\x44\x58\x54\x35\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"
get NAME basename
string DNAME = NAME
string DNAME += ".dds"
string KNAME = NAME
string KNAME += ".ktex"

get ASIZE asize
getdstring KTEX 0x8
get WIDTH short
get HEIGHT short
getDString UNK 0x6        # get that 6 unknown values
log KNAME 0xC 0x6         # save them to .ktex file

math DATASIZE = ASIZE
math DATASIZE -= 0x12     # 0x12 = size of KTEX header
savepos START

putVarChr MEMORY_FILE 0XC HEIGHT short
putVarChr MEMORY_FILE 0x10 WIDTH short

append
log MEMORY_FILE START DATASIZE
append

get DDSSIZE asize MEMORY_FILE
log DNAME 0 DDSSIZE MEMORY_FILE


and

Code: Select all

# Game: Shank 2 (PC)
# DDS to TEX converter
# by MerlinSVK    Feb 2012
# script for QuickBMS    http://aluigi.org/papers.htm#quickbms

set MEMORY_FILE binary "\x4B\x54\x45\x58\x00\x00\x01\x02\xAA\xAA\xBB\xBB\xCC\xCC\xDD\xDD\xEE\xEE"

open FDDE DDS 0
open FDDE KTEX 1

get NAME basename
string NAME = NAME
string NAME += ".tex_NEW"

get ASIZE asize 0
goto 0xC 0
get HEIGHT short 0
get DUMMY short 0
get WIDTH short 0
goto 0x80 0

savepos START 0
math DATASIZE = ASIZE
math DATASIZE -= 0x80     # 0x80 = size of DDS header

putVarChr MEMORY_FILE 0x8 WIDTH short
putVarChr MEMORY_FILE 0xA HEIGHT short
# korekcia
set KOREKCIA short 0x0201
putVarChr MEMORY_FILE 0x6 KOREKCIA short
# korekcia

get UNK1 short 1
get UNK2 short 1
get UNK3 short 1

putVarChr MEMORY_FILE 0xC UNK1 short
putVarChr MEMORY_FILE 0xE UNK2 short
putVarChr MEMORY_FILE 0x10 UNK3 short


append
log MEMORY_FILE START DATASIZE
append


get TEXSIZE asize MEMORY_FILE
log NAME 0 TEXSIZE MEMORY_FILE


Hi! Could you update for Xbox360? Thanks!
MerlinSVK
Posts: 165
Joined: Wed Aug 13, 2014 10:00 am

Re: Mark of the Ninja *.tex

Post by MerlinSVK »

I can't. I don't know what is the correct texture format. TextureFinder shows nothing usefull.
shadow_lonely
Posts: 216
Joined: Mon Oct 06, 2014 3:30 am

Re: Mark of the Ninja *.tex

Post by shadow_lonely »

MerlinSVK wrote:I can't. I don't know what is the correct texture format. TextureFinder shows nothing usefull.

Thanks for your quick reply.
I think it is correct texture:
courier_0.rar

Maybe Xbox 360 is different.