PDA

View Full Version : my modified hyperlaunch



loppydog
09-18-2010, 06:49 PM
I have been modifying Hyperlaunch do fit my needs and I though I could post it to help others with key remaps and other stuff. I will try to highlight some major changes in red. I you have any question please ask. This is still a major work in progress for me, so you might notice many emulators are not finished yet. But it will give you an idea on the direction I am going. Also I have a secondary monitor that displays my CP, so if you see anything related to Irfanview, thats what it is for.



/**
* HyperLaunch Version 1.05
* Autohotkey script by BadBoyBill badboybill@hyperspin-fe.com
* CursorHide by Lazlo
* Integrated FreeDO wrapper by brian_hoffman
*
* If you are reading this and do not have autohotkey you can get it
* @ http://www.autohotkey.com/download/
* If you would like to modify this script and share it thats OK, but
* see if your modification is something that we would like to add
* to the official version.
*
* Refer to the autohotkey documentation for the keyoboard keylist
*
* If this script does not support your favorite emulator
* then please request support @ http://www.hyperspin-fe.com/forum
*
* :Supported emulators:
* :System: :Emulators:
*Atari 5200.............................messpp.exe
*Atari Lynx.............................handy.exe
*Daphne.................................daphne.exe
*Future Pinball.........................Future Pinball.exe
*Gameboy Advance........................visualboyadvance.ex e
*Gameboy................................visualboya dvance.exe
*Gameboy Color..........................visualboyadvance.ex e
*MAME...................................mame.exe
*Neo Geo................................mame.exe
*Neo Geo Pocket Color...................NeoPop-Win32.exe
*Nintendo 64............................project64.exe
*Nintendo Entertainment System..........nestopia.exe
*Panasonic 3DO..........................FreeDO.exe
*Sega 32X...............................fusion.exe
*Sega CD................................fusion.exe
*Sega Dreamcast.........................nullDC_100b1_6.e xe
*Sega Game Gear.........................fusion.exe
*Sega Genesis...........................fusion.exe
*Sega Master System.....................fusion.exe
*Sony Playstation.......................psxfin.exe
*Super Nintendo Entertainment System....zsnesw.exe
*TurboGrafx 16..........................mednafen.exe
*Zinc...................................zinc.exe
*JukeBox................................silverjuke .exe
*JukeBox................................SKJukebox. exe
*
* :UN-OFFICIAL:
* :System: :Emulators:
*AAE....................................aae.exe
*Amstrad CPC............................AMSTRAD.exe
*Atari 2600.............................messpp.exe
*Atari 7800.............................messpp.exe
*Atari 800xl............................800winxl.exe
*Atari Jaguar...........................pt.exe
*Atari ST...............................steem.exe
*Atomiswave.............................demul.exe (v55)
*Capcom Play System 3\cps3..............emulator.exe
*Casino.................................mame.exe
*Colecovision...........................messppp
*Commodore CD32.........................winuae.exe
*Commodore 64...........................CCS.exe
*Dice...................................dice.exe
*DosBox.................................DosBox.exe ||dfend reloaded
*Favorites..............................mame.exe
*Final Burn Alpha.......................fba.exe
*Fujitsu FM.............................unz.exe
*Intellivision..........................bliss.exe
*MisFit-Mame............................misui32.exe
*MSX....................................blueMSX.ex e
*M.******E.N..............................MugenLaunc her.exe
*Nebula.................................nebula.exe
*Neo Geo CD.............................neoraine32.exe
*Nuon...................................nuance.exe
*PC Gaming..............................lnk bat files (roms)
*PC-FX..................................pcfx.exe
*ScummVM................................ScummVM.ex e
*Sega Naomi Makaron.....................makaronT12.exe
*Sega Naomi Demul.......................demul.exe
*Street Fighter IV......................exe
*Supercade..............................Internet Shortcut
*GCE Vectrex............................messpp.exe
*Visual Pinball.........................vpinball.exe
*Winkawaks..............................winkawaks. exe Alternate (NEW)
*WonderSwan.............................exe
*ZX Spectrum............................realspec.exe
*/

#SingleInstance force ;Prevent multiple instances
#InstallKeybdHook
SetTitleMatchMode 2

;------------------------------------------------------------------------------;
; MAIN SETTINGS ;
;------------------------------------------------------------------------------;

;[UNIVERSAL HOTKEYS] ;SEPERATE MULTIPLE KEYS WITH &(ampersand) up to 2 keys.
exitScriptKey = ? ;Secret hotkey(s) to exit script if needed
;Not to be confused with exit emulator keys

exitEmulatorKey = Esc ;This key/key combo will close any emulators
;that do not have normal closing methods.

toggleCursorKey = t ;hotkey(s) to show or hide cursor if needed
;when hideCursor below is true

;[MOUSE CURSOR]
hideCursor = false ;Automatically hide cursor during script
;WARNING: Make sure ALL your emu's are running fine
;before setting this to true as a precaution.*

;[WINDOWS]
hideDesktop = true ;Attempts to hide desktop with black screen, might help
;on some emu's for hiding launching windows.

hideTaskbar = false ;Hide the windows taskbar when running emu's.
;WARNING: Make sure ALL your emu's are running fine
; before setting this to true as a precaution.*

