Jump to content
LaunchBox Community Forums

Recommended Posts

I was looking for a way to display some info - mainly easily forgotten key combinations - while playing games with WinUAE through Launchbox.

WinUAE is using rawinput so it can't accept  directinput commands from Autohotkey. Searching through the http://eab.abime.net i came upon a script which uses the WinUAE Pipe to get events from Autohotkey.

I modified the script so when i press button 16 on my 4th gamepad, WinUAE goes into window mode, a message is displayed with some helpful info and waits for me to press OK (the game is still running normally in the background). Pressing OK makes WinUAE to revert to fullscreen mode.

If you want to modify the script to send different events to WinUAE, all the events WinUAE accepts are listed here: https://github.com/tonioni/WinUAE/blob/master/inputevents.def

#NoEnv

;Display Help Info

#IfWinActive, ahk_Exe WinUAE64.exe
4joy16::
WinUAE("EVT SPC_TOGGLEFULLSCREEN 1")
MsgBox,,INFO,Use END+(1 to 0) to swap disks
WinUAE("EVT SPC_TOGGLEFULLSCREEN 1")

return
#IfWinActive

WinUAE(command) {
    VarSetCapacity(result, 4096)
    if !DllCall("CallNamedPipe", "str", "\\.\pipe\WinUAE"
        , "astr", command, "int", StrPut(command, "cp0")
        , "ptr", &result, "int", 4096
        , "uint*", bytesRead, "uint", 1)
        throw Exception("CallNamedPipe failed with error " A_LastError)
    return RegExReplace(StrGet(&result, bytesRead, "cp0"), "\R$")
}

NOTE: I use WinUAE64. If you use the 32-bit WinUAE you must change the second line to read #IfWinActive, ahk_Exe WinUAE.exe

Edited by Crush

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...