Sonic and Sega Retro Message Board: Dude's sadx Model Tools, version 1.4 - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Page 1 of 1
    Locked
    Locked Forum

Dude's sadx Model Tools, version 1.4 New Model exporting!

#1 User is offline Dude 

Posted 20 September 2009 - 02:16 AM

  • 3ds MAX Help Desk
  • Posts: 3026
  • Joined: 11-September 04
  • Gender:Male
  • Location:Southbridge, MA
  • Project:Sonic Adventure Generations
  • Wiki edits:43
Well after a long time working, I'm ready to release my latest set of hacking tools. This release has all of the old stuff, plus 2 big things that I'm sure people will love.

New features:
- An almost perfect maxscript model exporter that exports split model data. The exported data can be re-compiled by hand with notepad and a hex editor.
- A new program called sadxmdl_porter.exe. This program takes a model chunk (everything from material data to the end of the attach data) and a base address in sonic.exe where you want to insert it, and fixes all of the pointers so you can paste the file into sonic.exe



download


How to use the exporter
If you are exporting a single mesh model:
1. open 3dsmax, load your scene with the model in question. Select the model piece you want to export and make sure the pivot point is centered to the model. In the toolbar on the right hand side of the screen, go to the "utilities" tab and click the MaxScript button. Then press "Run script" and locate the exporter script. The rollout should show up. Check all of the boxes, pick the export directory and press "Export Data"

2. Now that you have your split model data you can start putting them together. Open Hex workshop and Notepad. You'll need to grab a material struct, either premade from sonic.exe/chrmodels or construct it yourself. Paste the material struct into a new file in Hex Workshop. Save the file as "Model.nj"

3. Go to the end of "Model.nj" and write down the address in notepad as "Mesh 1; poly". Open out.ply and paste it at the end of the material data and write the new file end address as "Mesh1; uv". Open out.uv and paste its contents into model.nj.

4. Write down the new end address in your log file as "meshes". Go back to model.nj in hex workshop and insert 0x1c bytes. The first byte is the material ID, which will need to be 00, but increments with each mesh we add. The second byte will need to be 0x00 also, this means the model is using trilists. The next 2 bytes are a short int for how many polygons are in the mesh. Get this number from 3dsmax by selecing the model, going into triangle mode and doing "Select All". Max will report the number of tris in the sidebar on the right. The next 4 bytes are the pointer to the poly data, which we wrote down in step 3. Skip ahead 0xc bytes. The next 4 bytes will be a pointer to the UV data, which we also wrote down in step 3. The next 4 bytes are padding and then we should be at the end of the file.

5. Go to the end of the file, write down the address as "vertex data". Open out.vt and paste the data at the end of model.nj

6. Go to the end of the file, write down the address as "vertex normals". Open out.vn and paste the data at the end of model.nj You've now added all of the model data. Only one last thing to process.

7. Insert 0x2c bytes. This will be our ATTACH data. The first 4 bytes are the pointer to the vertex data (step 5). The second 4 are pointer to the normal data (step 6). The next 4 are the number of verticies in the model (retrieved the same was as the poly total was). The next 4 is the pointer to the mesh data (step 4). The next 4 is the pointer to the material data (should be 0 in this case). The next 2 bytes are the mesh count, then the next 2 are the material count (both 1 in this tutorial). The next 0xc bytes are the relative coordinates for the center of the model in floats (should also be 0 because we centered the pivot in step 1), and the next float is the radius of the model, and the last 4 bytes are padding. Save Model.nj and make a backup of it.

8. Run sadxmdl_porter.exe. Tell it the name of the nj file you made earlier, then give it the address you plan on putting the model in sonic.exe. The program is verbose sometimes, this is normal. It will also generate an out.log. This is useful for debugging but you shouldn't need it unless something went wrong.

9. congrats, model.nj is now ready to be put in sonic.exe. You'll still need to give it a seg, and a COL if you're using it for levels but the model data is done.

I'll make the tutorial for doing multiple mesh models later.
This post has been edited by Dude: 29 April 2010 - 12:39 PM

#2 User is offline Azukara 

Posted 21 September 2009 - 06:10 PM

  • Don't let's start!
  • Posts: 2807
  • Joined: 17-October 07
  • Gender:Male
  • Location:Meowth's party
  • Project:Sonic World Runner
  • Wiki edits:27