daemontools = "C:\Program Files (x86)\DAEMON Tools Lite\DTLite.exe" ;Hide the windows taskbar when running emu's.
;WARNING: Make sure ALL your emu's are running fine
; before setting this to true as a precaution.*

SetKeyDelay , 50, 50 ;used for some games that need a key delay


/*
*:If for some weird reason the script hangs follow these steps to get back to normal.
1. If an emulator hangs up or cant load your game then first try to exit the emu
by pressing your Emulator exit hotkey above.
2. If your emu exited but your mouse cursor is gone use your cursor toggle hotkey.
3. Next try to exit the script by pressing your Exit Script Hotkey above. This
will also bring back your cursor and taskbar is they are set to true.
*/







;************************************************* ******************************
;* EDIT BELOW THIS POINT AT YOUR OWN RISK *
;************************************************* ******************************

;------------------------------------------------------------------------------;
; GET PARAMATERS AND SET HOTKEYS ;
;------------------------------------------------------------------------------;

;CHECKING FOR 2 PARAMS, IF NOT THEN EXIT
if 0 < 2
{
MsgBox Usage: HyperLaunch.ahk/exe "System Name" "Rom Name"
ExitApp
}

systemName = %1%
romName = %2%

Hotkey, %exitScriptKey%, ExitScript
if (hideCursor = "true")
{
Hotkey, %toggleCursorKey%, ToggleCursor
SystemCursor("Off")
}

WinClose, cmd.exe
;------------------------------------------------------------------------------;
; GET AND CHECK PATHS ;
;------------------------------------------------------------------------------;
GoSub, CheckINI
IniRead, iniEmuPath, %A_ScriptDir%\Settings\%systemName%.ini, exe info, path
emuPath := GetFullName(iniEmuPath)
IniRead, iniRomPath, %A_ScriptDir%\Settings\%systemName%.ini, exe info, rompath
romPath := GetFullName(iniRomPath)
IniRead, executable, %A_ScriptDir%\Settings\%systemName%.ini, exe info, exe
IniRead, romExtensions, %A_ScriptDir%\Settings\%systemName%.ini, exe info, romextension

romExtension =
GoSub, CheckPaths

;------------------------------------------------------------------------------;
; RUN SYSTEM ;
;------------------------------------------------------------------------------;


;**********************************ATARI 2600***********************************
if (systemName = "Atari 2600" && executable = "stella.exe")
{
blockinput, on
hideDesktop()
Hotkey, $1, StellaSave
Hotkey, $2, StellaLoad
Hotkey, $Esc, StellaExit
Hotkey, $p, StellaMenu
run, "C:\hyperspin\i_view32.exe" "%romPath%CP\%romName%.png" /one/fs/pos=(-1024`,-600)
Sleep, 500
blockinput, off
RunWait, %executable% "%romPath%%romName%%romExtension%", %emuPath%, UseErrorLevel
run, "C:\hyperspin\i_view32.exe" "C:\hyperspin\Default.gif" /one/fs/pos=(-1024`,-600)
}

;**********************************ATARI 5200***********************************
else if (systemName = "Atari 5200" && executable = "kat5200.exe")
{
blockinput, on
hideDesktop()
Hotkey, $1, Kat5200Save
Hotkey, $2, Kat5200Load
Hotkey, $Esc, Kat5200Exit
Hotkey, $p, Kat5200Menu
run, "C:\hyperspin\i_view32.exe" "%romPath%CP\%romName%.png" /one/fs/pos=(-1024`,-600)
Sleep, 500
blockinput, off
RunWait, %executable% "%romPath%%romName%%romExtension%", %emuPath%, UseErrorLevel
run, "C:\hyperspin\i_view32.exe" "C:\hyperspin\Default.gif" /one/fs/pos=(-1024`,-600)
}

;**********************************ATARI 7800***********************************
else if (systemName = "Atari 7800" && (executable = "messpp.exe" || executable = "mess.exe"))
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
RunWait, %executable% a7800 -cart "%romPath%%romName%%romExtension%" -skip_gameinfo -nowindow -nonewui, %emuPath%, Hide UseErrorLevel
}

;*********************************Atomiswave****** ****************************
else if (systemName = "Atomiswave")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
Blockinput on
SetDefaultMouseSpeed, 0
MouseGetPos X, Y
MouseMove %A_ScreenWidth%,-%A_ScreenHeight%
Gui +AlwaysOnTop -Caption +ToolWindow
Gui, color, 0
Gui Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth%, HSHIDE
IniRead, num_down, %emupath%settings.ini, %RomName%, Down_Count, 0
IniRead, system, %emupath%settings.ini, %RomName%, System, Atomiswave
Run, "%emupath%%executable%", Hide UseErrorLevel
winactivate %executable%
sleep, 1000 ; wait a moment for emulator to load
send, {AltDown}{AltUP}
send, {down}
sleep, 500
if (system = "Atomiswave")
{
send, {Down}
send, {Down}
send, {ENTER}
send, {DOWN %num_down%} ; send down keystroke to select rom
send, {ALTDOWN}{ENTER}{ALTUP}
send, {ENTER}
sleep, 5000 ; sleep for 5 seconds before pressing f8 key
send, {F8} ; Go full Screen
sleep, 1000
Gui Destroy
SetDefaultMouseSpeed, 2
Blockinput off
Process, WaitClose, %executable%
}
}

;**********************************ATARI Lynx***********************************


