Post
by Zerovisibilite » Sun Dec 05, 2010 2:40 pm
Basiclly if you look at the last couple bytes of the tex file , it will tell you the length and width. then i just took a raw dds file and copied the header from that to the top of the text file. You can leave all the info in the tex file as most if not all will look at the header to decide how long the file is and not the file itself. Then change the Length and width values in the new header to the values that were stored in the bottem.
here is the actual code for the vb stuff i was doing
This is in a seperate module but i am including it so yoiu can see the data structures
Type Texture_MK_HeaderInfo
MK_Header As String * 4
MK_Width As Integer
MK_Height As Integer
MK_Unknown1 As Integer
MK_Mips As Byte
'Start Pixel Info at 54
End Type
Type DDS_DXT1_HeaderInfo
ddsMiscHeader(1 To 12) As Byte
ddsWidth As Long
ddsHeight As Long
ddsHolder1 As Byte
ddsHolder2 As Long
ddsHolder3 As Byte
ddsHolder4 As Integer
ddsMipMap As Integer
ddsHolder6 As Byte
ddsFin(96) As Byte
End Type
This is the begining of the meat and potato code that does the copy and paste
Dim DDS_Info As DDS_DXT1_HeaderInfo
Dim MK_info As Texture_MK_HeaderInfo
Dim MKPixels() As Byte
ddsFilename = App.Path & "\DXT1Header.hex"
Open ddsFilename For Binary As #1
Get #1, 1, DDS_Info
Close #1
file_length = FileLen(TextureFilename)
ReDim MKPixels(1 To file_length)
Open TextureFilename For Binary As #1
Get #1, file_length - 47, MK_info '1 33960'2 '287959
'Get #1, 220885, PSKFAce '1 33960'2 '287959
Get #1, 1, MKPixels
Close #1
test0 = UBound(MKPixels)
Test1 = MK_info.MK_Header
Test2 = MK_info.MK_Width
Test3 = MK_info.MK_Height
Test4 = MK_info.MK_Unknown1
Test5 = MK_info.MK_Mips
Test8 = DDS_Info.ddsHeight
Test9 = DDS_Info.ddsWidth
Test10 = DDS_Info.ddsMipMap
DDS_Info.ddsHeight = MK_info.MK_Height
DDS_Info.ddsWidth = MK_info.MK_Width
DDS_Info.ddsMipMap = MK_info.MK_Mips
Open OutputDDSFilename For Binary As #1
Put #1, 1, DDS_Info '1 33960'2 '287959
Put #1, , MKPixels
Close #1
Based on the code i used it looks like the information in the tex file is 48 bytes before the end of the file
I can take a look at revamping is project a little but I wouldn't hold your breath on how long it will be. I am really swamped at work