Browse Source

Made BSIPA game agnostic

pull/46/head
Anairkoen Schno 5 years ago
parent
commit
12263d56c0
3 changed files with 20 additions and 5 deletions
  1. +1
    -1
      Doorstop
  2. +7
    -3
      IPA.Injector/Injector.cs
  3. +12
    -1
      IPA.Loader/Utilities/BeatSaber.cs

+ 1
- 1
Doorstop

@ -1 +1 @@
Subproject commit 37db1fce3e2f398c2e181fe5e1135bc0637125ec
Subproject commit 0f76cf26a2f84c6cd82a1c7a1d773c10be6ba233

+ 7
- 3
IPA.Injector/Injector.cs View File

@ -85,9 +85,13 @@ namespace IPA.Injector
private static void InstallBootstrapPatch()
{
var cAsmName = Assembly.GetExecutingAssembly().GetName();
var managedPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var dataDir = new DirectoryInfo(managedPath).Parent.Name;
var gameName = dataDir.Substring(0, dataDir.Length - 5);
loader.Debug("Finding backup");
var backupPath = Path.Combine(Environment.CurrentDirectory, "IPA", "Backups", "Beat Saber");
var backupPath = Path.Combine(Environment.CurrentDirectory, "IPA", "Backups", gameName);
var bkp = BackupManager.FindLatestBackup(backupPath);
if (bkp == null)
loader.Warn("No backup found! Was BSIPA installed using the installer?");
@ -97,7 +101,7 @@ namespace IPA.Injector
#region Insert patch into UnityEngine.CoreModule.dll
{
var unityPath = Path.Combine(Environment.CurrentDirectory, "Beat Saber_Data", "Managed",
var unityPath = Path.Combine(managedPath,
"UnityEngine.CoreModule.dll");
var unityAsmDef = AssemblyDefinition.ReadAssembly(unityPath, new ReaderParameters
@ -188,7 +192,7 @@ namespace IPA.Injector
loader.Debug("Ensuring Assembly-CSharp is virtualized");
{
var ascPath = Path.Combine(Environment.CurrentDirectory, "Beat Saber_Data", "Managed",
var ascPath = Path.Combine(managedPath,
"Assembly-CSharp.dll");
#region Virtualize Assembly-CSharp.dll


+ 12
- 1
IPA.Loader/Utilities/BeatSaber.cs View File

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Reflection;
using UnityEngine;
using Version = SemVer.Version;
@ -36,10 +37,20 @@ namespace IPA.Utilities
/// </summary>
public static Release ReleaseType => (_releaseCache ?? (_releaseCache = FindSteamVRAsset() ? Release.Steam : Release.Oculus)).Value;
private static string _installRoot;
/// <summary>
/// The path to the Beat Saber install dir
/// </summary>
public static string InstallPath => Environment.CurrentDirectory;
public static string InstallPath
{
get
{
if (_installRoot == null)
_installRoot = Path.GetFullPath(
Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..", ".."));
return _installRoot;
}
}
/// <summary>
/// The path to the `Libs` folder. Use only if necessary.
/// </summary>


Loading…
Cancel
Save