Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0d17ab1
Enable cross emulator stockpiles
Foifur Apr 8, 2025
e49beb8
Cross emulator stockpiles updates
Foifur Apr 11, 2025
b65f147
Add emu version to dataRow cell
Foifur Apr 11, 2025
fd475ea
Various additions for cross-emulator stockpiles
Foifur Aug 1, 2025
2de920a
Add event handler for swapTimeout
Foifur Aug 1, 2025
0faa9ee
Make swap a method and add NetCore command
Foifur Aug 1, 2025
8c158d0
Make SwapImplementation async
Foifur Aug 3, 2025
1451cca
Add swap emulator timeout as general RTC settings parameter
Foifur Aug 4, 2025
3ea30a5
Add EmuVer to StashKey constructor
Foifur Aug 6, 2025
c91424d
Update max intensity after AllSpecSent
Foifur Aug 6, 2025
1788bbd
Improve check if CoreForm should be focused
Foifur Aug 6, 2025
30c6f20
Add glitch harvester settings that were accidentally removed during r…
Foifur Aug 6, 2025
f5cc2f8
Convert a LOT of methods to async
Foifur Aug 6, 2025
29ebd2c
Check for swap states in StockpileManagerUISide
Foifur Aug 8, 2025
ee130d0
Update SwapImplementation message command
Foifur Aug 9, 2025
80b541b
Add cancelation token for swapTimeoutTask
Foifur Aug 14, 2025
2f40547
Fix missing emulator popup showing multiple of the same implementation
Foifur Aug 14, 2025
29f1356
Add UnlockInterface command
Foifur Aug 14, 2025
9755c0e
Add unlockAfterSwap argument to SwapImplementation
Foifur Aug 14, 2025
1fc7293
Add null-conditional operator
Foifur Aug 17, 2025
07f7ae2
Disable check for mixed stockpiles
Foifur Aug 17, 2025
2a2a1bd
Better string check for swapping implementation
Foifur Aug 19, 2025
4d09d0b
Remove LoadLists from swapping
Foifur Aug 28, 2025
f59aa9d
Fix EMUVER choosing current emulator on stockpile load or import
Foifur Oct 8, 2025
194283e
Add EMUVER and update emulator version to stockpile settings
Foifur Oct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Source/Frontend/UI/Components/Blast Editor/SanitizeToolForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ private void AddToStockpile(object sender, EventArgs e)
SystemCore = oldSk.SystemCore,
GameName = oldSk.GameName,
SyncSettings = oldSk.SyncSettings,
StateLocation = oldSk.StateLocation
StateLocation = oldSk.StateLocation,
EmuVer = oldSk.EmuVer
};
newSk.BlastLayer = (BlastLayer)oldSk.BlastLayer.Clone();
StockpileManagerUISide.StashHistory.Add(newSk);
Expand Down Expand Up @@ -323,7 +324,8 @@ private void AddToStash(object sender, EventArgs e)
SystemCore = oldSk.SystemCore,
GameName = oldSk.GameName,
SyncSettings = oldSk.SyncSettings,
StateLocation = oldSk.StateLocation
StateLocation = oldSk.StateLocation,
EmuVer = oldSk.EmuVer
};
newSk.BlastLayer = (BlastLayer)oldSk.BlastLayer.Clone();
StockpileManagerUISide.StashHistory.Add(newSk);
Expand Down Expand Up @@ -390,7 +392,8 @@ public FastSanitizer(StashKey originalStashkey, BlastLayer blClone)
SystemCore = originalStashkey.SystemCore,
GameName = originalStashkey.GameName,
SyncSettings = originalStashkey.SyncSettings,
StateLocation = originalStashkey.StateLocation
StateLocation = originalStashkey.StateLocation,
EmuVer = originalStashkey.EmuVer
};
internalSK.BlastLayer = blClone;
OriginalLayer = blClone;
Expand Down Expand Up @@ -522,7 +525,7 @@ internal async Task Disable50()
internal async Task LoadCorrupt()
{
internalSK.BlastLayer = new BlastLayer(shownHalf);
S.GET<GlitchHarvesterBlastForm>().IsCorruptionApplied = internalSK.Run();
S.GET<GlitchHarvesterBlastForm>().IsCorruptionApplied = await internalSK.Run();

await Task.Delay(1);
}
Expand Down Expand Up @@ -554,7 +557,7 @@ internal StashKey GetStashKeyMinusChanges()

