Final Fight - Creating Attract Movies

6/16/2011

Here is a shell script I've written to generate AVI files for your favorite game

Just copy everything below into a text file and save as MAME2AVI.BAT

Run MAME2AVI

The script will search and create and missing attract movies

Read the instructions

 

@echo off
::::::::::::::::::::::::::::::::::::::::::::::::::
:::                                            :::
::: MAME ATTRACT CREATOR SCRIPT                :::
:::                                            :::
::: DOSMAME V1.0 June 2011                     :::
:::                                            :::
::: HTTP://DOSMAME.MAMEWORLD.NET               :::
:::                                            :::
::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::
:::                                            :::
::: MAME2AVI.BAT                               :::
:::                                            :::
::: PREREQUISITES:                             :::
:::  MENCODER                                  :::
:::  http://oss.netfarm.it/mplayer-win32.php   :::
:::  PUT MENCODER AND THIS SCRIPT IN THE       :::
:::  'tools' DIRECTORY SPECIFIED IN THE USER   :::
:::  OPTIONS BELOW                             :::
:::                                            :::
:::  A WORKING WINDOWS COMMAND-LINE VERSION    :::
:::  OF MAME                                   :::
:::                                            :::
:::                                            :::
:::                                            :::
::: THIS SCRIPT WILL;                          :::
::: .SKIP AVI CREATION IF THE MOVIE ALREADY    :::
:::  EXISTS IN %mame_dir%\avi\                 :::
::: .SKIP ROMS NOT AVAILABLE IN %mame_dir%\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=8ballact
:: SET DEBUG TO 1 AND SET A ROM NAME IF YOU NEED TO DEBUG
:: A ROM AND SKIP THROUGH EACH STEP OF THE SCRIPT

:::
::: END OF DEBUG OPTIONS
:::
::::::::::::::::::::::::::::::::::::::::::::::::::




::::::::::::::::::::::::::::::::::::::::::::::::::
:::
::: SET USER OPTIONS BELOW
:::

set parents_only=1
:: SET THIS TO 1 IF YOU ONLY WANT PARENT GAMES, OR 0 (ZERO) FOR ALL

set game_duration=50
:: THIS IS THE AMMOUNT OF TIME THE MOVIE WILL RUN IN SECONDS

set trim=25
:: THIS IS THE AMOUNT OF TIME IN SECONDS TO TAKE OFF THE BEGINNING OF THE MOVIE

set mame_dir=d:\mame
:: THIS IS THE DIRECTORY OF MAME.EXE

set mame_exe=groovymame64.exe
:: THIS IS THE MAME EXECUTABLE

set tools=d:\roms2avi
:: THIS IS THE FOLDER WHERE THIS SCRIPT AND MEMCODER LIVES

:::
::: END OF USER OPTIONS
:::
::::::::::::::::::::::::::::::::::::::::::::::::::





::::::::::::::::::::::::::::::::::::::::::::::::::
:::
::: MAIN SCRIPT - DON'T TOUCH THIS BELOW
:::

if %debug% == 1 @echo on
cd %mame_dir%
if %parents_only% == 1 for /f "tokens=2" %%a in ('%mame_dir%\%mame_exe% -listclones') do call :doIt %%a
if %parents_only% == 0 for /f "tokens=1" %%a in ('%mame_dir%\%mame_exe% -listfull') do call :doIt %%a

:doIt
set rom=%1
if exist %mame_dir%\avi\%rom%.avi goto aviExist
if not exist %mame_dir%\roms\%rom%.zip goto romNotExist
if not exist avi mkdir avi

echo.
echo Running game %rom%
echo.
if %debug% == 1 if %rom% == %debug_rom% pause
start /min /wait %mame_dir%\%mame_exe% %rom% -aviwrite %rom%.avi -str %game_duration% -nouse_backdrops -nouse_bezels -window
if %debug% == 1 if %rom% == %debug_rom% pause

:createVideo
echo.
echo Creating video for %rom%
echo.

if %debug% == 1 if %rom% == %debug_rom% pause
if not exist snap\%rom%.avi goto noAviFound
%tools%\mencoder -oac copy -ovc copy snap\%rom%.avi -ss %trim% -oac mp3lame -ovc lavc -lavcopts acodec=mp3,1bitrate=128,vcodec=mpeg4,vbitrate=800,vhq,vm4v -o avi\%rom%.avi
if %debug% == 1 if %rom% == %debug_rom% 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% 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
:::
::: END OF MAIN SCRIPT
:::
::::::::::::::::::::::::::::::::::::::::::::::::::


Comments have been closed.

Blog

DOS MAME Retired
9/23/2013

Today I'm officially retiring my DOS MAME pages. As of writing, MAME is at version ... Read More

x64MAME - Windows 7 Config
12/7/2012

Windows 7 Config (WIP) Set a static IP address with NO gateway or DNS to prevent ... Read More

x64MAME - All Change
12/7/2012

I've been having some reliability issues with Windows XP x64 - lock outs & ... Read More

More Blog Entries