First of all, this is going to be another wall of text!
Generally speaking, the same microcodes (Ucodes for short) are used across most N64 games, but, as messiaen said, there are variations as well as updated versions. The ones used in the majority of games are:
- Fast3D (or "RSP SW 2.0D"), for example in Mario 64 and Waverace 64
- F3DEX 1.xx, for example in Starfox, Mystical Ninja or Aerogauge
- F3DEX 2.xx, for example in Smash Bros., Evangelion or Sin & Punishment
- F3DZEX, a seemingly specialized version of the former used in the Zelda games and Animal Forest
Additionally, games are able to use multiple Ucodes at once (I seem to recall a LOADUCODE command or similar, I suppose that's used for switching), like ex. Evangelion, which also uses a 2D Ucode called S2DEX. That one is also used by Yoshi's Story and is the reason why both games weren't emulated for quite some time - emulators/video plugins didn't support that Ucode. There are a few more in Nintendo's official set of Ucodes, but those aren't used that often, or at least it appears so (ex. L3DEX). And finally, there are a few customized Ucodes made/modified by the game's developers themselfs, like those used in, if I recall, Star Wars Rouge Squadron and Indiana Jones.
So overall, once a basic RSP Display List interpreter is coded up, it should be rather easy to adapt it for different games as long as that use the same Ucode. That said, loading and finding Display Lists to render is a story in itself. I've used multiple methodes so far to get them:
One would be the way OZMAV does it with Zelda - it opens a pair of extracted files, in this case zmap and zscene files which contain geometry data in Display Lists, actor information (characters, signs, greenery, etc), collision data, different area configurations, etc. Then I scan those files for the Display List start command, 0xDE here (DE000000 xxyyyyyy, the xx/yy being the DList's RAM segment and offset), take note of their offsets and render them. Alternatively, if there aren't any such starting commands (like in zobj files, the actor models I've mentioned, and a few maps) you can check for 0xE7 which is some kinda synchronization command for the RSP which appears in every Display List, but that naturally gives you many, possibly incorrect, entry points for rendering.
Next up is loading, analyzing and rendering from a ROM. Unless there's already documentation about the game out, like luckily with Mario 64, you'll most likely need to tear the ROM open yourself to figure out where ex. level information is stored, which DLists are needed for each level and where they're stored, etc. There are projects for Zelda that read everything out of the ROM, also correctly rendering actors with their real models instead of ugly cubes like I'm doing it.
Finally, which was a wild but logical guess, you can try to use RAM dumps for rendering, like I'm doing it with the Evangelion branch (also works with other games, like I said above, but Eva looks best in it ). Many games have what I'm calling a "Master Display List", which sets up the RAM segments among other things, and then calls each "Geometry Display List", the ones that contain all the drawing commands themselfs, like VTX, TRI1, TRI2, etc. I don't know how to automatically detect that Master DList's offset, so you've got to manually check the RAM dump for a possible offset and try that out in the viewer.
In the end, taking Banjo-Kazooie as an example which is using a F3DEX 1.xx Ucode, after taking a compatible DList interpreter, determining the best method to use for DList finding - there's a file extractor for the game, and actually even a model viewer using them (Bottles' Glasses by cooliscool, also author of the Zelda editor Utility of Time), so I suppose that would be the easiest -, and adapting what might need adapting (file loading, RAM segment stuff), you've got yourself a working model viewer.
...and man, this has become really, really long. I apologize for this giant wall of text here, but I hope it was somewhat interesting and that I haven't forgot anything.
____________________ cu xdaniel
|