Browse Source

Mods now get moved to a new location after updates

pull/12/head
Anairkoen Schno 5 years ago
parent
commit
3ee8070f82
17 changed files with 115 additions and 42 deletions
  1. +0
    -1
      BSIPA-ModList/UI/ViewControllers/ModInfoViewController.cs
  2. +8
    -3
      IPA.Injector/Injector.cs
  3. +9
    -2
      IPA.Loader/Config/SelfConfig.cs
  4. +6
    -2
      IPA.Loader/JsonConverters/SemverVersionConverter.cs
  5. +0
    -2
      IPA.Loader/Loader/Composite/CompositeBSPlugin.cs
  6. +13
    -3
      IPA.Loader/Loader/Features/Feature.cs
  7. +2
    -0
      IPA.Loader/Loader/PluginComponent.cs
  8. +17
    -3
      IPA.Loader/Loader/PluginLoader.cs
  9. +35
    -23
      IPA.Loader/Loader/PluginManager.cs
  10. +1
    -1
      IPA.Loader/Loader/manifest.json
  11. +1
    -1
      IPA/Program.cs
  12. BIN
      Refs/Assembly-CSharp.dll
  13. BIN
      Refs/BeatSaberCustomUI.dll
  14. +22
    -0
      Refs/BeatSaberCustomUI.xml
  15. BIN
      Refs/Unity.TextMeshPro.dll
  16. BIN
      Refs/UnityEngine.CoreModule.dll
  17. +1
    -1
      appveyor.yml

+ 0
- 1
BSIPA-ModList/UI/ViewControllers/ModInfoViewController.cs View File

@ -171,7 +171,6 @@ namespace BSIPA_ModList.UI
{
private TextMeshProUGUI titleText;
private TextMeshProUGUI authorText;
private TextMeshProUGUI descText;
private Image icon;
public void Init(ModInfoViewController controller)


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

@ -183,8 +183,8 @@ namespace IPA.Injector
bkp?.Add(unityPath);
unityAsmDef.Write(unityPath);
}
else
return; // shortcut
/*else
return; // shortcut*/
}
#endregion Insert patch into UnityEngine.CoreModule.dll
@ -206,7 +206,8 @@ namespace IPA.Injector
#region Anti-Yeet
if (SelfConfig.SelfConfigRef.Value.ApplyAntiYeet)
//if (SelfConfig.SelfConfigRef.Value.ApplyAntiYeet)
try
{
loader.Debug("Applying anti-yeet patch");
@ -223,6 +224,10 @@ namespace IPA.Injector
ascAsmDef.Write(ascPath);
}
catch (Exception)
{
// ignore
}
#endregion
}


+ 9
- 2
IPA.Loader/Config/SelfConfig.cs View File

@ -1,5 +1,9 @@
using IPA.Logging;
using IPA.JsonConverters;
using IPA.Logging;
using IPA.Utilities;
using Newtonsoft.Json;
using SemVer;
using System;
namespace IPA.Config
{
@ -33,10 +37,11 @@ namespace IPA.Config
}
internal const string IPAName = "Beat Saber IPA";
internal const string IPAVersion = "3.12.17";
internal const string IPAVersion = "3.12.18";
public bool Regenerate = true;
[Obsolete("No longer does anything, built-in mod yeeter always disabled")]
public bool ApplyAntiYeet = false;
public class UpdateObject
@ -57,5 +62,7 @@ namespace IPA.Config
}
public DebugObject Debug = new DebugObject();
public string LastGameVersion = null;
}
}

+ 6
- 2
IPA.Loader/JsonConverters/SemverVersionConverter.cs View File

@ -6,8 +6,12 @@ namespace IPA.JsonConverters
{
internal class SemverVersionConverter : JsonConverter<Version>
{
public override Version ReadJson(JsonReader reader, Type objectType, Version existingValue, bool hasExistingValue, JsonSerializer serializer) => new Version(reader.Value as string, true);
public override Version ReadJson(JsonReader reader, Type objectType, Version existingValue, bool hasExistingValue, JsonSerializer serializer) => reader.Value == null ? null : new Version(reader.Value as string, true);
public override void WriteJson(JsonWriter writer, Version value, JsonSerializer serializer) => writer.WriteValue(value.ToString());
public override void WriteJson(JsonWriter writer, Version value, JsonSerializer serializer)
{
if (value == null) writer.WriteNull();
else writer.WriteValue(value.ToString());
}
}
}

+ 0
- 2
IPA.Loader/Loader/Composite/CompositeBSPlugin.cs View File

