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: AutoHotKey Fun Pt 3 - Demul light gun games!  (Read 10834 times)

0 Members and 1 Guest are viewing this topic.

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9269
  • Last login:Today at 07:10:16 am
  • ...
AutoHotKey Fun Pt 3 - Demul light gun games!
« on: December 30, 2010, 07:09:11 pm »
I wrote some scripts to add Demul light gun games to my front-end a while back.
These are extremely sloppy, amateur & will probably be unnecessary in the next version of Demul, but I'm gonna share them anyway.
Most of them are copied and pasted from other scripts I already had, so there are some unnecessary things like Gui 2 (instead of just Gui) that may not seem to make sense, but it works for me.  It requires some tweaking to get it to work on different computers, so be forewarned that it isn't plug & play.

Demul .5.6 added command line options, but not an option to launch fullscreen.
Here is where the autohotkey script comes in.

The command line to launch a game in Demul is:
Code: [Select]
demul.exe -run=naomi -rom=[ROM](thanks to ptinolv for supplying that in another thread)

The messed up part here is that the active window title changes as the game launches, spg & gpu change.

The script needs to be tweaked to include a spg # that the emulator hangs at for a second, so the script recognizes the window, activates it, then presses ALT+ENTER to launch fullscreen.  The full version of the script puts up a black window while the emulator launches, so you don't see any of these windows.
Here is a shortened version of the script that can be used to figure out what numbers to plug in:
(you could also just add a semicolon ; before the lines pertaining to the Gui and autohotkey will ignore them)
Code: [Select]
Run, C:\Emulators\Programs\Demul\demul.exe -run=atomiswave -rom=rangrmsn
WinWait, gpuDXv3 | spg: 61 gpu: 0 | Ranger Mission,
IfWinNotActive, gpuDXv3 | spg: 61 gpu: 0 | Ranger Mission, , WinActivate, gpuDXv3 | spg: 61 gpu: 0 | Ranger Mission,
WinWaitActive, gpuDXv3 | spg: 61 gpu: 0 | Ranger Mission,
Send, {ALTDOWN}{ENTER}{ALTUP}
ESC::
Process, Close, demul.exe
ExitAPP
return
You need to tweak the number in red here: gpuDXv3 | spg: 61 gpu: 0 | Ranger Mission in all four places to a number that works on your computer.
60 & 61 worked for most games on my test pc, but I had to change it on my mame pc.  It will vary depending on the performance of your computer.
Run the script and watch for a number that the emulator sits at for a second or two, then try that one.  This seems to be the right time to go fullscreen.
I've gotten errors trying to do it too soon or after the game has fully launched.
If the game doesn't go fullscreen, the script isn't recognizing the window.  Try a different number.  PRESS ESC to exit the script and try a different value.
Once you get this working, add the other parts of the script that put up the black window that hides everything until the game has launched:
Code: [Select]
Gui, 2: +AlwaysOnTop -Caption +ToolWindow                                        
Gui, 2: Color, 0                                                                                
Gui, 2: Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth%, HSHIDE
Run, C:\Emulators\Programs\Demul\demul.exe -run=atomiswave -rom=rangrmsn
WinWait, gpuDXv3 | spg: 67 gpu: 0 | Ranger Mission,
IfWinNotActive, gpuDXv3 | spg: 67 gpu: 0 | Ranger Mission, , WinActivate, gpuDXv3 | spg: 67 gpu: 0 | Ranger Mission,
WinWaitActive, gpuDXv3 | spg: 67 gpu: 0 | Ranger Mission,
Send, {ALTDOWN}{ENTER}{ALTUP}
Gui, 2:Destroy
ESC::
Process, Close, demul.exe
ExitAPP
return

This requires a script for every game, but there are only 9.
The other 8 are attached as text files.

If there is a better way, please chime in.  You aren't going to hurt my feelings.  I've always said that I'm more persistent than good.
I wanted the games on my front-end and I got them there.  I'm happy.

EDIT:  The simpler way is to just use a Sleep in place of all the Winwait stuff:

Code: [Select]
Gui, 2: +AlwaysOnTop -Caption +ToolWindow                                        
Gui, 2: Color, 0                                                                                
Gui, 2: Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth%, HSHIDE
Run, C:\Emulators\Programs\Demul\demul.exe -run=atomiswave -rom=rangrmsn
Sleep, 4000
Send, {ALTDOWN}{ENTER}{ALTUP}
Gui, 2:Destroy
ESC::
Process, Close, demul.exe
ExitAPP
return

Make the sleep longer if it doesn't work.

« Last Edit: June 02, 2011, 04:10:06 pm by BadMouth »

DirtyDachshunds

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 360
  • Last login:December 18, 2014, 01:14:25 pm
    • First Project: MillerCade
Re: AutoHotKey Fun Pt 3 - Demul light gun games!
« Reply #1 on: December 30, 2010, 07:59:28 pm »
Simply awesome!  Thanks so much.

 :applaud:

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9269
  • Last login:Today at 07:10:16 am
  • ...
Re: AutoHotKey Fun Pt 3 - Demul light gun games!
« Reply #2 on: December 30, 2010, 08:12:08 pm »
Just played a few rounds and remembered some things unrelated to the script, but worthy of mention....

> Sport Shooting USA.  P2 trigger is actually controlled by P4 controls in the emulator, so map something to P4 button 1 to be able to press fire for P2 in the calibration screen.  Otherwise you won't be able to finish the calibration process.

> Death Crimson Ox (rom=deathcox ..snicker), offscreen reload doesn't work, but if you press both mouse buttons at one time, it reloads.  I think one other game did this, but I can't remember which one (maybe lupin).

>The emulator is pretty slow to start.  Give it time before thinking the script isn't working.  If you hear the intro music to the game and it isn't fullscreen, then the script didn't work.

djvj

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 32
  • Last login:August 12, 2022, 02:39:36 pm
Re: AutoHotKey Fun Pt 3 - Demul light gun games!
« Reply #3 on: December 30, 2010, 09:52:38 pm »
You should check out mine and chillinwater's naomi script on the HS forums. I also have a complete naomi release for HS on UG tracker all setup for you (unsure if I can mention that).

http://www.hyperspin-fe.com/forum/showpost.php?p=86093&postcount=104
« Last Edit: December 30, 2010, 10:00:15 pm by djvj »
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music."

HowTo mod GunCon2 with Aimtraks