remove some unused code, and a few other misc cleanups

This commit is contained in:
adelikat 2019-12-06 19:22:23 -06:00
parent 4e7d19fa18
commit 70840c1b54
6 changed files with 12 additions and 82 deletions

View File

@ -2,11 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.IO; using System.IO;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
class ArgParser public class ArgParser
//parses command line arguments and adds the values to a class attribute //parses command line arguments and adds the values to a class attribute
//default values are null for strings and false for boolean //default values are null for strings and false for boolean
//the last value will overwrite previously set values //the last value will overwrite previously set values
@ -161,7 +160,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
//inititalize socket server // initialize socket server
if (socket_ip != null && socket_port > 0) if (socket_ip != null && socket_port > 0)
{ {
GlobalWin.socketServer = new Communication.SocketServer(); GlobalWin.socketServer = new Communication.SocketServer();
@ -185,13 +184,8 @@ namespace BizHawk.Client.EmuHawk
return args.FirstOrDefault(arg => arg.StartsWith("--config=", StringComparison.InvariantCultureIgnoreCase))?.Substring(9); return args.FirstOrDefault(arg => arg.StartsWith("--config=", StringComparison.InvariantCultureIgnoreCase))?.Substring(9);
} }
} }
public class ArgParserException : Exception
class ArgParserException : Exception
{ {
public ArgParserException()
{
}
public ArgParserException(string message) : base(message) public ArgParserException(string message) : base(message)
{ {
} }

View File

@ -1,52 +1,14 @@
using System; using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing; using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles; using Microsoft.Win32.SafeHandles;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public unsafe static class Win32 public static unsafe class Win32
{ {
public static bool Is64BitProcess { get { return (IntPtr.Size == 8); } }
public static bool Is64BitOperatingSystem { get { return Is64BitProcess || InternalCheckIsWow64(); } }
[DllImport("kernel32.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool IsWow64Process(
[In] IntPtr hProcess,
[Out] out bool wow64Process
);
[DllImport("kernel32.dll")] [DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string dllToLoad); public static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
[DllImport("kernel32.dll")]
public static extern bool FreeLibrary(IntPtr hModule);
static bool InternalCheckIsWow64()
{
if ((Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1) ||
Environment.OSVersion.Version.Major >= 6)
{
using (var p = System.Diagnostics.Process.GetCurrentProcess())
{
bool retVal;
if (!IsWow64Process(p.Handle, out retVal))
{
return false;
}
return retVal;
}
}
else
{
return false;
}
}
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct RECT public struct RECT
@ -238,7 +200,6 @@ namespace BizHawk.Client.EmuHawk
public const int WAVE_FORMAT_PCM = 1; public const int WAVE_FORMAT_PCM = 1;
public const int AVIIF_KEYFRAME = 0x00000010; public const int AVIIF_KEYFRAME = 0x00000010;
[Flags] [Flags]
public enum OpenFileStyle : uint public enum OpenFileStyle : uint
{ {
@ -434,13 +395,11 @@ namespace BizHawk.Client.EmuHawk
// Release an open AVI stream // Release an open AVI stream
[DllImport("avifil32.dll")] [DllImport("avifil32.dll")]
public static extern int AVIStreamRelease( public static extern int AVIStreamRelease(IntPtr pavi);
IntPtr pavi);
// Release an open AVI stream // Release an open AVI stream
[DllImport("avifil32.dll")] [DllImport("avifil32.dll")]
public static extern int AVIFileRelease( public static extern int AVIFileRelease(IntPtr pfile);
IntPtr pfile);
// Replacement of mmioFOURCC macros // Replacement of mmioFOURCC macros

View File

@ -1,10 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
@ -16,25 +10,13 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent(); InitializeComponent();
} }
public BmpView BmpView { get { return bmpView1; } } public BmpView BmpView => bmpView1;
[Browsable(false)]
public bool ShouldDraw { get { return this.Visible; } }
public override string ToString() public override string ToString()
{ {
return Text; return Text;
} }
public void SetDetails(IList<Tuple<string, string>> details)
{
listView1.Items.Clear();
foreach (var t in details)
{
listView1.Items.Add(new ListViewItem(new string[] { t.Item1, t.Item2 }));
}
}
private void MobileDetailView_SizeChanged(object sender, EventArgs e) private void MobileDetailView_SizeChanged(object sender, EventArgs e)
{ {
// bmp view is always square // bmp view is always square

View File

@ -26,7 +26,7 @@ namespace BizHawk.Client.EmuHawk
[ConfigPersist] [ConfigPersist]
private List<RollColumn> Columns private List<RollColumn> Columns
{ {
get { return TraceView.AllColumns; } get => TraceView.AllColumns;
set set
{ {
TraceView.AllColumns.Clear(); TraceView.AllColumns.Clear();
@ -42,7 +42,7 @@ namespace BizHawk.Client.EmuHawk
private FileInfo _logFile; private FileInfo _logFile;
private FileInfo LogFile private FileInfo LogFile
{ {
get { return _logFile; } get => _logFile;
set set
{ {
_logFile = value; _logFile = value;
@ -94,10 +94,7 @@ namespace BizHawk.Client.EmuHawk
}); });
} }
public bool UpdateBefore public bool UpdateBefore => false;
{
get { return false; }
}
public bool AskSaveChanges() public bool AskSaveChanges()
{ {

View File

@ -10,7 +10,6 @@ namespace BizHawk.Client.EmuHawk
public partial class VirtualPadTargetScreen : UserControl, IVirtualPadControl public partial class VirtualPadTargetScreen : UserControl, IVirtualPadControl
{ {
private readonly Pen BlackPen = new Pen(Brushes.Black, 2); private readonly Pen BlackPen = new Pen(Brushes.Black, 2);
private readonly Pen WhitePen = new Pen(Brushes.White, 2);
private readonly Pen GrayPen = new Pen(Brushes.Gray, 2); private readonly Pen GrayPen = new Pen(Brushes.Gray, 2);
private readonly Pen RedPen = new Pen(Brushes.Red, 2); private readonly Pen RedPen = new Pen(Brushes.Red, 2);
@ -19,8 +18,8 @@ namespace BizHawk.Client.EmuHawk
private bool _readonly; private bool _readonly;
private bool _isSet; // The tool has to keep track of this because there is currently no way to know if a float button is being autoheld or just held private bool _isSet; // The tool has to keep track of this because there is currently no way to know if a float button is being autoheld or just held
private int? _overrideX = null; private int? _overrideX;
private int? _overrideY = null; private int? _overrideY;
public VirtualPadTargetScreen() public VirtualPadTargetScreen()
{ {

View File

@ -10,7 +10,6 @@ namespace BizHawk.Client.EmuHawk
[Schema("INTV")] [Schema("INTV")]
public class IntvSchema : IVirtualPadSchema public class IntvSchema : IVirtualPadSchema
{ {
private string UnpluggedControllerName => typeof(UnpluggedController).DisplayName();
private string StandardControllerName => typeof(StandardController).DisplayName(); private string StandardControllerName => typeof(StandardController).DisplayName();
private string AnalogControllerName => typeof(FakeAnalogController).DisplayName(); private string AnalogControllerName => typeof(FakeAnalogController).DisplayName();