Quantcast

Jump to content

» «
Photo

[REL] ViceTXD Update

94 replies to this topic
Spooky
  • Spooky

    Prince of the Yolkfolk

  • Members
  • Joined: 13 Jan 2002

#31

Posted 14 September 2003 - 07:48 PM

I've updated it and it's available at the same url...

Download: Setup.exe (491kb)

steve-m
  • steve-m

  • Members
  • Joined: 26 Jul 2002

#32

Posted 14 September 2003 - 08:43 PM Edited by ST.MU, 14 September 2003 - 09:22 PM.

QUOTE (Spooky @ Sep 14 2003, 21:13)
I think you're refering to the 3rd dword, which Delfi informed me is the "gametype"... with "268697599" being ViceCity.

No, first dword is section type, second section size and third the version id of the renderware file. TXD files have the same basic format as DFF files and consist of sections with different purpose. See KCows dff documentation for more infos. Every section has a 12 byte section header, containing type, size and ver id.
The version id is
0x0800FFFF for GTA3,
0x0C02FFFF for VC PS2 and
0x1003FFFF for VC PC
(in the most cases).

The (usual) txd format looks like this:
CODE
(22) Texture Dictionary
|
+-+ (1) Data
| |--> Number of Textures (dword)
|
+-+ (21) Texture No. 1
| |-+ (1) Data
| | |--> (all the texture information and the image itself)
| |
| +-- (3) Extension (always empty - size=0) --> MISSING
|
+-+ (21) Texture No. 2
|†|-- ... (same as above)
|
+-+ (21) Texture No. 3
††|-- ...

(The number in brackets stands for the section type - dword)

QUOTE (Spooky @ Sep 14 2003, 21:13)
- The flags are in the dword right after the alpha name.

These are just the alpha flags and (hopefully) depend on the image type:
CODE
8bit without alpha: 9728
8bit with alpha: 9472

32bit without alpha: 1536
32bit with alpha: 1280

DXT1 without alpha: 512
DXT1 with alpha: 256
DXT3 with alpha: 768