I watched the videos of this on Youtube, and then I saw the shark. I laughed so hard I almost cried. =P

Really, this is neat stuff. It looks like the community is finding out how to take this game apart more and more every day....

#3 User is offline Hinchy 

Posted 04 October 2009 - 10:39 PM

  • Up And Down And All Around
  • Posts: 1629
  • Joined: 04-September 08
  • Gender:Not Telling
  • Location:Apartment 0xFF
  • Project:Sonic Melponterations
  • Wiki edits:32
I am so confused on how to rip things with this. I find the amount of col structs for Ice Cap segment 0 from 4 bytes before 10755376 - which is 59. I go back to each COL struct in there in reverse, and I'm pretty sure the models are between 13866820 and 14874740. But then I rip these models and I get a bunch of unrelated crap. It's a problem with my technique, as I got similar results from trying to rip Twinkle Park. HALP

#4 User is offline Dude 

Posted 05 October 2009 - 11:25 AM

  • 3ds MAX Help Desk
  • Posts: 3026
  • Joined: 11-September 04
  • Gender:Male
  • Location:Southbridge, MA
  • Project:Sonic Adventure Generations
  • Wiki edits:43
QUOTE (Hinchy @ Oct 4 2009, 11:39 PM)
I am so confused on how to rip things with this. I find the amount of col structs for Ice Cap segment 0 from 4 bytes before 10755376 - which is 59. I go back to each COL struct in there in reverse, and I'm pretty sure the models are between 13866820 and 14874740. But then I rip these models and I get a bunch of unrelated crap. It's a problem with my technique, as I got similar results from trying to rip Twinkle Park. HALP


OK this is the proper technique for doing so and when I finish writing my level ripper it will work like this:
1. store the value for number of col structs (in your case 59)
2. skip 4 bytes (I dunno what the 0c means but its *almost* always there)
3. The next value is a float (in your case 3000)
4. the 4 bytes after that point to the beginning of the col structs, subtract the key and follow it.
5. Take the stored value for col number and multiply it by 0x24 (36)
6. Take the result (84c) and select a block of that many bytes, starting from the address pointed to in step 4.
7. Copy that into a new file, then start reading from it using the col format and rip each level model one at a time. (this may require a custom ripper)
8. Finished level rip.
This post has been edited by Dude: 05 October 2009 - 11:26 AM

#5 User is offline Dude 

Posted 27 October 2009 - 05:44 PM

  • 3ds MAX Help Desk
  • Posts: 3026
  • Joined: 11-September 04
  • Gender:Male
  • Location:Southbridge, MA
  • Project:Sonic Adventure Generations
  • Wiki edits:43
Bump, update at the top.

#6 User is offline SANiK 

Posted 31 October 2009 - 02:43 PM

  • Posts: 408
  • Joined: 21-September 04
  • Gender:Male
  • Wiki edits:6
Dear Dude: I am so fucking proud of you. You're like a brother to me.

"Does this mean you'll go back to the SADX/Sonic scene?"
Sadly no. :O

Keep up the great work though.

#7 User is offline Dude 

Posted 03 November 2009 - 04:43 PM

  • 3ds MAX Help Desk
  • Posts: 3026
  • Joined: 11-September 04
  • Gender:Male
  • Location:Southbridge, MA
  • Project:Sonic Adventure Generations
  • Wiki edits:43
New version released, this one does the pivots for you, saving hours of work and needless exhaustion. Tutorial and further updates coming eventually.

#8 User is offline MainMemory 

Posted 03 November 2009 - 08:18 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 3369
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
Would it kill you to use hexadecimal for the addresses? I would like to have some consistency. The number of objects can stay in decimal.

#9 User is offline Hinchy 

Posted 20 November 2009 - 05:14 PM

  • Up And Down And All Around
  • Posts: 1629
  • Joined: 04-September 08
  • Gender:Not Telling
  • Location:Apartment 0xFF
  • Project:Sonic Melponterations
  • Wiki edits:32
I messged this to Dude but if any of you guys can help me with this it'd sure be appreciated.

