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 )
184193EndFunc ; ==>CreateProfileFolderIfEmpty
185194Func 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
191203Func CheckStateFile()
192204 Return FileExists (@ScriptDir & " \" & StringTrimRight (@ScriptName , 4 ) & " .state" )
193205EndFunc ; ==>CheckStateFile
@@ -201,8 +213,8 @@ Func WriteStateFile()
201213 FileWrite (@ScriptDir & " \" & StringTrimRight (@ScriptName , 4 ) & " .state" , $Profile )
202214EndFunc ; ==>WriteStateFile
203215Func 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 )
206218EndFunc ; ==>ShowProgressBar
207219Func RunLauncherIfNeeded()
208220 If FileExists (@ScriptDir & " \" & StringTrimRight (@ScriptName , 4 ) & " -launcher.cmd" ) Then
0 commit comments