(Just the second byte of the dword changes, that's why all values are divisible by 256)

So does anyone know, what the dword flag between constant dword 8 and texture name means? Although it could be different for every single texture, it is always the same within the whole TXD AFAIK.
Both flag and ver id can be changed in my TXD Builder (see options), if anyone likes to test.

Anything unclear? tounge2.gif

[EDIT] Spooky, although leaving out the empty extension section isn't wrong and using the wrong section size doesn't seem to cause an error, most of the old TXD editors, viewers and installers only know the "standard" format and won't get along with other formats, even if they are theoretically correct.

[EDIT 2] Sorry for filling your topic with this crap, haven't seen Delfi started a new one.

Steve

Spooky
  • Spooky

    Prince of the Yolkfolk

  • Members
  • Joined: 13 Jan 2002

#33

Posted 14 September 2003 - 09:21 PM

QUOTE (ST.MU @ Sep 14 2003, 20:43)
QUOTE (Spooky @ Sep 14 2003, 21:13)
I think you're refering to the 3rd dword, which Delfi informed me is the "gametype"... with "268697599" being ViceCity.

No, first dword is section type, second section size and third the version id of the renderware file.
I know, but you said when adding new textures/creating a new txd it had a high number where the size should be, but because of the bug, it was never high, it was always 4... which is why I thought you were mistaken smile.gif .

QUOTE (ST.MU @ Sep 14 2003, 20:43)
The (usual) txd format looks like this:
CODE
(22) Texture Dictionary
+-+ (1) Data
| |-- Number of Textures (dword)
|
+-+ (21) Texture No. 1
| |-+ (1) Data
| | |-- (all the texture information and the image itself)
| |
| +-- (3) Extension (always empty - size=0) --> MISSING
|
+-+ (21) Texture No. 2
| †|-- ... (same as above)
|
+-+ (21) Texture No. 3
† †|-- ...
If the extension section is empty/missing in every texture, how do you know it exists?

QUOTE (ST.MU @ Sep 14 2003, 20:43)
QUOTE (Spooky @ Sep 14 2003, 21:13)
- The flags are in the dword right after the alpha name.

These are just the alpha flags and (hopefully) depend on the image type:
CODE
8bit without alpha: 9728
8bit with alpha: 9472

32bit without alpha: 1536
32bit with alpha: 1280

DXT1 without alpha: 512
DXT1 with alpha: 256
DXT3 with alpha: 768

(Just the second byte of the dword changes, that's why all values are divisible by 256)
I thought the same but some textures stray from this key... for example some player/npc skins are DXT1 without alpha and the flags are 33280... which led me to believe it's 16 individual 1-bit flags.

QUOTE (ST.MU @ Sep 14 2003, 20:43)
So does anyone know, what the dword flag between constant dword 8 and texture name means?
I didn't know this, but Delfi told me it's todo with the texture pixel format...
CODE
special: Longword; † † † † † † † // 4354= 16bit
† † † † † † † † † † † † † † † † // 4358= 8bpp
† † † † † † † † † † † † † † † † // 4354= 32bpp

steve-m
  • steve-m

  • Members
  • Joined: 26 Jul 2002

#34

Posted 14 September 2003 - 09:52 PM

QUOTE (Spooky @ Sep 14 2003, 23:21)
I know, but you said when adding new textures/creating a new txd it had a high number where the size should be, but because of the bug, it was never high, it was always 4... which is why I thought you were mistaken smile.gif .
It's like that: The number was very high (4294967288), when you look at it as dword/cardinal/whatever (+). But when you look at it as integer (+/-) it is -8, that means you took the 4 and subtracted the 12 byte headersize, so it became negative! Both of us are right! smile.gif

QUOTE (Spooky @ Sep 14 2003, 23:21)
If the extension section is empty/missing in every texture, how do you know it exists?
The extension section is empty because the 12 byte section header is there, saying the section has a size of 0 byte, so it contains no data/other sections. And the missing was related to YOUR txd file, because there isn't even this section header.
This is a section header:
CODE
type TSectionHeader = record
 sectype,  // A number defining the type of section
 size,  // The size of the section, the 12 byte of this header not included
 verID: cardinal;  // The file format version ID, the same for every header in one file
end;
So when I write "(22) Texture Dictionary", it means "This is a 12 byte header with sectype=22".
In txd files only data sections contain data, the others contain other sections again, as you can see in my graph.

QUOTE (Spooky @ Sep 14 2003, 23:21)
I didn't know this, but Delfi told me it's todo with the texture pixel format...
CODE
special: Longword; † † † † † † † // 4354= 16bit
† † † † † † † † † † † † † † † † // 4358= 8bpp
† † † † † † † † † † † † † † † † // 4354= 32bpp
This can't be right, because this flag is usually the same for every texture in one txd archive, and these can be different formats of course. We still need to find out the sense of this.

Steve

Spooky
  • Spooky

    Prince of the Yolkfolk

  • Members
  • Joined: 13 Jan 2002

#35

Posted 15 September 2003 - 04:19 AM

ViceTXD updated! - 1.5b biggrin.gif

I've re-wrote alot of the code as well as general fixes/additions, expect a few bugs :s.

Download: Setup.exe (491kb)

---

Steve, I've sorted the extension section wink.gif .

JernejL
  • JernejL

    Big Homie

  • Feroci Racing
  • Joined: 11 Mar 2002

#36

Posted 15 September 2003 - 10:20 AM

come on you two!
go to the new txd format discussions topic about this sh*t!
and spooky - moderator, move these last tech posts there ok?

Spooky
  • Spooky

    Prince of the Yolkfolk

  • Members
  • Joined: 13 Jan 2002

#37

Posted 15 September 2003 - 02:28 PM

I can only move whole threads, not posts :s. I'll just order everyone to move there! tounge.gif

ZanderZ
  • ZanderZ

    GTA modder & tool writer

  • Members
  • Joined: 08 Sep 2002

#38

Posted 16 September 2003 - 08:57 AM

I just downloaded the CitroŽn 2CV at www.philsfiles.de and I opened the huge txd file in ViceTXD. There were only 3 8bit textures, of max. size 128x128. Yet the txd file was over 1 mb!
Then I opened the txd in TXD Workshop and I could see there were 8 more 512x512 textures!
How come ViceTXD doesn't show these?

Spooky
  • Spooky

    Prince of the Yolkfolk

  • Members
  • Joined: 13 Jan 2002

#39

Posted 16 September 2003 - 12:15 PM

The texture count in the main file header must be screwed... ViceTXD scans through the file for textures untill it reaches <texture count>, then it exits the function.

I've updated ViceTXD just for you wink.gif , it'll now read all textures and let you know about the error, and also let you fix it if you want to.

Download: Setup.exe (491kb)

steve-m
  • steve-m

  • Members
  • Joined: 26 Jul 2002

#40

Posted 16 September 2003 - 02:40 PM

The txd could have been made with TXD Gold, because I guess there was a bug that doesn't "physically" delete textures, just changes the number in the header.

ZanderZ
  • ZanderZ

    GTA modder & tool writer

  • Members
  • Joined: 08 Sep 2002

#41

Posted 16 September 2003 - 02:49 PM Edited by ZanderZ, 16 September 2003 - 02:51 PM.

QUOTE (Spooky @ Sep 16 2003, 13:15)
The texture count in the main file header must be screwed... ViceTXD scans through the file for textures untill it reaches <texture count>, then it exits the function.

Ah, okay, sounds logical

QUOTE (Spooky @ Sep 16 2003, 13:15)
I've updated ViceTXD just for you wink.gif , it'll now read all textures and let you know about the error, and also let you fix it if you want to.

Thanks for updating, but it doesn't work sad.gif I still only see 3 textures.
I did a dff check with TXD Builder, and the car does use the textures, so it's probably not a 'forgotten' deleted texture.

steve-m
  • steve-m

  • Members
  • Joined: 26 Jul 2002

#42

Posted 16 September 2003 - 03:13 PM

@ZanderZ: Did you try other txd viewers?

Spooky, a few ideas for new features:
- open the edit header dialog on double-clicking a texture name, center it on the screen/main form
- allow the user to convert the formats of already existing textures (e.g. 32bit => 16bit DXT3)
- mipmap support (both viewing and editing/adding)

Here is some sample (pseudo) code how to calculate the dimensions of lower mipmap levels (based on the dimensions of level 0 and the given size):
CODE
// this comes after the texture information data
for i:=0 to MipMapCount-1 do begin
 txd.Read(c, 4); // Read the size of mipmap image data, also for level 0 (full size)
 MipMaps[i].size:=c; // Save the size for the actual mipmap
 MipMaps[i].offset:=txd.Position; // Store the offset for later use (painting)
 txd.Position:=txd.Position+c; // Skip to the next mipmap
 if not tex.DXT1 then c:=c*2; // because for DXT3 there is additional alpha data, just used for the calculation below
 
 // This is the height/width calculation code, also works for non-quadratic textures!
 MipMaps[i].height:=round(sqrt(c/(tex.width/tex.height)));
 MipMaps[j].width:=round((tex.width/tex.height)*sqrt(c/(tex.width/tex.height)));
end;

Spooky
  • Spooky

    Prince of the Yolkfolk

  • Members
  • Joined: 13 Jan 2002

#43

Posted 16 September 2003 - 03:39 PM

ZanderZ:
The only other thing I can think of, is the program that created the TXD didn't do the data sizing correctly... upload/email me this TXD, and i'll let you know what the problem is smile.gif .

Steve:
- Good idea... added.
- I will add this soon, I was just waiting to see if anyone had problems with the new features.
- It will be added, thanks for the code wink.gif

ZanderZ
  • ZanderZ

    GTA modder & tool writer

  • Members
  • Joined: 08 Sep 2002

#44

Posted 16 September 2003 - 04:40 PM

Here's a direct link to the car, it included the txd file: http://www.philsfile.../citroen2cv.zip
I could upload just the txd file, but it wouldn't be a lot smaller...

Steve: no, I only tried it in those two programs, and I did the dff check with your TXD Builder. I'll try some other txd viewers.

Spooky
  • Spooky

    Prince of the Yolkfolk

  • Members
  • Joined: 13 Jan 2002

#45

Posted 16 September 2003 - 05:27 PM

The problem is, whatever was used to create the TXD set the datasize for the 3rd image to <5236> when it should be <17512> confused.gif . <5236> would be the correct size for a 64x64 texture (such as the first texture in this archive), but it was somehow applied to this 128x128 texture.

ZanderZ
  • ZanderZ

    GTA modder & tool writer

  • Members
  • Joined: 08 Sep 2002

#46

Posted 16 September 2003 - 05:38 PM

That's weird... But the only reason I pointed it out was because at first I thought it might be a ViceTXD bug. It seams to work in VC, so it's just an error of the creator, not yours wink.gif

DiCanio
  • DiCanio

    Foot Soldier

  • Members
  • Joined: 22 Jul 2002

#47

Posted 17 September 2003 - 07:38 AM

if you download the Mitsubishi Evo VII WRC Beta by Griff
you only see 7 textures in the 8mb txd file
There are actually 14 in there

TXD Builder only sees 3 in a DFF Check

http://www.3d-graffiti.com/

http://www.3d-graffi..._7_wrc_beta.zip

---------------

Thanx for all the updates
I'm sure the three of you will suss out all there is
to know about TXD's - a confusing topic wow.gif )

JernejL
  • JernejL

    Big Homie

  • Feroci Racing
  • Joined: 11 Mar 2002

#48

Posted 17 September 2003 - 12:14 PM Edited by Delfi, 17 September 2003 - 12:14 PM.

wanna know if the program was txd gold?
check the last 17 (or less) bytes of the txd file (before possible 2048 alingment trash) biggrin.gif

basicly, all duplicated images of image 0 in txd gold
have copied whole header data - and so the OLD
texture_count before duplicating is in all copies...

Spooky
  • Spooky

    Prince of the Yolkfolk

  • Members
  • Joined: 13 Jan 2002

#49

Posted 17 September 2003 - 04:13 PM

It must've been txd gold then, because the header for the 4th texture is really the header from the first with a few changes.

Suction Testicle Man
  • Suction Testicle Man

    Yeah, well, you know, that's just, like, your opinion, man.

  • Moderator
  • Joined: 27 Sep 2002
  • None

#50

Posted 19 September 2003 - 03:43 PM Edited by Suction Testicle Man, 19 September 2003 - 03:49 PM.

I have a problem...

I extracted wshsprayshp.txd and exported and edited a file with a picture of a garage door on paint. When I tried to import it back into the .txd it said all sorts of jargon (I'm using the latest version of ViceTXD). The file in question was a 16bit one. I tried creating a new 32bit one with the same name and renamed the old one, then imported the edited file over my newly created one but the game just crashed when I drove to where the texture is supposed to be in the game.

Later I then tried simply exporting the 16bit file and then importing it back without even touching it and it did not work - it displayed the same jargon. So my conclusion is you have problems with 16bit files. Any reason for this? If I'm asking a stupid question you can shoot me if you want.

::EDIT:: You posted this a few seconds ago:
QUOTE
This is actually todo with your graphics card not supporting DXT compresed textures... basicly you can't add or replace textures that are using DXT compression. I'm working on getting around this with a software compresser but untill then you can just add the texture as new with the same name, using 32bit uncomressed then renaming the old texture to something else.

I have a feeling the same applies to me sad.gif

Suction Testicle Man
  • Suction Testicle Man

    Yeah, well, you know, that's just, like, your opinion, man.

  • Moderator
  • Joined: 27 Sep 2002
  • None

#51

Posted 28 September 2003 - 01:03 PM

Well, does anyone know if this is the case? smile.gif

steve-m
  • steve-m

  • Members
  • Joined: 26 Jul 2002

#52

Posted 28 September 2003 - 01:28 PM

@STM: I don't know, but when ViceTXD does work with compressed textures (able to show them), your graphics card must support it...

@Spooky: Any progress implementing the mipmap function?
Some new stuff you can add:
- deleting textures from archive
- a checkbox in the replace dialog, asking wether to resize the new texture (if different size) or not (strech)
- several hotkeys, like pressing del deletes the texture (if implemented)

JernejL
  • JernejL

    Big Homie

  • Feroci Racing
  • Joined: 11 Mar 2002

#53

Posted 28 September 2003 - 06:40 PM

QUOTE (ST.MU @ Sep 28 2003, 14:28)
@STM: I don't know, but when ViceTXD does work with compressed textures (able to show them), your graphics card must support it...

@Spooky: Any progress implementing the mipmap function?
Some new stuff you can add:
- deleting textures from archive
- a checkbox in the replace dialog, asking wether to resize the new texture (if different size) or not (strech)
- several hotkeys, like pressing del deletes the texture (if implemented)

@ST.MU:

spooky wrote his own dxt decompression code and it is
built into the program and graphic card independant.

spooky's compressor uses dxt compression offered by your graphical card.
and your card sometimes doesn't want to compress the right way...

Spooky
  • Spooky

    Prince of the Yolkfolk

  • Members
  • Joined: 13 Jan 2002

#54

Posted 29 September 2003 - 12:28 AM

@ST.MU: I've been rather busy recently with work, but I will get to it, and i'll try to add what you've suggested smile.gif .

@Delfi: Why aren't you ever on msn anymore? tounge.gif or maybe we're just not on at the same times confused.gif

JernejL
  • JernejL

    Big Homie

  • Feroci Racing
  • Joined: 11 Mar 2002

#55

Posted 29 September 2003 - 10:33 AM

QUOTE (Spooky @ Sep 29 2003, 01:28)
@Delfi: Why aren't you ever on msn anymore? tounge.gif or maybe we're just not on at the same times confused.gif

@Spooky: i was on msn friday and sunday from around 20:00 - 23:00
GMT +1, you weren't online, just in friday your sister accidently logged
in, she said you went out...

OffRoader23
  • OffRoader23

    Like A Rock

  • Members
  • Joined: 12 Aug 2002

#56

Posted 05 October 2003 - 04:31 AM

have you made it so you can delete textures from it yet? just wondering i havent read the full 3 pages yet, but i do know that that would be helpful to be able to delete a texture from the .txd cuz i have like 5 extra textures in my wheels.txd and they are just wasting space

JernejL
  • JernejL

    Big Homie

  • Feroci Racing
  • Joined: 11 Mar 2002

#57

Posted 09 October 2003 - 07:11 PM

QUOTE (OffRoader23 @ Oct 5 2003, 05:31)
have you made it so you can delete textures from it yet? just wondering i havent read the full 3 pages yet, but i do know that that would be helpful to be able to delete a texture from the .txd cuz i have like 5 extra textures in my wheels.txd and they are just wasting space

i'll answer on your next question even before you ask:
nobody would reply on this question because youre
just wasting time (like i am right now) because why not
go and download it and check it out BY YOURSELF?

MasterW3
  • MasterW3

    Square Civilian

  • Members
  • Joined: 18 Sep 2002

#58

Posted 23 October 2003 - 12:18 AM

what file is d3d9.dll?
I've screwed my computer up 4 times in a row installing DirectCrud9...
so I will stay well away from it...
anything I can do to edit TXD files in my case?

Demarest
  • Demarest

    what could be

  • BUSTED!
  • Joined: 12 Jul 2003

#59

Posted 23 October 2003 - 10:50 AM

QUOTE (MasterW3 @ Oct 22 2003, 19:18)
what file is d3d9.dll?
I've screwed my computer up 4 times in a row installing DirectCrud9...
so I will stay well away from it...
anything I can do to edit TXD files in my case?

Isn't it a file placed on the machine by DirectX 9? VC auto-installs DX9.

ZanderZ
  • ZanderZ

    GTA modder & tool writer

  • Members
  • Joined: 08 Sep 2002

#60

Posted 23 October 2003 - 12:07 PM

QUOTE (Demarest @ Oct 23 2003, 12:50)
Isn't it a file placed on the machine by DirectX 9? VC auto-installs DX9.

Yes, it's Direct3D version 9 (probably, given the name), so it's used for 3D stuff. Why ViceTXD uses it, I don't know.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users