Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 50 additions & 47 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ on:
- 'v*'

jobs:
build-windows-bootstrap:
runs-on: windows-2022
# build-windows-bootstrap:
# runs-on: windows-2022

steps:
- uses: actions/checkout@v3
with:
submodules: false
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: false

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 10.0.x
# - name: Setup .NET
# uses: actions/setup-dotnet@v3
# with:
# dotnet-version: 10.0.x

- name: Publish bootstrap
working-directory: SS14.Launcher.Bootstrap
run: dotnet publish -r win-x64
# - name: Publish bootstrap
# working-directory: SS14.Launcher.Bootstrap
# run: dotnet publish -r win-x64

- uses: actions/upload-artifact@v4
with:
name: "bootstrap"
retention-days: 1
path: "SS14.Launcher.Bootstrap/bin/Release/net10.0-windows/win-x64/publish/SimpleStation14 Launcher.exe"
# - uses: actions/upload-artifact@v4
# with:
# name: "bootstrap"
# retention-days: 1
# path: "SS14.Launcher.Bootstrap/bin/Release/net10.0-windows/win-x64/publish/SimpleStation14 Launcher.exe"

build:
runs-on: ubuntu-latest
needs: build-windows-bootstrap
# needs: build-windows-bootstrap

steps:
- name: Checkout code
Expand All @@ -45,15 +45,18 @@ jobs:
dotnet-version: 10.0.x

- name: Create build (macOS & Linux)
run: ./publish.py osx linux
run: ./publish.py osx # linux

