MAME Attract Movie Generation Script
So in order to keep up with the developement of MAME, I've created a script to generate an attract movie.
to run the script you mush modify the options relevent to your setup.
The 2 configurable optios are;
::: DEBUG OPTIONS
This is optional - this is where you can troubleshoot the script
::: USER OPTIONS
Here is where you set your local directories, movie length and output options.
Below is the script - copy and save as a .BAT
Enjoy....
@echo off
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::: :::
::: MAME ATTRACT CREATOR SCRIPT :::
::: :::
::: DOSMAME V2.0 July 2011 :::
::: :::
::: HTTP://DOSMAME.MAMEWORLD.NET :::
::: :::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::: :::
::: MAME2AVI.BAT :::
::: :::
::: THIS SCRIPT; :::
::: RUNS THROUGH A SOURCE FOLDER AND CREATES A NEW AVI FILE IN A DESTINATION FOLDER :::
::: SKIPS AVI CREATION IF THE MOVIE ALREADY EXISTS IN THE DESTINATION FOLDER :::
::: SKIP AVI CREATION FOR MISSING ROMS :::
::: :::
::: :::
::: :::
::: PREREQUISITES: :::
::: MENCODER.EXE http://www.mplayerhq.hu/DOCS/HTML/en/index.html :::
::: http://oss.netfarm.it/mplayer-win32.php :::
::: PUT MENCODER.EXE AND THIS SCRIPT IN THE 'tools' DIRECTORY SPECIFIED IN THE USER :::
::: OPTIONS BELOW :::
::: :::
::: A WORKING WINDOWS COMMAND-LINE VERSION OF MAME AND ROMS :::
::: :::
::: :::
::: BEFORE RUNNING, SETUP YOUR USER OPTIONS! :::
::: :::
::: MAKE A BACKUP! :::
::: :::
::: USAGE IS ENTIRLY AT YOUR OWN RISK :::
::: xDOSMAMEx :::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::
::: DEBUG OPTIONS
:::
set debug=0
set debug_rom=dingo
set debug_pause=0
:: SETTING DEBUG TO 1 WILL JUST RUN 1 ROM 'debug_rom'
::
:: SETTING 'debug_pause' TO 1 WAIT FOR A KEY PRESS FOR EACH
:: STAGE OF THE PROCESS WHILST DEBUGGING
::
:: SET 'debug' TO 0 TO SCAN ALL AVAILABLE ROMS WITHOUT A PAUSE
:::
::: END OF DEBUG OPTIONS
:::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::
::: USER OPTIONS
:::
set create_watermark=1
:: SET THIS TO 1 IF YOU WANT THE GAME NAME OVERLAYED
:: SET TO 0 IF NOT
set mame_dir=x:\mame\mame
:: THIS IS THE DIRECTORY OF THE MAME EXECUTABLE (NO TRAILING SLASH)
set mame_options=-nothrottle -nosound -window
:: SET CUSTOM MAME OPTIONS HERE
set existing_avi_path=x:\mame\mame\avis
:: THIS IS WHERE THE SCRIPT WILL SCAN FOR EXISTING AVIs - IF NO AVI IS FOUND IN THIS PATH, A NEW AVI WILL BE CREATED IN THE PATH BELOW (NO TRAILING SLASH)
set new_avi_path=x:\mame\mame\avis-new
:: THIS IS WHERE NEW AVIS WILL BE CREATED (NO TRAILING SLASH)
set mame_exe=mame64.exe
:: THIS IS THE MAME EXECUTABLE
set tools=X:\documents\dev\roms2avi
:: THIS IS THE FOLDER WHERE THIS SCRIPT AND MEMCODER LIVES (NO TRAILING SLASH)
set parents_only=1
:: SET THIS TO 1 IF YOU ONLY WANT PARENT GAMES, OR 0 (ZERO) FOR ALL
set game_duration=60
:: THIS IS THE AMMOUNT OF TIME THE MOVIE WILL RUN IN SECONDS
set trim=30
:: THIS IS THE AMOUNT OF TIME IN SECONDS TO TAKE OFF THE BEGINNING OF THE MOVIE
set encoder_options=-oac copy -ovc copy -oac mp3lame -oac mp3lame -ovc lavc -aspect 4/3
set fencoder_options=-acodec libmp3lame -vcodec libx264 -aspect 4/3
:: SET USE MENCODER OUPTPUT OPTIONS HERE - SEE http://www.mplayerhq.hu/DOCS/HTML/en/mencoder.html
:::
::: END OF USER OPTIONS
:::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::
::: MAIN SCRIPT - DON'T TOUCH THIS BELOW
:::
if not exist %new_avi_path% mkdir %new_avi_path%
if %debug% == 1 @echo on
cd %mame_dir%
if %debug% == 1 Call :doIt %debug_rom%
if %debug% == 0 if %parents_only% == 1 for /f "tokens=2" %%a in ('%mame_dir%\%mame_exe% -listclones') do call :doIt %%a
if %debug% == 0 if %parents_only% == 0 for /f "tokens=1" %%a in ('%mame_dir%\%mame_exe% -listfull') do call :doIt %%a
:doIt
set rom=%1
if %debug% == 1 if %rom% == %debug_rom% if %debug_pause% == 1 pause
if exist %new_avi_path%\%rom%.avi goto aviExist
if %debug% == 1 if %rom% == %debug_rom% if %debug_pause% == 1 pause
if not exist %mame_dir%\roms\%rom%.zip goto romNotExist
:getGameInfo
echo.
echo Getting game infomation for %rom%
echo.
for /f "tokens=1,2*" %%a in ('%mame_dir%\%mame_exe% -listfull') do (
if %rom% == %%a set game_fullname=%%b%%c
)
for /f "useback tokens=*" %%a in ('%game_fullname%') do set game_fullname=%%~a
echo %game_fullname%
:createWatermarkFile
if %create_watermark% == 1 if exist %tools%\watermark.srt del %tools%\watermark.srt
if %create_watermark% == 1 echo 1 >> %tools%\watermark.srt
if %create_watermark% == 1 echo 00:00:00,000 --^> 99:59:59,000 >> %tools%\watermark.srt
if %create_watermark% == 1 echo %game_fullname% >> %tools%\watermark.srt
if %create_watermark% == 1 set watermarkOptions=-sub %tools%\watermark.srt
echo.
echo Running game %rom%
echo.
if %debug% == 1 if %rom% == %debug_rom% if %debug_pause% == 1 pause
cd %mame_dir%
%mame_exe% %rom% -aviwrite %rom%.avi -str %game_duration% %mame_options%
if %debug% == 1 if %rom% == %debug_rom% if %debug_pause% == 1 pause
:createVideo
echo.
echo Creating video for %rom%
echo.
if %debug% == 1 if %rom% == %debug_rom% if %debug_pause% == 1 pause
if not exist snap\%rom%.avi goto noAviFound
if %create_watermark% == 1 %tools%\mencoder snap\%rom%.avi -ss %trim% %encoder_options% -o %new_avi_path%\%rom%-1.avi
if %create_watermark% == 1 %tools%\mencoder %new_avi_path%\%rom%-1.avi %encoder_options% %watermarkOptions% -o %new_avi_path%\%rom%.avi
if %create_watermark% == 1 del %new_avi_path%\%rom%-1.avi /q
if not %create_watermark% == 1 %tools%\mencoder snap\%rom%.avi -ss %trim% %encoder_options% -o %new_avi_path%\%rom%.avi
if %debug% == 1 if %rom% == %debug_rom% if %debug_pause% == 1 pause
goto aviComplete
:noAviFound
echo.
echo Error: no snap\%rom%.avi output found - check roms
echo Error: no snap\%rom%.avi output found - check roms >> movie-log.txt
:aviComplete
echo.
echo Process complete for %rom%
if %debug% == 1 if %rom% == %debug_rom% if %debug_pause% == 1 pause
echo Cleaning up %rom%
echo.
::del snap\%rom%.avi
:aviExist
echo.
echo %rom%.avi exists - skipping %rom%
goto :end
:romNotExist
echo.
echo %rom% rom not found
goto :end
:end
cd %tools%
:::
::: END OF MAIN SCRIPT
:::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::