Skip to content

Commit

Permalink
Make Sybaris patchers path configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
ghorsington committed Jun 21, 2018
1 parent e1491f4 commit f22ec80
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore


lib/*.dll

# User-specific files
*.suo
*.user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BepInEx">
<HintPath>..\lib\BepInEx.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.0\lib\net35\Mono.Cecil.dll</HintPath>
<Private>False</Private>
Expand Down
7 changes: 6 additions & 1 deletion BepInEx.SybarisLoader.Patcher/SybarisLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public static class Loader
{
private static Dictionary<string, List<MethodInfo>> patchersDictionary;


private static IEnumerable<string> _targetDLLs = null;

public static IEnumerable<string> TargetDLLs
Expand All @@ -37,6 +36,12 @@ private static void Init()

patchersDictionary = new Dictionary<string, List<MethodInfo>>(StringComparer.InvariantCultureIgnoreCase);

if (!Directory.Exists(Utils.SybarisDir))
{
Trace.TraceWarning($"{Utils.SybarisDir} does not exist! Creating one...");
return;
}

Trace.TraceInformation($"Loading patchers from \"{Utils.SybarisDir}\"");

foreach (string dll in Directory.GetFiles(Utils.SybarisDir, "*.Patcher.dll"))
Expand Down
6 changes: 4 additions & 2 deletions BepInEx.SybarisLoader.Patcher/Util/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ public static class Utils
/// <summary>
/// Patches directory for Sybaris.
/// </summary>
public static string SybarisDir { get; } = // Another solution would be to use native GetModuleFileName, since we're running in the game's process anyway
Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName), "Sybaris"));
public static string SybarisDir { get; }
= // Another solution would be to use native GetModuleFileName, since we're running in the game's process anyway
Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName),
Config.GetEntry("sybaris-patches-location", "Sybaris", "org.bepinex.patchers.sybarisloader")));

/// <summary>
/// Try to resolve and load the given assembly DLL.
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@ This is a patcher for [BepInEx 4.0](https://github.com/BepInEx/BepInEx) that all

## Installation

Put `BepInEx.SybarisLoader.Patcher.dll` into `BepInEx\patchers` folder.
1. Put `BepInEx.SybarisLoader.Patcher.dll` into `BepInEx\patchers` folder.

2. Add and **modify** the following options in the `BepInEx\config.ini`:

```ini
[org.bepinex.patchers.sybarisloader]
; Location of Sybaris patchers
; For Sybaris 2 this should be Sybaris
; For Sybaris 1 this should be Sybaris\Loader
sybaris-patches-location=Sybaris
```


Put Sybaris patches into `Sybaris` folder as you have done before.

Expand Down

0 comments on commit f22ec80

Please sign in to comment.