| |
SCARZIP (SCARZ Information Pane)
| This forum is read only. This serves as an archive of SCARZ (CulT forums) from 2003-2005 |
|
  |
Sonic Adventure 2 hacking, Stage 2, controlling |
|
|
|
|
May 22 2004, 04:06 PM
|
|
CulT Demigod

Group: CulT Member DX
Posts: 3,324
Joined: 21-August 03
Member No.: 81
Gender: Male
Country: United Kingdom
|
Wow, it'd be awesome to play Shenmue again. I miss that game. But then again, downloading or even finding the ISO would take ages, and i doubt Chanka would be able to run it yet.
|
|
|
|
|
|
|
|
May 22 2004, 10:32 PM
|
|
The things we do to the people that we love...

Group: CulT Family
Posts: 585
Joined: 13-April 04
Member No.: 2,150
Gender: Male
|
K, I am able to read vertex structure type #23 with no guessing. That means I am able to load all the vertices by reading the "file system" in the model files.
Currently, I am trying to fix up the loader so it loads faces. But I still have the face data to crack.
Completed vertex structure: float x; float y; float z; float normal_x; float normal_y; float normal_z;
typedef struct SEG //Each file system seg { dword type; dword attach; //Contains anothe "uncracked" structure, see "uncracked structure" //Note, the object depends on the type, if type==23, then the object is "attached" float pos[3]; //Position of the "oobject" float rot[3]; //Rotation of the "object" float scl[3]; //This contains the "scale" of the "object" dword parent; //Parent tree node dword joint; //Believed to be where this tree node "interesects" another } SEG;
typedef struct UNCRACKED { dword vertex; //The address of the vertex data in the file, add 8 bytes to dword vertex to get to the first vertex. The 8 bytes consists of unknown data currently //Vertex buffer end=position of this struct in memory-4 dword face; //Believed to be the address of the face data dword unk[4]; //Unknown data that follows } UNCRACKED;
Some factors of face data hacking that I must consider: 1) texture UV's 2) texture id? 3) vertex indeces
This post has been edited by Sanik: May 22 2004, 10:46 PM
|
|
|
|
|
|
|
|
May 23 2004, 04:40 PM
|
|
Error

Group: CulT Family
Posts: 341
Joined: 23-November 03
Member No.: 997
Gender: Male
Country: United States
|
On an unrelated note, PAL versions of the SA2:Battle any character any level codes have been added to the existing thread in the archives. Figured I'd mention it here since people are still reading this thread. :-)
|
|
|
|
|
|
|
|
May 23 2004, 05:16 PM
|
|
|...|

Group: CulT Member
Posts: 157
Joined: 4-March 04
Member No.: 1,812
Gender: Male
Country: France
|
QUOTE(sonicblur @ May 23 2004, 10:40 PM) On an unrelated note, PAL versions of the SA2:Battle any character any level codes have been added to the existing thread in the archives. Figured I'd mention it here since people are still reading this thread. :-) I loooooooooove you :D
|
|
|
|
|
|
|
|
May 26 2004, 02:01 PM
|
|

Group: CulT Member
Posts: 11
Joined: 30-April 04
Member No.: 2,358
Gender: Male
|
[quote=Sintendo,May 22 2004, 12:12 PM] More Chanka running Sonic Adventure 2 screenshots! :D
:)
|
|
|
|
|
|
|
|
May 26 2004, 02:24 PM
|
|
The things we do to the people that we love...

Group: CulT Family
Posts: 585
Joined: 13-April 04
Member No.: 2,150
Gender: Male
|
... *counts to 10* breathe in breathe out ... The Echelon version had the cut down music. By cut down, I mean in a lower quality. (Koji Chao, 2004) QUOTE(Infinity) Although yes DC disks are 1gb, these particular ones were not filled
Are you stating that SA2 was originally 700 MB, but just on a 1 GB "GD"-rom, with the remaining bits and pieces set to 0? (Meaning they were not filled to the top) If so, then you might be missing something. If you have 600 MB of free space left on a format, do you A) Leave it empty B) Use higher quality sound, textures, and/or models C) None of the above
This post has been edited by Sanik: May 26 2004, 02:24 PM
|
|
|
|
|
|
|
|
May 28 2004, 12:16 PM
|
|
I'm Back Beeyatches! =P

Group: CulT Member
Posts: 178
Joined: 28-June 04
From: Underneath Your Bed. Muahaha.
Member No.: 2,833
Gender: Male
Country: United Kingdom
|
QUOTE(Sanik @ May 26 2004, 08:24 PM) ... *counts to 10* breathe in breathe out ... The Echelon version had the cut down music. By cut down, I mean in a lower quality. (Koji Chao, 2004) QUOTE(Infinity) Although yes DC disks are 1gb, these particular ones were not filled
Are you stating that SA2 was originally 700 MB, but just on a 1 GB "GD"-rom, with the remaining bits and pieces set to 0? (Meaning they were not filled to the top) If so, then you might be missing something. If you have 600 MB of free space left on a format, do you A) Leave it empty B) Use higher quality sound, textures, and/or models C) None of the above im gonna go with C. just randomly, im guessing its gonna be that, that the space is NEEDED for something else. Just my theory =P
|
|
|
|
|
|
|
|
May 28 2004, 01:25 PM
|
|
TEN THOUSAND FISTS IN THE AIIIIIR

Group: CulT Family
Posts: 4,753
Joined: 22-August 04
Member No.: 100
Gender: Male
Country: Puerto Rico
|
QUOTE(PsychoSk8r @ May 28 2004, 12:16 PM) QUOTE(Sanik @ May 26 2004, 08:24 PM) ... *counts to 10* breathe in breathe out ... The Echelon version had the cut down music. By cut down, I mean in a lower quality. (Koji Chao, 2004) QUOTE(Infinity) Although yes DC disks are 1gb, these particular ones were not filled
Are you stating that SA2 was originally 700 MB, but just on a 1 GB "GD"-rom, with the remaining bits and pieces set to 0? (Meaning they were not filled to the top) If so, then you might be missing something. If you have 600 MB of free space left on a format, do you A) Leave it empty B) Use higher quality sound, textures, and/or models C) None of the above im gonna go with C. just randomly, im guessing its gonna be that, that the space is NEEDED for something else. Just my theory =P Using higher quality models/textures would tax the system, so you insert 600 mb of dummy data to move the necessary data to the outside of the disc =P
|
|
|
|
|
|
|
|
May 28 2004, 01:31 PM
|
|
Xtreme Researcher

Group: CulT Member
Posts: 556
Joined: 19-March 04
Member No.: 1,899
Gender: Male
Country: United Kingdom
|
QUOTE(James McCloud @ May 28 2004, 10:25 AM) Using higher quality models/textures would tax the system, so you insert 600 mb of dummy data to move the necessary data to the outside of the disc =P Just like they did with Ikaruga, the game is in fact only about 30mb, but is pushed to the outside of the disc by a dummy file As far as I know, the Ech version had the Jap voices cut out as well. So the space was used, but wouldn't fit on a normal CD-R without it being cut out.
|
|
|
|
|
|
|
|
May 28 2004, 09:33 PM
|
|
The things we do to the people that we love...

Group: CulT Family
Posts: 585
Joined: 13-April 04
Member No.: 2,150
Gender: Male
|
Well, I figured 1 thing, the SA2 models have a vertex limit of 0xFFFF (65535 vertices) PER OBJECT. I also figured where the number of vertices is stored per object.
But, for the face data, I haven't gotten a thing. I separated bytes that were under the vertex total, but there was no pattern noticable.
It seems that the face data has it's own "file system" to it. That's gonnah prolly take a few more weeks to crack.
On the good side, Chanka is getting released tomorrow. I wonder if I will need the DC BIOS...
This post has been edited by Sanik: May 28 2004, 09:34 PM
|
|
|
|
|
|
|
|
May 29 2004, 12:12 AM
|
|

Group: Unwanted
Posts: 15
Joined: 28-May 04
From: The Dark Side base
Member No.: 2,560
Gender: Male
|
Should you be able to succesfully hack this data, What do you plan to do with it?
And by the way, How big is this Chanka program?
|
|
|
|
|
|
|
|
Jun 2 2004, 03:06 PM
|
|
The things we do to the people that we love...

Group: CulT Family
Posts: 585
Joined: 13-April 04
Member No.: 2,150
Gender: Male
|
K, first things first. Sonic Adventure 2 model format is 99% cracked. Only like 7 variables remain. The only thing is, the models use tiangle strips. I have to figure out how to intrepret it.
STAGE 1 is almost over, and that consists of understanding the format and loading it. STAGE 2 is about to begin, which consists of trying to draw those triangles in different groupings (quads, pentagons, etc.) It should take only a few days, but finals are about to begin, so this stage is delayed.
I will post the revised format outline later. I am not on my laptop at the current time. (Maybe be back on it in like 5 hours)
How did this happen you ask? *crowd: we never said a word* SHUSH!! Ahem, like I said, errr, I mean like the crowd asked =D I had completed downloading the Katana dev kit. In it, it contains the compiler from one SEGA model format to another. Well, it doesn't support the ability to decompile .bin files, but I was able to put in test runs and see how the outputted face data changes. That's how I was able to crack the hard ass face data.
The bad news is, if I hadn't used the SDK to figure out the face data, it would had been the first model format hacked from scratch... well, that's a bit overdoing it.
The proper name of the format that SA2 uses is the Ninja Chunk Model format. SA2 uses a revision that adds a little changes which I got covered. The only remaining thing to figure out is intrepreting the face data (STAGE 2) To do so, I must figure what "StripL" and "StripR" mean.
The DC BIOS uses Ninja Basic Model (Same as Chunk, but face data is in different grouping system)
The source code to intrepret the models isn't there, so it's basicly reading up on the DC's 3D card to figure out why face data is seperated into StripL and StripR, and how the graphics card handles these.
This post has been edited by Sanik: Jun 2 2004, 03:24 PM
|
|
|
|
|
|
|
|
Jun 2 2004, 05:28 PM
|
|
Disconnected...

Group: CulT Member DX
Posts: 2,267
Joined: 23-August 03
Member No.: 355
Gender: Female
Country: Canada
|
WOW. o_O The SDK really helped you tremendously.
That's so cool. ^_^ This is going to be pretty revolutionary, finally being able to use Dreamcast Models from various games in other things.
*cheers* Keep going. ^__^ You can do it!
|
|
|
|
|
|
|
|
Jun 2 2004, 09:04 PM
|
|
The things we do to the people that we love...

Group: CulT Family
Posts: 585
Joined: 13-April 04
Member No.: 2,150
Gender: Male
|
SA2 model format outline: Sorry guys because I didn't use the standard methods, but I thought C code would be a little clearer CODE //SA2 model format, reversion 15 //Formal name found to be "Ninja CnkModel"
//Vertex structure typedef struct VERTEX { float x; float y; float z; float normal_x; float normal_y; float normal_z; } VERTEX;
//Vertex descriptor typedef struct VERTEX_DESC { word id; word unknown[2]; word vertex_total; VERTEX vertex[vertex_total]; } VERTEX_DESC;
/* Currently, it is not know what id is, but it keeps having the value of 0x29, thus it may be used as a check to see if the model pointers are correct. It is believed that the unknown variables describe the vertex format. Currently, nothing is known, and we will later learn a CRC to use as a way to check if the format is supported. */
//Face structure typedef struct FACE { sword length; word strip[abs(length)]; //Errr, use ABS only during malloc } FACE;
/* The length also contains some kind of type. If it's positive, it's the length and type R. If it's negative, then to get the length, you have to negate the variable. Also, since it's negative, it's type L. It is unknown currently how face data is intrepretted through this. */
//Face descriptor typedef struct FACE_DESC { word alpha_mode; word unknown2; byte material_difference[4]; //It's in order of 3 to 0 when reading file byte material_ambience[4]; byte material_specular[4]; word unknown3; word unknown4; word strip_total; FACE strip[strip_total]; word NULL; } FACE_DESC;
/* It was currently hacked how to read this structure, but intrepreting it is another story. NULL is always 0; */
//Segment structure typedef struct SEG { dword type; dword attach; float pos[3]; float rot[3]; float scl[3]; dword child; dword joint; } SEG;
/* The type seems to be flags being turned on/off. The types that commonly contain models are types 20 to 23. The attached object seems to always be a model, but in occasions, junk data seems to be thrown it. The attach points to an "ATTACHED_DESC" The joint is a pointer to an list which comes off of this one. */
//Attached descriptor typedef struct ATTACHED_DESC { dword vertex; dword face; dword unknown[4]; } ATTACHED_DESC;
/* Vertex points to a "VERTEX_DESC" Face points to "FACE_DESC" The unknown data has yet to be cracked, but isn't needed to load the model. One could do without it. It is unknown what it may be used for. Here is the CRC that was described earlier which can be used to check if the vertex count in the header describes a known format: vertex_total=((vertex_desc.pos+8)-(attached_desc.pos-4))/24 */
This is the model that allowed such an increase: By changing values, I was able to determine how it was later on compiled. CODE /* NJA 0.88alpha2 NinjaAsciiDataMix CnkModel (SI) */
/* ROOT OBJECT : object_sphere1_sphere1 n(1) d(1) */
CNKOBJECT_START
PLIST strip_sphere1_sphere1[] START CnkM_DAS( FBS_SA|FBD_ISA ), 6, //These 2 are unknown MDiff( 255, 178, 178, 178 ), MAmbi( 255, 127, 127, 127 ), MSpec( 11, 255, 255, 255 ), CnkS( FST_FL ), 150, _NB( UFO_0, 12 ), StripR(12), 7, 13, 6, 12, 5, 11, 4, 10, 3, 9, 2, 0, StripL(42), 8, 7, 14, 13, 20, 19, 26, 25, 32, 31, 38, 37, 44, 0, 51, 2, 52, 3, 53, 4, 54, 5, 55, 6, 56, 7, 57, 8, 1, 15, 22, 21, 28, 27, 34, 33, 40, 39, 46, 45, 52, 51, StripR(10), 13, 19, 12, 18, 11, 17, 10, 16, 9, 0, StripR(8), 19, 25, 18, 24, 17, 23, 16, 0, StripL(4), 28, 29, 22, 1, StripR(6), 25, 31, 24, 30, 23, 0, StripR(6), 34, 28, 35, 29, 36, 1, StripL(4), 31, 30, 37, 0, StripR(8), 40, 34, 41, 35, 42, 36, 43, 1, StripR(10), 46, 40, 47, 41, 48, 42, 49, 43, 50, 1, StripR(14), 51, 44, 45, 38, 39, 32, 33, 26, 27, 20, 21, 14, 15, 8, StripR(12), 52, 46, 53, 47, 54, 48, 55, 49, 56, 50, 57, 1, CnkNull(), CnkEnd() END
VLIST vertex_sphere1_sphere1[] START CnkV_VN(0, 349), OffnbIdx(0, 58), VERT( 0x00000000, 0xc0a00000, 0x00000000 ), NORM( 0xb20e8bdb, 0xbf800000, 0xb03e0fce ), VERT( 0x00000000, 0x40a00000, 0x00000000 ), NORM( 0xb13e0fce, 0x3f800000, 0x313e0fce ), VERT( 0x3ff4eadb, 0xc093d21b, 0x00000000 ), NORM( 0x3ed85ccc, 0xbf6804dd, 0x32904465 ), VERT( 0x40624630, 0xc0624630, 0x00000000 ), NORM( 0x3f3ac853, 0xbf2f1108, 0x33169293 ), VERT( 0x4093d21b, 0xbff4eada, 0x00000000 ), NORM( 0x3f6e284e, 0xbebbcc4e, 0x324fb1ee ), VERT( 0x40a00000, 0x346aac7a, 0x00000000 ), NORM( 0x3f800000, 0x00000000, 0x00000000 ), VERT( 0x4093d21b, 0x3ff4eade, 0x00000000 ), NORM( 0x3f6e284e, 0x3ebbcc50, 0x31cfb1ee ), VERT( 0x40624630, 0x40624630, 0x00000000 ), NORM( 0x3f3ac852, 0x3f2f1109, 0x31c8c36d ), VERT( 0x3ff4eadd, 0x4093d21b, 0x00000000 ), NORM( 0x3ed85ccc, 0x3f6804de, 0x31405b32 ), VERT( 0x3fad2ec9, 0xc093d21b, 0xbfad2ec9 ), NORM( 0x3e98fdca, 0xbf6804dd, 0xbe98fdcb ), VERT( 0x40200000, 0xc0624630, 0xc0200000 ), NORM( 0x3f041340, 0xbf2f1107, 0xbf041341 ), VERT( 0x40510cd1, 0xbff4eada, 0xc0510cd1 ), NORM( 0x3f286719, 0xbebbcc4d, 0xbf28671b ), VERT( 0x40624630, 0x346aac7a, 0xc0624630 ), NORM( 0x3f3504f3, 0x00000000, 0xbf3504f3 ), VERT( 0x40510cd1, 0x3ff4eade, 0xc0510cd1 ), NORM( 0x3f286719, 0x3ebbcc51, 0xbf28671a ), VERT( 0x40200000, 0x40624630, 0xc0200000 ), NORM( 0x3f04133f, 0x3f2f1107, 0xbf041340 ), VERT( 0x3fad2eca, 0x4093d21b, 0xbfad2eca ), NORM( 0x3e98fdca, 0x3f6804de, 0xbe98fdcc ), VERT( 0x00000000, 0xc093d21b, 0xbff4eada ), NORM( 0xb2405b32, 0xbf6804de, 0xbed85ccc ), VERT( 0x00000000, 0xc0624630, 0xc0624630 ), NORM( 0xb2c8c36f, 0xbf2f1107, 0xbf3ac855 ), VERT( 0x00000000, 0xbff4eada, 0xc093d21a ), NORM( 0x00000000, 0xbebbcc4e, 0xbf6e284f ), VERT( 0x00000000, 0x346aac7a, 0xc0a00000 ), NORM( 0x00000000, 0x00000000, 0xbf800000 ), VERT( 0x00000000, 0x3ff4eade, 0xc093d21a ), NORM( 0xb24fb1ed, 0x3ebbcc50, 0xbf6e284f ), VERT( 0x00000000, 0x40624630, 0xc0624630 ), NORM( 0xb2969293, 0x3f2f1108, 0xbf3ac854 ), VERT( 0x00000000, 0x4093d21b, 0xbff4eadc ), NORM( 0x31904466, 0x3f6804de, 0xbed85ccc ), VERT( 0xbfad2ec8, 0xc093d21b, 0xbfad2ec8 ), NORM( 0xbe98fdcb, 0xbf6804dd, 0xbe98fdca ), VERT( 0xc0200000, 0xc0624630, 0xc0200000 ), NORM( 0xbf041341, 0xbf2f1106, 0xbf041341 ), VERT( 0xc0510cd0, 0xbff4eada, 0xc0510cd0 ), NORM( 0xbf28671a, 0xbebbcc4e, 0xbf28671b ), VERT( 0xc0624630, 0x346aac7a, 0xc0624630 ), NORM( 0xbf3504f3, 0x00000000, 0xbf3504f3 ), VERT( 0xc0510cd0, 0x3ff4eade, 0xc0510cd0 ), NORM( 0xbf28671a, 0x3ebbcc52, 0xbf28671b ), VERT( 0xc0200000, 0x40624630, 0xc0200000 ), NORM( 0xbf041341, 0x3f2f1108, 0xbf041341 ), VERT( 0xbfad2eca, 0x4093d21b, 0xbfad2eca ), NORM( 0xbe98fdcd, 0x3f6804de, 0xbe98fdcb ), VERT( 0xbff4ead9, 0xc093d21b, 0x00000000 ), NORM( 0xbed85ccc, 0xbf6804de, 0x00000000 ), VERT( 0xc0624630, 0xc0624630, 0x00000000 ), NORM( 0xbf3ac855, 0xbf2f1106, 0x00000000 ), VERT( 0xc093d21a, 0xbff4eada, 0x00000000 ), NORM( 0xbf6e284f, 0xbebbcc4e, 0x00000000 ), VERT( 0xc0a00000, 0x346aac7a, 0x00000000 ), NORM( 0xbf800000, 0x00000000, 0x00000000 ), VERT( 0xc093d21a, 0x3ff4eade, 0x00000000 ), NORM( 0xbf6e284f, 0x3ebbcc50, 0x00000000 ), VERT( 0xc0624630, 0x40624630, 0x00000000 ), NORM( 0xbf3ac854, 0x3f2f1108, 0x31c8c36f ), VERT( 0xbff4eadc, 0x4093d21b, 0x00000000 ), NORM( 0xbed85ccc, 0x3f6804de, 0xb1904466 ), VERT( 0xbfad2ec8, 0xc093d21b, 0x3fad2ec8 ), NORM( 0xbe98fdca, 0xbf6804dd, 0x3e98fdcb ), VERT( 0xc0200000, 0xc0624630, 0x40200000 ), NORM( 0xbf041341, 0xbf2f1106, 0x3f041341 ), VERT( 0xc0510cd0, 0xbff4eada, 0x40510cd0 ), NORM( 0xbf28671b, 0xbebbcc4e, 0x3f28671a ), VERT( 0xc0624630, 0x346aac7a, 0x40624630 ), NORM( 0xbf3504f3, 0x00000000, 0x3f3504f3 ), VERT( 0xc0510cd0, 0x3ff4eade, 0x40510cd0 ), NORM( 0xbf28671a, 0x3ebbcc51, 0x3f28671a ), VERT( 0xc0200000, 0x40624630, 0x40200000 ), NORM( 0xbf041341, 0x3f2f1108, 0x3f041341 ), VERT( 0xbfad2eca, 0x4093d21b, 0x3fad2eca ), NORM( 0xbe98fdcb, 0x3f6804de, 0x3e98fdcd ), VERT( 0x00000000, 0xc093d21b, 0x3ff4ead9 ), NORM( 0x00000000, 0xbf6804de, 0x3ed85ccc ), VERT( 0x00000000, 0xc0624630, 0x40624630 ), NORM( 0x00000000, 0xbf2f1106, 0x3f3ac855 ), VERT( 0x00000000, 0xbff4eada, 0x4093d21a ), NORM( 0x00000000, 0xbebbcc4e, 0x3f6e284f ), VERT( 0x00000000, 0x346aac7a, 0x40a00000 ), NORM( 0x00000000, 0x00000000, 0x3f800000 ), VERT( 0x00000000, 0x3ff4eade, 0x4093d21a ), NORM( 0x00000000, 0x3ebbcc50, 0x3f6e284f ), VERT( 0x00000000, 0x40624630, 0x40624630 ), NORM( 0xb1c8c36f, 0x3f2f1108, 0x3f3ac854 ), VERT( 0x00000000, 0x4093d21b, 0x3ff4eadc ), NORM( 0xb1904466, 0x3f6804de, 0x3ed85ccc ), VERT( 0x3fad2ec8, 0xc093d21b, 0x3fad2ec8 ), NORM( 0x3e98fdcb, 0xbf6804dd, 0x3e98fdcb ), VERT( 0x40200000, 0xc0624630, 0x40200000 ), NORM( 0x3f041341, 0xbf2f1107, 0x3f041341 ), VERT( 0x40510cd0, 0xbff4eada, 0x40510cd0 ), NORM( 0x3f28671a, 0xbebbcc4e, 0x3f28671b ), VERT( 0x40624630, 0x346aac7a, 0x40624630 ), NORM( 0x3f3504f3, 0x00000000, 0x3f3504f3 ), VERT( 0x40510cd0, 0x3ff4eade, 0x40510cd0 ), NORM( 0x3f28671b, 0x3ebbcc51, 0x3f28671b ), VERT( 0x40200000, 0x40624630, 0x40200000 ), NORM( 0x3f041340, 0x3f2f1107, 0x3f041340 ), VERT( 0x3fad2eca, 0x4093d21b, 0x3fad2eca ), NORM( 0x3e98fdcd, 0x3f6804de, 0x3e98fdcb ), CnkEnd() END
CNKMODEL model_sphere1_sphere1[] START VList vertex_sphere1_sphere1, PList strip_sphere1_sphere1, Center 0.000000F, 0.000000F, 0.000000F, Radius 7.071068F, END
CNKOBJECT object_sphere1_sphere1[] START EvalFlags ( 0x00000017 ), CNKModel model_sphere1_sphere1, OPosition ( 0.000000F, 0.000000F, 0.000000F ), OAngle ( 0.000000F, 0.000000F, 0.000000F ), OScale ( 1.000000F, 1.000000F, 1.000000F ), Child NULL, Sibling NULL, END
CNKOBJECT_END
DEFAULT_START
#ifndef DEFAULT_OBJECT_NAME #define DEFAULT_OBJECT_NAME object_sphere1_sphere1 #endif
DEFAULT_END
I still have a few more clues to figure out things. Like, in the H files, it gives macros, and describes what it does. From there, I can use my imagination to do the rest.
This post has been edited by Sanik: Jun 2 2004, 09:20 PM
|
|
|
|
|
|
|
|
Jun 3 2004, 01:08 PM
|
|
There's no such thing as 2

