Skip to content

Commit e0d57e1

Browse files
committed
Update Steamworks.NET and steam_api
This allows mods to make use of the newer features provided by Steamworks.NET.
1 parent dfe0912 commit e0d57e1

5 files changed

Lines changed: 21 additions & 6 deletions

File tree

MiniInstaller/DepCalls.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ public static void ConvertToNETCore(string asmFrom, string asmTo = null, HashSet
105105
foreach (string dep in deps) {
106106
string srcDepPath = Path.Combine(Path.GetDirectoryName(asmFrom), $"{dep}.dll");
107107
string dstDepPath = Path.Combine(Path.GetDirectoryName(asmTo), $"{dep}.dll");
108-
if (File.Exists(srcDepPath) && !MiscUtil.IsSystemLibrary(srcDepPath))
108+
// Don't convert steamworks - doing so would copy it from the vanilla backup location instead of taking our updated version.
109+
bool isSteamworks = MiscUtil.IsSteamworksNet(srcDepPath);
110+
if (File.Exists(srcDepPath) && !MiscUtil.IsSystemLibrary(srcDepPath) && !isSteamworks)
109111
ConvertToNETCore(srcDepPath, dstDepPath, convertedAsms);
110-
else if (File.Exists(dstDepPath) && !MiscUtil.IsSystemLibrary(srcDepPath))
112+
else if (File.Exists(dstDepPath) && !MiscUtil.IsSystemLibrary(srcDepPath) && !isSteamworks)
111113
ConvertToNETCore(dstDepPath, convertedAsms: convertedAsms);
112114
}
113115

MiniInstaller/LibAndDepHandling.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,38 @@ public static void DeleteSystemLibs() {
2626
public static void SetupNativeLibs() {
2727
string[] libSrcs; // Later entries take priority
2828
string libDstDir;
29+
string steamworksLibSrc;
2930
Dictionary<string, string> dllMap = new Dictionary<string, string>();
3031

3132
switch (Globals.Platform) {
3233
case Globals.InstallPlatform.Windows: {
3334
// Setup Windows native libs
3435
if (Environment.Is64BitOperatingSystem) {
36+
steamworksLibSrc = Path.Combine(Globals.PathEverestLib, "lib64-win-x64", "Steamworks.NET.dll");
3537
libSrcs = new string[] { Path.Combine(Globals.PathEverestLib, "lib64-win-x64"), Path.Combine(Globals.PathGame, "runtimes", "win-x64", "native") };
3638
libDstDir = Path.Combine(Globals.PathGame, "lib64-win-x64");
3739
dllMap.Add("fmodstudio64.dll", "fmodstudio.dll");
3840
} else {
3941
// We can take some native libraries from the vanilla install
42+
steamworksLibSrc = Path.Combine(Globals.PathEverestLib, "lib64-win-x86", "Steamworks.NET.dll");
4043
libSrcs = new string[] {
41-
Path.Combine(Globals.PathOrig, "fmod.dll"), Path.Combine(Globals.PathOrig, "fmodstudio.dll"), Path.Combine(Globals.PathOrig, "steam_api.dll"),
44+
Path.Combine(Globals.PathOrig, "fmod.dll"), Path.Combine(Globals.PathOrig, "fmodstudio.dll"),
4245
Path.Combine(Globals.PathEverestLib, "lib64-win-x86"), Path.Combine(Globals.PathGame, "runtimes", "win-x86", "native")
4346
};
4447
libDstDir = Path.Combine(Globals.PathGame, "lib64-win-x86");
4548
}
4649
} break;
4750
case Globals.InstallPlatform.Linux: {
4851
// Setup Linux native libs
52+
steamworksLibSrc = Path.Combine(Globals.PathEverestLib, "lib64-linux", "Steamworks.NET.dll");
4953
libSrcs = new string[] { Path.Combine(Globals.PathOrig, "lib64"), Path.Combine(Globals.PathEverestLib, "lib64-linux"), Path.Combine(Globals.PathGame, "runtimes", "linux-x64", "native") };
5054
libDstDir = Path.Combine(Globals.PathGame, "lib64-linux");
5155
MiscUtil.ParseMonoNativeLibConfig(Path.Combine(Globals.PathOrig, "Celeste.exe.config"), "linux", dllMap, "lib{0}.so");
5256
MiscUtil.ParseMonoNativeLibConfig(Path.Combine(Globals.PathOrig, "FNA.dll.config"), "linux", dllMap, "lib{0}.so");
5357
} break;
5458
case Globals.InstallPlatform.MacOS:{
5559
// Setup MacOS native libs
60+
steamworksLibSrc = Path.Combine(Globals.PathEverestLib, "lib64-osx", "Steamworks.NET.dll");
5661
libSrcs = new string[] { Path.Combine(Globals.PathOrig, "osx"), Path.Combine(Globals.PathEverestLib, "lib64-osx"), Path.Combine(Globals.PathGame, "runtimes", "osx", "native") };
5762
libDstDir = Path.Combine(Globals.PathGame, "lib64-osx");
5863
MiscUtil.ParseMonoNativeLibConfig(Path.Combine(Globals.PathOrig, "Celeste.exe.config"), "osx", dllMap, "lib{0}.dylib");
@@ -99,6 +104,11 @@ void CopyNativeLib(string src, string dst) {
99104
}
100105
}
101106

107+
// Copy our Steamworks.NET.dll
108+
string steamworksLibDst = Path.Combine(Globals.PathGame, "Steamworks.NET.dll");
109+
File.Delete(steamworksLibDst);
110+
File.Copy(steamworksLibSrc, steamworksLibDst);
111+
102112
// Delete old libraries
103113
foreach (string libFile in Globals.WindowsNativeLibFileNames)
104114
File.Delete(Path.Combine(Globals.PathGame, libFile));
@@ -270,4 +280,4 @@ public static void SetupAppHosts(string appExe, string appDll, string resDll = n
270280
} break;
271281
}
272282
}
273-
}
283+
}

MiniInstaller/MiscUtil.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ public static bool IsSystemLibrary(string file) {
6464
"Mono.Security.dll"
6565
}.Any(name => Path.GetFileName(file).Equals(name, StringComparison.OrdinalIgnoreCase));
6666
}
67-
67+
68+
public static bool IsSteamworksNet(string file) {
69+
return Path.GetFileName(file).Equals("Steamworks.NET.dll", StringComparison.OrdinalIgnoreCase);
70+
}
6871
// This is not "pure" but I guess it also somewhat fits here
6972
public static void MoveExecutable(string srcPath, string dstPath) {
7073
File.Delete(dstPath);

lib-stripped/Steamworks.NET.dll

132 KB
Binary file not shown.

0 commit comments

Comments
 (0)