Managed to read Star Fox SNES ROM using VL-Tone guides. I need more info.

Started by dyson132, April 11, 2012, 01:41:57 PM

Previous topic - Next topic

Stef

Just saw your messages ! Awesome VL Tones contacted you, well done :)
I downloaded the zip file he sent but looks like that is all we already have on different topic / forum / archive we explored.
I am still looking to find a bit more infos about object and after having spent some time on that i can only make some assumptions...
I figured the scale data but all others infos as object looks weird...
I will describe them later when i will be back at home but i guess VL-Tone can help with that (if he can remember) :)

dyson132

Quote from: Stef on March 06, 2013, 08:01:26 AM
I downloaded the zip file he sent but looks like that is all we already have on different topic / forum / archive we explored.
I looked over them too, I've left him a question about decompiling this SFXEdit and the Shockwave Object Decoder. Anyway, I am just hoping for solid bits of information like the following which I post here so it is searchable on the internets:
QuoteNote that some of the things that you find in SFXedit might not be used by the program itself and are just some text I pasted in my project for reference.
Also, SFXedit doesn't use/emulate any Super-FX code. It does feature a very simple 65c816 dissembler/assembler because level data sometimes depends on ASM code to branch, but it doesn't actually emulate the code.

Quote from: Stef on March 06, 2013, 08:01:26 AM
I am still looking to find a bit more infos about object and after having spent some time on that i can only make some assumptions...
I figured the scale data but all others infos as object looks weird...
I will describe them later when i will be back at home but i guess VL-Tone can help with that (if he can remember) :)
Great! Awesome and lets just hope! :D
Making a level editor would be awesome but I now see that without deconstructing the logic of the header information in the game it would be impossible to modify a stage size or amount of objects it can hold.
By the way, is it hard or even meaningful to map out a ROM? As in, "$60F58 here is the something that does this". Are there any tools for such a thing? I ask because I wish to make a cleaner document about what we already have. :D

Stef

Quote from: dyson132 on March 06, 2013, 08:26:37 AM
Making a level editor would be awesome but I now see that without deconstructing the logic of the header information in the game it would be impossible to modify a stage size or amount of objects it can hold.
By the way, is it hard or even meaningful to map out a ROM? As in, "$60F58 here is the something that does this". Are there any tools for such a thing? I ask because I wish to make a cleaner document about what we already have. :D

Actually SFXEdit already have the level editor, except it is done in hexa decimal edition form but you can actually already edit / modify Starfox level through the application :)
Map out the rom is a nice idea, it is the easiest way then to read / decode and understand the rom for someone else it but that would require much much time to do it ! Right now we already have many informations but you are right, they need to be compiled and set in a good form so we can easily read them. And as far i know there is no ready to go solution for that... except taking notepad and writing all by hands :p

By the way, here is the format of the object header as i now understand it :


$00: vertex address offset (2 bytes, low byte first)
$02: bank number (1 byte)
$03: face address offset (2 bytes, low byte first)
$05: Z position ?? (2 bytes, low byte first)
$07: scale, used as left shift operator: value <<= scale  (1 byte)
$08: unknown address, collision infos ?? (2 bytes, low byte first)
$0A: size X (2 bytes, low byte first)
$0C: size Y (2 bytes, low byte first)
$0E: size Z (2 bytes, low byte first)
$10: Z distance / alignment ? (2 bytes, low byte first)
$12: palette address (2 bytes, low byte first)
$14: id1
$16: id2
$18: id3
$1A: id4


Bank number = 0 is a special value meaning there is no vertex nor face data attached to this object.

To compute final vertex and face data address in the rom we have to use this formula :
((bank number - 1) * $8000) + address offset   (add $200 for headered rom)

