remove unused usings and other redundancies

This commit is contained in:
adelikat 2020-04-23 19:53:41 -05:00
parent a88154ca27
commit d4c8615e95
49 changed files with 106 additions and 164 deletions

View File

@ -4,8 +4,6 @@ using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
using System.Text;
using BizHawk.Common;
namespace BizHawk.BizInvoke

View File

@ -2,8 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using BizHawk.Client.Common;
namespace BizHawk.Client.Common
{
/// <summary>

View File

@ -1,7 +1,5 @@
using System;
using BizHawk.Client.Common;
namespace BizHawk.Client.Common
{
/// <remarks>This class needs to be in the assembly or old tools will throw on load instead of being recognised as old.</remarks>

View File

@ -1,8 +1,6 @@
using System;
using System.Globalization;
using BizHawk.Client.Common;
namespace BizHawk.Client.Common
{
/// <summary>

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using BizHawk.Client.Common;
namespace BizHawk.Client.Common
{
/// <summary>

View File

@ -1,12 +1,9 @@
using BizHawk.Client.Common;
namespace BizHawk.Client.Common
namespace BizHawk.Client.Common
{
/// <summary>
/// Interface to implements in order to make a custom tool
/// </summary>
public interface IExternalToolForm : IToolForm
{
}
}

View File

@ -1,6 +1,5 @@
using System;
using System.Globalization;
using BizHawk.Client.Common;
namespace BizHawk.Client.Common
{

View File

@ -4,8 +4,6 @@ using System.IO;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Common;
using BizHawk.Common.PathExtensions;
using BizHawk.Emulation.Common;

View File

@ -456,23 +456,23 @@ namespace BizHawk.Client.EmuHawk
public static int BorderHeight()
{
var point = new System.Drawing.Point(0, 0);
var point = new Point(0, 0);
Type t = ClientAssembly.GetType("BizHawk.Client.EmuHawk.GlobalWin");
FieldInfo f = t.GetField("DisplayManager");
object displayManager = f.GetValue(null);
MethodInfo m = t.GetMethod("TransFormPoint");
point = (System.Drawing.Point) m.Invoke(displayManager, new object[] { point });
point = (Point) m.Invoke(displayManager, new object[] { point });
return point.Y;
}
public static int BorderWidth()
{
var point = new System.Drawing.Point(0, 0);
var point = new Point(0, 0);
Type t = ClientAssembly.GetType("BizHawk.Client.EmuHawk.GlobalWin");
FieldInfo f = t.GetField("DisplayManager");
object displayManager = f.GetValue(null);
MethodInfo m = t.GetMethod("TransFormPoint");
point = (System.Drawing.Point)m.Invoke(displayManager, new object[] { point });
point = (Point)m.Invoke(displayManager, new object[] { point });
return point.X;
}

View File

@ -143,7 +143,7 @@ namespace BizHawk.Client.EmuHawk
tw.MagFilter = (TextureMagFilter)param;
}
public Texture2d LoadTexture(sd.Bitmap bitmap)
public Texture2d LoadTexture(Bitmap bitmap)
{
var sdBitmap = (Bitmap)bitmap.Clone();
GDIPTextureWrapper tw = new GDIPTextureWrapper { SDBitmap = sdBitmap };
@ -200,21 +200,21 @@ namespace BizHawk.Client.EmuHawk
public Matrix4 CreateGuiProjectionMatrix(int w, int h)
{
return CreateGuiProjectionMatrix(new sd.Size(w, h));
return CreateGuiProjectionMatrix(new Size(w, h));
}
public Matrix4 CreateGuiViewMatrix(int w, int h, bool autoFlip)
{
return CreateGuiViewMatrix(new sd.Size(w, h), autoFlip);
return CreateGuiViewMatrix(new Size(w, h), autoFlip);
}
public Matrix4 CreateGuiProjectionMatrix(sd.Size dims)
public Matrix4 CreateGuiProjectionMatrix(Size dims)
{
//see CreateGuiViewMatrix for more
return Matrix4.Identity;
}
public Matrix4 CreateGuiViewMatrix(sd.Size dims, bool autoFlip)
public Matrix4 CreateGuiViewMatrix(Size dims, bool autoFlip)
{
//on account of gdi+ working internally with a default view exactly like we want, we don't need to setup a new one here
//furthermore, we _cant_, without inverting the GuiView and GuiProjection before drawing, to completely undo it
@ -238,7 +238,7 @@ namespace BizHawk.Client.EmuHawk
{
}
public void SetViewport(sd.Size size)
public void SetViewport(Size size)
{
SetViewport(size.Width, size.Height);
}

View File

@ -832,7 +832,7 @@ namespace BizHawk.Client.EmuHawk
SetViewport(0, 0, width, height);
}
public void SetViewport(sd.Size size)
public void SetViewport(Size size)
{
SetViewport(size.Width, size.Height);
}

View File

@ -1,10 +1,10 @@
using System;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk.Properties {
namespace BizHawk.Client.EmuHawk.Properties
{
internal static class Resources {
private static readonly Assembly Asm = Assembly.GetExecutingAssembly();

View File

@ -46,7 +46,7 @@ namespace BizHawk.Client.EmuHawk
public void RecalculateMagic(double framerate)
{
// ceiling instead of floor here is very important (magic)
SamplesInOneFrame = 2 * (int)System.Math.Ceiling((44100.0 / framerate));
SamplesInOneFrame = 2 * (int)Math.Ceiling((44100.0 / framerate));
//TargetExtraSamples = ;// complete guess
}

View File

@ -6,7 +6,6 @@ using System.Linq;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Client.Common.MovieConversionExtensions;
using BizHawk.Common.PathExtensions;
namespace BizHawk.Client.EmuHawk
{

View File

@ -6,7 +6,6 @@ using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.ToolExtensions;
using BizHawk.Common.PathExtensions;
// TODO - select which memorydomains go out to the CDL file. will this cause a problem when re-importing it?
// perhaps missing domains shouldn't fail a check
@ -190,8 +189,8 @@ namespace BizHawk.Client.EmuHawk
if (tsbViewStyle.SelectedIndex == 2)
lvi[5 + i] = $"{totals[i] / 1024.0f:0.00}";
}
}
lvCDL.RowCount = _cdl.Count;
}

View File

@ -156,7 +156,7 @@ namespace BizHawk.Client.EmuHawk
}
}
private void SetTypeSelected(Common.DisplayType type)
private void SetTypeSelected(DisplayType type)
{
foreach (var item in DisplayTypeDropDown.Items)
{

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;

View File

@ -12,7 +12,6 @@ using BizHawk.Common;
using BizHawk.Common.NumberExtensions;
using BizHawk.Common.StringExtensions;
using BizHawk.Common.IOExtensions;
using BizHawk.Common.PathExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.ToolExtensions;
@ -24,10 +23,7 @@ namespace BizHawk.Client.EmuHawk
{
private class NullMemoryDomain : MemoryDomain
{
public override byte PeekByte(long addr)
{
return 0;
}
public override byte PeekByte(long addr) => 0;
public override void PokeByte(long addr, byte val)
{

View File

@ -52,7 +52,7 @@ namespace BizHawk.Client.EmuHawk
[LuaMethod("borderheight", "Gets the current height in pixels of the letter/pillarbox area (top side only) around the emu display surface, excluding the gameExtraPadding you've set. This function (the whole lot of them) should be renamed or refactored since the padding areas have got more complex.")]
public static int BorderHeight()
{
var point = new System.Drawing.Point(0, 0);
var point = new Point(0, 0);
return GlobalWin.DisplayManager.TransformPoint(point).Y;
}
@ -60,7 +60,7 @@ namespace BizHawk.Client.EmuHawk
[LuaMethod("borderwidth", "Gets the current width in pixels of the letter/pillarbox area (left side only) around the emu display surface, excluding the gameExtraPadding you've set. This function (the whole lot of them) should be renamed or refactored since the padding areas have got more complex.")]
public static int BorderWidth()
{
var point = new System.Drawing.Point(0, 0);
var point = new Point(0, 0);
return GlobalWin.DisplayManager.TransformPoint(point).X;
}

View File

@ -348,14 +348,14 @@ namespace BizHawk.Client.EmuHawk
private void RenderView()
{
Bitmap bmp = null;
System.Drawing.Imaging.BitmapData bmpdata = null;
BitmapData bmpdata = null;
int* pixelptr = null;
int stride = 0;
Action<int, int> allocate = (w, h) =>
{
bmp = new Bitmap(w, h);
bmpdata = bmp.LockBits(new Rectangle(0, 0, w, h), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
bmpdata = bmp.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
pixelptr = (int*)bmpdata.Scan0.ToPointer();
stride = bmpdata.Stride;
};
@ -673,7 +673,7 @@ namespace BizHawk.Client.EmuHawk
int pixsize = paletteCellSize * 16 + paletteCellSpacing * 17;
int cellTotalSize = (paletteCellSize + paletteCellSpacing);
var bmp = new Bitmap(pixsize, pixsize, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
var bmp = new Bitmap(pixsize, pixsize, PixelFormat.Format32bppArgb);
using (var g = Graphics.FromImage(bmp))
{
for (int y = 0; y < 16; y++)
@ -987,7 +987,7 @@ namespace BizHawk.Client.EmuHawk
//view a tileset tile
int bpp = currTileDataState.Bpp;
var bmp = new Bitmap(8, 8, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
var bmp = new Bitmap(8, 8, PixelFormat.Format32bppArgb);
var bmpdata = bmp.LockBits(new Rectangle(0, 0, 8, 8), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
if (currTileDataState.Type == eDisplayType.TilesMode7)
gd.RenderMode7TilesToScreen((int*)bmpdata.Scan0, bmpdata.Stride / 4, false, false, 1, currTileDataState.Tile, 1);
@ -1011,7 +1011,7 @@ namespace BizHawk.Client.EmuHawk
var bounds = si.ObjSizeBoundsSquare;
int width = bounds.Width;
int height = bounds.Height;
var bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
var bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb);
var bmpData = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
gd.RenderSpriteToScreen((int*)bmpData.Scan0, bmpData.Stride / 4, 0, 0, si, currObjDataState.Number);
bmp.UnlockBits(bmpData);

View File

@ -7,7 +7,6 @@ using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Common.PathExtensions;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk

View File

@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Sony.PSX;

View File

@ -6,11 +6,8 @@ using System.Threading;
using System.Diagnostics;
using System.Dynamic;
using System.IO;
using System.Text;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using System.IO;
namespace BizHawk.Emulation.Cores.Arcades.MAME
{

View File

@ -137,7 +137,7 @@ namespace BizHawk.Emulation.Cores.Components.I8048
}
//a little CDL related stuff
public delegate void DoCDLCallbackType(ushort addr, I8048.eCDLogMemFlags flags);
public delegate void DoCDLCallbackType(ushort addr, eCDLogMemFlags flags);
public DoCDLCallbackType CDLCallback;

View File

@ -124,7 +124,7 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
}
//a little CDL related stuff
public delegate void DoCDLCallbackType(ushort addr, LR35902.eCDLogMemFlags flags);
public delegate void DoCDLCallbackType(ushort addr, eCDLogMemFlags flags);
public DoCDLCallbackType CDLCallback;

View File

@ -130,7 +130,7 @@ namespace BizHawk.Emulation.Cores.Components.MC6800
}
//a little CDL related stuff
public delegate void DoCDLCallbackType(ushort addr, MC6800.eCDLogMemFlags flags);
public delegate void DoCDLCallbackType(ushort addr, eCDLogMemFlags flags);
public DoCDLCallbackType CDLCallback;

View File

@ -139,7 +139,7 @@ namespace BizHawk.Emulation.Cores.Components.MC6809
}
//a little CDL related stuff
public delegate void DoCDLCallbackType(ushort addr, MC6809.eCDLogMemFlags flags);
public delegate void DoCDLCallbackType(ushort addr, eCDLogMemFlags flags);
public DoCDLCallbackType CDLCallback;

View File

@ -81,7 +81,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
public AmstradCPCSettings()
{
BizHawk.Common.SettingsUtil.SetDefaultValues(this);
SettingsUtil.SetDefaultValues(this);
}
}
@ -114,7 +114,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
public AmstradCPCSyncSettings()
{
BizHawk.Common.SettingsUtil.SetDefaultValues(this);
SettingsUtil.SetDefaultValues(this);
}
public static bool NeedsReboot(AmstradCPCSyncSettings x, AmstradCPCSyncSettings y)
@ -162,8 +162,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
public static CPCMachineMetaData GetMetaObject(MachineType type)
{
CPCMachineMetaData m = new CPCMachineMetaData();
m.MachineType = type;
var m = new CPCMachineMetaData { MachineType = type };
switch (type)
{
@ -191,14 +190,14 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
break;
}
m.Data.Add(AmstradCPC.GetMemberName((CPCMachineMetaData c) => c.Name), m.Name.Trim());
m.Data.Add(AmstradCPC.GetMemberName((CPCMachineMetaData c) => c.Description), m.Description.Trim());
m.Data.Add(AmstradCPC.GetMemberName((CPCMachineMetaData c) => c.Released), m.Released.Trim());
m.Data.Add(AmstradCPC.GetMemberName((CPCMachineMetaData c) => c.CPU), m.CPU.Trim());
m.Data.Add(AmstradCPC.GetMemberName((CPCMachineMetaData c) => c.Memory), m.Memory.Trim());
m.Data.Add(AmstradCPC.GetMemberName((CPCMachineMetaData c) => c.Video), m.Video.Trim());
m.Data.Add(AmstradCPC.GetMemberName((CPCMachineMetaData c) => c.Audio), m.Audio.Trim());
m.Data.Add(AmstradCPC.GetMemberName((CPCMachineMetaData c) => c.Media), m.Media.Trim());
m.Data.Add(GetMemberName((CPCMachineMetaData c) => c.Name), m.Name.Trim());
m.Data.Add(GetMemberName((CPCMachineMetaData c) => c.Description), m.Description.Trim());
m.Data.Add(GetMemberName((CPCMachineMetaData c) => c.Released), m.Released.Trim());
m.Data.Add(GetMemberName((CPCMachineMetaData c) => c.CPU), m.CPU.Trim());
m.Data.Add(GetMemberName((CPCMachineMetaData c) => c.Memory), m.Memory.Trim());
m.Data.Add(GetMemberName((CPCMachineMetaData c) => c.Video), m.Video.Trim());
m.Data.Add(GetMemberName((CPCMachineMetaData c) => c.Audio), m.Audio.Trim());
m.Data.Add(GetMemberName((CPCMachineMetaData c) => c.Media), m.Media.Trim());
return m;
}
@ -206,8 +205,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
public static string GetMetaString(MachineType type)
{
var m = GetMetaObject(type);
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
// get longest title
int titleLen = 0;

View File

@ -51,7 +51,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
sbm.AppendLine("The detected disk image contains multiple sides.");
sbm.AppendLine("This is NOT currently supported in ZXHawk.");
sbm.AppendLine("Please find an alternate image/dump where each side has been saved as a separate *.dsk image (and use the multi-disk bundler tool to load into Bizhawk).");
throw new System.NotImplementedException(sbm.ToString());
throw new NotImplementedException(sbm.ToString());
}
if (DiskHeader.NumberOfTracks > 42)
@ -62,7 +62,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
sbm.AppendLine("The detected disk is an " + DiskHeader.NumberOfTracks + " track disk image.");
sbm.AppendLine("This is currently incompatible with the emulated +3 disk drive (42 tracks).");
sbm.AppendLine("Likely the disk image is an 80 track betadisk or opus image, the drives and controllers for which are not currently emulated in ZXHawk");
throw new System.NotImplementedException(sbm.ToString());
throw new NotImplementedException(sbm.ToString());
}
// standard CPC format all track sizes are the same in the image

View File

@ -1,5 +1,4 @@
using System.IO;
using BizHawk.Common;
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Consoles.Vectrex
{

View File

@ -1,5 +1,4 @@
using System;
using BizHawk.Common;
using BizHawk.Common;
using BizHawk.Emulation.Cores.Components.I8048;
namespace BizHawk.Emulation.Cores.Consoles.O2Hawk

View File

@ -1,6 +1,5 @@
using BizHawk.Common.NumberExtensions;
using BizHawk.Common;
using System;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{

View File

@ -1,8 +1,6 @@
//http://wiki.nesdev.com/w/index.php/TxROM
//read some background info on namco 108 and DxROM boards here
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES
{
[NesBoardImplPriority]

View File

@ -94,12 +94,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public void SetDiskImage(byte[] diskimage)
{
// each FDS format is worse than the last
if (diskimage.Take(4).SequenceEqual(System.Text.Encoding.ASCII.GetBytes("\x01*NI")))
if (diskimage.Take(4).SequenceEqual(Encoding.ASCII.GetBytes("\x01*NI")))
{
int nsides = diskimage.Length / 65500;
MemoryStream ms = new MemoryStream();
ms.Write(System.Text.Encoding.ASCII.GetBytes("FDS\x1A"), 0, 4);
ms.Write(Encoding.ASCII.GetBytes("FDS\x1A"), 0, 4);
ms.WriteByte((byte)nsides);
byte[] nulls = new byte[11];
ms.Write(nulls, 0, 11);

View File

@ -174,7 +174,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// set up region
switch (_display_type)
{
case Common.DisplayType.PAL:
case DisplayType.PAL:
apu = new APU(this, apu, true);
ppu.region = PPU.Region.PAL;
VsyncNum = 50;
@ -184,7 +184,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
_display_type = DisplayType.PAL;
ClockRate = 5320342.5;
break;
case Common.DisplayType.NTSC:
case DisplayType.NTSC:
apu = new APU(this, apu, false);
ppu.region = PPU.Region.NTSC;
VsyncNum = 39375000;
@ -194,7 +194,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ClockRate = 5369318.1818181818181818181818182;
break;
// this is in bootgod, but not used at all
case Common.DisplayType.Dendy:
case DisplayType.Dendy:
apu = new APU(this, apu, false);
ppu.region = PPU.Region.Dendy;
VsyncNum = 50;

View File

@ -365,7 +365,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
AutoMapperProps.Populate(Board, SyncSettings);
Console.WriteLine("Using NTSC display type for NSF for now");
_display_type = Common.DisplayType.NTSC;
_display_type = DisplayType.NTSC;
HardReset();
@ -403,7 +403,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
AutoMapperProps.Populate(Board, SyncSettings);
Console.WriteLine("Using NTSC display type for FDS disk image");
_display_type = Common.DisplayType.NTSC;
_display_type = DisplayType.NTSC;
HardReset();
@ -730,21 +730,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
Console.WriteLine("Using system region override");
fromrom = fromsettings;
}
switch (fromrom)
_display_type = fromrom switch
{
case NESSyncSettings.Region.Dendy:
_display_type = Common.DisplayType.Dendy;
break;
case NESSyncSettings.Region.NTSC:
_display_type = Common.DisplayType.NTSC;
break;
case NESSyncSettings.Region.PAL:
_display_type = Common.DisplayType.PAL;
break;
default:
_display_type = Common.DisplayType.NTSC;
break;
}
NESSyncSettings.Region.Dendy => DisplayType.Dendy,
NESSyncSettings.Region.NTSC => DisplayType.NTSC,
NESSyncSettings.Region.PAL => DisplayType.PAL,
_ => DisplayType.NTSC
};
Console.WriteLine("Using NES system region of {0}", _display_type);
HardReset();

View File

@ -386,7 +386,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
//OAM ADDRESS (write)
void write_2003(int addr, byte value)
{
if (region == PPU.Region.NTSC)
if (region == Region.NTSC)
{
// in NTSC this does several glitchy things to corrupt OAM
// commented out for now until better understood

View File

@ -239,7 +239,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|| s == " truncated file" // This is a garbage rom not worth anyone's time but at least NesHawk handles these better, and these occur before the core has a chance to assess an unsupported mapper
)
{
throw new Emulation.Common.UnsupportedGameException("Quicknes unsupported mapper");
throw new Common.UnsupportedGameException("Quicknes unsupported mapper");
}
else
{

View File

@ -319,7 +319,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
// we need to do this from the raw file since QuickNES hasn't had time to process it yet.
byte[] FixInesHeader(byte[] file)
{
string sha1 = BizHawk.Common.BufferExtensions.BufferExtensions.HashSHA1(file);
string sha1 = BufferExtensions.HashSHA1(file);
bool didSomething = false;
Console.WriteLine(sha1);

View File

@ -13,7 +13,6 @@ using System;
namespace BizHawk.Emulation.Cores.Nintendo.SNES
{
public unsafe class SNESGraphicsDecoder : IDisposable, IMonitor
{
public class PaletteSelection
@ -49,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
return ret;
}
public static Dimensions[,] ObjSizes = new Dimensions[,]
public static Dimensions[,] ObjSizes =
{
{ new Dimensions(8,8), new Dimensions(16,16) },
{ new Dimensions(8,8), new Dimensions(32,32) },
@ -63,14 +62,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
public static Dimensions SizeInBlocksForBGSize(ScreenSize size)
{
switch (size)
return size switch
{
case ScreenSize.AAAA_32x32: return new Dimensions(1, 1);
case ScreenSize.ABAB_64x32: return new Dimensions(2, 1);
case ScreenSize.AABB_32x64: return new Dimensions(1, 2);
case ScreenSize.ABCD_64x64: return new Dimensions(2, 2);
default: throw new Exception();
}
ScreenSize.AAAA_32x32 => new Dimensions(1, 1),
ScreenSize.ABAB_64x32 => new Dimensions(2, 1),
ScreenSize.AABB_32x64 => new Dimensions(1, 2),
ScreenSize.ABCD_64x64 => new Dimensions(2, 2),
_ => throw new Exception()
};
}
public enum BGMode
@ -78,12 +77,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
Unavailable, Text, Mode7, Mode7Ext, Mode7DC, OBJ
}
/// <summary>
/// is a BGMode a mode7 type (mode7, mode7ext, mode7DC)
/// </summary>
public static bool BGModeIsMode7Type(BGMode BGMode) { return BGMode == SNESGraphicsDecoder.BGMode.Mode7 || BGMode == SNESGraphicsDecoder.BGMode.Mode7DC || BGMode == SNESGraphicsDecoder.BGMode.Mode7Ext; }
public static bool BGModeIsMode7Type(BGMode bgMode) => bgMode == BGMode.Mode7 || bgMode == BGMode.Mode7DC || bgMode == BGMode.Mode7Ext;
/// <summary>
/// this class is not 'smart' - it wont recompute values for you. it's meant to be read only (we should find some way to protect write access to make that clear)
@ -177,15 +174,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
/// <summary>
/// The size of the layer, in tiles
/// </summary>
public Dimensions ScreenSizeInTiles
{
get
{
if (BGMode == SNESGraphicsDecoder.BGMode.Text)
return SizeInTilesForBGSize(ScreenSize);
else return new Dimensions(128, 128);
}
}
public Dimensions ScreenSizeInTiles => BGMode == BGMode.Text
? SizeInTilesForBGSize(ScreenSize)
: new Dimensions(128, 128);
/// <summary>
/// The size of the layer, in pixels. This has factored in the selection of 8x8 or 16x16 tiles
@ -196,7 +187,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
/// returns information about what colors could possibly be used for this bg
/// </summary>
public PaletteSelection PaletteSelection;
}
public class BGInfos
@ -269,7 +259,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
Address += si.OBJTable1Addr - (256 * 32);
Address &= 0xFFFF;
}
}

View File

@ -1,7 +1,6 @@
using System;
using BizHawk.Common;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components;
namespace BizHawk.Emulation.Cores.PCEngine

View File

@ -181,7 +181,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
if (DataIn.Count == 0)
{
// read in a sector and shove it in the queue
DiscSystem.DiscSectorReader dsr = new DiscSectorReader(disc); // TODO - cache reader
var dsr = new DiscSectorReader(disc); // TODO - cache reader
dsr.ReadLBA_2048(CurrentReadingSector, DataIn.GetBuffer(), 0);
DataIn.SignalBufferFilled(2048);
CurrentReadingSector++;

View File

@ -358,7 +358,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
/// </summary>
class DiscInterface : IDisposable
{
public DiscInterface(DiscSystem.Disc disc, Action<DiscInterface> cbActivity)
public DiscInterface(Disc disc, Action<DiscInterface> cbActivity)
{
this.Disc = disc;
cbReadTOC = ShockDisc_ReadTOC;
@ -371,7 +371,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
OctoshockDll.ShockDisc_ReadLBA cbReadLBA;
Action<DiscInterface> cbActivity;
public DiscSystem.Disc Disc;
public Disc Disc;
public IntPtr OctoshockHandle;
public void Dispose()
@ -414,19 +414,19 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
cbActivity(this);
//todo - cache reader
DiscSystem.DiscSectorReader dsr = new DiscSystem.DiscSectorReader(Disc);
var dsr = new DiscSectorReader(Disc);
int readed = dsr.ReadLBA_2448(lba, SectorBuffer, 0);
if (readed == 2448)
{
Marshal.Copy(SectorBuffer, 0, new IntPtr(dst), 2448);
return OctoshockDll.SHOCK_OK;
}
else
return OctoshockDll.SHOCK_ERROR;
return OctoshockDll.SHOCK_ERROR;
}
}
public List<DiscSystem.Disc> Discs;
public List<Disc> Discs;
List<DiscInterface> discInterfaces = new List<DiscInterface>();
DiscInterface currentDiscInterface;

View File

@ -353,7 +353,7 @@ namespace BizHawk.Emulation.Cores.Libretro
private byte[] savebuff, savebuff2;
public void SaveStateBinary(System.IO.BinaryWriter writer)
public void SaveStateBinary(BinaryWriter writer)
{
api.CMD_UpdateSerializeSize();
if (savebuff == null || savebuff.Length != (int)api.comm->env.retro_serialize_size)
@ -371,7 +371,7 @@ namespace BizHawk.Emulation.Cores.Libretro
writer.Write(IsLagFrame);
}
public void LoadStateBinary(System.IO.BinaryReader reader)
public void LoadStateBinary(BinaryReader reader)
{
int newlen = reader.ReadInt32();
if (newlen > savebuff.Length)
@ -393,8 +393,8 @@ namespace BizHawk.Emulation.Cores.Libretro
savebuff2 = new byte[savebuff.Length + 13];
}
var ms = new System.IO.MemoryStream(savebuff2, true);
var bw = new System.IO.BinaryWriter(ms);
var ms = new MemoryStream(savebuff2, true);
var bw = new BinaryWriter(ms);
SaveStateBinary(bw);
bw.Flush();
ms.Close();

View File

@ -43,7 +43,7 @@ namespace BizHawk.Bizware.BizwareGL
if (WrappedBitmap != null)
{
CurrLock = WrappedBitmap.LockBits(new sd.Rectangle(0, 0, Width, Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
CurrLock = WrappedBitmap.LockBits(new Rectangle(0, 0, Width, Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
return CurrLock;
}
@ -257,7 +257,7 @@ namespace BizHawk.Bizware.BizwareGL
/// <summary>
/// Initializes the BitmapBuffer from a System.Drawing.Bitmap
/// </summary>
public BitmapBuffer(sd.Bitmap bitmap, BitmapLoadOptions options)
public BitmapBuffer(Bitmap bitmap, BitmapLoadOptions options)
{
if (options.AllowWrap && bitmap.PixelFormat == PixelFormat.Format32bppArgb)
{
@ -288,7 +288,7 @@ namespace BizHawk.Bizware.BizwareGL
HasAlpha = false;
}
void LoadInternal(Stream stream, sd.Bitmap bitmap, BitmapLoadOptions options)
void LoadInternal(Stream stream, Bitmap bitmap, BitmapLoadOptions options)
{
bool cleanup = options.CleanupAlpha0;
bool needsPad = true;
@ -307,7 +307,7 @@ namespace BizHawk.Bizware.BizwareGL
int w = bmp.Width;
int h = bmp.Height;
InitSize(w, h);
BitmapData bmpdata = bmp.LockBits(new sd.Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
BitmapData bmpdata = bmp.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
Color[] palette = bmp.Palette.Entries;
int* ptr = (int*)bmpdata.Scan0.ToPointer();
int stride = bmpdata.Stride;
@ -330,7 +330,7 @@ namespace BizHawk.Bizware.BizwareGL
int w = bmp.Width;
int h = bmp.Height;
InitSize(w, h);
BitmapData bmpdata = bmp.LockBits(new sd.Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed);
BitmapData bmpdata = bmp.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed);
Color[] palette = bmp.Palette.Entries;
byte* ptr = (byte*)bmpdata.Scan0.ToPointer();
fixed (int* pPtr = &Pixels[0])
@ -363,7 +363,7 @@ namespace BizHawk.Bizware.BizwareGL
int width = bmp.Width;
int height = bmp.Height;
InitSize(width, height);
BitmapData bmpdata = bmp.LockBits(new sd.Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
BitmapData bmpdata = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
int* ptr = (int*)bmpdata.Scan0;
int stride = bmpdata.Stride / 4;
LoadFrom(width, stride, height, (byte*)ptr, options);
@ -526,7 +526,7 @@ namespace BizHawk.Bizware.BizwareGL
}
//note: we lock it as 32bpp even if the bitmap is 24bpp so we can write to it more conveniently.
var bmpdata = bmp.LockBits(new sd.Rectangle(0, 0, Width, Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
var bmpdata = bmp.LockBits(new Rectangle(0, 0, Width, Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
if(bmpdata.Stride == bmpdata.Width*4)
Marshal.Copy(Pixels, 0, bmpdata.Scan0, Width * Height);

View File

@ -17,11 +17,14 @@ namespace BizHawk.Bizware.BizwareGL
Owner = gl;
}
readonly OpenTK.Graphics.Color4[] CornerColors = new OpenTK.Graphics.Color4[4] {
new OpenTK.Graphics.Color4(1.0f,1.0f,1.0f,1.0f),new OpenTK.Graphics.Color4(1.0f,1.0f,1.0f,1.0f),new OpenTK.Graphics.Color4(1.0f,1.0f,1.0f,1.0f),new OpenTK.Graphics.Color4(1.0f,1.0f,1.0f,1.0f)
readonly OpenTK.Graphics.Color4[] CornerColors =
{
new OpenTK.Graphics.Color4(1.0f,1.0f,1.0f,1.0f),
new OpenTK.Graphics.Color4(1.0f,1.0f,1.0f,1.0f),
new OpenTK.Graphics.Color4(1.0f,1.0f,1.0f,1.0f),
new OpenTK.Graphics.Color4(1.0f,1.0f,1.0f,1.0f)
};
public void SetCornerColor(int which, OpenTK.Graphics.Color4 color)
{
CornerColors[which] = color;
@ -41,15 +44,12 @@ namespace BizHawk.Bizware.BizwareGL
CurrentImageAttributes?.Dispose();
}
public void SetPipeline(Pipeline pipeline)
{
}
public void SetDefaultPipeline()
{
}
public void SetModulateColorWhite()
@ -72,14 +72,17 @@ namespace BizHawk.Bizware.BizwareGL
float b = color.B / 255.0f;
float a = color.A / 255.0f;
float[][] colorMatrixElements = {
float[][] colorMatrixElements =
{
new float[] {r, 0, 0, 0, 0},
new float[] {0, g, 0, 0, 0},
new float[] {0, 0, b, 0, 0},
new float[] {0, 0, 0, a, 0},
new float[] {0, 0, 0, 0, 1}};
new float[] {0, 0, 0, 0, 1}
ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements);
};
var colorMatrix = new ColorMatrix(colorMatrixElements);
CurrentImageAttributes.SetColorMatrix(colorMatrix,ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
}
@ -153,10 +156,8 @@ namespace BizHawk.Bizware.BizwareGL
public void RectFill(float x, float y, float w, float h)
{
}
public void DrawSubrect(Texture2d tex, float x, float y, float w, float h, float u0, float v0, float u1, float v1)
{
var tw = tex.Opaque as GDIPTextureWrapper;
@ -274,10 +275,8 @@ namespace BizHawk.Bizware.BizwareGL
unsafe void DrawInternal(Art art, float x, float y, float w, float h, bool fx, bool fy)
{
}
public bool IsActive { get; private set; }
public IGL Owner { get; }
public IGL Gdi => Owner;

View File

@ -3,7 +3,6 @@
//why this stupid assert on the blendstate. just set one by default, geeze.
using System;
using System.Diagnostics;
using OpenTK;
using OpenTK.Graphics.OpenGL;

View File

@ -14,7 +14,7 @@ namespace BizHawk.Bizware.BizwareGL
public StringRenderer(IGL owner, Stream xml, params Stream[] textures)
{
Owner = owner;
FontInfo = Cyotek.Drawing.BitmapFont.BitmapFontLoader.LoadFontFromXmlFile(xml);
FontInfo = BitmapFontLoader.LoadFontFromXmlFile(xml);
// load textures
for(int i=0;i<FontInfo.Pages.Length;i++)
@ -119,7 +119,7 @@ namespace BizHawk.Bizware.BizwareGL
public IGL Owner { get; }
private readonly Cyotek.Drawing.BitmapFont.BitmapFont FontInfo;
private readonly BitmapFont FontInfo;
private List<Texture2d> TexturePages = new List<Texture2d>();
}
}