Skip to content
Closed
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
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
path = HarmonyX
url = https://github.com/ResoniteModding/HarmonyX.git
branch = patchy
[submodule "Hardware.Info"]
path = Hardware.Info
url = https://github.com/ResoniteModding/Hardware.Info.git
branch = patchy
1 change: 0 additions & 1 deletion Hardware.Info
Submodule Hardware.Info deleted from b0e99d
9 changes: 9 additions & 0 deletions Runtimes/NET/BepisLoader/BepisLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

namespace BepisLoader;

public class BepisLoader

Check warning on line 7 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'BepisLoader'

Check warning on line 7 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'BepisLoader'
{
internal static string resoDir = string.Empty;
private static readonly string tfmFolder = "net10.0";
internal static AssemblyLoadContext alc = null!;
static void Main(string[] args)
{
resoDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

Check warning on line 14 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.

Check warning on line 14 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.
#if DEBUG
logPath = Path.Combine(resoDir, "BepisLoader.log");
File.WriteAllText(logPath, "BepisLoader started\n");
Expand All @@ -18,6 +19,14 @@

alc = new BepisLoadContext();

// Load System.Management explicitly for Windows to avoid PlatformNotSupportedException
var systemManagementPath = RuntimeInformation.RuntimeIdentifier.StartsWith("win")
? new FileInfo(Path.Combine(resoDir, "runtimes", "win", "lib", tfmFolder, "System.Management.dll"))

Check warning on line 24 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'paths' in 'string Path.Combine(params ReadOnlySpan<string> paths)'.

Check warning on line 24 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'paths' in 'string Path.Combine(params ReadOnlySpan<string> paths)'.
: new FileInfo(Path.Combine(resoDir, "System.Management.dll"));

Check warning on line 25 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'.

Check warning on line 25 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'.

if (systemManagementPath.Exists)
alc.LoadFromAssemblyPath(systemManagementPath.FullName);

// TODO: removing this breaks stuff, idk why
AppDomain.CurrentDomain.AssemblyResolve += ResolveGameDll;

Expand All @@ -35,8 +44,8 @@
if (!File.Exists(resoDllPath)) resoDllPath = Path.Combine(resoDir, "Resonite.dll");

var t = asm.GetType("StartupHook");
var m = t.GetMethod("Initialize", BindingFlags.Public | BindingFlags.Static, [typeof(string), typeof(string), typeof(AssemblyLoadContext)]);

Check warning on line 47 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

Check warning on line 47 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.
m.Invoke(null, [resoDllPath, bepinPath, alc]);

Check warning on line 48 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

Check warning on line 48 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

// Find and load Resonite
var resoAsm = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x => x.GetName().Name == "Renderite.Host");
Expand Down Expand Up @@ -157,7 +166,7 @@
private static string logPath;
private static object _lock = new object();
#endif
public static void Log(string message)

Check warning on line 169 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'BepisLoader.Log(string)'

Check warning on line 169 in Runtimes/NET/BepisLoader/BepisLoader.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'BepisLoader.Log(string)'
{
#if DEBUG
lock (_lock)
Expand Down
10 changes: 0 additions & 10 deletions Runtimes/NET/BepisLoader/BepisLoader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@
<DebugType>embedded</DebugType>
</PropertyGroup>

<ItemGroup>
<Compile Remove="..\..\..\Hardware.Info\**" />
<EmbeddedResource Remove="..\..\..\Hardware.Info\**" />
<None Remove="..\..\..\Hardware.Info\**" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\Hardware.Info\Hardware.Info\Hardware.Info.csproj" />
</ItemGroup>

<Target Name="RemoveExeAfterBuild" AfterTargets="Build">
<Delete Condition="Exists('$(TargetDir)$(AssemblyName).exe')" Files="$(TargetDir)$(AssemblyName).exe" />
<Delete Condition="Exists('$(TargetDir)$(AssemblyName)')" Files="$(TargetDir)$(AssemblyName)" />
Expand Down
Loading