else if (systemName = "Atari Lynx" && executable = "handy.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess2
RunWait, %executable% "%romPath%%romName%%romExtension%", %emuPath%, UseErrorLevel
}

;************************************DAPHNE******* ******************************
else if (systemName = "Daphne" && executable = "daphne.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
daphneParams = vldp -fullscreen -x 640 -y 480 -nohwaccel -framefile
frameFilePath = %romPath%%romName%%romExtension%
RunWait, %executable% %romName% %daphneParams% %frameFilePath%, %emuPath%, UseErrorLevel
}

;********************************GAMEBOY ADVANCE********************************

else if (systemName = "Gameboy Advance" && executable = "visualboyadvance.exe")
{
hideDesktop()
Hotkey, $1, VisualboySave
Hotkey, $2, VisualboyLoad
Hotkey, %exitEmulatorKey%, CloseProcess
RunWait, "%emuPath%%executable%" "%romPath%%romName%%romExtension%", UseErrorLevel
Process, WaitClose, visualboyadvance.exe
}

;***********************************GAMEBOY******* ****************************
else if (systemName = "Gameboy" && executable = "visualboyadvance.exe")
{
hideDesktop()
Hotkey, $1, VisualboySave
Hotkey, $2, VisualboyLoad
Hotkey, %exitEmulatorKey%, CloseProcess
RunWait, "%emuPath%%executable%" "%romPath%%romName%%romExtension%", UseErrorLevel
Process, WaitClose, visualboyadvance.exe
}

;********************************GAMEBOY COLOR********************************
else if (systemName = "Gameboy Color" && executable = "visualboyadvance.exe")
{
hideDesktop()
Hotkey, $1, VisualboySave
Hotkey, $2, VisualboyLoad
Hotkey, %exitEmulatorKey%, CloseProcess
RunWait, "%emuPath%%executable%" "%romPath%%romName%%romExtension%", UseErrorLevel
Process, WaitClose, visualboyadvance.exe
}

;********************************Future Pinball********************************
else if (systemName = "Future Pinball" && executable = "Future Pinball.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
Runwait, "%emuPath%%executable%" /open "%romPath%%romName%%romExtension%" /play /exit %emuPath%, Hide UseErrorLevel
}

;*************************************MAME******** ******************************

else if (systemName = "MAME" && executable = "mame.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess2
Hotkey, $1, MameSave
Hotkey, $2, MameLoad
Hotkey, $p, MameMenu
Runwait, %executable% "%romName%", %EmuPath%, Hide UseErrorLevel
}

;***********************************NEO GEO*************************************

else if (systemName = "Neo Geo" && executable = "mame.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
Hotkey, $1, MameSave
Hotkey, $2, MameLoad
Hotkey, $p, MameMenu
RunWait, %executable% "%romName%", %emuPath%, Hide UseErrorLevel
}

;*****************************NEO GEO POCKET COLOR******************************

else if (systemName = "Neo Geo Pocket Color" && executable = "NeoPop-Win32.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
RunWait, %executable% "%romPath%%romName%%romExtension%", %emuPath%, UseErrorLevel
}

;***********************************NINTENDO 64*********************************

else if (systemName = "Nintendo 64" && executable = "Project64.exe")
{
hideDesktop()
Sleep, 2000
Hotkey, %exitEmulatorKey%, CloseProcess
RunWait, %executable% "%romPath%%romName%%romExtension%", %emuPath%, Hide UseErrorLevel
}

;****************************NINTENDO ENTERTAINMENT SYSTEM**********************

else if (systemName = "Nintendo Entertainment System" && executable = "nestopia.exe")
{
hideDesktop()
Hotkey, $1, NestopiaSave
Hotkey, $2, NestopiaLoad
Hotkey, $Esc, NestopiaExit
Runwait, %executable% "%romPath%%romName%%romExtension%", %emuPath%, Hide UseErrorLevel
Process, waitClose, %executable%
}

;***********************************Panasonic 3DO*******************************

else if (systemName = "Panasonic 3DO" && executable = "FreeDO.exe")
{
hideDesktop()
SetWorkingDir, %emuPath%
Hotkey, $1, FreedoSave
Hotkey, $2, FreedoLoad
Hotkey, %exitEmulatorKey%, CloseProcess
Gui +AlwaysOnTop -Caption +ToolWindow
Gui, color, 0
Gui Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth%,
FileDelete, %emupath%config.xml
FileCopy, %emupath%restore.xml, %emupath%config.xml
Run, "%EmuPath%%Executable%", Hide UseErrorLevel
sleep, 500
WinWait, FreeDO v.2.1 Alpha ~ FPS 60`, INTFPS 60,
IfWinNotActive, FreeDO v.2.1 Alpha ~ FPS 60`, INTFPS 60, , WinActivate, FreeDO v.2.1 Alpha ~ FPS 60`, INTFPS 60,
WinWaitActive, FreeDO v.2.1 Alpha ~ FPS 60`, INTFPS 60,
Send, {ALTDOWN}{ALTUP}{up}{ENTER} ;{ENTER}
WinWait, Open,
IfWinNotActive, Open, , WinActivate, Open,
WinWaitActive, Open,
sleep, 500
clipboard=
clipboard=%romPath%%romName%%romExtension%
ClipWait
Sleep,100
Send,^v
Sleep,100
send, {ENTER}
Sleep, 100
send, {F11}
sleep,500
send, {F9}
sleep, 2000
Gui Destroy
Process, WaitClose, %executable%
WinActivate, HyperSpin
}

;***********************************ScummVM******* ****************************

else if (systemName = "ScummVM" && executable = "ScummVM.exe")
{
hideDesktop()
Hotkey, $1, ScummvmSave
Hotkey, $2, ScummvmLoad
Hotkey, $Esc, ScummvmExit
Hotkey, $p, ScummvmMenu
Gui +AlwaysOnTop -Caption +ToolWindow
Gui, color, 0
Gui Show, x0 y0 h%A_ScreenHeight% w%A_ScreenWidth%, HSHIDE
Run, "%emupath%%executable%" %romname%
WinWaitActive, ScummVM.exe
sleep, 2000
Gui Destroy
Process, waitClose, ScummVM.exe
}

;***********************************SEGA 32X************************************

else if (systemName = "Sega 32X" && executable = "Fusion.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess2
Hotkey, $1, FusionSave
Hotkey, $2, FusionLoad
Run, %Executable% "%romPath%%romName%%romExtension%" -auto -32X -fullscreen, %EmuPath%, Hide UseErrorLevel
Process, WaitClose, fusion.exe
}

;***********************************SEGA CD*************************************

else if (systemName = "Sega CD" && executable = "Fusion.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess2
Hotkey, $1, FusionSave
Hotkey, $2, FusionLoad
Run, %Executable% "%romPath%%romName%%romExtension%" -auto -scd -fullscreen, %EmuPath%, Hide UseErrorLevel
Process, WaitClose, %Executable%
}

;*********************************SEGA DREAMCAST********************************

else if (systemName = "Sega Dreamcast" && executable = "nullDC_100b1_6.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
Run, %Executable% -config ImageReader:DefaultImage="%romPath%%romName%%romExtension%", %EmuPath%,Hide UseErrorLevel
WinWait, nullDC
Sleep,1000
WinShow, ahk_class ndc_main_window
Process, WaitClose, nullDC_100b1_6.exe
}


;*********************************SEGA Game Gear********************************

else if (systemName = "Sega Game Gear" && executable = "Fusion.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess2
Hotkey, $1, FusionSave
Hotkey, $2, FusionLoad
Run, %Executable% "%romPath%%romName%%romExtension%" -auto -sms -fullscreen, %EmuPath%, Hide UseErrorLevel
Process, WaitClose, fusion.exe
}

;*********************************SEGA Genesis**********************************

else if (systemName = "Sega Genesis" && executable = "Fusion.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess2
Hotkey, $1, FusionSave
Hotkey, $2, FusionLoad
Run, %Executable% "%romPath%%romName%%romExtension%" -auto -gen -fullscreen, %EmuPath%, Hide UseErrorLevel
Process, WaitClose, fusion.exe
}

;*******************************SEGA Master System******************************

else if (systemName = "Sega Master System" && executable = "Fusion.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess2
Hotkey, $1, FusionSave
Hotkey, $2, FusionLoad
Run, %Executable% "%romPath%%romName%%romExtension%" -auto -sms -fullscreen, %EmuPath%, Hide UseErrorLevel
Process, WaitClose, fusion.exe
}

;***********************************SEGA MODEL 2*********************************

else if (systemName = "Sega Model 2")
{
if(executable = "emulator_multicpu.exe" || executable = "emulator.exe" )
{
;hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
Run, %executable% %romName%, %emuPath%, Hide UseErrorLevel
DetectHiddenWindows, on
WinWait, Model 2
WinShow
Process, WaitClose, %executable%
}
}

;***********************************SEGA Naomi***********************************
else if (systemName = "Sega Naomi" && executable="naomi.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
IniRead, Xram, %emupath%settings.ini, %RomName%, Xram, 2PH
IniRead, Region, %emupath%settings.ini, %RomName%, Region, 0
If (Xram = "1ph"){
filecopy, %emupath%1PH_xram.bin, %emupath%xram.bin, 1
IniWrite, %Region%, %emupath%NAOMI.ini, Settings, Region
}
Else if(Xram = "1pv"){
filecopy, %emupath%1PV_xram.bin, %emupath%xram.bin, 1
IniWrite, %Region%, %emupath%NAOMI.ini, Settings, Region
}
Else if(Xram = "2pv"){
filecopy, %emupath%2PV_xram.bin, %emupath%xram.bin, 1
IniWrite, %Region%, %emupath%NAOMI.ini, Settings, Region
}
Else{
filecopy, %emupath%2PH_xram.bin, %emupath%xram.bin, 1
IniWrite, %Region%, %emupath%NAOMI.ini, Settings, Region
}
Run, "%emupath%%executable%" "%romPath%%romName%%romExtension%", %emuPath%, Hide UseErrorLevel
Process, WaitClose, %executable%
}


;**********************************SEGA SATURN***********************************
else if (systemName = "Sega Saturn" && executable = "SSF.exe")

