Skip to content

Commit 3a7ac3a

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 67f18be commit 3a7ac3a

6 files changed

Lines changed: 21 additions & 9 deletions

File tree

Celeste.Mod.mm/Celeste.Mod.mm.csproj

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626
<HintPath>..\lib-stripped\FNA.dll</HintPath>
2727
<Private>False</Private>
2828
</Reference>
29-
<Reference Include="Steamworks.NET">
30-
<HintPath>..\lib-stripped\Steamworks.NET.dll</HintPath>
31-
<Private>False</Private>
32-
</Reference>
3329
</ItemGroup>
3430

3531
<ItemGroup>
@@ -45,6 +41,7 @@
4541
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
4642
<ProjectReference Include="..\external\NLua\build\net6.0\NLua.net6.0.csproj" />
4743
<PackageReference Include="MAB.DotIgnore" Version="3.0.2" />
44+
<PackageReference Include="Steamworks.NET" Version="2024.8.0" />
4845

4946
<!-- Dependency not used by Everest itself, but kept for mod compatibility reasons -->
5047
<PackageReference Include="DotNetZip" Version="1.16.0" />

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: 11 additions & 1 deletion
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.PathGame, "runtimes", "win-x64", "lib", "netstandard2.1", "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.PathGame, "runtimes", "win-x86", "lib", "netstandard2.1", "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.PathGame, "runtimes", "linux-x86", "lib", "netstandard2.1", "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.PathGame, "runtimes", "osx-x64", "lib", "netstandard2.1", "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));

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

-188 KB
Binary file not shown.

0 commit comments

Comments
 (0)