Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Mupen64 movie file playback #192

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lemon32767
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant