xboxscene.org forums

Pages: [1] 2

Author Topic: Txd Files  (Read 556 times)

BILLS

  • Archived User
  • Sr. Member
  • *
  • Posts: 297
Txd Files
« on: August 23, 2005, 10:39:00 PM »

WEll, currently i got some people working on helping out with some of the nnasty TXD files that appear descibed as "scrambled". I cant post my site becasue HS wont allow any site promotion, so youll have to ask Zdemon aobut this sites where abouts. Ayway, its being worked on jsut so you know  smile.gif
Logged

giftic

  • Archived User
  • Jr. Member
  • *
  • Posts: 91
Txd Files
« Reply #1 on: August 24, 2005, 08:46:00 AM »

beerchug.gif  and the Heaven's sent more Angels of the leet tongue.gif  thankx Bills
Logged

BILLS

  • Archived User
  • Sr. Member
  • *
  • Posts: 297
Txd Files
« Reply #2 on: August 24, 2005, 05:12:00 PM »

QUOTE(giftic @ Aug 24 2005, 11:57 AM)
beerchug.gif  and the Heaven's sent more Angels of the leet tongue.gif  thankx Bills
Logged

gta_hack3r

  • Archived User
  • Jr. Member
  • *
  • Posts: 72
Txd Files
« Reply #3 on: August 25, 2005, 03:18:00 AM »

Yeah, he is a legend!  beerchug.gif
Logged

BILLS

  • Archived User
  • Sr. Member
  • *
  • Posts: 297
Txd Files
« Reply #4 on: August 25, 2005, 09:42:00 AM »

Ok, pure gold:

QUOTE(Mirage)
a palettized texture means that it's build up of a palette and the actual texture with 'pointers' to those colours.

eg. if the beginning of your palette looks like this: 00 00 00 FF 20 30 40 FF AA BB CC FF and the beginning of the texture looks like this: 0 2 1 0 then the actual RGB data on the screen would be: 00 00 00 AA BB CC 20 30 40 00 00 00

Now, continuing to look at the loadsc0.txd file... Format hacking also involves guessing a lot...

I'm going to GUESS it's a big texture, because the file is called LOADingSCreen0... I'm placing my bet on a 512x512 texture so it can encompas most of the xbox screen (640x512)

1. the palette info ends at $0490
2. the filesize is 263336 bytes
3. 512x512 = 262144

Now, the filesize minus the palette and the beginning of the header equals 263336 - $0490 = 262168

but, 262168 (raw data) -262144 (texturesize) = 24, so i've got some extra data not encounted for... my first guess would be at the beginning of the raw data, but there are just zero's there so i look at the end of the file...

And that's exactly where i find the extra data... from $40490 till $404a8... 24 bytes

So, now I know the raw data I should be looking at is from $0490-$40490, as that is where my 8 bit palettized texture is

save that datablock and load it into photoshop as a raw 512x512 image and see if you see any patterns smile.gif


QUOTE(Xmax)
As for the patterns, there certainly are.
As a matter of facts, this image is far from being just "white noise", as there are quite clear correlations in the pixels' structure.

The first thing you would notice is that there are "stripes" of pixels that are more "correlated" than others.

The effect is evident looking for both "horizontal" and "vertical" stripes, but on "vertical" ones it is even possible to "see" sort of "lines" that subdivide the strips. Note: those lines are not "made of" pixels, they are rather a sort of "immaterial" lines between a pixel and the adjacent one. You get what I mean?

The most evident vertical "lines" are placed at a distance of 64 pixels each other, thus subdividing the whole 512 pixels image width in 8 vertical stripes.
Try to adjust the your viewer at different zoom levels if you find hard to spot them at first. Can you see them?

Going further, you would also notice that the "median" line placed at 1/2 of the width and the two "sub-median" lines placed at 1/4 and 3/4 of the width are a bit more evident than the others.

On the other side, there are other "lines", less evident though, at a finer grain, further subdividing the image in 16 strips (32 pixels of distance), 23 strips (16 pixels of distance), etc. If you zoom very hard you should be able to see this process going down further to 2 pixels wide stripes (you will be able to find here and there some lines of "blocks" of 2x2 pixels).

Of course, all the above applies also to the other dimension (i.e. "horizontal" stripes instead of "vertical" ones).

So, "what does it all mean?", you would ask...

Let's assume that what we are looking at is a "scrambled" image i.e. an image obtained by "displacing" the pixels of the original, according to a given algorithm(which may be untrue but seems a reasonable starting point).

A "scrambling" algorithm that may lead to this correlation structure is the following:

1. take the original image, subdivide it in 2 vertical slices, then swap them.
2. on the resulting image at point 1: subdivide it in 4 vertical slices, then swap them
3. on the resulting image at point 2: subdivide it in 8 vertical slices, then swap them
4. Go on like this until you will swap slices that are 1 pixel width (you will always come to this condition if the width of the original image is a power of two, which holds true for our test image ;-)

5. Repeat the above process, but using horizontal slices instead of vertical ones.

6. Done.

The above algorithm may have a number of "variations", the most important being the case where the slices are not only "swapped" at each step, but also "mirrored" in the process, either along a vertical or horizontal axis.

A good point of this algorithm is that it is totally reversible: i.e. you can use the very same algorithm for scrambling and unscrambling. Also, what kind of swaps you perform first (i.e. the horizontal, or the vertical ones, the finer grain or the gross grain, etc.) shouldn't matter for the final result, giving a bit of "freedom" in the implementation.

Now, writing a little proggie that takes that 512x512 "raw" image and perform those swaps (+ eventually mirrorings w/ different options) so that the results can be analysed with photoshop, shouldn't be a huge work.
Any coder to join?
@Cyclone, I know you are a very fast one when it comes to delivering apps. (and we've already synergized like this in the past ;-) Would you like to try this out? :-D




QUOTE(Cyclone)
@Blitz: Looking at country.txd (or loadsc0.txd-just replace 256 by 512 everytime):

We know that the image is an 8-bit 256x256 image (from TXDWorkshop)
we know the filesize is 1192+(256x256) bytes

This means each pixel in our 256x256 image occupies ONE byte of data. Follow so far?
This ONEtoONE of one byte per pixel suggests there is NO compression.

This single byte is a number 0-255 that you look-up in the palette table that preceeded the image block.

Straining my brain I think I remember the palette table being:
-triplets in an Windows format BMP (as in R,G,B,R,G,B...)
-------i.e. the preceeding (256*3=)768bytes
-quartlets in OS2 Bitmaps (R,G,B,A,R,G,B,A...)
-------i.e. the preceeding (256*4=)1024bytes

RGBA (=Red, Green, Blue, Alpha)
Which is why you see the repeating xFF for maximum alpha value
Thus an OS2 format Bitmap, understand now?

Therefore I would expect the palette data to start at (1192-1024=)168 bytes in.

You can:
-Ignore Mirage on one point: you don't need to save out the datablock Photoshop7+ will do that for you smile.gif -see attached image
-RENAME file to .RAW & open in Photoshop enter 256x256 by 8bit & header offset as 1192
-You see your image as was seen in TXDWorkshop

@ _Mirage_: IMHO you're wrong about those 24bytes, if you also look at country.txd you will see the palette does start off at 168bytes in & you are reading too much into the data you've seen in loadsc0.

@Xmax et al.: http://forums.xbox-s...dpost&p=2784863 for preliminary source code

This post has been edited by Cyclone: Today, 07:42 AM


QUOTE(xmax)
Of course! As you wish! :-)
Oh, and don't forget to <quote/ ="be sociable"> too!
rolleyes.gif

[EDIT-1]
I only now see your link to the swizzle topic on X-S!
Guess you're right! (and I hope I didn't reinvent the wheel actually... LOL)

If I look at the images attached some posts below:
http://forums.xbox-s...dpost&p=2785143
I've got a strange deja-vu feeling (talking about the first image, not the second! tongue.gif )

[EDIT-2]
Looking closely to the algorythm you referenced to (swizzle/unswizzle block functions), it looks like:
+ the swizzle function recursively works on halved and halved square blocks (1/2, 1/4, 1/8, etc... of the original image width/height) until it reach a 2x2 pixel block (in the input image)
+ on that block the "scrambling/swizzling" is performed by copying those four pixels as a "row" in the output image. i.e. if the input image has those four pixels at a given offset:
CODE

+--->
|AB
|CD
V

in the output image the pixels are re-arranged this way:
CODE

+----->
|ABCD
V

+ doing some recursive steps more, and if I'm not wrong, a 2x2 grid of adjacent blocks in the input image:
CODE

+------>
|AB EF
|CD GH
|
|IJ MN
|KL OP
V

should produce the following output:
CODE

+---------------------->
|ABCD EFGH IJKL MNOP
V

+ and so on, recursively, for greater and greater 2x2 blocks, until all of the image is swizzled.

The opposite (i.e. from "continuous rows" to "2x2 blocks") is done by the "un-swizzle" function.

