There is a documentation even from that xdr2obj git "xdr.org" with many common things with the ".wdr" doc here: http://gta.wikia.com/wiki/WDR and our .cdr from PS3 is really close but just at some header fields later when starts the ps edge compression approach the things becomes different!.
I started looking around console format's some time ago had done a simple app to decompress RSC resource archive but now i'm working on reversing the 3d data from RAGE engine on GTA V but PS3 version. There are .cdr,cft and cdd formats right now i'm focus on .cdr drawables there are a lot of wiki's and info about the x360 one .xdr and obviusly for pc .wdr (gta iv) the thing is totally different on ps3 -x360, i mean on old gen consoles the format have more things in common with the old .WDR from GTA IV even there was that xdr2obj for x360 because the .xdr(xbox360) and .wdr old gta iv pc are really the same as i see when searching with hxd BUT the thing for PS3 is really different!, have some days and at least with the .cdr i managed to get vertex extracted (i believe they are) (format of vertex is the most common v(x,y,z) etc) and have done reverse engineering of many offsets in the file i'm writing a doc about my findings.
Offsets documented:



The section 0x1D10 that i use is from asteroid .cdr but every .CDR have one section like that maybe is some kind of vertex buffer because have important information for the model.
Here are some .cdr files maybe any other dev with experience can help me. About the .cdr they were decompressed from zlib rockstar it uses RSC format with my experimental program written on java i managed to get it unpacked on ps3 version they just use zlib on x360 they use lzx. because that there is no RSC header on the files.
https://drive.google.com/open?id=0B7ouK ... jItV2R5SjQ
That is a image of what i have done in the few time. is an asteroid model with only points.
And this is .zip with .cdr and images with some analysis patterns even i have extracted some blocks that are on the file with hxd. They are three blocks i think i got vertex data from the one named "asteroid_18800-0x2D60-block" being 18800 the offset on that block in the file and 0x2D60 his length and when i check 0x2D60/10 it gives me 0x2D6 that is actually the verts count so maybe i'm not so wrong. the other two i don't know anything must be skeleton or shaders related.
https://drive.google.com/open?id=0B7ouK ... zBGamJHSWM
That file contains an asteroid model just like this one:

I made some more research but now i know more about this format. Rockstar use Playstation Edge in order to optimize vertex cache and indexes to better load on spus of cell cpu just like this doc says:
http://www.jonolick.com/uploads/7/9/2/1 ... _final.pdf
Sony PS Edge vertex and index format is used in many games from GOW 3, Playstation all stars, etc. In any heavy game with lot of 3d stuff it should be used.
Here in this forums i started to see some topics about ps edge compression and see the work of chrrox (thanks to him for his scripts).
There is a function on noesis include's "rapi.decompressEdgeIndices(edgeData, indexCount)" that does all the magic obviusly when you know on the file where is located the index offset, vertex count, index count, index size, etc. I managed today to get that more documented in a doc file there is it:
https://drive.google.com/file/d/0B7ouKH ... sp=sharing
For faster results i just use the asteroid.cdr file so in the doc are some fixed offsets and values for this file only but should work many of that fields with even all .cdr that i look around. Well this doc like i say is usefull when you have the asteroid cdr.
viewtopic.php?f=18&t=11954 Here is the link to noesis-plugin that chrrox write for ps all stars and i use that src to check if there is that kind of format and YES i get somethings in common between ps all stars and maybe every edge related format with our .CDR from RAGE GTA V on ps3 and that is what i had wrote on the document.
Here is another picture too with colors of that block (asteroid.cdr:0x1D10 fixed offset) that i quote in the previous document:
https://drive.google.com/file/d/0B7ouKH ... sp=sharing
Hurray! I managed to get decompressed the index data! using that offsets in the doc and as the picture says and using the python plugin with noesis func "rapi.decompressEdgeIndices" but that is just faces and triangles and this time is Ok the data from what i see.
bs.seek(indexOffset, NOESEEK_ABS)
edgeData = bs.readBytes(indexSize)
edgeDecomp = rapi.decompressEdgeIndices(edgeData, indexCount)
(this is from chrrox plugin to ps all stars)
I get this file:
https://drive.google.com/file/d/0B7ouKH ... sp=sharing
here is a picture of how it looks index data now that is decompressed (v1,v2,v3) short values:
https://drive.google.com/file/d/0B7ouKH ... sp=sharing
Later i make a simple java app to convert every short to integer values of two bytes as the index data should normally be ( for example: f 1 2 3, f 3 2 0, etc) and get :
http://pastebin.com/csQjWwd4
Looks according to index information that there are 724 verts in our asteroid cdr sample at least and in the offset that i believe it is vert count says that there are 726 or 0x2D6 so maybe we are more close to the goal
Here is the "experimental" python (noesis compatible based on chrrox ps all stars, again thanks to him for marvelous work!) this is a modified script to work with (asteroid.cdr but can work with other .cdr with only one geometry i think and changing the value 0x3000 to where graphics section of resource starts according to .RSC format) BUT IT works just to decompress edges at this time don't try to export .obj or anything this script is just to fwrite decompressed faces to another file. The python script doesn have some offsets rights.
http://pastebin.com/7EEiw3LA
Again this python script for noesis is just to use this:
Code: Select all
edgeDecomp = rapi.decompressEdgeIndices(edgeData, indexCount)Here are some more .cdr files if anyone want to look on this.
https://drive.google.com/file/d/0B7ouKH ... sp=sharing
Now need more work with kind of file, it should be great if we can do something with the format because i think that even Red dead redemption work in this way and maybe in the far future we can mod console versions. I need help from more experienced devs with this 3d reversing stuff i'm a programmer but i'm new in these stuff. Again thanks to everyone!. sorry for my bad english.



