remove redundant code throughout the emuhawk project

This commit is contained in:
adelikat 2014-06-29 02:28:48 +00:00
parent dbf89440f6
commit ab5cfab035
33 changed files with 105 additions and 124 deletions

View File

@ -81,7 +81,7 @@ namespace BizHawk.Client.EmuHawk
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show("AVIFIL32 Thread died:\n\n" + e.ToString());
System.Windows.Forms.MessageBox.Show("AVIFIL32 Thread died:\n\n" + e);
return;
}
}
@ -493,12 +493,12 @@ namespace BizHawk.Client.EmuHawk
public string Serialize()
{
return System.Convert.ToBase64String(SerializeToByteArray());
return Convert.ToBase64String(SerializeToByteArray());
}
public static CodecToken DeSerialize(string s)
{
return DeSerializeFromByteArray(System.Convert.FromBase64String(s));
return DeSerializeFromByteArray(Convert.FromBase64String(s));
}
}

View File

@ -53,7 +53,7 @@ namespace BizHawk.Client.EmuHawk
/// <param name="cmax">maximum compression level</param>
/// <param name="hwnd">hwnd of parent</param>
/// <returns>false if user canceled; true if user consented</returns>
public static bool DoCompressionDlg(ref int threads, ref int complevel, int tmin, int tmax, int cmin, int cmax, System.Windows.Forms.IWin32Window hwnd)
public static bool DoCompressionDlg(ref int threads, ref int complevel, int tmin, int tmax, int cmin, int cmax, IWin32Window hwnd)
{
JMDForm j = new JMDForm();
j.threadsBar.Minimum = tmin;

View File

@ -228,14 +228,14 @@ namespace BizHawk.Client.EmuHawk
writeBE16(2); // data channel
writeBE32(0); // timestamp (same time as previous packet)
f.WriteByte(71); // gamename
temp = System.Text.Encoding.UTF8.GetBytes(mmd.gamename);
temp = Encoding.UTF8.GetBytes(mmd.gamename);
writeVar(temp.Length);
f.Write(temp, 0, temp.Length);
writeBE16(2);
writeBE32(0);
f.WriteByte(65); // authors
temp = System.Text.Encoding.UTF8.GetBytes(mmd.authors);
temp = Encoding.UTF8.GetBytes(mmd.authors);
writeVar(temp.Length);
f.Write(temp, 0, temp.Length);
@ -652,7 +652,7 @@ namespace BizHawk.Client.EmuHawk
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show("JMD Worker Thread died:\n\n" + e.ToString());
System.Windows.Forms.MessageBox.Show("JMD Worker Thread died:\n\n" + e);
return;
}
}
@ -711,7 +711,7 @@ namespace BizHawk.Client.EmuHawk
m.WriteByte((byte)(v.BufferWidth & 255));
m.WriteByte((byte)(v.BufferHeight >> 8));
m.WriteByte((byte)(v.BufferHeight & 255));
var g = new DeflaterOutputStream(m, new ICSharpCode.SharpZipLib.Zip.Compression.Deflater(token.compressionlevel));
var g = new DeflaterOutputStream(m, new Deflater(token.compressionlevel));
g.IsStreamOwner = false; // leave memory stream open so we can pick its contents
g.Write(v.VideoBuffer, 0, v.VideoBuffer.Length);
g.Flush();

View File

@ -69,7 +69,7 @@ namespace BizHawk.Client.EmuHawk
class DummyDisposable : IDisposable { public void Dispose() { } }
public IDisposable AcquireVideoCodecToken(System.Windows.Forms.IWin32Window hwnd) { return new DummyDisposable(); }
public IDisposable AcquireVideoCodecToken(IWin32Window hwnd) { return new DummyDisposable(); }
public void SetMovieParameters(int fpsnum, int fpsden)
{

View File

@ -38,7 +38,7 @@ namespace BizHawk.Client.EmuHawk
var ofd = new OpenFileDialog();
ofd.FileName = PathManager.FilesystemSafeName(Global.Game) + ".syncless.txt";
ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null);
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
if (ofd.ShowDialog() == DialogResult.Cancel)
return;
mSynclessConfigFile = ofd.FileName;
@ -101,7 +101,7 @@ namespace BizHawk.Client.EmuHawk
var sfd = new SaveFileDialog();
sfd.FileName = Path.ChangeExtension(mSynclessConfigFile, ".avi");
sfd.InitialDirectory = Path.GetDirectoryName(sfd.FileName);
if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
if (sfd.ShowDialog() == DialogResult.Cancel)
return;
using (AviWriter avw = new AviWriter())

View File

@ -52,7 +52,7 @@ namespace BizHawk.Client.EmuHawk
this.m_sysIcon = icon;
if (this.m_sysIcon == null)
this.messageLbl.Location = new System.Drawing.Point(FORM_X_MARGIN, FORM_Y_MARGIN);
this.messageLbl.Location = new Point(FORM_X_MARGIN, FORM_Y_MARGIN);
}
public void SetMessageToAutoSize()

