diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fbe35d..0142c69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### WorldPredownload v1.6.5 +- *Actually downloads worlds properly now* + ### WorldPredownload v1.6.4 - Fix compatibility with latest update diff --git a/RELEASE.md b/RELEASE.md index 1537032..1e85916 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,2 @@ -### WorldPredownload v1.6.4 -- Fix compatibility with latest update - -### ActionMenuUtils v2.0.4 -- *Actually* fix compatibility with latest update +### WorldPredownload v1.6.5 +- *Actually downloads worlds properly now* diff --git a/WorldPredownload/DownloadManager/DownloadComplete.cs b/WorldPredownload/DownloadManager/DownloadComplete.cs index d8f0765..95f8d00 100644 --- a/WorldPredownload/DownloadManager/DownloadComplete.cs +++ b/WorldPredownload/DownloadManager/DownloadComplete.cs @@ -18,7 +18,9 @@ namespace WorldPredownload.DownloadManager [SuppressMessage("ReSharper", "HeuristicUnreachableCode")] public static partial class WorldDownloadManager { - private static readonly AsyncCompletedEventHandler OnComplete = async (_, args) => + private static readonly AsyncCompletedEventHandler OnComplete = Complete; + + private static async void Complete(object _, AsyncCompletedEventArgs args) { await TaskUtilities.YieldToMainThread(); webClient.Dispose(); @@ -32,9 +34,7 @@ public static partial class WorldDownloadManager WorldButton.UpdateTextDownloadStopped(); //WorldDownloadStatus.GameObject.SetText(Constants.STATUS_IDLE_TEXT); if (!string.IsNullOrEmpty(file)) File.Delete(file); - if (!args.Cancelled) - MelonLogger.Error( - $"World failed to download. Why you might ask?... I don't know! This exception might help: {args.Error}"); + if (!args.Cancelled) MelonLogger.Error($"World failed to download. Why you might ask?... I don't know! This exception might help: {args.Error}"); return; } @@ -44,26 +44,18 @@ public static partial class WorldDownloadManager // level = CompressionLevel.High, // blockSize = 131072U // }, 0, ThreadPriority.Normal); - - var operation = AssetBundle.RecompressAssetBundleAsync_Internal(file, file, new BuildCompression - { - compression = CompressionType.Lz4, - level = CompressionLevel.High, - blockSize = 131072U - }, 0, ThreadPriority.Normal); - operation.add_completed(DelegateSupport.ConvertDelegate>( - new System.Action( - delegate - { - MelonLogger.Msg($"Finished recompressing world with result: {operation.result}"); - var task = new Task(OnRecompress); - // I don't really know how else to ensure that this the recompress operation runs on the main thread, if you know feel free to bonk me for being dumb - task.NoAwait("WorldPredownload OnRecompress"); - task.Start(); - })) - ); - }; + var operation = AssetBundle.RecompressAssetBundleAsync_Internal(file, file, new BuildCompression {compression = CompressionType.Lz4, level = CompressionLevel.High, blockSize = 131072U}, 0, ThreadPriority.Normal); + + operation.add_completed(DelegateSupport.ConvertDelegate>(new System.Action(delegate + { + MelonLogger.Msg($"Finished recompressing world with result: {operation.result}"); + var task = new Task(OnRecompress); + // I don't really know how else to ensure that this the recompress operation runs on the main thread, if you know feel free to bonk me for being dumb + task.NoAwait("WorldPredownload OnRecompress"); + task.Start(); + }))); + } private static async void OnRecompress() { diff --git a/WorldPredownload/DownloadManager/DownloadProgress.cs b/WorldPredownload/DownloadManager/DownloadProgress.cs index a290416..30bef6e 100644 --- a/WorldPredownload/DownloadManager/DownloadProgress.cs +++ b/WorldPredownload/DownloadManager/DownloadProgress.cs @@ -11,7 +11,9 @@ namespace WorldPredownload.DownloadManager [SuppressMessage("ReSharper", "HeuristicUnreachableCode")] public static partial class WorldDownloadManager { - private static readonly DownloadProgressChangedEventHandler OnProgress = async (_, args) => + private static readonly DownloadProgressChangedEventHandler OnProgress = Progress; + + private static async void Progress(object _, DownloadProgressChangedEventArgs args) { await TaskUtilities.YieldToMainThread(); if (!Downloading) return; @@ -21,6 +23,6 @@ public static partial class WorldDownloadManager if (FriendButton.CanChangeText) FriendButton.Button.SetText(text); if (WorldButton.CanChangeText) WorldButton.Button.SetText(text); if (ModSettings.showStatusOnHud) HudIcon.Update(args.ProgressPercentage / 100f); - }; + } } } \ No newline at end of file diff --git a/WorldPredownload/Helpers/Utilities.cs b/WorldPredownload/Helpers/Utilities.cs index ca3a031..9b46070 100644 --- a/WorldPredownload/Helpers/Utilities.cs +++ b/WorldPredownload/Helpers/Utilities.cs @@ -19,7 +19,7 @@ namespace WorldPredownload.Helpers [SuppressMessage("ReSharper", "HeuristicUnreachableCode")] public static class Utilities { - private static readonly Regex FileIdRegex = new("(/file_[0-9A-Za-z-]+/)", RegexOptions.Compiled); + private static readonly Regex FileIdRegex = new("/(file_[0-9A-Za-z-]+)/", RegexOptions.Compiled); private static readonly Regex FileVersionRegex = new("(?:\\/file_[0-9A-Za-z-]+\\/)([0-9]+)", RegexOptions.Compiled); @@ -73,7 +73,7 @@ public static AssetBundleDownloadManager GetAssetBundleDownloadManager() { return AssetBundleDownloadManager.prop_AssetBundleDownloadManager_0; } - + public static void HideCurrentPopup() { VRCUiManager.prop_VRCUiManager_0.HideScreen("POPUP"); diff --git a/WorldPredownload/Main.cs b/WorldPredownload/Main.cs index 678e2d2..1037b48 100644 --- a/WorldPredownload/Main.cs +++ b/WorldPredownload/Main.cs @@ -3,7 +3,7 @@ using UIExpansionKit.API; using WorldPredownload.UI; -[assembly: MelonInfo(typeof(WorldPredownload.WorldPredownload), "WorldPredownload", "1.6.4", "gompo", "https://github.com/gompoc/VRChatMods/releases/")] +[assembly: MelonInfo(typeof(WorldPredownload.WorldPredownload), "WorldPredownload", "1.6.5", "gompo", "https://github.com/gompoc/VRChatMods/releases/")] [assembly: MelonGame("VRChat", "VRChat")] [assembly: ModJsonInfo( 141, diff --git a/WorldPredownload/WorldPredownload.csproj b/WorldPredownload/WorldPredownload.csproj index ad60885..f8a22e7 100644 --- a/WorldPredownload/WorldPredownload.csproj +++ b/WorldPredownload/WorldPredownload.csproj @@ -3,7 +3,7 @@ net472 true - 1.6.4.0 + 1.6.5.0 9 true annotations