Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
- rebuilt the launcher on UniGame Launcher v1.2.0
  • Loading branch information
alex47exe committed Jan 24, 2019
1 parent a45a8ac commit 6adc6d3
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 67 deletions.
2 changes: 1 addition & 1 deletion ProgramData.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ___ UniGame Launcher v1.1.0 © 2017-2018, SalFisher47
# ___ UniGame Launcher v1.2.0 © 2017-2018, SalFisher47


[launcher]
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Prince of Persia: The Two Thrones ~ Widescreen Launcher v2

This *PoP T2T* launcher is based on **[UniGame Launcher v1.1.0](https://github.com/alex47exe/UniGame-Launcher/releases/tag/v1.1.0)** and **nemesis2000**'s **widescreen fix** at [http://ps2wide.net](http://ps2wide.net/pc.html#poptt), already included
This *PoP T2T* launcher is based on **[UniGame Launcher v1.2.0](https://github.com/alex47exe/UniGame-Launcher/releases/tag/v1.2.0)** and **nemesis2000**'s **widescreen fix** at [http://ps2wide.net](http://ps2wide.net/pc.html#poptt), already included

------

Expand Down
168 changes: 115 additions & 53 deletions _Prince of Persia The Two Thrones.au3
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UPX_Parameters=-9 --strip-relocs=0 --compress-exports=0 --compress-icons=0
#AutoIt3Wrapper_Res_Description=UniGame Launcher
#AutoIt3Wrapper_Res_Fileversion=1.1.0.47
#AutoIt3Wrapper_Res_ProductVersion=1.1.0.47
#AutoIt3Wrapper_Res_LegalCopyright=2017-2018, SalFisher47
#AutoIt3Wrapper_Res_Fileversion=1.2.0.47
#AutoIt3Wrapper_Res_ProductVersion=1.2.0.47
#AutoIt3Wrapper_Res_LegalCopyright=2017-2019, SalFisher47
#AutoIt3Wrapper_Res_SaveSource=n
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Expand All @@ -20,22 +20,22 @@
#pragma compile(InputBoxRes, true)
#pragma compile(CompanyName, 'SalFisher47')
#pragma compile(FileDescription, 'UniGame Launcher')
#pragma compile(FileVersion, 1.1.0.47)
#pragma compile(FileVersion, 1.2.0.47)
#pragma compile(InternalName, 'UniGame Launcher')
#pragma compile(LegalCopyright, '2017-2018, SalFisher47')
#pragma compile(LegalCopyright, '2017-2019, SalFisher47')
#pragma compile(OriginalFilename, UniGame_Launcher.exe)
#pragma compile(ProductName, 'UniGame Launcher')
#pragma compile(ProductVersion, 1.1.0.47)
#pragma compile(ProductVersion, 1.2.0.47)
#EndRegion ;**** Pragma Compile ****

; === UniGame Launcher.au3 =========================================================================================================
; === UniGame_Launcher_one.au3 =====================================================================================================
; Title .........: UniGame Launcher
; Version .......: 1.1.0.47
; Version .......: 1.2.0.47
; AutoIt Version : 3.3.14.5
; Language ......: English
; Description ...: Universal Game Launcher
; Description ...: Universal Game Launcher one
; Author(s) .....: SalFisher47
; Last Modified .: November 18, 2018 - last compiled on January 8 2019
; Last Modified .: January 23, 2019 - last compiled on January 23 2019
; ==================================================================================================================================

Global $Env_RoamingAppData = @AppDataDir, _
Expand All @@ -46,6 +46,11 @@ Global $Env_RoamingAppData = @AppDataDir, _
If @error Then $Env_SavedGames = $Env_UserProfile & "\Saved Games"

$Ini = @ScriptDir & "\" & StringTrimRight(@ScriptName, 4) & ".ini"
$ini_RunAdmin = IniRead($ini, "launcher", "run_admin", "")

; check for game path and add it to ini file in C:\ProgramData\SalFisher47\UniGame Launcher
If Not FileExists(@AppDataCommonDir & "\SalFisher47\UniGame Launcher") Then DirCreate(@AppDataCommonDir & "\SalFisher47\UniGame Launcher")
FileInstall("ProgramData.ini", @AppDataCommonDir & "\SalFisher47\UniGame Launcher\" & StringTrimRight(@ScriptName, 4) & ".ini", 0)

$exe_run = IniRead($Ini, "Exe", "exe_run", "")
$exe_path_full = @ScriptDir & "\" & $exe_run
Expand All @@ -54,20 +59,18 @@ $exe_path_only = StringTrimRight($exe_path_full, StringLen($exe_only)+1)
$exe_cmd = IniRead($Ini, "Exe", "exe_cmd", "")
$exe_compat = IniRead($Ini, "Exe", "exe_compat", "")

$exe_run_alt = IniRead($Ini, "Exe", "exe_run_alt", "")
$exe_path_full_alt = @ScriptDir & "\" & $exe_run_alt
$exe_only_alt = StringTrimLeft($exe_path_full_alt, StringInStr($exe_path_full_alt, "\", 0, -1))
$exe_path_only_alt = StringTrimRight($exe_path_full_alt, StringLen($exe_only_alt)+1)
$exe_cmd_alt = IniRead($Ini, "Exe", "exe_cmd_alt", "")
$exe_compat_alt = IniRead($Ini, "Exe", "exe_compat_alt", "")

$run_first = IniRead($Ini, "Exe", "run_first", 0)
If Not FileExists(@AppDataCommonDir & "\SalFisher47\RunFirst") Then DirCreate(@AppDataCommonDir & "\SalFisher47\RunFirst")
FileInstall("RunFirst\RunFirst.exe", @AppDataCommonDir & "\SalFisher47\RunFirst\RunFirst.exe", 0)
FileInstall("RunFirst\RunFirst.txt", @AppDataCommonDir & "\SalFisher47\RunFirst\RunFirst.txt", 0)

; check for game path and add it to ini file in C:\ProgramData\SalFisher47\UniGame Launcher
If Not FileExists(@AppDataCommonDir & "\SalFisher47\UniGame Launcher") Then DirCreate(@AppDataCommonDir & "\SalFisher47\UniGame Launcher")
FileInstall("ProgramData.ini", @AppDataCommonDir & "\SalFisher47\UniGame Launcher\" & StringTrimRight(@ScriptName, 4) & ".ini", 0)
$first_launch = 1
If IniRead(@AppDataCommonDir & "\SalFisher47\UniGame Launcher\" & StringTrimRight(@ScriptName, 4) & ".ini", "launcher", "game_path", "") <> @ScriptDir Then
$first_launch = 0
IniWrite(@AppDataCommonDir & "\SalFisher47\UniGame Launcher\" & StringTrimRight(@ScriptName, 4) & ".ini", "launcher", "game_path", " " & @ScriptDir)
EndIf

; check for savegame path and add it to ini file in C:\ProgramData\SalFisher47\UniGame Launcher
$ini_Savegame_dir = IniRead($ini, "savegame", "savegame_dir", "")
$ini_Savegame_subdir = IniRead($ini, "savegame", "savegame_subdir", "")
Expand All @@ -90,16 +93,47 @@ Switch $ini_Savegame_dir
Case "GameDir"
$Savegame_dir = @ScriptDir & "\" & $ini_Savegame_subdir
EndSwitch
If $Savegame_dir <> "" Then

If IniRead(@AppDataCommonDir & "\SalFisher47\UniGame Launcher\" & StringTrimRight(@ScriptName, 4) & ".ini", "launcher", "game_path", "") <> @ScriptDir Then
$first_launch = 1
IniWrite(@AppDataCommonDir & "\SalFisher47\UniGame Launcher\" & StringTrimRight(@ScriptName, 4) & ".ini", "launcher", "game_path", " " & @ScriptDir)
If IniRead(@AppDataCommonDir & "\SalFisher47\UniGame Launcher\" & StringTrimRight(@ScriptName, 4) & ".ini", "launcher", "savegame_path", "") <> $Savegame_dir Then
;$first_launch = 0
IniWrite(@AppDataCommonDir & "\SalFisher47\UniGame Launcher\" & StringTrimRight(@ScriptName, 4) & ".ini", "launcher", "savegame_path", " " & $Savegame_dir)
EndIf
If $ini_RunAdmin == 1 Then
_RunAdmin()
Exit
Else
_RunMain()
Exit
EndIf
Else
If IsAdmin() Then
$first_launch = 1
If IniRead(@AppDataCommonDir & "\SalFisher47\UniGame Launcher\" & StringTrimRight(@ScriptName, 4) & ".ini", "launcher", "savegame_path", "") <> $Savegame_dir Then
IniWrite(@AppDataCommonDir & "\SalFisher47\UniGame Launcher\" & StringTrimRight(@ScriptName, 4) & ".ini", "launcher", "savegame_path", " " & $Savegame_dir)
EndIf
_RunMain()
Exit
Else
$first_launch = 0
If IniRead(@AppDataCommonDir & "\SalFisher47\UniGame Launcher\" & StringTrimRight(@ScriptName, 4) & ".ini", "launcher", "savegame_path", "") <> $Savegame_dir Then
IniWrite(@AppDataCommonDir & "\SalFisher47\UniGame Launcher\" & StringTrimRight(@ScriptName, 4) & ".ini", "launcher", "savegame_path", " " & $Savegame_dir)
EndIf
_RunMain()
Exit
EndIf
EndIf

$HUD_Fix_CanStretchRect = IniRead($ini, "game", "CanStretchRect", 0)
$Fog_Fix_ForceVSFog = IniRead($ini, "game", "ForceVSFog", 1)
$Fog_Fix_InvertFogRange = IniRead($ini, "game", "InvertFogRange", 0)
$desktopRatio = Round(@DesktopWidth/@DesktopHeight, 2)

_RunMain()

Func _RunBefore_EveryLaunch()

$HUD_Fix_CanStretchRect = IniRead($ini, "fix", "CanStretchRect", 0)
$Fog_Fix_ForceVSFog = IniRead($ini, "fix", "ForceVSFog", 1)
$Fog_Fix_InvertFogRange = IniRead($ini, "fix", "InvertFogRange", 0)

$Ini2 = @ScriptDir & "\pop3.ini"

Expand Down Expand Up @@ -140,50 +174,78 @@ If RegRead("HKLM\SOFTWARE\UBISOFT\Prince of Persia The Two Thrones\1.00.999", "P
RegWrite("HKLM\SOFTWARE\UBISOFT\Prince of Persia The Two Thrones\1.00.999", "Profiles_Path", "REG_SZ", @ScriptDir)
EndIf

If $first_launch == 1 Then
_RunUser()
Else
_RunAdmin()
EndFunc

Func _RunBefore_FirstLaunch()

FileInstall("Hardware.ini", @ScriptDir & "\Hardware.ini", 1)
FileMove(@ScriptDir & "\POP3.exe", @ScriptDir & "\POP3_.exe", 0)
FileMove(@ScriptDir & "\blank.exe", @ScriptDir & "\POP3.exe", 0)
ShellExecuteWait($exe_only, " " & $exe_cmd & " " & $CmdLineRaw, $exe_path_only)
If IniRead(@ScriptDir & "\Hardware.ini", "CAPS", "CanStretchRect", "") <> $HUD_Fix_CanStretchRect Then IniWrite(@ScriptDir & "\Hardware.ini", "CAPS", "CanStretchRect", $HUD_Fix_CanStretchRect)
If IniRead(@ScriptDir & "\Hardware.ini", "CAPS", "ForceVSFog", "") <> $Fog_Fix_ForceVSFog Then IniWrite(@ScriptDir & "\Hardware.ini", "CAPS", "ForceVSFog", $Fog_Fix_ForceVSFog)
If IniRead(@ScriptDir & "\Hardware.ini", "CAPS", "InvertFogRange", "") <> $Fog_Fix_InvertFogRange Then IniWrite(@ScriptDir & "\Hardware.ini", "CAPS", "InvertFogRange", $Fog_Fix_InvertFogRange)
FileMove(@ScriptDir & "\POP3.exe", @ScriptDir & "\blank.exe", 1)
FileMove(@ScriptDir & "\POP3_.exe", @ScriptDir & "\POP3.exe", 1)

EndIf

Func _RunUser() ; main script
If RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", $exe_path_full) <> $exe_compat Then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", $exe_path_full, "REG_SZ", $exe_compat)
EndIf
Func _RunMain() ; main script
RegRead('HKCU\Software\Valve\Steam', 'SteamPath')
If @error Then
RegWrite('HKCU\Software\Valve\Steam', 'SteamExe','REG_SZ','d:/steam/steam.exe')
RegWrite('HKCU\Software\Valve\Steam', 'SteamPath','REG_SZ','d:/steam')
RegWrite('HKLM\SOFTWARE\Valve\Steam', 'InstallPath','REG_SZ','D:\Steam')
EndIf
If RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", $exe_path_full) <> $exe_compat Then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", $exe_path_full, "REG_SZ", $exe_compat)
EndIf
If $Savegame_dir <> "" Then
If Not FileExists($Savegame_dir) Then DirCreate($Savegame_dir)
FileCreateShortcut($Savegame_dir, @ScriptDir & "\_savegame.lnk")
EndIf
If $first_launch == 1 Then
; add commands here to run before game exe at first launch
_RunBefore_EveryLaunch()
_RunBefore_FirstLaunch()
;---
If $run_first == 1 Then
If $Savegame_dir <> "" Then
If Not FileExists($Savegame_dir) Then DirCreate($Savegame_dir)
FileCreateShortcut($Savegame_dir, @ScriptDir & "\_savegame.lnk")
If $exe_run_alt <> "" Then
ShellExecute(@AppDataCommonDir & "\SalFisher47\RunFirst\RunFirst.exe", '"' & $exe_path_full_alt & '"' & " " & $exe_cmd_alt & " " & $CmdLineRaw, $exe_path_only_alt, "", @SW_HIDE)
Else
ShellExecute(@AppDataCommonDir & "\SalFisher47\RunFirst\RunFirst.exe", '"' & $exe_path_full & '"' & " " & $exe_cmd & " " & $CmdLineRaw, $exe_path_only, "", @SW_HIDE)
EndIf
ShellExecute(@AppDataCommonDir & "\SalFisher47\RunFirst\RunFirst.exe", '"' & $exe_path_full & '"' & " " & $exe_cmd & " " & $CmdLineRaw, $exe_path_only, "", @SW_HIDE)
Else
If $Savegame_dir <> "" Then
If Not FileExists($Savegame_dir) Then DirCreate($Savegame_dir)
FileCreateShortcut($Savegame_dir, @ScriptDir & "\_savegame.lnk")
If $exe_run_alt <> "" Then
ShellExecute($exe_only_alt, " " & $exe_cmd_alt & " " & $CmdLineRaw, $exe_path_only_alt)
Else
ShellExecute($exe_only, " " & $exe_cmd & " " & $CmdLineRaw, $exe_path_only)
EndIf
EndIf
; add commands here to run after game exe at first launch
Else
; add commands here to run before game exe at every launch, except the first one
If FileExists(@ScriptDir & "\Hardware.ini") Then
_RunBefore_EveryLaunch()
Else
_RunBefore_EveryLaunch()
_RunBefore_FirstLaunch()
EndIf
;---
If $run_first == 1 Then
ShellExecute(@AppDataCommonDir & "\SalFisher47\RunFirst\RunFirst.exe", '"' & $exe_path_full & '"' & " " & $exe_cmd & " " & $CmdLineRaw, $exe_path_only, "", @SW_HIDE)
Else
ShellExecute($exe_only, " " & $exe_cmd & " " & $CmdLineRaw, $exe_path_only)
EndIf
; add commands here to run after game exe at every launch, except the first one
EndIf
EndFunc

Func _RunAdmin() ; run main script as admin on first launch
If RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", @ScriptDir & "\" & StringTrimRight(@ScriptName, 4) & ".exe") <> "RUNASADMIN" Then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", @ScriptDir & "\" & StringTrimRight(@ScriptName, 4) & ".exe", "REG_SZ", "RUNASADMIN")
EndIf
;---
If $Savegame_dir <> "" Then
If Not FileExists($Savegame_dir) Then DirCreate($Savegame_dir)
FileCreateShortcut($Savegame_dir, @ScriptDir & "\_savegame.lnk")
EndIf
FileInstall("Hardware.ini", @ScriptDir & "\Hardware.ini", 1)
IniWrite(@AppDataCommonDir & "\SalFisher47\UniGame Launcher\PoP3\PoP3.ini", "EXE", "patched", " 1")
FileMove(@ScriptDir & "\POP3.exe", @ScriptDir & "\POP3_.exe", 0)
FileMove(@ScriptDir & "\blank.exe", @ScriptDir & "\POP3.exe", 0)
ShellExecuteWait($exe_only, " " & $exe_cmd & " " & $CmdLineRaw, $exe_path_only)
If IniRead(@ScriptDir & "\Hardware.ini", "CAPS", "CanStretchRect", "") <> $HUD_Fix_CanStretchRect Then IniWrite(@ScriptDir & "\Hardware.ini", "CAPS", "CanStretchRect", $HUD_Fix_CanStretchRect)
If IniRead(@ScriptDir & "\Hardware.ini", "CAPS", "ForceVSFog", "") <> $Fog_Fix_ForceVSFog Then IniWrite(@ScriptDir & "\Hardware.ini", "CAPS", "ForceVSFog", $Fog_Fix_ForceVSFog)
If IniRead(@ScriptDir & "\Hardware.ini", "CAPS", "InvertFogRange", "") <> $Fog_Fix_InvertFogRange Then IniWrite(@ScriptDir & "\Hardware.ini", "CAPS", "InvertFogRange", $Fog_Fix_InvertFogRange)
FileMove(@ScriptDir & "\POP3.exe", @ScriptDir & "\blank.exe", 1)
FileMove(@ScriptDir & "\POP3_.exe", @ScriptDir & "\POP3.exe", 1)
ShellExecute(StringTrimRight(@ScriptName, 4) & ".exe", $CmdLineRaw, @ScriptDir)
;---
If RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers", @ScriptDir & "\" & StringTrimRight(@ScriptName, 4) & ".exe") == "RUNASADMIN" Then
Expand Down
Binary file modified _Prince of Persia The Two Thrones.exe
Binary file not shown.
40 changes: 28 additions & 12 deletions _Prince of Persia The Two Thrones.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# ___ UniGame Launcher v1.1.0 © 2017-2018, SalFisher47
# - customized for 'Prince of Persia: The Two Thrones'
# ___ UniGame Launcher v1.2.0 © 2017-2019, SalFisher47


[exe]
Expand All @@ -11,6 +10,13 @@ exe_run = PrinceOfPersia.exe
exe_cmd =
exe_compat =

# ___ Executable to run only at first launch, command-line parameters & compatibility settings
# Use it only if you need to run the game through a different executable (e.g. settings launcher) at first launch, ...
# ... or same as above, but with different command-line parameters & compatibility settings
exe_run_alt =
exe_cmd_alt =
exe_compat_alt =

# ___ If 1, runs the game on the first cpu core, through RunFirst.exe
# To be used only on some older games that don't run properly on multi-core cpus
run_first = 1
Expand All @@ -21,19 +27,10 @@ desktop_width = 0
desktop_height = 0


[game]

# ___ HUD fix
CanStretchRect = 0

# ___ Fog fix
ForceVSFog = 1
InvertFogRange = 0


[savegame]

# ___ Savegame folder & subfolder
# If specified, _savegame.lnk will be created
# MyDocs ...for C:\Users\username\Documents
# PublicDocs ...for C:\Users\Public\Documents
# LocalAppData ...for C:\Users\username\AppData\Local
Expand All @@ -46,5 +43,24 @@ savegame_dir = GameDir
savegame_subdir = POP3Profiles


[launcher]

# ___ If 1, runs this launcher as administrator at first launch
# Running from another PC, username or game folder, will do the same
run_admin = 1


[fix]

# ___ HUD fix
CanStretchRect = 0

# ___ Fog fix
ForceVSFog = 1
InvertFogRange = 0






0 comments on commit 6adc6d3

Please sign in to comment.