{

Run, %DAEMONTOOLS% -mount 0`,"%romPath%%romName%%romExtension%"
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
Run, %executable% , %emuPath%, UseErrorLevel
process, waitclose, %executable%
Run, %DAEMONTOOLS% -unmount 0
}
;********************************Sony Playstation*******************************

else if (systemName = "Sony Playstation" && executable = "psxfin.exe")
{
psxParams = -f
Hotkey, %exitEmulatorKey%, CloseProcess
Run, %Executable% %psxParams% "%romPath%%romName%%romExtension%", %EmuPath%, Hide UseErrorLevel
DetectHiddenWindows, on
WinWait, ahk_class pSX
hideDesktop()
WinWaitClose, ahk_class pSX
}

;***********************Super Nintendo Entertainment System*********************

else if (systemName = "Super Nintendo Entertainment System" && executable = "zsnesw.exe")
{
hideDesktop()
Hotkey, $1, ZsnesSave
Hotkey, $2, ZsnesLoad
Hotkey, $p, ZsnesMenu
Hotkey, $Esc, ZsnesExit
RunWait, %Executable% "%romPath%%romName%%romExtension%", %EmuPath%
}

;**********************************Turbo Duo***********************************
else if (systemName = "Turbo Duo" && executable = "pce.exe")
{
RunWait, %DAEMONTOOLS% -mount 0`,"%romPath%%romName%%romExtension%"
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
Run, %executable% syscard3.pce , %emuPath%, UseErrorLevel
}

;**********************************TurboGrafx 16********************************

else if (systemName = "TurboGrafx 16" && executable = "mednafen.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
RunWait, "%EmuPath%%Executable%" "%romPath%%romName%%romExtension%" -fs 1,, UseErrorLevel
}

;***********************************JukeBox******* ******************************

else if (systemName = "Jukebox" && executable = "Silverjuke.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseJuke
RunWait, %emuPath%%executable% --kiosk, Hide UseErrorLevel
}
else if (systemName = "Jukebox" && executable = "SKJukebox.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
RunWait, %emuPath%%executable%, Hide UseErrorLevel
}

;***************************************Zinc****** ******************************

else if (systemName = "Zinc" && executable = "zinc.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
RunWait, %Executable% %romName% --use-config-file="C:\HyperSpin\Emulators\Zinc\zinc.cfg" --use-renderer-cfg-file="C:\HyperSpin\Emulators\Zinc\renderer.cfg", %EmuPath%, Hide UseErrorLevel
}

else
{
MsgBox,48,Error,%systemName% is an invalid System Name or %executable% isnt supported yet,6
}


;------------------------------------------------------------------------------;
; WHEN EMULATOR FINISHES OR IF LAUNCH EXE FAILS ;
;------------------------------------------------------------------------------;
;************PROBABLY DO NOT NEED TO EDIT THIS AREA*************

WinActivate, HyperSpin
WinMaximize, HyperSpin
WinActivate, HyperSpin
Sleep, 500
Send, ^m ;hotkey set in ultramon to fix resolution problems. Maximize window to desktop



if (ErrorLevel = "ERROR")
{
MsgBox,48,Error,Failed to run executable check your paths,6
}
Goto ExitScript ; Exits script and returns to frontend


;------------------------------------------------------------------------------;
; KILL COMMANDS & HOTKEYS ;
;------------------------------------------------------------------------------;
;************PROBABLY DO NOT NEED TO EDIT THIS AREA*************

/*
Most emu's can be closed with CloseProcess when using a 2 key combo, if not set a custom
close.
*/
CloseJuke:
RunWait, %emuPath%%executable% --execute="program.shutdown(30);", Hide UseErrorLevel
return

;***********closeprocess WITH ESC kypress***************
CloseProcess:
KeyWait, Esc, T2
if ErrorLevel = 1
{
Hotkey, %exitScriptKey%, Off
Process, Close, %Executable%
Process, WaitClose, %Executable%
Gui, Color, 000000
Gui -Caption +ToolWindow +AlwaysOnTop
Gui, Show, W%A_ScreenWidth% H%A_ScreenHeight%, BlackGui
winactivate, hyperspin.exe
return
}
else
{
Hotkey, %exitEmulatorKey%, Off
send, {Esc}
Hotkey, %exitEmulatorKey%, On
return
}