internal async Task Replay()
{
S.GET<GlitchHarvesterBlastForm>().IsCorruptionApplied = internalSK.Run();
S.GET<GlitchHarvesterBlastForm>().IsCorruptionApplied = await internalSK.Run();

await Task.Delay(1);
}
Expand Down
17 changes: 9 additions & 8 deletions Source/Frontend/UI/Components/Controls/SavestateList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace RTCV.UI.Components.Controls
using System.Drawing.Design;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using CorruptCore;
using NetCore;
Expand Down Expand Up @@ -255,7 +256,8 @@ public void BtnSavestate_MouseDown(object sender, MouseEventArgs e)
SystemCore = psk.SystemCore,
GameName = psk.GameName,
SyncSettings = psk.SyncSettings,
StateLocation = psk.StateLocation
StateLocation = psk.StateLocation,
EmuVer = psk.EmuVer
};

newStashkey.BlastLayer = new BlastLayer();
Expand All @@ -268,7 +270,7 @@ public void BtnSavestate_MouseDown(object sender, MouseEventArgs e)
StashKey sk = StockpileManagerUISide.SaveState();
RegisterStashKeyTo(holder, sk);
})
.AddItem("Load this entry", (ob, ev) =>
.AddItem("Load this entry", async (ob, ev) =>
{
var holder = (SavestateHolder)((Button)sender).Parent;
StashKey psk = holder.sk;
Expand All @@ -279,7 +281,7 @@ public void BtnSavestate_MouseDown(object sender, MouseEventArgs e)
return;
}

StockpileManagerUISide.LoadState(psk);
await StockpileManagerUISide.LoadState(psk);
}
else
{
Expand Down Expand Up @@ -404,7 +406,7 @@ private bool CheckAndFixingMissingStates(StashKey psk)
return true;
}

public void LoadCurrentState()
public async Task LoadCurrentState()
{
StashKey psk = SelectedHolder?.sk;
if (psk != null)
Expand All @@ -414,7 +416,7 @@ public void LoadCurrentState()
return;
}

StockpileManagerUISide.LoadState(psk);
await StockpileManagerUISide.LoadState(psk);
}
else
{
Expand Down Expand Up @@ -524,7 +526,7 @@ private void btnSaveLoad_MouseDown(object sender, MouseEventArgs e)
}
}

internal void LoadPreviousSavestateNow()
internal async Task LoadPreviousSavestateNow()
{
var sk = SelectedHolder?.sk;

Expand All @@ -549,8 +551,7 @@ internal void LoadPreviousSavestateNow()
return;
}


StockpileManagerUISide.LoadState(prevHolder.sk);
await StockpileManagerUISide.LoadState(prevHolder.sk);
StockpileManagerUISide.CurrentStashkey = null;
S.GET<GlitchHarvesterBlastForm>().IsCorruptionApplied = false;
LocalNetCoreRouter.Route(NetCore.Endpoints.CorruptCore, NetCore.Commands.Remote.ClearBlastlayerCache, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,22 @@ private void UpdateCreateInfiniteUnits(object sender, EventArgs e)
RtcCore.CreateInfiniteUnits = cbCreateInfiniteUnits.Checked;
}

private void OnFormShown(object sender, EventArgs e)
public void UpdateMaxIntensity()
{
object paramValue = AllSpec.VanguardSpec[VSPEC.OVERRIDE_DEFAULTMAXINTENSITY];

if (paramValue is int maxIntensity)
{
multiTB_Intensity.SetMaximum(maxIntensity, false);
}
else
multiTB_Intensity.SetMaximum(65535, false);

if (multiTB_Intensity.Value > multiTB_Intensity.Maximum)
multiTB_Intensity.Value = multiTB_Intensity.Maximum;
}

private void OnFormShown(object sender, EventArgs e)
{
UpdateMaxIntensity();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ namespace RTCV.UI
using NetCore;
using RTCV.Common;
using Modular;
using System.Threading;
using System.Threading.Tasks;
using RTCV.NetCore.Enums;
using System.Timers;

public partial class GlitchHarvesterBlastForm : ComponentForm, IBlockable
{
Expand Down Expand Up @@ -95,7 +99,7 @@ private void UpdateBlastToggleColor(bool value)
this.updatingBackColor = false;
}

private void OnDragDrop(object sender, DragEventArgs e)
private async void OnDragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);
foreach (var f in files)
Expand All @@ -104,7 +108,7 @@ private void OnDragDrop(object sender, DragEventArgs e)
{
BlastLayer bl = BlastTools.LoadBlastLayerFromFile(f);
var newStashKey = new StashKey(RtcCore.GetRandomKey(), null, bl);
S.GET<GlitchHarvesterBlastForm>().IsCorruptionApplied = StockpileManagerUISide.ApplyStashkey(newStashKey, false, false);
S.GET<GlitchHarvesterBlastForm>().IsCorruptionApplied = await StockpileManagerUISide.ApplyStashkey(newStashKey, false, false);
}
}
}
Expand All @@ -114,24 +118,35 @@ private void OnDragEnter(object sender, DragEventArgs e)
e.Effect = DragDropEffects.Link;
}

public void OneTimeExecute()


public async void OneTimeExecute()
{
logger.Trace("Entering OneTimeExecute()");
//Disable autocorrupt
S.GET<CoreForm>().AutoCorrupt = false;

bool killswitchWasEnabled = AutoKillSwitch.Enabled;

// If the stockpile entry is from a different emulator, close the current one and wait until the new one has connected
if (!String.Equals(StockpileManagerUISide.CurrentStashkey.EmuVer, new DirectoryInfo(RtcCore.EmuDir).Name, StringComparison.OrdinalIgnoreCase))
{
if (!(await VanguardImplementation.SwapImplementation(StockpileManagerUISide.CurrentStashkey.EmuVer)))
return;
}

if (ghMode == GlitchHarvesterMode.CORRUPT)
{
IsCorruptionApplied = StockpileManagerUISide.ApplyStashkey(StockpileManagerUISide.CurrentStashkey, loadBeforeOperation);
IsCorruptionApplied = await StockpileManagerUISide.ApplyStashkey(StockpileManagerUISide.CurrentStashkey, loadBeforeOperation);
}
else if (ghMode == GlitchHarvesterMode.INJECT)
{
IsCorruptionApplied = StockpileManagerUISide.InjectFromStashkey(StockpileManagerUISide.CurrentStashkey, loadBeforeOperation);
IsCorruptionApplied = await StockpileManagerUISide.InjectFromStashkey(StockpileManagerUISide.CurrentStashkey, loadBeforeOperation);
S.GET<StashHistoryForm>().RefreshStashHistory();
}
else if (ghMode == GlitchHarvesterMode.ORIGINAL)
{
IsCorruptionApplied = StockpileManagerUISide.OriginalFromStashkey(StockpileManagerUISide.CurrentStashkey);
IsCorruptionApplied = await StockpileManagerUISide.OriginalFromStashkey(StockpileManagerUISide.CurrentStashkey);
}

if (Render.RenderAtLoad && loadBeforeOperation)
Expand All @@ -142,6 +157,13 @@ public void OneTimeExecute()
{
Render.StopRender();
}

logger.Trace("Unlocking Interface");
UICore.UnlockInterface();
logger.Trace("Load done");

AutoKillSwitch.Enabled = killswitchWasEnabled;

logger.Trace("Exiting OneTimeExecute()");
}

Expand Down Expand Up @@ -196,7 +218,7 @@ public void refreshRenderOutputButton()
}
}

public void Corrupt(object sender, EventArgs e)
public async void Corrupt(object sender, EventArgs e)
{
logger.Trace("btnCorrupt Clicked");

Expand All @@ -212,12 +234,6 @@ public void Corrupt(object sender, EventArgs e)
{
SetBlastButtonVisibility(false);

if (!(AllSpec.UISpec[UISPEC.SELECTEDDOMAINS] is string[] domains) || domains.Length == 0)
{
MessageBox.Show("Can't corrupt with no domains selected.");
return;
}

//Shut off autocorrupt if it's on.
//Leave this check here so we don't wastefully update the spec
if (S.GET<CoreForm>().AutoCorrupt)
Expand All @@ -238,7 +254,7 @@ public void Corrupt(object sender, EventArgs e)
sks.Add((StashKey)row.Cells[0].Value);
}

IsCorruptionApplied = StockpileManagerUISide.MergeStashkeys(sks);
IsCorruptionApplied = await StockpileManagerUISide.MergeStashkeys(sks);

S.GET<StashHistoryForm>().RefreshStashHistorySelectLast();
//lbStashHistory.TopIndex = lbStashHistory.Items.Count - 1;
Expand All @@ -257,7 +273,7 @@ public void Corrupt(object sender, EventArgs e)
}

S.GET<StashHistoryForm>().DontLoadSelectedStash = true;
IsCorruptionApplied = StockpileManagerUISide.Corrupt(loadBeforeOperation);
IsCorruptionApplied = await StockpileManagerUISide.Corrupt(loadBeforeOperation);
S.GET<StashHistoryForm>().RefreshStashHistorySelectLast();
}
else if (ghMode == GlitchHarvesterMode.INJECT)
Expand All @@ -278,7 +294,7 @@ public void Corrupt(object sender, EventArgs e)