- name: Download Windows Bootstrap
uses: actions/download-artifact@v5
with:
name: "bootstrap"
- name: Debug show files
run: ls -R bin/**

# - name: Download Windows Bootstrap
# uses: actions/download-artifact@v5
# with:
# name: "bootstrap"

- name: Create build (Windows)
run: ./publish.py windows --x64-only
# - name: Create build (Windows)
# run: ./publish.py windows --x64-only

- name: Create Release
id: create_release
Expand All @@ -66,27 +69,27 @@ jobs:
draft: false
prerelease: ${{ contains(github.ref, 'pre') }}

# Upload Linux
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./SS14.Launcher_Linux.zip
asset_name: SS14.Launcher_Linux.zip
asset_content_type: application/zip

# Upload Windows
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./SS14.Launcher_Windows.zip
asset_name: SS14.Launcher_Windows.zip
asset_content_type: application/zip
# # Upload Linux
# - name: Upload Release Asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./SS14.Launcher_Linux.zip
# asset_name: SS14.Launcher_Linux.zip
# asset_content_type: application/zip

# # Upload Windows
# - name: Upload Release Asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./SS14.Launcher_Windows.zip
# asset_name: SS14.Launcher_Windows.zip
# asset_content_type: application/zip

# Upload macOS
- name: Upload Release Asset
Expand Down
13 changes: 11 additions & 2 deletions PublishFiles/SimpleStation14 Launcher.app/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>SS14L</string>
<string>SS14Launcher</string>
<key>CFBundleDisplayName</key>
<string>SimpleStation14 Launcher</string>
<string>SimpleStation14</string>
<key>CFBundleExecutable</key>
<string>SS14</string>
<key>CFBundleIdentifier</key>
<string>com.simplestation14.launcher</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>LSArchitecturePriority</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<!--
Just a note about this icon.
MacOS seems REALLY iffy about this and even when the file is correct,
Expand Down
9 changes: 7 additions & 2 deletions PublishFiles/SimpleStation14 Launcher.app/Contents/MacOS/SS14
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ cd "$BASEDIR"

mkdir -p "$HOME/Library/Application Support/SimpleStation14"

export DOTNET_ROOT="$(pwd)/../Resources/dotnet"
ARCH=$(uname -m)

exec ../Resources/bin/SS14.Launcher "$@" > "$HOME/Library/Application Support/SimpleStation14/launcher.log"
export DOTNET_ROOT="$(pwd)/../Resources/$ARCH/dotnet"

# Why do we invoke dotnet with the dll, instead of the apphost?
# Because for some reason, the ARM64 apphost is broken when published by GitHub Actions.
# Idk dude. This works.
exec "$DOTNET_ROOT/dotnet" ../Resources/$ARCH/bin/SS14.Launcher.dll "$@" > "$HOME/Library/Application Support/SimpleStation14/launcher.log"
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>SS14LO</string>
<string>SS14Loader</string>
<key>CFBundleDisplayName</key>
<string>SimpleStation14</string>
<key>CFBundleExecutable</key>
<string>SS14</string>
<key>CFBundleIdentifier</key>
<string>com.simplestation14.loader</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>LSArchitecturePriority</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<!--
Just a note about this icon.
MacOS seems REALLY iffy about this and even when the file is correct,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# cd to file containing script or something?
BASEDIR=$(dirname "$0")
echo "$BASEDIR"
cd "$BASEDIR"

# Why do we invoke dotnet with the dll, instead of the apphost?
# Because for some reason, the ARM64 apphost is broken when published by GitHub Actions.
# Idk dude. This works.
DOTNET_PATH="$DOTNET_ROOT/dotnet"
LOADER_PATH="../Resources/$(uname -m)/bin/SS14.Loader.dll"

if [[ -z ${SS14_LOG_CLIENT} ]]; then
# No log path
exec "$DOTNET_PATH" "$LOADER_PATH" "$@"
else
exec "$DOTNET_PATH" "$LOADER_PATH" "$@" > "$SS14_LOG_CLIENT" 2>&1
fi
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
8 changes: 6 additions & 2 deletions SS14.Launcher/Models/Connector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@
if (info != null && info.AuthInformation.Mode != AuthMode.Disabled && _loginManager.ActiveAccount != null)
{
var account = _loginManager.Logins.Items.FirstOrDefault(l =>
info.AuthInformation.LoginUrls?.Contains(l.ServerUrl) ?? l.Server == ConfigConstants.FallbackAuthServer);

Check warning on line 349 in SS14.Launcher/Models/Connector.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'item' in 'bool List<string>.Contains(string item)'.

Check warning on line 349 in SS14.Launcher/Models/Connector.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'item' in 'bool List<string>.Contains(string item)'.
var authServers = info.AuthInformation.LoginUrls?.ToString() ??
"(Fallback) " + LoginManager.GetAuthServerById(ConfigConstants.FallbackAuthServer).AuthUrl;
if (account == null)
Expand All @@ -355,7 +355,7 @@
return null;
}
if (account != _loginManager.ActiveAccount &&
!info.AuthInformation.LoginUrls?.Contains(_loginManager.ActiveAccount.ServerUrl) == true)

Check warning on line 358 in SS14.Launcher/Models/Connector.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'item' in 'bool List<string>.Contains(string item)'.

Check warning on line 358 in SS14.Launcher/Models/Connector.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'item' in 'bool List<string>.Contains(string item)'.
{
Log.Warning("Using different account than the active one due to server requiring a different account provider: {Server}", string.Join(", ", authServers));
_loginManager.ActiveAccount = account;
Expand Down Expand Up @@ -728,7 +728,11 @@

if (release)
{
basePath = Path.Combine(LauncherPaths.DirLauncherInstall, "loader");
basePath = LauncherPaths.DirLauncherInstall;
if (OperatingSystem.IsMacOS())
basePath = Path.Combine(basePath, "..", "..");
else
basePath = Path.Combine(basePath, "loader");
}
else
{
Expand Down Expand Up @@ -763,7 +767,7 @@
{
if (release)
{
var appPath = Path.Combine(basePath, "SimpleStation14.app");
var appPath = Path.GetFullPath(Path.Combine(basePath, "SimpleStation14.app"));
Log.Debug("Using app bundle: {appPath}", appPath);

Log.Debug("Clearing quarantine on loader.");
Expand All @@ -782,7 +786,7 @@
RedirectStandardOutput = true
});

PipeLogOutput(xattr);

Check warning on line 789 in SS14.Launcher/Models/Connector.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'process' in 'void Connector.PipeLogOutput(Process process)'.

await xattr.WaitForExitAsync();

Expand Down
33 changes: 12 additions & 21 deletions SS14.Loader/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using NSec.Cryptography;
using Robust.LoaderApi;


namespace SS14.Loader;

internal enum ExitCode : int
Expand All @@ -27,11 +26,6 @@ internal class Program

private readonly IFileApi _fileApi;

/// <summary>
/// Main Program class constructor. Loads assembly contexts.
/// </summary>
/// <param name="robustPath"></param>
/// <param name="engineArgs"></param>
private Program(string robustPath, string[] engineArgs)
{
_engineArgs = engineArgs;
Expand All @@ -43,7 +37,7 @@ private Program(string robustPath, string[] engineArgs)
var prefix = "";
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
prefix = "SimpleStation14.app/Contents/Resources/";
prefix = "Space Station 14.app/Contents/Resources/";
}

_fileApi = new ZipFileApi(zipArchive, prefix);
Expand All @@ -59,22 +53,22 @@ private IntPtr LoadContextOnResolvingUnmanaged(Assembly assembly, string unmanag
return IntPtr.Zero;
}

/// <summary>
/// Runs the program.
/// </summary>
/// <returns></returns>
private bool Run()
{
if (!TryOpenAssembly(RobustAssemblyName, out Assembly? clientAssembly))
if (!TryOpenAssembly(RobustAssemblyName, out var clientAssembly))
{
Console.WriteLine("Unable to locate Robust.Client.dll in engine build!");
Console.WriteLine($"Unable to locate {RobustAssemblyName} assembly in engine build!");
return false;
}

if (!TryGetLoader(clientAssembly, out var loader))
return false;

#if USE_SYSTEM_SQLITE
SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_sqlite3());
#else
SQLitePCL.Batteries_V2.Init();
#endif

var launcher = Environment.GetEnvironmentVariable("SS14_LAUNCHER_PATH");
var redialApi = launcher != null ? new RedialApi(launcher) : null;
Expand Down Expand Up @@ -112,7 +106,6 @@ private bool Run()
contentApi?.Dispose();
overlayApi?.Dispose();
}

return true;
}

Expand All @@ -134,7 +127,7 @@ private static bool TryGetLoader(Assembly clientAssembly, [NotNullWhen(true)] ou
return false;
}

loader = (ILoaderEntryPoint)Activator.CreateInstance(type)!;
loader = (ILoaderEntryPoint) Activator.CreateInstance(type)!;
return true;
}

Expand Down Expand Up @@ -170,11 +163,10 @@ private bool TryOpenAssemblyStream(string name, [NotNullWhen(true)] out Stream?
[STAThread]
internal static int Main(string[] args)
{
// TEMP: Arguments can be parsed separately for tighter error handling.
if (args.Length < 3)
{
Console.WriteLine("Usage: SS14.Loader <robustPath> <signature> <public key> [engineArg [engineArg...]]");
return (int)ExitCode.InvalidSignature;
return (int) ExitCode.InvalidSignature;
}

var robustPath = args[0];
Expand All @@ -201,17 +193,16 @@ internal static int Main(string[] args)
#endif
{
Console.WriteLine("Failed to verify engine signature!");
return (int)ExitCode.InvalidSignature;
return (int) ExitCode.InvalidSignature;
}
}

var program = new Program(robustPath, args[3..]);
if (!program.Run())
{
return (int)ExitCode.FailedProgramExecution;
return (int) ExitCode.FailedProgramExecution;
}

// WIP: Remove if not needed.
/*Console.WriteLine("lsasm dump:");
foreach (var asmLoadContext in AssemblyLoadContext.All)
{
Expand All @@ -222,6 +213,6 @@ internal static int Main(string[] args)
}
}*/

return (int)ExitCode.Success;
return (int) ExitCode.Success;
}
}
Loading
Loading