Remove some duplicated code. Also trying some C# 6 stuff, let's see what breaks.
This commit is contained in:
parent
23fb06a0cd
commit
85c1a42e48
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -200,42 +201,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
string dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
|
string dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
|
||||||
SetDllDirectory(dllDir);
|
SetDllDirectory(dllDir);
|
||||||
|
|
||||||
if (System.Diagnostics.Debugger.IsAttached)
|
|
||||||
{ // Let the debugger handle errors
|
|
||||||
#if WINDOWS
|
|
||||||
if (Global.Config.SingleInstanceMode)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
new SingleInstanceController(args).Run(args);
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException)
|
|
||||||
{
|
|
||||||
/*Eat it, MainForm disposed itself and Run attempts to dispose of itself. Eventually we would want to figure out a way to prevent that, but in the meantime it is harmless, so just eat the error*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
using (var mf = new MainForm(args))
|
|
||||||
{
|
|
||||||
var title = mf.Text;
|
|
||||||
mf.Show();
|
|
||||||
mf.Text = title;
|
|
||||||
|
|
||||||
GlobalWin.ExitCode = mf.ProgramRunLoop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (GlobalWin.Sound != null)
|
|
||||||
{
|
|
||||||
GlobalWin.Sound.Dispose();
|
|
||||||
GlobalWin.Sound = null;
|
|
||||||
}
|
|
||||||
GlobalWin.GL.Dispose();
|
|
||||||
Input.Cleanup();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Display error message windows
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if WINDOWS
|
#if WINDOWS
|
||||||
|
@ -259,20 +224,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
mf.Show();
|
mf.Show();
|
||||||
mf.Text = title;
|
mf.Text = title;
|
||||||
|
|
||||||
if (System.Diagnostics.Debugger.IsAttached)
|
|
||||||
{
|
|
||||||
GlobalWin.ExitCode = mf.ProgramRunLoop();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GlobalWin.ExitCode = mf.ProgramRunLoop();
|
GlobalWin.ExitCode = mf.ProgramRunLoop();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e) when (!Debugger.IsAttached && !VersionInfo.DeveloperBuild && Global.MovieSession.Movie.IsActive)
|
||||||
{
|
|
||||||
#if WINDOWS
|
|
||||||
if (!VersionInfo.DeveloperBuild && Global.MovieSession.Movie.IsActive)
|
|
||||||
{
|
{
|
||||||
var result = MessageBox.Show(
|
var result = MessageBox.Show(
|
||||||
"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)",
|
"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)",
|
||||||
|
@ -285,14 +241,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Global.MovieSession.Movie.Save();
|
Global.MovieSession.Movie.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (Exception e) when (!Debugger.IsAttached)
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
new ExceptionBox(e).ShowDialog();
|
new ExceptionBox(e).ShowDialog();
|
||||||
}
|
}
|
||||||
|
@ -306,7 +258,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
GlobalWin.GL.Dispose();
|
GlobalWin.GL.Dispose();
|
||||||
Input.Cleanup();
|
Input.Cleanup();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//cleanup:
|
//cleanup:
|
||||||
//cleanup IGL stuff so we can get better refcounts when exiting process, for debugging
|
//cleanup IGL stuff so we can get better refcounts when exiting process, for debugging
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
set PATH=%PATH%;C:\Program Files (x86)\git\bin;C:\Program Files\git\bin
|
rem set PATH=%PATH%;C:\Program Files (x86)\git\bin;C:\Program Files\git\bin
|
||||||
|
|
||||||
if "%1"=="" (
|
if "%1"=="" (
|
||||||
SET NAME=BizHawk.zip
|
SET NAME=BizHawk.zip
|
||||||
|
@ -9,10 +9,10 @@ if "%1"=="" (
|
||||||
git --version > NUL
|
git --version > NUL
|
||||||
@if errorlevel 1 goto MISSINGGIT
|
@if errorlevel 1 goto MISSINGGIT
|
||||||
|
|
||||||
reg query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildToolsPath > nul 2>&1
|
reg query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v MSBuildToolsPath > nul 2>&1
|
||||||
if ERRORLEVEL 1 goto MISSINGMSBUILD
|
if ERRORLEVEL 1 goto MISSINGMSBUILD
|
||||||
|
|
||||||
for /f "skip=2 tokens=2,*" %%A in ('reg.exe query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0" /v MSBuildToolsPath') do SET MSBUILDDIR=%%B
|
for /f "skip=2 tokens=2,*" %%A in ('reg.exe query "HKLM\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0" /v MSBuildToolsPath') do SET MSBUILDDIR=%%B
|
||||||
|
|
||||||
IF NOT EXIST %MSBUILDDIR%nul goto MISSINGMSBUILD
|
IF NOT EXIST %MSBUILDDIR%nul goto MISSINGMSBUILD
|
||||||
IF NOT EXIST %MSBUILDDIR%msbuild.exe goto MISSINGMSBUILD
|
IF NOT EXIST %MSBUILDDIR%msbuild.exe goto MISSINGMSBUILD
|
||||||
|
|
Loading…
Reference in New Issue