Skip to content

Commit 6a836e9

Browse files
authored
Merge pull request #1 from ResoniteModding/fix-headless
Fix Headless Server
2 parents 074ef22 + 61fe27d commit 6a836e9

3 files changed

Lines changed: 21 additions & 11 deletions

File tree

BepInExResoniteShim.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
using Elements.Core;
66
using FrooxEngine;
77
using HarmonyLib;
8-
using Renderite.Host;
98
using System.Reflection;
109
using System.Reflection.Emit;
11-
using System.Reflection.Metadata.Ecma335;
1210

1311
namespace BepInExResoniteShim;
1412

@@ -52,16 +50,15 @@ public override void Load()
5250
}
5351

5452
Logger = Log;
55-
HarmonyInstance.PatchAll();
56-
}
57-
58-
[HarmonyPatch(typeof(GraphicalClientRunner), MethodType.StaticConstructor)]
59-
public class AppPathFixer
60-
{
61-
public static void Postfix(ref string ___AssemblyDirectory)
53+
try
6254
{
63-
___AssemblyDirectory = Paths.GameRootPath;
55+
GraphicalClientPatches.ApplyPatch();
6456
}
57+
catch (Exception e)
58+
{
59+
Logger.LogInfo("Failed to apply GraphicalClientPatches (This is normal on headless server): " + e);
60+
}
61+
HarmonyInstance.PatchAll();
6562
}
6663

6764
[HarmonyPatch]

BepInExResoniteShim.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<Version>0.8.0</Version>
4+
<Version>0.8.1</Version>
55
<TargetFramework>net9.0</TargetFramework>
66
<Authors>ResoniteModding</Authors>
77
<Product>BepInEx Resonite Shim</Product>

GraphicalClientPatches.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using BepInEx;
2+
using HarmonyLib;
3+
using Renderite.Host;
4+
5+
namespace BepInExResoniteShim;
6+
7+
public static class GraphicalClientPatches
8+
{
9+
public static void ApplyPatch()
10+
{
11+
AccessTools.Field(typeof(GraphicalClientRunner), "AssemblyDirectory").SetValue(null, Paths.GameRootPath);
12+
}
13+
}

0 commit comments

Comments
 (0)