diff --git a/Stickers/Integrations/BTKUI/UIAddon.Page.StickerSelect.cs b/Stickers/Integrations/BTKUI/UIAddon.Page.StickerSelect.cs index 1874ccb..76eba84 100644 --- a/Stickers/Integrations/BTKUI/UIAddon.Page.StickerSelect.cs +++ b/Stickers/Integrations/BTKUI/UIAddon.Page.StickerSelect.cs @@ -175,6 +175,8 @@ public static partial class BTKUIAddon // StickerMod.Logger.Msg("Populating menu items."); try { + Thread.CurrentThread.IsBackground = false; // working around bug in MTJobManager + var directories = _curDirectoryInfo.GetDirectories(); var files = _curDirectoryInfo.GetFiles(); @@ -213,6 +215,7 @@ public static partial class BTKUIAddon finally { IsPopulatingPage = false; + Thread.CurrentThread.IsBackground = true; // working around bug in MTJobManager } } @@ -220,10 +223,10 @@ public static partial class BTKUIAddon { for (int i = 0; i < _folderButtons.Length; i++) { - Button button = _folderButtons[i]; if (i >= directories.Count) break; - + + Button button = _folderButtons[i]; button.ButtonText = directories[i].Name; button.ButtonTooltip = $"Open {directories[i].Name}"; MTJobManager.RunOnMainThread("PopulateMenuItems", () => button.Hidden = false); @@ -236,10 +239,9 @@ public static partial class BTKUIAddon { for (int i = 0; i < _fileButtons.Length; i++) { - Button button = _fileButtons[i]; if (i >= files.Count) break; - + FileInfo fileInfo = files[i]; if (!SUPPORTED_IMAGE_EXTENSIONS.Contains(fileInfo.Extension.ToLower())) @@ -248,6 +250,7 @@ public static partial class BTKUIAddon string relativePath = Path.GetRelativePath(_initialDirectory, fileInfo.FullName); string relativePathWithoutExtension = relativePath[..^fileInfo.Extension.Length]; + Button button = _fileButtons[i]; button.ButtonTooltip = $"Load {fileInfo.Name}"; // Do not change "Load " prefix, we extract file name if (StickerCache.IsThumbnailAvailable(relativePathWithoutExtension)) diff --git a/Stickers/Main.cs b/Stickers/Main.cs index 33efcee..8847dac 100644 --- a/Stickers/Main.cs +++ b/Stickers/Main.cs @@ -35,7 +35,8 @@ public class StickerMod : MelonMod if (StickerSystem.Instance == null) return; - if (Input.mouseScrollDelta.y != 0f + if (StickerSystem.Instance.IsInStickerMode + && Input.mouseScrollDelta.y != 0f && Cursor.lockState == CursorLockMode.Locked // prevent scrolling while in menus && !CVRInputManager.Instance.zoom) // prevent scrolling while using scroll zoom StickerSystem.Instance.SelectedStickerSlot += (int)Input.mouseScrollDelta.y; diff --git a/Stickers/Stickers/Networking/ModNetwork.Outbound.cs b/Stickers/Stickers/Networking/ModNetwork.Outbound.cs index 74a7446..d3f20f3 100644 --- a/Stickers/Stickers/Networking/ModNetwork.Outbound.cs +++ b/Stickers/Stickers/Networking/ModNetwork.Outbound.cs @@ -146,6 +146,8 @@ public static partial class ModNetwork { try { + Thread.CurrentThread.IsBackground = false; // working around bug in MTJobManager + var textureData = _textureStorage[stickerSlot].textureData; var textureHash = _textureStorage[stickerSlot].textureHash; var width = _textureStorage[stickerSlot].width; @@ -181,6 +183,7 @@ public static partial class ModNetwork { IsSendingTexture = false; InvokeTextureOutboundStateChanged(false); + Thread.CurrentThread.IsBackground = true; // working around bug in MTJobManager } }); } diff --git a/Stickers/Stickers/StickerSystem.ImageLoading.cs b/Stickers/Stickers/StickerSystem.ImageLoading.cs index 4f5fce4..254cd02 100644 --- a/Stickers/Stickers/StickerSystem.ImageLoading.cs +++ b/Stickers/Stickers/StickerSystem.ImageLoading.cs @@ -50,6 +50,7 @@ public partial class StickerSystem { try { + Thread.CurrentThread.IsBackground = false; // working around bug in MTJobManager if (!TryLoadImage(imageName, slotIndex, out string errorMessage)) throw new Exception(errorMessage); } @@ -61,6 +62,7 @@ public partial class StickerSystem finally { _isLoadingImage[slotIndex] = false; + Thread.CurrentThread.IsBackground = true; // working around bug in MTJobManager } }); } diff --git a/Stickers/Stickers/Utilities/StickerCache.cs b/Stickers/Stickers/Utilities/StickerCache.cs index 59e8fc4..3fb5fcf 100644 --- a/Stickers/Stickers/Utilities/StickerCache.cs +++ b/Stickers/Stickers/Utilities/StickerCache.cs @@ -83,6 +83,8 @@ public static class StickerCache { try { + Thread.CurrentThread.IsBackground = false; // working around bug in MTJobManager + int generatedThumbnails = 0; while (BTKUIAddon.IsPopulatingPage || _filesToGenerateThumbnails.Count > 0) @@ -113,6 +115,7 @@ public static class StickerCache finally { IsGeneratingThumbnails = false; + Thread.CurrentThread.IsBackground = true; // working around bug in MTJobManager } }); } diff --git a/copy_and_nstrip_dll.ps1 b/copy_and_nstrip_dll.ps1 index 1f4dfe3..aa4cb97 100644 --- a/copy_and_nstrip_dll.ps1 +++ b/copy_and_nstrip_dll.ps1 @@ -10,7 +10,7 @@ $cvrDefaultPath = "C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR" # $cvrDefaultPath = "E:\temp\CVR_Experimental" # Array with the dlls to strip -$dllsToStrip = @('Assembly-CSharp.dll','Assembly-CSharp-firstpass.dll','AVProVideo.Runtime.dll', 'Unity.TextMeshPro.dll', 'MagicaCloth.dll', 'MagicaClothV2.dll', 'ECM2.dll', 'TheClapper.dll') +$dllsToStrip = @('Assembly-CSharp.dll','Assembly-CSharp-firstpass.dll','AVProVideo.Runtime.dll', 'Unity.TextMeshPro.dll', 'MagicaCloth.dll', 'MagicaClothV2.dll', 'ECM2.dll', 'TheClapper.dll', 'MTJobSystem.dll') # Array with the mods to grab $modNames = @("BTKUILib", "BTKSAImmersiveHud", "PortableMirrorMod", "VRBinding", "TheClapper")