Higan AutoIt script problem (fixed it myself, so sharing the fix).
Posted: Mon Oct 19, 2015 2:29 am
I do not really need help, but I will share my tests in case someone might get the same problem I got.
I recently reinstalled Windows on my computer and so had to redo all the config, which wasn't a problem at all.
First, I want to mention that the line on the website which explain how to force Higan to use the ESC key to close it might be wrong. I tested several versions with the line :
and it didn't worked on all the versions I tested.
But if you put instead :
Then, it work fine.
Though, in my situation, I use PinacleGameProfiler to bind the XBOX 360 home button to the ESC key (which mean I quit all emulators, and even Mgalaxy by pressing the home button) but it seemed Higan didn't wanted to recognize it (pressing "ESC" on the keyboard was closing the emulator fine, when the home button wouldn't work if I was directly using the hotkey of the emulator) so I had to use a AutoIt Script, which I thought was working fine (I was using the same I use for emulators which doesn't have built-in hotkey to close them), a script which use those commands :
But tonight, when I started to play a Snes game using SRAM (save), I noticed the script I was using until now to close the emulator (the one I use which most emulators) would prevent the emulator to save (which only happen with this emulator, other never got a problem to save properly with the old script).
I guess the emulator only save if it's closed properly because if I use the hotkey from the emulator itself, it save fine. And if I close the window with the "X" icon in the top-right corner, it also save fine.
So after a lot of tries, I finally came up with this script, which works fine :
I first tried to close the window using the actual window title but as it change when you load a rom, it wouldn't work properly and so I used the "class" of the window instead, which seems to be like the hidden name of a window and which never change from what google said to me
It should be compatible with most versions I guess, but just in case, the version I use with this script is "Higan v092" if it can help (if I remember right, it's the last version which able to import a game without using the built-in interface for roms).
I recently reinstalled Windows on my computer and so had to redo all the config, which wasn't a problem at all.
First, I want to mention that the line on the website which explain how to force Higan to use the ESC key to close it might be wrong. I tested several versions with the line :
Code: Select all
CloseEmulator = "KB0::Esc"
But if you put instead :
Code: Select all
CloseEmulator = "KB0::Escape"
Though, in my situation, I use PinacleGameProfiler to bind the XBOX 360 home button to the ESC key (which mean I quit all emulators, and even Mgalaxy by pressing the home button) but it seemed Higan didn't wanted to recognize it (pressing "ESC" on the keyboard was closing the emulator fine, when the home button wouldn't work if I was directly using the hotkey of the emulator) so I had to use a AutoIt Script, which I thought was working fine (I was using the same I use for emulators which doesn't have built-in hotkey to close them), a script which use those commands :
Code: Select all
While ProcessExists ( $PID )
ProcessClose ( $PID )
WEnd
I guess the emulator only save if it's closed properly because if I use the hotkey from the emulator itself, it save fine. And if I close the window with the "X" icon in the top-right corner, it also save fine.
So after a lot of tries, I finally came up with this script, which works fine :
Code: Select all
HotKeySet("{ESC}", "Terminate")
$path = "D:\Emulation\Snes\"
$app = "higan-balanced.exe"
If $CmdLine[0] == 1 Then
$PID = Run( $path & $app & ' "' & $CmdLine[1] & '"', $path)
While 1
Sleep(100)
WEnd
EndIf
Func Terminate()
WinClose ("[CLASS:phoenix_window]")
Exit 0
It should be compatible with most versions I guess, but just in case, the version I use with this script is "Higan v092" if it can help (if I remember right, it's the last version which able to import a game without using the built-in interface for roms).