Group: CulT Family
Posts: 957
Joined: 20-August 03
From: Sydney, Australia
Member No.: 4
Gender: Male
|
Nice work man! Damn nice. So, you planning to write an importer for the format now? Anything still holding things up?
Oh, and BTW, if you still need it, you can find a good description of all the vertex formats you'll ever come across, including triange strips, in the OpenGL Programming Guide. It's available free in PDF on the net.
|
|
|
|
|
|
|
|
Jun 3 2004, 03:27 PM
|
|
The things we do to the people that we love...

Group: CulT Family
Posts: 585
Joined: 13-April 04
Member No.: 2,150
Gender: Male
|
Yeah, I am trying to figure why they split triangles into StripL and StripR. I am running out of ways to attempt to read the triangle data. StripR(12), 7, 13, 6, 12, 5, 11, 4, 10, 3, 9, 2, 0, StripL(42), 8, 7, 14, 13, 20, 19, 26, 25, 32, 31, 38, 37, 44, 0, 51, 2, 52, 3, 53, 4, 54, 5, 55, 6, 56, 7, 57, 8, 1, 15, 22, 21, 28, 27, 34, 33, 40, 39, 46, 45, 52, 51, StripR(10), 13, 19, 12, 18, 11, 17, 10, 16, 9, 0, StripR(8), 19, 25, 18, 24, 17, 23, 16, 0, StripL(4), 28, 29, 22, 1, StripR(6), 25, 31, 24, 30, 23, 0, StripR(6), 34, 28, 35, 29, 36, 1, StripL(4), 31, 30, 37, 0, StripR(8), 40, 34, 41, 35, 42, 36, 43, 1, StripR(10), 46, 40, 47, 41, 48, 42, 49, 43, 50, 1, StripR(14), 51, 44, 45, 38, 39, 32, 33, 26, 27, 20, 21, 14, 15, 8, StripR(12), 52, 46, 53, 47, 54, 48, 55, 49, 56, 50, 57, 1, StripL and StripR are the only functions left to crack. It's StripX(a_len) Notice how the length is always even. I attempted to draw each strip as a TRIANGLE_LIST but it just didn't work.--EDIT: It seems my face loading function had a bug. I am trying to fix it as of now. I was able to use the SEGA tools to convert this: //Ninja Model Basic, ASCII CODE /*//NJA 0.7alpha1 NinjaAsciiDataMix
// ROOT OBJECT : object_cube_root*/
MATERIAL matlist_cube_root[] START
MATSTART Diffuse ( 255, 255, 255, 255 ), Specular ( 255, 255, 255, 255), Exponent ( 0.0F ), AttrTexId ( 0x0, 0 ), AttrFlags ( 0x94000000 ), MATEND
END
OBJECT_START
POLYGON pg3_0_cube_root[] START 3, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 14, 13, 12, 15, 14, 12, 18, 17, 16, 19, 18, 16, 22, 21, 20, 23, 22, 20, END
MESHSET meshset_cube_root[] START
MESHSTART TypeMatId ( 0x0000, 0 ), MeshNum 12, Meshes pg3_0_cube_root, PolyAttrs NULL, PolyNormal NULL, VertColor NULL, VertUV NULL, MESHEND
END
POINT point_cube_root[] START VERT( 1.000000F, 1.000000F, 1.000000F ), VERT( 1.000000F, -1.000000F, 1.000000F ), VERT( 1.000000F, -1.000000F, -1.000000F ), VERT( 1.000000F, 1.000000F, -1.000000F ), VERT( 1.000000F, -1.000000F, 1.000000F ), VERT( -1.000000F, -1.000000F, 1.000000F ), VERT( -1.000000F, -1.000000F, -1.000000F ), VERT( 1.000000F, -1.000000F, -1.000000F ), VERT( 1.000000F, 1.000000F, 1.000000F ), VERT( -1.000000F, 1.000000F, 1.000000F ), VERT( -1.000000F, -1.000000F, 1.000000F ), VERT( 1.000000F, -1.000000F, 1.000000F ), VERT( -1.000000F, -1.000000F, -1.000000F ), VERT( -1.000000F, 1.000000F, -1.000000F ), VERT( -1.000000F, 1.000000F, 1.000000F ), VERT( -1.000000F, -1.000000F, 1.000000F ), VERT( -1.000000F, 1.000000F, -1.000000F ), VERT( 1.000000F, 1.000000F, -1.000000F ), VERT( 1.000000F, 1.000000F, 1.000000F ), VERT( -1.000000F, 1.000000F, 1.000000F ), VERT( -1.000000F, -1.000000F, -1.000000F ), VERT( 1.000000F, -1.000000F, -1.000000F ), VERT( 1.000000F, 1.000000F, -1.000000F ), VERT( -1.000000F, 1.000000F, -1.000000F ), END
NORMAL normal_cube_root[] START NORM( 1.000000F, 0.000000F, 0.000000F ), NORM( 1.000000F, 0.000000F, 0.000000F ), NORM( 1.000000F, 0.000000F, 0.000000F ), NORM( 1.000000F, 0.000000F, 0.000000F ), NORM( 0.000000F, -1.000000F, 0.000000F ), NORM( 0.000000F, -1.000000F, 0.000000F ), NORM( 0.000000F, -1.000000F, 0.000000F ), NORM( 0.000000F, -1.000000F, 0.000000F ), NORM( 0.000000F, 0.000000F, 1.000000F ), NORM( 0.000000F, 0.000000F, 1.000000F ), NORM( 0.000000F, 0.000000F, 1.000000F ), NORM( 0.000000F, 0.000000F, 1.000000F ), NORM( -1.000000F, 0.000000F, 0.000000F ), NORM( -1.000000F, 0.000000F, 0.000000F ), NORM( -1.000000F, 0.000000F, 0.000000F ), NORM( -1.000000F, 0.000000F, 0.000000F ), NORM( 0.000000F, 1.000000F, 0.000000F ), NORM( 0.000000F, 1.000000F, 0.000000F ), NORM( 0.000000F, 1.000000F, 0.000000F ), NORM( 0.000000F, 1.000000F, 0.000000F ), NORM( 0.000000F, 0.000000F, -1.000000F ), NORM( 0.000000F, 0.000000F, -1.000000F ), NORM( 0.000000F, 0.000000F, -1.000000F ), NORM( 0.000000F, 0.000000F, -1.000000F ), END
MODEL model_cube_root[] START Points point_cube_root, Normal normal_cube_root, PointNum 24, Meshset meshset_cube_root, Materials matlist_cube_root, MeshsetNum 1, MatNum 1, Center 0.000000F, 0.000000F, 0.000000F, Radius 0.000000F, END
OBJECT G_ObjectBox[] START EvalFlags ( 0x00000017 ), Model model_cube_root, OPosition ( 0.000000F, 0.000000F, 0.000000F ), OAngle ( 0.000000F, 0.000000F, 0.000000F ), OScale ( 1.000000F, 1.000000F, 1.000000F ), Child NULL, Sibling NULL, END
OBJECT_END
DEFAULT_START
#ifndef DEFAULT_OBJECT_NAME #define DEFAULT_OBJECT_NAME object_cube_root #endif
DEFAULT_END
To the complex model: CODE /* NJA 0.95alpha1 NinjaAsciiDataMix CnkModel (NJA) */
/* ROOT OBJECT : object_box_tBox n(1) d(1) */
CNKOBJECT_START
PLIST strip_box_tBox[] START CnkM_DAS( FBS_SA|FBD_ISA ), 6, MDiff( 255, 255, 255, 255 ), MAmbi( 0, 0, 0, 0 ), MSpec( 0, 255, 255, 255 ), CnkS( 0x0 ), 32, _NB( UFO_0, 6 ), StripL(4), 0, 2, 3, 1, StripL(4), 7, 4, 6, 5, StripL(4), 11, 8, 10, 9, StripL(4), 15, 14, 12, 13, StripL(4), 19, 18, 16, 17, StripL(4), 23, 22, 20, 21, CnkNull(), CnkEnd() END
VLIST vertex_box_tBox[] START CnkV_VN(0x0, 145), OffnbIdx(0, 24), VERT( 0x3f800000, 0x3f800000, 0x3f800000 ), NORM( 0x3f800000, 0x00000000, 0x00000000 ), VERT( 0x3f800000, 0xbf800000, 0x3f800000 ), NORM( 0x3f800000, 0x00000000, 0x00000000 ), VERT( 0x3f800000, 0xbf800000, 0xbf800000 ), NORM( 0x3f800000, 0x00000000, 0x00000000 ), VERT( 0x3f800000, 0x3f800000, 0xbf800000 ), NORM( 0x3f800000, 0x00000000, 0x00000000 ), VERT( 0x3f800000, 0xbf800000, 0x3f800000 ), NORM( 0x00000000, 0xbf800000, 0x00000000 ), VERT( 0xbf800000, 0xbf800000, 0x3f800000 ), NORM( 0x00000000, 0xbf800000, 0x00000000 ), VERT( 0xbf800000, 0xbf800000, 0xbf800000 ), NORM( 0x00000000, 0xbf800000, 0x00000000 ), VERT( 0x3f800000, 0xbf800000, 0xbf800000 ), NORM( 0x00000000, 0xbf800000, 0x00000000 ), VERT( 0x3f800000, 0x3f800000, 0x3f800000 ), NORM( 0x00000000, 0x00000000, 0x3f800000 ), VERT( 0xbf800000, 0x3f800000, 0x3f800000 ), NORM( 0x00000000, 0x00000000, 0x3f800000 ), VERT( 0xbf800000, 0xbf800000, 0x3f800000 ), NORM( 0x00000000, 0x00000000, 0x3f800000 ), VERT( 0x3f800000, 0xbf800000, 0x3f800000 ), NORM( 0x00000000, 0x00000000, 0x3f800000 ), VERT( 0xbf800000, 0xbf800000, 0xbf800000 ), NORM( 0xbf800000, 0x00000000, 0x00000000 ), VERT( 0xbf800000, 0x3f800000, 0xbf800000 ), NORM( 0xbf800000, 0x00000000, 0x00000000 ), VERT( 0xbf800000, 0x3f800000, 0x3f800000 ), NORM( 0xbf800000, 0x00000000, 0x00000000 ), VERT( 0xbf800000, 0xbf800000, 0x3f800000 ), NORM( 0xbf800000, 0x00000000, 0x00000000 ), VERT( 0xbf800000, 0x3f800000, 0xbf800000 ), NORM( 0x00000000, 0x3f800000, 0x00000000 ), VERT( 0x3f800000, 0x3f800000, 0xbf800000 ), NORM( 0x00000000, 0x3f800000, 0x00000000 ), VERT( 0x3f800000, 0x3f800000, 0x3f800000 ), NORM( 0x00000000, 0x3f800000, 0x00000000 ), VERT( 0xbf800000, 0x3f800000, 0x3f800000 ), NORM( 0x00000000, 0x3f800000, 0x00000000 ), VERT( 0xbf800000, 0xbf800000, 0xbf800000 ), NORM( 0x00000000, 0x00000000, 0xbf800000 ), VERT( 0x3f800000, 0xbf800000, 0xbf800000 ), NORM( 0x00000000, 0x00000000, 0xbf800000 ), VERT( 0x3f800000, 0x3f800000, 0xbf800000 ), NORM( 0x00000000, 0x00000000, 0xbf800000 ), VERT( 0xbf800000, 0x3f800000, 0xbf800000 ), NORM( 0x00000000, 0x00000000, 0xbf800000 ), CnkEnd() END
CNKMODEL model_box_tBox[] START VList vertex_box_tBox, PList strip_box_tBox, Center 0.000000F, 0.000000F, 0.000000F, Radius 1.414214F, END
CNKOBJECT object_box_tBox[] START EvalFlags ( 0x00000017 ), CNKModel model_box_tBox, OPosition ( 0.000000F, 0.000000F, 0.000000F ), OAngle ( 0.000000F, 0.000000F, 0.000000F ), OScale ( 1.000000F, 1.000000F, 1.000000F ), Child NULL, Sibling NULL, END
CNKOBJECT_END
DEFAULT_START
#ifndef DEFAULT_OBJECT_NAME #define DEFAULT_OBJECT_NAME object_box_tBox #endif
DEFAULT_END
And this is what I have converted it to as an .obj: CODE g box v 1.000000 1.000000 1.000000 v 1.000000 -1.000000 1.000000 v 1.000000 -1.000000 -1.000000 v 1.000000 1.000000 -1.000000 v 1.000000 -1.000000 1.000000 v -1.000000 -1.000000 1.000000 v -1.000000 -1.000000 -1.000000 v 1.000000 -1.000000 -1.000000 v 1.000000 1.000000 1.000000 v -1.000000 1.000000 1.000000 v -1.000000 -1.000000 1.000000 v 1.000000 -1.000000 1.000000 v -1.000000 -1.000000 -1.000000 v -1.000000 1.000000 -1.000000 v -1.000000 1.000000 1.000000 v -1.000000 -1.000000 1.000000 v -1.000000 1.000000 -1.000000 v 1.000000 1.000000 -1.000000 v 1.000000 1.000000 1.000000 v -1.000000 1.000000 1.000000 v -1.000000 -1.000000 -1.000000 v 1.000000 -1.000000 -1.000000 v 1.000000 1.000000 -1.000000 v -1.000000 1.000000 -1.000000
#faces have been increased by 1 to support the OBJ format f 1 3 4 2 f 8 5 7 6 f 12 9 11 10 f 16 15 13 14 f 20 19 17 18 f 24 23 21 22
What happens is, the box is drawn, but incorrectly. The faces overlap. Thus, StripL may be a Triangle List. Below, the first diagram shows the triangles, and second one shows the draw order. I THINK this may be a triangle list. If so, the only thing left to hack is StripR. (IMG: http://jamesseph.phpwebhosting.com/dude/sanikstuff/tri.png)
This post has been edited by Sanik: Jun 3 2004, 06:01 PM
|
|
|
|
|
|
|
|
Jun 4 2004, 06:48 AM
|
|
The things we do to the people that we love...

Group: CulT Family
Posts: 585
Joined: 13-April 04
Member No.: 2,150
Gender: Male
|
http://jamesseph.phpwebhosting.com/dude/sa...stuff/DEBUG.zipK, first version of the converter. It doesn't support OBJ positioning YET. That's why Shadow's head appears right between his legs. Also, it still doesn't load faces, but I am getting to it. It takes an uncompressed PRS (thanks to Nemmy) which contains a .bin, to a .obj (Java or so model format, gonnah change it once it's debugged) CODE //BIN MDL dissassembler #include "stdio.h"
//Typedefs typedef unsigned char byte; typedef unsigned short word; typedef unsigned int dword;
typedef signed char sbyte; typedef signed short sword; typedef signed int sdword;
//BIN MDL defines //Material /* Flag Blending Src */ #define FBS_ZER (0) #define FBS_ONE (2048) #define FBS_OC (4096) #define FBS_IOC (6144) #define FBS_SA (8192) #define FBS_ISA (10240) #define FBS_DA (12288) #define FBS_IDA (14336)
#define FBS_MASK (14336)
/* Flag Blending Dst */ #define FBD_ZER (0) #define FBD_ONE (256) #define FBD_OC (512) #define FBD_IOC (768) #define FBD_SA (1024) #define FBD_ISA (1280) #define FBD_DA (1536) #define FBD_IDA (1792)
#define FBD_MASK (1792)
//BIN MDL structures typedef struct SEG { dword type; dword attach; float pos[3]; float rot[3]; float scl[3]; dword child; dword joint; } SEG;
//BIN MDL functions int main() { FILE *_file; FILE *_out; dword save; dword id; dword offset; dword dw_temp; //DEBUG float f_temp[6]; //DEBUG word w_total; //DEBUG word w_count; //DEBUG SEG seg; //Material byte alpha_mode[3]; //[SRC][DST][TYPE] //Lighting _out=fopen("out.obj","wb"); //DEBUG _file=fopen("in.bin", "rb"); if(_file == NULL) { printf("Error: Not enough free RAM\n"); exit(1); } read_new_tag: fread(&id, 4, 1, _file); while(!feof(_file) && (id!=0xFFFFFFFF)) { fread(&offset, 4, 1, _file); printf("slot %d = %d\n", id, offset); save=ftell(_file); fseek(_file, offset, SEEK_SET); //Read seg read_new_seg: fread(&seg.type, 4, 1, _file); fread(&seg.attach, 4, 1, _file); fread(&seg.pos, 36, 1, _file); //Loads all fread(&seg.child, 4, 1, _file); fread(&seg.joint, 4, 1, _file); //Print seg printf(" %d:\n dword %d\n dword %d\n ...\n dword %d\n dword %d\n", offset, seg.type, seg.attach, seg.child, seg.joint); //Output attachment data if((seg.attach!=0))// && (seg.type==20)) { fprintf(_out, "g group%d_%d\n", offset, seg.type); //DEBUG //Vertices (Needs to add support to all the formats) //Jump to the start of the vertex data fseek(_file, seg.attach, SEEK_SET); fread(&dw_temp, 4, 1, _file); fseek(_file, dw_temp, SEEK_SET); //Check if first word == 0x29 (Some kind of id check?) w_count=(fgetc(_file)+(fgetc(_file)<<8)); if(w_count!=0x29) { fprintf(_out, "#ERROR: %d - 0x29 check failed, skipping\n", w_count); goto skip_read; } //Skip vertex type descriptor (UNKNOWN DWORD) dword _fadf; _fadf=fgetc(_file)+(fgetc(_file)<<8)+(fgetc(_file)<<16)+(fgetc(_file)<<24); fprintf(_out, "#DEBUG: %d\n", _fadf); //Get total vertices by reading header w_count=(fgetc(_file)+(fgetc(_file)<<8))*2; //Get total vertices by calculating it w_total=((seg.attach-4)-(dw_temp))/12; //Check if the header is lying if(w_total!=w_count) { fprintf(_out, "#ERROR: %d != %d - Unknown object type, skipping\n", w_total, w_count); goto skip_read; } //Read the vertices for(w_count=0; w_count<(w_total/2); w_count++) { fread(&f_temp, 24, 1, _file); //Skip normals fprintf(_out, "v %f %f %f\n", f_temp[0], f_temp[1], f_temp[2]); //DEBUG (skips normals because normals are 3, 4, and 5 //fwrite(&f_temp[0], 4, 1, _out); //fwrite(&f_temp[1], 4, 1, _out); //fwrite(&f_temp[2], 4, 1, _out); } //Faces/strips //Jump to the start of the face data fseek(_file, seg.attach+4, SEEK_SET); fread(&dw_temp, 4, 1, _file); fseek(_file, dw_temp, SEEK_SET); //Figure the alpha_type w_count=fgetc(_file)+(fgetc(_file)<<8)+(fgetc(_file)<<16)+(fgetc(_file)<<24); alpha_mode[0]=w_count & FBS_MASK; alpha_mode[1]=w_count & FBD_MASK; alpha_mode[2]=w_count & 0x3F; switch(alpha_mode[2]) { case 17: //#define CnkM_D( _bits) (_bits)|(17) /* [CHead][4(Size)][ARGB] */ /* Diffuse */ fprintf(_out, "#DEBUG: D\n"); break; case 18: //#define CnkM_S( _bits) (_bits)|(18) /* [CHead][4(Size)][NRGB] N: NOOP(255) */ /* Specular */ fprintf(_out, "#DEBUG: S\n"); break; case 19: //#define CnkM_DS( _bits) (_bits)|(19) /* [CHead][8(Size)][ARGB][NRGB] */ /* Diffuse, Specular */ fprintf(_out, "#DEBUG: DS\n"); break; case 20: //#define CnkM_A( _bits) (_bits)|(20) /* [CHead][4(Size)][ERGB] E: Exponent */ /* Ambient */ fprintf(_out, "#DEBUG: A\n"); break; case 21: //#define CnkM_DA( _bits) (_bits)|(21) /* [CHead][8(Size)][ARGB][ERGB] */ /* Diffuse, Ambient */ fprintf(_out, "#DEBUG: DA\n"); break; case 22: //#define CnkM_AS( _bits) (_bits)|(22) /* [CHead][8(Size)][NRGB][ERGB] */ /* Ambient, Specular */ fprintf(_out, "#DEBUG: AS\n"); break; case 23: //#define CnkM_DAS( _bits) (_bits)|(23) /* [CHead][12(Size)][ARGB][NRGB][ERGB] */ /* Diff, Abmi, Spec */ fprintf(_out, "#DEBUG: DAS\n"); break; default: fprintf(_out, "#ERROR: %d - unknown alpha mode\n", alpha_mode[2]); goto skip_read; } //Finish skip_read: fputc('\n', _out); } //Move on to next seg if(seg.child!=0) { offset=seg.child; fseek(_file, seg.child, SEEK_SET); goto read_new_seg; } else { //Go back fseek(_file, save, SEEK_SET); goto read_new_tag; } } fclose(_file); fclose(_out); for(;;) { } return 0; }
|
|
|
|
|
|
|
|
Jun 4 2004, 11:57 AM
|
|
There's no such thing as 2

Group: CulT Family
Posts: 957
Joined: 20-August 03
From: Sydney, Australia
Member No.: 4
Gender: Male
|
Nice man, very nice. I suggest you take a few screenshots and post this in GD with some eye-catching title. A lot of people won't notice it in here buried at the end of a 4 page topic.
|
|
|
|
|
|
|
|
Jun 4 2004, 01:39 PM
|
|
The things we do to the people that we love...

Group: CulT Family
Posts: 585
Joined: 13-April 04
Member No.: 2,150
Gender: Male
|
I want to finish it first.
BTW, Nemesis, did you ever complete the DFF format support? I am thinking it's supposed to be 100%, but unsure if you had some things left .
|
|
|
|
|
|
|
|
Jun 4 2004, 02:34 PM
|
|
TEN THOUSAND FISTS IN THE AIIIIIR

Group: CulT Family
Posts: 4,753
Joined: 22-August 04
Member No.: 100
Gender: Male
Country: Puerto Rico
|
QUOTE(Sanik @ Jun 4 2004, 01:39 PM) I want to finish it first.
BTW, Nemesis, did you ever complete the DFF format support? I am thinking it's supposed to be 100%, but unsure if you had some things left . He still hasn't done vertex assignments, skeleton, and keyframes IIRC. and sign onto aim pzl.
|
|
|
|
|
|
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:
|
|