diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fec15a8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +images/ +*.code-workspace \ No newline at end of file diff --git a/ActivatePegasus.ahk b/ActivatePegasus.ahk new file mode 100644 index 0000000..92f9250 --- /dev/null +++ b/ActivatePegasus.ahk @@ -0,0 +1,17 @@ +#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. +; #Warn ; Enable warnings to assist with detecting common errors. +SendMode Input ; Recommended for new scripts due to its superior speed and reliability. +SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. + +sleep, 1000 +if WinExist("Pegasus") + WinActivate + +sleep, 2000 + +if WinExist("BlackScreen") +{ + WinClose + Process,Close, BlackScreen.exe +} +ExitApp \ No newline at end of file diff --git a/BlackScreen.ahk b/BlackScreen.ahk new file mode 100644 index 0000000..9bf2815 --- /dev/null +++ b/BlackScreen.ahk @@ -0,0 +1,23 @@ +#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. +; #Warn ; Enable warnings to assist with detecting common errors. +SendMode Input ; Recommended for new scripts due to its superior speed and reliability. +SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. + +HideShowTaskbar(hide := hide) + +HideShowTaskbar(action) { + static ABM_SETSTATE := 0xA, ABS_AUTOHIDE := 0x1, ABS_ALWAYSONTOP := 0x2 + VarSetCapacity(APPBARDATA, size := 2*A_PtrSize + 2*4 + 16 + A_PtrSize, 0) + NumPut(size, APPBARDATA), NumPut(WinExist("ahk_class Shell_TrayWnd"), APPBARDATA, A_PtrSize) + NumPut(action ? ABS_AUTOHIDE : ABS_ALWAYSONTOP, APPBARDATA, size - A_PtrSize) + DllCall("Shell32\SHAppBarMessage", UInt, ABM_SETSTATE, Ptr, &APPBARDATA) +} +WA=%A_screenwidth% +HA=%A_screenheight% +MouseMove, WA, HA ,, R + +Gui, Color, black + +Gui -Caption + +Gui, Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight% \ No newline at end of file diff --git a/GameEnd.ahk b/GameEnd.ahk new file mode 100644 index 0000000..309d728 --- /dev/null +++ b/GameEnd.ahk @@ -0,0 +1,8 @@ +#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. +; #Warn ; Enable warnings to assist with detecting common errors. +SendMode Input ; Recommended for new scripts due to its superior speed and reliability. +SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. + +Run, ../ActivatePegasus.exe + +ExitApp \ No newline at end of file diff --git a/GameStart.ahk b/GameStart.ahk new file mode 100644 index 0000000..c89748d --- /dev/null +++ b/GameStart.ahk @@ -0,0 +1,5 @@ +#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. +; #Warn ; Enable warnings to assist with detecting common errors. +SendMode Input ; Recommended for new scripts due to its superior speed and reliability. +SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. +Run, ../BlackScreen.exe \ No newline at end of file diff --git a/PegasusWindowsLauncher.ahk b/PegasusWindowsLauncher.ahk new file mode 100644 index 0000000..1f7947f --- /dev/null +++ b/PegasusWindowsLauncher.ahk @@ -0,0 +1,67 @@ +; +; AutoHotkey Version: 1.x +; Language: English +; Platform: Win9x/NT +; Author: A.N.Other +; +; Script Function: +; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder) +; +#Persistent +#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. +SendMode Input ; Recommended for new scripts due to its superior speed and reliability. +SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. +HideShowTaskbar(hide := hide) + +HideShowTaskbar(action) { + static ABM_SETSTATE := 0xA, ABS_AUTOHIDE := 0x1, ABS_ALWAYSONTOP := 0x2 + VarSetCapacity(APPBARDATA, size := 2*A_PtrSize + 2*4 + 16 + A_PtrSize, 0) + NumPut(size, APPBARDATA), NumPut(WinExist("ahk_class Shell_TrayWnd"), APPBARDATA, A_PtrSize) + NumPut(action ? ABS_AUTOHIDE : ABS_ALWAYSONTOP, APPBARDATA, size - A_PtrSize) + DllCall("Shell32\SHAppBarMessage", UInt, ABM_SETSTATE, Ptr, &APPBARDATA) +} +WA=%A_screenwidth% +HA=%A_screenheight% +MouseMove, WA, HA ,, R + +Gui, Color, black + +Gui -Caption + +Gui, Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight% + +; Store the arguments passed to it +arg1 := A_Args[1] +arg2 := A_Args[2] + +; If appropriate, run the steam game +steam(args) +{ + searchString := "steam:" + + IfInString, args, %searchString% + { + ; When coming from Pegasus through Launchbox, we need to split the string since it is written incorrectly + StringSplit, outputArray, args, : + Run, steam://rungameid/%outputArray3% + } else { + ; In case this is used outside the Pegasus/LB combo + Run, steam://rungameid/%args% + } +} + +; Run the correct command based on whether there is a switch argument +switch arg1 +{ + case "-s": ; Steam + steam(arg2) + default: ; Everything else + Run, %arg1% +} + + +sleep, 10000 +WinGetActiveTitle, Title +WinWait, %Title% +WinWaitClose +ExitApp \ No newline at end of file diff --git a/README.md b/README.md index 7a5b332..0a8ad1d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,24 @@ # PegasusHelper -Some Windows helper scripts for Pegasus Frontend to make the experience more pleasing + +## What does this do? +This is a series of compiled scripts that make the Pegasus experience on Windows a little more pleasing. + +- Hide the desktop when launching games limiting immersion breaking +- Seamlessly return to Pegasus without seeing the desktop +- Optional Windows launcher to help with launching Steam games + +## How to use +Download the latest zip from the releases page and unzip directly into your Pegasus config directory. It should look like config\scripts with all the files and directories needed already set up. + +## PegasusWindowsLauncher +PegasusWindowsLauncher.exe is primarily intended for those that wish to manage their Steam games via LaunchBox. Simply set up a new emulator in LaunchBox called Steam (or whatever you like), with the default launch paramaters as -s, and make sure to check "Use file name only without file extension" and set it to be the default emulator for Steam. Import your Steam games using LaunchBox's built in Steam import tool and set the Platform to Steam (enter it manually if you don't have one) but scrape as Windows. + +![LaunchBox setup](https://i.imgur.com/qiRYihO.png) +![LaunchBox setup](https://i.imgur.com/wHjl9re.png) + +## Caveats +With PegasusWindowsLauncher, it currently waits for 10 seconds before it is able to recognise the game. For this reason, if you exit the game quickly (ie before 10 seconds after launching), or if the game takes longer than 10 seconds to start (say, it has to install Steam redists or it has a launcher) it won't exit gracefully. This is being worked on and will hopefully be solved in future versions. + +## Version history +v0.1 +- Initial release \ No newline at end of file