diff --git a/source/Launcher/Enderal Launcher.au3 b/source/Launcher/Enderal Launcher.au3 index 821028b7e..c26b7a4fd 100644 --- a/source/Launcher/Enderal Launcher.au3 +++ b/source/Launcher/Enderal Launcher.au3 @@ -250,6 +250,18 @@ Func WriteCheckboxWithCustom($ctrl, $section, $key, $checkedVal = "1", $unchecke EndIf EndFunc +; ============================================ +; DPI Awareness Functions +; ============================================ +Func SetDPIAwareness() + ; Set DPI awareness for SkyrimSE.exe to prevent Windows scaling issues + Local $exePath = $LAUNCHER_DIR & "\SkyrimSE.exe" + If Not FileExists($exePath) Then Return + + Local $regKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" + RegWrite($regKey, $exePath, "REG_SZ", "~ HIGHDPIAWARE") +EndFunc + ; ============================================ ; Version Detection Functions ; ============================================ @@ -314,12 +326,167 @@ Func GetEnderalVersion() Return "" EndFunc +; ============================================ +; Update Function +; ============================================ +Func CheckAndApplyUpdate() + ; Check if update is needed: SkyrimSE.exe is not 1.6.659 AND skse64_1_6_659.dll exists + Local $skyrimVersion = GetSkyrimVersion() + Local $oldSkseDll = $LAUNCHER_DIR & "\skse64_1_6_659.dll" + + If $skyrimVersion <> "1.6.659" And FileExists($oldSkseDll) Then + ; Files to delete unconditionally + Local $filesToDelete[] = [ _ + "skse64_1_6_659.dll", _ + "tbb.dll", _ + "tbbmalloc.dll", _ + "enderal readme.txt", _ + "Skyrim_Default.ini", _ + "Data\Skyrim - Patch.bsa", _ + "Data\Enderal SE v2.0.12.4 Changelog.txt", _ + "Data\SKSE\Plugins\JContainers64.dll", _ + "Data\SKSE\Plugins\YesImSure.json", _ + "Data\meshes\actors\character\character assets\skeleton.xml", _ + "Data\meshes\actors\character\character assets female\skeleton_female.xml", _ + "Data\SkyUI_SE.ini" _ + ] + + ; Files to delete only if size matches [path, size] + Local $filesToDeleteWithSize[][2] = [ _ + ["Data\Interface\controls\pc\controlmap.txt", 8492], _ + ["Data\Interface\exported\widgets\skyui\followerpanel.swf", 15541], _ + ["Data\Interface\dialoguemenu.swf", 24622], _ + ["Data\Interface\fonts_en2.swf", 33021], _ + ["Data\Interface\hudmenu.swf", 372484], _ + ["Data\Interface\startmenu.swf", 66683], _ + ["Data\Interface\fontconfig.txt", 1211], _ + ["Data\Scripts\ActiveMagicEffect.pex", 7497], _ + ["Data\Scripts\Actor.pex", 14869], _ + ["Data\Scripts\ActorBase.pex", 2643], _ + ["Data\Scripts\ActorValueInfo.pex", 1791], _ + ["Data\Scripts\Alias.pex", 3949], _ + ["Data\Scripts\Ammo.pex", 549], _ + ["Data\Scripts\Apparatus.pex", 522], _ + ["Data\Scripts\Armor.pex", 4983], _ + ["Data\Scripts\ArmorAddon.pex", 1169], _ + ["Data\Scripts\Art.pex", 500], _ + ["Data\Scripts\Book.pex", 574], _ + ["Data\Scripts\Camera.pex", 1171], _ + ["Data\Scripts\Cell.pex", 1264], _ + ["Data\Scripts\ColorComponent.pex", 1206], _ + ["Data\Scripts\ColorForm.pex", 1124], _ + ["Data\Scripts\CombatStyle.pex", 3260], _ + ["Data\Scripts\ConstructibleObject.pex", 1047], _ + ["Data\Scripts\DefaultObjectManager.pex", 540], _ + ["Data\Scripts\Enchantment.pex", 1149], _ + ["Data\Scripts\EquipSlot.pex", 515], _ + ["Data\Scripts\Faction.pex", 3819], _ + ["Data\Scripts\Flora.pex", 651], _ + ["Data\Scripts\Form.pex", 5057], _ + ["Data\Scripts\FormList.pex", 813], _ + ["Data\Scripts\FormType.pex", 7963], _ + ["Data\Scripts\GameData.pex", 1898], _ + ["Data\Scripts\HeadPart.pex", 1274], _ + ["Data\Scripts\Ingredient.pex", 1369], _ + ["Data\Scripts\Input.pex", 968], _ + ["Data\Scripts\JArray.pex", 3575], _ + ["Data\Scripts\JAtomic.pex", 1973], _ + ["Data\Scripts\JContainers.pex", 1184], _ + ["Data\Scripts\JContainers_DomainExample.pex", 14101], _ + ["Data\Scripts\JDB.pex", 1373], _ + ["Data\Scripts\JFormDB.pex", 1933], _ + ["Data\Scripts\JFormMap.pex", 1675], _ + ["Data\Scripts\JIntMap.pex", 1672], _ + ["Data\Scripts\JLua.pex", 1162], _ + ["Data\Scripts\JMap.pex", 1669], _ + ["Data\Scripts\JString.pex", 944], _ + ["Data\Scripts\JValue.pex", 2589], _ + ["Data\Scripts\Keyword.pex", 714], _ + ["Data\Scripts\LeveledActor.pex", 805], _ + ["Data\Scripts\LeveledItem.pex", 1022], _ + ["Data\Scripts\LeveledSpell.pex", 802], _ + ["Data\Scripts\Location.pex", 1744], _ + ["Data\Scripts\MagicEffect.pex", 2501], _ + ["Data\Scripts\Math.pex", 1436], _ + ["Data\Scripts\ModEvent.pex", 952], _ + ["Data\Scripts\NetImmerse.pex", 2929], _ + ["Data\Scripts\ObjectReference.pex", 16307], _ + ["Data\Scripts\Outfit.pex", 505], _ + ["Data\Scripts\Perk.pex", 1431], _ + ["Data\Scripts\Potion.pex", 1298], _ + ["Data\Scripts\Quest.pex", 5314], _ + ["Data\Scripts\Race.pex", 6618], _ + ["Data\Scripts\Scroll.pex", 1387], _ + ["Data\Scripts\Shout.pex", 766], _ + ["Data\Scripts\SKSE.pex", 845], _ + ["Data\Scripts\SoulGem.pex", 506], _ + ["Data\Scripts\Sound.pex", 723], _ + ["Data\Scripts\SoundDescriptor.pex", 900], _ + ["Data\Scripts\SpawnerTask.pex", 907], _ + ["Data\Scripts\Spell.pex", 1673], _ + ["Data\Scripts\StringUtil.pex", 1100], _ + ["Data\Scripts\TextureSet.pex", 593], _ + ["Data\Scripts\TreeObject.pex", 650], _ + ["Data\Scripts\UI.pex", 2070], _ + ["Data\Scripts\UICallback.pex", 1139], _ + ["Data\Scripts\Utility.pex", 2658], _ + ["Data\Scripts\Weapon.pex", 3259], _ + ["Data\Scripts\Weather.pex", 1107], _ + ["Data\Scripts\WornObject.pex", 1629] _ + ] + + ; Delete unconditional files + For $i = 0 To UBound($filesToDelete) - 1 + Local $fullPath = $LAUNCHER_DIR & "\" & $filesToDelete[$i] + If FileExists($fullPath) Then + FileDelete($fullPath) + EndIf + Next + + ; Delete files only if size matches + For $i = 0 To UBound($filesToDeleteWithSize) - 1 + Local $fullPath = $LAUNCHER_DIR & "\" & $filesToDeleteWithSize[$i][0] + If FileExists($fullPath) Then + Local $fileSize = FileGetSize($fullPath) + If $fileSize = $filesToDeleteWithSize[$i][1] Then + FileDelete($fullPath) + EndIf + EndIf + Next + + ; Delete directories + Local $dirsToDelete[] = [ _ + "Data\SKSE\Plugins\JCData", _ + "Skyrim" _ + ] + + For $i = 0 To UBound($dirsToDelete) - 1 + Local $fullPath = $LAUNCHER_DIR & "\" & $dirsToDelete[$i] + If FileExists($fullPath) Then + DirRemove($fullPath, 1) + EndIf + Next + + ; Set borderless windowed mode in EnderalPrefs.ini if it exists + Local $prefsPath = GetDocumentsPath() & "\My Games\" & GetEnderalBaseDirectoryName() & "\EnderalPrefs.ini" + If FileExists($prefsPath) Then + IniWrite($prefsPath, "Display", "bBorderless", "1") + IniWrite($prefsPath, "Display", "bFull Screen", "0") + EndIf + + MsgBox(64, "Update", "Enderal SE has been successfully updated.") + EndIf +EndFunc + ; ============================================ ; Main Entry Point ; ============================================ Main() Func Main() + ; Check and apply update if needed + CheckAndApplyUpdate() + ; Check if SkyrimRedirector is installed Local $redirectorDll = $LAUNCHER_DIR & "\Data\SKSE\Plugins\SkyrimRedirector.dll" Local $redirectorIni = $LAUNCHER_DIR & "\Data\SKSE\Plugins\SkyrimRedirector.ini" @@ -671,27 +838,27 @@ Func CreateMainWindow() GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetCursor(-1, 0) - ; Support - shadow first, then main label - $lblSupportShadow = GUICtrlCreateLabel("Support", $startX + $linkSpacing * 2 + 1, $linkBarY + 1, 70, 25, $SS_CENTER) + ; Discord - shadow first, then main label + $lblSupportShadow = GUICtrlCreateLabel("Discord", $startX + $linkSpacing * 2 + 1, $linkBarY + 1, 70, 25, $SS_CENTER) GUICtrlSetFont(-1, 10, 400, 4) GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetCursor(-1, 0) - $lblSupport = GUICtrlCreateLabel("Support", $startX + $linkSpacing * 2, $linkBarY, 70, 25, $SS_CENTER) + $lblSupport = GUICtrlCreateLabel("Discord", $startX + $linkSpacing * 2, $linkBarY, 70, 25, $SS_CENTER) GUICtrlSetFont(-1, 10, 400, 4) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetCursor(-1, 0) ; Changelog - shadow first, then main label - $lblChangelogShadow = GUICtrlCreateLabel("Changelog", $startX + $linkSpacing * 3 + 15 + 1, $linkBarY + 1, 100, 25, $SS_CENTER) + $lblChangelogShadow = GUICtrlCreateLabel("Changelog", $startX + $linkSpacing * 3 + 9 + 1, $linkBarY + 1, 100, 25, $SS_CENTER) GUICtrlSetFont(-1, 10, 400, 4) GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetCursor(-1, 0) - $lblChangelog = GUICtrlCreateLabel("Changelog", $startX + $linkSpacing * 3 + 15, $linkBarY, 100, 25, $SS_CENTER) + $lblChangelog = GUICtrlCreateLabel("Changelog", $startX + $linkSpacing * 3 + 9, $linkBarY, 100, 25, $SS_CENTER) GUICtrlSetFont(-1, 10, 400, 4) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) @@ -1101,7 +1268,7 @@ Func MainLoop() ShellExecute("https://wiki.en.sureai.net/Enderal") Case $lblSupport, $lblSupportShadow - ShellExecute("https://mod.pub/enderal-se/38/comments") + ShellExecute("https://go.eddoursul.win/enderal-se-launcher-support") Case $lblChangelog, $lblChangelogShadow ShellExecute("https://mod.pub/enderal-se/38/changelogs") @@ -1418,24 +1585,21 @@ Func LaunchGame() GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUISetState(@SW_SHOW, $hLaunchingGUI) + ; Set DPI awareness for SkyrimSE.exe + SetDPIAwareness() + ; Launch SKSE Run($LAUNCHER_DIR & "\skse64_loader.exe", $LAUNCHER_DIR) - ; Wait for SkyrimSE.exe to gain focus - Local $hSkyrimWnd = 0 + ; Wait for SkyrimSE.exe window to appear (GOG or Steam version) While 1 - ; Check if SkyrimSE.exe window exists and has focus - $hSkyrimWnd = WinGetHandle("[CLASS:Skyrim Special Edition]") - If $hSkyrimWnd Then - ; SkyrimSE window exists, check if it has focus - If WinActive($hSkyrimWnd) Then - ExitLoop - EndIf + If WinExists("[CLASS:Skyrim Special Edition GOG]") Or WinExists("[CLASS:Skyrim Special Edition]") Then + ExitLoop EndIf ; Also check if the process is no longer running (user closed it quickly) If Not ProcessExists("SkyrimSE.exe") And Not ProcessExists("skse64_loader.exe") Then - ; Process ended before gaining focus, close modal and restore buttons + ; Process ended before window appeared, close modal and restore buttons GUIDelete($hLaunchingGUI) GUICtrlSetState($btnPlay, $GUI_SHOW) GUICtrlSetState($btnSettings, $GUI_SHOW) @@ -1446,7 +1610,7 @@ Func LaunchGame() Sleep(100) WEnd - ; SkyrimSE.exe has focus, exit launcher + ; SkyrimSE.exe window exists, exit launcher Exit EndFunc diff --git a/source/Launcher/Enderal_default.ini b/source/Launcher/Enderal_default.ini index b170de750..c65f94d3d 100644 --- a/source/Launcher/Enderal_default.ini +++ b/source/Launcher/Enderal_default.ini @@ -59,21 +59,26 @@ bUseWaterDepth=1 bUseWaterDisplacements=1 bUseWaterReflections=1 bUseWaterRefractions=1 + [MapMenu] -uLockedObjectMapLOD = 32 -uLockedTerrainLOD = 32 -sWorldMapOverlayNormalSnowTexture = -sWorldMapOverlayNormalTexture = -sMapCloudNIF = 0 -fWorldMapDepthBlurScale = 0.0000 -fMapWorldMaxPanSpeed = 80000.0000 -fMapWorldCursorMoveArea = 0.4000 -fMapWorldYawRange = 20.0000 -fMapWorldMinPitch = 90.0000 -fMapWorldMaxPitch = 90.0000 -sMapWorldDefaultWorldSpace = Vyn +; Paper map settings +uLockedObjectMapLOD=32 +uLockedTerrainLOD=32 +sWorldMapOverlayNormalSnowTexture= +sWorldMapOverlayNormalTexture= +sMapCloudNIF=0 +fWorldMapDepthBlurScale=0.0000 +fMapWorldMaxPanSpeed=80000.0000 +fMapWorldCursorMoveArea=0.4000 +fMapWorldYawRange=20.0000 +fMapWorldMinPitch=90.0000 +fMapWorldMaxPitch=90.0000 +sMapWorldDefaultWorldSpace=Vyn +fMapTransitionSpeed=0.4 + [SaveGame] iAutoSaveCount=5 + [Interface] fBookDistance=75.0000 fNoteDistance=70.0000