retroviking Posted March 18 Posted March 18 (edited) On 3/18/2025 at 7:05 PM, JoeViking245 said: SetKeyDelay, 0, 50 1 & 5:: Send {Esc} Return 1::1 Expand yeah, keyboard 1 & 5. Still didn't work. Thanks anyway This worked though; ~1 & 5:: Send {Esc} { WinClose, ahk_exe {{{StartupEXE}}} } Edited March 18 by retroviking 1 Quote
jevcleem Posted March 21 Posted March 21 (edited) Now that xemu is better supported, I tried making the following useful ahk scripts for xemu that i think are general enough to be added as default settings (at least i hope so, dont want to accidentally delete them by pressing set to default). It's my first time writing ahk scripts so feedback would be welcome - i'm a programmer and i found ahk to be so unintuitive to use, am i missing something? 😆 Save state script: Will go to your xemu log file to see what game has been started and then use the monitor window to set a game-specific snapshot. This is necessary because using hotkeys make system wide snapshots (not tied to the running game). ; Define the path to the log file logFilePath := ".\Emulators\xemu\xemu.log" ; Read the contents of the log file into a string variable FileRead, logContents, %logFilePath% ; Check if the file was successfully read if (ErrorLevel) { MsgBox, Failed to get the filename! Check the install directory of xemu in the ahk script 'save state script'. ExitApp } ; Use regular expression to extract the string between the two delimiters RegExMatch(logContents, "LaunchBox\\Games\\Microsoft Xbox\\(.*?).iso", extractedString) ; If a match is found, the result will be in extractedString1 if (extractedString) { filename := extractedString1 ; The captured match will be in extractedString1 ;MsgBox, Extracted filename: %filename% } else { MsgBox, Could not obtain the filename, check the regex expression in the ahk script 'save state script'. ExitApp } ; Send ~ key (tilde key) Send, {~ 1} ; this adds characters in monitor Send, {Backspace 2} ;an extra one is sometimes needed.. ; Wait a little to ensure the focus is ready Sleep, 500 ; Send the savevm command with the filename Send, savevm "%filename%"" ; double quote can only be added twice or is not added at all.. Send, {Backspace 1} ;remove the extra double quote ; Send Enter key to execute the command Send, {Enter} Send, {~ 1} Load state script: The same as above but using 'loadvm' instead of 'savevm' Resume script: I (and many others) use the xbox guide button as pause menu, this will however open the xemu menu. So after resuming, esc is sent to close it. You can still open the xemu menu by pressing select+start. If you use a different way, not using the guide button, to open the pause menu, this hotkey will have not have an impact, it will not close the emulator. ; Send esc key to close the menu Send, {esc} Running script (not working): I first tried remapping the guide button to an alternative input which can also open the pause menu (here it is 'appskey'). This path didn't work however.. Any feedback would be welcome because this would prevent the xemu menu from opening in the first place. ;#Persistent ; Keep the script running ; Set up a timer to check if the target app is running ;SetTimer, CheckApp, 500 ; Check every 500ms ;CheckApp: ;if (GetKeyState("Joy11", "P")) ;{ ;Remap the Xbox Guide button to send F12 ;Send, {AppsKey} ;} Edited March 21 by jevcleem Quote
JoeViking245 Posted March 21 Posted March 21 On 3/21/2025 at 4:19 PM, jevcleem said: i'm a programmer and i found ahk to be so unintuitive to use, am i missing something? 😆 Expand It is definitely its own language. lol But it is straight forward, in its own rights (once you get used to it. ) On 3/21/2025 at 4:19 PM, jevcleem said: Running script (not working): I first tried remapping the guide button to an alternative input which can also open the pause menu (here it is 'appskey'). This path didn't work however.. Any feedback would be welcome because this would prevent the xemu menu from opening in the first place. Expand Not really sur what exactly you're attempting to do here. With AHK, you can't "Send" an Xinput button. You can only read them (detect they were pressed). On 3/21/2025 at 4:19 PM, jevcleem said: Remap the Xbox Guide button to send F12 Expand For this... $vk07:: { Send {F12} Return } But I think for Xemu, the default for Pause is Alt+P. I could be totally off base too. 😊 $vk07:: { Send !p Return } Quote
jevcleem Posted Friday at 09:42 PM Posted Friday at 09:42 PM On 3/21/2025 at 8:21 PM, JoeViking245 said: Not really sur what exactly you're attempting to do here. With AHK, you can't "Send" an Xinput button. You can only read them (detect they were pressed). $vk07:: { Send {F12} Return } Expand I have AppsKey (which is a button on a usb remote i use) mapped to open the pause menu in bigbox/launchbox, i tested it by mapping AppsKey to a button on the keyboard and it worked so that part of the code is alright. It's just that i cant get ahk to recognize the guide button, i also found about $vk07 (and some variations) online and they all dont work. It's not that big of a deal, the resume script is a great workaround. But I think for Xemu, the default for Pause is Alt+P. I could be totally off base too. 😊 $vk07:: { Send !p Return } Tried with my keyboard, alt+p is not working Quote
JoeViking245 Posted Friday at 11:11 PM Posted Friday at 11:11 PM On 3/21/2025 at 9:42 PM, jevcleem said: Tried with my keyboard, alt+p is not working Expand Of course not. It's Ctrl+P. (my bad. srry 'bout that. 😊) However, through some research and testing, I found you can't override (remap) Xemus' "Guide Button brings up the built in Pause Menu". aka, you can't make the Guide Button do anything different [in Xemu]. With my wireless Xbox 360 controller, I can put in Xemu's Running Script $vk07::Run notepad.exe and after launching a game, if I press the Guide button, it will [still] open Xemu's Pause Menu, and ALSO start Notepad. So the Guide button is recognized in AHK (well, on this controller it is). Even when Xemu is running. It's just that it doesn't do you much good in Xemu. (though a moot point since you have it already working...) Also what I found... to get to the LaunchBox pause screen (and pause-emulation), map a button (or button-combo) in LaunchBox/BigBox (requires separate mappings for each app) that's NOT the Guide button. Then edit Xemu (in LaunchBox) and under Pause Screen, check all 3 boxes. Quote
jevcleem Posted Saturday at 09:39 PM Posted Saturday at 09:39 PM On 3/21/2025 at 11:11 PM, JoeViking245 said: With my wireless Xbox 360 controller, I can put in Xemu's Running Script $vk07::Run notepad.exe and after launching a game, if I press the Guide button, it will [still] open Xemu's Pause Menu, and ALSO start Notepad. So the Guide button is recognized in AHK (well, on this controller it is). Even when Xemu is running. It's just that it doesn't do you much good in Xemu. Expand huh interesting Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.