Skip to content

Commit

Permalink
Intial release
Browse files Browse the repository at this point in the history
  • Loading branch information
PlayingKarrde committed Mar 31, 2021
1 parent 8556c85 commit f7b3ea3
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
images/
*.code-workspace
17 changes: 17 additions & 0 deletions ActivatePegasus.ahk
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions BlackScreen.ahk
Original file line number Diff line number Diff line change
@@ -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%
8 changes: 8 additions & 0 deletions GameEnd.ahk
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions GameStart.ahk
Original file line number Diff line number Diff line change
@@ -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
67 changes: 67 additions & 0 deletions PegasusWindowsLauncher.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other <[email protected]>
;
; 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
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f7b3ea3

Please sign in to comment.