-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from seionmoya/client-modloader
[WIP] Initial client modloader
- Loading branch information
Showing
6 changed files
with
128 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net48</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="NLog" HintPath="References/NLog.dll" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Fuyu.Common\Fuyu.Common.csproj" /> | ||
<ProjectReference Include="..\Fuyu.DependencyInjection\Fuyu.DependencyInjection.csproj" /> | ||
<ProjectReference Include="..\Fuyu.Modding\Fuyu.Modding.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using NLog; | ||
using NLog.Targets; | ||
using Fuyu.Common.IO; | ||
using Fuyu.DependencyInjection; | ||
using Fuyu.Modding; | ||
|
||
[Target(nameof(FuyuClient))] | ||
public sealed class FuyuClient : TargetWithLayout | ||
{ | ||
protected override void InitializeTarget() | ||
{ | ||
var container = new DependencyContainer(); | ||
|
||
CheckIncompatibleSoftware(); | ||
|
||
Terminal.WriteLine("Loading mods..."); | ||
ModManager.Instance.AddMods("./Fuyu/Mods"); | ||
ModManager.Instance.Load(container).GetAwaiter().GetResult(); | ||
Terminal.WriteLine("Finished loading mods"); | ||
|
||
// TODO: OnApplicationQuit | ||
// -- seionmoya, 20205-01-04 | ||
} | ||
|
||
private void CheckIncompatibleSoftware() | ||
{ | ||
var record = new Dictionary<string, string>() | ||
{ | ||
{ "BepInEx/", "BepInEx" }, | ||
{ "MelonLoader/", "MelonLoader" }, | ||
{ "SPT.Launcher/", "SPTarkov" }, | ||
{ "monomod.exe", "MonoMod" }, | ||
{ "MonoMod.RuntimeDetour.HookGen.exe", "MonoMod" } | ||
// TODO: UnityModManager, UMF | ||
}; | ||
|
||
foreach (var kvp in record) | ||
{ | ||
if (VFS.Exists(kvp.Key)) | ||
{ | ||
throw new Exception($"{kvp.Value} found. Please remove the software from the client before proceeding."); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Fuyu.Client.NLog | ||
|
||
Fuyu mod loader for clients using NLog. | ||
|
||
## Installation | ||
|
||
1. Build the project | ||
2. Place `Fuyu.Client.NLog` inside `<game data>/Managed/` | ||
3. Place `NLog.dll` inside `<game data>/Managed/`, override when prompted | ||
4. Add the following to `NLog/NLog.config`: | ||
|
||
```xml | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" | ||
autoReload="true" | ||
throwExceptions="true" | ||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log"> | ||
|
||
<extensions> | ||
<add assembly="Fuyu.Client.NLog"/> | ||
</extensions> | ||
|
||
<targets async="true"> | ||
<target name="FuyuTarget" xsi:type="FuyuTarget" /> | ||
<!-- ... --> | ||
</targets> | ||
|
||
<rules> | ||
<logger name="FuyuTarget" minlevel="Off" writeTo="traceFile" /> | ||
<!-- ... --> | ||
</rules> | ||
</nlog> | ||
``` | ||
|
||
## FAQ | ||
|
||
> Why not BepInEx / Monomod / Unity Mod Manager / MelonLoader? | ||
Fuyu is designed to function with as little dependencies as possible to run, | ||
especially not depending on external projects. With it's own loader, Fuyu also | ||
gains more control over mod loading. | ||
|
||
> Why does the project include a NLog version? | ||
EFT removed `LoadNLogExtensionAssemblies` in their build, thus we have to use | ||
the version from the reference folder (NLog 4.7.15, netstandard2.0). |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters