View Page Source

Revision (current)
Last Updated by feos 23 days ago
Back to Page

[|MAME] doesn't have rerecording, but you can TAS it by running it in [|libTAS].


!! What you'll need

* Some decently new [|libTAS] release.
* A versioned release of MAME, ideally pre-compiled.
** For Ubuntu, just grab something from [|Canonical Launchpad]. {{current stable release}} is fine unless you need something newer. You only need the {{mame-data}} and {{mame}} {{.deb}} packages, and make sure you get the right build for your architecture (usually it's {{amd64}}).
** There's also [|this unofficial repository] that hosts builds of latest MAME release for several Ubuntu releases, but previous builds get wiped regularly.
* Your game that runs on MAME.
** MAME ROMs are usually packed into {{.zip}} archives, but MAME can launch them from {{.7z}} or even a regular folder, as long as its called after the right ROM set.
** If you want to TAS a version (clone) of the game, you still need its base (parent) ROMs to be there too. Merged ROM sets have everything in the parent package, but MAME User Interface only detects games if they are packaged separately, so you won't be able to run the clone from MAME menus. But you can still launch it from terminal.
** If your game requires a BIOS (put it in the same folder as your ROM), and there are several compatible BIOS files in your set, you need to select the one you want to use. The easiest way is to do it in MAME menus: ''Configure Machine'' in main menu or the ''Tab'' hotkey when the game is loaded. You can also specify it via the {{-bios}} command-line argument, but to know what the right option is called you need to run mame with your game and {{-listxml}} argument, and the {{biosset name}} entries in the output will be what you need.

!! Using with libTAS

# MAME usually installs itself into {{/usr/games/mame}} so use that path for the ''Game executable'' field.
# ''Command-line options'' should be {{yourrom -window -nokeepaspect -skip_gameinfo -nomaximize -nonvram_save}} where {{yourrom}} is actually the name of your game's ROM set package. [|Full list] of options MAME supports.
# If you don't know which folders MAME looks for ROMs in and where to put your ROM, put it anywhere and add {{-rompath folder/containing/your/rom}} to ''Command-line options'', with actual path to your ROM, but without the filename.
# Make sure ''Runtime -> Prevent writing to disk'' is enabled, or MAME will dump files onto your disk, messing with game state and movie sync.
# If you've already launched your game outside libTAS, or if you've launched it in libTAS with ''Runtime -> Prevent writing to disk'' disabled, you may have {{nvram}} ([|non-volatile RAM]) contents dumped to your disk, which will mess with game state and movie sync. In Ubuntu, go to {{~/.mame}} and delete everything (usually it's {{cfg}}, {{nvram}}, and {{.ini}}s).

! Input keys

To know which input keys MAME expects as in-game controls, you can look them up in MAME menu. If mouse cursor is not working (you may need to run MAME in windowed mode by using the {{-w}} commandline switch), just use ''Tab'', ''Enter'', and arrow keys. Fullscreen hotkey is ''left Alt'' + ''Enter''.
* Launch MAME normally.
** If you're running MAME without a game loaded, use ''Tab'' to get to ''General Settings'', and then go to ''Input Assignments''.
** If you're running it with your game, hit ''Tab'' and go to ''Input Settings -> Input Assignments (this system)'' or ''Input Assignments (general)''. The former is probably more convenient because you don't have to assign keys you won't need for that game.
* Run MAME from libTAS.
** In order to access its menu you need to disable hotkey binding for ''Tab'' in libTAS ''Input -> Configure mapping'' menu (bound to ''Fast-forward'' by default).
libTAS may also have MAME's in-game control keys bound to something unrelated, unbind them too or reassign them in MAME.

Note that your run must sync on MAME with all UI hotkeys disabled! Using MAME User Interface within the movie is not allowed.
* UI hotkeys can be disabled by going to ''General Settings -> Input Assignments -> User Interface'' from the main MAME menu, or to ''Input Settings -> Input Assignments (general) -> User Interface'' while running a game. %%% Note: don't clear ''UI Up/Down/Select/Cancel'' hotkeys if you don't have mouse pointer working in MAME, otherwise you won't be able to navigate through menus.
* Download [|this file] and put it into {{~/.mame/cfg}}. Alternatively, you can put it into any folder and then send that path to MAME via the {{-cfg_directory}} command-line argument.

! Framerate

MAME emulates lots of machines with different framerates. It shows framerate in the information screen before the game (unless you disable it in the menu or via the {{-skip_gameinfo}} argument). But that value can't be used in libTAS since it expects framerate represented as numerator / denominator. To obtain those, we need to utilize [|MAME's Lua scripting] abilities.

Download [|this Lua script], put it anywhere, and add {{-script full/path/to/your/file/framerate.lua}} to ''Command-line options'' (specifying its actual full path). That way in terminal you'll be able to see what numerator and denominator you need to set in libTAS's ''Frames per second'' fields for that game (and only that game). It also prints intended aspect ratio for encoding.

! MAME replay file 

When your run is ready, you can make MAME create its internal replay file from it. This is not required, but it may help people who don't have libTAS and Linux or WSL2 set up, but still want to watch the movie in the emulator.
* Disable ''Runtime -> Prevent writing to disk''
* Add {{-record somefilename.inp}} to libTAS's ''Command-line options''
* Replay your {{.ltm}} movie and stop when needed
* The resulting file will appear in {{~/.mame/inp}}
* Replay it in standalone MAME via {{-playback somefilename.inp}} and [|other arguments of your choice]

!! Movie submissions

''We allow submissions using MAME with libTAS. Please follow these guidelines to ensure your movie is acceptable and can be synced:''

Follow all rules already in place for [EmulatorResources/LibTAS#MovieSubmissions|submitting libTAS movies].

Keep in mind our [MovieRules#GameplayMustBeAccurateToHardware|rules on emulation accuracy]. If the game has emulation problems, MAME tells that in its User Interface when you select that game in the list, and when you launch it.
* There should be no obvious audio, video, and/or gameplay-affecting glitches caused by poor emulation.
* Machines marked by MAME as {{Overall: NOT WORKING}} or with something {{Unimplemented}} are __not allowed for publication__.
* Non-arcade machines are only allowed if:
** TASVideos doesn't have an approved rerecording emulator for that system
** Emulation of that machine is marked in MAME as {{OK}}. {{Imperfect}} emulation is not allowed.

Configuring MAME before running the game (for example, presetting DIP switches) is allowed, as long as that configuration is __intended for playing that game normally__. Aside from that, your run must sync on default MAME config.

Using MAME User Interface within the movie is __not allowed for publication__. You run must sync on MAME with all [EmulatorResources/MAME#InputKeys|UI hotkeys] disabled!

__Make sure your movie starts with no save data!__ Having your own save data present may cause desyncs when other people try to run your movie. To delete your save data in Ubuntu, go to {{~/.mame}} and delete everything (usually it's {{cfg}}, {{nvram}}, and {{.ini}}s).

When making a libTAS movie that you plan to submit to TASVideos or upload it to userfiles, put {{Platform: Arcade}} at the very start of the movie annotations, that way the site will recognize your platform properly. Other systems that MAME can emulate can be supported in the future, if the system is emulated well (see above).

In your description or movie annotations, please provide the following:
* libTAS version
* MAME version (ideally with a link to the release build package)
* Additional MAME configuration steps if they are necessary for your movie.
* Filename and MD5 hash of your ROM set (use {{md5sum}} in a terminal)