use object initializers in Client.EmuHawk
This commit is contained in:
parent
e5da8c765a
commit
4bf463a2fc
|
@ -175,8 +175,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
//initialize mapped memory files
|
||||
if (mmf_filename != null)
|
||||
{
|
||||
GlobalWin.memoryMappedFiles = new Communication.MemoryMappedFiles();
|
||||
GlobalWin.memoryMappedFiles.Filename = mmf_filename;
|
||||
GlobalWin.memoryMappedFiles = new Communication.MemoryMappedFiles
|
||||
{
|
||||
Filename = mmf_filename
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -406,10 +406,11 @@ namespace BizHawk.Client.EmuHawk.Filters
|
|||
OutputSize.Height *= YIS;
|
||||
}
|
||||
|
||||
var outState = new SurfaceState();
|
||||
outState.SurfaceFormat = new SurfaceFormat(OutputSize);
|
||||
outState.SurfaceDisposition = SurfaceDisposition.RenderTarget;
|
||||
DeclareOutput(outState);
|
||||
DeclareOutput(new SurfaceState
|
||||
{
|
||||
SurfaceFormat = new SurfaceFormat(OutputSize),
|
||||
SurfaceDisposition = SurfaceDisposition.RenderTarget
|
||||
});
|
||||
}
|
||||
|
||||
public override Size PresizeOutput(string channel, Size size)
|
||||
|
|
|
@ -157,8 +157,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public Texture2d LoadTexture(sd.Bitmap bitmap)
|
||||
{
|
||||
var sdbmp = (sd.Bitmap)bitmap.Clone();
|
||||
GDIPTextureWrapper tw = new GDIPTextureWrapper();
|
||||
tw.SDBitmap = sdbmp;
|
||||
GDIPTextureWrapper tw = new GDIPTextureWrapper { SDBitmap = sdbmp };
|
||||
return new Texture2d(this, tw, bitmap.Width, bitmap.Height);
|
||||
}
|
||||
|
||||
|
@ -190,8 +189,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
//definitely needed (by TextureFrugalizer at least)
|
||||
var sdbmp = bmp.ToSysdrawingBitmap();
|
||||
var tw = new GDIPTextureWrapper();
|
||||
tw.SDBitmap = sdbmp;
|
||||
var tw = new GDIPTextureWrapper { SDBitmap = sdbmp };
|
||||
return new Texture2d(this, tw, bmp.Width, bmp.Height);
|
||||
}
|
||||
|
||||
|
@ -349,8 +347,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var ret = new GLControlWrapper_GdiPlus(this);
|
||||
|
||||
//create a render target for this control
|
||||
RenderTargetWrapper rtw = new RenderTargetWrapper(this);
|
||||
rtw.Control = ret;
|
||||
RenderTargetWrapper rtw = new RenderTargetWrapper(this) { Control = ret };
|
||||
ret.RenderTargetWrapper = rtw;
|
||||
|
||||
return ret;
|
||||
|
@ -364,11 +361,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public unsafe RenderTarget CreateRenderTarget(int w, int h)
|
||||
{
|
||||
GDIPTextureWrapper tw = new GDIPTextureWrapper();
|
||||
tw.SDBitmap = new Bitmap(w,h, sdi.PixelFormat.Format32bppArgb);
|
||||
var tw = new GDIPTextureWrapper
|
||||
{
|
||||
SDBitmap = new Bitmap(w, h, sdi.PixelFormat.Format32bppArgb)
|
||||
};
|
||||
var tex = new Texture2d(this, tw, w, h);
|
||||
|
||||
RenderTargetWrapper rtw = new RenderTargetWrapper(this);
|
||||
var rtw = new RenderTargetWrapper(this);
|
||||
var rt = new RenderTarget(this, rtw, tex);
|
||||
rtw.Target = rt;
|
||||
return rt;
|
||||
|
|
|
@ -1,18 +1,11 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Bizware.BizwareGL;
|
||||
|
||||
using SlimDX.Direct3D9;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
using d3d9 = SlimDX.Direct3D9;
|
||||
using gl = OpenTK.Graphics.OpenGL;
|
||||
using sd = System.Drawing;
|
||||
|
@ -48,8 +41,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
//make an 'offscreen context' so we can at least do things without having to create a window
|
||||
OffscreenNativeWindow = new OpenTK.NativeWindow();
|
||||
OffscreenNativeWindow.ClientSize = new sd.Size(8, 8);
|
||||
OffscreenNativeWindow = new NativeWindow { ClientSize = new Size(8, 8) };
|
||||
|
||||
CreateDevice();
|
||||
CreateRenderStates();
|
||||
|
@ -226,8 +218,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (required)
|
||||
throw;
|
||||
var s = new Shader(this, null, false);
|
||||
s.Errors = ex.ToString();
|
||||
var s = new Shader(this, null, false) { Errors = ex.ToString() };
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +238,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (!results.Succeeded)
|
||||
{
|
||||
if (required) throw new InvalidOperationException(results.Errors);
|
||||
else return new Shader(this, null, false);
|
||||
return new Shader(this, null, false);
|
||||
}
|
||||
|
||||
sw.MapCodeToNative = results.MapCodeToNative;
|
||||
|
@ -282,8 +273,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (required)
|
||||
throw;
|
||||
var s = new Shader(this, null, false);
|
||||
s.Errors = ex.ToString();
|
||||
var s = new Shader(this, null, false) { Errors = ex.ToString() };
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
@ -384,8 +374,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
string errors = $"Vertex Shader:\r\n {vertexShader.Errors} \r\n-------\r\nFragment Shader:\r\n{fragmentShader.Errors}";
|
||||
if (required)
|
||||
throw new InvalidOperationException($"Couldn't build required GL pipeline:\r\n{errors}");
|
||||
var pipeline = new Pipeline(this, null, false, null, null, null);
|
||||
pipeline.Errors = errors;
|
||||
var pipeline = new Pipeline(this, null, false, null, null, null) { Errors = errors };
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,13 +71,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
public IGL_TK(int major_version, int minor_version, bool forward_compatible)
|
||||
{
|
||||
//make an 'offscreen context' so we can at least do things without having to create a window
|
||||
OffscreenNativeWindow = new NativeWindow();
|
||||
OffscreenNativeWindow.ClientSize = new sd.Size(8, 8);
|
||||
this.GraphicsContext = new GraphicsContext(GraphicsMode.Default, OffscreenNativeWindow.WindowInfo, major_version, minor_version, forward_compatible ? GraphicsContextFlags.ForwardCompatible : GraphicsContextFlags.Default);
|
||||
OffscreenNativeWindow = new NativeWindow { ClientSize = new sd.Size(8, 8) };
|
||||
GraphicsContext = new GraphicsContext(GraphicsMode.Default, OffscreenNativeWindow.WindowInfo, major_version, minor_version, forward_compatible ? GraphicsContextFlags.ForwardCompatible : GraphicsContextFlags.Default);
|
||||
MakeDefaultCurrent();
|
||||
|
||||
//this is important for reasons unknown
|
||||
this.GraphicsContext.LoadAll();
|
||||
GraphicsContext.LoadAll();
|
||||
|
||||
//misc initialization
|
||||
CreateRenderStates();
|
||||
|
@ -190,8 +189,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
string errors = $"Vertex Shader:\r\n {vertexShader.Errors} \r\n-------\r\nFragment Shader:\r\n{fragmentShader.Errors}";
|
||||
if (required)
|
||||
throw new InvalidOperationException($"Couldn't build required GL pipeline:\r\n{errors}");
|
||||
var pipeline = new Pipeline(this, null, false, null, null, null);
|
||||
pipeline.Errors = errors;
|
||||
var pipeline = new Pipeline(this, null, false, null, null, null) { Errors = errors };
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
|
@ -316,9 +314,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (fsw.MapCodeToNative.ContainsKey(name)) name = fsw.MapCodeToNative[name];
|
||||
}
|
||||
|
||||
var ui = new UniformInfo();
|
||||
ui.Name = name;
|
||||
ui.Opaque = loc;
|
||||
var ui = new UniformInfo { Name = name, Opaque = loc };
|
||||
|
||||
if (type == ActiveUniformType.Sampler2D)
|
||||
{
|
||||
|
|
|
@ -4,27 +4,31 @@
|
|||
{
|
||||
public static global::SlimDX.Matrix ToSlimDXMatrix(this OpenTK.Matrix4 m, bool transpose)
|
||||
{
|
||||
global::SlimDX.Matrix ret = new global::SlimDX.Matrix();
|
||||
ret.M11 = m.M11;
|
||||
ret.M12 = m.M12;
|
||||
ret.M13 = m.M13;
|
||||
ret.M14 = m.M14;
|
||||
ret.M21 = m.M21;
|
||||
ret.M22 = m.M22;
|
||||
ret.M23 = m.M23;
|
||||
ret.M24 = m.M24;
|
||||
ret.M31 = m.M31;
|
||||
ret.M32 = m.M32;
|
||||
ret.M33 = m.M33;
|
||||
ret.M34 = m.M34;
|
||||
ret.M41 = m.M41;
|
||||
ret.M42 = m.M42;
|
||||
ret.M43 = m.M43;
|
||||
ret.M44 = m.M44;
|
||||
global::SlimDX.Matrix ret = new global::SlimDX.Matrix
|
||||
{
|
||||
M11 = m.M11,
|
||||
M12 = m.M12,
|
||||
M13 = m.M13,
|
||||
M14 = m.M14,
|
||||
M21 = m.M21,
|
||||
M22 = m.M22,
|
||||
M23 = m.M23,
|
||||
M24 = m.M24,
|
||||
M31 = m.M31,
|
||||
M32 = m.M32,
|
||||
M33 = m.M33,
|
||||
M34 = m.M34,
|
||||
M41 = m.M41,
|
||||
M42 = m.M42,
|
||||
M43 = m.M43,
|
||||
M44 = m.M44
|
||||
};
|
||||
|
||||
//could be optimized later into the above copies
|
||||
if (transpose)
|
||||
{
|
||||
ret = global::SlimDX.Matrix.Transpose(ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -38,6 +42,5 @@
|
|||
{
|
||||
return new global::SlimDX.Vector2(v.X, v.Y);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -445,21 +445,35 @@ namespace BizHawk.Client.EmuHawk
|
|||
float noise_freq = 1789773.0f / (16.0f * (noise_period + 1));
|
||||
int noise_note = FindNearestNote(noise_freq);
|
||||
|
||||
//create the record
|
||||
ApuState rec = new ApuState();
|
||||
rec.pulse0.en = !apu.pulse[0].Debug_IsSilenced;
|
||||
rec.pulse0.vol = (byte)apu.pulse[0].Debug_Volume;
|
||||
rec.pulse0.note = pulse0_note;
|
||||
rec.pulse0.type = (byte)apu.pulse[0].Debug_DutyType;
|
||||
rec.pulse1.en = !apu.pulse[1].Debug_IsSilenced;
|
||||
rec.pulse1.vol = (byte)apu.pulse[1].Debug_Volume;
|
||||
rec.pulse1.note = pulse1_note;
|
||||
rec.pulse1.type = (byte)apu.pulse[1].Debug_DutyType;
|
||||
rec.triangle.en = !apu.triangle.Debug_IsSilenced;
|
||||
rec.triangle.note = tri_note;
|
||||
rec.noise.en = !apu.noise.Debug_IsSilenced;
|
||||
rec.noise.vol = (byte)apu.noise.Debug_Volume;
|
||||
rec.noise.note = noise_note;
|
||||
// create the record
|
||||
var rec = new ApuState
|
||||
{
|
||||
pulse0 =
|
||||
{
|
||||
en = !apu.pulse[0].Debug_IsSilenced,
|
||||
vol = (byte) apu.pulse[0].Debug_Volume,
|
||||
note = pulse0_note,
|
||||
type = (byte) apu.pulse[0].Debug_DutyType
|
||||
},
|
||||
pulse1 =
|
||||
{
|
||||
en = !apu.pulse[1].Debug_IsSilenced,
|
||||
vol = (byte) apu.pulse[1].Debug_Volume,
|
||||
note = pulse1_note,
|
||||
type = (byte) apu.pulse[1].Debug_DutyType
|
||||
},
|
||||
triangle =
|
||||
{
|
||||
en = !apu.triangle.Debug_IsSilenced,
|
||||
note = tri_note
|
||||
},
|
||||
noise =
|
||||
{
|
||||
en = !apu.noise.Debug_IsSilenced,
|
||||
vol = (byte) apu.noise.Debug_Volume,
|
||||
note = noise_note
|
||||
}
|
||||
};
|
||||
|
||||
Log.Add(rec);
|
||||
|
||||
|
|
|
@ -45,8 +45,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
|
||||
var psx = OwnerEmulator as Octoshock;
|
||||
List<string> buttons = new List<string>();
|
||||
buttons.Add("- NONE -");
|
||||
var buttons = new List<string> { "- NONE -" };
|
||||
buttons.AddRange(psx.HackyDiscButtons);
|
||||
|
||||
lvDiscs.Items.Clear();
|
||||
|
@ -167,10 +166,5 @@ namespace BizHawk.Client.EmuHawk
|
|||
UpdateValues();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue