Batch file -- you can use it to record .inp

General discussion on MAME, MARP, or whatever else that doesn't belong in any of the other forums

Moderators: mahlemiut, seymour, QRS

Post Reply
User avatar
mike_myers
Button Masher
Button Masher
Posts: 61
Joined: Sat Dec 20, 2003 10:38 pm
Contact:

Batch file -- you can use it to record .inp

Post by mike_myers »

This batch file destroys NVRAM\ directory before recording games and uses HISCORE.BAT to show the best score for that game ['normal' mode and 'VS' mode only]

Code: Select all

@echo off
:begin
cls
set game=%1
:: Default game: Super Sidekicks 2 -change it if you want-
if "%1"=="" set game=SSIDEKI2

:nvram
if not exist nvram\nul goto scores
:: Remove NVRAM\ directory
deltree /y nvram
:: Create a File (NVRAM). -- MAME can't create NVRAM\ directory -- :)
echo. > nvram

:scores
:: Shows the best scores [normal and VS mode -if available-]
cls
set hiscore=
echo Best score for %game%...
call hiscore /ROM %game%
echo Best score for %game% [VS mode]...
call hiscore /ROM %game%-vs
pause

:ok
set hiscore=%hiscore%+
:: Run Alphamame (rename the file to alpha.exe or change this line)
alpha %game% -rec %game% -skip_disclaimer 
:: Play again? -it overwrites the .inp- [Default option: 'N']
choice /c:yn /t:n,10 Play again? -it overwrites the .inp-

:: if you play again, the batch shows best score every 5 times
:: -put more/less '+' if you want-
if "%hiscore%"=="+++++" if not errorlevel 2 goto scores
if not errorlevel 2 goto ok

:finish
:: Shows the size of the .inp file -if you want to delete it-
dir inp\%game%.inp
choice /c:yn /t:n,10 Delete %game%.inp?
:: It asks again before deleting -just to be sure-
if not errorlevel 2 del inp\%game%.inp /p
set game=
set hiscore=
Image
User avatar
mahlemiut
Editor
Posts: 4191
Joined: Mon Feb 04, 2002 10:05 pm
Location: New Zealand
Contact:

Post by mahlemiut »

Or you could just use the -nvram_directory NUL switch. But whatever. :)
- Barry Rodewald
MARP Assistant Web Maintainer
Image
User avatar
mike_myers
Button Masher
Button Masher
Posts: 61
Joined: Sat Dec 20, 2003 10:38 pm
Contact:

Post by mike_myers »

Yes, that batch woeks 100% in windows 95/98 and MS-DOS 6.x, becuase DELTREE command doesn't exist in Windows NT/ME/2000/XP.

If you use one of those versions, you can get the same using RD /S /Q.
Image
User avatar
mike_myers
Button Masher
Button Masher
Posts: 61
Joined: Sat Dec 20, 2003 10:38 pm
Contact:

Post by mike_myers »

After the changes...

REC.BAT

Code: Select all

@echo off
:begin
cls
set game=%1
:: Default game: Super Sidekicks 2 -change it if you want-
if "%1"=="" set game=SSIDEKI2

:scores
:: Shows the best scores [normal and VS mode -if available-]
cls
set hiscore=
echo Best score for %game%...
call hiscore /ROM %game%
echo Best score for %game% [VS mode]...
call hiscore /ROM %game%-vs
pause

:ok
set hiscore=%hiscore%+
:: Run Alphamame (rename the file to alpha.exe or change this line)
alpha %game% -rec %game% -skip_disclaimer -nvram_directory NUL
:: Play again? -it overwrites the .inp- [Default option: 'N']
choice /c:yn /t:n,10 Play again? -it overwrites the .inp-

:: if you play again, the batch shows best score every 5 times
:: -put more/less '+' if you want-
if "%hiscore%"=="+++++" if not errorlevel 2 goto scores
if not errorlevel 2 goto ok

:finish
:: Shows the size of the .inp file -if you want to delete it-
dir inp\%game%.inp
choice /c:yn /t:n,10 Delete %game%.inp?
:: It asks again before deleting -just to be sure-
if not errorlevel 2 del inp\%game%.inp /p
set game=
set hiscore= 
PD: You can make a copy of this using -nosound option.
Image
User avatar
mike_myers
Button Masher
Button Masher
Posts: 61
Joined: Sat Dec 20, 2003 10:38 pm
Contact:

Post by mike_myers »

Another change...

REC.BAT

Code: Select all

@echo off
:begin
cls

:: Default game used -- Super Sidekicks, You can modify that
:: editing this line:
::    if "%1"=="" set game=SSIDEKI
set game=%1
if "%1"=="" set game=SSIDEKI

:: Deletes .CFG file (if you use /NOCFG option)
if "%2"=="" goto scores
echo " %2 " | find " /nocfg " /i > NUL
if not errorlevel 1 if exist cfg\%1.cfg del cfg\%1.cfg

:: Show 1st place (uses HISCORE.BAT)
:scores
cls
set hiscore=
echo Best score of game %game%...
call hiscore /ROM %game%
echo.
echo Best score of game %game% [VS mode]...
call hiscore /ROM %game%-vs
pause

:: Runs Wolfmame (or another emulator)
:ok
set hiscore=%hiscore%+
rem If you use another emulator, replace mamep by the emulator used ;)
mamep %game% -rec %game% -skip_disclaimer -nvram_directory NUL -pause_brightness 1.00
:: If MAME can't load a game, returns 0. ;)
if not errorlevel 1 goto ok2
:: If the game doesn't exist (or isn't supported), deletes the .inp file
:: without asking -to save disk space-
if exist inp\%game%.inp del inp\%game%.inp
goto end2

:ok2
:: Show file size and asks if you've beaten your best score
DIR inp\%game%.inp
choice /c:yn New hiscore? 
:: If the .inp isn't a hiscore, you can delete it if you want
if errorlevel 2 goto no_record

:: ---------------------------------------
:: One way to set how many points you've scored
:: (This includes the score at the end of the filename)
:record
set score=
:record2
choice /c:0123456789X Type score (X = end)
if not errorlevel 1 goto end
if errorlevel 11 goto record3
if errorlevel 10 if not errorlevel 11 set score=%score%9
if errorlevel 9 if not errorlevel 10 set score=%score%8
if errorlevel 8 if not errorlevel 9 set score=%score%7
if errorlevel 7 if not errorlevel 8 set score=%score%6
if errorlevel 6 if not errorlevel 7 set score=%score%5
if errorlevel 5 if not errorlevel 6 set score=%score%4
if errorlevel 4 if not errorlevel 5 set score=%score%3
if errorlevel 3 if not errorlevel 4 set score=%score%2
if errorlevel 2 if not errorlevel 3 set score=%score%1
if errorlevel 1 if not errorlevel 2 if "%score%"=="" rem Do nothing
if errorlevel 1 if not errorlevel 2 if not "%score%"=="" set score=%score%0
goto record2

:record3
if "%score%"=="" goto end
choice /c:yn Score: %score% -- OK?
if errorlevel 2 goto record
if errorlevel 1 goto record4
if not errorlevel 1 goto end

:record4
echo Renaming .inp file ...
ren inp\%game%.inp %game%_%score%.inp
dir inp\%game%_%score%.inp
:: Compress the .inp file using a Winzip Add-on *new*
choice /c:yn ZIP record? (Needs Winzip Command Line Support Add-on) 
if errorlevel 2 goto end
wzzip inp\%game%_%score%.zip inp\%game%_%score%.inp 
goto end

:: ---------------------------------------

:: If the .inp isn't a record, you can delete it.
:no_record
del inp\%game%.inp /p
goto end

:end
:: If you play again, the batch file shows the best score every 5 times.
:: You can modify this adding/removing '+' characters in this line:
::   if errorlevel 1 if "%hiscore%"=="+++++" goto scores
choice /c:yn Play again? 
if errorlevel 2 goto end2
if errorlevel 1 if "%hiscore%"=="+++++" goto scores
if errorlevel 1 goto ok

:end2
:: Destroys variables used
set score=
set game=
set hiscore=
Image
User avatar
Barthax
MARP Seer
MARP Seer
Posts: 691
Joined: Fri Sep 27, 2002 1:13 pm
Contact:

Post by Barthax »

As we're on the subject, I have something similar available from http://www.tosec.info/modules.php?name= ... ec_barthax - the MAME Fever download. Allows the use of many different versions of MAME & includes a (slightly out of date) dat file for ClrMAME to organise the versions. As with Mike's batch file above, it's not for the faint of DOS.
Post Reply