Jump to content
LaunchBox Community Forums

Anyone know of a way to set up the Mame command line to Auto play tapes?


fanzine

Recommended Posts

I am setting up the Atari 2600 in mame and have the supercharger working to an extent. I have the command line set up to load the Supercharger cart and then the chosen cassette. I have to manually play the tape and was wondering if there was a way to automate this process through command line for this and other machines. Thanks for any help!

Link to comment
Share on other sites

To play the tape it's just a matter of pressing F2.  You can pass in the command line

-autoboot_command "xxxx"

where xxxx are letters/symbols/numbers.  But haven't figured how to send Function-Key-2 (F2). 

An example for Acorn Electron cartridges is 

electron -skip_gameinfo -autoboot_delay "2" -autoboot_command "*tape\nchain""""""\n" -cass "name_of_the_rom"

Here it skips the game info, pauses for 2 seconds, then sends    *tape   {Enter} (the \n you see)   chain   (the series of quotes is basically a long pause)   {Enter}    -cass "name_of_the_rom"

This doesn't answer the question, but gives you an idea of how the autoboot works.  If you can find out how to get it to send/register {F2}, I'm sure there are many people out there that would gladly buy you a beer or a nice tall glass of fresh lemon-aid. :D

Link to comment
Share on other sites

  • 9 months later...

After MUCH trial and error, I finally made a setup that automatically loads a ZX81 software list cassette and plays it.

First, create a new emulator profile. For my setup I used:

Emulator Name: Autohotkey MAME ZX81
Emulator Application Path: ThirdParty\AutoHotkey\AutoHotkey.exe
Default Command-Line Parameters: ZX81autoplay.ahk

Checkmark 'Don't use quotes' and 'Use file name only'
 

I created a Autohotkey script called ZX81autoplay.ahk, which is saved in the same folder as Autohotkey. It contains:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.

SetWorkingDir ..\MAME\   ;My MAME folder relative to Autohotkey
Run, mame64.exe zx81 -keyboardprovider dinput -ui_active -skip_gameinfo -autoboot_delay 5 -autoboot_command "j""""""\n" %1%
sleep, 8000
SetKeyDelay, -1, 110
Send {F2 down}
sleep, 100
Send {F2 up}

 

Lines 1 to 3 are auto-generated by Autohotkey

Line 4 of the Autohotkey script sets the directory where MAME is located.

Line 5 launches MAME with the MAME UI active, waits 5 seconds, then sends the command to type LOAD "". (The 'J' key on the ZX81 is the shortcut for LOAD, and """ sends a single quote, so """""" sends "".) \n sends the ENTER key. %1% is for the argument that Launchbox will send to the script, which is the name of the game file. (LOAD"" on the ZX81 runs the first program on the cassette.)

Line 6 waits 8 seconds

Lines 7 to 9 is the only working method I could find that would send F2 (the default Play Tape hotkey) via the script. (Credit)

 

Once the tape starts loading you can press Insert to fast forward.  Don't forget to press Scroll Lock after the game is loaded to give keyboard focus back to the game.

You may need to adjust the delay times in the script.  I'd also like to mention that the ZX81 is the first MAME supported system I've come across that doesn't play the tape automatically with loading commands, as with the Commodore 64 or the BBC Micro. Not sure why this feature is missing.

 

On 7/19/2020 at 11:41 PM, JoeViking245 said:

If you can find out how to get it to send/register {F2}, I'm sure there are many people out there that would gladly buy you a beer or a nice tall glass of fresh lemon-aid.

This post is a bit old, but I'll take that lemon-aid if the offer is still valid! :)

Edit: Upon review, I guess I could just create a new MAME emulator profile for ZX81 and use the built in Running Autohotkey Script tab.

Edited by deadfraggle
Link to comment
Share on other sites

On 5/2/2021 at 9:03 PM, deadfraggle said:

After MUCH trial and error, I finally made a setup that automatically loads a ZX81 software list cassette and plays it.

First, create a new emulator profile. For my setup I used:

Emulator Name: Autohotkey MAME ZX81
Emulator Application Path: ThirdParty\AutoHotkey\AutoHotkey.exe
Default Command-Line Parameters: ZX81autoplay.ahk

Checkmark 'Don't use quotes' and 'Use file name only'
 

I created a Autohotkey script called ZX81autoplay.ahk, which is saved in the same folder as Autohotkey. It contains:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.

SetWorkingDir ..\MAME\   ;My MAME folder relative to Autohotkey
Run, mame64.exe zx81 -keyboardprovider dinput -ui_active -skip_gameinfo -autoboot_delay 5 -autoboot_command "j""""""\n" %1%
sleep, 8000
SetKeyDelay, -1, 110
Send {F2 down}
sleep, 100
Send {F2 up}


 

Lines 1 to 3 are auto-generated by Autohotkey

Line 4 of the Autohotkey script sets the directory where MAME is located.

Line 5 launches MAME with the MAME UI active, waits 5 seconds, then sends the command to type LOAD "". (The 'J' key on the ZX81 is the shortcut for LOAD, and """ sends a single quote, so """""" sends "".) \n sends the ENTER key. %1% is for the argument that Launchbox will send to the script, which is the name of the game file. (LOAD"" on the ZX81 runs the first program on the cassette.)

Line 6 waits 8 seconds

Lines 7 to 9 is the only working method I could find that would send F2 (the default Play Tape hotkey) via the script. (Credit)

 

Once the tape starts loading you can press Insert to fast forward.  Don't forget to press Scroll Lock after the game is loaded to give keyboard focus back to the game.

You may need to adjust the delay times in the script.  I'd also like to mention that the ZX81 is the first MAME supported system I've come across that doesn't play the tape automatically with loading commands, as with the Commodore 64 or the BBC Micro. Not sure why this feature is missing.

 

This post is a bit old, but I'll take that lemon-aid if the offer is still valid! :)

Edit: Upon review, I guess I could just create a new MAME emulator profile for ZX81 and use the built in Running Autohotkey Script tab.

Hey man, great find!

Say, how would these lines look, if instead of mame standalone I were to use the mame core in retroarch?

SetWorkingDir ..\MAME\   ;My MAME folder relative to Autohotkey
Run, mame64.exe zx81 -keyboardprovider dinput -ui_active -skip_gameinfo -autoboot_delay 5 -autoboot_command "j""""""\n" %1%

 

I'm guessing something like this:

SetWorkingDir M:\LaunchBox\Emulators\RetroArch\   ;My MAME folder relative to Autohotkey
Run, retroarch.exe zx81 -keyboardprovider dinput -ui_active -skip_gameinfo -autoboot_delay 5 -autoboot_command "j""""""\n" %1%

 

However, I don't know how to target mame_libretro.dll

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...