Feature: Mupen64 movie file playback #192
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds an optional feature to play back Mupen64 movies from game start.
Mupen64 movies are used to create Tool-Assisted Speedruns (TASes). For more information on what a TAS is, go here: https://tasvideos.org/WelcomeToTASVideos.html. For an example of an N64 TAS: https://tasvideos.org/3264M.html.
In the context of the Nintendo 64, various TASing communities use Mupen64, most prominently (but not exclusively), Super Mario 64 TASers. A very nice feature of the M64 movie format compared to other N64 TASing emulators is that it records the inputs when the game actually polls the controller, as opposed to recording the input for each visual frame. This means that TASes in this format can be played back on console despite the different lag timing in HLE emulators and real N64s, using specific hardware devices made for this purpose (for example, see https://www.youtube.com/watch?v=BFBGWrGT1E8).
One interesting aspect of SM64 TASes is that sometimes, certain techniques are used to save time that can crash on real hardware if done improperly, so console verification is important for these kinds of movies. One such example of a trick would be moneybag duplication, which can result in an RCP crash due to too many objects on screen causing a buffer overflow in the game's internal display list buffer which ends up sending invalid F3D commands (https://www.youtube.com/watch?v=sE_aLqwIva0, notice the black squares, those graphical glitches are indicative of a crash on real hardware, but the reverse is not true: this kind of bug can crash on real hardware without displaying any graphical anomalies on emulator, so that's not a reliable indicator). HLE emulators and video plugins fail to emulate this type of crash, but cen64 crashes just like a real N64 would. Therefore it is convenient to be able to validate TASes to ensure that they work on real hardware using an accurate emulator like cen64, because having a hardware TAS playback device is not accessible for most people.
The PR adds a command-line option to play back a movie file like so:
cen64 -m64 1KeyTas.m64 pifdata.bin SM64-JP.z64
. It only supports playing back movies from console reset, since savestates aren't implemented. This is the preferred method anyway, because savestates can't be used for console verification.The interesting bit of code is in
si/controller.c:155
, which just copies the inputs stored in the M64 file to the SI controller verbatim during a PIF read command.