mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
Stickers: hacky workaround for bug in MTJobManager
This commit is contained in:
parent
d635b45db2
commit
d1102bb1e5
6 changed files with 18 additions and 6 deletions
|
@ -175,6 +175,8 @@ public static partial class BTKUIAddon
|
||||||
// StickerMod.Logger.Msg("Populating menu items.");
|
// StickerMod.Logger.Msg("Populating menu items.");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Thread.CurrentThread.IsBackground = false; // working around bug in MTJobManager
|
||||||
|
|
||||||
var directories = _curDirectoryInfo.GetDirectories();
|
var directories = _curDirectoryInfo.GetDirectories();
|
||||||
var files = _curDirectoryInfo.GetFiles();
|
var files = _curDirectoryInfo.GetFiles();
|
||||||
|
|
||||||
|
@ -213,6 +215,7 @@ public static partial class BTKUIAddon
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
IsPopulatingPage = false;
|
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++)
|
for (int i = 0; i < _folderButtons.Length; i++)
|
||||||
{
|
{
|
||||||
Button button = _folderButtons[i];
|
|
||||||
if (i >= directories.Count)
|
if (i >= directories.Count)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Button button = _folderButtons[i];
|
||||||
button.ButtonText = directories[i].Name;
|
button.ButtonText = directories[i].Name;
|
||||||
button.ButtonTooltip = $"Open {directories[i].Name}";
|
button.ButtonTooltip = $"Open {directories[i].Name}";
|
||||||
MTJobManager.RunOnMainThread("PopulateMenuItems", () => button.Hidden = false);
|
MTJobManager.RunOnMainThread("PopulateMenuItems", () => button.Hidden = false);
|
||||||
|
@ -236,7 +239,6 @@ public static partial class BTKUIAddon
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _fileButtons.Length; i++)
|
for (int i = 0; i < _fileButtons.Length; i++)
|
||||||
{
|
{
|
||||||
Button button = _fileButtons[i];
|
|
||||||
if (i >= files.Count)
|
if (i >= files.Count)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -248,6 +250,7 @@ public static partial class BTKUIAddon
|
||||||
string relativePath = Path.GetRelativePath(_initialDirectory, fileInfo.FullName);
|
string relativePath = Path.GetRelativePath(_initialDirectory, fileInfo.FullName);
|
||||||
string relativePathWithoutExtension = relativePath[..^fileInfo.Extension.Length];
|
string relativePathWithoutExtension = relativePath[..^fileInfo.Extension.Length];
|
||||||
|
|
||||||
|
Button button = _fileButtons[i];
|
||||||
button.ButtonTooltip = $"Load {fileInfo.Name}"; // Do not change "Load " prefix, we extract file name
|
button.ButtonTooltip = $"Load {fileInfo.Name}"; // Do not change "Load " prefix, we extract file name
|
||||||
|
|
||||||
if (StickerCache.IsThumbnailAvailable(relativePathWithoutExtension))
|
if (StickerCache.IsThumbnailAvailable(relativePathWithoutExtension))
|
||||||
|
|
|
@ -35,7 +35,8 @@ public class StickerMod : MelonMod
|
||||||
if (StickerSystem.Instance == null)
|
if (StickerSystem.Instance == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Input.mouseScrollDelta.y != 0f
|
if (StickerSystem.Instance.IsInStickerMode
|
||||||
|
&& Input.mouseScrollDelta.y != 0f
|
||||||
&& Cursor.lockState == CursorLockMode.Locked // prevent scrolling while in menus
|
&& Cursor.lockState == CursorLockMode.Locked // prevent scrolling while in menus
|
||||||
&& !CVRInputManager.Instance.zoom) // prevent scrolling while using scroll zoom
|
&& !CVRInputManager.Instance.zoom) // prevent scrolling while using scroll zoom
|
||||||
StickerSystem.Instance.SelectedStickerSlot += (int)Input.mouseScrollDelta.y;
|
StickerSystem.Instance.SelectedStickerSlot += (int)Input.mouseScrollDelta.y;
|
||||||
|
|
|
@ -146,6 +146,8 @@ public static partial class ModNetwork
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Thread.CurrentThread.IsBackground = false; // working around bug in MTJobManager
|
||||||
|
|
||||||
var textureData = _textureStorage[stickerSlot].textureData;
|
var textureData = _textureStorage[stickerSlot].textureData;
|
||||||
var textureHash = _textureStorage[stickerSlot].textureHash;
|
var textureHash = _textureStorage[stickerSlot].textureHash;
|
||||||
var width = _textureStorage[stickerSlot].width;
|
var width = _textureStorage[stickerSlot].width;
|
||||||
|
@ -181,6 +183,7 @@ public static partial class ModNetwork
|
||||||
{
|
{
|
||||||
IsSendingTexture = false;
|
IsSendingTexture = false;
|
||||||
InvokeTextureOutboundStateChanged(false);
|
InvokeTextureOutboundStateChanged(false);
|
||||||
|
Thread.CurrentThread.IsBackground = true; // working around bug in MTJobManager
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ public partial class StickerSystem
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Thread.CurrentThread.IsBackground = false; // working around bug in MTJobManager
|
||||||
if (!TryLoadImage(imageName, slotIndex, out string errorMessage))
|
if (!TryLoadImage(imageName, slotIndex, out string errorMessage))
|
||||||
throw new Exception(errorMessage);
|
throw new Exception(errorMessage);
|
||||||
}
|
}
|
||||||
|
@ -61,6 +62,7 @@ public partial class StickerSystem
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_isLoadingImage[slotIndex] = false;
|
_isLoadingImage[slotIndex] = false;
|
||||||
|
Thread.CurrentThread.IsBackground = true; // working around bug in MTJobManager
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,8 @@ public static class StickerCache
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Thread.CurrentThread.IsBackground = false; // working around bug in MTJobManager
|
||||||
|
|
||||||
int generatedThumbnails = 0;
|
int generatedThumbnails = 0;
|
||||||
|
|
||||||
while (BTKUIAddon.IsPopulatingPage || _filesToGenerateThumbnails.Count > 0)
|
while (BTKUIAddon.IsPopulatingPage || _filesToGenerateThumbnails.Count > 0)
|
||||||
|
@ -113,6 +115,7 @@ public static class StickerCache
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
IsGeneratingThumbnails = false;
|
IsGeneratingThumbnails = false;
|
||||||
|
Thread.CurrentThread.IsBackground = true; // working around bug in MTJobManager
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ $cvrDefaultPath = "C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR"
|
||||||
# $cvrDefaultPath = "E:\temp\CVR_Experimental"
|
# $cvrDefaultPath = "E:\temp\CVR_Experimental"
|
||||||
|
|
||||||
# Array with the dlls to strip
|
# 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
|
# Array with the mods to grab
|
||||||
$modNames = @("BTKUILib", "BTKSAImmersiveHud", "PortableMirrorMod", "VRBinding", "TheClapper")
|
$modNames = @("BTKUILib", "BTKSAImmersiveHud", "PortableMirrorMod", "VRBinding", "TheClapper")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue