XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Wed Feb 21, 2018 8:47 pm

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: DTX1 g1t format for kaizoku musou3
PostPosted: Sun Jun 26, 2016 7:33 pm 
Offline
advanced

Joined: Fri Nov 21, 2014 12:21 pm
Posts: 70
Has thanked: 17 times
Have thanks: 7 times














You can make the ads go away by registering

Hi, I edit a bms script for PC version of this game. It can convert *.g1t to dds(DTX5) but has problem for DTX1. Can someone fix it?

Code:
idstring GT1G0600
set MEMORY_FILE binary "\x44\x44\x53\x20\x7C\x00\x00\x00\x07\x10\x08\x00\x80\x00\x00\x00\x80\x00\x00\x00\x00\x20\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\x31\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 dataSize long
get dataOffset long
get texCount long
goto dataOffset
savepos OFFTABLE

set NUM 0
for i = 0 < texCount
math NUM + 1
get NAME BASENAME
string NAME + "_"
string NAME += NUM
string NAME + ".dds"
goto OFFTABLE

set JUMP 0
get JUMP long

savepos OFFTABLE
math JUMP + dataOffset
goto JUMP
get ukn4 byte
get texC byte
get texD byte
get NULL byte

set set1 texD
set set2 texD

math set1 & 0xF0
print "%set1% 1st set1"
math set1 / 16
print "%set1% 2nd set1"
math set2 & 0x0F

if set1 == 0
get unk5 long
else
get unk5 long
get unk6 long
get unk7 long
get unk8 long
endif
savepos OFFSET

set texH 2
set texW 2
Math texW p set1
Math texH p set2

putVarChr MEMORY_FILE 0x0C texH short
putVarChr MEMORY_FILE 0x10 texW short

if texC == 0x01
print "{0x01} ARGB32 Found!"
set bbp 32
math MAGIC = texW
math MAGIC * texH
math MAGIC / 0x4
math MAGIC * 0x10
putVarChr MEMORY_FILE 0x14 MAGIC long
putVarChr MEMORY_FILE 0x50 0x41 long
putVarChr MEMORY_FILE 0x54 0x00 byte
putVarChr MEMORY_FILE 0x55 0x00 byte
putVarChr MEMORY_FILE 0x56 0x00 byte
putVarChr MEMORY_FILE 0x57 0x00 byte
putVarChr MEMORY_FILE 0x58 0x20 long
putVarChr MEMORY_FILE 0x5E 0xFF Short
putVarChr MEMORY_FILE 0x61 0xFF Short
putVarChr MEMORY_FILE 0x64 0xFF Short
putVarChr MEMORY_FILE 0x6B 0xFF Short
endif
if texC == 0x06
print "{0x06} DXT1 Found!"
set bbp 4
math MAGIC = texW
math MAGIC * texH
math MAGIC / 0x2
putVarChr MEMORY_FILE 0x14 MAGIC long
putVarChr MEMORY_FILE 0x50 0x41 long
putVarChr MEMORY_FILE 0x54 0x44 byte
putVarChr MEMORY_FILE 0x55 0x58 byte
putVarChr MEMORY_FILE 0x56 0x54 byte
putVarChr MEMORY_FILE 0x57 0x31 byte
putVarChr MEMORY_FILE 0x58 0x00 long
putVarChr MEMORY_FILE 0x5E 0x00 Short
putVarChr MEMORY_FILE 0x61 0x00 Short
putVarChr MEMORY_FILE 0x64 0x00 Short
putVarChr MEMORY_FILE 0x6B 0x00 Short
endif
if texC == 0x08
print "{0x08} DXT5 Found!"
set bbp 8
math MAGIC = texW
math MAGIC * texH
putVarChr MEMORY_FILE 0x14 MAGIC long
putVarChr MEMORY_FILE 0x50 0x04 long
putVarChr MEMORY_FILE 0x54 0x44 byte
putVarChr MEMORY_FILE 0x55 0x58 byte
putVarChr MEMORY_FILE 0x56 0x54 byte
putVarChr MEMORY_FILE 0x57 0x35 byte
putVarChr MEMORY_FILE 0x58 0x00 long
putVarChr MEMORY_FILE 0x5E 0x00 Short
putVarChr MEMORY_FILE 0x61 0x00 Short
putVarChr MEMORY_FILE 0x64 0x00 Short
putVarChr MEMORY_FILE 0x6B 0x00 Short
endif
set SIZE texH
math SIZE * texW
math bbp / 8
math SIZE * bbp
log NAME 0 0x80 MEMORY_FILE
append
log NAME OFFSET SIZE
append
next i


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: DTX1 g1t format for kaizoku musou 3
PostPosted: Sun Jun 26, 2016 11:25 pm 
Offline
VIP member
VIP member

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1020
Has thanked: 2026 times
Have thanks: 541 times
I don't know much about QuickBMS but i made a Noesis script to open both of your samples :D
*script removed*
see this post for proper Noesis python script
viewtopic.php?p=123534#p123534

i couldn't figure out where or how the width and height is stored in your samples but luckily they were both 512x512
if you can share more samples of various size i might be able to update the script :scaredy:

_________________
Noesis
Hex2obj
QuickBMS
TextureFinder
Unity Assets Bundle Extractor


Last edited by AceWell on Sun Oct 16, 2016 12:43 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: DTX1 g1t format for kaizoku musou 3
PostPosted: Mon Jun 27, 2016 12:55 am 
Offline
advanced

Joined: Fri Nov 21, 2014 12:21 pm
Posts: 70
Has thanked: 17 times
Have thanks: 7 times
AceWell wrote:
I don't know much about QuickBMS but i made a Noesis script to open both of your samples :D

i couldn't figure out where or how the width and height is stored in your samples but luckily they were both 512x512
if you can share more samples of various size i might be able to update the script :scaredy:


Unfortunately, quickbms script is the thing for me.


Top
 Profile  
 
 Post subject: Re: DTX1 g1t format for kaizoku musou3
PostPosted: Mon Jun 27, 2016 3:37 am 
Offline
advanced

Joined: Fri Nov 21, 2014 12:21 pm
Posts: 70
Has thanked: 17 times
Have thanks: 7 times
Well.. I solve it.

Code:
idstring GT1G0600
set MEMORY_FILE binary "\x44\x44\x53\x20\x7C\x00\x00\x00\x07\x10\x08\x00\x80\x00\x00\x00\x80\x00\x00\x00\x00\x20\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\x31\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 dataSize long
get dataOffset long
get texCount long
goto dataOffset
savepos OFFTABLE

set NUM 0
for i = 0 < texCount
math NUM + 1
get NAME BASENAME
string NAME + "_"
string NAME += NUM
string NAME + ".dds"
goto OFFTABLE

set JUMP 0
get JUMP long

savepos OFFTABLE
math JUMP + dataOffset
goto JUMP
get ukn4 byte   #0x10
get texC byte   #0x06
get texD byte   #0x99
get NULL byte

set set1 texD   #0x99
set set2 texD   #0x99

math set1 & 0xF0   #0x99 to 0x90 = 144
print "%set1% 1st set1"
math set1 / 16      #144 / 16 = 9
print "%set1% 2nd set1"
math set2 & 0x0F   #0x99 to 0x09 = 9

get unk5 longlong
get unk6 longlong
savepos OFFSET

set texH 2
set texW 2
Math texW p set1   #2^9 = 512
Math texH p set2   #2^9 = 512

putVarChr MEMORY_FILE 0x0C texH short
putVarChr MEMORY_FILE 0x10 texW short

if texC == 0x06
print "{0x06} DXT1 Found!"
set bbp 4
math MAGIC = texW
math MAGIC * texH
putVarChr MEMORY_FILE 0x14 MAGIC long
putVarChr MEMORY_FILE 0x50 0x04 long
putVarChr MEMORY_FILE 0x54 0x44 byte
putVarChr MEMORY_FILE 0x55 0x58 byte
putVarChr MEMORY_FILE 0x56 0x54 byte
putVarChr MEMORY_FILE 0x57 0x31 byte
putVarChr MEMORY_FILE 0x58 0x00 long
putVarChr MEMORY_FILE 0x5E 0x00 Short
putVarChr MEMORY_FILE 0x61 0x00 Short
putVarChr MEMORY_FILE 0x64 0x00 Short
putVarChr MEMORY_FILE 0x6B 0x00 Short
endif

if texC == 0x08
print "{0x08} DXT5 Found!"
set bbp 8
math MAGIC = texW
math MAGIC * texH
putVarChr MEMORY_FILE 0x14 MAGIC long
putVarChr MEMORY_FILE 0x50 0x04 long
putVarChr MEMORY_FILE 0x54 0x44 byte
putVarChr MEMORY_FILE 0x55 0x58 byte
putVarChr MEMORY_FILE 0x56 0x54 byte
putVarChr MEMORY_FILE 0x57 0x35 byte
putVarChr MEMORY_FILE 0x58 0x00 long
putVarChr MEMORY_FILE 0x5E 0x00 Short
putVarChr MEMORY_FILE 0x61 0x00 Short
putVarChr MEMORY_FILE 0x64 0x00 Short
putVarChr MEMORY_FILE 0x6B 0x00 Short
endif

set SIZE texH      #0x200 = 512
math SIZE * texW   #SIZE = 0x200 * 0x200 = 0x40000
math SIZE / 8
math SIZE * bbp

log NAME 0 0x80 MEMORY_FILE
append
log NAME OFFSET SIZE
append
next i


Top
 Profile  
 
 Post subject: g1t format for Pirate Warriors 3
PostPosted: Mon Jun 27, 2016 11:13 am 
Offline
VIP member
VIP member

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1020
Has thanked: 2026 times
Have thanks: 541 times
adol365 wrote:
Unfortunately, quickbms script is the thing for me.
adol365 wrote:
Well.. I solve it.

great! i would still like to try completing the script though, can you please upload more samples? :D

edit
i am lost in your bms script at these parts
Code:
set set1 texD   #0x99
set set2 texD   #0x99

math set1 & 0xF0   #0x99 to 0x90 = 144
math set1 / 16      #144 / 16 = 9
math set2 & 0x0F   #0x99 to 0x09 = 9

.....

set texH 2
set texW 2
Math texW p set1   #2^9 = 512
Math texH p set2   #2^9 = 512

how did you know to set set1 and set2 to 0x99?
how did you know to change set1 to 0x90 and where did you get that value from?
and where did you get 0xF0 from?
where did you get the 16 from?
how did you know to change set2 to 0x09 and where did you get that value from?
and where did you get 0x0F from?

are you using a known formula and if so where can i learn more about it? :D

_________________
Noesis
Hex2obj
QuickBMS
TextureFinder
Unity Assets Bundle Extractor


Top
 Profile  
 
 Post subject: Re: DTX1 g1t format for kaizoku musou3
PostPosted: Mon Jun 27, 2016 5:58 pm 
Offline
Moderator
User avatar

Joined: Sun May 18, 2008 3:01 pm
Posts: 2450
Has thanked: 56 times
Have thanks: 1204 times
That's my old bms script i made for the dynasty warriors format games.
They store their width and height in the same format as the xbox 360 sdk.
you can look at it here
viewtopic.php?f=18&t=8102
Microsoft did this for fun and to limit the max width and height to 4096 x 4096 on the 360.
Its just raising them to their correct powers 1 , 2 ,4 ,8 , 16 ext till it gets to the correct width and height.


Top
 Profile  
 
 Post subject: Re: DTX1 g1t format for kaizoku musou3
PostPosted: Tue Jun 28, 2016 12:25 am 
Offline
advanced

Joined: Fri Nov 21, 2014 12:21 pm
Posts: 70
Has thanked: 17 times
Have thanks: 7 times
Here is the sample files which include ARGB32, DTX1, and DTX5.
https://drive.google.com/file/d/0B8JGJb-FRy_baTR3bzlBOUl4aVk/view?usp=sharing

And the modified quickbms script for PC version. One can understand this code using hex editor.

Code:
idstring GT1G0600
set MEMORY_FILE binary "\x44\x44\x53\x20\x7C\x00\x00\x00\x07\x10\x08\x00\x80\x00\x00\x00\x80\x00\x00\x00\x00\x20\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\x31\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 dataSize long
get dataOffset long
get texCount long
goto dataOffset
savepos OFFTABLE

set NUM 0
for i = 0 < texCount
math NUM + 1
get NAME BASENAME
string NAME + "_"
string NAME += NUM
string NAME + ".dds"
goto OFFTABLE

set JUMP 0
get JUMP long

savepos OFFTABLE
math JUMP + dataOffset
goto JUMP
get ukn4 byte   #0x10
get texC byte   #0x06
get texD byte   #0x99
get NULL byte

set set1 texD   #0x99
set set2 texD   #0x99

math set1 & 0xF0   #0x99 to 0x90 = 144
print "%set1% 1st set1"
math set1 / 16      #144 / 16 = 9
print "%set1% 2nd set1"
math set2 & 0x0F   #0x99 to 0x09 = 9

get unk5 longlong
get unk6 longlong
savepos OFFSET

set texH 2
set texW 2
Math texW p set2   #2^9 = 512
Math texH p set1   #2^9 = 512

putVarChr MEMORY_FILE 0x10 texW short
putVarChr MEMORY_FILE 0x0C texH short

