diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..a7fb7ac
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,2 @@
+patreon: xen42
+custom: ["https://paypal.me/xen42"]
\ No newline at end of file
diff --git a/DredgeVR/DredgeVR.csproj b/DredgeVR/DredgeVR.csproj
index e20c5c3..281d114 100644
--- a/DredgeVR/DredgeVR.csproj
+++ b/DredgeVR/DredgeVR.csproj
@@ -12,7 +12,7 @@
false
x86
net48
- default
+ latest
true
false
false
@@ -25,6 +25,9 @@
Always
+
+ Always
+
@@ -37,11 +40,4 @@
-
-
-
-
-
-
-
diff --git a/DredgeVR/Helpers/FileHelper.cs b/DredgeVR/Helpers/FileHelper.cs
new file mode 100644
index 0000000..3ed6d56
--- /dev/null
+++ b/DredgeVR/Helpers/FileHelper.cs
@@ -0,0 +1,35 @@
+using System;
+using System.IO;
+
+namespace DredgeVR.Helpers;
+
+public static class FileHelper
+{
+ public static void Copy(string sourceDirectory, string targetDirectory)
+ {
+ DirectoryInfo diSource = new DirectoryInfo(sourceDirectory);
+ DirectoryInfo diTarget = new DirectoryInfo(targetDirectory);
+
+ CopyAll(diSource, diTarget);
+ }
+
+ public static void CopyAll(DirectoryInfo source, DirectoryInfo target)
+ {
+ Directory.CreateDirectory(target.FullName);
+
+ // Copy each file into the new directory.
+ foreach (FileInfo fi in source.GetFiles())
+ {
+ Console.WriteLine(@"Copying {0}\{1}", target.FullName, fi.Name);
+ fi.CopyTo(Path.Combine(target.FullName, fi.Name), true);
+ }
+
+ // Copy each subdirectory using recursion.
+ foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
+ {
+ DirectoryInfo nextTargetSubDir =
+ target.CreateSubdirectory(diSourceSubDir.Name);
+ CopyAll(diSourceSubDir, nextTargetSubDir);
+ }
+ }
+}
diff --git a/DredgeVR/Loader.cs b/DredgeVR/Loader.cs
index 5418d4f..a3f2809 100644
--- a/DredgeVR/Loader.cs
+++ b/DredgeVR/Loader.cs
@@ -8,11 +8,20 @@
using UnityEngine;
using UnityEngine.XR.Management;
using Valve.VR;
+using System.Runtime.CompilerServices;
namespace DredgeVR
{
public class Loader
{
+ // Confuses me that the mod dll counts as the executing assembly
+ // Might change if we were using a different mod loader
+ // Should update Winch to provide these paths if it doesn't already
+ public static string DredgeVRFolder => Directory.GetParent(Assembly.GetExecutingAssembly().Location).FullName;
+
+ // Bit hacky but eh
+ public static string DredgeFolder => Directory.GetParent(Assembly.GetExecutingAssembly().Location).Parent.Parent.FullName;
+
public static void Initialize()
{
OptionsManager.Load();
@@ -26,6 +35,14 @@ public static void Initialize()
new Harmony("DredgeVR").PatchAll();
}
+ ///
+ /// This runs when the assembly is loaded
+ ///
+ public static void Preload()
+ {
+ FileHelper.Copy(Path.Combine(DredgeVRFolder, "CopyToGame"), Path.Combine(DredgeFolder, "DREDGE_Data"));
+ }
+
private static void SetUpXr()
{
SteamVR_Actions.PreInitialize();
@@ -54,8 +71,7 @@ private static void SetUpXr()
// SteamVR_Settings.instance.pauseGameWhenDashboardVisible = true;
// Makes it so that Dredge appears as a VR game in your Steam Home
- var dredgeFolder = Directory.GetParent(Assembly.GetExecutingAssembly().Location).Parent.Parent.FullName;
- var manifestPath = Path.Combine(dredgeFolder, @"DREDGE_Data\StreamingAssets\dredge.vrmanifest");
+ var manifestPath = Path.Combine(DredgeFolder, @"DREDGE_Data\StreamingAssets\dredge.vrmanifest");
ApplicationManifestHelper.UpdateManifest(manifestPath,
"steam.app.1562430",
"https://steamcdn-a.akamaihd.net/steam/apps/1562430/header.jpg",
diff --git a/DredgeVR/mod_meta.json b/DredgeVR/mod_meta.json
index 93702dd..46662e7 100644
--- a/DredgeVR/mod_meta.json
+++ b/DredgeVR/mod_meta.json
@@ -3,6 +3,7 @@
"ModGUID": "xen.DredgeVR",
"Version": "0.2.0",
"ModAssembly": "DredgeVR.dll",
- "MinWinchVersion": "0.2.3",
- "Entrypoint": "DredgeVR.Loader/Initialize"
+ "MinWinchVersion": "0.3.0",
+ "Entrypoint": "DredgeVR.Loader/Initialize",
+ "Preload": "DredgeVR.Loader/Preload"
}