From b6d0aa9ca6a7420a369bb4e684ff95df812df6c4 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Mon, 23 Mar 2020 17:09:22 -0500 Subject: [PATCH] Bumped version for new Beat Saber beta --- IPA.Loader/Config/SelfConfig.cs | 2 +- IPA.Loader/Loader/manifest.json | 4 +- IPA.Loader/Utilities/Utils.cs | 488 +++++++++++++-------------- IPA/Program.cs | 2 +- Refs/Unity.TextMeshPro.dll | Bin 97792 -> 97792 bytes Refs/UnityEngine.CoreModule.Net4.dll | Bin 710656 -> 710656 bytes Refs/UnityEngine.UI.dll | Bin 100864 -> 100864 bytes appveyor.yml | 2 +- 8 files changed, 249 insertions(+), 249 deletions(-) diff --git a/IPA.Loader/Config/SelfConfig.cs b/IPA.Loader/Config/SelfConfig.cs index 57856357..83f1e8d3 100644 --- a/IPA.Loader/Config/SelfConfig.cs +++ b/IPA.Loader/Config/SelfConfig.cs @@ -68,7 +68,7 @@ namespace IPA.Config } internal const string IPAName = "Beat Saber IPA"; - internal const string IPAVersion = "3.99.99.10"; + internal const string IPAVersion = "3.99.99.11"; // uses Updates.AutoUpdate, Updates.AutoCheckUpdates, YeetMods, Debug.ShowCallSource, Debug.ShowDebug, // Debug.CondenseModLogs diff --git a/IPA.Loader/Loader/manifest.json b/IPA.Loader/Loader/manifest.json index c5487c0d..5357df61 100644 --- a/IPA.Loader/Loader/manifest.json +++ b/IPA.Loader/Loader/manifest.json @@ -5,10 +5,10 @@ "#![IPA.Loader.description.md]", "A mod loader specifically for Beat Saber." ], - "gameVersion": "1.8.0b1", + "gameVersion": "1.8.0b2", "id": "BSIPA", "name": "Beat Saber IPA", - "version": "4.0.0-beta.10", + "version": "4.0.0-beta.11", "icon": "IPA.icon_white.png", "features": [ "define-feature(print, IPA.Loader.Features.PrintFeature)", diff --git a/IPA.Loader/Utilities/Utils.cs b/IPA.Loader/Utilities/Utils.cs index e3931e28..028848b8 100644 --- a/IPA.Loader/Utilities/Utils.cs +++ b/IPA.Loader/Utilities/Utils.cs @@ -1,246 +1,246 @@ -using System; -using System.IO; -using System.Text; -using System.Linq; -using System.Collections.Generic; -using Mono.Cecil; -using System.Runtime.CompilerServices; +using System; +using System.IO; +using System.Text; +using System.Linq; +using System.Collections.Generic; +using Mono.Cecil; +using System.Runtime.CompilerServices; using System.Threading; -#if NET3 -using File = Net3_Proxy.File; -#endif +#if NET3 +using File = Net3_Proxy.File; +#endif -namespace IPA.Utilities -{ - /// - /// A class providing static utility functions that in any other language would just *exist*. - /// - public static class Utils - { - /// - /// Converts a hex string to a byte array. - /// - /// the hex stream - /// the corresponding byte array - public static byte[] StringToByteArray(string hex) - { - int numberChars = hex.Length; - byte[] bytes = new byte[numberChars / 2]; - for (int i = 0; i < numberChars; i += 2) - bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16); - return bytes; - } - - /// - /// Converts a byte array to a hex string. - /// - /// the byte array - /// the hex form of the array - public static string ByteArrayToString(byte[] ba) - { - StringBuilder hex = new StringBuilder(ba.Length * 2); - foreach (byte b in ba) - hex.AppendFormat("{0:x2}", b); - return hex.ToString(); - } - - // Copyright (c) 2008-2013 Hafthor Stefansson - // Distributed under the MIT/X11 software license - // Ref: http://www.opensource.org/licenses/mit-license.php. - // From: https://stackoverflow.com/a/8808245/3117125 - /// - /// Uses unsafe code to compare 2 byte arrays quickly. - /// - /// array 1 - /// array 2 - /// whether or not they are byte-for-byte equal - public static unsafe bool UnsafeCompare(byte[] a1, byte[] a2) - { - if (a1 == a2) return true; - if (a1 == null || a2 == null || a1.Length != a2.Length) - return false; - fixed (byte* p1 = a1, p2 = a2) - { - byte* x1 = p1, x2 = p2; - int l = a1.Length; - for (int i = 0; i < l / 8; i++, x1 += 8, x2 += 8) - if (*((long*)x1) != *((long*)x2)) return false; - if ((l & 4) != 0) { if (*((int*)x1) != *((int*)x2)) return false; x1 += 4; x2 += 4; } - if ((l & 2) != 0) { if (*((short*)x1) != *((short*)x2)) return false; x1 += 2; x2 += 2; } - if ((l & 1) != 0) if (*x1 != *x2) return false; - return true; - } - } - - /// - /// Gets a path relative to the provided folder. - /// - /// the file to relativize - /// the source folder - /// a path to get from to - public static string GetRelativePath(string file, string folder) - { - Uri pathUri = new Uri(file); - // Folders must end in a slash - if (!folder.EndsWith(Path.DirectorySeparatorChar.ToString())) - { - folder += Path.DirectorySeparatorChar; - } - Uri folderUri = new Uri(folder); - return Uri.UnescapeDataString(folderUri.MakeRelativeUri(pathUri).ToString().Replace('/', Path.DirectorySeparatorChar)); - } - - /// - /// Copies all files from to . - /// - /// the source directory - /// the destination directory - /// the filename of the file to append together - /// a delegate called when there is an error copying. Return true to keep going. - public static void CopyAll(DirectoryInfo source, DirectoryInfo target, string appendFileName = "", - Func onCopyException = null) - { - if (source.FullName.ToLower() == target.FullName.ToLower()) - { - return; - } - - // Check if the target directory exists, if not, create it. - if (Directory.Exists(target.FullName) == false) - { - Directory.CreateDirectory(target.FullName); - } - - // Copy each file into it's new directory. - foreach (FileInfo fi in source.GetFiles()) - { - try - { - if (fi.Name == appendFileName) - File.AppendAllLines(Path.Combine(target.ToString(), fi.Name), File.ReadAllLines(fi.FullName)); - else - fi.CopyTo(Path.Combine(target.ToString(), fi.Name), true); - } - catch (Exception e) - { - var keepOn = onCopyException?.Invoke(e, fi); - if (!keepOn.Unwrap()) - throw; - } - } - - // Copy each subdirectory using recursion. - foreach (DirectoryInfo diSourceSubDir in source.GetDirectories()) - { - DirectoryInfo nextTargetSubDir = - target.CreateSubdirectory(diSourceSubDir.Name); - CopyAll(diSourceSubDir, nextTargetSubDir, appendFileName, onCopyException); - } - } - - /// - /// Whether you can safely use without Mono throwing a fit. - /// - /// if you can use safely, otherwise - public static bool CanUseDateTimeNowSafely { get; private set; } = true; - private static bool DateTimeSafetyUnknown = true; - private static long UnsafeAdvanceTicks = 1; - - /// - /// Gets the current if supported, otherwise, if Mono would throw a fit, - /// returns plus some value, such that each time it is called - /// the value will be greater than the previous result. Not suitable for timing. - /// - /// the current if supported, otherwise some indeterminant increasing value. - public static DateTime CurrentTime() - { - if (DateTimeSafetyUnknown) - { - DateTime time = DateTime.MinValue; - try - { - time = DateTime.Now; - } - catch (TimeZoneNotFoundException) - { // Mono did a fucky wucky and we need to avoid this call - CanUseDateTimeNowSafely = false; - } - DateTimeSafetyUnknown = false; - return time; - } - else - { - if (CanUseDateTimeNowSafely) return DateTime.Now; - else return DateTime.MinValue.AddTicks(Interlocked.Increment(ref UnsafeAdvanceTicks)); // return MinValue as a fallback - } - } - - /// - /// Compares a pair of s ignoring both the prerelease and build fields. - /// - /// the left value - /// the right value - /// < 0 if l is less than r, 0 if they are equal in the numeric portion, or > 0 if l is greater than r - public static int VersionCompareNoPrerelease(SemVer.Version l, SemVer.Version r) - { - var cmpVal = l.Major - r.Major; - if (cmpVal != 0) return cmpVal; - cmpVal = l.Minor - r.Minor; - if (cmpVal != 0) return cmpVal; - cmpVal = l.Patch - r.Patch; - return cmpVal; - } - - /// - /// An object used to manage scope guards. - /// - /// - /// - /// using var _ = new Utils.ScopeGuardObject(() => RunOnScopeExit(value)); - /// - /// - /// - public struct ScopeGuardObject : IDisposable - { - private readonly Action action; - /// - /// Creates a new scope guard that will invoke when disposed. - /// - /// the action to run on dispose - public ScopeGuardObject(Action action) - => this.action = action; - void IDisposable.Dispose() - => action?.Invoke(); - } - - /// - /// Creates a scope guard for a given . - /// - /// the to run on dispose - /// a that will run on disposal - /// - /// - /// using var _ = Utils.ScopeGuard(() => RunOnScopeExit(value)); - /// - /// - public static ScopeGuardObject ScopeGuard(Action action) - => new ScopeGuardObject(action); - - internal static bool HasInterface(this TypeDefinition type, string interfaceFullName) - { - return (type?.Interfaces?.Any(i => i.InterfaceType.FullName == interfaceFullName) ?? false) - || (type?.Interfaces?.Any(t => HasInterface(t?.InterfaceType?.Resolve(), interfaceFullName)) ?? false); - } - -#if NET4 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static IEnumerable StrJP(this IEnumerable a) => a; - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static IEnumerable StrJP(this IEnumerable a) => a.Select(o => $"{o}" /* safer than .ToString() */); -#endif -#if NET3 - internal static string[] StrJP(this IEnumerable a) => a.ToArray(); - internal static string[] StrJP(this IEnumerable a) => a.Select(o => $"{o}" /* safer than .ToString() */).ToArray(); -#endif - } -} +namespace IPA.Utilities +{ + /// + /// A class providing static utility functions that in any other language would just *exist*. + /// + public static class Utils + { + /// + /// Converts a hex string to a byte array. + /// + /// the hex stream + /// the corresponding byte array + public static byte[] StringToByteArray(string hex) + { + int numberChars = hex.Length; + byte[] bytes = new byte[numberChars / 2]; + for (int i = 0; i < numberChars; i += 2) + bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16); + return bytes; + } + + /// + /// Converts a byte array to a hex string. + /// + /// the byte array + /// the hex form of the array + public static string ByteArrayToString(byte[] ba) + { + StringBuilder hex = new StringBuilder(ba.Length * 2); + foreach (byte b in ba) + hex.AppendFormat("{0:x2}", b); + return hex.ToString(); + } + + // Copyright (c) 2008-2013 Hafthor Stefansson + // Distributed under the MIT/X11 software license + // Ref: http://www.opensource.org/licenses/mit-license.php. + // From: https://stackoverflow.com/a/8808245/3117125 + /// + /// Uses unsafe code to compare 2 byte arrays quickly. + /// + /// array 1 + /// array 2 + /// whether or not they are byte-for-byte equal + public static unsafe bool UnsafeCompare(byte[] a1, byte[] a2) + { + if (a1 == a2) return true; + if (a1 == null || a2 == null || a1.Length != a2.Length) + return false; + fixed (byte* p1 = a1, p2 = a2) + { + byte* x1 = p1, x2 = p2; + int l = a1.Length; + for (int i = 0; i < l / 8; i++, x1 += 8, x2 += 8) + if (*((long*)x1) != *((long*)x2)) return false; + if ((l & 4) != 0) { if (*((int*)x1) != *((int*)x2)) return false; x1 += 4; x2 += 4; } + if ((l & 2) != 0) { if (*((short*)x1) != *((short*)x2)) return false; x1 += 2; x2 += 2; } + if ((l & 1) != 0) if (*x1 != *x2) return false; + return true; + } + } + + /// + /// Gets a path relative to the provided folder. + /// + /// the file to relativize + /// the source folder + /// a path to get from to + public static string GetRelativePath(string file, string folder) + { + Uri pathUri = new Uri(file); + // Folders must end in a slash + if (!folder.EndsWith(Path.DirectorySeparatorChar.ToString())) + { + folder += Path.DirectorySeparatorChar; + } + Uri folderUri = new Uri(folder); + return Uri.UnescapeDataString(folderUri.MakeRelativeUri(pathUri).ToString().Replace('/', Path.DirectorySeparatorChar)); + } + + /// + /// Copies all files from to . + /// + /// the source directory + /// the destination directory + /// the filename of the file to append together + /// a delegate called when there is an error copying. Return true to keep going. + public static void CopyAll(DirectoryInfo source, DirectoryInfo target, string appendFileName = "", + Func onCopyException = null) + { + if (source.FullName.ToLower() == target.FullName.ToLower()) + { + return; + } + + // Check if the target directory exists, if not, create it. + if (Directory.Exists(target.FullName) == false) + { + Directory.CreateDirectory(target.FullName); + } + + // Copy each file into it's new directory. + foreach (FileInfo fi in source.GetFiles()) + { + try + { + if (fi.Name == appendFileName) + File.AppendAllLines(Path.Combine(target.ToString(), fi.Name), File.ReadAllLines(fi.FullName)); + else + fi.CopyTo(Path.Combine(target.ToString(), fi.Name), true); + } + catch (Exception e) + { + var keepOn = onCopyException?.Invoke(e, fi); + if (!keepOn.Unwrap()) + throw; + } + } + + // Copy each subdirectory using recursion. + foreach (DirectoryInfo diSourceSubDir in source.GetDirectories()) + { + DirectoryInfo nextTargetSubDir = + target.CreateSubdirectory(diSourceSubDir.Name); + CopyAll(diSourceSubDir, nextTargetSubDir, appendFileName, onCopyException); + } + } + + /// + /// Whether you can safely use without Mono throwing a fit. + /// + /// if you can use safely, otherwise + public static bool CanUseDateTimeNowSafely { get; private set; } = true; + private static bool DateTimeSafetyUnknown = true; + private static long UnsafeAdvanceTicks = 1; + + /// + /// Gets the current if supported, otherwise, if Mono would throw a fit, + /// returns plus some value, such that each time it is called + /// the value will be greater than the previous result. Not suitable for timing. + /// + /// the current if supported, otherwise some indeterminant increasing value. + public static DateTime CurrentTime() + { + if (DateTimeSafetyUnknown) + { + DateTime time = DateTime.MinValue; + try + { + time = DateTime.Now; + } + catch (TimeZoneNotFoundException) + { // Mono did a fucky wucky and we need to avoid this call + CanUseDateTimeNowSafely = false; + } + DateTimeSafetyUnknown = false; + return time; + } + else + { + if (CanUseDateTimeNowSafely) return DateTime.Now; + else return DateTime.MinValue.AddTicks(Interlocked.Increment(ref UnsafeAdvanceTicks)); // return MinValue as a fallback + } + } + + /// + /// Compares a pair of s ignoring both the prerelease and build fields. + /// + /// the left value + /// the right value + /// < 0 if l is less than r, 0 if they are equal in the numeric portion, or > 0 if l is greater than r + public static int VersionCompareNoPrerelease(SemVer.Version l, SemVer.Version r) + { + var cmpVal = l.Major - r.Major; + if (cmpVal != 0) return cmpVal; + cmpVal = l.Minor - r.Minor; + if (cmpVal != 0) return cmpVal; + cmpVal = l.Patch - r.Patch; + return cmpVal; + } + + /// + /// An object used to manage scope guards. + /// + /// + /// + /// using var _ = new Utils.ScopeGuardObject(() => RunOnScopeExit(value)); + /// + /// + /// + public struct ScopeGuardObject : IDisposable + { + private readonly Action action; + /// + /// Creates a new scope guard that will invoke when disposed. + /// + /// the action to run on dispose + public ScopeGuardObject(Action action) + => this.action = action; + void IDisposable.Dispose() + => action?.Invoke(); + } + + /// + /// Creates a scope guard for a given . + /// + /// the to run on dispose + /// a that will run on disposal + /// + /// + /// using var _ = Utils.ScopeGuard(() => RunOnScopeExit(value)); + /// + /// + public static ScopeGuardObject ScopeGuard(Action action) + => new ScopeGuardObject(action); + + internal static bool HasInterface(this TypeDefinition type, string interfaceFullName) + { + return (type?.Interfaces?.Any(i => i.InterfaceType.FullName == interfaceFullName) ?? false) + || (type?.Interfaces?.Any(t => HasInterface(t?.InterfaceType?.Resolve(), interfaceFullName)) ?? false); + } + +#if NET4 + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static IEnumerable StrJP(this IEnumerable a) => a; + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static IEnumerable StrJP(this IEnumerable a) => a.Select(o => $"{o}" /* safer than .ToString() */); +#endif +#if NET3 + internal static string[] StrJP(this IEnumerable a) => a.ToArray(); + internal static string[] StrJP(this IEnumerable a) => a.Select(o => $"{o}" /* safer than .ToString() */).ToArray(); +#endif + } +} diff --git a/IPA/Program.cs b/IPA/Program.cs index 1bc0231f..0243b9f1 100644 --- a/IPA/Program.cs +++ b/IPA/Program.cs @@ -23,7 +23,7 @@ namespace IPA Unknown } - public const string FileVersion = "3.99.99.10"; + public const string FileVersion = "3.99.99.11"; public static Version Version => Assembly.GetEntryAssembly().GetName().Version; diff --git a/Refs/Unity.TextMeshPro.dll b/Refs/Unity.TextMeshPro.dll index 957aba6ecbcbc655bc3d72d8cd6618158589b192..397fc3afbfff26f22504b4a3d0eb0de557f4a50f 100644 GIT binary patch delta 42 zcmV+_0M-A1`~`sg1(1jXP8E59i?xdZrBe{^ewJLjzIQ^nU)Vmy8Qq(=KvV(1DWkg+ Am;e9( delta 42 zcmV+_0M-A1`~`sg1(1jXT2WPji?xdZrBe`N%#5v(?43fg*l9eRjCwn_KvV(1DW|>@ AcmMzZ diff --git a/Refs/UnityEngine.CoreModule.Net4.dll b/Refs/UnityEngine.CoreModule.Net4.dll index 872881e51c2727794b0851d04d2e145d056c5735..45c117373db436ee550936044907ac6c51aa6b82 100644 GIT binary patch delta 2814 zcmYk7Yitx%7>2)jheM%2TWBb~P+M4N!37J2LRz4-)IxxAzbK%vuyUzjK#4Ii;1-(b zA1@ITC;Tuhtf+trSYSm#D@6rSt|9`Wi(5cM*h5pA^C1VAEld$@@imvZlBxd8PH+qu!)lVT26b0c?wqQ-cWF<0o0Rn6Dnn-Q zPVc<5y@kOGyi8s#qT5@jcC8Q_5#8HXbudD)ks@)vU3t9X^o^Icr8TkJI(D)Xz-2v%W`rRoFE!&hGs@>t@q^+^7Gi+=uSe zEo-kbLt&2fKF3+7eGu!e(<9Aw+~4Cdr@l)O&*G_%dun97-LsT6Cf(joB-hF3GWXfJ z$q%KK-a!>k3_Fu=ax&ssR8QB3+RR+L`=qt&gCAtx;Hi%}`5#5r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