if texC == 0x01
print "{0x01} ARGB32 Found!"
set bbp 32
math MAGIC = texW
math MAGIC * texH
math MAGIC / 4
math MAGIC * 16
putVarChr MEMORY_FILE 0x14 MAGIC long
putVarChr MEMORY_FILE 0x50 0x41 long
putVarChr MEMORY_FILE 0x54 0x00 byte
putVarChr MEMORY_FILE 0x55 0x00 byte
putVarChr MEMORY_FILE 0x56 0x00 byte
putVarChr MEMORY_FILE 0x57 0x00 byte
putVarChr MEMORY_FILE 0x58 0x20 long
putVarChr MEMORY_FILE 0x5E 0xFF Short
putVarChr MEMORY_FILE 0x61 0xFF Short
putVarChr MEMORY_FILE 0x64 0xFF Short
putVarChr MEMORY_FILE 0x6B 0xFF Short
endif
if texC == 0x06
print "{0x06} DXT1 Found!"
set bbp 4
math MAGIC = texW
math MAGIC * texH
math MAGIC / 2
putVarChr MEMORY_FILE 0x14 MAGIC long
putVarChr MEMORY_FILE 0x50 0x04 long
putVarChr MEMORY_FILE 0x54 0x44 byte
putVarChr MEMORY_FILE 0x55 0x58 byte
putVarChr MEMORY_FILE 0x56 0x54 byte
putVarChr MEMORY_FILE 0x57 0x31 byte
putVarChr MEMORY_FILE 0x58 0x00 long
putVarChr MEMORY_FILE 0x5E 0x00 Short
putVarChr MEMORY_FILE 0x61 0x00 Short
putVarChr MEMORY_FILE 0x64 0x00 Short
putVarChr MEMORY_FILE 0x6B 0x00 Short
endif

if texC == 0x08
print "{0x08} DXT5 Found!"
set bbp 8
math MAGIC = texW
math MAGIC * texH
putVarChr MEMORY_FILE 0x14 MAGIC long
putVarChr MEMORY_FILE 0x50 0x04 long
putVarChr MEMORY_FILE 0x54 0x44 byte
putVarChr MEMORY_FILE 0x55 0x58 byte
putVarChr MEMORY_FILE 0x56 0x54 byte
putVarChr MEMORY_FILE 0x57 0x35 byte
putVarChr MEMORY_FILE 0x58 0x00 long
putVarChr MEMORY_FILE 0x5E 0x00 Short
putVarChr MEMORY_FILE 0x61 0x00 Short
putVarChr MEMORY_FILE 0x64 0x00 Short
putVarChr MEMORY_FILE 0x6B 0x00 Short
endif

set SIZE texH      #0x200 = 512
math SIZE * texW   #SIZE = 0x200 * 0x200 = 0x40000
math SIZE / 8
math SIZE * bbp

log NAME 0 0x80 MEMORY_FILE
append
log NAME OFFSET SIZE
append
next i


Top
 Profile  
 
 Post subject: Re: DTX1 g1t format for kaizoku musou3
PostPosted: Tue Jun 28, 2016 9:18 am 
Offline
VIP member
VIP member

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1020
Has thanked: 2026 times
Have thanks: 541 times
adol365 wrote:
Here is the sample files which include ARGB32, DTX1, and DTX5.
.....
And the modified quickbms script for PC version. One can understand this code using hex editor.

Right and thanks for the samples, i guess my questions are mainly about the "and" bitwise operation
because this is the first time i ever encountered a need for it and now i want to understand it a little. :D

0x99 = 0xFF
0xF0 = 0x90 = 144 dec
0x0F = 0x09 = 9 dec

Quote:
math set1 / 16

i still don't get where the 16 comes from, does that represent 16 bits?

_________________
Noesis
Hex2obj
QuickBMS
TextureFinder
Unity Assets Bundle Extractor


Top
 Profile  
 
 Post subject: Re: DTX1 g1t format for kaizoku musou3
PostPosted: Wed Jun 29, 2016 2:48 am 
Offline
Moderator
User avatar

Joined: Sun May 18, 2008 3:01 pm
Posts: 2450
Has thanked: 56 times
Have thanks: 1204 times
he divided by 16 to shift the position.
f5 = 0xF0 + 0x5
he wanted 0xF so he divided by 16
another more common way would be bit.shift


Top
 Profile  
 
 Post subject: Re: DTX1 g1t format for kaizoku musou3
PostPosted: Sat Oct 15, 2016 7:44 am 
Offline
VIP member
VIP member

Joined: Wed Nov 05, 2008 12:16 pm
Posts: 1020
Has thanked: 2026 times
Have thanks: 541 times
adol365 wrote:
Here is the sample files which include ARGB32, DTX1, and DTX5.
https://drive.google.com/file/d/0B8JGJb-FRy_baTR3bzlBOUl4aVk/view?usp=sharing


finally got around to finishing this Noesis python script that will open all of your samples :D


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
Noesis
Hex2obj
QuickBMS
TextureFinder
Unity Assets Bundle Extractor


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group