@ -59,8 +59,6 @@ namespace IPA.Loader.Composite
public string Version => throw new InvalidOperationException();
public ModsaberModInfo ModInfo => throw new InvalidOperationException();
public void OnLateUpdate() {
Invoke(plugin => {
if (plugin.Plugin is IEnhancedBeatSaberPlugin saberPlugin)


+ 13
- 3
IPA.Loader/Loader/Features/Feature.cs View File

@ -74,10 +74,20 @@ namespace IPA.Loader.Features
/// </summary>
protected internal virtual bool StoreOnPlugin => true;
private static readonly Dictionary<string, Type> featureTypes = new Dictionary<string, Type>
static Feature()
{
{ "define-feature", typeof(DefineFeature) }
};
Reset();
}
internal static void Reset()
{
featureTypes = new Dictionary<string, Type>
{
{ "define-feature", typeof(DefineFeature) }
};
}
private static Dictionary<string, Type> featureTypes;
internal static bool HasFeature(string name) => featureTypes.ContainsKey(name);


+ 2
- 0
IPA.Loader/Loader/PluginComponent.cs View File

@ -23,6 +23,8 @@ namespace IPA.Loader
{
DontDestroyOnLoad(gameObject);
PluginManager.Load();
bsPlugins = new CompositeBSPlugin(PluginManager.BSMetas);
#pragma warning disable 618
ipaPlugins = new CompositeIPAPlugin(PluginManager.Plugins);


+ 17
- 3
IPA.Loader/Loader/PluginLoader.cs View File

@ -24,7 +24,6 @@ namespace IPA.Loader
LoadMetadata();
Resolve();
ComputeLoadOrder();
InitFeatures();
});
/// <summary>
@ -109,7 +108,7 @@ namespace IPA.Loader
internal static List<PluginMetadata> PluginsMetadata = new List<PluginMetadata>();
private static Regex embeddedTextDescriptionPattern = new Regex(@"#!\[(.+)\]", RegexOptions.Compiled | RegexOptions.Singleline);
private static readonly Regex embeddedTextDescriptionPattern = new Regex(@"#!\[(.+)\]", RegexOptions.Compiled | RegexOptions.Singleline);
internal static void LoadMetadata()
{
@ -502,6 +501,14 @@ namespace IPA.Loader
}
}
internal static void ReleaseAll()
{
ignoredPlugins = new HashSet<PluginMetadata>();
PluginsMetadata = new List<PluginMetadata>();
Feature.Reset();
GC.Collect();
}
internal static void Load(PluginMetadata meta)
{
if (meta.Assembly == null && meta.PluginType != null)
@ -519,6 +526,9 @@ namespace IPA.Loader
var info = new PluginInfo();
if (meta.Manifest.GameVersion != BeatSaber.GameVersion)
Logger.loader.Warn($"Mod {meta.Name} developed for game version {meta.Manifest.GameVersion}, so it may not work properly.");
try
{
Load(meta);
@ -580,6 +590,10 @@ namespace IPA.Loader
return info;
}
internal static List<PluginInfo> LoadPlugins() => PluginsMetadata.Select(InitPlugin).Where(p => p != null).ToList();
internal static List<PluginInfo> LoadPlugins()
{
InitFeatures();
return PluginsMetadata.Select(InitPlugin).Where(p => p != null).ToList();
}
}
}

+ 35
- 23
IPA.Loader/Loader/PluginManager.cs View File

@ -37,18 +37,9 @@ namespace IPA.Loader
return (_bsPlugins ?? throw new InvalidOperationException()).Select(p => p.Plugin);
}
}
private static List<PluginInfo> _bsPlugins;
internal static IEnumerable<PluginInfo> BSMetas
{
get
{
if (_bsPlugins == null)
{
LoadPlugins();
}
return _bsPlugins;
}
}
internal static IEnumerable<PluginInfo> BSMetas => _bsPlugins;
/// <summary>
/// Gets info about the plugin with the specified name.
@ -76,27 +67,48 @@ namespace IPA.Loader
public static IEnumerable<PluginInfo> AllPlugins => BSMetas;
/// <summary>
/// An <see cref="IEnumerable"/> of old IPA plugins
/// An <see cref="IEnumerable"/> of old IPA plugins.
/// </summary>
[Obsolete("I mean, IPlugin shouldn't be used, so why should this? Not renaming to extend support for old plugins.")]
public static IEnumerable<IPlugin> Plugins
public static IEnumerable<IPlugin> Plugins => _ipaPlugins;
private static List<IPlugin> _ipaPlugins;
internal static IConfigProvider SelfConfigProvider { get; set; }
internal static void Load()
{
get
string pluginDir = BeatSaber.PluginsPath;
var gameVer = BeatSaber.GameVersion;
var lastVerS = SelfConfig.SelfConfigRef.Value.LastGameVersion;
var lastVer = lastVerS != null ? new SemVer.Version(lastVerS) : null;
if (lastVer != null && gameVer != lastVer)
{
if (_ipaPlugins == null)
{
LoadPlugins();
}
return _ipaPlugins;
var oldPluginsName = Path.Combine(BeatSaber.InstallPath, $"{lastVer} Plugins");
var newPluginsName = Path.Combine(BeatSaber.InstallPath, $"{gameVer} Plugins");
ReleaseAll();
if (Directory.Exists(oldPluginsName))
Directory.Delete(oldPluginsName, true);
Directory.Move(pluginDir, oldPluginsName);
if (Directory.Exists(newPluginsName))
Directory.Move(newPluginsName, pluginDir);
else
Directory.CreateDirectory(pluginDir);
LoadTask().Wait();
}
}
private static List<IPlugin> _ipaPlugins;
internal static IConfigProvider SelfConfigProvider { get; set; }
SelfConfig.SelfConfigRef.Value.LastGameVersion = gameVer.ToString();
SelfConfig.LoaderConfig.Store(SelfConfig.SelfConfigRef.Value);
LoadPlugins();
}
private static void LoadPlugins()
{
string pluginDirectory = Path.Combine(Environment.CurrentDirectory, "Plugins");
string pluginDirectory = BeatSaber.PluginsPath;
// Process.GetCurrentProcess().MainModule crashes the game and Assembly.GetEntryAssembly() is NULL,
// so we need to resort to P/Invoke


+ 1
- 1
IPA.Loader/Loader/manifest.json View File

@ -8,7 +8,7 @@
"gameVersion": "0.13.2",
"id": "BSIPA",
"name": "Beat Saber IPA",
"version": "3.12.17",
"version": "3.12.18",
"icon": "IPA.icon.png",
"features": [
"define-feature(print, IPA.Loader.Features.PrintFeature)",


+ 1
- 1
IPA/Program.cs View File

@ -23,7 +23,7 @@ namespace IPA
Unknown
}
public const string FileVersion = "3.12.17";
public const string FileVersion = "3.12.18";
public static Version Version => Assembly.GetEntryAssembly().GetName().Version;


BIN
Refs/Assembly-CSharp.dll View File


BIN
Refs/BeatSaberCustomUI.dll View File


+ 22
- 0
Refs/BeatSaberCustomUI.xml View File

@ -129,6 +129,28 @@
<param name="sizeDelta">The size of the color picker's RectTransform.</param>
<returns></returns>
</member>
<member name="M:CustomUI.BeatSaber.BeatSaberUI.CreateTextSegmentedControl(UnityEngine.RectTransform,UnityEngine.Vector2,UnityEngine.Vector2,UnityEngine.Events.UnityAction{System.Int32},System.Single,System.Single)">
<summary>
Creates a custom TextSegmentedControl component.
</summary>
<param name="parent">Thet transform to parent the new TextSegmentedControl component to.</param>
<param name="anchoredPosition">The position the TextSegmentedControl component should be anchored to.</param>
<param name="sizeDelta">The size of the TextSegmentedControl component RectTransform.</param>
<param name="onValueChanged">Callback when the user clicks on one of the segments.</param>
<param name="fontSize">Size of text in segments.</param>
<param name="padding">Size of padding in segments.</param>
<returns>The newly created TextSegmentedControl component.</returns>
</member>
<member name="M:CustomUI.BeatSaber.BeatSaberUI.CreateIconSegmentedControl(UnityEngine.RectTransform,UnityEngine.Vector2,UnityEngine.Vector2,UnityEngine.Events.UnityAction{System.Int32})">
<summary>
Creates a custom IconSegmentedControl component.
</summary>
<param name="parent">Thet transform to parent the new IconSegmentedControl component to.</param>
<param name="anchoredPosition">The position the IconSegmentedControl component should be anchored to.</param>
<param name="sizeDelta">The size of the IconSegmentedControl component RectTransform.</param>
<param name="onValueChanged">Callback when the user clicks on one of the segments.</param>
<returns>The newly created IconSegmentedControl component.</returns>
</member>
<member name="F:CustomUI.BeatSaber.CustomFlowCoordinator.parentFlowCoordinator">
<summary>
The FlowCoordinator that presented this FlowCoordinator


BIN
Refs/Unity.TextMeshPro.dll View File


BIN
Refs/UnityEngine.CoreModule.dll View File


+ 1
- 1
appveyor.yml View File

@ -1,6 +1,6 @@
version: 'BSIPA-{branch}-{build}'
environment:
bsipa_version: '3.12.17'
bsipa_version: '3.12.18'
pull_requests:
do_not_increment_build_number: true
install:


Loading…
Cancel
Save