Example of low poly arwing model header :
vertex address = ($10 * $8000) + $F173 = $8F173  ($8F373 on headered rom)
face address = (($10 * $8000) + $F196 = $8F196  ($8F396 on headered rom)

There are many informations I'm not sure about :
$05: Z distance ?? (2 bytes, low byte first)
$08: unknown address, collision infos ?? (2 bytes, low byte first)
$10: Z position / alignment ? (2 bytes, low byte first)

$05 seems to be something as Z distance of object but i'm really not sure, the filed is rarely set which make it even more difficult to figure.
$08 field is rarely set too but when it is done, it seems to be a 16 bit address... Note that field is almost time use of Arwing object or some big boss / base object.
$10 is almost time very close to the value set in $0E (size z) but not always the same, a bit more or a bit less... can't really figure what it is.

About the size fields, they give the final object size after scale factor have been applied. Once again I am not sure about them but i believe the size information could be use as a bounding box and Z position could be a sort of bounding box shift compared to object center. Just some suppositions...

Here is the last version of my object decoder tool :
https://www.dropbox.com/s/bem8k66w8syj80q/sfxObjReader.jar?dl=0

Red object : not correctly decoded
Green object : animated
Blue object : position field set

As you may see, the SFX Object decoder do not exactly use the same header decoding as the one explained above, it is just because i tried several test cases and i still don't have figured the real meaning of these fields.

Here is a preview of my project, just a small demo:
https://www.dropbox.com/s/macxo0841djlo5a/sfx_gen.zip?dl=0

I started to work on it a long time ago but i can now display direct object from starfox which is awesome =)
Ah yeah, you need a sega megadrive emulator to test it ;)

Edit: fixed dropbox links

dyson132

Quote from: Stef on March 06, 2013, 05:14:03 PM
I started to work on it a long time ago but i can now display direct object from starfox which is awesome =)
Ah yeah, you need a sega megadrive emulator to test it ;)

Where did this come from? xD
How did you do this a long time ago if you just now have the models?!?! :D
It looks great! How did you make this work?

Everything else sounds great. I think I will wait a bit more to rewrite my code, specially since I am kind of stuck with the stage information. :D
You've had awesome progress! :D

To help you out I'll begin hacking at the rom and using your table as reference for distorting objects.  >:D


:D the only one I did get to work as you mentioned out was the scale one. The collision ones are interesting but I couldn't figure out their inner workings although I know they are collisions since I managed to destroy the ship many times before actually starting the game. I also tried using the two bytes as 4 face index values but I'm still not sure.
The "$05: Z position ?? (2 bytes, low byte first)" seems to be right too because it shifter the position at with the Arwing becomes available.

I also answered a question I had for some time which was why is there a face missing from the the Corneria Base obj. It actually isn't missing, it is loaded as a separate object in order to be correctly drawn on screen using the BSP. See, this rectangle appears in front of the ship which should appear in front of the Corneria Base. This rectangle also appears as a separate object in the SFXEdit.

Do you want me to post the complete header info to VL-Tone or should you?.

Stef

Quote from: dyson132 on March 06, 2013, 06:36:22 PM
Where did this come from? xD
How did you do this a long time ago if you just now have the models?!?! :D
It looks great! How did you make this work?

I started to write the 3D engine a long time ago and i improved it so it can be fast enough to allow Starfox style game on a stock megadrive.
Also i started with my own models, i got the arwing one from the deconstruction page and i did other object by hand but they weren't that great. Also i did not wanted to show it until it has something interesting to show ;)
The good point is that megadrive share a lot of identical constraint / feature with the SNES (as the 4bpp color) so it is a nice target to attempt a "port". The difficult part is that i don't have the SuperFX to help, hopefully a stock megadrive has much more power than a stock SNES (thanks to the true 16 bits architecture) so even without SuperFX we can put some polygon up :)
The lack of a bitmap mode does not help either here but i can live with that (need software tile buffer to bitmap buffer conversion).

Quote
Everything else sounds great. I think I will wait a bit more to rewrite my code, specially since I am kind of stuck with the stage information. :D
You've had awesome progress! :D

To get that i somehow simulated a board to store level data, i use a sort of ztimer the same way the original Starfox does. When timer goes to 0 i simply read from the board next object until i read a new Ztimer value. For the moment i made a test level by putting random objects here and there with some movements for the big walker for instance. It's nice to see them animated as the original :)

Quote
To help you out I'll begin hacking at the rom and using your table as reference for distorting objects.  >:D

:D the only one I did get to work as you mentioned out was the scale one. The collision ones are interesting but I couldn't figure out their inner workings although I know they are collisions since I managed to destroy the ship many times before actually starting the game. I also tried using the two bytes as 4 face index values but I'm still not sure.
The "$05: Z position ?? (2 bytes, low byte first)" seems to be right too because it shifter the position at with the Arwing becomes available.

Unfortunately i can say the scale is the only parameter i am certain, the size / object bounds looks weird and as i say above, i do not see how use them neither yet.
All that values still need a lot of research ;)