S.GET<StashHistoryForm>().DontLoadSelectedStash = true;

IsCorruptionApplied = StockpileManagerUISide.InjectFromStashkey(StockpileManagerUISide.CurrentStashkey, loadBeforeOperation);
IsCorruptionApplied = await StockpileManagerUISide.InjectFromStashkey(StockpileManagerUISide.CurrentStashkey, loadBeforeOperation);
S.GET<StashHistoryForm>().RefreshStashHistorySelectLast();
}
else if (ghMode == GlitchHarvesterMode.ORIGINAL)
Expand All @@ -296,7 +312,7 @@ public void Corrupt(object sender, EventArgs e)
}

S.GET<StashHistoryForm>().DontLoadSelectedStash = true;
IsCorruptionApplied = StockpileManagerUISide.OriginalFromStashkey(StockpileManagerUISide.CurrentStashkey);
IsCorruptionApplied = await StockpileManagerUISide.OriginalFromStashkey(StockpileManagerUISide.CurrentStashkey);
}

if (Render.RenderAtLoad && loadBeforeOperation)
Expand Down Expand Up @@ -330,9 +346,9 @@ public void btnCorrupt_MouseDown(object sender, MouseEventArgs e)

new ContextMenuBuilder()
.AddItem("Blast + Send RAW To Stash", (ob, ev) => BlastRawStash())
.AddItem("Corrupt", (ob, ev) => CorruptWithMode(GlitchHarvesterMode.CORRUPT))
.AddItem("Inject", (ob, ev) => CorruptWithMode(GlitchHarvesterMode.INJECT))
.AddItem("Original", (ob, ev) => CorruptWithMode(GlitchHarvesterMode.ORIGINAL))
.AddItem("Corrupt", async (ob, ev) => await Task.Run(() => CorruptWithMode(GlitchHarvesterMode.CORRUPT)))
.AddItem("Inject", async (ob, ev) => await Task.Run(() => CorruptWithMode(GlitchHarvesterMode.INJECT)))
.AddItem("Original", async (ob, ev) => await Task.Run(() => CorruptWithMode(GlitchHarvesterMode.ORIGINAL)))
.Build()
.Show(this, locate);

Expand Down Expand Up @@ -428,7 +444,7 @@ private void OnRerollButtonMouseDown(object sender, MouseEventArgs e)
}
}

public void RerollSelected(object sender, EventArgs e)
public async void RerollSelected(object sender, EventArgs e)
{
if (!btnRerollSelected.Visible)
{
Expand Down Expand Up @@ -476,7 +492,7 @@ public void RerollSelected(object sender, EventArgs e)
.lbStashHistory.Items.Count - 1;
}

IsCorruptionApplied = StockpileManagerUISide.ApplyStashkey(StockpileManagerUISide.CurrentStashkey);
IsCorruptionApplied = await StockpileManagerUISide.ApplyStashkey(StockpileManagerUISide.CurrentStashkey);
}
}
finally
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@ public GlitchHarvesterIntensityForm()
multiTB_Intensity.ValueChanged += (sender, args) => RtcCore.Intensity = multiTB_Intensity.Value;
}

private void OnFormShown(object sender, EventArgs e)
public void UpdateMaxIntensity()
{
object paramValue = AllSpec.VanguardSpec[VSPEC.OVERRIDE_DEFAULTMAXINTENSITY];

if (paramValue != null && paramValue is int maxintensity)
{
multiTB_Intensity.SetMaximum(maxintensity, false);
}
if (paramValue is int maxIntensity)
multiTB_Intensity.SetMaximum(maxIntensity, false);
else
multiTB_Intensity.SetMaximum(65535, false);

if (multiTB_Intensity.Value > multiTB_Intensity.Maximum)
multiTB_Intensity.Value = multiTB_Intensity.Maximum;
}

private void OnFormShown(object sender, EventArgs e)
{
UpdateMaxIntensity();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,13 @@ private void loadSSK(bool import, string fileName)
}

var s = (string)AllSpec.VanguardSpec?[VSPEC.NAME] ?? "ERROR";
/*
if (!string.IsNullOrEmpty(ssk.VanguardImplementation) && !ssk.VanguardImplementation.Equals(s, StringComparison.OrdinalIgnoreCase) && ssk.VanguardImplementation != "ERROR")
{
MessageBox.Show($"The ssk you loaded is for a different Vanguard implementation.\nThe ssk reported {ssk.VanguardImplementation} but you're connected to {s}.\nThis is a fatal error. Aborting load.");
return;
}
*/

if (import)
{
Expand Down
Loading