"StarVex" - Can StarFox be played on a Laser Projector?

Started by chuckborisnorris, January 29, 2022, 05:12:59 AM

Previous topic - Next topic

chuckborisnorris

You may have heard about the wireframe mod for StarFox1.2 (U) that came out at the beginning of this month.
This got me wondering: Is it possible to read the wireframe data from memory and display it as vector graphics in one's own application?

So I opened up Retroarch and setup a few emulators to see which would actually run StarFox. In the end I settled for the bSnes Supafaust, as it had the least lag, and started trying to read the simple information: bombs, HP, etc using GameConqueror. (I'm running Ubuntu 20.04 so can't use a lot of the StarFox tools out there unfortunately :-\)

Before long I had the 'offset' values for the HUD info: bombs, HP, the tilt of the horizon line, lives, what I can only describe as 'HIT!' and the boost cooldown timer (which was actually combined from a frame counter and another variable which checked whether the boost was decreasing or increasing). Nice  :thumbsup:

Next I read the memory map for the 'base' address of these offsets. In Linux this is done by literally reading a file:
$cat /proc/[pid]/maps
...and I built a small C application (Unfortunately I'm an embedded C guy, not an assembly guy) which drew the various elements I'd gathered to a custom window. Nice  :thumbsup:

There are good open-source laser DACs out there nowadays which can allow you to write your own programs straight to vector output, rather than rely on DMX or ILDA files, but since this is a ROM hacking site I won't bore you with the details. This is predominatly a laser project but I need advice from the StarFox wizards. Anyway the HUD elements are running nicely on my projector, at the cruddy framerate but meh, at least it's accurate. :thumbsup:


Now comes the hard bit..


I've been reading the various ROM hacking notes/memory maps/etc online and there is a lot of information on how to pull the object data as lists of vertices, tris and faces. This would be one way to go (and it may be the only way); read the object data and essentially create my own emulator.
The problem is, although the SuperFX is pretty simple to program, I don't really have time to learn a new assembly language at the moment and so I may have to shelve this project for a while if this ends up being the best option.

What I was hoping is that I could read the SuperFX DMA buffer (or something) and grab the drawn data directly. Now that there is this wireframe mod I wouldn't have to worry so much about reading all that texture info as well.
It is my understanding that:

  • The SuperFX chip writes all of its data to its own RAM and then transfers the data in one block to the SNES RAM via DMA as opposed to small chunks via HDMA.
  • bSnes emulators don't accurately emulate the Super FX chip.
  • The polygon data and HUD are drawn onto background 1 which is then drawn onto background 2 (in the SNES RAM?).
  • the Super FX chip is capable of drawing X,Y points as well as tilemaps.
Can anyone confirm the above 4 points?

Assuming these points are correct, it is going to be difficult to access the data as the Super FX originally intended (running on Linux via Retroarch only adds more application layers) but is there some way of reading that list of X,Y points? Some format or pattern to them e.g. X,Y,C,NULL?
Is there some sort of header information for the DMA/background 1 buffer that I can search for with scanmem/GameConqueror?
Searching for objects using the offsets given in the ROM hacking notes (which are using 4 digit hex) don't seem to correspond to the addresses I see inside Retroarch and so, unless there is some relative offset I can use (?), finding things solely by address has been a non-starter so far.
e.g. one source (which currently gives a 502 - bad gateway - error, bit annoying) says that the start of the DMA buffer can be found at $072800 but checking this address relative to all (base) memory locations in the 'misc' address space (using scanmem and proc/[pid]/maps) doesnt give me any kind of sensible data, either all 0's or a large block of some other, single, value. I don't have any luck finding any other addresses using this method, so clearly it's not working for me.
This is why I'm asking about patterns rather than addresses...

With a list of X,Y points I can create a method to cut that list down to a reasonable number for a laser projector quite easily.

So far I've found various address spaces containing sets of 2 or 3 numbers, split by NULL values, but these don't plot on a scatter graph.
I've also found large, mainly empty, areas of memory which could be filling up with the colour at each co-ordinate; could this be some sort of background mask?
What I really need to understand is how the information to draw these models to the screen is stored. Any help with, or insight into, this would be greatly appreciated. To be clear, I understand how to grab the raw object data but I don't really want all this info, I just want the draw buffer containing the XY-projected representation of the object data.   

P.S. I understand that this is going to be a mission to get the full game working but this is the main PoC I want to get working for now.

Thanks for your time,

kandowontu

Wow! That's a lot of deep data diving going on :o

I wish I could answer all of your questions...bsnes plus is recommended for more accurate superfx emulation first of all.

As for the shapes, it's exactly the same as starfox but instead of tri/quad/bigger faces, everything is 2 point edges. As for how the code is compiled, come to the discord and I can try and make some sense out of the source code part if you want!

Check my Twitter profile for my discord: http://twitter.com/kandowontu

chuckborisnorris

#2
Thank you for the invite Kandowontu! I'm busy this evening but I will come to the discord tomorrow after work to discuss this with you more.

I know, a deep-data dive isn't exactly the easy way to do this... if you have any advice to a better methodology please lmk.

Quote... it's exactly the same as starfox but instead of tri/quad/bigger faces, everything is 2 point edges.
Does this mean that there is a list of 'edges' formatted in much the same way as the vertex data?
i.e. 'Vertex List' type header(0x04?), vertex count (0x02), number of vertices (0x?? * 4)

Solgnar

You know your on the best possible timeline when there is talk of SF on Laser Projector 
:thumbsup: :beer: