├── .github └── FUNDING.yml ├── .gitignore ├── Edit-and-run-before-opening-solution.bat ├── LICENSE ├── README.md ├── SpaceEngineersLauncher.sln └── SpaceEngineersLauncher ├── App.config ├── ConfigFile.cs ├── LogFile.cs ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs └── Resources.resx ├── Resources └── Icon.ico ├── SpaceEngineersLauncher.csproj ├── SplashScreen.cs ├── app.manifest ├── deploy.bat └── splash.gif /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [sepluginloader] 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # JustCode is a .NET coding add-in 131 | .JustCode 132 | 133 | # TeamCity is a build add-in 134 | _TeamCity* 135 | 136 | # DotCover is a Code Coverage Tool 137 | *.dotCover 138 | 139 | # AxoCover is a Code Coverage Tool 140 | .axoCover/* 141 | !.axoCover/settings.json 142 | 143 | # Visual Studio code coverage results 144 | *.coverage 145 | *.coveragexml 146 | 147 | # NCrunch 148 | _NCrunch_* 149 | .*crunch*.local.xml 150 | nCrunchTemp_* 151 | 152 | # MightyMoose 153 | *.mm.* 154 | AutoTest.Net/ 155 | 156 | # Web workbench (sass) 157 | .sass-cache/ 158 | 159 | # Installshield output folder 160 | [Ee]xpress/ 161 | 162 | # DocProject is a documentation generator add-in 163 | DocProject/buildhelp/ 164 | DocProject/Help/*.HxT 165 | DocProject/Help/*.HxC 166 | DocProject/Help/*.hhc 167 | DocProject/Help/*.hhk 168 | DocProject/Help/*.hhp 169 | DocProject/Help/Html2 170 | DocProject/Help/html 171 | 172 | # Click-Once directory 173 | publish/ 174 | 175 | # Publish Web Output 176 | *.[Pp]ublish.xml 177 | *.azurePubxml 178 | # Note: Comment the next line if you want to checkin your web deploy settings, 179 | # but database connection strings (with potential passwords) will be unencrypted 180 | *.pubxml 181 | *.publishproj 182 | 183 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 184 | # checkin your Azure Web App publish settings, but sensitive information contained 185 | # in these scripts will be unencrypted 186 | PublishScripts/ 187 | 188 | # NuGet Packages 189 | *.nupkg 190 | # NuGet Symbol Packages 191 | *.snupkg 192 | # The packages folder can be ignored because of Package Restore 193 | **/[Pp]ackages/* 194 | # except build/, which is used as an MSBuild target. 195 | !**/[Pp]ackages/build/ 196 | # Uncomment if necessary however generally it will be regenerated when needed 197 | #!**/[Pp]ackages/repositories.config 198 | # NuGet v3's project.json files produces more ignorable files 199 | *.nuget.props 200 | *.nuget.targets 201 | 202 | # Microsoft Azure Build Output 203 | csx/ 204 | *.build.csdef 205 | 206 | # Microsoft Azure Emulator 207 | ecf/ 208 | rcf/ 209 | 210 | # Windows Store app package directories and files 211 | AppPackages/ 212 | BundleArtifacts/ 213 | Package.StoreAssociation.xml 214 | _pkginfo.txt 215 | *.appx 216 | *.appxbundle 217 | *.appxupload 218 | 219 | # Visual Studio cache files 220 | # files ending in .cache can be ignored 221 | *.[Cc]ache 222 | # but keep track of directories ending in .cache 223 | !?*.[Cc]ache/ 224 | 225 | # Others 226 | ClientBin/ 227 | ~$* 228 | *~ 229 | *.dbmdl 230 | *.dbproj.schemaview 231 | *.jfm 232 | *.pfx 233 | *.publishsettings 234 | orleans.codegen.cs 235 | 236 | # Including strong name files can present a security risk 237 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 238 | #*.snk 239 | 240 | # Since there are multiple workflows, uncomment next line to ignore bower_components 241 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 242 | #bower_components/ 243 | 244 | # RIA/Silverlight projects 245 | Generated_Code/ 246 | 247 | # Backup & report files from converting an old project file 248 | # to a newer Visual Studio version. Backup files are not needed, 249 | # because we have git ;-) 250 | _UpgradeReport_Files/ 251 | Backup*/ 252 | UpgradeLog*.XML 253 | UpgradeLog*.htm 254 | ServiceFabricBackup/ 255 | *.rptproj.bak 256 | 257 | # SQL Server files 258 | *.mdf 259 | *.ldf 260 | *.ndf 261 | 262 | # Business Intelligence projects 263 | *.rdl.data 264 | *.bim.layout 265 | *.bim_*.settings 266 | *.rptproj.rsuser 267 | *- [Bb]ackup.rdl 268 | *- [Bb]ackup ([0-9]).rdl 269 | *- [Bb]ackup ([0-9][0-9]).rdl 270 | 271 | # Microsoft Fakes 272 | FakesAssemblies/ 273 | 274 | # GhostDoc plugin setting file 275 | *.GhostDoc.xml 276 | 277 | # Node.js Tools for Visual Studio 278 | .ntvs_analysis.dat 279 | node_modules/ 280 | 281 | # Visual Studio 6 build log 282 | *.plg 283 | 284 | # Visual Studio 6 workspace options file 285 | *.opt 286 | 287 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 288 | *.vbw 289 | 290 | # Visual Studio LightSwitch build output 291 | **/*.HTMLClient/GeneratedArtifacts 292 | **/*.DesktopClient/GeneratedArtifacts 293 | **/*.DesktopClient/ModelManifest.xml 294 | **/*.Server/GeneratedArtifacts 295 | **/*.Server/ModelManifest.xml 296 | _Pvt_Extensions 297 | 298 | # Paket dependency manager 299 | .paket/paket.exe 300 | paket-files/ 301 | 302 | # FAKE - F# Make 303 | .fake/ 304 | 305 | # CodeRush personal settings 306 | .cr/personal 307 | 308 | # Python Tools for Visual Studio (PTVS) 309 | __pycache__/ 310 | *.pyc 311 | 312 | # Cake - Uncomment if you are using it 313 | # tools/** 314 | # !tools/packages.config 315 | 316 | # Tabs Studio 317 | *.tss 318 | 319 | # Telerik's JustMock configuration file 320 | *.jmconfig 321 | 322 | # BizTalk build output 323 | *.btp.cs 324 | *.btm.cs 325 | *.odx.cs 326 | *.xsd.cs 327 | 328 | # OpenCover UI analysis results 329 | OpenCover/ 330 | 331 | # Azure Stream Analytics local run output 332 | ASALocalRun/ 333 | 334 | # MSBuild Binary and Structured Log 335 | *.binlog 336 | 337 | # NVidia Nsight GPU debugger configuration file 338 | *.nvuser 339 | 340 | # MFractors (Xamarin productivity tool) working folder 341 | .mfractor/ 342 | 343 | # Local History for Visual Studio 344 | .localhistory/ 345 | 346 | # BeatPulse healthcheck temp database 347 | healthchecksdb 348 | 349 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 350 | MigrationBackup/ 351 | 352 | # Ionide (cross platform F# VS Code tools) working folder 353 | .ionide/ 354 | 355 | # SE's Bin64 folder symlinked for DLL dependencies 356 | /Bin64/ 357 | 358 | # Steam's workshop folder symlinked for DLL dependencies 359 | /workshop/ 360 | 361 | # JetBrains Rider project files 362 | .idea/ -------------------------------------------------------------------------------- /Edit-and-run-before-opening-solution.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Location of your SpaceEngineers.exe 4 | mklink /J Bin64 "C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Bin64" 5 | 6 | pause 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD Zero Clause License 2 | 3 | Copyright (c) 2025 SE Plugin Loader 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 9 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 10 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 11 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 12 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 13 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 14 | PERFORMANCE OF THIS SOFTWARE. 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Space Engineers Launcher 2 | 3 | A launcher for Space Engineers with built in [Plugin Loader](https://github.com/sepluginloader/PluginLoader). 4 | 5 | The launcher will download and keep Plugin Loader up to date automatically. If you want to use this launcher without Plugin Loader, you can open the configuration file in the `Bin64/Plugins/` folder and change the `NoUpdates` value to true. 6 | 7 | ## Installation 8 | 9 | 1. Download the Launcher exe file from the [Releases page](https://github.com/sepluginloader/SpaceEngineersLauncher/releases/latest) 10 | 2. Make sure the exe file is not blocked before continuing by opening the file properties of the extracted file and checking the Unblock box if it exists. 11 | 3. The exe file can now be placed in the game Bin64 folder. 12 | - You can find the Bin64 folder by right clicking on Space Engineers and selecting Properties. Then under the Local Files tab, select Browse and navigate to the Bin64 folder. 13 | 4. Launch Space Engineers by opening the SpaceEngineersLauncher.exe file. 14 | 15 | ### Community Videos 16 | Tutorial videos from the community: 17 | 18 | AliceDoesThings\ 19 | [https://www.youtube.com/watch?v=76pIEdxnfDg](https://www.youtube.com/watch?v=76pIEdxnfDg) 20 | 21 | Vortex Mods\ 22 | [https://www.youtube.com/watch?v=ywBYoDZHG-4](https://www.youtube.com/watch?v=ywBYoDZHG-4) 23 | 24 | ### Linux 25 | 26 | Linux users may need additional steps. See [opekope2's solution](https://gist.github.com/opekope2/e02db7e526dadff0813a6ea2aebf820b). 27 | 28 | ## Troubleshooting 29 | **I get a message that says "We have detected a better graphics card", "Please apply windows updates and update to latest graphics drivers", or I have another graphics related issue** 30 | 31 | Try going into Windows settings > Display > Graphics and setting SpaceEngineersLauncher.exe to High performance. 32 | -------------------------------------------------------------------------------- /SpaceEngineersLauncher.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.32510.428 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceEngineersLauncher", "SpaceEngineersLauncher\SpaceEngineersLauncher.csproj", "{E061250C-1358-4F05-8734-B3070DEE792F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Release|Any CPU = Release|Any CPU 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {E061250C-1358-4F05-8734-B3070DEE792F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {E061250C-1358-4F05-8734-B3070DEE792F}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {E061250C-1358-4F05-8734-B3070DEE792F}.Debug|x64.ActiveCfg = Debug|x64 19 | {E061250C-1358-4F05-8734-B3070DEE792F}.Debug|x64.Build.0 = Debug|x64 20 | {E061250C-1358-4F05-8734-B3070DEE792F}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {E061250C-1358-4F05-8734-B3070DEE792F}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {E061250C-1358-4F05-8734-B3070DEE792F}.Release|x64.ActiveCfg = Release|x64 23 | {E061250C-1358-4F05-8734-B3070DEE792F}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {5373543C-5C55-4152-946D-2C5372F7CADD} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /SpaceEngineersLauncher/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SpaceEngineersLauncher/ConfigFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Xml.Serialization; 4 | 5 | namespace avaness.SpaceEngineersLauncher 6 | { 7 | [XmlRoot("LauncherConfig")] 8 | public class ConfigFile 9 | { 10 | private string filePath; 11 | 12 | public string LoaderVersion { get; set; } 13 | 14 | public bool NoUpdates { get; set; } 15 | 16 | [XmlArrayItem("File")] 17 | public string[] Files { get; set; } 18 | 19 | private int networkTimeout = 10000; 20 | public int NetworkTimeout 21 | { 22 | get 23 | { 24 | return networkTimeout; 25 | } 26 | set 27 | { 28 | if (value < 100) 29 | networkTimeout = 100; 30 | else if (value > 60000) 31 | networkTimeout = 60000; 32 | else 33 | networkTimeout = value; 34 | } 35 | } 36 | 37 | public bool AllowIPv6 { get; set; } = true; 38 | 39 | 40 | public ConfigFile() 41 | { 42 | 43 | } 44 | 45 | public static ConfigFile Load(string filePath) 46 | { 47 | if (File.Exists(filePath)) 48 | { 49 | try 50 | { 51 | XmlSerializer serializer = new XmlSerializer(typeof(ConfigFile)); 52 | FileStream fs = File.OpenRead(filePath); 53 | ConfigFile config = (ConfigFile)serializer.Deserialize(fs); 54 | fs.Close(); 55 | config.filePath = filePath; 56 | return config; 57 | } 58 | catch (Exception e) 59 | { 60 | LogFile.WriteLine($"An error occurred while loading launcher config: " + e); 61 | } 62 | } 63 | 64 | return new ConfigFile 65 | { 66 | filePath = filePath 67 | }; 68 | } 69 | 70 | public void Save() 71 | { 72 | try 73 | { 74 | LogFile.WriteLine("Saving config"); 75 | XmlSerializer serializer = new XmlSerializer(typeof(ConfigFile)); 76 | if (File.Exists(filePath)) 77 | File.Delete(filePath); 78 | FileStream fs = File.OpenWrite(filePath); 79 | serializer.Serialize(fs, this); 80 | fs.Flush(); 81 | fs.Close(); 82 | } 83 | catch (Exception e) 84 | { 85 | LogFile.WriteLine($"An error occurred while saving launcher config: " + e); 86 | } 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /SpaceEngineersLauncher/LogFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace avaness.SpaceEngineersLauncher 5 | { 6 | public static class LogFile 7 | { 8 | private static StreamWriter writer; 9 | 10 | public static void Init(string file) 11 | { 12 | try 13 | { 14 | writer = File.CreateText(file); 15 | } 16 | catch 17 | { 18 | writer = null; 19 | } 20 | } 21 | 22 | /// 23 | /// Writes the specifed text to the log file. 24 | /// WARNING: Not thread safe! 25 | /// 26 | public static void WriteLine(string text) 27 | { 28 | try 29 | { 30 | writer?.WriteLine($"{DateTime.UtcNow:O} {text}"); 31 | writer?.Flush(); 32 | } 33 | catch 34 | { 35 | Dispose(); 36 | } 37 | } 38 | 39 | public static void Dispose() 40 | { 41 | if (writer == null) 42 | return; 43 | 44 | try 45 | { 46 | writer.Flush(); 47 | writer.Close(); 48 | } 49 | catch { } 50 | writer = null; 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /SpaceEngineersLauncher/Program.cs: -------------------------------------------------------------------------------- 1 | using Sandbox; 2 | using SpaceEngineers; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.IO.Compression; 7 | using System.Net; 8 | using System.Reflection; 9 | using System.Text; 10 | using System.Text.RegularExpressions; 11 | using System.Windows.Forms; 12 | using VRage.Plugins; 13 | using System.Linq; 14 | using System.Diagnostics; 15 | using System.Threading; 16 | using System.Security.Cryptography; 17 | 18 | namespace avaness.SpaceEngineersLauncher 19 | { 20 | static class Program 21 | { 22 | private const uint AppId = 244850u; 23 | private const string RepoUrl = "https://github.com/sepluginloader/PluginLoader/"; 24 | private const string RepoDownloadSuffix = "releases/download/{0}/PluginLoader-{0}.zip"; 25 | private static readonly Regex VersionRegex = new Regex(@"^v(\d+\.)*\d+$"); 26 | private const string PluginLoaderFile = "PluginLoader.dll"; 27 | private const string OriginalAssemblyFile = "SpaceEngineers.exe"; 28 | private const string ProgramGuid = "03f85883-4990-4d47-968e-5e4fc5d72437"; 29 | private static readonly Version SupportedGameVersion = new Version(1, 202, 0); 30 | private const int MutexTimeout = 1000; // ms 31 | private const int SteamTimeout = 30; // seconds 32 | 33 | private static string exeLocation; 34 | private static SplashScreen splash; 35 | private static Mutex mutex; // For ensuring only a single instance of SE 36 | private static bool mutexActive; 37 | 38 | static void Main(string[] args) 39 | { 40 | if (IsReport(args)) 41 | { 42 | StartSpaceEngineers(args); 43 | return; 44 | } 45 | 46 | exeLocation = Path.GetDirectoryName(Path.GetFullPath(Assembly.GetExecutingAssembly().Location)); 47 | 48 | if (!IsSingleInstance()) 49 | { 50 | Show("Error: Space Engineers is already running!"); 51 | return; 52 | } 53 | 54 | if (!IsInGameFolder()) 55 | { 56 | Show($"Error: {OriginalAssemblyFile} not found!\nIs {Path.GetFileName(Assembly.GetExecutingAssembly().Location)} in the Bin64 folder?"); 57 | return; 58 | } 59 | 60 | if (!IsSupportedGameVersion()) 61 | { 62 | Show("Game version not supported! Requires " + SupportedGameVersion.ToString(3) + " or later"); 63 | return; 64 | } 65 | 66 | try 67 | { 68 | StartPluginLoader(args); 69 | StartSpaceEngineers(args); 70 | Close(); 71 | } 72 | finally 73 | { 74 | if (mutexActive) 75 | mutex.ReleaseMutex(); 76 | } 77 | } 78 | 79 | private static void StartPluginLoader(string[] args) 80 | { 81 | bool nosplash = args != null && Array.IndexOf(args, "-nosplash") >= 0; 82 | if (!nosplash) 83 | splash = new SplashScreen("avaness.SpaceEngineersLauncher"); 84 | 85 | try 86 | { 87 | string pluginsDir = Path.Combine(exeLocation, "Plugins"); 88 | if(!Directory.Exists(pluginsDir)) 89 | Directory.CreateDirectory(pluginsDir); 90 | 91 | LogFile.Init(Path.Combine(pluginsDir, "launcher.log")); 92 | LogFile.WriteLine("Starting - v" + Assembly.GetExecutingAssembly().GetName().Version.ToString(3)); 93 | 94 | ConfigFile config = ConfigFile.Load(Path.Combine(pluginsDir, "launcher.xml")); 95 | 96 | // Fix tls 1.2 not supported on Windows 7 - github.com is tls 1.2 only 97 | try 98 | { 99 | ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; 100 | } 101 | catch (NotSupportedException e) 102 | { 103 | LogFile.WriteLine("An error occurred while setting up networking, web requests will probably fail: " + e); 104 | } 105 | 106 | string appIdFile = Path.Combine(exeLocation, "steam_appid.txt"); 107 | if (!File.Exists(appIdFile)) 108 | { 109 | LogFile.WriteLine(appIdFile + " does not exist, creating."); 110 | File.WriteAllText(appIdFile, AppId.ToString()); 111 | } 112 | 113 | StartSteam(); 114 | 115 | EnsureAssemblyConfigFile(); 116 | 117 | if (!config.NoUpdates) 118 | Update(config); 119 | 120 | StringBuilder pluginLog = new StringBuilder("Loading plugins: "); 121 | List plugins = new List(); 122 | 123 | splash?.SetText("Registering plugins..."); 124 | 125 | if (CanUseLoader(config)) 126 | { 127 | string loaderDll = Path.Combine(exeLocation, PluginLoaderFile); 128 | pluginLog.Append(loaderDll).Append(','); 129 | plugins.Add(loaderDll); 130 | } 131 | else 132 | { 133 | LogFile.WriteLine("WARNING: Plugin Loader does not exist."); 134 | } 135 | 136 | if (args != null && args.Length > 1) 137 | { 138 | int pluginFlag = Array.IndexOf(args, "-plugin"); 139 | if (pluginFlag >= 0) 140 | { 141 | args[pluginFlag] = ""; 142 | for (int i = pluginFlag + 1; i < args.Length && !args[i].StartsWith("-"); i++) 143 | { 144 | string plugin = args[i]; 145 | if (plugin.EndsWith("PluginLoader.dll", StringComparison.OrdinalIgnoreCase)) 146 | continue; 147 | if (!Path.IsPathRooted(plugin)) 148 | plugin = Path.GetFullPath(Path.Combine(exeLocation, plugin)); 149 | if (File.Exists(plugin)) 150 | { 151 | pluginLog.Append(plugin).Append(','); 152 | plugins.Add(plugin); 153 | } 154 | else 155 | { 156 | LogFile.WriteLine("WARNING: '" + plugin + "' does not exist."); 157 | } 158 | } 159 | } 160 | } 161 | 162 | if (plugins.Count > 0) 163 | { 164 | if (pluginLog.Length > 0) 165 | pluginLog.Length--; 166 | LogFile.WriteLine(pluginLog.ToString()); 167 | 168 | MyPlugins.RegisterUserAssemblyFiles(plugins); 169 | } 170 | 171 | splash?.SetText("Starting game..."); 172 | } 173 | catch (Exception e) 174 | { 175 | LogFile.WriteLine("Error while getting Plugin Loader ready: " + e); 176 | Show("Plugin Loader crashed: " + e); 177 | if (Application.OpenForms.Count > 0) 178 | Application.OpenForms[0].Close(); 179 | } 180 | 181 | if (nosplash) 182 | Close(); 183 | else 184 | MyCommonProgramStartup.BeforeSplashScreenInit += Close; 185 | } 186 | 187 | private static void StartSteam() 188 | { 189 | if(!Steamworks.SteamAPI.IsSteamRunning()) 190 | { 191 | splash?.SetText("Starting steam..."); 192 | try 193 | { 194 | Process steam = Process.Start( 195 | new ProcessStartInfo("cmd", "/c start steam://") 196 | { 197 | UseShellExecute = true, 198 | WindowStyle = ProcessWindowStyle.Hidden, 199 | }); 200 | if(steam != null) 201 | { 202 | for (int i = 0; i < SteamTimeout; i++) 203 | { 204 | Thread.Sleep(1000); 205 | if (Steamworks.SteamAPI.Init()) 206 | return; 207 | } 208 | } 209 | } 210 | catch { } 211 | 212 | LogFile.WriteLine("Steam not detected!"); 213 | Show("Steam must be running before you can start Space Engineers."); 214 | splash?.Delete(); 215 | Environment.Exit(0); 216 | } 217 | 218 | } 219 | 220 | [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] 221 | private static void StartSpaceEngineers(string[] args) 222 | { 223 | MyProgram.Main(args); 224 | } 225 | 226 | private static bool IsInGameFolder() 227 | { 228 | return File.Exists(Path.Combine(exeLocation, OriginalAssemblyFile)); 229 | } 230 | 231 | private static bool IsSupportedGameVersion() 232 | { 233 | SpaceEngineers.Game.SpaceEngineersGame.SetupBasicGameInfo(); 234 | int? gameVersionInt = Sandbox.Game.MyPerGameSettings.BasicGameInfo.GameVersion; 235 | if (!gameVersionInt.HasValue) 236 | return true; 237 | string gameVersionStr = VRage.Utils.MyBuildNumbers.ConvertBuildNumberFromIntToStringFriendly(gameVersionInt.Value, "."); 238 | Version gameVersion = new Version(gameVersionStr); 239 | return gameVersion >= SupportedGameVersion; 240 | } 241 | 242 | private static bool IsSingleInstance() 243 | { 244 | // Check for other SpaceEngineersLauncher.exe 245 | mutex = new Mutex(true, ProgramGuid, out mutexActive); 246 | if (!mutexActive) 247 | { 248 | try 249 | { 250 | mutexActive = mutex.WaitOne(MutexTimeout); 251 | if(!mutexActive) 252 | return false; 253 | } 254 | catch (AbandonedMutexException) 255 | { } // Abandoned probably means that the process was killed or crashed 256 | } 257 | 258 | // Check for other SpaceEngineers.exe 259 | string sePath = Path.Combine(exeLocation, OriginalAssemblyFile); 260 | if (Process.GetProcessesByName("SpaceEngineers").Any(x => x.MainModule.FileName.Equals(sePath, StringComparison.OrdinalIgnoreCase))) 261 | return false; 262 | 263 | return true; 264 | } 265 | 266 | private static void EnsureAssemblyConfigFile() 267 | { 268 | // Without this file, SE will have many bugs because its dependencies will not be correct. 269 | string originalConfig = Path.Combine(exeLocation, OriginalAssemblyFile + ".config"); 270 | string newConfig = Path.Combine(exeLocation, Path.GetFileName(Assembly.GetExecutingAssembly().Location) + ".config"); 271 | if (File.Exists(originalConfig)) 272 | { 273 | if (!File.Exists(newConfig) || !FilesEqual(originalConfig, newConfig)) 274 | { 275 | File.Copy(originalConfig, newConfig, true); 276 | Restart(); 277 | } 278 | } 279 | else if(File.Exists(newConfig)) 280 | { 281 | File.Delete(newConfig); 282 | Restart(); 283 | } 284 | } 285 | 286 | private static void Close() 287 | { 288 | MyCommonProgramStartup.BeforeSplashScreenInit -= Close; 289 | splash?.Delete(); 290 | splash = null; 291 | LogFile.Dispose(); 292 | } 293 | 294 | static bool IsReport(string[] args) 295 | { 296 | return args != null && args.Length > 0 297 | && (Array.IndexOf(args, "-report") >= 0 || Array.IndexOf(args, "-reporX") >= 0); 298 | } 299 | 300 | static void Update(ConfigFile config) 301 | { 302 | splash?.SetText("Checking for updates..."); 303 | 304 | 305 | string currentVersion = null; 306 | if (!string.IsNullOrWhiteSpace(config.LoaderVersion) && CanUseLoader(config) && VersionRegex.IsMatch(config.LoaderVersion)) 307 | { 308 | currentVersion = config.LoaderVersion; 309 | LogFile.WriteLine("Plugin Loader " + currentVersion); 310 | } 311 | else 312 | { 313 | LogFile.WriteLine("Plugin Loader version unknown"); 314 | } 315 | 316 | if (!IsLatestVersion(config, currentVersion, out string latestVersion)) 317 | { 318 | LogFile.WriteLine("An update is available to " + latestVersion); 319 | 320 | StringBuilder prompt = new StringBuilder(); 321 | if (string.IsNullOrWhiteSpace(currentVersion)) 322 | { 323 | prompt.Append("Plugin Loader is not installed!").AppendLine(); 324 | prompt.Append("Version to download: ").Append(latestVersion).AppendLine(); 325 | prompt.Append("Would you like to install it now?"); 326 | } 327 | else 328 | { 329 | prompt.Append("An update is available for Plugin Loader:").AppendLine(); 330 | prompt.Append(currentVersion).Append(" -> ").Append(latestVersion).AppendLine(); 331 | prompt.Append("Would you like to update now?"); 332 | } 333 | 334 | DialogResult result = Show(prompt.ToString(), MessageBoxButtons.YesNoCancel); 335 | if (result == DialogResult.Yes) 336 | { 337 | splash?.SetText("Downloading update..."); 338 | if (!TryDownloadUpdate(config, latestVersion)) 339 | Show("Update failed!"); 340 | } 341 | else if (result == DialogResult.Cancel) 342 | { 343 | splash?.Delete(); 344 | Environment.Exit(0); 345 | } 346 | } 347 | } 348 | 349 | static bool IsLatestVersion(ConfigFile config, string currentVersion, out string latestVersion) 350 | { 351 | try 352 | { 353 | Uri uri = new Uri(RepoUrl + "releases/latest", UriKind.Absolute); 354 | HttpWebResponse response = Download(config, uri); 355 | if (response?.ResponseUri != null) 356 | { 357 | string version = response.ResponseUri.OriginalString; 358 | int versionStart = version.LastIndexOf('v'); 359 | if (versionStart >= 0 && versionStart < version.Length) 360 | { 361 | latestVersion = version.Substring(versionStart); 362 | if (string.IsNullOrWhiteSpace(currentVersion) || currentVersion != latestVersion) 363 | return !VersionRegex.IsMatch(latestVersion); 364 | } 365 | } 366 | } 367 | catch (Exception e) 368 | { 369 | LogFile.WriteLine("An error occurred while getting the latest version: " + e); 370 | } 371 | latestVersion = currentVersion; 372 | return true; 373 | } 374 | 375 | static bool TryDownloadUpdate(ConfigFile config, string version) 376 | { 377 | try 378 | { 379 | HashSet files = new HashSet(); 380 | 381 | LogFile.WriteLine("Updating to Plugin Loader " + version); 382 | 383 | Uri uri = new Uri(RepoUrl + string.Format(RepoDownloadSuffix, version), UriKind.Absolute); 384 | HttpWebResponse response = Download(config, uri); 385 | using (Stream zipFileStream = response.GetResponseStream()) 386 | using (ZipArchive zipFile = new ZipArchive(zipFileStream)) 387 | { 388 | foreach (ZipArchiveEntry entry in zipFile.Entries) 389 | { 390 | string fileName = Path.GetFileName(entry.FullName); 391 | string filePath = Path.Combine(exeLocation, fileName); 392 | 393 | using (Stream entryStream = entry.Open()) 394 | using (FileStream entryFile = File.Create(filePath)) 395 | { 396 | entryStream.CopyTo(entryFile); 397 | } 398 | 399 | files.Add(fileName); 400 | } 401 | } 402 | 403 | config.LoaderVersion = version; 404 | config.Files = files.ToArray(); 405 | config.Save(); 406 | return true; 407 | } 408 | catch (Exception e) 409 | { 410 | LogFile.WriteLine("An error occurred while updating: " + e); 411 | } 412 | return false; 413 | } 414 | 415 | static HttpWebResponse Download(ConfigFile config, Uri uri) 416 | { 417 | LogFile.WriteLine("Downloading " + uri); 418 | HttpWebRequest request = WebRequest.CreateHttp(uri); 419 | request.Timeout = config.NetworkTimeout; 420 | request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; 421 | if (!config.AllowIPv6) 422 | request.ServicePoint.BindIPEndPointDelegate = BlockIPv6; 423 | return request.GetResponse() as HttpWebResponse; 424 | } 425 | 426 | private static IPEndPoint BlockIPv6(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount) 427 | { 428 | if (remoteEndPoint.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) 429 | return new IPEndPoint(IPAddress.Any, 0); 430 | 431 | throw new InvalidOperationException("No IPv4 address"); 432 | } 433 | 434 | static bool CanUseLoader(ConfigFile config) 435 | { 436 | if (!File.Exists(Path.Combine(exeLocation, PluginLoaderFile))) 437 | { 438 | LogFile.WriteLine("WARNING: File verification failed, file does not exist: " + PluginLoaderFile); 439 | return false; 440 | } 441 | 442 | if (config.Files != null) 443 | { 444 | foreach (string file in config.Files) 445 | { 446 | if (!File.Exists(Path.Combine(exeLocation, file))) 447 | { 448 | LogFile.WriteLine("WARNING: File verification failed, file does not exist: " + file); 449 | return false; 450 | } 451 | } 452 | } 453 | 454 | return true; 455 | } 456 | 457 | static DialogResult Show(string msg, MessageBoxButtons buttons = MessageBoxButtons.OK) 458 | { 459 | if (Application.OpenForms.Count > 0) 460 | return MessageBox.Show(Application.OpenForms[0], msg, "Space Engineers Launcher", buttons); 461 | return MessageBox.Show(msg, "Space Engineers Launcher", buttons); 462 | } 463 | 464 | static void Restart() 465 | { 466 | Close(); 467 | Application.Restart(); 468 | Process.GetCurrentProcess().Kill(); 469 | } 470 | 471 | static bool FilesEqual(string file1, string file2) 472 | { 473 | FileInfo fileInfo1 = new FileInfo(file1); 474 | FileInfo fileInfo2 = new FileInfo(file2); 475 | return fileInfo1.Length == fileInfo2.Length && GetHash256(file1) == GetHash256(file2); 476 | } 477 | 478 | static string GetHash256(string file) 479 | { 480 | using (SHA256CryptoServiceProvider sha = new SHA256CryptoServiceProvider()) 481 | { 482 | return GetHash(file, sha); 483 | } 484 | } 485 | 486 | static string GetHash(string file, HashAlgorithm hash) 487 | { 488 | using (FileStream fileStream = new FileStream(file, FileMode.Open)) 489 | { 490 | using (BufferedStream bufferedStream = new BufferedStream(fileStream)) 491 | { 492 | byte[] data = hash.ComputeHash(bufferedStream); 493 | StringBuilder sb = new StringBuilder(2 * data.Length); 494 | foreach (byte b in data) 495 | sb.AppendFormat("{0:x2}", b); 496 | return sb.ToString(); 497 | } 498 | } 499 | } 500 | } 501 | } 502 | -------------------------------------------------------------------------------- /SpaceEngineersLauncher/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("SpaceEngineersLauncher")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("SpaceEngineersLauncher")] 12 | [assembly: AssemblyCopyright("Copyright © 2022")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("e061250c-1358-4f05-8734-b3070dee792f")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.6.0")] 35 | [assembly: AssemblyFileVersion("1.0.6.0")] 36 | -------------------------------------------------------------------------------- /SpaceEngineersLauncher/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace avaness.SpaceEngineersLauncher.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("avaness.SpaceEngineersLauncher.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 65 | /// 66 | internal static System.Drawing.Icon Icon { 67 | get { 68 | object obj = ResourceManager.GetObject("Icon", resourceCulture); 69 | return ((System.Drawing.Icon)(obj)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /SpaceEngineersLauncher/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Resources\Icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | -------------------------------------------------------------------------------- /SpaceEngineersLauncher/Resources/Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sepluginloader/SpaceEngineersLauncher/a9254748af8112bae27217e83d3ede33770ccd15/SpaceEngineersLauncher/Resources/Icon.ico -------------------------------------------------------------------------------- /SpaceEngineersLauncher/SpaceEngineersLauncher.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E061250C-1358-4F05-8734-B3070DEE792F} 8 | WinExe 9 | avaness.SpaceEngineersLauncher 10 | SpaceEngineersLauncher 11 | v4.8 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | true 37 | bin\x64\Debug\ 38 | DEBUG;TRACE 39 | full 40 | x64 41 | 7.3 42 | prompt 43 | true 44 | 45 | 46 | bin\x64\Release\ 47 | TRACE 48 | true 49 | pdbonly 50 | x64 51 | 7.3 52 | prompt 53 | true 54 | 55 | 56 | Resources\Icon.ico 57 | 58 | 59 | app.manifest 60 | 61 | 62 | 63 | False 64 | ..\Bin64\Sandbox.Game.dll 65 | False 66 | 67 | 68 | ..\Bin64\SpaceEngineers.exe 69 | False 70 | 71 | 72 | False 73 | ..\Bin64\SpaceEngineers.Game.dll 74 | False 75 | 76 | 77 | False 78 | ..\Bin64\Steamworks.NET.dll 79 | False 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | ..\Bin64\VRage.dll 90 | False 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | True 100 | True 101 | Resources.resx 102 | 103 | 104 | Form 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | ResXFileCodeGenerator 118 | Resources.Designer.cs 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | call "$(ProjectDir)\deploy.bat" "$(TargetPath) " 127 | 128 | -------------------------------------------------------------------------------- /SpaceEngineersLauncher/SplashScreen.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | using System.Drawing; 3 | using System.Reflection; 4 | using System.IO; 5 | 6 | namespace avaness.SpaceEngineersLauncher 7 | { 8 | public class SplashScreen : Form 9 | { 10 | private static readonly Size originalSplashSize = new Size(1024, 576); 11 | private static readonly PointF originalSplashScale = new PointF(0.7f, 0.7f); 12 | private const float barWidth = 0.98f; // 98% of width 13 | private const float barHeight = 0.06f; // 6% of height 14 | private static readonly Color backgroundColor = Color.FromArgb(4, 4, 4); 15 | 16 | private readonly bool invalid; 17 | private readonly Label lbl; 18 | private readonly PictureBox gifBox; 19 | private readonly RectangleF bar; 20 | 21 | private float barValue = float.NaN; 22 | 23 | public object GameInfo { get; private set; } 24 | 25 | public SplashScreen(string assemblyNamespace) 26 | { 27 | Image gif; 28 | if (!TryLoadImage(assemblyNamespace, out gif)) 29 | { 30 | invalid = true; 31 | return; 32 | } 33 | 34 | Size = new Size((int)(originalSplashSize.Width * originalSplashScale.X), (int)(originalSplashSize.Height * originalSplashScale.Y)); 35 | Name = "SplashScreenPluginLoaderLauncher"; 36 | FormBorderStyle = FormBorderStyle.None; 37 | 38 | SizeF barSize = new SizeF(Size.Width * barWidth, Size.Height * barHeight); 39 | float padding = (1 - barWidth) * Size.Width * 0.5f; 40 | PointF barStart = new PointF(padding, Size.Height - barSize.Height - padding); 41 | bar = new RectangleF(barStart, barSize); 42 | 43 | Font lblFont = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Bold); 44 | lbl = new Label 45 | { 46 | Name = "PluginLauncherInfo", 47 | Font = lblFont, 48 | BackColor = backgroundColor, 49 | ForeColor = Color.White, 50 | MaximumSize = Size, 51 | Size = new Size(Size.Width, lblFont.Height), 52 | TextAlign = ContentAlignment.MiddleCenter, 53 | Location = new Point(0, (int)(barStart.Y - lblFont.Height - 1)), 54 | }; 55 | Controls.Add(lbl); 56 | 57 | gifBox = new PictureBox() 58 | { 59 | Name = "PluginLauncherAnimation", 60 | Image = gif, 61 | Size = Size, 62 | AutoSize = false, 63 | SizeMode = PictureBoxSizeMode.StretchImage, 64 | }; 65 | Controls.Add(gifBox); 66 | 67 | gifBox.Paint += OnPictureBoxDraw; 68 | 69 | CenterToScreen(); 70 | Show(); 71 | ForceUpdate(); 72 | } 73 | 74 | private bool TryLoadImage(string assemblyNamespace, out Image img) 75 | { 76 | try 77 | { 78 | Assembly myAssembly = Assembly.GetExecutingAssembly(); 79 | Stream myStream = myAssembly.GetManifestResourceStream(assemblyNamespace + ".splash.gif"); 80 | img = new Bitmap(myStream); 81 | return true; 82 | } 83 | catch 84 | { 85 | img = null; 86 | return false; 87 | } 88 | } 89 | 90 | public void SetText(string msg) 91 | { 92 | if (invalid) 93 | return; 94 | 95 | lbl.Text = msg; 96 | barValue = float.NaN; 97 | gifBox.Invalidate(); 98 | ForceUpdate(); 99 | } 100 | 101 | public void SetBarValue(float percent = float.NaN) 102 | { 103 | if (invalid) 104 | return; 105 | 106 | barValue = percent; 107 | gifBox.Invalidate(); 108 | ForceUpdate(); 109 | } 110 | 111 | private void ForceUpdate() 112 | { 113 | Application.DoEvents(); 114 | } 115 | 116 | private void OnPictureBoxDraw(object sender, PaintEventArgs e) 117 | { 118 | if (!float.IsNaN(barValue)) 119 | { 120 | Graphics graphics = e.Graphics; 121 | graphics.FillRectangle(Brushes.DarkSlateGray, bar); 122 | graphics.FillRectangle(Brushes.White, new RectangleF(bar.Location, new SizeF(bar.Width * barValue, bar.Height))); 123 | } 124 | } 125 | 126 | public void Delete() 127 | { 128 | if (invalid) 129 | return; 130 | 131 | gifBox.Paint -= OnPictureBoxDraw; 132 | Close(); 133 | Dispose(); 134 | ForceUpdate(); 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /SpaceEngineersLauncher/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | true 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /SpaceEngineersLauncher/deploy.bat: -------------------------------------------------------------------------------- 1 | 2 | Rem Run this script with the full file path as argument 3 | 4 | if [%1] == [] goto eof 5 | 6 | set bin64="%~dp0..\Bin64\" 7 | set counter=1 8 | 9 | Rem Wait for the file to be ready 10 | :waitfile 11 | 2>nul ( 12 | >>%bin64%\%~nx1 (call ) 13 | ) && (goto copyfile) || (echo File is in use.) 14 | set /a counter=counter+1 15 | echo Trying attempt #%counter% 16 | ping -n 6 127.0.0.1 >nul 17 | goto waitfile 18 | 19 | Rem Copy the file to the target location 20 | :copyfile 21 | echo Copying file. 22 | copy /y "%~1" %bin64%\%~nx1 23 | 24 | :eof -------------------------------------------------------------------------------- /SpaceEngineersLauncher/splash.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sepluginloader/SpaceEngineersLauncher/a9254748af8112bae27217e83d3ede33770ccd15/SpaceEngineersLauncher/splash.gif --------------------------------------------------------------------------------