Quote
I also answered a question I had for some time which was why is there a face missing from the the Corneria Base obj. It actually isn't missing, it is loaded as a separate object in order to be correctly drawn on screen using the BSP. See, this rectangle appears in front of the ship which should appear in front of the Corneria Base. This rectangle also appears as a separate object in the SFXEdit.

Glad to hear that, so the objects are corrects at least ;)

Quote
Do you want me to post the complete header info to VL-Tone or should you?.

We can post him a link here if he is interested :)

dyson132

A lot of great info in your post. I hope you finish the port. :D

I had already posted the link to this thread and I think he read it since he commented on SuperFX being emulated in SFXEdit. I'll post the header info in case he can give some insight.
I posted the link to your post about your port too, the idea is too good not to mention.

Stef

Quote from: dyson132 on March 07, 2013, 07:43:36 AM
A lot of great info in your post. I hope you finish the port. :D

Thanks :D I hope to finish it too but that is really *a lot* of work so that might become a simple "demo" but who know :)

Quote
I had already posted the link to this thread and I think he read it since he commented on SuperFX being emulated in SFXEdit. I'll post the header info in case he can give some insight.
I posted the link to your post about your port too, the idea is too good not to mention.

Cool ! I don't know if he actually follows our progression but i hope he is, its help would be very valuable :)

dyson132

Quote from: Stef on March 07, 2013, 08:20:45 AM
Thanks :D I hope to finish it too but that is really *a lot* of work so that might become a simple "demo" but who know :)

I guess the problem with stopping now is that you've gotten people's attention.
http://www.nintendoage.com/forum/messageview.cfm?catid=22&threadid=97838&StartRow=1

Oh no, now you have to finish. Blast processing my a**! :P
https://www.youtube.com/watch?v=PNGWykZ0ju0
https://www.youtube.com/watch?v=Bm-ICwWxaAY
Now it is personal.  :banghead:
And you'll have to add SVP chip.  ;D

I propose that in order to prove the Genesis is more powerful than the SNES... lets port Star Fox!
If you are a real fan you should prove it in the best way possible, help us decode the Star Fox SNES rom. :D
There must be really good reverse engineers that are also fanboys. xD

Stef

Yeah i realized that was posted elsewhere now, i'm glad to see how it was generally received :) funny to see it induced some nintendo vs sega fans wars too :p
Well anyway it would have be a shame to stop here now we have dig that far ;)

I first want to be able to use the max data i can from the original rom, the more we can extract, the less we have to reproduce :p
Then when that will be done i will probably work on optimization.
I got new inspirations about some infos present in header :D
I think the Z position /distance stuff are related to the Z clipping / collision test, this is something i need to test !


dyson132

Quote from: Stef on March 08, 2013, 08:29:14 PM
Well anyway it would have be a shame to stop here now we have dig that far ;)

I first want to be able to use the max data i can from the original rom, the more we can extract, the less we have to reproduce :p

Sure lets continue. I don't have much to offer since I am not as experienced as you are but I can verify stuff very quickly.
Also, since VL-Tone mentioned that he needed an 65c816 dissembler/assembler for level info, my guess is you can completely port the game. :D
I was just playing a Doom 64 port for PC:
http://www.doomworld.com/vb/source-ports/54058-doom64-ex-2-0a-feedback-build-updated-1-25-11/
The guy started out replicating the game from what he saw but ended up making an application that read from the rom data. It works very well. I want to do this with Star Fox. :D


Quote from: Stef on March 08, 2013, 08:29:14 PM
I got new inspirations about some infos present in header :D
I think the Z position /distance stuff are related to the Z clipping / collision test, this is something i need to test !

Great! I need more distractions from work! at least I won't get fired for coding so, do you need help?
I should be able to corrupt the game so much that it shows wireframe 3D cubes where the collision boundaries should be. I know you can do it too but I have the code ready and everything.
:D

Stef

Quote from: dyson132 on March 08, 2013, 08:43:12 PM
Sure lets continue. I don't have much to offer since I am not as experienced as you are but I can verify stuff very quickly.
Also, since VL-Tone mentioned that he needed an 65c816 dissembler/assembler for level info, my guess is you can completely port the game. :D
I was just playing a Doom 64 port for PC:
http://www.doomworld.com/vb/source-ports/54058-doom64-ex-2-0a-feedback-build-updated-1-25-11/
The guy started out replicating the game from what he saw but ended up making an application that read from the rom data. It works very well. I want to do this with Star Fox. :D

