Skip to content

Commit d930c69

Browse files
committed
Use manual memory barriers instead of volatile fields as the latter doesn't always match our intended memory barrier model.
Additionally, fix a typo.
1 parent c93d835 commit d930c69

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

TTMouseclickSimulator/Core/Toontown/Environment/ToontownInteractionProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected override sealed List<Process> FindProcesses()
4848
"Could not find Toontown Rewritten. Please make sure " +
4949
"TT Rewritten is running before starting the simulator.\n\n" +
5050
"If you're running Toontown Rewritten as administrator, you may also " +
51-
"need to the simulator as administrator.");
51+
"need to run the simulator as administrator.");
5252
}
5353

5454
return processes;
@@ -63,7 +63,7 @@ protected override sealed List<Process> FindProcesses()
6363
"Could not find Corporate Clash. Please make sure " +
6464
"Corporate Clash is running before starting the simulator.\n\n" +
6565
"If you're running Corporate Clash as administrator, you may also " +
66-
"need to the simulator as administrator.");
66+
"need to run the simulator as administrator.");
6767
}
6868

6969
return processes;

TTMouseclickSimulator/MainWindow.xaml.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ private bool HandleSimulatorRetry(Exception ex)
262262
{
263263
// Show a TaskDialog.
264264
bool result = false;
265+
265266
this.Dispatcher.Invoke(() =>
266267
{
267268
// If we cancelled the simulator already in the meanwhile, it wouldn't make
@@ -303,10 +304,14 @@ private bool HandleSimulatorRetry(Exception ex)
303304
var resultButton = FormsTaskDialog.ShowDialog(this, dialogPage);
304305

305306
if (resultButton == buttonTryAgain)
306-
Volatile.Write(ref result, true);
307+
{
308+
result = true;
309+
Thread.MemoryBarrier();
310+
}
307311
});
308312

309-
return Volatile.Read(ref result);
313+
Thread.MemoryBarrier();
314+
return result;
310315
}
311316

312317
private static string? GetExceptionDetailsText(Exception ex)

0 commit comments

Comments
 (0)