Higan AutoIt script problem (fixed it myself, so sharing the fix).

Get answers to questions about using mGalaxy.
Post Reply
davhuit
Elite Member
Elite Member
Posts: 173
Joined: Mon Aug 12, 2013 3:06 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 :

Code: Select all

CloseEmulator = "KB0::Esc"
and it didn't worked on all the versions I tested.

But if you put instead :

Code: Select all

CloseEmulator = "KB0::Escape"
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 :

Code: Select all

While ProcessExists ( $PID )
          ProcessClose ( $PID )
    WEnd
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 :

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
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 :D

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).
Last edited by davhuit on Mon Oct 19, 2015 2:39 am, edited 1 time in total.
Aeliss
Hero Member
Hero Member
Posts: 900
Joined: Thu Apr 04, 2013 5:55 pm

Nice, ^^, realy usefull informations.
But personally, I never made this emul working, impossible to configure it, I can't go on other drive than "c:/", and If I copy/paste a good path, It delete it automaticaly.
Last edited by Aeliss on Mon Oct 19, 2015 3:59 pm, edited 1 time in total.
davhuit
Elite Member
Elite Member
Posts: 173
Joined: Mon Aug 12, 2013 3:06 am

Yeah. I noticed it store a uncompressed copy of the rom in the system disk, which is not particulary a problem for me.
Last edited by davhuit on Wed Oct 21, 2015 3:35 am, edited 1 time in total.
Post Reply