diff --git a/Edit-and-run-before-opening-solution.bat b/Edit-and-run-before-opening-solution.bat new file mode 100644 index 0000000..5085861 --- /dev/null +++ b/Edit-and-run-before-opening-solution.bat @@ -0,0 +1,6 @@ +@echo off + +REM Location of your SpaceEngineers.exe +mklink /J Bin64 "C:\Users\Lunar\Games\Steam\steamapps\common\SpaceEngineers\Bin64" + +pause diff --git a/UplinkLauncher/UplinkLauncher.cs b/UplinkLauncher/UplinkLauncher.cs index 420ebf7..15d3a17 100644 --- a/UplinkLauncher/UplinkLauncher.cs +++ b/UplinkLauncher/UplinkLauncher.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using VRage.Plugins; using SpaceEngineers; using System.IO; -using DTLib.Demystifier; +using System.Reflection; namespace UplinkLauncher; @@ -14,11 +14,8 @@ internal static class UplinkLauncher { try { - Console.WriteLine("Starting Uplink SE"); - Console.WriteLine(new string('-', Console.WindowWidth)); - List plugins = new List(); - + if (!Directory.Exists(PluginsLocalDir)) Directory.CreateDirectory(PluginsLocalDir); string[] localPlugins = Directory.GetFiles( @@ -26,30 +23,35 @@ internal static class UplinkLauncher foreach (string plugin in localPlugins) { - Console.WriteLine("Adding plugin: " + plugin); plugins.Add(Path.GetFullPath(plugin)); } MyPlugins.RegisterUserAssemblyFiles(plugins); - // why this file isn't created automatically? - // how game handles this without this magnificent launcher??? string appIdFile = "steam_appid.txt"; if (!File.Exists(appIdFile)) { - Console.WriteLine($"Could not find '{appIdFile}', creating new file"); File.WriteAllText(appIdFile, "244850"); } - // finally start ze game!!! - MyProgram.Main(args); + //Абсолютно великий код который делает чтобы Аплинк скопировал себе .config от инжей. Я не знаю, что такое .config, но там какие-то зависимости некие и настройки + string UplinkConfig = Path.GetFileName(Assembly.GetExecutingAssembly().Location) + ".config"; + if (File.Exists("SpaceEngineers.exe.config")) + { + File.Copy("SpaceEngineers.exe.config", UplinkConfig, true); + } + + StartSpaceEngineers(args); } catch (Exception e) { - Console.WriteLine("Crashed with exception:"); - Console.WriteLine(e.ToStringDemystified()); - Console.WriteLine("\nPress enter to exit..."); - Console.ReadLine(); + } } + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] + private static void StartSpaceEngineers(string[] args) + { + MyProgram.Main(args); + } } \ No newline at end of file diff --git a/UplinkLauncher/UplinkLauncher.csproj b/UplinkLauncher/UplinkLauncher.csproj index ae9c8d6..da3fd17 100644 --- a/UplinkLauncher/UplinkLauncher.csproj +++ b/UplinkLauncher/UplinkLauncher.csproj @@ -1,36 +1,31 @@ - Exe - net48 + WinExe + net481 Release;Debug x64 x64 latest + true disable enable true false false - true ..\UplinkSE_logo.ico - - + + true + - - false - false - - false - false diff --git a/UplinkSE.sln b/UplinkSE.sln index 5761a6f..340055f 100644 --- a/UplinkSE.sln +++ b/UplinkSE.sln @@ -10,32 +10,35 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFolder", "SolutionFolder", "{F9D624C2-7460-4672-AA31-1E8887084041}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore + build.sh = build.sh + install.sh = install.sh + launch.sh = launch.sh README.md = README.md UplinkSE_logo.ico = UplinkSE_logo.ico UplinkSE_logo.png = UplinkSE_logo.png - install.sh = install.sh - launch.sh = launch.sh - build.sh = build.sh EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Release|x64 = Release|x64 Debug|x64 = Debug|x64 + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2534AAEB-1F27-43F9-86C5-A1726DACB98D}.Release|x64.ActiveCfg = Release|x64 - {2534AAEB-1F27-43F9-86C5-A1726DACB98D}.Release|x64.Build.0 = Release|x64 - {2534AAEB-1F27-43F9-86C5-A1726DACB98D}.Debug|x64.ActiveCfg = Debug|x64 - {2534AAEB-1F27-43F9-86C5-A1726DACB98D}.Debug|x64.Build.0 = Debug|x64 - {28965A64-C9EC-4168-82E2-AE66B5D8A29F}.Release|x64.ActiveCfg = Release|x64 - {28965A64-C9EC-4168-82E2-AE66B5D8A29F}.Release|x64.Build.0 = Release|x64 {28965A64-C9EC-4168-82E2-AE66B5D8A29F}.Debug|x64.ActiveCfg = Debug|x64 {28965A64-C9EC-4168-82E2-AE66B5D8A29F}.Debug|x64.Build.0 = Debug|x64 + {28965A64-C9EC-4168-82E2-AE66B5D8A29F}.Release|x64.ActiveCfg = Release|x64 + {28965A64-C9EC-4168-82E2-AE66B5D8A29F}.Release|x64.Build.0 = Release|x64 + {2534AAEB-1F27-43F9-86C5-A1726DACB98D}.Debug|x64.ActiveCfg = Debug|x64 + {2534AAEB-1F27-43F9-86C5-A1726DACB98D}.Debug|x64.Build.0 = Debug|x64 + {2534AAEB-1F27-43F9-86C5-A1726DACB98D}.Release|x64.ActiveCfg = Release|x64 + {2534AAEB-1F27-43F9-86C5-A1726DACB98D}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {2534AAEB-1F27-43F9-86C5-A1726DACB98D} = {F9D624C2-7460-4672-AA31-1E8887084041} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BCA57FA1-2E0B-4DEA-9C70-E3A9914D76C7} EndGlobalSection diff --git a/UplinkSE/UplinkSE.csproj b/UplinkSE/UplinkSE.csproj index 8232793..dfd467d 100644 --- a/UplinkSE/UplinkSE.csproj +++ b/UplinkSE/UplinkSE.csproj @@ -7,6 +7,7 @@ x64 x64 latest + true disable enable true diff --git a/deploy.ps1 b/deploy.ps1 new file mode 100644 index 0000000..450c208 --- /dev/null +++ b/deploy.ps1 @@ -0,0 +1,34 @@ +$SE_PATH = "" + +#DETECT SE INSTALLATION + function DetectGamepath{ + #CHECK FOR STEAM INSTALLATION + if(Test-Path -Path HKLM:\SOFTWARE\WOW6432Node\Valve\Steam) + { + #GET STEAM PATH FROM REGISTRY + $SteamInstallPath = Get-ItemPropertyValue -Path HKLM:\SOFTWARE\WOW6432Node\Valve\Steam -Name InstallPath + #READ .vdf WITH GAME DRIVE LOCATIONS + $libraryfolders = ("{`n" + ((Get-Content -Path $SteamInstallPath'\steamapps\libraryfolders.vdf' | Out-String) ` + <#COMMIT REGEXAGE TO CONVERT VALVE FORMAT TO JSON#> ` + -replace '"\t\t"', '": "' <# "KEY": "VALUE" #> ` + -replace '"\r\n\s*{', '": {' <# "OBJECT": { #> ` + -replace '"\r\n', "`",`n" <# "VALUE", #> ` + -replace '",\n(\t+)\}', "`"`n`$1}" <# "VALUE" #> ` + -replace '}(\r\n\s*")','},$1') <# }, #> ` + + "}" | ConvertFrom-Json).libraryfolders + #FIND A DRIVE THAT CONTAINS APPID OF 244850 WHICH IS SPACE ENGINEERS AS WE ALL KNOW + foreach ($drive in $libraryfolders.psobject.Properties) + { + if($drive.Value.apps.PSobject.Properties.name -contains "244850") + { + $SE_PATH = $drive.Value.path + '\steamapps\common\SpaceEngineers\Bin64' + } + } + ValidateGamepath + }else{ + #STEAM LIKELY NOT INSTALLED + Write-Output "Steam not detected" + } + } + +Copy-Item \ No newline at end of file