View File

@ -71,8 +71,8 @@ namespace BizHawk.Client.EmuHawk
g.CompositingQuality = CompositingQuality.HighSpeed;
if (ScaleImage)
{
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
g.InterpolationMode = InterpolationMode.NearestNeighbor;
g.PixelOffsetMode = PixelOffsetMode.Half;
g.DrawImage(bmp, 0, 0, Width, Height);
}
else

View File

@ -325,7 +325,7 @@ namespace BizHawk.Client.EmuHawk
public static extern FileType GetFileType(IntPtr hFile);
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern System.IntPtr GetCommandLine();
public static extern IntPtr GetCommandLine();
public enum FileType : uint
{

View File

@ -3,27 +3,16 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.FilterManager;
using BizHawk.Client.EmuHawk;
using BizHawk.Bizware.BizwareGL;
using OpenTK;
using OpenTK.Graphics;
namespace BizHawk.Client.EmuHawk
{
@ -34,11 +23,11 @@ namespace BizHawk.Client.EmuHawk
/// </summary>
public class DisplayManager : IDisposable
{
class DisplayManagerRenderTargetProvider : FilterManager.IRenderTargetProvider
class DisplayManagerRenderTargetProvider : IRenderTargetProvider
{
DisplayManagerRenderTargetProvider(Func<Size, RenderTarget> callback) { Callback = callback; }
Func<Size, RenderTarget> Callback;
RenderTarget FilterManager.IRenderTargetProvider.Get(Size size)
RenderTarget IRenderTargetProvider.Get(Size size)
{
return Callback(size);
}
@ -68,18 +57,18 @@ namespace BizHawk.Client.EmuHawk
using (var tex = typeof(Program).Assembly.GetManifestResourceStream("BizHawk.Client.EmuHawk.Resources.courier16px_0.png"))
TheOneFont = new StringRenderer(GL, xml, tex);
var fiHq2x = new FileInfo(System.IO.Path.Combine(PathManager.GetExeDirectoryAbsolute(),"Shaders/BizHawk/hq2x.cgp"));
var fiHq2x = new FileInfo(Path.Combine(PathManager.GetExeDirectoryAbsolute(),"Shaders/BizHawk/hq2x.cgp"));
if(fiHq2x.Exists)
using(var stream = fiHq2x.OpenRead())
ShaderChain_hq2x = new Filters.RetroShaderChain(GL, new Filters.RetroShaderPreset(stream), System.IO.Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk"));
var fiScanlines = new FileInfo(System.IO.Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk/BizScanlines.cgp"));
ShaderChain_hq2x = new Filters.RetroShaderChain(GL, new Filters.RetroShaderPreset(stream), Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk"));
var fiScanlines = new FileInfo(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk/BizScanlines.cgp"));
if (fiScanlines.Exists)
using (var stream = fiScanlines.OpenRead())
ShaderChain_scanlines = new Filters.RetroShaderChain(GL, new Filters.RetroShaderPreset(stream), System.IO.Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk"));
var fiBicubic = new FileInfo(System.IO.Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk/bicubic-fast.cgp"));
ShaderChain_scanlines = new Filters.RetroShaderChain(GL, new Filters.RetroShaderPreset(stream), Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk"));
var fiBicubic = new FileInfo(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk/bicubic-fast.cgp"));
if (fiBicubic.Exists)
using (var stream = fiBicubic.OpenRead())
ShaderChain_bicubic = new Filters.RetroShaderChain(GL, new Filters.RetroShaderPreset(stream), System.IO.Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk"));
ShaderChain_bicubic = new Filters.RetroShaderChain(GL, new Filters.RetroShaderPreset(stream), Path.Combine(PathManager.GetExeDirectoryAbsolute(), "Shaders/BizHawk"));
LuaSurfaceSets["emu"] = new SwappableDisplaySurfaceSet();
LuaSurfaceSets["native"] = new SwappableDisplaySurfaceSet();
@ -115,7 +104,7 @@ namespace BizHawk.Client.EmuHawk
PresentationPanel presentationPanel; //well, its the final layer's target, at least
GraphicsControl GraphicsControl; //well, its the final layer's target, at least
GLManager.ContextRef CR_GraphicsControl;
FilterManager.FilterProgram CurrentFilterProgram;
FilterProgram CurrentFilterProgram;
/// <summary>
/// these variables will track the dimensions of the last frame's (or the next frame? this is confusing) emulator native output size
@ -140,7 +129,7 @@ namespace BizHawk.Client.EmuHawk
}
}
FilterManager.FilterProgram BuildDefaultChain(Size chain_insize, Size chain_outsize)
FilterProgram BuildDefaultChain(Size chain_insize, Size chain_outsize)
{
//select user special FX shader chain
Dictionary<string, object> selectedChainProperties = new Dictionary<string, object>();
@ -172,7 +161,7 @@ namespace BizHawk.Client.EmuHawk
Renderer.End();
};
FilterManager.FilterProgram chain = new FilterManager.FilterProgram();
var chain = new FilterProgram();
//add the first filter, encompassing output from the emulator core
chain.AddFilter(fInput, "input");
@ -211,7 +200,7 @@ namespace BizHawk.Client.EmuHawk
return chain;
}
void AppendRetroShaderChain(FilterManager.FilterProgram program, string name, Filters.RetroShaderChain retroChain, Dictionary<string, object> properties)
void AppendRetroShaderChain(FilterProgram program, string name, Filters.RetroShaderChain retroChain, Dictionary<string, object> properties)
{
for (int i = 0; i < retroChain.Passes.Length; i++)
{
@ -223,7 +212,7 @@ namespace BizHawk.Client.EmuHawk
}
}
Filters.LuaLayer AppendLuaLayer(FilterManager.FilterProgram chain, string name)
Filters.LuaLayer AppendLuaLayer(FilterProgram chain, string name)
{
Texture2d luaNativeTexture = null;
var luaNativeSurface = LuaSurfaceSets[name].GetCurrent();
@ -350,7 +339,7 @@ namespace BizHawk.Client.EmuHawk
public BitmapBuffer offscreenBB;
}
FilterManager.FilterProgram UpdateSourceInternal(JobInfo job)
FilterProgram UpdateSourceInternal(JobInfo job)
{
GlobalWin.GLManager.Activate(CR_GraphicsControl);
@ -408,7 +397,7 @@ TESTEROO:
//build the default filter chain and set it up with services filters will need
Size chain_insize = new Size(bufferWidth, bufferHeight);
FilterManager.FilterProgram filterProgram = BuildDefaultChain(chain_insize, chain_outsize);
var filterProgram = BuildDefaultChain(chain_insize, chain_outsize);
filterProgram.GuiRenderer = Renderer;
filterProgram.GL = GL;
@ -457,7 +446,7 @@ TESTEROO:
{
switch (step.Type)
{
case FilterManager.FilterProgram.ProgramStepType.Run:
case FilterProgram.ProgramStepType.Run:
{
int fi = (int)step.Args;
var f = CurrentFilterProgram.Filters[fi];
@ -466,7 +455,7 @@ TESTEROO:
var orec = f.FindOutput();
if (orec != null)
{
if (orec.SurfaceDisposition == FilterManager.SurfaceDisposition.Texture)
if (orec.SurfaceDisposition == SurfaceDisposition.Texture)
{
texCurr = f.GetOutput();
rtCurr = null;
@ -474,7 +463,7 @@ TESTEROO:
}
break;
}
case FilterManager.FilterProgram.ProgramStepType.NewTarget:
case FilterProgram.ProgramStepType.NewTarget:
{
var size = (Size)step.Args;
rtCurr = ShaderChainFrugalizers[rtCounter++].Get(size);
@ -482,7 +471,7 @@ TESTEROO:
CurrentFilterProgram.CurrRenderTarget = rtCurr;
break;
}
case FilterManager.FilterProgram.ProgramStepType.FinalTarget:
case FilterProgram.ProgramStepType.FinalTarget:
{
var size = (Size)step.Args;
inFinalTarget = true;

View File

@ -276,9 +276,9 @@ namespace BizHawk.Client.EmuHawk.Filters
DeclareOutput(state);
}
Bizware.BizwareGL.Texture2d Texture;
Texture2d Texture;
public void SetTexture(Bizware.BizwareGL.Texture2d tex)
public void SetTexture(Texture2d tex)
{
Texture = tex;
}

View File

@ -56,8 +56,8 @@ namespace BizHawk.Client.EmuHawk
MessageFont = blitter.GetFontType("MessageFont");
}
public System.Drawing.Color FixedMessagesColor { get { return System.Drawing.Color.FromArgb(Global.Config.MessagesColor); } }
public System.Drawing.Color FixedAlertMessageColor { get { return System.Drawing.Color.FromArgb(Global.Config.AlertMessageColor); } }
public Color FixedMessagesColor { get { return Color.FromArgb(Global.Config.MessagesColor); } }
public Color FixedAlertMessageColor { get { return Color.FromArgb(Global.Config.AlertMessageColor); } }
public OSDManager()
{

View File

@ -17,17 +17,16 @@ namespace BizHawk.Client.EmuHawk
IsAvailable = false;
try
{
var test = new SlimDX.XInput.Controller(UserIndex.One).IsConnected;
IsAvailable = true;
}
catch { }
if (!IsAvailable) return;
var c1 = new SlimDX.XInput.Controller(UserIndex.One);
var c2 = new SlimDX.XInput.Controller(UserIndex.Two);
var c3 = new SlimDX.XInput.Controller(UserIndex.Three);
var c4 = new SlimDX.XInput.Controller(UserIndex.Four);
var c1 = new Controller(UserIndex.One);
var c2 = new Controller(UserIndex.Two);
var c3 = new Controller(UserIndex.Three);
var c4 = new Controller(UserIndex.Four);
if (c1.IsConnected) Devices.Add(new GamePad360(c1));
if (c2.IsConnected) Devices.Add(new GamePad360(c2));
@ -44,10 +43,10 @@ namespace BizHawk.Client.EmuHawk
// ********************************** Instance Members **********************************
readonly SlimDX.XInput.Controller controller;
readonly Controller controller;
State state;
GamePad360(SlimDX.XInput.Controller c)
GamePad360(Controller c)
{
controller = c;
InitializeButtons();

View File

@ -1487,7 +1487,7 @@ namespace BizHawk.Client.EmuHawk
{
var Message = String.Format("Invalid file format. Reason: {0} \nForce transfer? This may cause the calculator to crash.", ex.Message);
if (MessageBox.Show(Message, "Upload Failed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
if (MessageBox.Show(Message, "Upload Failed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{
(Global.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), false);
}
@ -1784,7 +1784,7 @@ namespace BizHawk.Client.EmuHawk
private void DGBsettingsToolStripMenuItem_Click(object sender, EventArgs e)
{
BizHawk.Client.EmuHawk.config.GB.DGBPrefs.DoDGBPrefsDialog(this);
config.GB.DGBPrefs.DoDGBPrefsDialog(this);
}
#endregion
@ -1954,8 +1954,10 @@ namespace BizHawk.Client.EmuHawk
private void DisplayConfigMenuItem_Click(object sender, EventArgs e)
{
var result = new config.DisplayConfigLite().ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)
if (result == DialogResult.OK)
{
FrameBufferResized();
}
}
private void CoreSelectionContextSubMenu_DropDownOpened(object sender, EventArgs e)
@ -2223,7 +2225,7 @@ namespace BizHawk.Client.EmuHawk
}
catch (Exception ex)
{
MessageBox.Show("Exception on drag and drop:\n" + ex.ToString());
MessageBox.Show("Exception on drag and drop:\n" + ex);
}
}

View File

@ -743,14 +743,14 @@ namespace BizHawk.Client.EmuHawk
// hackish
if (o.Item1 == "WMouse X")
{
var P = GlobalWin.DisplayManager.UntransformPoint(new System.Drawing.Point((int)o.Item2, 0));
var P = GlobalWin.DisplayManager.UntransformPoint(new Point((int)o.Item2, 0));
float x = P.X / (float)Global.Emulator.VideoProvider.BufferWidth;
return new Tuple<string, float>("WMouse X", x * 20000 - 10000);
}
if (o.Item1 == "WMouse Y")
{
var P = GlobalWin.DisplayManager.UntransformPoint(new System.Drawing.Point(0, (int)o.Item2));
var P = GlobalWin.DisplayManager.UntransformPoint(new Point(0, (int)o.Item2));
float y = P.Y / (float)Global.Emulator.VideoProvider.BufferHeight;
return new Tuple<string, float>("WMouse Y", y * 20000 - 10000);
}
@ -887,7 +887,7 @@ namespace BizHawk.Client.EmuHawk
//(this could be determined with more work; other side affects of the fullscreen mode include: corrupted taskbar, no modal boxes on top of GL control, no screenshots)
//At any rate, we can solve this by adding a 1px black border around the GL control
//Please note: It is important to do this before resizing things, otherwise momentarily a GL control without WS_BORDER will be at the magic dimensions and cause the flakeout
Padding = new System.Windows.Forms.Padding(1);
Padding = new Padding(1);
BackColor = Color.Black;
#endif
@ -909,7 +909,7 @@ namespace BizHawk.Client.EmuHawk
WindowState = FormWindowState.Normal;
#if WINDOWS
Padding = new System.Windows.Forms.Padding(0);
Padding = new Padding(0);
//it's important that we set the form color back to this, because the statusbar icons blend onto the mainform, not onto the statusbar--
//so we need the statusbar and mainform backdrop color to match
BackColor = SystemColors.Control;
@ -2402,7 +2402,7 @@ namespace BizHawk.Client.EmuHawk
}
else if (Global.Emulator is Gameboy)
{
CoreNameStatusBarButton.Image = BizHawk.Client.EmuHawk.Properties.Resources.gambatte;
CoreNameStatusBarButton.Image = Properties.Resources.gambatte;
}
else
{
@ -2749,7 +2749,7 @@ namespace BizHawk.Client.EmuHawk
if (ext == "<directory>")
{
var fbd = new FolderBrowserEx();
if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
if (fbd.ShowDialog() == DialogResult.Cancel)
{
aw.Dispose();
return;
@ -2874,7 +2874,7 @@ namespace BizHawk.Client.EmuHawk
IDisposable disposableOutput = null;
if (_avwriterResizew > 0 && _avwriterResizeh > 0)
{
BizHawk.Bizware.BizwareGL.BitmapBuffer bbin = null;
BitmapBuffer bbin = null;
Bitmap bmpin = null;
Bitmap bmpout = null;
try
@ -2885,7 +2885,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
bbin = new Bizware.BizwareGL.BitmapBuffer(Global.Emulator.VideoProvider.BufferWidth, Global.Emulator.VideoProvider.BufferHeight, Global.Emulator.VideoProvider.GetVideoBuffer());
bbin = new BitmapBuffer(Global.Emulator.VideoProvider.BufferWidth, Global.Emulator.VideoProvider.BufferHeight, Global.Emulator.VideoProvider.GetVideoBuffer());
}
@ -3259,7 +3259,7 @@ namespace BizHawk.Client.EmuHawk
private void GBcoreSettingsToolStripMenuItem_Click(object sender, EventArgs e)
{
BizHawk.Client.EmuHawk.config.GB.GBPrefs.DoGBPrefsDialog(this);
config.GB.GBPrefs.DoGBPrefsDialog(this);
}
private void settingsToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
//http://www.codeproject.com/Articles/310675/AppDomain-AssemblyResolve-Event-Tips
#if WINDOWS
// this will look in subdirectory "dll" to load pinvoked stuff
string dllDir = System.IO.Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
string dllDir = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
SetDllDirectory(dllDir);
//but before we even try doing that, whack the MOTW from everything in that directory (thats a dll)
@ -64,10 +64,10 @@ namespace BizHawk.Client.EmuHawk
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
string iniPath = System.IO.Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.ini");
string iniPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.ini");
Global.Config = ConfigService.Load<Config>(iniPath);
Global.Config.ResolveDefaults();
BizHawk.Common.HawkFile.ArchiveHandlerFactory = new SevenZipSharpArchiveHandler();
HawkFile.ArchiveHandlerFactory = new SevenZipSharpArchiveHandler();
#if WINDOWS
try { GlobalWin.DSound = SoundEnumeration.Create(); }
@ -79,7 +79,7 @@ namespace BizHawk.Client.EmuHawk
//create IGL context.
//at some point in the future, we may need to select from several drivers
GlobalWin.GL = new BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK();
GlobalWin.GL = new Bizware.BizwareGL.Drivers.OpenTK.IGL_TK();
GlobalWin.GLManager = new GLManager();
GlobalWin.CR_GL = GlobalWin.GLManager.GetContextForIGL(GlobalWin.GL);
@ -169,7 +169,7 @@ namespace BizHawk.Client.EmuHawk
//for debugging purposes, this is provided. when we're satisfied everyone understands whats going on, we'll get rid of this
[DllImportAttribute("kernel32.dll", EntryPoint = "CreateFileW")]
public static extern System.IntPtr CreateFileW([InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)] string lpFileName, int dwDesiredAccess, int dwShareMode, [InAttribute()] int lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, [InAttribute()] int hTemplateFile);
public static extern IntPtr CreateFileW([InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)] string lpFileName, int dwDesiredAccess, int dwShareMode, [InAttribute()] int lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, [InAttribute()] int hTemplateFile);
static void ApplyMOTW(string path)
{
int generic_write = 0x40000000;
@ -178,7 +178,7 @@ namespace BizHawk.Client.EmuHawk
var adsHandle = CreateFileW(path + ":Zone.Identifier", generic_write, file_share_write, 0, create_always, 0, 0);
using (var sfh = new Microsoft.Win32.SafeHandles.SafeFileHandle(adsHandle, true))
{
var adsStream = new System.IO.FileStream(sfh, FileAccess.Write);
var adsStream = new FileStream(sfh, FileAccess.Write);
StreamWriter sw = new StreamWriter(adsStream);
sw.Write("[ZoneTransfer]\r\nZoneId=3");
sw.Flush();
@ -212,7 +212,7 @@ namespace BizHawk.Client.EmuHawk
//load missing assemblies by trying to find them in the dll directory
string dllname = new AssemblyName(args.Name).Name + ".dll";
string directory = System.IO.Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
string directory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dll");
string fname = Path.Combine(directory, dllname);
if (!File.Exists(fname)) return null;
//it is important that we use LoadFile here and not load from a byte array; otherwise mixed (managed/unamanged) assemblies can't load

View File

@ -19,10 +19,10 @@ namespace BizHawk.Client.EmuHawk
}
public string ButtonName;
public BizHawk.Client.Common.Config.AnalogBind Bind;
public Config.AnalogBind Bind;
bool listening = false;
public AnalogBindControl(string ButtonName, BizHawk.Client.Common.Config.AnalogBind Bind)
public AnalogBindControl(string ButtonName, Config.AnalogBind Bind)
: this()
{
this.Bind = Bind;

View File

@ -11,9 +11,9 @@ namespace BizHawk.Client.EmuHawk
{
class AnalogBindPanel : UserControl
{
Dictionary<string, BizHawk.Client.Common.Config.AnalogBind> RealConfigObject;
Dictionary<string, Config.AnalogBind> RealConfigObject;
public AnalogBindPanel(Dictionary<string, BizHawk.Client.Common.Config.AnalogBind> RealConfigObject, List<string> RealConfigButtons = null)
public AnalogBindPanel(Dictionary<string, Config.AnalogBind> RealConfigObject, List<string> RealConfigButtons = null)
:base()
{
this.RealConfigObject = RealConfigObject;
@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk
/// save to config
/// </summary>
/// <param name="SaveConfigObject">if non-null, save to possibly different config object than originally initialized from</param>
public void Save(Dictionary<string, BizHawk.Client.Common.Config.AnalogBind> SaveConfigObject = null)
public void Save(Dictionary<string, Config.AnalogBind> SaveConfigObject = null)
{
var saveto = SaveConfigObject ?? RealConfigObject;
foreach (Control c in Controls)

View File

@ -67,7 +67,7 @@ namespace BizHawk.Client.EmuHawk.config
Global.Config.DispUserFilterPath = PathSelection;
GlobalWin.DisplayManager.RefreshUserShader();
DialogResult = System.Windows.Forms.DialogResult.OK;
DialogResult = DialogResult.OK;
Close();
}
@ -81,7 +81,7 @@ namespace BizHawk.Client.EmuHawk.config
var ofd = new OpenFileDialog();
ofd.Filter = ".CGP (*.cgp)|*.cgp";
ofd.FileName = PathSelection;
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
if (ofd.ShowDialog() == DialogResult.OK)
{
rbUser.Checked = true;
PathSelection = Path.GetFullPath(ofd.FileName);

View File

@ -81,7 +81,7 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent();
//prep imagelist for listview with 3 item states for {idUnsure, idMissing, idOk}
imageList1.Images.AddRange(new[] { EmuHawk.Properties.Resources.RetroQuestion, EmuHawk.Properties.Resources.ExclamationRed, EmuHawk.Properties.Resources.GreenCheck });
imageList1.Images.AddRange(new[] { Properties.Resources.RetroQuestion, Properties.Resources.ExclamationRed, Properties.Resources.GreenCheck });
listviewSorter = new ListViewSorter(this, -1);
}
@ -255,7 +255,7 @@ namespace BizHawk.Client.EmuHawk
private void tbbOrganize_Click(object sender, EventArgs e)
{
if (System.Windows.Forms.MessageBox.Show(this, "This is going to move/rename every automatically-selected firmware file under your configured firmwares directory to match our recommended organizational scheme (which is not super great right now). Proceed?", "Firmwares Organization Confirm", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel)
if (MessageBox.Show(this, "This is going to move/rename every automatically-selected firmware file under your configured firmwares directory to match our recommended organizational scheme (which is not super great right now). Proceed?", "Firmwares Organization Confirm", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
return;
Manager.DoScanAndResolve();
@ -299,7 +299,7 @@ namespace BizHawk.Client.EmuHawk
private void lvFirmwares_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right && lvFirmwares.GetItemAt(e.X, e.Y) != null)
if (e.Button == MouseButtons.Right && lvFirmwares.GetItemAt(e.X, e.Y) != null)
lvFirmwaresContextMenuStrip.Show(lvFirmwares, e.Location);
}
@ -310,7 +310,7 @@ namespace BizHawk.Client.EmuHawk
ofd.InitialDirectory = currSelectorDir;
ofd.RestoreDirectory = true;
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
if (ofd.ShowDialog() == DialogResult.OK)
{
//remember the location we selected this firmware from, maybe there are others
currSelectorDir = Path.GetDirectoryName(ofd.FileName);

View File

@ -1,10 +1,4 @@
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;
//todo - display details on the current resolution status
@ -26,7 +20,7 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent();
//prep imagelist for listview with 4 item states for (ideal, acceptable, unacceptable, bad)
imageList1.Images.AddRange(new[] { EmuHawk.Properties.Resources.GreenCheck, EmuHawk.Properties.Resources.Freeze, EmuHawk.Properties.Resources.thumbsdown, EmuHawk.Properties.Resources.ExclamationRed });
imageList1.Images.AddRange(new[] { Properties.Resources.GreenCheck, Properties.Resources.Freeze, Properties.Resources.thumbsdown, Properties.Resources.ExclamationRed });
}
private void lvOptions_KeyDown(object sender, KeyEventArgs e)
@ -50,7 +44,7 @@ namespace BizHawk.Client.EmuHawk
private void lvOptions_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right && lvOptions.GetItemAt(e.X, e.Y) != null)
if (e.Button == MouseButtons.Right && lvOptions.GetItemAt(e.X, e.Y) != null)
lvmiOptionsContextMenuStrip.Show(lvOptions, e.Location);
}
}

View File

@ -1,11 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
@ -22,7 +19,7 @@ namespace BizHawk.Client.EmuHawk
public BmpView()
{
if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv")
if (Process.GetCurrentProcess().ProcessName == "devenv")
{
// in the designer
//this.BackColor = Color.Black;
@ -74,14 +71,14 @@ namespace BizHawk.Client.EmuHawk
return;
bmp.Dispose();
}
bmp = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
bmp = new Bitmap(w, h, PixelFormat.Format32bppArgb);
BmpView_SizeChanged(null, null);
Refresh();
}
public void Clear()
{
var lockdata = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
var lockdata = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
Win32.MemSet(lockdata.Scan0, 0xff, (uint)(lockdata.Height * lockdata.Stride));
bmp.UnlockBits(lockdata);
Refresh();
@ -93,7 +90,7 @@ namespace BizHawk.Client.EmuHawk
Global.Config.PathEntries[Global.Emulator.SystemId, "Screenshots"].Path,
Global.Emulator.SystemId);
DirectoryInfo di = new DirectoryInfo(path);
var di = new DirectoryInfo(path);
if (!di.Exists)
{

View File

@ -50,7 +50,7 @@ namespace BizHawk.Client.EmuHawk.config.GB
dlg.gbPrefControl1.ColorGameBoy = emu.IsCGBMode(false);
dlg.gbPrefControl2.ColorGameBoy = emu.IsCGBMode(true);
if (dlg.ShowDialog(owner) == System.Windows.Forms.DialogResult.OK)
if (dlg.ShowDialog(owner) == DialogResult.OK)
{
dlg.GetSettings(out s, out ss);
Global.Emulator.PutSettings(s);

View File

@ -38,9 +38,9 @@ namespace BizHawk.Client.EmuHawk
{
var old = SyncSettings.RegionOverride;
SyncSettings.RegionOverride = (BizHawk.Emulation.Cores.Nintendo.NES.NES.NESSyncSettings.Region)
SyncSettings.RegionOverride = (NES.NESSyncSettings.Region)
Enum.Parse(
typeof(BizHawk.Emulation.Cores.Nintendo.NES.NES.NESSyncSettings.Region),
typeof(NES.NESSyncSettings.Region),
(string)comboBox1.SelectedItem);
bool changed = DTDB.WasModified ||

View File

@ -74,7 +74,7 @@ namespace BizHawk.Client.EmuHawk.config.NES
if (palette != null && palette.Exists)
{
var data = BizHawk.Emulation.Cores.Nintendo.NES.NES.Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(palette.Name));
var data = Emulation.Cores.Nintendo.NES.NES.Palettes.Load_FCEUX_Palette(HawkFile.ReadAllBytes(palette.Name));
Settings.SetNesHawkPalette(data);
SetPaletteImage();
}

View File

@ -72,8 +72,8 @@ namespace BizHawk.Client.EmuHawk
{
if (cProfile == true)
{
ProfileDialogHelpTexBox.Location = new System.Drawing.Point(217, 12);
ProfileDialogHelpTexBox.Size = new System.Drawing.Size(165, 126);
ProfileDialogHelpTexBox.Location = new Point(217, 12);
ProfileDialogHelpTexBox.Size = new Size(165, 126);
SaveScreenshotStatesCheckBox.Visible = true;
SaveLargeScreenshotStatesCheckBox.Visible = true;
AllowUDLRCheckBox.Visible = true;
@ -81,8 +81,8 @@ namespace BizHawk.Client.EmuHawk
}
else if (cProfile == false)
{
ProfileDialogHelpTexBox.Location = new System.Drawing.Point(184, 12);
ProfileDialogHelpTexBox.Size = new System.Drawing.Size(198, 126);
ProfileDialogHelpTexBox.Location = new Point(184, 12);
ProfileDialogHelpTexBox.Size = new Size(198, 126);
ProfileDialogHelpTexBox.Text = "Options: \r\nCasual Gaming - All about performance! \r\n\nTool-Assisted Speedruns - Maximum Accuracy! \r\n\nLongplays - Stability is the key!";
SaveScreenshotStatesCheckBox.Visible = false;
SaveLargeScreenshotStatesCheckBox.Visible = false;

View File

@ -121,7 +121,7 @@ namespace BizHawk.Client.EmuHawk
using (var sfd = new SaveFileDialog())
{
var result = sfd.ShowDialog(this);
if (result == System.Windows.Forms.DialogResult.OK)
if (result == DialogResult.OK)
{
using (TextWriter tw = new StreamWriter(sfd.FileName))
{

View File

@ -118,7 +118,7 @@ namespace BizHawk.Client.EmuHawk
catch (Exception e)
{
textBoxOutputDir.Text = string.Empty;
textBoxXML.Text = "Failed!\n" + e.ToString();
textBoxXML.Text = "Failed!\n" + e;
SaveRunButton.Enabled = false;
return false;
}

View File

@ -474,7 +474,7 @@ namespace BizHawk.Client.EmuHawk
// try to run the current mouseover, to refresh if the mouse is being held over a pane while the emulator runs
// this doesn't really work well; the update rate seems to be throttled
MouseEventArgs e = new MouseEventArgs(MouseButtons.None, 0, Cursor.Position.X, System.Windows.Forms.Cursor.Position.Y, 0);
MouseEventArgs e = new MouseEventArgs(MouseButtons.None, 0, Cursor.Position.X, Cursor.Position.Y, 0);
OnMouseMove(e);
}

View File

@ -7,7 +7,7 @@ class SyncTextBox : RichTextBox
public SyncTextBox()
{
this.Multiline = true;
this.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
this.ScrollBars = RichTextBoxScrollBars.Vertical;
}
public Control Buddy { get; set; }

View File

@ -197,7 +197,7 @@ namespace BizHawk.Client.EmuHawk
{
if (!_gameGenieTable.ContainsKey(char.ToUpper(e.KeyChar)))
{
if (Control.ModifierKeys != Keys.None)
if (ModifierKeys != Keys.None)
{
return;
}

View File

@ -274,8 +274,8 @@ namespace BizHawk.Client.EmuHawk
SpriteView.sprites.UnlockBits(bmpdata2);
SpriteView.Refresh();
HandleSpriteViewMouseMove(SpriteView.PointToClient(Control.MousePosition));
HandlePaletteViewMouseMove(PaletteView.PointToClient(Control.MousePosition));
HandleSpriteViewMouseMove(SpriteView.PointToClient(MousePosition));
HandlePaletteViewMouseMove(PaletteView.PointToClient(MousePosition));
}
}

View File

@ -906,14 +906,14 @@ namespace BizHawk.Client.EmuHawk
private void viewer_MouseDown(object sender, MouseEventArgs e)
{
viewer.Capture = true;
if ((e.Button & System.Windows.Forms.MouseButtons.Middle) != 0)
if ((e.Button & MouseButtons.Middle) != 0)
{
viewerPan = true;
panStartLocation = viewer.PointToScreen(e.Location);
Cursor = Cursors.SizeAll;
}
if ((e.Button & System.Windows.Forms.MouseButtons.Right) != 0)
if ((e.Button & MouseButtons.Right) != 0)
Freeze();
}
@ -1224,7 +1224,7 @@ namespace BizHawk.Client.EmuHawk
private void paletteViewer_MouseDown(object sender, MouseEventArgs e)
{
if ((e.Button & System.Windows.Forms.MouseButtons.Right) != 0)
if ((e.Button & MouseButtons.Right) != 0)
Freeze();
}
@ -1285,7 +1285,7 @@ namespace BizHawk.Client.EmuHawk
{
var cd = new ColorDialog();
cd.Color = pnBackdropColor.BackColor;
if (cd.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
if (cd.ShowDialog(this) == DialogResult.OK)
{
pnBackdropColor.BackColor = cd.Color;
Global.Config.SNESGraphicsUserBackdropColor = pnBackdropColor.BackColor.ToArgb();
@ -1298,7 +1298,7 @@ namespace BizHawk.Client.EmuHawk
if(keyData == (Keys.C | Keys.Control))
{
// find the control under the mouse
Point m = System.Windows.Forms.Cursor.Position;
Point m = Cursor.Position;
Control top = this;
Control found = null;
do
@ -1393,7 +1393,7 @@ namespace BizHawk.Client.EmuHawk
if (sender == checkEN2_OBJ) s.ShowOBJ_2 = checkEN2_OBJ.Checked;
if (sender == checkEN3_OBJ) s.ShowOBJ_3 = checkEN3_OBJ.Checked;
if ((Control.ModifierKeys & Keys.Shift) != 0)
if ((ModifierKeys & Keys.Shift) != 0)
{
if (sender == checkEN0_BG1) s.ShowBG1_1 = s.ShowBG1_0;
if (sender == checkEN1_BG1) s.ShowBG1_0 = s.ShowBG1_1;

View File

@ -217,7 +217,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var kvp in _tas.ColumnNames)
{
AddColumn(kvp.Key, kvp.Value.ToString(), 20);
AddColumn(kvp.Key, kvp.Value, 20);
}
}