Skip to content

Commit edf7070

Browse files
Concurrency Update
AltLauncher now allows you to run multiple instances, as long as you keep it to one per game. Useful for those with a powerful computer and multiple monitors
1 parent afae6b2 commit edf7070

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

AltLauncher.au3

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#AutoIt3Wrapper_Icon=Resources\AltLauncher.ico
33
#AutoIt3Wrapper_Outfile=Build\AltLauncher.exe
44
#AutoIt3Wrapper_UseX64=n
5-
#AutoIt3Wrapper_Res_Fileversion=0.2.0.7
5+
#AutoIt3Wrapper_Res_Fileversion=0.2.0.8
66
#AutoIt3Wrapper_Res_Language=1033
77
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
88
#include <Constants.au3>
@@ -83,7 +83,16 @@ Func ReadConfig()
8383
Case "--"
8484

8585
Case "--read"
86-
$Profile = FileRead($ProfilesPath & "\Selected Profile.txt")
86+
Local $filestate = False
87+
$hFile = FileOpen($ProfilesPath & "\Selected Profile.txt", 2)
88+
If $hFile = -1 Then ;hidden file check
89+
$attrib = FileGetAttrib(@ScriptDir & "\Selected Profile.txt")
90+
FileSetAttrib(@ScriptDir & "\Selected Profile.txt", "-H")
91+
$hFile = FileOpen(@ScriptDir & "\Selected Profile.txt", 2)
92+
EndIf
93+
FileRead($ProfilesPath & "\Selected Profile.txt")
94+
FileClose($hFile)
95+
If $filestate = True Then FileSetAttrib(@ScriptDir & "\Selected Profile.txt", "+" & $attrib)
8796
Case "--select"
8897
$Profile = ""
8998
Case Else
@@ -122,7 +131,7 @@ Func GuiInit()
122131

123132
Local $iWinW = ($iSpacing + $iBtnW + 1) * $iCols + $iSpacing + 2
124133
Local $iWinH = ($iSpacing + $iBtnH) * $iRows + $iSpacing + 30
125-
Local $hGUI = GUICreate("AltLauncher", $iWinW, $iWinH, -1, -1, $WS_SYSMENU)
134+
Local $hGUI = GUICreate($Title & " - Game: " & $Name, $iWinW, $iWinH, -1, -1, $WS_SYSMENU)
126135
GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseGUI")
127136
Local $iX = $iSpacing, $iY = $iSpacing
128137
For $i = 1 To $iTotal + 1
@@ -183,11 +192,14 @@ Func CreateProfileFolderIfEmpty()
183192
DirCreate($ProfilesPath & '\' & $Profile & '\' & $ProfilesSubPath & '\' & $Name)
184193
EndFunc ;==>CreateProfileFolderIfEmpty
185194
Func CheckIfAlreadyRunning()
186-
Do
187-
$ProcessList = ProcessList("AltLauncher.exe")
188-
Sleep(250)
189-
Until $ProcessList[0][0] < 2
190-
EndFunc ;==>CheckIfAlreadyRunning
195+
If _Singleton("AltLauncher_" & $Name, 1) = 0 Then ;already running
196+
If MsgBox($MB_ICONERROR + $MB_RETRYCANCEL, $Title & " - Game: " & $Name, "AltLauncher is already active for this game. Only one instance allowed per game.") = 4 Then
197+
CheckIfAlreadyRunning()
198+
Else
199+
Exit
200+
EndIf
201+
EndIf
202+
EndFunc ;==>CheckIfAlreadyRunningV2
191203
Func CheckStateFile()
192204
Return FileExists(@ScriptDir & "\" & StringTrimRight(@ScriptName, 4) & ".state")
193205
EndFunc ;==>CheckStateFile
@@ -201,8 +213,8 @@ Func WriteStateFile()
201213
FileWrite(@ScriptDir & "\" & StringTrimRight(@ScriptName, 4) & ".state", $Profile)
202214
EndFunc ;==>WriteStateFile
203215
Func ShowProgressBar()
204-
$Title &= " - Profile: "
205-
ProgressOn($Title & $Profile, "Loading...", "", -1, -1, $DLG_NOTONTOP + $DLG_MOVEABLE)
216+
$Title &= " - Profile: " & $Profile & " - Game: " & $Name
217+
ProgressOn($Title, "Loading...", "", -1, -1, $DLG_NOTONTOP + $DLG_MOVEABLE)
206218
EndFunc ;==>ShowProgressBar
207219
Func RunLauncherIfNeeded()
208220
If FileExists(@ScriptDir & "\" & StringTrimRight(@ScriptName, 4) & "-launcher.cmd") Then
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[General]
2+
Name=DRAGON QUEST XI S Echoes of an Elusive Age - Definitive Edition
3+
Path=C:\Program Files (x86)\Steam\steamapps\common\DRAGON QUEST XI S\Game\Binaries\Win64
4+
Executable=DRAGON QUEST XI S.exe
5+
LaunchFlags=
6+
7+
[Directories]
8+
=%UserProfile%\OneDrive\Documents\My Games\DRAGON QUEST XI S\Steam\%STEAMID3%\Saved\SaveGames\Book

0 commit comments

Comments
 (0)