;***********closeprocess WITHOUT ESC keypress**********
CloseProcess2:
KeyWait, Esc, T2
if ErrorLevel = 1
{
Hotkey, %exitScriptKey%, Off
Process, Close, %Executable%
Process, WaitClose, %Executable%
Gui, Color, 000000
Gui -Caption +ToolWindow +AlwaysOnTop
Gui, Show, W%A_ScreenWidth% H%A_ScreenHeight%, BlackGui
winactivate, hyperspin.exe
return
}
else
return
;********************FreeDo*********************** *****
;*********************Save************************ *****
FreedoSave:
KeyWait 1, t2
Send % Errorlevel ? "{f5}" : "1"
KeyWait 1
Return
;*********************Load************************ *****
FreedoLoad:
KeyWait 2, t2
Send % Errorlevel ? "{f8}" : "2"
KeyWait 2
Return
;********************Fusion*********************** *****
;*********************Save************************ *****
FusionSave:
KeyWait 1, t2
Send % Errorlevel ? "{f5}" : "M"
KeyWait 1
Return
;*********************Load************************ *****
FusionLoad:
KeyWait 2, t2
Send % Errorlevel ? "{f8}" : "N"
KeyWait 2
Return
;********************Kat5200********************** *****
;*********************Save************************ *****
Kat5200Save:
KeyWait 1, t2
Send % Errorlevel ? "+1" : "1"
KeyWait 1
Return
;*********************Load************************ *****
Kat5200Load:
KeyWait 2, t2
Send % Errorlevel ? "!1" : "2"
KeyWait 2
Return
;*********************Exit************************ *****
Kat5200Exit:
Keywait Esc, t2
Send % Errorlevel ? "!{f4}" : "{Esc}"
Keywait Esc
return
;*********************Menu************************ *****
Kat5200Menu:
Keywait P, t2
Send % Errorlevel ? "{Tab}" : "p"
Keywait P
return
;*********************Mame************************ *****
;*********************Save************************ *****
MameSave:
KeyWait, 1, T2
if ErrorLevel = 1
{
blockinput, on
keywait, 1
sleep, 1000
Send, +{f7}
sleep, 1000
Send, a
blockinput, off
return
}
else
{
send, m
keywait, 1
return
}
;*********************Load************************ *****
MameLoad:
KeyWait, 2, T2
if ErrorLevel = 1
{
blockinput, on
keywait, 2
sleep, 1000
Send, {f7}
sleep, 1000
Send, a
blockinput, off
return
}
else
{
send, n
keywait, 2
return
}
;*********************Menu************************ *****
MameMenu:
KeyWait, p, T2
if ErrorLevel = 1
{
Send, {tab}
keywait, p
return
}
else
{
send, b
keywait, p
return
}
;*******************Nestopia********************** *****
;*********************Save************************ *****
NestopiaSave:
KeyWait 1, t2
Send % Errorlevel ? "{f5}" : "1"
KeyWait 1
Return
;*********************Load************************ *****
NestopiaLoad:
KeyWait 2, t2
Send % Errorlevel ? "{f7}" : "2"
KeyWait 2
Return
;*********************Exit************************ *****
NestopiaExit:
KeyWait Esc, t2
Send % Errorlevel ? "!x" : "{esc}"
KeyWait Esc
Return
;********************ScummVM********************** *****
;*********************Save************************ *****
ScummvmSave:
KeyWait 1, t2
Send % Errorlevel ? "!1" : "1"
KeyWait 1
Return
;*********************Load************************ *****
ScummvmLoad:
KeyWait 2, t2
Send % Errorlevel ? "^1" : "2"
KeyWait 2
Return
;*********************Exit************************ *****
ScummvmExit:
KeyWait Esc, t2
Send % Errorlevel ? "!x" : "{Esc}"
KeyWait Esc
Return
;*********************Menu************************ *****
ScummvmMenu:
KeyWait p, t2
Send % Errorlevel ? "^{f5}" : "p"
KeyWait p
Return
;********************Stella*********************** *****
;*********************Save************************ *****
StellaSave:
KeyWait 1, t2
Send % Errorlevel ? "{f2}" : "1"
KeyWait 1
Return
;*********************Load************************ *****
StellaLoad:
KeyWait 2, t2
Send % Errorlevel ? "{f3}" : "2"
KeyWait 2
Return
;*********************Exit************************ *****
StellaExit:
Keywait Esc, t2
Send % Errorlevel ? "^q" : "{esc}"
Keywait Esc
return
;*********************Menu************************ *****
StellaMenu:
Keywait P, t2
Send % Errorlevel ? "{TAB}" : "p"
Keywait P
return
;****************VisualBoyAdvance***************** *****
;*********************Save************************ *****
VisualboySave:
KeyWait 1, t2
Send % Errorlevel ? "{f2}" : "m"
KeyWait 1
Return
;*********************Load************************ *****
VisualboyLoad:
KeyWait 2, t2
Send % Errorlevel ? "{f3}" : "n"
KeyWait 2
Return
;*********************ZSNES*********************** *****
;*********************Save************************ *****
ZsnesSave:
KeyWait 1, t2
Send % Errorlevel ? "{f2}" : "1"
KeyWait 1
Return
;*********************Load************************ *****
ZsnesLoad:
KeyWait 2, t2
Send % Errorlevel ? "{f3}" : "2"
KeyWait 2
Return
;*********************Menu************************ *****
ZsnesMenu:
Keywait P, t2
Send % Errorlevel ? "{Esc}" : "1"
Keywait P
return
;*********************Exit************************ *****
ZsnesExit:
Keywait Esc, t2
Send % Errorlevel ? "x" : ""
Keywait Esc
return
;************************************************* *****

ExitScript:
Process, Exist, HyperSpin.exe
PID := errorLevel
if (PID)
{
WinActivate, ahk_pid %PID%
WinWaitActive, ahk_pid %PID%
Gui, destroy
if (hideCursor)
SystemCursor("On")
if (hideTaskbar)
WinShow ahk_class Shell_TrayWnd
ExitApp
}


OnExit, ExitScript
return








;------------------------------------------------------------------------------;
; REST OF SCRIPT ;
;------------------------------------------------------------------------------;
;************PROBABLY DO NOT NEED TO EDIT THIS AREA*************



