From d0c8acdb8d4fdcb09304e476216cb1970d043ab4 Mon Sep 17 00:00:00 2001 From: Maddie <52103563+maddie480@users.noreply.github.com> Date: Wed, 12 Feb 2025 22:02:50 +0100 Subject: [PATCH] Ship unaltered love2d on Windows instead of following the release procedure I am trying to make the cursed-olympus.zip floating around on the Celeste Discord official now --- .github/workflows/accent-issue-test.yml | 2 +- azure-pipelines.yml | 32 ++----------------------- changelog.txt | 2 +- launcher-winforms/Program.cs | 14 +++-------- sharp/CmdRestart.cs | 4 ++++ sharp/CmdWin32AppUninstall.cs | 2 +- sharp/CmdWin32CreateShortcuts.cs | 6 +++-- src/modinstaller.lua | 25 +++++++++++-------- src/registry.lua | 2 +- 9 files changed, 32 insertions(+), 57 deletions(-) diff --git a/.github/workflows/accent-issue-test.yml b/.github/workflows/accent-issue-test.yml index 4396643..51d958c 100644 --- a/.github/workflows/accent-issue-test.yml +++ b/.github/workflows/accent-issue-test.yml @@ -16,7 +16,7 @@ jobs: Invoke-WebRequest -Uri 'https://maddie480.ovh/celeste/download-olympus?branch=main&platform=windows' -OutFile temp.zip Expand-Archive -Path temp.zip -DestinationPath . Expand-Archive -Path windows.main\dist.zip -DestinationPath olympus-install - Remove-Item -Path temp.zip,windows.main,olympus-install\main.exe -Force -Recurse + Remove-Item -Path temp.zip,windows.main -Force -Recurse - name: Install love2d run: | diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8eb6882..94f1017 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,7 +15,6 @@ strategy: loveAppImage: '' loveBinaryDirectory: '' loveResourcesDirectory: '' - loveBinary: 'love.exe' macos: jobArchName: 'macOS' imageName: 'macOS-latest' @@ -207,7 +206,7 @@ steps: Invoke-WebRequest -Uri $env:LOVELUAURL -OutFile lovelua.zip Expand-Archive -Path lovelua.zip -DestinationPath lovelua Copy-Item -Path lovelua/love-11.3-win32/lua51.dll -Destination love-raw/love-11.5-win32/lua51.dll -Force -# Copy cached unpacked LÖVE, fix it up if needed +# Copy cached unpacked LÖVE - task: PowerShell@2 condition: and(succeeded(), ne(variables.loveURL, '')) displayName: 'Dist: Copy and fix cached LÖVE' @@ -220,17 +219,6 @@ steps: Move-Item -Path love/love-11.5-win32 -Destination love-win Remove-Item -Path love -Force -Recurse Move-Item -Path love-win -Destination love - Invoke-WebRequest -Uri "https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe" -OutFile rcedit.exe - ./rcedit.exe love/love.exe ` - --set-icon icon.ico ` - --set-version-string Comments $env:BUILD_SOURCEVERSION ` - --set-version-string CompanyName "Everest Team" ` - --set-version-string FileDescription Olympus ` - --set-version-string FileVersion $env:BUILD_BUILDNUMBER ` - --set-version-string LegalCopyright "See https://github.com/EverestAPI/Olympus/blob/main/LICENSE" ` - --set-version-string OriginalFilename main.exe ` - --set-version-string ProductName Olympus ` - --set-version-string ProductVersion $env:BUILD_BUILDNUMBER } # Update the version.txt in the src dir based on the build number. @@ -253,22 +241,6 @@ steps: Compress-Archive -Path src/* -DestinationPath olympus.zip Move-Item -Path olympus.zip -Destination olympus.love Copy-Item -Path olympus.love -Destination love/$env:LOVEBINARYDIRECTORY/olympus.love -# Glue it onto the love binary. -- task: PowerShell@2 - condition: and(succeeded(), ne(variables.loveBinary, '')) - displayName: 'Dist: Glue olympus.love onto LÖVE' - continueOnError: true - inputs: - targetType: 'inline' - script: | - if ($PSVersionTable.PSVersion.Major -lt 6) { - Get-Content love/$env:LOVEBINARYDIRECTORY/$env:LOVEBINARY,love/$env:LOVEBINARYDIRECTORY/olympus.love -Encoding Byte -ReadCount 512 | Set-Content love-glued -Encoding Byte - } else { - Get-Content love/$env:LOVEBINARYDIRECTORY/$env:LOVEBINARY,love/$env:LOVEBINARYDIRECTORY/olympus.love -AsByteStream -ReadCount 0 | Set-Content love-glued -AsByteStream - } - Remove-Item -Path love/$env:LOVEBINARYDIRECTORY/$env:LOVEBINARY -Force - Move-Item -Path love-glued -Destination love/$env:LOVEBINARYDIRECTORY/$env:LOVEBINARY - Remove-Item -Path love/$env:LOVEBINARYDIRECTORY/olympus.love -Force # Copy luarocks. - task: CopyFiles@2 @@ -322,7 +294,7 @@ steps: Remove-Item -Path love/game.ico -Force Remove-Item -Path love/love.ico -Force Remove-Item -Path love/lovec.exe -Force - Move-Item -Path love/love.exe -Destination love/main.exe + Copy-Item -Path icon.ico -Destination love/icon.ico New-Item -Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY/main -ItemType Directory Compress-Archive -Path love/* -DestinationPath $env:BUILD_ARTIFACTSTAGINGDIRECTORY/main/dist.zip -Force New-Item -Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY/update -ItemType Directory diff --git a/changelog.txt b/changelog.txt index 832ed30..e9eb450 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,4 +3,4 @@ and only contains the latest changes. Its purpose is to be shown in Olympus when updating. #changelog# -∙ Do not create scripts on-the-fly and run them on Mac and Linux to suppress output, as this causes "permission denied" issues on some distributions \ No newline at end of file +∙ Ship unaltered love2d on Windows instead of following the release procedure, since this seems to fix issues for some people \ No newline at end of file diff --git a/launcher-winforms/Program.cs b/launcher-winforms/Program.cs index eae7b03..8163915 100644 --- a/launcher-winforms/Program.cs +++ b/launcher-winforms/Program.cs @@ -13,19 +13,15 @@ namespace Olympus { static class Program { public static string InstallDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Olympus"); - public static string MainPath = Path.Combine(InstallDir, "main.exe"); + public static string MainPath = Path.Combine(InstallDir, "love.exe"); public static string ConfigDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Olympus"); public static string LogPath = Path.Combine(ConfigDir, "log-launcher.txt"); - public static string[] Args; - [STAThread] - static void Main(string[] args) { + static void Main() { CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture; - Args = args; - if (!Directory.Exists(InstallDir)) Directory.CreateDirectory(InstallDir); if (!Directory.Exists(ConfigDir)) @@ -90,11 +86,7 @@ public static bool StartMain() { Process process = new Process(); process.StartInfo.FileName = MainPath; process.StartInfo.WorkingDirectory = InstallDir; - process.StartInfo.Arguments = string.Join(" ", Args.Select(arg => { - arg = Regex.Replace(arg, @"(\\*)" + "\"", @"$1\$0"); - arg = Regex.Replace(arg, @"^(.*\s.*?)(\\*)$", "\"$1$2$2\""); - return arg; - })); + process.StartInfo.Arguments = "\"" + Path.Combine(Path.GetDirectoryName(MainPath), "olympus.love") + "\""; process.Start(); return true; } diff --git a/sharp/CmdRestart.cs b/sharp/CmdRestart.cs index bba4774..33aa3ae 100644 --- a/sharp/CmdRestart.cs +++ b/sharp/CmdRestart.cs @@ -19,6 +19,10 @@ public override string Run(string exe) { } process.StartInfo.FileName = exe; +#if WIN32 + process.StartInfo.Arguments = "\"" + exe + "\""; + process.StartInfo.FileName = Path.Combine(Path.GetDirectoryName(exe), "love.exe"); +#endif Environment.CurrentDirectory = process.StartInfo.WorkingDirectory = Path.GetDirectoryName(exe); Console.Error.WriteLine($"Starting Olympus process: {exe}"); diff --git a/sharp/CmdWin32AppUninstall.cs b/sharp/CmdWin32AppUninstall.cs index fad1788..d7e16fb 100644 --- a/sharp/CmdWin32AppUninstall.cs +++ b/sharp/CmdWin32AppUninstall.cs @@ -33,7 +33,7 @@ public override string Run(bool quiet) { string selfDirectory = Path.GetDirectoryName(selfPath); if (string.IsNullOrEmpty(root)) root = Path.GetDirectoryName(selfDirectory); - if (!File.Exists(Path.Combine(root, "main.exe")) || + if (!File.Exists(Path.Combine(root, "love.exe")) || !File.Exists(Path.Combine(root, "love.dll")) || !Directory.Exists(Path.Combine(root, "sharp"))) { if (!quiet) diff --git a/sharp/CmdWin32CreateShortcuts.cs b/sharp/CmdWin32CreateShortcuts.cs index 7a8eead..0f9d212 100644 --- a/sharp/CmdWin32CreateShortcuts.cs +++ b/sharp/CmdWin32CreateShortcuts.cs @@ -17,7 +17,9 @@ public override string Run(string exepath) { public static void CreateShortcut(string exepath, string lnkpath) { IShellLink link = (IShellLink) new ShellLink(); link.SetDescription("Launch Olympus"); - link.SetPath(exepath); + link.SetPath(Path.Combine(Path.GetDirectoryName(exepath), "love.exe")); + link.SetArguments("\"" + Path.Combine(Path.GetDirectoryName(exepath), "olympus.love") + "\""); + link.SetIconLocation(Path.Combine(Path.GetDirectoryName(exepath), "icon.ico"), 0); link.SetWorkingDirectory(Directory.GetParent(exepath).FullName); ((IPersistFile) link).Save(lnkpath, false); } @@ -53,4 +55,4 @@ internal interface IShellLink { } } -#endif \ No newline at end of file +#endif diff --git a/src/modinstaller.lua b/src/modinstaller.lua index 75a14fe..87177cc 100644 --- a/src/modinstaller.lua +++ b/src/modinstaller.lua @@ -16,27 +16,32 @@ function modinstaller.register() local userOS = love.system.getOS() if userOS == "Windows" then + local retval = false + local exepath = love.filesystem.getSource() - if (exepath:match(".exe$") and + if (exepath:match(".love") and registry.setKey([[HKCU\Software\Classes\Everest\]], "URL:Everest") and registry.setKey([[HKCU\Software\Classes\Everest\URL Protocol]], "") and - registry.setKey([[HKCU\Software\Classes\Everest\shell\open\command\]], string.format([["%s" "%%1"]], exepath))) + registry.setKey([[HKCU\Software\Classes\Everest\shell\open\command\]], + string.format([["%s" "%s" "%%1"]], exepath:gsub("olympus.love$", "love.exe"), exepath))) then -- While we're here, might as well register the application properly. print("updating installed application listing") sharp.win32AppAdd(exepath, utils.trim(utils.load("version.txt") or "?")) + retval = true + end - -- While we're here, might as well create some helpful .lnks - -- INTRODUCED AFTER BUILD 1531 - if config.lastrun < 0 or config.lastrun <= 1531 then - print("creating shortcuts", exepath) - sharp.win32CreateShortcuts(exepath) - end - - return true + -- While we're here, might as well create some helpful .lnks + -- Updated on build 4650 + if config.lastrun <= 4650 then + print("creating shortcuts", exepath) + sharp.win32CreateShortcuts(exepath) + retval = true end + return retval + elseif userOS == "OS X" then return false diff --git a/src/registry.lua b/src/registry.lua index 2b91c83..6749062 100644 --- a/src/registry.lua +++ b/src/registry.lua @@ -13,7 +13,7 @@ end registry.setKey = registry.setKeySharp --- Fuck LuaCOM. Besides the fact that it likes to not work at random, it also keeps main.exe alive. +-- Fuck LuaCOM. Besides the fact that it likes to not work at random, it also keeps love.exe alive. --[[ local luacomStatus, luacom = pcall(require, "luacom") if luacomStatus and luacom then