Yegorchic Posted September 11, 2005 Share Posted September 11, 2005 Hello to evrybody... Can somebody tell me about GTA SA .txd files. I mean, can somebody tell me, how this files coded... m... I think you understood me... Sorry for my bad English... Link to comment Share on other sites More sharing options...
aru Posted September 11, 2005 Share Posted September 11, 2005 Well, I have code in C# for reading the TXD files... I don't have a generic format written up.. let me know if that will help and I can post it. Link to comment Share on other sites More sharing options...
Yegorchic Posted September 12, 2005 Author Share Posted September 12, 2005 Please, post this algorithm of decoding .txd it if you can. --- But I know C# not well, because I learnt Delphi. Link to comment Share on other sites More sharing options...
Jarno Posted September 12, 2005 Share Posted September 12, 2005 Spookie haves released the source of ViceTXD. I'm searching how to handle the SA IMG format with Delphi 7. I have IMG 1.3 but I have everything tried. Don't work Link to comment Share on other sites More sharing options...
aru Posted September 12, 2005 Share Posted September 12, 2005 Doesn't seem like I can attach files here.. so fetch from here: http://aru.nd4spdworld.com/pic/rwtxd.zip You need to write your own decoder for TXDDecoder.Decode() since my code has some stuff I have to rewrite properly before I can post it... no time that now. Sorry for lack of comments.. and some stuff could be done better than the approach I took in that.. especially with the code redundancies in classes that inherit RWBaseBlock. If you have Delphi 2005 (I think), you can compile your app to a Delphi .NET app and access the code from those classes as a C# dll. But they are pretty small, so converting to Delphi shouldn't be a problem. Good luck with whatever it is you guys are doing . Link to comment Share on other sites More sharing options...
Yegorchic Posted September 13, 2005 Author Share Posted September 13, 2005 aru, I think I want to do tool, that you did. I wrote my IMG Reader, and now I want to make texure preview. I rogramming on Delphi 7, and I don't like Delphi 8 and 2005, because I think it especially it for .NET. Thank you! Link to comment Share on other sites More sharing options...
Jarno Posted September 13, 2005 Share Posted September 13, 2005 Yegorchic can you please help me with how to handle SA IMG. I will give credits to you in my app Link to comment Share on other sites More sharing options...
steve-m Posted September 13, 2005 Share Posted September 13, 2005 Some time ago Delfi posted the updated dff and txd file loaders for MooMapper, they are coded in Delphi. Link to comment Share on other sites More sharing options...
Jarno Posted September 13, 2005 Share Posted September 13, 2005 I have searched but can't find something like that from Delfi. Link to comment Share on other sites More sharing options...
steve-m Posted September 13, 2005 Share Posted September 13, 2005 http://www.gtaforums.com/index.php?showtopic=203957 Link to comment Share on other sites More sharing options...
Jarno Posted September 13, 2005 Share Posted September 13, 2005 (edited) Thank you Steve-M. [edit] Link is not working (In the post of Delfi) [/edit] [edit2] Already downloaded it. In july. (Forget) But I have one question. How to update the IMG Tool 1.3 (Source) code with this one I'm not the best @ Opening files and stuff. So please someone can help me. If needed I will open new topic. [/edit2] Edited September 13, 2005 by Jarno Link to comment Share on other sites More sharing options...
Yegorchic Posted September 13, 2005 Author Share Posted September 13, 2005 This is sructure of IMG file v2.0 (it's work in my prog.): First 4 bytes must be "VER2" Then you must read 3 bytes - this is count of files. Then go files table. In Delphi I wrote that: type TIMG = record StartBlock: Longword; // Start of block BlockCount: Longword; // Size of block Name: array[1..24] of Char; // file name end; And you must read 32 bytes for file. For finding real size of block and block start you must BlockCount*2048 and StartBlock*2048. And for "real file size" you must BlockCount*2. I think that's all. Link to comment Share on other sites More sharing options...
Jarno Posted September 14, 2005 Share Posted September 14, 2005 Tnx but I don't understand you at all. I will post later this day my code. Maybe you can change it. Link to comment Share on other sites More sharing options...
JernejL Posted September 14, 2005 Share Posted September 14, 2005 I rogramming on Delphi 7, and I don't like Delphi 8 and 2005, because I think it especially it for .NET. delphi 8 is .net only, but 2005 enables win32 development again. altrough delphi 4 rules all the way Currently working on Top Down City Game, a classics top down game similar to GTA1 & GTA2: Thread Info: https://gtaforums.com/topic/911312-new-game-top-down-city/ Youtube channel: https://www.youtube.com/channel/UCxGfOh3ld7Xm-ic3KEMB6iA Discord: https://discord.gg/UXmDPzS - join #bridge channel Link to comment Share on other sites More sharing options...
dertyjerzian Posted September 14, 2005 Share Posted September 14, 2005 off topic but hey, I gotta know: Dammit jarno, I have been clicking that moving X for days! Nothing has happened! Why does this dancing error graphic enthrawl me so? Please tell me what it's all about as I can tell now after many tests that it indeed does nothing! lol And happy forum birthday the eleventh Link to comment Share on other sites More sharing options...
steve-m Posted September 14, 2005 Share Posted September 14, 2005 Dammit jarno, I have been clicking that moving X for days! Nothing has happened! Why does this dancing error graphic enthrawl me so? Please tell me what it's all about as I can tell now after many tests that it indeed does nothing! lol To keep stupids busy I guess... Link to comment Share on other sites More sharing options...
Jarno Posted September 14, 2005 Share Posted September 14, 2005 Dammit jarno, I have been clicking that moving X for days! Nothing has happened! Why does this dancing error graphic enthrawl me so? Please tell me what it's all about as I can tell now after many tests that it indeed does nothing! lol Sorry but how you mean? Please can somebody take the code of IMGTool1.3 and make it compitable for SA. Thanks in advance. Link to comment Share on other sites More sharing options...
Yegorchic Posted September 14, 2005 Author Share Posted September 14, 2005 Jarno, if you want GTA SA IMG Archive structure, then see my last post. Link to comment Share on other sites More sharing options...
Jarno Posted September 14, 2005 Share Posted September 14, 2005 Yegorchic, I don't know how to do that with IMG Tool 1.3 Maybe you want to do it for me please. If needed PM me or something and I will sent source. Link to comment Share on other sites More sharing options...
Yegorchic Posted September 19, 2005 Author Share Posted September 19, 2005 Ow... I learnt, learnt and learnt aru's C code, but not understood it all... can somebody say me algorithm of .TXD files??? Link to comment Share on other sites More sharing options...
aru Posted September 19, 2005 Share Posted September 19, 2005 Okay lets see... this might make a bit more sense than the OOP'd C# code Basic chunk header format, all chunks in any txd or dff file starts like this. (see this for more info: http://www.chronetal.co.uk/gta/index.php?page=dff) Each chunk may be composed of data or more chunks. This is RWHeader in my code. Header { DWORD Type; DWORD Size; WORD Unknown; WORD Version; } Type may be one of the following (defined as enum RWTypes in my code): TXDStruct = 0x1, TXDExtension = 0x3, TXDTexture = 0x15, TXDFile = 0x16, The generic format tree is as follows, TXDFile (or known as Clump normally) -- TXDStruct (defined as RWTXDInfo in my code) -- TXDTexture ---- TXDStruct (defined as RWTXDData) -- TXDTexture ---- TXDStruct (defined as RWTXDData) etc.. For reading purposes, just ignore any other chunks that come up. Since you have size of the chunk, you can just skip it to find the next chunk. In the tree above, you see that only TXDStruct chunks have data, TXDFile and TXDTexture just contain more chunks. Now for the format of the data in RWTXDInfo: RWTXDInfo { WORD Count; // This the number of textures in the file WORD Unknown; } and for the format of the data in TDTXDData: TDTXDData { DWORD Version; DWORD FilterFlags; BYTE TextureName[32]; // Null terminated string BYTE AlphaName[32]; // Null terminated string DWORD AlphaFlags; DWORD D3DTextureFormat; WORD Width; WORD Height; BYTE BitDepth; BYTE MipMapCount; BYTE TexCodeType; BYTE Flags; BYTE Palette[256*4]; // Only present if BitDepth == 8 DWORD DataSize; BYTE Data[DataSize]; // If MipMapCount > 1, then the following two repeats (MipMapCount-1) times DWORD MipMapDataSize; BYTE MipMapData[MipMapDataSize]; } Now Data above will contain the texture data. If D3DTextureFormat is set to a FOURCC code of "DXT3" or "DXT1", you need to DXT decode the Data block to get your 16 bpp texture data. Otherwise, just look at the BitDepth and decode the Data accordingly. If BitDepth is 8, then palette contains your 256 colour texture palette, Data is a byte array of ptrs into the palette. If BitDepth is 16, then the texture is in 565 format I think (1555 if bit0 of Flags is set -- this tells that the texture has an alpha channel). If the bitdepth is 32, then its just the normal 24bit texture with a 8bit alpha channel (if alpha present, otherwise just ignore the extra 8 bits). Ideally, you should just be able to figure out the format from D3DTextureFormat, but I'm not if this was only introduced in later versions of the TXD format or if TXD Workshop writes the wrong value for it... just looking at the D3DFormat value doesn't always work! Link to comment Share on other sites More sharing options...
Yegorchic Posted September 20, 2005 Author Share Posted September 20, 2005 Thanks! Now I will read it, and try to make my simple TXD reader... Link to comment Share on other sites More sharing options...
AleXXX Posted September 21, 2005 Share Posted September 21, 2005 If someone compiling new MooMapper with SA DFF/TXD loaders, please give me it! At me no Delfi. Link to comment Share on other sites More sharing options...
JernejL Posted September 22, 2005 Share Posted September 22, 2005 (edited) If someone compiling new MooMapper with SA DFF/TXD loaders, please give me it! At me no Delfi. how can't people finally for once understand that altrough the txd and dff loaders are updated the moomapper still won't edit san andreas maps. it is not enough, it also needs new img loader, ipl parser, binary ipl parser etc.. i updated the dff and txd loaders because i use them in GGMM and they work well there because i don't have to read map files. Edited September 22, 2005 by Delfi Currently working on Top Down City Game, a classics top down game similar to GTA1 & GTA2: Thread Info: https://gtaforums.com/topic/911312-new-game-top-down-city/ Youtube channel: https://www.youtube.com/channel/UCxGfOh3ld7Xm-ic3KEMB6iA Discord: https://discord.gg/UXmDPzS - join #bridge channel Link to comment Share on other sites More sharing options...
Yegorchic Posted September 22, 2005 Author Share Posted September 22, 2005 But can you update it in the Internet, because gtaconnection, how you said, doesn't work! Link to comment Share on other sites More sharing options...
JernejL Posted September 23, 2005 Share Posted September 23, 2005 But can you update it in the Internet, because gtaconnection, how you said, doesn't work! No, i can't because i don't have the internet at home and have to go to library where i can't upload to FTP because stupid firewall blocks its connection ports. Currently working on Top Down City Game, a classics top down game similar to GTA1 & GTA2: Thread Info: https://gtaforums.com/topic/911312-new-game-top-down-city/ Youtube channel: https://www.youtube.com/channel/UCxGfOh3ld7Xm-ic3KEMB6iA Discord: https://discord.gg/UXmDPzS - join #bridge channel Link to comment Share on other sites More sharing options...
steve-m Posted September 23, 2005 Share Posted September 23, 2005 Delfi, upload it to http://www.yousendit.com/ (via browser) and let someone else host it. Link to comment Share on other sites More sharing options...
Jarno Posted September 23, 2005 Share Posted September 23, 2005 Can Somebody help me with the SA IMG. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now