SystemCursor(OnOff=1) ; INIT = "I","Init"; OFF = 0,"Off"; TOGGLE = -1,"T","Toggle"; ON = others
{
static AndMask, XorMask, $, h_cursor
,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 ; system cursors
, b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 ; blank cursors
, h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13 ; handles of default cursors
if (OnOff = "Init" or OnOff = "I" or $ = "") ; init when requested or at first call
{
$ = h ; active default cursors
VarSetCapacity( h_cursor,4444, 1 )
VarSetCapacity( AndMask, 32*4, 0xFF )
VarSetCapacity( XorMask, 32*4, 0 )
system_cursors = 32512,32513,32514,32515,32516,32642,32643,32644,32 645,32646,32648,32649,32650
StringSplit c, system_cursors, `,
Loop %c0%
{
h_cursor := DllCall( "LoadCursor", "uint",0, "uint",c%A_Index% )
h%A_Index% := DllCall( "CopyImage", "uint",h_cursor, "uint",2, "int",0, "int",0, "uint",0 )
b%A_Index% := DllCall("CreateCursor","uint",0, "int",0, "int",0
, "int",32, "int",32, "uint",&AndMask, "uint",&XorMask )
}
}
if (OnOff = 0 or OnOff = "Off" or $ = "h" and (OnOff < 0 or OnOff = "Toggle" or OnOff = "T"))
$ = b ; use blank cursors
else
$ = h ; use the saved cursors

Loop %c0%
{
h_cursor := DllCall( "CopyImage", "uint",%$%%A_Index%, "uint",2, "int",0, "int",0, "uint",0 )
DllCall( "SetSystemCursor", "uint",h_cursor, "uint",c%A_Index% )
}
}
ToggleCursor:
SystemCursor("Toggle")
return

IniRead(Filename, Section, Key, Default = "") {
FileRead, text, *t %Filename%
text = `n%text%`n
StringTrimLeft, text, text, InStr(text, "`n[" . Section . "]`n")
Loop, 8 {
sp := sp . " "
StringReplace, text, text, %Key%%sp%=, %Key%=
If ErrorLevel
Break
}
start := InStr(text, "`n" . Key . "=")
If !start
Return, Default
start += StrLen(Key) + 2
StringMid, Value, text, start, InStr(text, "`n", false, start) - start
Return, Value
}

;Get Full Path from Relative Path
GetFullName( fn ) {
static buf, i
if !i
i := VarSetCapacity(buf, 512)
DllCall("GetFullPathNameA", "str", fn, "uint", 512, "str", buf, "str*", 0)
return buf
}

hideDesktop(){
;WinHide ahk_class Shell_TrayWnd
;Gui, +toolwindow
;Gui, -Caption
;Gui, Color, black
;Gui, show, +toolwindow Maximize
Gui, Color, 000000
Gui -Caption +ToolWindow
Gui, Show, W%A_ScreenWidth% H%A_ScreenHeight%, BlackScreen

}

CheckINI:
IfNotExist, %A_ScriptDir%\HyperSpin.exe
{
MsgBox,48,Error, Must be in same directory as HyperSpin.exe,6
Goto ExitScript
}
IfNotExist, %A_ScriptDir%\Settings\%systemName%.ini
{
MsgBox,48,Error,Cannot Find %A_ScriptDir%\Settings\%systemName%.ini,6
Goto ExitScript
}
return

CheckPaths:
romFound =
StringRight, emuPathBackSlash, EmuPath, 1
StringRight, romPathBackSlash, RomPath, 1

If (emuPathBackSlash != "\" || romPathBackSlash != "\")
{
MsgBox,48,Error, Make sure your paths contains a backslash on the end ,6
Goto ExitScript
}
If (executable = "")
{
MsgBox,48,Error, Missing executable in %systemName%.ini ,6
Goto ExitScript
}
If (romPath = "")
{
MsgBox,48,Error, Missing rom path in %systemName%.ini ,6
Goto ExitScript
}
If (emuPath = "")
{
MsgBox,48,Error, Missing emulator path in %systemName%.ini ,6
Goto ExitScript
}
IfNotExist, %EmuPath%%Executable%
{
MsgBox,48,Error,Cannot Find %EmuPath%%Executable%,6
Goto ExitScript
}
if(systemName != "zinc")
{
If (romExtensions = "")
{
MsgBox,48,Error, Missing rom extension in %systemName%.ini ,6
Goto ExitScript
}
Loop, parse, romExtensions, `,
{
inputVar = %A_LoopField%
StringLeft, charToCheck, inputVar, 1
If(charToCheck = ".")
{
MsgBox,48,Error, Make sure your rom extensions do not contain a ".",6
Goto ExitScript
}
IfExist %RomPath%%RomName%.%A_LoopField%
{
romExtension = .%A_LoopField%
romFound = true
break
}else{
IfExist %RomPath%%RomName%\%RomName%.%A_LoopField%
{
RomPath = %RomPath%%RomName%\
;MsgBox %RomPath%
romExtension = .%A_LoopField%
romFound = true
break
}else{
romFound = false
}
}
}
}
if (romFound = "false")
{
if(systemName != "daphne"){
MsgBox,48,Error,Cannot find Rom - %RomPath%%RomName% with any provided extension,6
Goto ExitScript
}else{
MsgBox,48,Error,Cannot find Daphne framefile - %RomPath%%RomName% with any provided extension,6
Goto ExitScript
}
}
return

djvj
09-18-2010, 07:25 PM
Thanks loppydog

In what cases did you find this necessary?



WinActivate, HyperSpin
WinMaximize, HyperSpin
WinActivate, HyperSpin
Sleep, 500
Send, ^m ;hotkey set in ultramon to fix resolution problems. Maximize window to desktop


I found one downside with using your keymaps. This is probably only me though. I use Input Director to share my mouse/keyboard with all the computers on my desk. Well, it seems autohotkey doesn't detect when I hold down my keyboard key. Windows does though, so however ahk hooks into the inputs, probably via hardware, these don't work for me.

I hooked up a keyboard to test and they do work fine. Sucks, as I do all my HS testing on my gaming pc which doesn't use any physical inputs at all.

I actually just found a post on the input director forums pertaining to exactly this shortcoming.
http://groups.google.com/group/input-director/browse_thread/thread/feba61e2ebd84f4f/fd249948acebd68d?hl=en&lnk=gst&q=autohotkey#fd249948acebd68d

It sounds like it is an issue with ahk, I also tried using #InstallKeybdHook and that did not fix it.

I found a person on the ahk forum that was looking to fix this exact issue:
http://www.autohotkey.com/forum/topic38641.html
&
http://www.autohotkey.com/forum/topic38386.html

loppydog
09-18-2010, 10:28 PM
WinActivate, HyperSpin
WinMaximize, HyperSpin
WinActivate, HyperSpin
Sleep, 500
Send, ^m ;hotkey set in ultramon to fix resolution problems. Maximize window to desktop

For my setup this fixed a major problem I had with resolution issues. When I would launch an emulator that was not the same resolution as hyperspin, then exit back to hyperspin, I would only see a small portion of what was displayed. These commands fixed this problem. Most people will probably not have this issue because I think it may have something to do with my second monitor and/or using wondows 7.

as far as your problem with input director, I cant really help you much there because I have not even heard of it ;) But what I can tell you is that some programs do not work well with AHK. But usually after much trial and error I find something that works. For instance, I was having NO luck getting MAME working with this kind of script, but after some research I found that I need to "force" directinput....read about that here:

http://forum.arcadecontrols.com/index.php?topic=100234.0

If I were you I would try to post and ask for help at the AHK forums, they may not be able to help you, but if enough people complian about it maybe someone will find a fix if one is posible. They have alway been very helpful for me. Just make sure you explain your problem with as much detail as possible.

djvj
09-18-2010, 10:35 PM
Yea I already did.

http://www.autohotkey.com/forum/topic62693.html

MAME/MESS work differently then all other emus. They seem to only read from raw/physical inputs and you can't remap controls with xpadder or joy2key.

That's good to see that it can be patched and recompiled though. Might have to consider this in the future.

loppydog
09-29-2010, 09:45 AM
hey, just so everybody knows, if you recompile MAME with "force direct input", it makes MAME think all your pointing devices are the same. So if you have two guns for instance, it will not work. That is the problem I am facing right now.

djvj
09-29-2010, 11:15 AM
Good find, I was thinking of trying that option in the future, but if it breaks not being able to use 2 guns, then I won't even try.

loppydog
09-29-2010, 11:44 AM
well, it seems to have broken that feature for me. But if someone wanted to try it and see, then let us know how it worked, that would be great.

Trnzaddict
10-22-2010, 06:42 PM
I'm going to try your switch resolutions script part when i get a chance. This should help users if they have any lag/slowdown when hypersin is upscaled past it's native resolution, but your emu run fine in the higher resolution.

All my emu's i've run so far are fine in 1920x1080. Hyperspin stutters quite a bit when scaled that high but is smooth as butter in 1024x768.

stevil69a
12-19-2010, 01:53 AM
Hi Guys
Extreme noob and dont i am ment to be posting here but i am trying to get makaron to run in hyperspin and have no idea what i'm doing i can get the wheel with the rom list but when it goes to load it says naomi.exe not supported yet any ideas?/

loppydog
12-20-2010, 09:13 AM
you are better off posting directly in the "Hyperspin support" section, there will be people there that can help you out.

sabilata
06-09-2011, 05:38 PM
excuse the lack of connectivity. Could you translate this for me siguinificado numbers: KeyWait 1, t2,
Send Errorlevel%? "{f2}": "1 "

Another ves I apologize for the lack of acquaintance with the English

loppydog
06-09-2011, 08:32 PM
this is just part of the code that just basically says:
If the "1" button is held down for 2 seconds or more(t2)..then send a keystroke of F2...if not, send a keystroke of "1". In this case that is also the "trigger" key, but it could be any key. Also, this is only part of the code, it still needs a hotkey trigger which in my script is located in each of the emulator blocks. Hope this makes sense!

swindmiller
08-16-2011, 05:31 PM
I am using your script with a tankstick setup and it works perfectly...thanks.

I am trying to use this on a different setup using only xbox 360 controllers and xpadder. I saw in like the 2nd post that this was a problem...basically it does not read the hold thru xpadder only a directly attached keyboard.
Was wondering if there was a workaround yet?
I have it working if I plug a keyboard in but that kind of defeats the purpose :)

Thanks,
Scott

loppydog
08-19-2011, 09:06 AM
well, if you are using Xpadder to map joystick controls to keyboard keys, I guess it may work. But I would think there would be some issues there. Holding your controller button down is probably not the same thing as holding a keyboard button down. Should be easy enough for you to test tho.

swindmiller
08-19-2011, 09:23 AM
well, if you are using Xpadder to map joystick controls to keyboard keys, I guess it may work. But I would think there would be some issues there. Holding your controller button down is probably not the same thing as holding a keyboard button down. Should be easy enough for you to test tho.

Thanks...I did test it and it does not work. Was checking to see if there was another way around it.

Thanks,
Scott