Skip to content

Commit 1be2738

Browse files
committed
EmuHawk: Remove PlatformSpecificMainLoopCrashHandler implementation. Microsoft.VisualBasic can be referenced without issue using mono if mono-vbnc is installed
1 parent cc532a2 commit 1be2738

File tree

1 file changed

+5
-57
lines changed

1 file changed

+5
-57
lines changed

BizHawk.Client.EmuHawk/Program.cs

+5-57
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,7 @@ static int Main(string[] args)
8989
return SubMain(args);
9090
}
9191

92-
private interface PlatformSpecificMainLoopCrashHandler
93-
{
94-
void TryCatchFinally(string[] args);
95-
}
96-
private class Win32MainLoopCrashHandler : PlatformSpecificMainLoopCrashHandler
92+
private class MainLoopCrashHandler
9793
{
9894
public void TryCatchFinally(string[] args)
9995
{
@@ -153,56 +149,8 @@ public void TryCatchFinally(string[] args)
153149
}
154150
}
155151
}
156-
private class UnixMonoMainLoopCrashHandler : PlatformSpecificMainLoopCrashHandler
157-
{
158-
// Identical to the implementation in Win32MainLoopCrashHandler sans the single-instance check.
159-
public void TryCatchFinally(string[] args)
160-
{
161-
try
162-
{
163-
using (var mf = new MainForm(args))
164-
{
165-
var title = mf.Text;
166-
mf.Show();
167-
mf.Text = title;
168-
try
169-
{
170-
GlobalWin.ExitCode = mf.ProgramRunLoop();
171-
}
172-
catch (Exception e) when (!Debugger.IsAttached && !VersionInfo.DeveloperBuild && Global.MovieSession.Movie.IsActive)
173-
{
174-
var result = MessageBox.Show(
175-
"EmuHawk has thrown a fatal exception and is about to close.\nA movie has been detected. Would you like to try to save?\n(Note: Depending on what caused this error, this may or may not succeed)",
176-
"Fatal error: " + e.GetType().Name,
177-
MessageBoxButtons.YesNo,
178-
MessageBoxIcon.Exclamation
179-
);
180-
if (result == DialogResult.Yes)
181-
{
182-
Global.MovieSession.Movie.Save();
183-
}
184-
}
185-
}
186-
}
187-
catch (Exception e) when (!Debugger.IsAttached)
188-
{
189-
new ExceptionBox(e).ShowDialog();
190-
}
191-
finally
192-
{
193-
if (GlobalWin.Sound != null)
194-
{
195-
GlobalWin.Sound.Dispose();
196-
GlobalWin.Sound = null;
197-
}
198-
GlobalWin.GL.Dispose();
199-
Input.Cleanup();
200-
}
201-
}
202-
}
203-
private static PlatformSpecificMainLoopCrashHandler mainLoopCrashHandler = EXE_PROJECT.PlatformLinkedLibSingleton.RunningOnUnix
204-
? (PlatformSpecificMainLoopCrashHandler) new UnixMonoMainLoopCrashHandler()
205-
: (PlatformSpecificMainLoopCrashHandler) new Win32MainLoopCrashHandler();
152+
153+
private static MainLoopCrashHandler mainLoopCrashHandler = new MainLoopCrashHandler();
206154

207155
//NoInlining should keep this code from getting jammed into Main() which would create dependencies on types which havent been setup by the resolver yet... or something like that
208156
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
@@ -422,7 +370,7 @@ static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs ar
422370
}
423371
}
424372

425-
#if WINDOWS
373+
//#if WINDOWS
426374
public class SingleInstanceController : WindowsFormsApplicationBase
427375
{
428376
readonly string[] cmdArgs;
@@ -450,6 +398,6 @@ protected override void OnCreateMainForm()
450398
}
451399

452400

453-
#endif
401+
//#endif
454402
}
455403
}

0 commit comments

Comments
 (0)