Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Automating racer emulators  (Read 1928 times)

0 Members and 1 Guest are viewing this topic.

holmes

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 41
  • Last login:May 20, 2024, 05:07:22 pm
  • I want to build my own arcade controls!
Automating racer emulators
« on: June 11, 2023, 02:28:13 pm »
Hi,

 I have finished building a prototype twin racer cabinet which will hep me to identify and solve the different issues before building the final cabinet.
I am in the process to try to set-up  a front-end. As expected I run in a number of issues for which there is no obvious solution.

I wan to run mame, model2, model3, Naomi2 and Teknoparrot games. I want to be able to play in single or 2 players modes without to have to go to test mode and change the game settings. One way could be to prepare several version of configuration files and to copy them to the conf file before running the emulator.
Moreover, I want to be able to quit an emulator with one button. This does not seem to be possible for Model2 emulator. Finally,  for some games, it is necessary to change the wheel angle settings (typically Intial D games have a 540° rotation angles) of my G29 wheels.
To do all this, it seems that some scripting is necessary.
I tried the Retrobat front end. It does not seem to offer the necessary features. I had great expectations from COINOPS NEXT 2, but the MODEL2 pack did not seem to solve some some of the issues (for example how to quit the emulator).
I ended up to the conclusion it is necessary for me to learn a scripting language like AutoIt and to do all the different actions with it. However  I am not the first guy who tried to solve this. Maybe there are easier solutions. Any ideas or feedback?
Thanks!


Fursphere

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1212
  • Last login:Today at 05:17:01 pm
Re: Automating racer emulators
« Reply #1 on: June 11, 2023, 08:22:21 pm »
What wheels are you using?   The vendor's software package will help with the wheel angle stuff. 

Logitech - you can use the profiler to set wheel angels.  Fanatec, you can setup user presets, then quickly change using the wheel buttons. 

I use separate emulator installs / folders for single player mode and twin mode.  There small enough that it doesn't matter to duplicate them. 

I have some autohotkey stuff I've written to auto-launch player 2 when player 1 starts the game.    But this is kind of overkill. 

I use LaunchBox / BigBox for my front end.   

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 409
  • Last login:April 06, 2024, 06:15:03 am
  • Id 10 and t error
Re: Automating racer emulators
« Reply #2 on: June 11, 2023, 08:28:31 pm »
I use launchbox and have all those emulators plus more and use a single exit button. I have my screens and pcs in my twin boot based on AC power signal so even if i want to play single player it boots both and I just jump on one and race. Uses more power yes but save all that complicated double up settings etc.

Fursphere

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1212
  • Last login:Today at 05:17:01 pm
Re: Automating racer emulators
« Reply #3 on: June 11, 2023, 08:43:37 pm »
I use launchbox and have all those emulators plus more and use a single exit button. I have my screens and pcs in my twin boot based on AC power signal so even if i want to play single player it boots both and I just jump on one and race. Uses more power yes but save all that complicated double up settings etc.

Is your twin using one PC or two?   (Mine is using two)

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1763
  • Last login:June 03, 2024, 11:59:35 pm
  • Is running at 15kHz
Re: Automating racer emulators
« Reply #4 on: June 11, 2023, 08:50:26 pm »
I use Attractmode as a frontend on each cab, mostly because these driving cabs grew out of the GroovyMAME stuff i was tinkering with and i had no idea there were more powerful frontends out there. I reckon i've been through most of the challenges you mention, added to which i use PVM-2730's as the monitors for my side-by-side cabs. So i run everything at 15kHz 4:3 just for fun :)

TBH i doubt there's a frontend that could do anything as complex as i find I need it to. Tthere's always something i want to add, or want a game to do, and profilers or injectors or redraw programs often fail to find games running under Teknoparrot's umbrella - they find some TP process instead, not the game exe, if there even is one. To get around that I'm using batch files and Autohotkey (AHK), along with a combination of Joytokey, RTSS, specialK, DxWnd, DisplayChanger2 and a few other programs, depending on what i need to do to get a game to work. Each setup of mine uses a G25 wheel, along with at least two other joysticks. I also use AHK to swap out eeprom files to switch between single-player and LAN for some games that need it - because TP always uses the same user/appdata/roaming/teknoparrot folder for eeproms, no matter where it launches from.

I'll normally make sure to get games running first, then get them to LAN, then work on how to config them to launch from the frontend and close to the frontend cleanly - the last often being more complicated than it sounds. Running different programs as admin (or even not as admin) can make a big difference to permissions, which can affect the way things work. In one case, to change IP addresses on the fly, i need to launch a batfile that launches a shortcut to an exe, that itself launches more batfiles. Extensive testing of other methods failed to work.

I'll start with an example that covers a few tricks - ID5 on Teknoparrot.  Attactmode launches a shortcut that points to a compiled AHK exe called ID5.exe, which looks like this:
Quote
process, close, attract.exe

Run "C:\games\TeknoParrotUi_1.0.0.528\ID5.bat"

sleep 500

run "C:\Program Files\Logitech\Gaming Software\LWEMon.exe"

winwaitactive, ahk_class FREEGLUT

WinGet, WindowID, ID, A
WinSet, Style, -0xC40000, ahk_id %WindowID%
WinMove, ahk_id %WindowID%, , 0, 0

~q::
send, esc
process, close, ahk_class FREEGLUT
process, close, teknobudgie
process, close, budgieloader.exe
process, close, LWEMon.exe

sleep 500

Run "C:\games\TeknoParrotUi_1.0.0.528\ID5-close.bat"

sleep 500

run "C:\Program Files\Logitech\Gaming Software\LWEMon.exe"
sleep 1000
process, close, LWEMon.exe

Run "C:\games\TeknoParrotUi_1.0.0.528\Attractmode.lnk"

exitapp

return
In addition to the above, joytokey is used to bind one of the shifter buttons to "q", of course, which is the hotkey bind that starts to close everything and resets to the frontend cleanly. The game runs windowed (to remove v-sync from the 50Hz video modes i use) and the Winget/set/move commands push it to borderless fullscreen.

The referenced batfile ID5.bat looks like this: (UCR is a joystick remapper I no longer use.)
Quote
@echo off

rem cd\
rem cd C:\utils\UCR
rem Start C:\utils\UCR\UCR-ID5

reg add "HKCU\Software\Logitech\Gaming Software\GlobalDeviceSettings\G25" /f /v OperatingRange /t REG_DWORD /d 0x0000384

cd\
cd C:\utils
start C:\utils\dc2.exe -configure="C:\utils\1024x576.xml"

cd\
cd C:\games\TeknoParrotUi_1.0.0.528
start C:\games\TeknoParrotUi_1.0.0.528\TeknoParrotUi.exe --profile=ID5.xml

And the batfile ID5-close.bat look like this:
Quote
@echo off

rem cd\
rem cd C:\utils\UCR

rem Start C:\utils\UCR\UCR-Default

reg add "HKCU\Software\Logitech\Gaming Software\GlobalDeviceSettings\G25" /f /v OperatingRange /t REG_DWORD /d 0x0000010e

cd\
cd C:\utils

start C:\utils\dc2.exe -configure="C:\utils\800x600.xml"

I have no idea if newer Logitech wheels are this clunky to remap on the fly, but... the reg edit is to change the degrees of freedom on the G25, as the software doesn't work properly with game profiles for things like TP. At best it will identify the TP shell exe, which means you can't change settings per-game. After changing the degrees in the registry, you can either open the Windows joy.cpl file or whatever it's called (or open the controlpanel > devices & printers > G25 > properties) which never worked for me, or i can launch the LWEmon software (The old logitech profiler for the G25). Letting it load for a second activates the regword change, then it can be closed (i think i leave it open during gameplay, here). Then the reverse to set it back to 270 (10e in hex) at the end. It's also possible, at least on the G25, to hold a few buttons down and move to a few preset angles, but they're all a bit off what you actually want, IMO.

I could no doubt move some commands between the batfiles and the ID5 ahk exe, and change the delay times, but i find that with running all the different games and emulators, nothing gets much simpler :)

If you do go this route, i'm happy to share config files for anything i have working. But if Launchbox does everything you need, i'd just use that.


« Last Edit: June 13, 2023, 02:27:15 am by buttersoft »

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 409
  • Last login:April 06, 2024, 06:15:03 am
  • Id 10 and t error
Re: Automating racer emulators
« Reply #5 on: June 12, 2023, 04:24:22 am »
Is your twin using one PC or two?   (Mine is using two)

2 PC's. I dont think 1 PC can run 2 instances of teknoparrot in link

holmes

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 41
  • Last login:May 20, 2024, 05:07:22 pm
  • I want to build my own arcade controls!
Re: Automating racer emulators
« Reply #6 on: June 13, 2023, 01:21:14 am »
Many thanks for your feedback, guys, and in particular to Buttersoft. It seems there is no other option than to script a lot of actions.
The choice of frontend may seem not so important after all.

I have started to test Launchbox. It is seems rather easy. However AHK scripts are also required. So I am still unsure whether I will use Launchbox or RetroFE.