The good point of doing it on PC is that you're not limited in term of CPU resource, so you can really replicate game using most of the original data ! In my case i have to convert them in a more friendly format for the megadrive as i cannot waste any CPU resource in weird decoding code :p

Quote
Great! I need more distractions from work! at least I won't get fired for coding so, do you need help?
I should be able to corrupt the game so much that it shows wireframe 3D cubes where the collision boundaries should be. I know you can do it too but I have the code ready and everything.

Of course you're welcome to test that :D Honestly you are a lot faster than me for that as you already shown ;)


dyson132

Quote from: Stef on March 09, 2013, 07:07:20 AM
Of course you're welcome to test that :D Honestly you are a lot faster than me for that as you already shown ;)

I'll do it. Do you have any more guesses about the Z position /distance and Z clipping / collision test?

Stef

Quote from: dyson132 on March 09, 2013, 09:17:07 AM
I'll do it. Do you have any more guesses about the Z position /distance and Z clipping / collision test?

Thanks :) Honestly not really for the moment, i need to look more closely in these. I think you can try display a sort of bounding box around object using object size and also try to display straight Z line corresponding to object Z center minus the Z distance in header so you can see if this value is reliable as a clipping or collision detection.

dyson132

Quote from: Stef on March 11, 2013, 11:29:06 AM
Thanks :) Honestly not really for the moment, i need to look more closely in these. I think you can try display a sort of bounding box around object using object size and also try to display straight Z line corresponding to object Z center minus the Z distance in header so you can see if this value is reliable as a clipping or collision detection.
Cool. I'll have to do this in a few days though, I have to finish this damn Red Book!

:D
Look VL-Tone answered my questions, I have yet to read them:
http://jul.rustedlogic.net/thread.php?id=15998



I've read it now so I think I'll go into regular rom hacking because I really seem to be missing some tools. :P



I knew I had seen this somewhere. In case anyone wishes to replicate the checkerboard pattern they can start here. Page 63 of the RedBook, glPolygonStipple() . It is supposed to be used as a mask.

   glPolygonStipple (halftone);
   glBegin(GL_POLYGON);
    glVertex3f(200,  0,  0);
    glVertex3f(250,  0,  0);
    glVertex3f(250,100,  0);
    glVertex3f( 50,100,  0);
   glEnd();
   glDisable (GL_POLYGON_STIPPLE);



dyson132

Ok Stef!
My presentations are over, now I can try and do the stuff I said before.

Have you had any progress? just so I don't try to replicate what you have done. :D

Stef

Hey,

Glad to hear that :)
Unfortunately i did not made any progress as i did not have any free time lately and that is, until April...
So you can consider i am exactly at the same point as i was in the last post :p

dyson132

Quote from: Stef on March 23, 2013, 06:51:31 AM
Hey,

Glad to hear that :)
Unfortunately i did not made any progress as i did not have any free time lately and that is, until April...
So you can consider i am exactly at the same point as i was in the last post :p

Dammit! And I got my head stuck GLSL for work, I should be back to the rom soon.
:)

Stef

Hi,

Back to bring some news, not good ones unfortunately.
I had to fly some days ago for my job and unfortunately the air company lost one of my baggage on return, the baggage which contained my laptop actually... Usually i always keep my laptop as hand baggage and never put it to the check in but i didn't had choice this time. Even if the company told me they can still find the baggage i don't really trust them and assume it's already 100% lost. Worst than laptop itself is data loss... i lost about 7 months of data, work... I'm trying to recover as much i can from internet, forum, dropbox or whatever but i know i lost many stuff.
Right now i try to get back my starfox remake project, hopefully i had some backup sitting somewhere, unfortunately these backups are quite old (really older than the one i posted 1 month ago) but well, it can be redone.
Really glad that we discussed here as i could restore my starfox object decoder from archives i posted =)

dyson132

That is horrible!  :banghead:
I hope you get your stuff back soon! :)

I've been away too, progress is down to 0 on the Star Fox decode because I had to learn GLSL and stuff. I don't know when I'll resume it but I haven't left the thread either.

Good luck! :)

Stef

Yep, just unlucky this time... but as i said i have the motivation to get it back which is the most important :)
Glad to hear you're still around !


Quote from: dyson132 on April 10, 2013, 12:09:51 AM
That is horrible!  :banghead:
I hope you get your stuff back soon! :)

I've been away too, progress is down to 0 on the Star Fox decode because I had to learn GLSL and stuff. I don't know when I'll resume it but I haven't left the thread either.

Good luck! :)