QUOTE
(3:39:47 PM) zachhinchliffe: dude me and jeztac are having trouble with importing new models with your new tools
(3:47:29 PM) zachhinchliffe: the model imports way off location and disappears when I go near it
(4:12:42 PM) zachhinchliffe: all we're doing is editing the vertexes without changing the model location at all
(4:13:02 PM) zachhinchliffe: and then it goes way off-location, to the right of the second checkpoint
(4:14:21 PM) zachhinchliffe: of emerald coast that is

This post has been edited by Hinchy: 20 November 2009 - 05:14 PM

#10 User is offline Dude 

Posted 29 April 2010 - 12:39 PM

  • 3ds MAX Help Desk
  • Posts: 3026
  • Joined: 11-September 04
  • Gender:Male
  • Location:Southbridge, MA
  • Project:Sonic Adventure Generations
  • Wiki edits:43
Well after a long time working, I'm ready to release my latest set of hacking tools. This release has all of the old stuff, plus 2 big things that I'm sure people will love.

New features:
- An almost perfect maxscript model exporter that exports split model data. The exported data can be re-compiled by hand with notepad and a hex editor.
- A new program called sadxmdl_porter.exe. This program takes a model chunk (everything from material data to the end of the attach data) and a base address in sonic.exe where you want to insert it, and fixes all of the pointers so you can paste the file into sonic.exe



download


How to use the exporter
If you are exporting a single mesh model:
1. open 3dsmax, load your scene with the model in question. Select the model piece you want to export and make sure the pivot point is centered to the model. In the toolbar on the right hand side of the screen, go to the "utilities" tab and click the MaxScript button. Then press "Run script" and locate the exporter script. The rollout should show up. Check all of the boxes, pick the export directory and press "Export Data"

2. Now that you have your split model data you can start putting them together. Open Hex workshop and Notepad. You'll need to grab a material struct, either premade from sonic.exe/chrmodels or construct it yourself. Paste the material struct into a new file in Hex Workshop. Save the file as "Model.nj"

3. Go to the end of "Model.nj" and write down the address in notepad as "Mesh 1; poly". Open out.ply and paste it at the end of the material data and write the new file end address as "Mesh1; uv". Open out.uv and paste its contents into model.nj.

4. Write down the new end address in your log file as "meshes". Go back to model.nj in hex workshop and insert 0x1c bytes. The first byte is the material ID, which will need to be 00, but increments with each mesh we add. The second byte will need to be 0x00 also, this means the model is using trilists. The next 2 bytes are a short int for how many polygons are in the mesh. Get this number from 3dsmax by selecing the model, going into triangle mode and doing "Select All". Max will report the number of tris in the sidebar on the right. The next 4 bytes are the pointer to the poly data, which we wrote down in step 3. Skip ahead 0xc bytes. The next 4 bytes will be a pointer to the UV data, which we also wrote down in step 3. The next 4 bytes are padding and then we should be at the end of the file.

5. Go to the end of the file, write down the address as "vertex data". Open out.vt and paste the data at the end of model.nj

6. Go to the end of the file, write down the address as "vertex normals". Open out.vn and paste the data at the end of model.nj You've now added all of the model data. Only one last thing to process.

7. Insert 0x2c bytes. This will be our ATTACH data. The first 4 bytes are the pointer to the vertex data (step 5). The second 4 are pointer to the normal data (step 6). The next 4 are the number of verticies in the model (retrieved the same was as the poly total was). The next 4 is the pointer to the mesh data (step 4). The next 4 is the pointer to the material data (should be 0 in this case). The next 2 bytes are the mesh count, then the next 2 are the material count (both 1 in this tutorial). The next 0xc bytes are the relative coordinates for the center of the model in floats (should also be 0 because we centered the pivot in step 1), and the next float is the radius of the model, and the last 4 bytes are padding. Save Model.nj and make a backup of it.

8. Run sadxmdl_porter.exe. Tell it the name of the nj file you made earlier, then give it the address you plan on putting the model in sonic.exe. The program is verbose sometimes, this is normal. It will also generate an out.log. This is useful for debugging but you shouldn't need it unless something went wrong.

9. congrats, model.nj is now ready to be put in sonic.exe. You'll still need to give it a seg, and a COL if you're using it for levels but the model data is done.

I'll make the tutorial for doing multiple mesh models later.

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users