Build Your Own Arcade Controls Forum
Main => Software Forum => Topic started by: mrclean on September 25, 2006, 09:28:10 pm
-
Atari Jaguar I need an ESC Cab friendly emu hack Jcrouse or any one else? Baically i need as stated a Jaguar emu that will exit when i hit the ESC key any clues as to where I can snag this ? :blah:
-
Try this AutoIt script. I just wrote it so it's untested but it should work okay. Just replace emu.exe with the executable name of the Jaguar emulator, compile the script and place it into your emu's folder and run it instead of your emu's exe.
; Basic AutoIt script to close an emulator using ESC
; Run the Emulator
Run(@ScriptDir & "\emu.exe");
; Define Kill Key
HotKeySet ("{ESCAPE}", "close_emu")
; Kill the Emulator
Func close_emu ()
ProcessClose ("emu.exe")
Exit
EndFunc
; Main Loop
While 1
Sleep (500)
If ProcessExists ('emu.exe') = 0 Then Exit
WEnd
Exit
-
I can tell you from my wrapper coding experience. It'll work but it's sloppy.
You want to try to avoid "hard" termination if possible.
The auto setting in my command line wrapper basically does the following:
Try pressing alt+f4... wait a sec.
If the process still exists post a close message to the window... wait a sec.
If the process still exists close the process.
Of course this is a generic solution, for specific emus you can use the one that works best.
-
I can tell you from my wrapper coding experience. It'll work but it's sloppy.
You want to try to avoid "hard" termination if possible.
The auto setting in my command line wrapper basically does the following:
Try pressing alt+f4... wait a sec.
If the process still exists post a close message to the window... wait a sec.
If the process still exists close the process.
Of course this is a generic solution, for specific emus you can use the one that works best.
Thats a good point using SendMessage with WM_CLOSE is much cleaner. AutoIt probably supports it.
-
Atari Jaguar I need an ESC Cab friendly emu hack Jcrouse or any one else? Baically i need as stated a Jaguar emu that will exit when i hit the ESC key any clues as to where I can snag this ? :blah:
i use project tempest in my cab. doesn't work perfect, but ok.
http://pt.emuunlim.com/
you may try an old version, the new versions doesn't use esc to exit..
-
Try this AutoIt script. I just wrote it so it's untested but it should work okay. Just replace emu.exe with the executable name of the Jaguar emulator, compile the script and place it into your emu's folder and run it instead of your emu's exe.
; Basic AutoIt script to close an emulator using ESC
; Run the Emulator
Run(@ScriptDir & "\emu.exe");
; Define Kill Key
HotKeySet ("{ESCAPE}", "close_emu")
; Kill the Emulator
Func close_emu ()
ProcessClose ("emu.exe")
Exit
EndFunc
; Main Loop
While 1
Sleep (500)
If ProcessExists ('emu.exe') = 0 Then Exit
WEnd
Exit
AutoIT - love it, use it all the time. Once I switched over to a company that wouldn't buy Winbatch for me, I switched over...
-
Ok thanks to our resident AutoIt expert Nologic over at the GameEx forums, he has revised my script to include a safer way of killing the emulator using the methods described by Howard as well as making use of variables to make it more readable. Thanks Nologic! :)
; Basic AutoIt script to close an emulator using ESC
$Emu = 'Emu.exe' ; EMU Executable
$Key = '{ESCAPE}' ; Kill Key
; Run the Emulator
$pid = Run( @ScriptDir & '\' & $emu )
HotKeySet ( $Key , 'close_emu' )
; Kill the Emulator
Func close_emu ()
If ProcessExists ( $pid ) = 0 Then Exit
Send ( '{ALTDOWN}{F4}{ALTUP}' )
Sleep (500)
If ProcessExists ( $pid ) = 0 Then Exit
WinClose ( $title )
Sleep (500)
If ProcessExists ( $pid ) = 0 Then Exit
ProcessClose ( $pid )
Exit
EndFunc
; Main Loop
While 1
$title = WinGetTitle('')
If ProcessExists ( $pid ) = 0 Then Exit
Sleep (500)
WEnd
; EOF
-
Nice....
If I can figure out how to get autoit/ahk to read settings from text files I might start writing my wrappers in script form. They can be compiled to exes and they don't need any dependancies, meaning they are a lot slimmer than anything you can do in a visual studio language.
-
Howard AutoIt can read from text files with no problem...tho I tend to use INI files. Any ways here is an old ZiNc wrapper that shows the basic reading from an INI file, and the reading of an INI thats been passed via commandline.
#include <process.au3>
; Read ROM Pathing
$roms = IniRead( @ScriptDir & "\settings.ini", "ROMS", "PATH", @ScriptDir & "\ROMS\" )
; Read Game Related Settings
$ini_01 = IniRead( $CmdLine[1] , "GAM" , "Number" , "1" )
$ini_02 = IniRead( $CmdLine[1] , "CFG" , "Config" , "./Zinc.cfg" )
$ini_03 = IniRead( $CmdLine[1] , "CFG" , "Renderer" , "./renderer.cfg" )
$ini_04 = IniRead( $CmdLine[1] , "CFG" , "Controller" , "./controller.cfg" )
$ini_05 = IniRead( $CmdLine[1] , "GFX" , "Rotate" , "0" )
$ini_06 = IniRead( $CmdLine[1] , "GFX" , "Geometry" , "yes" )
$ini_07 = IniRead( $CmdLine[1] , "PLG" , "Controller" , "./controller.znc" )
$ini_08 = IniRead( $CmdLine[1] , "PLG" , "Renderer" , "./renderer.znc" )
$ini_09 = IniRead( $CmdLine[1] , "SND" , "Use" , "yes" )
$ini_10 = IniRead( $CmdLine[1] , "SND" , "Filter-Enable" , "yes" )
$ini_11 = IniRead( $CmdLine[1] , "SND" , "Filter-CutOff" , "44100" )
$ini_12 = IniRead( $CmdLine[1] , "SND" , "Lite-Enable" , "yes" )
$ini_13 = IniRead( $CmdLine[1] , "SND" , "Lite-Multiplier" , "40" )
$ini_14 = IniRead( $CmdLine[1] , "SND" , "Stereo-Exciter" , "yes" )
; Kill Emulator
Func end_session ()
ProcessClose( "ZiNc.exe" )
Exit
EndFunc
$game = @ScriptDir & '\ZiNc.exe ' & $ini_01 & _
' --roms-directory=' & $roms & _
' --controller=' & $ini_07 & _
' --renderer=' & $ini_08 & _
' --use-config-file=' & $ini_02 & _
' --use-renderer-cfg-file=' & $ini_03 & _
' --use-controller-cfg-file=' & $ini_04 & _
' --rotate=' & $ini_05 & _
' --use-slow-geometry=' & $ini_06 & _
' --use-sound=' & $ini_09 & _
' --sound-filter-enable=' & $ini_10 & _
' --sound-filter-cutoff=' & $ini_11 & _
' --sound-surround-lite-enable=' & $ini_12 & _
' --sound-surround-lite-multiplier=' & $ini_13 & _
' --sound-stereo-exciter=' & $ini_14
; Define Kill Key
HotKeySet( "{BACKSPACE}" , "end_session" )
; Launch Emulator
_RunDos ( $game )
; Time just keeps on slipping into the future :)
While 1
If ProcessExists ( 'ZiNc.exe' ) = 0 Then Exit
Sleep ( 500 )
WEnd
; EOF
-
I use ini files myself, so that works better actually. Thanks for the snippet.
-
Your welcome
-
at the end of the day im retarded when it comes to creating just about anything and would appreciate it if someone has the actual hacked emu they can just upload and last time i used one of the jag's it had no sound.
-
Is it possible for AutoIt scripts to read parameters passed to the exe? If it can use variables like %1% and %2% can in batch files then someone could compile the script for him so he can use it with any emu.
Ie. SetKillEsc.exe myemu.exe
or even add another variable so you can set the actual key via command line argument
Ie. SetKillKey.exe myemu.exe {ESCAPE}
-
You don't have to create anything... headkaze gave you a script that'll work. Save it to a file, download autoit and you are good to go.
I don't think you realize how hard it is to hack an emu, it's far easier to make a wrapper. Any of the "hacked" emus out there weren't hacked, they either had their source code modified or their cfg file was altered using a hex editor.
If you don't even know of a working jaguar emulator then why did you even ask? We can't magically get sound emulation working for you ya know.
headkaze the easiest solution is to just download my generic command line wrapper, it does the same thing. But yes ahk does support command line parameters. They are stored as numbers, with %0% being the number of commands passed.
-
Two command lines options...first the Emu...then the Button...both are required.
; Basic AutoIt script to close an emulator using ESC
$Emu = $CmdLine[1] ; EMU Executable
$Key = $CmdLine[2] ; Kill Key
; Run the Emulator
$pid = Run( @ScriptDir & '\' & $emu )
HotKeySet ( $Key , 'close_emu' )
; Kill the Emulator
Func close_emu ()
If ProcessExists ( $pid ) = 0 Then Exit
Send ( '{ALTDOWN}{F4}{ALTUP}' )
Sleep (500)
If ProcessExists ( $pid ) = 0 Then Exit
WinClose ( $title )
Sleep (500)
If ProcessExists ( $pid ) = 0 Then Exit
ProcessClose ( $pid )
Exit
EndFunc
; Main Loop
While 1
$title = WinGetTitle('')
If ProcessExists ( $pid ) = 0 Then Exit
Sleep (500)
WEnd
; EOF