Now, this algorithm is *different* from the one I posted, but due to its "recursively-halving" nature, I would expect it to give as output the same "correlation" pattern I described some posts ago. (moreover, the same pattern is present on the deja-vu image posted as example on X-S).

So, I agree with you that it's worthy to also explore this algorithm (and its variations) on our screen loader image.

If in the end none of them will work, we may always decide to get in contact with cypher... ;-)


Expect something done soon  wink.gif
Logged

giftic

  • Archived User
  • Jr. Member
  • *
  • Posts: 91
Txd Files
« Reply #5 on: August 25, 2005, 02:08:00 PM »

smile.gif Bills that was like the most enlightful info we had in like a MONTH about GTA XBOX MODDIN.. biggrin.gif  this is the begining of the ground breaking...great stuff smile.gif  
Logged

BILLS

  • Archived User
  • Sr. Member
  • *
  • Posts: 297
Txd Files
« Reply #6 on: August 25, 2005, 04:26:00 PM »

all done with the app, these guys WORK

App

it currently only works with the loadsc0.txd file. But it will be worked on. Im doing a fornt end for it also.
It needs to be in the same directory as  loadsc0.txd

Your welcome.  smile.gif


BTW this is by mirage. open source as always. Youll have to find my site for it though  wink.gif

ITS a command prompt proggy, so ifyou dont know how to use it follow this:

1. Click Start. go to Run. Type in cmd. the command prompt opens.

2. type in

cd "Where ever it is located"
(without parenthisis

3. It then dizplays in a grayish tone. Type in  unswizzle loadsc0.txd

it releases two files. the pcx one is the right one  wink.gif  that is being changed to png though
Logged

BILLS

  • Archived User
  • Sr. Member
  • *
  • Posts: 297
Txd Files
« Reply #7 on: August 25, 2005, 05:51:00 PM »

Ok jsut finished the front end for the app. READ THE HELP. Its easier on the eyes  tongue.gif  

GTA Unswizzle
Logged

giftic

  • Archived User
  • Jr. Member
  • *
  • Posts: 91
Txd Files
« Reply #8 on: August 25, 2005, 05:56:00 PM »

sad.gif wont let me download it..can u PM me ya website..or relink..

i feel like Xbox GTA Modding is advanceing as we speak beerchug.gif
Logged

IAteYourMom

  • Archived User
  • Jr. Member
  • *
  • Posts: 97
Txd Files
« Reply #9 on: August 25, 2005, 10:53:00 PM »

this is nice i hope u guys get it to work with skins and clothes soon smile.gif just so u know the loadscreens for some odd reason can be replaced with pc ones even tho they are swizzled... i did it without any unsizzling on my part and they work fine... but this is still a great find i hope it brings us closer to using skins an new tshirts on the xbox!
Logged

BILLS

  • Archived User
  • Sr. Member
  • *
  • Posts: 297
Txd Files
« Reply #10 on: August 31, 2005, 05:49:00 PM »

ok...its getting close to done..it works with all files except the multi files like particale...unfortunatley i will not be relelasing any more updates to gtaxboxmods becasue darkblizzard is a miserable fuck.

Have a nice day.
Logged

DocDiZ

  • Archived User
  • Newbie
  • *
  • Posts: 13
Txd Files
« Reply #11 on: September 04, 2005, 02:17:00 PM »

Thanks to _mirage_ we now have a (I think) fully working UN&REswizzler.
You know where to get it ;)

Feedback at that place too.

DocDiZ
Logged

darkblizzard

  • Archived User
  • Hero Member
  • *
  • Posts: 520
Txd Files
« Reply #12 on: September 05, 2005, 03:49:00 PM »

QUOTE(DocDiZ @ Sep 4 2005, 03:21 PM)
Thanks to _mirage_ we now have a (I think) fully working UN&REswizzler.
You know where to get it ;)

Feedback at that place too.

DocDiZ
*



no it doesnt do everything...
Logged

DocDiZ

  • Archived User
  • Newbie
  • *
  • Posts: 13
Txd Files
« Reply #13 on: September 05, 2005, 04:29:00 PM »

QUOTE(darkblizzard @ Sep 5 2005, 11:53 PM)
no it doesnt do everything...
*


Feedback at that place too.
Logged

darkblizzard

  • Archived User
  • Hero Member
  • *
  • Posts: 520
Txd Files
« Reply #14 on: September 05, 2005, 04:48:00 PM »

i can post it here if i want...  smile.gif
Logged
Pages: [1] 2