@Buttersoft:
I would indeed  be interested in your scripts. tnak you very much for your help!

 

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1763
  • Last login:June 03, 2024, 11:59:35 pm
  • Is running at 15kHz
Re: Automating racer emulators
« Reply #7 on: June 13, 2023, 07:15:29 am »
Ok, config dump attached. This is NOT emulator settings, just the bat files and AHK scripts i use to launch games from Attractmode and return to it cleanly. Selecting a game in Attractmode launches a compiled AHK exe (well, via a shortcut). That exe will either launch bat files, or shortcuts (lnk files) in order to run bat files as admin (required for some commands like taskkill to be effective).

The one exception is IDZero v2.3 (via segatools not TP) that needs a batfile to launch the AHK exe that in turn launches lnk files that launch batfiles as admin. hah. This chain somehow gains enough environmental permissions, or possibly momentum, to allow the bat files to change IP addresses so LAN works.

The AHK exe files probably won't decompile cleanly, so i have simply included the uncompiled ahk files, that you can open in notepad. You will almost certainly need to modify each to work on your system, and probably the bat files too, but they will hopefully provide lots of examples to get you started.
« Last Edit: June 13, 2023, 07:22:23 am by buttersoft »

holmes

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 41
  • Last login:May 20, 2024, 05:07:22 pm
  • I want to build my own arcade controls!
Re: Automating racer emulators
« Reply #8 on: June 13, 2023, 05:03:09 pm »
Thanks, buttersoft!

I had a ook at the files, especially at Model2 Daytona.
Sorry for the stupid question but I do not see any command to kill the emulator.
Could you explain  how you do it ?

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1763
  • Last login:June 03, 2024, 11:59:35 pm
  • Is running at 15kHz
Re: Automating racer emulators
« Reply #9 on: June 13, 2023, 07:54:49 pm »
I have an Alt-F4 bind in Joy-to-key for that one :) It could probably be done with a taskkill command in a bat file run as admin though - which would get around the fact that with the ahk script as it stands, alt-tabbing will think the game has closed and open Attractmode again.

I think i do a similar thing for Supermodel emulator, though possibly with Esc.
« Last Edit: June 13, 2023, 08:00:46 pm by buttersoft »

Fursphere

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1212
  • Last login:Today at 05:17:01 pm
Re: Automating racer emulators
« Reply #10 on: June 13, 2023, 08:54:50 pm »
I use an AHK script that binds ESC to kill application by .exe name.    Hit esc, and the app is force closed.

buttersoft

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1763
  • Last login:June 03, 2024, 11:59:35 pm
  • Is running at 15kHz
Re: Automating racer emulators
« Reply #11 on: June 13, 2023, 09:09:47 pm »
I use an AHK script that binds ESC to kill application by .exe name.    Hit esc, and the app is force closed.

Most of my configs do that, but it doesn't always work. Hence occasional use in the above of shortcuts to launch bat files as admin using the taskkill command.

I didn't do that for Daytona tho, as that was early days and i hadn't needed to get into scripting so heavily :)
« Last Edit: June 14, 2023, 02:24:56 am by buttersoft »

vandale

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 409
  • Last login:April 06, 2024, 06:15:03 am
  • Id 10 and t error
Re: Automating racer emulators
« Reply #12 on: June 17, 2023, 05:01:30 am »
I simply use esc mapped to a joystick button via joy2key, escapes all games cleanly and never have issues in launchbox, thats for mame, m2, supermodel, teknoparrot, hacked .exe etc. I do however have all sorts of custom scripts to run all the linked games because as you know, no one rule works for all games. I also script the wifi connections on and off for games like WMMT that need an internet connection to link.

BadMouth

  • Moderator
  • Trade Count: (+6)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9226
  • Last login:Yesterday at 09:41:59 am
  • ...
Re: Automating racer emulators
« Reply #13 on: June 17, 2023, 01:04:16 pm »
I'd go with autohotkey, but back in the day model 2 emulator often came packaged with another program called closemul which closes the model 2 process if esc is pressed.  Despite using batch files and autohotkey, I still use closemul to close model 2 emulator.

I run a very convoluted Mala setup for the front end which I won't get into here.  The primary purpose is to have all the arcade games show up together in the MAME list regardless of what emulator they run on.

My recommendation would be to create an autohotkey script for every single game, create a shortcut to the script, and point your front end toward the shortcut as if they are all PC games.

Could be better options out there.  I've been out of the loop for quite a while.
« Last Edit: June 17, 2023, 01:07:01 pm by BadMouth »